@happyvertical/smrt-messages 0.60.9 → 0.60.10

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 (38) hide show
  1. package/AGENTS.md +17 -0
  2. package/README.md +40 -0
  3. package/agents/notification-outbox.md +116 -0
  4. package/dist/chunks/{AccountCollection-CPsjabD-.js → AccountCollection-By48bdwt.js} +2 -2
  5. package/dist/chunks/{AccountCollection-CPsjabD-.js.map → AccountCollection-By48bdwt.js.map} +1 -1
  6. package/dist/chunks/{Email-C85SNWH0.js → Email-CMUK3aWU.js} +3 -3
  7. package/dist/chunks/{Email-C85SNWH0.js.map → Email-CMUK3aWU.js.map} +1 -1
  8. package/dist/chunks/{EmailFolder-Ia8OFxRn.js → EmailFolder-DLJvqNqI.js} +2 -2
  9. package/dist/chunks/{EmailFolder-Ia8OFxRn.js.map → EmailFolder-DLJvqNqI.js.map} +1 -1
  10. package/dist/chunks/{Message-x-bj-WcS.js → Message-DXpqot5f.js} +52 -5
  11. package/dist/chunks/Message-DXpqot5f.js.map +1 -0
  12. package/dist/chunks/{MessageCollection-BM4y2_mB.js → MessageCollection-CMGaSGBc.js} +2 -2
  13. package/dist/chunks/{MessageCollection-BM4y2_mB.js.map → MessageCollection-CMGaSGBc.js.map} +1 -1
  14. package/dist/chunks/__smrt-register__-CaGLtiEU.js +6 -0
  15. package/dist/chunks/__smrt-register__-CaGLtiEU.js.map +1 -0
  16. package/dist/collections/NotificationDeliveryCollection.d.ts +6 -0
  17. package/dist/collections/NotificationDeliveryCollection.d.ts.map +1 -0
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +780 -38
  21. package/dist/index.js.map +1 -1
  22. package/dist/manifest.json +1135 -89
  23. package/dist/models/Message.d.ts +15 -0
  24. package/dist/models/Message.d.ts.map +1 -1
  25. package/dist/models/NotificationDelivery.d.ts +128 -0
  26. package/dist/models/NotificationDelivery.d.ts.map +1 -0
  27. package/dist/senders/EmailSender.d.ts +9 -0
  28. package/dist/senders/EmailSender.d.ts.map +1 -1
  29. package/dist/services/NotificationOutboxService.d.ts +226 -0
  30. package/dist/services/NotificationOutboxService.d.ts.map +1 -0
  31. package/dist/smrt-knowledge.json +470 -9
  32. package/dist/smrt-knowledge.okf.md +155 -0
  33. package/dist/types.d.ts +6 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +17 -16
  36. package/dist/chunks/Message-x-bj-WcS.js.map +0 -1
  37. package/dist/chunks/__smrt-register__-B7iWfX8p.js +0 -6
  38. package/dist/chunks/__smrt-register__-B7iWfX8p.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.60.9",
5
+ "packageVersion": "0.60.10",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-messages:AccountCollection": {
8
8
  "name": "accountcollection",
@@ -153,8 +153,14 @@
153
153
  ],
154
154
  "schema": {
155
155
  "tableName": "accounts",
156
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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 \"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);",
157
157
  "columns": {
158
+ "_sync_origin_device_id": {
159
+ "type": "TEXT"
160
+ },
161
+ "_sync_revision": {
162
+ "type": "INTEGER"
163
+ },
158
164
  "id": {
159
165
  "type": "UUID",
160
166
  "primaryKey": true,
@@ -282,7 +288,7 @@
282
288
  ]
283
289
  }
284
290
  ],
285
- "version": "3854ea98"
291
+ "version": "bab4f6cd"
286
292
  },
287
293
  "importPath": "@happyvertical/smrt-messages"
288
294
  },
@@ -529,8 +535,14 @@
529
535
  ],
530
536
  "schema": {
531
537
  "tableName": "attachments",
532
- "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\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);",
538
+ "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);",
533
539
  "columns": {
540
+ "_sync_origin_device_id": {
541
+ "type": "TEXT"
542
+ },
543
+ "_sync_revision": {
544
+ "type": "INTEGER"
545
+ },
534
546
  "id": {
535
547
  "type": "UUID",
536
548
  "primaryKey": true,
@@ -637,7 +649,7 @@
637
649
  ]
638
650
  }
639
651
  ],
640
- "version": "ee5ae0dd"
652
+ "version": "710eb303"
641
653
  },
642
654
  "importPath": "@happyvertical/smrt-messages"
643
655
  },
@@ -700,8 +712,14 @@
700
712
  ],
701
713
  "schema": {
702
714
  "tableName": "blacklists",
703
- "ddl": "CREATE TABLE IF NOT EXISTS \"blacklists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"reason\" TEXT DEFAULT '',\n \"auto_archive\" BOOLEAN DEFAULT TRUE,\n \"tenant_id\" UUID NOT NULL\n);",
715
+ "ddl": "CREATE TABLE IF NOT EXISTS \"blacklists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"reason\" TEXT DEFAULT '',\n \"auto_archive\" BOOLEAN DEFAULT TRUE,\n \"tenant_id\" UUID NOT NULL\n);",
704
716
  "columns": {
717
+ "_sync_origin_device_id": {
718
+ "type": "TEXT"
719
+ },
720
+ "_sync_revision": {
721
+ "type": "INTEGER"
722
+ },
705
723
  "id": {
706
724
  "type": "UUID",
707
725
  "primaryKey": true,
@@ -776,7 +794,7 @@
776
794
  ]
777
795
  }
778
796
  ],
779
- "version": "04efaa8d"
797
+ "version": "478c8724"
780
798
  },
781
799
  "importPath": "@happyvertical/smrt-messages"
782
800
  },
@@ -1020,8 +1038,14 @@
1020
1038
  ],
1021
1039
  "schema": {
1022
1040
  "tableName": "accounts",
1023
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
1041
+ "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);",
1024
1042
  "columns": {
1043
+ "_sync_origin_device_id": {
1044
+ "type": "TEXT"
1045
+ },
1046
+ "_sync_revision": {
1047
+ "type": "INTEGER"
1048
+ },
1025
1049
  "id": {
1026
1050
  "type": "UUID",
1027
1051
  "primaryKey": true,
@@ -1149,7 +1173,7 @@
1149
1173
  ]
1150
1174
  }
1151
1175
  ],
1152
- "version": "3854ea98"
1176
+ "version": "bab4f6cd"
1153
1177
  },
1154
1178
  "importPath": "@happyvertical/smrt-messages"
1155
1179
  },
@@ -1423,8 +1447,14 @@
1423
1447
  ],
1424
1448
  "schema": {
1425
1449
  "tableName": "email_attachments",
1426
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\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);",
1450
+ "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);",
1427
1451
  "columns": {
1452
+ "_sync_origin_device_id": {
1453
+ "type": "TEXT"
1454
+ },
1455
+ "_sync_revision": {
1456
+ "type": "INTEGER"
1457
+ },
1428
1458
  "id": {
1429
1459
  "type": "UUID",
1430
1460
  "primaryKey": true,
@@ -1467,7 +1497,7 @@
1467
1497
  ]
1468
1498
  }
1469
1499
  ],
1470
- "version": "70291c59"
1500
+ "version": "7caeb6f9"
1471
1501
  },
1472
1502
  "importPath": "@happyvertical/smrt-messages"
1473
1503
  },
@@ -1901,8 +1931,14 @@
1901
1931
  ],
1902
1932
  "schema": {
1903
1933
  "tableName": "messages",
1904
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
1934
+ "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);",
1905
1935
  "columns": {
1936
+ "_sync_origin_device_id": {
1937
+ "type": "TEXT"
1938
+ },
1939
+ "_sync_revision": {
1940
+ "type": "INTEGER"
1941
+ },
1906
1942
  "id": {
1907
1943
  "type": "UUID",
1908
1944
  "primaryKey": true,
@@ -2253,7 +2289,7 @@
2253
2289
  ]
2254
2290
  }
2255
2291
  ],
2256
- "version": "6ff29dd9"
2292
+ "version": "643e5fb5"
2257
2293
  },
2258
2294
  "importPath": "@happyvertical/smrt-messages"
2259
2295
  },
@@ -2551,8 +2587,14 @@
2551
2587
  ],
