@doist/twist-sdk 1.0.3 → 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.
@@ -33,9 +33,9 @@ var InboxClient = /** @class */ (function (_super) {
33
33
  workspace_id: args.workspaceId,
34
34
  };
35
35
  if (args.since)
36
- params.since_ts_or_obj_idx = Math.floor(args.since.getTime() / 1000);
36
+ params.newer_than_ts = Math.floor(args.since.getTime() / 1000);
37
37
  if (args.until)
38
- params.until_ts_or_obj_idx = Math.floor(args.until.getTime() / 1000);
38
+ params.older_than_ts = Math.floor(args.until.getTime() / 1000);
39
39
  if (args.limit)
40
40
  params.limit = args.limit;
41
41
  if (args.cursor)
@@ -27,6 +27,7 @@ exports.mockChannel = {
27
27
  archived: false,
28
28
  created: new Date('2021-01-01T00:00:00Z'),
29
29
  version: 0,
30
+ url: 'https://twist.com/a/1/ch/1/',
30
31
  };
31
32
  exports.mockThread = {
32
33
  id: 1,
@@ -43,6 +44,7 @@ exports.mockThread = {
43
44
  snippetCreator: 1,
44
45
  starred: false,
45
46
  isArchived: false,
47
+ url: 'https://twist.com/a/1/ch/1/t/1/',
46
48
  };
47
49
  exports.mockGroup = {
48
50
  id: 1,
@@ -63,13 +65,17 @@ exports.mockConversation = {
63
65
  archived: false,
64
66
  created: new Date('2021-01-01T00:00:00Z'),
65
67
  creator: 1,
68
+ url: 'https://twist.com/a/1/msg/1/',
66
69
  };
67
70
  exports.mockComment = {
68
71
  id: 1,
69
72
  content: 'This is a comment',
70
73
  creator: 1,
71
74
  threadId: 1,
75
+ workspaceId: 1,
76
+ channelId: 1,
72
77
  posted: new Date('2021-01-01T00:00:00Z'),
78
+ url: 'https://twist.com/a/1/ch/1/t/1/c/1',
73
79
  };
74
80
  exports.mockWorkspaceUser = {
75
81
  id: 1,
@@ -1,7 +1,19 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.SearchResultSchema = exports.UnreadConversationSchema = exports.UnreadThreadSchema = exports.InboxThreadSchema = exports.ConversationMessageSchema = exports.WorkspaceUserSchema = exports.CommentSchema = exports.ConversationSchema = exports.GroupSchema = exports.ThreadSchema = exports.ChannelSchema = exports.WorkspaceSchema = exports.UserSchema = exports.SystemMessageSchema = void 0;
4
15
  var zod_1 = require("zod");
16
+ var url_helpers_1 = require("../utils/url-helpers");
5
17
  var enums_1 = require("./enums");
6
18
  // Reusable schema for system messages that can be either a string or an object
7
19
  exports.SystemMessageSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.unknown()]).nullable().optional();
@@ -74,7 +86,8 @@ exports.WorkspaceSchema = zod_1.z.object({
74
86
  plan: zod_1.z.enum(enums_1.WORKSPACE_PLANS).nullable().optional(),
75
87
  });
76
88
  // Channel entity from API
77
- exports.ChannelSchema = zod_1.z.object({
89
+ exports.ChannelSchema = zod_1.z
90
+ .object({
78
91
  id: zod_1.z.number(),
79
92
  name: zod_1.z.string(),
80
93
  description: zod_1.z.string().nullable().optional(),
@@ -92,9 +105,11 @@ exports.ChannelSchema = zod_1.z.object({
92
105
  icon: zod_1.z.number().nullable().optional(),
93
106
  version: zod_1.z.number(),
94
107
  filters: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).nullable().optional(),
95
- });
108
+ })
109
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({ workspaceId: data.workspaceId, channelId: data.id }) })); });
96
110
  // Thread entity from API
97
- exports.ThreadSchema = zod_1.z.object({
111
+ exports.ThreadSchema = zod_1.z
112
+ .object({
98
113
  id: zod_1.z.number(),
99
114
  title: zod_1.z.string(),
100
115
  content: zod_1.z.string(),
@@ -157,7 +172,12 @@ exports.ThreadSchema = zod_1.z.object({
157
172
  })
158
173
  .nullable()
159
174
  .optional(),
160
- });
175
+ })
176
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({
177
+ workspaceId: data.workspaceId,
178
+ channelId: data.channelId,
179
+ threadId: data.id,
180
+ }) })); });
161
181
  // Group entity from API
162
182
  exports.GroupSchema = zod_1.z.object({
163
183
  id: zod_1.z.number(),
@@ -168,7 +188,8 @@ exports.GroupSchema = zod_1.z.object({
168
188
  version: zod_1.z.number(),
169
189
  });
170
190
  // Conversation entity from API
171
- exports.ConversationSchema = zod_1.z.object({
191
+ exports.ConversationSchema = zod_1.z
192
+ .object({
172
193
  id: zod_1.z.number(),
173
194
  workspaceId: zod_1.z.number(),
174
195
  userIds: zod_1.z.array(zod_1.z.number()),
@@ -204,14 +225,16 @@ exports.ConversationSchema = zod_1.z.object({
204
225
  })
205
226
  .nullable()
206
227
  .optional(),
207
- });
228
+ })
229
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({ workspaceId: data.workspaceId, conversationId: data.id }) })); });
208
230
  // Comment entity from API
