@pipedream/todoist 0.1.4 → 0.2.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.
@@ -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.3",
10
+ version: "0.1.1",
11
11
  type: "action",
12
12
  props: {
13
13
  todoist,
@@ -17,6 +17,11 @@ export default {
17
17
  "project",
18
18
  ],
19
19
  },
20
+ syncDir: {
21
+ type: "dir",
22
+ accessMode: "write",
23
+ sync: true,
24
+ },
20
25
  },
21
26
  async run ({ $ }) {
22
27
  const { project } = this;
@@ -27,7 +32,7 @@ export default {
27
32
  project_id: project,
28
33
  },
29
34
  });
30
- const csv = await converter.json2csvAsync(tasks);
35
+ const csv = converter.json2csv(tasks);
31
36
 
32
37
  const { path } = await file({
33
38
  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.3",
9
+ version: "0.1.1",
10
10
  type: "action",
11
11
  props: {
12
12
  todoist,
@@ -23,6 +23,12 @@ export default {
23
23
  ],
24
24
  description: "Project to import tasks into",
25
25
  },
26
+ syncDir: {
27
+ type: "dir",
28
+ accessMode: "read",
29
+ sync: true,
30
+ optional: true,
31
+ },
26
32
  },
27
33
  methods: {
28
34
  exportSummary($, tasks) {
@@ -37,8 +43,13 @@ export default {
37
43
  project,
38
44
  } = this;
39
45
 
40
- const fileContents = (await fs.promises.readFile(path)).toString();
41
- const tasks = await converter.csv2jsonAsync(fileContents);
46
+ const stream = await getFileStream(path);
47
+ const chunks = [];
48
+ for await (const chunk of stream) {
49
+ chunks.push(chunk);
50
+ }
51
+ const fileContents = Buffer.concat(chunks).toString();
52
+ const tasks = converter.csv2json(fileContents);
42
53
  // CREATE TASKS
43
54
  const data = tasks.map((task) => ({
44
55
  content: task.content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/todoist",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
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.3",
14
- "json-2-csv": "^3.15.1",
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: "Path to .csv file containing task data. Enter a static value (e.g., `/tmp/myFile.csv`) or reference prior step exports via the `steps` object (e.g., `{{steps.export_tasks.$return_value}}`).",
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: {