@pipedream/asana 0.3.4 → 0.3.6
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/actions/add-task-to-section/add-task-to-section.mjs +1 -1
- package/actions/create-project/create-project.mjs +1 -1
- package/actions/create-subtask/create-subtask.mjs +1 -1
- package/actions/create-task/create-task.mjs +1 -1
- package/actions/create-task-comment/create-task-comment.mjs +1 -1
- package/actions/delete-task/delete-task.mjs +1 -1
- package/actions/find-task-by-id/find-task-by-id.mjs +1 -1
- package/actions/search-projects/search-projects.mjs +1 -1
- package/actions/search-sections/search-sections.mjs +1 -1
- package/actions/search-tasks/search-tasks.mjs +1 -1
- package/actions/search-user-projects/search-user-projects.mjs +1 -1
- package/actions/update-task/update-task.mjs +1 -1
- package/asana.app.mjs +15 -12
- package/package.json +2 -2
- package/sources/common/common.mjs +0 -10
- package/sources/new-completed-task/new-completed-task.mjs +1 -1
- package/sources/new-project/new-project.mjs +1 -1
- package/sources/new-story/new-story.mjs +1 -1
- package/sources/new-subtask/new-subtask.mjs +26 -19
- package/sources/new-tag/new-tag.mjs +1 -1
- package/sources/new-task/new-task.mjs +1 -1
- package/sources/new-team/new-team.mjs +1 -1
- package/sources/new-user/new-user.mjs +1 -1
- package/sources/new-workspace/new-workspace.mjs +1 -1
- package/sources/tag-added-to-task/tag-added-to-task.mjs +28 -19
- package/sources/{updated-task-in-project/updated-task-in-project.mjs → task-updated-in-project/task-updated-in-project.mjs} +28 -21
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Add Task To Section",
|
|
6
6
|
description: "Add a task to a specific, existing section. This will remove the task from other sections of the project. [See the docs here](https://developers.asana.com/docs/add-task-to-section)",
|
|
7
7
|
key: "asana-add-task-to-section",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-create-project",
|
|
6
6
|
name: "Create Project",
|
|
7
7
|
description: "Create a new project in a workspace or team. [See the docs here](https://developers.asana.com/docs/create-a-project)",
|
|
8
|
-
version: "0.9.
|
|
8
|
+
version: "0.9.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
asana,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-create-subtask",
|
|
6
6
|
name: "Create Subtask",
|
|
7
7
|
description: "Creates a new subtask and adds it to the parent task. [See the docs here](https://developers.asana.com/docs/create-a-subtask)",
|
|
8
|
-
version: "0.3.
|
|
8
|
+
version: "0.3.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-create-task-comment",
|
|
6
6
|
name: "Create Task Comment",
|
|
7
7
|
description: "Adds a comment to a task. [See the docs here](https://developers.asana.com/docs/create-a-story-on-a-task)",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-delete-task",
|
|
6
6
|
name: "Delete Task",
|
|
7
7
|
description: "Deletes a specific and existing task. [See the docs here](https://developers.asana.com/docs/delete-a-task)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-find-task-by-id",
|
|
6
6
|
name: "Find Task by ID",
|
|
7
7
|
description: "Searches for a task by id. Returns the complete task record for a single task. [See the docs here](https://developers.asana.com/docs/get-a-task)",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -3,7 +3,7 @@ import asana from "../../asana.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
5
|
key: "asana-search-projects",
|
|
6
|
-
version: "0.2.
|
|
6
|
+
version: "0.2.1",
|
|
7
7
|
name: "Search Projects",
|
|
8
8
|
description: "Finds an existing project. [See the docs here](https://developers.asana.com/docs/get-multiple-projects)",
|
|
9
9
|
props: {
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "asana-search-sections",
|
|
5
5
|
name: "Search Sections",
|
|
6
6
|
description: "Searches for a section by name within a particular project. [See the docs here](https://developers.asana.com/docs/get-sections-in-a-project)",
|
|
7
|
-
version: "0.2.
|
|
7
|
+
version: "0.2.1",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-search-tasks",
|
|
6
6
|
name: "Search Tasks",
|
|
7
7
|
description: "Searches for a Task by name within a Project. [See the docs here](https://developers.asana.com/docs/get-multiple-tasks)",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-search-user-projects",
|
|
6
6
|
name: "Get list of user projects",
|
|
7
7
|
description: "Return list of projects given the user and workspace gid. [See the docs here](https://developers.asana.com/docs/get-multiple-projects)",
|
|
8
|
-
version: "0.4.
|
|
8
|
+
version: "0.4.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
asana,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "asana-update-task",
|
|
6
6
|
name: "Update Task",
|
|
7
7
|
description: "Updates a specific and existing task. [See the docs here](https://developers.asana.com/docs/update-a-task)",
|
|
8
|
-
version: "0.3.
|
|
8
|
+
version: "0.3.1",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
...common.props,
|
package/asana.app.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
type: "string[]",
|
|
11
11
|
async options() {
|
|
12
12
|
const organizations = await this.getOrganizations();
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
return organizations.map((organization) => ({
|
|
15
15
|
label: organization.name,
|
|
16
16
|
value: organization.gid,
|
|
@@ -90,15 +90,16 @@ export default {
|
|
|
90
90
|
type: "string[]",
|
|
91
91
|
async options({ project }) {
|
|
92
92
|
const tasks = await this.getTasks({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return tasks.map((task) => {
|
|
97
|
-
return {
|
|
98
|
-
label: task.name,
|
|
99
|
-
value: task.gid,
|
|
100
|
-
};
|
|
93
|
+
params: {
|
|
94
|
+
project,
|
|
95
|
+
},
|
|
101
96
|
});
|
|
97
|
+
return tasks.map(({
|
|
98
|
+
name: label, gid: value,
|
|
99
|
+
}) => ({
|
|
100
|
+
label,
|
|
101
|
+
value,
|
|
102
|
+
}));
|
|
102
103
|
},
|
|
103
104
|
},
|
|
104
105
|
sections: {
|
|
@@ -149,11 +150,12 @@ export default {
|
|
|
149
150
|
* @returns {string} The request result data.
|
|
150
151
|
*/
|
|
151
152
|
async _makeRequest(path, options = {}, $ = this) {
|
|
152
|
-
|
|
153
|
+
const config = {
|
|
153
154
|
url: `${this._apiUrl()}/${path}`,
|
|
154
155
|
headers: this._headers(),
|
|
155
156
|
...options,
|
|
156
|
-
}
|
|
157
|
+
};
|
|
158
|
+
return axios($, config);
|
|
157
159
|
},
|
|
158
160
|
/**
|
|
159
161
|
* Create a webhook
|
|
@@ -257,7 +259,8 @@ export default {
|
|
|
257
259
|
* @returns {string} An Asana Task.
|
|
258
260
|
*/
|
|
259
261
|
async getTask(taskId, $) {
|
|
260
|
-
|
|
262
|
+
const response = await this._makeRequest(`tasks/${taskId}`, {}, $);
|
|
263
|
+
return response.data;
|
|
261
264
|
},
|
|
262
265
|
/**
|
|
263
266
|
* Get an Asana Task list.
|
package/package.json
CHANGED
|
@@ -34,12 +34,6 @@ export default {
|
|
|
34
34
|
_setWebhookId(webhookId) {
|
|
35
35
|
this.db.set("webhookId", webhookId);
|
|
36
36
|
},
|
|
37
|
-
_getTasks() {
|
|
38
|
-
return this.db.get("tasks");
|
|
39
|
-
},
|
|
40
|
-
_setTasks(tasks) {
|
|
41
|
-
this.db.set("tasks", tasks);
|
|
42
|
-
},
|
|
43
37
|
getWebhookFilter() {
|
|
44
38
|
throw new Error("getWebhookFilter is not implemented");
|
|
45
39
|
},
|
|
@@ -57,10 +51,6 @@ export default {
|
|
|
57
51
|
});
|
|
58
52
|
|
|
59
53
|
this._setWebhookId(response.gid);
|
|
60
|
-
|
|
61
|
-
if (this.tasks) {
|
|
62
|
-
this._setTasks(this.tasks);
|
|
63
|
-
}
|
|
64
54
|
},
|
|
65
55
|
async deactivate() {
|
|
66
56
|
const webhookId = this._getWebhookId();
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "asana-new-project",
|
|
7
7
|
name: "New Project Added To Workspace (Instant)",
|
|
8
8
|
description: "Emit new event for each new project added to a workspace.",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.1",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
...common.props,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
type: "source",
|
|
8
8
|
name: "New Subtask (Instant)",
|
|
9
9
|
description: "Emit new event for each subtask added to a project.",
|
|
10
|
-
version: "0.1
|
|
10
|
+
version: "1.0.1",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -24,16 +24,16 @@ export default {
|
|
|
24
24
|
],
|
|
25
25
|
},
|
|
26
26
|
tasks: {
|
|
27
|
+
optional: true,
|
|
27
28
|
propDefinition: [
|
|
28
29
|
asana,
|
|
29
30
|
"tasks",
|
|
30
31
|
(c) => ({
|
|
31
|
-
|
|
32
|
+
project: c.project,
|
|
32
33
|
}),
|
|
33
34
|
],
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
|
-
|
|
37
37
|
methods: {
|
|
38
38
|
...common.methods,
|
|
39
39
|
getWebhookFilter() {
|
|
@@ -48,25 +48,32 @@ export default {
|
|
|
48
48
|
};
|
|
49
49
|
},
|
|
50
50
|
async emitEvent(event) {
|
|
51
|
-
const {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const tasks = this.db.get("tasks");
|
|
51
|
+
const { tasks } = this;
|
|
52
|
+
const { events = [] } = event.body || {};
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const promises = events
|
|
55
|
+
.filter(({ parent }) => parent.resource_type === "task")
|
|
56
|
+
.filter(({ resource }) => {
|
|
57
|
+
return tasks?.length
|
|
58
|
+
? tasks.includes(String(resource.gid))
|
|
59
|
+
: true;
|
|
60
|
+
})
|
|
61
|
+
.map(async (event) => ({
|
|
62
|
+
event,
|
|
63
|
+
task: await this.asana.getTask(event.resource.gid),
|
|
64
|
+
}));
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
tasks.includes(e.parent.gid)) {
|
|
61
|
-
const task = await this.asana.getTask(e.resource.gid);
|
|
66
|
+
const responses = await Promise.all(promises);
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
responses.forEach(({
|
|
69
|
+
event, task,
|
|
70
|
+
}) => {
|
|
71
|
+
this.$emit(task, {
|
|
72
|
+
id: task.gid,
|
|
73
|
+
summary: task.name,
|
|
74
|
+
ts: Date.parse(event.created_at),
|
|
75
|
+
});
|
|
76
|
+
});
|
|
70
77
|
},
|
|
71
78
|
},
|
|
72
79
|
};
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
type: "source",
|
|
8
8
|
name: "New Task (Instant)",
|
|
9
9
|
description: "Emit new event for each task added to a project. [See docs here](https://developers.asana.com/docs/establish-a-webhook)",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.1",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -7,7 +7,8 @@ export default {
|
|
|
7
7
|
type: "source",
|
|
8
8
|
name: "New Tag Added To Task (Instant)",
|
|
9
9
|
description: "Emit new event for each new tag added to a task.",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.1",
|
|
11
|
+
dedupe: "unique",
|
|
11
12
|
props: {
|
|
12
13
|
...common.props,
|
|
13
14
|
project: {
|
|
@@ -23,11 +24,12 @@ export default {
|
|
|
23
24
|
],
|
|
24
25
|
},
|
|
25
26
|
tasks: {
|
|
27
|
+
optional: true,
|
|
26
28
|
propDefinition: [
|
|
27
29
|
asana,
|
|
28
30
|
"tasks",
|
|
29
31
|
(c) => ({
|
|
30
|
-
|
|
32
|
+
project: c.project,
|
|
31
33
|
}),
|
|
32
34
|
],
|
|
33
35
|
},
|
|
@@ -46,26 +48,33 @@ export default {
|
|
|
46
48
|
};
|
|
47
49
|
},
|
|
48
50
|
async emitEvent(event) {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
+
const { tasks } = this;
|
|
52
|
+
const { events = [] } = event.body || {};
|
|
51
53
|
|
|
52
|
-
const
|
|
54
|
+
const promises = events
|
|
55
|
+
.filter(({ resource }) => {
|
|
56
|
+
return tasks?.length
|
|
57
|
+
? tasks.includes(String(resource.gid))
|
|
58
|
+
: true;
|
|
59
|
+
})
|
|
60
|
+
.map(async (event) => ({
|
|
61
|
+
event,
|
|
62
|
+
task: await this.asana.getTask(event.resource.gid),
|
|
63
|
+
tag: await this.asana.getTag(event.parent.gid),
|
|
64
|
+
}));
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
if (e.parent.resource_type !== "tag") continue;
|
|
66
|
+
const responses = await Promise.all(promises);
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|
|
68
|
+
responses.forEach(({
|
|
69
|
+
event, task, tag,
|
|
70
|
+
}) => {
|
|
71
|
+
const ts = Date.parse(event.created_at);
|
|
72
|
+
this.$emit(tag, {
|
|
73
|
+
id: `${tag.gid}-${ts}`,
|
|
74
|
+
summary: `${tag.name} added to ${task.name}`,
|
|
75
|
+
ts,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
69
78
|
},
|
|
70
79
|
},
|
|
71
80
|
};
|
|
@@ -3,11 +3,11 @@ const { asana } = common.props;
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
...common,
|
|
6
|
-
key: "asana-
|
|
6
|
+
key: "asana-task-updated-in-project",
|
|
7
7
|
type: "source",
|
|
8
|
-
name: "
|
|
8
|
+
name: "Task Updated In Project (Instant)",
|
|
9
9
|
description: "Emit new event for each update to a task.",
|
|
10
|
-
version: "0.1
|
|
10
|
+
version: "1.0.1",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -24,11 +24,12 @@ export default {
|
|
|
24
24
|
],
|
|
25
25
|
},
|
|
26
26
|
tasks: {
|
|
27
|
+
optional: true,
|
|
27
28
|
propDefinition: [
|
|
28
29
|
asana,
|
|
29
30
|
"tasks",
|
|
30
31
|
(c) => ({
|
|
31
|
-
|
|
32
|
+
project: c.project,
|
|
32
33
|
}),
|
|
33
34
|
],
|
|
34
35
|
},
|
|
@@ -47,26 +48,32 @@ export default {
|
|
|
47
48
|
};
|
|
48
49
|
},
|
|
49
50
|
async emitEvent(event) {
|
|
50
|
-
const {
|
|
51
|
-
|
|
51
|
+
const { tasks } = this;
|
|
52
|
+
const { events = [] } = event.body || {};
|
|
52
53
|
|
|
53
|
-
const
|
|
54
|
+
const promises = events
|
|
55
|
+
.filter(({ resource }) => {
|
|
56
|
+
return tasks?.length
|
|
57
|
+
? tasks.includes(String(resource.gid))
|
|
58
|
+
: true;
|
|
59
|
+
})
|
|
60
|
+
.map(async (event) => ({
|
|
61
|
+
event,
|
|
62
|
+
task: await this.asana.getTask(event.resource.gid),
|
|
63
|
+
}));
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
// This conditional ignore when Asana fire a subtask update event
|
|
57
|
-
if (e.parent && e.parent.resource_type === "task") continue;
|
|
65
|
+
const responses = await Promise.all(promises);
|
|
58
66
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
67
|
+
responses.forEach(({
|
|
68
|
+
event, task,
|
|
69
|
+
}) => {
|
|
70
|
+
const ts = Date.parse(event.created_at);
|
|
71
|
+
this.$emit(task, {
|
|
72
|
+
id: `${task.gid}-${ts}`,
|
|
73
|
+
summary: task.name,
|
|
74
|
+
ts,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
70
77
|
},
|
|
71
78
|
},
|
|
72
79
|
};
|