@pipedream/asana 0.12.0 → 1.1.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 (40) hide show
  1. package/actions/add-task-to-section/add-task-to-section.mjs +1 -1
  2. package/actions/common/constants.mjs +10 -0
  3. package/actions/create-project/create-project.mjs +1 -1
  4. package/actions/create-subtask/create-subtask.mjs +1 -1
  5. package/actions/create-task/create-task.mjs +1 -1
  6. package/actions/create-task-comment/create-task-comment.mjs +1 -1
  7. package/actions/create-task-from-template/create-task-from-template.mjs +1 -1
  8. package/actions/delete-task/delete-task.mjs +1 -1
  9. package/actions/find-task-by-id/find-task-by-id.mjs +14 -1
  10. package/actions/get-portfolio/get-portfolio.mjs +46 -0
  11. package/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs +62 -8
  12. package/actions/list-organizations-options/list-organizations-options.mjs +1 -1
  13. package/actions/list-portfolio-items/list-portfolio-items.mjs +94 -0
  14. package/actions/list-portfolios/list-portfolios.mjs +83 -0
  15. package/actions/list-task-stories/list-task-stories.mjs +5 -3
  16. package/actions/list-teams/list-teams.mjs +12 -3
  17. package/actions/list-users/list-users.mjs +12 -3
  18. package/actions/list-workspaces/list-workspaces.mjs +12 -3
  19. package/actions/search-projects/search-projects.mjs +59 -18
  20. package/actions/search-sections/search-sections.mjs +39 -8
  21. package/actions/search-tasks/search-tasks.mjs +59 -8
  22. package/actions/search-tasks-premium/search-tasks-premium.mjs +12 -3
  23. package/actions/search-user-projects/search-user-projects.mjs +60 -18
  24. package/actions/update-task/update-task.mjs +1 -1
  25. package/asana.app.mjs +76 -11
  26. package/package.json +1 -1
  27. package/sources/new-completed-task/new-completed-task.mjs +1 -1
  28. package/sources/new-project/new-project.mjs +1 -1
  29. package/sources/new-story/new-story.mjs +1 -1
  30. package/sources/new-subtask/new-subtask.mjs +1 -1
  31. package/sources/new-tag/new-tag.mjs +1 -1
  32. package/sources/new-task/new-task.mjs +1 -1
  33. package/sources/new-team/new-team.mjs +1 -1
  34. package/sources/new-user/new-user.mjs +1 -1
  35. package/sources/new-workspace/new-workspace.mjs +1 -1
  36. package/sources/tag-added-to-task/tag-added-to-task.mjs +1 -1
  37. package/sources/tags-added-to-any-task/tags-added-to-any-task.mjs +1 -1
  38. package/sources/task-assigned-in-project/task-assigned-in-project.mjs +1 -1
  39. package/sources/task-field-updated-in-project/task-field-updated-in-project.mjs +1 -1
  40. 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.13",
8
+ version: "0.2.15",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -19,4 +19,14 @@ export default {
19
19
  "light-warm-gray",
20
20
  "light-yellow",
21
21
  ],
22
+ DEFAULT_PORTFOLIO_ITEM_OPT_FIELDS: [
23
+ "name",
24
+ "archived",
25
+ "created_at",
26
+ "start_on",
27
+ "due_on",
28
+ "owner",
29
+ "resource_type",
30
+ "custom_fields",
31
+ ],
22
32
  };
@@ -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 documentation](https://developers.asana.com/docs/create-a-project)",
8
- version: "0.10.7",
8
+ version: "0.10.9",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.6",
8
+ version: "0.4.8",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.6",
8
+ version: "0.4.8",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.13",
8
+ version: "0.2.15",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.8",
7
+ version: "0.0.10",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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.14",
8
+ version: "0.0.16",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -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.13",
8
+ version: "0.3.0",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -26,10 +26,23 @@ export default {
26
26
  }),
27
27
  ],
28
28
  },
29
+ optFields: {
30
+ propDefinition: [
31
+ asana,
32
+ "optFields",
33
+ ],
34
+ description: "Optional task properties to include in the response (e.g. `created_at`, `due_on`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/docs/get-a-task)",
35
+ optional: true,
36
+ },
29
37
  },
