@open-workspace/email 0.5.2 → 0.6.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 (50) hide show
  1. package/README.md +1 -2
  2. package/alchemy/index.ts +0 -16
  3. package/migrations/0003_after_0_5_2.sql +1 -0
  4. package/migrations/meta/0003_snapshot.json +703 -0
  5. package/migrations/meta/_journal.json +7 -0
  6. package/package.json +6 -5
  7. package/shared/mail.ts +3 -2
  8. package/shared/module.ts +1 -1
  9. package/src/client.tsx +20 -30
  10. package/src/extensions.ts +176 -0
  11. package/src/mail/compose-window-chrome.tsx +5 -10
  12. package/src/mail/compose-window.tsx +13 -2
  13. package/src/mail/composer-attach-button.tsx +106 -0
  14. package/src/mail/composer-editor.tsx +17 -0
  15. package/src/mail/composer-inserts.tsx +186 -0
  16. package/src/mail/composer-toolbar.tsx +3 -0
  17. package/src/mail/conversation-message.tsx +37 -1
  18. package/src/mail/conversation-reply.tsx +5 -10
  19. package/src/mail/message-actions.tsx +30 -0
  20. package/src/mail/message-attachments.tsx +62 -0
  21. package/src/mail/message-panels.tsx +206 -0
  22. package/src/mail/module-extensions.ts +87 -0
  23. package/src/mail/reader-pane.tsx +75 -47
  24. package/src/mail/recipient-combobox.tsx +32 -12
  25. package/src/mail/shared-compose.ts +45 -0
  26. package/src/settings/mail-notifications.tsx +119 -0
  27. package/src/settings/settings-queries.ts +0 -7
  28. package/worker/backups/file-parts.ts +9 -6
  29. package/worker/backups/mail-backup.ts +21 -4
  30. package/worker/backups/settings-backup.ts +56 -24
  31. package/worker/db/schema.ts +0 -36
  32. package/worker/jmap/method-core.ts +2 -3
  33. package/worker/jmap/push-subscription-methods.ts +5 -2
  34. package/worker/jmap/push.ts +10 -11
  35. package/worker/jmap/routes.ts +10 -49
  36. package/worker/mail/bimi.ts +2 -3
  37. package/worker/mail/person-erasure.ts +58 -0
  38. package/worker/mail/push-notifications.ts +59 -419
  39. package/worker/mail/remote-proxy.ts +3 -206
  40. package/worker/mail/remote-routes.ts +2 -2
  41. package/worker/mail/uploads.ts +14 -6
  42. package/worker/mail/webhook-source.ts +13 -1
  43. package/worker/mailbox/index.ts +27 -0
  44. package/worker/mailbox/mailbox-drafts.ts +5 -0
  45. package/worker/module-api.ts +239 -0
  46. package/worker/module.ts +11 -7
  47. package/src/pwa/push-key.ts +0 -18
  48. package/src/pwa/push-subscription.ts +0 -213
  49. package/src/settings/notifications-page.tsx +0 -306
  50. package/worker/mail/push-endpoint.ts +0 -17