209
- exports.CommentSchema = zod_1.z.object({
231
+ exports.CommentSchema = zod_1.z
232
+ .object({
210
233
  id: zod_1.z.number(),
211
234
  content: zod_1.z.string(),
212
235
  creator: zod_1.z.number(),
213
236
  threadId: zod_1.z.number(),
214
- workspaceId: zod_1.z.number().nullable().optional(),
237
+ workspaceId: zod_1.z.number(),
215
238
  conversationId: zod_1.z.number().nullable().optional(),
216
239
  posted: zod_1.z.date(),
217
240
  lastEdited: zod_1.z.date().nullable().optional(),
@@ -223,7 +246,7 @@ exports.CommentSchema = zod_1.z.object({
223
246
  objIndex: zod_1.z.number().nullable().optional(),
224
247
  // Extended fields that may appear in some API responses (like inbox)
225
248
  creatorName: zod_1.z.string().nullable().optional(),
226
- channelId: zod_1.z.number().nullable().optional(),
249
+ channelId: zod_1.z.number(),
227
250
  recipients: zod_1.z.array(zod_1.z.number()).nullable().optional(),
228
251
  groups: zod_1.z.array(zod_1.z.number()).nullable().optional(),
229
252
  toEmails: zod_1.z.array(zod_1.z.string()).nullable().optional(),
@@ -231,7 +254,13 @@ exports.CommentSchema = zod_1.z.object({
231
254
  deletedBy: zod_1.z.number().nullable().optional(),
232
255
  version: zod_1.z.number().nullable().optional(),
233
256
  actions: zod_1.z.array(zod_1.z.unknown()).nullable().optional(),
234
- });
257
+ })
258
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({
259
+ workspaceId: data.workspaceId,
260
+ channelId: data.channelId,
261
+ threadId: data.threadId,
262
+ commentId: data.id,
263
+ }) })); });
235
264
  // WorkspaceUser entity from v4 API
236
265
  exports.WorkspaceUserSchema = BaseUserSchema.extend({
237
266
  email: zod_1.z.string().nullable().optional(),
@@ -243,7 +272,8 @@ exports.WorkspaceUserSchema = BaseUserSchema.extend({
243
272
  version: zod_1.z.number(),
244
273
  });
245
274
  // ConversationMessage entity from API
246
- exports.ConversationMessageSchema = zod_1.z.object({
275
+ exports.ConversationMessageSchema = zod_1.z
276
+ .object({
247
277
  id: zod_1.z.number(),
248
278
  content: zod_1.z.string(),
249
279
  creator: zod_1.z.number(),
@@ -259,10 +289,16 @@ exports.ConversationMessageSchema = zod_1.z.object({
259
289
  directGroupMentions: zod_1.z.array(zod_1.z.number()).nullable().optional(),
260
290
  directMentions: zod_1.z.array(zod_1.z.number()).nullable().optional(),
261
291
  version: zod_1.z.number().nullable().optional(),
262
- workspaceId: zod_1.z.number().nullable().optional(),
263
- });
292
+ workspaceId: zod_1.z.number(),
293
+ })
294
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({
295
+ workspaceId: data.workspaceId,
296
+ conversationId: data.conversationId,
297
+ messageId: data.id,
298
+ }) })); });
264
299
  // InboxThread entity from API - returns full Thread objects with additional inbox metadata
