@pipedream/asana 0.7.2 → 0.7.4

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 (30) hide show
  1. package/actions/add-task-to-section/add-task-to-section.mjs +1 -1
  2. package/actions/create-project/create-project.mjs +76 -28
  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/create-task-from-template/create-task-from-template.mjs +1 -1
  7. package/actions/delete-task/delete-task.mjs +1 -1
  8. package/actions/find-task-by-id/find-task-by-id.mjs +1 -1
  9. package/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs +1 -1
  10. package/actions/search-projects/search-projects.mjs +1 -1
  11. package/actions/search-sections/search-sections.mjs +1 -1
  12. package/actions/search-tasks/search-tasks.mjs +1 -1
  13. package/actions/search-user-projects/search-user-projects.mjs +1 -1
  14. package/actions/update-task/update-task.mjs +1 -1
  15. package/asana.app.mjs +7 -3
  16. package/package.json +1 -1
  17. package/sources/new-completed-task/new-completed-task.mjs +1 -1
  18. package/sources/new-project/new-project.mjs +1 -1
  19. package/sources/new-story/new-story.mjs +1 -1
  20. package/sources/new-subtask/new-subtask.mjs +1 -1
  21. package/sources/new-tag/new-tag.mjs +1 -1
  22. package/sources/new-task/new-task.mjs +1 -1
  23. package/sources/new-team/new-team.mjs +1 -1
  24. package/sources/new-user/new-user.mjs +1 -1
  25. package/sources/new-workspace/new-workspace.mjs +1 -1
  26. package/sources/tag-added-to-task/tag-added-to-task.mjs +1 -1
  27. package/sources/tags-added-to-any-task/tags-added-to-any-task.mjs +1 -1
  28. package/sources/task-assigned-in-project/task-assigned-in-project.mjs +1 -1
  29. package/sources/task-field-updated-in-project/task-field-updated-in-project.mjs +14 -9
  30. package/sources/task-updated-in-project/task-updated-in-project.mjs +1 -1
