@open-workspace/email 0.2.0 → 0.4.0

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 (223) hide show
  1. package/README.md +23 -20
  2. package/alchemy/index.ts +273 -0
  3. package/drizzle/mailbox/0000_puzzling_dracula.sql +149 -0
  4. package/drizzle/mailbox/0001_mute_jack_flag.sql +12 -0
  5. package/drizzle/mailbox/meta/0000_snapshot.json +1002 -0
  6. package/drizzle/mailbox/meta/0001_snapshot.json +1002 -0
  7. package/drizzle/mailbox/meta/_journal.json +20 -0
  8. package/drizzle/mailbox/migrations.js +12 -0
  9. package/index.ts +3 -1
  10. package/migrations/0000_dry_moon_knight.sql +77 -0
  11. package/migrations/meta/0000_snapshot.json +248 -106
  12. package/migrations/meta/_journal.json +2 -2
  13. package/package.json +74 -68
  14. package/shared/attachment-preview.ts +37 -27
  15. package/shared/folder-order.ts +106 -0
  16. package/shared/mail-authentication.ts +8 -3
  17. package/shared/mail-feedback.ts +18 -25
  18. package/shared/mail-headers.ts +114 -39
  19. package/shared/mail-import.ts +38 -0
  20. package/shared/mail-path.ts +42 -0
  21. package/shared/mail-received.ts +174 -31
  22. package/shared/mail-remote.ts +59 -2
  23. package/shared/mail-sender-intel.ts +22 -4
  24. package/shared/mail.ts +78 -26
  25. package/shared/module.ts +33 -0
  26. package/shared/office-preview.ts +14 -2
  27. package/shared/pdfjs-assets.ts +35 -0
  28. package/shared/permissions.ts +73 -0
  29. package/shared/webhooks.ts +41 -0
  30. package/src/admin/blocked-senders.tsx +189 -0
  31. package/src/client.tsx +97 -0
  32. package/src/lib/mail-api.ts +9 -0
  33. package/src/mail/attachment-preview-dialog.tsx +161 -0
  34. package/src/mail/blocked-senders.tsx +138 -0
  35. package/src/mail/compose-window-chrome.tsx +194 -0
  36. package/src/mail/compose-window.tsx +486 -0
  37. package/src/mail/composer-asset-bookmarks.ts +409 -0
  38. package/src/mail/composer-asset.tsx +229 -0
  39. package/src/mail/composer-attachment-list.tsx +138 -0
  40. package/src/mail/composer-editor-document.ts +65 -0
  41. package/src/mail/composer-editor.tsx +284 -0
  42. package/src/mail/composer-linked-attachment-text.ts +12 -0
  43. package/src/mail/composer-recipient-fields.tsx +165 -0
  44. package/src/mail/composer-recipients.ts +208 -0
  45. package/src/mail/composer-session.ts +562 -0
  46. package/src/mail/composer-toolbar.tsx +303 -0
  47. package/src/mail/composer-upload-client.ts +105 -0
  48. package/src/mail/composer-upload-progress.ts +53 -0
  49. package/src/mail/conversation-list.tsx +550 -0
  50. package/src/mail/conversation-loading-skeleton.tsx +119 -0
  51. package/src/mail/conversation-message.tsx +346 -0
  52. package/src/mail/conversation-reply.tsx +470 -0
  53. package/src/mail/conversation-selection-toolbar.tsx +322 -0
  54. package/src/mail/conversation-view.tsx +437 -0
  55. package/src/mail/delivery-indicator.tsx +272 -0
  56. package/src/mail/email-html-body.tsx +203 -0
  57. package/src/mail/folder-glyph.tsx +46 -0
  58. package/src/mail/folder-manager.tsx +532 -0
  59. package/src/mail/format-bytes.ts +7 -0
  60. package/src/mail/mail-app-bar.tsx +253 -0
  61. package/src/mail/mail-background.tsx +12 -0
  62. package/src/mail/mail-dock.tsx +137 -0
  63. package/src/mail/mail-folders.ts +44 -0
  64. package/src/mail/mail-layout.css +236 -0
  65. package/src/mail/mail-location.ts +73 -0
  66. package/src/mail/mail-mailbox-sheet.tsx +275 -0
  67. package/src/mail/mail-nav-rail.tsx +129 -0
  68. package/src/mail/mail-nav.tsx +324 -0
  69. package/src/mail/mail-prefetch.ts +59 -0
  70. package/src/mail/mail-primitives.tsx +66 -0
  71. package/src/mail/mail-queries.ts +209 -0
  72. package/src/mail/mail-query-cache.ts +486 -0
  73. package/src/mail/mail-seed.ts +47 -0
  74. package/src/mail/mail-shell.tsx +126 -0
  75. package/src/mail/mailbox-ai-settings.tsx +185 -0
  76. package/src/mail/mailbox-realtime.tsx +251 -0
  77. package/src/mail/mailbox-route.tsx +15 -0
  78. package/src/mail/message-actions.tsx +353 -0
  79. package/src/mail/message-attachments.tsx +200 -0
  80. package/src/mail/message-format.ts +75 -0
  81. package/src/mail/message-header.tsx +260 -0
  82. package/src/mail/message-translation.tsx +225 -0
  83. package/src/mail/original-message-sheet.tsx +619 -0
  84. package/src/mail/original-message.ts +191 -0
  85. package/src/mail/outbound-notification.ts +53 -0
  86. package/src/mail/pane-splitter.tsx +117 -0
  87. package/src/mail/pdf-preview-toolbar.tsx +152 -0
  88. package/src/mail/pdf-preview.css +44 -0
  89. package/src/mail/pdf-preview.tsx +156 -0
  90. package/src/mail/pdf-translation-layout.ts +95 -0
  91. package/src/mail/print-message.ts +92 -0
  92. package/src/mail/reader-pane.tsx +535 -0
  93. package/src/mail/recipient-combobox.tsx +335 -0
  94. package/src/mail/recipient-field-row.tsx +34 -0
  95. package/src/mail/reply-to-warning.tsx +50 -0
  96. package/src/mail/sanitize-email-html.ts +430 -0
  97. package/src/mail/sender-actions.tsx +149 -0
  98. package/src/mail/sender-authentication.tsx +485 -0
  99. package/src/mail/sender-dialogs.tsx +384 -0
  100. package/src/mail/sender-security.tsx +545 -0
  101. package/src/mail/toolbar-tooltip.tsx +29 -0
  102. package/src/mail/translation-html.ts +49 -0
  103. package/src/mail/translation-language.ts +21 -0
  104. package/src/mail/types.ts +53 -0
  105. package/src/mail/unread-document-indicator.tsx +60 -0
  106. package/src/mail/use-compose-submission.ts +208 -0
  107. package/src/mail/use-composer-attachment-preflight.ts +184 -0
  108. package/src/mail/use-composer-submission.ts +117 -0
  109. package/src/mail/use-conversation-selection.ts +186 -0
  110. package/src/mail/use-mail-controller.ts +427 -0
  111. package/src/mail/use-mail-data.ts +279 -0
  112. package/src/mail/use-mail-safety.ts +155 -0
  113. package/src/mail/use-mail-send.ts +142 -0
  114. package/src/mail/use-pdf-translation-overlay.ts +156 -0
  115. package/src/mail/use-pdf-translation.ts +100 -0
  116. package/src/mail/use-pdf-viewer.ts +215 -0
  117. package/src/mail/use-reply-submission.ts +114 -0
  118. package/src/mail/use-sanitized-email-html.ts +20 -0
  119. package/src/mail/use-visible-message-read.ts +138 -0
  120. package/src/pwa/push-subscription.ts +151 -0
  121. package/src/settings/mail-apps-page.tsx +235 -0
  122. package/src/settings/notifications-page.tsx +291 -0
  123. package/worker/admin/blocked-sender-routes.ts +166 -0
  124. package/worker/admin/schemas.ts +11 -0
  125. package/worker/bindings.d.ts +14 -10
  126. package/worker/db/schema.ts +90 -34
  127. package/worker/jmap/eventsource.ts +169 -0
  128. package/worker/jmap/methods.ts +1716 -361
  129. package/worker/jmap/push-types.ts +27 -0
  130. package/worker/jmap/push.ts +207 -0
  131. package/worker/jmap/routes.ts +448 -86
  132. package/worker/mail/access.ts +258 -21
  133. package/worker/mail/ai-classification.ts +36 -20
  134. package/worker/mail/ai-translation.ts +13 -6
  135. package/worker/mail/auth-headers.ts +395 -137
  136. package/worker/mail/bimi.ts +200 -73
  137. package/worker/mail/bootstrap.ts +79 -0
  138. package/worker/mail/capped-body.ts +36 -0
  139. package/worker/mail/classification-signals.ts +35 -25
  140. package/worker/mail/conversation-cursor.ts +30 -19
  141. package/worker/mail/delivery-events.ts +88 -62
  142. package/worker/mail/delivery-facts.ts +46 -10
  143. package/worker/mail/demo-routes.ts +34 -10
  144. package/worker/mail/doh.ts +62 -23
  145. package/worker/mail/downloads.ts +75 -40
  146. package/worker/mail/edge-cache.ts +155 -0
  147. package/worker/mail/header-metadata.ts +84 -52
  148. package/worker/mail/impersonation.ts +160 -38
  149. package/worker/mail/import-routes.ts +313 -0
  150. package/worker/mail/inbound-delivery.ts +19 -9
  151. package/worker/mail/inbound-threading.ts +18 -8
  152. package/worker/mail/inbound.ts +82 -40
  153. package/worker/mail/ip-intel.ts +110 -27
  154. package/worker/mail/isolate-cache.ts +35 -0
  155. package/worker/mail/link-domains.ts +29 -7
  156. package/worker/mail/mailbox-deletion.ts +10 -4
  157. package/worker/mail/mailbox-directory.ts +16 -6
  158. package/worker/mail/mailing-list.ts +94 -39
  159. package/worker/mail/message-security.ts +90 -15
  160. package/worker/mail/message-view.ts +18 -6
  161. package/worker/mail/office-conversion.ts +31 -9
  162. package/worker/mail/office-preview-container.ts +40 -13
  163. package/worker/mail/office-preview-queue.ts +76 -32
  164. package/worker/mail/org-domain.ts +8 -1
  165. package/worker/mail/outbound-content.ts +71 -26
  166. package/worker/mail/outbound-delivery.ts +31 -17
  167. package/worker/mail/outbound-service.ts +48 -30
  168. package/worker/mail/outbound-threading.ts +30 -17
  169. package/worker/mail/outbound.ts +97 -70
  170. package/worker/mail/outgoing-context.ts +25 -15
  171. package/worker/mail/participants.ts +44 -29
  172. package/worker/mail/push-notifications.ts +283 -171
  173. package/worker/mail/quote-parser.ts +21 -10
  174. package/worker/mail/r2-presigned-urls.ts +31 -25
  175. package/worker/mail/receive.ts +23 -11
  176. package/worker/mail/recipients.ts +6 -1
  177. package/worker/mail/remote-proxy.ts +187 -31
  178. package/worker/mail/remote-routes.ts +87 -0
  179. package/worker/mail/remote-token.ts +104 -0
  180. package/worker/mail/repeat.ts +19 -0
  181. package/worker/mail/reply-plan.ts +62 -33
  182. package/worker/mail/rfc.ts +32 -7
  183. package/worker/mail/routes.ts +871 -542
  184. package/worker/mail/safety-routes.ts +329 -202
  185. package/worker/mail/schemas.ts +84 -105
  186. package/worker/mail/search.ts +1 -0
  187. package/worker/mail/security-settings.ts +41 -9
  188. package/worker/mail/sender-intel.ts +206 -51
  189. package/worker/mail/spamhaus.ts +92 -45
  190. package/worker/mail/unsubscribe.ts +76 -18
  191. package/worker/mail/uploads.ts +153 -91
  192. package/worker/mail/webhook-source.ts +35 -12
  193. package/worker/mail/workspace-safety.ts +97 -38
  194. package/worker/mailbox/demo-html.ts +7 -7
  195. package/worker/mailbox/demo-seed.ts +10 -44
  196. package/worker/mailbox/demo.ts +597 -227
  197. package/worker/mailbox/email-index.ts +53 -0
  198. package/worker/mailbox/folder-model.ts +53 -17
  199. package/worker/mailbox/import-placement.ts +88 -0
  200. package/worker/mailbox/inbox-counts.ts +106 -0
  201. package/worker/mailbox/index.ts +1761 -737
  202. package/worker/mailbox/jmap-store.ts +139 -35
  203. package/worker/mailbox/model.ts +7 -14
  204. package/worker/mailbox/office-preview-jobs.ts +56 -25
  205. package/worker/mailbox/schema.ts +87 -66
  206. package/worker/mailbox/senders.ts +176 -70
  207. package/worker/mcp/mail-action-tools.ts +128 -87
  208. package/worker/mcp/mail-compose-tools.ts +133 -82
  209. package/worker/mcp/mail-query-tools.ts +120 -71
  210. package/worker/mcp/mail-safety-tools.ts +321 -248
  211. package/worker/mcp/schemas.ts +43 -0
  212. package/worker/mcp/tools.ts +13 -10
  213. package/worker/module.ts +43 -18
  214. package/worker/sql.d.ts +8 -0
  215. package/alchemy.ts +0 -126
  216. package/containers/office-preview/Dockerfile +0 -10
  217. package/migrations/0000_email.sql +0 -53
  218. package/shared/mail-rules.ts +0 -156
  219. package/worker/admin/report-routes.ts +0 -164
  220. package/worker/mail/reported-messages.ts +0 -68
  221. package/worker/mailbox/legacy-migrations.ts +0 -41
  222. package/worker/mailbox/migrations.ts +0 -10
  223. package/worker/mailbox/rules.ts +0 -110
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "6",
8
+ "when": 1794374467401,
9
+ "tag": "0000_puzzling_dracula",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1794379791382,
16
+ "tag": "0001_mute_jack_flag",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,12 @@
1
+ import journal from './meta/_journal.json';
2
+ import m0000 from './0000_puzzling_dracula.sql';
3
+ import m0001 from './0001_mute_jack_flag.sql';
4
+
5
+ export default {
6
+ journal,
7
+ migrations: {
8
+ m0000,
9
+ m0001
10
+ }
11
+ }
12
+
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
- export { email, type MailAppType } from "./worker/module";
1
+ export { email, email as default, type MailAppType } from "./worker/module";
2
+
2
3
  export { MailboxDO } from "./worker/mailbox/index";