265
- exports.InboxThreadSchema = zod_1.z.object({
300
+ exports.InboxThreadSchema = zod_1.z
301
+ .object({
266
302
  id: zod_1.z.number(),
267
303
  title: zod_1.z.string(),
268
304
  content: zod_1.z.string(),
@@ -300,7 +336,12 @@ exports.InboxThreadSchema = zod_1.z.object({
300
336
  lastComment: exports.CommentSchema.nullable().optional(),
301
337
  toEmails: zod_1.z.array(zod_1.z.string()).nullable().optional(),
302
338
  version: zod_1.z.number().nullable().optional(),
303
- });
339
+ })
340
+ .transform(function (data) { return (__assign(__assign({}, data), { url: (0, url_helpers_1.getFullTwistURL)({
341
+ workspaceId: data.workspaceId,
342
+ channelId: data.channelId,
343
+ threadId: data.id,
344
+ }) })); });
304
345
  // UnreadThread entity from API - simplified thread reference for unread threads
305
346
  exports.UnreadThreadSchema = zod_1.z.object({
306
347
  threadId: zod_1.z.number(),
@@ -30,9 +30,9 @@ var InboxClient = /** @class */ (function (_super) {
30
30
  workspace_id: args.workspaceId,
31
31
  };
32
32
  if (args.since)
33
- params.since_ts_or_obj_idx = Math.floor(args.since.getTime() / 1000);
33
+ params.newer_than_ts = Math.floor(args.since.getTime() / 1000);
34
34
  if (args.until)
35
- params.until_ts_or_obj_idx = Math.floor(args.until.getTime() / 1000);
35
+ params.older_than_ts = Math.floor(args.until.getTime() / 1000);
36
36
  if (args.limit)
37
37
  params.limit = args.limit;
38
38
  if (args.cursor)
@@ -24,6 +24,7 @@ export var mockChannel = {
24
24
  archived: false,
25
25
  created: new Date('2021-01-01T00:00:00Z'),
26
26
  version: 0,
27
+ url: 'https://twist.com/a/1/ch/1/',
27
28
  };
28
29
  export var mockThread = {
29
30
  id: 1,
@@ -40,6 +41,7 @@ export var mockThread = {
40
41
  snippetCreator: 1,
41
42
  starred: false,
42
43
  isArchived: false,
44
+ url: 'https://twist.com/a/1/ch/1/t/1/',
43
45
  };
44
46
  export var mockGroup = {
45
47
  id: 1,
@@ -60,13 +62,17 @@ export var mockConversation = {
60
62
  archived: false,
61
63
  created: new Date('2021-01-01T00:00:00Z'),
62
64
  creator: 1,
65
+ url: 'https://twist.com/a/1/msg/1/',
63
66
  };
64
67
  export var mockComment = {
65
68
  id: 1,
66
69
  content: 'This is a comment',
67
70
  creator: 1,
68
71
  threadId: 1,
72
+ workspaceId: 1,
73
+ channelId: 1,
69
74
  posted: new Date('2021-01-01T00:00:00Z'),
75
+ url: 'https://twist.com/a/1/ch/1/t/1/c/1',
70
76
  };
71
77
  export var mockWorkspaceUser = {
72
78
  id: 1,
@@ -1,4 +1,16 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { z } from 'zod';
13
+ import { getFullTwistURL } from '../utils/url-helpers.js';
2
14
  import { USER_TYPES, WORKSPACE_PLANS } from './enums.js';
3
15
  // Reusable schema for system messages that can be either a string or an object
4
16
  export var SystemMessageSchema = z.union([z.string(), z.unknown()]).nullable().optional();
@@ -71,7 +83,8 @@ export var WorkspaceSchema = z.object({
71
83
  plan: z.enum(WORKSPACE_PLANS).nullable().optional(),
72
84
  });
73
85
  // Channel entity from API
74
- export var ChannelSchema = z.object({
86
+ export var ChannelSchema = z
87
+ .object({
75
88
  id: z.number(),
76
89
  name: z.string(),
77
90
  description: z.string().nullable().optional(),
@@ -89,9 +102,11 @@ export var ChannelSchema = z.object({
89
102
  icon: z.number().nullable().optional(),
90
103
  version: z.number(),
91
104
  filters: z.record(z.string(), z.string()).nullable().optional(),
92
- });
105
+ })
106
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({ workspaceId: data.workspaceId, channelId: data.id }) })); });
93
107
  // Thread entity from API
94
- export var ThreadSchema = z.object({
108
+ export var ThreadSchema = z
109
+ .object({
95
110
  id: z.number(),
96
111
  title: z.string(),
97
112
  content: z.string(),
@@ -154,7 +169,12 @@ export var ThreadSchema = z.object({
154
169
  })
155
170
  .nullable()
156
171
  .optional(),
157
- });
172
+ })
173
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({
174
+ workspaceId: data.workspaceId,
175
+ channelId: data.channelId,
176
+ threadId: data.id,
177
+ }) })); });
158
178
  // Group entity from API
159
179
  export var GroupSchema = z.object({
160
180
  id: z.number(),
@@ -165,7 +185,8 @@ export var GroupSchema = z.object({
165
185
  version: z.number(),
166
186
  });
167
187
  // Conversation entity from API
168
- export var ConversationSchema = z.object({
188
+ export var ConversationSchema = z
189
+ .object({
169
190
  id: z.number(),
170
191
  workspaceId: z.number(),
171
192
  userIds: z.array(z.number()),
@@ -201,14 +222,16 @@ export var ConversationSchema = z.object({
201
222
  })
202
223
  .nullable()
203
224
  .optional(),
204
- });
225
+ })
226
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({ workspaceId: data.workspaceId, conversationId: data.id }) })); });
205
227
  // Comment entity from API
206
- export var CommentSchema = z.object({
228
+ export var CommentSchema = z
229
+ .object({
207
230
  id: z.number(),
208
231
  content: z.string(),
209
232
  creator: z.number(),
210
233
  threadId: z.number(),
211
- workspaceId: z.number().nullable().optional(),
234
+ workspaceId: z.number(),
212
235
  conversationId: z.number().nullable().optional(),
213
236
  posted: z.date(),
214
237
  lastEdited: z.date().nullable().optional(),
@@ -220,7 +243,7 @@ export var CommentSchema = z.object({
220
243
  objIndex: z.number().nullable().optional(),
221
244
  // Extended fields that may appear in some API responses (like inbox)
222
245
  creatorName: z.string().nullable().optional(),
223
- channelId: z.number().nullable().optional(),
246
+ channelId: z.number(),
224
247
  recipients: z.array(z.number()).nullable().optional(),
225
248
  groups: z.array(z.number()).nullable().optional(),
226
249
  toEmails: z.array(z.string()).nullable().optional(),
@@ -228,7 +251,13 @@ export var CommentSchema = z.object({
228
251
  deletedBy: z.number().nullable().optional(),
229
252
  version: z.number().nullable().optional(),
230
253
  actions: z.array(z.unknown()).nullable().optional(),
231
- });
254
+ })
255
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({
256
+ workspaceId: data.workspaceId,
257
+ channelId: data.channelId,
258
+ threadId: data.threadId,
259
+ commentId: data.id,
260
+ }) })); });
232
261
  // WorkspaceUser entity from v4 API
233
262
  export var WorkspaceUserSchema = BaseUserSchema.extend({
234
263
  email: z.string().nullable().optional(),
@@ -240,7 +269,8 @@ export var WorkspaceUserSchema = BaseUserSchema.extend({
240
269
  version: z.number(),
241
270
  });
242
271
  // ConversationMessage entity from API
243
- export var ConversationMessageSchema = z.object({
272
+ export var ConversationMessageSchema = z
273
+ .object({
244
274
  id: z.number(),
245
275
  content: z.string(),
246
276
  creator: z.number(),
@@ -256,10 +286,16 @@ export var ConversationMessageSchema = z.object({
256
286
  directGroupMentions: z.array(z.number()).nullable().optional(),
257
287
  directMentions: z.array(z.number()).nullable().optional(),
258
288
  version: z.number().nullable().optional(),
259
- workspaceId: z.number().nullable().optional(),
260
- });
289
+ workspaceId: z.number(),
290
+ })
291
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({
292
+ workspaceId: data.workspaceId,
293
+ conversationId: data.conversationId,
294
+ messageId: data.id,
295
+ }) })); });
261
296
  // InboxThread entity from API - returns full Thread objects with additional inbox metadata