30
38
  async run({ $ }) {
31
39
  const { data: response } = await this.asana.getTask({
32
40
  taskId: this.task_gid,
41
+ params: {
42
+ opt_fields: this.optFields?.length
43
+ ? this.optFields.join(",")
44
+ : undefined,
45
+ },
33
46
  $,
34
47
  });
35
48
 
@@ -0,0 +1,46 @@
1
+ import asana from "../../asana.app.mjs";
2
+
3
+ export default {
4
+ key: "asana-get-portfolio",
5
+ name: "Get Portfolio",
6
+ description: "Returns the complete portfolio record for a single portfolio. Use this after **List Portfolios** to retrieve full portfolio details including custom fields, members, and owner; the `optFields` prop requests specific properties (e.g. `custom_field_settings`, `members`, `start_on`, `due_on`). [See the documentation](https://developers.asana.com/reference/getportfolio)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ asana,
16
+ portfolioId: {
17
+ propDefinition: [
18
+ asana,
19
+ "portfolioId",
20
+ ],
21
+ },
22
+ optFields: {
23
+ propDefinition: [
24
+ asana,
25
+ "optFields",
26
+ ],
27
+ description: "Optional portfolio properties to include in the response (e.g. `custom_field_settings`, `custom_fields`, `members`, `owner`, `start_on`, `due_on`, `created_at`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/reference/getportfolio)",
28
+ optional: true,
29
+ },
30
+ },
31
+ async run({ $ }) {
32
+ const { data: portfolio } = await this.asana.getPortfolio({
33
+ portfolioId: this.portfolioId,
34
+ params: {
35
+ opt_fields: this.optFields?.length
36
+ ? this.optFields.join(",")
37
+ : undefined,
38
+ },
39
+ $,
40
+ });
41
+
42
+ $.export("$summary", `Successfully retrieved portfolio ${portfolio.name || this.portfolioId}`);
43
+
44
+ return portfolio;
45
+ },
46
+ };
@@ -1,10 +1,10 @@
1
- import common from "../common/common.mjs";
1
+ import asana from "../../asana.app.mjs";
2
2
 
