@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/error/payload.d.ts
CHANGED
|
@@ -33,6 +33,23 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
33
33
|
message: z.ZodString;
|
|
34
34
|
code: z.ZodString;
|
|
35
35
|
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
message: z.ZodString;
|
|
38
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
39
|
+
code: z.ZodLiteral<"input/required">;
|
|
40
|
+
status: z.ZodLiteral<400>;
|
|
41
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
42
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
message: z.ZodString;
|
|
45
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
46
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
47
|
+
status: z.ZodLiteral<412>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
message: z.ZodString;
|
|
50
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
51
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
52
|
+
status: z.ZodLiteral<403>;
|
|
36
53
|
}, z.core.$strip>, z.ZodObject<{
|
|
37
54
|
message: z.ZodString;
|
|
38
55
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -696,6 +713,29 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
696
713
|
message: z.ZodString;
|
|
697
714
|
code: z.ZodString;
|
|
698
715
|
}, z.core.$strip>>;
|
|
716
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
717
|
+
message: z.ZodString;
|
|
718
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
719
|
+
action: z.ZodOptional<z.ZodString>;
|
|
720
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
721
|
+
code: z.ZodLiteral<"input/required">;
|
|
722
|
+
status: z.ZodLiteral<400>;
|
|
723
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
724
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
725
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
726
|
+
message: z.ZodString;
|
|
727
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
728
|
+
action: z.ZodOptional<z.ZodString>;
|
|
729
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
730
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
731
|
+
status: z.ZodLiteral<412>;
|
|
732
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
733
|
+
message: z.ZodString;
|
|
734
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
735
|
+
action: z.ZodOptional<z.ZodString>;
|
|
736
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
737
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
738
|
+
status: z.ZodLiteral<403>;
|
|
699
739
|
}, z.core.$strip>, z.ZodObject<{
|
|
700
740
|
message: z.ZodString;
|
|
701
741
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1632,6 +1672,23 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
|
|
|
1632
1672
|
message: z.ZodString;
|
|
1633
1673
|
code: z.ZodString;
|
|
1634
1674
|
}, z.core.$strip>>;
|
|
1675
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1676
|
+
message: z.ZodString;
|
|
1677
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1678
|
+
code: z.ZodLiteral<"input/required">;
|
|
1679
|
+
status: z.ZodLiteral<400>;
|
|
1680
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
1681
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1682
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1683
|
+
message: z.ZodString;
|
|
1684
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1685
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
1686
|
+
status: z.ZodLiteral<412>;
|
|
1687
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1688
|
+
message: z.ZodString;
|
|
1689
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1690
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
1691
|
+
status: z.ZodLiteral<403>;
|
|
1635
1692
|
}, z.core.$strip>, z.ZodObject<{
|
|
1636
1693
|
message: z.ZodString;
|
|
1637
1694
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -2311,6 +2368,29 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
|
|
|
2311
2368
|
message: z.ZodString;
|
|
2312
2369
|
code: z.ZodString;
|
|
2313
2370
|
}, z.core.$strip>>;
|
|
2371
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2372
|
+
message: z.ZodString;
|
|
2373
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2374
|
+
action: z.ZodOptional<z.ZodString>;
|
|
2375
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
2376
|
+
code: z.ZodLiteral<"input/required">;
|
|
2377
|
+
status: z.ZodLiteral<400>;
|
|
2378
|
+
flag: z.ZodNullable<z.ZodString>;
|
|
2379
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2381
|
+
message: z.ZodString;
|
|
2382
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2383
|
+
action: z.ZodOptional<z.ZodString>;
|
|
2384
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
2385
|
+
code: z.ZodLiteral<"core/precondition_failed">;
|
|
2386
|
+
status: z.ZodLiteral<412>;
|
|
2387
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2388
|
+
message: z.ZodString;
|
|
2389
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2390
|
+
action: z.ZodOptional<z.ZodString>;
|
|
2391
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
2392
|
+
code: z.ZodLiteral<"core/person_required">;
|
|
2393
|
+
status: z.ZodLiteral<403>;
|
|
2314
2394
|
}, z.core.$strip>, z.ZodObject<{
|
|
2315
2395
|
message: z.ZodString;
|
|
2316
2396
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;iBAQqD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/error/payload.js
CHANGED
|
@@ -60,6 +60,23 @@ const InvalidInputPublic = z.object({
|
|
|
60
60
|
issues: z.array(ValidationIssue).describe("Field-level validation failures."),
|
|
61
61
|
...publicFields
|
|
62
62
|
}).describe("Input failed validation at a boundary (400).");
|
|
63
|
+
const InputRequiredPublic = z.object({
|
|
64
|
+
code: z.literal("input/required").describe("A run that may not prompt reached a question with no answer. `PITHY_NONINTERACTIVE=1`, `--no-input` and `--json` each forbid a prompt; this is what one turns into, so an agent is told what to pass rather than left waiting on a question nobody will answer."),
|
|
65
|
+
status: z.literal(400).describe("Bad Request — the call left out something it has to say."),
|
|
66
|
+
flag: z.string().nullable().describe("The flag that answers the question, as it is typed (`--worker`). `null` when no flag can: only a person, or a document piped to stdin, answers it."),
|
|
67
|
+
choices: z.array(z.string().describe("One value the flag takes.")).optional().describe("Every value the flag takes, when the set is known. Absent when it is open, such as a name."),
|
|
68
|
+
...publicFields
|
|
69
|
+
}).describe("A run that may not prompt needed an answer it was not given (400).");
|
|
70
|
+
const PreconditionFailedPublic = z.object({
|
|
71
|
+
code: z.literal("core/precondition_failed").describe("The call is well formed, and the state it needs is not there yet: no credentials, an environment that is not provisioned, a resource nothing has created. Distinct from `validation/invalid_input` because the remedy is a different step run first, not a different call."),
|
|
72
|
+
status: z.literal(412).describe("Precondition Failed — the request is valid, and what it depends on is missing."),
|
|
73
|
+
...publicFields
|
|
74
|
+
}).describe("The state this request depends on is not there yet (412).");
|
|
75
|
+
const PersonRequiredPublic = z.object({
|
|
76
|
+
code: z.literal("core/person_required").describe("The step is one only a person may take: a typed confirmation phrase, or a command that is manual by design. Distinct from `input/required` because no flag value an automated caller could choose is the right answer — the right move is to stop and ask."),
|
|
77
|
+
status: z.literal(403).describe("Forbidden — the caller may not take this step for a person, however the call is phrased."),
|
|
78
|
+
...publicFields
|
|
79
|
+
}).describe("A step only a person may take (403).");
|
|
63
80
|
const InvalidTokenPublic = z.object({
|
|
64
81
|
code: z.literal("auth/invalid_token").describe("The bearer/session credential is missing, expired, or invalid."),
|
|
65
82
|
status: z.literal(401).describe("Unauthorized."),
|
|
@@ -713,6 +730,9 @@ const TestersNotConfiguredPublic = z.object({
|
|
|
713
730
|
*/
|
|
714
731
|
const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
715
732
|
InvalidInputPublic,
|
|
733
|
+
InputRequiredPublic,
|
|
734
|
+
PreconditionFailedPublic,
|
|
735
|
+
PersonRequiredPublic,
|
|
716
736
|
InvalidTokenPublic,
|
|
717
737
|
ForbiddenPublic,
|
|
718
738
|
AuthProviderUnavailablePublic,
|
|
@@ -844,6 +864,9 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
|
844
864
|
TestersNotConfiguredPublic
|
|
845
865
|
]).describe("The public shape of every error the kit defines — the closed set, safe for the wire.");
|
|
846
866
|
const InvalidInput = InvalidInputPublic.extend(internalFields).describe(InvalidInputPublic.description ?? "");
|
|
867
|
+
const InputRequired = InputRequiredPublic.extend(internalFields).describe(InputRequiredPublic.description ?? "");
|
|
868
|
+
const PreconditionFailed = PreconditionFailedPublic.extend(internalFields).describe(PreconditionFailedPublic.description ?? "");
|
|
869
|
+
const PersonRequired = PersonRequiredPublic.extend(internalFields).describe(PersonRequiredPublic.description ?? "");
|
|
847
870
|
const InvalidToken = InvalidTokenPublic.extend(internalFields).describe(InvalidTokenPublic.description ?? "");
|
|
848
871
|
const Forbidden = ForbiddenPublic.extend(internalFields).describe(ForbiddenPublic.description ?? "");
|
|
849
872
|
const AuthProviderUnavailable = AuthProviderUnavailablePublic.extend(internalFields).describe(AuthProviderUnavailablePublic.description ?? "");
|
|
@@ -980,6 +1003,9 @@ const SupportReplyFailed = SupportReplyFailedPublic.extend(internalFields).descr
|
|
|
980
1003
|
*/
|
|
981
1004
|
const KitErrorPayload = z.discriminatedUnion("code", [
|
|
982
1005
|
InvalidInput,
|
|
1006
|
+
InputRequired,
|
|
1007
|
+
PreconditionFailed,
|
|
1008
|
+
PersonRequired,
|
|
983
1009
|
InvalidToken,
|
|
984
1010
|
Forbidden,
|
|
985
1011
|
AuthProviderUnavailable,
|
|
@@ -44,6 +44,50 @@ export declare class ValidationError extends PithyError {
|
|
|
44
44
|
cause?: unknown;
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* A run that may not prompt reached a question nobody gave it the answer to (#697).
|
|
49
|
+
*
|
|
50
|
+
* `flag` is the flag that answers it, or `null` when no flag can — a person, or a document on stdin, is
|
|
51
|
+
* the only answer. `choices` is every value the flag takes when that set is known, and is left off the
|
|
52
|
+
* payload rather than written empty when it is not: an empty list would claim the flag takes nothing.
|
|
53
|
+
*/
|
|
54
|
+
export declare class InputRequiredError extends PithyError {
|
|
55
|
+
readonly payload: Extract<ErrorPayload, {
|
|
56
|
+
code: "input/required";
|
|
57
|
+
}>;
|
|
58
|
+
constructor(args?: ErrorArgs & {
|
|
59
|
+
flag?: string | null;
|
|
60
|
+
choices?: readonly string[];
|
|
61
|
+
}, options?: {
|
|
62
|
+
cause?: unknown;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The call is well formed, and what it depends on is not there yet (#697): no credentials, an environment
|
|
67
|
+
* nothing has provisioned. A separate class from {@link ValidationError} because the remedy is a step to
|
|
68
|
+
* run first, not a different call — the CLI exits 3 for it and 2 for a validation failure.
|
|
69
|
+
*/
|
|
70
|
+
export declare class PreconditionFailedError extends PithyError {
|
|
71
|
+
readonly payload: Extract<ErrorPayload, {
|
|
72
|
+
code: "core/precondition_failed";
|
|
73
|
+
}>;
|
|
74
|
+
constructor(args?: ErrorArgs, options?: {
|
|
75
|
+
cause?: unknown;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A step only a person may take (#697): a typed confirmation phrase, or a command that is manual by
|
|
80
|
+
* design. Not {@link InputRequiredError}, which names a flag an automated caller can pass — here no value
|
|
81
|
+
* a caller could choose is the right answer, and the CLI exits 5 so an agent stops and asks.
|
|
82
|
+
*/
|
|
83
|
+
export declare class PersonRequiredError extends PithyError {
|
|
84
|
+
readonly payload: Extract<ErrorPayload, {
|
|
85
|
+
code: "core/person_required";
|
|
86
|
+
}>;
|
|
87
|
+
constructor(args?: ErrorArgs, options?: {
|
|
88
|
+
cause?: unknown;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
47
91
|
export declare class UnauthorizedError extends PithyError {
|
|
48
92
|
readonly payload: Extract<ErrorPayload, {
|
|
49
93
|
code: "auth/invalid_token";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pithyError.d.ts","sourceRoot":"","sources":["../../src/error/pithyError.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAE/B,YAAY,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAK/D;CACF;AAED,4FAA4F;AAC5F,UAAU,SAAS;IACjB,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,MAA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|
}
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* A run that may not prompt reached a question nobody gave it the answer to (#697).
|
|
38
|
+
*
|
|
39
|
+
* `flag` is the flag that answers it, or `null` when no flag can — a person, or a document on stdin, is
|
|
40
|
+
* the only answer. `choices` is every value the flag takes when that set is known, and is left off the
|
|
41
|
+
* payload rather than written empty when it is not: an empty list would claim the flag takes nothing.
|
|
42
|
+
*/
|
|
43
|
+
var InputRequiredError = class extends PithyError {
|
|
44
|
+
constructor(args = {}, options) {
|
|
45
|
+
super({
|
|
46
|
+
code: "input/required",
|
|
47
|
+
status: 400,
|
|
48
|
+
message: args.message ?? "An answer is required, and this run may not ask for it.",
|
|
49
|
+
action: args.action,
|
|
50
|
+
detail: args.detail,
|
|
51
|
+
params: args.params,
|
|
52
|
+
flag: args.flag ?? null,
|
|
53
|
+
...args.choices === void 0 ? {} : { choices: [...args.choices] }
|
|
54
|
+
}, options);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The call is well formed, and what it depends on is not there yet (#697): no credentials, an environment
|
|
59
|
+
* nothing has provisioned. A separate class from {@link ValidationError} because the remedy is a step to
|
|
60
|
+
* run first, not a different call — the CLI exits 3 for it and 2 for a validation failure.
|
|
61
|
+
*/
|
|
62
|
+
var PreconditionFailedError = class extends PithyError {
|
|
63
|
+
constructor(args = {}, options) {
|
|
64
|
+
super({
|
|
65
|
+
code: "core/precondition_failed",
|
|
66
|
+
status: 412,
|
|
67
|
+
message: args.message ?? "Something this needs is not set up yet.",
|
|
68
|
+
action: args.action,
|
|
69
|
+
detail: args.detail,
|
|
70
|
+
params: args.params
|
|
71
|
+
}, options);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* A step only a person may take (#697): a typed confirmation phrase, or a command that is manual by
|
|
76
|
+
* design. Not {@link InputRequiredError}, which names a flag an automated caller can pass — here no value
|
|
77
|
+
* a caller could choose is the right answer, and the CLI exits 5 so an agent stops and asks.
|
|
78
|
+
*/
|
|
79
|
+
var PersonRequiredError = class extends PithyError {
|
|
80
|
+
constructor(args = {}, options) {
|
|
81
|
+
super({
|
|
82
|
+
code: "core/person_required",
|
|
83
|
+
status: 403,
|
|
84
|
+
message: args.message ?? "Only a person may take this step.",
|
|
85
|
+
action: args.action,
|
|
86
|
+
detail: args.detail,
|
|
87
|
+
params: args.params
|
|
88
|
+
}, options);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
36
91
|
var UnauthorizedError = class extends PithyError {
|
|
37
92
|
constructor(args = {}, options) {
|
|
38
93
|
super({
|
|
@@ -196,4 +251,4 @@ function sentenceOf(error) {
|
|
|
196
251
|
return action ? `${messageOf(error)} ${action}` : messageOf(error);
|
|
197
252
|
}
|
|
198
253
|
//#endregion
|
|
199
|
-
export { ConflictError, ForbiddenError, InternalError, NotFoundError, PithyError, RateLimitError, UnauthorizedError, UpstreamError, UpstreamTimeoutError, ValidationError, WebhookUnverifiedError, fromZodError, messageOf, sentenceOf };
|
|
254
|
+
export { ConflictError, ForbiddenError, InputRequiredError, InternalError, NotFoundError, PersonRequiredError, PithyError, PreconditionFailedError, RateLimitError, UnauthorizedError, UpstreamError, UpstreamTimeoutError, ValidationError, WebhookUnverifiedError, fromZodError, messageOf, sentenceOf };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
/**
|
|
4
|
+
* **An import that would not resolve: which kind it was, whose it was, and the one thing to do about it —
|
|
5
|
+
* decided here and nowhere else (#709).**
|
|
6
|
+
*
|
|
7
|
+
* Three surfaces refuse a module that will not load: the CLI's `pithy.config.ts` loader, its capability
|
|
8
|
+
* loaders, and the vite plugin's Worker config. Each read core's facts and then kept its own rules for the
|
|
9
|
+
* rest — builtins, `#` imports, `file:` URLs, an unexported subpath, a package name. Three review rounds
|
|
10
|
+
* each found one of them giving advice the others had stopped giving: `bun install` where installing
|
|
11
|
+
* cannot help, an absolute path in a rendered field, a dependency's fault blamed on the capability. Fixing
|
|
12
|
+
* them site by site fixed today's three and left the class. So the rules moved here, the surfaces keep
|
|
13
|
+
* none, and `packages/cli/src/project/unresolvedSurfaces.test.ts` feeds every kind through all three.
|
|
14
|
+
*
|
|
15
|
+
* What a surface still owns is what is genuinely its own: a capability loader knows which package it was
|
|
16
|
+
* loading, and an absent *capability* is `pithy add`, not `bun install`. That is a fact about the target,
|
|
17
|
+
* not about the import, and it is the only override any surface makes.
|
|
18
|
+
*
|
|
19
|
+
* ## The two runtimes hand back different halves
|
|
20
|
+
*
|
|
21
|
+
* Measured on Bun 1.4.2 and Node 22.23.3 (Node 24.21.0 throws the same), importing a real tree:
|
|
22
|
+
*
|
|
23
|
+
* | the import | Bun 1.4.2 | Node 22 |
|
|
24
|
+
* |---|---|---|
|
|
25
|
+
* | absent package | `specifier`, `referrer`, `Cannot find package` | `Cannot find package 'pkg'` |
|
|
26
|
+
* | deep import, package absent **or** installed without it | the same sentence for both | `Cannot find package 'pkg'`, or the resolved `url` |
|
|
27
|
+
* | unexported subpath | the same sentence again | `ERR_PACKAGE_PATH_NOT_EXPORTED` |
|
|
28
|
+
* | `node:nope` | `ERR_UNKNOWN_BUILTIN_MODULE`, `specifier`, `referrer` | the code and sentence, nothing else |
|
|
29
|
+
* | `bun:nope` | `Cannot find package 'nope'` — the scheme is dropped | `ERR_UNSUPPORTED_ESM_URL_SCHEME` |
|
|
30
|
+
* | the adopter's file | the import as written, `referrer` | the resolved `url` |
|
|
31
|
+
* | `#internal` | `Cannot find package '#internal'` | `ERR_PACKAGE_IMPORT_NOT_DEFINED` |
|
|
32
|
+
* | installed package, `exports` with no `"."` | `Cannot find package 'pkg'` — the sentence for an absent one | `No "exports" main defined in …/pkg/package.json` |
|
|
33
|
+
* | installed package, `main` names a missing file | the same sentence again | `Cannot find package '…/node_modules/pkg/<main>'` |
|
|
34
|
+
* | installed package, `exports` `"."` names a missing file | the same sentence again | the resolved `url` of that file |
|
|
35
|
+
* | deep import, an `exports` pattern maps it to a missing file | the import as written, `referrer` | the resolved `url` of that file |
|
|
36
|
+
* | a `file:` URL | converted to a path | the resolved `url` |
|
|
37
|
+
* | a package's own relative import | the import as written, `referrer` in the package | the resolved `url` |
|
|
38
|
+
*
|
|
39
|
+
* Node gives the **already-resolved path**; Bun gives the **import as written** and the file it was
|
|
40
|
+
* written in. Both are read to one path before anything is decided, so a remedy does not depend on the
|
|
41
|
+
* runtime it was read on. Where Bun says less than Node — an unexported subpath reads as a missing one —
|
|
42
|
+
* the two share a remedy, which is the only way to keep them agreeing.
|
|
43
|
+
*
|
|
44
|
+
* **A bare name is asked of the probe too.** Bun 1.4.2 says `Cannot find package 'pkg'` for a package that
|
|
45
|
+
* is installed and has no entry to import by its bare name — every `@pithy-sh/*` package, whose `exports`
|
|
46
|
+
* map has no `"."` — exactly as it says it for one that is absent. Taken at face value, that told an
|
|
47
|
+
* adopter to install what was installed. So a bare name the probe finds is an installed package with no
|
|
48
|
+
* usable entry, named by the package, and Node's two sentences for the same tree read to the same remedy.
|
|
49
|
+
*
|
|
50
|
+
* **And so is its `package.json`.** Bun says the same sentence again for a package that *declares* an entry
|
|
51
|
+
* whose file is not there — an unbuilt workspace package, a broken install — and Node hands back that
|
|
52
|
+
* file's path, so a bare import read as a deep one the adopter never wrote. Neither is "no entry": it is
|
|
53
|
+
* that package to rebuild or reinstall. Only the manifest says which, so {@link packageEntryProbe} reads
|
|
54
|
+
* it, and every runtime's shape for the same tree reads to the same kind.
|
|
55
|
+
*
|
|
56
|
+
* **And a deep import is resolved through `exports` too.** Every `@pithy-sh/*` package exports `./src/*` as
|
|
57
|
+
* `./dist/*.js`, so in an unbuilt one every deep import matches the pattern and lands on a file that is not
|
|
58
|
+
* there. Bun and Vite hand back the import as written and Node the `dist` file it resolved to; read at
|
|
59
|
+
* face value, the first two told an adopter the package does not provide a path it declares, and Node
|
|
60
|
+
* quoted a path nobody wrote. So the import is resolved through the manifest — patterns and conditions,
|
|
61
|
+
* as the runtimes do — and Node's file is mapped back to the import that reaches it, which is what is
|
|
62
|
+
* shown. A target the manifest declares and the disk does not have is {@link exportedKind}'s to call.
|
|
63
|
+
*
|
|
64
|
+
* ## Vite's module runner says it a third way
|
|
65
|
+
*
|
|
66
|
+
* The vite plugin loads a config through `runnerImport` (Vite 8.3.0, measured), which resolves bare
|
|
67
|
+
* imports itself before any runtime does and throws its own shapes: `PLUGIN_ERROR` with
|
|
68
|
+
* *`"." is not exported under the conditions [...] from package <dir>`* for an `exports` map with no
|
|
69
|
+
* usable `"."` (or `"./sub"` for an unexported subpath), and `ERR_RESOLVE_PACKAGE_ENTRY_FAIL` —
|
|
70
|
+
* *Failed to resolve entry for package "pkg"* — for every other bare name with nothing on disk to load,
|
|
71
|
+
* declared or not. Neither names an importer, so the manifest is found from the project instead.
|
|
72
|
+
*
|
|
73
|
+
* **Bun 1.4.2 cannot be told from an absent package for `bun:nope`.** It drops the scheme and reports a
|
|
74
|
+
* package called `nope`, with nothing left in the cause to say otherwise. That one reads as an absent
|
|
75
|
+
* package, and is the one remedy here that a runtime takes out of this module's hands.
|
|
76
|
+
*
|
|
77
|
+
* ## Never a path, never a URL
|
|
78
|
+
*
|
|
79
|
+
* Every rendered field is built from what {@link UnresolvedImport.shown} allows: a bare specifier, a
|
|
80
|
+
* path relative to the project, or a path inside a package named from that package. An absolute path or
|
|
81
|
+
* a `file:` URL is never returned from here, so a surface cannot render one.
|
|
82
|
+
*
|
|
83
|
+
* ## A package that resolves and will not load
|
|
84
|
+
*
|
|
85
|
+
* One more failure belongs to an installed package and reads, unclassified, as the adopter's: a package
|
|
86
|
+
* whose code contradicts the `"type"` its `package.json` declares. Node throws it from inside that package
|
|
87
|
+
* — `module is not defined in ES module scope`, `Cannot use import statement outside a module` — and Vite's
|
|
88
|
+
* runner hands the import to Node, so it throws the same. Nothing resolves wrongly, so it is not an
|
|
89
|
+
* {@link unresolvedImport}; but a surface that falls through to its own rules says *the config threw* or
|
|
90
|
+
* *the config does not parse*. {@link packageLoadFailure} names the package instead, from the file the
|
|
91
|
+
* error was thrown in, and every surface asks it before deciding the failure was its own.
|
|
92
|
+
*/
|
|
93
|
+
/** Which of the causes it was. Each has one remedy, and only three of them say to install. */
|
|
94
|
+
export type UnresolvedImportKind =
|
|
95
|
+
/** A package that is not installed. Installing is the remedy. */
|
|
96
|
+
"package"
|
|
97
|
+
/**
|
|
98
|
+
* An installed package asked for a path it does not have, or does not export — or asked by its bare name
|
|
99
|
+
* when it has no entry there. Installing changes nothing.
|
|
100
|
+
*/
|
|
101
|
+
| "package-subpath"
|
|
102
|
+
/**
|
|
103
|
+
* An installed package whose `package.json` names an entry — `exports` `"."` or `main` — that is not on
|
|
104
|
+
* disk: unbuilt, or a broken install. That package is rebuilt or reinstalled; the project's install
|
|
105
|
+
* does not touch a package it already has.
|
|
106
|
+
*/
|
|
107
|
+
| "package-entry"
|
|
108
|
+
/** An installed package's own relative import of its own file. Its maintainer's, never an install. */
|
|
109
|
+
| "package-file"
|
|
110
|
+
/** A module the runtime provides, or does not: `node:nope`. Installing cannot add one. */
|
|
111
|
+
| "builtin"
|
|
112
|
+
/** A file in the adopter's own tree, a `file:` URL included. Theirs to create or correct. */
|
|
113
|
+
| "local-file"
|
|
114
|
+
/** A `#` import its importer's own `imports` map does not satisfy. Theirs, or the package's maintainer's. */
|
|
115
|
+
| "imports-map"
|
|
116
|
+
/** A deep import, and nothing to say whether its package is absent or only the path is. Both remedies. */
|
|
117
|
+
| "undetermined"
|
|
118
|
+
/** A resolution failure that names nothing. Both remedies. */
|
|
119
|
+
| "unnamed";
|
|
120
|
+
/** One unresolved import, classified. Every field may be rendered: none carries a path or a URL. */
|
|
121
|
+
export interface UnresolvedImport {
|
|
122
|
+
/** Which cause it was. */
|
|
123
|
+
kind: UnresolvedImportKind;
|
|
124
|
+
/** The import as it may be shown: a bare specifier, `./`-relative to the project, or `<package>/<path>`. */
|
|
125
|
+
shown?: string;
|
|
126
|
+
/** The package the import named, for the kinds that name one. */
|
|
127
|
+
package?: string;
|
|
128
|
+
/** The package whose file holds the import. Absent when that is the adopter's own code, or not said. */
|
|
129
|
+
owner?: string;
|
|
130
|
+
/** Whether installing the project's dependencies can fix it. */
|
|
131
|
+
installHelps: boolean;
|
|
132
|
+
/** The one sentence every surface puts in its `action`. */
|
|
133
|
+
remedy: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Whether `pkg` is installed where `referrer` would look for it. The caller's to answer: core touches no
|
|
137
|
+
* filesystem, and on Bun 1.4.2 nothing in the cause says. {@link nodeModulesProbe} builds the answer.
|
|
138
|
+
*/
|
|
139
|
+
export type InstalledProbe = (pkg: string, referrer: string) => boolean;
|
|
140
|
+
/** What a surface tells the classifier about where it stands. */
|
|
141
|
+
export interface UnresolvedImportOptions {
|
|
142
|
+
/** Answers the one question the cause cannot. Without it, a deep import is `undetermined`. */
|
|
143
|
+
installed?: InstalledProbe;
|
|
144
|
+
/**
|
|
145
|
+
* Answers the next one: what an installed package declares, and what of it is on disk. Without it, Bun's
|
|
146
|
+
* bare name is taken to have no entry there, a loader that names the file or the package it could not
|
|
147
|
+
* load — Node reaching for a `main`, Vite's *Failed to resolve entry* — is taken to have reached for a
|
|
148
|
+
* declared one, and a deep import is a path the package does not provide.
|
|
149
|
+
*/
|
|
150
|
+
entry?: EntryProbe;
|
|
151
|
+
/** The directory an adopter's paths are shown relative to. Without it, a resolved path is never shown. */
|
|
152
|
+
relativeTo?: string;
|
|
153
|
+
/** The package doing the importing — `@pithy-sh/cli`, `@pithy-sh/vite`. Never named as an owner. */
|
|
154
|
+
loader?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* An installed `pkg` found on the chain above `from`: its manifest, and whether a path inside it is on disk.
|
|
158
|
+
* `undefined` when there is no such package, or no manifest to read. {@link packageEntryProbe} builds the
|
|
159
|
+
* answer; what the manifest *means* — the entry it declares, where an `exports` pattern leads — is decided
|
|
160
|
+
* here, by {@link declaredEntry} and {@link exportedTarget}, so no surface reads a manifest its own way.
|
|
161
|
+
*/
|
|
162
|
+
export type EntryProbe = (pkg: string, from: string) => InstalledPackage | undefined;
|
|
163
|
+
/** What {@link EntryProbe} answers: one installed package's manifest, and its directory to ask of. */
|
|
164
|
+
export interface InstalledPackage {
|
|
165
|
+
/** Its `package.json`, parsed. */
|
|
166
|
+
manifest: unknown;
|
|
167
|
+
/** Whether a path inside the package — a file or a directory, `""` for the package itself — is on disk. */
|
|
168
|
+
has(path: string): boolean;
|
|
169
|
+
}
|
|
170
|
+
/** The two filesystem calls {@link nodeModulesProbe} makes. `node:fs`'s `existsSync` and `realpathSync`. */
|
|
171
|
+
export interface ProbeFileSystem {
|
|
172
|
+
/** Whether a file is there. */
|
|
173
|
+
exists(path: string): boolean;
|
|
174
|
+
/** Where a path really is, through every symlink. May throw for a path that is not there. */
|
|
175
|
+
realpath(path: string): string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The {@link InstalledProbe} a surface on Node or Bun passes: `pkg` on the `node_modules` chain above
|
|
179
|
+
* `referrer`, **walked from where `referrer` really is**.
|
|
180
|
+
*
|
|
181
|
+
* Both runtimes resolve from the real path of the importing file, and Bun's isolated linker puts every
|
|
182
|
+
* package behind a symlink into its store, with that package's own dependencies beside the real
|
|
183
|
+
* directory and not beside the link. Walked from the link, the chain is the root's — a different copy,
|
|
184
|
+
* or none — so a dependency the resolver could see was reported absent, and the adopter told to install
|
|
185
|
+
* what was installed. A `referrer` that will not resolve is walked as given.
|
|
186
|
+
*
|
|
187
|
+
* Core has no filesystem, so the two calls are the caller's. The walk is here, once.
|
|
188
|
+
*/
|
|
189
|
+
export declare function nodeModulesProbe(fs: ProbeFileSystem): InstalledProbe;
|
|
190
|
+
/**
|
|
191
|
+
* The {@link EntryProbe} a surface on Node or Bun passes: the same walk as {@link nodeModulesProbe}, then
|
|
192
|
+
* the package's own `package.json`, and `exists` for the paths beside it.
|
|
193
|
+
*/
|
|
194
|
+
export declare function packageEntryProbe(fs: ProbeFileSystem & {
|
|
195
|
+
read(path: string): string;
|
|
196
|
+
}): EntryProbe;
|
|
197
|
+
/**
|
|
198
|
+
* The entry a manifest declares for an `import` of the package's bare name, or `null` for none. `exports`
|
|
199
|
+
* wins when present — its `"."`, or the whole map when no key is a subpath — and a target is the first
|
|
200
|
+
* one whose condition an import matches. With no `exports`, it is `main`.
|
|
201
|
+
*/
|
|
202
|
+
export declare function declaredEntry(manifest: unknown): string | null;
|
|
203
|
+
/** Where one subpath leads through `exports`: the file, and for a pattern, the directory it expands under. */
|
|
204
|
+
export interface ExportedTarget {
|
|
205
|
+
/** The file an import takes, as a path inside the package. */
|
|
206
|
+
target: string;
|
|
207
|
+
/**
|
|
208
|
+
* For a target reached through a pattern (`./src/*` → `./dist/*.js`), the directory inside the package
|
|
209
|
+
* its `*` expands under (`dist`; `""` for the package itself). Absent for a subpath with a key of its own.
|
|
210
|
+
*/
|
|
211
|
+
under?: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* What an import of `subpath` (`"."`, `"./src/capability"`) takes from a manifest's `exports`, as Node and
|
|
215
|
+
* Vite resolve it: an exact key first, then the pattern with the longest prefix, each target followed
|
|
216
|
+
* through the conditions an import matches. `null` when the map does not export it — no key, no pattern,
|
|
217
|
+
* or a `null` target — and `undefined` when the manifest has no `exports`, so the subpath is a file path.
|
|
218
|
+
*/
|
|
219
|
+
export declare function exportedTarget(manifest: unknown, subpath: string): ExportedTarget | null | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* Classify an import that would not resolve, or answer `undefined` when `cause` is not one.
|
|
222
|
+
*
|
|
223
|
+
* Read duck-typed, for `prop`'s reason in `cause.ts`, and through Bun's `AggregateError` wrapper, for
|
|
224
|
+
* `rootCause`'s.
|
|
225
|
+
*/
|
|
226
|
+
export declare function unresolvedImport(wrapped: unknown, options?: UnresolvedImportOptions): UnresolvedImport | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* The package whose own source holds the import that did not resolve — **never a path**.
|
|
229
|
+
*
|
|
230
|
+
* #480 is why: `pithy add email` refused with *Nothing resolves "@pithy-sh/core/src/capability/capability"*
|
|
231
|
+
* while core resolved throughout, because the import was `@pithy-sh/email`'s and email was the package
|
|
232
|
+
* not linked. The importer is the half that points there. The **last** `node_modules` in the path wins,
|
|
233
|
+
* because every store nests (pnpm's `.pnpm/<id>/node_modules/<pkg>`, Bun's `.bun/<pkg>@<v>/node_modules/<pkg>`),
|
|
234
|
+
* and the name is held to what npm allows, so a store's bookkeeping directory answers nothing.
|
|
235
|
+
*/
|
|
236
|
+
export declare function importingPackage(cause: unknown): string | undefined;
|
|
237
|
+
/** A package's file that would not load: the package it is in, and the one sentence for it. */
|
|
238
|
+
export interface PackageLoadFailure {
|
|
239
|
+
/** The installed package whose own file threw. Never the loader. */
|
|
240
|
+
owner: string;
|
|
241
|
+
/** The one sentence every surface puts in its `action`. Names the package, never a path. */
|
|
242
|
+
remedy: string;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* **A file inside an installed package would not load, so the package is named and never the config.**
|
|
246
|
+
*
|
|
247
|
+
* A `"type"` its code contradicts — `module` over `module.exports`, `commonjs` over `import` — throws from
|
|
248
|
+
* inside that package, on Node and through Vite's runner alike, as a `ReferenceError` or a `SyntaxError`.
|
|
249
|
+
* Unclassified, the first read as *the config threw while loading* and the second as *the config does not
|
|
250
|
+
* parse*: the adopter told to fix a file that is fine. A package's file that does not parse at all is the
|
|
251
|
+
* same fault in the same place, and is named the same way.
|
|
252
|
+
*
|
|
253
|
+
* **The file is the one that failed to load, and only that one.** Node heads a compile error with the file
|
|
254
|
+
* and line it could not compile, and Bun 1.4.2 hands over a `BuildMessage` with no stack at all, the file
|
|
255
|
+
* in its `position`. Otherwise the error's first stack frame must be a module's own top level, run as it
|
|
256
|
+
* is imported — `at file:///…:L:C`, or Vite's `at eval (…)`, with no function of its own. A first frame
|
|
257
|
+
* inside a function is the config calling into a package, and a later frame is a caller: so a package's
|
|
258
|
+
* deliberate throw, which the config provoked — json5's `parse` throws a `SyntaxError` on bad input — is
|
|
259
|
+
* never laid at the package's door. Only errors a module throws while it is loaded are read: a
|
|
260
|
+
* `SyntaxError` or a `BuildMessage`, and a `ReferenceError` for a CommonJS global in a module's scope.
|
|
261
|
+
*
|
|
262
|
+
* `undefined` when the cause is not one, or was thrown in the adopter's own file — that stays theirs.
|
|
263
|
+
*/
|
|
264
|
+
export declare function packageLoadFailure(wrapped: unknown, options?: Pick<UnresolvedImportOptions, "loader">): PackageLoadFailure | undefined;
|
|
265
|
+
//# sourceMappingURL=unresolved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unresolved.d.ts","sourceRoot":"","sources":["../../src/error/unresolved.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAEH,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB;AAC9B,iEAAiE;AAC/D,SAAS;AACX;;;GAGG;GACD,iBAAiB;AACnB;;;;GAIG;GACD,eAAe;AACjB,sGAAsG;GACpG,cAAc;AAChB,0FAA0F;GACxF,SAAS;AACX,6FAA6F;GAC3F,YAAY;AACd,6GAA6G;GAC3G,aAAa;AACf,0GAA0G;GACxG,cAAc;AAChB,8DAA8D;GAC5D,SAAS,CAAC;AAEd,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,4GAA4G;IAC5G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wGAAwG;IACxG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,YAAY,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,MAAM,EAAE,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