@doist/comms-sdk 0.2.0 → 0.2.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 (33) hide show
  1. package/dist/cjs/clients/add-comment-helper.js +1 -2
  2. package/dist/cjs/clients/base-client.js +8 -0
  3. package/dist/cjs/clients/channels-client.js +19 -8
  4. package/dist/cjs/clients/comments-client.js +24 -5
  5. package/dist/cjs/clients/conversation-messages-client.js +15 -4
  6. package/dist/cjs/clients/conversations-client.js +23 -12
  7. package/dist/cjs/clients/inbox-client.js +15 -2
  8. package/dist/cjs/clients/threads-client.js +27 -8
  9. package/dist/cjs/clients/workspaces-client.js +9 -1
  10. package/dist/cjs/types/entities.js +119 -98
  11. package/dist/cjs/utils/url-helpers.js +3 -1
  12. package/dist/esm/clients/add-comment-helper.js +1 -2
  13. package/dist/esm/clients/base-client.js +8 -0
  14. package/dist/esm/clients/channels-client.js +20 -9
  15. package/dist/esm/clients/comments-client.js +25 -6
  16. package/dist/esm/clients/conversation-messages-client.js +16 -5
  17. package/dist/esm/clients/conversations-client.js +24 -13
  18. package/dist/esm/clients/inbox-client.js +15 -2
  19. package/dist/esm/clients/threads-client.js +28 -9
  20. package/dist/esm/clients/workspaces-client.js +10 -2
  21. package/dist/esm/types/entities.js +111 -97
  22. package/dist/esm/utils/url-helpers.js +3 -1
  23. package/dist/types/clients/add-comment-helper.d.ts +3 -1
  24. package/dist/types/clients/base-client.d.ts +6 -0
  25. package/dist/types/clients/channels-client.d.ts +3 -0
  26. package/dist/types/clients/comments-client.d.ts +4 -0
  27. package/dist/types/clients/conversation-messages-client.d.ts +3 -0
  28. package/dist/types/clients/conversations-client.d.ts +3 -0
  29. package/dist/types/clients/inbox-client.d.ts +382 -0
  30. package/dist/types/clients/threads-client.d.ts +4 -0
  31. package/dist/types/clients/workspaces-client.d.ts +2 -0
  32. package/dist/types/types/entities.d.ts +1654 -126
  33. package/package.json +1 -1
@@ -1,8 +1,390 @@
1
+ import { z } from 'zod';
1
2
  import { type InboxThread } from '../types/entities.js';
2
3
  import type { ArchiveAllArgs, GetInboxArgs } from '../types/requests.js';
3
4
  import { BaseClient } from './base-client.js';