3
3
  export default {
4
4
  key: "asana-get-tasks-from-task-list",
5
5
  name: "Get Tasks From Task List",
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.11",
6
+ description: "Returns tasks from the user's personal **My Tasks** inbox — NOT a project task list. Use this when the user asks for 'my tasks', 'my task list', or 'My Tasks'. Only a workspace GID is needed; no project GID required. [See the documentation](https://developers.asana.com/reference/gettasksforusertasklist)",
7
+ version: "1.1.0",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -12,19 +12,73 @@ export default {
12
12
  },
13
13
  type: "action",
14
14
  props: {
15
- ...common.props,
15
+ asana,
16
+ workspace: {
17
+ label: "Workspace",
18
+ description: "The workspace GID to retrieve the user task list from. Use the **List Workspaces** action to find available workspace GIDs.",
19
+ type: "string",
20
+ propDefinition: [
21
+ asana,
22
+ "workspaces",
23
+ ],
24
+ },
25
+ optFields: {
26
+ propDefinition: [
27
+ asana,
28
+ "optFields",
29
+ ],
30
+ description: "Optional task properties to include in the response (e.g. `created_at`, `due_on`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/reference/gettasksforusertasklist)",
31
+ optional: true,
32
+ },
33
+ maxResults: {
34
+ propDefinition: [
35
+ asana,
36
+ "maxResults",
37
+ ],
38
+ },
16
39
  },
17
40
  async run({ $ }) {
18
- const { data: response } = await this.asana.getTasksFromUserTaskList({
41
+ const { data: taskList } = await this.asana.getUserTaskList({
42
+ userId: "me",
19
43
  params: {
20
44
  workspace: this.workspace,
21
- project: this.project,
22
45
  },
23
46
  $,
24
47
  });
25
48
 
26
- $.export("$summary", `Successfully retrieved ${response.length} tasks`);
49
+ let hasMore, count = 0;
50
+ const params = {
51
+ opt_fields: this.optFields?.length
52
+ ? this.optFields.join(",")
53
+ : undefined,
54
+ limit: 100,
55
+ };
56
+ const results = [];
27
57
 
28
- return response;
58
+ do {
59
+ const {
60
+ data, next_page: next,
61
+ } = await this.asana.getTasksForUserTaskList({
62
+ userTaskListId: taskList.gid,
63
+ params,
64
+ $,
65
+ });
66
+
67
+ hasMore = next;
68
+ params.offset = next?.offset;
69
+
70
+ if (data.length === 0) break;
71
+
72
+ for (const task of data) {
73
+ results.push(task);
74
+ if (++count >= this.maxResults) {
75
+ hasMore = false;
76
+ break;
77
+ }
78
+ }
79
+ } while (hasMore);
80
+
81
+ $.export("$summary", `Successfully retrieved ${results.length} tasks`);
82
+ return results;
29
83
  },
30
84
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-list-organizations-options",
5
5
  name: "List Organizations Options",
6
6
  description: "Retrieves available options for the Organizations field.",
7
- version: "0.0.1",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -0,0 +1,94 @@
1
+ import asana from "../../asana.app.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ key: "asana-list-portfolio-items",
6
+ name: "List Portfolio Items",
7
+ description: "Returns a list of the items (projects) in the given portfolio. Use this after **List Portfolios** to answer count, timing, and spend questions; the default Opt Fields include `created_at`, `start_on`, `due_on`, and `custom_fields`. Archived filtering happens client-side because Asana has no server-side filter on this endpoint. [See the documentation](https://developers.asana.com/reference/getitemsforportfolio)",
8
+ version: "0.0.1",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ type: "action",
15
+ props: {
16
+ asana,
17
+ portfolioId: {
18
+ propDefinition: [
19
+ asana,
20
+ "portfolioId",
21
+ ],
22
+ },
23
+ optFields: {
24
+ propDefinition: [
25
+ asana,
26
+ "optFields",
27
+ ],
28
+ description: "Optional item properties to include in the response (defaults to `name`, `archived`, `created_at`, `start_on`, `due_on`, `owner`, `resource_type`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/reference/getitemsforportfolio)",
29
+ optional: true,
30
+ default: constants.DEFAULT_PORTFOLIO_ITEM_OPT_FIELDS,
31
+ },
32
+ excludeArchived: {
33
+ type: "boolean",
34
+ label: "Exclude Archived",
35
+ description: "Filter out archived projects from the results. The filter is applied client-side because Asana has no server-side archived filter on this endpoint.",
36
+ optional: true,
37
+ default: false,
38
+ },
39
+ maxResults: {
40
+ propDefinition: [
41
+ asana,
42
+ "maxResults",
43
+ ],
44
+ },
45
+ },
46
+ async run({ $ }) {
47
+ const optFields = [
48
+ ...(this.optFields ?? []),
49
+ ];
50
+ if (this.excludeArchived && !optFields.includes("archived")) {
51
+ optFields.push("archived");
52
+ }
53
+
54
+ let hasMore, count = 0;
55
+ const params = {
56
+ opt_fields: optFields.length
57
+ ? optFields.join(",")
58
+ : undefined,
59
+ limit: 100,
60
+ };
61
+ const results = [];
62
+
63
+ do {
64
+ const {
65
+ data, next_page: next,
66
+ } = await this.asana.getPortfolioItems({
67
+ portfolioId: this.portfolioId,
68
+ params,
69
+ $,
70
+ });
71
+
72
+ hasMore = next;
73
+ params.offset = next?.offset;
74
+
75
+ if (data.length === 0) break;
76
+
77
+ for (const item of data) {
78
+ if (this.excludeArchived && item.archived) continue;
79
+ results.push(item);
80
+ if (++count >= this.maxResults) {
81
+ hasMore = false;
82
+ break;
83
+ }
84
+ }
85
+ } while (hasMore);
86
+
87
+ $.export("$summary", `${results.length} item${results.length !== 1
88
+ ? "s"
89
+ : ""} retrieved${results.length >= this.maxResults
90
+ ? " (maxResults reached)"
91
+ : ""}`);
92
+ return results;
93
+ },
94
+ };
@@ -0,0 +1,83 @@
1
+ import asana from "../../asana.app.mjs";
2
+
3
+ export default {
4
+ key: "asana-list-portfolios",
5
+ name: "List Portfolios",
6
+ description: "Returns a list of portfolios in the given workspace owned by the given user. Use this to discover portfolio GIDs before calling **Get Portfolio** or **List Portfolio Items**. Owner defaults to the authenticated user; regular API users can only list portfolios they own. [See the documentation](https://developers.asana.com/reference/getportfolios)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ asana,
16
+ workspace: {
17
+ type: "string",
18
+ label: "Workspace",
19
+ description: "The workspace or organization GID to filter portfolios on. Use the **List Workspaces** action to find available workspace GIDs.",
20
+ },
21
+ owner: {
22
+ type: "string",
23
+ label: "Owner",
24
+ description: "The GID of the user who owns the portfolios. Defaults to the authenticated user (`me`). Use the **List Users** action to find user GIDs. Regular API users can only list portfolios they own; service accounts may specify any user.",
25
+ optional: true,
26
+ },
27
+ optFields: {
28
+ propDefinition: [
29
+ asana,
30
+ "optFields",
31
+ ],
32
+ description: "Optional portfolio properties to include in the response (e.g. `created_at`, `due_on`, `members`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/reference/getportfolios)",
33
+ optional: true,
34
+ },
35
+ maxResults: {
36
+ propDefinition: [
37
+ asana,
38
+ "maxResults",
39
+ ],
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ let hasMore, count = 0;
44
+ const params = {
45
+ workspace: this.workspace,
46
+ owner: this.owner || "me",
47
+ opt_fields: this.optFields?.length
48
+ ? this.optFields.join(",")
49
+ : undefined,
50
+ limit: 100,
51
+ };
52
+ const results = [];
53
+
54
+ do {
55
+ const {
56
+ data, next_page: next,
57
+ } = await this.asana.getPortfolios({
58
+ params,
59
+ $,
60
+ });
61
+
62
+ hasMore = next;
63
+ params.offset = next?.offset;
64
+
65
+ if (data.length === 0) break;
66
+
67
+ for (const portfolio of data) {
68
+ results.push(portfolio);
69
+ if (++count >= this.maxResults) {
70
+ hasMore = false;
71
+ break;
72
+ }
73
+ }
74
+ } while (hasMore);
75
+
76
+ $.export("$summary", `${results.length} portfolio${results.length !== 1
77
+ ? "s"
78
+ : ""} retrieved${results.length >= this.maxResults
79
+ ? " (maxResults reached)"
80
+ : ""}`);
81
+ return results;
82
+ },
83
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-list-task-stories",
5
5
  name: "List Task Stories",
6
6
  description: "List stories (including comments) for a task. [See the documentation](https://developers.asana.com/reference/getstoriesfortask)",
7
- version: "0.0.4",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -40,8 +40,10 @@ export default {
40
40
  maxResults: {
41
41
  type: "integer",
42
42
  label: "Max Results",
43
- description: "The maximum number of results to return",
43
+ description: "The maximum total number of results to return across all paginated API calls. Each page fetches up to 100 items (Asana's maximum); this cap is applied after auto-pagination completes.",
44
44
  default: 100,
45
+ min: 1,
46
+ max: 9999,
45
47
  optional: true,
46
48
  },
47
49
  },
@@ -59,7 +61,7 @@ export default {
59
61
  let hasMore, count = 0;
60
62
 
61
63
  const params = {
62
- limit: this.maxResults,
64
+ limit: 100,
63
65
  opt_fields: this.optFields
64
66
  ? this.optFields?.join(",")
65
67
  : undefined,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-list-teams",
5
5
  name: "List Teams",
6
6
  description: "Retrieves all teams in a specified Asana workspace. Use this action to discover available teams for creating projects, adding team members, or organizing work by department. Requires a workspace GID, which you can obtain from the **List Workspaces** action. The authenticated user must have access to the workspace; only teams visible to the user are returned. Results are paginated (default 25, max 100 per page); use the returned offset token to fetch additional pages. To include optional fields like description, visibility, or access levels, specify them in Opt Fields. Consider following up with **Create Project** to create a project under a team, or **List Users** to find team members. [See the documentation](https://developers.asana.com/reference/getteamsforworkspace)",
7
- version: "0.0.1",
7
+ version: "1.0.1",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -74,7 +74,16 @@ export default {
74
74
  offset: this.offset?.trim() || undefined,
75
75
  },
76
76
  });
77
- $.export("$summary", `Successfully fetched ${response.data?.length} teams`);
78
- return response;
77
+ const truncated = !!response.next_page?.offset;
78
+ $.export("$summary", `Successfully fetched ${response.data?.length} teams${
79
+ truncated
80
+ ? " (more pages available)"
81
+ : ""
82
+ }`);
83
+ return {
84
+ data: response.data,
85
+ truncated,
86
+ next_offset: response.next_page?.offset || null,
87
+ };
79
88
  },
80
89
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-list-users",
5
5
  name: "List Users",
6
6
  description: "Retrieves all users in a specified Asana workspace. Use this action to populate assignee choices for tasks, verify workspace membership, or audit user access. Requires a workspace GID, which you can obtain from the **List Workspaces** action. The authenticated user must have access to the workspace. Results are paginated; use the returned offset token to fetch additional pages. To include optional fields like email or photo, specify them in Opt Fields. Consider following up with **Create Task** or **Update Task** to assign work to the retrieved users. [See the documentation](https://developers.asana.com/reference/getusersforworkspace)",
7
- version: "0.0.1",
7
+ version: "1.0.1",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -54,7 +54,16 @@ export default {
54
54
  offset: this.offset?.trim() || undefined,
55
55
  },
56
56
  });