2552
2588
  "schema": {
2553
2589
  "tableName": "email_folders",
2554
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_folders\" (\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 \"account_id\" UUID,\n \"name\" TEXT,\n \"path\" TEXT,\n \"delimiter\" TEXT,\n \"special_use\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"unread_count\" INTEGER NOT NULL DEFAULT 0,\n \"subscribed\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
2590
+ "ddl": "CREATE TABLE IF NOT EXISTS \"email_folders\" (\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 \"account_id\" UUID,\n \"name\" TEXT,\n \"path\" TEXT,\n \"delimiter\" TEXT,\n \"special_use\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"unread_count\" INTEGER NOT NULL DEFAULT 0,\n \"subscribed\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
2555
2591
  "columns": {
2592
+ "_sync_origin_device_id": {
2593
+ "type": "TEXT"
2594
+ },
2595
+ "_sync_revision": {
2596
+ "type": "INTEGER"
2597
+ },
2556
2598
  "id": {
2557
2599
  "type": "UUID",
2558
2600
  "primaryKey": true,
@@ -2660,7 +2702,7 @@
2660
2702
  ]
2661
2703
  }
2662
2704
  ],
2663
- "version": "e895818f"
2705
+ "version": "cfea127c"
2664
2706
  },
2665
2707
  "importPath": "@happyvertical/smrt-messages"
2666
2708
  },
@@ -2941,8 +2983,14 @@
2941
2983
  ],
2942
2984
  "schema": {
2943
2985
  "tableName": "messages",
2944
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
2986
+ "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);",
2945
2987
  "columns": {
2988
+ "_sync_origin_device_id": {
2989
+ "type": "TEXT"
2990
+ },
2991
+ "_sync_revision": {
2992
+ "type": "INTEGER"
2993
+ },
2946
2994
  "id": {
2947
2995
  "type": "UUID",
2948
2996
  "primaryKey": true,
@@ -3293,7 +3341,7 @@
3293
3341
  ]
3294
3342
  }
3295
3343
  ],
3296
- "version": "c03791c7"
3344
+ "version": "7838f80a"
3297
3345
  },
3298
3346
  "importPath": "@happyvertical/smrt-messages"
3299
3347
  },
@@ -3339,8 +3387,14 @@
3339
3387
  ],
3340
3388
  "schema": {
3341
3389
  "tableName": "messaging_endpoints",
3342
- "ddl": "CREATE TABLE IF NOT EXISTS \"messaging_endpoints\" (\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 NOT NULL,\n \"profile_id\" UUID,\n \"label\" TEXT NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"address\" TEXT NOT NULL,\n \"is_active\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"verified_at\" TIMESTAMP\n);",
3390
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messaging_endpoints\" (\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 NOT NULL,\n \"profile_id\" UUID,\n \"label\" TEXT NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"address\" TEXT NOT NULL,\n \"is_active\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"verified_at\" TIMESTAMP\n);",
3343
3391
  "columns": {
3392
+ "_sync_origin_device_id": {
3393
+ "type": "TEXT"
3394
+ },
3395
+ "_sync_revision": {
3396
+ "type": "INTEGER"
3397
+ },
3344
3398
  "id": {
3345
3399
  "type": "UUID",
3346
3400
  "primaryKey": true,
@@ -3437,7 +3491,271 @@
3437
3491
  ]
3438
3492
  }
3439
3493
  ],
3440
- "version": "fca5554d"
3494
+ "version": "b4466849"
3495
+ },
3496
+ "importPath": "@happyvertical/smrt-messages"
3497
+ },
3498
+ "@happyvertical/smrt-messages:NotificationDeliveryCollection": {
3499
+ "name": "notificationdeliverycollection",
3500
+ "className": "NotificationDeliveryCollection",
3501
+ "qualifiedName": "@happyvertical/smrt-messages:NotificationDeliveryCollection",
3502
+ "collection": "notificationdeliveries",
3503
+ "filePath": "/home/runner/work/smrt/smrt/packages/messages/src/collections/NotificationDeliveryCollection.ts",
3504
+ "packageName": "@happyvertical/smrt-messages",
3505
+ "fields": {},
3506
+ "methods": {},
3507
+ "decoratorConfig": {
3508
+ "tableName": "notification_deliveries",
3509
+ "api": false,
3510
+ "mcp": false,
3511
+ "cli": false
3512
+ },
3513
+ "extends": "SmrtCollection",
3514
+ "extendsTypeArg": "NotificationDelivery",
3515
+ "exportName": "NotificationDeliveryCollection",
3516
+ "collectionExportName": "NotificationDeliveryCollectionCollection",
3517
+ "collectionOf": "@happyvertical/smrt-messages:NotificationDelivery",
3518
+ "inheritedExposure": [
3519
+ "api",
3520
+ "mcp",
3521
+ "cli"
3522
+ ],
3523
+ "schema": {
3524
+ "tableName": "notification_deliveries",
3525
+ "ddl": "CREATE TABLE IF NOT EXISTS \"notification_deliveries\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"source_ref\" TEXT NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"subject\" TEXT NOT NULL,\n \"text_body\" TEXT NOT NULL,\n \"href\" TEXT NOT NULL,\n \"recipient_address\" TEXT NOT NULL,\n \"recipient_name\" TEXT,\n \"account_id\" UUID,\n \"message_id\" UUID,\n \"status\" TEXT DEFAULT 'pending',\n \"state_version\" INTEGER NOT NULL DEFAULT 0,\n \"transition_id\" TEXT,\n \"attempts\" INTEGER NOT NULL DEFAULT 0,\n \"max_attempts\" INTEGER NOT NULL DEFAULT 5,\n \"next_attempt_at\" TEXT,\n \"lease_token\" TEXT,\n \"lease_expires_at\" TIMESTAMP,\n \"handed_off_at\" TIMESTAMP,\n \"delivered_at\" TIMESTAMP,\n \"provider_message_id\" TEXT,\n \"last_error\" TEXT\n);",
3526
+ "columns": {
3527
+ "_sync_origin_device_id": {
3528
+ "type": "TEXT"
3529
+ },
3530
+ "_sync_revision": {
3531
+ "type": "INTEGER"
3532
+ },
3533
+ "id": {
3534
+ "type": "UUID",
3535
+ "primaryKey": true,
3536
+ "referenceKind": "id",
3537
+ "notNull": true
3538
+ },
3539
+ "slug": {
3540
+ "type": "TEXT",
3541
+ "notNull": true
3542
+ },
3543
+ "context": {
3544
+ "type": "TEXT",
3545
+ "notNull": true,
3546
+ "default": ""
3547
+ },
3548
+ "created_at": {
3549
+ "type": "TIMESTAMP",
3550
+ "notNull": true,
3551
+ "default": "current_timestamp"
3552
+ },
3553
+ "updated_at": {
3554
+ "type": "TIMESTAMP",
3555
+ "notNull": true,
3556
+ "default": "current_timestamp"
3557
+ },
3558
+ "tenant_id": {
3559
+ "type": "UUID",
3560
+ "referenceKind": "tenantId",
3561
+ "notNull": true,
3562
+ "unique": false
3563
+ },
3564
+ "recipient_user_id": {
3565
+ "type": "UUID",
3566
+ "referenceKind": "crossPackageRef",
3567
+ "notNull": true,
3568
+ "unique": false
3569
+ },
3570
+ "channel": {
3571
+ "type": "TEXT",
3572
+ "notNull": true,
3573
+ "unique": false,
3574
+ "default": "email"
3575
+ },
3576
+ "source_ref": {
3577
+ "type": "TEXT",
3578
+ "notNull": true,
3579
+ "unique": false
3580
+ },
3581
+ "kind": {
3582
+ "type": "TEXT",
3583
+ "notNull": true,
3584
+ "unique": false
3585
+ },
3586
+ "subject": {
3587
+ "type": "TEXT",
3588
+ "notNull": true,
3589
+ "unique": false
3590
+ },
3591
+ "text_body": {
3592
+ "type": "TEXT",
3593
+ "notNull": true,
3594
+ "unique": false
3595
+ },
3596
+ "href": {
3597
+ "type": "TEXT",
3598
+ "notNull": true,
3599
+ "unique": false
3600
+ },
3601
+ "recipient_address": {
3602
+ "type": "TEXT",
3603
+ "notNull": true,
3604
+ "unique": false
3605
+ },
3606
+ "recipient_name": {
3607
+ "type": "TEXT",
3608
+ "notNull": false,
3609
+ "unique": false
3610
+ },
3611
+ "account_id": {
3612
+ "type": "UUID",
3613
+ "referenceKind": "foreignKey",
3614
+ "notNull": false,
3615
+ "unique": false,
3616
+ "foreignKey": {
3617
+ "table": "accounts",
3618
+ "column": "id",
3619
+ "onDelete": "NO ACTION",
3620
+ "onUpdate": "CASCADE"
3621
+ }
3622
+ },
3623
+ "message_id": {
3624
+ "type": "UUID",
3625
+ "referenceKind": "foreignKey",
3626
+ "notNull": false,
3627
+ "unique": false,
3628
+ "foreignKey": {
3629
+ "table": "messages",
3630
+ "column": "id",
3631
+ "onDelete": "NO ACTION",
3632
+ "onUpdate": "CASCADE"
3633
+ }
3634
+ },
3635
+ "status": {
3636
+ "type": "TEXT",
3637
+ "notNull": false,
3638
+ "unique": false,
3639
+ "default": "pending"
3640
+ },
3641
+ "state_version": {
3642
+ "type": "INTEGER",
3643
+ "notNull": true,
3644
+ "unique": false,
3645
+ "default": 0
3646
+ },
3647
+ "transition_id": {
3648
+ "type": "TEXT",
3649
+ "notNull": false,
3650
+ "unique": false
3651
+ },
3652
+ "attempts": {
3653
+ "type": "INTEGER",
3654
+ "notNull": true,
3655
+ "unique": false,
3656
+ "default": 0
3657
+ },
3658
+ "max_attempts": {
3659
+ "type": "INTEGER",
3660
+ "notNull": true,
3661
+ "unique": false,
3662
+ "default": 5
3663
+ },
3664
+ "next_attempt_at": {
3665
+ "type": "TEXT",
3666
+ "notNull": false,
3667
+ "unique": false
3668
+ },
3669
+ "lease_token": {
3670
+ "type": "TEXT",
3671
+ "notNull": false,
3672
+ "unique": false
3673
+ },
3674
+ "lease_expires_at": {
3675
+ "type": "TIMESTAMP",
3676
+ "notNull": false,
3677
+ "unique": false
3678
+ },
3679
+ "handed_off_at": {
3680
+ "type": "TIMESTAMP",
3681
+ "notNull": false,
3682
+ "unique": false
3683
+ },
3684
+ "delivered_at": {
3685
+ "type": "TIMESTAMP",
3686
+ "notNull": false,
3687
+ "unique": false
3688
+ },
3689
+ "provider_message_id": {
3690
+ "type": "TEXT",
3691
+ "notNull": false,
3692
+ "unique": false
3693
+ },
3694
+ "last_error": {
3695
+ "type": "TEXT",
3696
+ "notNull": false,
3697
+ "unique": false
3698
+ }
3699
+ },
3700
+ "indexes": [
3701
+ {
3702
+ "name": "notification_deliveries_tenant_id_recipient_user_id_idx",
3703
+ "columns": [
3704
+ "tenant_id",
3705
+ "recipient_user_id",
3706
+ "channel",
3707
+ "source_ref"
3708
+ ],
3709
+ "unique": true
3710
+ },
3711
+ {
3712
+ "name": "notification_deliveries_slug_context_idx",
3713
+ "columns": [
3714
+ "slug",
3715
+ "context"
3716
+ ]
3717
+ },
3718
+ {
3719
+ "name": "notification_deliveries_due_idx",
3720
+ "columns": [
3721
+ "status",
3722
+ "next_attempt_at"
3723
+ ]
3724
+ },
3725
+ {
3726
+ "name": "notification_deliveries_lease_idx",
3727
+ "columns": [
3728
+ "status",
3729
+ "lease_expires_at"
3730
+ ]
3731
+ },
3732
+ {
3733
+ "name": "notification_deliveries_tenant_id_created_at_idx",
3734
+ "columns": [
3735
+ "tenant_id",
3736
+ "created_at"
3737
+ ]
3738
+ },
3739
+ {
3740
+ "name": "notification_deliveries_recipient_user_id_idx",
3741
+ "columns": [
3742
+ "recipient_user_id"
3743
+ ]
3744
+ },
3745
+ {
3746
+ "name": "notification_deliveries_account_id_idx",
3747
+ "columns": [
3748
+ "account_id"
3749
+ ]
3750
+ },
3751
+ {
3752
+ "name": "notification_deliveries_message_id_idx",
3753
+ "columns": [
3754
+ "message_id"
3755
+ ]
3756
+ }
3757
+ ],
3758
+ "version": "4da8dfdc"
3441
3759
  },
3442
3760
  "importPath": "@happyvertical/smrt-messages"
3443
3761
  },