5
+ export declare const InboxThreadListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
6
+ id: z.ZodString;
7
+ title: z.ZodString;
8
+ content: z.ZodString;
9
+ creator: z.ZodNumber;
10
+ creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ channelId: z.ZodString;
12
+ workspaceId: z.ZodNumber;
13
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
14
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
15
+ attachmentId: z.ZodString;
16
+ urlType: z.ZodString;
17
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
21
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
26
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
31
+ }, z.core.$loose>>>>;
32
+ commentCount: z.ZodNumber;
33
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
34
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
35
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
36
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
37
+ lastObjIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
+ lastUpdated: z.ZodDate;
39
+ mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
40
+ participants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
41
+ pinned: z.ZodOptional<z.ZodBoolean>;
42
+ pinnedTs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
43
+ posted: z.ZodDate;
44
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodNumber>>>>;
45
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
46
+ snippet: z.ZodString;
47
+ snippetCreator: z.ZodNumber;
48
+ snippetMaskAvatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
51
+ isArchived: z.ZodBoolean;
52
+ inInbox: z.ZodBoolean;
53
+ isSaved: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
54
+ closed: z.ZodBoolean;
55
+ responders: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
56
+ lastComment: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
57
+ id: z.ZodString;
58
+ content: z.ZodString;
59
+ creator: z.ZodNumber;
60
+ threadId: z.ZodString;
61
+ workspaceId: z.ZodNumber;
62
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ posted: z.ZodDate;
64
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
65
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
66
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
67
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
68
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
69
+ attachmentId: z.ZodString;
70
+ urlType: z.ZodString;
71
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
75
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
78
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
79
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
85
+ }, z.core.$loose>>>>;
86
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
87
+ objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
88
+ creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ channelId: z.ZodString;
90
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
91
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
92
+ toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
93
+ deleted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
94
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
95
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
96
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
97
+ }, z.core.$strip>, z.ZodTransform<{
98
+ url: string;
99
+ id: string;
100
+ content: string;
101
+ creator: number;
102
+ threadId: string;
103
+ workspaceId: number;
104
+ posted: Date;
105
+ channelId: string;
106
+ conversationId?: string | null | undefined;
107
+ lastEdited?: Date | null | undefined;
108
+ directMentions?: number[] | null | undefined;
109
+ directGroupMentions?: string[] | null | undefined;
110
+ systemMessage?: unknown;
111
+ attachments?: {
112
+ [x: string]: unknown;
113
+ attachmentId: string;
114
+ urlType: string;
115
+ title?: string | null | undefined;
116
+ url?: string | null | undefined;
117
+ fileName?: string | null | undefined;
118
+ fileSize?: number | null | undefined;
119
+ underlyingType?: string | null | undefined;
120
+ description?: string | null | undefined;
121
+ image?: string | null | undefined;
122
+ imageWidth?: number | null | undefined;
123
+ imageHeight?: number | null | undefined;
124
+ duration?: string | null | undefined;
125
+ uploadState?: string | null | undefined;
126
+ video?: string | null | undefined;
127
+ videoType?: string | null | undefined;
128
+ videoAutoPlay?: boolean | null | undefined;
129
+ }[] | null | undefined;
130
+ reactions?: Record<string, unknown> | null | undefined;
131
+ objIndex?: number | null | undefined;
132
+ creatorName?: string | null | undefined;
133
+ recipients?: number[] | null | undefined;
134
+ groups?: string[] | null | undefined;
135
+ toEmails?: string[] | null | undefined;
136
+ deleted?: boolean | null | undefined;
137
+ deletedBy?: number | null | undefined;
138
+ version?: number | null | undefined;
139
+ actions?: unknown[] | null | undefined;
140
+ }, {
141
+ id: string;
142
+ content: string;
143
+ creator: number;
144
+ threadId: string;
145
+ workspaceId: number;
146
+ posted: Date;
147
+ channelId: string;
148
+ conversationId?: string | null | undefined;
149
+ lastEdited?: Date | null | undefined;
150
+ directMentions?: number[] | null | undefined;
151
+ directGroupMentions?: string[] | null | undefined;
152
+ systemMessage?: unknown;
153
+ attachments?: {
154
+ [x: string]: unknown;
155
+ attachmentId: string;
156
+ urlType: string;
157
+ title?: string | null | undefined;
158
+ url?: string | null | undefined;
159
+ fileName?: string | null | undefined;
160
+ fileSize?: number | null | undefined;
161
+ underlyingType?: string | null | undefined;
162
+ description?: string | null | undefined;
163
+ image?: string | null | undefined;
164
+ imageWidth?: number | null | undefined;
165
+ imageHeight?: number | null | undefined;
166
+ duration?: string | null | undefined;
167
+ uploadState?: string | null | undefined;
168
+ video?: string | null | undefined;
169
+ videoType?: string | null | undefined;
170
+ videoAutoPlay?: boolean | null | undefined;
171
+ }[] | null | undefined;
172
+ reactions?: Record<string, unknown> | null | undefined;
173
+ objIndex?: number | null | undefined;
174
+ creatorName?: string | null | undefined;
175
+ recipients?: number[] | null | undefined;
176
+ groups?: string[] | null | undefined;
177
+ toEmails?: string[] | null | undefined;
178
+ deleted?: boolean | null | undefined;
179
+ deletedBy?: number | null | undefined;
180
+ version?: number | null | undefined;
181
+ actions?: unknown[] | null | undefined;
182
+ }>>>>;
183
+ toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
184
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
185
+ }, z.core.$strip>, z.ZodTransform<{
186
+ url: string;
187
+ id: string;
188
+ title: string;
189
+ content: string;
190
+ creator: number;
191
+ channelId: string;
192
+ workspaceId: number;
193
+ commentCount: number;
194
+ lastUpdated: Date;
195
+ posted: Date;
196
+ snippet: string;
197
+ snippetCreator: number;
198
+ isArchived: boolean;
199
+ inInbox: boolean;
200
+ closed: boolean;
201
+ creatorName?: string | null | undefined;
202
+ actions?: unknown[] | null | undefined;
203
+ attachments?: {
204
+ [x: string]: unknown;
205
+ attachmentId: string;
206
+ urlType: string;
207
+ title?: string | null | undefined;
208
+ url?: string | null | undefined;
209
+ fileName?: string | null | undefined;
210
+ fileSize?: number | null | undefined;
211
+ underlyingType?: string | null | undefined;
212
+ description?: string | null | undefined;
213
+ image?: string | null | undefined;
214
+ imageWidth?: number | null | undefined;
215
+ imageHeight?: number | null | undefined;
216
+ duration?: string | null | undefined;
217
+ uploadState?: string | null | undefined;
218
+ video?: string | null | undefined;
219
+ videoType?: string | null | undefined;
220
+ videoAutoPlay?: boolean | null | undefined;
221
+ }[] | null | undefined;
222
+ directGroupMentions?: string[] | null | undefined;
223
+ directMentions?: number[] | null | undefined;
224
+ groups?: string[] | null | undefined;
225
+ lastEdited?: Date | null | undefined;
226
+ lastObjIndex?: number | null | undefined;
227
+ mutedUntil?: Date | null | undefined;
228
+ participants?: number[] | null | undefined;
229
+ pinned?: boolean | undefined;
230
+ pinnedTs?: number | null | undefined;
231
+ reactions?: Record<string, number[]> | null | undefined;
232
+ recipients?: number[] | null | undefined;
233
+ snippetMaskAvatarUrl?: string | null | undefined;
234
+ snippetMaskPoster?: string | null | undefined;
235
+ systemMessage?: unknown;
236
+ isSaved?: boolean | null | undefined;
237
+ responders?: number[] | null | undefined;
238
+ lastComment?: {
239
+ url: string;
240
+ id: string;
241
+ content: string;
242
+ creator: number;
243
+ threadId: string;
244
+ workspaceId: number;
245
+ posted: Date;
246
+ channelId: string;
247
+ conversationId?: string | null | undefined;
248
+ lastEdited?: Date | null | undefined;
249
+ directMentions?: number[] | null | undefined;
250
+ directGroupMentions?: string[] | null | undefined;
251
+ systemMessage?: unknown;
252
+ attachments?: {
253
+ [x: string]: unknown;
254
+ attachmentId: string;
255
+ urlType: string;
256
+ title?: string | null | undefined;
257
+ url?: string | null | undefined;
258
+ fileName?: string | null | undefined;
259
+ fileSize?: number | null | undefined;
260
+ underlyingType?: string | null | undefined;
261
+ description?: string | null | undefined;
262
+ image?: string | null | undefined;
263
+ imageWidth?: number | null | undefined;
264
+ imageHeight?: number | null | undefined;
265
+ duration?: string | null | undefined;
266
+ uploadState?: string | null | undefined;
267
+ video?: string | null | undefined;
268
+ videoType?: string | null | undefined;
269
+ videoAutoPlay?: boolean | null | undefined;
270
+ }[] | null | undefined;
271
+ reactions?: Record<string, unknown> | null | undefined;
272
+ objIndex?: number | null | undefined;
273
+ creatorName?: string | null | undefined;
274
+ recipients?: number[] | null | undefined;
275
+ groups?: string[] | null | undefined;
276
+ toEmails?: string[] | null | undefined;
277
+ deleted?: boolean | null | undefined;
278
+ deletedBy?: number | null | undefined;
279
+ version?: number | null | undefined;
280
+ actions?: unknown[] | null | undefined;
281
+ } | null | undefined;
282
+ toEmails?: string[] | null | undefined;
283
+ version?: number | null | undefined;
284
+ }, {
285
+ id: string;
286
+ title: string;
287
+ content: string;
288
+ creator: number;
289
+ channelId: string;
290
+ workspaceId: number;
291
+ commentCount: number;
292
+ lastUpdated: Date;
293
+ posted: Date;
294
+ snippet: string;
295
+ snippetCreator: number;
296
+ isArchived: boolean;
297
+ inInbox: boolean;
298
+ closed: boolean;
299
+ creatorName?: string | null | undefined;
300
+ actions?: unknown[] | null | undefined;
301
+ attachments?: {
302
+ [x: string]: unknown;
303
+ attachmentId: string;
304
+ urlType: string;
305
+ title?: string | null | undefined;
306
+ url?: string | null | undefined;
307
+ fileName?: string | null | undefined;
308
+ fileSize?: number | null | undefined;
309
+ underlyingType?: string | null | undefined;
310
+ description?: string | null | undefined;
311
+ image?: string | null | undefined;
312
+ imageWidth?: number | null | undefined;
313
+ imageHeight?: number | null | undefined;
314
+ duration?: string | null | undefined;
315
+ uploadState?: string | null | undefined;
316
+ video?: string | null | undefined;
317
+ videoType?: string | null | undefined;
318
+ videoAutoPlay?: boolean | null | undefined;
319
+ }[] | null | undefined;
320
+ directGroupMentions?: string[] | null | undefined;
321
+ directMentions?: number[] | null | undefined;
322
+ groups?: string[] | null | undefined;
323
+ lastEdited?: Date | null | undefined;
324
+ lastObjIndex?: number | null | undefined;
325
+ mutedUntil?: Date | null | undefined;
326
+ participants?: number[] | null | undefined;
327
+ pinned?: boolean | undefined;
328
+ pinnedTs?: number | null | undefined;
329
+ reactions?: Record<string, number[]> | null | undefined;
330
+ recipients?: number[] | null | undefined;
331
+ snippetMaskAvatarUrl?: string | null | undefined;
332
+ snippetMaskPoster?: string | null | undefined;
333
+ systemMessage?: unknown;
334
+ isSaved?: boolean | null | undefined;
335
+ responders?: number[] | null | undefined;
336
+ lastComment?: {
337
+ url: string;
338
+ id: string;
339
+ content: string;
340
+ creator: number;
341
+ threadId: string;
342
+ workspaceId: number;
343
+ posted: Date;
344
+ channelId: string;
345
+ conversationId?: string | null | undefined;
346
+ lastEdited?: Date | null | undefined;
347
+ directMentions?: number[] | null | undefined;
348
+ directGroupMentions?: string[] | null | undefined;
349
+ systemMessage?: unknown;
350
+ attachments?: {
351
+ [x: string]: unknown;
352
+ attachmentId: string;
353
+ urlType: string;
354
+ title?: string | null | undefined;
355
+ url?: string | null | undefined;
356
+ fileName?: string | null | undefined;
357
+ fileSize?: number | null | undefined;
358
+ underlyingType?: string | null | undefined;
359
+ description?: string | null | undefined;
360
+ image?: string | null | undefined;
361
+ imageWidth?: number | null | undefined;
362
+ imageHeight?: number | null | undefined;
363
+ duration?: string | null | undefined;
364
+ uploadState?: string | null | undefined;
365
+ video?: string | null | undefined;
366
+ videoType?: string | null | undefined;
367
+ videoAutoPlay?: boolean | null | undefined;
368
+ }[] | null | undefined;
369
+ reactions?: Record<string, unknown> | null | undefined;
370
+ objIndex?: number | null | undefined;
371
+ creatorName?: string | null | undefined;
372
+ recipients?: number[] | null | undefined;
373
+ groups?: string[] | null | undefined;
374
+ toEmails?: string[] | null | undefined;
375
+ deleted?: boolean | null | undefined;
376
+ deletedBy?: number | null | undefined;
377
+ version?: number | null | undefined;
378
+ actions?: unknown[] | null | undefined;
379
+ } | null | undefined;
380
+ toEmails?: string[] | null | undefined;
381
+ version?: number | null | undefined;
382
+ }>>>;
4
383
  /** Client for `/api/v1/inbox/`. */
5
384
  export declare class InboxClient extends BaseClient {
385
+ private readonly linkBaseUrl;
386
+ private readonly inboxThreadSchema;
387
+ private readonly inboxThreadListSchema;
6
388
  /**
7
389
  * Gets inbox items (threads).
8
390
  *
@@ -292,6 +292,10 @@ export declare const ThreadListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
292
292
  * `createThread` when the caller doesn't supply one.
293
293
  */
294
294
  export declare class ThreadsClient extends BaseClient {
295
+ private readonly linkBaseUrl;
296
+ private readonly threadSchema;
297
+ private readonly threadListSchema;
298
+ private readonly commentSchema;
295
299
  /**
296
300
  * Gets threads. At least one of `channelId` / `workspaceId` is required.
297
301
  * `newerThan` / `olderThan` (`Date`) are converted to the
@@ -62,6 +62,8 @@ export declare const ChannelListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
62
62
  * currently rejects any `color` other than `1` on add/update.
63
63
  */
64
64
  export declare class WorkspacesClient extends BaseClient {
65
+ private readonly linkBaseUrl;
66
+ private readonly channelListSchema;
65
67
  /**
66
68
  * Gets all the user's workspaces.
67
69
  *