@pithy-sh/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capability/bindings.d.ts +5 -0
- package/dist/capability/bindings.d.ts.map +1 -1
- package/dist/capability/bindings.js +44 -3
- package/dist/capability/capability.d.ts +33 -0
- package/dist/capability/capability.d.ts.map +1 -1
- package/dist/capability/manifest.d.ts +5 -0
- package/dist/capability/manifest.d.ts.map +1 -1
- package/dist/capability/manifest.js +1 -1
- package/dist/capability/validateBindings.js +1 -1
- package/dist/controlPlane/http/cors.js +1 -1
- package/dist/createBackend.d.ts +2 -1
- package/dist/createBackend.d.ts.map +1 -1
- package/dist/createBackend.js +5 -4
- package/dist/error/http.d.ts +27 -5
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/http.js +33 -9
- package/dist/http/oidcWebhook.d.ts +283 -0
- package/dist/http/oidcWebhook.d.ts.map +1 -0
- package/dist/http/oidcWebhook.js +414 -0
- package/dist/http/signedWebhook.d.ts +9 -65
- package/dist/http/signedWebhook.d.ts.map +1 -1
- package/dist/http/signedWebhook.js +19 -9
- package/dist/http/webhookWindow.d.ts +33 -0
- package/dist/http/webhookWindow.d.ts.map +1 -0
- package/dist/http/webhookWindow.js +35 -0
- package/dist/logger/errorHandler.d.ts +11 -0
- package/dist/logger/errorHandler.d.ts.map +1 -0
- package/dist/logger/errorHandler.js +87 -0
- package/dist/naming/environment.js +1 -1
- package/dist/naming/provisionScope.d.ts +108 -3
- package/dist/naming/provisionScope.d.ts.map +1 -1
- package/dist/naming/provisionScope.js +27 -2
- package/dist/naming/resource.js +1 -1
- package/dist/naming/resourceNames.js +1 -1
- package/dist/schema/describedness.d.ts +30 -1
- package/dist/schema/describedness.d.ts.map +1 -1
- package/dist/schema/describedness.js +42 -6
- package/dist/test-utils/oidcFixtures.d.ts +93 -0
- package/dist/test-utils/oidcFixtures.d.ts.map +1 -0
- package/dist/test-utils/oidcFixtures.js +111 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workflow/naming.js +1 -1
- package/package.json +1 -1
- package/src/capability/bindings.ts +49 -0
- package/src/capability/capability.ts +34 -0
- package/src/createBackend.ts +7 -3
- package/src/error/http.ts +34 -10
- package/src/http/oidcWebhook.ts +672 -0
- package/src/http/signedWebhook.ts +44 -16
- package/src/http/webhookWindow.ts +35 -0
- package/src/logger/errorHandler.ts +94 -0
- package/src/naming/provisionScope.ts +150 -4
- package/src/schema/describedness.ts +51 -6
- package/src/test-utils/oidcFixtures.ts +138 -0
- package/src/version.generated.ts +1 -1
|
@@ -57,6 +57,11 @@ export declare const BindingSpec: z.ZodObject<{
|
|
|
57
57
|
job: z.ZodOptional<z.ZodString>;
|
|
58
58
|
service: z.ZodOptional<z.ZodString>;
|
|
59
59
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
environment: "environment";
|
|
62
|
+
global: "global";
|
|
63
|
+
}>>;
|
|
64
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
60
65
|
}, z.core.$strip>;
|
|
61
66
|
export type BindingSpec = z.infer<typeof BindingSpec>;
|
|
62
67
|
/** Authoring shape for a capability's `requiredBindings`: `optional` may be omitted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/capability/bindings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/capability/bindings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW,sTAmBuC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAU3D;AAkCD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;iBAwHpB,CAAC;AACL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { NAME_SEGMENT } from "../naming/segment.js";
|
|
4
|
+
import { FEATURE_RESOURCE_KINDS } from "../naming/feature.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/capability/bindings.ts
|
|
6
7
|
const BindingType = z.union([
|
|
@@ -63,6 +64,35 @@ function isWrittenBinding(type) {
|
|
|
63
64
|
return type === "d1" || type === "kv" || type === "r2" || type === "ai" || type === "durable_object" || type === "ratelimit" || type === "workflow";
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
67
|
+
* A JavaScript class name — what `className` may be.
|
|
68
|
+
*
|
|
69
|
+
* Constrained because it is no longer only a JSON value. A Durable Object's `className` is written into
|
|
70
|
+
* the adopter's Worker entry as `export { <className> } from "…";` (#428), which is generated TypeScript
|
|
71
|
+
* built out of third-party data read from `node_modules` — the shape #171, #174 and #183 each met one
|
|
72
|
+
* field too late. An identifier cannot close the statement and open another.
|
|
73
|
+
*/
|
|
74
|
+
const CLASS_NAME = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
75
|
+
/**
|
|
76
|
+
* A bare module specifier — a package, optionally with a path into it.
|
|
77
|
+
*
|
|
78
|
+
* The other half of the generated export line, and narrowed for the same reason. No quotes, no
|
|
79
|
+
* whitespace, no `..`: a specifier that walked back out of its own package would re-export whatever it
|
|
80
|
+
* landed on, which is `configImports.isInside`'s argument in a regex.
|
|
81
|
+
*/
|
|
82
|
+
const CLASS_MODULE = /^(@[a-z0-9~-][a-z0-9._~-]*\/)?[a-z0-9~-][a-z0-9._~-]*(\/[A-Za-z0-9_~-][A-Za-z0-9._~-]*)*$/;
|
|
83
|
+
/**
|
|
84
|
+
* The kinds whose resource Pithy names and creates — the only kinds `scope` and `resource` mean anything
|
|
85
|
+
* for.
|
|
86
|
+
*
|
|
87
|
+
* {@link FEATURE_RESOURCE_KINDS} rather than a fresh literal, because it is already the repo's answer to
|
|
88
|
+
* "which bindings does a provisioning run compose a `<project>-<scope>-<thing>` name for": it is the
|
|
89
|
+
* domain of `ProvisionScope.resource`, and the CLI's own `PROVISIONABLE` map is the same three. Every
|
|
90
|
+
* other kind's name is composed by a different rule with no `<thing>` slot to fill — a Workflow's from
|
|
91
|
+
* the capability and the job, a Worker script's by wrangler — and a `secret` already states its scope in
|
|
92
|
+
* `defineSecretRegistry`, where the value it names lives.
|
|
93
|
+
*/
|
|
94
|
+
const NAMED_RESOURCE_KINDS = new Set(FEATURE_RESOURCE_KINDS);
|
|
95
|
+
/**
|
|
66
96
|
* Declares a Cloudflare binding a capability requires in the Worker env. The authoring
|
|
67
97
|
* shape lets `optional` be omitted (defaults false); `createBackend` normalizes via parse.
|
|
68
98
|
*/
|
|
@@ -70,11 +100,13 @@ const BindingSpec = z.object({
|
|
|
70
100
|
type: BindingType.describe("Resource kind this binding provides."),
|
|
71
101
|
name: z.string().min(1).describe("Binding name expected in the Worker env (e.g. \"DB\", \"SESSIONS\")."),
|
|
72
102
|
optional: z.boolean().default(false).describe("If true, createBackend won't fail when this binding is absent."),
|
|
73
|
-
className: z.string().min(1).regex(
|
|
74
|
-
classModule: z.string().min(1).regex(
|
|
103
|
+
className: z.string().min(1).regex(CLASS_NAME, "A className is a JavaScript identifier: letters, digits, `_` and `$`, not leading a digit.").optional().describe("The exported class this binding is backed by. For a `durable_object` binding it is the DO class (e.g. \"MultiplayerSession\") the CLI writes into `durable_objects.bindings`, the DO class migration tag, and the `export { … }` line in the Worker entry. For a `workflow` binding it is the `WorkflowEntrypoint` subclass (e.g. \"EmailSendWorkflow\") the CLI writes as `class_name` — the same value the capability's own `WorkflowSpec.className` carries. Ignored for every other kind."),
|
|
104
|
+
classModule: z.string().min(1).regex(CLASS_MODULE, "A classModule is a bare module specifier: a package, optionally with a path into it.").optional().describe("The module the class is exported from (e.g. \"@pithy-sh/multiplayer/src/session/durableObject\") — what the CLI writes the Worker entry's `export { <className> } from \"<classModule>\";` against. Required for a `durable_object` binding, because wrangler resolves `class_name` against the entry `main` names and refuses the deploy when nothing there exports it. Its own module, never the package entry point, which `pithy.config.ts` loads in Node. Ignored for every other kind."),
|
|
75
105
|
job: z.string().min(1).regex(NAME_SEGMENT, "A job is one name segment: lowercase letters, digits, and single hyphens.").optional().describe("The job within the capability this Workflow runs (e.g. \"send\") — the `<job>` segment of the deployed `<project>-<env>-<capability>-<job>` name, and the second half of the `<capability>/<job>` dispatch key. Meaningful only for a `workflow` binding, where it is what lets `pithy add` name the Workflow offline instead of leaving the binding unwritten. Ignored for every other kind."),
|
|
76
106
|
service: z.string().min(1).optional().describe("The Worker this binding calls, named as it appears in `apps/<name>/` (e.g. \"api\"). Meaningful only for a `service` binding — the CLI resolves it to that Worker's environment-scoped script name when writing `services` into wrangler.jsonc, so worker-to-worker RPC targets the right deployment per environment. Ignored for every other kind."),
|
|
77
|
-
remote: z.boolean().optional().describe("Reach the real Cloudflare resource during local development instead of a local emulation. Set it for a binding that has none — Vectorize and Workers AI both lack local simulation — so `wrangler dev` and any Workflow host, which always runs locally, still work. Left unset rather than defaulting to false, so a spec that does not care emits no flag at all. Ignored in a deployed Worker.")
|
|
107
|
+
remote: z.boolean().optional().describe("Reach the real Cloudflare resource during local development instead of a local emulation. Set it for a binding that has none — Vectorize and Workers AI both lack local simulation — so `wrangler dev` and any Workflow host, which always runs locally, still work. Left unset rather than defaulting to false, so a spec that does not care emits no flag at all. Ignored in a deployed Worker."),
|
|
108
|
+
scope: z.enum(["environment", "global"]).optional().describe("Whether the resource behind this binding is one per environment (absent, the default) or one for the whole project. A `global` resource takes the literal `global` where the environment segment goes — `<project>-global-<thing>` — so every environment's stanza names the identical resource and provisioning creates it once. Declare it where the data is not an environment-local fact: `@pithy-sh/email`'s suppression list is one per project, because an unsubscribe recorded through a staging Worker has to be honored by a production one, and three per-environment databases meant it was not (#513). Say nothing where it is: a session store, a cache, and `@pithy-sh/secrets`' own database are per environment, and one line apart in the same env there is no convention to tell them apart by — which is why this is declared rather than inferred. Meaningful only for a `d1`, `kv` or `r2` binding."),
|
|
109
|
+
resource: z.string().min(1).regex(NAME_SEGMENT, "A resource is one name segment: lowercase letters, digits, and single hyphens.").optional().describe("The `<thing>` segment of this resource's name, when it is not the kebabbed binding name. Absent is the ordinary case and means the binding name is the segment (`EMAIL_SUPPRESSIONS` → `email-suppressions`). Declare it where the two must differ: `SUPPORT_BUCKET` backs `<project>-global-support`, because the binding keeps `_BUCKET` for whoever reads `env.SUPPORT_BUCKET` in a Worker while the resource drops it — `r2` is already the composed name's kind, so the suffix repeats it. Meaningful only for a `d1`, `kv` or `r2` binding.")
|
|
78
110
|
}).describe("Declares a Cloudflare binding a capability requires in the Worker env.").check((ctx) => {
|
|
79
111
|
if (ctx.value.type === "durable_object" && ctx.value.className === void 0) ctx.issues.push({
|
|
80
112
|
code: "custom",
|
|
@@ -94,6 +126,15 @@ const BindingSpec = z.object({
|
|
|
94
126
|
path: ["service"],
|
|
95
127
|
message: `Service binding "${ctx.value.name}" needs a service — the Worker it calls, as named in apps/.`
|
|
96
128
|
});
|
|
129
|
+
if (!NAMED_RESOURCE_KINDS.has(ctx.value.type)) for (const field of ["scope", "resource"]) {
|
|
130
|
+
if (ctx.value[field] === void 0) continue;
|
|
131
|
+
ctx.issues.push({
|
|
132
|
+
code: "custom",
|
|
133
|
+
input: ctx.value,
|
|
134
|
+
path: [field],
|
|
135
|
+
message: `Binding "${ctx.value.name}" declares a ${field}, which only a d1, kv or r2 binding has — this one is a ${ctx.value.type}.`
|
|
136
|
+
});
|
|
137
|
+
}
|
|
97
138
|
});
|
|
98
139
|
//#endregion
|
|
99
140
|
export { BindingSpec, BindingType, isProvisionedBinding, isWrittenBinding };
|
|
@@ -156,6 +156,33 @@ export interface SecretRegistryEntrySeam {
|
|
|
156
156
|
}
|
|
157
157
|
/** A capability's secret-registry slice: secret name → {@link SecretRegistryEntrySeam}. */
|
|
158
158
|
export type SecretRegistrySeam = Record<string, SecretRegistryEntrySeam>;
|
|
159
|
+
/**
|
|
160
|
+
* **Which branches of a `json` secret's schema this Worker's configuration actually uses** — secret
|
|
161
|
+
* name → the top-level keys that apply, in the order they should be offered.
|
|
162
|
+
*
|
|
163
|
+
* A `json` secret is often a bundle of independent blocks: `payments-provider-credentials` is five
|
|
164
|
+
* optional rail blocks, `turnstile-secret-keys` is two optional widgets. The schema says which blocks
|
|
165
|
+
* are *possible*; only the composed config says which are *real*, and a credential for a rail that is
|
|
166
|
+
* off is a value nothing will ever read. So `pithy secrets create` asks per field for the blocks named
|
|
167
|
+
* here, and never offers — never writes — one that is not.
|
|
168
|
+
*
|
|
169
|
+
* **It is declared, not matched by name.** `PaymentsRailToggles.paddle` and
|
|
170
|
+
* `PaymentsProviderCredentials.paddle` happen to be spelled the same today, and a CLI that keyed off
|
|
171
|
+
* that would be right by coincidence: nothing makes a config flag and a schema key the same thing, and
|
|
172
|
+
* two of them one line apart cannot be told apart by convention (#513). The capability already knows
|
|
173
|
+
* the answer at construction — it has both halves in hand — so it states it, and the CLI reads a fact
|
|
174
|
+
* instead of inferring one.
|
|
175
|
+
*
|
|
176
|
+
* **It lives on the capability rather than on the entry** because a registry entry is plain data,
|
|
177
|
+
* shared by every Worker that declares the name and projected into `pithy.manifest.json`. This answer
|
|
178
|
+
* is per composition — the same secret, two Workers, two configs — so it belongs where the config is.
|
|
179
|
+
*
|
|
180
|
+
* An absent declaration is not an empty one. A capability that says nothing leaves the CLI with no way
|
|
181
|
+
* to know which blocks apply, and it falls back to asking for the whole document rather than guessing;
|
|
182
|
+
* an empty array says *none of them apply*, which is the same fallback for a different reason. A
|
|
183
|
+
* secret whose schema has no branches at all needs no declaration — every field is asked.
|
|
184
|
+
*/
|
|
185
|
+
export type SecretBranchSeam = Record<string, readonly string[]>;
|
|
159
186
|
/**
|
|
160
187
|
* The structural seam for one capability's token-profile slice — profile name → the scoped CF API
|
|
161
188
|
* token that capability's code needs. Declared next to the code that uses it (alongside
|
|
@@ -280,6 +307,12 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
280
307
|
* every declared secret in one batch — and no capability needs to know another's secrets.
|
|
281
308
|
*/
|
|
282
309
|
secretRegistry?: SecretRegistrySeam;
|
|
310
|
+
/**
|
|
311
|
+
* Which branches of this capability's `json` secrets this Worker's configuration uses — see
|
|
312
|
+
* {@link SecretBranchSeam}. Additive and optional: a capability whose secrets are flat, or which has
|
|
313
|
+
* no `json` secret at all, declares nothing.
|
|
314
|
+
*/
|
|
315
|
+
secretBranches?: SecretBranchSeam;
|
|
283
316
|
/**
|
|
284
317
|
* The scoped CF API tokens this capability's code needs, as a token-profile slice (profile name →
|
|
285
318
|
* {@link TokenProfileSeam}). Additive and optional, and declared next to {@link Capability.secretRegistry}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/capability/capability.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EA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AAI,YAAY,CAC5E,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EACzB,eAAe,CAChB,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,kBAAkB,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI,YAAY,CAC/E,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC1B,kBAAkB,CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI,YAAY,CACjF,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,CAAC"}
|
|
@@ -296,6 +296,11 @@ export declare const CapabilityManifest: z.ZodObject<{
|
|
|
296
296
|
job: z.ZodOptional<z.ZodString>;
|
|
297
297
|
service: z.ZodOptional<z.ZodString>;
|
|
298
298
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
300
|
+
environment: "environment";
|
|
301
|
+
global: "global";
|
|
302
|
+
}>>;
|
|
303
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
299
304
|
}, z.core.$strip>>;
|
|
300
305
|
peerCapabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
301
306
|
optionalCapabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/capability/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgDxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,iBAAiB,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA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;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiE0D,CAAC;AAC1F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { BindingSpec } from "./bindings.js";
|
|
4
3
|
import { ValidationError } from "../error/pithyError.js";
|
|
4
|
+
import { BindingSpec } from "./bindings.js";
|
|
5
5
|
import { manifestRecord } from "./vanishingKey.js";
|
|
6
6
|
import { DevSecret } from "./devSecret.js";
|
|
7
7
|
import { NAMESPACE_PATTERN } from "../migrations/registry.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { isProvisionedBinding } from "./bindings.js";
|
|
4
3
|
import { InternalError } from "../error/pithyError.js";
|
|
4
|
+
import { isProvisionedBinding } from "./bindings.js";
|
|
5
5
|
//#region src/capability/validateBindings.ts
|
|
6
6
|
/** How a missing binding is named in both halves of the error: `kv:SESSIONS`. */
|
|
7
7
|
function label(binding) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import "../../naming/environment.js";
|
|
3
4
|
import "../../worker/identity.js";
|
|
4
5
|
import { CONTROL_PLANE_HEADER, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER } from "../wire.js";
|
|
5
|
-
import "../../naming/environment.js";
|
|
6
6
|
//#region src/controlPlane/http/cors.ts
|
|
7
7
|
/**
|
|
8
8
|
* CORS for the control-plane surface — the one thing standing between a browser and a Worker that is
|
package/dist/createBackend.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ type BackendEnv<Caps extends readonly Capability[]> = {
|
|
|
47
47
|
* each capability's middleware; and mounts the capability (then app) routes. On every request
|
|
48
48
|
* `c.var.db` is the typed database registry — one `Kysely` per named database (`c.var.db.app`) —
|
|
49
49
|
* and `c.var.kv` the typed namespace registry — one `TypedKv` per store (`c.var.kv.cms.pages`).
|
|
50
|
-
* `PithyError`s become their declared HTTP status via {@link
|
|
50
|
+
* `PithyError`s become their declared HTTP status via {@link loggingErrorHandler}, which also writes
|
|
51
|
+
* each fault to the request logger with its `action` and `detail` — the fields the wire body strips.
|
|
51
52
|
*
|
|
52
53
|
* Binding validation runs **once on the first request**, not at module load: in Workers `env` is
|
|
53
54
|
* per-request, so there is no env to check until a request arrives. The result is memoized.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBackend.d.ts","sourceRoot":"","sources":["../src/createBackend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EAEpB,SAAS,EACV,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"createBackend.d.ts","sourceRoot":"","sources":["../src/createBackend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EAEpB,SAAS,EACV,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKtF,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EA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CA0KrF"}
|
package/dist/createBackend.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { noopEmit } from "./audit/recorder.js";
|
|
4
|
-
import { BindingSpec } from "./capability/bindings.js";
|
|
5
4
|
import { ValidationError } from "./error/pithyError.js";
|
|
5
|
+
import { BindingSpec } from "./capability/bindings.js";
|
|
6
6
|
import { recordComposition } from "./capability/composition.js";
|
|
7
7
|
import { validateBindings } from "./capability/validateBindings.js";
|
|
8
8
|
import { workerVersion } from "./worker/identity.js";
|
|
@@ -10,11 +10,11 @@ import { isControlPlaneCapability } from "./controlPlane/capability.js";
|
|
|
10
10
|
import { allowedOriginSet, corsSurface, registerControlPlaneCors } from "./controlPlane/http/cors.js";
|
|
11
11
|
import { buildDbRegistry, composeDatabases } from "./data/databases.js";
|
|
12
12
|
import { noEntitlementProvider } from "./entitlement/entitlement.js";
|
|
13
|
-
import { pithyErrorHandler } from "./error/http.js";
|
|
14
13
|
import { bakedTranslator } from "./i18n/translator.js";
|
|
15
14
|
import { catalogFor, composeMessages } from "./i18n/registry.js";
|
|
16
15
|
import { buildKvRegistry, composeKv } from "./kv/namespaces.js";
|
|
17
16
|
import { bindRequestContext, createWorkerLogger } from "./logger/worker.js";
|
|
17
|
+
import { loggingErrorHandler } from "./logger/errorHandler.js";
|
|
18
18
|
import { HEALTH_PATH } from "./worker/health.js";
|
|
19
19
|
import { registeredWorkflowBinding } from "./workflow/bindings.js";
|
|
20
20
|
import { buildWorkflowDispatcher } from "./workflow/dispatch.js";
|
|
@@ -63,7 +63,8 @@ function envNameOf(env, fallback) {
|
|
|
63
63
|
* each capability's middleware; and mounts the capability (then app) routes. On every request
|
|
64
64
|
* `c.var.db` is the typed database registry — one `Kysely` per named database (`c.var.db.app`) —
|
|
65
65
|
* and `c.var.kv` the typed namespace registry — one `TypedKv` per store (`c.var.kv.cms.pages`).
|
|
66
|
-
* `PithyError`s become their declared HTTP status via {@link
|
|
66
|
+
* `PithyError`s become their declared HTTP status via {@link loggingErrorHandler}, which also writes
|
|
67
|
+
* each fault to the request logger with its `action` and `detail` — the fields the wire body strips.
|
|
67
68
|
*
|
|
68
69
|
* Binding validation runs **once on the first request**, not at module load: in Workers `env` is
|
|
69
70
|
* per-request, so there is no env to check until a request arrives. The result is memoized.
|
|
@@ -98,7 +99,7 @@ function createBackend(options) {
|
|
|
98
99
|
...Object.values(workflows).map((entry) => BindingSpec.parse(registeredWorkflowBinding(entry)))
|
|
99
100
|
]);
|
|
100
101
|
const app = new Hono();
|
|
101
|
-
app.onError(
|
|
102
|
+
app.onError(loggingErrorHandler);
|
|
102
103
|
const baseLogger = options.logger ?? createWorkerLogger();
|
|
103
104
|
const controlPlane = all.find(isControlPlaneCapability);
|
|
104
105
|
if (controlPlane) {
|
package/dist/error/http.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type { Context } from "hono";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { PithyError } from "./pithyError";
|
|
5
6
|
/**
|
|
6
7
|
* The HTTP surface of an error, as a real codec. `encode` (server emits) maps an in-memory
|
|
7
8
|
* `ErrorPayload` down to the public wire shape by calling {@link clientError} — **the security
|
|
@@ -1508,11 +1509,32 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
1508
1509
|
status: z.ZodInt;
|
|
1509
1510
|
}, z.core.$strip>]>>;
|
|
1510
1511
|
/**
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1514
|
-
* carrying the original as `cause` (kept internal) and a
|
|
1515
|
-
* CLI's "unexpected crash" path.
|
|
1512
|
+
* Whatever was thrown, as the `PithyError` the response will be rendered from.
|
|
1513
|
+
*
|
|
1514
|
+
* A `PithyError` is itself; a Hono `HTTPException` 400 becomes `validation/invalid_input`; anything
|
|
1515
|
+
* else is wrapped as a `core/internal` 500 carrying the original as `cause` (kept internal) and a
|
|
1516
|
+
* generic public message — mirroring the CLI's "unexpected crash" path.
|
|
1517
|
+
*
|
|
1518
|
+
* Split out from {@link pithyErrorHandler} so a caller that wants to **read** the fault before it is
|
|
1519
|
+
* encoded — the logging handler in `logger/errorHandler.ts` — works from the same object the response
|
|
1520
|
+
* is built from, rather than translating a second time and logging a different instance of it. The
|
|
1521
|
+
* split is what keeps this module free of the logger: the translation is exported, the log is written
|
|
1522
|
+
* on the other side of the boundary. See `logger/boundary.test.ts`.
|
|
1523
|
+
*/
|
|
1524
|
+
export declare function toPithyError(err: Error): PithyError;
|
|
1525
|
+
/** Render an already-translated fault as its HTTP response — the client half, and only that. */
|
|
1526
|
+
export declare function renderPithyError(pithy: PithyError, c: Context): Response;
|
|
1527
|
+
/**
|
|
1528
|
+
* Hono `onError` handler — the **encoder**, with no log of its own.
|
|
1529
|
+
*
|
|
1530
|
+
* Any `PithyError` becomes `{ error: <public payload> }` at its declared status; a Hono
|
|
1531
|
+
* `HTTPException` 400 becomes `validation/invalid_input`; any other throw is wrapped as a
|
|
1532
|
+
* `core/internal` 500.
|
|
1533
|
+
*
|
|
1534
|
+
* **Prefer `loggingErrorHandler` from `logger/errorHandler.ts`** — `createBackend` registers that one,
|
|
1535
|
+
* and it is what makes a misconfiguration's `action` reach an operator instead of dying at the wire
|
|
1536
|
+
* (#521). This one stays exported for an app assembled without the logger seam, and it stays here,
|
|
1537
|
+
* logger-free, because this module is on the client side of the logger boundary.
|
|
1516
1538
|
*/
|
|
1517
1539
|
export declare function pithyErrorHandler(err: Error, c: Context): Response;
|
|
1518
1540
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/error/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/error/http.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MA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/http.js
CHANGED
|
@@ -59,16 +59,40 @@ function fromHttpException(error) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* carrying the original as `cause` (kept internal) and a
|
|
66
|
-
* CLI's "unexpected crash" path.
|
|
62
|
+
* Whatever was thrown, as the `PithyError` the response will be rendered from.
|
|
63
|
+
*
|
|
64
|
+
* A `PithyError` is itself; a Hono `HTTPException` 400 becomes `validation/invalid_input`; anything
|
|
65
|
+
* else is wrapped as a `core/internal` 500 carrying the original as `cause` (kept internal) and a
|
|
66
|
+
* generic public message — mirroring the CLI's "unexpected crash" path.
|
|
67
|
+
*
|
|
68
|
+
* Split out from {@link pithyErrorHandler} so a caller that wants to **read** the fault before it is
|
|
69
|
+
* encoded — the logging handler in `logger/errorHandler.ts` — works from the same object the response
|
|
70
|
+
* is built from, rather than translating a second time and logging a different instance of it. The
|
|
71
|
+
* split is what keeps this module free of the logger: the translation is exported, the log is written
|
|
72
|
+
* on the other side of the boundary. See `logger/boundary.test.ts`.
|
|
67
73
|
*/
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
function toPithyError(err) {
|
|
75
|
+
if (err instanceof PithyError) return err;
|
|
76
|
+
return (err instanceof HTTPException ? fromHttpException(err) : null) ?? new InternalError({ detail: err instanceof Error ? err.message : String(err) }, { cause: err });
|
|
77
|
+
}
|
|
78
|
+
/** Render an already-translated fault as its HTTP response — the client half, and only that. */
|
|
79
|
+
function renderPithyError(pithy, c) {
|
|
71
80
|
return c.json({ error: HttpError.encode(pithy.payload) }, pithy.payload.status);
|
|
72
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Hono `onError` handler — the **encoder**, with no log of its own.
|
|
84
|
+
*
|
|
85
|
+
* Any `PithyError` becomes `{ error: <public payload> }` at its declared status; a Hono
|
|
86
|
+
* `HTTPException` 400 becomes `validation/invalid_input`; any other throw is wrapped as a
|
|
87
|
+
* `core/internal` 500.
|
|
88
|
+
*
|
|
89
|
+
* **Prefer `loggingErrorHandler` from `logger/errorHandler.ts`** — `createBackend` registers that one,
|
|
90
|
+
* and it is what makes a misconfiguration's `action` reach an operator instead of dying at the wire
|
|
91
|
+
* (#521). This one stays exported for an app assembled without the logger seam, and it stays here,
|
|
92
|
+
* logger-free, because this module is on the client side of the logger boundary.
|
|
93
|
+
*/
|
|
94
|
+
function pithyErrorHandler(err, c) {
|
|
95
|
+
return renderPithyError(toPithyError(err), c);
|
|
96
|
+
}
|
|
73
97
|
//#endregion
|
|
74
|
-
export { HttpError, pithyErrorHandler };
|
|
98
|
+
export { HttpError, pithyErrorHandler, renderPithyError, toPithyError };
|