Skip to content

Commit 91bf402

Browse files
committed
add: signnow, smugmug, sonix
1 parent e5adcbc commit 91bf402

File tree

6 files changed

+44
-44
lines changed

6 files changed

+44
-44
lines changed

components/signnow/actions/upload-document-with-tags/upload-document-with-tags.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import fs from "fs";
21
import FormData from "form-data";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import app from "../../signnow.app.mjs";
44

55
export default {
66
key: "signnow-upload-document-with-tags",
77
name: "Upload Document With Tags",
88
description: "Uploads a file that contains SignNow text tags. [See the documentation](https://docs.signnow.com/docs/signnow/document/operations/create-a-document-fieldextract)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
app,
1313
file: {
1414
type: "string",
15-
label: "File Path",
16-
description: "File path of a file previously downloaded in Pipedream E.g. (`/tmp/my-file.pdf`). [Download a file to the `/tmp` directory](https://pipedream.com/docs/code/nodejs/http-requests/#download-a-file-to-the-tmp-directory)",
15+
label: "File Path or URL",
16+
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`).",
1717
},
1818
},
1919
methods: {
@@ -37,7 +37,14 @@ export default {
3737
} = this;
3838

3939
const data = new FormData();
40-
data.append("file", fs.createReadStream(file));
40+
const {
41+
stream, metadata,
42+
} = await getFileStreamAndMetadata(file);
43+
data.append("file", stream, {
44+
contentType: metadata.contentType,
45+
knownLength: metadata.size,
46+
filename: metadata.name,
47+
});
4148

4249
const response = await uploadDocumentWithTags({
4350
$,

components/signnow/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/signnow",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream signNow Components",
55
"main": "signnow.app.mjs",
66
"keywords": [
@@ -13,10 +13,9 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.0",
16+
"@pipedream/platform": "^3.1.0",
1717
"crypto": "^1.0.1",
1818
"form-data": "^4.0.0",
19-
"fs": "^0.0.1-security",
2019
"uuid": "^10.0.0"
2120
}
2221
}

components/smugmug/actions/upload-image/upload-image.mjs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import smugmug from "../../smugmug.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "smugmug-upload-image",
77
name: "Upload Image",
88
description: "Uploads an image to a SmugMug album. [See the docs here](https://api.smugmug.com/services/api/?method=upload)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
smugmug,
@@ -19,8 +19,8 @@ export default {
1919
},
2020
filePath: {
2121
type: "string",
22-
label: "File Path",
23-
description: "The path to the image file saved to the [`/tmp`directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)(e.g. `/tmp/image.png`).",
22+
label: "File Path or URL",
23+
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`).",
2424
},
2525
},
2626
async run({ $ }) {
@@ -32,8 +32,14 @@ export default {
3232
const albumUri = album.Response.Uri;
3333

3434
const data = new FormData();
35-
const file = fs.createReadStream(this.filePath);
36-
data.append("file", file);
35+
const {
36+
stream, metadata,
37+
} = await getFileStreamAndMetadata(this.filePath);
38+
data.append("file", stream, {
39+
contentType: metadata.contentType,
40+
knownLength: metadata.size,
41+
filename: metadata.name,
42+
});
3743

3844
const response = await this.smugmug.uploadImage(filename, albumUri, data, $);
3945
if (response.stat === "ok") {

components/smugmug/package.json

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

components/sonix/actions/upload-media/upload-media.mjs

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
1-
import { ConfigurationError } from "@pipedream/platform";
1+
import { getFileStreamAndMetadata } from "@pipedream/platform";
22
import FormData from "form-data";
3-
import fs from "fs";
43
import { LANGUAGE_OPTIONS } from "../../common/constants.mjs";
5-
import { checkTmp } from "../../common/utils.mjs";
64
import sonix from "../../sonix.app.mjs";
75

86
export default {
97
key: "sonix-upload-media",
108
name: "Upload Media",
119
description: "Submits new media for processing. [See the documentation](https://sonix.ai/docs/api#new_media)",
12-
version: "0.0.1",
10+
version: "1.0.0",
1311
type: "action",
1412
props: {
1513
sonix,
1614
file: {
1715
type: "string",
18-
label: "File",
19-
description: "Path of the audio or video file in /tmp folder. The limit is 100MB using this parameter. For larger files, use **File URL**. `NOTE: Only one of **File** or **File URL** is required.` To upload a file to /tmp folder, please follow the [doc here](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
20-
optional: true,
21-
},
22-
fileUrl: {
23-
type: "string",
24-
label: "File URL",
25-
description: "URL pointing to the audio/video file. `NOTE: Only one of **File** or **File URL** is required.`",
26-
optional: true,
16+
label: "File Path or URL",
17+
description: "The audio or video file to upload (max 100MB). Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
2718
},
2819
language: {
2920
type: "string",
@@ -70,18 +61,17 @@ export default {
7061
},
7162
},
7263
async run({ $ }) {
73-
if (!this.file && !this.fileUrl) {
74-
throw new ConfigurationError("You must provite whether **File** or **File URL**.");
75-
}
76-
7764
const formData = new FormData();
7865

79-
if (this.file) {
80-
const filePath = checkTmp(this.file);
81-
formData.append("file", fs.createReadStream(filePath));
82-
}
66+
const {
67+
stream, metadata,
68+
} = await getFileStreamAndMetadata(this.file);
69+
formData.append("file", stream, {
70+
contentType: metadata.contentType,
71+
knownLength: metadata.size,
72+
filename: metadata.name,
73+
});
8374

84-
this.fileUrl && formData.append("file_url", this.fileUrl);
8575
this.language && formData.append("language", this.language);
8676
this.name && formData.append("name", this.name);
8777
this.transcriptText && formData.append("transcript_text", `${this.transcriptText}`);

components/sonix/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sonix",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "Pipedream Sonix Components",
55
"main": "sonix.app.mjs",
66
"keywords": [
@@ -13,8 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.5.1",
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
}

0 commit comments

Comments
 (0)