@open-workspace/email 0.5.2 → 0.6.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 (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
package/README.md CHANGED
@@ -18,8 +18,7 @@ OpenWorkspace({
18
18
  so a zone with another provider's MX records must have them removed first, or
19
19
  the deploy fails.
20
20
 
21
- It takes three options. `pushContact` is the `mailto:` or `https:` contact push
22
- services see; without it they see the app's URL. `retention` is how many days
21
+ It takes two options. `retention` is how many days
23
22
  a conversation stays in Trash or Spam before it is deleted, as
24
23
  `{ trash, spam }`: Spam defaults to 30, and Trash (or a folder set to `null`)
25
24
  keeps mail until someone empties it. `archive: { years }` keeps a write-once
package/alchemy/index.ts CHANGED
@@ -3,7 +3,6 @@ import { createRequire } from "node:module";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
 
5
5
  import * as Cloudflare from "@alchemy.run/cloudflare";
6
- import { VapidKeys } from "@open-workspace/core/alchemy";
7
6
  import type { WorkspaceModuleInfra } from "@open-workspace/core/alchemy";
8
7
  import { AlchemyContext } from "alchemy/AlchemyContext";
9
8
  import { Random } from "alchemy/Random";
@@ -56,8 +55,6 @@ const deliveryEvents = [
56
55
  ];
57
56
 
58
57
  export type EmailInfraProps = {
59
- /** Contact for push services (mailto: or https:); defaults to the app's URL. */
60
- pushContact?: string;
61
58
  /**
62
59
  * Days a conversation stays in Trash or Spam before it is deleted
63
60
  * permanently. Spam defaults to 30; Trash, or a folder set to null, keeps
@@ -154,9 +151,6 @@ const emailRoutingToken = () =>
154
151
  };
155
152
  });
156
153
 
157
- /** The contact push services see, bound only when configured. */
158
- type PushSubjectEnv = { VAPID_SUBJECT?: string };
159
-
160
154
  /** `Email({ retention })` in days, bound only for folders that delete mail. */
161
155
  type RetentionEnv = {
162
156
  TRASH_RETENTION_DAYS?: string;
@@ -241,15 +235,9 @@ const emailEnv = (
241
235
  Effect.gen(function* () {
242
236
  const alchemy = yield* Effect.serviceOption(AlchemyContext);
243
237
  const dev = Option.isSome(alchemy) && alchemy.value.dev;
244
- const vapid = yield* VapidKeys("VapidKeys", {});
245
238
  // Signs the remote image proxy's tokens; minted once, kept in state.
246
239
  const remoteKey = yield* Random("MailRemoteKey", { bytes: 32 });
247
240
  const bucket = mailStorage(origin, dev);
248
- // Push services see the configured contact; without one the Worker
249
- // falls back to the app's URL, so the binding is left out.
250
- const pushSubject: PushSubjectEnv = {};
251
-
252
- if (props.pushContact) pushSubject.VAPID_SUBJECT = props.pushContact;
253
241
 
254
242
  const emailRouting: Partial<
255
243
  Effect.Success<ReturnType<typeof emailRoutingToken>>
@@ -262,10 +250,6 @@ const emailEnv = (
262
250
  * deployed, the local S3 endpoint under `alchemy dev`.
263
251
  */
264
252
  MAIL_S3: Cloudflare.R2.S3Credentials(bucket, { access: "read-write" }),
265
- /** Web Push keys Alchemy mints, and the contact push services see. */
266
- VAPID_PUBLIC_KEY: vapid.publicKey,
267
- VAPID_PRIVATE_KEY: vapid.privateKey,
268
- ...pushSubject,
269
253
  ...retentionEnv(props.retention),
270
254
  ...emailRouting,
271
255
  ...archiveEnv(props.archive, dev),
@@ -0,0 +1 @@
1
+ DROP TABLE `push_subscriptions`;