Skip to content

Commit 7ccedf7

Browse files
committed
updates
1 parent 945eba1 commit 7ccedf7

File tree

4 files changed

+27
-30
lines changed

4 files changed

+27
-30
lines changed

components/api4ai/api4ai.app.mjs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,14 @@ export default {
1414
},
1515
},
1616
methods: {
17-
streamToBuffer(stream) {
18-
return new Promise((resolve, reject) => {
19-
const chunks = [];
20-
21-
stream.on("data", (chunk) => chunks.push(chunk));
22-
stream.on("end", () => resolve(Buffer.concat(chunks)));
23-
stream.on("error", reject);
24-
});
25-
},
2617
async makeRequest($, url, image, params = {}) {
2718
// Prepare form data.
2819
const form = new FormData();
2920
const {
3021
stream, metadata,
3122
} = await getFileStreamAndMetadata(image);
3223

33-
const buffer = await this.streamToBuffer(stream);
34-
form.append("image", buffer, {
24+
form.append("image", stream, {
3525
contentType: metadata.contentType,
3626
knownLength: metadata.size,
3727
filename: metadata.name,

components/elevenlabs/actions/add-voice/add-voice.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
const data = new FormData();
4646
if (description) data.append("description", description);
4747

48-
files.forEach(async (file) => {
48+
for (const file of files) {
4949
const {
5050
stream, metadata,
5151
} = await getFileStreamAndMetadata(file);
@@ -54,7 +54,7 @@ export default {
5454
knownLength: metadata.size,
5555
filename: metadata.name,
5656
});
57-
});
57+
}
5858

5959
if (labels) data.append("labels", labels);
6060
data.append("name", name);

components/transifex/actions/upload-file/upload-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default {
5959
},
6060
},
6161
methods: {
62-
asyncstreamToBuffer(stream) {
62+
async streamToBuffer(stream) {
6363
return new Promise((resolve, reject) => {
6464
const chunks = [];
6565

components/trello/actions/create-card/create-card.mjs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export default {
9393
type: "string",
9494
label: "File",
9595
description: "Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFlie.pdf).",
96+
optional: true,
9697
},
9798
mimeType: {
9899
propDefinition: [
@@ -240,22 +241,28 @@ export default {
240241
coordinates,
241242
};
242243

243-
const form = new FormData();
244-
const {
245-
stream, metadata,
246-
} = await getFileStreamAndMetadata(file);
247-
form.append("file", stream, {
248-
contentType: metadata.contentType,
249-
knownLength: metadata.size,
250-
filename: metadata.name,
251-
});
252-
253-
response = await this.app.createCard({
254-
$,
255-
params,
256-
headers: form.getHeaders(),
257-
data: form,
258-
});
244+
if (file) {
245+
const form = new FormData();
246+
const {
247+
stream, metadata,
248+
} = await getFileStreamAndMetadata(file);
249+
form.append("file", stream, {
250+
contentType: metadata.contentType,
251+
knownLength: metadata.size,
252+
filename: metadata.name,
253+
});
254+
response = await this.app.createCard({
255+
$,
256+
params,
257+
headers: form.getHeaders(),
258+
data: form,
259+
});
260+
} else {
261+
response = await this.app.createCard({
262+
$,
263+
params,
264+
});
265+
}
259266

260267
if (customFieldIds) {
261268
const customFieldItems = await this.getCustomFieldItems($);

0 commit comments

Comments
 (0)