@@ -3498,8 +3816,14 @@
3498
3816
  ],
3499
3817
  "schema": {
3500
3818
  "tableName": "persona_message_routes",
3501
- "ddl": "CREATE TABLE IF NOT EXISTS \"persona_message_routes\" (\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 NOT NULL,\n \"persona_id\" UUID NOT NULL,\n \"account_id\" UUID NOT NULL,\n \"endpoint_id\" UUID NOT NULL,\n \"purpose\" TEXT NOT NULL,\n \"priority\" INTEGER NOT NULL DEFAULT 0,\n \"enabled\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
3819
+ "ddl": "CREATE TABLE IF NOT EXISTS \"persona_message_routes\" (\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 NOT NULL,\n \"persona_id\" UUID NOT NULL,\n \"account_id\" UUID NOT NULL,\n \"endpoint_id\" UUID NOT NULL,\n \"purpose\" TEXT NOT NULL,\n \"priority\" INTEGER NOT NULL DEFAULT 0,\n \"enabled\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
3502
3820
  "columns": {
3821
+ "_sync_origin_device_id": {
3822
+ "type": "TEXT"
3823
+ },
3824
+ "_sync_revision": {
3825
+ "type": "INTEGER"
3826
+ },
3503
3827
  "id": {
3504
3828
  "type": "UUID",
3505
3829
  "primaryKey": true,
@@ -3624,7 +3948,7 @@
3624
3948
  ]
3625
3949
  }
3626
3950
  ],
3627
- "version": "3dc1d5d0"
3951
+ "version": "3caf446e"
3628
3952
  },
3629
3953
  "importPath": "@happyvertical/smrt-messages"
3630
3954
  },
@@ -3655,8 +3979,14 @@
3655
3979
  ],
3656
3980
  "schema": {
3657
3981
  "tableName": "user_notifications",
3658
- "ddl": "CREATE TABLE IF NOT EXISTS \"user_notifications\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"title\" TEXT NOT NULL,\n \"body\" TEXT,\n \"href\" TEXT,\n \"severity\" TEXT DEFAULT 'info',\n \"source_ref\" TEXT NOT NULL,\n \"occurred_at\" TEXT,\n \"read_at\" TIMESTAMP,\n \"dismissed_at\" TIMESTAMP\n);",
3982
+ "ddl": "CREATE TABLE IF NOT EXISTS \"user_notifications\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"title\" TEXT NOT NULL,\n \"body\" TEXT,\n \"href\" TEXT,\n \"severity\" TEXT DEFAULT 'info',\n \"source_ref\" TEXT NOT NULL,\n \"occurred_at\" TEXT,\n \"read_at\" TIMESTAMP,\n \"dismissed_at\" TIMESTAMP\n);",
3659
3983
  "columns": {
3984
+ "_sync_origin_device_id": {
3985
+ "type": "TEXT"
3986
+ },
3987
+ "_sync_revision": {
3988
+ "type": "INTEGER"
3989
+ },
3660
3990
  "id": {
3661
3991
  "type": "UUID",
3662
3992
  "primaryKey": true,
@@ -3780,7 +4110,7 @@
3780
4110
  ]
3781
4111
  }
3782
4112
  ],
3783
- "version": "0e68a388"
4113
+ "version": "43e6281c"
3784
4114
  },
3785
4115
  "importPath": "@happyvertical/smrt-messages"
3786
4116
  },
@@ -3862,8 +4192,14 @@
3862
4192
  ],
3863
4193
  "schema": {
3864
4194
  "tableName": "whitelists",
3865
- "ddl": "CREATE TABLE IF NOT EXISTS \"whitelists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"category\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"tenant_id\" UUID NOT NULL\n);",
4195
+ "ddl": "CREATE TABLE IF NOT EXISTS \"whitelists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"category\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"tenant_id\" UUID NOT NULL\n);",
3866
4196
  "columns": {
4197
+ "_sync_origin_device_id": {
4198
+ "type": "TEXT"
4199
+ },
4200
+ "_sync_revision": {
4201
+ "type": "INTEGER"
4202
+ },
3867
4203
  "id": {
3868
4204
  "type": "UUID",
3869
4205
  "primaryKey": true,
@@ -3937,7 +4273,7 @@
3937
4273
  ]
3938
4274
  }
3939
4275
  ],
3940
- "version": "40a655a1"
4276
+ "version": "eb5b558d"
3941
4277
  },
3942
4278
  "importPath": "@happyvertical/smrt-messages"
3943
4279
  },
@@ -4204,8 +4540,14 @@
4204
4540
  ],
