@remit/api-zod-schemas 0.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/schemas.ts ADDED
@@ -0,0 +1,1244 @@
1
+ import { z } from "zod";
2
+
3
+ /**
4
+ * Package: @remit/api-zod-schemas
5
+ * Version: 0.0.1
6
+ */
7
+
8
+ export const AccountExportStateSchema = z.enum(["Pending", "Processing", "Ready", "Failed"]);
9
+
10
+ export const AccountConfigStateSchema = z.enum(["active", "deleting"]);
11
+
12
+ export const AccountAuthTypeSchema = z.enum(["password", "oauthMicrosoft"]);
13
+
14
+ export const ConnectionStateSchema = z.enum(["not_authenticated", "authenticated", "selected", "logout", "reauth_required"]);
15
+
16
+ export const SyncPhaseSchema = z.enum(["idle", "discovering_mailboxes", "syncing_inbox", "syncing_others", "complete", "error"]);
17
+
18
+ export const CanonicalMailboxRoleSchema = z.enum(["Inbox", "Drafts", "Sent", "Archive", "Junk", "Trash", "All", "Flagged"]);
19
+
20
+ export const NamespaceTypeSchema = z.enum(["personal", "other_users", "shared"]);
21
+
22
+ export const MailboxSyncStatusSchema = z.enum(["synced", "pending", "failed", "deleting"]);
23
+
24
+ export const MailboxCursorStateSchema = z.enum(["normal", "cursor_invalid", "rebuilding"]);
25
+
26
+ export const MailboxSpecialUseSchema = z.enum(["All", "Archive", "Drafts", "Flagged", "Junk", "Sent", "Trash", "Important"]);
27
+
28
+ export const FilterScopeSchema = z.enum(["Standing", "Temporary"]);
29
+
30
+ export const FilterStateSchema = z.enum(["Active", "Expired"]);
31
+
32
+ export const FilterMatchOperatorSchema = z.enum(["And", "Or"]);
33
+
34
+ export const FilterClauseFieldSchema = z.enum(["From", "Subject", "HasWords"]);
35
+
36
+ export const OrganizeJobStateSchema = z.enum(["Pending", "Running", "Complete", "Failed"]);
37
+
38
+ export const SortOrderSchema = z.enum(["asc", "desc"]);
39
+
40
+ export const StarColorSchema = z.enum(["none", "yellow", "orange", "red", "purple", "blue", "teal", "green", "yellow_bang", "red_bang", "purple_question", "blue_info", "orange_guillemet", "green_check", "yellow_check", "blue_star"]);
41
+
42
+ export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social"]);
43
+
44
+ export const SenderTrustSchema = z.enum(["unknown", "wellknown", "vip"]);
45
+
46
+ export const PlacementActionSchema = z.enum(["MoveToInbox", "MoveToJunk"]);
47
+
48
+ export const SemanticSearchChunkTypeSchema = z.enum(["sender", "recipient", "subject", "attachment", "body", "entities"]);
49
+
50
+ export const OutboxMessageStatusSchema = z.enum(["draft", "queued", "sending", "sent", "failed", "blocked"]);
51
+
52
+ export const MessageStatusSchema = z.enum(["active", "deleting", "deleted", "moving"]);
53
+
54
+ export const MessageSyncStatusSchema = z.enum(["synced", "pending", "failed"]);
55
+
56
+ export const AuthResultVerdictSchema = z.enum(["Pass", "Fail", "None", "Neutral", "Softfail"]);
57
+
58
+ export const PlacementConfidenceSchema = z.enum(["Confident", "Unsure"]);
59
+
60
+ export const AddressRoleSchema = z.enum(["from", "sender", "reply_to", "to", "cc", "bcc"]);
61
+
62
+ export const MediaTypeSchema = z.enum(["TEXT", "IMAGE", "AUDIO", "VIDEO", "APPLICATION", "MULTIPART", "MESSAGE"]);
63
+
64
+ export const TransferEncodingSchema = z.enum(["7BIT", "8BIT", "BINARY", "BASE64", "QUOTED-PRINTABLE"]);
65
+
66
+ export const ContentDispositionSchema = z.enum(["inline", "attachment"]);
67
+
68
+ export const MultipartSubtypeSchema = z.enum(["mixed", "alternative", "digest", "parallel", "related", "signed", "encrypted", "form-data", "report"]);
69
+
70
+ export const ReferenceTypeSchema = z.enum(["in_reply_to", "references"]);
71
+
72
+ export const MessageSystemFlagSchema = z.enum(["\Seen", "\Answered", "\Flagged", "\Deleted", "\Draft"]);
73
+
74
+ export const MessageKeywordFlagSchema = z.enum(["$Forwarded", "$MDNSent", "$Junk", "$NotJunk", "$Phishing"]);
75
+
76
+ export const MailboxAttributeSchema = z.enum(["\NonExistent", "\Noinferiors", "\Noselect", "\HasChildren", "\HasNoChildren", "\Marked", "\Unmarked", "\Subscribed", "\Remote"]);
77
+
78
+ export const StorageTypeSchema = z.enum(["s3", "filesystem", "inline", "database"]);
79
+
80
+ export const ContentEncodingSchema = z.enum(["none", "gzip", "zstd"]);
81
+
82
+ export const AccountSettingNameSchema = z.enum(["Theme", "Density", "DefaultComposerFormat", "PinnedFolders", "AccountSignaturePlainText", "AccountSignatureHtml", "AccountDisplayName", "AccountMuted", "MailboxDisplayName", "MailboxMuted", "FolderRoleAppointment", "MailboxRole"]);
83
+
84
+ export const LabelColorSchema = z.enum(["Default", "Red", "Orange", "Yellow", "Green", "Teal", "Blue", "Purple", "Gray"]);
85
+
86
+ export const MessagePlacementMoveStateSchema = z.enum(["pending", "queued", "processing", "processed"]);
87
+
88
+ export const FlagPushOperationSchema = z.enum(["add", "remove"]);
89
+
90
+ export const MessageFlagPushStateSchema = z.enum(["pending", "queued", "processing", "processed"]);
91
+
92
+ export const CognitoAuthorizerSchema = z.object({
93
+ type: z.unknown(),
94
+ "in": z.unknown(),
95
+ name: z.literal("Authorization")
96
+ });
97
+
98
+ export const ApiErrorSchema = z.object({
99
+ code: z.string(),
100
+ message: z.string(),
101
+ details: z.record(z.string(), z.string()).optional()
102
+ });
103
+
104
+ export const ValidationErrorSchema = z.object({
105
+ statusCode: z.literal(400),
106
+ error: ApiErrorSchema
107
+ });
108
+
109
+ export const AmazonApiGatewayIntegrationSchema = z.object({
110
+ type: z.literal("aws_proxy"),
111
+ httpMethod: z.literal("POST"),
112
+ passthroughBehavior: z.literal("when_no_match"),
113
+ uri: z.object({ "Fn::Sub": z.literal("arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:{{HandlerFunctionName}}/invocations") })
114
+ });
115
+
116
+ export const NotFoundErrorSchema = z.object({
117
+ statusCode: z.literal(404),
118
+ error: ApiErrorSchema
119
+ });
120
+
121
+ export const InternalServerErrorSchema = z.object({
122
+ statusCode: z.literal(500),
123
+ error: ApiErrorSchema
124
+ });
125
+
126
+ export const UnauthorizedErrorSchema = z.object({
127
+ statusCode: z.literal(401),
128
+ error: ApiErrorSchema
129
+ });
130
+
131
+ export const ForbiddenErrorSchema = z.object({
132
+ statusCode: z.literal(403),
133
+ error: ApiErrorSchema
134
+ });
135
+
136
+ export const DeleteMeInputSchema = z.object({
137
+ confirmEmail: z.string()
138
+ });
139
+
140
+ export const DeleteAccountConfigResponseSchema = z.object({
141
+ statusCode: z.literal(202),
142
+ message: z.string()
143
+ });
144
+
145
+ export const VipSuggestionEntrySchema = z.object({
146
+ addressId: z.string(),
147
+ displayName: z.string().optional(),
148
+ normalizedEmail: z.string(),
149
+ inboundCount: z.number(),
150
+ outboundCount: z.number(),
151
+ replyCount: z.number(),
152
+ lastReplyAt: z.number().optional(),
153
+ lastInboundAt: z.number().optional()
154
+ });
155
+
156
+ export const VipSuggestionsResponseSchema = z.object({
157
+ suggestions: z.array(VipSuggestionEntrySchema)
158
+ });
159
+
160
+ export const CreateExportResponseSchema = z.object({
161
+ statusCode: z.literal(202),
162
+ exportId: z.string()
163
+ });
164
+
165
+ export const AccountExportRequestSchema = z.object({
166
+ accountExportRequestId: z.string(),
167
+ accountConfigId: z.string(),
168
+ userId: z.string(),
169
+ state: AccountExportStateSchema,
170
+ createdAt: z.number(),
171
+ updatedAt: z.number(),
172
+ expiresAt: z.number().optional(),
173
+ objectKey: z.string().optional(),
174
+ downloadUrl: z.string().optional(),
175
+ errorMessage: z.string().optional()
176
+ });
177
+
178
+ export const AccountExportRequestResponseSchema = z.object({
179
+ accountExportRequestId: z.string(),
180
+ accountConfigId: z.string(),
181
+ userId: z.string(),
182
+ state: AccountExportStateSchema,
183
+ createdAt: z.number(),
184
+ updatedAt: z.number(),
185
+ expiresAt: z.number().optional(),
186
+ objectKey: z.string().optional(),
187
+ downloadUrl: z.string().optional(),
188
+ errorMessage: z.string().optional()
189
+ });
190
+
191
+ export const AccountConfigResponseSchema = z.object({
192
+ accountConfigId: z.string(),
193
+ userId: z.string(),
194
+ name: z.string().optional(),
195
+ state: AccountConfigStateSchema,
196
+ deletedAt: z.number().optional(),
197
+ cascadeStartedAt: z.number().optional(),
198
+ createdAt: z.number(),
199
+ updatedAt: z.number()
200
+ });
201
+
202
+ export const MutedFlagSchema = z.object({
203
+ setAt: z.number(),
204
+ setBy: z.string().optional(),
205
+ expiresAt: z.number().optional(),
206
+ reason: z.string().optional(),
207
+ value: z.boolean()
208
+ });
209
+
210
+ export const FolderAppointmentSchema = z.object({
211
+ role: CanonicalMailboxRoleSchema,
212
+ mailboxId: z.string().optional()
213
+ });
214
+
215
+ export const AccountResponseSchema = z.object({
216
+ accountId: z.string(),
217
+ accountConfigId: z.string(),
218
+ username: z.string(),
219
+ email: z.string(),
220
+ authType: AccountAuthTypeSchema,
221
+ imapHost: z.string(),
222
+ imapPort: z.number(),
223
+ imapTls: z.boolean(),
224
+ imapStartTls: z.boolean(),
225
+ smtpEnabled: z.boolean(),
226
+ smtpHost: z.string(),
227
+ smtpPort: z.number(),
228
+ smtpTls: z.boolean(),
229
+ smtpStartTls: z.boolean(),
230
+ smtpUsername: z.string(),
231
+ isActive: z.boolean(),
232
+ connectionState: ConnectionStateSchema,
233
+ lastConnectedAt: z.number().optional(),
234
+ lastSyncAt: z.number().optional(),
235
+ lastError: z.string().optional(),
236
+ syncPhase: SyncPhaseSchema.optional(),
237
+ mailboxCountTotal: z.number().optional(),
238
+ mailboxCountSynced: z.number().optional(),
239
+ createdAt: z.number(),
240
+ updatedAt: z.number(),
241
+ displayName: z.string().optional(),
242
+ muted: MutedFlagSchema.optional(),
243
+ signaturePlainText: z.string().optional(),
244
+ signatureHtml: z.string().optional(),
245
+ folderAppointments: z.array(FolderAppointmentSchema)
246
+ });
247
+
248
+ export const ConfigDescriptionResponseSchema = z.object({
249
+ accountConfig: AccountConfigResponseSchema,
250
+ accounts: z.array(AccountResponseSchema)
251
+ });
252
+
253
+ export const AccountConfigSchema = z.object({
254
+ accountConfigId: z.string(),
255
+ userId: z.string(),
256
+ name: z.string().optional(),
257
+ state: AccountConfigStateSchema,
258
+ deletedAt: z.number().optional(),
259
+ cascadeStartedAt: z.number().optional(),
260
+ createdAt: z.number(),
261
+ updatedAt: z.number()
262
+ });
263
+
264
+ export const AccountSchema = z.object({
265
+ accountId: z.string(),
266
+ accountConfigId: z.string(),
267
+ username: z.string(),
268
+ email: z.string(),
269
+ authType: AccountAuthTypeSchema,
270
+ passwordHash: z.string().optional(),
271
+ oauthRefreshTokenHash: z.string().optional(),
272
+ oauthTokenUpdatedAt: z.number().optional(),
273
+ imapHost: z.string(),
274
+ imapPort: z.number(),
275
+ imapTls: z.boolean(),
276
+ imapStartTls: z.boolean(),
277
+ smtpEnabled: z.boolean(),
278
+ smtpHost: z.string(),
279
+ smtpPort: z.number(),
280
+ smtpTls: z.boolean(),
281
+ smtpStartTls: z.boolean(),
282
+ smtpUsername: z.string(),
283
+ smtpPasswordHash: z.string().optional(),
284
+ isActive: z.boolean(),
285
+ connectionState: ConnectionStateSchema,
286
+ lastConnectedAt: z.number().optional(),
287
+ lastSyncAt: z.number().optional(),
288
+ lastError: z.string().optional(),
289
+ syncPhase: SyncPhaseSchema.optional(),
290
+ mailboxCountTotal: z.number().optional(),
291
+ mailboxCountSynced: z.number().optional(),
292
+ createdAt: z.number(),
293
+ updatedAt: z.number(),
294
+ deletedAt: z.number().optional()
295
+ });
296
+
297
+ export const AddressFlagBaseSchema = z.object({
298
+ setAt: z.number(),
299
+ setBy: z.string().optional(),
300
+ expiresAt: z.number().optional(),
301
+ reason: z.string().optional()
302
+ });
303
+
304
+ export const MailboxSchema = z.object({
305
+ mailboxId: z.string(),
306
+ accountId: z.string(),
307
+ namespaceType: NamespaceTypeSchema,
308
+ namespacePrefix: z.string(),
309
+ hierarchyDelimiter: z.string(),
310
+ fullPath: z.string(),
311
+ uidValidity: z.number(),
312
+ uidNext: z.number(),
313
+ highestModseq: z.number(),
314
+ messageCount: z.number(),
315
+ unseenCount: z.number(),
316
+ deletedCount: z.number(),
317
+ totalSize: z.number(),
318
+ lastSyncUid: z.number(),
319
+ highWaterMarkUid: z.number(),
320
+ lastMessageSyncAt: z.number(),
321
+ initialSyncCompletedAt: z.number().optional(),
322
+ parentMailboxId: z.string(),
323
+ syncStatus: MailboxSyncStatusSchema.optional(),
324
+ cursorState: MailboxCursorStateSchema,
325
+ oldPath: z.string().optional(),
326
+ specialUse: z.array(MailboxSpecialUseSchema).optional(),
327
+ createdAt: z.number(),
328
+ updatedAt: z.number()
329
+ });
330
+
331
+ export const MailboxResponseSchema = z.object({
332
+ mailboxId: z.string(),
333
+ accountId: z.string(),
334
+ namespaceType: NamespaceTypeSchema,
335
+ namespacePrefix: z.string(),
336
+ hierarchyDelimiter: z.string(),
337
+ fullPath: z.string(),
338
+ messageCount: z.number(),
339
+ unseenCount: z.number(),
340
+ deletedCount: z.number(),
341
+ lastSyncUid: z.number(),
342
+ highWaterMarkUid: z.number(),
343
+ lastMessageSyncAt: z.number(),
344
+ specialUse: z.array(MailboxSpecialUseSchema).optional(),
345
+ createdAt: z.number(),
346
+ updatedAt: z.number(),
347
+ muted: MutedFlagSchema.optional(),
348
+ displayNameOverride: z.string().optional()
349
+ });
350
+
351
+ export const CreateMailboxInputSchema = z.object({
352
+ namespaceType: NamespaceTypeSchema,
353
+ fullPath: z.string()
354
+ });
355
+
356
+ export const RenameMailboxInputSchema = z.object({
357
+ fullPath: z.string().optional(),
358
+ muted: z.union([MutedFlagSchema, z.unknown()]).optional(),
359
+ displayNameOverride: z.union([z.string(), z.unknown()]).optional()
360
+ });
361
+
362
+ export const AppointFolderRoleInputSchema = z.object({
363
+ mailboxId: z.union([z.string(), z.unknown()])
364
+ });
365
+
366
+ export const FilterClauseSchema = z.object({
367
+ field: FilterClauseFieldSchema,
368
+ value: z.string()
369
+ });
370
+
371
+ export const FilterSchema = z.object({
372
+ filterId: z.string(),
373
+ accountConfigId: z.string(),
374
+ name: z.string(),
375
+ scope: FilterScopeSchema,
376
+ expiresAt: z.string().optional(),
377
+ ttl: z.number().optional(),
378
+ state: FilterStateSchema,
379
+ hasAnchor: z.boolean(),
380
+ ruleChangedAt: z.number(),
381
+ matchOperator: FilterMatchOperatorSchema,
382
+ literalClauses: z.array(FilterClauseSchema),
383
+ actionLabelId: z.string(),
384
+ actionMailboxId: z.string(),
385
+ createdAt: z.number(),
386
+ updatedAt: z.number()
387
+ });
388
+
389
+ export const FilterResponseSchema = z.object({
390
+ filterId: z.string(),
391
+ accountConfigId: z.string(),
392
+ name: z.string(),
393
+ scope: FilterScopeSchema,
394
+ expiresAt: z.string().optional(),
395
+ state: FilterStateSchema,
396
+ hasAnchor: z.boolean(),
397
+ ruleChangedAt: z.number(),
398
+ matchOperator: FilterMatchOperatorSchema,
399
+ literalClauses: z.array(FilterClauseSchema),
400
+ actionLabelId: z.string(),
401
+ actionMailboxId: z.string(),
402
+ createdAt: z.number(),
403
+ updatedAt: z.number()
404
+ });
405
+
406
+ export const CreateFilterInputSchema = z.object({
407
+ name: z.string(),
408
+ scope: FilterScopeSchema,
409
+ expiresAt: z.string().optional(),
410
+ matchOperator: FilterMatchOperatorSchema,
411
+ literalClauses: z.array(FilterClauseSchema),
412
+ actionLabelId: z.string(),
413
+ actionMailboxId: z.string(),
414
+ anchorMessageId: z.string().optional()
415
+ });
416
+
417
+ export const UpdateFilterInputSchema = z.object({
418
+ name: z.string(),
419
+ matchOperator: FilterMatchOperatorSchema,
420
+ literalClauses: z.array(FilterClauseSchema),
421
+ actionLabelId: z.string(),
422
+ actionMailboxId: z.string()
423
+ });
424
+
425
+ export const OrganizeInputSchema = z.object({
426
+ anchorMessageId: z.string().optional(),
427
+ matchOperator: FilterMatchOperatorSchema,
428
+ literalClauses: z.array(FilterClauseSchema),
429
+ similarityThreshold: z.number().optional(),
430
+ actionLabelId: z.string(),
431
+ actionMailboxId: z.string()
432
+ });
433
+
434
+ export const CreateOrganizeJobResponseSchema = z.object({
435
+ statusCode: z.literal(202),
436
+ organizeJobId: z.string(),
437
+ state: OrganizeJobStateSchema
438
+ });
439
+
440
+ export const OrganizePreviewResponseSchema = z.object({
441
+ matchedCount: z.number(),
442
+ messageIds: z.array(z.string())
443
+ });
444
+
445
+ export const OrganizeJobRequestSchema = z.object({
446
+ organizeJobId: z.string(),
447
+ accountConfigId: z.string(),
448
+ userId: z.string(),
449
+ state: OrganizeJobStateSchema,
450
+ anchorMessageId: z.string(),
451
+ matchOperator: FilterMatchOperatorSchema,
452
+ literalClauses: z.array(FilterClauseSchema),
453
+ similarityThreshold: z.number(),
454
+ actionLabelId: z.string(),
455
+ actionMailboxId: z.string(),
456
+ matchedCount: z.number(),
457
+ appliedCount: z.number(),
458
+ failedCount: z.number(),
459
+ errorMessage: z.string(),
460
+ ttl: z.number(),
461
+ createdAt: z.number(),
462
+ updatedAt: z.number()
463
+ });
464
+
465
+ export const OrganizeJobResponseSchema = z.object({
466
+ organizeJobId: z.string(),
467
+ accountConfigId: z.string(),
468
+ userId: z.string(),
469
+ state: OrganizeJobStateSchema,
470
+ anchorMessageId: z.string(),
471
+ matchOperator: FilterMatchOperatorSchema,
472
+ literalClauses: z.array(FilterClauseSchema),
473
+ similarityThreshold: z.number(),
474
+ actionLabelId: z.string(),
475
+ actionMailboxId: z.string(),
476
+ matchedCount: z.number(),
477
+ appliedCount: z.number(),
478
+ failedCount: z.number(),
479
+ errorMessage: z.string(),
480
+ createdAt: z.number(),
481
+ updatedAt: z.number()
482
+ });
483
+
484
+ export const EmptyTrashResponseSchema = z.object({
485
+ deletedCount: z.number()
486
+ });
487
+
488
+ export const SyncTriggerResponseSchema = z.object({
489
+ triggered: z.boolean(),
490
+ message: z.string()
491
+ });
492
+
493
+ export const MailboxSyncProgressSchema = z.object({
494
+ mailboxId: z.string(),
495
+ fullPath: z.string(),
496
+ phase: z.string(),
497
+ messagesTotal: z.number(),
498
+ messagesSynced: z.number(),
499
+ lastSyncedAt: z.number().optional()
500
+ });
501
+
502
+ export const AccountSyncStatusResponseSchema = z.object({
503
+ accountId: z.string(),
504
+ syncPhase: SyncPhaseSchema.optional(),
505
+ mailboxCountTotal: z.number().optional(),
506
+ mailboxCountSynced: z.number().optional(),
507
+ mailboxes: z.array(MailboxSyncProgressSchema)
508
+ });
509
+
510
+ export const CreateAccountInputSchema = z.object({
511
+ email: z.string(),
512
+ displayName: z.string().optional(),
513
+ username: z.string().optional(),
514
+ authType: AccountAuthTypeSchema.optional(),
515
+ password: z.string().optional(),
516
+ imapHost: z.string(),
517
+ imapPort: z.number(),
518
+ imapTls: z.boolean(),
519
+ imapStartTls: z.boolean(),
520
+ smtpEnabled: z.boolean().optional(),
521
+ smtpHost: z.string().optional(),
522
+ smtpPort: z.number().optional(),
523
+ smtpTls: z.boolean().optional(),
524
+ smtpStartTls: z.boolean().optional(),
525
+ smtpUsername: z.string().optional(),
526
+ smtpPassword: z.string().optional()
527
+ });
528
+
529
+ export const TestConnectionInputSchema = z.object({
530
+ accountId: z.string().optional(),
531
+ username: z.string(),
532
+ password: z.string().optional(),
533
+ imapHost: z.string(),
534
+ imapPort: z.number(),
535
+ imapTls: z.boolean(),
536
+ imapStartTls: z.boolean(),
537
+ smtpHost: z.string().optional(),
538
+ smtpPort: z.number().optional(),
539
+ smtpTls: z.boolean().optional(),
540
+ smtpStartTls: z.boolean().optional(),
541
+ smtpUsername: z.string().optional(),
542
+ smtpPassword: z.string().optional()
543
+ });
544
+
545
+ export const TestConnectionResponseSchema = z.object({
546
+ imapSuccess: z.boolean(),
547
+ imapError: z.string().optional(),
548
+ smtpSuccess: z.boolean().optional(),
549
+ smtpError: z.string().optional()
550
+ });
551
+
552
+ export const UpdateAccountInputSchema = z.object({
553
+ displayName: z.string().optional(),
554
+ password: z.string().optional(),
555
+ imapHost: z.string().optional(),
556
+ imapPort: z.number().optional(),
557
+ imapTls: z.boolean().optional(),
558
+ imapStartTls: z.boolean().optional(),
559
+ smtpEnabled: z.boolean().optional(),
560
+ smtpHost: z.string().optional(),
561
+ smtpPort: z.number().optional(),
562
+ smtpTls: z.boolean().optional(),
563
+ smtpStartTls: z.boolean().optional(),
564
+ smtpUsername: z.string().optional(),
565
+ smtpPassword: z.string().optional(),
566
+ isActive: z.boolean().optional(),
567
+ signaturePlainText: z.string().optional(),
568
+ signatureHtml: z.string().optional(),
569
+ muted: z.union([MutedFlagSchema, z.unknown()]).optional()
570
+ });
571
+
572
+ export const DeleteAccountResponseSchema = z.object({
573
+ accountId: z.string(),
574
+ deletedAt: z.number(),
575
+ message: z.string()
576
+ });
577
+
578
+ export const ThreadMessageSchema = z.object({
579
+ threadMessageId: z.string(),
580
+ threadId: z.string(),
581
+ messageId: z.string(),
582
+ accountConfigId: z.string(),
583
+ mailboxId: z.string(),
584
+ uid: z.number(),
585
+ messageIdHeader: z.string().optional(),
586
+ inReplyTo: z.string().optional(),
587
+ referenceOrder: z.number(),
588
+ fromEmail: z.string().optional(),
589
+ fromName: z.string().optional(),
590
+ subject: z.string().optional(),
591
+ internalDate: z.number(),
592
+ sentDate: z.number(),
593
+ isRead: z.boolean(),
594
+ hasAttachment: z.boolean(),
595
+ star: StarColorSchema,
596
+ hasStars: z.boolean(),
597
+ isDeleted: z.boolean(),
598
+ snippet: z.string().optional(),
599
+ category: MessageCategorySchema,
600
+ createdAt: z.number(),
601
+ updatedAt: z.number()
602
+ });
603
+
604
+ export const MessageAuthenticitySchema = z.object({
605
+ fromDomain: z.string(),
606
+ dkimDomain: z.string().optional(),
607
+ dkimMismatch: z.boolean()
608
+ });
609
+
610
+ export const AutoMovedInfoSchema = z.object({
611
+ action: PlacementActionSchema,
612
+ fromPlacement: z.string()
613
+ });
614
+
615
+ export const ThreadMessageResponseSchema = z.object({
616
+ threadMessageId: z.string(),
617
+ threadId: z.string(),
618
+ messageId: z.string(),
619
+ accountConfigId: z.string(),
620
+ mailboxId: z.string(),
621
+ fromEmail: z.string().optional(),
622
+ fromName: z.string().optional(),
623
+ subject: z.string().optional(),
624
+ sentDate: z.number(),
625
+ isRead: z.boolean(),
626
+ hasAttachment: z.boolean(),
627
+ star: StarColorSchema,
628
+ hasStars: z.boolean(),
629
+ isDeleted: z.boolean(),
630
+ snippet: z.string().optional(),
631
+ createdAt: z.number(),
632
+ updatedAt: z.number(),
633
+ category: MessageCategorySchema.optional(),
634
+ senderTrust: SenderTrustSchema,
635
+ authenticity: MessageAuthenticitySchema.optional(),
636
+ accountId: z.string().optional(),
637
+ autoMoved: AutoMovedInfoSchema.optional()
638
+ });
639
+
640
+ export const ThreadSearchResponseSchema = z.object({
641
+ items: z.array(ThreadMessageResponseSchema).optional(),
642
+ continuationToken: z.string().optional(),
643
+ count: z.number().optional()
644
+ });
645
+
646
+ export const SemanticSearchResultSchema = z.object({
647
+ messageId: z.string(),
648
+ threadId: z.string(),
649
+ score: z.number(),
650
+ matchedChunkType: SemanticSearchChunkTypeSchema,
651
+ mailboxIds: z.array(z.string()),
652
+ fromName: z.string().optional(),
653
+ subject: z.string().optional(),
654
+ sentDate: z.number().optional(),
655
+ category: MessageCategorySchema.optional()
656
+ });
657
+
658
+ export const CreateOutboxMessageInputSchema = z.object({
659
+ accountId: z.string(),
660
+ toAddresses: z.array(z.string()),
661
+ ccAddresses: z.array(z.string()).optional(),
662
+ bccAddresses: z.array(z.string()).optional(),
663
+ subject: z.string().optional(),
664
+ textBody: z.string().optional(),
665
+ htmlBody: z.string().optional(),
666
+ inReplyTo: z.string().optional(),
667
+ references: z.array(z.string()).optional(),
668
+ sendImmediately: z.boolean().optional()
669
+ });
670
+
671
+ export const OutboxMessageSchema = z.object({
672
+ outboxMessageId: z.string(),
673
+ accountId: z.string(),
674
+ accountConfigId: z.string(),
675
+ fromAddress: z.string(),
676
+ fromName: z.string().optional(),
677
+ toAddresses: z.array(z.string()),
678
+ ccAddresses: z.array(z.string()),
679
+ bccAddresses: z.array(z.string()),
680
+ replyToAddress: z.string().optional(),
681
+ subject: z.string().optional(),
682
+ messageIdValue: z.string(),
683
+ inReplyTo: z.string().optional(),
684
+ references: z.array(z.string()),
685
+ textBody: z.string().optional(),
686
+ htmlBody: z.string().optional(),
687
+ status: OutboxMessageStatusSchema,
688
+ lastError: z.string().optional(),
689
+ lastSmtpCode: z.number().optional(),
690
+ sentAt: z.number().optional(),
691
+ smtpMessageId: z.string().optional(),
692
+ createdAt: z.number(),
693
+ updatedAt: z.number()
694
+ });
695
+
696
+ export const OutboxMessageResponseSchema = z.object({
697
+ outboxMessageId: z.string(),
698
+ accountId: z.string(),
699
+ fromAddress: z.string(),
700
+ fromName: z.string().optional(),
701
+ toAddresses: z.array(z.string()),
702
+ ccAddresses: z.array(z.string()),
703
+ bccAddresses: z.array(z.string()),
704
+ subject: z.string().optional(),
705
+ inReplyTo: z.string().optional(),
706
+ references: z.array(z.string()),
707
+ textBody: z.string().optional(),
708
+ htmlBody: z.string().optional(),
709
+ status: OutboxMessageStatusSchema,
710
+ lastError: z.string().optional(),
711
+ sentAt: z.number().optional(),
712
+ createdAt: z.number(),
713
+ updatedAt: z.number()
714
+ });
715
+
716
+ export const UpdateOutboxMessageInputSchema = z.object({
717
+ toAddresses: z.array(z.string()).optional(),
718
+ ccAddresses: z.array(z.string()).optional(),
719
+ bccAddresses: z.array(z.string()).optional(),
720
+ subject: z.string().optional(),
721
+ textBody: z.string().optional(),
722
+ htmlBody: z.string().optional(),
723
+ inReplyTo: z.string().optional(),
724
+ references: z.array(z.string()).optional()
725
+ });
726
+
727
+ export const TrustedFlagSchema = z.object({
728
+ setAt: z.number(),
729
+ setBy: z.string().optional(),
730
+ expiresAt: z.number().optional(),
731
+ reason: z.string().optional(),
732
+ value: z.boolean()
733
+ });
734
+
735
+ export const BlockedFlagSchema = z.object({
736
+ setAt: z.number(),
737
+ setBy: z.string().optional(),
738
+ expiresAt: z.number().optional(),
739
+ reason: z.string().optional(),
740
+ value: z.boolean()
741
+ });
742
+
743
+ export const VipFlagSchema = z.object({
744
+ setAt: z.number(),
745
+ setBy: z.string().optional(),
746
+ expiresAt: z.number().optional(),
747
+ reason: z.string().optional(),
748
+ value: z.boolean()
749
+ });
750
+
751
+ export const WellknownFlagSchema = z.object({
752
+ setAt: z.number(),
753
+ setBy: z.string().optional(),
754
+ expiresAt: z.number().optional(),
755
+ reason: z.string().optional(),
756
+ value: z.boolean()
757
+ });
758
+
759
+ export const CategoryFlagSchema = z.object({
760
+ setAt: z.number(),
761
+ setBy: z.string().optional(),
762
+ expiresAt: z.number().optional(),
763
+ reason: z.string().optional(),
764
+ value: MessageCategorySchema
765
+ });
766
+
767
+ export const AutoArchiveFlagSchema = z.object({
768
+ setAt: z.number(),
769
+ setBy: z.string().optional(),
770
+ expiresAt: z.number().optional(),
771
+ reason: z.string().optional(),
772
+ value: z.boolean()
773
+ });
774
+
775
+ export const UnsubscribedFlagSchema = z.object({
776
+ setAt: z.number(),
777
+ setBy: z.string().optional(),
778
+ expiresAt: z.number().optional(),
779
+ reason: z.string().optional(),
780
+ value: z.boolean()
781
+ });
782
+
783
+ export const AddressFlagsSchema = z.object({
784
+ trusted: TrustedFlagSchema.optional(),
785
+ blocked: BlockedFlagSchema.optional(),
786
+ muted: MutedFlagSchema.optional(),
787
+ vip: VipFlagSchema.optional(),
788
+ wellknown: WellknownFlagSchema.optional(),
789
+ category: CategoryFlagSchema.optional(),
790
+ autoArchive: AutoArchiveFlagSchema.optional(),
791
+ unsubscribed: UnsubscribedFlagSchema.optional()
792
+ });
793
+
794
+ export const AddressSchema = z.object({
795
+ addressId: z.string(),
796
+ accountConfigId: z.string(),
797
+ displayName: z.string().optional(),
798
+ localPart: z.string(),
799
+ domain: z.string(),
800
+ normalizedEmail: z.string(),
801
+ normalizedCompound: z.string(),
802
+ flags: AddressFlagsSchema,
803
+ inboundCount: z.number(),
804
+ outboundCount: z.number(),
805
+ replyCount: z.number(),
806
+ lastInboundAt: z.number(),
807
+ lastOutboundAt: z.number().optional(),
808
+ lastReplyAt: z.number(),
809
+ createdAt: z.number(),
810
+ updatedAt: z.number()
811
+ });
812
+
813
+ export const AddressResponseSchema = z.object({
814
+ addressId: z.string(),
815
+ accountConfigId: z.string(),
816
+ displayName: z.string().optional(),
817
+ localPart: z.string(),
818
+ domain: z.string(),
819
+ normalizedEmail: z.string(),
820
+ flags: AddressFlagsSchema,
821
+ inboundCount: z.number(),
822
+ outboundCount: z.number(),
823
+ replyCount: z.number(),
824
+ lastInboundAt: z.number(),
825
+ lastReplyAt: z.number(),
826
+ createdAt: z.number(),
827
+ updatedAt: z.number()
828
+ });
829
+
830
+ export const UpdateAddressFlagsInputSchema = z.object({
831
+ trusted: z.union([TrustedFlagSchema, z.unknown()]).optional(),
832
+ blocked: z.union([BlockedFlagSchema, z.unknown()]).optional(),
833
+ muted: z.union([MutedFlagSchema, z.unknown()]).optional(),
834
+ vip: z.union([VipFlagSchema, z.unknown()]).optional(),
835
+ wellknown: z.union([WellknownFlagSchema, z.unknown()]).optional(),
836
+ category: z.union([CategoryFlagSchema, z.unknown()]).optional(),
837
+ autoArchive: z.union([AutoArchiveFlagSchema, z.unknown()]).optional(),
838
+ unsubscribed: z.union([UnsubscribedFlagSchema, z.unknown()]).optional()
839
+ });
840
+
841
+ export const UpdateAddressInputSchema = z.object({
842
+ flags: UpdateAddressFlagsInputSchema.optional()
843
+ });
844
+
845
+ export const MessageSummaryResponseSchema = z.object({
846
+ messageId: z.string(),
847
+ mailboxId: z.string(),
848
+ uid: z.number(),
849
+ rfc822Size: z.number(),
850
+ internalDate: z.number(),
851
+ messageIdHeader: z.string().optional(),
852
+ authenticity: MessageAuthenticitySchema.optional(),
853
+ autoMoved: AutoMovedInfoSchema.optional()
854
+ });
855
+
856
+ export const EnvelopeAddressResponseSchema = z.object({
857
+ addressId: z.string(),
858
+ displayName: z.string().optional(),
859
+ normalizedEmail: z.string(),
860
+ addressRole: AddressRoleSchema,
861
+ addressOrder: z.number(),
862
+ flags: AddressFlagsSchema.optional()
863
+ });
864
+
865
+ export const EnvelopeResponseSchema = z.object({
866
+ messageId: z.string(),
867
+ date: z.number(),
868
+ subject: z.string().optional(),
869
+ messageIdValue: z.string().optional(),
870
+ from: z.array(EnvelopeAddressResponseSchema),
871
+ to: z.array(EnvelopeAddressResponseSchema),
872
+ cc: z.array(EnvelopeAddressResponseSchema),
873
+ bcc: z.array(EnvelopeAddressResponseSchema),
874
+ replyTo: z.array(EnvelopeAddressResponseSchema),
875
+ category: MessageCategorySchema.optional(),
876
+ senderTrust: SenderTrustSchema
877
+ });
878
+
879
+ export const BodyPartResponseSchema = z.object({
880
+ bodyPartId: z.string(),
881
+ mediaType: MediaTypeSchema,
882
+ mediaSubtype: z.string(),
883
+ contentId: z.string().optional(),
884
+ sizeOctets: z.number(),
885
+ disposition: ContentDispositionSchema.optional(),
886
+ dispositionFilename: z.string().optional(),
887
+ isMultipart: z.boolean(),
888
+ contentUrl: z.string().url()
889
+ });
890
+
891
+ export const MessageReferenceResponseSchema = z.object({
892
+ messageIdValue: z.string(),
893
+ referenceType: ReferenceTypeSchema,
894
+ referenceOrder: z.number()
895
+ });
896
+
897
+ export const DescribeMessageResponseSchema = z.object({
898
+ message: MessageSummaryResponseSchema,
899
+ envelope: EnvelopeResponseSchema,
900
+ flags: z.array(z.string()),
901
+ bodyParts: z.array(BodyPartResponseSchema),
902
+ references: z.array(MessageReferenceResponseSchema)
903
+ });
904
+
905
+ export const MessageAuthResultSchema = z.object({
906
+ dmarc: AuthResultVerdictSchema.optional(),
907
+ spf: AuthResultVerdictSchema.optional(),
908
+ dkim: AuthResultVerdictSchema.optional()
909
+ });
910
+
911
+ export const MessageProviderSpamSchema = z.object({
912
+ classified: z.boolean(),
913
+ score: z.string().optional(),
914
+ source: z.string().optional()
915
+ });
916
+
917
+ export const MessagePlacementVerdictSchema = z.object({
918
+ action: PlacementActionSchema,
919
+ confidence: PlacementConfidenceSchema,
920
+ fromPlacement: z.string(),
921
+ reasons: z.array(z.string()),
922
+ dryRun: z.boolean(),
923
+ decidedAt: z.number()
924
+ });
925
+
926
+ export const MessageSchema = z.object({
927
+ messageId: z.string(),
928
+ mailboxId: z.string(),
929
+ uid: z.number(),
930
+ sequenceNumber: z.number(),
931
+ rfc822Size: z.number(),
932
+ internalDate: z.number(),
933
+ messageIdHeader: z.string().optional(),
934
+ envelopeId: z.string(),
935
+ rootBodyPartId: z.string(),
936
+ bodyStorageKey: z.string().optional(),
937
+ status: MessageStatusSchema,
938
+ syncStatus: MessageSyncStatusSchema,
939
+ originalMailboxId: z.string().optional(),
940
+ originalUid: z.number().optional(),
941
+ category: MessageCategorySchema,
942
+ authenticity: MessageAuthenticitySchema.optional(),
943
+ authResult: MessageAuthResultSchema.optional(),
944
+ providerSpam: MessageProviderSpamSchema.optional(),
945
+ hasListUnsubscribe: z.boolean(),
946
+ movedByRemit: z.boolean(),
947
+ placementVerdict: MessagePlacementVerdictSchema.optional(),
948
+ createdAt: z.number(),
949
+ updatedAt: z.number()
950
+ });
951
+
952
+ export const BodyPartSchema = z.object({
953
+ bodyPartId: z.string(),
954
+ messageId: z.string(),
955
+ parentBodyPartId: z.string().optional(),
956
+ partPath: z.string(),
957
+ mediaType: MediaTypeSchema,
958
+ mediaSubtype: z.string(),
959
+ contentId: z.string().optional(),
960
+ contentDescription: z.string().optional(),
961
+ transferEncoding: TransferEncodingSchema,
962
+ sizeOctets: z.number(),
963
+ lineCount: z.number().optional(),
964
+ md5Hash: z.string().optional(),
965
+ disposition: ContentDispositionSchema.optional(),
966
+ dispositionFilename: z.string().optional(),
967
+ language: z.string().optional(),
968
+ location: z.string().optional(),
969
+ isMultipart: z.boolean(),
970
+ multipartSubtype: MultipartSubtypeSchema.optional(),
971
+ createdAt: z.number(),
972
+ updatedAt: z.number()
973
+ });
974
+
975
+ export const MessageReferenceSchema = z.object({
976
+ messageReferenceId: z.string(),
977
+ messageId: z.string(),
978
+ envelopeId: z.string(),
979
+ messageIdValue: z.string(),
980
+ referenceType: ReferenceTypeSchema,
981
+ referenceOrder: z.number(),
982
+ createdAt: z.number(),
983
+ updatedAt: z.number()
984
+ });
985
+
986
+ export const RawMessageResponseSchema = z.object({
987
+ raw: z.string()
988
+ });
989
+
990
+ export const UpdateFlagsInputSchema = z.object({
991
+ isRead: z.boolean().optional(),
992
+ isStarred: z.boolean().optional(),
993
+ starColor: StarColorSchema.optional()
994
+ });
995
+
996
+ export const BulkUpdateFlagsInputSchema = z.object({
997
+ messageIds: z.array(z.string()),
998
+ isRead: z.boolean().optional(),
999
+ isStarred: z.boolean().optional(),
1000
+ starColor: StarColorSchema.optional()
1001
+ });
1002
+
1003
+ export const MessageBulkOperationResultSchema = z.object({
1004
+ successCount: z.number(),
1005
+ failureCount: z.number(),
1006
+ failedIds: z.array(z.string()).optional()
1007
+ });
1008
+
1009
+ export const DeleteMessagesInputSchema = z.object({
1010
+ messageIds: z.array(z.string()),
1011
+ permanent: z.boolean().optional()
1012
+ });
1013
+
1014
+ export const BulkMessageInputSchema = z.object({
1015
+ messageIds: z.array(z.string())
1016
+ });
1017
+
1018
+ export const MoveMessagesInputSchema = z.object({
1019
+ messageIds: z.array(z.string()),
1020
+ destinationMailboxId: z.string()
1021
+ });
1022
+
1023
+ export const CopyMessagesInputSchema = z.object({
1024
+ messageIds: z.array(z.string()),
1025
+ destinationMailboxId: z.string()
1026
+ });
1027
+
1028
+ export const EnvelopeAddressSchema = z.object({
1029
+ envelopeAddressId: z.string(),
1030
+ messageId: z.string(),
1031
+ addressId: z.string(),
1032
+ displayName: z.string().optional(),
1033
+ normalizedEmail: z.string(),
1034
+ addressRole: AddressRoleSchema,
1035
+ addressOrder: z.number(),
1036
+ createdAt: z.number(),
1037
+ updatedAt: z.number()
1038
+ });
1039
+
1040
+ export const AccountSettingValueSchema = z.object({
1041
+ kind: z.string()
1042
+ });
1043
+
1044
+ export const BooleanSettingSchema = z.object({
1045
+ kind: z.literal("Boolean"),
1046
+ value: z.boolean()
1047
+ });
1048
+
1049
+ export const StringSettingSchema = z.object({
1050
+ kind: z.literal("String"),
1051
+ value: z.string()
1052
+ });
1053
+
1054
+ export const NumberSettingSchema = z.object({
1055
+ kind: z.literal("Number"),
1056
+ value: z.number()
1057
+ });
1058
+
1059
+ export const StringListSettingSchema = z.object({
1060
+ kind: z.literal("StringList"),
1061
+ value: z.array(z.string())
1062
+ });
1063
+
1064
+ export const MapSettingSchema = z.object({
1065
+ kind: z.literal("Map"),
1066
+ value: z.record(z.string(), z.string())
1067
+ });
1068
+
1069
+ export const MutedFlagSettingSchema = z.object({
1070
+ kind: z.literal("MutedFlag"),
1071
+ value: MutedFlagSchema
1072
+ });
1073
+
1074
+ export const AccountSettingSchema = z.object({
1075
+ accountSettingId: z.string(),
1076
+ accountConfigId: z.string(),
1077
+ name: z.string(),
1078
+ value: z.union([BooleanSettingSchema, StringSettingSchema, NumberSettingSchema, StringListSettingSchema, MapSettingSchema, MutedFlagSettingSchema]),
1079
+ createdAt: z.number(),
1080
+ updatedAt: z.number()
1081
+ });
1082
+
1083
+ export const MailboxAttributeEntrySchema = z.object({
1084
+ mailboxAttributeId: z.string(),
1085
+ mailboxId: z.string(),
1086
+ attributeName: MailboxAttributeSchema
1087
+ });
1088
+
1089
+ export const MailboxSpecialUseEntrySchema = z.object({
1090
+ mailboxSpecialUseId: z.string(),
1091
+ mailboxId: z.string(),
1092
+ specialUse: MailboxSpecialUseSchema
1093
+ });
1094
+
1095
+ export const MailboxFlagSchema = z.object({
1096
+ mailboxFlagId: z.string(),
1097
+ mailboxId: z.string(),
1098
+ flagName: z.union([MessageSystemFlagSchema, MessageKeywordFlagSchema, z.string()]),
1099
+ isPermanent: z.boolean()
1100
+ });
1101
+
1102
+ export const MailboxLockSchema = z.object({
1103
+ mailboxId: z.string(),
1104
+ eventName: z.string(),
1105
+ accountId: z.string(),
1106
+ lockId: z.string(),
1107
+ acquiredAt: z.number(),
1108
+ lockedBy: z.string(),
1109
+ ttl: z.number()
1110
+ });
1111
+
1112
+ export const MessageFlagSchema = z.object({
1113
+ messageFlagId: z.string(),
1114
+ messageId: z.string(),
1115
+ flagName: z.union([MessageSystemFlagSchema, MessageKeywordFlagSchema, z.string()]),
1116
+ setAt: z.number(),
1117
+ createdAt: z.number(),
1118
+ updatedAt: z.number()
1119
+ });
1120
+
1121
+ export const MessagePlacementMoveSchema = z.object({
1122
+ messageId: z.string(),
1123
+ accountId: z.string(),
1124
+ accountConfigId: z.string(),
1125
+ sourceMailboxId: z.string(),
1126
+ destinationMailboxId: z.string(),
1127
+ state: MessagePlacementMoveStateSchema,
1128
+ createdAt: z.number(),
1129
+ updatedAt: z.number()
1130
+ });
1131
+
1132
+ export const MessageFlagPushSchema = z.object({
1133
+ messageId: z.string(),
1134
+ flagName: z.string(),
1135
+ accountId: z.string(),
1136
+ accountConfigId: z.string(),
1137
+ mailboxId: z.string(),
1138
+ operation: FlagPushOperationSchema,
1139
+ state: MessageFlagPushStateSchema,
1140
+ createdAt: z.number(),
1141
+ updatedAt: z.number()
1142
+ });
1143
+
1144
+ export const EnvelopeSchema = z.object({
1145
+ envelopeId: z.string(),
1146
+ messageId: z.string(),
1147
+ dateValue: z.number(),
1148
+ dateRaw: z.string(),
1149
+ subject: z.string().optional(),
1150
+ messageIdValue: z.string().optional(),
1151
+ createdAt: z.number(),
1152
+ updatedAt: z.number()
1153
+ });
1154
+
1155
+ export const BodyPartParameterSchema = z.object({
1156
+ bodyPartParameterId: z.string(),
1157
+ messageId: z.string(),
1158
+ bodyPartId: z.string(),
1159
+ parameterName: z.string(),
1160
+ parameterValue: z.string(),
1161
+ createdAt: z.number(),
1162
+ updatedAt: z.number()
1163
+ });
1164
+
1165
+ export const RawMessageStorageSchema = z.object({
1166
+ rawStorageId: z.string(),
1167
+ messageId: z.string(),
1168
+ storageType: StorageTypeSchema,
1169
+ storageLocation: z.string(),
1170
+ storageKey: z.string(),
1171
+ sizeBytes: z.number(),
1172
+ checksumSha256: z.string(),
1173
+ contentEncoding: ContentEncodingSchema,
1174
+ storedAt: z.number(),
1175
+ expiresAt: z.number().optional(),
1176
+ createdAt: z.number(),
1177
+ updatedAt: z.number()
1178
+ });
1179
+
1180
+ export const BodyPartStorageSchema = z.object({
1181
+ bodyPartStorageId: z.string(),
1182
+ messageId: z.string(),
1183
+ bodyPartId: z.string(),
1184
+ storageType: StorageTypeSchema,
1185
+ storageLocation: z.string(),
1186
+ storageKey: z.string(),
1187
+ decodedSizeBytes: z.number(),
1188
+ checksumSha256: z.string(),
1189
+ contentEncoding: ContentEncodingSchema,
1190
+ isDeduped: z.boolean(),
1191
+ dedupHash: z.string().optional(),
1192
+ storedAt: z.number(),
1193
+ createdAt: z.number(),
1194
+ updatedAt: z.number()
1195
+ });
1196
+
1197
+ export const BodyPartContentSchema = z.object({
1198
+ bodyPartContentId: z.string(),
1199
+ messageId: z.string(),
1200
+ bodyPartId: z.string(),
1201
+ content: z.string(),
1202
+ contentLength: z.number(),
1203
+ createdAt: z.number(),
1204
+ updatedAt: z.number()
1205
+ });
1206
+
1207
+ export const LabelSchema = z.object({
1208
+ labelId: z.string(),
1209
+ accountConfigId: z.string(),
1210
+ name: z.string(),
1211
+ normalizedName: z.string(),
1212
+ color: LabelColorSchema,
1213
+ createdAt: z.number(),
1214
+ updatedAt: z.number()
1215
+ });
1216
+
1217
+ export const MessageLabelSchema = z.object({
1218
+ messageLabelId: z.string(),
1219
+ messageId: z.string(),
1220
+ labelId: z.string(),
1221
+ accountConfigId: z.string(),
1222
+ appliedByFilterId: z.string().optional(),
1223
+ createdAt: z.number(),
1224
+ updatedAt: z.number()
1225
+ });
1226
+
1227
+ export const FilterAnchorSchema = z.object({
1228
+ accountConfigId: z.string(),
1229
+ filterId: z.string(),
1230
+ anchorEmbedding: z.array(z.number()),
1231
+ anchorEmbeddingId: z.string(),
1232
+ anchorSourceText: z.string(),
1233
+ anchorMessageId: z.string(),
1234
+ createdAt: z.number(),
1235
+ updatedAt: z.number()
1236
+ });
1237
+
1238
+ export const MicrosoftOAuthStartRequestSchema = z.object({
1239
+ email: z.string().optional()
1240
+ });
1241
+
1242
+ export const MicrosoftOAuthStartResponseSchema = z.object({
1243
+ authorizationUrl: z.string()
1244
+ });