Skip to content

Commit e5adcbc

Browse files
committed
add: signaturit, signerx
1 parent d4150b2 commit e5adcbc

File tree

6 files changed

+43
-53
lines changed

6 files changed

+43
-53
lines changed

components/signaturit/actions/create-certified-email/create-certified-email.mjs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import FormData from "form-data";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import { TYPE_OPTIONS } from "../../common/constants.mjs";
4-
import {
5-
checkTmp,
6-
parseObject,
7-
} from "../../common/utils.mjs";
4+
import { parseObject } from "../../common/utils.mjs";
85
import signaturit from "../../signaturit.app.mjs";
96

107
export default {
118
key: "signaturit-create-certified-email",
129
name: "Create Certified Email",
1310
description: "Initiates the creation of a certified email. [See the documentation](https://docs.signaturit.com/api/latest#emails_create_email)",
14-
version: "0.0.1",
11+
version: "0.1.0",
1512
type: "action",
1613
props: {
1714
signaturit,
@@ -102,7 +99,14 @@ export default {
10299
if (this.attachments) {
103100
let j = 0;
104101
for (const file of parseObject(this.attachments)) {
105-
formData.append(`attachments[${j++}]`, fs.createReadStream(checkTmp(file)));
102+
const {
103+
stream, metadata,
104+
} = await getFileStreamAndMetadata(file);
105+
formData.append(`attachments[${j++}]`, stream, {
106+
contentType: metadata.contentType,
107+
knownLength: metadata.size,
108+
filename: metadata.name,
109+
});
106110
}
107111
}
108112
const response = await this.signaturit.createCertifiedEmail({

components/signaturit/actions/create-signature-request-from-template/create-signature-request-from-template.mjs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import FormData from "form-data";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import {
44
DELIVERY_TYPE_OPTIONS,
55
SIGNATURE_TYPE_OPTIONS,
66
SIGNING_MODE_OPTIONS,
77
} from "../../common/constants.mjs";
8-
import {
9-
checkTmp,
10-
parseObject,
11-
} from "../../common/utils.mjs";
8+
import { parseObject } from "../../common/utils.mjs";
129
import signaturit from "../../signaturit.app.mjs";
1310

1411
export default {
1512
key: "signaturit-create-signature-request-from-template",
1613
name: "Create Signature Request from Template",
1714
description: "Creates a signature request using a pre-existing template. [See the documentation](https://docs.signaturit.com/api/latest#signatures_create_signature)",
18-
version: "0.0.1",
15+
version: "0.1.0",
1916
type: "action",
2017
props: {
2118
signaturit,
@@ -213,7 +210,14 @@ export default {
213210
if (this.files) {
214211
let k = 0;
215212
for (const file of parseObject(this.files)) {
216-
formData.append(`files[${k++}]`, fs.createReadStream(checkTmp(file)));
213+
const {
214+
stream, metadata,
215+
} = await getFileStreamAndMetadata(file);
216+
formData.append(`files[${k++}]`, stream, {
217+
contentType: metadata.contentType,
218+
knownLength: metadata.size,
219+
filename: metadata.name,
220+
});
217221
}
218222
}
219223
const response = await this.signaturit.createSignatureRequest({

components/signaturit/package.json

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

components/signaturit/signaturit.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default {
3232
},
3333
attachments: {
3434
type: "string[]",
35-
label: "Attachments",
36-
description: "A list of paths to the files saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
35+
label: "Attachment File Paths or URLs",
36+
description: "The file(s) to attach. For each entry, provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
3737
},
3838
recipients: {
3939
type: "string[]",

components/signerx/actions/upload-package/upload-package.mjs

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,37 @@
11
import FormData from "form-data";
2-
import fs from "fs";
3-
import { checkTmp } from "../../common/utils.mjs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
43
import signerx from "../../signerx.app.mjs";
54

65
export default {
76
key: "signerx-upload-package",
87
name: "Upload Package",
98
description: "Quickly create a draft for a new package/document by uploading a file or providing a file_url to a PDF document. [See the documentation](https://documenter.getpostman.com/view/13877745/2sa3xv9kni)",
10-
version: "0.0.1",
9+
version: "0.1.0",
1110
type: "action",
1211
props: {
1312
signerx,
14-
documentType: {
13+
file: {
1514
type: "string",
16-
label: "Document Type",
17-
description: "whether you hava the file or an URL to the file.",
18-
options: [
19-
"file",
20-
"file_url",
21-
],
22-
reloadProps: true,
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.pdf`).",
2317
},
2418
name: {
2519
type: "string",
2620
label: "Name",
2721
description: "The name of the package/document",
2822
},
2923
},
30-
async additionalProps() {
31-
const props = {};
32-
props.file = (this.documentType === "file")
33-
? {
34-
type: "string",
35-
label: "File",
36-
description: "The path to the pdf file saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
37-
}
38-
: {
39-
type: "string",
40-
label: "File URL",
41-
description: "The URL to the file.",
42-
};
43-
return props;
44-
},
4524
async run({ $ }) {
4625
const data = new FormData();
47-
if (this.documentType === "file") {
48-
data.append("file", fs.createReadStream(checkTmp(this.file)));
49-
} else {
50-
data.append("file_url", this.file);
51-
}
26+
27+
const {
28+
stream, metadata,
29+
} = await getFileStreamAndMetadata(this.file);
30+
data.append("file", stream, {
31+
contentType: metadata.contentType,
32+
knownLength: metadata.size,
33+
filename: metadata.name,
34+
});
5235
data.append("name", this.name);
5336

5437
const response = await this.signerx.createDraftPackage({

components/signerx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/signerx",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream SignerX Components",
55
"main": "signerx.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.0",
16+
"@pipedream/platform": "^3.1.0",
1717
"form-data": "^4.0.0"
1818
}
1919
}

0 commit comments

Comments
 (0)