4205
4541
  "schema": {
4206
4542
  "tableName": "accounts",
4207
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
4543
+ "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);",
4208
4544
  "columns": {
4545
+ "_sync_origin_device_id": {
4546
+ "type": "TEXT"
4547
+ },
4548
+ "_sync_revision": {
4549
+ "type": "INTEGER"
4550
+ },
4209
4551
  "id": {
4210
4552
  "type": "UUID",
4211
4553
  "primaryKey": true,
@@ -4333,7 +4675,7 @@
4333
4675
  ]
4334
4676
  }
4335
4677
  ],
4336
- "version": "3854ea98"
4678
+ "version": "bab4f6cd"
4337
4679
  },
4338
4680
  "importPath": "@happyvertical/smrt-messages"
4339
4681
  },
@@ -4512,8 +4854,14 @@
4512
4854
  ],
4513
4855
  "schema": {
4514
4856
  "tableName": "attachments",
4515
- "ddl": "CREATE TABLE IF NOT EXISTS \"attachments\" (\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);",
4857
+ "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);",
4516
4858
  "columns": {
4859
+ "_sync_origin_device_id": {
4860
+ "type": "TEXT"
4861
+ },
4862
+ "_sync_revision": {
4863
+ "type": "INTEGER"
4864
+ },
4517
4865
  "id": {
4518
4866
  "type": "UUID",
4519
4867
  "primaryKey": true,
@@ -4620,7 +4968,7 @@
4620
4968
  ]
4621
4969
  }
4622
4970
  ],
4623
- "version": "ee5ae0dd"
4971
+ "version": "710eb303"
4624
4972
  },
4625
4973
  "importPath": "@happyvertical/smrt-messages"
4626
4974
  },
@@ -4718,8 +5066,14 @@
4718
5066
  "validationRules": [],
4719
5067
  "schema": {
4720
5068
  "tableName": "blacklists",
4721
- "ddl": "CREATE TABLE IF NOT EXISTS \"blacklists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"reason\" TEXT DEFAULT '',\n \"auto_archive\" BOOLEAN DEFAULT TRUE,\n \"tenant_id\" UUID NOT NULL\n);",
5069
+ "ddl": "CREATE TABLE IF NOT EXISTS \"blacklists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"reason\" TEXT DEFAULT '',\n \"auto_archive\" BOOLEAN DEFAULT TRUE,\n \"tenant_id\" UUID NOT NULL\n);",
4722
5070
  "columns": {
5071
+ "_sync_origin_device_id": {
5072
+ "type": "TEXT"
5073
+ },
5074
+ "_sync_revision": {
5075
+ "type": "INTEGER"
5076
+ },
4723
5077
  "id": {
4724
5078
  "type": "UUID",
4725
5079
  "primaryKey": true,
@@ -4794,7 +5148,7 @@
4794
5148
  ]
4795
5149
  }
4796
5150
  ],
4797
- "version": "04efaa8d"
5151
+ "version": "478c8724"
4798
5152
  },
4799
5153
  "importPath": "@happyvertical/smrt-messages"
4800
5154
  },
@@ -5320,8 +5674,30 @@
5320
5674
  "isStatic": false,
5321
5675
  "isPublic": true
5322
5676
  },
5323
- "retrySend": {
5324
- "name": "retrySend",
5677
+ "isSendOutcomeUnknown": {
5678
+ "name": "isSendOutcomeUnknown",
5679
+ "async": false,
5680
+ "parameters": [],
5681
+ "returnType": "boolean",
5682
+ "isStatic": false,
5683
+ "isPublic": true
5684
+ },
5685
+ "abandonSendAttempt": {
5686
+ "name": "abandonSendAttempt",
5687
+ "async": true,
5688
+ "parameters": [
5689
+ {
5690
+ "name": "reason",
5691
+ "type": "string",
5692
+ "optional": false
5693
+ }
5694
+ ],
5695
+ "returnType": "Promise<boolean>",
5696
+ "isStatic": false,
5697
+ "isPublic": true
5698
+ },
5699
+ "retrySend": {
5700
+ "name": "retrySend",
5325
5701
  "async": true,
5326
5702
  "parameters": [
5327
5703
  {
@@ -5542,8 +5918,14 @@
5542
5918
  ],
5543
5919
  "schema": {
5544
5920
  "tableName": "messages",
5545
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
5921
+ "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);",
5546
5922
  "columns": {
5923
+ "_sync_origin_device_id": {
5924
+ "type": "TEXT"
5925
+ },
5926
+ "_sync_revision": {
5927
+ "type": "INTEGER"
5928
+ },
5547
5929
  "id": {
5548
5930
  "type": "UUID",
5549
5931
  "primaryKey": true,
@@ -5894,7 +6276,7 @@
5894
6276
  ]
5895
6277
  }
5896
6278
  ],
5897
- "version": "6ff29dd9"
6279
+ "version": "643e5fb5"
5898
6280
  },
5899
6281
  "importPath": "@happyvertical/smrt-messages"
5900
6282
  },
@@ -6274,8 +6656,14 @@
6274
6656
  ],
6275
6657
  "schema": {
6276
6658
  "tableName": "accounts",
6277
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
6659
+ "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);",
6278
6660
  "columns": {
6661
+ "_sync_origin_device_id": {
6662
+ "type": "TEXT"
6663
+ },
6664
+ "_sync_revision": {
6665
+ "type": "INTEGER"
6666
+ },
6279
6667
  "id": {
6280
6668
  "type": "UUID",
6281
6669
  "primaryKey": true,
@@ -6403,7 +6791,7 @@
6403
6791
  ]
6404
6792
  }
6405
6793
  ],
6406
- "version": "3854ea98"
6794
+ "version": "bab4f6cd"
6407
6795
  },
6408
6796
  "importPath": "@happyvertical/smrt-messages"
6409
6797
  },
@@ -6513,8 +6901,14 @@
6513
6901
  "collectionExportName": "EmailAttachmentCollection",
6514
6902
  "schema": {
6515
6903
  "tableName": "email_attachments",
6516
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_attachments\" (\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);",
6904
+ "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);",
6517
6905
  "columns": {
6906
+ "_sync_origin_device_id": {
6907
+ "type": "TEXT"
6908
+ },
6909
+ "_sync_revision": {
6910
+ "type": "INTEGER"
6911
+ },
6518
6912
  "id": {
6519
6913
  "type": "UUID",
6520
6914
  "primaryKey": true,
@@ -6557,7 +6951,7 @@
6557
6951
  ]
6558
6952
  }
6559
6953
  ],
6560
- "version": "70291c59"
6954
+ "version": "7caeb6f9"
6561
6955
  },
6562
6956
  "importPath": "@happyvertical/smrt-messages"
6563
6957
  },
@@ -6793,8 +7187,14 @@
6793
7187
  ],
6794
7188
  "schema": {
6795
7189
  "tableName": "email_folders",
6796
- "ddl": "CREATE TABLE IF NOT EXISTS \"email_folders\" (\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 \"account_id\" UUID,\n \"name\" TEXT,\n \"path\" TEXT,\n \"delimiter\" TEXT,\n \"special_use\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"unread_count\" INTEGER NOT NULL DEFAULT 0,\n \"subscribed\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
7190
+ "ddl": "CREATE TABLE IF NOT EXISTS \"email_folders\" (\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 \"account_id\" UUID,\n \"name\" TEXT,\n \"path\" TEXT,\n \"delimiter\" TEXT,\n \"special_use\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"unread_count\" INTEGER NOT NULL DEFAULT 0,\n \"subscribed\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
6797
7191
  "columns": {
7192
+ "_sync_origin_device_id": {
7193
+ "type": "TEXT"
7194
+ },
7195
+ "_sync_revision": {
7196
+ "type": "INTEGER"
7197
+ },
6798
7198
  "id": {
6799
7199
  "type": "UUID",
6800
7200
  "primaryKey": true,
@@ -6902,7 +7302,7 @@
6902
7302
  ]
6903
7303
  }
6904
7304
  ],
6905
- "version": "e895818f"
7305
+ "version": "cfea127c"
6906
7306
  },
6907
7307
  "importPath": "@happyvertical/smrt-messages"
6908
7308
  },
@@ -7301,6 +7701,28 @@
7301
7701
  "isStatic": false,
7302
7702
  "isPublic": true
7303
7703
  },
7704
+ "isSendOutcomeUnknown": {
7705
+ "name": "isSendOutcomeUnknown",
7706
+ "async": false,
7707
+ "parameters": [],
7708
+ "returnType": "boolean",
7709
+ "isStatic": false,
7710
+ "isPublic": true
7711
+ },
7712
+ "abandonSendAttempt": {
7713
+ "name": "abandonSendAttempt",
7714
+ "async": true,
7715
+ "parameters": [
7716
+ {
7717
+ "name": "reason",
7718
+ "type": "string",
7719
+ "optional": false
7720
+ }
7721
+ ],
7722
+ "returnType": "Promise<boolean>",
7723
+ "isStatic": false,
7724
+ "isPublic": true
7725
+ },
7304
7726
  "retrySend": {
7305
7727
  "name": "retrySend",
7306
7728
  "async": true,
@@ -7405,8 +7827,14 @@
7405
7827
  ],
