@pithy-sh/core 0.9.0 → 0.11.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/access/access.d.ts +172 -0
- package/dist/access/access.d.ts.map +1 -0
- package/dist/access/access.js +147 -0
- package/dist/access/acting.d.ts +49 -0
- package/dist/access/acting.d.ts.map +1 -0
- package/dist/access/acting.js +21 -0
- package/dist/access/policyCheck.d.ts +33 -0
- package/dist/access/policyCheck.d.ts.map +1 -0
- package/dist/access/policyCheck.js +48 -0
- package/dist/access/usage.d.ts +83 -0
- package/dist/access/usage.d.ts.map +1 -0
- package/dist/access/usage.js +104 -0
- package/dist/access/visibility.d.ts +66 -0
- package/dist/access/visibility.d.ts.map +1 -0
- package/dist/access/visibility.js +86 -0
- 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/audit/auditEvent.d.ts +5 -0
- package/dist/audit/auditEvent.d.ts.map +1 -1
- package/dist/audit/auditEvent.js +2 -0
- package/dist/capability/bindings.d.ts +47 -2
- package/dist/capability/bindings.d.ts.map +1 -1
- package/dist/capability/bindings.js +117 -7
- package/dist/capability/capability.d.ts +105 -28
- 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/manifest.d.ts +2 -1
- package/dist/capability/manifest.d.ts.map +1 -1
- package/dist/capability/manifest.js +1 -1
- package/dist/capability/settings.d.ts +96 -4
- package/dist/capability/settings.d.ts.map +1 -1
- package/dist/capability/settings.js +85 -4
- 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 +2437 -0
- package/dist/cli/commandCatalog.generated.d.ts.map +1 -0
- package/dist/cli/commandCatalog.generated.js +2564 -0
- package/dist/cli/commandFacts.d.ts +164 -0
- package/dist/cli/commandFacts.d.ts.map +1 -0
- package/dist/cli/commandFacts.js +216 -0
- package/dist/controlPlane/capability.d.ts.map +1 -1
- package/dist/controlPlane/capability.js +12 -2
- package/dist/controlPlane/context.d.ts +5 -0
- package/dist/controlPlane/context.d.ts.map +1 -1
- package/dist/controlPlane/context.js +3 -1
- package/dist/controlPlane/data/connection.d.ts +47 -0
- package/dist/controlPlane/data/connection.d.ts.map +1 -1
- package/dist/controlPlane/data/connection.js +55 -1
- package/dist/controlPlane/error/errors.d.ts.map +1 -1
- package/dist/controlPlane/error/errors.js +4 -3
- package/dist/controlPlane/http/cors.d.ts +4 -4
- package/dist/controlPlane/http/cors.js +4 -4
- package/dist/controlPlane/http/guard.d.ts +11 -0
- package/dist/controlPlane/http/guard.d.ts.map +1 -1
- package/dist/controlPlane/http/guard.js +28 -2
- package/dist/controlPlane/http/handlers.d.ts +60 -0
- package/dist/controlPlane/http/handlers.d.ts.map +1 -1
- package/dist/controlPlane/http/handlers.js +31 -2
- package/dist/controlPlane/http/readiness.d.ts +33 -0
- package/dist/controlPlane/http/readiness.d.ts.map +1 -0
- package/dist/controlPlane/http/readiness.js +39 -0
- package/dist/controlPlane/http/responses.d.ts +147 -0
- package/dist/controlPlane/http/responses.d.ts.map +1 -1
- package/dist/controlPlane/http/responses.js +61 -4
- package/dist/controlPlane/http/routes.d.ts +2 -1
- package/dist/controlPlane/http/routes.d.ts.map +1 -1
- package/dist/controlPlane/http/routes.js +50 -9
- package/dist/controlPlane/http/verify.d.ts.map +1 -1
- package/dist/controlPlane/http/verify.js +2 -1
- package/dist/controlPlane/migrationState/migrationState.d.ts +102 -0
- package/dist/controlPlane/migrationState/migrationState.d.ts.map +1 -0
- package/dist/controlPlane/migrationState/migrationState.js +142 -0
- package/dist/controlPlane/migrations/0003_connection_principal.d.ts +21 -0
- package/dist/controlPlane/migrations/0003_connection_principal.d.ts.map +1 -0
- package/dist/controlPlane/migrations/0003_connection_principal.js +33 -0
- package/dist/controlPlane/scope/scope.d.ts +13 -2
- package/dist/controlPlane/scope/scope.d.ts.map +1 -1
- package/dist/controlPlane/scope/scope.js +14 -3
- package/dist/createBackend.d.ts +7 -0
- package/dist/createBackend.d.ts.map +1 -1
- package/dist/createBackend.js +41 -6
- package/dist/createEntrypoint.d.ts.map +1 -1
- package/dist/createEntrypoint.js +5 -3
- package/dist/entitlement/allowance.d.ts +25 -0
- package/dist/entitlement/allowance.d.ts.map +1 -0
- package/dist/entitlement/allowance.js +80 -0
- package/dist/entitlement/entitlement.d.ts +41 -0
- package/dist/entitlement/entitlement.d.ts.map +1 -1
- package/dist/entitlement/meter.d.ts +57 -0
- package/dist/entitlement/meter.d.ts.map +1 -0
- package/dist/entitlement/meter.js +13 -0
- 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 +184 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +368 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +126 -4
- 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/authContext.d.ts +7 -0
- package/dist/http/authContext.d.ts.map +1 -1
- package/dist/http/authContext.js +8 -1
- 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/scopeGates.d.ts +20 -0
- package/dist/http/scopeGates.d.ts.map +1 -0
- package/dist/http/scopeGates.js +36 -0
- 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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/logger/record.d.ts +107 -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/capabilitySets.d.ts +23 -0
- package/dist/migrations/capabilitySets.d.ts.map +1 -0
- package/dist/migrations/capabilitySets.js +74 -0
- 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/registry.d.ts +26 -0
- package/dist/migrations/registry.d.ts.map +1 -1
- package/dist/migrations/registry.js +38 -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/migrations/state.d.ts +60 -0
- package/dist/migrations/state.d.ts.map +1 -0
- package/dist/migrations/state.js +46 -0
- package/dist/naming/domains.d.ts +17 -0
- package/dist/naming/domains.d.ts.map +1 -1
- package/dist/naming/domains.js +62 -4
- package/dist/naming/environment.d.ts.map +1 -1
- package/dist/naming/environment.js +2 -1
- package/dist/naming/feature.d.ts +27 -5
- package/dist/naming/feature.d.ts.map +1 -1
- package/dist/naming/feature.js +36 -6
- package/dist/naming/limits.d.ts +47 -3
- package/dist/naming/limits.d.ts.map +1 -1
- package/dist/naming/limits.js +47 -3
- 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 +6 -0
- package/dist/naming/provisionScope.d.ts.map +1 -1
- package/dist/naming/provisionScope.js +10 -4
- package/dist/naming/resourceNames.d.ts +21 -2
- package/dist/naming/resourceNames.d.ts.map +1 -1
- package/dist/naming/resourceNames.js +21 -3
- 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/writeD1.d.ts +7 -1
- package/dist/seed/writeD1.d.ts.map +1 -1
- package/dist/seed/writeD1.js +9 -3
- package/dist/seed/writeKv.d.ts +2 -0
- package/dist/seed/writeKv.d.ts.map +1 -1
- package/dist/seed/writeKv.js +6 -2
- 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/worker/serviceLoopback.d.ts +36 -0
- package/dist/worker/serviceLoopback.d.ts.map +1 -0
- package/dist/worker/serviceLoopback.js +74 -0
- package/dist/workflow/dispatchRoute.d.ts.map +1 -1
- package/dist/workflow/dispatchRoute.js +12 -6
- package/dist/workflow/faults.d.ts +12 -1
- package/dist/workflow/faults.d.ts.map +1 -1
- package/dist/workflow/faults.js +24 -18
- 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 +4 -4
- package/src/access/access.ts +298 -0
- package/src/access/acting.ts +59 -0
- package/src/access/policyCheck.ts +77 -0
- package/src/access/usage.ts +141 -0
- package/src/access/visibility.ts +109 -0
- package/src/asyncapi/document.ts +164 -0
- package/src/audit/auditEvent.ts +4 -0
- package/src/capability/bindings.ts +159 -13
- package/src/capability/capability.ts +106 -29
- package/src/capability/composition.ts +2 -1
- package/src/capability/settings.ts +165 -4
- package/src/cli/command.ts +865 -0
- package/src/cli/commandCatalog.generated.ts +2723 -0
- package/src/cli/commandFacts.ts +220 -0
- package/src/controlPlane/capability.ts +25 -1
- package/src/controlPlane/context.ts +4 -0
- package/src/controlPlane/data/connection.ts +90 -0
- package/src/controlPlane/error/errors.ts +10 -3
- package/src/controlPlane/http/cors.ts +4 -4
- package/src/controlPlane/http/guard.ts +35 -2
- package/src/controlPlane/http/handlers.ts +41 -0
- package/src/controlPlane/http/readiness.ts +50 -0
- package/src/controlPlane/http/responses.ts +140 -2
- package/src/controlPlane/http/routes.ts +82 -10
- package/src/controlPlane/http/verify.ts +2 -0
- package/src/controlPlane/migrationState/migrationState.ts +200 -0
- package/src/controlPlane/migrations/0003_connection_principal.ts +37 -0
- package/src/controlPlane/scope/scope.ts +14 -2
- package/src/createBackend.ts +59 -8
- package/src/createEntrypoint.ts +9 -3
- package/src/entitlement/allowance.ts +85 -0
- package/src/entitlement/entitlement.ts +38 -0
- package/src/entitlement/meter.ts +69 -0
- package/src/entitlement/require.ts +1 -1
- package/src/error/cause.ts +18 -181
- package/src/error/payload.ts +270 -4
- package/src/error/pithyError.ts +76 -0
- package/src/error/unresolved.ts +853 -0
- package/src/error/wire.ts +40 -0
- package/src/http/authContext.ts +13 -1
- 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/scopeGates.ts +34 -0
- 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/index.ts +1 -0
- package/src/migrations/bookkeeping.ts +39 -2
- package/src/migrations/capabilitySets.ts +87 -0
- package/src/migrations/groups.ts +295 -0
- package/src/migrations/migrateStep.ts +19 -0
- package/src/migrations/owner.ts +10 -6
- package/src/migrations/registry.ts +46 -2
- package/src/migrations/retained.ts +2 -2
- package/src/migrations/runner.ts +214 -22
- package/src/migrations/state.ts +94 -0
- package/src/naming/domains.ts +75 -16
- package/src/naming/environment.ts +2 -1
- package/src/naming/feature.ts +46 -7
- package/src/naming/limits.ts +35 -3
- package/src/naming/packageName.ts +20 -0
- package/src/naming/provisionScope.ts +21 -2
- package/src/naming/resourceNames.ts +52 -5
- package/src/openapi/document.ts +412 -0
- package/src/openapi/routeGroups.ts +25 -0
- package/src/seed/writeD1.ts +13 -4
- package/src/seed/writeKv.ts +6 -2
- package/src/text/comments.ts +56 -4
- package/src/text/literals.ts +294 -0
- package/src/version.generated.ts +1 -1
- package/src/worker/serviceLoopback.ts +105 -0
- package/src/workflow/dispatchRoute.ts +13 -6
- package/src/workflow/faults.ts +56 -27
- package/src/workflow/hostEnv.ts +9 -1
- package/src/workflow/loopback.ts +2 -1
package/src/error/payload.ts
CHANGED
|
@@ -85,6 +85,54 @@ const InvalidInputPublic = z
|
|
|
85
85
|
})
|
|
86
86
|
.describe("Input failed validation at a boundary (400).");
|
|
87
87
|
|
|
88
|
+
const InputRequiredPublic = z
|
|
89
|
+
.object({
|
|
90
|
+
code: z
|
|
91
|
+
.literal("input/required")
|
|
92
|
+
.describe(
|
|
93
|
+
"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.",
|
|
94
|
+
),
|
|
95
|
+
status: z.literal(400).describe("Bad Request — the call left out something it has to say."),
|
|
96
|
+
flag: z
|
|
97
|
+
.string()
|
|
98
|
+
.nullable()
|
|
99
|
+
.describe(
|
|
100
|
+
"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.",
|
|
101
|
+
),
|
|
102
|
+
choices: z
|
|
103
|
+
.array(z.string().describe("One value the flag takes."))
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("Every value the flag takes, when the set is known. Absent when it is open, such as a name."),
|
|
106
|
+
...publicFields,
|
|
107
|
+
})
|
|
108
|
+
.describe("A run that may not prompt needed an answer it was not given (400).");
|
|
109
|
+
|
|
110
|
+
const PreconditionFailedPublic = z
|
|
111
|
+
.object({
|
|
112
|
+
code: z
|
|
113
|
+
.literal("core/precondition_failed")
|
|
114
|
+
.describe(
|
|
115
|
+
"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.",
|
|
116
|
+
),
|
|
117
|
+
status: z.literal(412).describe("Precondition Failed — the request is valid, and what it depends on is missing."),
|
|
118
|
+
...publicFields,
|
|
119
|
+
})
|
|
120
|
+
.describe("The state this request depends on is not there yet (412).");
|
|
121
|
+
|
|
122
|
+
const PersonRequiredPublic = z
|
|
123
|
+
.object({
|
|
124
|
+
code: z
|
|
125
|
+
.literal("core/person_required")
|
|
126
|
+
.describe(
|
|
127
|
+
"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.",
|
|
128
|
+
),
|
|
129
|
+
status: z
|
|
130
|
+
.literal(403)
|
|
131
|
+
.describe("Forbidden — the caller may not take this step for a person, however the call is phrased."),
|
|
132
|
+
...publicFields,
|
|
133
|
+
})
|
|
134
|
+
.describe("A step only a person may take (403).");
|
|
135
|
+
|
|
88
136
|
const InvalidTokenPublic = z
|
|
89
137
|
.object({
|
|
90
138
|
code: z.literal("auth/invalid_token").describe("The bearer/session credential is missing, expired, or invalid."),
|
|
@@ -453,6 +501,28 @@ const TurnstileConfigPublic = z
|
|
|
453
501
|
})
|
|
454
502
|
.describe("The Turnstile middleware is misconfigured (500).");
|
|
455
503
|
|
|
504
|
+
const TurnstileAnalyticsWindowPublic = z
|
|
505
|
+
.object({
|
|
506
|
+
code: z
|
|
507
|
+
.literal("turnstile/analytics_window")
|
|
508
|
+
.describe(
|
|
509
|
+
"The requested challenge window reaches past what Cloudflare keeps, or is wider than one read may ask for.",
|
|
510
|
+
),
|
|
511
|
+
status: z.literal(400).describe("Bad Request — narrow the window or move it later."),
|
|
512
|
+
...publicFields,
|
|
513
|
+
})
|
|
514
|
+
.describe("A Turnstile-analytics window outside Cloudflare's retention or range (400).");
|
|
515
|
+
|
|
516
|
+
const TurnstileAnalyticsUnavailablePublic = z
|
|
517
|
+
.object({
|
|
518
|
+
code: z
|
|
519
|
+
.literal("turnstile/analytics_unavailable")
|
|
520
|
+
.describe("Cloudflare does not serve Turnstile analytics to this account, so no outcome can be read."),
|
|
521
|
+
status: z.literal(409).describe("Conflict — the account's configuration rules the read out."),
|
|
522
|
+
...publicFields,
|
|
523
|
+
})
|
|
524
|
+
.describe("Turnstile analytics are not served to this account (409).");
|
|
525
|
+
|
|
456
526
|
// --- @pithy-sh/audit: audit-trail recorder codes ---
|
|
457
527
|
|
|
458
528
|
const AuditInvalidEventPublic = z
|
|
@@ -487,6 +557,18 @@ const MediaNotFoundPublic = z
|
|
|
487
557
|
})
|
|
488
558
|
.describe("A requested media record does not exist (404).");
|
|
489
559
|
|
|
560
|
+
const MediaForbiddenPublic = z
|
|
561
|
+
.object({
|
|
562
|
+
code: z
|
|
563
|
+
.literal("media/forbidden")
|
|
564
|
+
.describe(
|
|
565
|
+
"The caller may read the media record but not change it: only its owner, acting for the record's organization, or a role holding `media:manage` there may edit, delete or re-scope it.",
|
|
566
|
+
),
|
|
567
|
+
status: z.literal(403).describe("Forbidden."),
|
|
568
|
+
...publicFields,
|
|
569
|
+
})
|
|
570
|
+
.describe("The caller may read the record but not change it (403).");
|
|
571
|
+
|
|
490
572
|
const MediaUnsupportedPublic = z
|
|
491
573
|
.object({
|
|
492
574
|
code: z
|
|
@@ -517,6 +599,30 @@ const MediaEnrichmentFailedPublic = z
|
|
|
517
599
|
})
|
|
518
600
|
.describe("A media AI-enrichment step failed (500).");
|
|
519
601
|
|
|
602
|
+
const MediaAnalyticsWindowPublic = z
|
|
603
|
+
.object({
|
|
604
|
+
code: z
|
|
605
|
+
.literal("media/analytics_window")
|
|
606
|
+
.describe(
|
|
607
|
+
"The requested delivery window reaches past what Cloudflare keeps, or is wider than one read may ask for.",
|
|
608
|
+
),
|
|
609
|
+
status: z.literal(400).describe("Bad Request — narrow the window or move it later."),
|
|
610
|
+
...publicFields,
|
|
611
|
+
})
|
|
612
|
+
.describe("A delivery-analytics window outside Cloudflare's retention or range (400).");
|
|
613
|
+
|
|
614
|
+
const MediaAnalyticsUnavailablePublic = z
|
|
615
|
+
.object({
|
|
616
|
+
code: z
|
|
617
|
+
.literal("media/analytics_unavailable")
|
|
618
|
+
.describe(
|
|
619
|
+
"Cloudflare does not serve the delivery analytics this read needs to this account — a Customer Metadata Boundary outside the US carries none of them.",
|
|
620
|
+
),
|
|
621
|
+
status: z.literal(409).describe("Conflict — the account's configuration rules the read out."),
|
|
622
|
+
...publicFields,
|
|
623
|
+
})
|
|
624
|
+
.describe("Delivery analytics are not served to this account (409).");
|
|
625
|
+
|
|
520
626
|
// --- @pithy-sh/leaderboard: optional ranking capability codes ---
|
|
521
627
|
|
|
522
628
|
const LeaderboardBoardNotFoundPublic = z
|
|
@@ -883,7 +989,7 @@ const StorageNotFoundPublic = z
|
|
|
883
989
|
.object({
|
|
884
990
|
code: z
|
|
885
991
|
.literal("storage/not_found")
|
|
886
|
-
.describe("No object row matches, or the object exists but
|
|
992
|
+
.describe("No object row matches, or the object exists but this caller may not read it."),
|
|
887
993
|
status: z.literal(404).describe("Not Found."),
|
|
888
994
|
...publicFields,
|
|
889
995
|
})
|
|
@@ -891,18 +997,22 @@ const StorageNotFoundPublic = z
|
|
|
891
997
|
|
|
892
998
|
const StorageForbiddenPublic = z
|
|
893
999
|
.object({
|
|
894
|
-
code: z
|
|
1000
|
+
code: z
|
|
1001
|
+
.literal("storage/forbidden")
|
|
1002
|
+
.describe(
|
|
1003
|
+
"The caller may read the object but not change it: only its owner, acting for the object's organization, or a role holding `storage:manage` there may.",
|
|
1004
|
+
),
|
|
895
1005
|
status: z.literal(403).describe("Forbidden."),
|
|
896
1006
|
...publicFields,
|
|
897
1007
|
})
|
|
898
|
-
.describe("The caller
|
|
1008
|
+
.describe("The caller may read the object but not change it (403).");
|
|
899
1009
|
|
|
900
1010
|
const StorageQuotaExceededPublic = z
|
|
901
1011
|
.object({
|
|
902
1012
|
code: z
|
|
903
1013
|
.literal("storage/quota_exceeded")
|
|
904
1014
|
.describe(
|
|
905
|
-
"The declared upload size would push the owner past
|
|
1015
|
+
"The declared upload size would push the owner past the configured `bytesPerOwner` quota. Checked at init against pending and stored rows together, so concurrent inits cannot race past the limit. Where the `storageBytes` meter is enforced, the same refusal is `payments/quota_exceeded` (402).",
|
|
906
1016
|
),
|
|
907
1017
|
status: z.literal(413).describe("Content Too Large."),
|
|
908
1018
|
...publicFields,
|
|
@@ -1209,6 +1319,30 @@ const PaymentsSubscriptionChangeRefusedPublic = z
|
|
|
1209
1319
|
})
|
|
1210
1320
|
.describe("A subscription's state forbids the change asked of it (409).");
|
|
1211
1321
|
|
|
1322
|
+
const PaymentsOverrideStalePublic = z
|
|
1323
|
+
.object({
|
|
1324
|
+
code: z
|
|
1325
|
+
.literal("payments/override_stale")
|
|
1326
|
+
.describe(
|
|
1327
|
+
"A control-plane override write named a version behind the subject's override row. Two operators share one customer: both opened the same allowance, and the second would silently overwrite the first while the first believed they had succeeded. So the write is refused and nothing is written. 409, because the request is well-formed and the same request against the version it now holds would be accepted — the caller re-reads, and tries again.",
|
|
1328
|
+
),
|
|
1329
|
+
status: z.literal(409).describe("Conflict — the override changed since the caller read it."),
|
|
1330
|
+
...publicFields,
|
|
1331
|
+
})
|
|
1332
|
+
.describe("An override write named a stale version (409).");
|
|
1333
|
+
|
|
1334
|
+
const PaymentsQuotaExceededPublic = z
|
|
1335
|
+
.object({
|
|
1336
|
+
code: z
|
|
1337
|
+
.literal("payments/quota_exceeded")
|
|
1338
|
+
.describe(
|
|
1339
|
+
"An enforced kit meter — emails enqueued, bytes stored, media items held — would pass the subject's effective quota for the period. Nothing was written. 402 Payment Required, because it is the honest status: the plan does not allow more and the remedy is a purchase, a bigger tier, or a number pinned for this subject from the control plane. A meter refuses and never bills — the kit does not sell overage.",
|
|
1340
|
+
),
|
|
1341
|
+
status: z.literal(402).describe("Payment Required — the plan's allowance for this period is used up."),
|
|
1342
|
+
...publicFields,
|
|
1343
|
+
})
|
|
1344
|
+
.describe("An enforced meter is at its quota for this period (402).");
|
|
1345
|
+
|
|
1212
1346
|
// --- @pithy-sh/core: the `control-plane` verification strategy ---
|
|
1213
1347
|
//
|
|
1214
1348
|
// NOT Cloudflare's control plane. Everywhere else in this repo "control plane" means the Cloudflare
|
|
@@ -1359,6 +1493,68 @@ const OrganizationNominationInvalidPublic = z
|
|
|
1359
1493
|
})
|
|
1360
1494
|
.describe("No standing ownership offer this caller may accept (400).");
|
|
1361
1495
|
|
|
1496
|
+
// --- @pithy-sh/artifacts: Git repositories, ownership, grants and short-lived tokens ---
|
|
1497
|
+
|
|
1498
|
+
const ArtifactsNotFoundPublic = z
|
|
1499
|
+
.object({
|
|
1500
|
+
code: z
|
|
1501
|
+
.literal("artifacts/not_found")
|
|
1502
|
+
.describe(
|
|
1503
|
+
"No such repository, **or** one the caller holds no grant on and does not own. One code for both, byte for byte: a repository's name is in its clone URL, and a refusal that told the two apart would hand it over. Also what the credential route answers for a repository with remote access off. Which it was survives in `detail`, which the HTTP codec strips.",
|
|
1504
|
+
),
|
|
1505
|
+
status: z.literal(404).describe("Not Found."),
|
|
1506
|
+
...publicFields,
|
|
1507
|
+
})
|
|
1508
|
+
.describe("No such repository, or none this caller may see — the same answer for both (404).");
|
|
1509
|
+
|
|
1510
|
+
const ArtifactsForbiddenPublic = z
|
|
1511
|
+
.object({
|
|
1512
|
+
code: z
|
|
1513
|
+
.literal("artifacts/forbidden")
|
|
1514
|
+
.describe(
|
|
1515
|
+
"The caller can see the repository and may not do this to it: a grant holder asking for what only an owner may do, or a member of an organization whose role lacks the configured `managePower`. A 403 rather than the 404 above, because by then the caller already knows the repository exists.",
|
|
1516
|
+
),
|
|
1517
|
+
status: z.literal(403).describe("Forbidden."),
|
|
1518
|
+
...publicFields,
|
|
1519
|
+
})
|
|
1520
|
+
.describe("The caller may see this repository and may not do this (403).");
|
|
1521
|
+
|
|
1522
|
+
const ArtifactsInvalidNamePublic = z
|
|
1523
|
+
.object({
|
|
1524
|
+
code: z
|
|
1525
|
+
.literal("artifacts/invalid_name")
|
|
1526
|
+
.describe(
|
|
1527
|
+
"A supplied repository name is outside Cloudflare's charset or the 2-to-63 cap. Refused and never shortened: a name somebody chose is in every clone URL, and a silently different one is a repository nobody can find.",
|
|
1528
|
+
),
|
|
1529
|
+
status: z.literal(400).describe("Bad Request."),
|
|
1530
|
+
...publicFields,
|
|
1531
|
+
})
|
|
1532
|
+
.describe("A repository name breaks the naming rule (400).");
|
|
1533
|
+
|
|
1534
|
+
const ArtifactsNameTakenPublic = z
|
|
1535
|
+
.object({
|
|
1536
|
+
code: z
|
|
1537
|
+
.literal("artifacts/name_taken")
|
|
1538
|
+
.describe(
|
|
1539
|
+
"The owner already holds a repository with that display name, or a supplied physical name is already in the namespace. The second happens only where the adopter supplies names, so uniqueness is theirs.",
|
|
1540
|
+
),
|
|
1541
|
+
status: z.literal(409).describe("Conflict."),
|
|
1542
|
+
...publicFields,
|
|
1543
|
+
})
|
|
1544
|
+
.describe("That repository name is already in use (409).");
|
|
1545
|
+
|
|
1546
|
+
const ArtifactsInvalidConfigPublic = z
|
|
1547
|
+
.object({
|
|
1548
|
+
code: z
|
|
1549
|
+
.literal("artifacts/invalid_config")
|
|
1550
|
+
.describe(
|
|
1551
|
+
"The capability's configuration cannot be honored: a `tokenTtlSeconds` above the ceiling, or `organization` composed with no `managePower` named. Raised at boot, so a mistake fails on deploy rather than at the first mint.",
|
|
1552
|
+
),
|
|
1553
|
+
status: z.literal(400).describe("Bad Request — the configuration is malformed."),
|
|
1554
|
+
...publicFields,
|
|
1555
|
+
})
|
|
1556
|
+
.describe("The artifacts configuration is invalid (400).");
|
|
1557
|
+
|
|
1362
1558
|
// --- @pithy-sh/support: inbound inbox, taxonomy, and classification codes ---
|
|
1363
1559
|
|
|
1364
1560
|
const SupportNotFoundPublic = z
|
|
@@ -1555,6 +1751,9 @@ const TestersNotConfiguredPublic = z
|
|
|
1555
1751
|
export const KitPublicErrorPayload = z
|
|
1556
1752
|
.discriminatedUnion("code", [
|
|
1557
1753
|
InvalidInputPublic,
|
|
1754
|
+
InputRequiredPublic,
|
|
1755
|
+
PreconditionFailedPublic,
|
|
1756
|
+
PersonRequiredPublic,
|
|
1558
1757
|
InvalidTokenPublic,
|
|
1559
1758
|
ForbiddenPublic,
|
|
1560
1759
|
AuthProviderUnavailablePublic,
|
|
@@ -1588,12 +1787,17 @@ export const KitPublicErrorPayload = z
|
|
|
1588
1787
|
TurnstileMissingTokenPublic,
|
|
1589
1788
|
TurnstileFailedPublic,
|
|
1590
1789
|
TurnstileConfigPublic,
|
|
1790
|
+
TurnstileAnalyticsWindowPublic,
|
|
1791
|
+
TurnstileAnalyticsUnavailablePublic,
|
|
1591
1792
|
AuditInvalidEventPublic,
|
|
1592
1793
|
AuditWriteFailedPublic,
|
|
1593
1794
|
MediaNotFoundPublic,
|
|
1795
|
+
MediaForbiddenPublic,
|
|
1594
1796
|
MediaUnsupportedPublic,
|
|
1595
1797
|
MediaStorageFailedPublic,
|
|
1596
1798
|
MediaEnrichmentFailedPublic,
|
|
1799
|
+
MediaAnalyticsWindowPublic,
|
|
1800
|
+
MediaAnalyticsUnavailablePublic,
|
|
1597
1801
|
LeaderboardBoardNotFoundPublic,
|
|
1598
1802
|
LeaderboardEntryNotFoundPublic,
|
|
1599
1803
|
LeaderboardScoreRejectedPublic,
|
|
@@ -1656,6 +1860,8 @@ export const KitPublicErrorPayload = z
|
|
|
1656
1860
|
PaymentsEntitlementNotInCatalogPublic,
|
|
1657
1861
|
PaymentsSubjectUnresolvedPublic,
|
|
1658
1862
|
PaymentsSubscriptionChangeRefusedPublic,
|
|
1863
|
+
PaymentsOverrideStalePublic,
|
|
1864
|
+
PaymentsQuotaExceededPublic,
|
|
1659
1865
|
ControlPlaneNotConnectedPublic,
|
|
1660
1866
|
ControlPlaneInvalidCredentialPublic,
|
|
1661
1867
|
ControlPlaneInsufficientScopePublic,
|
|
@@ -1668,6 +1874,11 @@ export const KitPublicErrorPayload = z
|
|
|
1668
1874
|
OrganizationLastAdministratorPublic,
|
|
1669
1875
|
OrganizationSlugTakenPublic,
|
|
1670
1876
|
OrganizationNominationInvalidPublic,
|
|
1877
|
+
ArtifactsNotFoundPublic,
|
|
1878
|
+
ArtifactsForbiddenPublic,
|
|
1879
|
+
ArtifactsInvalidNamePublic,
|
|
1880
|
+
ArtifactsNameTakenPublic,
|
|
1881
|
+
ArtifactsInvalidConfigPublic,
|
|
1671
1882
|
SupportNotFoundPublic,
|
|
1672
1883
|
SupportInvalidCategoryPublic,
|
|
1673
1884
|
SupportUnparseableMessagePublic,
|
|
@@ -1690,6 +1901,11 @@ export const KitPublicErrorPayload = z
|
|
|
1690
1901
|
// The full members: each public member plus the operator-only `action` and `detail`. Built as explicit consts
|
|
1691
1902
|
// (not mapped) so the `code`-literal discriminated-union types survive for `Extract` narrowing.
|
|
1692
1903
|
const InvalidInput = InvalidInputPublic.extend(internalFields).describe(InvalidInputPublic.description ?? "");
|
|
1904
|
+
const InputRequired = InputRequiredPublic.extend(internalFields).describe(InputRequiredPublic.description ?? "");
|
|
1905
|
+
const PreconditionFailed = PreconditionFailedPublic.extend(internalFields).describe(
|
|
1906
|
+
PreconditionFailedPublic.description ?? "",
|
|
1907
|
+
);
|
|
1908
|
+
const PersonRequired = PersonRequiredPublic.extend(internalFields).describe(PersonRequiredPublic.description ?? "");
|
|
1693
1909
|
const InvalidToken = InvalidTokenPublic.extend(internalFields).describe(InvalidTokenPublic.description ?? "");
|
|
1694
1910
|
const Forbidden = ForbiddenPublic.extend(internalFields).describe(ForbiddenPublic.description ?? "");
|
|
1695
1911
|
const AuthProviderUnavailable = AuthProviderUnavailablePublic.extend(internalFields).describe(
|
|
@@ -1759,6 +1975,12 @@ const TurnstileMissingToken = TurnstileMissingTokenPublic.extend(internalFields)
|
|
|
1759
1975
|
);
|
|
1760
1976
|
const TurnstileFailed = TurnstileFailedPublic.extend(internalFields).describe(TurnstileFailedPublic.description ?? "");
|
|
1761
1977
|
const TurnstileConfig = TurnstileConfigPublic.extend(internalFields).describe(TurnstileConfigPublic.description ?? "");
|
|
1978
|
+
const TurnstileAnalyticsWindow = TurnstileAnalyticsWindowPublic.extend(internalFields).describe(
|
|
1979
|
+
TurnstileAnalyticsWindowPublic.description ?? "",
|
|
1980
|
+
);
|
|
1981
|
+
const TurnstileAnalyticsUnavailable = TurnstileAnalyticsUnavailablePublic.extend(internalFields).describe(
|
|
1982
|
+
TurnstileAnalyticsUnavailablePublic.description ?? "",
|
|
1983
|
+
);
|
|
1762
1984
|
const AuditInvalidEvent = AuditInvalidEventPublic.extend(internalFields).describe(
|
|
1763
1985
|
AuditInvalidEventPublic.description ?? "",
|
|
1764
1986
|
);
|
|
@@ -1766,6 +1988,7 @@ const AuditWriteFailed = AuditWriteFailedPublic.extend(internalFields).describe(
|
|
|
1766
1988
|
AuditWriteFailedPublic.description ?? "",
|
|
1767
1989
|
);
|
|
1768
1990
|
const MediaNotFound = MediaNotFoundPublic.extend(internalFields).describe(MediaNotFoundPublic.description ?? "");
|
|
1991
|
+
const MediaForbidden = MediaForbiddenPublic.extend(internalFields).describe(MediaForbiddenPublic.description ?? "");
|
|
1769
1992
|
const MediaUnsupported = MediaUnsupportedPublic.extend(internalFields).describe(
|
|
1770
1993
|
MediaUnsupportedPublic.description ?? "",
|
|
1771
1994
|
);
|
|
@@ -1775,6 +1998,12 @@ const MediaStorageFailed = MediaStorageFailedPublic.extend(internalFields).descr
|
|
|
1775
1998
|
const MediaEnrichmentFailed = MediaEnrichmentFailedPublic.extend(internalFields).describe(
|
|
1776
1999
|
MediaEnrichmentFailedPublic.description ?? "",
|
|
1777
2000
|
);
|
|
2001
|
+
const MediaAnalyticsWindow = MediaAnalyticsWindowPublic.extend(internalFields).describe(
|
|
2002
|
+
MediaAnalyticsWindowPublic.description ?? "",
|
|
2003
|
+
);
|
|
2004
|
+
const MediaAnalyticsUnavailable = MediaAnalyticsUnavailablePublic.extend(internalFields).describe(
|
|
2005
|
+
MediaAnalyticsUnavailablePublic.description ?? "",
|
|
2006
|
+
);
|
|
1778
2007
|
const LeaderboardBoardNotFound = LeaderboardBoardNotFoundPublic.extend(internalFields).describe(
|
|
1779
2008
|
LeaderboardBoardNotFoundPublic.description ?? "",
|
|
1780
2009
|
);
|
|
@@ -1960,6 +2189,12 @@ const PaymentsSubjectUnresolved = PaymentsSubjectUnresolvedPublic.extend(interna
|
|
|
1960
2189
|
const PaymentsSubscriptionChangeRefused = PaymentsSubscriptionChangeRefusedPublic.extend(internalFields).describe(
|
|
1961
2190
|
PaymentsSubscriptionChangeRefusedPublic.description ?? "",
|
|
1962
2191
|
);
|
|
2192
|
+
const PaymentsOverrideStale = PaymentsOverrideStalePublic.extend(internalFields).describe(
|
|
2193
|
+
PaymentsOverrideStalePublic.description ?? "",
|
|
2194
|
+
);
|
|
2195
|
+
const PaymentsQuotaExceeded = PaymentsQuotaExceededPublic.extend(internalFields).describe(
|
|
2196
|
+
PaymentsQuotaExceededPublic.description ?? "",
|
|
2197
|
+
);
|
|
1963
2198
|
const ControlPlaneNotConnected = ControlPlaneNotConnectedPublic.extend(internalFields).describe(
|
|
1964
2199
|
ControlPlaneNotConnectedPublic.description ?? "",
|
|
1965
2200
|
);
|
|
@@ -2030,6 +2265,22 @@ const OrganizationNominationInvalid = OrganizationNominationInvalidPublic.extend
|
|
|
2030
2265
|
OrganizationNominationInvalidPublic.description ?? "",
|
|
2031
2266
|
);
|
|
2032
2267
|
|
|
2268
|
+
const ArtifactsNotFound = ArtifactsNotFoundPublic.extend(internalFields).describe(
|
|
2269
|
+
ArtifactsNotFoundPublic.description ?? "",
|
|
2270
|
+
);
|
|
2271
|
+
const ArtifactsForbidden = ArtifactsForbiddenPublic.extend(internalFields).describe(
|
|
2272
|
+
ArtifactsForbiddenPublic.description ?? "",
|
|
2273
|
+
);
|
|
2274
|
+
const ArtifactsInvalidName = ArtifactsInvalidNamePublic.extend(internalFields).describe(
|
|
2275
|
+
ArtifactsInvalidNamePublic.description ?? "",
|
|
2276
|
+
);
|
|
2277
|
+
const ArtifactsNameTaken = ArtifactsNameTakenPublic.extend(internalFields).describe(
|
|
2278
|
+
ArtifactsNameTakenPublic.description ?? "",
|
|
2279
|
+
);
|
|
2280
|
+
const ArtifactsInvalidConfig = ArtifactsInvalidConfigPublic.extend(internalFields).describe(
|
|
2281
|
+
ArtifactsInvalidConfigPublic.description ?? "",
|
|
2282
|
+
);
|
|
2283
|
+
|
|
2033
2284
|
const SupportNotFound = SupportNotFoundPublic.extend(internalFields).describe(SupportNotFoundPublic.description ?? "");
|
|
2034
2285
|
const SupportInvalidCategory = SupportInvalidCategoryPublic.extend(internalFields).describe(
|
|
2035
2286
|
SupportInvalidCategoryPublic.description ?? "",
|
|
@@ -2053,6 +2304,9 @@ const SupportReplyFailed = SupportReplyFailedPublic.extend(internalFields).descr
|
|
|
2053
2304
|
export const KitErrorPayload = z
|
|
2054
2305
|
.discriminatedUnion("code", [
|
|
2055
2306
|
InvalidInput,
|
|
2307
|
+
InputRequired,
|
|
2308
|
+
PreconditionFailed,
|
|
2309
|
+
PersonRequired,
|
|
2056
2310
|
InvalidToken,
|
|
2057
2311
|
Forbidden,
|
|
2058
2312
|
AuthProviderUnavailable,
|
|
@@ -2086,12 +2340,17 @@ export const KitErrorPayload = z
|
|
|
2086
2340
|
TurnstileMissingToken,
|
|
2087
2341
|
TurnstileFailed,
|
|
2088
2342
|
TurnstileConfig,
|
|
2343
|
+
TurnstileAnalyticsWindow,
|
|
2344
|
+
TurnstileAnalyticsUnavailable,
|
|
2089
2345
|
AuditInvalidEvent,
|
|
2090
2346
|
AuditWriteFailed,
|
|
2091
2347
|
MediaNotFound,
|
|
2348
|
+
MediaForbidden,
|
|
2092
2349
|
MediaUnsupported,
|
|
2093
2350
|
MediaStorageFailed,
|
|
2094
2351
|
MediaEnrichmentFailed,
|
|
2352
|
+
MediaAnalyticsWindow,
|
|
2353
|
+
MediaAnalyticsUnavailable,
|
|
2095
2354
|
LeaderboardBoardNotFound,
|
|
2096
2355
|
LeaderboardEntryNotFound,
|
|
2097
2356
|
LeaderboardScoreRejected,
|
|
@@ -2154,6 +2413,8 @@ export const KitErrorPayload = z
|
|
|
2154
2413
|
PaymentsEntitlementNotInCatalog,
|
|
2155
2414
|
PaymentsSubjectUnresolved,
|
|
2156
2415
|
PaymentsSubscriptionChangeRefused,
|
|
2416
|
+
PaymentsOverrideStale,
|
|
2417
|
+
PaymentsQuotaExceeded,
|
|
2157
2418
|
ControlPlaneNotConnected,
|
|
2158
2419
|
ControlPlaneInvalidCredential,
|
|
2159
2420
|
ControlPlaneInsufficientScope,
|
|
@@ -2166,6 +2427,11 @@ export const KitErrorPayload = z
|
|
|
2166
2427
|
OrganizationLastAdministrator,
|
|
2167
2428
|
OrganizationSlugTaken,
|
|
2168
2429
|
OrganizationNominationInvalid,
|
|
2430
|
+
ArtifactsNotFound,
|
|
2431
|
+
ArtifactsForbidden,
|
|
2432
|
+
ArtifactsInvalidName,
|
|
2433
|
+
ArtifactsNameTaken,
|
|
2434
|
+
ArtifactsInvalidConfig,
|
|
2169
2435
|
SupportNotFound,
|
|
2170
2436
|
SupportInvalidCategory,
|
|
2171
2437
|
SupportUnparseableMessage,
|
package/src/error/pithyError.ts
CHANGED
|
@@ -61,6 +61,82 @@ export class ValidationError extends PithyError {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* A run that may not prompt reached a question nobody gave it the answer to (#697).
|
|
66
|
+
*
|
|
67
|
+
* `flag` is the flag that answers it, or `null` when no flag can — a person, or a document on stdin, is
|
|
68
|
+
* the only answer. `choices` is every value the flag takes when that set is known, and is left off the
|
|
69
|
+
* payload rather than written empty when it is not: an empty list would claim the flag takes nothing.
|
|
70
|
+
*/
|
|
71
|
+
export class InputRequiredError extends PithyError {
|
|
72
|
+
declare readonly payload: Extract<ErrorPayload, { code: "input/required" }>;
|
|
73
|
+
|
|
74
|
+
constructor(
|
|
75
|
+
args: ErrorArgs & { flag?: string | null; choices?: readonly string[] } = {},
|
|
76
|
+
options?: { cause?: unknown },
|
|
77
|
+
) {
|
|
78
|
+
super(
|
|
79
|
+
{
|
|
80
|
+
code: "input/required",
|
|
81
|
+
status: 400,
|
|
82
|
+
message: args.message ?? "An answer is required, and this run may not ask for it.",
|
|
83
|
+
action: args.action,
|
|
84
|
+
detail: args.detail,
|
|
85
|
+
params: args.params,
|
|
86
|
+
flag: args.flag ?? null,
|
|
87
|
+
...(args.choices === undefined ? {} : { choices: [...args.choices] }),
|
|
88
|
+
},
|
|
89
|
+
options,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The call is well formed, and what it depends on is not there yet (#697): no credentials, an environment
|
|
96
|
+
* nothing has provisioned. A separate class from {@link ValidationError} because the remedy is a step to
|
|
97
|
+
* run first, not a different call — the CLI exits 3 for it and 2 for a validation failure.
|
|
98
|
+
*/
|
|
99
|
+
export class PreconditionFailedError extends PithyError {
|
|
100
|
+
declare readonly payload: Extract<ErrorPayload, { code: "core/precondition_failed" }>;
|
|
101
|
+
|
|
102
|
+
constructor(args: ErrorArgs = {}, options?: { cause?: unknown }) {
|
|
103
|
+
super(
|
|
104
|
+
{
|
|
105
|
+
code: "core/precondition_failed",
|
|
106
|
+
status: 412,
|
|
107
|
+
message: args.message ?? "Something this needs is not set up yet.",
|
|
108
|
+
action: args.action,
|
|
109
|
+
detail: args.detail,
|
|
110
|
+
params: args.params,
|
|
111
|
+
},
|
|
112
|
+
options,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* A step only a person may take (#697): a typed confirmation phrase, or a command that is manual by
|
|
119
|
+
* design. Not {@link InputRequiredError}, which names a flag an automated caller can pass — here no value
|
|
120
|
+
* a caller could choose is the right answer, and the CLI exits 5 so an agent stops and asks.
|
|
121
|
+
*/
|
|
122
|
+
export class PersonRequiredError extends PithyError {
|
|
123
|
+
declare readonly payload: Extract<ErrorPayload, { code: "core/person_required" }>;
|
|
124
|
+
|
|
125
|
+
constructor(args: ErrorArgs = {}, options?: { cause?: unknown }) {
|
|
126
|
+
super(
|
|
127
|
+
{
|
|
128
|
+
code: "core/person_required",
|
|
129
|
+
status: 403,
|
|
130
|
+
message: args.message ?? "Only a person may take this step.",
|
|
131
|
+
action: args.action,
|
|
132
|
+
detail: args.detail,
|
|
133
|
+
params: args.params,
|
|
134
|
+
},
|
|
135
|
+
options,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
64
140
|
export class UnauthorizedError extends PithyError {
|
|
65
141
|
declare readonly payload: Extract<ErrorPayload, { code: "auth/invalid_token" }>;
|
|
66
142
|
|