@remit/data-ports 0.0.83 → 0.0.85

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 (174) hide show
  1. package/dist/account-settings.d.ts +371 -0
  2. package/dist/account-settings.js +114 -0
  3. package/dist/conformance/account.d.ts +3 -0
  4. package/dist/conformance/account.js +118 -0
  5. package/dist/conformance/calendar-collection.d.ts +3 -0
  6. package/dist/conformance/calendar-collection.js +251 -0
  7. package/dist/conformance/calendar-event-index.d.ts +3 -0
  8. package/dist/conformance/calendar-event-index.js +114 -0
  9. package/dist/conformance/calendar-feed-token.d.ts +3 -0
  10. package/dist/conformance/calendar-feed-token.js +97 -0
  11. package/dist/conformance/calendar-object.d.ts +3 -0
  12. package/dist/conformance/calendar-object.js +156 -0
  13. package/dist/conformance/calendar-suggestion.d.ts +3 -0
  14. package/dist/conformance/calendar-suggestion.js +255 -0
  15. package/{src/conformance/harness.ts → dist/conformance/harness.d.ts} +4 -4
  16. package/dist/conformance/harness.js +1 -0
  17. package/dist/conformance/index.js +8 -0
  18. package/dist/conformance/label.d.ts +3 -0
  19. package/dist/conformance/label.js +92 -0
  20. package/dist/conformance/sender-signer-standing.d.ts +3 -0
  21. package/dist/conformance/sender-signer-standing.js +81 -0
  22. package/dist/display-name.d.ts +1 -0
  23. package/dist/display-name.js +26 -0
  24. package/dist/errors.d.ts +150 -0
  25. package/dist/errors.js +181 -0
  26. package/dist/filter-ttl.d.ts +7 -0
  27. package/{src/filter-ttl.ts → dist/filter-ttl.js} +8 -11
  28. package/dist/folder-role.d.ts +239 -0
  29. package/dist/folder-role.js +276 -0
  30. package/dist/id.d.ts +124 -0
  31. package/{src/id.ts → dist/id.js} +41 -127
  32. package/dist/index.d.ts +37 -0
  33. package/dist/index.js +5 -0
  34. package/dist/interfaces/account-config.d.ts +15 -0
  35. package/dist/interfaces/account-config.js +1 -0
  36. package/dist/interfaces/account-export-request.d.ts +10 -0
  37. package/dist/interfaces/account-export-request.js +1 -0
  38. package/dist/interfaces/account-setting.d.ts +8 -0
  39. package/dist/interfaces/account-setting.js +1 -0
  40. package/dist/interfaces/account.d.ts +29 -0
  41. package/dist/interfaces/account.js +1 -0
  42. package/dist/interfaces/address.d.ts +70 -0
  43. package/dist/interfaces/address.js +1 -0
  44. package/dist/interfaces/calendar-collection.d.ts +38 -0
  45. package/dist/interfaces/calendar-collection.js +1 -0
  46. package/dist/interfaces/calendar-event-index.d.ts +19 -0
  47. package/dist/interfaces/calendar-event-index.js +1 -0
  48. package/dist/interfaces/calendar-feed-token.d.ts +31 -0
  49. package/dist/interfaces/calendar-feed-token.js +1 -0
  50. package/dist/interfaces/calendar-object.d.ts +36 -0
  51. package/dist/interfaces/calendar-object.js +1 -0
  52. package/dist/interfaces/calendar-store.d.ts +93 -0
  53. package/dist/interfaces/calendar-store.js +1 -0
  54. package/dist/interfaces/calendar-suggestion.d.ts +62 -0
  55. package/dist/interfaces/calendar-suggestion.js +1 -0
  56. package/dist/interfaces/config-import.d.ts +8 -0
  57. package/dist/interfaces/config-import.js +1 -0
  58. package/dist/interfaces/envelope.d.ts +24 -0
  59. package/dist/interfaces/envelope.js +1 -0
  60. package/dist/interfaces/filter.d.ts +28 -0
  61. package/dist/interfaces/filter.js +1 -0
  62. package/dist/interfaces/label.d.ts +17 -0
  63. package/dist/interfaces/label.js +1 -0
  64. package/dist/interfaces/mailbox-lock.d.ts +12 -0
  65. package/dist/interfaces/mailbox-lock.js +1 -0
  66. package/dist/interfaces/mailbox-special-use.d.ts +54 -0
  67. package/dist/interfaces/mailbox-special-use.js +1 -0
  68. package/dist/interfaces/mailbox.d.ts +79 -0
  69. package/dist/interfaces/mailbox.js +1 -0
  70. package/dist/interfaces/message-flag-push.d.ts +9 -0
  71. package/dist/interfaces/message-flag-push.js +1 -0
  72. package/dist/interfaces/message-flag.d.ts +14 -0
  73. package/dist/interfaces/message-flag.js +1 -0
  74. package/dist/interfaces/message-label.d.ts +21 -0
  75. package/dist/interfaces/message-label.js +1 -0
  76. package/dist/interfaces/message-placement-move.d.ts +8 -0
  77. package/dist/interfaces/message-placement-move.js +1 -0
  78. package/dist/interfaces/message.d.ts +60 -0
  79. package/dist/interfaces/message.js +1 -0
  80. package/dist/interfaces/organize-job-request.d.ts +10 -0
  81. package/dist/interfaces/organize-job-request.js +1 -0
  82. package/dist/interfaces/outbox-attachment.d.ts +101 -0
  83. package/dist/interfaces/outbox-attachment.js +7 -0
  84. package/dist/interfaces/outbox-message.d.ts +70 -0
  85. package/dist/interfaces/outbox-message.js +20 -0
  86. package/dist/interfaces/quarantine.d.ts +20 -0
  87. package/dist/interfaces/quarantine.js +1 -0
  88. package/dist/interfaces/sender-signer-standing.d.ts +26 -0
  89. package/dist/interfaces/sender-signer-standing.js +1 -0
  90. package/dist/interfaces/sync-warning.d.ts +11 -0
  91. package/dist/interfaces/sync-warning.js +1 -0
  92. package/dist/interfaces/thread-message.d.ts +202 -0
  93. package/dist/interfaces/thread-message.js +1 -0
  94. package/dist/mailbox-name.d.ts +35 -0
  95. package/dist/mailbox-name.js +68 -0
  96. package/dist/message-parts.d.ts +22 -0
  97. package/dist/message-parts.js +18 -0
  98. package/dist/message-settlement.d.ts +35 -0
  99. package/{src/message-settlement.ts → dist/message-settlement.js} +5 -19
  100. package/dist/mutation-events.d.ts +19 -0
  101. package/{src/mutation-events.ts → dist/mutation-events.js} +2 -5
  102. package/dist/sender-mute.d.ts +26 -0
  103. package/{src/sender-mute.ts → dist/sender-mute.js} +12 -34
  104. package/dist/sync-warning-state.d.ts +3 -0
  105. package/dist/sync-warning-state.js +5 -0
  106. package/dist/types.d.ts +491 -0
  107. package/dist/types.js +1 -0
  108. package/dist/update-manifest.d.ts +24 -0
  109. package/dist/update-manifest.js +20 -0
  110. package/dist/virtual-copy.d.ts +8 -0
  111. package/{src/virtual-copy.ts → dist/virtual-copy.js} +10 -15
  112. package/dist/wellknown.d.ts +47 -0
  113. package/{src/wellknown.ts → dist/wellknown.js} +26 -49
  114. package/package.json +44 -79
  115. package/src/account-settings.ts +0 -194
  116. package/src/conformance/account.ts +0 -104
  117. package/src/conformance/calendar-collection.ts +0 -342
  118. package/src/conformance/calendar-event-index.ts +0 -203
  119. package/src/conformance/calendar-feed-token.ts +0 -148
  120. package/src/conformance/calendar-object.ts +0 -269
  121. package/src/conformance/calendar-suggestion.ts +0 -490
  122. package/src/conformance/label.ts +0 -136
  123. package/src/conformance/sender-signer-standing.ts +0 -117
  124. package/src/display-name.test.ts +0 -101
  125. package/src/display-name.ts +0 -40
  126. package/src/errors.ts +0 -244
  127. package/src/folder-role.test.ts +0 -422
  128. package/src/folder-role.ts +0 -447
  129. package/src/id.test.ts +0 -352
  130. package/src/index.ts +0 -170
  131. package/src/interfaces/account-config.ts +0 -25
  132. package/src/interfaces/account-export-request.ts +0 -21
  133. package/src/interfaces/account-setting.ts +0 -14
  134. package/src/interfaces/account.ts +0 -43
  135. package/src/interfaces/address.ts +0 -122
  136. package/src/interfaces/calendar-collection.ts +0 -60
  137. package/src/interfaces/calendar-event-index.ts +0 -34
  138. package/src/interfaces/calendar-feed-token.ts +0 -38
  139. package/src/interfaces/calendar-object.ts +0 -58
  140. package/src/interfaces/calendar-suggestion.ts +0 -93
  141. package/src/interfaces/calendar-unit-of-work.ts +0 -47
  142. package/src/interfaces/config-import.ts +0 -16
  143. package/src/interfaces/envelope.ts +0 -32
  144. package/src/interfaces/filter-anchor-transaction.ts +0 -23
  145. package/src/interfaces/filter-anchor.ts +0 -11
  146. package/src/interfaces/filter.ts +0 -41
  147. package/src/interfaces/label.ts +0 -30
  148. package/src/interfaces/mailbox-lock.ts +0 -32
  149. package/src/interfaces/mailbox-special-use.ts +0 -60
  150. package/src/interfaces/mailbox.ts +0 -115
  151. package/src/interfaces/message-flag-push.ts +0 -17
  152. package/src/interfaces/message-flag.ts +0 -15
  153. package/src/interfaces/message-label.ts +0 -25
  154. package/src/interfaces/message-placement-move.ts +0 -15
  155. package/src/interfaces/message.ts +0 -65
  156. package/src/interfaces/organize-job-request.ts +0 -19
  157. package/src/interfaces/outbox-attachment.ts +0 -132
  158. package/src/interfaces/outbox-message.ts +0 -106
  159. package/src/interfaces/quarantine.ts +0 -22
  160. package/src/interfaces/sender-signer-standing.ts +0 -37
  161. package/src/interfaces/thread-message.ts +0 -264
  162. package/src/interfaces/unit-of-work.ts +0 -28
  163. package/src/mailbox-name.test.ts +0 -106
  164. package/src/mailbox-name.ts +0 -90
  165. package/src/mailbox-state-doors.test.ts +0 -104
  166. package/src/message-placement-doors.test.ts +0 -100
  167. package/src/message-settlement.test.ts +0 -132
  168. package/src/sender-mute.test.ts +0 -76
  169. package/src/types.ts +0 -820
  170. package/src/update-manifest.test.ts +0 -130
  171. package/src/update-manifest.ts +0 -22
  172. package/src/virtual-copy.test.ts +0 -34
  173. package/tsconfig.json +0 -8
  174. /package/{src/conformance/index.ts → dist/conformance/index.d.ts} +0 -0
