@zerodot/clickup 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.
Files changed (3) hide show
  1. package/README.md +62 -15
  2. package/dist/index.cjs +30 -9
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -1,24 +1,71 @@
1
1
  # @zerodot/clickup
2
2
 
3
- ClickUp node package for zerodot.
3
+ <img src="https://raw.githubusercontent.com/zerodot-io/nodes/main/packages/clickup/clickup.svg" alt="ClickUp logo" width="48" height="48">
4
4
 
5
- ## Credential
5
+ Create and manage tasks, lists, folders, and spaces in ClickUp. The node calls the ClickUp API v2. It creates, gets, lists, updates, and deletes tasks. It also gets lists, spaces, and folders. Connect with a personal API token or an OAuth access token.
6
6
 
7
- Create a **ClickUp API token** credential with a personal API token or OAuth access token from ClickUp.
7
+ ## Install
8
8
 
9
- - **Personal API tokens** can be created in ClickUp under **Settings > Apps**.
10
- - **OAuth access tokens** are also supported.
9
+ In zerodot, go to **System > Nodes** and install **ClickUp**.
11
10
 
12
- ## Operations
11
+ Manual: install `@zerodot/clickup` where the web app and the worker run, and add it to `ZERODOT_NODE_PACKAGES`.
13
12
 
14
- - **Task**: Create, Get, Get Many, Update, Delete
15
- - **List**: Get, Get All
16
- - **Space**: Get All
17
- - **Folder**: Get All
13
+ ## Nodes
18
14
 
19
- ## Notes
15
+ ### ClickUp (`clickup.api`)
20
16
 
21
- - ClickUp API base URL: `https://api.clickup.com/api/v2`
22
- - Task create and list operations require a list ID.
23
- - List Get All uses a folder ID when provided, otherwise it uses the space ID for folderless lists.
24
- - Space Get All requires a workspace (team) ID.
17
+ - **Task**: create, get, get many, update, delete
18
+ - **List**: get, get all
19
+ - **Space**: get all
20
+ - **Folder**: get all
21
+
22
+ The node has no trigger.
23
+
24
+ **Create a task.** Set **List ID** (`listId`) and **Name** (`name`). Both are required. You can also set **Description** (plain text), **Markdown Content**, **Status** (a status name, for example `to do`), and **Priority**. Priority is a number from 1 to 4: 1 urgent, 2 high, 3 normal, 4 low. Fields that are empty are not sent.
25
+
26
+ **Get a task.** Set **Task ID** (`taskId`). It is required. List ID is not used for this operation.
27
+
28
+ **Get many tasks.** Set **List ID**. It is required. The node gets one page of tasks from the list. ClickUp returns 100 tasks per page.
29
+
30
+ - **Archived** (`archived`): include archived tasks. It is off by default.
31
+ - **Page** (`page`): the page number, starting at 0. Use it to get the next page.
32
+ - **Limit** (`limit`): keep only the first N tasks of the page, from 1 to 100. ClickUp has no limit parameter, so the node does not send it. It cuts the page after the answer arrives.
33
+
34
+ **Update a task.** Set **Task ID**. Then set the fields to change: **Name**, **Description**, **Markdown Content**, **Status**, or **Priority**. Fields that are empty are not sent.
35
+
36
+ **Delete a task.** Set **Task ID**. The task is deleted. The node does not ask for a confirmation.
37
+
38
+ **Get a list.** Set **List ID**. It is required.
39
+
40
+ **Get all lists.** Set **Folder ID** (`folderId`) to get the lists of that folder. Then Space ID is not needed. If **Folder ID** is empty, set **Space ID** (`spaceId`). The node then gets the lists of the space.
41
+
42
+ **Get all spaces.** Set **Workspace ID** (`teamId`), the ClickUp team ID. It is required.
43
+
44
+ **Get all folders.** Set **Space ID**. It is required.
45
+
46
+ **Output.** The output is the JSON answer of ClickUp. A task is one object. A list of tasks, lists, spaces, or folders is an object with an array in it, for example `tasks`, `lists`, `spaces`, or `folders`. If ClickUp returns no body, for example after a delete, the output is `{ "success": true }`. The node does not use binary data.
47
+
48
+ **Pagination.** The node does not page by itself. **Get many tasks** returns one page. Change **Page** to get the next page. Each page has up to 100 tasks.
49
+
50
+ **Requests and limits.** Each request sends the token in the `Authorization` header. A redirect is an error. **Timeout** (`timeoutMs`) is the limit for each request. The default is 30000 ms. The range is 1 to 300000 ms. The node does not retry. For status 429 the error says that the rate limit was reached.
51
+
52
+ **Errors.** An error names the call and the HTTP status. It adds the message of ClickUp, when ClickUp sends one. For 401, 403, 404, and 429 it adds a short hint. The error never includes the API token.
53
+
54
+ ## Credentials
55
+
56
+ ### ClickUp API token (`clickup.apiToken`)
57
+
58
+ - **API Token** (`apiToken`), required, secret. A personal API token or an OAuth access token from ClickUp.
59
+
60
+ Testing the credential calls the current user endpoint of ClickUp.
61
+
62
+ Setup:
63
+
64
+ 1. In ClickUp, create a personal API token. Or get an OAuth access token for your app.
65
+ 2. Copy the token.
66
+ 3. In zerodot, create a **ClickUp API token** credential. Paste the token into **API Token**.
67
+ 4. Test the credential.
68
+
69
+ ## License
70
+
71
+ AGPL-3.0-only
package/dist/index.cjs CHANGED
@@ -175,7 +175,13 @@ const clickupConfig = zod.z.object({
175
175
  requiredWhenShown: true
176
176
  }),
