Skip to content

Commit 14881d4

Browse files
committed
fix: todoist, zoho_bugtracker
1 parent 78c7203 commit 14881d4

File tree

7 files changed

+12
-49
lines changed

7 files changed

+12
-49
lines changed

components/todoist/actions/export-tasks/export-tasks.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "todoist-export-tasks",
88
name: "Export Tasks",
99
description: "Export project task names as comma separated file. Returns path to new file. [See Docs](https://developer.todoist.com/rest/v2/#get-active-tasks)",
10-
version: "0.0.3",
10+
version: "0.1.0",
1111
type: "action",
1212
props: {
1313
todoist,
@@ -27,7 +27,7 @@ export default {
2727
project_id: project,
2828
},
2929
});
30-
const csv = await converter.json2csvAsync(tasks);
30+
const csv = converter.json2csv(tasks);
3131

3232
const { path } = await file({
3333
postfix: ".csv",

components/todoist/actions/import-tasks/import-tasks.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default {
4343
chunks.push(chunk);
4444
}
4545
const fileContents = Buffer.concat(chunks).toString();
46-
const tasks = await converter.csv2jsonAsync(fileContents);
46+
const tasks = converter.csv2json(fileContents);
4747
// CREATE TASKS
4848
const data = tasks.map((task) => ({
4949
content: task.content,

components/todoist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"dependencies": {
1313
"@pipedream/platform": "^3.1.0",
14-
"json-2-csv": "3.15.1",
14+
"json-2-csv": "^5.5.9",
1515
"query-string": "^7.1.3",
1616
"tmp-promise": "^3.0.3",
1717
"uuid": "^8.3.2"

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import FormData from "form-data";
2-
import {
3-
clearObj, getUploadContentType,
4-
} from "../../common/utils.mjs";
2+
import { clearObj } from "../../common/utils.mjs";
53
import { getFileStreamAndMetadata } from "@pipedream/platform";
64
import zohoBugtracker from "../../zoho_bugtracker.app.mjs";
75

@@ -211,11 +209,11 @@ export default {
211209
const filename = metadata.name;
212210
formData.append("uploaddoc", stream, {
213211
filename,
214-
contentType: getUploadContentType(metadata.name),
212+
contentType: metadata.contentType,
215213
knownLength: metadata.size,
216214
header: [
217215
`Content-Disposition: form-data; name="uploaddoc"; filename="${filename}"`,
218-
`Content-Type: ${getUploadContentType(filename)}`,
216+
`Content-Type: ${metadata.contentType}`,
219217
],
220218
});
221219
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import FormData from "form-data";
2-
import {
3-
clearObj, getUploadContentType,
4-
} from "../../common/utils.mjs";
2+
import { clearObj } from "../../common/utils.mjs";
53
import { getFileStreamAndMetadata } from "@pipedream/platform";
64
import zohoBugtracker from "../../zoho_bugtracker.app.mjs";
75

@@ -232,11 +230,11 @@ export default {
232230
const filename = metadata.name;
233231
formData.append("uploaddoc", stream, {
234232
filename,
235-
contentType: getUploadContentType(metadata.name),
233+
contentType: metadata.contentType,
236234
knownLength: metadata.size,
237235
header: [
238236
`Content-Disposition: form-data; name="uploaddoc"; filename="${filename}"`,
239-
`Content-Type: ${getUploadContentType(filename)}`,
237+
`Content-Type: ${metadata.contentType}`,
240238
],
241239
});
242240
}

components/zoho_bugtracker/common/utils.mjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ConfigurationError } from "@pipedream/platform";
21
/* eslint-disable no-unused-vars */
32
export const clearObj = (obj) => {
43
return Object.entries(obj)
@@ -19,14 +18,3 @@ export const clearObj = (obj) => {
1918
{},
2019
);
2120
};
22-
23-
export const getUploadContentType = (filename) => {
24-
const fileExt = filename.split(".").pop();
25-
switch (fileExt.toLowerCase()) {
26-
case "png": return "image/png";
27-
case "jpg": return "image/jpeg";
28-
case "jpeg": return "image/jpeg";
29-
case "gif": return "image/gif";
30-
default: throw ConfigurationError("Only `.jpg`, `.jpeg`, `.png`, and `.gif` may be used at this time. Other file types are not supported.");
31-
}
32-
};

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)