@pithy-sh/email 0.1.2 → 0.1.4

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 (176) hide show
  1. package/dist/analytics.d.ts +21 -0
  2. package/dist/analytics.d.ts.map +1 -0
  3. package/dist/analytics.js +15 -0
  4. package/dist/audit/actions.d.ts +47 -0
  5. package/dist/audit/actions.d.ts.map +1 -0
  6. package/dist/audit/actions.js +47 -0
  7. package/dist/bounce/classify.d.ts +40 -0
  8. package/dist/bounce/classify.d.ts.map +1 -0
  9. package/dist/bounce/classify.js +48 -0
  10. package/dist/bounce/handler.d.ts +34 -0
  11. package/dist/bounce/handler.d.ts.map +1 -0
  12. package/dist/bounce/handler.js +83 -0
  13. package/dist/capability.d.ts +160 -0
  14. package/dist/capability.d.ts.map +1 -0
  15. package/dist/capability.js +257 -0
  16. package/dist/crypto/signingKey.d.ts +38 -0
  17. package/dist/crypto/signingKey.d.ts.map +1 -0
  18. package/dist/crypto/signingKey.js +38 -0
  19. package/dist/crypto/token.d.ts +49 -0
  20. package/dist/crypto/token.d.ts.map +1 -0
  21. package/dist/crypto/token.js +101 -0
  22. package/dist/data/emailEvent.d.ts +30 -0
  23. package/dist/data/emailEvent.d.ts.map +1 -0
  24. package/dist/data/emailEvent.js +24 -0
  25. package/dist/data/emailJob.d.ts +78 -0
  26. package/dist/data/emailJob.d.ts.map +1 -0
  27. package/dist/data/emailJob.js +64 -0
  28. package/dist/data/emailSuppression.d.ts +25 -0
  29. package/dist/data/emailSuppression.d.ts.map +1 -0
  30. package/dist/data/emailSuppression.js +23 -0
  31. package/dist/data/enums.d.ts +78 -0
  32. package/dist/data/enums.d.ts.map +1 -0
  33. package/dist/data/enums.js +67 -0
  34. package/dist/data/tables.d.ts +116 -0
  35. package/dist/data/tables.d.ts.map +1 -0
  36. package/dist/data/tables.js +32 -0
  37. package/dist/error/errors.d.ts +62 -0
  38. package/dist/error/errors.d.ts.map +1 -0
  39. package/dist/error/errors.js +84 -0
  40. package/dist/http/callbacks.d.ts +23 -0
  41. package/dist/http/callbacks.d.ts.map +1 -0
  42. package/dist/http/callbacks.js +112 -0
  43. package/dist/http/guards.d.ts +101 -0
  44. package/dist/http/guards.d.ts.map +1 -0
  45. package/dist/http/guards.js +146 -0
  46. package/dist/http/responses.d.ts +297 -0
  47. package/dist/http/responses.d.ts.map +1 -0
  48. package/dist/http/responses.js +117 -0
  49. package/dist/http/routes.d.ts +73 -0
  50. package/dist/http/routes.d.ts.map +1 -0
  51. package/dist/http/routes.js +294 -0
  52. package/dist/http/schemas.d.ts +92 -0
  53. package/dist/http/schemas.d.ts.map +1 -0
  54. package/dist/http/schemas.js +93 -0
  55. package/dist/http/view.d.ts +80 -0
  56. package/dist/http/view.d.ts.map +1 -0
  57. package/dist/http/view.js +132 -0
  58. package/dist/index.d.ts +48 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +13 -0
  61. package/dist/jobs/read.d.ts +193 -0
  62. package/dist/jobs/read.d.ts.map +1 -0
  63. package/dist/jobs/read.js +145 -0
  64. package/dist/jobs/retry.d.ts +101 -0
  65. package/dist/jobs/retry.d.ts.map +1 -0
  66. package/dist/jobs/retry.js +69 -0
  67. package/dist/migrations/0001_init.d.ts +34 -0
  68. package/dist/migrations/0001_init.d.ts.map +1 -0
  69. package/dist/migrations/0001_init.js +62 -0
  70. package/dist/migrations/0001_suppressions.d.ts +12 -0
  71. package/dist/migrations/0001_suppressions.d.ts.map +1 -0
  72. package/dist/migrations/0001_suppressions.js +22 -0
  73. package/dist/provision/devDelivery.d.ts +34 -0
  74. package/dist/provision/devDelivery.d.ts.map +1 -0
  75. package/dist/provision/devDelivery.js +39 -0
  76. package/dist/provision/hostCatalogs.d.ts +12 -0
  77. package/dist/provision/hostCatalogs.d.ts.map +1 -0
  78. package/dist/provision/hostCatalogs.js +80 -0
  79. package/dist/provision/provisionEmail.d.ts +145 -0
  80. package/dist/provision/provisionEmail.d.ts.map +1 -0
  81. package/dist/provision/provisionEmail.js +120 -0
  82. package/dist/provision/resolveEmailConfig.d.ts +124 -0
  83. package/dist/provision/resolveEmailConfig.d.ts.map +1 -0
  84. package/dist/provision/resolveEmailConfig.js +126 -0
  85. package/dist/provision/settingsCheck.d.ts +42 -0
  86. package/dist/provision/settingsCheck.d.ts.map +1 -0
  87. package/dist/provision/settingsCheck.js +140 -0
  88. package/dist/send/batchIdentity.d.ts +44 -0
  89. package/dist/send/batchIdentity.d.ts.map +1 -0
  90. package/dist/send/batchIdentity.js +48 -0
  91. package/dist/send/enqueue.d.ts +218 -0
  92. package/dist/send/enqueue.d.ts.map +1 -0
  93. package/dist/send/enqueue.js +155 -0
  94. package/dist/send/errorMapping.d.ts +29 -0
  95. package/dist/send/errorMapping.d.ts.map +1 -0
  96. package/dist/send/errorMapping.js +54 -0
  97. package/dist/send/events.d.ts +17 -0
  98. package/dist/send/events.d.ts.map +1 -0
  99. package/dist/send/events.js +19 -0
  100. package/dist/send/fromComposition.d.ts +49 -0
  101. package/dist/send/fromComposition.d.ts.map +1 -0
  102. package/dist/send/fromComposition.js +55 -0
  103. package/dist/send/retryPolicy.d.ts +34 -0
  104. package/dist/send/retryPolicy.d.ts.map +1 -0
  105. package/dist/send/retryPolicy.js +41 -0
  106. package/dist/send/runSend.d.ts +108 -0
  107. package/dist/send/runSend.d.ts.map +1 -0
  108. package/dist/send/runSend.js +220 -0
  109. package/dist/send/sendAt.d.ts +8 -0
  110. package/dist/send/sendAt.d.ts.map +1 -0
  111. package/dist/send/sendAt.js +64 -0
  112. package/dist/send/sender.d.ts +44 -0
  113. package/dist/send/sender.d.ts.map +1 -0
  114. package/dist/send/sender.js +2 -0
  115. package/dist/send/senderBinding.d.ts +46 -0
  116. package/dist/send/senderBinding.d.ts.map +1 -0
  117. package/dist/send/senderBinding.js +23 -0
  118. package/dist/send/suppression.d.ts +95 -0
  119. package/dist/send/suppression.d.ts.map +1 -0
  120. package/dist/send/suppression.js +134 -0
  121. package/dist/templates/engine.d.ts +111 -0
  122. package/dist/templates/engine.d.ts.map +1 -0
  123. package/dist/templates/engine.js +260 -0
  124. package/dist/templates/messages.d.ts +96 -0
  125. package/dist/templates/messages.d.ts.map +1 -0
  126. package/dist/templates/messages.es.d.ts +31 -0
  127. package/dist/templates/messages.es.d.ts.map +1 -0
  128. package/dist/templates/messages.es.js +84 -0
  129. package/dist/templates/messages.js +268 -0
  130. package/dist/templates/partials.d.ts +7 -0
  131. package/dist/templates/partials.d.ts.map +1 -0
  132. package/dist/templates/partials.js +61 -0
  133. package/dist/templates/precompiled.generated.d.ts +268 -0
  134. package/dist/templates/precompiled.generated.d.ts.map +1 -0
  135. package/dist/templates/precompiled.generated.js +4041 -0
  136. package/dist/templates/registry.d.ts +120 -0
  137. package/dist/templates/registry.d.ts.map +1 -0
  138. package/dist/templates/registry.js +325 -0
  139. package/dist/templates/samples.d.ts +9 -0
  140. package/dist/templates/samples.d.ts.map +1 -0
  141. package/dist/templates/samples.js +100 -0
  142. package/dist/templates/severity.d.ts +42 -0
  143. package/dist/templates/severity.d.ts.map +1 -0
  144. package/dist/templates/severity.js +83 -0
  145. package/dist/templates/theme.d.ts +195 -0
  146. package/dist/templates/theme.d.ts.map +1 -0
  147. package/dist/templates/theme.js +170 -0
  148. package/dist/version.generated.d.ts +7 -0
  149. package/dist/version.generated.d.ts.map +1 -0
  150. package/dist/version.generated.js +9 -0
  151. package/dist/workflows/hostApp.d.ts +35 -0
  152. package/dist/workflows/hostApp.d.ts.map +1 -0
  153. package/dist/workflows/hostApp.js +21 -0
  154. package/dist/workflows/hostEnv.d.ts +131 -0
  155. package/dist/workflows/hostEnv.d.ts.map +1 -0
  156. package/dist/workflows/hostEnv.js +149 -0
  157. package/dist/workflows/instanceLiveness.d.ts +5 -0
  158. package/dist/workflows/instanceLiveness.d.ts.map +1 -0
  159. package/dist/workflows/instanceLiveness.js +39 -0
  160. package/dist/workflows/instances.d.ts +20 -0
  161. package/dist/workflows/instances.d.ts.map +1 -0
  162. package/dist/workflows/instances.js +2 -0
  163. package/dist/workflows/params.d.ts +25 -0
  164. package/dist/workflows/params.d.ts.map +1 -0
  165. package/dist/workflows/params.js +23 -0
  166. package/dist/workflows/scheduler.d.ts +84 -0
  167. package/dist/workflows/scheduler.d.ts.map +1 -0
  168. package/dist/workflows/scheduler.js +113 -0
  169. package/dist/workflows/sendBatch.d.ts +87 -0
  170. package/dist/workflows/sendBatch.d.ts.map +1 -0
  171. package/dist/workflows/sendBatch.js +52 -0
  172. package/dist/workflows/worker.d.ts +102 -0
  173. package/dist/workflows/worker.d.ts.map +1 -0
  174. package/dist/workflows/worker.js +119 -0
  175. package/package.json +22 -11
  176. package/src/version.generated.ts +1 -1
