@pipedream/pandadoc 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-document-attachment/create-document-attachment.mjs +18 -36
- package/actions/create-document-from-file/create-document-from-file.mjs +11 -19
- package/actions/download-document/download-document.mjs +6 -1
- package/actions/download-protected-document/download-protected-document.mjs +6 -1
- package/package.json +2 -2
- package/pandadoc.app.mjs +2 -2
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import app from "../../pandadoc.app.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
2
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
5
3
|
import FormData from "form-data";
|
|
6
4
|
|
|
7
5
|
export default {
|
|
@@ -9,7 +7,7 @@ export default {
|
|
|
9
7
|
name: "Create Document Attachment",
|
|
10
8
|
description: "Adds an attachment to a document. [See the documentation here](https://developers.pandadoc.com/reference/create-document-attachment)",
|
|
11
9
|
type: "action",
|
|
12
|
-
version: "0.
|
|
10
|
+
version: "0.1.1",
|
|
13
11
|
props: {
|
|
14
12
|
app,
|
|
15
13
|
documentId: {
|
|
@@ -29,41 +27,25 @@ export default {
|
|
|
29
27
|
label: "File Name",
|
|
30
28
|
description: "A name you want to set for a file in the system",
|
|
31
29
|
},
|
|
30
|
+
syncDir: {
|
|
31
|
+
type: "dir",
|
|
32
|
+
accessMode: "read",
|
|
33
|
+
sync: true,
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
32
36
|
},
|
|
33
37
|
methods: {
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} else if (fs.existsSync(filePath)) {
|
|
39
|
-
return filePath;
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
},
|
|
43
|
-
getFileStream(filePath) {
|
|
44
|
-
return fs.createReadStream(filePath);
|
|
45
|
-
},
|
|
46
|
-
getFileMeta(filePath) {
|
|
47
|
-
const stats = fs.statSync(filePath);
|
|
48
|
-
return {
|
|
49
|
-
name: path.basename(filePath),
|
|
50
|
-
size: stats.size,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
getFormData(file, fileName) {
|
|
54
|
-
const fileValidation = this.isValidFile(file);
|
|
55
|
-
if (!fileValidation) {
|
|
56
|
-
throw new ConfigurationError("`file` must be a valid file path!");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const fileMeta = this.getFileMeta(fileValidation);
|
|
60
|
-
const fileContent = this.getFileStream(fileValidation);
|
|
38
|
+
async getFormData(file, fileName) {
|
|
39
|
+
const {
|
|
40
|
+
stream, metadata,
|
|
41
|
+
} = await getFileStreamAndMetadata(file);
|
|
61
42
|
const data = new FormData();
|
|
62
|
-
|
|
63
|
-
data.append("file",
|
|
64
|
-
|
|
43
|
+
data.append("name", fileName || metadata.name);
|
|
44
|
+
data.append("file", stream, {
|
|
45
|
+
contentType: metadata.contentType,
|
|
46
|
+
knownLength: metadata.size,
|
|
47
|
+
filename: metadata.name,
|
|
65
48
|
});
|
|
66
|
-
|
|
67
49
|
return data;
|
|
68
50
|
},
|
|
69
51
|
},
|
|
@@ -74,7 +56,7 @@ export default {
|
|
|
74
56
|
fileName,
|
|
75
57
|
} = this;
|
|
76
58
|
|
|
77
|
-
const data = this.getFormData(file, fileName);
|
|
59
|
+
const data = await this.getFormData(file, fileName);
|
|
78
60
|
|
|
79
61
|
const response = await this.app.createDocumentAttachments({
|
|
80
62
|
$,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "Create Document From File",
|
|
8
8
|
description: "Create a document from a file or public file URL. [See the documentation here](https://developers.pandadoc.com/reference/create-document-from-pdf)",
|
|
9
9
|
type: "action",
|
|
10
|
-
version: "
|
|
10
|
+
version: "1.0.1",
|
|
11
11
|
props: {
|
|
12
12
|
app,
|
|
13
13
|
name: {
|
|
@@ -27,13 +27,6 @@ export default {
|
|
|
27
27
|
app,
|
|
28
28
|
"file",
|
|
29
29
|
],
|
|
30
|
-
optional: true,
|
|
31
|
-
},
|
|
32
|
-
fileUrl: {
|
|
33
|
-
type: "string",
|
|
34
|
-
label: "File URL",
|
|
35
|
-
description: "A public file URL to use instead of a local file.",
|
|
36
|
-
optional: true,
|
|
37
30
|
},
|
|
38
31
|
documentFolderId: {
|
|
39
32
|
propDefinition: [
|
|
@@ -48,6 +41,12 @@ export default {
|
|
|
48
41
|
\nE.g. \`{ "name": { "value": "Jane", "role": "user" }, "like": { "value": true, "role": "user" } }\``,
|
|
49
42
|
optional: true,
|
|
50
43
|
},
|
|
44
|
+
syncDir: {
|
|
45
|
+
type: "dir",
|
|
46
|
+
accessMode: "read",
|
|
47
|
+
sync: true,
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
51
50
|
},
|
|
52
51
|
methods: createDocumentAttachment.methods,
|
|
53
52
|
async run({ $ }) {
|
|
@@ -55,7 +54,6 @@ export default {
|
|
|
55
54
|
name,
|
|
56
55
|
recipients,
|
|
57
56
|
file,
|
|
58
|
-
fileUrl,
|
|
59
57
|
documentFolderId,
|
|
60
58
|
} = this;
|
|
61
59
|
|
|
@@ -66,7 +64,7 @@ export default {
|
|
|
66
64
|
throw new ConfigurationError("**Error parsing recipients** - each must be a valid JSON-stringified object");
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
const json = {
|
|
70
68
|
name,
|
|
71
69
|
recipients: parsedRecipients,
|
|
72
70
|
folder_uuid: documentFolderId,
|
|
@@ -78,15 +76,9 @@ export default {
|
|
|
78
76
|
: this.fields;
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
data.url = fileUrl;
|
|
85
|
-
} else {
|
|
86
|
-
data = this.getFormData(file);
|
|
87
|
-
contentType = `multipart/form-data; boundary=${data._boundary}`;
|
|
88
|
-
data.append("data", JSON.stringify(json));
|
|
89
|
-
}
|
|
79
|
+
const data = await this.getFormData(file);
|
|
80
|
+
const contentType = `multipart/form-data; boundary=${data._boundary}`;
|
|
81
|
+
data.append("data", JSON.stringify(json));
|
|
90
82
|
|
|
91
83
|
const response = await this.app.createDocument({
|
|
92
84
|
$,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
description:
|
|
8
8
|
"Download a document as PDF. [See documentation here](https://developers.pandadoc.com/reference/download-document)",
|
|
9
9
|
type: "action",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.2",
|
|
11
11
|
props: {
|
|
12
12
|
app,
|
|
13
13
|
id: {
|
|
@@ -34,6 +34,11 @@ export default {
|
|
|
34
34
|
"separateFiles",
|
|
35
35
|
],
|
|
36
36
|
},
|
|
37
|
+
syncDir: {
|
|
38
|
+
type: "dir",
|
|
39
|
+
accessMode: "write",
|
|
40
|
+
sync: true,
|
|
41
|
+
},
|
|
37
42
|
},
|
|
38
43
|
additionalProps() {
|
|
39
44
|
return this.showWatermark
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
description:
|
|
8
8
|
"Download a completed document as a verifiable PDF. [See documentation here](https://developers.pandadoc.com/reference/download-protected-document)",
|
|
9
9
|
type: "action",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.2",
|
|
11
11
|
props: {
|
|
12
12
|
app,
|
|
13
13
|
id: {
|
|
@@ -28,6 +28,11 @@ export default {
|
|
|
28
28
|
"separateFiles",
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
|
+
syncDir: {
|
|
32
|
+
type: "dir",
|
|
33
|
+
accessMode: "write",
|
|
34
|
+
sync: true,
|
|
35
|
+
},
|
|
31
36
|
},
|
|
32
37
|
async run({ $ }) {
|
|
33
38
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/pandadoc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Pipedream PandaDoc Components",
|
|
5
5
|
"main": "pandadoc.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pipedream/platform": "^1.
|
|
17
|
+
"@pipedream/platform": "^3.1.0",
|
|
18
18
|
"form-data": "^4.0.0"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/pandadoc.app.mjs
CHANGED
|
@@ -88,8 +88,8 @@ export default {
|
|
|
88
88
|
},
|
|
89
89
|
file: {
|
|
90
90
|
type: "string",
|
|
91
|
-
label: "File",
|
|
92
|
-
description: "The file to upload
|
|
91
|
+
label: "File Path or URL",
|
|
92
|
+
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`)",
|
|
93
93
|
},
|
|
94
94
|
name: {
|
|
95
95
|
type: "string",
|