@pipedream/asana 0.3.8 → 0.4.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.
Files changed (27) hide show
  1. package/actions/add-task-to-section/add-task-to-section.mjs +1 -1
  2. package/actions/create-project/create-project.mjs +1 -1
  3. package/actions/create-subtask/create-subtask.mjs +1 -1
  4. package/actions/create-task/create-task.mjs +1 -1
  5. package/actions/create-task-comment/create-task-comment.mjs +1 -1
  6. package/actions/delete-task/delete-task.mjs +1 -1
  7. package/actions/find-task-by-id/find-task-by-id.mjs +1 -1
  8. package/actions/search-projects/search-projects.mjs +1 -1
  9. package/actions/search-sections/search-sections.mjs +1 -1
  10. package/actions/search-tasks/search-tasks.mjs +1 -1
  11. package/actions/search-user-projects/search-user-projects.mjs +1 -1
  12. package/actions/update-task/update-task.mjs +1 -1
  13. package/asana.app.mjs +20 -0
  14. package/package.json +1 -1
  15. package/sources/new-completed-task/new-completed-task.mjs +1 -1
  16. package/sources/new-project/new-project.mjs +1 -1
  17. package/sources/new-story/new-story.mjs +1 -1
  18. package/sources/new-subtask/new-subtask.mjs +1 -1
  19. package/sources/new-tag/new-tag.mjs +1 -1
  20. package/sources/new-task/new-task.mjs +1 -1
  21. package/sources/new-team/new-team.mjs +1 -1
  22. package/sources/new-user/new-user.mjs +1 -1
  23. package/sources/new-workspace/new-workspace.mjs +1 -1
  24. package/sources/tag-added-to-task/tag-added-to-task.mjs +1 -1
  25. package/sources/task-assigned-in-project/task-assigned-in-project.mjs +79 -0
  26. package/sources/task-field-updated-in-project/task-field-updated-in-project.mjs +73 -0
  27. package/sources/task-updated-in-project/task-updated-in-project.mjs +25 -11
@@ -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.1",
8
+ version: "0.2.2",
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.1",
8
+ version: "0.9.2",
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.1",
8
+ version: "0.3.2",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "asana-create-task",
6
6
  name: "Create Task",
7
7
  description: "Creates a new task. [See the docs here](https://developers.asana.com/docs/create-a-task)",
8
- version: "0.3.1",
8
+ version: "0.3.2",
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.1",
8
+ version: "0.2.2",
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.2",
8
+ version: "0.0.3",
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.1",
8
+ version: "0.2.2",
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.1",
6
+ version: "0.2.2",
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.1",
7
+ version: "0.2.2",
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.1",
8
+ version: "0.2.2",
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.1",
8
+ version: "0.4.2",
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.1",
8
+ version: "0.3.2",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
package/asana.app.mjs CHANGED
@@ -117,6 +117,26 @@ export default {
117
117
  });
118
118
  },
119
119
  },
120
+ taskFields: {
121
+ label: "Task Fields",
122
+ description: "List of task fields that will emit events when updated. This field uses the field code.",
123
+ type: "string[]",
124
+ async options({ project }) {
125
+ const tasks = await this.getTasks({
126
+ params: {
127
+ project,
128
+ limit: 1,
129
+ },
130
+ });
131
+
132
+ if (!tasks || tasks.length === 0) {
133
+ return [];
134
+ }
135
+ const task = await this.getTask(tasks[0].gid);
136
+
137
+ return Object.keys(task);
138
+ },
139
+ },
120
140
  },