7406
7828
  "schema": {
7407
7829
  "tableName": "messages",
7408
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
7830
+ "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);",
7409
7831
  "columns": {
7832
+ "_sync_origin_device_id": {
7833
+ "type": "TEXT"
7834
+ },
7835
+ "_sync_revision": {
7836
+ "type": "INTEGER"
7837
+ },
7410
7838
  "id": {
7411
7839
  "type": "UUID",
7412
7840
  "primaryKey": true,
@@ -7757,7 +8185,7 @@
7757
8185
  ]
7758
8186
  }
7759
8187
  ],
7760
- "version": "c03791c7"
8188
+ "version": "7838f80a"
7761
8189
  },
7762
8190
  "importPath": "@happyvertical/smrt-messages"
7763
8191
  },
@@ -7891,21 +8319,371 @@
7891
8319
  "conflictColumns": [
7892
8320
  "tenant_id",
7893
8321
  "channel",
7894
- "label"
8322
+ "label"
8323
+ ],
8324
+ "tenantScoped": {
8325
+ "mode": "required"
8326
+ }
8327
+ },
8328
+ "extends": "SmrtObject",
8329
+ "exportName": "MessagingEndpoint",
8330
+ "collectionExportName": "MessagingEndpointCollection",
8331
+ "displayLabelField": "label",
8332
+ "validationRules": [
8333
+ {
8334
+ "field": "label",
8335
+ "rule": "required",
8336
+ "fieldType": "text"
8337
+ },
8338
+ {
8339
+ "field": "channel",
8340
+ "rule": "required",
8341
+ "fieldType": "text"
8342
+ },
8343
+ {
8344
+ "field": "address",
8345
+ "rule": "required",
8346
+ "fieldType": "text"
8347
+ },
8348
+ {
8349
+ "field": "isActive",
8350
+ "rule": "required",
8351
+ "fieldType": "boolean"
8352
+ }
8353
+ ],
8354
+ "schema": {
8355
+ "tableName": "messaging_endpoints",
8356
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messaging_endpoints\" (\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 NOT NULL,\n \"profile_id\" UUID,\n \"label\" TEXT NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"address\" TEXT NOT NULL,\n \"is_active\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"verified_at\" TIMESTAMP\n);",
8357
+ "columns": {
8358
+ "_sync_origin_device_id": {
8359
+ "type": "TEXT"
8360
+ },
8361
+ "_sync_revision": {
8362
+ "type": "INTEGER"
8363
+ },
8364
+ "id": {
8365
+ "type": "UUID",
8366
+ "primaryKey": true,
8367
+ "referenceKind": "id",
8368
+ "notNull": true
8369
+ },
8370
+ "slug": {
8371
+ "type": "TEXT",
8372
+ "notNull": true
8373
+ },
8374
+ "context": {
8375
+ "type": "TEXT",
8376
+ "notNull": true,
8377
+ "default": ""
8378
+ },
8379
+ "created_at": {
8380
+ "type": "TIMESTAMP",
8381
+ "notNull": true,
8382
+ "default": "current_timestamp"
8383
+ },
8384
+ "updated_at": {
8385
+ "type": "TIMESTAMP",
8386
+ "notNull": true,
8387
+ "default": "current_timestamp"
8388
+ },
8389
+ "tenant_id": {
8390
+ "type": "UUID",
8391
+ "referenceKind": "tenantId",
8392
+ "notNull": true,
8393
+ "unique": false
8394
+ },
8395
+ "profile_id": {
8396
+ "type": "UUID",
8397
+ "referenceKind": "crossPackageRef",
8398
+ "notNull": false,
8399
+ "unique": false
8400
+ },
8401
+ "label": {
8402
+ "type": "TEXT",
8403
+ "notNull": true,
8404
+ "unique": false
8405
+ },
8406
+ "channel": {
8407
+ "type": "TEXT",
8408
+ "notNull": true,
8409
+ "unique": false,
8410
+ "default": "email"
8411
+ },
8412
+ "address": {
8413
+ "type": "TEXT",
8414
+ "notNull": true,
8415
+ "unique": false
8416
+ },
8417
+ "is_active": {
8418
+ "type": "BOOLEAN",
8419
+ "notNull": true,
8420
+ "unique": false,
8421
+ "default": true
8422
+ },
8423
+ "verified_at": {
8424
+ "type": "TIMESTAMP",
8425
+ "notNull": false,
8426
+ "unique": false
8427
+ }
8428
+ },
8429
+ "indexes": [
8430
+ {
8431
+ "name": "messaging_endpoints_tenant_id_channel_idx",
8432
+ "columns": [
8433
+ "tenant_id",
8434
+ "channel",
8435
+ "label"
8436
+ ],
8437
+ "unique": true
8438
+ },
8439
+ {
8440
+ "name": "messaging_endpoints_slug_context_idx",
8441
+ "columns": [
8442
+ "slug",
8443
+ "context"
8444
+ ]
8445
+ },
8446
+ {
8447
+ "name": "messaging_endpoints_tenant_id_created_at_idx",
8448
+ "columns": [
8449
+ "tenant_id",
8450
+ "created_at"
8451
+ ]
8452
+ },
8453
+ {
8454
+ "name": "messaging_endpoints_profile_id_idx",
8455
+ "columns": [
8456
+ "profile_id"
8457
+ ]
8458
+ }
8459
+ ],
8460
+ "version": "b4466849"
8461
+ },
8462
+ "importPath": "@happyvertical/smrt-messages"
8463
+ },
8464
+ "@happyvertical/smrt-messages:NotificationDelivery": {
8465
+ "name": "notificationdelivery",
8466
+ "className": "NotificationDelivery",
8467
+ "qualifiedName": "@happyvertical/smrt-messages:NotificationDelivery",
8468
+ "collection": "notificationdeliveries",
8469
+ "description": "One durable, source-keyed notification delivery to one person over one external channel (the outbox row behind NotificationOutboxService).",
8470
+ "filePath": "/home/runner/work/smrt/smrt/packages/messages/src/models/NotificationDelivery.ts",
8471
+ "packageName": "@happyvertical/smrt-messages",
8472
+ "fields": {
8473
+ "tenantId": {
8474
+ "type": "text",
8475
+ "required": true,
8476
+ "_meta": {
8477
+ "sqlType": "UUID",
8478
+ "__tenancy": {
8479
+ "isTenantIdField": true,
8480
+ "autoFilter": true,
8481
+ "required": true,
8482
+ "autoPopulate": true,
8483
+ "nullable": false,
8484
+ "mode": "required",
8485
+ "field": "tenantId",
8486
+ "allowSuperAdminBypass": false
8487
+ }
8488
+ }
8489
+ },
8490
+ "recipientUserId": {
8491
+ "type": "crossPackageRef",
8492
+ "required": true,
8493
+ "related": "@happyvertical/smrt-users:User"
8494
+ },
8495
+ "channel": {
8496
+ "type": "text",
8497
+ "required": true,
8498
+ "default": "email",
8499
+ "_meta": {
8500
+ "required": true
8501
+ },
8502
+ "enum": [
8503
+ "email"
8504
+ ]
8505
+ },
8506
+ "sourceRef": {
8507
+ "type": "text",
8508
+ "required": true,
8509
+ "_meta": {
8510
+ "required": true
8511
+ }
8512
+ },
8513
+ "kind": {
8514
+ "type": "text",
8515
+ "required": true,
8516
+ "_meta": {
8517
+ "required": true
8518
+ }
8519
+ },
8520
+ "subject": {
8521
+ "type": "text",
8522
+ "required": true,
8523
+ "_meta": {
8524
+ "required": true
8525
+ }
8526
+ },
8527
+ "textBody": {
8528
+ "type": "text",
8529
+ "required": true,
8530
+ "_meta": {
8531
+ "required": true
8532
+ }
8533
+ },
8534
+ "href": {
8535
+ "type": "text",
8536
+ "required": true,
8537
+ "_meta": {
8538
+ "required": true
8539
+ }
8540
+ },
8541
+ "recipientAddress": {
8542
+ "type": "text",
8543
+ "required": true,
8544
+ "_meta": {
8545
+ "required": true
8546
+ }
8547
+ },
8548
+ "recipientName": {
8549
+ "type": "text",
8550
+ "required": false
8551
+ },
8552
+ "accountId": {
8553
+ "type": "foreignKey",
8554
+ "required": false,
8555
+ "related": "Account"
8556
+ },
8557
+ "messageId": {
8558
+ "type": "foreignKey",
8559
+ "required": false,
8560
+ "related": "Message"
8561
+ },
8562
+ "status": {
8563
+ "type": "text",
8564
+ "required": false,
8565
+ "default": "pending",
8566
+ "enum": [
8567
+ "pending",
8568
+ "sending",
8569
+ "sent",
8570
+ "failed",
8571
+ "uncertain",
8572
+ "cancelled"
8573
+ ]
8574
+ },
8575
+ "stateVersion": {
8576
+ "type": "integer",
8577
+ "required": true,
8578
+ "default": 0
8579
+ },
8580
+ "transitionId": {
8581
+ "type": "text",
8582
+ "required": false
8583
+ },
8584
+ "attempts": {
8585
+ "type": "integer",
8586
+ "required": true,
8587
+ "default": 0
8588
+ },
8589
+ "maxAttempts": {
8590
+ "type": "integer",
8591
+ "required": true,
8592
+ "default": 5
8593
+ },
8594
+ "nextAttemptAt": {
8595
+ "type": "text",
8596
+ "required": false
8597
+ },
8598
+ "leaseToken": {
8599
+ "type": "text",
8600
+ "required": false
8601
+ },
8602
+ "leaseExpiresAt": {
8603
+ "type": "datetime",
8604
+ "required": false
8605
+ },
8606
+ "handedOffAt": {
8607
+ "type": "datetime",
8608
+ "required": false
8609
+ },
8610
+ "deliveredAt": {
8611
+ "type": "datetime",
8612
+ "required": false
8613
+ },
8614
+ "providerMessageId": {
8615
+ "type": "text",
8616
+ "required": false
8617
+ },
8618
+ "lastError": {
8619
+ "type": "text",
8620
+ "required": false
8621
+ }
8622
+ },
8623
+ "methods": {
8624
+ "transition": {
8625
+ "name": "transition",
8626
+ "async": true,
8627
+ "parameters": [
8628
+ {
8629
+ "name": "changes",
8630
+ "type": "NotificationDeliveryTransition",
8631
+ "optional": false,
8632
+ "resolvedType": "Partial<Pick<NotificationDelivery, 'messageId' | 'status' | 'attempts' | 'nextAttemptAt' | 'leaseToken' | 'leaseExpiresAt' | 'handedOffAt' | 'deliveredAt' | 'providerMessageId' | 'lastError'>>"
8633
+ },
8634
+ {
8635
+ "name": "expected",
8636
+ "type": "object",
8637
+ "optional": true,
8638
+ "memberTypes": [
8639
+ "string"
8640
+ ]
8641
+ }
8642
+ ],
8643
+ "returnType": "Promise<boolean>",
8644
+ "isStatic": false,
8645
+ "isPublic": true
8646
+ }
8647
+ },
8648
+ "decoratorConfig": {
8649
+ "tableName": "notification_deliveries",
8650
+ "api": false,
8651
+ "mcp": false,
8652
+ "cli": false,
8653
+ "conflictColumns": [
8654
+ "tenant_id",
8655
+ "recipient_user_id",
8656
+ "channel",
8657
+ "source_ref"
8658
+ ],
8659
+ "indexes": [
8660
+ {
8661
+ "name": "notification_deliveries_due_idx",
8662
+ "columns": [
8663
+ "status",
8664
+ "nextAttemptAt"
8665
+ ]
8666
+ },
8667
+ {
8668
+ "name": "notification_deliveries_lease_idx",
8669
+ "columns": [
8670
+ "status",
8671
+ "leaseExpiresAt"
8672
+ ]
8673
+ }
7895
8674
  ],
7896
8675
  "tenantScoped": {
7897
8676
  "mode": "required"
7898
8677
  }
7899
8678
  },
7900
8679
  "extends": "SmrtObject",
7901
- "exportName": "MessagingEndpoint",
7902
- "collectionExportName": "MessagingEndpointCollection",
7903
- "displayLabelField": "label",
8680
+ "exportName": "NotificationDelivery",
8681
+ "collectionExportName": "NotificationDeliveryCollection",
7904
8682
  "validationRules": [
7905
8683
  {
7906
- "field": "label",
8684
+ "field": "recipientUserId",
7907
8685
  "rule": "required",
7908
- "fieldType": "text"
8686
+ "fieldType": "crossPackageRef"
7909
8687
  },
7910
8688
  {
7911
8689
  "field": "channel",
@@ -7913,20 +8691,61 @@
7913
8691
  "fieldType": "text"
7914
8692
  },
7915
8693
  {
7916
- "field": "address",
8694
+ "field": "sourceRef",
7917
8695
  "rule": "required",
7918
8696
  "fieldType": "text"
7919
8697
  },
7920
8698
  {
7921
- "field": "isActive",
8699
+ "field": "kind",
7922
8700
  "rule": "required",
7923
- "fieldType": "boolean"
8701
+ "fieldType": "text"
8702
+ },
8703
+ {
8704
+ "field": "subject",
8705
+ "rule": "required",
8706
+ "fieldType": "text"
8707
+ },
8708
+ {
8709
+ "field": "textBody",
8710
+ "rule": "required",
8711
+ "fieldType": "text"
8712
+ },
8713
+ {
8714
+ "field": "href",
8715
+ "rule": "required",
8716
+ "fieldType": "text"
8717
+ },
8718
+ {
8719
+ "field": "recipientAddress",
8720
+ "rule": "required",
8721
+ "fieldType": "text"
8722
+ },
8723
+ {
8724
+ "field": "stateVersion",
8725
+ "rule": "required",
8726
+ "fieldType": "integer"
8727
+ },
8728
+ {
8729
+ "field": "attempts",
8730
+ "rule": "required",
8731
+ "fieldType": "integer"
8732
+ },
8733
+ {
8734
+ "field": "maxAttempts",
8735
+ "rule": "required",
8736
+ "fieldType": "integer"
7924
8737
  }
7925
8738
  ],
7926
8739
  "schema": {
7927
- "tableName": "messaging_endpoints",
7928
- "ddl": "CREATE TABLE IF NOT EXISTS \"messaging_endpoints\" (\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 NOT NULL,\n \"profile_id\" UUID,\n \"label\" TEXT NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"address\" TEXT NOT NULL,\n \"is_active\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"verified_at\" TIMESTAMP\n);",
8740
+ "tableName": "notification_deliveries",
8741
+ "ddl": "CREATE TABLE IF NOT EXISTS \"notification_deliveries\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"channel\" TEXT NOT NULL DEFAULT 'email',\n \"source_ref\" TEXT NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"subject\" TEXT NOT NULL,\n \"text_body\" TEXT NOT NULL,\n \"href\" TEXT NOT NULL,\n \"recipient_address\" TEXT NOT NULL,\n \"recipient_name\" TEXT,\n \"account_id\" UUID,\n \"message_id\" UUID,\n \"status\" TEXT DEFAULT 'pending',\n \"state_version\" INTEGER NOT NULL DEFAULT 0,\n \"transition_id\" TEXT,\n \"attempts\" INTEGER NOT NULL DEFAULT 0,\n \"max_attempts\" INTEGER NOT NULL DEFAULT 5,\n \"next_attempt_at\" TEXT,\n \"lease_token\" TEXT,\n \"lease_expires_at\" TIMESTAMP,\n \"handed_off_at\" TIMESTAMP,\n \"delivered_at\" TIMESTAMP,\n \"provider_message_id\" TEXT,\n \"last_error\" TEXT\n);",
7929
8742
  "columns": {
8743
+ "_sync_origin_device_id": {
8744
+ "type": "TEXT"
8745
+ },
8746
+ "_sync_revision": {
8747
+ "type": "INTEGER"
8748
+ },
7930
8749
  "id": {
7931
8750
  "type": "UUID",
7932
8751
  "primaryKey": true,
@@ -7958,72 +8777,201 @@
7958
8777
  "notNull": true,
7959
8778
  "unique": false
7960
8779
  },
7961
- "profile_id": {
8780
+ "recipient_user_id": {
7962
8781
  "type": "UUID",
7963
8782
  "referenceKind": "crossPackageRef",
7964
- "notNull": false,
8783
+ "notNull": true,
7965
8784
  "unique": false
7966
8785
  },
7967
- "label": {
8786
+ "channel": {
8787
+ "type": "TEXT",
8788
+ "notNull": true,
8789
+ "unique": false,
8790
+ "default": "email"
8791
+ },
8792
+ "source_ref": {
7968
8793
  "type": "TEXT",
7969
8794
  "notNull": true,
7970
8795
  "unique": false
7971
8796
  },
7972
- "channel": {
8797
+ "kind": {
8798
+ "type": "TEXT",
8799
+ "notNull": true,
8800
+ "unique": false
8801
+ },
8802
+ "subject": {
8803
+ "type": "TEXT",
8804
+ "notNull": true,
8805
+ "unique": false
8806
+ },
8807
+ "text_body": {
8808
+ "type": "TEXT",
8809
+ "notNull": true,
8810
+ "unique": false
8811
+ },
8812
+ "href": {
8813
+ "type": "TEXT",
8814
+ "notNull": true,
8815
+ "unique": false
8816
+ },
8817
+ "recipient_address": {
7973
8818
  "type": "TEXT",
7974
8819
  "notNull": true,
8820
+ "unique": false
8821
+ },
8822
+ "recipient_name": {
8823
+ "type": "TEXT",
8824
+ "notNull": false,
8825
+ "unique": false
8826
+ },
8827
+ "account_id": {
8828
+ "type": "UUID",
8829
+ "referenceKind": "foreignKey",
8830
+ "notNull": false,
7975
8831
  "unique": false,
7976
- "default": "email"
8832
+ "foreignKey": {
8833
+ "table": "accounts",
8834
+ "column": "id",
8835
+ "onDelete": "NO ACTION",
8836
+ "onUpdate": "CASCADE"
8837
+ }
7977
8838
  },
7978
- "address": {
8839
+ "message_id": {
8840
+ "type": "UUID",
8841
+ "referenceKind": "foreignKey",
8842
+ "notNull": false,
8843
+ "unique": false,
8844
+ "foreignKey": {
8845
+ "table": "messages",
8846
+ "column": "id",
8847
+ "onDelete": "NO ACTION",
8848
+ "onUpdate": "CASCADE"
8849
+ }
8850
+ },
8851
+ "status": {
7979
8852
  "type": "TEXT",
8853
+ "notNull": false,
8854
+ "unique": false,
8855
+ "default": "pending"
8856
+ },
8857
+ "state_version": {
8858
+ "type": "INTEGER",
7980
8859
  "notNull": true,
8860
+ "unique": false,
8861
+ "default": 0
8862
+ },
8863
+ "transition_id": {
8864
+ "type": "TEXT",
8865
+ "notNull": false,
7981
8866
  "unique": false
7982
8867
  },
7983
- "is_active": {
7984
- "type": "BOOLEAN",
8868
+ "attempts": {
8869
+ "type": "INTEGER",
7985
8870
  "notNull": true,
7986
8871
  "unique": false,
7987
- "default": true
8872
+ "default": 0
7988
8873
  },
7989
- "verified_at": {
8874
+ "max_attempts": {
8875
+ "type": "INTEGER",
8876
+ "notNull": true,
8877
+ "unique": false,
8878
+ "default": 5
8879
+ },
8880
+ "next_attempt_at": {
8881
+ "type": "TEXT",
8882
+ "notNull": false,
8883
+ "unique": false
8884
+ },
8885
+ "lease_token": {
8886
+ "type": "TEXT",
8887
+ "notNull": false,
8888
+ "unique": false
8889
+ },
8890
+ "lease_expires_at": {
8891
+ "type": "TIMESTAMP",
8892
+ "notNull": false,
8893
+ "unique": false
8894
+ },
8895
+ "handed_off_at": {
8896
+ "type": "TIMESTAMP",
8897
+ "notNull": false,
8898
+ "unique": false
8899
+ },
8900
+ "delivered_at": {
7990
8901
  "type": "TIMESTAMP",
7991
8902
  "notNull": false,
7992
8903
  "unique": false
8904
+ },
8905
+ "provider_message_id": {
8906
+ "type": "TEXT",
8907
+ "notNull": false,
8908
+ "unique": false
8909
+ },
8910
+ "last_error": {
8911
+ "type": "TEXT",
8912
+ "notNull": false,
8913
+ "unique": false
7993
8914
  }
7994
8915
  },
7995
8916
  "indexes": [
7996
8917
  {
7997
- "name": "messaging_endpoints_tenant_id_channel_idx",
8918
+ "name": "notification_deliveries_tenant_id_recipient_user_id_idx",
7998
8919
  "columns": [
7999
8920
  "tenant_id",
8921
+ "recipient_user_id",
8000
8922
  "channel",
8001
- "label"
8923
+ "source_ref"
8002
8924
  ],
8003
8925
  "unique": true
8004
8926
  },
8005
8927
  {
8006
- "name": "messaging_endpoints_slug_context_idx",
8928
+ "name": "notification_deliveries_slug_context_idx",
8007
8929
  "columns": [
8008
8930
  "slug",
8009
8931
  "context"
8010
8932
  ]
8011
8933
  },
8012
8934
  {
8013
- "name": "messaging_endpoints_tenant_id_created_at_idx",
8935
+ "name": "notification_deliveries_due_idx",
8936
+ "columns": [
8937
+ "status",
8938
+ "next_attempt_at"
8939
+ ]
8940
+ },
8941
+ {
8942
+ "name": "notification_deliveries_lease_idx",
8943
+ "columns": [
8944
+ "status",
8945
+ "lease_expires_at"
8946
+ ]
8947
+ },
8948
+ {
8949
+ "name": "notification_deliveries_tenant_id_created_at_idx",
8014
8950
  "columns": [
8015
8951
  "tenant_id",
8016
8952
  "created_at"
8017
8953
  ]
8018
8954
  },
8019
8955
  {
8020
- "name": "messaging_endpoints_profile_id_idx",
8956
+ "name": "notification_deliveries_recipient_user_id_idx",
8021
8957
  "columns": [
8022
- "profile_id"
8958
+ "recipient_user_id"
8959
+ ]
8960
+ },
8961
+ {
8962
+ "name": "notification_deliveries_account_id_idx",
8963
+ "columns": [
8964
+ "account_id"
8965
+ ]
8966
+ },
8967
+ {
8968
+ "name": "notification_deliveries_message_id_idx",
8969
+ "columns": [
8970
+ "message_id"
8023
8971
  ]
8024
8972
  }
8025
8973
  ],
8026
- "version": "fca5554d"
8974
+ "version": "4da8dfdc"
8027
8975
  },
8028
8976
  "importPath": "@happyvertical/smrt-messages"
8029
8977
  },
@@ -8168,8 +9116,14 @@
8168
9116
  ],
8169
9117
  "schema": {
8170
9118
  "tableName": "persona_message_routes",
8171
- "ddl": "CREATE TABLE IF NOT EXISTS \"persona_message_routes\" (\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 NOT NULL,\n \"persona_id\" UUID NOT NULL,\n \"account_id\" UUID NOT NULL,\n \"endpoint_id\" UUID NOT NULL,\n \"purpose\" TEXT NOT NULL,\n \"priority\" INTEGER NOT NULL DEFAULT 0,\n \"enabled\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
9119
+ "ddl": "CREATE TABLE IF NOT EXISTS \"persona_message_routes\" (\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 NOT NULL,\n \"persona_id\" UUID NOT NULL,\n \"account_id\" UUID NOT NULL,\n \"endpoint_id\" UUID NOT NULL,\n \"purpose\" TEXT NOT NULL,\n \"priority\" INTEGER NOT NULL DEFAULT 0,\n \"enabled\" BOOLEAN NOT NULL DEFAULT TRUE\n);",
8172
9120
  "columns": {
9121
+ "_sync_origin_device_id": {
9122
+ "type": "TEXT"
9123
+ },
9124
+ "_sync_revision": {
9125
+ "type": "INTEGER"
9126
+ },
8173
9127
  "id": {
8174
9128
  "type": "UUID",
8175
9129
  "primaryKey": true,
@@ -8294,7 +9248,7 @@
8294
9248
  ]
8295
9249
  }
8296
9250
  ],
8297
- "version": "3dc1d5d0"
9251
+ "version": "3caf446e"
8298
9252
  },
8299
9253
  "importPath": "@happyvertical/smrt-messages"
8300
9254
  },
@@ -8574,8 +9528,14 @@
8574
9528
  ],
8575
9529
  "schema": {
8576
9530
  "tableName": "accounts",
8577
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
9531
+ "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);",
8578
9532
  "columns": {
9533
+ "_sync_origin_device_id": {
9534
+ "type": "TEXT"
9535
+ },
9536
+ "_sync_revision": {
9537
+ "type": "INTEGER"
9538
+ },
8579
9539
  "id": {
8580
9540
  "type": "UUID",
8581
9541
  "primaryKey": true,
@@ -8703,7 +9663,7 @@
8703
9663
  ]
8704
9664
  }
8705
9665
  ],
8706
- "version": "3854ea98"
9666
+ "version": "bab4f6cd"
8707
9667
  },
8708
9668
  "importPath": "@happyvertical/smrt-messages"
8709
9669
  },