57
- $.export("$summary", `Successfully fetched ${response.data?.length} users`);
58
- return response;
57
+ const truncated = !!response.next_page?.offset;
58
+ $.export("$summary", `Successfully fetched ${response.data?.length} users${
59
+ truncated
60
+ ? " (more pages available)"
61
+ : ""
62
+ }`);
63
+ return {
64
+ data: response.data,
65
+ truncated,
66
+ next_offset: response.next_page?.offset || null,
67
+ };
59
68
  },
60
69
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "asana-list-workspaces",
5
5
  name: "List Workspaces",
6
6
  description: "List workspaces available to the authenticated Asana account. Use this when you need a workspace GID before running **List Teams** or other workspace-scoped actions. `optFields` can include optional workspace properties such as `email_domains` and `is_organization`; leave `offset` empty for the first page and pass a returned offset token (for example, `3:0:abcdef123456`) to fetch the next page. [See the documentation](https://developers.asana.com/reference/getworkspaces)",
7
- version: "0.0.1",
7
+ version: "1.0.1",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -52,7 +52,16 @@ export default {
52
52
  offset: this.offset?.trim() || undefined,
53
53
  },
54
54
  });
55
- $.export("$summary", `Successfully fetched ${response.data?.length} workspaces`);
56
- return response;
55
+ const truncated = !!response.next_page?.offset;
56
+ $.export("$summary", `Successfully fetched ${response.data?.length} workspaces${
57
+ truncated
58
+ ? " (more pages available)"
59
+ : ""
60
+ }`);
61
+ return {
62
+ data: response.data,
63
+ truncated,
64
+ next_offset: response.next_page?.offset || null,
65
+ };
57
66
  },
