@remit/drizzle-sqlite-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
@@ -190,6 +190,437 @@ export declare const accountExportRequests: import("drizzle-orm/sqlite-core").SQ
190
190
  };
191
191
  dialect: "sqlite";
192
192
  }>;
193
+ export declare const quarantines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
194
+ name: "quarantine";
195
+ schema: undefined;
196
+ columns: {
197
+ quarantineId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
198
+ name: "quarantine_id";
199
+ tableName: "quarantine";
200
+ dataType: "string";
201
+ columnType: "SQLiteText";
202
+ data: string;
203
+ driverParam: string;
204
+ notNull: true;
205
+ hasDefault: true;
206
+ isPrimaryKey: true;
207
+ isAutoincrement: false;
208
+ hasRuntimeDefault: true;
209
+ enumValues: [string, ...string[]];
210
+ baseColumn: never;
211
+ identity: undefined;
212
+ generated: undefined;
213
+ }, {}, {
214
+ length: number;
215
+ }>;
216
+ accountConfigId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
217
+ name: "account_config_id";
218
+ tableName: "quarantine";
219
+ dataType: "string";
220
+ columnType: "SQLiteText";
221
+ data: string;
222
+ driverParam: string;
223
+ notNull: true;
224
+ hasDefault: false;
225
+ isPrimaryKey: false;
226
+ isAutoincrement: false;
227
+ hasRuntimeDefault: false;
228
+ enumValues: [string, ...string[]];
229
+ baseColumn: never;
230
+ identity: undefined;
231
+ generated: undefined;
232
+ }, {}, {
233
+ length: number;
234
+ }>;
235
+ accountId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
236
+ name: "account_id";
237
+ tableName: "quarantine";
238
+ dataType: "string";
239
+ columnType: "SQLiteText";
240
+ data: string;
241
+ driverParam: string;
242
+ notNull: true;
243
+ hasDefault: false;
244
+ isPrimaryKey: false;
245
+ isAutoincrement: false;
246
+ hasRuntimeDefault: false;
247
+ enumValues: [string, ...string[]];
248
+ baseColumn: never;
249
+ identity: undefined;
250
+ generated: undefined;
251
+ }, {}, {
252
+ length: number;
253
+ }>;
254
+ mailboxId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
255
+ name: "mailbox_id";
256
+ tableName: "quarantine";
257
+ dataType: "string";
258
+ columnType: "SQLiteText";
259
+ data: string;
260
+ driverParam: string;
261
+ notNull: true;
262
+ hasDefault: false;
263
+ isPrimaryKey: false;
264
+ isAutoincrement: false;
265
+ hasRuntimeDefault: false;
266
+ enumValues: [string, ...string[]];
267
+ baseColumn: never;
268
+ identity: undefined;
269
+ generated: undefined;
270
+ }, {}, {
271
+ length: number;
272
+ }>;
273
+ uidValidity: import("drizzle-orm/sqlite-core").SQLiteColumn<{
274
+ name: "uid_validity";
275
+ tableName: "quarantine";
276
+ dataType: "number";
277
+ columnType: "SQLiteInteger";
278
+ data: number;
279
+ driverParam: number;
280
+ notNull: true;
281
+ hasDefault: false;
282
+ isPrimaryKey: false;
283
+ isAutoincrement: false;
284
+ hasRuntimeDefault: false;
285
+ enumValues: undefined;
286
+ baseColumn: never;
287
+ identity: undefined;
288
+ generated: undefined;
289
+ }, {}, {}>;
290
+ uid: import("drizzle-orm/sqlite-core").SQLiteColumn<{
291
+ name: "uid";
292
+ tableName: "quarantine";
293
+ dataType: "number";
294
+ columnType: "SQLiteInteger";
295
+ data: number;
296
+ driverParam: number;
297
+ notNull: true;
298
+ hasDefault: false;
299
+ isPrimaryKey: false;
300
+ isAutoincrement: false;
301
+ hasRuntimeDefault: false;
302
+ enumValues: undefined;
303
+ baseColumn: never;
304
+ identity: undefined;
305
+ generated: undefined;
306
+ }, {}, {}>;
307
+ mailboxRole: import("drizzle-orm/sqlite-core").SQLiteColumn<{
308
+ name: "mailbox_role";
309
+ tableName: "quarantine";
310
+ dataType: "string";
311
+ columnType: "SQLiteText";
312
+ data: "Inbox" | "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged";
313
+ driverParam: string;
314
+ notNull: false;
315
+ hasDefault: false;
316
+ isPrimaryKey: false;
317
+ isAutoincrement: false;
318
+ hasRuntimeDefault: false;
319
+ enumValues: [string, ...string[]];
320
+ baseColumn: never;
321
+ identity: undefined;
322
+ generated: undefined;
323
+ }, {}, {
324
+ length: number;
325
+ $type: "Inbox" | "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged";
326
+ }>;
327
+ mailboxPath: import("drizzle-orm/sqlite-core").SQLiteColumn<{
328
+ name: "mailbox_path";
329
+ tableName: "quarantine";
330
+ dataType: "string";
331
+ columnType: "SQLiteText";
332
+ data: string;
333
+ driverParam: string;
334
+ notNull: true;
335
+ hasDefault: false;
336
+ isPrimaryKey: false;
337
+ isAutoincrement: false;
338
+ hasRuntimeDefault: false;
339
+ enumValues: [string, ...string[]];
340
+ baseColumn: never;
341
+ identity: undefined;
342
+ generated: undefined;
343
+ }, {}, {
344
+ length: number;
345
+ }>;
346
+ quarantinedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
347
+ name: "quarantined_at";
348
+ tableName: "quarantine";
349
+ dataType: "number";
350
+ columnType: "SQLiteInteger";
351
+ data: number;
352
+ driverParam: number;
353
+ notNull: true;
354
+ hasDefault: false;
355
+ isPrimaryKey: false;
356
+ isAutoincrement: false;
357
+ hasRuntimeDefault: false;
358
+ enumValues: undefined;
359
+ baseColumn: never;
360
+ identity: undefined;
361
+ generated: undefined;
362
+ }, {}, {}>;
363
+ attempts: import("drizzle-orm/sqlite-core").SQLiteColumn<{
364
+ name: "attempts";
365
+ tableName: "quarantine";
366
+ dataType: "number";
367
+ columnType: "SQLiteInteger";
368
+ data: number;
369
+ driverParam: number;
370
+ notNull: true;
371
+ hasDefault: false;
372
+ isPrimaryKey: false;
373
+ isAutoincrement: false;
374
+ hasRuntimeDefault: false;
375
+ enumValues: undefined;
376
+ baseColumn: never;
377
+ identity: undefined;
378
+ generated: undefined;
379
+ }, {}, {}>;
380
+ failureStage: import("drizzle-orm/sqlite-core").SQLiteColumn<{
381
+ name: "failure_stage";
382
+ tableName: "quarantine";
383
+ dataType: "string";
384
+ columnType: "SQLiteText";
385
+ data: "BodyParse";
386
+ driverParam: string;
387
+ notNull: true;
388
+ hasDefault: false;
389
+ isPrimaryKey: false;
390
+ isAutoincrement: false;
391
+ hasRuntimeDefault: false;
392
+ enumValues: [string, ...string[]];
393
+ baseColumn: never;
394
+ identity: undefined;
395
+ generated: undefined;
396
+ }, {}, {
397
+ length: number;
398
+ $type: "BodyParse";
399
+ }>;
400
+ failureCode: import("drizzle-orm/sqlite-core").SQLiteColumn<{
401
+ name: "failure_code";
402
+ tableName: "quarantine";
403
+ dataType: "string";
404
+ columnType: "SQLiteText";
405
+ data: "UnknownCharset" | "UnreadableBody";
406
+ driverParam: string;
407
+ notNull: true;
408
+ hasDefault: false;
409
+ isPrimaryKey: false;
410
+ isAutoincrement: false;
411
+ hasRuntimeDefault: false;
412
+ enumValues: [string, ...string[]];
413
+ baseColumn: never;
414
+ identity: undefined;
415
+ generated: undefined;
416
+ }, {}, {
417
+ length: number;
418
+ $type: "UnknownCharset" | "UnreadableBody";
419
+ }>;
420
+ failureMessage: import("drizzle-orm/sqlite-core").SQLiteColumn<{
421
+ name: "failure_message";
422
+ tableName: "quarantine";
423
+ dataType: "string";
424
+ columnType: "SQLiteText";
425
+ data: string;
426
+ driverParam: string;
427
+ notNull: true;
428
+ hasDefault: false;
429
+ isPrimaryKey: false;
430
+ isAutoincrement: false;
431
+ hasRuntimeDefault: false;
432
+ enumValues: [string, ...string[]];
433
+ baseColumn: never;
434
+ identity: undefined;
435
+ generated: undefined;
436
+ }, {}, {
437
+ length: number;
438
+ }>;
439
+ failurePartPath: import("drizzle-orm/sqlite-core").SQLiteColumn<{
440
+ name: "failure_part_path";
441
+ tableName: "quarantine";
442
+ dataType: "custom";
443
+ columnType: "SQLiteCustomColumn";
444
+ data: string;
445
+ driverParam: string;
446
+ notNull: false;
447
+ hasDefault: false;
448
+ isPrimaryKey: false;
449
+ isAutoincrement: false;
450
+ hasRuntimeDefault: false;
451
+ enumValues: undefined;
452
+ baseColumn: never;
453
+ identity: undefined;
454
+ generated: undefined;
455
+ }, {}, {
456
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
457
+ }>;
458
+ workerVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
459
+ name: "worker_version";
460
+ tableName: "quarantine";
461
+ dataType: "string";
462
+ columnType: "SQLiteText";
463
+ data: string;
464
+ driverParam: string;
465
+ notNull: true;
466
+ hasDefault: false;
467
+ isPrimaryKey: false;
468
+ isAutoincrement: false;
469
+ hasRuntimeDefault: false;
470
+ enumValues: [string, ...string[]];
471
+ baseColumn: never;
472
+ identity: undefined;
473
+ generated: undefined;
474
+ }, {}, {
475
+ length: number;
476
+ }>;
477
+ contentType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
478
+ name: "content_type";
479
+ tableName: "quarantine";
480
+ dataType: "custom";
481
+ columnType: "SQLiteCustomColumn";
482
+ data: string;
483
+ driverParam: string;
484
+ notNull: false;
485
+ hasDefault: false;
486
+ isPrimaryKey: false;
487
+ isAutoincrement: false;
488
+ hasRuntimeDefault: false;
489
+ enumValues: undefined;
490
+ baseColumn: never;
491
+ identity: undefined;
492
+ generated: undefined;
493
+ }, {}, {
494
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
495
+ }>;
496
+ transferEncoding: import("drizzle-orm/sqlite-core").SQLiteColumn<{
497
+ name: "transfer_encoding";
498
+ tableName: "quarantine";
499
+ dataType: "custom";
500
+ columnType: "SQLiteCustomColumn";
501
+ data: string;
502
+ driverParam: string;
503
+ notNull: false;
504
+ hasDefault: false;
505
+ isPrimaryKey: false;
506
+ isAutoincrement: false;
507
+ hasRuntimeDefault: false;
508
+ enumValues: undefined;
509
+ baseColumn: never;
510
+ identity: undefined;
511
+ generated: undefined;
512
+ }, {}, {
513
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
514
+ }>;
515
+ charset: import("drizzle-orm/sqlite-core").SQLiteColumn<{
516
+ name: "charset";
517
+ tableName: "quarantine";
518
+ dataType: "custom";
519
+ columnType: "SQLiteCustomColumn";
520
+ data: string;
521
+ driverParam: string;
522
+ notNull: false;
523
+ hasDefault: false;
524
+ isPrimaryKey: false;
525
+ isAutoincrement: false;
526
+ hasRuntimeDefault: false;
527
+ enumValues: undefined;
528
+ baseColumn: never;
529
+ identity: undefined;
530
+ generated: undefined;
531
+ }, {}, {
532
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
533
+ }>;
534
+ sizeBytes: import("drizzle-orm/sqlite-core").SQLiteColumn<{
535
+ name: "size_bytes";
536
+ tableName: "quarantine";
537
+ dataType: "number";
538
+ columnType: "SQLiteInteger";
539
+ data: number;
540
+ driverParam: number;
541
+ notNull: false;
542
+ hasDefault: false;
543
+ isPrimaryKey: false;
544
+ isAutoincrement: false;
545
+ hasRuntimeDefault: false;
546
+ enumValues: undefined;
547
+ baseColumn: never;
548
+ identity: undefined;
549
+ generated: undefined;
550
+ }, {}, {}>;
551
+ structure: import("drizzle-orm/sqlite-core").SQLiteColumn<{
552
+ name: "structure";
553
+ tableName: "quarantine";
554
+ dataType: "json";
555
+ columnType: "SQLiteTextJson";
556
+ data: unknown;
557
+ driverParam: string;
558
+ notNull: true;
559
+ hasDefault: true;
560
+ isPrimaryKey: false;
561
+ isAutoincrement: false;
562
+ hasRuntimeDefault: false;
563
+ enumValues: undefined;
564
+ baseColumn: never;
565
+ identity: undefined;
566
+ generated: undefined;
567
+ }, {}, {}>;
568
+ messageIdHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
569
+ name: "message_id_hash";
570
+ tableName: "quarantine";
571
+ dataType: "custom";
572
+ columnType: "SQLiteCustomColumn";
573
+ data: string;
574
+ driverParam: string;
575
+ notNull: false;
576
+ hasDefault: false;
577
+ isPrimaryKey: false;
578
+ isAutoincrement: false;
579
+ hasRuntimeDefault: false;
580
+ enumValues: undefined;
581
+ baseColumn: never;
582
+ identity: undefined;
583
+ generated: undefined;
584
+ }, {}, {
585
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
586
+ }>;
587
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
588
+ name: "created_at";
589
+ tableName: "quarantine";
590
+ dataType: "number";
591
+ columnType: "SQLiteInteger";
592
+ data: number;
593
+ driverParam: number;
594
+ notNull: true;
595
+ hasDefault: false;
596
+ isPrimaryKey: false;
597
+ isAutoincrement: false;
598
+ hasRuntimeDefault: false;
599
+ enumValues: undefined;
600
+ baseColumn: never;
601
+ identity: undefined;
602
+ generated: undefined;
603
+ }, {}, {}>;
604
+ updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
605
+ name: "updated_at";
606
+ tableName: "quarantine";
607
+ dataType: "number";
608
+ columnType: "SQLiteInteger";
609
+ data: number;
610
+ driverParam: number;
611
+ notNull: true;
612
+ hasDefault: false;
613
+ isPrimaryKey: false;
614
+ isAutoincrement: false;
615
+ hasRuntimeDefault: false;
616
+ enumValues: undefined;
617
+ baseColumn: never;
618
+ identity: undefined;
619
+ generated: undefined;
620
+ }, {}, {}>;
621
+ };
622
+ dialect: "sqlite";
623
+ }>;
193
624
  export declare const accountConfigs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