121
141
  methods: {
122
142
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/asana",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "Pipedream Asana Components",
5
5
  "main": "asana.app.mjs",
6
6
  "keywords": [
@@ -7,7 +7,7 @@ export default {
7
7
  type: "source",
8
8
  name: "New Completed Task (Instant)",
9
9
  description: "Emit new event for each task completed in a project.",
10
- version: "0.1.1",
10
+ version: "0.1.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -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.1",
9
+ version: "0.1.2",
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 Story Added To Project (Instant)",
9
9
  description: "Emit new event for each story added to a project.",
10
- version: "0.1.1",
10
+ version: "0.1.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...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: "1.0.1",
10
+ version: "1.0.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  type: "source",
7
7
  name: "New Tag",
8
8
  description: "Emit new event for each tag created in a workspace.",
9
- version: "0.0.3",
9
+ version: "0.0.4",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  asana,
@@ -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.1",
10
+ version: "0.1.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  type: "source",
7
7
  name: "New Team",
8
8
  description: "Emit new event for each task added to an organization.",
9
- version: "0.1.2",
9
+ version: "0.1.3",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  asana,
@@ -6,7 +6,7 @@ export default {
6
6
  type: "source",
7
7
  name: "New User (Instant)",
8
8
  description: "Emit new event for each user added to a workspace.",
9
- version: "0.1.1",
9
+ version: "0.1.2",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "asana-new-workspace",
7
7
  name: "New Workspace Added",
8
8
  description: "Emit new event each time you add a new workspace/organization.",
9
- version: "0.1.2",
9
+ version: "0.1.3",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  asana,
@@ -7,7 +7,7 @@ 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.1",
10
+ version: "0.1.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -0,0 +1,79 @@
1
+ import common from "../common/common.mjs";
2
+ const { asana } = common.props;
3
+
4
+ export default {
5
+ ...common,
6
+ key: "asana-task-assigned-in-project",
7
+ type: "source",
8
+ name: "Task Assigned in Project (Instant)",
9
+ description: "Emit an event each time a task is assigned, reassigned or unassigned.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ project: {
15
+ label: "Project",
16
+ description: "Gid of a project.",
17
+ type: "string",
18
+ propDefinition: [
19
+ asana,
20
+ "projects",
21
+ (c) => ({
22
+ workspace: c.workspace,
23
+ }),
24
+ ],
25
+ },
26
+ user: {
27
+ label: "Assignee",
28
+ type: "string",
29
+ description: "Only emit events when tasks are assigned to this user GID",
30
+ propDefinition: [
31
+ asana,
32
+ "users",
33
+ ],
34
+ },
35
+ },
36
+ methods: {
37
+ ...common.methods,
38
+ getWebhookFilter() {
39
+ return {
40
+ filters: [
41
+ {
42
+ action: "changed",
43
+ resource_type: "task",
44
+ fields: [
45
+ "assignee",
46
+ ],
47
+ },
48
+ ],
49
+ resource: this.project,
50
+ };
51
+ },
52
+ async emitEvent(event) {
53
+ const { user } = this;
54
+ const { events = [] } = event.body || {};
55
+
56
+ const promises = events
57
+ .filter(({ change }) =>
58
+ !change.new_value
59
+ || (user?.length > 0 && change.new_value.gid === user))
60
+ .map(async (event) => ({
61
+ event,
62
+ task: await this.asana.getTask(event.resource.gid),
63
+ }));
64
+
65
+ const responses = await Promise.all(promises);
66
+
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
+ });
77
+ },
78
+ },
79
+ };
@@ -0,0 +1,73 @@
1
+ import common from "../common/common.mjs";
2
+ const { asana } = common.props;
3
+
4
+ export default {
5
+ ...common,
6
+ key: "asana-task-field-updated-in-project",
7
+ type: "source",
8
+ name: "Task Field Updated In Project (Instant)",
9
+ description: "Emit a new event whenever given task fields are updated.",
10
+ version: "0.0.1",
11
+ dedupe: "unique",
12
+ props: {
13
+ ...common.props,
14
+ project: {
15
+ label: "Project",
16
+ description: "Gid of a project.",
17
+ type: "string",
18
+ propDefinition: [
19
+ asana,
20
+ "projects",
21
+ (c) => ({
22
+ workspace: c.workspace,
23
+ }),
24
+ ],
25
+ },
26
+ taskFields: {
27
+ propDefinition: [
28
+ asana,
29
+ "taskFields",
30
+ (c) => ({
31
+ project: c.project,
32
+ }),
33
+ ],
34
+ },
35
+ },
36
+ methods: {
37
+ ...common.methods,
38
+ getWebhookFilter() {
39
+ return {
40
+ filters: [
41
+ {
42
+ action: "changed",
43
+ resource_type: "task",
44
+ fields: this.taskFields,
45
+ },
46
+ ],
47
+ resource: this.project,
48
+ };
49
+ },
50
+ async emitEvent(event) {
51
+ const { events = [] } = event.body || {};
52
+
53
+ const promises = events
54
+ .map(async (event) => ({
55
+ event,
56
+ task: await this.asana.getTask(event.resource.gid),
57
+ }));
58
+
59
+ const responses = await Promise.all(promises);
60
+
61
+ responses.forEach(({
62
+ event, task,
63
+ }) => {
64
+ const ts = Date.parse(event.created_at);
65
+ this.$emit(task, {
66
+ id: `${task.gid}-${ts}`,
67
+ summary: task.name,
68
+ ts,
69
+ });
70
+ });
71
+ },
72
+ },
73
+ };
@@ -7,7 +7,7 @@ export default {
7
7
  type: "source",
8
8
  name: "Task Updated In Project (Instant)",
9
9
  description: "Emit new event for each update to a task.",
10
- version: "1.0.1",
10
+ version: "1.1.0",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -33,6 +33,16 @@ export default {
33
33
  }),
34
34
  ],
35
35
  },
36
+ user: {
37
+ label: "Assignee",
38
+ type: "string",
39
+ description: "Only emit events for tasks assigned to this user GID",
40
+ optional: true,
41
+ propDefinition: [
42
+ asana,
43
+ "users",
44
+ ],
45
+ },
36
46
  },
37
47
  methods: {
38
48
  ...common.methods,
@@ -48,7 +58,9 @@ export default {
48
58
  };
49
59
  },
50
60
  async emitEvent(event) {
51
- const { tasks } = this;
61
+ const {
62
+ tasks, user,
63
+ } = this;
52
64
  const { events = [] } = event.body || {};
53
65
 
54
66
  const promises = events
@@ -64,16 +76,18 @@ export default {
64
76
 
65
77
  const responses = await Promise.all(promises);
66
78
 
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,
79
+ responses
80
+ .filter(({ task }) => !user || task.assignee && task.assignee.gid === user)
81
+ .forEach(({
82
+ event, task,
83
+ }) => {
84
+ const ts = Date.parse(event.created_at);
85
+ this.$emit(task, {
86
+ id: `${task.gid}-${ts}`,
87
+ summary: task.name,
88
+ ts,
89
+ });
75
90
  });
76
- });
77
91
  },
78
92
  },
79
93
  };