@@ -0,0 +1,64 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { EmailInvalidPayloadError } from "../error/errors.js";
4
+ import { normalizeIanaTimezone } from "@pithy-sh/core/src/data/codecs";
5
+ //#region src/send/sendAt.ts
6
+ /**
7
+ * Resolve a job's absolute send time from its mode. `immediate` is now; `scheduled` is the given
8
+ * absolute instant; `timezone` resolves a recipient-local time-of-day (e.g. `10:00`) in their IANA
9
+ * zone to the next absolute instant at or after now. The timezone math uses `Intl` only — no library —
10
+ * by measuring the zone's offset at a candidate instant and correcting for it.
11
+ */
12
+ /** The offset (ms) of a timezone at a given UTC instant: zone wall-clock minus UTC. */
13
+ function zoneOffsetMs(timezone, utcMs) {
14
+ const parts = new Intl.DateTimeFormat("en-US", {
15
+ timeZone: timezone,
16
+ hour12: false,
17
+ year: "numeric",
18
+ month: "2-digit",
19
+ day: "2-digit",
20
+ hour: "2-digit",
21
+ minute: "2-digit",
22
+ second: "2-digit"
23
+ }).formatToParts(new Date(utcMs));
24
+ const get = (type) => Number(parts.find((p) => p.type === type)?.value ?? "0");
25
+ const hour = get("hour") % 24;
26
+ return Date.UTC(get("year"), get("month") - 1, get("day"), hour, get("minute"), get("second")) - utcMs;
27
+ }
28
+ /** Parse `HH:MM` to `{ hour, minute }`, or throw `email/invalid_payload`. */
29
+ function parseLocalTime(localTime) {
30
+ const match = /^(\d{1,2}):(\d{2})$/.exec(localTime.trim());
31
+ const hour = match ? Number(match[1]) : NaN;
32
+ const minute = match ? Number(match[2]) : NaN;
33
+ if (!match || hour < 0 || hour > 23 || minute < 0 || minute > 59) throw new EmailInvalidPayloadError({ detail: `invalid localTime '${localTime}' — expected HH:MM` });
34
+ return {
35
+ hour,
36
+ minute
37
+ };
38
+ }
39
+ /**
40
+ * The next absolute instant when the wall clock reads `hour:minute` in `timezone`, at or after `now`.
41
+ * Computes the candidate for the zone-local date of `now`, advancing a day if it has already passed.
42
+ */
43
+ function resolveTimezoneSendAt(localTime, timezone, now) {
44
+ const zone = normalizeIanaTimezone(timezone);
45
+ if (!zone) throw new EmailInvalidPayloadError({ detail: `invalid IANA timezone '${timezone}'` });
46
+ const { hour, minute } = parseLocalTime(localTime);
47
+ const dateParts = new Intl.DateTimeFormat("en-CA", {
48
+ timeZone: zone,
49
+ year: "numeric",
50
+ month: "2-digit",
51
+ day: "2-digit"
52
+ }).formatToParts(now);
53
+ const part = (type) => Number(dateParts.find((p) => p.type === type)?.value ?? "0");
54
+ const candidateFor = (dayOffset) => {
55
+ const guessUtc = Date.UTC(part("year"), part("month") - 1, part("day") + dayOffset, hour, minute);
56
+ const first = guessUtc - zoneOffsetMs(zone, guessUtc);
57
+ const secondOffset = zoneOffsetMs(zone, first);
58
+ return new Date(guessUtc - secondOffset);
59
+ };
60
+ const today = candidateFor(0);
61
+ return today.getTime() >= now.getTime() ? today : candidateFor(1);
62
+ }
63
+ //#endregion
64
+ export { resolveTimezoneSendAt };
@@ -0,0 +1,44 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * The minimal shape of the Cloudflare Email Service `send_email` binding this capability depends on.
5
+ * We type only what we use, structurally — the real binding (`env.EMAIL`) satisfies it, and tests
6
+ * inject a fake so send outcomes are deterministic. The binding sends both `html` and `text` and
7
+ * returns a `messageId`; it throws on failure with an `E_*` `.code` (mapped by `errorMapping`).
8
+ */
9
+ /** An outbound message handed to the binding — html + text both, per deliverability best practice. */
10
+ export interface EmailMessage {
11
+ /** The recipient address. */
12
+ to: string;
13
+ /** The sender — address plus display name. */
14
+ from: {
15
+ email: string;
16
+ name?: string;
17
+ };
18
+ /** Optional reply-to address. */
19
+ replyTo?: string;
20
+ /** The rendered subject line. */
21
+ subject: string;
22
+ /** The rendered HTML body. */
23
+ html: string;
24
+ /** The rendered plain-text body. */
25
+ text: string;
26
+ /** Optional whitelisted headers (e.g. `List-Unsubscribe`). */
27
+ headers?: Record<string, string>;
28
+ }
29
+ /**
30
+ * The send response. The Workers binding returns a `messageId`; the batch/REST shape additionally
31
+ * reports `delivered`/`permanentBounces`/`queued`. We capture all of it so synchronous permanent
32
+ * bounces can feed suppression immediately, and the `messageId` ties an asynchronous bounce back.
33
+ */
34
+ export interface EmailSendResult {
35
+ messageId?: string;
36
+ delivered?: string[];
37
+ permanentBounces?: string[];
38
+ queued?: string[];
39
+ }
40
+ /** The send seam. `env.EMAIL` satisfies it; tests pass a fake. */
41
+ export interface EmailSender {
42
+ send(message: EmailMessage): Promise<EmailSendResult>;
43
+ }
44
+ //# sourceMappingURL=sender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sender.d.ts","sourceRoot":"","sources":["../../src/send/sender.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,sGAAsG;AACtG,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACvD"}
@@ -0,0 +1,2 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
@@ -0,0 +1,46 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { SendWorkflowBinding } from "./enqueue";
4
+ /**
5
+ * Where the send Workflow comes from — one answer, for the two call sites that need it.
6
+ *
7
+ * `email().enqueue` and the admin retry route both start a send, and both used to read
8
+ * `env.EMAIL_SENDER` straight off the request env. Under `pithy dev` that binding does not exist:
9
+ * it is a **cross-script** binding at `<project>-dev-email`, and no local script runs under that
10
+ * name, so every immediate send was born `undispatched` and the local loop was silent
11
+ * (pithy-sh/pithy#410). A module rather than a line in each place, because the day the two answers
12
+ * differ is the day one of them stops sending mail and nothing says so.
13
+ */
14
+ /**
15
+ * What deciding the sender reads off the env, and nothing else.
16
+ *
17
+ * Three keys, not the whole enqueue env: `DB` and the suppression list are somebody else's question,
18
+ * and a narrower parameter is what lets the admin routes' own env shape pass without a cast.
19
+ */
20
+ export interface EmailSenderEnv {
21
+ /** The bound send Workflow. Present in every deployed environment; absent under `pithy dev`. */
22
+ EMAIL_SENDER?: SendWorkflowBinding;
23
+ /**
24
+ * The environment this composition was stamped for — `pithy init` writes it into every Worker's
25
+ * `wrangler.jsonc`. Read only to refuse: a substitution happens in `dev` and nowhere else.
26
+ */
27
+ ENVIRONMENT?: string;
28
+ /**
29
+ * The local email host's address, written by `pithy dev` as a `--var`. Present only in `dev`, where
30
+ * it is what stands in for the cross-script binding no local script can provide.
31
+ */
32
+ EMAIL_ORIGIN?: string;
33
+ }
34
+ /**
35
+ * The Workflow that starts a send: the bound one, or — under `pithy dev` — a loopback dispatcher
36
+ * addressed at the local email host.
37
+ *
38
+ * The rules are core's ({@link resolveWorkflowBinding}) and are stated there. The one thing decided
39
+ * here is that email's host is the capability named `email`, which is what makes the var
40
+ * `EMAIL_ORIGIN`.
41
+ *
42
+ * **Absent still means absent.** A composition with no binding and no local host enqueues the row
43
+ * `undispatched` exactly as it did — this fills the seam, it never invents one.
44
+ */
45
+ export declare function emailSenderBinding(env: EmailSenderEnv): SendWorkflowBinding | undefined;
46
+ //# sourceMappingURL=senderBinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"senderBinding.d.ts","sourceRoot":"","sources":["../../src/send/senderBinding.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gGAAgG;IAChG,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,mBAAmB,GAAG,SAAS,CAMvF"}
@@ -0,0 +1,23 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { resolveWorkflowBinding } from "@pithy-sh/core/src/workflow/dispatch";
4
+ //#region src/send/senderBinding.ts
5
+ /**
6
+ * The Workflow that starts a send: the bound one, or — under `pithy dev` — a loopback dispatcher
7
+ * addressed at the local email host.
8
+ *
9
+ * The rules are core's ({@link resolveWorkflowBinding}) and are stated there. The one thing decided
10
+ * here is that email's host is the capability named `email`, which is what makes the var
11
+ * `EMAIL_ORIGIN`.
12
+ *
13
+ * **Absent still means absent.** A composition with no binding and no local host enqueues the row
14
+ * `undispatched` exactly as it did — this fills the seam, it never invents one.
15
+ */
16
+ function emailSenderBinding(env) {
17
+ return resolveWorkflowBinding(env, {
18
+ binding: "EMAIL_SENDER",
19
+ capability: "email"
20
+ });
21
+ }
22
+ //#endregion
23
+ export { emailSenderBinding };
@@ -0,0 +1,95 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { EmailSuppression } from "../data/emailSuppression";
4
+ import { type EmailKind, SuppressionReason } from "../data/enums";
5
+ import type { EmailSuppressionDatabase } from "../data/tables";
6
+ /**
7
+ * The suppression list: addresses that must not be emailed, fed by hard bounces, complaints, and
8
+ * unsubscribes. The send path checks it before every send and skips a match, naming the reason it
9
+ * skipped for.
10
+ *
11
+ * Every address here goes through `normalizeAddress` from core, so a check and a write agree on the
12
+ * key — and so does `auth` matching a sign-in, `support` linking a sender, and `testers` reading this
13
+ * very table. A suppression written under one rule and read under another is a suppression that does
14
+ * not suppress, and it reports itself as "the list did not work" rather than as anything about case.
15
+ *
16
+ * The list is also the one thing in this capability a management client both reads and writes, and it
17
+ * is **global** — one database shared by every environment, so a row here stops mail from staging and
18
+ * production alike. That is why reading it, adding to it, and removing from it are three separate
19
+ * control-plane scopes rather than one.
20
+ *
21
+ * **The reason is part of the answer, not just a label on the row.** The list is keyed by address and
22
+ * holds no memory of which message a person was refusing, so treating every reason alike meant one
23
+ * unsubscribe from a weekly digest also withheld that person's sign-in link — and passwordless has no
24
+ * password to fall back on. `suppressionBlocks` is where the four reasons stop being interchangeable.
25
+ */
26
+ /**
27
+ * Whether a live suppression for this reason blocks a message of this kind.
28
+ *
29
+ * | reason | elective | transactional |
30
+ * |---|---|---|
31
+ * | `hard_bounce` | block | **block** — the mailbox does not exist. Sending is futile, and hammering dead addresses damages the sending domain for every other adopter on it. |
32
+ * | `complaint` | block | **block** — they reported us as spam. Continuing after a complaint is how a domain gets blocked outright. |
33
+ * | `unsubscribe` | block | **send** — an opt-out is a statement about mail somebody chose to receive. A sign-in link is not that; withholding it respects no preference, it locks the account. |
34
+ * | `manual` | block | block — an operator's deliberate act, and the one reason a human can point at. Narrowing it would silently overrule the person who set it. |
35
+ *
36
+ * Bounce and complaint are facts about the mailbox; unsubscribe and manual are decisions about mail.
37
+ * Only the unsubscribe decision is about a *category* of mail, which is why it is the only one the kind
38
+ * can narrow.
39
+ */
40
+ export declare function suppressionBlocks(reason: SuppressionReason, kind: EmailKind): boolean;
41
+ /**
42
+ * The live suppression reason blocking a message of this kind, or `null` if nothing does.
43
+ *
44
+ * The kind is required rather than defaulted. A default would have to be one of the two, and the one
45
+ * that reads as safe — block everything — is the one that locks people out of their own accounts.
46
+ */
47
+ export declare function blockingSuppression(db: EmailSuppressionDatabase, email: string, now: Date, kind: EmailKind): Promise<SuppressionReason | null>;
48
+ /** Add (or refresh) a suppression for an address. Idempotent on the unique `email` column. */
49
+ export declare function suppress(db: EmailSuppressionDatabase, input: {
50
+ email: string;
51
+ reason: SuppressionReason;
52
+ jobId?: string | null;
53
+ environment?: string | null;
54
+ detail?: string | null;
55
+ expiresAt?: Date | null;
56
+ }, now: Date): Promise<void>;
57
+ /**
58
+ * Remove a suppression. Returns whether a row was actually removed.
59
+ *
60
+ * The boolean matters: an operator unblocking an address that was never blocked, and one unblocking an
61
+ * address that was, are two different events and the audit trail should not record them as the same
62
+ * one. It also keeps the route idempotent — asking twice is not an error, it is simply the second one
63
+ * finding nothing to do.
64
+ *
65
+ * There is no soft delete. A suppression is a "do not send" flag, and a lifted flag that stays in the
66
+ * table is one bad query away from still being enforced.
67
+ */
68
+ export declare function unsuppress(db: EmailSuppressionDatabase, email: string): Promise<boolean>;
69
+ /** What the suppression list filters and pages by. */
70
+ export interface SuppressionListFilter {
71
+ /** One reason, or every reason when absent. */
72
+ reason?: SuppressionReason;
73
+ /** Look one address up exactly, rather than paging the list. */
74
+ email?: string;
75
+ /** The previous page's `nextCursor`. A malformed one is a first page. */
76
+ cursor?: string;
77
+ /** How many rows to return, clamped into range. */
78
+ limit?: number;
79
+ }
80
+ /** One page of the suppression list. */
81
+ export interface SuppressionPage {
82
+ /** The suppressed addresses, most recently blocked first. */
83
+ items: EmailSuppression[];
84
+ /** Where the next page starts, or null at the end of the list. */
85
+ nextCursor: string | null;
86
+ }
87
+ /**
88
+ * One page of the suppression list, most recently blocked first.
89
+ *
90
+ * Keyset, never offset — the same rule every list in this repo follows, and it applies here even though
91
+ * the table is quieter than the job log: a hard bounce arriving mid-scroll would otherwise skip a row
92
+ * for the person reading it.
93
+ */
94
+ export declare function listSuppressions(db: EmailSuppressionDatabase, filter: SuppressionListFilter): Promise<SuppressionPage>;
95
+ //# sourceMappingURL=suppression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suppression.d.ts","sourceRoot":"","sources":["../../src/send/suppression.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,KAAK,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAGrF;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,wBAAwB,EAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,IAAI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+ import { SuppressionReason } from "../data/enums.js";
4
+ import { EmailSuppression } from "../data/emailSuppression.js";
5
+ import { normalizeAddress } from "@pithy-sh/core/src/address/address";
6
+ import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
7
+ import { decodeCursor, pageLimit, toPage } from "@pithy-sh/core/src/data/cursor";
8
+ //#region src/send/suppression.ts
9
+ /**
10
+ * The suppression list: addresses that must not be emailed, fed by hard bounces, complaints, and
11
+ * unsubscribes. The send path checks it before every send and skips a match, naming the reason it
12
+ * skipped for.
13
+ *
14
+ * Every address here goes through `normalizeAddress` from core, so a check and a write agree on the
15
+ * key — and so does `auth` matching a sign-in, `support` linking a sender, and `testers` reading this
16
+ * very table. A suppression written under one rule and read under another is a suppression that does
17
+ * not suppress, and it reports itself as "the list did not work" rather than as anything about case.
18
+ *
19
+ * The list is also the one thing in this capability a management client both reads and writes, and it
20
+ * is **global** — one database shared by every environment, so a row here stops mail from staging and
21
+ * production alike. That is why reading it, adding to it, and removing from it are three separate
22
+ * control-plane scopes rather than one.
23
+ *
24
+ * **The reason is part of the answer, not just a label on the row.** The list is keyed by address and
25
+ * holds no memory of which message a person was refusing, so treating every reason alike meant one
26
+ * unsubscribe from a weekly digest also withheld that person's sign-in link — and passwordless has no
27
+ * password to fall back on. `suppressionBlocks` is where the four reasons stop being interchangeable.
28
+ */
29
+ /**
30
+ * Whether a live suppression for this reason blocks a message of this kind.
31
+ *
32
+ * | reason | elective | transactional |
33
+ * |---|---|---|
34
+ * | `hard_bounce` | block | **block** — the mailbox does not exist. Sending is futile, and hammering dead addresses damages the sending domain for every other adopter on it. |
35
+ * | `complaint` | block | **block** — they reported us as spam. Continuing after a complaint is how a domain gets blocked outright. |
36
+ * | `unsubscribe` | block | **send** — an opt-out is a statement about mail somebody chose to receive. A sign-in link is not that; withholding it respects no preference, it locks the account. |
37
+ * | `manual` | block | block — an operator's deliberate act, and the one reason a human can point at. Narrowing it would silently overrule the person who set it. |
38
+ *
39
+ * Bounce and complaint are facts about the mailbox; unsubscribe and manual are decisions about mail.
40
+ * Only the unsubscribe decision is about a *category* of mail, which is why it is the only one the kind
41
+ * can narrow.
42
+ */
43
+ function suppressionBlocks(reason, kind) {
44
+ if (reason === "unsubscribe") return kind === "elective";
45
+ return true;
46
+ }
47
+ /**
48
+ * The live suppression reason blocking a message of this kind, or `null` if nothing does.
49
+ *
50
+ * The kind is required rather than defaulted. A default would have to be one of the two, and the one
51
+ * that reads as safe — block everything — is the one that locks people out of their own accounts.
52
+ */
53
+ async function blockingSuppression(db, email, now, kind) {
54
+ const row = await db.selectFrom("pithyEmailSuppressions").select(["reason", "expiresAt"]).where("email", "=", normalizeAddress(email)).executeTakeFirst();
55
+ if (!row) return null;
56
+ if (!(row.expiresAt === null || row.expiresAt === void 0 || SQLiteDate.parse(row.expiresAt).getTime() > now.getTime())) return null;
57
+ const parsed = SuppressionReason.safeParse(row.reason);
58
+ if (!parsed.success) return "manual";
59
+ return suppressionBlocks(parsed.data, kind) ? parsed.data : null;
60
+ }
61
+ /** Add (or refresh) a suppression for an address. Idempotent on the unique `email` column. */
62
+ async function suppress(db, input, now) {
63
+ const email = normalizeAddress(input.email);
64
+ const jobId = input.jobId ?? null;
65
+ const environment = input.environment ?? null;
66
+ const detail = input.detail ?? null;
67
+ const expiresAt = input.expiresAt ? SQLiteDate.encode(input.expiresAt) : null;
68
+ await db.insertInto("pithyEmailSuppressions").values({
69
+ email,
70
+ reason: input.reason,
71
+ jobId,
72
+ environment,
73
+ detail,
74
+ expiresAt,
75
+ createdAt: SQLiteDate.encode(now)
76
+ }).onConflict((oc) => oc.column("email").doUpdateSet({
77
+ reason: input.reason,
78
+ jobId,
79
+ environment,
80
+ detail,
81
+ expiresAt
82
+ })).execute();
83
+ }
84
+ /**
85
+ * Remove a suppression. Returns whether a row was actually removed.
86
+ *
87
+ * The boolean matters: an operator unblocking an address that was never blocked, and one unblocking an
88
+ * address that was, are two different events and the audit trail should not record them as the same
89
+ * one. It also keeps the route idempotent — asking twice is not an error, it is simply the second one
90
+ * finding nothing to do.
91
+ *
92
+ * There is no soft delete. A suppression is a "do not send" flag, and a lifted flag that stays in the
93
+ * table is one bad query away from still being enforced.
94
+ */
95
+ async function unsuppress(db, email) {
96
+ return ((await db.deleteFrom("pithyEmailSuppressions").where("email", "=", normalizeAddress(email)).executeTakeFirst()).numDeletedRows ?? 0n) > 0n;
97
+ }
98
+ /**
99
+ * A cursor this table can resume from.
100
+ *
101
+ * Both halves must be numbers here — `createdAt` is a ms-epoch and `id` is an autoincrement integer —
102
+ * and anything else is treated exactly as a malformed cursor is. A string compared against an integer
103
+ * column in SQLite does not fail; it orders by something nobody meant, which is worse.
104
+ */
105
+ function suppressionCursor(raw) {
106
+ const cursor = decodeCursor(raw);
107
+ if (!cursor || typeof cursor.sort !== "number" || typeof cursor.id !== "number") return void 0;
108
+ return {
109
+ sort: cursor.sort,
110
+ id: cursor.id
111
+ };
112
+ }
113
+ /**
114
+ * One page of the suppression list, most recently blocked first.
115
+ *
116
+ * Keyset, never offset — the same rule every list in this repo follows, and it applies here even though
117
+ * the table is quieter than the job log: a hard bounce arriving mid-scroll would otherwise skip a row
118
+ * for the person reading it.
119
+ */
120
+ async function listSuppressions(db, filter) {
121
+ const limit = pageLimit(filter.limit);
122
+ const after = suppressionCursor(filter.cursor);
123
+ let query = db.selectFrom("pithyEmailSuppressions").selectAll().orderBy("createdAt", "desc").orderBy("id", "desc").limit(limit + 1);
124
+ if (filter.reason) query = query.where("reason", "=", filter.reason);
125
+ if (filter.email) query = query.where("email", "=", normalizeAddress(filter.email));
126
+ if (after) query = query.where((eb) => eb.or([eb("createdAt", "<", after.sort), eb.and([eb("createdAt", "=", after.sort), eb("id", "<", after.id)])]));
127
+ const items = (await query.execute()).map((row) => EmailSuppression.parse(row));
128
+ return toPage(items, limit, (row) => ({
129
+ sort: row.createdAt.getTime(),
130
+ id: row.id
131
+ }));
132
+ }
133
+ //#endregion
134
+ export { blockingSuppression, listSuppressions, suppress, suppressionBlocks, unsuppress };
@@ -0,0 +1,111 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { Translator } from "@pithy-sh/core/src/i18n/translator";
4
+ import type { EmailKind } from "../data/enums";
5
+ import { type EmailTemplate } from "./registry";
6
+ import { type EmailTheme } from "./theme";
7
+ /**
8
+ * The render engine. Templates are compiled **once at module load** — which in a Worker happens during
9
+ * isolate startup, where dynamic compilation is permitted — and cached, so a send never compiles or
10
+ * evals at request time (CLAUDE.md §Email: "precompiled, no runtime compile/eval"). Rendering is then
11
+ * pure string substitution.
12
+ *
13
+ * Tracking is applied here, not in the template: callback tokens are minted ahead of render (signing
14
+ * is async; Handlebars helpers are not) and the resulting URLs are placed into the render context.
15
+ * Click tracking rewrites the declared link locations; open tracking injects a pixel; and an **elective**
16
+ * template gets an unsubscribe link, which a marketing template additionally cannot render without.
17
+ *
18
+ * **A transactional template can never be given one.** The affordance is gated on the kind the template
19
+ * itself declares, so there is no argument a call site could pass to put an opt-out on a sign-in link —
20
+ * and `renderEmail` reports the URL it minted, so the send path sets `List-Unsubscribe` from what was
21
+ * actually rendered rather than from a second, drift-prone judgment of its own.
22
+ */
23
+ /** The mount prefix of the callback routes. Tracking URLs are built against `${baseUrl}${CALLBACK_BASE}`. */
24
+ export declare const CALLBACK_BASE = "/_pithy/email";
25
+ /** The signing + addressing context a tracked render needs. Shaped to plug straight into the send path. */
26
+ export interface RenderTracking {
27
+ /** The public base URL of the app worker; callback links are built against it. */
28
+ baseUrl: string;
29
+ /** The job this render belongs to — embedded in every token. */
30
+ jobId: string;
31
+ /** The recipient address — embedded in every token. */
32
+ recipient: string;
33
+ /** The marketing campaign id, for click/open attribution. */
34
+ campaignId?: string;
35
+ /** The current signing key value (from `@pithy-sh/secrets`). */
36
+ key: string;
37
+ /** The current signing key version, recorded as the token `kid`. */
38
+ kid: string;
39
+ /** When the tokens (and so the links) expire. */
40
+ expiresAt: Date;
41
+ /** Whether to inject the open-tracking pixel. */
42
+ openTracking: boolean;
43
+ /** Whether to rewrite links to tracked click callbacks. */
44
+ clickTracking: boolean;
45
+ }
46
+ /** A rendered email: the three parts a send needs, plus the opt-out URL it actually carries. */
47
+ export interface RenderResult {
48
+ subject: string;
49
+ html: string;
50
+ text: string;
51
+ /**
52
+ * The unsubscribe URL rendered into the body, when one was. Present only for an elective template with
53
+ * a signing context; the send path turns it into the `List-Unsubscribe` header, so the header and the
54
+ * link in the body can never disagree about whether this message can be opted out of.
55
+ */
56
+ unsubscribeUrl?: string;
57
+ }
58
+ /** Look up a template by id, or throw `email/template_not_found`. */
59
+ export declare function getTemplate(id: string): EmailTemplate;
60
+ /**
61
+ * The kind a template declares — the one answer to "may this message be refused".
62
+ *
63
+ * An id nobody registered is reported as `elective`, deliberately. It cannot be *proved* transactional,
64
+ * and the alternative reading would let a template deleted in a later release quietly reopen sending to
65
+ * addresses that opted out. Nothing is locked out by the choice: a job naming an unknown template fails
66
+ * at render moments later either way, so this only decides which of two failures gets reported.
67
+ */
68
+ export declare function templateKind(templateId: string): EmailKind;
69
+ /**
70
+ * Whether this template's payload is dropped once the message is delivered.
71
+ *
72
+ * **Keyed on the category, not the kind.** The kind answers "may this be refused"; this question is
73
+ * "are these inputs a one-time credential". `testerNudge` is the template that proves they are
74
+ * different axes — it is *elective*, because somebody may say stop chasing me, and its payload carries
75
+ * an opt-in URL that authenticates a tester. Keying on the kind would have left exactly that one live.
76
+ *
77
+ * A transactional message is a reply to something one person just did, and its payload is that
78
+ * person's one-time input: a sign-in URL, a code, an invitation token. A marketing message's payload is
79
+ * copy authored for a batch, carrying no per-recipient credential and answering the real question
80
+ * "what did the forty thousand of them actually receive". So the category is the line, and it falls in
81
+ * the right place on every template in the registry.
82
+ *
83
+ * There is no per-template override, because no template needs one today and an escape hatch nobody
84
+ * uses is where the bug comes back. The day a marketing template carries a per-recipient credential,
85
+ * the override is the change to make — with a reason written beside it.
86
+ *
87
+ * An id nobody registered redacts, which is the safe direction and, like `templateKind`, decides
88
+ * nothing real: a job naming an unknown template fails at render and never reaches a delivery.
89
+ */
90
+ export declare function redactsPayloadOnDelivery(templateId: string): boolean;
91
+ /** The registered template ids, for introspection and the CLI. */
92
+ export declare function listTemplates(): EmailTemplate[];
93
+ /**
94
+ * Validate a payload against its template and render just the subject line. Used at enqueue to fail
95
+ * fast on a bad payload and to store the job's subject without rendering the whole body. Throws
96
+ * `email/template_not_found` or `email/invalid_payload`.
97
+ */
98
+ export declare function renderSubject(templateId: string, payload: unknown, theme: EmailTheme, translator?: Translator): string;
99
+ /**
100
+ * Render a template to `{ subject, html, text }`. Validates the payload against the template's schema
101
+ * (throws `email/invalid_payload`), applies click/open tracking and — for an elective template — the
102
+ * unsubscribe link, then substitutes. A marketing template with no tracking context throws: it cannot
103
+ * render without an unsubscribe link.
104
+ *
105
+ * The opt-out rule is two-tier on purpose. Every elective template carries the link *when the engine can
106
+ * mint one*; a marketing template additionally *refuses to render* without it. Tying the hard refusal to
107
+ * the kind instead would mean a project that has not configured a link-signing key suddenly cannot send
108
+ * its testing-cohort nudges — a new outage, in a change whose whole subject is mail that fails silently.
109
+ */
110
+ export declare function renderEmail(templateId: string, payload: unknown, theme: EmailTheme, tracking?: RenderTracking, translator?: Translator): Promise<RenderResult>;
111
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/templates/engine.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,KAAK,UAAU,EAAW,MAAM,SAAS,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AAEH,6GAA6G;AAC7G,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAuH7C,2GAA2G;AAC3G,MAA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