@pithy-sh/core 0.8.0 → 0.10.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/asyncapi/document.d.ts +46 -0
- package/dist/asyncapi/document.d.ts.map +1 -0
- package/dist/asyncapi/document.js +115 -0
- package/dist/capability/capability.d.ts +7 -0
- package/dist/capability/capability.d.ts.map +1 -1
- package/dist/capability/composition.d.ts.map +1 -1
- package/dist/capability/composition.js +5 -1
- package/dist/capability/settings.d.ts +10 -2
- package/dist/capability/settings.d.ts.map +1 -1
- package/dist/capability/settings.js +5 -3
- package/dist/cli/command.d.ts +364 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +418 -0
- package/dist/cli/commandCatalog.generated.d.ts +2275 -0
- package/dist/cli/commandCatalog.generated.d.ts.map +1 -0
- package/dist/cli/commandCatalog.generated.js +2390 -0
- package/dist/cli/commandFacts.d.ts +164 -0
- package/dist/cli/commandFacts.d.ts.map +1 -0
- package/dist/cli/commandFacts.js +215 -0
- package/dist/controlPlane/error/errors.d.ts.map +1 -1
- package/dist/controlPlane/error/errors.js +4 -3
- package/dist/controlPlane/http/guard.d.ts.map +1 -1
- package/dist/controlPlane/http/guard.js +11 -1
- package/dist/controlPlane/http/routes.d.ts +1 -1
- package/dist/controlPlane/http/routes.d.ts.map +1 -1
- package/dist/controlPlane/http/routes.js +34 -7
- package/dist/createBackend.d.ts +7 -0
- package/dist/createBackend.d.ts.map +1 -1
- package/dist/createBackend.js +34 -4
- package/dist/entitlement/require.js +1 -1
- package/dist/error/cause.d.ts +16 -116
- package/dist/error/cause.d.ts.map +1 -1
- package/dist/error/cause.js +19 -153
- package/dist/error/http.d.ts +40 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +80 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +26 -0
- package/dist/error/pithyError.d.ts +44 -0
- package/dist/error/pithyError.d.ts.map +1 -1
- package/dist/error/pithyError.js +56 -1
- package/dist/error/unresolved.d.ts +265 -0
- package/dist/error/unresolved.d.ts.map +1 -0
- package/dist/error/unresolved.js +599 -0
- package/dist/error/wire.d.ts +20 -0
- package/dist/error/wire.d.ts.map +1 -0
- package/dist/error/wire.js +19 -0
- package/dist/http/oidcWebhook.d.ts +3 -3
- package/dist/http/oidcWebhook.js +3 -3
- package/dist/http/routeContract.js +1 -1
- package/dist/http/routeSpec.d.ts +66 -0
- package/dist/http/routeSpec.d.ts.map +1 -0
- package/dist/http/routeSpec.js +40 -0
- package/dist/http/sameOrigin.d.ts +1 -1
- package/dist/http/sameOrigin.js +1 -1
- package/dist/http/signedWebhook.d.ts +3 -3
- package/dist/http/signedWebhook.js +3 -3
- package/dist/http/socket.d.ts +52 -0
- package/dist/http/socket.d.ts.map +1 -0
- package/dist/http/socket.js +2 -0
- package/dist/http/subprotocol.d.ts +29 -0
- package/dist/http/subprotocol.d.ts.map +1 -0
- package/dist/http/subprotocol.js +37 -0
- package/dist/http/validation.d.ts +40 -8
- package/dist/http/validation.d.ts.map +1 -1
- package/dist/http/validation.js +25 -1
- package/dist/index.js +2 -2
- package/dist/logger/record.d.ts +23 -0
- package/dist/logger/record.d.ts.map +1 -1
- package/dist/migrations/bookkeeping.d.ts +21 -0
- package/dist/migrations/bookkeeping.d.ts.map +1 -1
- package/dist/migrations/bookkeeping.js +32 -3
- package/dist/migrations/groups.d.ts +140 -0
- package/dist/migrations/groups.d.ts.map +1 -0
- package/dist/migrations/groups.js +191 -0
- package/dist/migrations/migrateStep.d.ts +13 -0
- package/dist/migrations/migrateStep.d.ts.map +1 -0
- package/dist/migrations/migrateStep.js +20 -0
- package/dist/migrations/owner.d.ts +7 -0
- package/dist/migrations/owner.d.ts.map +1 -1
- package/dist/migrations/owner.js +11 -7
- package/dist/migrations/retained.js +2 -2
- package/dist/migrations/runner.d.ts +76 -5
- package/dist/migrations/runner.d.ts.map +1 -1
- package/dist/migrations/runner.js +130 -19
- package/dist/naming/domains.d.ts +30 -0
- package/dist/naming/domains.d.ts.map +1 -1
- package/dist/naming/domains.js +83 -4
- package/dist/naming/environment.d.ts.map +1 -1
- package/dist/naming/environment.js +2 -1
- package/dist/naming/packageName.d.ts +17 -0
- package/dist/naming/packageName.d.ts.map +1 -0
- package/dist/naming/packageName.js +22 -0
- package/dist/naming/provisionScope.d.ts.map +1 -1
- package/dist/naming/provisionScope.js +2 -1
- package/dist/openapi/document.d.ts +106 -0
- package/dist/openapi/document.d.ts.map +1 -0
- package/dist/openapi/document.js +314 -0
- package/dist/openapi/routeGroups.d.ts +8 -0
- package/dist/openapi/routeGroups.d.ts.map +1 -0
- package/dist/openapi/routeGroups.js +23 -0
- package/dist/seed/devLogin.d.ts +33 -0
- package/dist/seed/devLogin.d.ts.map +1 -1
- package/dist/seed/devLogin.js +28 -1
- package/dist/text/comments.js +66 -4
- package/dist/text/literals.d.ts +43 -0
- package/dist/text/literals.d.ts.map +1 -0
- package/dist/text/literals.js +293 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.d.ts.map +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workflow/dispatchRoute.d.ts.map +1 -1
- package/dist/workflow/dispatchRoute.js +12 -6
- package/dist/workflow/faults.d.ts.map +1 -1
- package/dist/workflow/faults.js +2 -3
- package/dist/workflow/hostEnv.d.ts +1 -0
- package/dist/workflow/hostEnv.d.ts.map +1 -1
- package/dist/workflow/hostEnv.js +4 -2
- package/dist/workflow/loopback.d.ts.map +1 -1
- package/dist/workflow/loopback.js +2 -1
- package/package.json +3 -3
- package/src/asyncapi/document.ts +164 -0
- package/src/capability/capability.ts +7 -0
- package/src/capability/composition.ts +2 -1
- package/src/capability/settings.ts +19 -2
- package/src/cli/command.ts +865 -0
- package/src/cli/commandCatalog.generated.ts +2533 -0
- package/src/cli/commandFacts.ts +219 -0
- package/src/controlPlane/error/errors.ts +10 -3
- package/src/controlPlane/http/guard.ts +14 -2
- package/src/controlPlane/http/routes.ts +57 -9
- package/src/createBackend.ts +35 -2
- package/src/entitlement/require.ts +1 -1
- package/src/error/cause.ts +18 -181
- package/src/error/payload.ts +59 -0
- package/src/error/pithyError.ts +76 -0
- package/src/error/unresolved.ts +853 -0
- package/src/error/wire.ts +40 -0
- package/src/http/oidcWebhook.ts +3 -3
- package/src/http/routeContract.ts +1 -1
- package/src/http/routeSpec.ts +81 -0
- package/src/http/sameOrigin.ts +1 -1
- package/src/http/signedWebhook.ts +3 -3
- package/src/http/socket.ts +55 -0
- package/src/http/subprotocol.ts +47 -0
- package/src/http/validation.ts +50 -8
- package/src/migrations/bookkeeping.ts +39 -2
- package/src/migrations/groups.ts +295 -0
- package/src/migrations/migrateStep.ts +19 -0
- package/src/migrations/owner.ts +10 -6
- package/src/migrations/retained.ts +2 -2
- package/src/migrations/runner.ts +214 -22
- package/src/naming/domains.ts +97 -16
- package/src/naming/environment.ts +2 -1
- package/src/naming/packageName.ts +20 -0
- package/src/naming/provisionScope.ts +2 -1
- package/src/openapi/document.ts +412 -0
- package/src/openapi/routeGroups.ts +25 -0
- package/src/seed/devLogin.ts +31 -0
- package/src/text/comments.ts +56 -4
- package/src/text/literals.ts +294 -0
- package/src/version.generated.ts +1 -1
- package/src/workflow/dispatchRoute.ts +13 -6
- package/src/workflow/faults.ts +5 -3
- package/src/workflow/hostEnv.ts +9 -1
- package/src/workflow/loopback.ts +2 -1
package/dist/createBackend.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { noopEmit } from "./audit/recorder.js";
|
|
4
4
|
import { ValidationError } from "./error/pithyError.js";
|
|
5
|
+
import { pithyCommandOf } from "./cli/command.js";
|
|
5
6
|
import { BindingSpec } from "./capability/bindings.js";
|
|
6
7
|
import { recordComposition } from "./capability/composition.js";
|
|
7
8
|
import { validateBindings } from "./capability/validateBindings.js";
|
|
8
9
|
import { workerVersion } from "./worker/identity.js";
|
|
10
|
+
import { describeRoute } from "./http/routeSpec.js";
|
|
9
11
|
import { isControlPlaneCapability } from "./controlPlane/capability.js";
|
|
10
12
|
import { allowedOriginSet, corsSurface, registerControlPlaneCors } from "./controlPlane/http/cors.js";
|
|
11
13
|
import { buildDbRegistry, composeDatabases } from "./data/databases.js";
|
|
@@ -15,11 +17,13 @@ import { catalogFor, composeMessages } from "./i18n/registry.js";
|
|
|
15
17
|
import { buildKvRegistry, composeKv } from "./kv/namespaces.js";
|
|
16
18
|
import { bindRequestContext, createWorkerLogger } from "./logger/worker.js";
|
|
17
19
|
import { loggingErrorHandler } from "./logger/errorHandler.js";
|
|
20
|
+
import { recordRouteGroups } from "./openapi/routeGroups.js";
|
|
18
21
|
import { HEALTH_PATH } from "./worker/health.js";
|
|
19
22
|
import { registeredWorkflowBinding } from "./workflow/bindings.js";
|
|
20
23
|
import { buildWorkflowDispatcher } from "./workflow/dispatch.js";
|
|
21
24
|
import { composeWorkflows } from "./workflow/register.js";
|
|
22
25
|
import { Hono } from "hono";
|
|
26
|
+
import { z } from "zod";
|
|
23
27
|
//#region src/createBackend.ts
|
|
24
28
|
/**
|
|
25
29
|
* Collapse duplicate bindings (same `type:name`) — capability and derived specs overlap. A binding
|
|
@@ -55,6 +59,11 @@ function versionOf(env) {
|
|
|
55
59
|
function envNameOf(env, fallback) {
|
|
56
60
|
return typeof env.ENVIRONMENT === "string" && env.ENVIRONMENT.length > 0 ? env.ENVIRONMENT : fallback ?? "unknown";
|
|
57
61
|
}
|
|
62
|
+
/** What `GET /health` answers. */
|
|
63
|
+
const HealthBody = z.object({
|
|
64
|
+
status: z.literal("ok").describe("Always `ok`: an answer at all is the liveness signal."),
|
|
65
|
+
version: z.string().nullable().describe("The Cloudflare version id of the build answering, or null where the Worker cannot say.")
|
|
66
|
+
}).describe("Liveness, and which build is answering.");
|
|
58
67
|
/**
|
|
59
68
|
* Assemble capabilities into a deployable Hono app — a valid Worker `fetch` handler.
|
|
60
69
|
*
|
|
@@ -77,7 +86,10 @@ function createBackend(options) {
|
|
|
77
86
|
const present = new Set(all.map((cap) => cap.name));
|
|
78
87
|
for (const cap of all) for (const dep of cap.dependsOn ?? []) if (!present.has(dep)) throw new ValidationError({
|
|
79
88
|
message: `Capability "${cap.name}" requires the "${dep}" capability, which is not composed.`,
|
|
80
|
-
action: `Add ${dep}() to createBackend's capabilities (run
|
|
89
|
+
action: `Add ${dep}() to createBackend's capabilities (run \`${pithyCommandOf("add", {
|
|
90
|
+
args: [dep],
|
|
91
|
+
flags: { "--with-prerequisites": true }
|
|
92
|
+
}, { runtime: true })}\`).`
|
|
81
93
|
});
|
|
82
94
|
for (const cap of all) cap.compose?.({ capabilities: all });
|
|
83
95
|
recordComposition(all);
|
|
@@ -161,13 +173,31 @@ function createBackend(options) {
|
|
|
161
173
|
* before `version_metadata` was declared reports "I cannot tell you", and `deploy` reports the check
|
|
162
174
|
* as inconclusive instead of failing it.
|
|
163
175
|
*/
|
|
164
|
-
|
|
176
|
+
const groups = [];
|
|
177
|
+
const healthStart = app.routes.length;
|
|
178
|
+
app.get(HEALTH_PATH, describeRoute({
|
|
179
|
+
summary: "Report liveness, and which build is answering.",
|
|
180
|
+
verification: "public",
|
|
181
|
+
responses: { 200: HealthBody }
|
|
182
|
+
}), (c) => c.json({
|
|
165
183
|
status: "ok",
|
|
166
184
|
version: workerVersion(c.env)
|
|
167
185
|
}));
|
|
186
|
+
groups.push({
|
|
187
|
+
tag: "core",
|
|
188
|
+
routes: app.routes.slice(healthStart)
|
|
189
|
+
});
|
|
168
190
|
for (const cap of all) for (const middleware of cap.middleware ?? []) middleware(app);
|
|
169
|
-
for (const cap of all)
|
|
191
|
+
for (const cap of all) {
|
|
192
|
+
const start = app.routes.length;
|
|
193
|
+
cap.routes?.(app);
|
|
194
|
+
groups.push({
|
|
195
|
+
tag: cap.name,
|
|
196
|
+
routes: app.routes.slice(start)
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
recordRouteGroups(app, groups);
|
|
170
200
|
return app;
|
|
171
201
|
}
|
|
172
202
|
//#endregion
|
|
173
|
-
export { createBackend };
|
|
203
|
+
export { HealthBody, createBackend };
|
|
@@ -8,7 +8,7 @@ import { ENTITLEMENT_DENIED_ACTION, EntitlementKey, grantedEntitlementKeys } fro
|
|
|
8
8
|
* `verification`-strategy sibling every paid route carries: it says what the caller must *hold*, the
|
|
9
9
|
* way `requireAuth()` says who the caller must *be*, and it belongs on the route line beside it.
|
|
10
10
|
*
|
|
11
|
-
* app.get("/reports", requireAuth(), requireEntitlement("pro"),
|
|
11
|
+
* app.get("/reports", requireAuth(), requireEntitlement("pro"), validate(…), handler)
|
|
12
12
|
*
|
|
13
13
|
* It lives in `@pithy-sh/core` rather than in `@pithy-sh/payments` for the same reason `requireAuth()`
|
|
14
14
|
* is copied into each capability instead of imported from `@pithy-sh/auth`: a gate that arrives with a
|
package/dist/error/cause.d.ts
CHANGED
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
* This module holds only what does not — the facts about the shapes a runtime hands over, and the filter
|
|
11
11
|
* that decides whether one of its strings is safe to put in front of an adopter.
|
|
12
12
|
*
|
|
13
|
+
* The one exception is an import that would not resolve, and it has its own module: `unresolved.ts`
|
|
14
|
+
* decides the kind and the remedy for all three surfaces, because three surfaces deciding it kept
|
|
15
|
+
* disagreeing (#709).
|
|
16
|
+
*
|
|
13
17
|
* **The filter is here for the same reason the facts are, and the argument took two issues to finish.**
|
|
14
|
-
* #223 moved `rootCause
|
|
18
|
+
* #223 moved `rootCause` and `prop` in and deliberately left `safeReason` beside
|
|
15
19
|
* the three refusals, on the reading that what a surface may say is that surface's business. That is true
|
|
16
20
|
* of the sentences and false of the filter: whether a string carries a path, a stack frame or half a
|
|
17
21
|
* parser's ANSI box is a property of the string, and the answer cannot differ between the CLI, a
|
|
@@ -24,11 +28,12 @@
|
|
|
24
28
|
/**
|
|
25
29
|
* Read a property off an unknown throwable without widening anything to `any`.
|
|
26
30
|
*
|
|
27
|
-
* Deliberately duck-typed.
|
|
28
|
-
*
|
|
29
|
-
* `instanceof Error
|
|
30
|
-
*
|
|
31
|
-
*
|
|
31
|
+
* Deliberately duck-typed. A cause is `unknown`, and an `instanceof Error` gate is a claim about a
|
|
32
|
+
* runtime's classes that the runtime can break. Bun did: on 1.3 its `ResolveMessage` and `BuildMessage`
|
|
33
|
+
* were **not** `instanceof Error`, so a gate passed a whole suite under vitest, which runs on Node, and
|
|
34
|
+
* silently dropped the parser's own sentence on the runtime that ships. That is #207. Bun 1.4 made both
|
|
35
|
+
* real `Error`s (measured on 1.4.2), and nothing here had to change, which is the point: every reader of
|
|
36
|
+
* a cause in this kit goes through this function and reads fields, never a class.
|
|
32
37
|
*
|
|
33
38
|
* Non-enumerable properties are read too — `AggregateError.errors` is one, and {@link rootCause}
|
|
34
39
|
* depends on it.
|
|
@@ -43,7 +48,7 @@ export declare function prop(cause: unknown, key: string): unknown;
|
|
|
43
48
|
* and only by running on Bun with a failure of the *realistic* shape.
|
|
44
49
|
*
|
|
45
50
|
* **And the realistic shape is the wrapped one.** A stray brace cascades — one missing `}` in a
|
|
46
|
-
* `pithy.config.ts`
|
|
51
|
+
* `pithy.config.ts` produces four diagnostics on Bun 1.4.2 — so a syntax error arrives wrapped far more
|
|
47
52
|
* often than bare. Classified as-is, the wrapper matches nothing: not a resolution failure, not a parse
|
|
48
53
|
* error, just something with a message. The refusal then says *the config threw while loading, run the
|
|
49
54
|
* file directly* while holding the line and column in its hand. #207 fixed the bare case and left this
|
|
@@ -58,26 +63,6 @@ export declare function prop(cause: unknown, key: string): unknown;
|
|
|
58
63
|
* a runtime that stops wrapping needs no change here.
|
|
59
64
|
*/
|
|
60
65
|
export declare function rootCause(cause: unknown): unknown;
|
|
61
|
-
/**
|
|
62
|
-
* The wrapper **after the diagnostics are gone** — a build that failed, and that is all that is left.
|
|
63
|
-
*
|
|
64
|
-
* {@link rootCause} handles the first `import()`. It cannot handle the second: Bun caches a failed module
|
|
65
|
-
* and re-throws an `AggregateError` with **no `errors` at all**, just the count and the path. There is
|
|
66
|
-
* nothing to unwrap, so a classifier that only unwraps reads a syntax error as "it threw" from the second
|
|
67
|
-
* caller onward — which is what `pithy doctor` shows an adopter, because resolving the project's account
|
|
68
|
-
* loads the root config before the report does (#206, #223).
|
|
69
|
-
*
|
|
70
|
-
* Nothing else Bun throws degrades this way: a `ResolveMessage`, a bare `BuildMessage` and a module's own
|
|
71
|
-
* `Error` are byte-identical on every import. Only the wrapper forgets.
|
|
72
|
-
*
|
|
73
|
-
* So the wrapper is recognized by its own message. **What it proves is narrow and worth stating:** the
|
|
74
|
-
* module reached the builder and the builder produced diagnostics. It did not fail to resolve — Bun
|
|
75
|
-
* throws the first `ResolveMessage` bare, wrapping nothing, even for a file with several bad imports —
|
|
76
|
-
* and it did not run, so it cannot have thrown. It failed to parse or to build. A caller may say that
|
|
77
|
-
* much and no more: the message itself carries an absolute path and a count, neither of which is the
|
|
78
|
-
* adopter's business, so it is a *predicate* here rather than a string anyone is tempted to print.
|
|
79
|
-
*/
|
|
80
|
-
export declare function isBuildFailureWrapper(cause: unknown): boolean;
|
|
81
66
|
/**
|
|
82
67
|
* The thrown value's message, **de-colored** — `undefined` when it has none.
|
|
83
68
|
*
|
|
@@ -100,15 +85,6 @@ export declare function causeMessage(cause: unknown): string | undefined;
|
|
|
100
85
|
* developer one frame of digging, and a mistake puts a path, a source line or a stack frame in a field
|
|
101
86
|
* that is rendered.
|
|
102
87
|
*
|
|
103
|
-
* **Provenance first, then content.** Bun's build-failure wrapper is refused outright, before a single
|
|
104
|
-
* content test runs. The content tests exist for a diagnostic that *might* be safe; the wrapper never is,
|
|
105
|
-
* because its whole message is a count nobody asked for and a path that must not travel. Leaving it to
|
|
106
|
-
* the content tests is what leaked: `2 errors building "app/config:12:5.ts"` has no leading slash, sailed
|
|
107
|
-
* through the absolute-path check, and produced *The config does not parse: 2 errors building
|
|
108
|
-
* "app/config:12:5.ts". Line 12, column 5.* — a path the adopter never wrote, and a position fabricated
|
|
109
|
-
* out of a file name (#223). That suppression was written three times because the filter was. It is
|
|
110
|
-
* written once here, and {@link failurePosition} refuses the same shape for the same reason.
|
|
111
|
-
*
|
|
112
88
|
* A trailing period comes off: every caller puts this inside a sentence of its own.
|
|
113
89
|
*/
|
|
114
90
|
export declare function safeReason(cause: unknown): string | undefined;
|
|
@@ -127,85 +103,9 @@ export interface FailurePosition {
|
|
|
127
103
|
* path they are appended to. Whether a surface prints them is that surface's policy: two of the three
|
|
128
104
|
* classifiers do, and the capability loader deliberately does not.
|
|
129
105
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
export declare function failurePosition(cause: unknown): FailurePosition | undefined;
|
|
135
|
-
/** What kind of thing failed to resolve. Three causes that wore one sentence until #489. */
|
|
136
|
-
export type UnresolvedKind =
|
|
137
|
-
/** A bare specifier for a package that is not installed. Installing dependencies is the remedy. */
|
|
138
|
-
"package"
|
|
139
|
-
/** An installed package asked for a subpath it does not provide. Installing again changes nothing. */
|
|
140
|
-
| "package-subpath"
|
|
141
|
-
/** A relative import of a file in the project's own tree. Installing again changes nothing. */
|
|
142
|
-
| "local-file";
|
|
143
|
-
/**
|
|
144
|
-
* Which of the three unresolved-import causes this was, or `undefined` when it cannot be told.
|
|
145
|
-
*
|
|
146
|
-
* **The discriminator was already in the message and was being thrown away.** `unresolvedSpecifier`
|
|
147
|
-
* matches `Cannot find (?:package|module)` — and `package` versus `module` is exactly the fact that
|
|
148
|
-
* separates a missing dependency from the other two. It sat in a non-capturing group, so every cause
|
|
149
|
-
* arrived wearing one sentence, and for two of the three that sentence advised an install which is
|
|
150
|
-
* *guaranteed* to change nothing. That is #489's class exactly: guidance a caller cannot follow, worst
|
|
151
|
-
* for the caller it is written for, which has no human to shrug and try something else.
|
|
152
|
-
*
|
|
153
|
-
* Measured across Node 24.13.0 and Bun 1.3.14, because the two runtimes hand back different halves and
|
|
154
|
-
* each hands back exactly one usable one:
|
|
155
|
-
*
|
|
156
|
-
* | cause | Node says | Bun's `specifier` |
|
|
157
|
-
* |---|---|---|
|
|
158
|
-
* | package absent | `Cannot find package 'pkg'`, no `url` | `pkg` |
|
|
159
|
-
* | subpath missing | `Cannot find module '/abs/node_modules/pkg/src/nope.js'`, `url` under node_modules | `pkg/src/nope` |
|
|
160
|
-
* | adopter's file | `Cannot find module '/abs/apps/board/src/x'`, `url` outside node_modules | `./src/x` |
|
|
161
|
-
*
|
|
162
|
-
* Bun gives the **specifier as written**, so a leading `.` settles it. Node gives the **already-resolved
|
|
163
|
-
* path**, where being under `node_modules` settles it. Neither read works on both runtimes; the pair
|
|
164
|
-
* does, and it is the same predicate — *is this inside node_modules* — applied to whichever fact the
|
|
165
|
-
* runtime supplied.
|
|
166
|
-
*/
|
|
167
|
-
export declare function unresolvedKind(cause: unknown): UnresolvedKind | undefined;
|
|
168
|
-
/**
|
|
169
|
-
* The specifier that did not resolve.
|
|
170
|
-
*
|
|
171
|
-
* A recorded fact about two runtimes: Bun's `ResolveMessage` carries it as a **field**, and Node states it
|
|
172
|
-
* in prose. The field is preferred wherever there is one, because the prose around it names the referrer's
|
|
173
|
-
* absolute path — the specifier is the adopter's own import, the referrer is our frame.
|
|
174
|
-
*
|
|
175
|
-
* Whether a surface names it, and what it advises when it does, is that surface's policy and stays there.
|
|
176
|
-
*/
|
|
177
|
-
export declare function unresolvedSpecifier(cause: unknown): string | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* The package whose own source contained the import that did not resolve — **never a path**.
|
|
180
|
-
*
|
|
181
|
-
* {@link unresolvedSpecifier} answers *what* did not resolve. This answers *where the import lives*, and
|
|
182
|
-
* the two are different facts whenever the failing import is not the adopter's own. #480 is that case
|
|
183
|
-
* verbatim: `pithy add email` on a fresh project refused with
|
|
184
|
-
*
|
|
185
|
-
* > Nothing resolves "@pithy-sh/core/src/capability/capability".
|
|
186
|
-
*
|
|
187
|
-
* while `@pithy-sh/core` resolved from the Worker at every step of the run, before and after. The
|
|
188
|
-
* specifier was honest — the runtime really could not resolve it — but the import belonged to
|
|
189
|
-
* `@pithy-sh/email`, which had just been installed and was the package genuinely not linked. So the
|
|
190
|
-
* refusal named the one dependency that was definitely fine, and an adopter following it ran `bun
|
|
191
|
-
* install` against a tree that already had core in it. The importer is the half that would have pointed
|
|
192
|
-
* at `email`, and both runtimes hand it over: **Bun's `ResolveMessage` carries `referrer` as a field**
|
|
193
|
-
* (measured on 1.3.14) and Node states it in prose as `imported from <path>`.
|
|
194
|
-
*
|
|
195
|
-
* **A package name, or nothing.** The referrer is an absolute path — our frame, and the reason
|
|
196
|
-
* {@link unresolvedSpecifier} drops the prose around the specifier — so what travels is the one part of
|
|
197
|
-
* it that is not a path: the package directory it sits under. A referrer outside `node_modules` is the
|
|
198
|
-
* adopter's own file, and there is nothing to say about it that the refusal does not already say by
|
|
199
|
-
* naming the config, so it answers `undefined` rather than a path. The path itself is never returned
|
|
200
|
-
* from this module, which is what makes leaking it impossible rather than merely discouraged.
|
|
201
|
-
*
|
|
202
|
-
* The **last** `node_modules` in the path, because every store layout nests: pnpm's
|
|
203
|
-
* `node_modules/.pnpm/<id>/node_modules/<pkg>` and Bun's isolated linker's
|
|
204
|
-
* `node_modules/.bun/<pkg>@<version>/node_modules/<pkg>` (both measured) put the real owner last, and so
|
|
205
|
-
* does an ordinary nested install. The name is then checked against what npm allows, so a store's own
|
|
206
|
-
* bookkeeping directory (`.bun`, `.pnpm`, `hono@4.6.3`) can only ever answer nothing.
|
|
207
|
-
*
|
|
208
|
-
* Whether a surface names it, and what it advises when it does, is that surface's policy and stays there.
|
|
106
|
+
* `isOwn`, when given, is asked about the file a structured position names, and a position in a file it
|
|
107
|
+
* disowns is no position at all: Bun's line and column in a file the config imports, quoted as the config's,
|
|
108
|
+
* send the adopter to a place in their config that is fine (#709).
|
|
209
109
|
*/
|
|
210
|
-
export declare function
|
|
110
|
+
export declare function failurePosition(cause: unknown, isOwn?: (file: string) => boolean): FailurePosition | undefined;
|
|
211
111
|
//# sourceMappingURL=cause.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cause.d.ts","sourceRoot":"","sources":["../../src/error/cause.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"cause.d.ts","sourceRoot":"","sources":["../../src/error/cause.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQjD;AAeD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO7D;AAED,mGAAmG;AACnG,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,eAAe,GAAG,SAAS,CAU9G"}
|
package/dist/error/cause.js
CHANGED
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
* This module holds only what does not — the facts about the shapes a runtime hands over, and the filter
|
|
12
12
|
* that decides whether one of its strings is safe to put in front of an adopter.
|
|
13
13
|
*
|
|
14
|
+
* The one exception is an import that would not resolve, and it has its own module: `unresolved.ts`
|
|
15
|
+
* decides the kind and the remedy for all three surfaces, because three surfaces deciding it kept
|
|
16
|
+
* disagreeing (#709).
|
|
17
|
+
*
|
|
14
18
|
* **The filter is here for the same reason the facts are, and the argument took two issues to finish.**
|
|
15
|
-
* #223 moved `rootCause
|
|
19
|
+
* #223 moved `rootCause` and `prop` in and deliberately left `safeReason` beside
|
|
16
20
|
* the three refusals, on the reading that what a surface may say is that surface's business. That is true
|
|
17
21
|
* of the sentences and false of the filter: whether a string carries a path, a stack frame or half a
|
|
18
22
|
* parser's ANSI box is a property of the string, and the answer cannot differ between the CLI, a
|
|
@@ -25,11 +29,12 @@
|
|
|
25
29
|
/**
|
|
26
30
|
* Read a property off an unknown throwable without widening anything to `any`.
|
|
27
31
|
*
|
|
28
|
-
* Deliberately duck-typed.
|
|
29
|
-
*
|
|
30
|
-
* `instanceof Error
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
* Deliberately duck-typed. A cause is `unknown`, and an `instanceof Error` gate is a claim about a
|
|
33
|
+
* runtime's classes that the runtime can break. Bun did: on 1.3 its `ResolveMessage` and `BuildMessage`
|
|
34
|
+
* were **not** `instanceof Error`, so a gate passed a whole suite under vitest, which runs on Node, and
|
|
35
|
+
* silently dropped the parser's own sentence on the runtime that ships. That is #207. Bun 1.4 made both
|
|
36
|
+
* real `Error`s (measured on 1.4.2), and nothing here had to change, which is the point: every reader of
|
|
37
|
+
* a cause in this kit goes through this function and reads fields, never a class.
|
|
33
38
|
*
|
|
34
39
|
* Non-enumerable properties are read too — `AggregateError.errors` is one, and {@link rootCause}
|
|
35
40
|
* depends on it.
|
|
@@ -47,7 +52,7 @@ function prop(cause, key) {
|
|
|
47
52
|
* and only by running on Bun with a failure of the *realistic* shape.
|
|
48
53
|
*
|
|
49
54
|
* **And the realistic shape is the wrapped one.** A stray brace cascades — one missing `}` in a
|
|
50
|
-
* `pithy.config.ts`
|
|
55
|
+
* `pithy.config.ts` produces four diagnostics on Bun 1.4.2 — so a syntax error arrives wrapped far more
|
|
51
56
|
* often than bare. Classified as-is, the wrapper matches nothing: not a resolution failure, not a parse
|
|
52
57
|
* error, just something with a message. The refusal then says *the config threw while loading, run the
|
|
53
58
|
* file directly* while holding the line and column in its hand. #207 fixed the bare case and left this
|
|
@@ -70,31 +75,6 @@ function rootCause(cause) {
|
|
|
70
75
|
}
|
|
71
76
|
return current;
|
|
72
77
|
}
|
|
73
|
-
/** Bun's wrapper announces itself: `4 errors building "<absolute path>"`, and nothing else says that. */
|
|
74
|
-
const BUILD_FAILURE = /^\d+ errors? building "/;
|
|
75
|
-
/**
|
|
76
|
-
* The wrapper **after the diagnostics are gone** — a build that failed, and that is all that is left.
|
|
77
|
-
*
|
|
78
|
-
* {@link rootCause} handles the first `import()`. It cannot handle the second: Bun caches a failed module
|
|
79
|
-
* and re-throws an `AggregateError` with **no `errors` at all**, just the count and the path. There is
|
|
80
|
-
* nothing to unwrap, so a classifier that only unwraps reads a syntax error as "it threw" from the second
|
|
81
|
-
* caller onward — which is what `pithy doctor` shows an adopter, because resolving the project's account
|
|
82
|
-
* loads the root config before the report does (#206, #223).
|
|
83
|
-
*
|
|
84
|
-
* Nothing else Bun throws degrades this way: a `ResolveMessage`, a bare `BuildMessage` and a module's own
|
|
85
|
-
* `Error` are byte-identical on every import. Only the wrapper forgets.
|
|
86
|
-
*
|
|
87
|
-
* So the wrapper is recognized by its own message. **What it proves is narrow and worth stating:** the
|
|
88
|
-
* module reached the builder and the builder produced diagnostics. It did not fail to resolve — Bun
|
|
89
|
-
* throws the first `ResolveMessage` bare, wrapping nothing, even for a file with several bad imports —
|
|
90
|
-
* and it did not run, so it cannot have thrown. It failed to parse or to build. A caller may say that
|
|
91
|
-
* much and no more: the message itself carries an absolute path and a count, neither of which is the
|
|
92
|
-
* adopter's business, so it is a *predicate* here rather than a string anyone is tempted to print.
|
|
93
|
-
*/
|
|
94
|
-
function isBuildFailureWrapper(cause) {
|
|
95
|
-
const message = prop(cause, "message");
|
|
96
|
-
return typeof message === "string" && BUILD_FAILURE.test(message);
|
|
97
|
-
}
|
|
98
78
|
/** Escape sequences a runtime colors its diagnostics with. They are formatting, and they never travel. */
|
|
99
79
|
const ANSI = /\u001b\[[0-9;]*m/g;
|
|
100
80
|
/** Anything that looks like the start of an absolute path — POSIX, `~`, or a Windows drive. */
|
|
@@ -128,19 +108,9 @@ function causeMessage(cause) {
|
|
|
128
108
|
* developer one frame of digging, and a mistake puts a path, a source line or a stack frame in a field
|
|
129
109
|
* that is rendered.
|
|
130
110
|
*
|
|
131
|
-
* **Provenance first, then content.** Bun's build-failure wrapper is refused outright, before a single
|
|
132
|
-
* content test runs. The content tests exist for a diagnostic that *might* be safe; the wrapper never is,
|
|
133
|
-
* because its whole message is a count nobody asked for and a path that must not travel. Leaving it to
|
|
134
|
-
* the content tests is what leaked: `2 errors building "app/config:12:5.ts"` has no leading slash, sailed
|
|
135
|
-
* through the absolute-path check, and produced *The config does not parse: 2 errors building
|
|
136
|
-
* "app/config:12:5.ts". Line 12, column 5.* — a path the adopter never wrote, and a position fabricated
|
|
137
|
-
* out of a file name (#223). That suppression was written three times because the filter was. It is
|
|
138
|
-
* written once here, and {@link failurePosition} refuses the same shape for the same reason.
|
|
139
|
-
*
|
|
140
111
|
* A trailing period comes off: every caller puts this inside a sentence of its own.
|
|
141
112
|
*/
|
|
142
113
|
function safeReason(cause) {
|
|
143
|
-
if (isBuildFailureWrapper(cause)) return void 0;
|
|
144
114
|
const text = (causeMessage(cause) ?? "").trim();
|
|
145
115
|
if (text.length === 0 || text.length > REASON_LIMIT) return void 0;
|
|
146
116
|
if (text.includes("\n")) return void 0;
|
|
@@ -156,13 +126,14 @@ function safeReason(cause) {
|
|
|
156
126
|
* path they are appended to. Whether a surface prints them is that surface's policy: two of the three
|
|
157
127
|
* classifiers do, and the capability loader deliberately does not.
|
|
158
128
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
129
|
+
* `isOwn`, when given, is asked about the file a structured position names, and a position in a file it
|
|
130
|
+
* disowns is no position at all: Bun's line and column in a file the config imports, quoted as the config's,
|
|
131
|
+
* send the adopter to a place in their config that is fine (#709).
|
|
162
132
|
*/
|
|
163
|
-
function failurePosition(cause) {
|
|
164
|
-
if (isBuildFailureWrapper(cause)) return void 0;
|
|
133
|
+
function failurePosition(cause, isOwn) {
|
|
165
134
|
const position = prop(cause, "position");
|
|
135
|
+
const file = prop(position, "file");
|
|
136
|
+
if (isOwn !== void 0 && typeof file === "string" && !isOwn(file)) return void 0;
|
|
166
137
|
const line = prop(position, "line");
|
|
167
138
|
const column = prop(position, "column");
|
|
168
139
|
if (typeof line === "number" && line > 0 && typeof column === "number") return {
|
|
@@ -176,110 +147,5 @@ function failurePosition(cause) {
|
|
|
176
147
|
column: Number(match[2])
|
|
177
148
|
};
|
|
178
149
|
}
|
|
179
|
-
/** Whether a path sits inside an installed package. */
|
|
180
|
-
function insideNodeModules(path) {
|
|
181
|
-
return path.split(/[\\/]/).includes("node_modules");
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Which of the three unresolved-import causes this was, or `undefined` when it cannot be told.
|
|
185
|
-
*
|
|
186
|
-
* **The discriminator was already in the message and was being thrown away.** `unresolvedSpecifier`
|
|
187
|
-
* matches `Cannot find (?:package|module)` — and `package` versus `module` is exactly the fact that
|
|
188
|
-
* separates a missing dependency from the other two. It sat in a non-capturing group, so every cause
|
|
189
|
-
* arrived wearing one sentence, and for two of the three that sentence advised an install which is
|
|
190
|
-
* *guaranteed* to change nothing. That is #489's class exactly: guidance a caller cannot follow, worst
|
|
191
|
-
* for the caller it is written for, which has no human to shrug and try something else.
|
|
192
|
-
*
|
|
193
|
-
* Measured across Node 24.13.0 and Bun 1.3.14, because the two runtimes hand back different halves and
|
|
194
|
-
* each hands back exactly one usable one:
|
|
195
|
-
*
|
|
196
|
-
* | cause | Node says | Bun's `specifier` |
|
|
197
|
-
* |---|---|---|
|
|
198
|
-
* | package absent | `Cannot find package 'pkg'`, no `url` | `pkg` |
|
|
199
|
-
* | subpath missing | `Cannot find module '/abs/node_modules/pkg/src/nope.js'`, `url` under node_modules | `pkg/src/nope` |
|
|
200
|
-
* | adopter's file | `Cannot find module '/abs/apps/board/src/x'`, `url` outside node_modules | `./src/x` |
|
|
201
|
-
*
|
|
202
|
-
* Bun gives the **specifier as written**, so a leading `.` settles it. Node gives the **already-resolved
|
|
203
|
-
* path**, where being under `node_modules` settles it. Neither read works on both runtimes; the pair
|
|
204
|
-
* does, and it is the same predicate — *is this inside node_modules* — applied to whichever fact the
|
|
205
|
-
* runtime supplied.
|
|
206
|
-
*/
|
|
207
|
-
function unresolvedKind(cause) {
|
|
208
|
-
if (/Cannot find package /.test(causeMessage(cause) ?? "")) return "package";
|
|
209
|
-
const specifier = unresolvedSpecifier(cause);
|
|
210
|
-
if (specifier === void 0) return void 0;
|
|
211
|
-
if (/^(?:\.|\/|[A-Za-z]:[\\/])/.test(specifier)) return insideNodeModules(specifier) ? "package-subpath" : "local-file";
|
|
212
|
-
const url = prop(cause, "url");
|
|
213
|
-
if (typeof url === "string" && url.length > 0) return insideNodeModules(url) ? "package-subpath" : "local-file";
|
|
214
|
-
return "package-subpath";
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* The specifier that did not resolve.
|
|
218
|
-
*
|
|
219
|
-
* A recorded fact about two runtimes: Bun's `ResolveMessage` carries it as a **field**, and Node states it
|
|
220
|
-
* in prose. The field is preferred wherever there is one, because the prose around it names the referrer's
|
|
221
|
-
* absolute path — the specifier is the adopter's own import, the referrer is our frame.
|
|
222
|
-
*
|
|
223
|
-
* Whether a surface names it, and what it advises when it does, is that surface's policy and stays there.
|
|
224
|
-
*/
|
|
225
|
-
function unresolvedSpecifier(cause) {
|
|
226
|
-
const field = prop(cause, "specifier");
|
|
227
|
-
if (typeof field === "string" && field.length > 0) return field;
|
|
228
|
-
return /Cannot find (?:package|module) ['"]([^'"]+)['"]/.exec(causeMessage(cause) ?? "")?.[1];
|
|
229
|
-
}
|
|
230
|
-
/** A package name as npm allows one: an optional `@scope/`, and never a store's dot-directory. */
|
|
231
|
-
const PACKAGE_NAME = /^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i;
|
|
232
|
-
/**
|
|
233
|
-
* The file the failing import was written in, as the runtime named it. **Module-private on purpose**: it
|
|
234
|
-
* is an absolute path, and {@link importingPackage} exists to make sure only its package half leaves here.
|
|
235
|
-
*/
|
|
236
|
-
function importerPath(cause) {
|
|
237
|
-
const field = prop(cause, "referrer");
|
|
238
|
-
if (typeof field === "string" && field.length > 0) return field;
|
|
239
|
-
const message = causeMessage(cause) ?? "";
|
|
240
|
-
return (/ imported from (.+)$/.exec(message) ?? /\bfrom ['"]([^'"]+)['"]/.exec(message))?.[1];
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* The package whose own source contained the import that did not resolve — **never a path**.
|
|
244
|
-
*
|
|
245
|
-
* {@link unresolvedSpecifier} answers *what* did not resolve. This answers *where the import lives*, and
|
|
246
|
-
* the two are different facts whenever the failing import is not the adopter's own. #480 is that case
|
|
247
|
-
* verbatim: `pithy add email` on a fresh project refused with
|
|
248
|
-
*
|
|
249
|
-
* > Nothing resolves "@pithy-sh/core/src/capability/capability".
|
|
250
|
-
*
|
|
251
|
-
* while `@pithy-sh/core` resolved from the Worker at every step of the run, before and after. The
|
|
252
|
-
* specifier was honest — the runtime really could not resolve it — but the import belonged to
|
|
253
|
-
* `@pithy-sh/email`, which had just been installed and was the package genuinely not linked. So the
|
|
254
|
-
* refusal named the one dependency that was definitely fine, and an adopter following it ran `bun
|
|
255
|
-
* install` against a tree that already had core in it. The importer is the half that would have pointed
|
|
256
|
-
* at `email`, and both runtimes hand it over: **Bun's `ResolveMessage` carries `referrer` as a field**
|
|
257
|
-
* (measured on 1.3.14) and Node states it in prose as `imported from <path>`.
|
|
258
|
-
*
|
|
259
|
-
* **A package name, or nothing.** The referrer is an absolute path — our frame, and the reason
|
|
260
|
-
* {@link unresolvedSpecifier} drops the prose around the specifier — so what travels is the one part of
|
|
261
|
-
* it that is not a path: the package directory it sits under. A referrer outside `node_modules` is the
|
|
262
|
-
* adopter's own file, and there is nothing to say about it that the refusal does not already say by
|
|
263
|
-
* naming the config, so it answers `undefined` rather than a path. The path itself is never returned
|
|
264
|
-
* from this module, which is what makes leaking it impossible rather than merely discouraged.
|
|
265
|
-
*
|
|
266
|
-
* The **last** `node_modules` in the path, because every store layout nests: pnpm's
|
|
267
|
-
* `node_modules/.pnpm/<id>/node_modules/<pkg>` and Bun's isolated linker's
|
|
268
|
-
* `node_modules/.bun/<pkg>@<version>/node_modules/<pkg>` (both measured) put the real owner last, and so
|
|
269
|
-
* does an ordinary nested install. The name is then checked against what npm allows, so a store's own
|
|
270
|
-
* bookkeeping directory (`.bun`, `.pnpm`, `hono@4.6.3`) can only ever answer nothing.
|
|
271
|
-
*
|
|
272
|
-
* Whether a surface names it, and what it advises when it does, is that surface's policy and stays there.
|
|
273
|
-
*/
|
|
274
|
-
function importingPackage(cause) {
|
|
275
|
-
const referrer = importerPath(cause);
|
|
276
|
-
if (referrer === void 0) return void 0;
|
|
277
|
-
const segments = referrer.split(/[\\/]/);
|
|
278
|
-
const at = segments.lastIndexOf("node_modules");
|
|
279
|
-
const head = at === -1 ? void 0 : segments[at + 1];
|
|
280
|
-
if (head === void 0) return void 0;
|
|
281
|
-
const name = head.startsWith("@") ? `${head}/${segments[at + 2] ?? ""}` : head;
|
|
282
|
-
return PACKAGE_NAME.test(name) ? name : void 0;
|
|
283
|
-
}
|
|
284
150
|
//#endregion
|
|
285
|
-
export { causeMessage, failurePosition,
|
|
151
|
+
export { causeMessage, failurePosition, prop, rootCause, safeReason };
|
package/dist/error/http.d.ts
CHANGED
|
@@ -31,6 +31,23 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
31
31
|
message: z.ZodString;
|
|
32
32
|
code: z.ZodString;
|
|
33
33
|
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
message: z.ZodString;
|
|
36
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
37
|
+
code: z.ZodLiteral<"input/required">;
|
|
38
|
+
status: z.ZodLiteral<400>;
|
|
39
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
40
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
message: z.ZodString;
|
|
43
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
44
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
45
|
+
status: z.ZodLiteral<412>;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
message: z.ZodString;
|
|
48
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
49
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
50
|
+
status: z.ZodLiteral<403>;
|
|
34
51
|
}, z.core.$strip>, z.ZodObject<{
|
|
35
52
|
message: z.ZodString;
|
|
36
53
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -693,6 +710,29 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
693
710
|
message: z.ZodString;
|
|
694
711
|
code: z.ZodString;
|
|
695
712
|
}, z.core.$strip>>;
|
|
713
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
714
|
+
message: z.ZodString;
|
|
715
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
716
|
+
action: z.ZodOptional<z.ZodString>;
|
|
717
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
718
|
+
code: z.ZodLiteral<"input/required">;
|
|
719
|
+
status: z.ZodLiteral<400>;
|
|
720
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
721
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
722
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
723
|
+
message: z.ZodString;
|
|
724
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
725
|
+
action: z.ZodOptional<z.ZodString>;
|
|
726
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
727
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
728
|
+
status: z.ZodLiteral<412>;
|
|
729
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
730
|
+
message: z.ZodString;
|
|
731
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
732
|
+
action: z.ZodOptional<z.ZodString>;
|
|
733
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
734
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
735
|
+
status: z.ZodLiteral<403>;
|
|
696
736
|
}, z.core.$strip>, z.ZodObject<{
|
|
697
737
|
message: z.ZodString;
|
|
698
738
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
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,MAAM,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA4B,UAAU,EAAmB,MAAM,cAAc,CAAC;AAErF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/error/http.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA4B,UAAU,EAAmB,MAAM,cAAc,CAAC;AAErF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA8BpB,CAAC;AAeH;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,CAInD;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAKxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAElE"}
|