@happyvertical/smrt-messages 0.62.6 → 0.62.8

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 (83) hide show
  1. package/AGENTS.md +102 -0
  2. package/dist/access-enforcement.d.ts +20 -0
  3. package/dist/access-enforcement.d.ts.map +1 -0
  4. package/dist/access.d.ts +203 -0
  5. package/dist/access.d.ts.map +1 -0
  6. package/dist/chunks/AttachmentCollection-DhCoruwp.js +308 -0
  7. package/dist/chunks/AttachmentCollection-DhCoruwp.js.map +1 -0
  8. package/dist/chunks/{Email-ChfbMCSF.js → Email-CmNoK1lj.js} +9 -6
  9. package/dist/chunks/Email-CmNoK1lj.js.map +1 -0
  10. package/dist/chunks/EmailAccountCollection-CHizpsxL.js +1555 -0
  11. package/dist/chunks/EmailAccountCollection-CHizpsxL.js.map +1 -0
  12. package/dist/chunks/EmailCollection-Yo2wBv_1.js +181 -0
  13. package/dist/chunks/EmailCollection-Yo2wBv_1.js.map +1 -0
  14. package/dist/chunks/{EmailFolder-XH5eH4Ed.js → EmailFolder-Dks5clxA.js} +25 -6
  15. package/dist/chunks/EmailFolder-Dks5clxA.js.map +1 -0
  16. package/dist/chunks/EmailFolderCollection-nIR4Kpcr.js +177 -0
  17. package/dist/chunks/EmailFolderCollection-nIR4Kpcr.js.map +1 -0
  18. package/dist/chunks/EmailSender-B-Rtq9du.js +147 -0
  19. package/dist/chunks/EmailSender-B-Rtq9du.js.map +1 -0
  20. package/dist/chunks/{Message-C6P1V5C_.js → Message-e99HkbG8.js} +30 -6
  21. package/dist/chunks/Message-e99HkbG8.js.map +1 -0
  22. package/dist/chunks/{MessageCollection-CjCT06XE.js → MessageCollection-t8cLUSNJ.js} +2 -2
  23. package/dist/chunks/{MessageCollection-CjCT06XE.js.map → MessageCollection-t8cLUSNJ.js.map} +1 -1
  24. package/dist/chunks/MessagingEndpointCollection-CGtAL77R.js +97 -0
  25. package/dist/chunks/MessagingEndpointCollection-CGtAL77R.js.map +1 -0
  26. package/dist/chunks/{SlackSender-CjSvwY1K.js → SlackSender-CetlSe6D.js} +2 -2
  27. package/dist/chunks/{SlackSender-CjSvwY1K.js.map → SlackSender-CetlSe6D.js.map} +1 -1
  28. package/dist/chunks/{TweetSender-CcLPNNi1.js → TweetSender-Dw-TDxIB.js} +2 -2
  29. package/dist/chunks/{TweetSender-CcLPNNi1.js.map → TweetSender-Dw-TDxIB.js.map} +1 -1
  30. package/dist/chunks/{providers-4iLula-V.js → providers-Bz_F_ywF.js} +36 -1
  31. package/dist/chunks/{providers-4iLula-V.js.map → providers-Bz_F_ywF.js.map} +1 -1
  32. package/dist/collections/AttachmentCollection.d.ts +6 -0
  33. package/dist/collections/AttachmentCollection.d.ts.map +1 -1
  34. package/dist/collections/EmailAccountCollection.d.ts.map +1 -1
  35. package/dist/connect.d.ts +82 -0
  36. package/dist/connect.d.ts.map +1 -0
  37. package/dist/connect.js +126 -0
  38. package/dist/connect.js.map +1 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +507 -1402
  42. package/dist/index.js.map +1 -1
  43. package/dist/mail-sync-jobs.d.ts +48 -0
  44. package/dist/mail-sync-jobs.d.ts.map +1 -0
  45. package/dist/mail-sync.d.ts +58 -0
  46. package/dist/mail-sync.d.ts.map +1 -0
  47. package/dist/manifest.json +1040 -56
  48. package/dist/models/Account.d.ts +23 -0
  49. package/dist/models/Account.d.ts.map +1 -1
  50. package/dist/models/Attachment.d.ts +14 -0
  51. package/dist/models/Attachment.d.ts.map +1 -1
  52. package/dist/models/Email.d.ts +1 -0
  53. package/dist/models/Email.d.ts.map +1 -1
  54. package/dist/models/EmailAccount.d.ts +32 -2
  55. package/dist/models/EmailAccount.d.ts.map +1 -1
  56. package/dist/models/EmailFolder.d.ts +7 -0
  57. package/dist/models/EmailFolder.d.ts.map +1 -1
  58. package/dist/models/Message.d.ts +7 -0
  59. package/dist/models/Message.d.ts.map +1 -1
  60. package/dist/permissions.d.ts +11 -0
  61. package/dist/permissions.d.ts.map +1 -1
  62. package/dist/providers/email.js +3 -2
  63. package/dist/providers/email.js.map +1 -1
  64. package/dist/providers/slack.js +2 -2
  65. package/dist/providers/twitter.js +2 -2
  66. package/dist/providers.d.ts.map +1 -1
  67. package/dist/recipes.d.ts +1 -1
  68. package/dist/services/MessagingSettingsService.d.ts +86 -0
  69. package/dist/services/MessagingSettingsService.d.ts.map +1 -1
  70. package/dist/services/NotificationOutboxService.d.ts +3 -0
  71. package/dist/services/NotificationOutboxService.d.ts.map +1 -1
  72. package/dist/smrt-knowledge.json +826 -29
  73. package/dist/smrt-knowledge.okf.md +4 -2
  74. package/dist/types.d.ts +10 -1
  75. package/dist/types.d.ts.map +1 -1
  76. package/package.json +21 -16
  77. package/dist/chunks/AccountCollection-RP_hLf6L.js +0 -257
  78. package/dist/chunks/AccountCollection-RP_hLf6L.js.map +0 -1
  79. package/dist/chunks/Email-ChfbMCSF.js.map +0 -1
  80. package/dist/chunks/EmailFolder-XH5eH4Ed.js.map +0 -1
  81. package/dist/chunks/Message-C6P1V5C_.js.map +0 -1
  82. package/dist/chunks/__smrt-register__-CfOb1uCN.js +0 -6
  83. package/dist/chunks/__smrt-register__-CfOb1uCN.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-messages",
5
- "packageVersion": "0.62.6",
5
+ "packageVersion": "0.62.8",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-messages:AccountCollection": {
8
8
  "name": "accountcollection",
@@ -153,7 +153,7 @@
153
153
  ],
154
154
  "schema": {
155
155
  "tableName": "accounts",
156
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
156
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
157
157
  "columns": {
158
158
  "_sync_origin_device_id": {
159
159
  "type": "TEXT"
@@ -220,6 +220,23 @@
220
220
  "notNull": false,
221
221
  "default": true
222
222
  },
223
+ "owner_user_id": {
224
+ "type": "UUID",
225
+ "referenceKind": "crossPackageRef",
226
+ "notNull": false
227
+ },
228
+ "label": {
229
+ "type": "TEXT",
230
+ "notNull": false
231
+ },
232
+ "connection_status": {
233
+ "type": "TEXT",
234
+ "notNull": false
235
+ },
236
+ "status_message": {
237
+ "type": "TEXT",
238
+ "notNull": false
239
+ },
223
240
  "last_sync_at": {
224
241
  "type": "TIMESTAMP",
225
242
  "notNull": false
@@ -241,6 +258,10 @@
241
258
  "notNull": false,
242
259
  "default": 60
243
260
  },
261
+ "sync_cursor": {
262
+ "type": "TEXT",
263
+ "notNull": false
264
+ },
244
265
  "workspace_id": {
245
266
  "type": "TEXT",
246
267
  "notNull": false
@@ -286,6 +307,12 @@
286
307
  "tenant_id",
287
308
  "created_at"
288
309
  ]
310
+ },
311
+ {
312
+ "name": "accounts_owner_user_id_idx",
313
+ "columns": [
314
+ "owner_user_id"
315
+ ]
289
316
  }
290
317
  ],
291
318
  "checks": [
@@ -297,7 +324,7 @@
297
324
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
298
325
  }
299
326
  ],
300
- "version": "b5f42708"
327
+ "version": "ed7f2dff"
301
328
  },
302
329
  "importPath": "@happyvertical/smrt-messages"
303
330
  },
@@ -310,6 +337,14 @@
310
337
  "packageName": "@happyvertical/smrt-messages",
311
338
  "fields": {},
