@pithy-sh/email 0.10.1 → 0.10.2
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/provision/resolveEmailConfig.d.ts +8 -3
- package/dist/provision/resolveEmailConfig.d.ts.map +1 -1
- package/dist/provision/resolveEmailConfig.js +5 -2
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +3 -3
- package/src/provision/resolveEmailConfig.ts +13 -6
- package/src/version.generated.ts +1 -1
|
@@ -32,7 +32,7 @@ export declare const emailWorkflowRegistry: WorkflowRegistry;
|
|
|
32
32
|
/**
|
|
33
33
|
* The Workflows one environment's email worker is deployed with — `<project>-<env>-email-send` and
|
|
34
34
|
* `<project>-<env>-email-schedule`. Derived by the call {@link resolveEmailConfig} deploys with, so teardown
|
|
35
|
-
* deletes the names provision created and no others
|
|
35
|
+
* deletes the names provision created and no others. Deleting a Worker does not delete the Workflows
|
|
36
36
|
* registered against it.
|
|
37
37
|
*/
|
|
38
38
|
export declare function emailWorkflowNames(project: string, env: ManagedEnvironment): string[];
|
|
@@ -83,18 +83,23 @@ export interface EmailConfigParams {
|
|
|
83
83
|
*/
|
|
84
84
|
env: ManagedEnvironment | "dev";
|
|
85
85
|
/**
|
|
86
|
-
* **The feature this host serves, when it serves one
|
|
86
|
+
* **The feature this host serves, when it serves one.** A feature gets its own email host, as a
|
|
87
87
|
* declared environment does, and everything the host is called or reads takes the feature's names: the
|
|
88
88
|
* Worker and its Workflows (`<project>-f<issue>-<slug>-email[-<job>]`), the feature's own master key and
|
|
89
89
|
* link-signing key entries, and the feature's own suppression database. `env` is then `feature`, which is
|
|
90
90
|
* what the host's `ENVIRONMENT` var says.
|
|
91
91
|
*/
|
|
92
92
|
feature?: FeatureIdentity;
|
|
93
|
+
/**
|
|
94
|
+
* The `apps/<owner>` Worker whose own host this is, when it owns a binding the host binds. The Worker and its
|
|
95
|
+
* Workflows then carry `<owner>---<capability>`, so it never takes the shared host's names.
|
|
96
|
+
*/
|
|
97
|
+
owner?: string;
|
|
93
98
|
/** The app database id for this environment — where jobs/events live. */
|
|
94
99
|
appDatabaseId: string;
|
|
95
100
|
/** The shared suppression database id (same in every environment). */
|
|
96
101
|
suppressionDatabaseId: string;
|
|
97
|
-
/** This environment's secrets database id (`<project>-<env>-secrets`). The signing key is not in it
|
|
102
|
+
/** This environment's secrets database id (`<project>-<env>-secrets`). The signing key is not in it. */
|
|
98
103
|
secretsDatabaseId: string;
|
|
99
104
|
/** The CF Secrets Store id holding the per-env master key and the per-env link-signing key. */
|
|
100
105
|
storeId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEmailConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolveEmailConfig.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,eAAe,CAAC;AAG1E;;;;;;GAMG;AACH,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACvE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,qBAAqB,EAAE,uBAAuB,E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qBAAqB,EAAE,gBAKnC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAIrF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,QAAW,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB9F;AAED,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,GAAG,EAAE,kBAAkB,GAAG,KAAK,CAAC;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wGAAwG;IACxG,iBAAiB,EAAE,MAAM,CAAC;IAC1B,+FAA+F;IAC/F,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,KAAK,EAAE,UAAU,CAAC;IAClB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAK/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,2BAA2B,EACrC,MAAM,EAAE,iBAAiB,GACxB,2BAA2B,CA2D7B"}
|
|
@@ -36,7 +36,7 @@ const emailWorkflowRegistry = Object.fromEntries(Object.entries({
|
|
|
36
36
|
/**
|
|
37
37
|
* The Workflows one environment's email worker is deployed with — `<project>-<env>-email-send` and
|
|
38
38
|
* `<project>-<env>-email-schedule`. Derived by the call {@link resolveEmailConfig} deploys with, so teardown
|
|
39
|
-
* deletes the names provision created and no others
|
|
39
|
+
* deletes the names provision created and no others. Deleting a Worker does not delete the Workflows
|
|
40
40
|
* registered against it.
|
|
41
41
|
*/
|
|
42
42
|
function emailWorkflowNames(project, env) {
|
|
@@ -114,12 +114,14 @@ function emailMessagesVars(messages) {
|
|
|
114
114
|
function resolveEmailConfig(template, params) {
|
|
115
115
|
const { project, env, appDatabaseId, suppressionDatabaseId, secretsDatabaseId, storeId, baseUrl, theme } = params;
|
|
116
116
|
const feature = params.feature;
|
|
117
|
+
const owner = params.owner;
|
|
117
118
|
const scope = feature ? featureScope(feature) : environmentScope(project, env);
|
|
118
119
|
return resolveWorkflowHost(template, {
|
|
119
120
|
project,
|
|
120
121
|
capability: EMAIL_CAPABILITY,
|
|
121
122
|
env,
|
|
122
123
|
...feature ? { feature } : {},
|
|
124
|
+
...owner !== void 0 ? { owner } : {},
|
|
123
125
|
databaseIds: {
|
|
124
126
|
DB: appDatabaseId,
|
|
125
127
|
EMAIL_SUPPRESSIONS: suppressionDatabaseId,
|
|
@@ -139,7 +141,8 @@ function resolveEmailConfig(template, params) {
|
|
|
139
141
|
project,
|
|
140
142
|
capability: EMAIL_CAPABILITY,
|
|
141
143
|
env,
|
|
142
|
-
...feature ? { feature } : {}
|
|
144
|
+
...feature ? { feature } : {},
|
|
145
|
+
...owner !== void 0 ? { owner } : {}
|
|
143
146
|
}).workflows
|
|
144
147
|
});
|
|
145
148
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
/** This package's npm name — the join key against a release feed. */
|
|
4
4
|
export declare const PACKAGE_NAME = "@pithy-sh/email";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.10.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.10.2";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/email";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.10.
|
|
7
|
+
const PACKAGE_VERSION = "0.10.2";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/email",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"postal-mime": "^3.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@pithy-sh/core": "^0.
|
|
46
|
-
"@pithy-sh/secrets": "^0.6.
|
|
45
|
+
"@pithy-sh/core": "^0.20.0",
|
|
46
|
+
"@pithy-sh/secrets": "^0.6.8",
|
|
47
47
|
"hono": "^4.13.2",
|
|
48
48
|
"kysely": "^0.29.0",
|
|
49
49
|
"zod": "^4.4.0"
|
|
@@ -54,8 +54,7 @@ export interface EmailWorkerWranglerTemplate extends WorkflowHostTemplate {
|
|
|
54
54
|
* jobs are mirrored here, and `resolveEmailConfig.test.ts` asserts the bindings and class names match
|
|
55
55
|
* the committed template byte for byte.
|
|
56
56
|
*
|
|
57
|
-
* **`params` is
|
|
58
|
-
* route, and that route validates an arriving loopback payload against the declaring spec's own
|
|
57
|
+
* **`params` is a request contract.** The host mounts the shared dispatch route, and that route validates an arriving loopback payload against the declaring spec's own
|
|
59
58
|
* schema before it starts anything — so the registry's `params` is the request contract of a real
|
|
60
59
|
* HTTP surface. Both sides therefore read the one schema out of `workflows/params.ts`; a `z.unknown()`
|
|
61
60
|
* here would let a malformed dispatch through to fail inside a durable instance instead.
|
|
@@ -81,7 +80,7 @@ export const emailWorkflowRegistry: WorkflowRegistry = Object.fromEntries(
|
|
|
81
80
|
/**
|
|
82
81
|
* The Workflows one environment's email worker is deployed with — `<project>-<env>-email-send` and
|
|
83
82
|
* `<project>-<env>-email-schedule`. Derived by the call {@link resolveEmailConfig} deploys with, so teardown
|
|
84
|
-
* deletes the names provision created and no others
|
|
83
|
+
* deletes the names provision created and no others. Deleting a Worker does not delete the Workflows
|
|
85
84
|
* registered against it.
|
|
86
85
|
*/
|
|
87
86
|
export function emailWorkflowNames(project: string, env: ManagedEnvironment): string[] {
|
|
@@ -156,18 +155,23 @@ export interface EmailConfigParams {
|
|
|
156
155
|
*/
|
|
157
156
|
env: ManagedEnvironment | "dev";
|
|
158
157
|
/**
|
|
159
|
-
* **The feature this host serves, when it serves one
|
|
158
|
+
* **The feature this host serves, when it serves one.** A feature gets its own email host, as a
|
|
160
159
|
* declared environment does, and everything the host is called or reads takes the feature's names: the
|
|
161
160
|
* Worker and its Workflows (`<project>-f<issue>-<slug>-email[-<job>]`), the feature's own master key and
|
|
162
161
|
* link-signing key entries, and the feature's own suppression database. `env` is then `feature`, which is
|
|
163
162
|
* what the host's `ENVIRONMENT` var says.
|
|
164
163
|
*/
|
|
165
164
|
feature?: FeatureIdentity;
|
|
165
|
+
/**
|
|
166
|
+
* The `apps/<owner>` Worker whose own host this is, when it owns a binding the host binds. The Worker and its
|
|
167
|
+
* Workflows then carry `<owner>---<capability>`, so it never takes the shared host's names.
|
|
168
|
+
*/
|
|
169
|
+
owner?: string;
|
|
166
170
|
/** The app database id for this environment — where jobs/events live. */
|
|
167
171
|
appDatabaseId: string;
|
|
168
172
|
/** The shared suppression database id (same in every environment). */
|
|
169
173
|
suppressionDatabaseId: string;
|
|
170
|
-
/** This environment's secrets database id (`<project>-<env>-secrets`). The signing key is not in it
|
|
174
|
+
/** This environment's secrets database id (`<project>-<env>-secrets`). The signing key is not in it. */
|
|
171
175
|
secretsDatabaseId: string;
|
|
172
176
|
/** The CF Secrets Store id holding the per-env master key and the per-env link-signing key. */
|
|
173
177
|
storeId: string;
|
|
@@ -220,6 +224,7 @@ export function resolveEmailConfig(
|
|
|
220
224
|
): EmailWorkerWranglerTemplate {
|
|
221
225
|
const { project, env, appDatabaseId, suppressionDatabaseId, secretsDatabaseId, storeId, baseUrl, theme } = params;
|
|
222
226
|
const feature = params.feature;
|
|
227
|
+
const owner = params.owner;
|
|
223
228
|
// One scope for every name below, so a feature's host can never bind a declared environment's key or list.
|
|
224
229
|
const scope = feature ? featureScope(feature) : environmentScope(project, env);
|
|
225
230
|
const resolved = resolveWorkflowHost(template, {
|
|
@@ -227,6 +232,7 @@ export function resolveEmailConfig(
|
|
|
227
232
|
capability: EMAIL_CAPABILITY,
|
|
228
233
|
env,
|
|
229
234
|
...(feature ? { feature } : {}),
|
|
235
|
+
...(owner !== undefined ? { owner } : {}),
|
|
230
236
|
databaseIds: {
|
|
231
237
|
DB: appDatabaseId,
|
|
232
238
|
EMAIL_SUPPRESSIONS: suppressionDatabaseId,
|
|
@@ -247,7 +253,7 @@ export function resolveEmailConfig(
|
|
|
247
253
|
// The link-signing key, at the entry `pithy secrets provision` created and bound the app Worker to —
|
|
248
254
|
// composed by the same `environmentScope(...).secretEntry` call, from the declaration's own scope, so
|
|
249
255
|
// the Worker that signs a link and the Worker that verifies it cannot be handed two different keys.
|
|
250
|
-
// Keyed by the binding the template declares; the entry keeps the registry key's name
|
|
256
|
+
// Keyed by the binding the template declares; the entry keeps the registry key's name.
|
|
251
257
|
secretNames: {
|
|
252
258
|
[EMAIL_LINK_SIGNING_KEY_BINDING]: scope.secretEntry(
|
|
253
259
|
EMAIL_LINK_SIGNING_KEY,
|
|
@@ -268,6 +274,7 @@ export function resolveEmailConfig(
|
|
|
268
274
|
capability: EMAIL_CAPABILITY,
|
|
269
275
|
env,
|
|
270
276
|
...(feature ? { feature } : {}),
|
|
277
|
+
...(owner !== undefined ? { owner } : {}),
|
|
271
278
|
}).workflows,
|
|
272
279
|
});
|
|
273
280
|
// The resolver fills fields; it never drops one. So every field this template narrows to required
|
package/src/version.generated.ts
CHANGED