194
625
  name: "account_config";
195
626
  schema: undefined;
@@ -1533,7 +1964,7 @@ export declare const filters: import("drizzle-orm/sqlite-core").SQLiteTableWithC
1533
1964
  data: unknown;
1534
1965
  driverParam: string;
1535
1966
  notNull: true;
1536
- hasDefault: false;
1967
+ hasDefault: true;
1537
1968
  isPrimaryKey: false;
1538
1969
  isAutoincrement: false;
1539
1970
  hasRuntimeDefault: false;
@@ -1745,7 +2176,7 @@ export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLi
1745
2176
  data: unknown;
1746
2177
  driverParam: string;
1747
2178
  notNull: true;
1748
- hasDefault: false;
2179
+ hasDefault: true;
1749
2180
  isPrimaryKey: false;
1750
2181
  isAutoincrement: false;
1751
2182
  hasRuntimeDefault: false;
@@ -2483,7 +2914,7 @@ export declare const outboxMessages: import("drizzle-orm/sqlite-core").SQLiteTab
2483
2914
  data: unknown;
2484
2915
  driverParam: string;
2485
2916
  notNull: true;
2486
- hasDefault: false;
2917
+ hasDefault: true;
2487
2918
  isPrimaryKey: false;
2488
2919
  isAutoincrement: false;