312
339
  "methods": {
340
+ "backfillAccountIds": {
341
+ "name": "backfillAccountIds",
342
+ "async": true,
343
+ "parameters": [],
344
+ "returnType": "Promise<number>",
345
+ "isStatic": false,
346
+ "isPublic": true
347
+ },
313
348
  "getByMessage": {
314
349
  "name": "getByMessage",
315
350
  "async": true,
@@ -544,7 +579,7 @@
544
579
  ],
545
580
  "schema": {
546
581
  "tableName": "attachments",
547
- "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
582
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"account_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
548
583
  "columns": {
549
584
  "_sync_origin_device_id": {
550
585
  "type": "TEXT"
@@ -595,6 +630,18 @@
595
630
  "onUpdate": "CASCADE"
596
631
  }
597
632
  },
633
+ "account_id": {
634
+ "type": "UUID",
635
+ "referenceKind": "foreignKey",
636
+ "notNull": false,
637
+ "unique": false,
638
+ "foreignKey": {
639
+ "table": "accounts",
640
+ "column": "id",
641
+ "onDelete": "NO ACTION",
642
+ "onUpdate": "CASCADE"
643
+ }
644
+ },
598
645
  "filename": {
599
646
  "type": "TEXT",
600
647
  "notNull": false,
@@ -656,9 +703,15 @@
656
703
  "columns": [
657
704
  "message_id"
658
705
  ]
706
+ },
707
+ {
708
+ "name": "attachments_account_id_idx",
709
+ "columns": [
710
+ "account_id"
711
+ ]
659
712
  }
660
713
  ],
661
- "version": "710eb303"
714
+ "version": "3f32531c"
662
715
  },
663
716
  "importPath": "@happyvertical/smrt-messages"
664
717
  },
@@ -1047,7 +1100,7 @@
1047
1100
  ],
1048
1101
  "schema": {
1049
1102
  "tableName": "accounts",
1050
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
1103
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
1051
1104
  "columns": {
1052
1105
  "_sync_origin_device_id": {
1053
1106
  "type": "TEXT"
@@ -1114,6 +1167,23 @@
1114
1167
  "notNull": false,
1115
1168
  "default": true
1116
1169
  },
1170
+ "owner_user_id": {
1171
+ "type": "UUID",
1172
+ "referenceKind": "crossPackageRef",
1173
+ "notNull": false
1174
+ },
1175
+ "label": {
1176
+ "type": "TEXT",
1177
+ "notNull": false
1178
+ },
1179
+ "connection_status": {
1180
+ "type": "TEXT",
1181
+ "notNull": false
1182
+ },
1183
+ "status_message": {
1184
+ "type": "TEXT",
1185
+ "notNull": false
1186
+ },
1117
1187
  "last_sync_at": {
1118
1188
  "type": "TIMESTAMP",
1119
1189
  "notNull": false
@@ -1135,6 +1205,10 @@
1135
1205
  "notNull": false,
1136
1206
  "default": 60
1137
1207
  },
1208
+ "sync_cursor": {
1209
+ "type": "TEXT",
1210
+ "notNull": false
1211
+ },
1138
1212
  "workspace_id": {
1139
1213
  "type": "TEXT",
1140
1214
  "notNull": false
@@ -1180,6 +1254,12 @@
1180
1254
  "tenant_id",
1181
1255
  "created_at"
1182
1256
  ]
1257
+ },
1258
+ {
1259
+ "name": "accounts_owner_user_id_idx",
1260
+ "columns": [
1261
+ "owner_user_id"
1262
+ ]
1183
1263
  }
1184
1264
  ],
1185
1265
  "checks": [
@@ -1191,7 +1271,7 @@
1191
1271
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
1192
1272
  }
1193
1273
  ],
1194
- "version": "b5f42708"
1274
+ "version": "ed7f2dff"
1195
1275
  },
1196
1276
  "importPath": "@happyvertical/smrt-messages"
1197
1277
  },
@@ -1204,6 +1284,14 @@
1204
1284
  "packageName": "@happyvertical/smrt-messages",
1205
1285
  "fields": {},
1206
1286
  "methods": {
1287
+ "backfillAccountIds": {
1288
+ "name": "backfillAccountIds",
1289
+ "async": true,
1290
+ "parameters": [],
1291
+ "returnType": "Promise<number>",
1292
+ "isStatic": false,
1293
+ "isPublic": true
1294
+ },
1207
1295
  "getByMessage": {
1208
1296
  "name": "getByMessage",
1209
1297
  "async": true,
@@ -1465,7 +1553,7 @@
1465
1553
  ],
1466
1554
  "schema": {
1467
1555
  "tableName": "email_attachments",
1468
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
1556
+ "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"account_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
1469
1557
  "columns": {
1470
1558
  "_sync_origin_device_id": {
1471
1559
  "type": "TEXT"
@@ -1516,6 +1604,18 @@
1516
1604
  "onUpdate": "CASCADE"
1517
1605
  }
1518
1606
  },
1607
+ "account_id": {
1608
+ "type": "UUID",
1609
+ "referenceKind": "foreignKey",
1610
+ "notNull": false,
1611
+ "unique": false,
1612
+ "foreignKey": {
1613
+ "table": "accounts",
1614
+ "column": "id",
1615
+ "onDelete": "NO ACTION",
1616
+ "onUpdate": "CASCADE"
1617
+ }
1618
+ },
1519
1619
  "filename": {
1520
1620
  "type": "TEXT",
1521
1621
  "notNull": false,
@@ -1577,9 +1677,15 @@
1577
1677
  "columns": [
1578
1678
  "message_id"
1579
1679
  ]
1680
+ },
1681
+ {
1682
+ "name": "email_attachments_account_id_idx",
1683
+ "columns": [
1684
+ "account_id"
1685
+ ]
1580
1686
  }
1581
1687
  ],
1582
- "version": "4f256284"
1688
+ "version": "ebed0053"
1583
1689
  },
1584
1690
  "importPath": "@happyvertical/smrt-messages"
1585
1691
  },
@@ -2013,7 +2119,7 @@
2013
2119
  ],
2014
2120
  "schema": {
2015
2121
  "tableName": "messages",
2016
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
2122
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
2017
2123
  "columns": {
2018
2124
  "_sync_origin_device_id": {
2019
2125
  "type": "TEXT"
@@ -2188,6 +2294,10 @@
2188
2294
  "type": "TEXT",
2189
2295
  "notNull": false
2190
2296
  },
2297
+ "provider_message_id": {
2298
+ "type": "TEXT",
2299
+ "notNull": false
2300
+ },
2191
2301
  "cc_addresses": {
2192
2302
  "type": "TEXT",
2193
2303
  "notNull": false
@@ -2429,7 +2539,7 @@
2429
2539
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
2430
2540
  }
2431
2541
  ],
2432
- "version": "643e5fb5"
2542
+ "version": "f48614e6"
2433
2543
  },
2434
2544
  "importPath": "@happyvertical/smrt-messages"
2435
2545
  },
@@ -3123,7 +3233,7 @@
3123
3233
  ],
3124
3234
  "schema": {
3125
3235
  "tableName": "messages",
3126
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
3236
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
3127
3237
  "columns": {
3128
3238
  "_sync_origin_device_id": {
3129
3239
  "type": "TEXT"
@@ -3298,6 +3408,10 @@
3298
3408
  "type": "TEXT",
3299
3409
  "notNull": false
3300
3410
  },
3411
+ "provider_message_id": {
3412
+ "type": "TEXT",
3413
+ "notNull": false
3414
+ },
3301
3415
  "cc_addresses": {
3302
3416
  "type": "TEXT",
3303
3417
  "notNull": false
@@ -3539,7 +3653,7 @@
3539
3653
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
3540
3654
  }
3541
3655
  ],
3542
- "version": "7838f80a"
3656
+ "version": "d8da74ce"
3543
3657
  },
3544
3658
  "importPath": "@happyvertical/smrt-messages"
3545
3659
  },
@@ -4763,6 +4877,52 @@
4763
4877
  "default": true,
4764
4878
  "description": "Whether this account is enabled for messaging."
4765
4879
  },
