Skip to content

Commit 78c7203

Browse files
committed
fix: todoist, xero_accounting_api, zip_archive_api
1 parent f03921e commit 78c7203

File tree

5 files changed

+33
-39
lines changed

5 files changed

+33
-39
lines changed

components/todoist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"dependencies": {
1313
"@pipedream/platform": "^3.1.0",
14-
"json-2-csv": "^3.15.1",
14+
"json-2-csv": "3.15.1",
1515
"query-string": "^7.1.3",
1616
"tmp-promise": "^3.0.3",
1717
"uuid": "^8.3.2"

components/xero_accounting_api/actions/upload-file/upload-file.mjs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@ import FormData from "form-data";
33
import {
44
axios, getFileStreamAndMetadata,
55
} from "@pipedream/platform";
6+
import xeroAccountingApi from "../../xero_accounting_api.app.mjs";
67

78
export default {
89
key: "xero_accounting_api-upload-file",
910
name: "Upload File",
10-
description: "Uploads a file to the specified document.",
11+
description: "Uploads a file to the specified document. [See the documentation](https://developer.xero.com/documentation/api/accounting/invoices#upload-attachment)",
1112
version: "1.0.0",
1213
type: "action",
1314
props: {
14-
xero_accounting_api: {
15-
type: "app",
16-
app: "xero_accounting_api",
17-
},
18-
tenant_id: {
19-
type: "string",
20-
description: "Id of the organization tenant to use on the Xero Accounting API. See [Get Tenant Connections](https://pipedream.com/@sergio/xero-accounting-api-get-tenant-connections-p_OKCzOgn/edit) for a workflow example on how to pull this data.",
15+
xeroAccountingApi,
16+
tenantId: {
17+
propDefinition: [
18+
xeroAccountingApi,
19+
"tenantId",
20+
],
2121
},
2222
filePathOrUrl: {
2323
type: "string",
2424
label: "File Path or URL",
2525
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
2626
},
27-
document_type: {
27+
documentType: {
28+
label: "Document Type",
2829
type: "string",
2930
description: "Document type of where the attachment will be sent to. This is used in as part of the Xero Account API endpoint where the request is sent against.",
3031
options: [
@@ -39,19 +40,13 @@ export default {
3940
"RepeatingInvoices",
4041
],
4142
},
42-
document_id: {
43+
documentId: {
44+
label: "Document ID",
4345
type: "string",
4446
description: "Xero identifier of the document where the attachment will be sent to.",
4547
},
4648
},
4749
async run({ $ }) {
48-
//See the API docs: https://developer.xero.com/documentation/api/invoices#upload-attachment
49-
//See a workflow example of this action: https://pipedream.com/@sergio/xero-accounting-api-upload-file-p_rvCqADQ/edit
50-
51-
if (!this.tenant_id) {
52-
throw new Error("Must provide tenant_id parameter.");
53-
}
54-
5550
const {
5651
stream, metadata,
5752
} = await getFileStreamAndMetadata(this.filePathOrUrl);
@@ -65,10 +60,10 @@ export default {
6560
//Sends the request against Xero Accounting API
6661
return await axios($, {
6762
method: "post",
68-
url: `https://api.xero.com/api.xro/2.0/${this.document_type}/${this.document_id}/Attachments/${metadata.name}`,
63+
url: `https://api.xero.com/api.xro/2.0/${this.documentType}/${this.documentId}/Attachments/${metadata.name}`,
6964
headers: {
70-
"Authorization": `Bearer ${this.xero_accounting_api.$auth.oauth_access_token}`,
71-
"xero-tenant-id": this.tenant_id,
65+
"Authorization": `Bearer ${this.xeroAccountingApi.$auth.oauth_access_token}`,
66+
"xero-tenant-id": this.tenantId,
7267
...data.getHeaders(),
7368
},
7469
data,

components/xero_accounting_api/xero_accounting_api.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
type: "string",
1111
label: "Tenant ID",
1212
description:
13-
"Id of the organization tenant to use on the Xero Accounting API. See [Get Tenant Connections](https://pipedream.com/@sergio/xero-accounting-api-get-tenant-connections-p_OKCzOgn/edit) for a workflow example on how to pull this data.",
13+
"Select an organization tenant to use, or provide a tenant ID",
1414
async options() {
1515
return this.getTenantsOpts();
1616
},

components/zip_archive_api/actions/compress-files/compress-files.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import app from "../../zip_archive_api.app.mjs";
22
import FormData from "form-data";
3-
import {
4-
getFileStreamAndMetadata, writeFile,
5-
} from "@pipedream/platform";
3+
import { getFileStreamAndMetadata } from "@pipedream/platform";
4+
import fs from "fs";
65

76
export default {
87
key: "zip_archive_api-compress-files",
@@ -63,7 +62,7 @@ export default {
6362
});
6463

6564
const tmpPath = `/tmp/${this.archiveName}`;
66-
await writeFile(tmpPath, response);
65+
fs.writeFileSync(tmpPath, response);
6766

6867
$.export("$summary", `Successfully compressed the files into '${tmpPath}'`);
6968

pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)