package/src/types.ts DELETED
@@ -1,820 +0,0 @@
1
- import type {
2
- AccountConfigSchema,
3
- AccountSchema,
4
- AddressSchema,
5
- BodyPartContentSchema,
6
- BodyPartParameterSchema,
7
- BodyPartSchema,
8
- BodyPartStorageSchema,
9
- CalendarCollectionSchema,
10
- CalendarEventIndexSchema,
11
- CalendarFeedTokenSchema,
12
- CalendarObjectSchema,
13
- CalendarSuggestionSchema,
14
- ConfigImportSchema,
15
- ConfigImportUnresolvedRefSchema,
16
- EnvelopeAddressSchema,
17
- EnvelopeSchema,
18
- FilterAnchorSchema,
19
- FilterSchema,
20
- LabelSchema,
21
- MailboxLockSchema,
22
- MailboxSchema,
23
- MailboxSpecialUseEntrySchema,
24
- MailboxSpecialUseSchema,
25
- MessageFlagPushSchema,
26
- MessageFlagSchema,
27
- MessageLabelSchema,
28
- MessagePlacementMoveSchema,
29
- MessageSchema,
30
- OrganizeJobRequestSchema,
31
- OutboxAttachmentSchema,
32
- OutboxMessageSchema,
33
- QuarantineSchema,
34
- RawMessageStorageSchema,
35
- SenderSignerStandingSchema,
36
- ThreadMessageSchema,
37
- } from "@remit/api-zod-schemas";
38
- import type { z } from "zod";
39
-
40
- export type ResultList<T> = {
41
- items: T[];
42
- continuationToken: string | undefined;
43
- };
44
-
45
- /**
46
- * Page shape for internal, non-API-facing pagination (e.g. the scheduled-sync
47
- * tick paging through every account). `cursor` is a raw backend-native token —
48
- * unlike `ResultList.continuationToken` it carries no salt/tamper check, since
49
- * it never crosses a trust boundary. `null` means no further pages.
50
- */
51
- export type AccountSchedulerPage = {
52
- items: AccountItem[];
53
- cursor: string | null;
54
- };
55
-
56
- export type ListOptions = {
57
- limit?: number;
58
- continuationToken?: string;
59
- };
60
-
61
- export type AccountItem = z.infer<typeof AccountSchema>;
62
- export type AccountConfigItem = z.infer<typeof AccountConfigSchema>;
63
- export type MailboxItem = z.infer<typeof MailboxSchema>;
64
- export type ThreadMessageItem = z.infer<typeof ThreadMessageSchema>;
65
- export type OutboxMessageItem = z.infer<typeof OutboxMessageSchema>;
66
- export type OutboxAttachmentItem = z.infer<typeof OutboxAttachmentSchema>;
67
- export type MessageItem = z.infer<typeof MessageSchema>;
68
- export type MessageFlagItem = z.infer<typeof MessageFlagSchema>;
69
- export type BodyPartItem = z.infer<typeof BodyPartSchema>;
70
- export type MessageReferenceItem = {
71
- messageReferenceId: string;
72
- messageId: string;
73
- envelopeId: string;
74
- messageIdValue: string;
75
- referenceType: string;
76
- referenceOrder: number;
77
- createdAt: number;
78
- updatedAt: number;
79
- };
80
- export type EnvelopeAddressItem = z.infer<typeof EnvelopeAddressSchema>;
81
- export type BodyPartParameterItem = z.infer<typeof BodyPartParameterSchema>;
82
- export type RawMessageStorageItem = z.infer<typeof RawMessageStorageSchema>;
83
- export type BodyPartStorageItem = z.infer<typeof BodyPartStorageSchema>;
84
- export type BodyPartContentItem = z.infer<typeof BodyPartContentSchema>;
85
- export type EnvelopeItem = z.infer<typeof EnvelopeSchema>;
86
- export type MailboxLockItem = z.infer<typeof MailboxLockSchema>;
87
- export type MailboxSpecialUseItem = z.infer<
88
- typeof MailboxSpecialUseEntrySchema
89
- >;
90
- export type AddressItem = z.infer<typeof AddressSchema>;
91
- export type LabelItem = z.infer<typeof LabelSchema>;
92
- export type MessageLabelItem = z.infer<typeof MessageLabelSchema>;
93
- export type FilterItem = z.infer<typeof FilterSchema>;
94
- export type FilterAnchorItem = z.infer<typeof FilterAnchorSchema>;
95
- export type MessagePlacementMoveItem = z.infer<
96
- typeof MessagePlacementMoveSchema
97
- >;
98
- export type MessageFlagPushItem = z.infer<typeof MessageFlagPushSchema>;
99
- export type QuarantineItem = z.infer<typeof QuarantineSchema>;
100
- export type QuarantineMimeNodeItem = QuarantineItem["structure"][number];
101
-
102
- /**
103
- * What a caller supplies to quarantine a message.
104
- *
105
- * `quarantineId` is absent on purpose. The column carries a random-id default
106
- * (the house pattern for every entity here), so an input that merely allowed
107
- * the id would let a writer omit it, take a fresh random one on every retry,
108
- * and turn the idempotent write this record depends on into an accumulating
109
- * pile of rows that the derived-id lookup never finds. The repository derives
110
- * it from the four fields that name the message, which are all required here.
111
- */
112
- export type QuarantineUpsertInput = Omit<
113
- QuarantineItem,
114
- "quarantineId" | "createdAt" | "updatedAt" | "structure"
115
- > & { structure?: QuarantineMimeNodeItem[] };
116
-
117
- export type MailboxSpecialUseValue = z.infer<typeof MailboxSpecialUseSchema>;
118
-
119
- export type AccountSettingValue =
120
- | { kind: "Boolean"; value: boolean }
121
- | { kind: "String"; value: string }
122
- | { kind: "Number"; value: number }
123
- | { kind: "StringList"; value: string[] }
124
- | { kind: "Map"; value: Record<string, string> }
125
- | {
126
- kind: "MutedFlag";
127
- value: {
128
- value: boolean;
129
- setAt: number;
130
- setBy?: string;
131
- expiresAt?: number;
132
- reason?: string;
133
- };
134
- };
135
-
136
- export type AccountSettingItem = {
137
- accountSettingId: string;
138
- accountConfigId: string;
139
- name: string;
140
- value: AccountSettingValue;
141
- createdAt: number;
142
- updatedAt: number;
143
- };
144
-
145
- export type AccountExportRequestItem = {
146
- accountExportRequestId: string;
147
- accountConfigId: string;
148
- userId: string;
149
- state: "Failed" | "Pending" | "Processing" | "Ready";
150
- createdAt: number;
151
- updatedAt: number;
152
- expiresAt?: number;
153
- objectKey?: string;
154
- downloadUrl?: string;
155
- errorMessage?: string;
156
- };
157
-
158
- export type AccountDescription = {
159
- account: AccountItem[];
160
- mailbox: MailboxItem[];
161
- };
162
-
163
- export type AccountConfigDescription = {
164
- accountConfig: AccountConfigItem[];
165
- account: AccountItem[];
166
- address: AddressItem[];
167
- };
168
-
169
- export type MessageData = {
170
- envelope: EnvelopeItem[];
171
- messageReference: MessageReferenceItem[];
172
- envelopeAddress: EnvelopeAddressItem[];
173
- bodyPart: BodyPartItem[];
174
- bodyPartParameter: BodyPartParameterItem[];
175
- rawMessageStorage: RawMessageStorageItem[];
176
- bodyPartStorage: BodyPartStorageItem[];
177
- bodyPartContent: BodyPartContentItem[];
178
- };
179
-
180
- export type MessageDescription = {
181
- message: MessageItem[];
182
- messageFlag: MessageFlagItem[];
183
- envelope: EnvelopeItem[];
184
- messageReference: MessageReferenceItem[];
185
- envelopeAddress: EnvelopeAddressItem[];
186
- bodyPart: BodyPartItem[];
187
- bodyPartParameter: BodyPartParameterItem[];
188
- rawMessageStorage: RawMessageStorageItem[];
189
- bodyPartStorage: BodyPartStorageItem[];
190
- bodyPartContent: BodyPartContentItem[];
191
- };
192
-
193
- export type WithMailboxLockResult<T> = {
194
- executed: boolean;
195
- result?: T;
196
- };
197
-
198
- export type CreateAccountInput = Omit<
199
- AccountItem,
200
- | "accountId"
201
- | "createdAt"
202
- | "updatedAt"
203
- | "authType"
204
- | "smtpEnabled"
205
- | "smtpHost"
206
- | "smtpPort"
207
- | "smtpTls"
208
- | "smtpStartTls"
209
- | "smtpUsername"
210
- | "syncedServices"
211
- | "grantedScopes"
212
- > & {
213
- accountId?: string;
214
- authType?: AccountItem["authType"];
215
- syncedServices?: AccountItem["syncedServices"];
216
- grantedScopes?: AccountItem["grantedScopes"];
217
- smtpEnabled?: AccountItem["smtpEnabled"];
218
- smtpHost?: AccountItem["smtpHost"];
219
- smtpPort?: AccountItem["smtpPort"];
220
- smtpTls?: AccountItem["smtpTls"];
221
- smtpStartTls?: AccountItem["smtpStartTls"];
222
- smtpUsername?: AccountItem["smtpUsername"];
223
- };
224
-
225
- export type UpdateAccountInput = Partial<
226
- Omit<CreateAccountInput, "accountConfigId">
227
- >;
228
-
229
- export type CreateAccountConfigInput = Omit<
230
- AccountConfigItem,
231
- "accountConfigId" | "createdAt" | "updatedAt" | "state"
232
- > & { accountConfigId?: string; state?: AccountConfigItem["state"] };
233
-
234
- export type UpdateAccountConfigInput = Partial<
235
- Omit<CreateAccountConfigInput, "userId">
236
- >;
237
-
238
- export type CreateAccountExportRequestInput = Omit<
239
- AccountExportRequestItem,
240
- "accountExportRequestId" | "createdAt" | "updatedAt"
241
- >;
242
-
243
- export type UpdateAccountExportRequestInput = Partial<
244
- Pick<AccountExportRequestItem, "state" | "expiresAt" | "errorMessage"> & {
245
- objectKey?: string;
246
- }
247
- >;
248
-
249
- export type OrganizeJobRequestItem = z.infer<typeof OrganizeJobRequestSchema>;
250
-
251
- export type CreateOrganizeJobRequestInput = Omit<
252
- OrganizeJobRequestItem,
253
- | "organizeJobId"
254
- | "createdAt"
255
- | "updatedAt"
256
- | "state"
257
- | "matchedCount"
258
- | "appliedCount"
259
- | "failedCount"
260
- | "errorMessage"
261
- > & { state?: OrganizeJobRequestItem["state"] };
262
-
263
- export type UpdateOrganizeJobRequestInput = Partial<
264
- Pick<
265
- OrganizeJobRequestItem,
266
- "state" | "matchedCount" | "appliedCount" | "failedCount" | "errorMessage"
267
- >
268
- >;
269
-
270
- export type ConfigImportItem = z.infer<typeof ConfigImportSchema>;
271
- export type ConfigImportUnresolvedRefItem = z.infer<
272
- typeof ConfigImportUnresolvedRefSchema
273
- >;
274
-
275
- export type CreateConfigImportInput = Omit<
276
- ConfigImportItem,
277
- "importId" | "createdAt" | "updatedAt" | "state" | "completedAt"
278
- > & {
279
- state?: ConfigImportItem["state"];
280
- completedAt?: ConfigImportItem["completedAt"];
281
- };
282
-
283
- export type UpdateConfigImportInput = Partial<
284
- Pick<ConfigImportItem, "state" | "unresolvedRefs" | "completedAt">
285
- >;
286
-
287
- export type UpsertAccountSettingInput = {
288
- accountConfigId: string;
289
- name: string;
290
- value: AccountSettingValue;
291
- };
292
-
293
- export type AddressFlags = NonNullable<AddressItem["flags"]>;
294
- export type FlagsMergePatch = {
295
- [K in keyof AddressFlags]?: AddressFlags[K] | null;
296
- };
297
-
298
- export type CreateAddressInput = Omit<
299
- AddressItem,
300
- | "addressId"
301
- | "createdAt"
302
- | "updatedAt"
303
- | "flags"
304
- | "inboundCount"
305
- | "outboundCount"
306
- | "replyCount"
307
- | "lastInboundAt"
308
- | "lastReplyAt"
309
- > & {
310
- addressId: string;
311
- flags?: AddressFlags;
312
- inboundCount?: AddressItem["inboundCount"];
313
- outboundCount?: AddressItem["outboundCount"];
314
- replyCount?: AddressItem["replyCount"];
315
- lastInboundAt?: AddressItem["lastInboundAt"];
316
- lastReplyAt?: AddressItem["lastReplyAt"];
317
- };
318
-
319
- export type UpdateAddressInput = Partial<
320
- Omit<CreateAddressInput, "accountConfigId">
321
- >;
322
-
323
- export type CreateEnvelopeAddressInput = Omit<
324
- EnvelopeAddressItem,
325
- "envelopeAddressId" | "createdAt" | "updatedAt"
326
- >;
327
-
328
- export type CreateEnvelopeInput = Omit<
329
- EnvelopeItem,
330
- "envelopeId" | "createdAt" | "updatedAt"
331
- > & { envelopeId: string };
332
-
333
- export type UpdateEnvelopeInput = Partial<
334
- Omit<CreateEnvelopeInput, "messageId">
335
- >;
336
-
337
- export type BodyPartParameterUpsertInput = {
338
- parameterName: string;
339
- parameterValue: string;
340
- };
341
-
342
- export type BodyPartUpsertInput = {
343
- partPath: string;
344
- parentPartPath: string | null;
345
- mediaType: BodyPartItem["mediaType"];
346
- mediaSubtype: string;
347
- contentId?: string;
348
- contentDescription?: string;
349
- transferEncoding: BodyPartItem["transferEncoding"];
350
- sizeOctets: number;
351
- lineCount?: number;
352
- md5Hash?: string;
353
- disposition?: BodyPartItem["disposition"];
354
- dispositionFilename?: string;
355
- language?: string;
356
- location?: string;
357
- isMultipart: boolean;
358
- multipartSubtype?: BodyPartItem["multipartSubtype"];
359
- parameters: BodyPartParameterUpsertInput[];
360
- };
361
-
362
- export type BodyPartContentUpsertInput = {
363
- bodyPartId: string;
364
- content: string;
365
- };
366
-
367
- /**
368
- * A mailbox row as an insert states it. `pendingPath` is absent: a create
369
- * records no rename target (folder-rename-and-delete.md T1), and the transition
370
- * is the only writer of it.
371
- */
372
- export type CreateMailboxInput = Omit<
373
- MailboxItem,
374
- | "mailboxId"
375
- | "createdAt"
376
- | "updatedAt"
377
- | "namespaceType"
378
- | "parentMailboxId"
379
- | "cursorState"
380
- | "syncStatus"
381
- | "pendingPath"
382
- | "syncFailureReason"
383
- > & {
384
- namespaceType?: MailboxItem["namespaceType"];
385
- parentMailboxId?: MailboxItem["parentMailboxId"];
386
- /** Total per RFC 032 (defaults to `normal`) — optional at the input boundary, callers rarely set it explicitly. */
387
- cursorState?: MailboxItem["cursorState"];
388
- /** Total per D1 (defaults to `synced`) — the insert paths that record an intent say so; the sweep's discovery insert does not have to. */
389
- syncStatus?: MailboxItem["syncStatus"];
390
- };
391
-
392
- export type CreateMailboxResult =
393
- | { outcome: "Created"; mailbox: MailboxItem }
394
- | { outcome: "PathTaken" };
395
-
396
- /**
397
- * Everything about a mailbox that is not its mutation state.
398
- *
399
- * `syncStatus` and `pendingPath` are omitted rather than merely discouraged
400
- * (docs/architecture/folder-rename-and-delete.md D3): where they are gone from
401
- * the only general-purpose writer, a folder state written without a predicate
402
- * is a type error rather than a convention someone has to remember. The two
403
- * doors are `transition` and `transitionSubtree`, and they are the whole set.
404
- */
405
- export type UpdateMailboxInput = Partial<
406
- Omit<CreateMailboxInput, "accountId" | "syncStatus">
407
- >;
408
-
409
- /**
410
- * The state a mailbox transition expects to find, as the six states this design
411
- * defines rather than as the four enum values
412
- * (docs/architecture/folder-rename-and-delete.md D3). `from` becomes an
413
- * `IN (…)` term; `wherePendingPath` becomes an equality or an `IS NULL` term,
414
- * and is omitted only by a caller that genuinely does not care which of the two
415
- * states sharing a `syncStatus` it is looking at.
416
- */
417
- export type MailboxStatePredicate = {
418
- from: readonly MailboxItem["syncStatus"][];
419
- wherePendingPath?: string | null;
420
- };
421
-
422
- /**
423
- * What a winning mailbox transition writes. `pendingPath` takes `null` to
424
- * clear, and is only honoured at all when the state being written is one that
425
- * may carry a rename target — a transition to `synced` or `deleting` drops it
426
- * whatever the caller passes, which is what makes the invariant hold by
427
- * construction rather than by convention.
428
- */
429
- export type MailboxTransitionWrite = {
430
- fullPath?: string;
431
- pendingPath?: string | null;
432
- syncFailureReason?: string;
433
- };
434
-
435
- export type MailboxTransitionIntent = MailboxStatePredicate & {
436
- to: MailboxItem["syncStatus"];
437
- set?: MailboxTransitionWrite;
438
- };
439
-
440
- /**
441
- * A subtree intent recorded all-or-nothing (D6). It carries no
442
- * `wherePendingPath`: its accepted from-states are `synced` and the two failed
443
- * variants, and both failed variants are legal starting points.
444
- */
445
- export type MailboxSubtreeTransitionIntent = {
446
- from: readonly MailboxItem["syncStatus"][];
447
- to: MailboxItem["syncStatus"];
448
- rowSet: (row: MailboxItem) => MailboxTransitionWrite;
449
- };
450
-
451
- export type CreateMessageInput = Omit<
452
- MessageItem,
453
- | "messageId"
454
- | "createdAt"
455
- | "updatedAt"
456
- | "status"
457
- | "syncStatus"
458
- | "abandonedMutation"
459
- | "category"
460
- | "classificationState"
461
- | "authenticityVerdict"
462
- | "hasListUnsubscribe"
463
- | "movedByRemit"
464
- > & {
465
- messageId: string;
466
- status?: MessageItem["status"];
467
- syncStatus?: MessageItem["syncStatus"];
468
- abandonedMutation?: MessageItem["abandonedMutation"];
469
- category?: MessageItem["category"];
470
- classificationState?: MessageItem["classificationState"];
471
- authenticityVerdict?: MessageItem["authenticityVerdict"];
472
- hasListUnsubscribe?: MessageItem["hasListUnsubscribe"];
473
- movedByRemit?: MessageItem["movedByRemit"];
474
- };
475
-
476
- /**
477
- * Everything about a message that is not its placement.
478
- *
479
- * The six placement fields are omitted rather than merely discouraged
480
- * (docs/architecture/imap-mutations.md R3): where they are gone from the only
481
- * general-purpose writer, a placement written without a predicate is a type
482
- * error rather than a convention someone has to remember. `transitionPlacement`
483
- * and the settle in `updateUid` are the two doors, and they are the whole set.
484
- */
485
- export type UpdateMessageInput = Partial<
486
- Omit<
487
- CreateMessageInput,
488
- | "mailboxId"
489
- | "uid"
490
- | "status"
491
- | "syncStatus"
492
- | "abandonedMutation"
493
- | "originalMailboxId"
494
- | "originalUid"
495
- >
496
- >;
497
-
498
- /**
499
- * The placement a transition expects to find, as the caller read it
500
- * (docs/architecture/imap-mutations.md R3). Every field named here becomes a
501
- * term of the UPDATE's WHERE clause; what the caller did not read, it does not
502
- * supply. `syncStatus` takes a set because several of the six placement states
503
- * share one `status`.
504
- */
505
- export type PlacementPredicate = {
506
- status?: MessageItem["status"] | readonly MessageItem["status"][];
507
- syncStatus?: MessageItem["syncStatus"] | readonly MessageItem["syncStatus"][];
508
- mailboxId?: string;
509
- uid?: number;
510
- };
511
-
512
- /**
513
- * What a winning transition writes. `originalMailboxId` and `originalUid` take
514
- * `null` to clear, which is how a settle spells a dropped pre-move pair.
515
- */
516
- export type PlacementTransitionInput = {
517
- status?: MessageItem["status"];
518
- syncStatus?: MessageItem["syncStatus"];
519
- abandonedMutation?: MessageItem["abandonedMutation"];
520
- mailboxId?: string;
521
- uid?: number;
522
- originalMailboxId?: string | null;
523
- originalUid?: number | null;
524
- };
525
-
526
- export type MessageIdSource = {
527
- messageId?: string;
528
- uid: number;
529
- mailboxId: string;
530
- date?: string;
531
- subject?: string;
532
- fromMailbox?: string;
533
- fromHost?: string;
534
- };
535
-
536
- export type CreateMessageFlagInput = Omit<
537
- MessageFlagItem,
538
- "messageFlagId" | "createdAt" | "updatedAt"
539
- >;
540
-
541
- export type PutMessagePlacementMoveInput = Omit<
542
- MessagePlacementMoveItem,
543
- "state" | "createdAt" | "updatedAt"
544
- >;
545
-
546
- export type PutMessageFlagPushInput = Omit<
547
- MessageFlagPushItem,
548
- "state" | "createdAt" | "updatedAt"
549
- >;
550
-
551
- export type CreateOutboxMessageInput = Omit<
552
- OutboxMessageItem,
553
- | "outboxMessageId"
554
- | "createdAt"
555
- | "updatedAt"
556
- | "ccAddresses"
557
- | "bccAddresses"
558
- | "references"
559
- | "appendedUid"
560
- > & {
561
- ccAddresses?: string[];
562
- bccAddresses?: string[];
563
- references?: string[];
564
- };
565
-
566
- export type UpdateOutboxMessageInput = Partial<
567
- Pick<
568
- OutboxMessageItem,
569
- | "status"
570
- | "lastError"
571
- | "lastSmtpCode"
572
- | "sentAt"
573
- | "smtpMessageId"
574
- | "appendedUid"
575
- | "toAddresses"
576
- | "ccAddresses"
577
- | "bccAddresses"
578
- | "subject"
579
- | "textBody"
580
- | "htmlBody"
581
- | "inReplyTo"
582
- | "references"
583
- >
584
- >;
585
-
586
- export type CreateThreadMessageInput = Omit<
587
- ThreadMessageItem,
588
- "threadMessageId" | "createdAt" | "updatedAt" | "star" | "category"
589
- > & {
590
- star?: ThreadMessageItem["star"];
591
- category?: ThreadMessageItem["category"];
592
- };
593
-
594
- export type UpdateThreadMessageInput = Partial<
595
- Omit<CreateThreadMessageInput, "accountConfigId" | "threadId" | "messageId">
596
- >;
597
-
598
- /**
599
- * One substring criterion over a text column of a ThreadMessage row, named by
600
- * the column it selects on rather than by whatever rule derived it. `sender`
601
- * covers the From address and display name together, the same pair
602
- * `SearchOptions.from` reads.
603
- *
604
- * Matching is accent- and case-insensitive substring, identical to the search
605
- * predicates, so a term is a NARROWING a caller refines further in memory. It
606
- * may return more than the criterion it stands for and never less — a term an
607
- * implementation cannot evaluate faithfully is dropped, not approximated.
608
- */
609
- export type ThreadMessageFieldTerm = {
610
- field: "sender" | "subject" | "listId";
611
- contains: string;
612
- };
613
-
614
- export type SearchOptions = {
615
- query?: string;
616
- subject?: string;
617
- from?: string;
618
- unread?: boolean;
619
- starred?: boolean;
620
- attachments?: boolean;
621
- /**
622
- * Whether the From address is muted, as a three-state filter: `false`
623
- * excludes muted senders, `true` keeps only them, absent filters nothing.
624
- *
625
- * The one criterion here that is not a column on the ThreadMessage row —
626
- * muting is a flag on the Address, reached through the row's `fromEmail` —
627
- * and it is a predicate rather than a pass over a page for the same reason
628
- * every other criterion is: a caller that hides muted mail while counting
629
- * with it in states a number larger than the list it renders (#1137).
630
- */
631
- muted?: boolean;
632
- /**
633
- * Any-of set over the denormalized `category` column on the ThreadMessage
634
- * row. An empty or absent set means no category filter. `uncategorized` is
635
- * a member like any other — the column is NOT NULL with that default, so it
636
- * names "no category" rather than standing for absence (issue #45). It
637
- * matches mail the classifier has not reached and mail it declined to
638
- * categorize alike; `Message.classificationState` is what separates those,
639
- * and no read path filters on it (issue #331).
640
- */
641
- category?: ThreadMessageItem["category"][];
642
- };
643
-
644
- export type CreateLabelInput = Omit<
645
- LabelItem,
646
- "labelId" | "normalizedName" | "createdAt" | "updatedAt" | "color"
647
- > & { color?: LabelItem["color"] };
648
-
649
- export type UpdateLabelInput = Partial<
650
- Pick<LabelItem, "name" | "normalizedName" | "color">
651
- >;
652
-
653
- export type CreateMessageLabelInput = Omit<
654
- MessageLabelItem,
655
- "messageLabelId" | "createdAt" | "updatedAt" | "appliedByFilterId"
656
- > & { appliedByFilterId?: MessageLabelItem["appliedByFilterId"] };
657
-
658
- export type CreateFilterInput = Omit<
659
- FilterItem,
660
- | "filterId"
661
- | "createdAt"
662
- | "updatedAt"
663
- | "state"
664
- | "disabledReason"
665
- | "hasAnchor"
666
- | "ruleChangedAt"
667
- | "actionChangedAt"
668
- | "matchOperator"
669
- | "literalClauses"
670
- | "actionLabelId"
671
- | "actionMailboxId"
672
- > & {
673
- state?: FilterItem["state"];
674
- disabledReason?: FilterItem["disabledReason"];
675
- hasAnchor?: FilterItem["hasAnchor"];
676
- matchOperator?: FilterItem["matchOperator"];
677
- literalClauses?: FilterItem["literalClauses"];
678
- actionLabelId?: FilterItem["actionLabelId"];
679
- actionMailboxId?: FilterItem["actionMailboxId"];
680
- };
681
-
682
- // ruleChangedAt is never client-supplied: FilterService derives it, bumping
683
- // only when the predicate, the action, scope, or expiresAt is present in the
684
- // update (RFC 034 Decision 3.2, reader #266) — a cosmetic `name` rename must
685
- // not move it. actionChangedAt is likewise server-derived, bumping only for
686
- // the narrower predicate/action subset (reader #384) that selectMoveWinner
687
- // reads for exclusive-move precedence. `scope` is updatable here (reader
688
- // #266): the handler resolves the merged scope/expiresAt/ttl/state before
689
- // calling through to the repo, so this type must carry `scope` as a valid
690
- // key, unlike the API-facing `UpdateFilterInput` for that same reason.
691
- export type UpdateFilterInput = Partial<
692
- Omit<CreateFilterInput, "accountConfigId">
693
- >;
694
-
695
- export type CreateFilterAnchorInput = Omit<
696
- FilterAnchorItem,
697
- "createdAt" | "updatedAt"
698
- >;
699
-
700
- export type CalendarCollectionItem = z.infer<typeof CalendarCollectionSchema>;
701
- export type CalendarObjectItem = z.infer<typeof CalendarObjectSchema>;
702
- export type CalendarEventIndexItem = z.infer<typeof CalendarEventIndexSchema>;
703
-
704
- // `calendarId` is derived from accountConfigId + urlSegment, and syncSequence
705
- // starts at zero and only ever moves through the collection's own bump — so
706
- // neither is ever supplied here. The fetch bookkeeping starts empty and only
707
- // moves through an update after a fetch.
708
- export type CreateCalendarCollectionInput = Omit<
709
- CalendarCollectionItem,
710
- | "calendarId"
711
- | "syncSequence"
712
- | "createdAt"
713
- | "updatedAt"
714
- | "color"
715
- | "componentSet"
716
- | "source"
717
- | "timezone"
718
- | "subscriptionUrl"
719
- | "subscriptionEnabled"
720
- | "subscriptionCheckedAt"
721
- | "subscriptionFetchedAt"
722
- | "subscriptionError"
723
- > & {
724
- color?: CalendarCollectionItem["color"];
725
- componentSet?: CalendarCollectionItem["componentSet"];
726
- source?: CalendarCollectionItem["source"];
727
- timezone?: CalendarCollectionItem["timezone"];
728
- subscriptionUrl?: CalendarCollectionItem["subscriptionUrl"];
729
- subscriptionEnabled?: CalendarCollectionItem["subscriptionEnabled"];
730
- };
731
-
732
- export type UpdateCalendarCollectionInput = Partial<
733
- Pick<
734
- CalendarCollectionItem,
735
- | "displayName"
736
- | "color"
737
- | "timezone"
738
- | "subscriptionEnabled"
739
- | "subscriptionCheckedAt"
740
- | "subscriptionFetchedAt"
741
- | "subscriptionError"
742
- >
743
- >;
744
-
745
- export type CalendarFeedTokenItem = z.infer<typeof CalendarFeedTokenSchema>;
746
-
747
- // `feedTokenId` is derived from `calendarId`, which is what makes one active
748
- // token per calendar structural rather than enforced. `rotatedAt` is the
749
- // repository's to stamp: only it can tell a mint from a replacement.
750
- export type PutCalendarFeedTokenInput = Omit<
751
- CalendarFeedTokenItem,
752
- "feedTokenId" | "rotatedAt" | "createdAt" | "updatedAt"
753
- >;
754
-
755
- /**
756
- * A whole calendar resource. Every projected column is supplied together with
757
- * the `icalData` it was projected from — the repository never derives one from
758
- * the other, so the projection can only ever be produced by the one place that
759
- * owns it (`@remit/calendar-service`) and can never drift from the bytes.
760
- *
761
- * `calendarObjectId` is derived from calendarId + resourceName, so this is an
762
- * upsert: writing the same resource twice rewrites its own row.
763
- */
764
- export type PutCalendarObjectInput = Omit<
765
- CalendarObjectItem,
766
- "calendarObjectId" | "createdAt" | "updatedAt"
767
- >;
768
-
769
- /**
770
- * One expanded occurrence. Written only as part of a full replacement of a
771
- * resource's occurrences — there is no single-occurrence write, because a row
772
- * here is never authoritative and never edited in place.
773
- */
774
- export type CalendarOccurrenceInput = Omit<
775
- CalendarEventIndexItem,
776
- "calendarId" | "calendarObjectId" | "createdAt" | "updatedAt"
777
- >;
778
-
779
- export type CalendarSuggestionItem = z.infer<typeof CalendarSuggestionSchema>;
780
-
781
- /**
782
- * A whole suggestion, as the producer read it out of a message. Every field is
783
- * derived from the message — nothing here is client-supplied — and
784
- * `suggestionId` is derived from messageId + bodyPartId + icalUid, so this is
785
- * an upsert: re-reading the same message rewrites its own row rather than
786
- * stacking a second card on the message.
787
- *
788
- * `state` and `acceptedCalendarObjectId` are excluded: a producer only ever
789
- * writes a `Pending` suggestion, and the two fields that record what a person
790
- * decided move exclusively through `settle`, so a re-sync can never walk an
791
- * answered card back to Pending. `supersededByMessageId` moves only through
792
- * `supersedeIfPending`, with the state it explains.
793
- */
794
- export type PutCalendarSuggestionInput = Omit<
795
- CalendarSuggestionItem,
796
- | "suggestionId"
797
- | "state"
798
- | "acceptedCalendarObjectId"
799
- | "supersededByMessageId"
800
- | "createdAt"
801
- | "updatedAt"
802
- >;
803
-
804
- export type SenderSignerStandingItem = z.infer<
805
- typeof SenderSignerStandingSchema
806
- >;
807
-
808
- /**
809
- * One message observed arriving for a `(senderKey, signerDomain)` pair.
810
- *
811
- * `observedAt` is supplied rather than taken from the clock so a caller
812
- * replaying a body-sync batch records the arrival's own time, and so the
813
- * `firstSeenAt`-immutability contract is assertable without sleeping.
814
- */
815
- export type ObserveSenderSignerStandingInput = {
816
- accountConfigId: string;
817
- senderKey: string;
818
- signerDomain: string;
819
- observedAt: number;
820
- };