4880
+ "ownerUserId": {
4881
+ "type": "crossPackageRef",
4882
+ "_meta": {
4883
+ "__statedOptions": [
4884
+ "description",
4885
+ "related"
4886
+ ],
4887
+ "description": "The person who owns this account and decides who else may use it."
4888
+ },
4889
+ "required": false,
4890
+ "related": "@happyvertical/smrt-users:User",
4891
+ "description": "The person who owns this account and decides who else may use it."
4892
+ },
4893
+ "label": {
4894
+ "type": "text",
4895
+ "_meta": {
4896
+ "__statedOptions": [
4897
+ "description"
4898
+ ],
4899
+ "description": "A short name shown beside this account, such as Support or Personal."
4900
+ },
4901
+ "required": false,
4902
+ "description": "A short name shown beside this account, such as Support or Personal."
4903
+ },
4904
+ "connectionStatus": {
4905
+ "type": "text",
4906
+ "_meta": {
4907
+ "__statedOptions": [
4908
+ "description"
4909
+ ],
4910
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
4911
+ },
4912
+ "required": false,
4913
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
4914
+ },
4915
+ "statusMessage": {
4916
+ "type": "text",
4917
+ "_meta": {
4918
+ "__statedOptions": [
4919
+ "description"
4920
+ ],
4921
+ "description": "Why the account needs attention, in plain words."
4922
+ },
4923
+ "required": false,
4924
+ "description": "Why the account needs attention, in plain words."
4925
+ },
4766
4926
  "lastSyncAt": {
4767
4927
  "type": "datetime",
4768
4928
  "_meta": {
@@ -4867,6 +5027,28 @@
4867
5027
  "isStatic": false,
4868
5028
  "isPublic": true
4869
5029
  },
5030
+ "markNeedsReconnect": {
5031
+ "name": "markNeedsReconnect",
5032
+ "async": true,
5033
+ "parameters": [
5034
+ {
5035
+ "name": "reason",
5036
+ "type": "string",
5037
+ "optional": false
5038
+ }
5039
+ ],
5040
+ "returnType": "Promise<void>",
5041
+ "isStatic": false,
5042
+ "isPublic": true
5043
+ },
5044
+ "markConnected": {
5045
+ "name": "markConnected",
5046
+ "async": true,
5047
+ "parameters": [],
5048
+ "returnType": "Promise<void>",
5049
+ "isStatic": false,
5050
+ "isPublic": true
5051
+ },
4870
5052
  "activate": {
4871
5053
  "name": "activate",
4872
5054
  "async": true,
@@ -4905,6 +5087,14 @@
4905
5087
  "isStatic": false,
4906
5088
  "isPublic": true
4907
5089
  },
5090
+ "removeCredentials": {
5091
+ "name": "removeCredentials",
5092
+ "async": true,
5093
+ "parameters": [],
5094
+ "returnType": "Promise<void>",
5095
+ "isStatic": false,
5096
+ "isPublic": true
5097
+ },
4908
5098
  "createSender": {
4909
5099
  "name": "createSender",
4910
5100
  "async": true,
@@ -4965,7 +5155,7 @@
4965
5155
  ],
4966
5156
  "schema": {
4967
5157
  "tableName": "accounts",
4968
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
5158
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
4969
5159
  "columns": {
4970
5160
  "_sync_origin_device_id": {
4971
5161
  "type": "TEXT"
@@ -5032,6 +5222,23 @@
5032
5222
  "notNull": false,
5033
5223
  "default": true
5034
5224
  },
5225
+ "owner_user_id": {
5226
+ "type": "UUID",
5227
+ "referenceKind": "crossPackageRef",
5228
+ "notNull": false
5229
+ },
5230
+ "label": {
5231
+ "type": "TEXT",
5232
+ "notNull": false
5233
+ },
5234
+ "connection_status": {
5235
+ "type": "TEXT",
5236
+ "notNull": false
5237
+ },
5238
+ "status_message": {
5239
+ "type": "TEXT",
5240
+ "notNull": false
5241
+ },
5035
5242
  "last_sync_at": {
5036
5243
  "type": "TIMESTAMP",
5037
5244
  "notNull": false
@@ -5053,6 +5260,10 @@
5053
5260
  "notNull": false,
5054
5261
  "default": 60
5055
5262
  },
5263
+ "sync_cursor": {
5264
+ "type": "TEXT",
5265
+ "notNull": false
5266
+ },
5056
5267
  "workspace_id": {
5057
5268
  "type": "TEXT",
5058
5269
  "notNull": false
@@ -5098,6 +5309,12 @@
5098
5309
  "tenant_id",
5099
5310
  "created_at"
5100
5311
  ]
5312
+ },
5313
+ {
5314
+ "name": "accounts_owner_user_id_idx",
5315
+ "columns": [
5316
+ "owner_user_id"
5317
+ ]
5101
5318
  }
5102
5319
  ],
5103
5320
  "checks": [
@@ -5109,7 +5326,7 @@
5109
5326
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
5110
5327
  }
5111
5328
  ],
5112
- "version": "b5f42708"
5329
+ "version": "ed7f2dff"
5113
5330
  },
5114
5331
  "importPath": "@happyvertical/smrt-messages"
5115
5332
  },
@@ -5156,6 +5373,16 @@
5156
5373
  "required": false,
5157
5374
  "related": "Message"
5158
5375
  },
5376
+ "accountId": {
5377
+ "type": "foreignKey",
5378
+ "_meta": {
5379
+ "__statedOptions": [
5380
+ "related"
5381
+ ]
5382
+ },
5383
+ "required": false,
5384
+ "related": "Account"
5385
+ },
5159
5386
  "filename": {
5160
5387
  "type": "text",
5161
5388
  "_meta": {
@@ -5225,6 +5452,22 @@
5225
5452
  }
5226
5453
  },
5227
5454
  "methods": {
5455
+ "loadFromId": {
5456
+ "name": "loadFromId",
5457
+ "async": true,
5458
+ "parameters": [],
5459
+ "returnType": "any",
5460
+ "isStatic": false,
5461
+ "isPublic": true
5462
+ },
5463
+ "loadFromSlug": {
5464
+ "name": "loadFromSlug",
5465
+ "async": true,
5466
+ "parameters": [],
5467
+ "returnType": "any",
5468
+ "isStatic": false,
5469
+ "isPublic": true
5470
+ },
5228
5471
  "getMessage": {
5229
5472
  "name": "getMessage",
5230
5473
  "async": true,
@@ -5329,7 +5572,7 @@
5329
5572
  ],
5330
5573
  "schema": {
5331
5574
  "tableName": "attachments",
5332
- "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
5575
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"account_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
5333
5576
  "columns": {
5334
5577
  "_sync_origin_device_id": {
5335
5578
  "type": "TEXT"
@@ -5380,6 +5623,18 @@
5380
5623
  "onUpdate": "CASCADE"
5381
5624
  }
5382
5625
  },
5626
+ "account_id": {
5627
+ "type": "UUID",
5628
+ "referenceKind": "foreignKey",
5629
+ "notNull": false,
5630
+ "unique": false,
5631
+ "foreignKey": {
5632
+ "table": "accounts",
5633
+ "column": "id",
5634
+ "onDelete": "NO ACTION",
5635
+ "onUpdate": "CASCADE"
5636
+ }
5637
+ },
5383
5638
  "filename": {
5384
5639
  "type": "TEXT",
5385
5640
  "notNull": false,
@@ -5441,9 +5696,15 @@
5441
5696
  "columns": [
5442
5697
  "message_id"
5443
5698
  ]
5699
+ },
5700
+ {
5701
+ "name": "attachments_account_id_idx",
5702
+ "columns": [
5703
+ "account_id"
5704
+ ]
5444
5705
  }
5445
5706
  ],
5446
- "version": "710eb303"
5707
+ "version": "3f32531c"
5447
5708
  },
5448
5709
  "importPath": "@happyvertical/smrt-messages"
5449
5710
  },
@@ -6024,6 +6285,17 @@
6024
6285
  "required": false,
6025
6286
  "description": "The sender-assigned reference of the email being replied to."
6026
6287
  },
6288
+ "providerMessageId": {
6289
+ "type": "text",
6290
+ "_meta": {
6291
+ "__statedOptions": [
6292
+ "description"
6293
+ ],
6294
+ "description": "The mail server's own id for this email, used to keep mailbox sync from storing it twice."
6295
+ },
6296
+ "required": false,
6297
+ "description": "The mail server's own id for this email, used to keep mailbox sync from storing it twice."
6298
+ },
6027
6299
  "ccAddresses": {
6028
6300
  "type": "text",
6029
6301
  "_meta": {
@@ -6308,6 +6580,22 @@
6308
6580
  "isStatic": false,
6309
6581
  "isPublic": true
6310
6582
  },
6583
+ "loadFromId": {
6584
+ "name": "loadFromId",
6585
+ "async": true,
6586
+ "parameters": [],
6587
+ "returnType": "any",
6588
+ "isStatic": false,
6589
+ "isPublic": true
6590
+ },
6591
+ "loadFromSlug": {
6592
+ "name": "loadFromSlug",
6593
+ "async": true,
6594
+ "parameters": [],
6595
+ "returnType": "any",
6596
+ "isStatic": false,
6597
+ "isPublic": true
6598
+ },
6311
6599
  "getAccount": {
6312
6600
  "name": "getAccount",
6313
6601
  "async": true,
@@ -6598,7 +6886,7 @@
6598
6886
  ],
6599
6887
  "schema": {
6600
6888
  "tableName": "messages",
6601
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
6889
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
6602
6890
  "columns": {
6603
6891
  "_sync_origin_device_id": {
6604
6892
  "type": "TEXT"
@@ -6773,6 +7061,10 @@
6773
7061
  "type": "TEXT",
6774
7062
  "notNull": false
6775
7063
  },
7064
+ "provider_message_id": {
7065
+ "type": "TEXT",
7066
+ "notNull": false
7067
+ },
6776
7068
  "cc_addresses": {
6777
7069
  "type": "TEXT",
6778
7070
  "notNull": false
@@ -7014,7 +7306,7 @@
7014
7306
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
7015
7307
  }
7016
7308
  ],
7017
- "version": "643e5fb5"
7309
+ "version": "f48614e6"
7018
7310
  },
7019
7311
  "importPath": "@happyvertical/smrt-messages"
7020
7312
  },