2489
2920
  hasRuntimeDefault: false;
@@ -2500,7 +2931,7 @@ export declare const outboxMessages: import("drizzle-orm/sqlite-core").SQLiteTab
2500
2931
  data: unknown;
2501
2932
  driverParam: string;
2502
2933
  notNull: true;
2503
- hasDefault: false;
2934
+ hasDefault: true;
2504
2935
  isPrimaryKey: false;
2505
2936
  isAutoincrement: false;
2506
2937
  hasRuntimeDefault: false;
@@ -2593,7 +3024,7 @@ export declare const outboxMessages: import("drizzle-orm/sqlite-core").SQLiteTab
2593
3024
  data: unknown;
2594
3025
  driverParam: string;
2595
3026
  notNull: true;
2596
- hasDefault: false;
3027
+ hasDefault: true;
2597
3028
  isPrimaryKey: false;
2598
3029
  isAutoincrement: false;
2599
3030
  hasRuntimeDefault: false;
@@ -4422,7 +4853,7 @@ export declare const mailboxSpecialUseEntries: import("drizzle-orm/sqlite-core")
4422
4853
  tableName: "mailbox_special_use_entry";
4423
4854
  dataType: "string";
4424
4855
  columnType: "SQLiteText";
4425
- data: "All" | "Archive" | "Drafts" | "Flagged" | "Junk" | "Sent" | "Trash" | "Important";
4856
+ data: "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged" | "Important";
4426
4857
  driverParam: string;