@@ -0,0 +1,703 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "d742f228-5e62-4abd-9340-0102c637f964",
5
+ "prevId": "33d3c977-8b7d-4b71-9a51-581d90c5eaae",
6
+ "tables": {
7
+ "blocked_senders": {
8
+ "name": "blocked_senders",
9
+ "columns": {
10
+ "pattern": {
11
+ "name": "pattern",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "created_by_user_id": {
18
+ "name": "created_by_user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "created_at": {
25
+ "name": "created_at",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ }
31
+ },
32
+ "indexes": {},
33
+ "foreignKeys": {
34
+ "blocked_senders_created_by_user_id_users_id_fk": {
35
+ "name": "blocked_senders_created_by_user_id_users_id_fk",
36
+ "tableFrom": "blocked_senders",
37
+ "tableTo": "users",
38
+ "columnsFrom": [
39
+ "created_by_user_id"
40
+ ],
41
+ "columnsTo": [
42
+ "id"
43
+ ],
44
+ "onDelete": "set null",
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
61
+ },
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",
162
+ "columnsFrom": [
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
+ "mail_archive_entries": {
179
+ "name": "mail_archive_entries",
180
+ "columns": {
181
+ "id": {
182
+ "name": "id",
183
+ "type": "text",
184
+ "primaryKey": true,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "mailbox_id": {
189
+ "name": "mailbox_id",
190
+ "type": "text",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "direction": {
196
+ "name": "direction",
197
+ "type": "text",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "source_key": {
203
+ "name": "source_key",
204
+ "type": "text",
205
+ "primaryKey": false,
206
+ "notNull": false,
207
+ "autoincrement": false
208
+ },
209
+ "status": {
210
+ "name": "status",
211
+ "type": "text",
212
+ "primaryKey": false,
213
+ "notNull": true,
214
+ "autoincrement": false,
215
+ "default": "'pending'"
216
+ },
217
+ "attempts": {
218
+ "name": "attempts",
219
+ "type": "integer",
220
+ "primaryKey": false,
221
+ "notNull": true,
222
+ "autoincrement": false,
223
+ "default": 0
224
+ },
225
+ "last_error": {
226
+ "name": "last_error",
227
+ "type": "text",
228
+ "primaryKey": false,
229
+ "notNull": false,
230
+ "autoincrement": false
231
+ },
232
+ "archive_key": {
233
+ "name": "archive_key",
234
+ "type": "text",
235
+ "primaryKey": false,
236
+ "notNull": true,
237
+ "autoincrement": false
238
+ },
239
+ "sha256": {
240
+ "name": "sha256",
241
+ "type": "text",
242
+ "primaryKey": false,
243
+ "notNull": false,
244
+ "autoincrement": false
245
+ },
246
+ "size": {
247
+ "name": "size",
248
+ "type": "integer",
249
+ "primaryKey": false,
250
+ "notNull": false,
251
+ "autoincrement": false
252
+ },
253
+ "created_at": {
254
+ "name": "created_at",
255
+ "type": "integer",
256
+ "primaryKey": false,
257
+ "notNull": true,
258
+ "autoincrement": false
259
+ },
260
+ "updated_at": {
261
+ "name": "updated_at",
262
+ "type": "integer",
263
+ "primaryKey": false,
264
+ "notNull": true,
265
+ "autoincrement": false
266
+ },
267
+ "archived_at": {
268
+ "name": "archived_at",
269
+ "type": "integer",
270
+ "primaryKey": false,
271
+ "notNull": false,
272
+ "autoincrement": false
273
+ }
274
+ },
275
+ "indexes": {
276
+ "mail_archive_entries_status_idx": {
277
+ "name": "mail_archive_entries_status_idx",
278
+ "columns": [
279
+ "status",
280
+ "created_at"
281
+ ],
282
+ "isUnique": false
283
+ },
284
+ "mail_archive_entries_source_idx": {
285
+ "name": "mail_archive_entries_source_idx",
286
+ "columns": [
287
+ "source_key"
288
+ ],
289
+ "isUnique": false
290
+ },
291
+ "mail_archive_entries_mailbox_idx": {
292
+ "name": "mail_archive_entries_mailbox_idx",
293
+ "columns": [
294
+ "mailbox_id",
295
+ "status"
296
+ ],
297
+ "isUnique": false
298
+ }
299
+ },
300
+ "foreignKeys": {},
301
+ "compositePrimaryKeys": {},
302
+ "uniqueConstraints": {},
303
+ "checkConstraints": {}
304
+ },
305
+ "mailbox_counts": {
306
+ "name": "mailbox_counts",
307
+ "columns": {
308
+ "mailbox_id": {
309
+ "name": "mailbox_id",
310
+ "type": "text",
311
+ "primaryKey": true,
312
+ "notNull": true,
313
+ "autoincrement": false
314
+ },
315
+ "incoming_count": {
316
+ "name": "incoming_count",
317
+ "type": "integer",
318
+ "primaryKey": false,
319
+ "notNull": true,
320
+ "autoincrement": false
321
+ },
322
+ "version": {
323
+ "name": "version",
324
+ "type": "integer",
325
+ "primaryKey": false,
326
+ "notNull": true,
327
+ "autoincrement": false
328
+ },
329
+ "updated_at": {
330
+ "name": "updated_at",
331
+ "type": "integer",
332
+ "primaryKey": false,
333
+ "notNull": true,
334
+ "autoincrement": false
335
+ }
336
+ },
337
+ "indexes": {},
338
+ "foreignKeys": {
339
+ "mailbox_counts_mailbox_id_mailboxes_id_fk": {
340
+ "name": "mailbox_counts_mailbox_id_mailboxes_id_fk",
341
+ "tableFrom": "mailbox_counts",
342
+ "tableTo": "mailboxes",
343
+ "columnsFrom": [
344
+ "mailbox_id"
345
+ ],
346
+ "columnsTo": [
347
+ "id"
348
+ ],
349
+ "onDelete": "cascade",
350
+ "onUpdate": "no action"
351
+ }
352
+ },
353
+ "compositePrimaryKeys": {},
354
+ "uniqueConstraints": {},
355
+ "checkConstraints": {}
356
+ },
357
+ "mailbox_notification_preferences": {
358
+ "name": "mailbox_notification_preferences",
359
+ "columns": {
360
+ "mailbox_id": {
361
+ "name": "mailbox_id",
362
+ "type": "text",
363
+ "primaryKey": false,
364
+ "notNull": true,
365
+ "autoincrement": false
366
+ },
367
+ "user_id": {
368
+ "name": "user_id",
369
+ "type": "text",
370
+ "primaryKey": false,
371
+ "notNull": true,
372
+ "autoincrement": false
373
+ },
374
+ "enabled": {
375
+ "name": "enabled",
376
+ "type": "integer",
377
+ "primaryKey": false,
378
+ "notNull": true,
379
+ "autoincrement": false,
380
+ "default": true
381
+ },
382
+ "updated_at": {
383
+ "name": "updated_at",
384
+ "type": "integer",
385
+ "primaryKey": false,
386
+ "notNull": true,
387
+ "autoincrement": false,
388
+ "default": "(unixepoch() * 1000)"
389
+ }
390
+ },
391
+ "indexes": {
392
+ "mailbox_notification_preferences_user_idx": {
393
+ "name": "mailbox_notification_preferences_user_idx",
394
+ "columns": [
395
+ "user_id"
396
+ ],
397
+ "isUnique": false
398
+ }
399
+ },
400
+ "foreignKeys": {
401
+ "mailbox_notification_preferences_mailbox_id_mailboxes_id_fk": {
402
+ "name": "mailbox_notification_preferences_mailbox_id_mailboxes_id_fk",
403
+ "tableFrom": "mailbox_notification_preferences",
404
+ "tableTo": "mailboxes",
405
+ "columnsFrom": [
406
+ "mailbox_id"
407
+ ],
408
+ "columnsTo": [
409
+ "id"
410
+ ],
411
+ "onDelete": "cascade",
412
+ "onUpdate": "no action"
413
+ },
414
+ "mailbox_notification_preferences_user_id_users_id_fk": {
415
+ "name": "mailbox_notification_preferences_user_id_users_id_fk",
416
+ "tableFrom": "mailbox_notification_preferences",
417
+ "tableTo": "users",
418
+ "columnsFrom": [
419
+ "user_id"
420
+ ],
421
+ "columnsTo": [
422
+ "id"
423
+ ],
424
+ "onDelete": "cascade",
425
+ "onUpdate": "no action"
426
+ }
427
+ },
428
+ "compositePrimaryKeys": {
429
+ "mailbox_notification_preferences_mailbox_id_user_id_pk": {
430
+ "columns": [
431
+ "mailbox_id",
432
+ "user_id"
433
+ ],
434
+ "name": "mailbox_notification_preferences_mailbox_id_user_id_pk"
435
+ }
436
+ },
437
+ "uniqueConstraints": {},
438
+ "checkConstraints": {}
439
+ },
440
+ "mailbox_read_counts": {
441
+ "name": "mailbox_read_counts",
442
+ "columns": {
443
+ "mailbox_id": {
444
+ "name": "mailbox_id",
445
+ "type": "text",
446
+ "primaryKey": false,
447
+ "notNull": true,
448
+ "autoincrement": false
449
+ },
450
+ "user_id": {
451
+ "name": "user_id",
452
+ "type": "text",
453
+ "primaryKey": false,
454
+ "notNull": true,
455
+ "autoincrement": false
456
+ },
457
+ "read_count": {
458
+ "name": "read_count",
459
+ "type": "integer",
460
+ "primaryKey": false,
461
+ "notNull": true,
462
+ "autoincrement": false
463
+ }
464
+ },
465
+ "indexes": {},
466
+ "foreignKeys": {
467
+ "mailbox_read_counts_mailbox_id_mailboxes_id_fk": {
468
+ "name": "mailbox_read_counts_mailbox_id_mailboxes_id_fk",
469
+ "tableFrom": "mailbox_read_counts",
470
+ "tableTo": "mailboxes",
471
+ "columnsFrom": [
472
+ "mailbox_id"
473
+ ],
474
+ "columnsTo": [
475
+ "id"
476
+ ],
477
+ "onDelete": "cascade",
478
+ "onUpdate": "no action"
479
+ }
480
+ },
481
+ "compositePrimaryKeys": {
482
+ "mailbox_read_counts_mailbox_id_user_id_pk": {
483
+ "columns": [
484
+ "mailbox_id",
485
+ "user_id"
486
+ ],
487
+ "name": "mailbox_read_counts_mailbox_id_user_id_pk"
488
+ }
489
+ },
490
+ "uniqueConstraints": {},
491
+ "checkConstraints": {}
492
+ },
493
+ "sender_reports": {
494
+ "name": "sender_reports",
495
+ "columns": {
496
+ "mailbox_id": {
497
+ "name": "mailbox_id",
498
+ "type": "text",
499
+ "primaryKey": false,
500
+ "notNull": true,
501
+ "autoincrement": false
502
+ },
503
+ "email_id": {
504
+ "name": "email_id",
505
+ "type": "text",
506
+ "primaryKey": false,
507
+ "notNull": true,
508
+ "autoincrement": false
509
+ },
510
+ "address": {
511
+ "name": "address",
512
+ "type": "text",
513
+ "primaryKey": false,
514
+ "notNull": true,
515
+ "autoincrement": false
516
+ },
517
+ "domain": {
518
+ "name": "domain",
519
+ "type": "text",
520
+ "primaryKey": false,
521
+ "notNull": true,
522
+ "autoincrement": false
523
+ },
524
+ "label": {
525
+ "name": "label",
526
+ "type": "text",
527
+ "primaryKey": false,
528
+ "notNull": true,
529
+ "autoincrement": false
530
+ },
531
+ "created_at": {
532
+ "name": "created_at",
533
+ "type": "integer",
534
+ "primaryKey": false,
535
+ "notNull": true,
536
+ "autoincrement": false
537
+ }
538
+ },
539
+ "indexes": {
540
+ "sender_reports_domain_idx": {
541
+ "name": "sender_reports_domain_idx",
542
+ "columns": [
543
+ "domain",
544
+ "address"
545
+ ],
546
+ "isUnique": false
547
+ }
548
+ },
549
+ "foreignKeys": {
550
+ "sender_reports_mailbox_id_mailboxes_id_fk": {
551
+ "name": "sender_reports_mailbox_id_mailboxes_id_fk",
552
+ "tableFrom": "sender_reports",
553
+ "tableTo": "mailboxes",
554
+ "columnsFrom": [
555
+ "mailbox_id"
556
+ ],
557
+ "columnsTo": [
558
+ "id"
559
+ ],
560
+ "onDelete": "cascade",
561
+ "onUpdate": "no action"
562
+ }
563
+ },
564
+ "compositePrimaryKeys": {
565
+ "sender_reports_mailbox_id_email_id_pk": {
566
+ "columns": [
567
+ "mailbox_id",
568
+ "email_id"
569
+ ],
570
+ "name": "sender_reports_mailbox_id_email_id_pk"
571
+ }
572
+ },
573
+ "uniqueConstraints": {},
574
+ "checkConstraints": {}
575
+ },
576
+ "signatures": {
577
+ "name": "signatures",
578
+ "columns": {
579
+ "user_id": {
580
+ "name": "user_id",
581
+ "type": "text",
582
+ "primaryKey": false,
583
+ "notNull": false,
584
+ "autoincrement": false
585
+ },
586
+ "mailbox_id": {
587
+ "name": "mailbox_id",
588
+ "type": "text",
589
+ "primaryKey": false,
590
+ "notNull": false,
591
+ "autoincrement": false
592
+ },
593
+ "html": {
594
+ "name": "html",
595
+ "type": "text",
596
+ "primaryKey": false,
597
+ "notNull": true,
598
+ "autoincrement": false
599
+ },
600
+ "text": {
601
+ "name": "text",
602
+ "type": "text",
603
+ "primaryKey": false,
604
+ "notNull": true,
605
+ "autoincrement": false
606
+ },
607
+ "images": {
608
+ "name": "images",
609
+ "type": "text",
610
+ "primaryKey": false,
611
+ "notNull": true,
612
+ "autoincrement": false
613
+ },
614
+ "use_on_new": {
615
+ "name": "use_on_new",
616
+ "type": "integer",
617
+ "primaryKey": false,
618
+ "notNull": true,
619
+ "autoincrement": false,
620
+ "default": true
621
+ },
622
+ "use_on_reply": {
623
+ "name": "use_on_reply",
624
+ "type": "integer",
625
+ "primaryKey": false,
626
+ "notNull": true,
627
+ "autoincrement": false,
628
+ "default": true
629
+ },
630
+ "updated_at": {
631
+ "name": "updated_at",
632
+ "type": "integer",
633
+ "primaryKey": false,
634
+ "notNull": true,
635
+ "autoincrement": false,
636
+ "default": "(unixepoch() * 1000)"
637
+ }
638
+ },
639
+ "indexes": {
640
+ "signatures_user_idx": {
641
+ "name": "signatures_user_idx",
642
+ "columns": [
643
+ "user_id"
644
+ ],
645
+ "isUnique": true
646
+ },
647
+ "signatures_mailbox_idx": {
648
+ "name": "signatures_mailbox_idx",
649
+ "columns": [
650
+ "mailbox_id"
651
+ ],
652
+ "isUnique": true
653
+ }
654
+ },
655
+ "foreignKeys": {
656
+ "signatures_user_id_users_id_fk": {
657
+ "name": "signatures_user_id_users_id_fk",
658
+ "tableFrom": "signatures",
659
+ "tableTo": "users",
660
+ "columnsFrom": [
661
+ "user_id"
662
+ ],
663
+ "columnsTo": [
664
+ "id"
665
+ ],
666
+ "onDelete": "cascade",
667
+ "onUpdate": "no action"
668
+ },
669
+ "signatures_mailbox_id_mailboxes_id_fk": {
670
+ "name": "signatures_mailbox_id_mailboxes_id_fk",
671
+ "tableFrom": "signatures",
672
+ "tableTo": "mailboxes",
673
+ "columnsFrom": [
674
+ "mailbox_id"
675
+ ],
676
+ "columnsTo": [
677
+ "id"
678
+ ],
679
+ "onDelete": "cascade",
680
+ "onUpdate": "no action"
681
+ }
682
+ },
683
+ "compositePrimaryKeys": {},
684
+ "uniqueConstraints": {},
685
+ "checkConstraints": {
686
+ "signatures_one_owner": {
687
+ "name": "signatures_one_owner",
688
+ "value": "(\"signatures\".\"user_id\" is null) <> (\"signatures\".\"mailbox_id\" is null)"
689
+ }
690
+ }
691
+ }
692
+ },
693
+ "views": {},
694
+ "enums": {},
695
+ "_meta": {
696
+ "schemas": {},
697
+ "tables": {},
698
+ "columns": {}
699
+ },
700
+ "internal": {
701
+ "indexes": {}
702
+ }
703
+ }