@@ -7122,30 +7414,76 @@
7122
7414
  "default": true,
7123
7415
  "description": "Whether this account is enabled for messaging."
7124
7416
  },
7125
- "lastSyncAt": {
7126
- "type": "datetime",
7417
+ "ownerUserId": {
7418
+ "type": "crossPackageRef",
7127
7419
  "_meta": {
7128
7420
  "__statedOptions": [
7129
- "description"
7421
+ "description",
7422
+ "related"
7130
7423
  ],
7131
- "description": "When this account last checked for new messages."
7424
+ "description": "The person who owns this account and decides who else may use it."
7132
7425
  },
7133
7426
  "required": false,
7134
- "description": "When this account last checked for new messages."
7427
+ "related": "@happyvertical/smrt-users:User",
7428
+ "description": "The person who owns this account and decides who else may use it."
7135
7429
  },
7136
- "settings": {
7430
+ "label": {
7137
7431
  "type": "text",
7138
7432
  "_meta": {
7139
7433
  "__statedOptions": [
7140
- "sensitive",
7141
- "readonly"
7434
+ "description"
7142
7435
  ],
7143
- "sensitive": true,
7144
- "readonly": true
7436
+ "description": "A short name shown beside this account, such as Support or Personal."
7145
7437
  },
7146
7438
  "required": false,
7147
- "sensitive": true,
7148
- "readonly": true
7439
+ "description": "A short name shown beside this account, such as Support or Personal."
7440
+ },
7441
+ "connectionStatus": {
7442
+ "type": "text",
7443
+ "_meta": {
7444
+ "__statedOptions": [
7445
+ "description"
7446
+ ],
7447
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
7448
+ },
7449
+ "required": false,
7450
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
7451
+ },
7452
+ "statusMessage": {
7453
+ "type": "text",
7454
+ "_meta": {
7455
+ "__statedOptions": [
7456
+ "description"
7457
+ ],
7458
+ "description": "Why the account needs attention, in plain words."
7459
+ },
7460
+ "required": false,
7461
+ "description": "Why the account needs attention, in plain words."
7462
+ },
7463
+ "lastSyncAt": {
7464
+ "type": "datetime",
7465
+ "_meta": {
7466
+ "__statedOptions": [
7467
+ "description"
7468
+ ],
7469
+ "description": "When this account last checked for new messages."
7470
+ },
7471
+ "required": false,
7472
+ "description": "When this account last checked for new messages."
7473
+ },
7474
+ "settings": {
7475
+ "type": "text",
7476
+ "_meta": {
7477
+ "__statedOptions": [
7478
+ "sensitive",
7479
+ "readonly"
7480
+ ],
7481
+ "sensitive": true,
7482
+ "readonly": true
7483
+ },
7484
+ "required": false,
7485
+ "sensitive": true,
7486
+ "readonly": true
7149
7487
  },
7150
7488
  "configuration": {
7151
7489
  "type": "text",
@@ -7203,6 +7541,23 @@
7203
7541
  "required": true,
7204
7542
  "default": 60,
7205
7543
  "description": "The time in minutes between scheduled mailbox checks."
7544
+ },
7545
+ "syncCursor": {
7546
+ "type": "text",
7547
+ "_meta": {
7548
+ "__statedOptions": [
7549
+ "sensitive",
7550
+ "readonly",
7551
+ "description"
7552
+ ],
7553
+ "description": "Where the next mailbox check resumes.",
7554
+ "sensitive": true,
7555
+ "readonly": true
7556
+ },
7557
+ "required": false,
7558
+ "description": "Where the next mailbox check resumes.",
7559
+ "sensitive": true,
7560
+ "readonly": true
7206
7561
  }
7207
7562
  },
7208
7563
  "methods": {
@@ -7250,6 +7605,28 @@
7250
7605
  "isStatic": false,
7251
7606
  "isPublic": true
7252
7607
  },
7608
+ "markNeedsReconnect": {
7609
+ "name": "markNeedsReconnect",
7610
+ "async": true,
7611
+ "parameters": [
7612
+ {
7613
+ "name": "reason",
7614
+ "type": "string",
7615
+ "optional": false
7616
+ }
7617
+ ],
7618
+ "returnType": "Promise<void>",
7619
+ "isStatic": false,
7620
+ "isPublic": true
7621
+ },
7622
+ "markConnected": {
7623
+ "name": "markConnected",
7624
+ "async": true,
7625
+ "parameters": [],
7626
+ "returnType": "Promise<void>",
7627
+ "isStatic": false,
7628
+ "isPublic": true
7629
+ },
7253
7630
  "activate": {
7254
7631
  "name": "activate",
7255
7632
  "async": true,
@@ -7288,6 +7665,14 @@
7288
7665
  "isStatic": false,
7289
7666
  "isPublic": true
7290
7667
  },
7668
+ "removeCredentials": {
7669
+ "name": "removeCredentials",
7670
+ "async": true,
7671
+ "parameters": [],
7672
+ "returnType": "Promise<void>",
7673
+ "isStatic": false,
7674
+ "isPublic": true
7675
+ },
7291
7676
  "createSender": {
7292
7677
  "name": "createSender",
7293
7678
  "async": true,
@@ -7304,6 +7689,14 @@
7304
7689
  "isStatic": false,
7305
7690
  "isPublic": true
7306
7691
  },
7692
+ "childOptions": {
7693
+ "name": "childOptions",
7694
+ "async": false,
7695
+ "parameters": [],
7696
+ "returnType": "Record<string, unknown>",
7697
+ "isStatic": false,
7698
+ "isPublic": true
7699
+ },
7307
7700
  "createClient": {
7308
7701
  "name": "createClient",
7309
7702
  "async": true,
@@ -7354,6 +7747,34 @@
7354
7747
  "isStatic": false,
7355
7748
  "isPublic": true
7356
7749
  },
7750
+ "syncChanges": {
7751
+ "name": "syncChanges",
7752
+ "async": true,
7753
+ "parameters": [
7754
+ {
7755
+ "name": "options",
7756
+ "type": "MailSyncOptions",
7757
+ "optional": true
7758
+ }
7759
+ ],
7760
+ "returnType": "Promise<MailSyncResult>",
7761
+ "isStatic": false,
7762
+ "isPublic": true
7763
+ },
7764
+ "fetchThread": {
7765
+ "name": "fetchThread",
7766
+ "async": true,
7767
+ "parameters": [
7768
+ {
7769
+ "name": "threadId",
7770
+ "type": "string",
7771
+ "optional": false
7772
+ }
7773
+ ],
7774
+ "returnType": "any",
7775
+ "isStatic": false,
7776
+ "isPublic": true
7777
+ },
7357
7778
  "getFolders": {
7358
7779
  "name": "getFolders",
7359
7780
  "async": true,
@@ -7447,7 +7868,7 @@
7447
7868
  ],
7448
7869
  "schema": {
7449
7870
  "tableName": "accounts",
7450
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
7871
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
7451
7872
  "columns": {
7452
7873
  "_sync_origin_device_id": {
7453
7874
  "type": "TEXT"
@@ -7514,6 +7935,23 @@
7514
7935
  "notNull": false,
7515
7936
  "default": true
7516
7937
  },
7938
+ "owner_user_id": {
7939
+ "type": "UUID",
7940
+ "referenceKind": "crossPackageRef",
7941
+ "notNull": false
7942
+ },
7943
+ "label": {
7944
+ "type": "TEXT",
7945
+ "notNull": false
7946
+ },
7947
+ "connection_status": {
7948
+ "type": "TEXT",
7949
+ "notNull": false
7950
+ },
7951
+ "status_message": {
7952
+ "type": "TEXT",
7953
+ "notNull": false
7954
+ },
7517
7955
  "last_sync_at": {
7518
7956
  "type": "TIMESTAMP",
7519
7957
  "notNull": false
@@ -7535,6 +7973,10 @@
7535
7973
  "notNull": false,
7536
7974
  "default": 60
7537
7975
  },
7976
+ "sync_cursor": {
7977
+ "type": "TEXT",
7978
+ "notNull": false
7979
+ },
7538
7980
  "workspace_id": {
7539
7981
  "type": "TEXT",
7540
7982
  "notNull": false
@@ -7580,6 +8022,12 @@
7580
8022
  "tenant_id",
7581
8023
  "created_at"
7582
8024
  ]
8025
+ },
8026
+ {
8027
+ "name": "accounts_owner_user_id_idx",
8028
+ "columns": [
8029
+ "owner_user_id"
8030
+ ]
7583
8031
  }
7584
8032
  ],
7585
8033
  "checks": [
@@ -7591,7 +8039,7 @@
7591
8039
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
7592
8040
  }
7593
8041
  ],
