@todoist/comms-sdk 5.0.2 → 5.1.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 CHANGED
@@ -8,6 +8,8 @@ The official TypeScript SDK for the Comms REST API.
8
8
  npm install @todoist/comms-sdk
9
9
  ```
10
10
 
11
+ In a browser, use it through a bundler such as rspack, Vite or esbuild: the package's `browser` field leaves undici out of the bundle, and requests go through the browser's `fetch`.
12
+
11
13
  Versions up to 4.x were published as `@doist/comms-sdk`.
12
14
 
13
15
  ## Usage
@@ -67,6 +69,11 @@ const sameChannel = await api.channels.createChannel({
67
69
  })
68
70
  ```
69
71
 
72
+ `comments.createComment`, `threads.closeThread`, and `threads.reopenThread`
73
+ accept an optional `clientRequestId`, the ID of the comment being answered.
74
+ The SDK sends it as `client_request_id`. Only replies sent by Comms' agent
75
+ service honour this value; other callers' values are ignored.
76
+
70
77
  ### Broadcast group markers
71
78
 
72
79
  Use the string constants `EVERYONE` / `EVERYONE_IN_THREAD` when
@@ -84,6 +84,8 @@ export class CommentsClient extends BaseClient {
84
84
  * @param args - The arguments for creating a comment.
85
85
  * @param args.threadId - The thread ID.
86
86
  * @param args.content - The comment content.
87
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
88
+ * for replies sent by Comms' agent service; other callers' values are ignored.
87
89
  * @param args.recipients - Optional array of user IDs to notify directly.
88
90
  * @param args.groups - Optional array of custom group IDs to notify.
89
91
  * @param args.directMentions - Optional array of user IDs that were @-mentioned in
@@ -289,6 +289,8 @@ export class ThreadsClient extends BaseClient {
289
289
  * @param args - The arguments for closing a thread.
290
290
  * @param args.id - The thread ID.
291
291
  * @param args.content - The comment content.
292
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
293
+ * for replies sent by Comms' agent service; other callers' values are ignored.
292
294
  * @param args.attachments - Optional array of {@link Attachment} objects.
293
295
  * @param args.actions - Optional array of action objects.
294
296
  * @param args.recipients - Optional array of user IDs to notify directly.
@@ -317,6 +319,8 @@ export class ThreadsClient extends BaseClient {
317
319
  * @param args - The arguments for reopening a thread.
318
320
  * @param args.id - The thread ID.
319
321
  * @param args.content - The comment content.
322
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
323
+ * for replies sent by Comms' agent service; other callers' values are ignored.
320
324
  * @param args.attachments - Optional array of {@link Attachment} objects.
321
325
  * @param args.actions - Optional array of action objects.
322
326
  * @param args.recipients - Optional array of user IDs to notify directly.
@@ -53,6 +53,7 @@ export const CreateCommentArgsSchema = z.object({
53
53
  threadId: z.string(),
54
54
  content: z.string(),
55
55
  id: z.string().optional(),
56
+ clientRequestId: z.string().optional(),
56
57
  attachments: z.array(RequestAttachmentSchema).nullable().optional(),
57
58
  actions: z.unknown().nullable().optional(),
58
59
  recipients: z.array(z.number()).nullable().optional(),
@@ -173,6 +173,8 @@ export declare class CommentsClient extends BaseClient {
173
173
  * @param args - The arguments for creating a comment.
174
174
  * @param args.threadId - The thread ID.
175
175
  * @param args.content - The comment content.
176
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
177
+ * for replies sent by Comms' agent service; other callers' values are ignored.
176
178
  * @param args.recipients - Optional array of user IDs to notify directly.
177
179
  * @param args.groups - Optional array of custom group IDs to notify.
178
180
  * @param args.directMentions - Optional array of user IDs that were @-mentioned in
@@ -496,6 +496,8 @@ export declare class ThreadsClient extends BaseClient {
496
496
  * @param args - The arguments for closing a thread.
497
497
  * @param args.id - The thread ID.
498
498
  * @param args.content - The comment content.
499
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
500
+ * for replies sent by Comms' agent service; other callers' values are ignored.
499
501
  * @param args.attachments - Optional array of {@link Attachment} objects.
500
502
  * @param args.actions - Optional array of action objects.
501
503
  * @param args.recipients - Optional array of user IDs to notify directly.
@@ -522,6 +524,8 @@ export declare class ThreadsClient extends BaseClient {
522
524
  * @param args - The arguments for reopening a thread.
523
525
  * @param args.id - The thread ID.
524
526
  * @param args.content - The comment content.
527
+ * @param args.clientRequestId - Id of the comment this one answers. Only honoured
528
+ * for replies sent by Comms' agent service; other callers' values are ignored.
525
529
  * @param args.attachments - Optional array of {@link Attachment} objects.
526
530
  * @param args.actions - Optional array of action objects.
527
531
  * @param args.recipients - Optional array of user IDs to notify directly.
@@ -76,6 +76,7 @@ export declare const CreateCommentArgsSchema: z.ZodObject<{
76
76
  threadId: z.ZodString;
77
77
  content: z.ZodString;
78
78
  id: z.ZodOptional<z.ZodString>;
79
+ clientRequestId: z.ZodOptional<z.ZodString>;
79
80
  attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
80
81
  attachmentId: z.ZodString;
81
82
  urlType: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoist/comms-sdk",
3
- "version": "5.0.2",
3
+ "version": "5.1.1",
4
4
  "description": "A TypeScript wrapper for the Comms REST API.",
5
5
  "author": "Doist developers",
6
6
  "homepage": "https://doist.github.io/comms-sdk-typescript/",
@@ -23,6 +23,9 @@
23
23
  }
24
24
  },
25
25
  "sideEffects": false,
26
+ "browser": {
27
+ "undici": false
28
+ },
26
29
  "scripts": {
27
30
  "clean": "rimraf dist",
28
31
  "test": "vitest run",
@@ -64,10 +67,11 @@
64
67
  "lefthook": "2.2.2",
65
68
  "msw": "2.14.6",
66
69
  "npm-run-all2": "9.0.2",
67
- "obsidian": "1.13.1",
70
+ "obsidian": "1.14.4",
68
71
  "oxfmt": "0.56.0",
69
72
  "oxlint": "1.71.0",
70
73
  "rimraf": "6.1.3",
74
+ "rolldown": "1.2.15",
71
75
  "semantic-release": "25.0.5",
72
76
  "ts-node": "10.9.2",
73
77
  "typescript": "5.9.3",