@@ -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 documentation](https://developers.asana.com/docs/add-task-to-section)",
7
7
  key: "asana-add-task-to-section",
8
- version: "0.2.8",
8
+ version: "0.2.10",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,19 +5,33 @@ 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 documentation](https://developers.asana.com/docs/create-a-project)",
8
- version: "0.10.1",
8
+ version: "0.10.3",
9
9
  type: "action",
10
10
  props: {
11
11
  asana,
12
12
  workspace: {
13
13
  label: "Workspace",
14
- description: "Gid of a workspace.",
14
+ description: "GID of a workspace.",
15
15
  type: "string",
16
16
  propDefinition: [
17
17
  asana,
18
18
  "workspaces",
19
19
  ],
20
20
  },
21
+ team: {
22
+ propDefinition: [
23
+ asana,
24
+ "teams",
25
+ ({ workspace }) => ({
26
+ workspaces: [
27
+ workspace,
28
+ ],
29
+ }),
30
+ ],
31
+ type: "string",
32
+ label: "Team",
33
+ description: "The team that this project is shared with. If the workspace for your project is an organization, you must supply a team to share the project with",
34
+ },
21
35
  name: {
22
36
  label: "Name",
23
37
  description: "Name of the project. This is generally a short sentence fragment that fits on a line in the UI for maximum readability. However, it can be longer.",
@@ -28,14 +42,9 @@ export default {
28
42
  description: "Free-form textual information associated with the project (ie., its description).",
29
43
  type: "string",
30
44
  },
31
- text: {
32
- label: "Text",
33
- description: "The text content of the status update.",
34
- type: "string",
35
- },
36
45
  color: {
37
46
  label: "Color",
38
- description: "The color associated with the status update.",
47
+ description: "The color associated with the status update",
39
48
  type: "string",
40
49
  options: constants.COLORS,
41
50
  optional: true,
@@ -46,9 +55,9 @@ export default {
46
55
  type: "string",
47
56
  optional: true,
48
57
  },
49
- default_view: {
58
+ defaultView: {
50
59
  label: "Default View",
51
- description: "The default view (list, board, calendar, or timeline) of a project.",
60
+ description: "The default view (list, board, calendar, or timeline) of a project",
52
61
  type: "string",
53
62
  options: [
54
63
  "list",
@@ -59,27 +68,31 @@ export default {
59
68
  default: "calendar",
60
69
  optional: true,
61
70
  },
62
- public: {
63
- label: "Public",
64
- description: "True if the project is public to its team.",
65
- type: "boolean",
71
+ privacySetting: {
72
+ label: "Privacy Setting",
73
+ description: "The privacy setting of the project. Note: Administrators in your organization may restrict the values of `privacy_setting`.",
74
+ type: "string",
66
75
  optional: true,
67
- default: false,
76
+ options: [
77
+ "public_to_workspace",
78
+ "private_to_team",
79
+ "private",
80
+ ],
68
81
  },
69
82
  archived: {
70
83
  label: "Archived",
71
- description: "Archived projects do not show in the UI by default and may be treated differently for queries.",
84
+ description: "Archived projects do not show in the UI by default and may be treated differently for queries",
72
85
  type: "boolean",
73
86
  optional: true,
74
87
  default: false,
75
88
  },
76
- due_on: {
89
+ dueOn: {
77
90
  label: "Due On",
78
91
  description: "The day on which this project is due. This takes a date with format YYYY-MM-DD.",
79
92
  type: "string",
80
93
  optional: true,
81
94
  },
82
- start_on: {
95
+ startOn: {
83
96
  label: "Start On",
84
97
  description: "The day on which work for this project begins. This takes a date with format YYYY-MM-DD. `Due On` must be present in the request when setting or unsetting the `Start On` parameter. Additionally, `Start On` and `Due On` cannot be the same date.",
85
98
  type: "string",
@@ -98,15 +111,15 @@ export default {
98
111
  }),
99
112
  ],
100
113
  },
101
- html_notes: {
114
+ htmlNotes: {
102
115
  label: "HTML Notes",
103
- description: "The notes of the project with formatting as HTML.",
116
+ description: "The notes of the project with formatting as HTML",
104
117
  type: "string",
105
118
  optional: true,
106
119
  },
107
120
  owner: {
108
121
  label: "Owner",
109
- description: "The current owner of the project.",
122
+ description: "The current owner of the project",
110
123
  type: "string",
111
124
  optional: true,
112
125
  propDefinition: [
@@ -117,6 +130,38 @@ export default {
117
130
  }),
118
131
  ],
119
132
  },
133
+ defaultAccessLevel: {
134
+ type: "string",
135
+ label: "Default Access Level",
136
+ description: "The default access for users or teams who join or are added as members to the project",
137
+ optional: true,
138
+ options: [
139
+ "admin",
140
+ "editor",
141
+ "commenter",
142
+ "viewer",
143
+ ],
144
+ },
145
+ minimumAccessLevelForCustomization: {
146
+ type: "string",
147
+ label: "Minimum Access Level for Customization",
148
+ description: "The minimum access level needed for project members to modify this project's workflow and appearance",
149
+ optional: true,
150
+ options: [
151
+ "admin",
152
+ "editor",
153
+ ],
154
+ },
155
+ minimumAccessLevelForSharing: {
156
+ type: "string",
157
+ label: "Minimum Access Level for Sharing",
158
+ description: "The minimum access level needed for project members to share the project with others",
159
+ optional: true,
160
+ options: [
161
+ "admin",
162
+ "editor",
163
+ ],
164
+ },
120
165
  },
121
166
  async run({ $ }) {
122
167
  const response = await this.asana._makeRequest({
@@ -126,24 +171,27 @@ export default {
126
171
  data: {
127
172
  name: this.name,
128
173
  notes: this.notes,
129
- text: this.text,
174
+ team: this.team,
130
175
  color: this.color,
131
176
  workspace: this.workspace,
132
- default_view: this.default_view,
177
+ default_view: this.defaultView,
133
178
  title: this.title,
134
- public: this.public,
179
+ privacy_setting: this.privacySetting,
135
180
  archived: this.archived,
136
- due_on: this.due_on,
137
- start_on: this.start_on,
181
+ due_on: this.dueOn,
182
+ start_on: this.startOn,
138
183
  followers: this.followers,
139
- html_notes: this.html_notes,
184
+ html_notes: this.htmlNotes,
140
185
  owner: this.owner,
186
+ default_access_level: this.defaultAccessLevel,
187
+ minimum_access_level_for_customization: this.minimumAccessLevelForCustomization,
188
+ minimum_access_level_for_sharing: this.minimumAccessLevelForSharing,
141
189
  },
142
190
  },
143
191
  $,
144
192
  });
145
193
 
146
- $.export("$summary", "Successfully created project");
194
+ $.export("$summary", `Successfully created project with GID: ${response.data.gid}`);
147
195
 
148
196
  return response;
149
197
  },
@@ -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 documentation](https://developers.asana.com/docs/create-a-subtask)",
8
- version: "0.4.1",
8
+ version: "0.4.3",
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 documentation](https://developers.asana.com/docs/create-a-task)",
8
- version: "0.4.1",
8
+ version: "0.4.3",
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 documentation](https://developers.asana.com/docs/create-a-story-on-a-task)",
8
- version: "0.2.8",
8
+ version: "0.2.10",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -4,7 +4,7 @@ export default {
4
4
  name: "Create Task from Template",
5
5
  key: "asana-create-task-from-template",
6
6
  description: "Creates a new task from a task template. [See the documentation](https://developers.asana.com/reference/instantiatetask)",
7
- version: "0.0.3",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  ...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 documentation](https://developers.asana.com/docs/delete-a-task)",
8
- version: "0.0.9",
8
+ version: "0.0.11",
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 documentation](https://developers.asana.com/docs/get-a-task)",
8
- version: "0.2.8",
8
+ version: "0.2.10",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-get-tasks-from-task-list",
5
5
  name: "Get Tasks From Task List",
6
6
  description: "Returns the compact list of tasks in a user’s My Tasks list. [See the documentation](https://developers.asana.com/reference/gettasksforusertasklist)",
7
- version: "0.0.6",
7
+ version: "0.0.8",
8
8
  type: "action",
9
9
  props: {
10
10
  ...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.8",
6
+ version: "0.2.10",
7
7
  name: "Search Projects",
8
8
  description: "Finds an existing project. [See the documentation](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 documentation](https://developers.asana.com/docs/get-sections-in-a-project)",
7
- version: "0.2.8",
7
+ version: "0.2.10",
8
8
  type: "action",
9
9
  props: {
10
10
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "asana-search-tasks",
7
7
  name: "Search Tasks",
8
8
  description: "Searches for a Task by name within a Project. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)",
9
- version: "0.3.2",
9
+ version: "0.3.4",
10
10
  type: "action",
11
11
  props: {
12
12
  ...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 documentation](https://developers.asana.com/docs/get-multiple-projects)",
8
- version: "0.5.1",
8
+ version: "0.5.3",
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 documentation](https://developers.asana.com/docs/update-a-task)",
8
- version: "0.4.1",
8
+ version: "0.4.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
package/asana.app.mjs CHANGED
@@ -225,7 +225,7 @@ export default {
225
225
  description: "List of task fields that will emit events when updated. This field uses the field code.",
226
226
  type: "string[]",
227
227
  async options({ project }) {
228
- const tasks = await this.getTasks({
228
+ const { data: tasks } = await this.getTasks({
229
229
  params: {
230
230
  project,
231
231
  limit: 1,
@@ -234,7 +234,9 @@ export default {
234
234
  if (!tasks || tasks.length === 0) {
235
235
  return [];
236
236
  }
237
- const task = await this.getTask(tasks[0].gid);
237
+ const { data: task } = await this.getTask({
238
+ taskId: tasks[0].gid,
239
+ });
238
240
  return Object.keys(task);
239
241
  },
240
242
  },
@@ -529,7 +531,9 @@ export default {
529
531
  let teams = [];
530
532
 
531
533
  for (const workspace of workspaces) {
532
- const { data } = (await this._makeRequest(`organizations/${workspace}/teams`));
534
+ const { data } = (await this._makeRequest({
535
+ path: `workspaces/${workspace}/teams`,
536
+ }));
533
537
  teams = teams.concat(data);
534
538
  }
535
539
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/asana",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
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.8",
10
+ version: "0.1.10",
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.8",
9
+ version: "0.1.10",
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.8",
10
+ version: "0.1.10",
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.8",
10
+ version: "1.0.10",
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.10",
9
+ version: "0.0.12",
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.8",
10
+ version: "0.1.10",
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 team added to an organization.",
9
- version: "0.1.9",
9
+ version: "0.1.11",
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.8",
9
+ version: "0.1.10",
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.9",
9
+ version: "0.1.11",
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.8",
10
+ version: "0.1.10",
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 Tags added to any task (Instant)",
9
9
  description: "Emit new event each time a tag is added to any task, optionally filtering by a given set of tags.",
10
- version: "0.0.7",
10
+ version: "0.0.9",
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 Task Assigned in Project (Instant)",
9
9
  description: "Emit new event each time a task is assigned, reassigned or unassigned.",
10
- version: "0.1.1",
10
+ version: "0.1.3",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
@@ -7,13 +7,13 @@ export default {
7
7
  type: "source",
8
8
  name: "New Task Field Updated In Project (Instant)",
9
9
  description: "Emit new event whenever given task fields are updated.",
10
- version: "0.0.7",
10
+ version: "0.0.9",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,
14
14
  project: {
15
15
  label: "Project",
16
- description: "Gid of a project.",
16
+ description: "GID of a project",
17
17
  type: "string",
18
18
  propDefinition: [
19
19
  asana,
@@ -37,20 +37,25 @@ export default {
37
37
  ...common.methods,
38
38
  getWebhookFilter() {
39
39
  return {
40
- filters: [
41
- {
42
- action: "changed",
43
- resource_type: "task",
44
- fields: this.taskFields,
45
- },
46
- ],
47
40
  resource: this.project,
48
41
  };
49
42
  },
43
+ isRelevant({
44
+ resource, change, parent,
45
+ }) {
46
+ const { taskFields } = this;
47
+ return resource.resource_type === "task"
48
+ && (
49
+ taskFields.includes(change?.field)
50
+ || taskFields.includes(parent?.resource_type)
51
+ || taskFields.find((field) => field.slice(0, -1) === parent?.resource_type)
52
+ );
53
+ },
50
54
  async emitEvent(event) {
51
55
  const { events = [] } = event.body || {};
52
56
 
53
57
  const promises = events
58
+ .filter((event) => this.isRelevant(event))
54
59
  .map(async (event) => ({
55
60
  event,
56
61
  task: (await this.asana.getTask({
@@ -7,7 +7,7 @@ export default {
7
7
  type: "source",
8
8
  name: "New Task Updated In Project (Instant)",
9
9
  description: "Emit new event for each update to a task.",
10
- version: "1.1.7",
10
+ version: "1.1.9",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,