7594
- "version": "b5f42708"
8042
+ "version": "ed7f2dff"
7595
8043
  },
7596
8044
  "importPath": "@happyvertical/smrt-messages"
7597
8045
  },
@@ -7638,6 +8086,16 @@
7638
8086
  "required": false,
7639
8087
  "related": "Message"
7640
8088
  },
8089
+ "accountId": {
8090
+ "type": "foreignKey",
8091
+ "_meta": {
8092
+ "__statedOptions": [
8093
+ "related"
8094
+ ]
8095
+ },
8096
+ "required": false,
8097
+ "related": "Account"
8098
+ },
7641
8099
  "filename": {
7642
8100
  "type": "text",
7643
8101
  "_meta": {
@@ -7707,6 +8165,22 @@
7707
8165
  }
7708
8166
  },
7709
8167
  "methods": {
8168
+ "loadFromId": {
8169
+ "name": "loadFromId",
8170
+ "async": true,
8171
+ "parameters": [],
8172
+ "returnType": "any",
8173
+ "isStatic": false,
8174
+ "isPublic": true
8175
+ },
8176
+ "loadFromSlug": {
8177
+ "name": "loadFromSlug",
8178
+ "async": true,
8179
+ "parameters": [],
8180
+ "returnType": "any",
8181
+ "isStatic": false,
8182
+ "isPublic": true
8183
+ },
7710
8184
  "getMessage": {
7711
8185
  "name": "getMessage",
7712
8186
  "async": true,
@@ -7816,7 +8290,7 @@
7816
8290
  ],
7817
8291
  "schema": {
7818
8292
  "tableName": "email_attachments",
7819
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
8293
+ "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"message_id\" UUID,\n \"account_id\" UUID,\n \"filename\" TEXT,\n \"content_type\" TEXT,\n \"size\" INTEGER NOT NULL DEFAULT 0,\n \"content_id\" TEXT,\n \"content_disposition\" TEXT DEFAULT 'attachment',\n \"file_path\" TEXT,\n \"source_url\" TEXT\n);",
7820
8294
  "columns": {
7821
8295
  "_sync_origin_device_id": {
7822
8296
  "type": "TEXT"
@@ -7867,6 +8341,18 @@
7867
8341
  "onUpdate": "CASCADE"
7868
8342
  }
7869
8343
  },
8344
+ "account_id": {
8345
+ "type": "UUID",
8346
+ "referenceKind": "foreignKey",
8347
+ "notNull": false,
8348
+ "unique": false,
8349
+ "foreignKey": {
8350
+ "table": "accounts",
8351
+ "column": "id",
8352
+ "onDelete": "NO ACTION",
8353
+ "onUpdate": "CASCADE"
8354
+ }
8355
+ },
7870
8356
  "filename": {
7871
8357
  "type": "TEXT",
7872
8358
  "notNull": false,
@@ -7928,9 +8414,15 @@
7928
8414
  "columns": [
7929
8415
  "message_id"
7930
8416
  ]
8417
+ },
8418
+ {
8419
+ "name": "email_attachments_account_id_idx",
8420
+ "columns": [
8421
+ "account_id"
8422
+ ]
7931
8423
  }
7932
8424
  ],
7933
- "version": "4f256284"
8425
+ "version": "ebed0053"
7934
8426
  },
7935
8427
  "importPath": "@happyvertical/smrt-messages"
7936
8428
  },
@@ -8051,6 +8543,22 @@
8051
8543
  }
8052
8544
  },
8053
8545
  "methods": {
8546
+ "loadFromId": {
8547
+ "name": "loadFromId",
8548
+ "async": true,
8549
+ "parameters": [],
8550
+ "returnType": "any",
8551
+ "isStatic": false,
8552
+ "isPublic": true
8553
+ },
8554
+ "loadFromSlug": {
8555
+ "name": "loadFromSlug",
8556
+ "async": true,
8557
+ "parameters": [],
8558
+ "returnType": "any",
8559
+ "isStatic": false,
8560
+ "isPublic": true
8561
+ },
8054
8562
  "getAccount": {
8055
8563
  "name": "getAccount",
8056
8564
  "async": true,
@@ -8813,6 +9321,22 @@
8813
9321
  "isStatic": false,
8814
9322
  "isPublic": true
8815
9323
  },
9324
+ "loadFromId": {
9325
+ "name": "loadFromId",
9326
+ "async": true,
9327
+ "parameters": [],
9328
+ "returnType": "any",
9329
+ "isStatic": false,
9330
+ "isPublic": true
9331
+ },
9332
+ "loadFromSlug": {
9333
+ "name": "loadFromSlug",
9334
+ "async": true,
9335
+ "parameters": [],
9336
+ "returnType": "any",
9337
+ "isStatic": false,
9338
+ "isPublic": true
9339
+ },
8816
9340
  "getAccount": {
8817
9341
  "name": "getAccount",
8818
9342
  "async": true,
@@ -8985,7 +9509,7 @@
8985
9509
  ],
8986
9510
  "schema": {
8987
9511
  "tableName": "messages",
8988
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
9512
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
8989
9513
  "columns": {
8990
9514
  "_sync_origin_device_id": {
8991
9515
  "type": "TEXT"
@@ -9160,6 +9684,10 @@
9160
9684
  "type": "TEXT",
9161
9685
  "notNull": false
9162
9686
  },
9687
+ "provider_message_id": {
9688
+ "type": "TEXT",
9689
+ "notNull": false
9690
+ },
9163
9691
  "cc_addresses": {
9164
9692
  "type": "TEXT",
9165
9693
  "notNull": false
@@ -9401,7 +9929,7 @@
9401
9929
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
9402
9930
  }
9403
9931
  ],
9404
- "version": "7838f80a"
9932
+ "version": "d8da74ce"
9405
9933
  },
9406
9934
  "importPath": "@happyvertical/smrt-messages"
9407
9935
  },
@@ -11109,6 +11637,52 @@
11109
11637
  "default": true,
11110
11638
  "description": "Whether this account is enabled for messaging."
11111
11639
  },
