@remit/drizzle-pg-schema 0.0.2 → 0.0.4

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/dist/schema.d.ts CHANGED
@@ -185,6 +185,422 @@ export declare const accountExportRequests: import("drizzle-orm/pg-core").PgTabl
185
185
  };
186
186
  dialect: "pg";
187
187
  }>;
188
+ export declare const quarantines: import("drizzle-orm/pg-core").PgTableWithColumns<{
189
+ name: "quarantine";
190
+ schema: undefined;
191
+ columns: {
192
+ quarantineId: import("drizzle-orm/pg-core").PgColumn<{
193
+ name: "quarantine_id";
194
+ tableName: "quarantine";
195
+ dataType: "string";
196
+ columnType: "PgText";
197
+ data: string;
198
+ driverParam: string;
199
+ notNull: true;
200
+ hasDefault: true;
201
+ isPrimaryKey: true;
202
+ isAutoincrement: false;
203
+ hasRuntimeDefault: true;
204
+ enumValues: [string, ...string[]];
205
+ baseColumn: never;
206
+ identity: undefined;
207
+ generated: undefined;
208
+ }, {}, {}>;
209
+ accountConfigId: import("drizzle-orm/pg-core").PgColumn<{
210
+ name: "account_config_id";
211
+ tableName: "quarantine";
212
+ dataType: "string";
213
+ columnType: "PgText";
214
+ data: string;
215
+ driverParam: string;
216
+ notNull: true;
217
+ hasDefault: false;
218
+ isPrimaryKey: false;
219
+ isAutoincrement: false;
220
+ hasRuntimeDefault: false;
221
+ enumValues: [string, ...string[]];
222
+ baseColumn: never;
223
+ identity: undefined;
224
+ generated: undefined;
225
+ }, {}, {}>;
226
+ accountId: import("drizzle-orm/pg-core").PgColumn<{
227
+ name: "account_id";
228
+ tableName: "quarantine";
229
+ dataType: "string";
230
+ columnType: "PgText";
231
+ data: string;
232
+ driverParam: string;
233
+ notNull: true;
234
+ hasDefault: false;
235
+ isPrimaryKey: false;
236
+ isAutoincrement: false;
237
+ hasRuntimeDefault: false;
238
+ enumValues: [string, ...string[]];
239
+ baseColumn: never;
240
+ identity: undefined;
241
+ generated: undefined;
242
+ }, {}, {}>;
243
+ mailboxId: import("drizzle-orm/pg-core").PgColumn<{
244
+ name: "mailbox_id";
245
+ tableName: "quarantine";
246
+ dataType: "string";
247
+ columnType: "PgText";
248
+ data: string;
249
+ driverParam: string;
250
+ notNull: true;
251
+ hasDefault: false;
252
+ isPrimaryKey: false;
253
+ isAutoincrement: false;
254
+ hasRuntimeDefault: false;
255
+ enumValues: [string, ...string[]];
256
+ baseColumn: never;
257
+ identity: undefined;
258
+ generated: undefined;
259
+ }, {}, {}>;
260
+ uidValidity: import("drizzle-orm/pg-core").PgColumn<{
261
+ name: "uid_validity";
262
+ tableName: "quarantine";
263
+ dataType: "number";
264
+ columnType: "PgBigInt53";
265
+ data: number;
266
+ driverParam: string | number;
267
+ notNull: true;
268
+ hasDefault: false;
269
+ isPrimaryKey: false;
270
+ isAutoincrement: false;
271
+ hasRuntimeDefault: false;
272
+ enumValues: undefined;
273
+ baseColumn: never;
274
+ identity: undefined;
275
+ generated: undefined;
276
+ }, {}, {}>;
277
+ uid: import("drizzle-orm/pg-core").PgColumn<{
278
+ name: "uid";
279
+ tableName: "quarantine";
280
+ dataType: "number";
281
+ columnType: "PgBigInt53";
282
+ data: number;
283
+ driverParam: string | number;
284
+ notNull: true;
285
+ hasDefault: false;
286
+ isPrimaryKey: false;
287
+ isAutoincrement: false;
288
+ hasRuntimeDefault: false;
289
+ enumValues: undefined;
290
+ baseColumn: never;
291
+ identity: undefined;
292
+ generated: undefined;
293
+ }, {}, {}>;
294
+ mailboxRole: import("drizzle-orm/pg-core").PgColumn<{
295
+ name: "mailbox_role";
296
+ tableName: "quarantine";
297
+ dataType: "string";
298
+ columnType: "PgText";
299
+ data: "Inbox" | "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged";
300
+ driverParam: string;
301
+ notNull: false;
302
+ hasDefault: false;
303
+ isPrimaryKey: false;
304
+ isAutoincrement: false;
305
+ hasRuntimeDefault: false;
306
+ enumValues: [string, ...string[]];
307
+ baseColumn: never;
308
+ identity: undefined;
309
+ generated: undefined;
310
+ }, {}, {
311
+ $type: "Inbox" | "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged";
312
+ }>;
313
+ mailboxPath: import("drizzle-orm/pg-core").PgColumn<{
314
+ name: "mailbox_path";
315
+ tableName: "quarantine";
316
+ dataType: "string";
317
+ columnType: "PgText";
318
+ data: string;
319
+ driverParam: string;
320
+ notNull: true;
321
+ hasDefault: false;
322
+ isPrimaryKey: false;
323
+ isAutoincrement: false;
324
+ hasRuntimeDefault: false;
325
+ enumValues: [string, ...string[]];
326
+ baseColumn: never;
327
+ identity: undefined;
328
+ generated: undefined;
329
+ }, {}, {}>;
330
+ quarantinedAt: import("drizzle-orm/pg-core").PgColumn<{
331
+ name: "quarantined_at";
332
+ tableName: "quarantine";
333
+ dataType: "number";
334
+ columnType: "PgBigInt53";
335
+ data: number;
336
+ driverParam: string | number;
337
+ notNull: true;
338
+ hasDefault: false;
339
+ isPrimaryKey: false;
340
+ isAutoincrement: false;
341
+ hasRuntimeDefault: false;
342
+ enumValues: undefined;
343
+ baseColumn: never;
344
+ identity: undefined;
345
+ generated: undefined;
346
+ }, {}, {}>;
347
+ attempts: import("drizzle-orm/pg-core").PgColumn<{
348
+ name: "attempts";
349
+ tableName: "quarantine";
350
+ dataType: "number";
351
+ columnType: "PgInteger";
352
+ data: number;
353
+ driverParam: string | number;
354
+ notNull: true;
355
+ hasDefault: false;
356
+ isPrimaryKey: false;
357
+ isAutoincrement: false;
358
+ hasRuntimeDefault: false;
359
+ enumValues: undefined;
360
+ baseColumn: never;
361
+ identity: undefined;
362
+ generated: undefined;
363
+ }, {}, {}>;
364
+ failureStage: import("drizzle-orm/pg-core").PgColumn<{
365
+ name: "failure_stage";
366
+ tableName: "quarantine";
367
+ dataType: "string";
368
+ columnType: "PgText";
369
+ data: "BodyParse";
370
+ driverParam: string;
371
+ notNull: true;
372
+ hasDefault: false;
373
+ isPrimaryKey: false;
374
+ isAutoincrement: false;
375
+ hasRuntimeDefault: false;
376
+ enumValues: [string, ...string[]];
377
+ baseColumn: never;
378
+ identity: undefined;
379
+ generated: undefined;
380
+ }, {}, {
381
+ $type: "BodyParse";
382
+ }>;
383
+ failureCode: import("drizzle-orm/pg-core").PgColumn<{
384
+ name: "failure_code";
385
+ tableName: "quarantine";
386
+ dataType: "string";
387
+ columnType: "PgText";
388
+ data: "UnknownCharset" | "UnreadableBody";
389
+ driverParam: string;
390
+ notNull: true;
391
+ hasDefault: false;
392
+ isPrimaryKey: false;
393
+ isAutoincrement: false;
394
+ hasRuntimeDefault: false;
395
+ enumValues: [string, ...string[]];
396
+ baseColumn: never;
397
+ identity: undefined;
398
+ generated: undefined;
399
+ }, {}, {
400
+ $type: "UnknownCharset" | "UnreadableBody";
401
+ }>;
402
+ failureMessage: import("drizzle-orm/pg-core").PgColumn<{
403
+ name: "failure_message";
404
+ tableName: "quarantine";
405
+ dataType: "string";
406
+ columnType: "PgText";
407
+ data: string;
408
+ driverParam: string;
409
+ notNull: true;
410
+ hasDefault: false;
411
+ isPrimaryKey: false;
412
+ isAutoincrement: false;
413
+ hasRuntimeDefault: false;
414
+ enumValues: [string, ...string[]];
415
+ baseColumn: never;
416
+ identity: undefined;
417
+ generated: undefined;
418
+ }, {}, {}>;
419
+ failurePartPath: import("drizzle-orm/pg-core").PgColumn<{
420
+ name: "failure_part_path";
421
+ tableName: "quarantine";
422
+ dataType: "custom";
423
+ columnType: "PgCustomColumn";
424
+ data: string;
425
+ driverParam: string;
426
+ notNull: false;
427
+ hasDefault: false;
428
+ isPrimaryKey: false;
429
+ isAutoincrement: false;
430
+ hasRuntimeDefault: false;
431
+ enumValues: undefined;
432
+ baseColumn: never;
433
+ identity: undefined;
434
+ generated: undefined;
435
+ }, {}, {
436
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
437
+ }>;
438
+ workerVersion: import("drizzle-orm/pg-core").PgColumn<{
439
+ name: "worker_version";
440
+ tableName: "quarantine";
441
+ dataType: "string";
442
+ columnType: "PgText";
443
+ data: string;
444
+ driverParam: string;
445
+ notNull: true;
446
+ hasDefault: false;
447
+ isPrimaryKey: false;
448
+ isAutoincrement: false;
449
+ hasRuntimeDefault: false;
450
+ enumValues: [string, ...string[]];
451
+ baseColumn: never;
452
+ identity: undefined;
453
+ generated: undefined;
454
+ }, {}, {}>;
455
+ contentType: import("drizzle-orm/pg-core").PgColumn<{
456
+ name: "content_type";
457
+ tableName: "quarantine";
458
+ dataType: "custom";
459
+ columnType: "PgCustomColumn";
460
+ data: string;
461
+ driverParam: string;
462
+ notNull: false;
463
+ hasDefault: false;
464
+ isPrimaryKey: false;
465
+ isAutoincrement: false;
466
+ hasRuntimeDefault: false;
467
+ enumValues: undefined;
468
+ baseColumn: never;
469
+ identity: undefined;
470
+ generated: undefined;
471
+ }, {}, {
472
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
473
+ }>;
474
+ transferEncoding: import("drizzle-orm/pg-core").PgColumn<{
475
+ name: "transfer_encoding";
476
+ tableName: "quarantine";
477
+ dataType: "custom";
478
+ columnType: "PgCustomColumn";
479
+ data: string;
480
+ driverParam: string;
481
+ notNull: false;
482
+ hasDefault: false;
483
+ isPrimaryKey: false;
484
+ isAutoincrement: false;
485
+ hasRuntimeDefault: false;
486
+ enumValues: undefined;
487
+ baseColumn: never;
488
+ identity: undefined;
489
+ generated: undefined;
490
+ }, {}, {
491
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
492
+ }>;
493
+ charset: import("drizzle-orm/pg-core").PgColumn<{
494
+ name: "charset";
495
+ tableName: "quarantine";
496
+ dataType: "custom";
497
+ columnType: "PgCustomColumn";
498
+ data: string;
499
+ driverParam: string;
500
+ notNull: false;
501
+ hasDefault: false;
502
+ isPrimaryKey: false;
503
+ isAutoincrement: false;
504
+ hasRuntimeDefault: false;
505
+ enumValues: undefined;
506
+ baseColumn: never;
507
+ identity: undefined;
508
+ generated: undefined;
509
+ }, {}, {
510
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
511
+ }>;
512
+ sizeBytes: import("drizzle-orm/pg-core").PgColumn<{
513
+ name: "size_bytes";
514
+ tableName: "quarantine";
515
+ dataType: "custom";
516
+ columnType: "PgCustomColumn";
517
+ data: number;
518
+ driverParam: string | number;
519
+ notNull: false;
520
+ hasDefault: false;
521
+ isPrimaryKey: false;
522
+ isAutoincrement: false;
523
+ hasRuntimeDefault: false;
524
+ enumValues: undefined;
525
+ baseColumn: never;
526
+ identity: undefined;
527
+ generated: undefined;
528
+ }, {}, {
529
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
530
+ }>;
531
+ structure: import("drizzle-orm/pg-core").PgColumn<{
532
+ name: "structure";
533
+ tableName: "quarantine";
534
+ dataType: "json";
535
+ columnType: "PgJsonb";
536
+ data: unknown;
537
+ driverParam: unknown;
538
+ notNull: true;
539
+ hasDefault: true;
540
+ isPrimaryKey: false;
541
+ isAutoincrement: false;
542
+ hasRuntimeDefault: false;
543
+ enumValues: undefined;
544
+ baseColumn: never;
545
+ identity: undefined;
546
+ generated: undefined;
547
+ }, {}, {}>;
548
+ messageIdHash: import("drizzle-orm/pg-core").PgColumn<{
549
+ name: "message_id_hash";
550
+ tableName: "quarantine";
551
+ dataType: "custom";
552
+ columnType: "PgCustomColumn";
553
+ data: string;
554
+ driverParam: string;
555
+ notNull: false;
556
+ hasDefault: false;
557
+ isPrimaryKey: false;
558
+ isAutoincrement: false;
559
+ hasRuntimeDefault: false;
560
+ enumValues: undefined;
561
+ baseColumn: never;
562
+ identity: undefined;
563
+ generated: undefined;
564
+ }, {}, {
565
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
566
+ }>;
567
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
568
+ name: "created_at";
569
+ tableName: "quarantine";
570
+ dataType: "number";
571
+ columnType: "PgBigInt53";
572
+ data: number;
573
+ driverParam: string | number;
574
+ notNull: true;
575
+ hasDefault: false;
576
+ isPrimaryKey: false;
577
+ isAutoincrement: false;
578
+ hasRuntimeDefault: false;
579
+ enumValues: undefined;
580
+ baseColumn: never;
581
+ identity: undefined;
582
+ generated: undefined;
583
+ }, {}, {}>;
584
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
585
+ name: "updated_at";
586
+ tableName: "quarantine";
587
+ dataType: "number";
588
+ columnType: "PgBigInt53";
589
+ data: number;
590
+ driverParam: string | number;
591
+ notNull: true;
592
+ hasDefault: false;
593
+ isPrimaryKey: false;
594
+ isAutoincrement: false;
595
+ hasRuntimeDefault: false;
596
+ enumValues: undefined;
597
+ baseColumn: never;
598
+ identity: undefined;
599
+ generated: undefined;
600
+ }, {}, {}>;
601
+ };
602
+ dialect: "pg";
603
+ }>;
188
604
  export declare const accountConfigs: import("drizzle-orm/pg-core").PgTableWithColumns<{
189
605
  name: "account_config";
190
606
  schema: undefined;
@@ -1496,7 +1912,7 @@ export declare const filters: import("drizzle-orm/pg-core").PgTableWithColumns<{
1496
1912
  data: unknown;
1497
1913
  driverParam: unknown;
1498
1914
  notNull: true;
1499
- hasDefault: false;
1915
+ hasDefault: true;
1500
1916
  isPrimaryKey: false;
1501
1917
  isAutoincrement: false;
1502
1918
  hasRuntimeDefault: false;
@@ -1694,7 +2110,7 @@ export declare const organizeJobRequests: import("drizzle-orm/pg-core").PgTableW
1694
2110
  data: unknown;
1695
2111
  driverParam: unknown;
1696
2112
  notNull: true;
1697
- hasDefault: false;
2113
+ hasDefault: true;
1698
2114
  isPrimaryKey: false;
1699
2115
  isAutoincrement: false;
1700
2116
  hasRuntimeDefault: false;
@@ -2406,7 +2822,7 @@ export declare const outboxMessages: import("drizzle-orm/pg-core").PgTableWithCo
2406
2822
  data: unknown;
2407
2823
  driverParam: unknown;
2408
2824
  notNull: true;
2409
- hasDefault: false;
2825
+ hasDefault: true;
2410
2826
  isPrimaryKey: false;
2411
2827
  isAutoincrement: false;
2412
2828
  hasRuntimeDefault: false;
@@ -2423,7 +2839,7 @@ export declare const outboxMessages: import("drizzle-orm/pg-core").PgTableWithCo
2423
2839
  data: unknown;
2424
2840
  driverParam: unknown;
2425
2841
  notNull: true;
2426
- hasDefault: false;
2842
+ hasDefault: true;
2427
2843
  isPrimaryKey: false;
2428
2844
  isAutoincrement: false;
2429
2845
  hasRuntimeDefault: false;
@@ -2514,7 +2930,7 @@ export declare const outboxMessages: import("drizzle-orm/pg-core").PgTableWithCo
2514
2930
  data: unknown;
2515
2931
  driverParam: unknown;
2516
2932
  notNull: true;
2517
- hasDefault: false;
2933
+ hasDefault: true;
2518
2934
  isPrimaryKey: false;
2519
2935
  isAutoincrement: false;
2520
2936
  hasRuntimeDefault: false;
@@ -4280,7 +4696,7 @@ export declare const mailboxSpecialUseEntries: import("drizzle-orm/pg-core").PgT
4280
4696
  tableName: "mailbox_special_use_entry";
4281
4697
  dataType: "string";
4282
4698
  columnType: "PgText";
4283
- data: "All" | "Archive" | "Drafts" | "Flagged" | "Junk" | "Sent" | "Trash" | "Important";
4699
+ data: "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged" | "Important";
4284
4700
  driverParam: string;
4285
4701
  notNull: true;
4286
4702
  hasDefault: false;
@@ -4292,7 +4708,7 @@ export declare const mailboxSpecialUseEntries: import("drizzle-orm/pg-core").PgT
4292
4708
  identity: undefined;
4293
4709
  generated: undefined;
4294
4710
  }, {}, {
4295
- $type: "All" | "Archive" | "Drafts" | "Flagged" | "Junk" | "Sent" | "Trash" | "Important";
4711
+ $type: "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged" | "Important";
4296
4712
  }>;
4297
4713
  };