262
- export var InboxThreadSchema = z.object({
297
+ export var InboxThreadSchema = z
298
+ .object({
263
299
  id: z.number(),
264
300
  title: z.string(),
265
301
  content: z.string(),
@@ -297,7 +333,12 @@ export var InboxThreadSchema = z.object({
297
333
  lastComment: CommentSchema.nullable().optional(),
298
334
  toEmails: z.array(z.string()).nullable().optional(),
299
335
  version: z.number().nullable().optional(),
300
- });
336
+ })
337
+ .transform(function (data) { return (__assign(__assign({}, data), { url: getFullTwistURL({
338
+ workspaceId: data.workspaceId,
339
+ channelId: data.channelId,
340
+ threadId: data.id,
341
+ }) })); });
301
342
  // UnreadThread entity from API - simplified thread reference for unread threads
302
343
  export var UnreadThreadSchema = z.object({
303
344
  threadId: z.number(),
@@ -59,7 +59,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
59
59
  }>>>;
60
60
  }, z.core.$strip>;
61
61
  export type Workspace = z.infer<typeof WorkspaceSchema>;
62
- export declare const ChannelSchema: z.ZodObject<{
62
+ export declare const ChannelSchema: z.ZodPipe<z.ZodObject<{
63
63
  id: z.ZodNumber;
64
64
  name: z.ZodString;
65
65
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -77,9 +77,46 @@ export declare const ChannelSchema: z.ZodObject<{
77
77
  icon: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
78
  version: z.ZodNumber;
79
79
  filters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
80
- }, z.core.$strip>;
80
+ }, z.core.$strip>, z.ZodTransform<{
81
+ url: string;
82
+ id: number;
83
+ name: string;
84
+ creator: number;
85
+ public: boolean;
86
+ workspaceId: number;
87
+ archived: boolean;
88
+ created: Date;
89
+ version: number;
90
+ description?: string | null | undefined;
91
+ userIds?: number[] | null | undefined;
92
+ color?: number | null | undefined;
93
+ useDefaultRecipients?: boolean | null | undefined;
94
+ defaultGroups?: number[] | null | undefined;
95
+ defaultRecipients?: number[] | null | undefined;
96
+ isFavorited?: boolean | null | undefined;
97
+ icon?: number | null | undefined;
98
+ filters?: Record<string, string> | null | undefined;
99
+ }, {
100
+ id: number;
101
+ name: string;
102
+ creator: number;
103
+ public: boolean;
104
+ workspaceId: number;
105
+ archived: boolean;
106
+ created: Date;
107
+ version: number;
108
+ description?: string | null | undefined;
109
+ userIds?: number[] | null | undefined;
110
+ color?: number | null | undefined;
111
+ useDefaultRecipients?: boolean | null | undefined;
112
+ defaultGroups?: number[] | null | undefined;
113
+ defaultRecipients?: number[] | null | undefined;
114
+ isFavorited?: boolean | null | undefined;
115
+ icon?: number | null | undefined;
116
+ filters?: Record<string, string> | null | undefined;
117
+ }>>;
81
118
  export type Channel = z.infer<typeof ChannelSchema>;
82
- export declare const ThreadSchema: z.ZodObject<{
119
+ export declare const ThreadSchema: z.ZodPipe<z.ZodObject<{
83
120
  id: z.ZodNumber;
84
121
  title: z.ZodString;
85
122
  content: z.ZodString;
@@ -139,7 +176,128 @@ export declare const ThreadSchema: z.ZodObject<{
139
176
  version: z.ZodNumber;
140
177
  workspaceId: z.ZodNumber;
141
178
  }, z.core.$strip>>>;
142
- }, z.core.$strip>;
179
+ }, z.core.$strip>, z.ZodTransform<{
180
+ url: string;
181
+ id: number;
182
+ title: string;
183
+ content: string;
184
+ creator: number;
185
+ channelId: number;
186
+ workspaceId: number;
187
+ commentCount: number;
188
+ lastUpdated: Date;
189
+ pinned: boolean;
190
+ posted: Date;
191
+ snippet: string;
192
+ snippetCreator: number;
193
+ starred: boolean;
194
+ isArchived: boolean;
195
+ creatorName?: string | null | undefined;
196
+ actions?: unknown[] | null | undefined;
197
+ attachments?: unknown[] | null | undefined;
198
+ closed?: boolean | null | undefined;
199
+ directGroupMentions?: number[] | null | undefined;
200
+ directMentions?: number[] | null | undefined;
201
+ groups?: number[] | null | undefined;
202
+ lastEdited?: Date | null | undefined;
203
+ lastObjIndex?: number | null | undefined;
204
+ mutedUntil?: Date | null | undefined;
205
+ participants?: number[] | null | undefined;
206
+ pinnedDate?: Date | null | undefined;
207
+ reactions?: Record<string, unknown> | null | undefined;
208
+ recipients?: number[] | null | undefined;
209
+ responders?: number[] | null | undefined;
210
+ snippetMaskAvatarUrl?: string | null | undefined;
211
+ snippetMaskPoster?: string | number | null | undefined;
212
+ systemMessage?: unknown;
213
+ toEmails?: string[] | null | undefined;
214
+ isSaved?: boolean | null | undefined;
215
+ inInbox?: boolean | null | undefined;
216
+ lastComment?: {
217
+ id: number;
218
+ content: string;
219
+ creator: number;
220
+ creatorName: string;
221
+ threadId: number;
222
+ channelId: number;
223
+ posted: Date;
224
+ objIndex: number;
225
+ deleted: boolean;
226
+ version: number;
227
+ workspaceId: number;
228
+ systemMessage?: unknown;
229
+ attachments?: unknown[] | null | undefined;
230
+ reactions?: Record<string, number[]> | null | undefined;
231
+ actions?: unknown[] | null | undefined;
232
+ lastEdited?: Date | null | undefined;
233
+ deletedBy?: number | null | undefined;
234
+ directGroupMentions?: number[] | null | undefined;
235
+ directMentions?: number[] | null | undefined;
236
+ groups?: number[] | null | undefined;
237
+ recipients?: number[] | null | undefined;
238
+ toEmails?: string[] | null | undefined;
239
+ } | null | undefined;
240
+ }, {
241
+ id: number;
242
+ title: string;
243
+ content: string;
244
+ creator: number;
245
+ channelId: number;
246
+ workspaceId: number;
247
+ commentCount: number;
248
+ lastUpdated: Date;
249
+ pinned: boolean;
250
+ posted: Date;
251
+ snippet: string;
252
+ snippetCreator: number;
253
+ starred: boolean;
254
+ isArchived: boolean;
255
+ creatorName?: string | null | undefined;
256
+ actions?: unknown[] | null | undefined;
257
+ attachments?: unknown[] | null | undefined;
258
+ closed?: boolean | null | undefined;
259
+ directGroupMentions?: number[] | null | undefined;
260
+ directMentions?: number[] | null | undefined;
261
+ groups?: number[] | null | undefined;
262
+ lastEdited?: Date | null | undefined;
263
+ lastObjIndex?: number | null | undefined;
264
+ mutedUntil?: Date | null | undefined;
265
+ participants?: number[] | null | undefined;
266
+ pinnedDate?: Date | null | undefined;
267
+ reactions?: Record<string, unknown> | null | undefined;
268
+ recipients?: number[] | null | undefined;
269
+ responders?: number[] | null | undefined;
270
+ snippetMaskAvatarUrl?: string | null | undefined;
271
+ snippetMaskPoster?: string | number | null | undefined;
272
+ systemMessage?: unknown;
273
+ toEmails?: string[] | null | undefined;
274
+ isSaved?: boolean | null | undefined;
275
+ inInbox?: boolean | null | undefined;
276
+ lastComment?: {
277
+ id: number;
278
+ content: string;
279
+ creator: number;
280
+ creatorName: string;
281
+ threadId: number;
282
+ channelId: number;
283
+ posted: Date;
284
+ objIndex: number;
285
+ deleted: boolean;
286
+ version: number;
287
+ workspaceId: number;
288
+ systemMessage?: unknown;
289
+ attachments?: unknown[] | null | undefined;
290
+ reactions?: Record<string, number[]> | null | undefined;
291
+ actions?: unknown[] | null | undefined;
292
+ lastEdited?: Date | null | undefined;
293
+ deletedBy?: number | null | undefined;
294
+ directGroupMentions?: number[] | null | undefined;
295
+ directMentions?: number[] | null | undefined;
296
+ groups?: number[] | null | undefined;
297
+ recipients?: number[] | null | undefined;
298
+ toEmails?: string[] | null | undefined;
299
+ } | null | undefined;
300
+ }>>;
143
301
  export type Thread = z.infer<typeof ThreadSchema>;
144
302
  export declare const GroupSchema: z.ZodObject<{
145
303
  id: z.ZodNumber;
@@ -150,7 +308,7 @@ export declare const GroupSchema: z.ZodObject<{
150
308
  version: z.ZodNumber;
151
309
  }, z.core.$strip>;
152
310
  export type Group = z.infer<typeof GroupSchema>;
153
- export declare const ConversationSchema: z.ZodObject<{
311
+ export declare const ConversationSchema: z.ZodPipe<z.ZodObject<{
154
312
  id: z.ZodNumber;
155
313
  workspaceId: z.ZodNumber;
156
314
  userIds: z.ZodArray<z.ZodNumber>;
@@ -183,14 +341,81 @@ export declare const ConversationSchema: z.ZodObject<{
183
341
  version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
184
342
  workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
185
343
  }, z.core.$strip>>>;
186
- }, z.core.$strip>;
344
+ }, z.core.$strip>, z.ZodTransform<{
345
+ url: string;
346
+ id: number;
347
+ workspaceId: number;
348
+ userIds: number[];
349
+ lastObjIndex: number;
350
+ snippet: string;
351
+ snippetCreators: number[];
352
+ lastActive: Date;
353
+ archived: boolean;
354
+ created: Date;
355
+ creator: number;
356
+ messageCount?: number | null | undefined;
357
+ mutedUntil?: Date | null | undefined;
358
+ title?: string | null | undefined;
359
+ private?: boolean | null | undefined;
360
+ lastMessage?: {
361
+ id: number;
362
+ content: string;
363
+ creator: number;
364
+ conversationId: number;
365
+ posted: Date;
366
+ systemMessage?: unknown;
367
+ attachments?: unknown[] | null | undefined;
368
+ reactions?: Record<string, number[]> | null | undefined;
369
+ actions?: unknown[] | null | undefined;
370
+ objIndex?: number | null | undefined;
371
+ lastEdited?: Date | null | undefined;
372
+ deleted?: boolean | null | undefined;
373
+ directGroupMentions?: number[] | null | undefined;
374
+ directMentions?: number[] | null | undefined;
375
+ version?: number | null | undefined;
376
+ workspaceId?: number | null | undefined;
377
+ } | null | undefined;
378
+ }, {
379
+ id: number;
380
+ workspaceId: number;
381
+ userIds: number[];
382
+ lastObjIndex: number;
383
+ snippet: string;
384
+ snippetCreators: number[];
385
+ lastActive: Date;
386
+ archived: boolean;
387
+ created: Date;
388
+ creator: number;
389
+ messageCount?: number | null | undefined;
390
+ mutedUntil?: Date | null | undefined;
391
+ title?: string | null | undefined;
392
+ private?: boolean | null | undefined;
393
+ lastMessage?: {
394
+ id: number;
395
+ content: string;
396
+ creator: number;
397
+ conversationId: number;
398
+ posted: Date;
399
+ systemMessage?: unknown;
400
+ attachments?: unknown[] | null | undefined;
401
+ reactions?: Record<string, number[]> | null | undefined;
402
+ actions?: unknown[] | null | undefined;
403
+ objIndex?: number | null | undefined;
404
+ lastEdited?: Date | null | undefined;
405
+ deleted?: boolean | null | undefined;
406
+ directGroupMentions?: number[] | null | undefined;
407
+ directMentions?: number[] | null | undefined;
408
+ version?: number | null | undefined;
409
+ workspaceId?: number | null | undefined;
410
+ } | null | undefined;
411
+ }>>;
187
412
  export type Conversation = z.infer<typeof ConversationSchema>;
188
- export declare const CommentSchema: z.ZodObject<{
413
+ export declare const CommentSchema: z.ZodPipe<z.ZodObject<{
189
414
  id: z.ZodNumber;
190
415
  content: z.ZodString;
191
416
  creator: z.ZodNumber;
192
417
  threadId: z.ZodNumber;
193
- workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
418
+ workspaceId: z.ZodNumber;
194
419
  conversationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
195
420
  posted: z.ZodDate;
196
421
  lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
@@ -201,7 +426,7 @@ export declare const CommentSchema: z.ZodObject<{
201
426
  reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
202
427
  objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
203
428
  creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
204
- channelId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
429
+ channelId: z.ZodNumber;
205
430
  recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
206
431
  groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
207
432
  toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
@@ -209,7 +434,56 @@ export declare const CommentSchema: z.ZodObject<{
209
434
  deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
210
435
  version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
211
436
  actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
212
- }, z.core.$strip>;
437
+ }, z.core.$strip>, z.ZodTransform<{
438
+ url: string;
439
+ id: number;
440
+ content: string;
441
+ creator: number;
442
+ threadId: number;
443
+ workspaceId: number;
444
+ posted: Date;
445
+ channelId: number;
446
+ conversationId?: number | null | undefined;
447
+ lastEdited?: Date | null | undefined;
448
+ directMentions?: number[] | null | undefined;
449
+ directGroupMentions?: number[] | null | undefined;
450
+ systemMessage?: unknown;
451
+ attachments?: unknown[] | null | undefined;
452
+ reactions?: Record<string, unknown> | null | undefined;
453
+ objIndex?: number | null | undefined;
454
+ creatorName?: string | null | undefined;
455
+ recipients?: number[] | null | undefined;
456
+ groups?: number[] | null | undefined;
457
+ toEmails?: string[] | null | undefined;
458
+ deleted?: boolean | null | undefined;
459
+ deletedBy?: number | null | undefined;
460
+ version?: number | null | undefined;
461
+ actions?: unknown[] | null | undefined;
462
+ }, {
463
+ id: number;
464
+ content: string;
465
+ creator: number;
466
+ threadId: number;
467
+ workspaceId: number;
468
+ posted: Date;
469
+ channelId: number;
470
+ conversationId?: number | null | undefined;
471
+ lastEdited?: Date | null | undefined;
472
+ directMentions?: number[] | null | undefined;
473
+ directGroupMentions?: number[] | null | undefined;
474
+ systemMessage?: unknown;
475
+ attachments?: unknown[] | null | undefined;
476
+ reactions?: Record<string, unknown> | null | undefined;
477
+ objIndex?: number | null | undefined;
478
+ creatorName?: string | null | undefined;
479
+ recipients?: number[] | null | undefined;
480
+ groups?: number[] | null | undefined;
481
+ toEmails?: string[] | null | undefined;
482
+ deleted?: boolean | null | undefined;
483
+ deletedBy?: number | null | undefined;
484
+ version?: number | null | undefined;
485
+ actions?: unknown[] | null | undefined;
486
+ }>>;
213
487
  export type Comment = z.infer<typeof CommentSchema>;
214
488
  export declare const WorkspaceUserSchema: z.ZodObject<{
215
489
  id: z.ZodNumber;
@@ -248,7 +522,7 @@ export declare const WorkspaceUserSchema: z.ZodObject<{
248
522
  version: z.ZodNumber;
249
523
  }, z.core.$strip>;
250
524
  export type WorkspaceUser = z.infer<typeof WorkspaceUserSchema>;
251
- export declare const ConversationMessageSchema: z.ZodObject<{
525
+ export declare const ConversationMessageSchema: z.ZodPipe<z.ZodObject<{
252
526
  id: z.ZodNumber;
253
527
  content: z.ZodString;
254
528
  creator: z.ZodNumber;
@@ -264,10 +538,45 @@ export declare const ConversationMessageSchema: z.ZodObject<{
264
538
  directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
265
539
  directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
266
540
  version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
267
- workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
268
- }, z.core.$strip>;
541
+ workspaceId: z.ZodNumber;
542
+ }, z.core.$strip>, z.ZodTransform<{
543
+ url: string;
544
+ id: number;
545
+ content: string;
546
+ creator: number;
547
+ conversationId: number;
548
+ posted: Date;
549
+ workspaceId: number;
550
+ systemMessage?: unknown;
551
+ attachments?: unknown[] | null | undefined;
552
+ reactions?: Record<string, number[]> | null | undefined;
553
+ actions?: unknown[] | null | undefined;
554
+ objIndex?: number | null | undefined;
555
+ lastEdited?: Date | null | undefined;
556
+ isDeleted?: boolean | null | undefined;
557
+ directGroupMentions?: number[] | null | undefined;
558
+ directMentions?: number[] | null | undefined;
559
+ version?: number | null | undefined;
560
+ }, {
561
+ id: number;
562
+ content: string;
563
+ creator: number;
564
+ conversationId: number;
565
+ posted: Date;
566
+ workspaceId: number;
567
+ systemMessage?: unknown;
568
+ attachments?: unknown[] | null | undefined;
569
+ reactions?: Record<string, number[]> | null | undefined;
570
+ actions?: unknown[] | null | undefined;
571
+ objIndex?: number | null | undefined;
572
+ lastEdited?: Date | null | undefined;
573
+ isDeleted?: boolean | null | undefined;
574
+ directGroupMentions?: number[] | null | undefined;
575
+ directMentions?: number[] | null | undefined;
576
+ version?: number | null | undefined;
577
+ }>>;
269
578
  export type ConversationMessage = z.infer<typeof ConversationMessageSchema>;
270
- export declare const InboxThreadSchema: z.ZodObject<{
579
+ export declare const InboxThreadSchema: z.ZodPipe<z.ZodObject<{
271
580
  id: z.ZodNumber;
272
581
  title: z.ZodString;
273
582
  content: z.ZodString;
@@ -302,12 +611,12 @@ export declare const InboxThreadSchema: z.ZodObject<{
302
611
  isSaved: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
303
612
  closed: z.ZodBoolean;
304
613
  responders: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
305
- lastComment: z.ZodOptional<z.ZodNullable<z.ZodObject<{
614
+ lastComment: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
306
615
  id: z.ZodNumber;
307
616
  content: z.ZodString;
308
617
  creator: z.ZodNumber;
309
618
  threadId: z.ZodNumber;
310
- workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
619
+ workspaceId: z.ZodNumber;
311
620
  conversationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
312
621
  posted: z.ZodDate;
313
622
  lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
@@ -318,7 +627,7 @@ export declare const InboxThreadSchema: z.ZodObject<{
318
627
  reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
319
628
  objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
320
629
  creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
321
- channelId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
630
+ channelId: z.ZodNumber;
322
631
  recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
323
632
  groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
324
633
  toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
@@ -326,10 +635,186 @@ export declare const InboxThreadSchema: z.ZodObject<{
326
635
  deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
327
636
  version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
328
637
  actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
329
- }, z.core.$strip>>>;
638
+ }, z.core.$strip>, z.ZodTransform<{
639
+ url: string;
640
+ id: number;
641
+ content: string;
642
+ creator: number;
643
+ threadId: number;
644
+ workspaceId: number;
645
+ posted: Date;
646
+ channelId: number;
647
+ conversationId?: number | null | undefined;
648
+ lastEdited?: Date | null | undefined;
649
+ directMentions?: number[] | null | undefined;
650
+ directGroupMentions?: number[] | null | undefined;
651
+ systemMessage?: unknown;
652
+ attachments?: unknown[] | null | undefined;
653
+ reactions?: Record<string, unknown> | null | undefined;
654
+ objIndex?: number | null | undefined;
655
+ creatorName?: string | null | undefined;
656
+ recipients?: number[] | null | undefined;
657
+ groups?: number[] | null | undefined;
658
+ toEmails?: string[] | null | undefined;
659
+ deleted?: boolean | null | undefined;
660
+ deletedBy?: number | null | undefined;
661
+ version?: number | null | undefined;
662
+ actions?: unknown[] | null | undefined;
663
+ }, {
664
+ id: number;
665
+ content: string;
666
+ creator: number;
667
+ threadId: number;
668
+ workspaceId: number;
669
+ posted: Date;
670
+ channelId: number;
671
+ conversationId?: number | null | undefined;
672
+ lastEdited?: Date | null | undefined;
673
+ directMentions?: number[] | null | undefined;
674
+ directGroupMentions?: number[] | null | undefined;
675
+ systemMessage?: unknown;
676
+ attachments?: unknown[] | null | undefined;
677
+ reactions?: Record<string, unknown> | null | undefined;
678
+ objIndex?: number | null | undefined;
679
+ creatorName?: string | null | undefined;
680
+ recipients?: number[] | null | undefined;
681
+ groups?: number[] | null | undefined;
682
+ toEmails?: string[] | null | undefined;
683
+ deleted?: boolean | null | undefined;
684
+ deletedBy?: number | null | undefined;
685
+ version?: number | null | undefined;
686
+ actions?: unknown[] | null | undefined;
687
+ }>>>>;
330
688
  toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
331
689
  version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
332
- }, z.core.$strip>;
690
+ }, z.core.$strip>, z.ZodTransform<{
691
+ url: string;
692
+ id: number;
693
+ title: string;
694
+ content: string;
695
+ creator: number;
696
+ channelId: number;
697
+ workspaceId: number;
698
+ commentCount: number;
699
+ lastUpdated: Date;
700
+ pinned: boolean;
701
+ posted: Date;
702
+ snippet: string;
703
+ snippetCreator: number;
704
+ starred: boolean;
705
+ isArchived: boolean;
706
+ inInbox: boolean;
707
+ closed: boolean;
708
+ creatorName?: string | null | undefined;
709
+ actions?: unknown[] | null | undefined;
710
+ attachments?: unknown[] | null | undefined;
711
+ directGroupMentions?: number[] | null | undefined;
712
+ directMentions?: number[] | null | undefined;
713
+ groups?: number[] | null | undefined;
714
+ lastEdited?: Date | null | undefined;
715
+ lastObjIndex?: number | null | undefined;
716
+ mutedUntil?: Date | null | undefined;
717
+ participants?: number[] | null | undefined;
718
+ pinnedDate?: Date | null | undefined;
719
+ reactions?: Record<string, number[]> | null | undefined;
720
+ recipients?: number[] | null | undefined;
721
+ snippetMaskAvatarUrl?: string | null | undefined;
722
+ snippetMaskPoster?: number | null | undefined;
723
+ systemMessage?: unknown;
724
+ isSaved?: boolean | null | undefined;
725
+ responders?: number[] | null | undefined;
726
+ lastComment?: {
727
+ url: string;
728
+ id: number;
729
+ content: string;
730
+ creator: number;
731
+ threadId: number;
732
+ workspaceId: number;
733
+ posted: Date;
734
+ channelId: number;
735
+ conversationId?: number | null | undefined;
736
+ lastEdited?: Date | null | undefined;
737
+ directMentions?: number[] | null | undefined;
738
+ directGroupMentions?: number[] | null | undefined;
739
+ systemMessage?: unknown;
740
+ attachments?: unknown[] | null | undefined;
741
+ reactions?: Record<string, unknown> | null | undefined;
742
+ objIndex?: number | null | undefined;
743
+ creatorName?: string | null | undefined;
744
+ recipients?: number[] | null | undefined;
745
+ groups?: number[] | null | undefined;
746
+ toEmails?: string[] | null | undefined;
747
+ deleted?: boolean | null | undefined;
748
+ deletedBy?: number | null | undefined;
749
+ version?: number | null | undefined;
750
+ actions?: unknown[] | null | undefined;
751
+ } | null | undefined;
752
+ toEmails?: string[] | null | undefined;
753
+ version?: number | null | undefined;
754
+ }, {
755
+ id: number;
756
+ title: string;
757
+ content: string;
758
+ creator: number;
759
+ channelId: number;
760
+ workspaceId: number;
761
+ commentCount: number;
762
+ lastUpdated: Date;
763
+ pinned: boolean;
764
+ posted: Date;
765
+ snippet: string;
766
+ snippetCreator: number;
767
+ starred: boolean;
768
+ isArchived: boolean;
769
+ inInbox: boolean;
770
+ closed: boolean;
771
+ creatorName?: string | null | undefined;
772
+ actions?: unknown[] | null | undefined;
773
+ attachments?: unknown[] | null | undefined;
774
+ directGroupMentions?: number[] | null | undefined;
775
+ directMentions?: number[] | null | undefined;
776
+ groups?: number[] | null | undefined;
777
+ lastEdited?: Date | null | undefined;
778
+ lastObjIndex?: number | null | undefined;
779
+ mutedUntil?: Date | null | undefined;
780
+ participants?: number[] | null | undefined;
781
+ pinnedDate?: Date | null | undefined;
782
+ reactions?: Record<string, number[]> | null | undefined;
783
+ recipients?: number[] | null | undefined;
784
+ snippetMaskAvatarUrl?: string | null | undefined;
785
+ snippetMaskPoster?: number | null | undefined;
786
+ systemMessage?: unknown;
787
+ isSaved?: boolean | null | undefined;
788
+ responders?: number[] | null | undefined;
789
+ lastComment?: {
790
+ url: string;
791
+ id: number;
792
+ content: string;
793
+ creator: number;
794
+ threadId: number;
795
+ workspaceId: number;
796
+ posted: Date;
797
+ channelId: number;
798
+ conversationId?: number | null | undefined;
799
+ lastEdited?: Date | null | undefined;
800
+ directMentions?: number[] | null | undefined;
801
+ directGroupMentions?: number[] | null | undefined;
802
+ systemMessage?: unknown;
803
+ attachments?: unknown[] | null | undefined;
804
+ reactions?: Record<string, unknown> | null | undefined;
805
+ objIndex?: number | null | undefined;
806
+ creatorName?: string | null | undefined;
807
+ recipients?: number[] | null | undefined;
808
+ groups?: number[] | null | undefined;
809
+ toEmails?: string[] | null | undefined;
810
+ deleted?: boolean | null | undefined;
811
+ deletedBy?: number | null | undefined;
812
+ version?: number | null | undefined;
813
+ actions?: unknown[] | null | undefined;
814
+ } | null | undefined;
815
+ toEmails?: string[] | null | undefined;
816
+ version?: number | null | undefined;
817
+ }>>;
333
818
  export type InboxThread = z.infer<typeof InboxThreadSchema>;
334
819
  export declare const UnreadThreadSchema: z.ZodObject<{
335
820
  threadId: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/twist-sdk",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "A TypeScript wrapper for the Twist REST API.",
5
5
  "author": "Doist developers",
6
6
  "homepage": "https://doist.github.io/twist-sdk-typescript/",