Skip to content

Commit 43a3eed

Browse files
committed
add: zoho_bugtracker
1 parent 8636bd2 commit 43a3eed

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

components/zoho_bugtracker/actions/create-bug/create-bug.mjs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import FormData from "form-data";
2-
import fs from "fs";
32
import {
43
clearObj, getUploadContentType,
54
} from "../../common/utils.mjs";
5+
import { getFileStreamAndMetadata } from "@pipedream/platform";
66
import zohoBugtracker from "../../zoho_bugtracker.app.mjs";
77

88
export default {
99
key: "zoho_bugtracker-create-bug",
1010
name: "Create Bug",
11-
version: "0.0.1",
11+
version: "0.1.0",
1212
description: "Create a new bug [See the documentation](https://www.zoho.com/projects/help/rest-api/bugtracker-bugs-api.html#alink3)",
1313
type: "action",
1414
props: {
@@ -205,11 +205,14 @@ export default {
205205
}
206206

207207
if (uploaddoc) {
208-
209-
const file = fs.createReadStream(uploaddoc);
210-
const filename = uploaddoc.split("/").pop();
211-
212-
formData.append("uploaddoc", file, {
208+
const {
209+
stream, metadata,
210+
} = await getFileStreamAndMetadata(uploaddoc);
211+
const filename = metadata.name;
212+
formData.append("uploaddoc", stream, {
213+
filename,
214+
contentType: getUploadContentType(metadata.name),
215+
knownLength: metadata.size,
213216
header: [
214217
`Content-Disposition: form-data; name="uploaddoc"; filename="${filename}"`,
215218
`Content-Type: ${getUploadContentType(filename)}`,

components/zoho_bugtracker/actions/update-bug/update-bug.mjs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import FormData from "form-data";
2-
import fs from "fs";
32
import {
43
clearObj, getUploadContentType,
54
} from "../../common/utils.mjs";
5+
import { getFileStreamAndMetadata } from "@pipedream/platform";
66
import zohoBugtracker from "../../zoho_bugtracker.app.mjs";
77

88
export default {
99
key: "zoho_bugtracker-update-bug",
1010
name: "Update Bug",
11-
version: "0.0.1",
11+
version: "0.1.0",
1212
description: "Update a specific bug [See the documentation](https://www.zoho.com/projects/help/rest-api/bugtracker-bugs-api.html#alink4)",
1313
type: "action",
1414
props: {
@@ -226,11 +226,14 @@ export default {
226226
}
227227

228228
if (uploaddoc) {
229-
230-
const file = fs.createReadStream(uploaddoc);
231-
const filename = uploaddoc.split("/").pop();
232-
233-
formData.append("uploaddoc", file, {
229+
const {
230+
stream, metadata,
231+
} = await getFileStreamAndMetadata(uploaddoc);
232+
const filename = metadata.name;
233+
formData.append("uploaddoc", stream, {
234+
filename,
235+
contentType: getUploadContentType(metadata.name),
236+
knownLength: metadata.size,
234237
header: [
235238
`Content-Disposition: form-data; name="uploaddoc"; filename="${filename}"`,
236239
`Content-Type: ${getUploadContentType(filename)}`,
@@ -249,7 +252,7 @@ export default {
249252
},
250253
});
251254

252-
$.export("$summary", `A bug with Id: ${bugId} was successfully updated!`);
255+
$.export("$summary", `Successfully updated bug with Id: ${bugId}!`);
253256
return response;
254257
},
255258
};

components/zoho_bugtracker/package.json

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

components/zoho_bugtracker/zoho_bugtracker.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ export default {
275275
},
276276
uploaddoc: {
277277
type: "string",
278-
label: "Upload Doc",
279-
description: "Please configure [Zoho Drive integration](https://help.zoho.com/portal/en/kb/projects/integration/zoho-apps/articles/zoho-workdrive-integration) to enable attachment for your Zoho BugTracker. The maximum size to upload a file is 128 MB. The path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [see docs here](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
278+
label: "Upload Doc File Path or URL",
279+
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`. Please configure [Zoho Drive integration](https://help.zoho.com/portal/en/kb/projects/integration/zoho-apps/articles/zoho-workdrive-integration) to enable attachment for your Zoho BugTracker. The maximum size to upload a file is 128 MB.",
280280
},
281281
},
282282
methods: {

pnpm-lock.yaml

Lines changed: 12 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)