@@ -9164,6 +10124,28 @@
9164
10124
  "isStatic": false,
9165
10125
  "isPublic": true
9166
10126
  },
10127
+ "isSendOutcomeUnknown": {
10128
+ "name": "isSendOutcomeUnknown",
10129
+ "async": false,
10130
+ "parameters": [],
10131
+ "returnType": "boolean",
10132
+ "isStatic": false,
10133
+ "isPublic": true
10134
+ },
10135
+ "abandonSendAttempt": {
10136
+ "name": "abandonSendAttempt",
10137
+ "async": true,
10138
+ "parameters": [
10139
+ {
10140
+ "name": "reason",
10141
+ "type": "string",
10142
+ "optional": false
10143
+ }
10144
+ ],
10145
+ "returnType": "Promise<boolean>",
10146
+ "isStatic": false,
10147
+ "isPublic": true
10148
+ },
9167
10149
  "retrySend": {
9168
10150
  "name": "retrySend",
9169
10151
  "async": true,
@@ -9303,8 +10285,14 @@
9303
10285
  ],
9304
10286
  "schema": {
9305
10287
  "tableName": "messages",
9306
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
10288
+ "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);",
9307
10289
  "columns": {
10290
+ "_sync_origin_device_id": {
10291
+ "type": "TEXT"
10292
+ },
10293
+ "_sync_revision": {
10294
+ "type": "INTEGER"
10295
+ },
9308
10296
  "id": {
9309
10297
  "type": "UUID",
9310
10298
  "primaryKey": true,
@@ -9655,7 +10643,7 @@
9655
10643
  ]
9656
10644
  }
9657
10645
  ],
