@remit/drizzle-sqlite-schema 0.0.18 → 0.0.20

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.js CHANGED
@@ -169,6 +169,47 @@ export const organizeJobRequests = sqliteTable("organize_job_request", {
169
169
  }, (table) => [
170
170
  index("organize_job_request_by_account_config_id").on(table.accountConfigId, table.createdAt),
171
171
  ]);
172
+ export const calendarCollections = sqliteTable("calendar", {
173
+ calendarId: text("calendar_id").primaryKey().$defaultFn(() => generateBase36Id()),
174
+ accountConfigId: text("account_config_id").notNull(),
175
+ urlSegment: text("url_segment").notNull(),
176
+ displayName: text("display_name").notNull(),
177
+ color: text("color").$type().notNull().default("Cal1"),
178
+ componentSet: text("component_set").$type().notNull().default("VeventOnly"),
179
+ source: text("source").$type().notNull().default("UserCreated"),
180
+ timezone: text("timezone").notNull().default(""),
181
+ syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
182
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
183
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
184
+ }, (table) => [
185
+ index("calendar_by_url_segment").on(table.accountConfigId, table.urlSegment),
186
+ index("calendar_primary").on(table.accountConfigId, table.calendarId),
187
+ ]);
188
+ export const calendarObjects = sqliteTable("calendar_object", {
189
+ calendarObjectId: text("calendar_object_id").primaryKey().$defaultFn(() => generateBase36Id()),
190
+ calendarId: text("calendar_id").notNull(),
191
+ resourceName: text("resource_name").notNull(),
192
+ icalUid: text("ical_uid").notNull(),
193
+ icalData: text("ical_data").notNull(),
194
+ etag: text("etag").notNull(),
195
+ sequence: integer("sequence").notNull().default(0),
196
+ syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
197
+ summary: text("summary").notNull(),
198
+ dtStart: text("dt_start").notNull(),
199
+ dtEnd: text("dt_end").notNull(),
200
+ allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
201
+ zoneCertainty: text("zone_certainty").$type().notNull().default("Explicit"),
202
+ status: text("status").$type().notNull().default("Confirmed"),
203
+ transparency: text("transparency").$type().notNull().default("Opaque"),
204
+ hasRecurrence: integer("has_recurrence", { mode: "boolean" }).notNull().default(false),
205
+ expandedThrough: text("expanded_through").notNull().default(""),
206
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
207
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
208
+ }, (table) => [
209
+ index("calendar_object_by_sync_sequence").on(table.calendarId, table.syncSequence),
210
+ index("calendar_object_by_uid").on(table.calendarId, table.icalUid),
211
+ index("calendar_object_primary").on(table.calendarId, table.calendarObjectId),
212
+ ]);
172
213
  export const threadMessages = sqliteTable("thread_message", {
173
214
  threadMessageId: text("thread_message_id").primaryKey().$defaultFn(() => generateBase36Id()),
174
215
  threadId: text("thread_id").notNull(),
@@ -336,6 +377,32 @@ export const messageReferences = sqliteTable("message_reference", {
336
377
  }, (table) => [
337
378
  index("message_reference_by_message_id").on(table.messageId, table.messageReferenceId),
338
379
  ]);
380
+ export const calendarSuggestions = sqliteTable("calendar_suggestion", {
381
+ suggestionId: text("suggestion_id").notNull(),
382
+ accountConfigId: text("account_config_id").notNull(),
383
+ messageId: text("message_id").notNull(),
384
+ bodyPartId: text("body_part_id").notNull(),
385
+ icalUid: text("ical_uid").notNull(),
386
+ sequence: integer("sequence").notNull().default(0),
387
+ method: text("method").$type().notNull().default("None"),
388
+ source: text("source").$type().notNull().default("IcalendarPart"),
389
+ state: text("state").$type().notNull().default("Pending"),
390
+ summary: text("summary").notNull(),
391
+ dtStart: text("dt_start").notNull(),
392
+ dtEnd: text("dt_end").notNull(),
393
+ allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
394
+ location: text("location").notNull().default(""),
395
+ organizer: text("organizer").notNull().default(""),
396
+ zoneCertainty: text("zone_certainty").$type().notNull().default("Explicit"),
397
+ icalData: text("ical_data").notNull().default(""),
398
+ acceptedCalendarObjectId: text("accepted_calendar_object_id").notNull().default(""),
399
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
400
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
401
+ }, (table) => [
402
+ primaryKey({ name: "calendar_suggestion_pk", columns: [table.accountConfigId, table.suggestionId] }),
403
+ index("calendar_suggestion_by_state").on(table.accountConfigId, table.state, table.createdAt, table.suggestionId),
404
+ index("calendar_suggestion_by_message").on(table.accountConfigId, table.messageId, table.suggestionId),
405
+ ]);
339
406
  export const envelopeAddresses = sqliteTable("envelope_address", {
340
407
  envelopeAddressId: text("envelope_address_id").primaryKey().$defaultFn(() => generateBase36Id()),
341
408
  messageId: text("message_id").notNull(),
@@ -525,47 +592,6 @@ export const bodyPartContents = sqliteTable("body_part_content", {
525
592
  }, (table) => [
526
593
  index("body_part_content_by_message_id").on(table.messageId, table.bodyPartContentId),
527
594
  ]);
528
- export const calendarCollections = sqliteTable("calendar", {
529
- calendarId: text("calendar_id").primaryKey().$defaultFn(() => generateBase36Id()),
530
- accountConfigId: text("account_config_id").notNull(),
531
- urlSegment: text("url_segment").notNull(),
532
- displayName: text("display_name").notNull(),
533
- color: text("color").$type().notNull().default("Cal1"),
534
- componentSet: text("component_set").$type().notNull().default("VeventOnly"),
535
- source: text("source").$type().notNull().default("UserCreated"),
536
- timezone: text("timezone").notNull().default(""),
537
- syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
538
- createdAt: integer("created_at", { mode: "number" }).notNull(),
539
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
540
- }, (table) => [
541
- index("calendar_by_url_segment").on(table.accountConfigId, table.urlSegment),
542
- index("calendar_primary").on(table.accountConfigId, table.calendarId),
543
- ]);
544
- export const calendarObjects = sqliteTable("calendar_object", {
545
- calendarObjectId: text("calendar_object_id").primaryKey().$defaultFn(() => generateBase36Id()),
546
- calendarId: text("calendar_id").notNull(),
547
- resourceName: text("resource_name").notNull(),
548
- icalUid: text("ical_uid").notNull(),
549
- icalData: text("ical_data").notNull(),
550
- etag: text("etag").notNull(),
551
- sequence: integer("sequence").notNull().default(0),
552
- syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
553
- summary: text("summary").notNull(),
554
- dtStart: text("dt_start").notNull(),
555
- dtEnd: text("dt_end").notNull(),
556
- allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
557
- zoneCertainty: text("zone_certainty").$type().notNull().default("Explicit"),
558
- status: text("status").$type().notNull().default("Confirmed"),
559
- transparency: text("transparency").$type().notNull().default("Opaque"),
560
- hasRecurrence: integer("has_recurrence", { mode: "boolean" }).notNull().default(false),
561
- expandedThrough: text("expanded_through").notNull().default(""),
562
- createdAt: integer("created_at", { mode: "number" }).notNull(),
563
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
564
- }, (table) => [
565
- index("calendar_object_by_sync_sequence").on(table.calendarId, table.syncSequence),
566
- index("calendar_object_by_uid").on(table.calendarId, table.icalUid),
567
- index("calendar_object_primary").on(table.calendarId, table.calendarObjectId),
568
- ]);
569
595
  export const calendarEventIndexes = sqliteTable("calendar_event_index", {
570
596
  calendarId: text("calendar_id").notNull(),
571
597
  calendarObjectId: text("calendar_object_id").notNull(),
@@ -573,6 +599,9 @@ export const calendarEventIndexes = sqliteTable("calendar_event_index", {
573
599
  startAt: text("start_at").notNull(),
574
600
  endAt: text("end_at").notNull(),
575
601
  allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
602
+ summary: text("summary").notNull().default(""),
603
+ status: text("status").$type().notNull().default("Confirmed"),
604
+ transparency: text("transparency").$type().notNull().default("Opaque"),
576
605
  createdAt: integer("created_at", { mode: "number" }).notNull(),
577
606
  updatedAt: integer("updated_at", { mode: "number" }).notNull(),
578
607
  }, (table) => [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/drizzle-sqlite-schema",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/schema.ts CHANGED
@@ -210,6 +210,57 @@ export const organizeJobRequests = sqliteTable(
210
210
  ],
211
211
  );
212
212
 
213
+ export const calendarCollections = sqliteTable(
214
+ "calendar",
215
+ {
216
+ calendarId: text("calendar_id").primaryKey().$defaultFn(() => generateBase36Id()),
217
+ accountConfigId: text("account_config_id").notNull(),
218
+ urlSegment: text("url_segment").notNull(),
219
+ displayName: text("display_name").notNull(),
220
+ color: text("color").$type<"Cal1" | "Cal2" | "Cal3" | "Cal4" | "Cal5" | "Cal6">().notNull().default("Cal1"),
221
+ componentSet: text("component_set").$type<"VeventOnly">().notNull().default("VeventOnly"),
222
+ source: text("source").$type<"Default" | "UserCreated" | "MailDerived">().notNull().default("UserCreated"),
223
+ timezone: text("timezone").notNull().default(""),
224
+ syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
225
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
226
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
227
+ },
228
+ (table) => [
229
+ index("calendar_by_url_segment").on(table.accountConfigId, table.urlSegment),
230
+ index("calendar_primary").on(table.accountConfigId, table.calendarId),
231
+ ],
232
+ );
233
+
234
+ export const calendarObjects = sqliteTable(
235
+ "calendar_object",
236
+ {
237
+ calendarObjectId: text("calendar_object_id").primaryKey().$defaultFn(() => generateBase36Id()),
238
+ calendarId: text("calendar_id").notNull(),
239
+ resourceName: text("resource_name").notNull(),
240
+ icalUid: text("ical_uid").notNull(),
241
+ icalData: text("ical_data").notNull(),
242
+ etag: text("etag").notNull(),
243
+ sequence: integer("sequence").notNull().default(0),
244
+ syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
245
+ summary: text("summary").notNull(),
246
+ dtStart: text("dt_start").notNull(),
247
+ dtEnd: text("dt_end").notNull(),
248
+ allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
249
+ zoneCertainty: text("zone_certainty").$type<"Local" | "Explicit" | "Ambiguous">().notNull().default("Explicit"),
250
+ status: text("status").$type<"Confirmed" | "Tentative" | "Cancelled">().notNull().default("Confirmed"),
251
+ transparency: text("transparency").$type<"Opaque" | "Transparent">().notNull().default("Opaque"),
252
+ hasRecurrence: integer("has_recurrence", { mode: "boolean" }).notNull().default(false),
253
+ expandedThrough: text("expanded_through").notNull().default(""),
254
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
255
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
256
+ },
257
+ (table) => [
258
+ index("calendar_object_by_sync_sequence").on(table.calendarId, table.syncSequence),
259
+ index("calendar_object_by_uid").on(table.calendarId, table.icalUid),
260
+ index("calendar_object_primary").on(table.calendarId, table.calendarObjectId),
261
+ ],
262
+ );
263
+
213
264
  export const threadMessages = sqliteTable(
214
265
  "thread_message",
215
266
  {
@@ -412,6 +463,37 @@ export const messageReferences = sqliteTable(
412
463
  ],
413
464
  );
414
465
 
466
+ export const calendarSuggestions = sqliteTable(
467
+ "calendar_suggestion",
468
+ {
469
+ suggestionId: text("suggestion_id").notNull(),
470
+ accountConfigId: text("account_config_id").notNull(),
471
+ messageId: text("message_id").notNull(),
472
+ bodyPartId: text("body_part_id").notNull(),
473
+ icalUid: text("ical_uid").notNull(),
474
+ sequence: integer("sequence").notNull().default(0),
475
+ method: text("method").$type<"Request" | "Reply" | "Cancel" | "Counter" | "Publish" | "None">().notNull().default("None"),
476
+ source: text("source").$type<"IcalendarPart" | "IcalendarAttachment" | "TextHeuristic">().notNull().default("IcalendarPart"),
477
+ state: text("state").$type<"Pending" | "Accepted" | "Declined" | "Tentative" | "Dismissed" | "Superseded">().notNull().default("Pending"),
478
+ summary: text("summary").notNull(),
479
+ dtStart: text("dt_start").notNull(),
480
+ dtEnd: text("dt_end").notNull(),
481
+ allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
482
+ location: text("location").notNull().default(""),
483
+ organizer: text("organizer").notNull().default(""),
484
+ zoneCertainty: text("zone_certainty").$type<"Local" | "Explicit" | "Ambiguous">().notNull().default("Explicit"),
485
+ icalData: text("ical_data").notNull().default(""),
486
+ acceptedCalendarObjectId: text("accepted_calendar_object_id").notNull().default(""),
487
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
488
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
489
+ },
490
+ (table) => [
491
+ primaryKey({ name: "calendar_suggestion_pk", columns: [table.accountConfigId, table.suggestionId] }),
492
+ index("calendar_suggestion_by_state").on(table.accountConfigId, table.state, table.createdAt, table.suggestionId),
493
+ index("calendar_suggestion_by_message").on(table.accountConfigId, table.messageId, table.suggestionId),
494
+ ],
495
+ );
496
+
415
497
  export const envelopeAddresses = sqliteTable(
416
498
  "envelope_address",
417
499
  {
@@ -681,57 +763,6 @@ export const bodyPartContents = sqliteTable(
681
763
  ],
682
764
  );
683
765
 
684
- export const calendarCollections = sqliteTable(
685
- "calendar",
686
- {
687
- calendarId: text("calendar_id").primaryKey().$defaultFn(() => generateBase36Id()),
688
- accountConfigId: text("account_config_id").notNull(),
689
- urlSegment: text("url_segment").notNull(),
690
- displayName: text("display_name").notNull(),
691
- color: text("color").$type<"Cal1" | "Cal2" | "Cal3" | "Cal4" | "Cal5" | "Cal6">().notNull().default("Cal1"),
692
- componentSet: text("component_set").$type<"VeventOnly">().notNull().default("VeventOnly"),
693
- source: text("source").$type<"Default" | "UserCreated" | "MailDerived">().notNull().default("UserCreated"),
694
- timezone: text("timezone").notNull().default(""),
695
- syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
696
- createdAt: integer("created_at", { mode: "number" }).notNull(),
697
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
698
- },
699
- (table) => [
700
- index("calendar_by_url_segment").on(table.accountConfigId, table.urlSegment),
701
- index("calendar_primary").on(table.accountConfigId, table.calendarId),
702
- ],
703
- );
704
-
705
- export const calendarObjects = sqliteTable(
706
- "calendar_object",
707
- {
708
- calendarObjectId: text("calendar_object_id").primaryKey().$defaultFn(() => generateBase36Id()),
709
- calendarId: text("calendar_id").notNull(),
710
- resourceName: text("resource_name").notNull(),
711
- icalUid: text("ical_uid").notNull(),
712
- icalData: text("ical_data").notNull(),
713
- etag: text("etag").notNull(),
714
- sequence: integer("sequence").notNull().default(0),
715
- syncSequence: integer("sync_sequence", { mode: "number" }).notNull().default(0),
716
- summary: text("summary").notNull(),
717
- dtStart: text("dt_start").notNull(),
718
- dtEnd: text("dt_end").notNull(),
719
- allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
720
- zoneCertainty: text("zone_certainty").$type<"Local" | "Explicit" | "Ambiguous">().notNull().default("Explicit"),
721
- status: text("status").$type<"Confirmed" | "Tentative" | "Cancelled">().notNull().default("Confirmed"),
722
- transparency: text("transparency").$type<"Opaque" | "Transparent">().notNull().default("Opaque"),
723
- hasRecurrence: integer("has_recurrence", { mode: "boolean" }).notNull().default(false),
724
- expandedThrough: text("expanded_through").notNull().default(""),
725
- createdAt: integer("created_at", { mode: "number" }).notNull(),
726
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
727
- },
728
- (table) => [
729
- index("calendar_object_by_sync_sequence").on(table.calendarId, table.syncSequence),
730
- index("calendar_object_by_uid").on(table.calendarId, table.icalUid),
731
- index("calendar_object_primary").on(table.calendarId, table.calendarObjectId),
732
- ],
733
- );
734
-
735
766
  export const calendarEventIndexes = sqliteTable(
736
767
  "calendar_event_index",
737
768
  {
@@ -741,6 +772,9 @@ export const calendarEventIndexes = sqliteTable(
741
772
  startAt: text("start_at").notNull(),
742
773
  endAt: text("end_at").notNull(),
743
774
  allDay: integer("all_day", { mode: "boolean" }).notNull().default(false),
775
+ summary: text("summary").notNull().default(""),
776
+ status: text("status").$type<"Confirmed" | "Tentative" | "Cancelled">().notNull().default("Confirmed"),
777
+ transparency: text("transparency").$type<"Opaque" | "Transparent">().notNull().default("Opaque"),
744
778
  createdAt: integer("created_at", { mode: "number" }).notNull(),
745
779
  updatedAt: integer("updated_at", { mode: "number" }).notNull(),
746
780
  },