@open-workspace/email 0.3.0 → 0.4.1

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 (221) hide show
  1. package/README.md +22 -22
  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_email.sql → 0000_dry_moon_knight.sql} +26 -20
  11. package/migrations/meta/0000_snapshot.json +125 -109
  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 +77 -28
  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 +63 -40
  127. package/worker/jmap/eventsource.ts +84 -16
  128. package/worker/jmap/methods.ts +1630 -524
  129. package/worker/jmap/push-types.ts +27 -0
  130. package/worker/jmap/push.ts +140 -56
  131. package/worker/jmap/routes.ts +366 -105
  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 +88 -22
  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 +271 -173
  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 +870 -541
  184. package/worker/mail/safety-routes.ts +328 -200
  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 +126 -93
  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 +595 -225
  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 +1734 -721
  202. package/worker/mailbox/jmap-store.ts +139 -35
  203. package/worker/mailbox/model.ts +8 -6
  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 -142
  216. package/containers/office-preview/Dockerfile +0 -10
  217. package/shared/mail-rules.ts +0 -156
  218. package/worker/admin/report-routes.ts +0 -164
  219. package/worker/mail/reported-messages.ts +0 -68
  220. package/worker/mailbox/migrations.ts +0 -10
  221. 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";
@@ -1,9 +1,7 @@
1
1
  CREATE TABLE `blocked_senders` (
2
2
  `pattern` text PRIMARY KEY NOT NULL,
3
- `report_id` text,
4
3
  `created_by_user_id` text,
5
4
  `created_at` integer NOT NULL,
6
- FOREIGN KEY (`report_id`) REFERENCES `reported_messages`(`id`) ON UPDATE no action ON DELETE set null,
7
5
  FOREIGN KEY (`created_by_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
8
6
  );
9
7
  --> statement-breakpoint
@@ -25,6 +23,14 @@ CREATE TABLE `jmap_push_subscriptions` (
25
23
  --> statement-breakpoint
26
24
  CREATE UNIQUE INDEX `jmap_push_subscriptions_device_unique` ON `jmap_push_subscriptions` (`user_id`,`device_client_id`);--> statement-breakpoint
27
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
28
34
  CREATE TABLE `mailbox_notification_preferences` (
29
35
  `mailbox_id` text NOT NULL,
30
36
  `user_id` text NOT NULL,
@@ -36,27 +42,27 @@ CREATE TABLE `mailbox_notification_preferences` (
36
42
  );
37
43
  --> statement-breakpoint
38
44
  CREATE INDEX `mailbox_notification_preferences_user_idx` ON `mailbox_notification_preferences` (`user_id`);--> statement-breakpoint
39
- CREATE TABLE `reported_messages` (
40
- `id` text PRIMARY KEY NOT NULL,
45
+ CREATE TABLE `mailbox_read_counts` (
41
46
  `mailbox_id` text NOT NULL,
42
- `email_id` text NOT NULL,
43
- `reporter_user_id` text,
44
- `sender_address` text NOT NULL,
45
- `sender_domain` text NOT NULL,
46
- `subject` text NOT NULL,
47
- `received_at` integer NOT NULL,
48
- `snapshot_json` text NOT NULL,
49
- `status` text DEFAULT 'open' NOT NULL,
50
- `resolved_by_user_id` text,
51
- `resolved_at` integer,
52
- `created_at` integer NOT NULL,
53
- FOREIGN KEY (`mailbox_id`) REFERENCES `mailboxes`(`id`) ON UPDATE no action ON DELETE cascade,
54
- FOREIGN KEY (`reporter_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
55
- FOREIGN KEY (`resolved_by_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set 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
56
62
  );
57
63
  --> statement-breakpoint
58
- CREATE UNIQUE INDEX `reported_messages_email_unique` ON `reported_messages` (`mailbox_id`,`email_id`);--> statement-breakpoint
59
- CREATE INDEX `reported_messages_status_idx` ON `reported_messages` (`status`,`created_at`);--> 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
60
66
  CREATE TABLE `sender_reports` (
61
67
  `mailbox_id` text NOT NULL,
62
68
  `email_id` text NOT NULL,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "e1a507fb-c877-4e1a-8bd6-acc6a143255f",
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,19 +31,6 @@
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",
43
- "tableFrom": "blocked_senders",
44
- "tableTo": "reported_messages",
45
- "columnsFrom": [
46
- "report_id"
47
- ],
48
- "columnsTo": [
49
- "id"
50
- ],
51
- "onDelete": "set null",
52
- "onUpdate": "no action"
53
- },
54
34
  "blocked_senders_created_by_user_id_users_id_fk": {
55
35
  "name": "blocked_senders_created_by_user_id_users_id_fk",
56
36
  "tableFrom": "blocked_senders",
@@ -195,6 +175,58 @@
195
175
  "uniqueConstraints": {},
196
176
  "checkConstraints": {}
197
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"
218
+ ],
219
+ "columnsTo": [
220
+ "id"
221
+ ],
222
+ "onDelete": "cascade",
223
+ "onUpdate": "no action"
224
+ }
225
+ },
226
+ "compositePrimaryKeys": {},
227
+ "uniqueConstraints": {},
228
+ "checkConstraints": {}
229
+ },
198
230
  "mailbox_notification_preferences": {
199
231
  "name": "mailbox_notification_preferences",
200
232
  "columns": {
@@ -278,16 +310,9 @@
278
310
  "uniqueConstraints": {},
279
311
  "checkConstraints": {}
280
312
  },
281
- "reported_messages": {
282
- "name": "reported_messages",
313
+ "mailbox_read_counts": {
314
+ "name": "mailbox_read_counts",
283
315
  "columns": {
284
- "id": {
285
- "name": "id",
286
- "type": "text",
287
- "primaryKey": true,
288
- "notNull": true,
289
- "autoincrement": false
290
- },
291
316
  "mailbox_id": {
292
317
  "name": "mailbox_id",
293
318
  "type": "text",
@@ -295,141 +320,132 @@
295
320
  "notNull": true,
296
321
  "autoincrement": false
297
322
  },
298
- "email_id": {
299
- "name": "email_id",
323
+ "user_id": {
324
+ "name": "user_id",
300
325
  "type": "text",
301
326
  "primaryKey": false,
302
327
  "notNull": true,
303
328
  "autoincrement": false
304
329
  },
305
- "reporter_user_id": {
306
- "name": "reporter_user_id",
307
- "type": "text",
308
- "primaryKey": false,
309
- "notNull": false,
310
- "autoincrement": false
311
- },
312
- "sender_address": {
313
- "name": "sender_address",
314
- "type": "text",
330
+ "read_count": {
331
+ "name": "read_count",
332
+ "type": "integer",
315
333
  "primaryKey": false,
316
334
  "notNull": true,
317
335
  "autoincrement": false
318
- },
319
- "sender_domain": {
320
- "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",
321
371
  "type": "text",
322
- "primaryKey": false,
372
+ "primaryKey": true,
323
373
  "notNull": true,
324
374
  "autoincrement": false
325
375
  },
326
- "subject": {
327
- "name": "subject",
376
+ "user_id": {
377
+ "name": "user_id",
328
378
  "type": "text",
329
379
  "primaryKey": false,
330
380
  "notNull": true,
331
381
  "autoincrement": false
332
382
  },
333
- "received_at": {
334
- "name": "received_at",
335
- "type": "integer",
383
+ "endpoint": {
384
+ "name": "endpoint",
385
+ "type": "text",
336
386
  "primaryKey": false,
337
387
  "notNull": true,
338
388
  "autoincrement": false
339
389
  },
340
- "snapshot_json": {
341
- "name": "snapshot_json",
390
+ "p256dh": {
391
+ "name": "p256dh",
342
392
  "type": "text",
343
393
  "primaryKey": false,
344
394
  "notNull": true,
345
395
  "autoincrement": false
346
396
  },
347
- "status": {
348
- "name": "status",
397
+ "auth": {
398
+ "name": "auth",
349
399
  "type": "text",
350
400
  "primaryKey": false,
351
401
  "notNull": true,
352
- "autoincrement": false,
353
- "default": "'open'"
354
- },
355
- "resolved_by_user_id": {
356
- "name": "resolved_by_user_id",
357
- "type": "text",
358
- "primaryKey": false,
359
- "notNull": false,
360
402
  "autoincrement": false
361
403
  },
362
- "resolved_at": {
363
- "name": "resolved_at",
404
+ "created_at": {
405
+ "name": "created_at",
364
406
  "type": "integer",
365
407
  "primaryKey": false,
366
- "notNull": false,
367
- "autoincrement": false
408
+ "notNull": true,
409
+ "autoincrement": false,
410
+ "default": "(unixepoch() * 1000)"
368
411
  },
369
- "created_at": {
370
- "name": "created_at",
412
+ "updated_at": {
413
+ "name": "updated_at",
371
414
  "type": "integer",
372
415
  "primaryKey": false,
373
416
  "notNull": true,
374
- "autoincrement": false
417
+ "autoincrement": false,
418
+ "default": "(unixepoch() * 1000)"
375
419
  }
376
420
  },
377
421
  "indexes": {
378
- "reported_messages_email_unique": {
379
- "name": "reported_messages_email_unique",
422
+ "push_subscriptions_endpoint_unique": {
423
+ "name": "push_subscriptions_endpoint_unique",
380
424
  "columns": [
381
- "mailbox_id",
382
- "email_id"
425
+ "endpoint"
383
426
  ],
384
427
  "isUnique": true
385
428
  },
386
- "reported_messages_status_idx": {
387
- "name": "reported_messages_status_idx",
429
+ "push_subscriptions_user_idx": {
430
+ "name": "push_subscriptions_user_idx",
388
431
  "columns": [
389
- "status",
390
- "created_at"
432
+ "user_id"
391
433
  ],
392
434
  "isUnique": false
393
435
  }
394
436
  },
395
437
  "foreignKeys": {
396
- "reported_messages_mailbox_id_mailboxes_id_fk": {
397
- "name": "reported_messages_mailbox_id_mailboxes_id_fk",
398
- "tableFrom": "reported_messages",
399
- "tableTo": "mailboxes",
400
- "columnsFrom": [
401
- "mailbox_id"
402
- ],
403
- "columnsTo": [
404
- "id"
405
- ],
406
- "onDelete": "cascade",
407
- "onUpdate": "no action"
408
- },
409
- "reported_messages_reporter_user_id_users_id_fk": {
410
- "name": "reported_messages_reporter_user_id_users_id_fk",
411
- "tableFrom": "reported_messages",
438
+ "push_subscriptions_user_id_users_id_fk": {
439
+ "name": "push_subscriptions_user_id_users_id_fk",
440
+ "tableFrom": "push_subscriptions",
412
441
  "tableTo": "users",
413
442
  "columnsFrom": [
414
- "reporter_user_id"
415
- ],
416
- "columnsTo": [
417
- "id"
418
- ],
419
- "onDelete": "set null",
420
- "onUpdate": "no action"
421
- },
422
- "reported_messages_resolved_by_user_id_users_id_fk": {
423
- "name": "reported_messages_resolved_by_user_id_users_id_fk",
424
- "tableFrom": "reported_messages",
425
- "tableTo": "users",
426
- "columnsFrom": [
427
- "resolved_by_user_id"
443
+ "user_id"
428
444
  ],
429
445
  "columnsTo": [
430
446
  "id"
431
447
  ],
432
- "onDelete": "set null",
448
+ "onDelete": "cascade",
433
449
  "onUpdate": "no action"
434
450
  }
435
451
  },
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1793521253047,
9
- "tag": "0000_email",
8
+ "when": 1794374467122,
9
+ "tag": "0000_dry_moon_knight",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]
package/package.json CHANGED
@@ -1,93 +1,99 @@
1
1
  {
2
2
  "name": "@open-workspace/email",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Team mail for OpenWorkspace: personal and shared inboxes, mailing lists, previews, safety, and AI.",
5
+ "keywords": [
6
+ "alchemy",
7
+ "cloudflare",
8
+ "email",
9
+ "jmap",
10
+ "self-hosted",
11
+ "workers"
12
+ ],
13
+ "homepage": "https://openworkspace.dev",
5
14
  "license": "Apache-2.0",
6
- "type": "module",
7
15
  "repository": {
8
16
  "type": "git",
9
17
  "url": "git+https://github.com/iivankin/openworkspace.git",
10
18
  "directory": "packages/email"
11
19
  },
12
- "homepage": "https://openworkspace.dev",
20
+ "files": [
21
+ "index.ts",
22
+ "alchemy",
23
+ "src",
24
+ "worker",
25
+ "shared",
26
+ "migrations",
27
+ "drizzle",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "type": "module",
13
32
  "exports": {
14
33
  ".": "./index.ts",
15
- "./alchemy": "./alchemy.ts",
34
+ "./alchemy": "./alchemy/index.ts",
35
+ "./client": "./src/client.tsx",
16
36
  "./*": "./*"
17
37
  },
18
38
  "scripts": {
19
- "typecheck": "tsc -p tsconfig.json",
20
- "db:generate": "drizzle-kit generate && drizzle-kit generate --config=drizzle.mailbox.config.ts && bun scripts/embed-mailbox-migrations.ts"
21
- },
22
- "peerDependencies": {
23
- "@open-workspace/core": "0.3.0",
24
- "alchemy": "2.0.0-beta.84",
25
- "@alchemy.run/cloudflare": "2.0.0-beta.84",
26
- "effect": "4.0.7"
39
+ "dev": "ALLOW_MOCK_AUTH=true alchemy dev dev/alchemy.run.ts",
40
+ "test": "bun run test:unit && bun run test:stack",
41
+ "test:unit": "bun test ./test/unit",
42
+ "test:stack": "bun test --preload ./test/stack/setup.ts --timeout 60000 ./test/stack",
43
+ "test:e2e": "playwright test -c test/e2e --project=desktop && playwright test -c test/e2e --project=mobile",
44
+ "typecheck": "tsc -p tsconfig.json && tsc -p test/tsconfig.json && tsc -p test/e2e/tsconfig.json",
45
+ "db:generate": "drizzle-kit generate && drizzle-kit generate --config=drizzle.mailbox.config.ts"
27
46
  },
28
47
  "dependencies": {
29
48
  "@hono/zod-validator": "0.9.1",
30
- "@mmmike/web-push": "1.3.0",
31
- "@modelcontextprotocol/server": "2.0.0",
49
+ "@mmmike/web-push": "1.5.0",
50
+ "@modelcontextprotocol/server": "2.4.0",
51
+ "@tanstack/react-query": "5.107.1",
52
+ "@tiptap/extension-placeholder": "3.33.1",
53
+ "@tiptap/pm": "3.33.1",
54
+ "@tiptap/react": "3.33.1",
55
+ "@tiptap/starter-kit": "3.33.1",
32
56
  "aws4fetch": "1.0.20",
33
- "drizzle-orm": "0.45.2",
34
- "hono": "4.13.5",
57
+ "date-fns": "4.4.0",
58
+ "dompurify": "3.4.17",
59
+ "drizzle-orm": "0.45.4",
60
+ "hono": "4.13.17",
35
61
  "html-to-text": "10.0.1",
36
- "postal-mime": "3.0.0",
37
- "tldts": "7.4.19",
38
- "zod": "4.5.4"
62
+ "lucide-react": "1.71.0",
63
+ "pdfjs-dist": "6.5.438",
64
+ "postal-mime": "4.2.1",
65
+ "react": "19.3.1",
66
+ "react-router": "8.5.1",
67
+ "sonner": "2.0.8",
68
+ "tldts": "7.4.21",
69
+ "zod": "4.6.7"
39
70
  },
40
71
  "devDependencies": {
41
- "@alchemy.run/cloudflare": "2.0.0-beta.84",
42
- "@base-ui/react": "1.7.0",
43
- "@effect/platform-bun": "4.0.7",
44
- "@effect/platform-node": "4.0.7",
45
- "@open-workspace/core": "0.3.0",
46
- "@simplewebauthn/browser": "13.3.0",
47
- "@tanstack/react-query": "5.102.8",
48
- "@tiptap/extension-image": "3.30.5",
49
- "@tiptap/extension-placeholder": "3.30.5",
50
- "@tiptap/pm": "3.30.5",
51
- "@tiptap/react": "3.30.5",
52
- "@tiptap/starter-kit": "3.30.5",
72
+ "@alchemy.run/cloudflare": "2.0.0-beta.85",
73
+ "@alchemy.run/test": "2.0.0-beta.85",
74
+ "@effect/platform-bun": "4.1.3",
75
+ "@effect/platform-node": "4.1.3",
76
+ "@open-workspace/core": "0.4.1",
77
+ "@open-workspace/create": "0.4.1",
78
+ "@types/bun": "1.4.4",
53
79
  "@types/html-to-text": "9.0.4",
54
- "@types/node": "26.4.0",
55
- "@types/react": "19.2.18",
56
- "@types/react-dom": "19.2.5",
57
- "alchemy": "2.0.0-beta.84",
58
- "class-variance-authority": "0.7.1",
59
- "clsx": "2.1.1",
60
- "cmdk": "1.1.1",
61
- "date-fns": "4.4.0",
62
- "dompurify": "3.4.14",
63
- "drizzle-kit": "0.31.10",
64
- "effect": "4.0.7",
65
- "lucide-react": "1.38.0",
66
- "pdfjs-dist": "6.3.289",
67
- "react": "19.2.8",
68
- "react-dom": "19.2.8",
69
- "react-router": "8.3.1",
70
- "sonner": "2.0.8",
71
- "tailwind-merge": "3.6.0",
80
+ "@types/node": "26.6.6",
81
+ "@types/react": "19.3.0",
82
+ "@types/react-dom": "19.3.0",
83
+ "ai": "7.0.166",
84
+ "alchemy": "2.0.0-beta.85",
85
+ "drizzle-kit": "0.31.11",
86
+ "effect": "4.1.3",
87
+ "openid-client": "6.8.9",
88
+ "playwright": "1.65.0",
89
+ "standardwebhooks": "1.1.1",
72
90
  "typescript": "7.0.2",
73
- "vite": "8.2.2"
91
+ "vite": "8.3.7"
74
92
  },
75
- "files": [
76
- "index.ts",
77
- "alchemy.ts",
78
- "worker",
79
- "shared",
80
- "migrations",
81
- "containers",
82
- "README.md",
83
- "LICENSE"
84
- ],
85
- "keywords": [
86
- "cloudflare",
87
- "workers",
88
- "email",
89
- "jmap",
90
- "self-hosted",
91
- "alchemy"
92
- ]
93
+ "peerDependencies": {
94
+ "@alchemy.run/cloudflare": "2.0.0-beta.85",
95
+ "@open-workspace/core": "0.4.1",
96
+ "alchemy": "2.0.0-beta.85",
97
+ "effect": "4.1.3"
98
+ }
93
99
  }