9658
- "version": "f91bb49a"
10646
+ "version": "362ea703"
9659
10647
  },
9660
10648
  "importPath": "@happyvertical/smrt-messages"
9661
10649
  },
@@ -9911,8 +10899,14 @@
9911
10899
  ],
9912
10900
  "schema": {
9913
10901
  "tableName": "accounts",
9914
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
10902
+ "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);",
9915
10903
  "columns": {
10904
+ "_sync_origin_device_id": {
10905
+ "type": "TEXT"
10906
+ },
10907
+ "_sync_revision": {
10908
+ "type": "INTEGER"
10909
+ },
9916
10910
  "id": {
9917
10911
  "type": "UUID",
9918
10912
  "primaryKey": true,
@@ -10040,7 +11034,7 @@
10040
11034
  ]
10041
11035
  }
10042
11036
  ],
10043
- "version": "3854ea98"
11037
+ "version": "bab4f6cd"
10044
11038
  },
10045
11039
  "importPath": "@happyvertical/smrt-messages"
10046
11040
  },
@@ -10477,6 +11471,28 @@
10477
11471
  "isStatic": false,
10478
11472
  "isPublic": true
10479
11473
  },
11474
+ "isSendOutcomeUnknown": {
11475
+ "name": "isSendOutcomeUnknown",
11476
+ "async": false,
11477
+ "parameters": [],
11478
+ "returnType": "boolean",
11479
+ "isStatic": false,
11480
+ "isPublic": true
11481
+ },
11482
+ "abandonSendAttempt": {
11483
+ "name": "abandonSendAttempt",
11484
+ "async": true,
11485
+ "parameters": [
11486
+ {
11487
+ "name": "reason",
11488
+ "type": "string",
11489
+ "optional": false
11490
+ }
11491
+ ],
11492
+ "returnType": "Promise<boolean>",
11493
+ "isStatic": false,
11494
+ "isPublic": true
11495
+ },
10480
11496
  "retrySend": {
10481
11497
  "name": "retrySend",
10482
11498
  "async": true,
@@ -10636,8 +11652,14 @@
10636
11652
  ],
