@pipedream/todoist 0.0.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.
- package/LICENSE +7 -0
- package/actions/create-filter/create-filter.mjs +66 -0
- package/actions/create-label/create-label.mjs +56 -0
- package/actions/create-project/create-project.mjs +57 -0
- package/actions/create-project-comment/create-project-comment.mjs +42 -0
- package/actions/create-section/create-section.mjs +49 -0
- package/actions/create-task/create-task.mjs +150 -0
- package/actions/create-task-comment/create-task-comment.mjs +51 -0
- package/actions/delete-comment/delete-comment.mjs +56 -0
- package/actions/delete-filter/delete-filter.mjs +30 -0
- package/actions/delete-label/delete-label.mjs +34 -0
- package/actions/delete-project/delete-project.mjs +34 -0
- package/actions/delete-section/delete-section.mjs +43 -0
- package/actions/delete-task/delete-task.mjs +44 -0
- package/actions/export-tasks/export-tasks.mjs +40 -0
- package/actions/find-project/find-project.mjs +51 -0
- package/actions/find-task/find-task.mjs +62 -0
- package/actions/find-user/find-user.mjs +28 -0
- package/actions/get-label/get-label.mjs +26 -0
- package/actions/get-project/get-project.mjs +26 -0
- package/actions/get-project-comment/get-project-comment.mjs +38 -0
- package/actions/get-section/get-section.mjs +38 -0
- package/actions/get-task/get-task.mjs +37 -0
- package/actions/get-task-comment/get-task-comment.mjs +47 -0
- package/actions/import-tasks/import-tasks.mjs +104 -0
- package/actions/invite-user-to-project/invite-user-to-project.mjs +40 -0
- package/actions/list-filters/list-filters.mjs +23 -0
- package/actions/list-labels/list-labels.mjs +21 -0
- package/actions/list-project-comments/list-project-comments.mjs +32 -0
- package/actions/list-projects/list-projects.mjs +22 -0
- package/actions/list-sections/list-sections.mjs +31 -0
- package/actions/list-task-comments/list-task-comments.mjs +40 -0
- package/actions/list-uncompleted-tasks/list-uncompleted-tasks.mjs +53 -0
- package/actions/mark-task-completed/mark-task-completed.mjs +43 -0
- package/actions/move-task-to-section/move-task-to-section.mjs +58 -0
- package/actions/uncomplete-task/uncomplete-task.mjs +42 -0
- package/actions/update-comment/update-comment.mjs +67 -0
- package/actions/update-filter/update-filter.mjs +76 -0
- package/actions/update-label/update-label.mjs +70 -0
- package/actions/update-project/update-project.mjs +62 -0
- package/actions/update-section/update-section.mjs +54 -0
- package/actions/update-task/update-task.mjs +126 -0
- package/colors.mjs +82 -0
- package/package.json +23 -0
- package/resource-types.mjs +15 -0
- package/sources/common-project.mjs +18 -0
- package/sources/common-task.mjs +38 -0
- package/sources/common.mjs +56 -0
- package/sources/completed-task/completed-task.mjs +17 -0
- package/sources/incomplete-task/incomplete-task.mjs +17 -0
- package/sources/new-or-modified-project/new-or-modified-project.mjs +10 -0
- package/sources/new-or-modified-task/new-or-modified-task.mjs +10 -0
- package/sources/new-project/new-project.mjs +11 -0
- package/sources/new-section/new-section.mjs +24 -0
- package/sources/new-task/new-task.mjs +11 -0
- package/sources/sync-resources/sync-resources.mjs +64 -0
- package/todoist.app.mjs +1105 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import todoist from "../../todoist.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "todoist-update-task",
|
|
5
|
+
name: "Update Task",
|
|
6
|
+
description: "Updates a task. [See the docs here](https://developer.todoist.com/rest/v1/#update-a-task)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
todoist,
|
|
11
|
+
project: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
todoist,
|
|
14
|
+
"project",
|
|
15
|
+
],
|
|
16
|
+
description: "The project containing the task to be updated",
|
|
17
|
+
},
|
|
18
|
+
task: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
todoist,
|
|
21
|
+
"task",
|
|
22
|
+
(c) => ({
|
|
23
|
+
project: c.project,
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
description: "The task to update",
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
propDefinition: [
|
|
30
|
+
todoist,
|
|
31
|
+
"content",
|
|
32
|
+
],
|
|
33
|
+
description: "Task Content",
|
|
34
|
+
},
|
|
35
|
+
description: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
todoist,
|
|
38
|
+
"description",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
labels: {
|
|
42
|
+
propDefinition: [
|
|
43
|
+
todoist,
|
|
44
|
+
"label",
|
|
45
|
+
],
|
|
46
|
+
type: "string[]",
|
|
47
|
+
description: "Labels associated with the task",
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
50
|
+
priority: {
|
|
51
|
+
propDefinition: [
|
|
52
|
+
todoist,
|
|
53
|
+
"priority",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
dueString: {
|
|
57
|
+
propDefinition: [
|
|
58
|
+
todoist,
|
|
59
|
+
"dueString",
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
dueDate: {
|
|
63
|
+
propDefinition: [
|
|
64
|
+
todoist,
|
|
65
|
+
"dueDate",
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
dueDatetime: {
|
|
69
|
+
propDefinition: [
|
|
70
|
+
todoist,
|
|
71
|
+
"dueDatetime",
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
dueLang: {
|
|
75
|
+
propDefinition: [
|
|
76
|
+
todoist,
|
|
77
|
+
"dueLang",
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
assignee: {
|
|
81
|
+
propDefinition: [
|
|
82
|
+
todoist,
|
|
83
|
+
"assignee",
|
|
84
|
+
(c) => ({
|
|
85
|
+
project: c.project,
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
async run ({ $ }) {
|
|
91
|
+
const {
|
|
92
|
+
task,
|
|
93
|
+
content,
|
|
94
|
+
description,
|
|
95
|
+
labels,
|
|
96
|
+
priority,
|
|
97
|
+
dueString,
|
|
98
|
+
dueDate,
|
|
99
|
+
dueDatetime,
|
|
100
|
+
dueLang,
|
|
101
|
+
assignee,
|
|
102
|
+
} = this;
|
|
103
|
+
const data = {
|
|
104
|
+
taskId: task,
|
|
105
|
+
content,
|
|
106
|
+
description,
|
|
107
|
+
label_ids: labels,
|
|
108
|
+
priority,
|
|
109
|
+
due_string: dueString,
|
|
110
|
+
due_date: dueDate,
|
|
111
|
+
due_datetime: dueDatetime,
|
|
112
|
+
due_lang: dueLang,
|
|
113
|
+
assignee,
|
|
114
|
+
};
|
|
115
|
+
// No interesting data is returned from Todoist
|
|
116
|
+
await this.todoist.updateTask({
|
|
117
|
+
$,
|
|
118
|
+
data,
|
|
119
|
+
});
|
|
120
|
+
$.export("$summary", "Successfully updated task");
|
|
121
|
+
return {
|
|
122
|
+
id: task,
|
|
123
|
+
success: true,
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
};
|
package/colors.mjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
label: "Berry Red",
|
|
4
|
+
value: 30,
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "Red",
|
|
8
|
+
value: 31,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "Orange",
|
|
12
|
+
value: 32,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Yellow",
|
|
16
|
+
value: 33,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Olive Green",
|
|
20
|
+
value: 34,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Lime Green",
|
|
24
|
+
value: 35,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Green",
|
|
28
|
+
value: 36,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Mint Green",
|
|
32
|
+
value: 37,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Teal",
|
|
36
|
+
value: 38,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Sky Blue",
|
|
40
|
+
value: 39,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Light Blue",
|
|
44
|
+
value: 40,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Blue",
|
|
48
|
+
value: 41,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Grape",
|
|
52
|
+
value: 42,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Violet",
|
|
56
|
+
value: 43,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Lavender",
|
|
60
|
+
value: 44,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "Magenta",
|
|
64
|
+
value: 45,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: "Salmon",
|
|
68
|
+
value: 46,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "Charcoal",
|
|
72
|
+
value: 47,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "Grey",
|
|
76
|
+
value: 48,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: "Taupe",
|
|
80
|
+
value: 49,
|
|
81
|
+
},
|
|
82
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipedream/todoist",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pipedream Todoist Components",
|
|
5
|
+
"main": "todoist.app.mjs",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pipedream",
|
|
8
|
+
"todoist"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://pipedream.com/apps/todoist",
|
|
11
|
+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"querystring": "^0.2.1",
|
|
15
|
+
"uuid": "^8.3.2",
|
|
16
|
+
"tmp-promise": "^3.0.3",
|
|
17
|
+
"json-2-csv": "^3.15.1"
|
|
18
|
+
},
|
|
19
|
+
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import common from "./common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
methods: {
|
|
6
|
+
...common.methods,
|
|
7
|
+
async getSyncResult() {
|
|
8
|
+
return this.todoist.syncProjects(this.db);
|
|
9
|
+
},
|
|
10
|
+
emitResults(results) {
|
|
11
|
+
for (const element of results) {
|
|
12
|
+
element.summary = `Project: ${element.id}`;
|
|
13
|
+
const meta = this.generateMeta(element);
|
|
14
|
+
this.$emit(element, meta);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import common from "./common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
props: {
|
|
6
|
+
...common.props,
|
|
7
|
+
selectProjects: {
|
|
8
|
+
propDefinition: [
|
|
9
|
+
common.props.todoist,
|
|
10
|
+
"selectProjects",
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
...common.methods,
|
|
16
|
+
isElementRelevant() {
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
async getSyncResult() {
|
|
20
|
+
return this.todoist.syncItems(this.db);
|
|
21
|
+
},
|
|
22
|
+
filterResults(syncResult) {
|
|
23
|
+
return Object.values(syncResult)
|
|
24
|
+
.filter(Array.isArray)
|
|
25
|
+
.flat()
|
|
26
|
+
.filter(this.isElementRelevant)
|
|
27
|
+
.filter((element) =>
|
|
28
|
+
this.todoist.isProjectInList(element.project_id, this.selectProjects ?? []));
|
|
29
|
+
},
|
|
30
|
+
emitResults(results) {
|
|
31
|
+
for (const element of results) {
|
|
32
|
+
element.summary = `Task: ${element.id}`;
|
|
33
|
+
const meta = this.generateMeta(element);
|
|
34
|
+
this.$emit(element, meta);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import todoist from "../todoist.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
todoist,
|
|
6
|
+
timer: {
|
|
7
|
+
type: "$.interface.timer",
|
|
8
|
+
label: "Polling Interval",
|
|
9
|
+
description: "Pipedream will poll the Todoist API on this schedule",
|
|
10
|
+
default: {
|
|
11
|
+
intervalSeconds: 60 * 15,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
db: "$.service.db",
|
|
15
|
+
},
|
|
16
|
+
hooks: {
|
|
17
|
+
async deploy() {
|
|
18
|
+
// Emit no more than 20 items on first run
|
|
19
|
+
const syncResult = await this.getSyncResult();
|
|
20
|
+
const results = this.filterResults(syncResult).slice(0, 20);
|
|
21
|
+
this.emitResults(results);
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
generateMeta(element) {
|
|
26
|
+
const {
|
|
27
|
+
id: elementId,
|
|
28
|
+
summary,
|
|
29
|
+
date_completed: dateCompleted,
|
|
30
|
+
} = element;
|
|
31
|
+
const ts = Date.parse(dateCompleted);
|
|
32
|
+
const id = `${elementId}-${ts}`;
|
|
33
|
+
return {
|
|
34
|
+
id,
|
|
35
|
+
summary,
|
|
36
|
+
ts,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
filterResults(syncResult) {
|
|
40
|
+
return Object.values(syncResult)
|
|
41
|
+
.filter(Array.isArray)
|
|
42
|
+
.flat();
|
|
43
|
+
},
|
|
44
|
+
getSyncResult() {
|
|
45
|
+
throw new Error("getSyncResult is not implemented");
|
|
46
|
+
},
|
|
47
|
+
emitResults() {
|
|
48
|
+
throw new Error("emitResults is not implemented");
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
async run() {
|
|
52
|
+
const syncResult = await this.getSyncResult();
|
|
53
|
+
const results = this.filterResults(syncResult);
|
|
54
|
+
this.emitResults(results);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import common from "../common-task.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-completed-task",
|
|
6
|
+
name: "Completed Task",
|
|
7
|
+
description: "Emit new event for each completed task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
isElementRelevant(element) {
|
|
14
|
+
return element.checked === 1;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import common from "../common-task.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-incomplete-task",
|
|
6
|
+
name: "Incomplete Task",
|
|
7
|
+
description: "Emit new event for each new incomplete task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
isElementRelevant(element) {
|
|
14
|
+
return element.checked === 0;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import common from "../common-project.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-new-or-modified-project",
|
|
6
|
+
name: "New or Modified Project",
|
|
7
|
+
description: "Emit new event for each new or modified project. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import common from "../common-task.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-new-or-modified-task",
|
|
6
|
+
name: "New or Modified Task",
|
|
7
|
+
description: "Emit new event for each new or modified task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import common from "../common-project.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-new-project",
|
|
6
|
+
name: "New Project",
|
|
7
|
+
description: "Emit new event for each new project. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "greatest",
|
|
11
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import common from "../common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-new-section",
|
|
6
|
+
name: "New Section",
|
|
7
|
+
description: "Emit new event for each new section added. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "greatest",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
async getSyncResult() {
|
|
14
|
+
return this.todoist.syncSections(this.db);
|
|
15
|
+
},
|
|
16
|
+
emitResults(results) {
|
|
17
|
+
for (const element of results) {
|
|
18
|
+
element.summary = `Section: ${element.id}`;
|
|
19
|
+
const meta = this.generateMeta(element);
|
|
20
|
+
this.$emit(element, meta);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import common from "../common-task.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-new-task",
|
|
6
|
+
name: "New Task",
|
|
7
|
+
description: "Emit new event for each new task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "greatest",
|
|
11
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import common from "../common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "todoist-sync-resources",
|
|
6
|
+
name: "Sync Resources",
|
|
7
|
+
description: "Emit new updates for your selected resources. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
includeResourceTypes: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.todoist,
|
|
15
|
+
"includeResourceTypes",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
hooks: {
|
|
20
|
+
...common.hooks,
|
|
21
|
+
async deploy() {
|
|
22
|
+
// Emit no more than 20 events on first run by setting a max value of 20
|
|
23
|
+
const syncResult = await this.getSyncResult();
|
|
24
|
+
this.emitResults(syncResult, 20);
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
...common.methods,
|
|
29
|
+
async getSyncResult() {
|
|
30
|
+
return this.todoist.syncResources(
|
|
31
|
+
this.db,
|
|
32
|
+
this.includeResourceTypes,
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
filterResults(syncResult) {
|
|
36
|
+
return syncResult;
|
|
37
|
+
},
|
|
38
|
+
processResults(results, max = null) {
|
|
39
|
+
let emitCount = 0;
|
|
40
|
+
for (const property in results) {
|
|
41
|
+
if (Array.isArray(results[property])) {
|
|
42
|
+
for (const element of results[property]) {
|
|
43
|
+
const data = {
|
|
44
|
+
resource: property,
|
|
45
|
+
data: element,
|
|
46
|
+
};
|
|
47
|
+
this.$emit(data, {
|
|
48
|
+
summary: property,
|
|
49
|
+
});
|
|
50
|
+
emitCount++;
|
|
51
|
+
if (max && emitCount >= max) {
|
|
52
|
+
return emitCount;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return emitCount;
|
|
58
|
+
},
|
|
59
|
+
emitResults(results, max = null) {
|
|
60
|
+
const emitCount = this.processResults(results, max);
|
|
61
|
+
console.log(`Emitted ${emitCount} events.`);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|