4427
4858
  notNull: true;
4428
4859
  hasDefault: false;
@@ -4435,7 +4866,7 @@ export declare const mailboxSpecialUseEntries: import("drizzle-orm/sqlite-core")
4435
4866
  generated: undefined;
4436
4867
  }, {}, {
4437
4868
  length: number;
4438
- $type: "All" | "Archive" | "Drafts" | "Flagged" | "Junk" | "Sent" | "Trash" | "Important";
4869
+ $type: "Drafts" | "Sent" | "Archive" | "Junk" | "Trash" | "All" | "Flagged" | "Important";
4439
4870
  }>;
4440
4871
  };
4441
4872
  dialect: "sqlite";
package/dist/schema.js CHANGED
@@ -14,6 +14,33 @@ export const accountExportRequests = sqliteTable("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 = sqliteTable("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: integer("uid_validity", { mode: "number" }).notNull(),
23
+ uid: integer("uid", { mode: "number" }).notNull(),
24
+ mailboxRole: text("mailbox_role").$type(),
25
+ mailboxPath: text("mailbox_path").notNull(),
26
+ quarantinedAt: integer("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: integer("size_bytes", { mode: "number" }),
37
+ structure: text("structure", { mode: "json" }).notNull().default([]),
38
+ messageIdHash: nullableText("message_id_hash"),
39
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
40
+ updatedAt: integer("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 = sqliteTable("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 = sqliteTable("filter", {
99
126
  hasAnchor: integer("has_anchor", { mode: "boolean" }).notNull().default(false),
100
127
  ruleChangedAt: integer("rule_changed_at", { mode: "number" }).notNull(),
101
128
  matchOperator: text("match_operator").$type().notNull().default("And"),
102
- literalClauses: text("literal_clauses", { mode: "json" }).notNull(),
129
+ literalClauses: text("literal_clauses", { mode: "json" }).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: integer("created_at", { mode: "number" }).notNull(),
@@ -115,7 +142,7 @@ export const organizeJobRequests = sqliteTable("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: text("literal_clauses", { mode: "json" }).notNull(),
145
+ literalClauses: text("literal_clauses", { mode: "json" }).notNull().default([]),
119
146
  similarityThreshold: real("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 = sqliteTable("outbox_message", {
171
198
  fromAddress: text("from_address").notNull(),
172
199
  fromName: nullableText("from_name"),
173
200
  toAddresses: text("to_addresses", { mode: "json" }).notNull(),
174
- ccAddresses: text("cc_addresses", { mode: "json" }).notNull(),
175
- bccAddresses: text("bcc_addresses", { mode: "json" }).notNull(),
201
+ ccAddresses: text("cc_addresses", { mode: "json" }).notNull().default([]),
202
+ bccAddresses: text("bcc_addresses", { mode: "json" }).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: text("references", { mode: "json" }).notNull(),
207
+ references: text("references", { mode: "json" }).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-sqlite-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 = sqliteTable(
20
20
  ],
21
21
  );
22
22
 
23
+ export const quarantines = sqliteTable(
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: integer("uid_validity", { mode: "number" }).notNull(),
31
+ uid: integer("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: integer("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: integer("size_bytes", { mode: "number" }),
45
+ structure: text("structure", { mode: "json" }).notNull().default([]),
46
+ messageIdHash: nullableText("message_id_hash"),
47
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
48
+ updatedAt: integer("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 = sqliteTable(
24
56
  "account_config",
25
57
  {
@@ -122,7 +154,7 @@ export const filters = sqliteTable(
122
154
  hasAnchor: integer("has_anchor", { mode: "boolean" }).notNull().default(false),
123
155
  ruleChangedAt: integer("rule_changed_at", { mode: "number" }).notNull(),
124
156
  matchOperator: text("match_operator").$type<"And" | "Or">().notNull().default("And"),
125
- literalClauses: text("literal_clauses", { mode: "json" }).notNull(),
157
+ literalClauses: text("literal_clauses", { mode: "json" }).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: integer("created_at", { mode: "number" }).notNull(),
@@ -143,7 +175,7 @@ export const organizeJobRequests = sqliteTable(
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: text("literal_clauses", { mode: "json" }).notNull(),
178
+ literalClauses: text("literal_clauses", { mode: "json" }).notNull().default([]),
147
179
  similarityThreshold: real("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 = sqliteTable(
209
241
  fromAddress: text("from_address").notNull(),
210
242
  fromName: nullableText("from_name"),
211
243
  toAddresses: text("to_addresses", { mode: "json" }).notNull(),
212
- ccAddresses: text("cc_addresses", { mode: "json" }).notNull(),
213
- bccAddresses: text("bcc_addresses", { mode: "json" }).notNull(),
244
+ ccAddresses: text("cc_addresses", { mode: "json" }).notNull().default([]),
245
+ bccAddresses: text("bcc_addresses", { mode: "json" }).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: text("references", { mode: "json" }).notNull(),
250
+ references: text("references", { mode: "json" }).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(),