177
177
  listId: zod.z.string().optional().meta({
178
- ...on(["task", "list"], "create", "getMany", "get"),
178
+ showWhen: [{
179
+ resource: ["task"],
180
+ operation: ["create", "getMany"]
181
+ }, {
182
+ resource: ["list"],
183
+ operation: ["get"]
184
+ }],
179
185
  title: "List ID",
180
186
  description: "The ID of the list",
181
187
  requiredWhenShown: true
@@ -184,7 +190,13 @@ const clickupConfig = zod.z.object({
184
190
  ...on(["list", "folder"], "getAll"),
185
191
  title: "Space ID",
186
192
  description: "The ID of the space. For List Get All, used when no folder ID is provided",
187
- requiredWhenShown: true
193
+ requiredWhen: [{
194
+ resource: ["folder"],
195
+ operation: ["getAll"]
196
+ }, {
197
+ resource: ["list"],
198
+ folderId: [{ _cnd: { exists: false } }, ""]
199
+ }]
188
200
  }),
189
201
  folderId: zod.z.string().optional().meta({
190
202
  ...on("list", "getAll"),
@@ -237,7 +249,7 @@ const clickupConfig = zod.z.object({
237
249
  limit: zod.z.number().int().min(1).max(100).optional().meta({
238
250
  ...on("task", "getMany"),
239
251
  title: "Limit",
240
- description: "Maximum number of tasks to return"
252
+ description: "Maximum number of tasks to return from the page. ClickUp returns 100 per page"
241
253
  }),
242
254
  timeoutMs: zod.z.number().int().min(1).max(3e5).default(3e4)
243
255
  }).superRefine((config, context) => {
@@ -322,7 +334,6 @@ function buildRequest(config) {
322
334
  path: `/api/v2/list/${id(config.listId, "listId", op)}`
323
335
  };
324
336
  case "list.getAll": {
325
- const spaceId = id(config.spaceId, "spaceId", op);
326
337
  const folderId = optionalString(config.folderId);
327
338
  if (folderId) return {
328
339
  method: "GET",
@@ -330,7 +341,7 @@ function buildRequest(config) {
330
341
  };
331
342
  return {
332
343
  method: "GET",
333
- path: `/api/v2/space/${spaceId}/list`
344
+ path: `/api/v2/space/${id(config.spaceId, "spaceId", op)}/list`
334
345
  };
335
346
  }
336
347
  case "space.getAll": return {
@@ -432,12 +443,22 @@ const nodes = [(0, _zerodot_node_sdk.defineNode)({
432
443
  },
433
444
  subtitle: (config) => typeof config.operation === "string" ? `${String(config.resource ?? "task")}: ${config.operation}` : void 0,
434
445
  async run({ config, credential, signal }) {
446
+ const data = await callClickUp(clickupAccess(credential), buildRequest(config), {
447
+ signal,
448
+ timeoutMs: config.timeoutMs
449
+ });
450
+ if (config.resource === "task" && config.operation === "getMany" && config.limit !== void 0) {
451
+ if (data && Array.isArray(data.tasks)) return {
452
+ port: "out",
453
+ data: {
454
+ ...data,
455
+ tasks: data.tasks.slice(0, config.limit)
456
+ }
457
+ };
458
+ }
435
459
  return {
436
460
  port: "out",
437
- data: await callClickUp(clickupAccess(credential), buildRequest(config), {
438
- signal,
439
- timeoutMs: config.timeoutMs
440
- }) ?? { success: true }
461
+ data: data ?? { success: true }
441
462
  };
442
463
  }
443
464
  })];
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@zerodot/clickup",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Create and manage tasks, lists, folders, and spaces in ClickUp. Use it to work with ClickUp tasks and organize work across your workspace.",
5
5
  "license": "AGPL-3.0-only",
6
+ "homepage": "https://github.com/zerodot-io/nodes/tree/main/packages/clickup",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/zerodot-io/nodes.git",