58
67
  };
@@ -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.13",
6
+ version: "0.3.0",
7
7
  annotations: {
8
8
  destructiveHint: false,
9
9
  openWorldHint: true,
@@ -21,9 +21,8 @@ export default {
21
21
  },
22
22
  workspace: {
23
23
  label: "Workspace",
24
- description: "The workspace or organization to filter projects on.",
24
+ description: "The workspace or organization to filter projects on. Use the **List Workspaces** action to find available workspace GIDs.",
25
25
  type: "string",
26
- optional: true,
27
26
  propDefinition: [
28
27
  asana,
29
28
  "workspaces",
@@ -35,25 +34,67 @@ export default {
35
34
  type: "boolean",
36
35
  optional: true,
37
36
  },
37
+ optFields: {
38
+ propDefinition: [
39
+ asana,
40
+ "optFields",
41
+ ],
42
+ description: "Optional project properties to include in the response (e.g. `created_at`, `start_on`, `due_on`, `archived`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/docs/get-multiple-projects)",
43
+ optional: true,
44
+ },
45
+ maxResults: {
46
+ propDefinition: [
47
+ asana,
48
+ "maxResults",
49
+ ],
50
+ },
38
51
  },
39
52
  async run({ $ }) {
40
- const {
41
- name,
42
- workspace,
43
- archived,
44
- } = this;
53
+ const optFields = Array.isArray(this.optFields)
54
+ ? [
55
+ ...this.optFields,
56
+ ]
57
+ : [];
58
+ if (this.name && optFields.length && !optFields.includes("name")) {
59
+ // the name filter below needs project.name present in the response
60
+ optFields.push("name");
61
+ }
45
62
 
46
- const { data: projects } = await this.asana.getProjects({
47
- params: {
48
- workspace,
49
- archived,
50
- },
51
- $,
52
- });
63
+ let hasMore, count = 0;
64
+ const params = {
65
+ workspace: this.workspace,
66
+ archived: this.archived,
67
+ opt_fields: optFields.length
68
+ ? optFields.join(",")
69
+ : undefined,
70
+ limit: 100,
71
+ };
72
+ const results = [];
53
73
 
54
- $.export("$summary", "Successfully retrieved projects");
74
+ do {
75
+ const {
76
+ data, next_page: next,
77
+ } = await this.asana.getProjects({
78
+ params,
79
+ $,
80
+ });
81
+
82
+ hasMore = next;
83
+ params.offset = next?.offset;
55
84
 
56
- if (this.name) return projects.filter((project) => project.name.includes(name));
57
- else return projects;
85
+ if (data.length === 0) break;
86
+
87
+ for (const project of data) {
88
+ if (this.name && !project.name.includes(this.name)) continue;
89
+ results.push(project);
90
+ if (++count >= this.maxResults) {
91
+ hasMore = false;
92
+ break;
93
+ }
94
+ }
95
+ } while (hasMore);
96
+
97
+ $.export("$summary", "Successfully retrieved projects");
98
+ return results;
58
99
  },
59
100
  };
@@ -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.13",
7
+ version: "0.3.1",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -18,16 +18,47 @@ export default {
18
18
  description: "The name of the section to search for.",
19
19
  type: "string",
20
20
  },
21
+ maxResults: {
22
+ propDefinition: [
23
+ common.props.asana,
24
+ "maxResults",
25
+ ],
26
+ },
21
27
  },
22
28
  async run({ $ }) {
23
- const { data: sections } = await this.asana.getSections({
24
- project: this.project,
25
- $,
26
- });
29
+ let hasMore, count = 0;
30
+ const params = {
31
+ limit: 100,
32
+ };
33
+ const results = [];
34
+
35
+ do {
36
+ const {
37
+ data, next_page: next,
38
+ } = await this.asana.getSections({
39
+ project: this.project,
40
+ params,
41
+ $,
42
+ });
43
+
44
+ hasMore = next;
45
+ params.offset = next?.offset;
46
+
47
+ if (data.length === 0) break;
27
48
 
28
- $.export("$summary", "Successfully retrieved sections");
49
+ for (const section of data) {
50
+ if (this.name && !section.name.includes(this.name)) continue;
51
+ results.push(section);
52
+ if (++count >= this.maxResults) {
53
+ hasMore = false;
54
+ break;
55
+ }
56
+ }
57
+ } while (hasMore);
29
58
 
30
- if (this.name) return sections.filter((section) => section.name.includes(this.name));
31
- else return sections;
59
+ $.export("$summary", `Retrieved ${results.length} section${results.length !== 1
60
+ ? "s"
61
+ : ""}`);
62
+ return results;
32
63
  },
