@pipedream/asana 1.1.0 → 2.0.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 (43) hide show
  1. package/actions/add-task-to-section/add-task-to-section.mjs +5 -16
  2. package/actions/common/common.mjs +3 -6
  3. package/actions/create-project/create-project.mjs +8 -16
  4. package/actions/create-subtask/create-subtask.mjs +9 -23
  5. package/actions/create-task/create-task.mjs +9 -23
  6. package/actions/create-task-comment/create-task-comment.mjs +5 -7
  7. package/actions/create-task-from-template/create-task-from-template.mjs +4 -6
  8. package/actions/delete-task/delete-task.mjs +4 -6
  9. package/actions/find-task-by-id/find-task-by-id.mjs +5 -7
  10. package/actions/get-portfolio/get-portfolio.mjs +3 -2
  11. package/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs +3 -2
  12. package/actions/list-organizations-options/list-organizations-options.mjs +10 -3
  13. package/actions/list-portfolio-items/list-portfolio-items.mjs +3 -2
  14. package/actions/list-portfolios/list-portfolios.mjs +4 -3
  15. package/actions/list-tags/list-tags.mjs +69 -0
  16. package/actions/list-task-stories/list-task-stories.mjs +28 -17
  17. package/actions/list-task-templates/list-task-templates.mjs +61 -0
  18. package/actions/list-teams/list-teams.mjs +4 -3
  19. package/actions/list-users/list-users.mjs +4 -3
  20. package/actions/list-workspaces/list-workspaces.mjs +3 -2
  21. package/actions/search-projects/search-projects.mjs +82 -35
  22. package/actions/search-sections/search-sections.mjs +9 -6
  23. package/actions/search-tasks/search-tasks.mjs +9 -14
  24. package/actions/search-tasks-premium/search-tasks-premium.mjs +10 -13
  25. package/actions/search-user-projects/search-user-projects.mjs +16 -9
  26. package/actions/update-task/update-task.mjs +6 -13
  27. package/asana.app.mjs +77 -88
  28. package/package.json +1 -1
  29. package/sources/common/common.mjs +1 -1
  30. package/sources/new-completed-task/new-completed-task.mjs +2 -2
  31. package/sources/new-project/new-project.mjs +1 -1
  32. package/sources/new-story/new-story.mjs +2 -2
  33. package/sources/new-subtask/new-subtask.mjs +3 -3
  34. package/sources/new-tag/new-tag.mjs +2 -2
  35. package/sources/new-task/new-task.mjs +2 -2
  36. package/sources/new-team/new-team.mjs +1 -1
  37. package/sources/new-user/new-user.mjs +1 -1
  38. package/sources/new-workspace/new-workspace.mjs +1 -1
  39. package/sources/tag-added-to-task/tag-added-to-task.mjs +3 -3
  40. package/sources/tags-added-to-any-task/tags-added-to-any-task.mjs +3 -3
  41. package/sources/task-assigned-in-project/task-assigned-in-project.mjs +3 -3
  42. package/sources/task-field-updated-in-project/task-field-updated-in-project.mjs +2 -5
  43. package/sources/task-updated-in-project/task-updated-in-project.mjs +4 -4