11640
+ "ownerUserId": {
11641
+ "type": "crossPackageRef",
11642
+ "_meta": {
11643
+ "__statedOptions": [
11644
+ "description",
11645
+ "related"
11646
+ ],
11647
+ "description": "The person who owns this account and decides who else may use it."
11648
+ },
11649
+ "required": false,
11650
+ "related": "@happyvertical/smrt-users:User",
11651
+ "description": "The person who owns this account and decides who else may use it."
11652
+ },
11653
+ "label": {
11654
+ "type": "text",
11655
+ "_meta": {
11656
+ "__statedOptions": [
11657
+ "description"
11658
+ ],
11659
+ "description": "A short name shown beside this account, such as Support or Personal."
11660
+ },
11661
+ "required": false,
11662
+ "description": "A short name shown beside this account, such as Support or Personal."
11663
+ },
11664
+ "connectionStatus": {
11665
+ "type": "text",
11666
+ "_meta": {
11667
+ "__statedOptions": [
11668
+ "description"
11669
+ ],
11670
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
11671
+ },
11672
+ "required": false,
11673
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
11674
+ },
11675
+ "statusMessage": {
11676
+ "type": "text",
11677
+ "_meta": {
11678
+ "__statedOptions": [
11679
+ "description"
11680
+ ],
11681
+ "description": "Why the account needs attention, in plain words."
11682
+ },
11683
+ "required": false,
11684
+ "description": "Why the account needs attention, in plain words."
11685
+ },
11112
11686
  "lastSyncAt": {
11113
11687
  "type": "datetime",
11114
11688
  "_meta": {
@@ -11246,6 +11820,28 @@
11246
11820
  "isStatic": false,
11247
11821
  "isPublic": true
11248
11822
  },
11823
+ "markNeedsReconnect": {
11824
+ "name": "markNeedsReconnect",
11825
+ "async": true,
11826
+ "parameters": [
11827
+ {
11828
+ "name": "reason",
11829
+ "type": "string",
11830
+ "optional": false
11831
+ }
11832
+ ],
11833
+ "returnType": "Promise<void>",
11834
+ "isStatic": false,
11835
+ "isPublic": true
11836
+ },
11837
+ "markConnected": {
11838
+ "name": "markConnected",
11839
+ "async": true,
11840
+ "parameters": [],
11841
+ "returnType": "Promise<void>",
11842
+ "isStatic": false,
11843
+ "isPublic": true
11844
+ },
11249
11845
  "activate": {
11250
11846
  "name": "activate",
11251
11847
  "async": true,
@@ -11284,6 +11880,14 @@
11284
11880
  "isStatic": false,
11285
11881
  "isPublic": true
11286
11882
  },
11883
+ "removeCredentials": {
11884
+ "name": "removeCredentials",
11885
+ "async": true,
11886
+ "parameters": [],
11887
+ "returnType": "Promise<void>",
11888
+ "isStatic": false,
11889
+ "isPublic": true
11890
+ },
11287
11891
  "createSender": {
11288
11892
  "name": "createSender",
11289
11893
  "async": true,
@@ -11336,7 +11940,7 @@
11336
11940
  ],
11337
11941
  "schema": {
11338
11942
  "tableName": "accounts",
11339
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
11943
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
11340
11944
  "columns": {
11341
11945
  "_sync_origin_device_id": {
11342
11946
  "type": "TEXT"
@@ -11403,8 +12007,25 @@
11403
12007
  "notNull": false,
11404
12008
  "default": true
11405
12009
  },
11406
- "last_sync_at": {
11407
- "type": "TIMESTAMP",
12010
+ "owner_user_id": {
12011
+ "type": "UUID",
12012
+ "referenceKind": "crossPackageRef",
12013
+ "notNull": false
12014
+ },
12015
+ "label": {
12016
+ "type": "TEXT",
12017
+ "notNull": false
12018
+ },
12019
+ "connection_status": {
12020
+ "type": "TEXT",
12021
+ "notNull": false
12022
+ },
12023
+ "status_message": {
12024
+ "type": "TEXT",
12025
+ "notNull": false
12026
+ },
12027
+ "last_sync_at": {
12028
+ "type": "TIMESTAMP",
11408
12029
  "notNull": false
11409
12030
  },
11410
12031
  "settings": {
@@ -11424,6 +12045,10 @@
11424
12045
  "notNull": false,
11425
12046
  "default": 60
11426
12047
  },
12048
+ "sync_cursor": {
12049
+ "type": "TEXT",
12050
+ "notNull": false
12051
+ },
11427
12052
  "workspace_id": {
11428
12053
  "type": "TEXT",
11429
12054
  "notNull": false
@@ -11469,6 +12094,12 @@
11469
12094
  "tenant_id",
11470
12095
  "created_at"
11471
12096
  ]
12097
+ },
12098
+ {
12099
+ "name": "accounts_owner_user_id_idx",
12100
+ "columns": [
12101
+ "owner_user_id"
12102
+ ]
11472
12103
  }
11473
12104
  ],
11474
12105
  "checks": [
@@ -11480,7 +12111,7 @@
11480
12111
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
11481
12112
  }
11482
12113
  ],
11483
- "version": "b5f42708"
12114
+ "version": "ed7f2dff"
11484
12115
  },
11485
12116
  "importPath": "@happyvertical/smrt-messages"
11486
12117
  },
@@ -12054,6 +12685,22 @@
12054
12685
  "isStatic": false,
12055
12686
  "isPublic": true
12056
12687
  },
12688
+ "loadFromId": {
12689
+ "name": "loadFromId",
12690
+ "async": true,
12691
+ "parameters": [],
12692
+ "returnType": "any",
12693
+ "isStatic": false,
12694
+ "isPublic": true
12695
+ },
12696
+ "loadFromSlug": {
12697
+ "name": "loadFromSlug",
12698
+ "async": true,
12699
+ "parameters": [],
12700
+ "returnType": "any",
12701
+ "isStatic": false,
12702
+ "isPublic": true
12703
+ },
12057
12704
  "getAccount": {
12058
12705
  "name": "getAccount",
12059
12706
  "async": true,
@@ -12261,7 +12908,7 @@
12261
12908
  ],
12262
12909
  "schema": {
12263
12910
  "tableName": "messages",
12264
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
12911
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
12265
12912
  "columns": {
12266
12913
  "_sync_origin_device_id": {
12267
12914
  "type": "TEXT"
@@ -12436,6 +13083,10 @@
12436
13083
  "type": "TEXT",
12437
13084
  "notNull": false
12438
13085
  },
13086
+ "provider_message_id": {
13087
+ "type": "TEXT",
13088
+ "notNull": false
13089
+ },
12439
13090
  "cc_addresses": {
12440
13091
  "type": "TEXT",
12441
13092
  "notNull": false
@@ -12677,7 +13328,7 @@
12677
13328
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
12678
13329
  }
12679
13330
  ],
12680
- "version": "362ea703"
13331
+ "version": "63b1a1ae"
12681
13332
  },
12682
13333
  "importPath": "@happyvertical/smrt-messages"
12683
13334
  },
@@ -12785,6 +13436,52 @@
12785
13436
  "default": true,
12786
13437
  "description": "Whether this account is enabled for messaging."
12787
13438
  },
13439
+ "ownerUserId": {
13440
+ "type": "crossPackageRef",
13441
+ "_meta": {
13442
+ "__statedOptions": [
13443
+ "description",
13444
+ "related"
13445
+ ],
13446
+ "description": "The person who owns this account and decides who else may use it."
13447
+ },
13448
+ "required": false,
13449
+ "related": "@happyvertical/smrt-users:User",
13450
+ "description": "The person who owns this account and decides who else may use it."
13451
+ },
13452
+ "label": {
13453
+ "type": "text",
13454
+ "_meta": {
13455
+ "__statedOptions": [
13456
+ "description"
13457
+ ],
13458
+ "description": "A short name shown beside this account, such as Support or Personal."
13459
+ },
13460
+ "required": false,
13461
+ "description": "A short name shown beside this account, such as Support or Personal."
13462
+ },
13463
+ "connectionStatus": {
13464
+ "type": "text",
13465
+ "_meta": {
13466
+ "__statedOptions": [
13467
+ "description"
13468
+ ],
13469
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
13470
+ },
13471
+ "required": false,
13472
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
13473
+ },
13474
+ "statusMessage": {
13475
+ "type": "text",
13476
+ "_meta": {
13477
+ "__statedOptions": [
13478
+ "description"
13479
+ ],
13480
+ "description": "Why the account needs attention, in plain words."
13481
+ },
13482
+ "required": false,
13483
+ "description": "Why the account needs attention, in plain words."
13484
+ },
12788
13485
  "lastSyncAt": {
12789
13486
  "type": "datetime",
12790
13487
  "_meta": {
@@ -12889,6 +13586,28 @@
12889
13586
  "isStatic": false,
12890
13587
  "isPublic": true
12891
13588
  },
13589
+ "markNeedsReconnect": {
13590
+ "name": "markNeedsReconnect",
13591
+ "async": true,
13592
+ "parameters": [
13593
+ {
13594
+ "name": "reason",
13595
+ "type": "string",
13596
+ "optional": false
13597
+ }
13598
+ ],
13599
+ "returnType": "Promise<void>",
13600
+ "isStatic": false,
13601
+ "isPublic": true
13602
+ },
13603
+ "markConnected": {
13604
+ "name": "markConnected",
13605
+ "async": true,
13606
+ "parameters": [],
13607
+ "returnType": "Promise<void>",
13608
+ "isStatic": false,
13609
+ "isPublic": true
13610
+ },
12892
13611
  "activate": {
12893
13612
  "name": "activate",
12894
13613
  "async": true,
@@ -12927,6 +13646,14 @@
12927
13646
  "isStatic": false,
12928
13647
  "isPublic": true
12929
13648
  },
13649
+ "removeCredentials": {
13650
+ "name": "removeCredentials",
13651
+ "async": true,
13652
+ "parameters": [],
13653
+ "returnType": "Promise<void>",
13654
+ "isStatic": false,
13655
+ "isPublic": true
13656
+ },
12930
13657
  "createSender": {
12931
13658
  "name": "createSender",
12932
13659
  "async": true,
@@ -12979,7 +13706,7 @@
12979
13706
  ],
12980
13707
  "schema": {
12981
13708
  "tableName": "accounts",
12982
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
13709
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
12983
13710
  "columns": {
12984
13711
  "_sync_origin_device_id": {
12985
13712
  "type": "TEXT"
@@ -13046,6 +13773,23 @@
13046
13773
  "notNull": false,
13047
13774
  "default": true
13048
13775
  },
13776
+ "owner_user_id": {
13777
+ "type": "UUID",
13778
+ "referenceKind": "crossPackageRef",
13779
+ "notNull": false
13780
+ },
13781
+ "label": {
13782
+ "type": "TEXT",
13783
+ "notNull": false
13784
+ },
13785
+ "connection_status": {
13786
+ "type": "TEXT",
13787
+ "notNull": false
13788
+ },
13789
+ "status_message": {
13790
+ "type": "TEXT",
13791
+ "notNull": false
13792
+ },
13049
13793
  "last_sync_at": {
13050
13794
  "type": "TIMESTAMP",
13051
13795
  "notNull": false
@@ -13067,6 +13811,10 @@
13067
13811
  "notNull": false,
13068
13812
  "default": 60
13069
13813
  },
13814
+ "sync_cursor": {
13815
+ "type": "TEXT",
13816
+ "notNull": false
13817
+ },
13070
13818
  "workspace_id": {
13071
13819
  "type": "TEXT",
13072
13820
  "notNull": false
@@ -13112,6 +13860,12 @@
13112
13860
  "tenant_id",
13113
13861
  "created_at"
13114
13862
  ]
13863
+ },
13864
+ {
13865
+ "name": "accounts_owner_user_id_idx",
13866
+ "columns": [
13867
+ "owner_user_id"
13868
+ ]
13115
13869
  }
13116
13870
  ],
13117
13871
  "checks": [
@@ -13123,7 +13877,7 @@
13123
13877
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
13124
13878
  }
13125
13879
  ],