33
64
  };
@@ -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.7",
9
+ version: "0.5.0",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -62,6 +62,20 @@ export default {
62
62
  description: "Only return tasks that have been modified since the given time. ISO 8601 date string",
63
63
  optional: true,
64
64
  },
65
+ optFields: {
66
+ propDefinition: [
67
+ asana,
68
+ "optFields",
69
+ ],
70
+ description: "Optional task properties to include in the response (e.g. `created_at`, `due_on`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)",
71
+ optional: true,
72
+ },
73
+ maxResults: {
74
+ propDefinition: [
75
+ asana,
76
+ "maxResults",
77
+ ],
78
+ },
65
79
  },
66
80
  async run({ $ }) {
67
81
  if (!this.project && !this.section && !this.assignee) {
@@ -72,9 +86,24 @@ export default {
72
86
  throw new ConfigurationError("Must specify only one of Assignee, Project, or Project + Section");
73
87
  }
74
88
 
89
+ const optFields = Array.isArray(this.optFields)
90
+ ? [
91
+ ...this.optFields,
92
+ ]
93
+ : [];
94
+ if (optFields.length && !optFields.includes("name")) {
95
+ // the name filter below needs task.name present in the response
96
+ optFields.push("name");
97
+ }
98
+
99
+ let hasMore, count = 0;
75
100
  const params = {
76
101
  completed_since: this.completedSince,
77
102
  modified_since: this.modifiedSince,
103
+ opt_fields: optFields.length
104
+ ? optFields.join(",")
105
+ : undefined,
106
+ limit: 100,
78
107
  };
79
108
 
80
109
  if (this.assignee) {
@@ -86,14 +115,36 @@ export default {
86
115
  params.project = this.project;
87
116
  }
88
117
 
89
- const { data: tasks } = await this.asana.getTasks({
90
- params,
91
- $,
92
- });
118
+ const results = [];
119
+
120
+ do {
121
+ const {
122
+ data, next_page: next,
123
+ } = await this.asana.getTasks({
124
+ params,
125
+ $,
126
+ });
127
+
128
+ hasMore = next;
129
+ params.offset = next?.offset;
130
+
131
+ if (data.length === 0) break;
93
132
 
94
- $.export("$summary", "Successfully retrieved tasks");
133
+ for (const task of data) {
134
+ if (!task.name.includes(this.name)) continue;
135
+ results.push(task);
136
+ if (++count >= this.maxResults) {
137
+ hasMore = false;
138
+ break;
139
+ }
140
+ }
141
+ } while (hasMore);
95
142
 
96
- if (this.name) return tasks.filter((task) => task.name.includes(this.name));
97
- else return tasks;
143
+ $.export("$summary", `${results.length} task${results.length !== 1
144
+ ? "s"
145
+ : ""} retrieved${results.length >= this.maxResults
146
+ ? " (maxResults reached)"
147
+ : ""}`);
148
+ return results;
98
149
  },
99
150
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "asana-search-tasks-premium",
6
6
  name: "Search Tasks Premium",
7
7
  description: "Searches for a task by name, assignee, section, project, completed since, and modified since. Requires a Premium Asana account. [See the documentation](https://developers.asana.com/reference/searchtasksforworkspace)",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -68,6 +68,12 @@ export default {
68
68
  description: "Only return tasks modified since this time. ISO 8601 format (for example: `2026-04-14` or `2026-04-14T00:00:00Z`).",
69
69
  optional: true,
70
70
  },
71
+ maxResults: {
72
+ propDefinition: [
73
+ asana,
74
+ "maxResults",
75
+ ],
76
+ },
71
77
  },
72
78
  async run({ $ }) {
73
79
  const params = {
@@ -77,6 +83,7 @@ export default {
77
83
  "sections.any": this.section,
78
84
  "projects.any": this.project,
79
85
  "text": this.name,
86
+ "limit": 100,
80
87
  };
81
88
 
82
89
  const { data: tasks } = await this.asana.searchTasks({
@@ -85,8 +92,10 @@ export default {
85
92
  $,
86
93
  });
87
94
 
95
+ const limited = this.maxResults
96
+ ? tasks.slice(0, this.maxResults)
97
+ : tasks;
88
98
  $.export("$summary", "Successfully retrieved tasks");
89
-
90
- return tasks;
99
+ return limited;
91
100
  },
92
101
  };
@@ -1,11 +1,10 @@
1
- import _ from "lodash";
2
1
  import asana from "../../asana.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "asana-search-user-projects",
6
5
  name: "Get list of user projects",
7
6
  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.6",
7
+ version: "0.6.0",
9
8
  annotations: {
10
9
  destructiveHint: false,
11
10
  openWorldHint: true,
@@ -16,7 +15,7 @@ export default {
16
15
  asana,
17
16
  workspace: {
18
17
  label: "Workspace",
19
- description: "Gid of a workspace.",
18
+ description: "The workspace GID. Use the **List Workspaces** action to find available workspace GIDs.",
20
19
  type: "string",
21
20
  propDefinition: [
22
21
  asana,
@@ -35,28 +34,71 @@ export default {
35
34
  }),
36
35
  ],
37
36
  },
37
+ optFields: {
38
+ propDefinition: [
39
+ asana,
40
+ "optFields",
41
+ ],
42
+ description: "Optional project properties to include in the response (e.g. `created_at`, `start_on`, `due_on`, `archived`, `custom_fields`). Nested paths are allowed; `gid` is always returned. [See the documentation](https://developers.asana.com/docs/get-multiple-projects)",
43
+ optional: true,
44
+ },
45
+ maxResults: {
46
+ propDefinition: [
47
+ asana,
48
+ "maxResults",
49
+ ],
50
+ },
38
51
  },
39
52
  async run({ $ }) {
40
- let { data: projects } = await this.asana.getProjects({
41
- params: {
42
- workspace: this.workspace,
43
- },
44
- $,
45
- });
53
+ // membership filtering below reads project.members, so always request the
54
+ // base fields; merge in any user-requested opt_fields on top.
55
+ const optFields = new Set([
56
+ "gid",
57
+ "name",
58
+ "resource_type",
59
+ "members",
60
+ ]);
61
+ if (Array.isArray(this.optFields)) {
62
+ for (const field of this.optFields) {
63
+ optFields.add(field);
64
+ }
65
+ }
66
+
67
+ let hasMore, count = 0;
68
+ const params = {
69
+ workspace: this.workspace,
70
+ opt_fields: [
71
+ ...optFields,
72
+ ].join(","),
73
+ limit: 100,
74
+ };
75
+ const allProjects = [];
46
76
 
47
- projects = projects.filter(async (project) => {
48
- const { data } = await this.asana.getProject({
49
- projectId: project.gid,
77
+ do {
78
+ const {
79
+ data, next_page: next,
80
+ } = await this.asana.getProjects({
81
+ params,
50
82
  $,
51
83
  });
52
84
 
53
- return data.members && !!_.find(data.members, {
54
- gid: this.user,
55
- });
56
- });
85
+ hasMore = next;
86
+ params.offset = next?.offset;
57
87
 
58
- $.export("$summary", "Successfully retrieved projects of user");
88
+ if (data.length === 0) break;
89
+
90
+ for (const project of data) {
91
+ const isMember = project.members && project.members.some((m) => m.gid === this.user);
92
+ if (!isMember) continue;
93
+ allProjects.push(project);
94
+ if (++count >= this.maxResults) {
95
+ hasMore = false;
96
+ break;
97
+ }
98
+ }
99
+ } while (hasMore);
59
100
 
60
- return projects;
101
+ $.export("$summary", "Successfully retrieved projects of user");
102
+ return allProjects;
61
103
  },
62
104
  };
@@ -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.6",
8
+ version: "0.4.8",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
package/asana.app.mjs CHANGED
@@ -19,7 +19,7 @@ export default {
19
19
  },
20
20
  workspaces: {
21
21
  label: "Workspaces",
22
- description: "List of workspaces. This field uses the workspace GID.",
22
+ description: "List of workspaces. Use the **List Workspaces** action to retrieve available workspace GIDs.",
23
23
  type: "string[]",
24
24
  async options({ prevContext }) {
25
25
  const params = {
@@ -47,7 +47,7 @@ export default {
47
47
  },
48
48
  teams: {
49
49
  label: "Teams",
50
- description: "List of teams. This field uses the team GID.",
50
+ description: "List of teams. Use the **List Teams** action to retrieve available team GIDs.",
51
51
  type: "string[]",
52
52
  async options({ workspace }) {
53
53
  const teams = await this.getTeams(workspace);
@@ -121,7 +121,7 @@ export default {
121
121
  },
122
122
  users: {
123
123
  label: "Users",
124
- description: "List of users. This field uses the user GID.",
124
+ description: "List of users. Use the **List Users** action to retrieve available user GIDs.",
125
125
  type: "string[]",
126
126
  async options({
127
127
  prevContext, workspace,
@@ -272,6 +272,26 @@ export default {
272
272
  };
273
273
  },
274
274
  },
275
+ maxResults: {
276
+ type: "integer",
277
+ label: "Max Results",
278
+ description: "The maximum total number of results to return across all paginated API calls. Each page fetches up to 100 items (Asana's maximum); this cap is applied after auto-pagination completes.",
279
+ default: 100,
280
+ min: 1,
281
+ max: 9999,
282
+ optional: true,
283
+ },
284
+ optFields: {
285
+ type: "string[]",
286
+ label: "Opt Fields",
287
+ description: "Optional properties to include in the response, as a list of field paths. Nested paths are allowed (e.g. `owner.name`, `custom_fields.name`); `gid` is always returned. [See the documentation](https://developers.asana.com/docs/inputoutput-options)",
288
+ optional: true,
289
+ },
290
+ portfolioId: {
291
+ type: "string",
292
+ label: "Portfolio",
293
+ description: "The portfolio GID. Use the **List Portfolios** action to find available portfolio GIDs.",
294
+ },
275
295
  },
276
296
  methods: {
277
297
  /**
@@ -371,7 +391,9 @@ export default {
371
391
  * @returns {string} An Asana Organizations list.
372
392
  */
373
393
  async getOrganizations() {
374
- const params = {};
394
+ const params = {
395
+ opt_fields: "is_organization",
396
+ };
375
397
  const workspaces = [];
376
398
  do {
377
399
  const {
@@ -383,13 +405,7 @@ export default {
383
405
  params.offset = next?.offset;
384
406
  } while (params.offset);
385
407
 
386
- const organizations = workspaces.filter(async (workspace) => {
387
- const { data } = await this.getWorkspace({
388
- workspaceId: workspace.gid,
389
- });
390
- return data?.is_organization;
391
- });
392
- return organizations;
408
+ return workspaces.filter((workspace) => workspace.is_organization);
393
409
  },
394
410
  /**
395
411
  * Get an Asana Project.
@@ -417,6 +433,47 @@ export default {
417
433
  ...opts,
418
434
  });
419
435
  },
436
+ /**
437
+ * Get an Asana Portfolio.
438
+ *
439
+ * @param {string} portfolioId - The portfolio GID.
440
+ *
441
+ * @returns {string} An Asana Portfolio.
442
+ */
443
+ getPortfolio({
444
+ portfolioId, ...opts
445
+ }) {
446
+ return this._makeRequest({
447
+ path: `portfolios/${portfolioId}`,
448
+ ...opts,
449
+ });
450
+ },
451
+ /**
452
+ * Get an Asana Portfolio list.
453
+ *
454
+ * @returns {string} An Asana Portfolio list.
455
+ */
456
+ getPortfolios(opts = {}) {
457
+ return this._makeRequest({
458
+ path: "portfolios",
459
+ ...opts,
460
+ });
461
+ },
462
+ /**
463
+ * Get the items in an Asana Portfolio.
464
+ *
465
+ * @param {string} portfolioId - The portfolio GID.
466
+ *
467
+ * @returns {string} An Asana Project list.
468
+ */
469
+ getPortfolioItems({
470
+ portfolioId, ...opts
471
+ }) {
472
+ return this._makeRequest({
473
+ path: `portfolios/${portfolioId}/items`,
474
+ ...opts,
475
+ });
476
+ },
420
477
  /**
421
478
  * Get an Asana Story.
422
479
  *
@@ -635,6 +692,14 @@ export default {
635
692
  $,
636
693
  });
637
694
  },
695
+ getTasksForUserTaskList({
696
+ userTaskListId, ...opts
697
+ }) {
698
+ return this._makeRequest({
699
+ path: `user_task_lists/${userTaskListId}/tasks`,
700
+ ...opts,
701
+ });
702
+ },
638
703
  listTaskTemplates(opts = {}) {
639
704
  return this._makeRequest({
640
705
  path: "task_templates",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/asana",
3
- "version": "0.12.0",
3
+ "version": "1.1.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.12",
10
+ version: "0.1.14",
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.12",
9
+ version: "0.1.14",
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.12",
10
+ version: "0.1.14",
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.12",
10
+ version: "1.0.14",
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.14",
9
+ version: "0.0.16",
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.12",
10
+ version: "0.1.14",
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.13",
9
+ version: "0.1.15",
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.12",
9
+ version: "0.1.14",
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.13",
9
+ version: "0.1.15",
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.12",
10
+ version: "0.1.14",
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.11",
10
+ version: "0.0.13",
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.5",
10
+ version: "0.1.7",
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 Field Updated In Project (Instant)",
9
9
  description: "Emit new event whenever given task fields are updated.",
10
- version: "0.0.11",
10
+ version: "0.0.13",
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 Updated In Project (Instant)",
9
9
  description: "Emit new event for each update to a task.",
10
- version: "1.1.11",
10
+ version: "1.1.13",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  ...common.props,