Skip to content

Commit fe3bb7e

Browse files
committed
add: stannp, zamzar, zoho_desk
1 parent 5624c24 commit fe3bb7e

File tree

11 files changed

+34
-46
lines changed

11 files changed

+34
-46
lines changed

components/stannp/actions/create-campaign/create-campaign.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "stannp-create-campaign",
1010
name: "Create a New Campaign",
1111
description: "Create a new campaign in Stannp. [See the documentation](https://www.stannp.com/us/direct-mail-api/campaigns)",
12-
version: "0.0.1",
12+
version: "0.1.0",
1313
type: "action",
1414
props: {
1515
stannp,
@@ -58,22 +58,22 @@ export default {
5858
},
5959
file: {
6060
type: "string",
61-
label: "File",
62-
description: "A single or multi-page PDF file to use as the design artwork. can be a URL or a path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp). Make sure the image is in the correct format.",
61+
label: "PDF File Path or URL",
62+
description: "A PDF file to use as the design artwork. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`)",
6363
optional: true,
6464
reloadProps: true,
6565
},
6666
front: {
6767
type: "string",
68-
label: "Front",
69-
description: "A PDF or JPG file to use as the front image. Can be a URL or a path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp). Make sure the image is in the correct format.",
68+
label: "Front Image Path or URL",
69+
description: "A PDF or JPG file to use as the front image. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.jpg`)",
7070
optional: true,
7171
reloadProps: true,
7272
},
7373
back: {
7474
type: "string",
75-
label: "Back",
76-
description: "A PDF or JPG file to use as the back image. Can be a URL or a path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp). Make sure the image is in the correct format.",
75+
label: "Back Image Path or URL",
76+
description: "A PDF or JPG file to use as the back image. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.jpg`)",
7777
optional: true,
7878
reloadProps: true,
7979
},

components/stannp/common/utils.mjs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import fs from "fs";
21
import urlExists from "url-exist";
2+
import { getFileStream } from "@pipedream/platform";
33

44
export const parseObject = (obj) => {
55
if (Array.isArray(obj)) {
@@ -24,13 +24,6 @@ export const checkFile = async (url) => {
2424
if (await urlExists(url)) {
2525
return url;
2626
} else {
27-
return fs.createReadStream(checkTmp(url));
27+
return getFileStream(url);
2828
}
2929
};
30-
31-
const checkTmp = (filename) => {
32-
if (!filename.startsWith("/tmp")) {
33-
return `/tmp/${filename}`;
34-
}
35-
return filename;
36-
};

components/stannp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/stannp",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Stannp Components",
55
"main": "stannp.app.mjs",
66
"keywords": [
@@ -13,8 +13,8 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16+
"@pipedream/platform": "^3.1.0",
1617
"form-data": "^4.0.0",
17-
"fs": "^0.0.1-security",
1818
"url-exist": "^3.0.1"
1919
}
2020
}

components/zamzar/actions/start-job-from-file/start-job-from-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "zamzar-start-job-from-file",
66
name: "Start Job From File",
77
description: "Starts a conversion job and upload a source file in a single request. [See the documentation](https://developers.zamzar.com/docs)",
8-
version: "0.0.2",
8+
version: "0.1.0",
99
type: "action",
1010
props: {
1111
app,

components/zamzar/common/utils.mjs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import { createReadStream } from "fs";
1+
import { getFileStream } from "@pipedream/platform";
22
import FormData from "form-data";
33
import constants from "./constants.mjs";
44

5-
function buildFormData(formData, data, parentKey) {
5+
async function buildFormData(formData, data, parentKey) {
66
if (data && typeof(data) === "object") {
7-
Object.keys(data)
8-
.forEach(async (key) => {
9-
buildFormData(formData, data[key], parentKey && `${parentKey}[${key}]` || key);
10-
});
11-
7+
for (const key of Object.keys(data)) {
8+
await buildFormData(formData, data[key], parentKey && `${parentKey}[${key}]` || key);
9+
}
1210
} else if (data && constants.FILE_PROP_NAMES.some((prop) => parentKey.includes(prop))) {
13-
formData.append(parentKey, createReadStream(data));
14-
11+
formData.append(parentKey, await getFileStream(data));
1512
} else if (data) {
1613
formData.append(parentKey, (data).toString());
1714
}

components/zamzar/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zamzar",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"description": "Pipedream Zamzar Components",
55
"main": "zamzar.app.mjs",
66
"keywords": [
@@ -13,8 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.6.2",
17-
"form-data": "^4.0.0",
18-
"fs": "^0.0.1-security"
16+
"@pipedream/platform": "^3.1.0",
17+
"form-data": "^4.0.0"
1918
}
2019
}

components/zamzar/zamzar.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export default {
88
propDefinitions: {
99
sourceFile: {
1010
type: "string",
11-
label: "Source File",
12-
description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
11+
label: "Source File Path or URL",
12+
description: "The file to convert. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
1313
},
1414
targetFormat: {
1515
type: "string",

components/zoho_desk/actions/add-ticket-attachment/add-ticket-attachment.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "Add Ticket Attachment",
77
description: "Attaches a file to a ticket. [See the docs here](https://desk.zoho.com/DeskAPIDocument#TicketAttachments#TicketAttachments_CreateTicketattachment)",
88
type: "action",
9-
version: "0.0.2",
9+
version: "0.1.0",
1010
props: {
1111
zohoDesk,
1212
orgId: {
@@ -32,8 +32,8 @@ export default {
3232
},
3333
file: {
3434
type: "string",
35-
label: "File",
36-
description: "File path of a file previously downloaded in Pipedream E.g. (`/tmp/my-file.txt`). [Download a file to the `/tmp` directory](https://pipedream.com/docs/code/nodejs/http-requests/#download-a-file-to-the-tmp-directory)",
35+
label: "File Path or URL",
36+
description: "The file to attach. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
3737
},
3838
},
3939
async run({ $ }) {

components/zoho_desk/common/utils.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createReadStream } from "fs";
1+
import { getFileStream } from "@pipedream/platform";
22
import FormData from "form-data";
33
import retry from "async-retry";
44
import constants from "./constants.mjs";
@@ -19,7 +19,7 @@ function buildFormData(formData, data, parentKey) {
1919
});
2020

2121
} else if (data && constants.FILE_PROP_NAMES.some((prop) => parentKey.includes(prop))) {
22-
formData.append(parentKey, createReadStream(data));
22+
formData.append(parentKey, getFileStream(data));
2323

2424
} else if (data) {
2525
formData.append(parentKey, (data).toString());

components/zoho_desk/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zoho_desk",
3-
"version": "0.0.4",
3+
"version": "0.1.0",
44
"description": "Pipedream Zoho_desk Components",
55
"main": "zoho_desk.app.mjs",
66
"keywords": [
@@ -10,10 +10,9 @@
1010
"homepage": "https://pipedream.com/apps/zoho_desk",
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"dependencies": {
13-
"@pipedream/platform": "^1.6.2",
13+
"@pipedream/platform": "^3.1.0",
1414
"async-retry": "^1.3.3",
15-
"form-data": "^4.0.0",
16-
"fs": "^0.0.1-security"
15+
"form-data": "^4.0.0"
1716
},
1817
"publishConfig": {
1918
"access": "public"

0 commit comments

Comments
 (0)