13126
- "version": "b5f42708"
13880
+ "version": "ed7f2dff"
13127
13881
  },
13128
13882
  "importPath": "@happyvertical/smrt-messages"
13129
13883
  },
@@ -13685,6 +14439,22 @@
13685
14439
  "isStatic": false,
13686
14440
  "isPublic": true
13687
14441
  },
14442
+ "loadFromId": {
14443
+ "name": "loadFromId",
14444
+ "async": true,
14445
+ "parameters": [],
14446
+ "returnType": "any",
14447
+ "isStatic": false,
14448
+ "isPublic": true
14449
+ },
14450
+ "loadFromSlug": {
14451
+ "name": "loadFromSlug",
14452
+ "async": true,
14453
+ "parameters": [],
14454
+ "returnType": "any",
14455
+ "isStatic": false,
14456
+ "isPublic": true
14457
+ },
13688
14458
  "getAccount": {
13689
14459
  "name": "getAccount",
13690
14460
  "async": true,
@@ -13912,7 +14682,7 @@
13912
14682
  ],
13913
14683
  "schema": {
13914
14684
  "tableName": "messages",
13915
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
14685
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
13916
14686
  "columns": {
13917
14687
  "_sync_origin_device_id": {
13918
14688
  "type": "TEXT"
@@ -14087,6 +14857,10 @@
14087
14857
  "type": "TEXT",
14088
14858
  "notNull": false
14089
14859
  },
14860
+ "provider_message_id": {
14861
+ "type": "TEXT",
14862
+ "notNull": false
14863
+ },
14090
14864
  "cc_addresses": {
14091
14865
  "type": "TEXT",
14092
14866
  "notNull": false
@@ -14328,7 +15102,7 @@
14328
15102
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
14329
15103
  }
14330
15104
  ],
14331
- "version": "32f5cb15"
15105
+ "version": "28598df2"
14332
15106
  },
14333
15107
  "importPath": "@happyvertical/smrt-messages"
14334
15108
  },
@@ -14436,6 +15210,52 @@
14436
15210
  "default": true,
14437
15211
  "description": "Whether this account is enabled for messaging."
14438
15212
  },
15213
+ "ownerUserId": {
15214
+ "type": "crossPackageRef",
15215
+ "_meta": {
15216
+ "__statedOptions": [
15217
+ "description",
15218
+ "related"
15219
+ ],
15220
+ "description": "The person who owns this account and decides who else may use it."
15221
+ },
15222
+ "required": false,
15223
+ "related": "@happyvertical/smrt-users:User",
15224
+ "description": "The person who owns this account and decides who else may use it."
15225
+ },
15226
+ "label": {
15227
+ "type": "text",
15228
+ "_meta": {
15229
+ "__statedOptions": [
15230
+ "description"
15231
+ ],
15232
+ "description": "A short name shown beside this account, such as Support or Personal."
15233
+ },
15234
+ "required": false,
15235
+ "description": "A short name shown beside this account, such as Support or Personal."
15236
+ },
15237
+ "connectionStatus": {
15238
+ "type": "text",
15239
+ "_meta": {
15240
+ "__statedOptions": [
15241
+ "description"
15242
+ ],
15243
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
15244
+ },
15245
+ "required": false,
15246
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
15247
+ },
15248
+ "statusMessage": {
15249
+ "type": "text",
15250
+ "_meta": {
15251
+ "__statedOptions": [
15252
+ "description"
15253
+ ],
15254
+ "description": "Why the account needs attention, in plain words."
15255
+ },
15256
+ "required": false,
15257
+ "description": "Why the account needs attention, in plain words."
15258
+ },
14439
15259
  "lastSyncAt": {
14440
15260
  "type": "datetime",
14441
15261
  "_meta": {
@@ -14554,6 +15374,28 @@
14554
15374
  "isStatic": false,
14555
15375
  "isPublic": true
14556
15376
  },
15377
+ "markNeedsReconnect": {
15378
+ "name": "markNeedsReconnect",
15379
+ "async": true,
15380
+ "parameters": [
15381
+ {
15382
+ "name": "reason",
15383
+ "type": "string",
15384
+ "optional": false
15385
+ }
15386
+ ],
15387
+ "returnType": "Promise<void>",
15388
+ "isStatic": false,
15389
+ "isPublic": true
15390
+ },
15391
+ "markConnected": {
15392
+ "name": "markConnected",
15393
+ "async": true,
15394
+ "parameters": [],
15395
+ "returnType": "Promise<void>",
15396
+ "isStatic": false,
15397
+ "isPublic": true
15398
+ },
14557
15399
  "activate": {
14558
15400
  "name": "activate",
14559
15401
  "async": true,
@@ -14592,6 +15434,14 @@
14592
15434
  "isStatic": false,
14593
15435
  "isPublic": true
14594
15436
  },
15437
+ "removeCredentials": {
15438
+ "name": "removeCredentials",
15439
+ "async": true,
15440
+ "parameters": [],
15441
+ "returnType": "Promise<void>",
15442
+ "isStatic": false,
15443
+ "isPublic": true
15444
+ },
14595
15445
  "createSender": {
14596
15446
  "name": "createSender",
14597
15447
  "async": true,
@@ -14644,7 +15494,7 @@
14644
15494
  ],
14645
15495
  "schema": {
14646
15496
  "tableName": "accounts",
14647
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
15497
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
14648
15498
  "columns": {
14649
15499
  "_sync_origin_device_id": {
14650
15500
  "type": "TEXT"
@@ -14711,6 +15561,23 @@
14711
15561
  "notNull": false,
14712
15562
  "default": true
14713
15563
  },
15564
+ "owner_user_id": {
15565
+ "type": "UUID",
15566
+ "referenceKind": "crossPackageRef",
15567
+ "notNull": false
15568
+ },
15569
+ "label": {
15570
+ "type": "TEXT",
15571
+ "notNull": false
15572
+ },
15573
+ "connection_status": {
15574
+ "type": "TEXT",
15575
+ "notNull": false
15576
+ },
15577
+ "status_message": {
15578
+ "type": "TEXT",
15579
+ "notNull": false
15580
+ },
14714
15581
  "last_sync_at": {
14715
15582
  "type": "TIMESTAMP",
14716
15583
  "notNull": false
@@ -14732,6 +15599,10 @@
14732
15599
  "notNull": false,
14733
15600
  "default": 60
14734
15601
  },
15602
+ "sync_cursor": {
15603
+ "type": "TEXT",
15604
+ "notNull": false
15605
+ },
14735
15606
  "workspace_id": {
14736
15607
  "type": "TEXT",
14737
15608
  "notNull": false
@@ -14777,6 +15648,12 @@
14777
15648
  "tenant_id",
14778
15649
  "created_at"
14779
15650
  ]
15651
+ },
15652
+ {
15653
+ "name": "accounts_owner_user_id_idx",
15654
+ "columns": [
15655
+ "owner_user_id"
15656
+ ]
14780
15657
  }
14781
15658
  ],
14782
15659
  "checks": [
@@ -14788,7 +15665,7 @@
14788
15665
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
14789
15666
  }
14790
15667
  ],