@@ -0,0 +1,69 @@
1
+ import asana from "../../asana.app.mjs";
2
+
3
+ export default {
4
+ key: "asana-list-tags",
5
+ name: "List Tags",
6
+ description: "Returns tags in an Asana workspace, up to 100 by default (increase `maxResults` for more) — not guaranteed to include every tag in a large workspace. Use this to discover tag GIDs before applying tags to tasks with **Create Task** or **Create Subtask** (the `tags` prop). Example: call with `workspace: '1200123456789012'` → returns tags like `[{gid: '1202345678901234', name: 'urgent'}]`. [See the documentation](https://developers.asana.com/reference/gettags)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ ai: "optimized",
10
+ annotations: {
11
+ destructiveHint: false,
12
+ openWorldHint: true,
13
+ readOnlyHint: true,
14
+ },
15
+ props: {
16
+ asana,
17
+ workspace: {
18
+ label: "Workspace",
19
+ description: "The workspace GID to list tags for, e.g. `1200123456789012`. Use the **List Workspaces** action to find available workspace GIDs.",
20
+ type: "string",
21
+ propDefinition: [
22
+ asana,
23
+ "workspaces",
24
+ ],
25
+ },
26
+ maxResults: {
27
+ propDefinition: [
28
+ asana,
29
+ "maxResults",
30
+ ],
31
+ },
32
+ },
33
+ async run({ $ }) {
34
+ const defaultLimit = 100;
35
+ let hasMore, count = 0;
36
+ const params = {
37
+ workspace: this.workspace,
38
+ limit: defaultLimit,
39
+ };
40
+ const results = [];
41
+
42
+ do {
43
+ const {
44
+ data, next_page: next,
45
+ } = await this.asana.getTags({
46
+ params,
47
+ $,
48
+ });
49
+
50
+ hasMore = next;
51
+ params.offset = next?.offset;
52
+
53
+ if (!data || data.length === 0) break;
54
+
55
+ for (const tag of data) {
56
+ results.push(tag);
57
+ if (++count >= this.maxResults) {
58
+ hasMore = false;
59
+ break;
60
+ }
61
+ }
62
+ } while (hasMore);
63
+
64
+ $.export("$summary", `${results.length} tag${results.length !== 1
65
+ ? "s"
66
+ : ""} retrieved`);
67
+ return results;
68
+ },
69
+ };
@@ -3,8 +3,9 @@ import common from "../common/common.mjs";
3
3
  export default {
4
4
  key: "asana-list-task-stories",
5
5
  name: "List Task Stories",
6
- description: "List stories (including comments) for a task. [See the documentation](https://developers.asana.com/reference/getstoriesfortask)",
7
- version: "0.0.6",
6
+ description: "Returns all stories (comments, activity log entries, system messages) for an Asana task. Use this to retrieve the comment history and audit trail for a task. Set `commentsOnly: true` to filter to only comment stories. Returns an array of story records each with `gid`, `type`, `text`, and `created_at`. Example: call with `project: '1204567890123456'`, `taskId: '1202345678901234'` → returns stories including `{gid: '1209012345678901', type: 'comment', text: 'Approved!', created_at: '2026-09-01T10:00:00Z'}`. [See the documentation](https://developers.asana.com/reference/getstoriesfortask)",
7
+ version: "1.0.0",
8
+ ai: "optimized",
8
9
  annotations: {
9
10
  destructiveHint: false,
10
11
  openWorldHint: true,
@@ -12,17 +13,14 @@ export default {
12
13
  },
13
14
  type: "action",
14
15
  props: {
15
- ...common.props,
16
+ asana: common.props.asana,
16
17
  taskId: {
17
18
  label: "Task GID",
18
- description: "The ID of the task to retrieve stories for",
19
+ description: "The ID of the task to retrieve stories for, e.g. `1202345678901234`. Use **Search Tasks** to find available task GIDs.",
19
20
  type: "string",
20
21
  propDefinition: [
21
22
  common.props.asana,
22
23
  "tasks",
23
- (c) => ({
24
- project: c.project,
25
- }),
26
24
  ],
27
25
  },
28
26
  commentsOnly: {
@@ -38,13 +36,10 @@ export default {
38
36
  optional: true,
39
37
  },
40
38
  maxResults: {
41
- type: "integer",
42
- label: "Max Results",
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
- default: 100,
45
- min: 1,
46
- max: 9999,
47
- optional: true,
39
+ propDefinition: [
40
+ common.props.asana,
41
+ "maxResults",
42
+ ],
48
43
  },
49
44
  },
50
45
  methods: {
@@ -60,11 +55,27 @@ export default {
60
55
  async run({ $ }) {
61
56
  let hasMore, count = 0;
62
57
 
58
+ // commentsOnly filters on story.type below, so that field must always be
59
+ // requested — it isn't part of the API's compact default and would
60
+ // otherwise be silently undefined whenever the caller supplies their own
61
+ // optFields, making every story fail the filter.
62
+ const optFields = new Set([
63
+ "gid",
64
+ "type",
65
+ "text",
66
+ "created_at",
67
+ ]);
68
+ if (Array.isArray(this.optFields)) {
69
+ for (const field of this.optFields) {
70
+ optFields.add(field);
71
+ }
72
+ }
73
+
63
74
  const params = {
64
75
  limit: 100,
65
- opt_fields: this.optFields
66
- ? this.optFields?.join(",")
67
- : undefined,
76
+ opt_fields: [
77
+ ...optFields,
78
+ ].join(","),
68
79
  };
69
80
 
70
81
  const results = [];
@@ -0,0 +1,61 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ key: "asana-list-task-templates",
5
+ name: "List Task Templates",
6
+ description: "Returns task templates in an Asana project, up to 100 by default (increase `maxResults` for more) — not guaranteed to include every template in a project with many. Use this to discover task template GIDs before calling **Create Task from Template** (the `taskTemplate` prop). Example: call with `project: '1204567890123456'` → returns templates like `[{gid: '1205678901234567', name: 'Bug Report Template'}]`. [See the documentation](https://developers.asana.com/reference/gettasktemplates)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ ai: "optimized",
10
+ annotations: {
11
+ destructiveHint: false,
12
+ openWorldHint: true,
13
+ readOnlyHint: true,
14
+ },
15
+ props: {
16
+ asana: common.props.asana,
17
+ project: common.props.project,
18
+ maxResults: {
19
+ propDefinition: [
20
+ common.props.asana,
21
+ "maxResults",
22
+ ],
23
+ },
24
+ },
25
+ async run({ $ }) {
26
+ const DEFAULT_LIMIT = 100;
27
+ let hasMore, count = 0;
28
+ const params = {
29
+ project: this.project,
30
+ limit: DEFAULT_LIMIT,
31
+ };
32
+ const results = [];
33
+
34
+ do {
35
+ const {
36
+ data, next_page: next,
37
+ } = await this.asana.listTaskTemplates({
38
+ params,
39
+ $,
40
+ });
41
+
42
+ hasMore = next;
43
+ params.offset = next?.offset;
44
+
45
+ if (!data || data.length === 0) break;
46
+
47
+ for (const template of data) {
48
+ results.push(template);
49
+ if (++count >= this.maxResults) {
50
+ hasMore = false;
51
+ break;
52
+ }
53
+ }
54
+ } while (hasMore);
55
+
56
+ $.export("$summary", `${results.length} task template${results.length !== 1
57
+ ? "s"
58
+ : ""} retrieved`);
59
+ return results;
60
+ },
61
+ };
@@ -3,14 +3,15 @@ import asana from "../../asana.app.mjs";
3
3
  export default {
4
4
  key: "asana-list-teams",
5
5
  name: "List Teams",
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: "1.0.1",
6
+ description: "Retrieves all teams in a specified Asana workspace. Use this action to discover available team GIDs for creating projects or organizing work by department. Requires a workspace GID from **List Workspaces**. Results are paginated (default 25 per page); pass the returned `next_offset` as `offset` to fetch additional pages. Consider following up with **Create Project** to create a project under a team. Example: call with `workspace: '1200123456789012'` → returns `{data: [{gid: '1203456789012345', name: 'Design'}, ...], next_offset: null}`. [See the documentation](https://developers.asana.com/reference/getteamsforworkspace)",
7
+ version: "1.0.3",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
11
11
  readOnlyHint: true,
12
12
  },
13
13
  type: "action",
14
+ ai: "optimized",
14
15
  props: {
15
16
  asana,
16
17
  workspace: {
@@ -20,7 +21,7 @@ export default {
20
21
  ],
21
22
  type: "string",
22
23
  label: "Workspace",
23
- description: "The workspace to list teams for. This field uses the workspace GID (e.g. \"120111222333444\").",
24
+ description: "The workspace to list teams for (a real workspace GID, not the example value below). Use **List Workspaces** to find valid GIDs — do not guess or reuse the example shown here. Format example: \"120111222333444\".",
24
25
  },
25
26
  optFields: {
26
27
  type: "string[]",
@@ -3,14 +3,15 @@ import asana from "../../asana.app.mjs";
3
3
  export default {
4
4
  key: "asana-list-users",
5
5
  name: "List Users",
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: "1.0.1",
6
+ description: "Retrieves all users in a specified Asana workspace. Use this to get user GIDs for assignee or owner fields in **Create Task** or **Update Task**. Requires a workspace GID from **List Workspaces**. Results are paginated; pass the returned `next_offset` as `offset` to fetch additional pages. Example: call with `workspace: '1200123456789012'`, `optFields: ['name','email']` → returns `{data: [{gid: '1198765432109876', name: 'Jane Doe', email: 'jane@acme.com'}, ...]}`. [See the documentation](https://developers.asana.com/reference/getusersforworkspace)",
7
+ version: "1.0.3",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
11
11
  readOnlyHint: true,
12
12
  },
13
13
  type: "action",
14
+ ai: "optimized",
14
15
  props: {
15
16
  asana,
16
17
  workspace: {
@@ -20,7 +21,7 @@ export default {
20
21
  ],
21
22
  type: "string",
22
23
  label: "Workspace",
23
- description: "The workspace to list users for. This field uses the workspace GID (e.g., \"1234567890123456\").",
24
+ description: "The workspace to list users for (a real workspace GID, not the example value below, and not the string \"me\"). Use **List Workspaces** to find valid GIDs — do not guess or reuse the example shown here. Format example: \"1234567890123456\".",
24
25
  },
25
26
  optFields: {
26
27
  type: "string[]",
@@ -3,9 +3,10 @@ import asana from "../../asana.app.mjs";
3
3
  export default {
4
4
  key: "asana-list-workspaces",
5
5
  name: "List Workspaces",
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: "1.0.1",
6
+ description: "Lists all Asana workspaces available to the authenticated account. Use this to get workspace GIDs required by **List Teams**, **List Users**, **Search Tasks**, **Create Task**, and other workspace-scoped actions. Pass a returned `next_offset` as `offset` to fetch additional pages. Example: call with no params → returns `{data: [{gid: '1200123456789012', name: 'Acme Corp'}, ...]}` (pass `optFields: ['is_organization']` to also get whether each workspace is an organization). [See the documentation](https://developers.asana.com/reference/getworkspaces)",
7
+ version: "1.0.3",
8
8
  type: "action",
9
+ ai: "optimized",
9
10
  annotations: {
10
11
  destructiveHint: false,
11
12
  openWorldHint: true,
@@ -3,34 +3,36 @@ import asana from "../../asana.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "asana-search-projects",
6
- version: "0.3.0",
6
+ version: "0.3.4",
7
+ ai: "optimized",
7
8
  annotations: {
8
9
  destructiveHint: false,
9
10
  openWorldHint: true,
10
11
  readOnlyHint: true,
11
12
  },
12
13
  name: "Search Projects",
13
- description: "Finds an existing project. [See the documentation](https://developers.asana.com/docs/get-multiple-projects)",
14
+ description: "Finds projects across an entire Asana workspace, optionally filtered by name (e.g. `Website Redesign`). Results are workspace-wide and are not limited to any portfolio, and there is no due-date filter. Archived projects are included unless you set `archived: false`. Every result includes `workspace.gid` — reuse that value directly for the `workspace` param on a follow-up action like **Create Task**, no need to look it up separately. If you need portfolio-scoped results, use **List Portfolios** and **List Portfolio Items** instead. Example: call with `workspace: '1200123456789012'`, `name: 'Marketing'` → returns `[{gid: '1204567890123456', name: 'Q4 Marketing Campaign', workspace: {gid: '1200123456789012'}}, ...]`. [See the documentation](https://developers.asana.com/docs/get-multiple-projects)",
14
15
  props: {
15
16
  asana,
16
17
  name: {
17
18
  label: "Name",
18
- description: "The name to filter projects on.",
19
+ description: "The name to filter projects on (client-side substring match), e.g. `Website Redesign`.",
19
20
  type: "string",
20
21
  optional: true,
21
22
  },
22
23
  workspace: {
23
- label: "Workspace",
24
- description: "The workspace or organization to filter projects on. Use the **List Workspaces** action to find available workspace GIDs.",
25
- type: "string",
26
24
  propDefinition: [
27
25
  asana,
28
26
  "workspaces",
29
27
  ],
28
+ label: "Workspace",
29
+ description: "The workspace or organization GID to filter projects on, e.g. `1201234567890123`. Use the **List Workspaces** action to find available workspace GIDs. If omitted, projects across all accessible workspaces are returned.",
30
+ type: "string",
31
+ optional: true,
30
32
  },
31
33
  archived: {
32
34
  label: "Archived",
33
- description: "Only return projects whose `archived` field takes on the value of this parameter.",
35
+ description: "Only return projects whose `archived` field matches this value. Set to `false` to exclude archived projects; if omitted, both archived and non-archived projects are returned. Example: `false`.",
34
36
  type: "boolean",
35
37
  optional: true,
36
38
  },
@@ -39,7 +41,7 @@ export default {
39
41
  asana,
40
42
  "optFields",
41
43
  ],
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)",
44
+ 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.",
43
45
  optional: true,
44
46
  },
45
47
  maxResults: {
@@ -47,6 +49,7 @@ export default {
47
49
  asana,
48
50
  "maxResults",
49
51
  ],
52
+ description: "Maximum number of projects to return (min 1, max 9999), e.g. `100`.",
50
53
  },
51
54
  },
52
55
  async run({ $ }) {
@@ -60,39 +63,83 @@ export default {
60
63
  optFields.push("name");
61
64
  }
62
65
 
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
- };
66
+ // Asana's GET /projects now rejects requests with no workspace/team scope
67
+ // (the "cross_workspace_deprecation" change), so a workspace-less search
68
+ // has to fan out across every accessible workspace internally instead of
69
+ // sending one unscoped request. getWorkspaces() itself is paginated, so
70
+ // walk every page rather than just the first.
71
+ let workspaces;
72
+ if (this.workspace) {
73
+ workspaces = [
74
+ this.workspace,
75
+ ];
76
+ } else {
77
+ workspaces = [];
78
+ const params = {};
79
+ let hasMoreWorkspaces;
80
+ do {
81
+ const {
82
+ data, next_page: next,
83
+ } = await this.asana.getWorkspaces({
84
+ params,
85
+ $,
86
+ });
87
+ workspaces.push(...data.map(({ gid }) => gid));
88
+ hasMoreWorkspaces = next;
89
+ params.offset = next?.offset;
90
+ } while (hasMoreWorkspaces);
91
+ }
92
+
93
+ let count = 0;
72
94
  const results = [];
73
95
 
74
- do {
75
- const {
76
- data, next_page: next,
77
- } = await this.asana.getProjects({
78
- params,
79
- $,
80
- });
96
+ for (const workspace of workspaces) {
97
+ if (count >= this.maxResults) {
98
+ break;
99
+ }
100
+
101
+ let hasMore;
102
+ const params = {
103
+ workspace,
104
+ archived: this.archived,
105
+ opt_fields: optFields.length
106
+ ? optFields.join(",")
107
+ : undefined,
108
+ limit: 100,
109
+ };
81
110
 
82
- hasMore = next;
83
- params.offset = next?.offset;
111
+ do {
112
+ const {
113
+ data, next_page: next,
114
+ } = await this.asana.getProjects({
115
+ params,
116
+ $,
117
+ });
84
118
 
85
- if (data.length === 0) break;
119
+ hasMore = next;
120
+ params.offset = next?.offset;
86
121
 
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;
122
+ if (!data?.length) break;
123
+
124
+ for (const project of data) {
125
+ if (this.name && !project.name?.includes(this.name)) continue;
126
+ // The workspace fan-out above already knows which workspace this project
127
+ // came from — attach it so callers chaining into another action (e.g.
128
+ // Create Task) don't have to guess or re-query for it.
129
+ results.push({
130
+ ...project,
131
+ workspace: project.workspace ?? {
132
+ gid: workspace,
133
+ resource_type: "workspace",
134
+ },
135
+ });
136
+ if (++count >= this.maxResults) {
137
+ hasMore = false;
138
+ break;
139
+ }
93
140
  }
94
- }
95
- } while (hasMore);
141
+ } while (hasMore);
142
+ }
96
143
 
97
144
  $.export("$summary", "Successfully retrieved projects");
98
145
  return results;
@@ -3,8 +3,9 @@ import common from "../common/common.mjs";
3
3
  export default {
4
4
  key: "asana-search-sections",
5
5
  name: "Search Sections",
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.3.1",
6
+ description: "Searches for sections by name within an Asana project. Use this to find section GIDs before calling **Add Task to Section** or when filtering tasks by section. The `sectionName` filter is a client-side substring match. Returns section records with `gid` and `name`. Example: call with `project: '1204567890123456'`, `sectionName: 'In Progress'` → returns `[{gid: '1203456789012345', name: 'In Progress'}]`. [See the documentation](https://developers.asana.com/docs/get-sections-in-a-project)",
7
+ version: "1.0.0",
8
+ ai: "optimized",
8
9
  annotations: {
9
10
  destructiveHint: false,
10
11
  openWorldHint: true,
@@ -12,11 +13,13 @@ export default {
12
13
  },
13
14
  type: "action",
14
15
  props: {
15
- ...common.props,
16
- name: {
16
+ asana: common.props.asana,
17
+ project: common.props.project,
18
+ sectionName: {
17
19
  label: "Name",
18
- description: "The name of the section to search for.",
20
+ description: "The name of the section to search for (client-side substring match), e.g. `In Progress`. Omit to return all sections in the project.",
19
21
  type: "string",
22
+ optional: true,
20
23
  },
21
24
  maxResults: {
22
25
  propDefinition: [
@@ -47,7 +50,7 @@ export default {
47
50
  if (data.length === 0) break;
48
51
 
49
52
  for (const section of data) {
50
- if (this.name && !section.name.includes(this.name)) continue;
53
+ if (this.sectionName && !section.name.includes(this.sectionName)) continue;
51
54
  results.push(section);
52
55
  if (++count >= this.maxResults) {
53
56
  hasMore = false;
@@ -5,8 +5,9 @@ import { ConfigurationError } from "@pipedream/platform";
5
5
  export default {
6
6
  key: "asana-search-tasks",
7
7
  name: "Search Tasks",
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.5.0",
8
+ description: "Searches for Asana tasks by name within a project, section, or by assignee. Must specify exactly one of: `project`, `section`, or `assignee` (project + section together is also valid). The `name` filter is a client-side substring match applied after fetching. For cross-project full-text search, use **Search Tasks Premium** instead. Returns task records with `gid` and `name` (plus any requested `optFields`). Example: call with `workspace: '1200123456789012'`, `project: '1204567890123456'`, `name: 'Q3'` → returns tasks in that project whose names contain 'Q3'. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)",
9
+ version: "0.5.1",
10
+ ai: "optimized",
10
11
  annotations: {
11
12
  destructiveHint: false,
12
13
  openWorldHint: true,
@@ -21,33 +22,27 @@ export default {
21
22
  },
22
23
  name: {
23
24
  label: "Name",
24
- description: "The task name to search for.",
25
+ description: "The task name to search for (client-side substring match). If omitted, all tasks matching the other filters are returned, e.g. `Q3 report`.",
25
26
  type: "string",
27
+ optional: true,
26
28
  },
27
29
  assignee: {
28
30
  label: "Assignee",
29
- description: "The assignee to filter tasks on",
30
31
  type: "string",
31
32
  optional: true,
32
33
  propDefinition: [
33
34
  asana,
34
35
  "users",
35
- ({ workspace }) => ({
36
- workspace,
37
- }),
38
36
  ],
39
37
  },
40
38
  section: {
41
39
  label: "Section",
42
40
  type: "string",
43
- description: "The section to filter tasks on. Must specify Project to list options.",
41
+ description: "The section GID to filter tasks on, e.g. `1203456789012345`. Use **Search Sections** with a project GID to find available section GIDs.",
44
42
  optional: true,
45
43
  propDefinition: [
46
44
  asana,
47
45
  "sections",
48
- (c) => ({
49
- project: c.project,
50
- }),
51
46
  ],
52
47
  },
53
48
  completedSince: {
@@ -91,7 +86,7 @@ export default {
91
86
  ...this.optFields,
92
87
  ]
93
88
  : [];
94
- if (optFields.length && !optFields.includes("name")) {
89
+ if (this.name && optFields.length && !optFields.includes("name")) {
95
90
  // the name filter below needs task.name present in the response
96
91
  optFields.push("name");
97
92
  }
@@ -128,10 +123,10 @@ export default {
128
123
  hasMore = next;
129
124
  params.offset = next?.offset;
130
125
 
131
- if (data.length === 0) break;
126
+ if (!data?.length) break;
132
127
 
133
128
  for (const task of data) {
134
- if (!task.name.includes(this.name)) continue;
129
+ if (this.name && !task.name?.includes(this.name)) continue;
135
130
  results.push(task);
136
131
  if (++count >= this.maxResults) {
137
132
  hasMore = false;
@@ -4,14 +4,15 @@ import common from "../common/common.mjs";
4
4
  export default {
5
5
  key: "asana-search-tasks-premium",
6
6
  name: "Search Tasks Premium",
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.4",
7
+ description: "Searches for tasks across an Asana workspace by name, assignee, section, project, completed since, and/or modified since. Requires a Premium Asana account. Use this over **Search Tasks** when you need cross-project full-text search or date-range filters not available on the basic endpoint. Results are capped at 100 by the Asana search API — pagination is not supported on this endpoint; narrow your filters (name, assignee, modified_since) if you expect more than 100 matches. Example: call with `workspace: '1200123456789012'`, `name: 'Q3'`, `assignee: '1198765432109876'` → returns up to 100 tasks whose text contains 'Q3' assigned to that user. [See the documentation](https://developers.asana.com/reference/searchtasksforworkspace)",
8
+ version: "0.0.6",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
12
12
  readOnlyHint: true,
13
13
  },
14
14
  type: "action",
15
+ ai: "optimized",
15
16
  props: {
16
17
  asana,
17
18
  info: {
@@ -32,28 +33,21 @@ export default {
32
33
  },
33
34
  assignee: {
34
35
  label: "Assignee",
35
- description: "The assignee to filter tasks on",
36
36
  type: "string",
37
37
  optional: true,
38
38
  propDefinition: [
39
39
  asana,
40
40
  "users",
41
- ({ workspace }) => ({
42
- workspace,
43
- }),
44
41
  ],
45
42
  },
46
43
  section: {
47
44
  label: "Section",
48
45
  type: "string",
49
- description: "Section GID used to filter tasks (for example: `1200123456789013`). Provide `project` so valid section IDs can be resolved.",
46
+ description: "Section GID used to filter tasks (for example: `1200123456789013`). Provide `project` so valid section IDs can be resolved. Use **Search Sections** to find available section GIDs.",
50
47
  optional: true,
51
48
  propDefinition: [
52
49
  asana,
53
50
  "sections",
54
- (c) => ({
55
- project: c.project,
56
- }),
57
51
  ],
58
52
  },
59
53
  completedSince: {
@@ -92,10 +86,13 @@ export default {
92
86
  $,
93
87
  });
94
88
 
89
+ const taskList = tasks ?? [];
95
90
  const limited = this.maxResults
96
- ? tasks.slice(0, this.maxResults)
97
- : tasks;
98
- $.export("$summary", "Successfully retrieved tasks");
91
+ ? taskList.slice(0, this.maxResults)
92
+ : taskList;
93
+ $.export("$summary", `Successfully retrieved ${limited.length} task${limited.length !== 1
94
+ ? "s"
95
+ : ""}`);
99
96
  return limited;
100
97
  },
101
98
  };