@pipedream/trello 0.4.1 → 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.
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import fs from "fs";
|
|
1
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
3
2
|
import FormData from "form-data";
|
|
4
3
|
import app from "../../trello.app.mjs";
|
|
5
4
|
|
|
@@ -7,7 +6,7 @@ export default {
|
|
|
7
6
|
key: "trello-add-attachment-to-card",
|
|
8
7
|
name: "Add Attachment To Card",
|
|
9
8
|
description: "Adds a file attachment on a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post)",
|
|
10
|
-
version: "
|
|
9
|
+
version: "1.0.1",
|
|
11
10
|
type: "action",
|
|
12
11
|
props: {
|
|
13
12
|
app,
|
|
@@ -36,33 +35,16 @@ export default {
|
|
|
36
35
|
"name",
|
|
37
36
|
],
|
|
38
37
|
},
|
|
39
|
-
fileType: {
|
|
40
|
-
propDefinition: [
|
|
41
|
-
app,
|
|
42
|
-
"fileType",
|
|
43
|
-
],
|
|
44
|
-
reloadProps: true,
|
|
45
|
-
},
|
|
46
|
-
url: {
|
|
47
|
-
propDefinition: [
|
|
48
|
-
app,
|
|
49
|
-
"url",
|
|
50
|
-
],
|
|
51
|
-
hidden: true,
|
|
52
|
-
},
|
|
53
38
|
file: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
hidden: true,
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "File Path or URL",
|
|
41
|
+
description: "Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf).",
|
|
59
42
|
},
|
|
60
43
|
mimeType: {
|
|
61
44
|
propDefinition: [
|
|
62
45
|
app,
|
|
63
46
|
"mimeType",
|
|
64
47
|
],
|
|
65
|
-
hidden: true,
|
|
66
48
|
},
|
|
67
49
|
setCover: {
|
|
68
50
|
type: "boolean",
|
|
@@ -71,21 +53,17 @@ export default {
|
|
|
71
53
|
default: false,
|
|
72
54
|
optional: true,
|
|
73
55
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
props.url.hidden = !attachmentIsUrl;
|
|
81
|
-
|
|
82
|
-
return {};
|
|
56
|
+
syncDir: {
|
|
57
|
+
type: "dir",
|
|
58
|
+
accessMode: "read",
|
|
59
|
+
sync: true,
|
|
60
|
+
optional: true,
|
|
61
|
+
},
|
|
83
62
|
},
|
|
84
63
|
async run({ $ }) {
|
|
85
64
|
const {
|
|
86
65
|
cardId,
|
|
87
66
|
name,
|
|
88
|
-
url,
|
|
89
67
|
mimeType,
|
|
90
68
|
setCover,
|
|
91
69
|
file,
|
|
@@ -98,32 +76,24 @@ export default {
|
|
|
98
76
|
setCover,
|
|
99
77
|
};
|
|
100
78
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (file) {
|
|
106
|
-
const form = new FormData();
|
|
107
|
-
form.append("file", fs.createReadStream(file));
|
|
79
|
+
const form = new FormData();
|
|
80
|
+
const {
|
|
81
|
+
stream, metadata,
|
|
82
|
+
} = await getFileStreamAndMetadata(file);
|
|
108
83
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
data: form,
|
|
115
|
-
});
|
|
84
|
+
form.append("file", stream, {
|
|
85
|
+
contentType: metadata.contentType,
|
|
86
|
+
knownLength: metadata.size,
|
|
87
|
+
filename: metadata.name,
|
|
88
|
+
});
|
|
116
89
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
}
|
|
90
|
+
response = await this.app.addAttachmentToCard({
|
|
91
|
+
$,
|
|
92
|
+
cardId,
|
|
93
|
+
params,
|
|
94
|
+
headers: form.getHeaders(),
|
|
95
|
+
data: form,
|
|
96
|
+
});
|
|
127
97
|
|
|
128
98
|
$.export("$summary", `Successfully added attachement to card ${cardId}`);
|
|
129
99
|
return response;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import app from "../../trello.app.mjs";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import FormData from "form-data";
|
|
4
|
-
import {
|
|
3
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
5
4
|
import constants from "../../common/constants.mjs";
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
key: "trello-create-card",
|
|
9
8
|
name: "Create Card",
|
|
10
9
|
description: "Creates a new card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post).",
|
|
11
|
-
version: "0.1
|
|
10
|
+
version: "1.0.1",
|
|
12
11
|
type: "action",
|
|
13
12
|
props: {
|
|
14
13
|
app,
|
|
@@ -90,34 +89,18 @@ export default {
|
|
|
90
89
|
description: "Array of labelIDs to add to the card",
|
|
91
90
|
optional: true,
|
|
92
91
|
},
|
|
93
|
-
fileType: {
|
|
94
|
-
propDefinition: [
|
|
95
|
-
app,
|
|
96
|
-
"fileType",
|
|
97
|
-
],
|
|
98
|
-
optional: true,
|
|
99
|
-
reloadProps: true,
|
|
100
|
-
},
|
|
101
|
-
urlSource: {
|
|
102
|
-
propDefinition: [
|
|
103
|
-
app,
|
|
104
|
-
"url",
|
|
105
|
-
],
|
|
106
|
-
hidden: true,
|
|
107
|
-
},
|
|
108
92
|
file: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
hidden: true,
|
|
93
|
+
type: "string",
|
|
94
|
+
label: "File Path or URL",
|
|
95
|
+
description: "Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf).",
|
|
96
|
+
optional: true,
|
|
114
97
|
},
|
|
115
98
|
mimeType: {
|
|
116
99
|
propDefinition: [
|
|
117
100
|
app,
|
|
118
101
|
"mimeType",
|
|
119
102
|
],
|
|
120
|
-
|
|
103
|
+
optional: true,
|
|
121
104
|
},
|
|
122
105
|
idCardSource: {
|
|
123
106
|
propDefinition: [
|
|
@@ -168,16 +151,16 @@ export default {
|
|
|
168
151
|
],
|
|
169
152
|
reloadProps: true,
|
|
170
153
|
},
|
|
154
|
+
syncDir: {
|
|
155
|
+
type: "dir",
|
|
156
|
+
accessMode: "read",
|
|
157
|
+
sync: true,
|
|
158
|
+
optional: true,
|
|
159
|
+
},
|
|
171
160
|
},
|
|
172
161
|
async additionalProps(existingProps) {
|
|
173
162
|
const props = {};
|
|
174
163
|
|
|
175
|
-
const attachmentIsPath = this.fileType === "path";
|
|
176
|
-
const attachmentIsUrl = this.fileType === "url";
|
|
177
|
-
existingProps.file.hidden = !attachmentIsPath;
|
|
178
|
-
existingProps.mimeType.hidden = !attachmentIsPath;
|
|
179
|
-
existingProps.urlSource.hidden = !attachmentIsUrl;
|
|
180
|
-
|
|
181
164
|
existingProps.keepFromSource.hidden = !this.idCardSource;
|
|
182
165
|
|
|
183
166
|
if (!this.customFieldIds?.length) {
|
|
@@ -237,7 +220,6 @@ export default {
|
|
|
237
220
|
idList,
|
|
238
221
|
idMembers,
|
|
239
222
|
idLabels,
|
|
240
|
-
urlSource,
|
|
241
223
|
mimeType,
|
|
242
224
|
file,
|
|
243
225
|
idCardSource,
|
|
@@ -266,14 +248,16 @@ export default {
|
|
|
266
248
|
coordinates,
|
|
267
249
|
};
|
|
268
250
|
|
|
269
|
-
if (file && !file?.startsWith("/tmp")) {
|
|
270
|
-
throw new ConfigurationError("The file path must be in the `/tmp` directory");
|
|
271
|
-
}
|
|
272
|
-
|
|
273
251
|
if (file) {
|
|
274
252
|
const form = new FormData();
|
|
275
|
-
|
|
276
|
-
|
|
253
|
+
const {
|
|
254
|
+
stream, metadata,
|
|
255
|
+
} = await getFileStreamAndMetadata(file);
|
|
256
|
+
form.append("fileSource", stream, {
|
|
257
|
+
contentType: metadata.contentType,
|
|
258
|
+
knownLength: metadata.size,
|
|
259
|
+
filename: metadata.name,
|
|
260
|
+
});
|
|
277
261
|
response = await this.app.createCard({
|
|
278
262
|
$,
|
|
279
263
|
params,
|
|
@@ -283,10 +267,7 @@ export default {
|
|
|
283
267
|
} else {
|
|
284
268
|
response = await this.app.createCard({
|
|
285
269
|
$,
|
|
286
|
-
params
|
|
287
|
-
...params,
|
|
288
|
-
urlSource,
|
|
289
|
-
},
|
|
270
|
+
params,
|
|
290
271
|
});
|
|
291
272
|
}
|
|
292
273
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/trello",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Pipedream Trello Components",
|
|
5
5
|
"main": "trello.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"homepage": "https://pipedream.com/apps/trello",
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@pipedream/platform": "^3.0
|
|
13
|
+
"@pipedream/platform": "^3.1.0",
|
|
14
14
|
"crypto": "^1.0.1",
|
|
15
15
|
"form-data": "^4.0.0",
|
|
16
16
|
"lodash-es": "^4.17.21",
|