@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,257 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { emailDatabase, emailSuppressionDatabase, emailSuppressionTables, emailTables } from "./data/tables.js";
4
+ import { createBounceHandler } from "./bounce/handler.js";
5
+ import { emailSigningRegistry } from "./crypto/signingKey.js";
6
+ import { EMAIL_MESSAGES, kitEmailLayers } from "./templates/messages.js";
7
+ import { CustomTheme, resolveTheme } from "./templates/theme.js";
8
+ import { registerCallbacks } from "./http/callbacks.js";
9
+ import { emailAdminRoutes } from "./http/guards.js";
10
+ import { emailSenderBinding } from "./send/senderBinding.js";
11
+ import { registerEmailAdminRoutes } from "./http/routes.js";
12
+ import { email_0001_init } from "./migrations/0001_init.js";
13
+ import { email_0001_suppressions } from "./migrations/0001_suppressions.js";
14
+ import { DevMailDelivery } from "./provision/devDelivery.js";
15
+ import { emailHostCatalogs } from "./provision/hostCatalogs.js";
16
+ import { emailSettings } from "./provision/settingsCheck.js";
17
+ import { enqueueEmail } from "./send/enqueue.js";
18
+ import { PACKAGE_VERSION } from "./version.generated.js";
19
+ import { EmailScheduleParams, EmailSendParams } from "./workflows/params.js";
20
+ import { z } from "zod";
21
+ import { defineCapability } from "@pithy-sh/core/src/capability/capability";
22
+ import { InternalError } from "@pithy-sh/core/src/error/pithyError";
23
+ //#region src/capability.ts
24
+ /**
25
+ * Sort order of the email migrations within the app database, relative to other capabilities
26
+ * (core low, app high). Unique per database; the migration registry composes the key
27
+ * `0200_email_0001_init`.
28
+ */
29
+ const EMAIL_MIGRATION_ORDER = 200;
30
+ /** Sort order of the suppression migration within the dedicated `EMAIL_SUPPRESSIONS` database. */
31
+ const EMAIL_SUPPRESSIONS_MIGRATION_ORDER = 100;
32
+ /**
33
+ * Configuration for the email capability, passed in `pithy.config.ts` — the thin user-owned surface.
34
+ * `fromAddress` and `baseUrl` are required; branding is one `theme` preset plus an optional
35
+ * `customTheme` that deep-merges over it (so a project tweaks just an accent or a palette color, not a
36
+ * dozen fields). Body width is intentionally *not* here — it is a property of each template (newsletters
37
+ * render wide, transactional narrow). The resolved theme is attached to the capability and serialized
38
+ * into the email worker's single `EMAIL_THEME` var at provision.
39
+ */
40
+ const EmailConfig = z.object({
41
+ fromAddress: z.string().describe("The address every email is sent from. Must use a domain onboarded onto Cloudflare Email Service."),
42
+ fromName: z.string().default("Pithy").describe("The sender display name recipients see."),
43
+ baseUrl: z.string().describe("The public base URL of the app worker; tracking and unsubscribe links are built against it."),
44
+ basePath: z.string().startsWith("/").default("/email").describe("Where the management routes mount (the send log and the suppression list). Not the callback links: those keep their fixed `/_pithy/email` prefix, because a tracking URL is already minted into mail sitting in somebody's inbox and moving it would break every link ever sent."),
45
+ theme: z.enum([
46
+ "saffron",
47
+ "midnight",
48
+ "forest",
49
+ "rose"
50
+ ]).default("saffron").describe("The off-the-shelf theme preset to start from: `saffron` (default), `midnight`, `forest`, or `rose`."),
51
+ customTheme: CustomTheme.optional().describe("A partial override deep-merged over the preset — change any theme field, inherit the rest."),
52
+ schedulerEnabled: z.boolean().default(true).describe("Whether the every-minute scheduler Workflow runs."),
53
+ devDelivery: DevMailDelivery.default("remote").describe("What the prebuilt email host does with a message when it is running on your machine under `pithy dev`. **The default, `remote`, sends real mail:** the Worker runs locally and delivers through Cloudflare Email Service, so a magic link you trigger from localhost arrives in the real inbox, with the same DKIM and the same delivery logs as production. That needs a Cloudflare login `wrangler dev` can use and a sending domain already onboarded onto Email Service. Set it to `simulator` to send nothing — `wrangler dev` logs the sender, recipient and subject and writes the rendered HTML and text bodies to disk, which is what an offline machine and CI want. It changes local development only; every deployed environment always sends for real.")
54
+ }).describe("Configuration for the email capability.");
55
+ /**
56
+ * The email capability. It contributes the three email tables to the app `DB`, mounts the
57
+ * click/open/unsubscribe callback routes, and registers the inbound bounce/complaint `email()` handler.
58
+ * It requires the `DB` binding and the `EMAIL_SENDER` Workflow binding (to start an immediate send at
59
+ * enqueue). The send and scheduler Workflows and the every-minute cron live in the prebuilt email
60
+ * worker (`workflows/worker.ts`), deployed per environment by `pithy add email`.
61
+ */
62
+ function email(config) {
63
+ const resolved = EmailConfig.parse(config);
64
+ const theme = resolveTheme(resolved.theme, resolved.customTheme);
65
+ /**
66
+ * Where an enqueue finds words for a locale — this package's own English until `compose` says
67
+ * otherwise.
68
+ *
69
+ * Reassigned rather than resolved once at construction, because a capability sees only itself when it
70
+ * is built and the translations belong to a capability that may be composed after this one.
71
+ */
72
+ let layersFor = kitEmailLayers;
73
+ /**
74
+ * The locales the project told the i18n capability it serves — the keys `pithy email provision`
75
+ * flattens a catalog for.
76
+ *
77
+ * `layersFor` alone cannot answer this. It is a function of a locale, so it can say what `es` reads
78
+ * and never that `es` is one of the languages this project speaks; the set lives on the i18n
79
+ * capability's own config, and this is the only thing that knows it.
80
+ */
81
+ let supportedLocales = [];
82
+ const capability = defineCapability({
83
+ name: "email",
84
+ version: PACKAGE_VERSION,
85
+ dependsOn: ["secrets"],
86
+ secretRegistry: emailSigningRegistry,
87
+ /**
88
+ * This capability's own copy — the seven templates whose words the kit owns, plus the shell's
89
+ * severity vocabulary and its opt-out link. All under `email/`, which `composeMessages` enforces.
90
+ *
91
+ * **In every language it is written in, not English alone (#442).** The send Worker is a separate
92
+ * deploy with no request and no config, so anything it does not bundle is stamped into it as a
93
+ * variable — and the kit's own translations were doing that on every provision run. Held here,
94
+ * they are built into the host and only an adopter's diff travels.
95
+ *
96
+ * A kit sentence still lives in exactly one place; which package that is follows how it reaches a
97
+ * reader. `@pithy-sh/i18n` keeps what no capability can — the error taxonomy, whose domains are
98
+ * not capability names, and the screens, which are copied rather than imported.
99
+ */
100
+ messages: EMAIL_MESSAGES,
101
+ /**
102
+ * Take the composed project's catalog layers, when it has any.
103
+ *
104
+ * Duck-typed, and deliberately not an import. `@pithy-sh/i18n` is optional — a project composing
105
+ * only `email` must not acquire it as a dependency — and CLAUDE.md's rule is that capabilities
106
+ * depend on core seams rather than on each other. `layersFor` is that seam's shape
107
+ * (`(locale) => catalogs`), declared in `@pithy-sh/core`'s i18n module and published by the i18n
108
+ * capability, so recognizing it structurally is the whole of the coupling.
109
+ *
110
+ * What arrives is the full stack in the right order: the adopter's overrides, the kit's
111
+ * translation, every composed capability's English. Absent, {@link kitEmailLayers} answers and a
112
+ * project sends what it always sent.
113
+ */
114
+ compose: ({ capabilities }) => {
115
+ for (const composed of capabilities) {
116
+ if (composed.name !== "i18n") continue;
117
+ const candidate = composed.layersFor;
118
+ if (typeof candidate === "function") layersFor = candidate;
119
+ const locales = composed.i18nConfig?.supportedLocales;
120
+ if (Array.isArray(locales)) supportedLocales = locales.filter((tag) => typeof tag === "string");
121
+ }
122
+ },
123
+ ciPermissions: ["email:routing"],
124
+ requiredBindings: [
125
+ {
126
+ type: "d1",
127
+ name: "DB"
128
+ },
129
+ {
130
+ type: "d1",
131
+ name: "EMAIL_SUPPRESSIONS"
132
+ },
133
+ {
134
+ type: "workflow",
135
+ name: "EMAIL_SENDER"
136
+ }
137
+ ],
138
+ databases: {
139
+ app: {
140
+ binding: "DB",
141
+ tables: emailTables,
142
+ migrationOrder: 200,
143
+ migrations: { "0001_init": email_0001_init }
144
+ },
145
+ emailSuppressions: {
146
+ binding: "EMAIL_SUPPRESSIONS",
147
+ tables: emailSuppressionTables,
148
+ migrationOrder: 100,
149
+ migrations: { "0001_suppressions": email_0001_suppressions }
150
+ }
151
+ },
152
+ /**
153
+ * The two durable jobs email owns. Both classes live in the prebuilt email worker
154
+ * (`workflows/worker.ts`), never in the app worker — the app only ever dispatches into `send`.
155
+ *
156
+ * The map keys are the wire names: `workflowScriptName("email", "send", "staging")` resolves to
157
+ * `pithy-email-send-staging`, which is byte-for-byte what the committed template already deploys.
158
+ * Declaring them here is what lets the CLI generate the host's `workflows` array and its cron from
159
+ * the specs instead of a hand-maintained block that can drift from this file.
160
+ */
161
+ workflows: {
162
+ send: {
163
+ binding: "EMAIL_SENDER",
164
+ className: "EmailSendWorkflow",
165
+ params: EmailSendParams
166
+ },
167
+ schedule: {
168
+ binding: "EMAIL_SCHEDULER",
169
+ className: "EmailSchedulerWorkflow",
170
+ params: EmailScheduleParams,
171
+ schedule: "* * * * *",
172
+ optional: true
173
+ }
174
+ },
175
+ /**
176
+ * Two route trees, one hook.
177
+ *
178
+ * The public callbacks keep their fixed `/_pithy/email` prefix — those URLs are already minted into
179
+ * mail nobody can recall — and the management routes mount under the configured `basePath`. They
180
+ * are registered together here rather than being two capabilities, because they are one
181
+ * capability's surface and `adminRoutes` below has to describe what this exact composition mounted.
182
+ */
183
+ routes: (app) => {
184
+ registerCallbacks(app);
185
+ registerEmailAdminRoutes({ basePath: resolved.basePath })(app);
186
+ },
187
+ /**
188
+ * The management surface, advertised on `GET /control-plane/manifest`.
189
+ *
190
+ * Built from the **resolved** `basePath` — the same value `registerEmailAdminRoutes` mounts
191
+ * against, read once. A default here and a default there is how a manifest comes to describe a
192
+ * route tree nobody serves.
193
+ */
194
+ adminRoutes: emailAdminRoutes(resolved.basePath),
195
+ /**
196
+ * How `pithy doctor` checks that these settings **work**, not merely that they are written (#411).
197
+ *
198
+ * Built from the resolved config, on the instance, so discovery needs no `pithy.manifest.json` and no
199
+ * import of this package by the CLI. The local half runs `workflows/hostEnv.ts` — the very declaration
200
+ * the prebuilt host refuses to start without — so doctor and the host cannot come to two answers.
201
+ */
202
+ settings: emailSettings({
203
+ fromAddress: resolved.fromAddress,
204
+ baseUrl: resolved.baseUrl,
205
+ theme
206
+ }),
207
+ email: createBounceHandler()
208
+ });
209
+ /**
210
+ * The suppression list off an env, or a wiring fault naming the binding.
211
+ *
212
+ * **Fails closed, unlike the enqueue-time check.** The two are asked different questions. `enqueue`
213
+ * asks "is this address blocked", and where it cannot ask, the send path asks again before anything
214
+ * leaves — so queueing the job is right. A caller here has asked for the list itself, and the only
215
+ * alternatives to raising are handing back a fabricated database or an empty answer that reads as
216
+ * "nobody is suppressed". Both are worse than a message naming what to bind.
217
+ */
218
+ const suppressions = (env) => {
219
+ const binding = env.EMAIL_SUPPRESSIONS;
220
+ if (!binding) throw new InternalError({
221
+ message: "The suppression list is not available.",
222
+ action: "Run `pithy add email` to provision it, or bind the EMAIL_SUPPRESSIONS D1 database.",
223
+ detail: "email.suppressions() was called with an env carrying no `EMAIL_SUPPRESSIONS` D1 binding."
224
+ });
225
+ return emailSuppressionDatabase(binding);
226
+ };
227
+ const enqueue = (env, input) => enqueueEmail({
228
+ db: emailDatabase(env.DB),
229
+ fromAddress: resolved.fromAddress,
230
+ fromName: resolved.fromName,
231
+ theme,
232
+ layersFor: (locale) => layersFor(locale),
233
+ sender: emailSenderBinding(env),
234
+ suppressionDb: env.EMAIL_SUPPRESSIONS ? emailSuppressionDatabase(env.EMAIL_SUPPRESSIONS) : void 0,
235
+ now: /* @__PURE__ */ new Date(),
236
+ newId: () => crypto.randomUUID()
237
+ }, input);
238
+ return Object.assign(capability, {
239
+ emailConfig: {
240
+ fromAddress: resolved.fromAddress,
241
+ fromName: resolved.fromName,
242
+ baseUrl: resolved.baseUrl,
243
+ schedulerEnabled: resolved.schedulerEnabled,
244
+ devDelivery: resolved.devDelivery,
245
+ theme
246
+ },
247
+ enqueue,
248
+ suppressions,
249
+ hostCatalogs: () => emailHostCatalogs(supportedLocales, (locale) => layersFor(locale))
250
+ });
251
+ }
252
+ /** Whether a capability is the email capability — carries its resolved config. */
253
+ function isEmailCapability(capability) {
254
+ return capability.name === "email" && "emailConfig" in capability;
255
+ }
256
+ //#endregion
257
+ export { EMAIL_MIGRATION_ORDER, EMAIL_SUPPRESSIONS_MIGRATION_ORDER, EmailConfig, email, isEmailCapability };
@@ -0,0 +1,38 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { SecretsStoreEnv } from "@pithy-sh/secrets/src/env/bindings";
4
+ import type { VersionedSecret } from "@pithy-sh/secrets/src/secretsStore";
5
+ /**
6
+ * The link-signing key lives in `@pithy-sh/secrets` as a rotatable, global secret. Email resolves it
7
+ * by name through its own minimal registry — `secretsStore` reads the same encrypted D1 row regardless
8
+ * of which registry names it, so email never needs the project-wide registry to sign or verify a link.
9
+ */
10
+ export declare const EMAIL_LINK_SIGNING_KEY = "email-link-signing-key";
11
+ /** The minimal registry email uses to resolve its signing key. Rotatable so old links verify after rotation. */
12
+ export declare const emailSigningRegistry: {
13
+ readonly "email-link-signing-key": {
14
+ readonly backend: "d1";
15
+ readonly scope: "global";
16
+ readonly rotatable: true;
17
+ readonly valueType: "text";
18
+ readonly devValue: "random";
19
+ readonly origin: {
20
+ readonly kind: "minted";
21
+ readonly recipe: {
22
+ readonly kind: "random";
23
+ readonly bytes: 32;
24
+ readonly encoding: "base64url";
25
+ };
26
+ };
27
+ readonly rotation: {
28
+ readonly kind: "local";
29
+ };
30
+ };
31
+ };
32
+ /**
33
+ * Resolve the current signing key plus every still-valid prior version. The current version is the
34
+ * `kid` new tokens are signed with; the full version set is what `verifyToken` checks a token's `kid`
35
+ * against, so a link minted before a rotation still verifies until its version is pruned.
36
+ */
37
+ export declare function resolveSigningKeys(env: SecretsStoreEnv): Promise<VersionedSecret<(typeof emailSigningRegistry)[typeof EMAIL_LINK_SIGNING_KEY]>>;
38
+ //# sourceMappingURL=signingKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signingKey.d.ts","sourceRoot":"","sources":["../../src/crypto/signingKey.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAG1E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,gHAAgH;AAChH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;CAe/B,CAAC;AAEH;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAGxF"}
@@ -0,0 +1,38 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { defineSecretRegistry } from "@pithy-sh/secrets/src/registry";
4
+ import { sharedSecretsStore } from "@pithy-sh/secrets/src/sharedSecretsStore";
5
+ //#region src/crypto/signingKey.ts
6
+ /**
7
+ * The link-signing key lives in `@pithy-sh/secrets` as a rotatable, global secret. Email resolves it
8
+ * by name through its own minimal registry — `secretsStore` reads the same encrypted D1 row regardless
9
+ * of which registry names it, so email never needs the project-wide registry to sign or verify a link.
10
+ */
11
+ const EMAIL_LINK_SIGNING_KEY = "email-link-signing-key";
12
+ /** The minimal registry email uses to resolve its signing key. Rotatable so old links verify after rotation. */
13
+ const emailSigningRegistry = defineSecretRegistry({ [EMAIL_LINK_SIGNING_KEY]: {
14
+ backend: "d1",
15
+ scope: "global",
16
+ rotatable: true,
17
+ valueType: "text",
18
+ devValue: "random",
19
+ origin: {
20
+ kind: "minted",
21
+ recipe: {
22
+ kind: "random",
23
+ bytes: 32,
24
+ encoding: "base64url"
25
+ }
26
+ },
27
+ rotation: { kind: "local" }
28
+ } });
29
+ /**
30
+ * Resolve the current signing key plus every still-valid prior version. The current version is the
31
+ * `kid` new tokens are signed with; the full version set is what `verifyToken` checks a token's `kid`
32
+ * against, so a link minted before a rotation still verifies until its version is pruned.
33
+ */
34
+ async function resolveSigningKeys(env) {
35
+ return (await sharedSecretsStore(env, emailSigningRegistry)).getVersions(EMAIL_LINK_SIGNING_KEY);
36
+ }
37
+ //#endregion
38
+ export { EMAIL_LINK_SIGNING_KEY, emailSigningRegistry, resolveSigningKeys };
@@ -0,0 +1,49 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { z } from "zod";
4
+ export declare const TokenKind: z.ZodEnum<{
5
+ click: "click";
6
+ open: "open";
7
+ unsubscribe: "unsubscribe";
8
+ }>;
9
+ export type TokenKind = z.output<typeof TokenKind>;
10
+ /** The signed claims a callback token carries. `kid`/`exp`/`v` are set by `mintToken`; the rest are caller claims. */
11
+ export declare const CallbackToken: z.ZodObject<{
12
+ v: z.ZodLiteral<1>;
13
+ kid: z.ZodString;
14
+ kind: z.ZodEnum<{
15
+ click: "click";
16
+ open: "open";
17
+ unsubscribe: "unsubscribe";
18
+ }>;
19
+ jobId: z.ZodString;
20
+ recipient: z.ZodString;
21
+ exp: z.ZodNumber;
22
+ destination: z.ZodOptional<z.ZodString>;
23
+ linkLabel: z.ZodOptional<z.ZodString>;
24
+ campaignId: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ export type CallbackToken = z.output<typeof CallbackToken>;
27
+ /** The caller-supplied claims for a token — everything except the fields `mintToken` fills in. */
28
+ export type TokenClaims = Omit<CallbackToken, "v" | "kid" | "exp">;
29
+ /**
30
+ * Mint a signed token. The claims plus `kid`/`exp`/`v` are JSON-encoded and base64url-packed, then
31
+ * HMAC-SHA-256 signed with `key`. The token is `<payload>.<signature>`; `kid` rides inside the signed
32
+ * payload so the verifier knows which key to check without trusting an unsigned header.
33
+ */
34
+ export declare function mintToken(claims: TokenClaims, options: {
35
+ key: string;
36
+ kid: string;
37
+ expiresAt: Date;
38
+ }): Promise<string>;
39
+ /**
40
+ * Verify a token against the valid signing-key version set (`@pithy-sh/secrets`' `getVersions` shape)
41
+ * and return its claims. Rejects — as `email/invalid_token` — a malformed token, an unknown/pruned
42
+ * `kid`, a bad signature (constant-time via `crypto.subtle.verify`), or an expired token. The order
43
+ * is deliberate: structure, then signature, then expiry, so a forged token never reaches the expiry
44
+ * check.
45
+ */
46
+ export declare function verifyToken(token: string, keys: {
47
+ versions: Record<string, string>;
48
+ }, now: Date): Promise<CallbackToken>;
49
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/crypto/token.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,SAAS;;;;EAE8F,CAAC;AACrH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEnD,sHAAsH;AACtH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;iBAkBmE,CAAC;AAC9F,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D,kGAAkG;AAClG,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;AAuBnE;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,GACrD,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAC1C,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,aAAa,CAAC,CA8CxB"}
@@ -0,0 +1,101 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { EmailInvalidTokenError } from "../error/errors.js";
4
+ import { z } from "zod";
5
+ //#region src/crypto/token.ts
6
+ /**
7
+ * HMAC-signed callback tokens. Click, open, and unsubscribe links carry one of these so a callback
8
+ * is tamper-proof: the claims (which job, which recipient, where a click goes, which campaign) are
9
+ * signed, and the signature is verified constant-time via `crypto.subtle.verify` before the callback
10
+ * acts. The signing secret is a **rotatable** key from `@pithy-sh/secrets`; every token records the
11
+ * key version (`kid`) it was signed with, so a link in a months-old email still verifies against the
12
+ * retained version set after a rotation — and is rejected once that version is pruned.
13
+ */
14
+ const encoder = new TextEncoder();
15
+ const decoder = new TextDecoder();
16
+ const TokenKind = z.enum([
17
+ "click",
18
+ "open",
19
+ "unsubscribe"
20
+ ]).describe("Which callback a token authorizes: a tracked link `click`, an open-pixel `open`, or an `unsubscribe`.");
21
+ /** The signed claims a callback token carries. `kid`/`exp`/`v` are set by `mintToken`; the rest are caller claims. */
22
+ const CallbackToken = z.object({
23
+ v: z.literal(1).describe("Token format version, so the scheme can evolve without ambiguity."),
24
+ kid: z.string().describe("The signing-key version this token was signed with; selects the key to verify against."),
25
+ kind: TokenKind.describe("Which callback this token authorizes."),
26
+ jobId: z.string().describe("The `pithy_email_jobs.id` this token is bound to."),
27
+ recipient: z.string().describe("The recipient address the callback is recorded against."),
28
+ exp: z.number().int().describe("Expiry as a Unix timestamp in seconds; the callback rejects a token past it."),
29
+ destination: z.string().optional().describe("For a `click` token, the absolute URL to 302-redirect to after recording."),
30
+ linkLabel: z.string().optional().describe("For a `click` token, the link's identity/label, recorded for attribution."),
31
+ campaignId: z.string().optional().describe("The marketing campaign this token is attributed to, when applicable.")
32
+ }).describe("The signed claims carried by an email callback token (click/open/unsubscribe).");
33
+ function base64UrlEncode(bytes) {
34
+ let binary = "";
35
+ for (const byte of bytes) binary += String.fromCharCode(byte);
36
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
37
+ }
38
+ function base64UrlDecode(value) {
39
+ const padded = value.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - value.length % 4) % 4);
40
+ const binary = atob(padded);
41
+ const bytes = new Uint8Array(binary.length);
42
+ for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
43
+ return bytes;
44
+ }
45
+ async function importKey(secret) {
46
+ return crypto.subtle.importKey("raw", encoder.encode(secret), {
47
+ name: "HMAC",
48
+ hash: "SHA-256"
49
+ }, false, ["sign", "verify"]);
50
+ }
51
+ /**
52
+ * Mint a signed token. The claims plus `kid`/`exp`/`v` are JSON-encoded and base64url-packed, then
53
+ * HMAC-SHA-256 signed with `key`. The token is `<payload>.<signature>`; `kid` rides inside the signed
54
+ * payload so the verifier knows which key to check without trusting an unsigned header.
55
+ */
56
+ async function mintToken(claims, options) {
57
+ const payload = {
58
+ v: 1,
59
+ kid: options.kid,
60
+ exp: Math.floor(options.expiresAt.getTime() / 1e3),
61
+ ...claims
62
+ };
63
+ const payloadB64 = base64UrlEncode(encoder.encode(JSON.stringify(payload)));
64
+ const key = await importKey(options.key);
65
+ return `${payloadB64}.${base64UrlEncode(new Uint8Array(await crypto.subtle.sign("HMAC", key, encoder.encode(payloadB64))))}`;
66
+ }
67
+ /**
68
+ * Verify a token against the valid signing-key version set (`@pithy-sh/secrets`' `getVersions` shape)
69
+ * and return its claims. Rejects — as `email/invalid_token` — a malformed token, an unknown/pruned
70
+ * `kid`, a bad signature (constant-time via `crypto.subtle.verify`), or an expired token. The order
71
+ * is deliberate: structure, then signature, then expiry, so a forged token never reaches the expiry
72
+ * check.
73
+ */
74
+ async function verifyToken(token, keys, now) {
75
+ const parts = token.split(".");
76
+ if (parts.length !== 2 || !parts[0] || !parts[1]) throw new EmailInvalidTokenError({ detail: "token is not in <payload>.<signature> form" });
77
+ const [payloadB64, signatureB64] = parts;
78
+ let raw;
79
+ try {
80
+ raw = JSON.parse(decoder.decode(base64UrlDecode(payloadB64)));
81
+ } catch (cause) {
82
+ throw new EmailInvalidTokenError({ detail: "token payload is not valid base64url JSON" }, { cause });
83
+ }
84
+ const parsed = CallbackToken.safeParse(raw);
85
+ if (!parsed.success) throw new EmailInvalidTokenError({ detail: "token payload does not match the claim schema" });
86
+ const versions = keys.versions;
87
+ const secret = Object.hasOwn(versions, parsed.data.kid) ? versions[parsed.data.kid] : void 0;
88
+ if (typeof secret !== "string") throw new EmailInvalidTokenError({ detail: `token kid '${parsed.data.kid}' is not in the valid key set` });
89
+ const key = await importKey(secret);
90
+ let valid;
91
+ try {
92
+ valid = await crypto.subtle.verify("HMAC", key, base64UrlDecode(signatureB64), encoder.encode(payloadB64));
93
+ } catch (cause) {
94
+ throw new EmailInvalidTokenError({ detail: "token signature could not be decoded" }, { cause });
95
+ }
96
+ if (!valid) throw new EmailInvalidTokenError({ detail: "token signature did not verify" });
97
+ if (parsed.data.exp * 1e3 <= now.getTime()) throw new EmailInvalidTokenError({ detail: "token has expired" });
98
+ return parsed.data;
99
+ }
100
+ //#endregion
101
+ export { CallbackToken, TokenKind, mintToken, verifyToken };
@@ -0,0 +1,30 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { z } from "zod";
4
+ /**
5
+ * One row in `pithy_email_events` — a per-recipient event for history and campaign attribution. The
6
+ * send path, the click/open/unsubscribe callbacks, and the inbound bounce handler all append here.
7
+ * `z.output` is the app shape; `z.input` is the SQLite row.
8
+ */
9
+ export declare const EmailEvent: z.ZodObject<{
10
+ id: z.ZodNumber;
11
+ jobId: z.ZodString;
12
+ recipient: z.ZodString;
13
+ type: z.ZodEnum<{
14
+ bounce: "bounce";
15
+ click: "click";
16
+ complaint: "complaint";
17
+ failed: "failed";
18
+ open: "open";
19
+ sent: "sent";
20
+ suppressed: "suppressed";
21
+ unsubscribe: "unsubscribe";
22
+ }>;
23
+ linkLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ linkUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ campaignId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ createdAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
28
+ }, z.core.$strip>;
29
+ export type EmailEvent = z.output<typeof EmailEvent>;
30
+ //# sourceMappingURL=emailEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailEvent.d.ts","sourceRoot":"","sources":["../../src/data/emailEvent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;iBA4B8C,CAAC;AACtE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { EmailEventType } from "./enums.js";
4
+ import { z } from "zod";
5
+ import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
6
+ //#region src/data/emailEvent.ts
7
+ /**
8
+ * One row in `pithy_email_events` — a per-recipient event for history and campaign attribution. The
9
+ * send path, the click/open/unsubscribe callbacks, and the inbound bounce handler all append here.
10
+ * `z.output` is the app shape; `z.input` is the SQLite row.
11
+ */
12
+ const EmailEvent = z.object({
13
+ id: z.number().int().describe("Surrogate primary key, autoincremented by SQLite."),
14
+ jobId: z.string().describe("The `pithy_email_jobs.id` this event belongs to."),
15
+ recipient: z.string().describe("The recipient address the event is about."),
16
+ type: EmailEventType.describe("What happened: sent, open, click, bounce, complaint, unsubscribe, suppressed, or failed."),
17
+ linkLabel: z.string().nullish().describe("For a `click` event, the link's identity/label as declared at render; null otherwise."),
18
+ linkUrl: z.string().nullish().describe("For a `click` event, the destination URL that was followed; null otherwise."),
19
+ campaignId: z.string().nullish().describe("The marketing campaign this event is attributed to; null for transactional."),
20
+ detail: z.string().nullish().describe("Free-form context — a bounce code, the user agent on an open, the suppression reason; null when not applicable."),
21
+ createdAt: SQLiteDate.describe("When the event was recorded.")
22
+ }).describe("One per-recipient email event in `pithy_email_events`.");
23
+ //#endregion
24
+ export { EmailEvent };
@@ -0,0 +1,78 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { z } from "zod";
4
+ /**
5
+ * The template input variables, stored as a JSON column. The per-template Zod payload schema
6
+ * validates these before a job is enqueued; the row keeps the validated object so the send Workflow
7
+ * can re-render without the caller present. A bag of strings/unknowns at the row level — the template
8
+ * id plus this payload reconstruct the email.
9
+ */
10
+ export declare const EmailJobPayload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
+ export type EmailJobPayload = z.output<typeof EmailJobPayload>;
12
+ /**
13
+ * What the `payload` column holds once a job's inputs are spent.
14
+ *
15
+ * An empty object, encoded through the same codec every other write uses rather than written as a
16
+ * `"{}"` literal — a column this schema could not read back would turn a delivered job into a row that
17
+ * throws when an operator opens it. The fact that it *was* redacted is `payloadRedactedAt`; this is
18
+ * only what is left where the variables were.
19
+ */
20
+ export declare const SPENT_PAYLOAD: string | Record<string, unknown>;
21
+ /**
22
+ * One row in `pithy_email_jobs` — the spine of the capability. Every email is a row first: a request
23
+ * handler only ever enqueues one, and the actual send always runs inside a Workflow. `z.output` is the
24
+ * app shape (Dates, booleans); `z.input` is the SQLite row (ms-epoch, 0|1, JSON string).
25
+ */
26
+ export declare const EmailJob: z.ZodObject<{
27
+ id: z.ZodString;
28
+ toAddress: z.ZodString;
29
+ recipientKey: z.ZodString;
30
+ fromAddress: z.ZodString;
31
+ fromName: z.ZodString;
32
+ subject: z.ZodString;
33
+ template: z.ZodString;
34
+ category: z.ZodEnum<{
35
+ marketing: "marketing";
36
+ transactional: "transactional";
37
+ }>;
38
+ payload: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ payloadRedactedAt: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>>>;
40
+ status: z.ZodEnum<{
41
+ bounced: "bounced";
42
+ canceled: "canceled";
43
+ failed: "failed";
44
+ pending: "pending";
45
+ scheduled: "scheduled";
46
+ sending: "sending";
47
+ sent: "sent";
48
+ suppressed: "suppressed";
49
+ undispatched: "undispatched";
50
+ }>;
51
+ mode: z.ZodEnum<{
52
+ immediate: "immediate";
53
+ scheduled: "scheduled";
54
+ timezone: "timezone";
55
+ }>;
56
+ attempts: z.ZodNumber;
57
+ batchId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ sendAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
59
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ localTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ campaignId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ correlation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ openTracking: z.ZodCodec<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodBoolean, z.ZodString]>, z.ZodBoolean>;
65
+ clickTracking: z.ZodCodec<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodBoolean, z.ZodString]>, z.ZodBoolean>;
66
+ messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ bounceCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ bounceType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ replyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ inReplyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ references: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ createdAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
74
+ updatedAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
75
+ sentAt: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>>>;
76
+ }, z.core.$strip>;
77
+ export type EmailJob = z.output<typeof EmailJob>;
78
+ //# sourceMappingURL=emailJob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailJob.d.ts","sourceRoot":"","sources":["../../src/data/emailJob.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,wCAIzB,CAAC;AACJ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,kCAAyC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoGkF,CAAC;AACxG,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC"}