14791
- "version": "b5f42708"
15668
+ "version": "ed7f2dff"
14792
15669
  },
14793
15670
  "importPath": "@happyvertical/smrt-messages"
14794
15671
  },
@@ -15396,6 +16273,52 @@
15396
16273
  "default": true,
15397
16274
  "description": "Whether this account is enabled for messaging."
15398
16275
  },
16276
+ "ownerUserId": {
16277
+ "type": "crossPackageRef",
16278
+ "_meta": {
16279
+ "__statedOptions": [
16280
+ "description",
16281
+ "related"
16282
+ ],
16283
+ "description": "The person who owns this account and decides who else may use it."
16284
+ },
16285
+ "required": false,
16286
+ "related": "@happyvertical/smrt-users:User",
16287
+ "description": "The person who owns this account and decides who else may use it."
16288
+ },
16289
+ "label": {
16290
+ "type": "text",
16291
+ "_meta": {
16292
+ "__statedOptions": [
16293
+ "description"
16294
+ ],
16295
+ "description": "A short name shown beside this account, such as Support or Personal."
16296
+ },
16297
+ "required": false,
16298
+ "description": "A short name shown beside this account, such as Support or Personal."
16299
+ },
16300
+ "connectionStatus": {
16301
+ "type": "text",
16302
+ "_meta": {
16303
+ "__statedOptions": [
16304
+ "description"
16305
+ ],
16306
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
16307
+ },
16308
+ "required": false,
16309
+ "description": "Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it."
16310
+ },
16311
+ "statusMessage": {
16312
+ "type": "text",
16313
+ "_meta": {
16314
+ "__statedOptions": [
16315
+ "description"
16316
+ ],
16317
+ "description": "Why the account needs attention, in plain words."
16318
+ },
16319
+ "required": false,
16320
+ "description": "Why the account needs attention, in plain words."
16321
+ },
15399
16322
  "lastSyncAt": {
15400
16323
  "type": "datetime",
15401
16324
  "_meta": {
@@ -15500,6 +16423,28 @@
15500
16423
  "isStatic": false,
15501
16424
  "isPublic": true
15502
16425
  },
16426
+ "markNeedsReconnect": {
16427
+ "name": "markNeedsReconnect",
16428
+ "async": true,
16429
+ "parameters": [
16430
+ {
16431
+ "name": "reason",
16432
+ "type": "string",
16433
+ "optional": false
16434
+ }
16435
+ ],
16436
+ "returnType": "Promise<void>",
16437
+ "isStatic": false,
16438
+ "isPublic": true
16439
+ },
16440
+ "markConnected": {
16441
+ "name": "markConnected",
16442
+ "async": true,
16443
+ "parameters": [],
16444
+ "returnType": "Promise<void>",
16445
+ "isStatic": false,
16446
+ "isPublic": true
16447
+ },
15503
16448
  "activate": {
15504
16449
  "name": "activate",
15505
16450
  "async": true,
@@ -15538,6 +16483,14 @@
15538
16483
  "isStatic": false,
15539
16484
  "isPublic": true
15540
16485
  },
16486
+ "removeCredentials": {
16487
+ "name": "removeCredentials",
16488
+ "async": true,
16489
+ "parameters": [],
16490
+ "returnType": "Promise<void>",
16491
+ "isStatic": false,
16492
+ "isPublic": true
16493
+ },
15541
16494
  "createSender": {
15542
16495
  "name": "createSender",
15543
16496
  "async": true,
@@ -15590,7 +16543,7 @@
15590
16543
  ],
15591
16544
  "schema": {
15592
16545
  "tableName": "accounts",
15593
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
16546
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
15594
16547
  "columns": {
15595
16548
  "_sync_origin_device_id": {
15596
16549
  "type": "TEXT"
@@ -15657,6 +16610,23 @@
15657
16610
  "notNull": false,
15658
16611
  "default": true
15659
16612
  },
16613
+ "owner_user_id": {
16614
+ "type": "UUID",
16615
+ "referenceKind": "crossPackageRef",
16616
+ "notNull": false
16617
+ },
16618
+ "label": {
16619
+ "type": "TEXT",
16620
+ "notNull": false
16621
+ },
16622
+ "connection_status": {
16623
+ "type": "TEXT",
16624
+ "notNull": false
16625
+ },
16626
+ "status_message": {
16627
+ "type": "TEXT",
16628
+ "notNull": false
16629
+ },
15660
16630
  "last_sync_at": {
15661
16631
  "type": "TIMESTAMP",
15662
16632
  "notNull": false
@@ -15678,6 +16648,10 @@
15678
16648
  "notNull": false,
15679
16649
  "default": 60
15680
16650
  },
16651
+ "sync_cursor": {
16652
+ "type": "TEXT",
16653
+ "notNull": false
16654
+ },
15681
16655
  "workspace_id": {
15682
16656
  "type": "TEXT",
15683
16657
  "notNull": false
@@ -15723,6 +16697,12 @@
15723
16697
  "tenant_id",
15724
16698
  "created_at"
15725
16699
  ]
16700
+ },
16701
+ {
16702
+ "name": "accounts_owner_user_id_idx",
16703
+ "columns": [
16704
+ "owner_user_id"
16705
+ ]
15726
16706
  }
15727
16707
  ],
15728
16708
  "checks": [
@@ -15734,7 +16714,7 @@
15734
16714
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
15735
16715
  }
15736
16716
  ],
15737
- "version": "b5f42708"
16717
+ "version": "ed7f2dff"
15738
16718
  },
15739
16719
  "importPath": "@happyvertical/smrt-messages"
15740
16720
  }
@@ -15835,7 +16815,8 @@
15835
16815
  "options": [
15836
16816
  "imap",
15837
16817
  "pop3",
15838
- "gmail"
16818
+ "gmail",
16819
+ "jmap"
15839
16820
  ],
15840
16821
  "required": true
15841
16822
  },
@@ -15886,7 +16867,7 @@
15886
16867
  "demo": {
15887
16868
  "mode": "server",
15888
16869
  "reasons": [
15889
- "Needs a server because its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3617, #3624, #3626, #3627)."
16870
+ "Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627)."
15890
16871
  ]
15891
16872
  }
15892
16873
  },
@@ -15955,7 +16936,7 @@
15955
16936
  "demo": {
15956
16937
  "mode": "server",
15957
16938
  "reasons": [
15958
- "Needs a server because its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3617, #3624, #3626, #3627)."
16939
+ "Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627)."
15959
16940
  ]
15960
16941
  }
15961
16942
  },
@@ -16188,13 +17169,14 @@
16188
17169
  "demo": {
16189
17170
  "mode": "server",
16190
17171
  "reasons": [
16191
- "Needs a server because its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3617, #3624, #3626, #3627)."
17172
+ "Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627)."
16192
17173
  ]
16193
17174
  }
16194
17175
  }
16195
17176
  ],
16196
17177
  "smrtDependencies": [
16197
17178
  "@happyvertical/smrt-core",
17179
+ "@happyvertical/smrt-jobs",
16198
17180
  "@happyvertical/smrt-ledgers",
16199
17181
  "@happyvertical/smrt-profiles",
16200
17182
  "@happyvertical/smrt-secrets",
@@ -16204,18 +17186,20 @@
16204
17186
  "browser": {
16205
17187
  "status": "server-only",
16206
17188
  "issues": [
17189
+ "#3615",
16207
17190
  "#3617",
16208
17191
  "#3624",
16209
17192
  "#3626",
16210
17193
  "#3627"
16211
17194
  ],
16212
17195
  "via": [
17196
+ "@happyvertical/smrt-jobs",
16213
17197
  "@happyvertical/smrt-profiles",
16214
17198
  "@happyvertical/smrt-secrets",
16215
17199
  "@happyvertical/smrt-tenancy",
16216
17200
  "@happyvertical/smrt-users"
16217
17201
  ]
16218
17202
  },
16219
- "schemaFingerprint": "dfb9fd778f2e205cf70a898f39ad642da42820a92d0ab4884ce7f67c6f5877d5",
17203
+ "schemaFingerprint": "5dfd9ffedd8ec270f109fc7e35730633db7b5756bc3e093e27442891f0ab7dfa",
16220
17204
  "stampsConstructors": true
16221
17205
  }