@pithy-sh/email 0.1.2 → 0.1.3
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.
- package/dist/analytics.d.ts +19 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +13 -0
- package/dist/audit/actions.d.ts +45 -0
- package/dist/audit/actions.d.ts.map +1 -0
- package/dist/audit/actions.js +45 -0
- package/dist/bounce/classify.d.ts +38 -0
- package/dist/bounce/classify.d.ts.map +1 -0
- package/dist/bounce/classify.js +46 -0
- package/dist/bounce/handler.d.ts +32 -0
- package/dist/bounce/handler.d.ts.map +1 -0
- package/dist/bounce/handler.js +81 -0
- package/dist/capability.d.ts +158 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +255 -0
- package/dist/crypto/signingKey.d.ts +36 -0
- package/dist/crypto/signingKey.d.ts.map +1 -0
- package/dist/crypto/signingKey.js +36 -0
- package/dist/crypto/token.d.ts +47 -0
- package/dist/crypto/token.d.ts.map +1 -0
- package/dist/crypto/token.js +99 -0
- package/dist/data/emailEvent.d.ts +28 -0
- package/dist/data/emailEvent.d.ts.map +1 -0
- package/dist/data/emailEvent.js +22 -0
- package/dist/data/emailJob.d.ts +76 -0
- package/dist/data/emailJob.d.ts.map +1 -0
- package/dist/data/emailJob.js +62 -0
- package/dist/data/emailSuppression.d.ts +23 -0
- package/dist/data/emailSuppression.d.ts.map +1 -0
- package/dist/data/emailSuppression.js +21 -0
- package/dist/data/enums.d.ts +76 -0
- package/dist/data/enums.d.ts.map +1 -0
- package/dist/data/enums.js +65 -0
- package/dist/data/tables.d.ts +114 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tables.js +30 -0
- package/dist/error/errors.d.ts +60 -0
- package/dist/error/errors.d.ts.map +1 -0
- package/dist/error/errors.js +82 -0
- package/dist/http/callbacks.d.ts +21 -0
- package/dist/http/callbacks.d.ts.map +1 -0
- package/dist/http/callbacks.js +110 -0
- package/dist/http/guards.d.ts +99 -0
- package/dist/http/guards.d.ts.map +1 -0
- package/dist/http/guards.js +144 -0
- package/dist/http/responses.d.ts +295 -0
- package/dist/http/responses.d.ts.map +1 -0
- package/dist/http/responses.js +115 -0
- package/dist/http/routes.d.ts +71 -0
- package/dist/http/routes.d.ts.map +1 -0
- package/dist/http/routes.js +292 -0
- package/dist/http/schemas.d.ts +90 -0
- package/dist/http/schemas.d.ts.map +1 -0
- package/dist/http/schemas.js +91 -0
- package/dist/http/view.d.ts +78 -0
- package/dist/http/view.d.ts.map +1 -0
- package/dist/http/view.js +130 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/jobs/read.d.ts +191 -0
- package/dist/jobs/read.d.ts.map +1 -0
- package/dist/jobs/read.js +143 -0
- package/dist/jobs/retry.d.ts +99 -0
- package/dist/jobs/retry.d.ts.map +1 -0
- package/dist/jobs/retry.js +67 -0
- package/dist/migrations/0001_init.d.ts +32 -0
- package/dist/migrations/0001_init.d.ts.map +1 -0
- package/dist/migrations/0001_init.js +60 -0
- package/dist/migrations/0001_suppressions.d.ts +10 -0
- package/dist/migrations/0001_suppressions.d.ts.map +1 -0
- package/dist/migrations/0001_suppressions.js +20 -0
- package/dist/provision/devDelivery.d.ts +32 -0
- package/dist/provision/devDelivery.d.ts.map +1 -0
- package/dist/provision/devDelivery.js +37 -0
- package/dist/provision/hostCatalogs.d.ts +10 -0
- package/dist/provision/hostCatalogs.d.ts.map +1 -0
- package/dist/provision/hostCatalogs.js +78 -0
- package/dist/provision/provisionEmail.d.ts +143 -0
- package/dist/provision/provisionEmail.d.ts.map +1 -0
- package/dist/provision/provisionEmail.js +118 -0
- package/dist/provision/resolveEmailConfig.d.ts +122 -0
- package/dist/provision/resolveEmailConfig.d.ts.map +1 -0
- package/dist/provision/resolveEmailConfig.js +124 -0
- package/dist/provision/settingsCheck.d.ts +40 -0
- package/dist/provision/settingsCheck.d.ts.map +1 -0
- package/dist/provision/settingsCheck.js +138 -0
- package/dist/send/batchIdentity.d.ts +42 -0
- package/dist/send/batchIdentity.d.ts.map +1 -0
- package/dist/send/batchIdentity.js +46 -0
- package/dist/send/enqueue.d.ts +216 -0
- package/dist/send/enqueue.d.ts.map +1 -0
- package/dist/send/enqueue.js +153 -0
- package/dist/send/errorMapping.d.ts +27 -0
- package/dist/send/errorMapping.d.ts.map +1 -0
- package/dist/send/errorMapping.js +52 -0
- package/dist/send/events.d.ts +15 -0
- package/dist/send/events.d.ts.map +1 -0
- package/dist/send/events.js +17 -0
- package/dist/send/fromComposition.d.ts +47 -0
- package/dist/send/fromComposition.d.ts.map +1 -0
- package/dist/send/fromComposition.js +53 -0
- package/dist/send/retryPolicy.d.ts +32 -0
- package/dist/send/retryPolicy.d.ts.map +1 -0
- package/dist/send/retryPolicy.js +39 -0
- package/dist/send/runSend.d.ts +106 -0
- package/dist/send/runSend.d.ts.map +1 -0
- package/dist/send/runSend.js +218 -0
- package/dist/send/sendAt.d.ts +6 -0
- package/dist/send/sendAt.d.ts.map +1 -0
- package/dist/send/sendAt.js +62 -0
- package/dist/send/sender.d.ts +42 -0
- package/dist/send/sender.d.ts.map +1 -0
- package/dist/send/sender.js +0 -0
- package/dist/send/senderBinding.d.ts +44 -0
- package/dist/send/senderBinding.d.ts.map +1 -0
- package/dist/send/senderBinding.js +21 -0
- package/dist/send/suppression.d.ts +93 -0
- package/dist/send/suppression.d.ts.map +1 -0
- package/dist/send/suppression.js +132 -0
- package/dist/templates/engine.d.ts +109 -0
- package/dist/templates/engine.d.ts.map +1 -0
- package/dist/templates/engine.js +258 -0
- package/dist/templates/messages.d.ts +94 -0
- package/dist/templates/messages.d.ts.map +1 -0
- package/dist/templates/messages.es.d.ts +29 -0
- package/dist/templates/messages.es.d.ts.map +1 -0
- package/dist/templates/messages.es.js +82 -0
- package/dist/templates/messages.js +266 -0
- package/dist/templates/partials.d.ts +5 -0
- package/dist/templates/partials.d.ts.map +1 -0
- package/dist/templates/partials.js +59 -0
- package/dist/templates/precompiled.generated.d.ts +266 -0
- package/dist/templates/precompiled.generated.d.ts.map +1 -0
- package/dist/templates/precompiled.generated.js +4039 -0
- package/dist/templates/registry.d.ts +118 -0
- package/dist/templates/registry.d.ts.map +1 -0
- package/dist/templates/registry.js +323 -0
- package/dist/templates/samples.d.ts +7 -0
- package/dist/templates/samples.d.ts.map +1 -0
- package/dist/templates/samples.js +98 -0
- package/dist/templates/severity.d.ts +40 -0
- package/dist/templates/severity.d.ts.map +1 -0
- package/dist/templates/severity.js +81 -0
- package/dist/templates/theme.d.ts +193 -0
- package/dist/templates/theme.d.ts.map +1 -0
- package/dist/templates/theme.js +168 -0
- package/dist/version.generated.d.ts +5 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/version.generated.js +7 -0
- package/dist/workflows/hostApp.d.ts +33 -0
- package/dist/workflows/hostApp.d.ts.map +1 -0
- package/dist/workflows/hostApp.js +19 -0
- package/dist/workflows/hostEnv.d.ts +129 -0
- package/dist/workflows/hostEnv.d.ts.map +1 -0
- package/dist/workflows/hostEnv.js +147 -0
- package/dist/workflows/instanceLiveness.d.ts +3 -0
- package/dist/workflows/instanceLiveness.d.ts.map +1 -0
- package/dist/workflows/instanceLiveness.js +37 -0
- package/dist/workflows/instances.d.ts +18 -0
- package/dist/workflows/instances.d.ts.map +1 -0
- package/dist/workflows/instances.js +0 -0
- package/dist/workflows/params.d.ts +23 -0
- package/dist/workflows/params.d.ts.map +1 -0
- package/dist/workflows/params.js +21 -0
- package/dist/workflows/scheduler.d.ts +82 -0
- package/dist/workflows/scheduler.d.ts.map +1 -0
- package/dist/workflows/scheduler.js +111 -0
- package/dist/workflows/sendBatch.d.ts +85 -0
- package/dist/workflows/sendBatch.d.ts.map +1 -0
- package/dist/workflows/sendBatch.js +50 -0
- package/dist/workflows/worker.d.ts +100 -0
- package/dist/workflows/worker.d.ts.map +1 -0
- package/dist/workflows/worker.js +117 -0
- package/package.json +22 -11
- package/src/version.generated.ts +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/templates/severity.ts
|
|
3
|
+
/**
|
|
4
|
+
* How urgent an operational notice is, and how that urgency is said out loud.
|
|
5
|
+
*
|
|
6
|
+
* **Severity is words first and color second, and the order matters.** A notice is read in an inbox
|
|
7
|
+
* list before it is opened, in a plain-text client that has no colors at all, and by people who cannot
|
|
8
|
+
* tell the red one from the amber one. So each level owns a *label* — which goes in the subject line,
|
|
9
|
+
* in the body, and in the text part — and a color that only ever reinforces it. A design where the
|
|
10
|
+
* only difference between "a release is out" and "your sign-in is broken" is a hex value has flattened
|
|
11
|
+
* them, and a reader who cannot see the difference learns to ignore both.
|
|
12
|
+
*
|
|
13
|
+
* The labels name the response, not the volume. "Action needed" tells somebody what the message wants
|
|
14
|
+
* from them; "Warning" only tells them how loudly it is being said.
|
|
15
|
+
*/
|
|
16
|
+
const NoticeSeverity = z.enum([
|
|
17
|
+
"info",
|
|
18
|
+
"warning",
|
|
19
|
+
"critical"
|
|
20
|
+
]).describe("How urgent an operational notice is. `info` is something that happened and needs nothing (a release is out); `warning` is something that needs attention before it becomes a fault (a secret is overdue for rotation); `critical` is something that is failing now. The level sets the subject-line label, so it is visible in an inbox before the message is opened.");
|
|
21
|
+
/**
|
|
22
|
+
* The one place a severity's presentation is decided.
|
|
23
|
+
*
|
|
24
|
+
* Colors are fixed rather than themed, deliberately: an accent belongs to a brand, but "this is on
|
|
25
|
+
* fire" belongs to the reader. A project whose accent is red would otherwise render a routine notice
|
|
26
|
+
* in the color of an emergency. Both ramps are contrast-checked — the light values against the white
|
|
27
|
+
* card every preset ships, the dark values against the near-black one.
|
|
28
|
+
*/
|
|
29
|
+
const PRESENTATION = {
|
|
30
|
+
info: {
|
|
31
|
+
labelKey: "email/severity.info",
|
|
32
|
+
light: "#475467",
|
|
33
|
+
dark: "#98A2B3"
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
labelKey: "email/severity.warning",
|
|
37
|
+
light: "#B54708",
|
|
38
|
+
dark: "#FEC84B"
|
|
39
|
+
},
|
|
40
|
+
critical: {
|
|
41
|
+
labelKey: "email/severity.critical",
|
|
42
|
+
light: "#B42318",
|
|
43
|
+
dark: "#FDA29B"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The presentation for a value that has already been through {@link NoticeSeverity}.
|
|
48
|
+
*
|
|
49
|
+
* A template renders after its payload is parsed, so the value is always one of the three. The
|
|
50
|
+
* fallback exists because a Handlebars helper must return *something* and `info` is the only safe
|
|
51
|
+
* guess: a notice that renders as calmer than it is can still be read, while one that throws mid-render
|
|
52
|
+
* is the notice nobody receives.
|
|
53
|
+
*/
|
|
54
|
+
function presentationOf(severity) {
|
|
55
|
+
return typeof severity === "string" && Object.hasOwn(PRESENTATION, severity) ? PRESENTATION[severity] : PRESENTATION.info;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The catalog key holding the word this level is called.
|
|
59
|
+
*
|
|
60
|
+
* The engine's `{{severityLabel severity}}` helper resolves this through the render's translator, so
|
|
61
|
+
* the level is said in the recipient's language in all three places it appears. Exported as a key and
|
|
62
|
+
* not as a word, because a function returning a word would have to be handed a translator, and then
|
|
63
|
+
* every caller would carry one to ask a question about an enum.
|
|
64
|
+
*/
|
|
65
|
+
function severityLabelKey(severity) {
|
|
66
|
+
return presentationOf(severity).labelKey;
|
|
67
|
+
}
|
|
68
|
+
/** The `{{severityColor severity}}` helper: the light-mode color, applied inline like every other one. */
|
|
69
|
+
function severityColor(severity) {
|
|
70
|
+
return presentationOf(severity).light;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The dark-mode overrides for the severity colors, generated from the same table.
|
|
74
|
+
*
|
|
75
|
+
* The shared head partial carries the light values inline and swaps these in under
|
|
76
|
+
* `prefers-color-scheme: dark`, exactly as it does for the theme's own palette. Generated rather than
|
|
77
|
+
* written out so a color changed here cannot leave dark mode showing the old one.
|
|
78
|
+
*/
|
|
79
|
+
const severityDarkModeCss = Object.entries(PRESENTATION).map(([name, { dark }]) => ` .sev-${name} { color: ${dark} !important; }`).join("\n");
|
|
80
|
+
//#endregion
|
|
81
|
+
export { NoticeSeverity, severityColor, severityDarkModeCss, severityLabelKey };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The theme injected into every template: "plug your colors in, point at your logo." Templates render
|
|
4
|
+
* with full **light/dark** support — each mode has its own background, card, text, and separator
|
|
5
|
+
* colors, applied inline for light and swapped in via a `prefers-color-scheme: dark` style block. A
|
|
6
|
+
* single `accent` (saffron) carries through both modes. Visual polish is deliberately secondary to the
|
|
7
|
+
* typed payload contracts — this is enough to brand the starter set well.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ContentWidth: z.ZodEnum<{
|
|
10
|
+
narrow: "narrow";
|
|
11
|
+
wide: "wide";
|
|
12
|
+
}>;
|
|
13
|
+
export type ContentWidth = z.output<typeof ContentWidth>;
|
|
14
|
+
/** One mode's color set — the surfaces and text shades the templates reference. */
|
|
15
|
+
export declare const Palette: z.ZodObject<{
|
|
16
|
+
background: z.ZodString;
|
|
17
|
+
cardBackground: z.ZodString;
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
textMuted: z.ZodString;
|
|
20
|
+
textSubtle: z.ZodString;
|
|
21
|
+
separator: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type Palette = z.output<typeof Palette>;
|
|
24
|
+
/** A footer link (social or otherwise). */
|
|
25
|
+
export declare const FooterLink: z.ZodObject<{
|
|
26
|
+
label: z.ZodString;
|
|
27
|
+
href: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type FooterLink = z.output<typeof FooterLink>;
|
|
30
|
+
export declare const EmailTheme: z.ZodObject<{
|
|
31
|
+
appName: z.ZodString;
|
|
32
|
+
accent: z.ZodString;
|
|
33
|
+
logoUrl: z.ZodString;
|
|
34
|
+
logoDarkUrl: z.ZodString;
|
|
35
|
+
footerAddress: z.ZodString;
|
|
36
|
+
light: z.ZodObject<{
|
|
37
|
+
background: z.ZodString;
|
|
38
|
+
cardBackground: z.ZodString;
|
|
39
|
+
text: z.ZodString;
|
|
40
|
+
textMuted: z.ZodString;
|
|
41
|
+
textSubtle: z.ZodString;
|
|
42
|
+
separator: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
dark: z.ZodObject<{
|
|
45
|
+
background: z.ZodString;
|
|
46
|
+
cardBackground: z.ZodString;
|
|
47
|
+
text: z.ZodString;
|
|
48
|
+
textMuted: z.ZodString;
|
|
49
|
+
textSubtle: z.ZodString;
|
|
50
|
+
separator: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
links: z.ZodArray<z.ZodObject<{
|
|
53
|
+
label: z.ZodString;
|
|
54
|
+
href: z.ZodString;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type EmailTheme = z.output<typeof EmailTheme>;
|
|
58
|
+
/**
|
|
59
|
+
* A partial override of {@link EmailTheme} — the thin config surface a project tweaks. Every field is
|
|
60
|
+
* optional and deep-merges over the chosen preset, so `customTheme: { accent: "#7C3AED", dark: { background: "#0A0A0A" } }`
|
|
61
|
+
* changes just those values and inherits the rest. Body width is **not** here: it is a property of the
|
|
62
|
+
* template (transactional is narrow, newsletters wide), not the brand.
|
|
63
|
+
*/
|
|
64
|
+
export declare const CustomTheme: z.ZodObject<{
|
|
65
|
+
appName: z.ZodOptional<z.ZodString>;
|
|
66
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
67
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
68
|
+
logoDarkUrl: z.ZodOptional<z.ZodString>;
|
|
69
|
+
footerAddress: z.ZodOptional<z.ZodString>;
|
|
70
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
label: z.ZodString;
|
|
72
|
+
href: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
74
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
background: z.ZodOptional<z.ZodString>;
|
|
76
|
+
cardBackground: z.ZodOptional<z.ZodString>;
|
|
77
|
+
text: z.ZodOptional<z.ZodString>;
|
|
78
|
+
textMuted: z.ZodOptional<z.ZodString>;
|
|
79
|
+
textSubtle: z.ZodOptional<z.ZodString>;
|
|
80
|
+
separator: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
background: z.ZodOptional<z.ZodString>;
|
|
84
|
+
cardBackground: z.ZodOptional<z.ZodString>;
|
|
85
|
+
text: z.ZodOptional<z.ZodString>;
|
|
86
|
+
textMuted: z.ZodOptional<z.ZodString>;
|
|
87
|
+
textSubtle: z.ZodOptional<z.ZodString>;
|
|
88
|
+
separator: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type CustomTheme = z.output<typeof CustomTheme>;
|
|
92
|
+
/** A named, off-the-shelf palette pair plus its accent — the base a config picks and may override. */
|
|
93
|
+
export interface ThemePalettes {
|
|
94
|
+
accent: string;
|
|
95
|
+
light: Palette;
|
|
96
|
+
dark: Palette;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Off-the-shelf themes a project can pick by name to bootstrap its config (`email({ theme: "midnight" })`),
|
|
100
|
+
* then override piecemeal (`accent`, `light`, `dark`). Each ships a matched light/dark pair so dark mode
|
|
101
|
+
* looks intentional, not auto-inverted. `saffron` is the Pithy default.
|
|
102
|
+
*/
|
|
103
|
+
export declare const themePresets: {
|
|
104
|
+
/** Pithy brand — warm parchment/ink, saffron accent. */
|
|
105
|
+
saffron: {
|
|
106
|
+
accent: string;
|
|
107
|
+
light: {
|
|
108
|
+
background: string;
|
|
109
|
+
cardBackground: string;
|
|
110
|
+
text: string;
|
|
111
|
+
textMuted: string;
|
|
112
|
+
textSubtle: string;
|
|
113
|
+
separator: string;
|
|
114
|
+
};
|
|
115
|
+
dark: {
|
|
116
|
+
background: string;
|
|
117
|
+
cardBackground: string;
|
|
118
|
+
text: string;
|
|
119
|
+
textMuted: string;
|
|
120
|
+
textSubtle: string;
|
|
121
|
+
separator: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/** Cool, modern neutral with a blue accent — a safe SaaS default. */
|
|
125
|
+
midnight: {
|
|
126
|
+
accent: string;
|
|
127
|
+
light: {
|
|
128
|
+
background: string;
|
|
129
|
+
cardBackground: string;
|
|
130
|
+
text: string;
|
|
131
|
+
textMuted: string;
|
|
132
|
+
textSubtle: string;
|
|
133
|
+
separator: string;
|
|
134
|
+
};
|
|
135
|
+
dark: {
|
|
136
|
+
background: string;
|
|
137
|
+
cardBackground: string;
|
|
138
|
+
text: string;
|
|
139
|
+
textMuted: string;
|
|
140
|
+
textSubtle: string;
|
|
141
|
+
separator: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
/** Calm green — good for product/community mail. */
|
|
145
|
+
forest: {
|
|
146
|
+
accent: string;
|
|
147
|
+
light: {
|
|
148
|
+
background: string;
|
|
149
|
+
cardBackground: string;
|
|
150
|
+
text: string;
|
|
151
|
+
textMuted: string;
|
|
152
|
+
textSubtle: string;
|
|
153
|
+
separator: string;
|
|
154
|
+
};
|
|
155
|
+
dark: {
|
|
156
|
+
background: string;
|
|
157
|
+
cardBackground: string;
|
|
158
|
+
text: string;
|
|
159
|
+
textMuted: string;
|
|
160
|
+
textSubtle: string;
|
|
161
|
+
separator: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/** Warm rose — softer, friendlier for consumer/lifecycle mail. */
|
|
165
|
+
rose: {
|
|
166
|
+
accent: string;
|
|
167
|
+
light: {
|
|
168
|
+
background: string;
|
|
169
|
+
cardBackground: string;
|
|
170
|
+
text: string;
|
|
171
|
+
textMuted: string;
|
|
172
|
+
textSubtle: string;
|
|
173
|
+
separator: string;
|
|
174
|
+
};
|
|
175
|
+
dark: {
|
|
176
|
+
background: string;
|
|
177
|
+
cardBackground: string;
|
|
178
|
+
text: string;
|
|
179
|
+
textMuted: string;
|
|
180
|
+
textSubtle: string;
|
|
181
|
+
separator: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
/** The names of the off-the-shelf themes. */
|
|
186
|
+
export type ThemePreset = keyof typeof themePresets;
|
|
187
|
+
/** The default theme — Pithy brand (`saffron`), parchment/ink light, deep-ink dark, logo-less. */
|
|
188
|
+
export declare const defaultTheme: EmailTheme;
|
|
189
|
+
/** Build a full {@link EmailTheme} from a preset plus an optional partial override (deep-merged). */
|
|
190
|
+
export declare function resolveTheme(preset: ThemePreset, custom?: CustomTheme): EmailTheme;
|
|
191
|
+
/** The pixel width the layout uses for a given content width. */
|
|
192
|
+
export declare function widthPx(width: ContentWidth): number;
|
|
193
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/templates/theme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY;;;EAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC;AAEzD,mFAAmF;AACnF,eAAO,MAAM,OAAO;;;;;;;iBASmD,CAAC;AACxE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,2CAA2C;AAC3C,eAAO,MAAM,UAAU;;;iBAKqC,CAAC;AAC7D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAErD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqB2F,CAAC;AACnH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO8F,CAAC;AACvH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,sGAAsG;AACtG,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY;IACvB,wDAAwD;;QAEtD,MAAM;QACN,KAAK;YACH,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;QAEX,IAAI;YACF,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;;IAGb,qEAAqE;;QAEnE,MAAM;QACN,KAAK;YACH,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;QAEX,IAAI;YACF,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;;IAGb,oDAAoD;;QAElD,MAAM;QACN,KAAK;YACH,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;QAEX,IAAI;YACF,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;;IAGb,kEAAkE;;QAEhE,MAAM;QACN,KAAK;YACH,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;QAEX,IAAI;YACF,UAAU;YACV,cAAc;YACd,IAAI;YACJ,SAAS;YACT,UAAU;YACV,SAAS;;;CAG0B,CAAC;AAE1C,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AAEpD,kGAAkG;AAClG,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAalF;AAED,iEAAiE;AACjE,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/templates/theme.ts
|
|
3
|
+
/**
|
|
4
|
+
* The theme injected into every template: "plug your colors in, point at your logo." Templates render
|
|
5
|
+
* with full **light/dark** support — each mode has its own background, card, text, and separator
|
|
6
|
+
* colors, applied inline for light and swapped in via a `prefers-color-scheme: dark` style block. A
|
|
7
|
+
* single `accent` (saffron) carries through both modes. Visual polish is deliberately secondary to the
|
|
8
|
+
* typed payload contracts — this is enough to brand the starter set well.
|
|
9
|
+
*/
|
|
10
|
+
const ContentWidth = z.enum(["narrow", "wide"]).describe("The email body width: `narrow` (600px — the transactional default) or `wide` (720px — better for newsletters).");
|
|
11
|
+
/** One mode's color set — the surfaces and text shades the templates reference. */
|
|
12
|
+
const Palette = z.object({
|
|
13
|
+
background: z.string().describe("The page background behind the card."),
|
|
14
|
+
cardBackground: z.string().describe("The card surface the email content sits on."),
|
|
15
|
+
text: z.string().describe("The primary text/heading color."),
|
|
16
|
+
textMuted: z.string().describe("Secondary body text — summaries, supporting copy."),
|
|
17
|
+
textSubtle: z.string().describe("Tertiary text — the footer and fine print."),
|
|
18
|
+
separator: z.string().describe("The hairline rule color between sections.")
|
|
19
|
+
}).describe("A light- or dark-mode color set for the email templates.");
|
|
20
|
+
/** A footer link (social or otherwise). */
|
|
21
|
+
const FooterLink = z.object({
|
|
22
|
+
label: z.string().describe("The link text shown in the footer."),
|
|
23
|
+
href: z.string().describe("The absolute URL the footer link points to.")
|
|
24
|
+
}).describe("One footer link rendered in the email footer.");
|
|
25
|
+
const EmailTheme = z.object({
|
|
26
|
+
appName: z.string().describe("The product name shown in the header (when no logo is set) and the footer."),
|
|
27
|
+
accent: z.string().describe("The single accent color (hex) for the CTA button and the header rule, in both modes. Defaults to saffron."),
|
|
28
|
+
logoUrl: z.string().describe("Absolute URL of the light-mode header logo PNG. Empty renders the app name as text."),
|
|
29
|
+
logoDarkUrl: z.string().describe("Absolute URL of the dark-mode logo PNG, swapped in under `prefers-color-scheme: dark`. Empty falls back to the light logo / app name."),
|
|
30
|
+
footerAddress: z.string().describe("The physical mailing address shown in the footer — required for marketing (CAN-SPAM) compliance."),
|
|
31
|
+
light: Palette.describe("The light-mode color set, applied inline."),
|
|
32
|
+
dark: Palette.describe("The dark-mode color set, applied via a `prefers-color-scheme: dark` style block."),
|
|
33
|
+
links: z.array(FooterLink).describe("Footer links (e.g. social profiles), rendered as a separated row.")
|
|
34
|
+
}).describe("Brand theme for the email templates — light/dark palettes, accent, logo, and the compliance footer.");
|
|
35
|
+
/**
|
|
36
|
+
* A partial override of {@link EmailTheme} — the thin config surface a project tweaks. Every field is
|
|
37
|
+
* optional and deep-merges over the chosen preset, so `customTheme: { accent: "#7C3AED", dark: { background: "#0A0A0A" } }`
|
|
38
|
+
* changes just those values and inherits the rest. Body width is **not** here: it is a property of the
|
|
39
|
+
* template (transactional is narrow, newsletters wide), not the brand.
|
|
40
|
+
*/
|
|
41
|
+
const CustomTheme = EmailTheme.partial().extend({
|
|
42
|
+
light: Palette.partial().optional().describe("Override individual light-mode palette colors."),
|
|
43
|
+
dark: Palette.partial().optional().describe("Override individual dark-mode palette colors.")
|
|
44
|
+
}).describe("A partial, deep-merged override of the chosen theme preset — derived from EmailTheme so it can't drift.");
|
|
45
|
+
/**
|
|
46
|
+
* Off-the-shelf themes a project can pick by name to bootstrap its config (`email({ theme: "midnight" })`),
|
|
47
|
+
* then override piecemeal (`accent`, `light`, `dark`). Each ships a matched light/dark pair so dark mode
|
|
48
|
+
* looks intentional, not auto-inverted. `saffron` is the Pithy default.
|
|
49
|
+
*/
|
|
50
|
+
const themePresets = {
|
|
51
|
+
/** Pithy brand — warm parchment/ink, saffron accent. */
|
|
52
|
+
saffron: {
|
|
53
|
+
accent: "#D4A017",
|
|
54
|
+
light: {
|
|
55
|
+
background: "#FAFAF6",
|
|
56
|
+
cardBackground: "#FFFFFF",
|
|
57
|
+
text: "#111111",
|
|
58
|
+
textMuted: "#5F5D57",
|
|
59
|
+
textSubtle: "#9A988F",
|
|
60
|
+
separator: "#E7E5DF"
|
|
61
|
+
},
|
|
62
|
+
dark: {
|
|
63
|
+
background: "#14110D",
|
|
64
|
+
cardBackground: "#1C1813",
|
|
65
|
+
text: "#FAFAF6",
|
|
66
|
+
textMuted: "#A09C90",
|
|
67
|
+
textSubtle: "#6B675E",
|
|
68
|
+
separator: "#2A251E"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
/** Cool, modern neutral with a blue accent — a safe SaaS default. */
|
|
72
|
+
midnight: {
|
|
73
|
+
accent: "#3B82F6",
|
|
74
|
+
light: {
|
|
75
|
+
background: "#F4F6FB",
|
|
76
|
+
cardBackground: "#FFFFFF",
|
|
77
|
+
text: "#0F172A",
|
|
78
|
+
textMuted: "#475569",
|
|
79
|
+
textSubtle: "#94A3B8",
|
|
80
|
+
separator: "#E2E8F0"
|
|
81
|
+
},
|
|
82
|
+
dark: {
|
|
83
|
+
background: "#0B1120",
|
|
84
|
+
cardBackground: "#111827",
|
|
85
|
+
text: "#F1F5F9",
|
|
86
|
+
textMuted: "#94A3B8",
|
|
87
|
+
textSubtle: "#64748B",
|
|
88
|
+
separator: "#1E293B"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
/** Calm green — good for product/community mail. */
|
|
92
|
+
forest: {
|
|
93
|
+
accent: "#2F9E6E",
|
|
94
|
+
light: {
|
|
95
|
+
background: "#F3F7F4",
|
|
96
|
+
cardBackground: "#FFFFFF",
|
|
97
|
+
text: "#13231B",
|
|
98
|
+
textMuted: "#4B6358",
|
|
99
|
+
textSubtle: "#8AA597",
|
|
100
|
+
separator: "#DDE8E1"
|
|
101
|
+
},
|
|
102
|
+
dark: {
|
|
103
|
+
background: "#0C140F",
|
|
104
|
+
cardBackground: "#141F18",
|
|
105
|
+
text: "#ECF5EF",
|
|
106
|
+
textMuted: "#9CB6A7",
|
|
107
|
+
textSubtle: "#5F7568",
|
|
108
|
+
separator: "#213028"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
/** Warm rose — softer, friendlier for consumer/lifecycle mail. */
|
|
112
|
+
rose: {
|
|
113
|
+
accent: "#E0567A",
|
|
114
|
+
light: {
|
|
115
|
+
background: "#FBF4F6",
|
|
116
|
+
cardBackground: "#FFFFFF",
|
|
117
|
+
text: "#26101A",
|
|
118
|
+
textMuted: "#6B4451",
|
|
119
|
+
textSubtle: "#B08A95",
|
|
120
|
+
separator: "#F0DDE3"
|
|
121
|
+
},
|
|
122
|
+
dark: {
|
|
123
|
+
background: "#160C10",
|
|
124
|
+
cardBackground: "#20141A",
|
|
125
|
+
text: "#F8EEF1",
|
|
126
|
+
textMuted: "#C29AA6",
|
|
127
|
+
textSubtle: "#7A5662",
|
|
128
|
+
separator: "#33222A"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
/** The default theme — Pithy brand (`saffron`), parchment/ink light, deep-ink dark, logo-less. */
|
|
133
|
+
const defaultTheme = {
|
|
134
|
+
appName: "Pithy",
|
|
135
|
+
accent: themePresets.saffron.accent,
|
|
136
|
+
logoUrl: "",
|
|
137
|
+
logoDarkUrl: "",
|
|
138
|
+
footerAddress: "",
|
|
139
|
+
light: themePresets.saffron.light,
|
|
140
|
+
dark: themePresets.saffron.dark,
|
|
141
|
+
links: []
|
|
142
|
+
};
|
|
143
|
+
/** Build a full {@link EmailTheme} from a preset plus an optional partial override (deep-merged). */
|
|
144
|
+
function resolveTheme(preset, custom) {
|
|
145
|
+
const base = themePresets[preset];
|
|
146
|
+
return {
|
|
147
|
+
appName: custom?.appName ?? defaultTheme.appName,
|
|
148
|
+
accent: custom?.accent ?? base.accent,
|
|
149
|
+
logoUrl: custom?.logoUrl ?? "",
|
|
150
|
+
logoDarkUrl: custom?.logoDarkUrl ?? "",
|
|
151
|
+
footerAddress: custom?.footerAddress ?? "",
|
|
152
|
+
light: {
|
|
153
|
+
...base.light,
|
|
154
|
+
...custom?.light
|
|
155
|
+
},
|
|
156
|
+
dark: {
|
|
157
|
+
...base.dark,
|
|
158
|
+
...custom?.dark
|
|
159
|
+
},
|
|
160
|
+
links: custom?.links ?? []
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** The pixel width the layout uses for a given content width. */
|
|
164
|
+
function widthPx(width) {
|
|
165
|
+
return width === "wide" ? 720 : 600;
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
export { ContentWidth, CustomTheme, EmailTheme, FooterLink, Palette, defaultTheme, resolveTheme, themePresets, widthPx };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** This package's npm name — the join key against a release feed. */
|
|
2
|
+
export declare const PACKAGE_NAME = "@pithy-sh/email";
|
|
3
|
+
/** This package's version, stamped from its own package.json at generation time. */
|
|
4
|
+
export declare const PACKAGE_VERSION = "0.1.3";
|
|
5
|
+
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.generated.d.ts","sourceRoot":"","sources":["../src/version.generated.ts"],"names":[],"mappings":"AAWA,qEAAqE;AACrE,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C,oFAAoF;AACpF,eAAO,MAAM,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/version.generated.ts
|
|
2
|
+
/** This package's npm name — the join key against a release feed. */
|
|
3
|
+
const PACKAGE_NAME = "@pithy-sh/email";
|
|
4
|
+
/** This package's version, stamped from its own package.json at generation time. */
|
|
5
|
+
const PACKAGE_VERSION = "0.1.3";
|
|
6
|
+
//#endregion
|
|
7
|
+
export { PACKAGE_NAME, PACKAGE_VERSION };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
|
|
2
|
+
import type { AmbientEnv } from "@pithy-sh/core/src/env/ambient";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
/**
|
|
5
|
+
* The email host worker's HTTP surface: one route, and only in `dev`.
|
|
6
|
+
*
|
|
7
|
+
* The host had no `fetch` at all — it was reached by Workflow dispatch and its cron, and nothing
|
|
8
|
+
* else. That is still true of a deployed environment: an app worker holds a cross-script
|
|
9
|
+
* `EMAIL_SENDER` binding and never speaks HTTP to this Worker. Locally there is no such binding,
|
|
10
|
+
* because `pithy dev` runs each worker as its own `wrangler dev` and CLAUDE.md rules out wrangler's
|
|
11
|
+
* cross-process service registry. So `pithy dev` composes a loopback dispatcher instead, pointed at
|
|
12
|
+
* `EMAIL_ORIGIN`, and this is the door it knocks on (pithy-sh/pithy#410).
|
|
13
|
+
*
|
|
14
|
+
* Everything about the route — the environment gate, the `public` verification strategy, the request
|
|
15
|
+
* contract, the 202 — belongs to `@pithy-sh/core/src/workflow/dispatchRoute`, so the other eight
|
|
16
|
+
* capability hosts mount the identical thing. What is email's is the registry: `:binding` resolves
|
|
17
|
+
* against email's own two jobs, and the payload validates against the declaring spec's schema.
|
|
18
|
+
*
|
|
19
|
+
* Built here rather than inside `worker.ts` because that module imports `cloudflare:workers` and so
|
|
20
|
+
* cannot be loaded under node. This one can, which is what lets the wiring be tested without a
|
|
21
|
+
* Workers runtime — and the wiring is the part that was missing.
|
|
22
|
+
*/
|
|
23
|
+
/** What the app needs to know beyond its registry: where it is running. */
|
|
24
|
+
export interface EmailHostAppOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The ambient environment the dispatch gate reads. Defaults to the process env, which in a Worker
|
|
27
|
+
* is the script's own vars — where provisioning stamps `ENVIRONMENT`. Injectable for tests.
|
|
28
|
+
*/
|
|
29
|
+
env?: AmbientEnv;
|
|
30
|
+
}
|
|
31
|
+
/** Build the email host worker's app: the Pithy error handler, and the workflow dispatch route. */
|
|
32
|
+
export declare function createEmailHostApp(options?: EmailHostAppOptions): Hono<PithyHonoEnv>;
|
|
33
|
+
//# sourceMappingURL=hostApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostApp.d.ts","sourceRoot":"","sources":["../../src/workflows/hostApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC,CAYxF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EMAIL_CAPABILITY } from "../provision/provisionEmail.js";
|
|
2
|
+
import { emailWorkflowRegistry } from "../provision/resolveEmailConfig.js";
|
|
3
|
+
import { pithyErrorHandler } from "@pithy-sh/core/src/error/http";
|
|
4
|
+
import { registerWorkflowDispatchRoute } from "@pithy-sh/core/src/workflow/dispatchRoute";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
//#region src/workflows/hostApp.ts
|
|
7
|
+
/** Build the email host worker's app: the Pithy error handler, and the workflow dispatch route. */
|
|
8
|
+
function createEmailHostApp(options = {}) {
|
|
9
|
+
const app = new Hono();
|
|
10
|
+
app.onError(pithyErrorHandler);
|
|
11
|
+
registerWorkflowDispatchRoute(app, {
|
|
12
|
+
capability: EMAIL_CAPABILITY,
|
|
13
|
+
registry: emailWorkflowRegistry,
|
|
14
|
+
env: options.env
|
|
15
|
+
});
|
|
16
|
+
return app;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createEmailHostApp };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { D1Database } from "@cloudflare/workers-types";
|
|
2
|
+
import type { SecretBinding } from "@pithy-sh/secrets/src/env/bindings";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { EmailSender } from "../send/sender";
|
|
5
|
+
import type { SendWorkflowInstances } from "./instances";
|
|
6
|
+
/** The email host's env, as the host runs on it. Every field is coerced here, never at its reader. */
|
|
7
|
+
export declare const EmailHostEnv: z.ZodObject<{
|
|
8
|
+
DB: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
9
|
+
EMAIL_SUPPRESSIONS: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
10
|
+
SECRETS: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
11
|
+
SECRETS_ENCRYPTION_KEYS: z.ZodUnion<readonly [z.ZodString, z.ZodType<SecretBinding, unknown, z.core.$ZodTypeInternals<SecretBinding, unknown>>]>;
|
|
12
|
+
EMAIL: z.ZodType<EmailSender, unknown, z.core.$ZodTypeInternals<EmailSender, unknown>>;
|
|
13
|
+
EMAIL_SENDER: z.ZodCustom<EmailSenderBinding, EmailSenderBinding>;
|
|
14
|
+
EMAIL_SCHEDULER: z.ZodType<{
|
|
15
|
+
create(): Promise<unknown>;
|
|
16
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
17
|
+
create(): Promise<unknown>;
|
|
18
|
+
}, unknown>>;
|
|
19
|
+
BASE_URL: z.ZodURL;
|
|
20
|
+
EMAIL_THEME: z.ZodPipe<z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<unknown, string | undefined>>, z.ZodObject<{
|
|
21
|
+
appName: z.ZodString;
|
|
22
|
+
accent: z.ZodString;
|
|
23
|
+
logoUrl: z.ZodString;
|
|
24
|
+
logoDarkUrl: z.ZodString;
|
|
25
|
+
footerAddress: z.ZodString;
|
|
26
|
+
light: z.ZodObject<{
|
|
27
|
+
background: z.ZodString;
|
|
28
|
+
cardBackground: z.ZodString;
|
|
29
|
+
text: z.ZodString;
|
|
30
|
+
textMuted: z.ZodString;
|
|
31
|
+
textSubtle: z.ZodString;
|
|
32
|
+
separator: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
dark: z.ZodObject<{
|
|
35
|
+
background: z.ZodString;
|
|
36
|
+
cardBackground: z.ZodString;
|
|
37
|
+
text: z.ZodString;
|
|
38
|
+
textMuted: z.ZodString;
|
|
39
|
+
textSubtle: z.ZodString;
|
|
40
|
+
separator: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
links: z.ZodArray<z.ZodObject<{
|
|
43
|
+
label: z.ZodString;
|
|
44
|
+
href: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
ENVIRONMENT: z.ZodOptional<z.ZodString>;
|
|
48
|
+
LINK_TTL_DAYS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
49
|
+
MAX_ATTEMPTS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
50
|
+
SCHEDULER_ENABLED: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
false: "false";
|
|
52
|
+
true: "true";
|
|
53
|
+
}>>, z.ZodTransform<boolean, "false" | "true">>;
|
|
54
|
+
SCHEDULER_BATCH_SIZE: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
55
|
+
SCHEDULER_MAX_JOBS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
56
|
+
SCHEDULER_GRACE_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
57
|
+
SCHEDULER_STUCK_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type EmailHostEnv = z.output<typeof EmailHostEnv>;
|
|
60
|
+
/** The send Workflow binding as the host holds it: it starts instances and answers about them. */
|
|
61
|
+
type EmailSenderBinding = {
|
|
62
|
+
create(options: {
|
|
63
|
+
id?: string;
|
|
64
|
+
params: {
|
|
65
|
+
jobIds: string[];
|
|
66
|
+
};
|
|
67
|
+
}): Promise<unknown>;
|
|
68
|
+
} & SendWorkflowInstances;
|
|
69
|
+
/**
|
|
70
|
+
* The email host's env declaration — the schema plus what fills each field.
|
|
71
|
+
*
|
|
72
|
+
* The host validates against this at boot ({@link import("@pithy-sh/core/src/workflow/hostEnv").requireHostEnv});
|
|
73
|
+
* `pithy doctor` walks the same object to check an adopter's *resolved* settings without running a
|
|
74
|
+
* Worker. One declaration, so the check an operator runs and the check the host runs cannot disagree.
|
|
75
|
+
*/
|
|
76
|
+
export declare const emailHostEnv: import("@pithy-sh/core/src/workflow/hostEnv").HostEnvDeclaration<z.ZodObject<{
|
|
77
|
+
DB: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
78
|
+
EMAIL_SUPPRESSIONS: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
79
|
+
SECRETS: z.ZodType<D1Database, unknown, z.core.$ZodTypeInternals<D1Database, unknown>>;
|
|
80
|
+
SECRETS_ENCRYPTION_KEYS: z.ZodUnion<readonly [z.ZodString, z.ZodType<SecretBinding, unknown, z.core.$ZodTypeInternals<SecretBinding, unknown>>]>;
|
|
81
|
+
EMAIL: z.ZodType<EmailSender, unknown, z.core.$ZodTypeInternals<EmailSender, unknown>>;
|
|
82
|
+
EMAIL_SENDER: z.ZodCustom<EmailSenderBinding, EmailSenderBinding>;
|
|
83
|
+
EMAIL_SCHEDULER: z.ZodType<{
|
|
84
|
+
create(): Promise<unknown>;
|
|
85
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
86
|
+
create(): Promise<unknown>;
|
|
87
|
+
}, unknown>>;
|
|
88
|
+
BASE_URL: z.ZodURL;
|
|
89
|
+
EMAIL_THEME: z.ZodPipe<z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<unknown, string | undefined>>, z.ZodObject<{
|
|
90
|
+
appName: z.ZodString;
|
|
91
|
+
accent: z.ZodString;
|
|
92
|
+
logoUrl: z.ZodString;
|
|
93
|
+
logoDarkUrl: z.ZodString;
|
|
94
|
+
footerAddress: z.ZodString;
|
|
95
|
+
light: z.ZodObject<{
|
|
96
|
+
background: z.ZodString;
|
|
97
|
+
cardBackground: z.ZodString;
|
|
98
|
+
text: z.ZodString;
|
|
99
|
+
textMuted: z.ZodString;
|
|
100
|
+
textSubtle: z.ZodString;
|
|
101
|
+
separator: z.ZodString;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
dark: z.ZodObject<{
|
|
104
|
+
background: z.ZodString;
|
|
105
|
+
cardBackground: z.ZodString;
|
|
106
|
+
text: z.ZodString;
|
|
107
|
+
textMuted: z.ZodString;
|
|
108
|
+
textSubtle: z.ZodString;
|
|
109
|
+
separator: z.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
links: z.ZodArray<z.ZodObject<{
|
|
112
|
+
label: z.ZodString;
|
|
113
|
+
href: z.ZodString;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
ENVIRONMENT: z.ZodOptional<z.ZodString>;
|
|
117
|
+
LINK_TTL_DAYS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
118
|
+
MAX_ATTEMPTS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
119
|
+
SCHEDULER_ENABLED: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
|
|
120
|
+
false: "false";
|
|
121
|
+
true: "true";
|
|
122
|
+
}>>, z.ZodTransform<boolean, "false" | "true">>;
|
|
123
|
+
SCHEDULER_BATCH_SIZE: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
124
|
+
SCHEDULER_MAX_JOBS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
125
|
+
SCHEDULER_GRACE_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
126
|
+
SCHEDULER_STUCK_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=hostEnv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostEnv.d.ts","sourceRoot":"","sources":["../../src/workflows/hostEnv.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAqEzD,sGAAsG;AACtG,eAAO,MAAM,YAAY;;;;;;;;kBA0BiB,OAAO,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4D6C,CAAC;AACxG,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC;AAEzD,kGAAkG;AAClG,KAAK,kBAAkB,GAAG;IACxB,MAAM,CAAC,OAAO,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAClF,GAAG,qBAAqB,CAAC;AAO1B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;kBAhFiB,OAAO,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiHxD,CAAC"}
|