@zerodot/asana 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -17
- package/dist/index.cjs +9 -10
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,27 +1,108 @@
|
|
|
1
1
|
# @zerodot/asana
|
|
2
2
|
|
|
3
|
-
Asana
|
|
3
|
+
<img src="https://raw.githubusercontent.com/zerodot-io/nodes/main/packages/asana/asana.svg" alt="Asana logo" width="48" height="48">
|
|
4
|
+
|
|
5
|
+
Create, get, and update tasks and projects in Asana. List tasks, projects, workspaces, and users. Connect with a personal access token, or with OAuth2 and your Asana account.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
In zerodot, go to **System > Nodes** and install **Asana**.
|
|
10
|
+
|
|
11
|
+
Manual: install `@zerodot/asana` where the web app and the worker run, and add it to `ZERODOT_NODE_PACKAGES`.
|
|
12
|
+
|
|
13
|
+
## Nodes
|
|
14
|
+
|
|
15
|
+
### Asana (`asana.api`)
|
|
16
|
+
|
|
17
|
+
- **Task**: create, get, update, get many
|
|
18
|
+
- **Project**: create, get, update, get many
|
|
19
|
+
- **Workspace**: get many
|
|
20
|
+
- **User**: get, get many
|
|
21
|
+
|
|
22
|
+
**Authentication.** Choose **Personal Access Token** or **OAuth2**. The node shows the credential type that matches your choice.
|
|
23
|
+
|
|
24
|
+
**IDs.** Asana IDs are GIDs. Use the GID of a task, project, workspace, or user. For **Assignee** and **User ID**, you can also use `me`.
|
|
25
|
+
|
|
26
|
+
**Task create.** Needs **Workspace** and **Name**. Other fields are optional:
|
|
27
|
+
|
|
28
|
+
- **Notes**: plain text.
|
|
29
|
+
- **Assignee**: a user GID, or `me`.
|
|
30
|
+
- **Project IDs**: project GIDs with commas between them.
|
|
31
|
+
- **Due On**: a date as `YYYY-MM-DD`.
|
|
32
|
+
- **Due At**: a date and time as an ISO 8601 timestamp.
|
|
33
|
+
- **Completed**: true or false.
|
|
34
|
+
|
|
35
|
+
The node sends the dates as text. Asana checks them.
|
|
36
|
+
|
|
37
|
+
**Task get and update.** Need **Task ID**. **Update** sends only the fields you fill in. It accepts **Name**, **Notes**, **Assignee**, **Project IDs**, **Due On**, **Due At**, and **Completed**.
|
|
38
|
+
|
|
39
|
+
**Task get many.** Needs either **Project ID**, or both **Assignee** and **Workspace**. If **Project ID** is set, the node lists the tasks of that project and ignores **Assignee**. Otherwise it lists the tasks of the assignee in the workspace.
|
|
40
|
+
|
|
41
|
+
**Project create.** Needs **Workspace** and **Name**. Other fields are optional:
|
|
42
|
+
|
|
43
|
+
- **Notes**, **Color** (for example `dark-green`), **Archived**.
|
|
44
|
+
- **Due On** and **Start On**, as `YYYY-MM-DD`.
|
|
45
|
+
- **Privacy Setting**, for example `public_to_workspace` or `private_to_team`.
|
|
46
|
+
|
|
47
|
+
**Project get and update.** Need **Project ID**. **Update** sends only the fields you fill in.
|
|
48
|
+
|
|
49
|
+
**Project get many.** Needs **Workspace**. **Archived** is optional. When it is set, the node sends it as a filter.
|
|
50
|
+
|
|
51
|
+
**User get.** Needs **User ID**. **User get many** takes an optional **Workspace**. When it is set, the users are limited to that workspace.
|
|
52
|
+
|
|
53
|
+
**Workspace get many.** Takes no input.
|
|
54
|
+
|
|
55
|
+
**Opt Fields.** Comma-separated field names, for example `gid,name,notes`. The node sends them as `opt_fields` with each request.
|
|
56
|
+
|
|
57
|
+
**Get many.** Without **Return All**, the node returns one page. **Limit** sets the number of items. It defaults to 50, and the maximum is 100. With **Return All**, the node follows the next page offset until there are no more items. It stops at 5000 items. Each page has up to 100 items.
|
|
58
|
+
|
|
59
|
+
**Output.** Get, create, and update return the `data` object of the Asana answer. Get many returns an array of the items.
|
|
60
|
+
|
|
61
|
+
**Destructive operations.** The node has no delete operation. Update can change or complete a task, and it can archive a project.
|
|
62
|
+
|
|
63
|
+
**Binary data.** The node does not read or write binary data.
|
|
64
|
+
|
|
65
|
+
**Limits and retries.** Each call has a timeout. The default is 30 seconds. When Asana returns HTTP `429`, the node waits for the `Retry-After` time, or for 1, 2, and 3 seconds when the header is missing. It retries up to 3 times. The node does not follow redirects.
|
|
66
|
+
|
|
67
|
+
Error messages include the Asana messages. Hints are added for these statuses:
|
|
68
|
+
|
|
69
|
+
- `401`: the token was not accepted.
|
|
70
|
+
- `403`: the token may lack access to the resource.
|
|
71
|
+
- `404`: check the IDs.
|
|
72
|
+
- `429`: the rate limit was reached.
|
|
4
73
|
|
|
5
74
|
## Credentials
|
|
6
75
|
|
|
7
|
-
|
|
8
|
-
|
|
76
|
+
### Asana Personal Access Token (`asana.pat`)
|
|
77
|
+
|
|
78
|
+
- `apiToken`: the personal access token. This value is secret.
|
|
79
|
+
|
|
80
|
+
Setup:
|
|
81
|
+
|
|
82
|
+
1. In Asana, open **My Settings > Apps > Developer apps**.
|
|
83
|
+
2. Create a personal access token and copy it.
|
|
84
|
+
3. In zerodot, create an **Asana Personal Access Token** credential.
|
|
85
|
+
4. Paste the token into the `apiToken` field. Save and test the credential.
|
|
86
|
+
|
|
87
|
+
### Asana OAuth2 (`asana.oauth2`)
|
|
88
|
+
|
|
89
|
+
- `clientId`: the client ID of your Asana OAuth app. This value is not secret.
|
|
90
|
+
- `clientSecret`: the client secret of your Asana OAuth app. This value is secret.
|
|
91
|
+
- `scope`: optional. Separate scopes with commas or spaces. If it is empty, the node uses these scopes: `tasks:read`, `tasks:write`, `projects:read`, `projects:write`, `workspaces:read`, and `users:read`.
|
|
92
|
+
- `accessToken`, `refreshToken`, `expiresAt`, `tokenType`, and `grantedScope`: written by zerodot after you connect the account. Do not set them yourself. `accessToken` and `refreshToken` are secret.
|
|
93
|
+
|
|
94
|
+
The node uses the Asana authorization URL `https://app.asana.com/-/oauth_authorize` and the token URL `https://app.asana.com/-/oauth_token`. It uses PKCE, and it sends the client credentials in the request body.
|
|
9
95
|
|
|
10
|
-
|
|
96
|
+
Setup:
|
|
11
97
|
|
|
12
|
-
|
|
98
|
+
1. Create an OAuth app for Asana, and copy its client ID and client secret.
|
|
99
|
+
2. In zerodot, create an **Asana OAuth2** credential.
|
|
100
|
+
3. Paste the client ID into `clientId` and the client secret into `clientSecret`.
|
|
101
|
+
4. Set `scope` if you need other scopes than the defaults.
|
|
102
|
+
5. Connect the account and sign in with Asana. Save and test the credential.
|
|
13
103
|
|
|
14
|
-
|
|
15
|
-
- **Project**: Create, Get, Update, Get Many
|
|
16
|
-
- **Workspace**: Get Many
|
|
17
|
-
- **User**: Get, Get Many
|
|
104
|
+
Both credential types test the credential with `GET /users/me?opt_fields=gid,name`.
|
|
18
105
|
|
|
19
|
-
##
|
|
106
|
+
## License
|
|
20
107
|
|
|
21
|
-
-
|
|
22
|
-
- Write requests are sent as `{ "data": { ... } }`.
|
|
23
|
-
- Task Get Many requires either a project ID, or an assignee and a workspace.
|
|
24
|
-
- Project Get Many lists projects in a workspace.
|
|
25
|
-
- Get Many operations support `limit`, `returnAll`, and pagination via `next_page.offset`.
|
|
26
|
-
- `optFields` maps to Asana `opt_fields` for compact or expanded responses.
|
|
27
|
-
- Rate limit responses (`429`) are retried using `Retry-After`.
|
|
108
|
+
AGPL-3.0-only
|
package/dist/index.cjs
CHANGED
|
@@ -333,16 +333,15 @@ const asanaConfig = zod.z.object({
|
|
|
333
333
|
requiredWhenShown: true
|
|
334
334
|
}),
|
|
335
335
|
projectId: zod.z.string().optional().meta({
|
|
336
|
-
showWhen: {
|
|
337
|
-
resource: ["task"
|
|
338
|
-
operation: [
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
},
|
|
336
|
+
showWhen: [{
|
|
337
|
+
resource: ["task"],
|
|
338
|
+
operation: ["getMany"]
|
|
339
|
+
}, {
|
|
340
|
+
resource: ["project"],
|
|
341
|
+
operation: ["get", "update"]
|
|
342
|
+
}],
|
|
344
343
|
title: "Project ID",
|
|
345
|
-
description: "For a project: the project GID. For task list: return tasks in this project"
|
|
344
|
+
description: "For a project: the project GID. For task list: return tasks in this project. If set, Assignee is ignored"
|
|
346
345
|
}),
|
|
347
346
|
userId: zod.z.string().optional().meta({
|
|
348
347
|
...on("user", "get"),
|
|
@@ -371,7 +370,7 @@ const asanaConfig = zod.z.object({
|
|
|
371
370
|
]
|
|
372
371
|
},
|
|
373
372
|
title: "Assignee",
|
|
374
|
-
description: "The user GID to assign, or \"me\". For task list, use with a workspace"
|
|
373
|
+
description: "The user GID to assign, or \"me\". For task list, use with a workspace. Ignored when Project ID is set"
|
|
375
374
|
}),
|
|
376
375
|
completed: zod.z.boolean().optional().meta({
|
|
377
376
|
...on("task", "create", "update"),
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerodot/asana",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Create and manage tasks and projects in Asana.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
|
+
"homepage": "https://github.com/zerodot-io/nodes/tree/main/packages/asana",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/zerodot-io/nodes.git",
|