4
+
3
5
  export { OfficePreviewContainer } from "./worker/mail/office-preview-container";
@@ -0,0 +1,77 @@
1
+ CREATE TABLE `blocked_senders` (
2
+ `pattern` text PRIMARY KEY NOT NULL,
3
+ `created_by_user_id` text,
4
+ `created_at` integer NOT NULL,
5
+ FOREIGN KEY (`created_by_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
6
+ );
7
+ --> statement-breakpoint
8
+ CREATE TABLE `jmap_push_subscriptions` (
9
+ `id` text PRIMARY KEY NOT NULL,
10
+ `user_id` text NOT NULL,
11
+ `client_id` text NOT NULL,
12
+ `device_client_id` text NOT NULL,
13
+ `url` text NOT NULL,
14
+ `p256dh` text,
15
+ `auth` text,
16
+ `verification_code` text NOT NULL,
17
+ `verified_at` integer,
18
+ `expires_at` integer NOT NULL,
19
+ `types_json` text,
20
+ `created_at` integer NOT NULL,
21
+ FOREIGN KEY (`client_id`,`user_id`) REFERENCES `oidc_grants`(`client_id`,`user_id`) ON UPDATE no action ON DELETE cascade
22
+ );
23
+ --> statement-breakpoint
24
+ CREATE UNIQUE INDEX `jmap_push_subscriptions_device_unique` ON `jmap_push_subscriptions` (`user_id`,`device_client_id`);--> statement-breakpoint
25
+ CREATE INDEX `jmap_push_subscriptions_expires_idx` ON `jmap_push_subscriptions` (`expires_at`);--> statement-breakpoint
26
+ CREATE TABLE `mailbox_counts` (
27
+ `mailbox_id` text PRIMARY KEY NOT NULL,
28
+ `incoming_count` integer NOT NULL,
29
+ `version` integer NOT NULL,
30
+ `updated_at` integer NOT NULL,
31
+ FOREIGN KEY (`mailbox_id`) REFERENCES `mailboxes`(`id`) ON UPDATE no action ON DELETE cascade
32
+ );
33
+ --> statement-breakpoint
34
+ CREATE TABLE `mailbox_notification_preferences` (
35
+ `mailbox_id` text NOT NULL,
36
+ `user_id` text NOT NULL,
37
+ `enabled` integer DEFAULT true NOT NULL,
38
+ `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
39
+ PRIMARY KEY(`mailbox_id`, `user_id`),
40
+ FOREIGN KEY (`mailbox_id`) REFERENCES `mailboxes`(`id`) ON UPDATE no action ON DELETE cascade,
41
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
42
+ );
43
+ --> statement-breakpoint
44
+ CREATE INDEX `mailbox_notification_preferences_user_idx` ON `mailbox_notification_preferences` (`user_id`);--> statement-breakpoint
45
+ CREATE TABLE `mailbox_read_counts` (
46
+ `mailbox_id` text NOT NULL,
47
+ `user_id` text NOT NULL,
48
+ `read_count` integer NOT NULL,
49
+ PRIMARY KEY(`mailbox_id`, `user_id`),
50
+ FOREIGN KEY (`mailbox_id`) REFERENCES `mailboxes`(`id`) ON UPDATE no action ON DELETE cascade
51
+ );
52
+ --> statement-breakpoint
53
+ CREATE TABLE `push_subscriptions` (
54
+ `id` text PRIMARY KEY NOT NULL,
55
+ `user_id` text NOT NULL,
56
+ `endpoint` text NOT NULL,
57
+ `p256dh` text NOT NULL,
58
+ `auth` text NOT NULL,
59
+ `created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
60
+ `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
61
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
62
+ );
63
+ --> statement-breakpoint
64
+ CREATE UNIQUE INDEX `push_subscriptions_endpoint_unique` ON `push_subscriptions` (`endpoint`);--> statement-breakpoint
65
+ CREATE INDEX `push_subscriptions_user_idx` ON `push_subscriptions` (`user_id`);--> statement-breakpoint
66
+ CREATE TABLE `sender_reports` (
67
+ `mailbox_id` text NOT NULL,
68
+ `email_id` text NOT NULL,
69
+ `address` text NOT NULL,
70
+ `domain` text NOT NULL,
71
+ `label` text NOT NULL,
72
+ `created_at` integer NOT NULL,
73
+ PRIMARY KEY(`mailbox_id`, `email_id`),
74
+ FOREIGN KEY (`mailbox_id`) REFERENCES `mailboxes`(`id`) ON UPDATE no action ON DELETE cascade
75
+ );
76
+ --> statement-breakpoint
77
+ CREATE INDEX `sender_reports_domain_idx` ON `sender_reports` (`domain`,`address`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "cf90d43b-4927-4d8c-aad6-9d1182a8e66a",
4
+ "id": "3c9a9f87-017b-4419-8672-d798164a2460",
5
5
  "prevId": "00000000-0000-0000-0000-000000000000",
6
6
  "tables": {
7
7
  "blocked_senders": {
@@ -14,13 +14,6 @@
14
14
  "notNull": true,
15
15
  "autoincrement": false
16
16
  },
17
- "report_id": {
18
- "name": "report_id",
19
- "type": "text",
20
- "primaryKey": false,
21
- "notNull": false,
22
- "autoincrement": false
23
- },
24
17
  "created_by_user_id": {
25
18
  "name": "created_by_user_id",
26
19
  "type": "text",
@@ -38,30 +31,195 @@
38
31
  },
39
32
  "indexes": {},
40
33
  "foreignKeys": {
41
- "blocked_senders_report_id_reported_messages_id_fk": {
42
- "name": "blocked_senders_report_id_reported_messages_id_fk",
34
+ "blocked_senders_created_by_user_id_users_id_fk": {
35
+ "name": "blocked_senders_created_by_user_id_users_id_fk",
43
36
  "tableFrom": "blocked_senders",
44
- "tableTo": "reported_messages",
37
+ "tableTo": "users",
45
38
  "columnsFrom": [
46
- "report_id"
39
+ "created_by_user_id"
47
40
  ],
48
41
  "columnsTo": [
49
42
  "id"
50
43
  ],
51
44
  "onDelete": "set null",
52
45
  "onUpdate": "no action"
46
+ }
47
+ },
48
+ "compositePrimaryKeys": {},
49
+ "uniqueConstraints": {},
50
+ "checkConstraints": {}
51
+ },
52
+ "jmap_push_subscriptions": {
53
+ "name": "jmap_push_subscriptions",
54
+ "columns": {
55
+ "id": {
56
+ "name": "id",
57
+ "type": "text",
58
+ "primaryKey": true,
59
+ "notNull": true,
60
+ "autoincrement": false
53
61
  },
54
- "blocked_senders_created_by_user_id_users_id_fk": {
55
- "name": "blocked_senders_created_by_user_id_users_id_fk",
56
- "tableFrom": "blocked_senders",
57
- "tableTo": "users",
62
+ "user_id": {
63
+ "name": "user_id",
64
+ "type": "text",
65
+ "primaryKey": false,
66
+ "notNull": true,
67
+ "autoincrement": false
68
+ },
69
+ "client_id": {
70
+ "name": "client_id",
71
+ "type": "text",
72
+ "primaryKey": false,
73
+ "notNull": true,
74
+ "autoincrement": false
75
+ },
76
+ "device_client_id": {
77
+ "name": "device_client_id",
78
+ "type": "text",
79
+ "primaryKey": false,
80
+ "notNull": true,
81
+ "autoincrement": false
82
+ },
83
+ "url": {
84
+ "name": "url",
85
+ "type": "text",
86
+ "primaryKey": false,
87
+ "notNull": true,
88
+ "autoincrement": false
89
+ },
90
+ "p256dh": {
91
+ "name": "p256dh",
92
+ "type": "text",
93
+ "primaryKey": false,
94
+ "notNull": false,
95
+ "autoincrement": false
96
+ },
97
+ "auth": {
98
+ "name": "auth",
99
+ "type": "text",
100
+ "primaryKey": false,
101
+ "notNull": false,
102
+ "autoincrement": false
103
+ },
104
+ "verification_code": {
105
+ "name": "verification_code",
106
+ "type": "text",
107
+ "primaryKey": false,
108
+ "notNull": true,
109
+ "autoincrement": false
110
+ },
111
+ "verified_at": {
112
+ "name": "verified_at",
113
+ "type": "integer",
114
+ "primaryKey": false,
115
+ "notNull": false,
116
+ "autoincrement": false
117
+ },
118
+ "expires_at": {
119
+ "name": "expires_at",
120
+ "type": "integer",
121
+ "primaryKey": false,
122
+ "notNull": true,
123
+ "autoincrement": false
124
+ },
125
+ "types_json": {
126
+ "name": "types_json",
127
+ "type": "text",
128
+ "primaryKey": false,
129
+ "notNull": false,
130
+ "autoincrement": false
131
+ },
132
+ "created_at": {
133
+ "name": "created_at",
134
+ "type": "integer",
135
+ "primaryKey": false,
136
+ "notNull": true,
137
+ "autoincrement": false
138
+ }
139
+ },
140
+ "indexes": {
141
+ "jmap_push_subscriptions_device_unique": {
142
+ "name": "jmap_push_subscriptions_device_unique",
143
+ "columns": [
144
+ "user_id",
145
+ "device_client_id"
146
+ ],
147
+ "isUnique": true
148
+ },
149
+ "jmap_push_subscriptions_expires_idx": {
150
+ "name": "jmap_push_subscriptions_expires_idx",
151
+ "columns": [
152
+ "expires_at"
153
+ ],
154
+ "isUnique": false
155
+ }
156
+ },
157
+ "foreignKeys": {
158
+ "jmap_push_subscriptions_client_id_user_id_oidc_grants_client_id_user_id_fk": {
159
+ "name": "jmap_push_subscriptions_client_id_user_id_oidc_grants_client_id_user_id_fk",
160
+ "tableFrom": "jmap_push_subscriptions",
161
+ "tableTo": "oidc_grants",
58
162
  "columnsFrom": [
59
- "created_by_user_id"
163
+ "client_id",
164
+ "user_id"
165
+ ],
166
+ "columnsTo": [
167
+ "client_id",
168
+ "user_id"
169
+ ],
170
+ "onDelete": "cascade",
171
+ "onUpdate": "no action"
172
+ }
173
+ },
174
+ "compositePrimaryKeys": {},
175
+ "uniqueConstraints": {},
176
+ "checkConstraints": {}
177
+ },
178
+ "mailbox_counts": {
179
+ "name": "mailbox_counts",
180
+ "columns": {
181
+ "mailbox_id": {
182
+ "name": "mailbox_id",
183
+ "type": "text",
184
+ "primaryKey": true,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "incoming_count": {
189
+ "name": "incoming_count",
190
+ "type": "integer",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "version": {
196
+ "name": "version",
197
+ "type": "integer",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "updated_at": {
203
+ "name": "updated_at",
204
+ "type": "integer",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "autoincrement": false
208
+ }
209
+ },
210
+ "indexes": {},
211
+ "foreignKeys": {
212
+ "mailbox_counts_mailbox_id_mailboxes_id_fk": {
213
+ "name": "mailbox_counts_mailbox_id_mailboxes_id_fk",
214
+ "tableFrom": "mailbox_counts",
215
+ "tableTo": "mailboxes",
216
+ "columnsFrom": [
217
+ "mailbox_id"
60
218
  ],
61
219
  "columnsTo": [
62
220
  "id"
63
221
  ],
64
- "onDelete": "set null",
222
+ "onDelete": "cascade",
65
223
  "onUpdate": "no action"
66
224
  }
67
225
  },
@@ -152,16 +310,9 @@
152
310
  "uniqueConstraints": {},
153
311
  "checkConstraints": {}
154
312
  },
155
- "reported_messages": {
156
- "name": "reported_messages",
313
+ "mailbox_read_counts": {
314
+ "name": "mailbox_read_counts",
157
315
  "columns": {
158
- "id": {
159
- "name": "id",
160
- "type": "text",
161
- "primaryKey": true,
162
- "notNull": true,
163
- "autoincrement": false
164
- },
165
316
  "mailbox_id": {
166
317
  "name": "mailbox_id",
167
318
  "type": "text",
@@ -169,141 +320,132 @@
169
320
  "notNull": true,
170
321
  "autoincrement": false
171
322
  },
172
- "email_id": {
173
- "name": "email_id",
323
+ "user_id": {
324
+ "name": "user_id",
174
325
  "type": "text",
175
326
  "primaryKey": false,
176
327
  "notNull": true,
177
328
  "autoincrement": false
178
329
  },
179
- "reporter_user_id": {
180
- "name": "reporter_user_id",
181
- "type": "text",
182
- "primaryKey": false,
183
- "notNull": false,
184
- "autoincrement": false
185
- },
186
- "sender_address": {
187
- "name": "sender_address",
188
- "type": "text",
330
+ "read_count": {
331
+ "name": "read_count",
332
+ "type": "integer",
189
333
  "primaryKey": false,
190
334
  "notNull": true,
191
335
  "autoincrement": false
192
- },
193
- "sender_domain": {
194
- "name": "sender_domain",
336
+ }
337
+ },
338
+ "indexes": {},
339
+ "foreignKeys": {
340
+ "mailbox_read_counts_mailbox_id_mailboxes_id_fk": {
341
+ "name": "mailbox_read_counts_mailbox_id_mailboxes_id_fk",
342
+ "tableFrom": "mailbox_read_counts",
343
+ "tableTo": "mailboxes",
344
+ "columnsFrom": [
345
+ "mailbox_id"
346
+ ],
347
+ "columnsTo": [
348
+ "id"
349
+ ],
350
+ "onDelete": "cascade",
351
+ "onUpdate": "no action"
352
+ }
353
+ },
354
+ "compositePrimaryKeys": {
355
+ "mailbox_read_counts_mailbox_id_user_id_pk": {
356
+ "columns": [
357
+ "mailbox_id",
358
+ "user_id"
359
+ ],
360
+ "name": "mailbox_read_counts_mailbox_id_user_id_pk"
361
+ }
362
+ },
363
+ "uniqueConstraints": {},
364
+ "checkConstraints": {}
365
+ },
366
+ "push_subscriptions": {
367
+ "name": "push_subscriptions",
368
+ "columns": {
369
+ "id": {
370
+ "name": "id",
195
371
  "type": "text",
196
- "primaryKey": false,
372
+ "primaryKey": true,
197
373
  "notNull": true,
198
374
  "autoincrement": false
199
375
  },
200
- "subject": {
201
- "name": "subject",
376
+ "user_id": {
377
+ "name": "user_id",
202
378
  "type": "text",
203
379
  "primaryKey": false,
204
380
  "notNull": true,
205
381
  "autoincrement": false
206
382
  },
207
- "received_at": {
208
- "name": "received_at",
209
- "type": "integer",
383
+ "endpoint": {
384
+ "name": "endpoint",
385
+ "type": "text",
210
386
  "primaryKey": false,
211
387
  "notNull": true,
212
388
  "autoincrement": false
213
389
  },
214
- "snapshot_json": {
215
- "name": "snapshot_json",
390
+ "p256dh": {
391
+ "name": "p256dh",
216
392
  "type": "text",
217
393
  "primaryKey": false,
218
394
  "notNull": true,
219
395
  "autoincrement": false
220
396
  },
221
- "status": {
222
- "name": "status",
397
+ "auth": {
398
+ "name": "auth",
223
399
  "type": "text",
224
400
  "primaryKey": false,
225
401
  "notNull": true,
226
- "autoincrement": false,
227
- "default": "'open'"
228
- },
229
- "resolved_by_user_id": {
230
- "name": "resolved_by_user_id",
231
- "type": "text",
232
- "primaryKey": false,
233
- "notNull": false,
234
402
  "autoincrement": false
235
403
  },
236
- "resolved_at": {
237
- "name": "resolved_at",
404
+ "created_at": {
405
+ "name": "created_at",
238
406
  "type": "integer",
239
407
  "primaryKey": false,
240
- "notNull": false,
241
- "autoincrement": false
408
+ "notNull": true,
409
+ "autoincrement": false,
410
+ "default": "(unixepoch() * 1000)"
242
411
  },
243
- "created_at": {
244
- "name": "created_at",
412
+ "updated_at": {
413
+ "name": "updated_at",
245
414
  "type": "integer",
246
415
  "primaryKey": false,
247
416
  "notNull": true,
248
- "autoincrement": false
417
+ "autoincrement": false,
418
+ "default": "(unixepoch() * 1000)"
249
419
  }
250
420
  },
251
421
  "indexes": {
252
- "reported_messages_email_unique": {
253
- "name": "reported_messages_email_unique",
422
+ "push_subscriptions_endpoint_unique": {
423
+ "name": "push_subscriptions_endpoint_unique",
254
424
  "columns": [
255
- "mailbox_id",
256
- "email_id"
425
+ "endpoint"
257
426
  ],
258
427
  "isUnique": true
259
428
  },
260
- "reported_messages_status_idx": {
261
- "name": "reported_messages_status_idx",
429
+ "push_subscriptions_user_idx": {
430
+ "name": "push_subscriptions_user_idx",
262
431
  "columns": [
263
- "status",
264
- "created_at"
432
+ "user_id"
265
433
  ],
266
434
  "isUnique": false
267
435
  }
268
436
  },
269
437
  "foreignKeys": {
270
- "reported_messages_mailbox_id_mailboxes_id_fk": {
271
- "name": "reported_messages_mailbox_id_mailboxes_id_fk",
272
- "tableFrom": "reported_messages",
273
- "tableTo": "mailboxes",
274
- "columnsFrom": [
275
- "mailbox_id"
276
- ],
277
- "columnsTo": [
278
- "id"
279
- ],
280
- "onDelete": "cascade",
281
- "onUpdate": "no action"
282
- },
283
- "reported_messages_reporter_user_id_users_id_fk": {
284
- "name": "reported_messages_reporter_user_id_users_id_fk",
285
- "tableFrom": "reported_messages",
438
+ "push_subscriptions_user_id_users_id_fk": {
439
+ "name": "push_subscriptions_user_id_users_id_fk",
440
+ "tableFrom": "push_subscriptions",
286
441
  "tableTo": "users",
287
442
  "columnsFrom": [
288
- "reporter_user_id"
289
- ],
290
- "columnsTo": [
291
- "id"
292
- ],
293
- "onDelete": "set null",
294
- "onUpdate": "no action"
295
- },
296
- "reported_messages_resolved_by_user_id_users_id_fk": {
297
- "name": "reported_messages_resolved_by_user_id_users_id_fk",
298
- "tableFrom": "reported_messages",
299
- "tableTo": "users",
300
- "columnsFrom": [
301
- "resolved_by_user_id"
443
+ "user_id"
302
444
  ],
303
445
  "columnsTo": [
304
446
  "id"
305
447
  ],
306
- "onDelete": "set null",
448
+ "onDelete": "cascade",
307
449
  "onUpdate": "no action"
308
450
  }
309
451
  },
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1793490619333,
9
- "tag": "0000_email",
8
+ "when": 1794374467122,
9
+ "tag": "0000_dry_moon_knight",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]