@pipedream/todoist 0.1.4 → 0.2.0
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.
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "todoist-export-tasks",
|
|
8
8
|
name: "Export Tasks",
|
|
9
9
|
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
|
|
10
|
+
version: "0.1.0",
|
|
11
11
|
type: "action",
|
|
12
12
|
props: {
|
|
13
13
|
todoist,
|
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
project_id: project,
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
|
-
const csv =
|
|
30
|
+
const csv = converter.json2csv(tasks);
|
|
31
31
|
|
|
32
32
|
const { path } = await file({
|
|
33
33
|
postfix: ".csv",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import todoist from "../../todoist.app.mjs";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import converter from "json-2-csv";
|
|
3
|
+
import { getFileStream } from "@pipedream/platform";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
key: "todoist-import-tasks",
|
|
7
7
|
name: "Import Tasks",
|
|
8
8
|
description: "Import tasks into a selected project. [See Docs](https://developer.todoist.com/sync/v9/#add-an-item)",
|
|
9
|
-
version: "0.0
|
|
9
|
+
version: "0.1.0",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
todoist,
|
|
@@ -37,8 +37,13 @@ export default {
|
|
|
37
37
|
project,
|
|
38
38
|
} = this;
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
const
|
|
40
|
+
const stream = await getFileStream(path);
|
|
41
|
+
const chunks = [];
|
|
42
|
+
for await (const chunk of stream) {
|
|
43
|
+
chunks.push(chunk);
|
|
44
|
+
}
|
|
45
|
+
const fileContents = Buffer.concat(chunks).toString();
|
|
46
|
+
const tasks = converter.csv2json(fileContents);
|
|
42
47
|
// CREATE TASKS
|
|
43
48
|
const data = tasks.map((task) => ({
|
|
44
49
|
content: task.content,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/todoist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pipedream Todoist Components",
|
|
5
5
|
"main": "todoist.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"homepage": "https://pipedream.com/apps/todoist",
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@pipedream/platform": "^3.0
|
|
14
|
-
"json-2-csv": "^
|
|
13
|
+
"@pipedream/platform": "^3.1.0",
|
|
14
|
+
"json-2-csv": "^5.5.9",
|
|
15
15
|
"query-string": "^7.1.3",
|
|
16
16
|
"tmp-promise": "^3.0.3",
|
|
17
17
|
"uuid": "^8.3.2"
|
package/todoist.app.mjs
CHANGED
|
@@ -255,8 +255,8 @@ export default {
|
|
|
255
255
|
},
|
|
256
256
|
path: {
|
|
257
257
|
type: "string",
|
|
258
|
-
label: "File Path",
|
|
259
|
-
description: "
|
|
258
|
+
label: "File Path or URL",
|
|
259
|
+
description: "The .csv file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.csv`)",
|
|
260
260
|
},
|
|
261
261
|
},
|
|
262
262
|
methods: {
|