10637
11653
  "schema": {
10638
11654
  "tableName": "messages",
10639
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\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);",
11655
+ "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);",
10640
11656
  "columns": {
11657
+ "_sync_origin_device_id": {
11658
+ "type": "TEXT"
11659
+ },
11660
+ "_sync_revision": {
11661
+ "type": "INTEGER"
11662
+ },
10641
11663
  "id": {
10642
11664
  "type": "UUID",
10643
11665
  "primaryKey": true,
@@ -10988,7 +12010,7 @@
10988
12010
  ]
10989
12011
  }
10990
12012
  ],
10991
- "version": "ffd4cea3"
12013
+ "version": "32f5cb15"
10992
12014
  },
10993
12015
  "importPath": "@happyvertical/smrt-messages"
10994
12016
  },
@@ -11252,8 +12274,14 @@
11252
12274
  ],
11253
12275
  "schema": {
11254
12276
  "tableName": "accounts",
11255
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
12277
+ "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);",
11256
12278
  "columns": {
12279
+ "_sync_origin_device_id": {
12280
+ "type": "TEXT"
12281
+ },
12282
+ "_sync_revision": {
12283
+ "type": "INTEGER"
12284
+ },
11257
12285
  "id": {
11258
12286
  "type": "UUID",
11259
12287
  "primaryKey": true,
@@ -11381,7 +12409,7 @@
11381
12409
  ]
11382
12410
  }
11383
12411
  ],
11384
- "version": "3854ea98"
12412
+ "version": "bab4f6cd"
11385
12413
  },
11386
12414
  "importPath": "@happyvertical/smrt-messages"
11387
12415
  },
@@ -11522,8 +12550,14 @@
11522
12550
  ],
11523
12551
  "schema": {
11524
12552
  "tableName": "user_notifications",
11525
- "ddl": "CREATE TABLE IF NOT EXISTS \"user_notifications\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"title\" TEXT NOT NULL,\n \"body\" TEXT,\n \"href\" TEXT,\n \"severity\" TEXT DEFAULT 'info',\n \"source_ref\" TEXT NOT NULL,\n \"occurred_at\" TEXT,\n \"read_at\" TIMESTAMP,\n \"dismissed_at\" TIMESTAMP\n);",
12553
+ "ddl": "CREATE TABLE IF NOT EXISTS \"user_notifications\" (\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 NOT NULL,\n \"recipient_user_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL,\n \"title\" TEXT NOT NULL,\n \"body\" TEXT,\n \"href\" TEXT,\n \"severity\" TEXT DEFAULT 'info',\n \"source_ref\" TEXT NOT NULL,\n \"occurred_at\" TEXT,\n \"read_at\" TIMESTAMP,\n \"dismissed_at\" TIMESTAMP\n);",
11526
12554
  "columns": {
12555
+ "_sync_origin_device_id": {
12556
+ "type": "TEXT"
12557
+ },
12558
+ "_sync_revision": {
12559
+ "type": "INTEGER"
12560
+ },
11527
12561
  "id": {
11528
12562
  "type": "UUID",
11529
12563
  "primaryKey": true,
@@ -11647,7 +12681,7 @@
11647
12681
  ]
11648
12682
  }
11649
12683
  ],
11650
- "version": "0e68a388"
12684
+ "version": "43e6281c"
11651
12685
  },
11652
12686
  "importPath": "@happyvertical/smrt-messages"
11653
12687
  },
@@ -11744,8 +12778,14 @@
11744
12778
  "validationRules": [],
11745
12779
  "schema": {
11746
12780
  "tableName": "whitelists",
11747
- "ddl": "CREATE TABLE IF NOT EXISTS \"whitelists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"category\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"tenant_id\" UUID NOT NULL\n);",
12781
+ "ddl": "CREATE TABLE IF NOT EXISTS \"whitelists\" (\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 \"pattern\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'email',\n \"category\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"tenant_id\" UUID NOT NULL\n);",
11748
12782
  "columns": {
12783
+ "_sync_origin_device_id": {
12784
+ "type": "TEXT"
12785
+ },
12786
+ "_sync_revision": {
12787
+ "type": "INTEGER"
12788
+ },
11749
12789
  "id": {
11750
12790
  "type": "UUID",
11751
12791
  "primaryKey": true,
@@ -11819,7 +12859,7 @@
11819
12859
  ]
11820
12860
  }
11821
12861
  ],
11822
- "version": "40a655a1"
12862
+ "version": "eb5b558d"
11823
12863
  },
11824
12864
  "importPath": "@happyvertical/smrt-messages"
11825
12865
  },
@@ -12075,8 +13115,14 @@
12075
13115
  ],
12076
13116
  "schema": {
12077
13117
  "tableName": "accounts",
12078
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\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);",
13118
+ "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);",
12079
13119
  "columns": {
13120
+ "_sync_origin_device_id": {
13121
+ "type": "TEXT"
13122
+ },
13123
+ "_sync_revision": {
13124
+ "type": "INTEGER"
13125
+ },
12080
13126
  "id": {
12081
13127
  "type": "UUID",
12082
13128
  "primaryKey": true,
@@ -12204,7 +13250,7 @@
12204
13250
  ]
12205
13251
  }
12206
13252
  ],
12207
- "version": "3854ea98"
13253
+ "version": "bab4f6cd"
12208
13254
  },
12209
13255
  "importPath": "@happyvertical/smrt-messages"
12210
13256
  }