4298
4714
  dialect: "pg";
package/dist/schema.js CHANGED
@@ -14,6 +14,33 @@ export const accountExportRequests = pgTable("account_export_request", {
14
14
  }, (table) => [
15
15
  index("account_export_request_by_account_config_id").on(table.accountConfigId, table.createdAt),
16
16
  ]);
17
+ export const quarantines = pgTable("quarantine", {
18
+ quarantineId: text("quarantine_id").primaryKey().$defaultFn(() => generateBase36Id()),
19
+ accountConfigId: text("account_config_id").notNull(),
20
+ accountId: text("account_id").notNull(),
21
+ mailboxId: text("mailbox_id").notNull(),
22
+ uidValidity: bigint("uid_validity", { mode: "number" }).notNull(),
23
+ uid: bigint("uid", { mode: "number" }).notNull(),
24
+ mailboxRole: text("mailbox_role").$type(),
25
+ mailboxPath: text("mailbox_path").notNull(),
26
+ quarantinedAt: bigint("quarantined_at", { mode: "number" }).notNull(),
27
+ attempts: integer("attempts").notNull(),
28
+ failureStage: text("failure_stage").$type().notNull(),
29
+ failureCode: text("failure_code").$type().notNull(),
30
+ failureMessage: text("failure_message").notNull(),
31
+ failurePartPath: nullableText("failure_part_path"),
32
+ workerVersion: text("worker_version").notNull(),
33
+ contentType: nullableText("content_type"),
34
+ transferEncoding: nullableText("transfer_encoding"),
35
+ charset: nullableText("charset"),
36
+ sizeBytes: nullableBigint("size_bytes"),
37
+ structure: jsonb("structure").notNull().default([]),
38
+ messageIdHash: nullableText("message_id_hash"),
39
+ createdAt: bigint("created_at", { mode: "number" }).notNull(),
40
+ updatedAt: bigint("updated_at", { mode: "number" }).notNull(),
41
+ }, (table) => [
42
+ index("quarantine_by_account_config_id").on(table.accountConfigId, table.quarantinedAt),
43
+ ]);
17
44
  export const accountConfigs = pgTable("account_config", {
18
45
  accountConfigId: text("account_config_id").primaryKey().$defaultFn(() => generateBase36Id()),
19
46
  userId: text("user_id").notNull(),
@@ -99,7 +126,7 @@ export const filters = pgTable("filter", {
99
126
  hasAnchor: boolean("has_anchor").notNull().default(false),
100
127
  ruleChangedAt: bigint("rule_changed_at", { mode: "number" }).notNull(),
101
128
  matchOperator: text("match_operator").$type().notNull().default("And"),
102
- literalClauses: jsonb("literal_clauses").notNull(),
129
+ literalClauses: jsonb("literal_clauses").notNull().default([]),
103
130
  actionLabelId: text("action_label_id").notNull().default("None"),
104
131
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
105
132
  createdAt: bigint("created_at", { mode: "number" }).notNull(),
@@ -115,7 +142,7 @@ export const organizeJobRequests = pgTable("organize_job_request", {
115
142
  state: text("state").$type().notNull().default("Pending"),
116
143
  anchorMessageId: text("anchor_message_id").notNull().default("None"),
117
144
  matchOperator: text("match_operator").$type().notNull().default("And"),
118
- literalClauses: jsonb("literal_clauses").notNull(),
145
+ literalClauses: jsonb("literal_clauses").notNull().default([]),
119
146
  similarityThreshold: doublePrecision("similarity_threshold").notNull(),
120
147
  actionLabelId: text("action_label_id").notNull().default("None"),
121
148
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
@@ -171,13 +198,13 @@ export const outboxMessages = pgTable("outbox_message", {
171
198
  fromAddress: text("from_address").notNull(),
172
199
  fromName: nullableText("from_name"),
173
200
  toAddresses: jsonb("to_addresses").notNull(),
174
- ccAddresses: jsonb("cc_addresses").notNull(),
175
- bccAddresses: jsonb("bcc_addresses").notNull(),
201
+ ccAddresses: jsonb("cc_addresses").notNull().default([]),
202
+ bccAddresses: jsonb("bcc_addresses").notNull().default([]),
176
203
  replyToAddress: nullableText("reply_to_address"),
177
204
  subject: nullableText("subject"),
178
205
  messageIdValue: text("message_id_value").notNull(),
179
206
  inReplyTo: nullableText("in_reply_to"),
180
- references: jsonb("references").notNull(),
207
+ references: jsonb("references").notNull().default([]),
181
208
  textBody: nullableText("text_body"),
182
209
  htmlBody: nullableText("html_body"),
183
210
  status: text("status").$type().notNull(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/drizzle-pg-schema",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/schema.ts CHANGED
@@ -20,6 +20,38 @@ export const accountExportRequests = pgTable(
20
20
  ],
21
21
  );
22
22
 
23
+ export const quarantines = pgTable(
24
+ "quarantine",
25
+ {
26
+ quarantineId: text("quarantine_id").primaryKey().$defaultFn(() => generateBase36Id()),
27
+ accountConfigId: text("account_config_id").notNull(),
28
+ accountId: text("account_id").notNull(),
29
+ mailboxId: text("mailbox_id").notNull(),
30
+ uidValidity: bigint("uid_validity", { mode: "number" }).notNull(),
31
+ uid: bigint("uid", { mode: "number" }).notNull(),
32
+ mailboxRole: text("mailbox_role").$type<"Inbox" | "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged">(),
33
+ mailboxPath: text("mailbox_path").notNull(),
34
+ quarantinedAt: bigint("quarantined_at", { mode: "number" }).notNull(),
35
+ attempts: integer("attempts").notNull(),
36
+ failureStage: text("failure_stage").$type<"BodyParse">().notNull(),
37
+ failureCode: text("failure_code").$type<"UnknownCharset" | "UnreadableBody">().notNull(),
38
+ failureMessage: text("failure_message").notNull(),
39
+ failurePartPath: nullableText("failure_part_path"),
40
+ workerVersion: text("worker_version").notNull(),
41
+ contentType: nullableText("content_type"),
42
+ transferEncoding: nullableText("transfer_encoding"),
43
+ charset: nullableText("charset"),
44
+ sizeBytes: nullableBigint("size_bytes"),
45
+ structure: jsonb("structure").notNull().default([]),
46
+ messageIdHash: nullableText("message_id_hash"),
47
+ createdAt: bigint("created_at", { mode: "number" }).notNull(),
48
+ updatedAt: bigint("updated_at", { mode: "number" }).notNull(),
49
+ },
50
+ (table) => [
51
+ index("quarantine_by_account_config_id").on(table.accountConfigId, table.quarantinedAt),
52
+ ],
53
+ );
54
+
23
55
  export const accountConfigs = pgTable(
24
56
  "account_config",
25
57
  {
@@ -122,7 +154,7 @@ export const filters = pgTable(
122
154
  hasAnchor: boolean("has_anchor").notNull().default(false),
123
155
  ruleChangedAt: bigint("rule_changed_at", { mode: "number" }).notNull(),
124
156
  matchOperator: text("match_operator").$type<"And" | "Or">().notNull().default("And"),
125
- literalClauses: jsonb("literal_clauses").notNull(),
157
+ literalClauses: jsonb("literal_clauses").notNull().default([]),
126
158
  actionLabelId: text("action_label_id").notNull().default("None"),
127
159
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
128
160
  createdAt: bigint("created_at", { mode: "number" }).notNull(),
@@ -143,7 +175,7 @@ export const organizeJobRequests = pgTable(
143
175
  state: text("state").$type<"Pending" | "Running" | "Complete" | "Failed">().notNull().default("Pending"),
144
176
  anchorMessageId: text("anchor_message_id").notNull().default("None"),
145
177
  matchOperator: text("match_operator").$type<"And" | "Or">().notNull().default("And"),
146
- literalClauses: jsonb("literal_clauses").notNull(),
178
+ literalClauses: jsonb("literal_clauses").notNull().default([]),
147
179
  similarityThreshold: doublePrecision("similarity_threshold").notNull(),
148
180
  actionLabelId: text("action_label_id").notNull().default("None"),
149
181
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
@@ -209,13 +241,13 @@ export const outboxMessages = pgTable(
209
241
  fromAddress: text("from_address").notNull(),
210
242
  fromName: nullableText("from_name"),
211
243
  toAddresses: jsonb("to_addresses").notNull(),
212
- ccAddresses: jsonb("cc_addresses").notNull(),
213
- bccAddresses: jsonb("bcc_addresses").notNull(),
244
+ ccAddresses: jsonb("cc_addresses").notNull().default([]),
245
+ bccAddresses: jsonb("bcc_addresses").notNull().default([]),
214
246
  replyToAddress: nullableText("reply_to_address"),
215
247
  subject: nullableText("subject"),
216
248
  messageIdValue: text("message_id_value").notNull(),
217
249
  inReplyTo: nullableText("in_reply_to"),
218
- references: jsonb("references").notNull(),
250
+ references: jsonb("references").notNull().default([]),
219
251
  textBody: nullableText("text_body"),
220
252
  htmlBody: nullableText("html_body"),
221
253
  status: text("status").$type<"draft" | "queued" | "sending" | "sent" | "failed" | "blocked">().notNull(),