@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { Ed25519PublicJwk } from "../data/connection.js";
|
|
3
|
+
import { ConnectionPrincipal, ConnectionPurpose, ControlPlaneActorKind, Ed25519PublicJwk } from "../data/connection.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/controlPlane/http/responses.ts
|
|
6
6
|
/**
|
|
@@ -47,8 +47,11 @@ const ControlPlanePingResponse = z.object({
|
|
|
47
47
|
const ControlPlaneKeysResponse = z.object({
|
|
48
48
|
connectionId: z.string().describe("The connection these keys belong to."),
|
|
49
49
|
environment: z.string().describe("The environment that connection is bound to."),
|
|
50
|
-
keys: z.array(PublicKeyView).describe("Every registered key, expired and revoked ones included.")
|
|
51
|
-
|
|
50
|
+
keys: z.array(PublicKeyView).describe("Every registered key, expired and revoked ones included."),
|
|
51
|
+
authorizedBy: ConnectionPrincipal.nullable().optional().describe("Who sanctioned this connection — the signed-in session's email at registration. Null for a connection registered before principals were recorded; absent from a Worker older than the field."),
|
|
52
|
+
actorKind: ControlPlaneActorKind.nullable().optional().describe("What kind of client this connection is for: `agent`, `dashboard` or `script`. Null for a connection registered before it was recorded; absent from an older Worker."),
|
|
53
|
+
purpose: ConnectionPurpose.nullable().optional().describe("What the client is for, in the registering operator's words. Untrusted text: render it escaped. Null for a connection registered before it was recorded; absent from an older Worker.")
|
|
54
|
+
}).describe("Every key registered against this connection, with its window, and who authorized it for what.");
|
|
52
55
|
/** `POST /control-plane/keys` — the appended key, and the set as it now stands. */
|
|
53
56
|
const RegisterKeyResponse = z.object({
|
|
54
57
|
keyId: z.string().describe("The key just registered."),
|
|
@@ -61,5 +64,59 @@ const ExpireKeyResponse = z.object({
|
|
|
61
64
|
validUntil: z.iso.datetime().describe("When its window closed, ISO-8601 — now, by construction."),
|
|
62
65
|
keys: z.array(PublicKeyView).describe("The connection's keys after the expiry.")
|
|
63
66
|
}).describe("The expired key, and the set it left behind.");
|
|
67
|
+
/**
|
|
68
|
+
* One migration as `GET {basePath}/migrations` reports it: its composed name, and whose it is.
|
|
69
|
+
*
|
|
70
|
+
* The namespace is a capability's name, which the manifest already reports in `capabilities[]`. So a
|
|
71
|
+
* client tells an adopter's own migrations from a composed capability's by comparing the two — no
|
|
72
|
+
* convention, and no list kept anywhere.
|
|
73
|
+
*/
|
|
74
|
+
const MigrationView = z.object({
|
|
75
|
+
name: z.string().describe("The composed migration name, exactly as the ledger records it: `0250_audit_0001_init`."),
|
|
76
|
+
namespace: z.string().nullable().describe("The capability this migration belongs to — its name, as `capabilities[]` in the manifest reports it. Null only for an undeclared migration whose name no Pithy registry could have composed.")
|
|
77
|
+
}).describe("One migration, and the capability namespace it belongs to.");
|
|
78
|
+
/** Whether the last group is still reversible by name, or what is in its way. */
|
|
79
|
+
const MigrationGroupPositionView = z.discriminatedUnion("state", [z.object({ state: z.literal("top").describe("The group's migrations are the contiguous tip of this database's chain. Not a promise that `pithy migrate --rollback --group <value>` runs: the CLI also refuses an undeclared migration in the ledger, and keeps back or refuses a database another environment binds.") }).describe("A group nothing on this database's ledger sits over."), z.object({
|
|
80
|
+
state: z.literal("buried").describe("Something sits over the group or inside it, so reversing it by name is refused."),
|
|
81
|
+
above: z.array(z.string()).describe("The groups in the way, newest first."),
|
|
82
|
+
ungrouped: z.array(MigrationView).describe("The migrations in the way that no group claims, newest first. Nothing can be reversed by group while one of them is at the tip.")
|
|
83
|
+
}).describe("A group with something in its way, and what that is.")]).describe("Where the last group sits in this database's chain: the top, or buried under named things.");
|
|
84
|
+
/** The run that last moved a database, and whether it can still be taken back. */
|
|
85
|
+
const MigrationGroupView = z.object({
|
|
86
|
+
group: z.string().describe("The group's value: the `--group` the run was given, or the ISO-8601 timestamp it generated."),
|
|
87
|
+
appliedAt: z.iso.datetime().describe("When this group last applied something here, ISO-8601."),
|
|
88
|
+
migrations: z.array(MigrationView).describe("What this group applied in this database and is still applied, in application order."),
|
|
89
|
+
position: MigrationGroupPositionView.describe("Whether the group is the top of the chain, or what is in its way.")
|
|
90
|
+
}).describe("The newest group with anything still applied in this database.");
|
|
91
|
+
/**
|
|
92
|
+
* One database this Worker binds, read or not.
|
|
93
|
+
*
|
|
94
|
+
* **An unreadable database carries no list at all**, never empty ones. `pending: []` reads as up to date,
|
|
95
|
+
* and a database nobody read is not that. The state is on the value, so a client reaches a list only by
|
|
96
|
+
* narrowing.
|
|
97
|
+
*/
|
|
98
|
+
const MigrationDatabaseView = z.discriminatedUnion("state", [z.object({
|
|
99
|
+
state: z.literal("readable").describe("This database's ledger was read."),
|
|
100
|
+
database: z.string().describe("The database name, as capabilities declare it in `databases`."),
|
|
101
|
+
binding: z.string().describe("The D1 binding it is read through, as `wrangler.jsonc` declares it."),
|
|
102
|
+
applied: z.array(MigrationView).describe("Every applied migration, in the order the ledger applied them."),
|
|
103
|
+
pending: z.array(MigrationView).describe("Declared by this build and not applied here, in the order they would run."),
|
|
104
|
+
undeclared: z.array(MigrationView).describe("Applied here and not declared by this Worker, sorted. Relative to this Worker: a database shared with another Worker lists that Worker's migrations here. Otherwise Kysely reads one as a corrupted chain and applies nothing."),
|
|
105
|
+
lastGroup: MigrationGroupView.nullable().describe("The newest group with anything applied here, or null when nothing applied here was ever grouped.")
|
|
106
|
+
}).describe("A database whose ledger was read."), z.object({
|
|
107
|
+
state: z.literal("unreadable").describe("This database's ledger could not be read on this call."),
|
|
108
|
+
database: z.string().describe("The database name, as capabilities declare it in `databases`."),
|
|
109
|
+
binding: z.string().describe("The D1 binding it would be read through.")
|
|
110
|
+
}).describe("A database that could not be read. No lists, so nothing about it reads as zero. The other databases still answer.")]).describe("One database this Worker binds: its migration state, or the fact that it could not be read.");
|
|
111
|
+
/**
|
|
112
|
+
* `GET /control-plane/migrations` — where every database this Worker binds stands.
|
|
113
|
+
*
|
|
114
|
+
* Asked of the Worker because the Worker *is* the deployed build. `pithy doctor` reads the project on disk,
|
|
115
|
+
* which is what the operator has and not necessarily what is deployed.
|
|
116
|
+
*/
|
|
117
|
+
const ControlPlaneMigrationsResponse = z.object({
|
|
118
|
+
environment: z.string().describe("The environment this Worker answers for."),
|
|
119
|
+
databases: z.array(MigrationDatabaseView).describe("One entry per database this Worker binds, sorted by database name. One unreadable costs only itself.")
|
|
120
|
+
}).describe("What is applied, pending and undeclared in each bound database, and which run put it there.");
|
|
64
121
|
//#endregion
|
|
65
|
-
export { ControlPlaneKeysResponse, ControlPlanePingResponse, ExpireKeyResponse, PublicKeyView, RegisterKeyResponse };
|
|
122
|
+
export { ControlPlaneKeysResponse, ControlPlaneMigrationsResponse, ControlPlanePingResponse, ExpireKeyResponse, MigrationDatabaseView, MigrationGroupPositionView, MigrationGroupView, MigrationView, PublicKeyView, RegisterKeyResponse };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type { Hono } from "hono";
|
|
4
4
|
import type { PithyHonoEnv } from "../../capability/capability";
|
|
5
|
-
import type
|
|
5
|
+
import { type AdminRoute } from "../discovery/adminRoute";
|
|
6
6
|
import { type ControlPlaneHandlerDeps } from "./handlers";
|
|
7
7
|
/**
|
|
8
8
|
* The seam's own routes, distinct from the admin routes capabilities contribute.
|
|
@@ -12,6 +12,7 @@ import { type ControlPlaneHandlerDeps } from "./handlers";
|
|
|
12
12
|
* GET /control-plane/keys → the registration state (keys:rotate)
|
|
13
13
|
* POST /control-plane/keys → register a key (keys:rotate)
|
|
14
14
|
* POST /control-plane/keys/:keyId/expire → retire a superseded key (keys:rotate)
|
|
15
|
+
* GET /control-plane/migrations → where each database stands (migrations:read)
|
|
15
16
|
*
|
|
16
17
|
* Every one is `control-plane` and default-denied — with no connection registered they all answer 403,
|
|
17
18
|
* and that is the shipped state of a Worker nobody has connected.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/http/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,yBAAyB,CAAC;AAGhF,OAAO,EACL,KAAK,uBAAuB,EAO7B,MAAM,YAAY,CAAC;AAUpB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAwC3E;AAED,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,EACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,uBAAuB,GAC5B,IAAI,CA6EN"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { ANY_VERIFIED_CALLER, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE } from "../scope/scope.js";
|
|
3
|
+
import { ANY_VERIFIED_CALLER, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE } from "../scope/scope.js";
|
|
4
4
|
import { requireControlPlane } from "./guard.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { describeRoute } from "../../http/routeSpec.js";
|
|
6
|
+
import { validate } from "../../http/validation.js";
|
|
7
|
+
import { ControlPlaneManifest } from "../discovery/adminRoute.js";
|
|
8
|
+
import { expireKeyHandler, listKeysHandler, manifestHandler, migrationsHandler, pingHandler, registerKeyHandler } from "./handlers.js";
|
|
9
|
+
import { ControlPlaneKeysResponse, ControlPlaneMigrationsResponse, ControlPlanePingResponse, ExpireKeyResponse, RegisterKeyResponse } from "./responses.js";
|
|
7
10
|
import { ExpireKeyParams, ExpireKeyRequest, RegisterKeyRequest } from "./schemas.js";
|
|
8
|
-
import { zValidator } from "@hono/zod-validator";
|
|
9
11
|
//#region src/controlPlane/http/routes.ts
|
|
10
12
|
/**
|
|
11
13
|
* The seam's own routes, distinct from the admin routes capabilities contribute.
|
|
@@ -15,6 +17,7 @@ import { zValidator } from "@hono/zod-validator";
|
|
|
15
17
|
* GET /control-plane/keys → the registration state (keys:rotate)
|
|
16
18
|
* POST /control-plane/keys → register a key (keys:rotate)
|
|
17
19
|
* POST /control-plane/keys/:keyId/expire → retire a superseded key (keys:rotate)
|
|
20
|
+
* GET /control-plane/migrations → where each database stands (migrations:read)
|
|
18
21
|
*
|
|
19
22
|
* Every one is `control-plane` and default-denied — with no connection registered they all answer 403,
|
|
20
23
|
* and that is the shipped state of a Worker nobody has connected.
|
|
@@ -71,15 +74,53 @@ function controlPlaneRouteDescriptors(basePath) {
|
|
|
71
74
|
path: `${basePath}/keys/:keyId/expire`,
|
|
72
75
|
scope: KEYS_ROTATE_SCOPE,
|
|
73
76
|
summary: "Retire a superseded key. Must be signed with the successor it names as proven."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
method: "GET",
|
|
80
|
+
path: `${basePath}/migrations`,
|
|
81
|
+
scope: MIGRATIONS_READ_SCOPE,
|
|
82
|
+
summary: "What each bound database has applied, what is pending, what is undeclared, and which run put it there. Undeclared is relative to this Worker."
|
|
74
83
|
}
|
|
75
84
|
];
|
|
76
85
|
}
|
|
77
86
|
function registerControlPlaneRoutes(app, basePath, deps) {
|
|
78
|
-
app.get(`${basePath}/ping`,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
app.get(`${basePath}/ping`, describeRoute({
|
|
88
|
+
summary: "Prove the connection and the key it signs with.",
|
|
89
|
+
verification: "control-plane",
|
|
90
|
+
responses: { 200: ControlPlanePingResponse }
|
|
91
|
+
}), requireControlPlane(ANY_VERIFIED_CALLER), pingHandler(deps));
|
|
92
|
+
app.get(`${basePath}/manifest`, describeRoute({
|
|
93
|
+
summary: "Describe what this Worker composes and how to call its admin surface.",
|
|
94
|
+
verification: "control-plane",
|
|
95
|
+
scopes: [MANIFEST_READ_SCOPE],
|
|
96
|
+
responses: { 200: ControlPlaneManifest }
|
|
97
|
+
}), requireControlPlane(MANIFEST_READ_SCOPE), manifestHandler(deps));
|
|
98
|
+
app.get(`${basePath}/keys`, describeRoute({
|
|
99
|
+
summary: "Read the connection's key registration state.",
|
|
100
|
+
verification: "control-plane",
|
|
101
|
+
scopes: [KEYS_ROTATE_SCOPE],
|
|
102
|
+
responses: { 200: ControlPlaneKeysResponse }
|
|
103
|
+
}), requireControlPlane(KEYS_ROTATE_SCOPE), listKeysHandler(deps));
|
|
104
|
+
app.post(`${basePath}/keys`, describeRoute({
|
|
105
|
+
summary: "Register a key for the connection.",
|
|
106
|
+
verification: "control-plane",
|
|
107
|
+
scopes: [KEYS_ROTATE_SCOPE],
|
|
108
|
+
responses: { 201: RegisterKeyResponse }
|
|
109
|
+
}), requireControlPlane(KEYS_ROTATE_SCOPE), validate("json", RegisterKeyRequest), (c) => registerKeyHandler(deps)(c, c.req.valid("json")));
|
|
110
|
+
app.post(`${basePath}/keys/:keyId/expire`, describeRoute({
|
|
111
|
+
summary: "Retire a superseded key.",
|
|
112
|
+
description: "Must be signed with the successor it names as proven.",
|
|
113
|
+
verification: "control-plane",
|
|
114
|
+
scopes: [KEYS_ROTATE_SCOPE],
|
|
115
|
+
responses: { 200: ExpireKeyResponse }
|
|
116
|
+
}), requireControlPlane(KEYS_ROTATE_SCOPE), validate("param", ExpireKeyParams), validate("json", ExpireKeyRequest), (c) => expireKeyHandler(deps)(c, c.req.valid("param"), c.req.valid("json")));
|
|
117
|
+
app.get(`${basePath}/migrations`, describeRoute({
|
|
118
|
+
summary: "Report where each database this Worker binds stands.",
|
|
119
|
+
description: "Applied, pending and undeclared migrations per database, each naming its namespace, and the last group with whether it is still reversible. Undeclared is relative to this Worker: a database shared with another Worker lists that Worker's migrations there. Read-only.",
|
|
120
|
+
verification: "control-plane",
|
|
121
|
+
scopes: [MIGRATIONS_READ_SCOPE],
|
|
122
|
+
responses: { 200: ControlPlaneMigrationsResponse }
|
|
123
|
+
}), requireControlPlane(MIGRATIONS_READ_SCOPE), migrationsHandler(deps));
|
|
83
124
|
}
|
|
84
125
|
//#endregion
|
|
85
126
|
export { controlPlaneRouteDescriptors, registerControlPlaneRoutes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/http/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,uBAAuB,EAAe,MAAM,gBAAgB,CAAC;AAI3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;GASG;AACH,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE7E,0GAA0G;AAC1G,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IACjF;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,sCAAsC;IACtC,MAAM,EAAE,WAAW,CAAC;IACpB,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,EAAE,UAAU,CAAC;IACjB,4EAA4E;IAC5E,WAAW,EAAE,uBAAuB,CAAC;CACtC;AAOD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/http/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,uBAAuB,EAAe,MAAM,gBAAgB,CAAC;AAI3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;GASG;AACH,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE7E,0GAA0G;AAC1G,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IACjF;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,sCAAsC;IACtC,MAAM,EAAE,WAAW,CAAC;IACpB,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,EAAE,UAAU,CAAC;IACjB,4EAA4E;IAC5E,WAAW,EAAE,uBAAuB,CAAC;CACtC;AAOD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA6E9B"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import type { MigrationProvider } from "kysely/migration";
|
|
4
|
+
import type { Capability } from "../../capability/capability";
|
|
5
|
+
import type { HealthSummary } from "../discovery/healthSummary";
|
|
6
|
+
import type { MigrationDatabaseView, MigrationView } from "../http/responses";
|
|
7
|
+
/**
|
|
8
|
+
* **Migration state over the control plane (#729).**
|
|
9
|
+
*
|
|
10
|
+
* A management client could not answer what is applied where, or whether a deploy left something behind:
|
|
11
|
+
* the seam registered a ping, the manifest and key rotation, and not one field of it was about a database.
|
|
12
|
+
* The read already existed — {@link readMigrationLedger} answers both directions — and it needs a D1
|
|
13
|
+
* binding and the composed provider in one process. **The Worker is the only thing holding both**, and it
|
|
14
|
+
* is the deployed build, so asked from its side the answer cannot be stale the way the project on disk is.
|
|
15
|
+
*
|
|
16
|
+
* Two halves. At assembly, {@link composeMigrationDatabases} builds what this Worker declares per bound
|
|
17
|
+
* database, through `collectMigrationSets` — the function `pithy migrate` composes with, so the route and
|
|
18
|
+
* `pithy doctor` compose the same way. Not always from the same inputs: on a D1 two Workers share, the CLI
|
|
19
|
+
* merges both Workers' sets and the route holds only its own, so `pending` and `undeclared` can differ
|
|
20
|
+
* there. On a database one Worker binds alone they agree. Per request, {@link readDatabaseMigrations} reads
|
|
21
|
+
* one database for the route and {@link readMigrationHealth} totals all of them for the manifest.
|
|
22
|
+
*
|
|
23
|
+
* **Read-only.** Nothing here runs, reverses or resets a migration. A screen somebody opened to ask must
|
|
24
|
+
* not hand them the thing that changes the schema.
|
|
25
|
+
*
|
|
26
|
+
* **`undeclared` is relative to this Worker.** Two Workers can be bound to one physical D1, and the CLI
|
|
27
|
+
* composes across all of them. A Worker composes only its own capabilities and cannot learn a co-bound
|
|
28
|
+
* Worker's, so from inside one, every migration the other shipped to the shared database reads as
|
|
29
|
+
* undeclared. That is why `undeclaredMigrations` grades nothing.
|
|
30
|
+
*/
|
|
31
|
+
/** One database this Worker binds, with what this build declares for it. Built once, at assembly. */
|
|
32
|
+
export interface ComposedMigrationDatabase {
|
|
33
|
+
/** The database name, as capabilities declare it in `databases`. */
|
|
34
|
+
database: string;
|
|
35
|
+
/** The D1 binding it is read through. */
|
|
36
|
+
binding: string;
|
|
37
|
+
/** Every migration this build declares for it — empty for a database bound with none. */
|
|
38
|
+
provider: MigrationProvider;
|
|
39
|
+
/** Each declared migration's namespace, known from the set it came from. */
|
|
40
|
+
namespaces: ReadonlyMap<string, string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Every database this Worker binds, with the provider this build composes for it, sorted by name.
|
|
44
|
+
*
|
|
45
|
+
* One entry per database `composeDatabases` maps to a binding — the same map the request registry is built
|
|
46
|
+
* from — so a database bound with no migrations is still reported. Leaving it out would read as not bound.
|
|
47
|
+
*/
|
|
48
|
+
export declare function composeMigrationDatabases(capabilities: readonly Capability[]): ComposedMigrationDatabase[];
|
|
49
|
+
/**
|
|
50
|
+
* One migration as the route reports it.
|
|
51
|
+
*
|
|
52
|
+
* A declared migration's namespace comes from the set it was declared in. An undeclared one has only its
|
|
53
|
+
* key, so it is decomposed — and a key no registry composed answers null rather than a guess.
|
|
54
|
+
*/
|
|
55
|
+
export declare function migrationView(name: string, namespaces: ReadonlyMap<string, string>): MigrationView;
|
|
56
|
+
/**
|
|
57
|
+
* Read one database's migration state for the route.
|
|
58
|
+
*
|
|
59
|
+
* **A database that cannot be read is `unreadable`, and costs only itself.** The cause goes to
|
|
60
|
+
* `onUnreadable` — the route logs it, where the operator's context stays the operator's — and never into
|
|
61
|
+
* the view: a D1 error can name a table or a query, and the view crosses to a management client.
|
|
62
|
+
*/
|
|
63
|
+
export declare function readDatabaseMigrations(env: Record<string, unknown>, entry: ComposedMigrationDatabase, onUnreadable?: (entry: ComposedMigrationDatabase, cause: unknown) => void): Promise<MigrationDatabaseView>;
|
|
64
|
+
/**
|
|
65
|
+
* The two health keys the seam contributes to its own manifest entry.
|
|
66
|
+
*
|
|
67
|
+
* Both `indexed`: one small select per bound database, bounded by the declared migration count rather
|
|
68
|
+
* than by the adopter's data. Both behind {@link MIGRATIONS_READ_SCOPE}, which the seam's own route
|
|
69
|
+
* requires, so a connection without it gets no value rather than a zero.
|
|
70
|
+
*
|
|
71
|
+
* **`undeclaredMigrations` declares no nominal, on purpose.** From inside one Worker, a database shared
|
|
72
|
+
* with another lists the other's migrations as undeclared, so `atMost: 0` would report a corrupted chain
|
|
73
|
+
* on a database that is entirely fine. Null is what a client reads as unknowable, never as healthy (#471).
|
|
74
|
+
*/
|
|
75
|
+
export declare const MIGRATION_HEALTH_KEYS: readonly [{
|
|
76
|
+
readonly key: "pendingMigrations";
|
|
77
|
+
readonly kind: "count";
|
|
78
|
+
readonly states: null;
|
|
79
|
+
readonly scope: string;
|
|
80
|
+
readonly cost: "indexed";
|
|
81
|
+
readonly summary: "Migrations this build declares that a bound database has not applied.";
|
|
82
|
+
readonly nominal: {
|
|
83
|
+
readonly atMost: 0;
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
readonly key: "undeclaredMigrations";
|
|
87
|
+
readonly kind: "count";
|
|
88
|
+
readonly states: null;
|
|
89
|
+
readonly scope: string;
|
|
90
|
+
readonly cost: "indexed";
|
|
91
|
+
readonly summary: "Migrations a bound database holds that this Worker does not declare. Relative to this Worker: a database shared with another lists that Worker's migrations here.";
|
|
92
|
+
readonly nominal: null;
|
|
93
|
+
}];
|
|
94
|
+
/**
|
|
95
|
+
* Total pending and undeclared across every bound database, for the manifest.
|
|
96
|
+
*
|
|
97
|
+
* **Throws rather than total a database it could not read.** A partial total is a zero for the database
|
|
98
|
+
* nobody read. The seam catches the throw and reports the summary `unavailable`, which a client reads as
|
|
99
|
+
* unknown — null is never zero.
|
|
100
|
+
*/
|
|
101
|
+
export declare function readMigrationHealth(env: Record<string, unknown>, databases: readonly ComposedMigrationDatabase[]): Promise<HealthSummary>;
|
|
102
|
+
//# sourceMappingURL=migrationState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationState.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/migrationState/migrationState.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAQ9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,qGAAqG;AACrG,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,4EAA4E;IAC5E,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAKD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,GAAG,yBAAyB,EAAE,CAe1G;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAElG;AA8BD;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,yBAAyB,EAChC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,GACxE,OAAO,CAAC,qBAAqB,CAAC,CAiBhC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;kBAEzB,mBAAmB;mBAClB,OAAO;;;mBAGP,SAAS;sBACN,uEAAuE;;iBACrE,MAAM,EAAE,CAAC;;;kBAGf,sBAAsB;mBACrB,OAAO;;;mBAGP,SAAS;sBAEb,mKAAmK;;EAGvH,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,SAAS,yBAAyB,EAAE,GAC9C,OAAO,CAAC,aAAa,CAAC,CAQxB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { InternalError } from "../../error/pithyError.js";
|
|
4
|
+
import { MIGRATIONS_READ_SCOPE } from "../scope/scope.js";
|
|
5
|
+
import { composeDatabases } from "../../data/databases.js";
|
|
6
|
+
import { composedMigrationKey, createMigrationRegistry, decomposeMigrationKey } from "../../migrations/registry.js";
|
|
7
|
+
import { collectMigrationSets } from "../../migrations/capabilitySets.js";
|
|
8
|
+
import { readMigrationLedger } from "../../migrations/runner.js";
|
|
9
|
+
import { readMigrationState } from "../../migrations/state.js";
|
|
10
|
+
//#region src/controlPlane/migrationState/migrationState.ts
|
|
11
|
+
/** A provider declaring nothing, for a database bound with no migrations: everything applied is undeclared. */
|
|
12
|
+
const NOTHING_DECLARED = { getMigrations: async () => ({}) };
|
|
13
|
+
/**
|
|
14
|
+
* Every database this Worker binds, with the provider this build composes for it, sorted by name.
|
|
15
|
+
*
|
|
16
|
+
* One entry per database `composeDatabases` maps to a binding — the same map the request registry is built
|
|
17
|
+
* from — so a database bound with no migrations is still reported. Leaving it out would read as not bound.
|
|
18
|
+
*/
|
|
19
|
+
function composeMigrationDatabases(capabilities) {
|
|
20
|
+
const sets = collectMigrationSets([...capabilities]);
|
|
21
|
+
const registry = createMigrationRegistry(sets);
|
|
22
|
+
const bound = composeDatabases([...capabilities]);
|
|
23
|
+
return Object.entries(bound).sort(([left], [right]) => left.localeCompare(right)).map(([database, group]) => {
|
|
24
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const set of sets) {
|
|
26
|
+
if (set.database !== database) continue;
|
|
27
|
+
for (const localKey of Object.keys(set.migrations)) namespaces.set(composedMigrationKey(set, localKey), set.namespace);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
database,
|
|
31
|
+
binding: group.binding,
|
|
32
|
+
provider: registry[database] ?? NOTHING_DECLARED,
|
|
33
|
+
namespaces
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One migration as the route reports it.
|
|
39
|
+
*
|
|
40
|
+
* A declared migration's namespace comes from the set it was declared in. An undeclared one has only its
|
|
41
|
+
* key, so it is decomposed — and a key no registry composed answers null rather than a guess.
|
|
42
|
+
*/
|
|
43
|
+
function migrationView(name, namespaces) {
|
|
44
|
+
return {
|
|
45
|
+
name,
|
|
46
|
+
namespace: namespaces.get(name) ?? decomposeMigrationKey(name)?.namespace ?? null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** The D1 binding for `entry`, or a refusal naming it — a Worker missing the binding cannot read it. */
|
|
50
|
+
function bindingOf(env, entry) {
|
|
51
|
+
const database = env[entry.binding];
|
|
52
|
+
if (database == null) throw new InternalError({
|
|
53
|
+
message: `The ${entry.binding} binding is missing, so database "${entry.database}" cannot be read.`,
|
|
54
|
+
action: `Declare ${entry.binding} in this Worker's wrangler.jsonc, then deploy again.`
|
|
55
|
+
});
|
|
56
|
+
return database;
|
|
57
|
+
}
|
|
58
|
+
function groupView(group, namespaces) {
|
|
59
|
+
return {
|
|
60
|
+
group: group.group,
|
|
61
|
+
appliedAt: group.appliedAt.toISOString(),
|
|
62
|
+
migrations: group.migrations.map((name) => migrationView(name, namespaces)),
|
|
63
|
+
position: group.position.state === "top" ? { state: "top" } : {
|
|
64
|
+
state: "buried",
|
|
65
|
+
above: group.position.above,
|
|
66
|
+
ungrouped: group.position.ungrouped.map((name) => migrationView(name, namespaces))
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Read one database's migration state for the route.
|
|
72
|
+
*
|
|
73
|
+
* **A database that cannot be read is `unreadable`, and costs only itself.** The cause goes to
|
|
74
|
+
* `onUnreadable` — the route logs it, where the operator's context stays the operator's — and never into
|
|
75
|
+
* the view: a D1 error can name a table or a query, and the view crosses to a management client.
|
|
76
|
+
*/
|
|
77
|
+
async function readDatabaseMigrations(env, entry, onUnreadable) {
|
|
78
|
+
try {
|
|
79
|
+
const state = await readMigrationState(bindingOf(env, entry), entry.provider);
|
|
80
|
+
const view = (name) => migrationView(name, entry.namespaces);
|
|
81
|
+
return {
|
|
82
|
+
state: "readable",
|
|
83
|
+
database: entry.database,
|
|
84
|
+
binding: entry.binding,
|
|
85
|
+
applied: state.applied.map(view),
|
|
86
|
+
pending: state.pending.map(view),
|
|
87
|
+
undeclared: state.undeclared.map(view),
|
|
88
|
+
lastGroup: state.lastGroup ? groupView(state.lastGroup, entry.namespaces) : null
|
|
89
|
+
};
|
|
90
|
+
} catch (cause) {
|
|
91
|
+
onUnreadable?.(entry, cause);
|
|
92
|
+
return {
|
|
93
|
+
state: "unreadable",
|
|
94
|
+
database: entry.database,
|
|
95
|
+
binding: entry.binding
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The two health keys the seam contributes to its own manifest entry.
|
|
101
|
+
*
|
|
102
|
+
* Both `indexed`: one small select per bound database, bounded by the declared migration count rather
|
|
103
|
+
* than by the adopter's data. Both behind {@link MIGRATIONS_READ_SCOPE}, which the seam's own route
|
|
104
|
+
* requires, so a connection without it gets no value rather than a zero.
|
|
105
|
+
*
|
|
106
|
+
* **`undeclaredMigrations` declares no nominal, on purpose.** From inside one Worker, a database shared
|
|
107
|
+
* with another lists the other's migrations as undeclared, so `atMost: 0` would report a corrupted chain
|
|
108
|
+
* on a database that is entirely fine. Null is what a client reads as unknowable, never as healthy (#471).
|
|
109
|
+
*/
|
|
110
|
+
const MIGRATION_HEALTH_KEYS = [{
|
|
111
|
+
key: "pendingMigrations",
|
|
112
|
+
kind: "count",
|
|
113
|
+
states: null,
|
|
114
|
+
scope: MIGRATIONS_READ_SCOPE,
|
|
115
|
+
cost: "indexed",
|
|
116
|
+
summary: "Migrations this build declares that a bound database has not applied.",
|
|
117
|
+
nominal: { atMost: 0 }
|
|
118
|
+
}, {
|
|
119
|
+
key: "undeclaredMigrations",
|
|
120
|
+
kind: "count",
|
|
121
|
+
states: null,
|
|
122
|
+
scope: MIGRATIONS_READ_SCOPE,
|
|
123
|
+
cost: "indexed",
|
|
124
|
+
summary: "Migrations a bound database holds that this Worker does not declare. Relative to this Worker: a database shared with another lists that Worker's migrations here.",
|
|
125
|
+
nominal: null
|
|
126
|
+
}];
|
|
127
|
+
/**
|
|
128
|
+
* Total pending and undeclared across every bound database, for the manifest.
|
|
129
|
+
*
|
|
130
|
+
* **Throws rather than total a database it could not read.** A partial total is a zero for the database
|
|
131
|
+
* nobody read. The seam catches the throw and reports the summary `unavailable`, which a client reads as
|
|
132
|
+
* unknown — null is never zero.
|
|
133
|
+
*/
|
|
134
|
+
async function readMigrationHealth(env, databases) {
|
|
135
|
+
const ledgers = await Promise.all(databases.map((entry) => readMigrationLedger(bindingOf(env, entry), entry.provider)));
|
|
136
|
+
return {
|
|
137
|
+
pendingMigrations: ledgers.reduce((total, ledger) => total + ledger.pending.length, 0),
|
|
138
|
+
undeclaredMigrations: ledgers.reduce((total, ledger) => total + ledger.undeclared.length, 0)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { MIGRATION_HEALTH_KEYS, composeMigrationDatabases, migrationView, readDatabaseMigrations, readMigrationHealth };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import type { Migration } from "kysely/migration";
|
|
4
|
+
/**
|
|
5
|
+
* Who sanctioned a connection, what kind of client it is, and what it is for — `#721`.
|
|
6
|
+
*
|
|
7
|
+
* **Appended, not folded into `0001`.** The seam has shipped and adopters' databases hold rows written by
|
|
8
|
+
* it, so the three columns arrive in a migration of their own, as `0002`'s origin did.
|
|
9
|
+
*
|
|
10
|
+
* **Nullable, with no default, and nothing backfilled.** A row registered before this carries no
|
|
11
|
+
* principal, and none can be recovered: most of the trail that might be mined for one names a token
|
|
12
|
+
* rather than a person, and a principal read off a token name is the self-assertion this issue exists to
|
|
13
|
+
* end. So null means *registered before principals were recorded*, the connection keeps working exactly
|
|
14
|
+
* as it did, its purpose may be set with `pithy dashboard connect --update --purpose`, and its principal
|
|
15
|
+
* is set only by registering again, under a signed-in session.
|
|
16
|
+
*
|
|
17
|
+
* **The Worker reads only `actorKind`**, to stamp it onto the audit rows a connection's calls write. The
|
|
18
|
+
* other two exist for the adopter's own review, on their own side.
|
|
19
|
+
*/
|
|
20
|
+
export declare const controlplane_0003_connection_principal: Migration;
|
|
21
|
+
//# sourceMappingURL=0003_connection_principal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0003_connection_principal.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/migrations/0003_connection_principal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sCAAsC,EAAE,SAcpD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
//#region src/controlPlane/migrations/0003_connection_principal.ts
|
|
4
|
+
/**
|
|
5
|
+
* Who sanctioned a connection, what kind of client it is, and what it is for — `#721`.
|
|
6
|
+
*
|
|
7
|
+
* **Appended, not folded into `0001`.** The seam has shipped and adopters' databases hold rows written by
|
|
8
|
+
* it, so the three columns arrive in a migration of their own, as `0002`'s origin did.
|
|
9
|
+
*
|
|
10
|
+
* **Nullable, with no default, and nothing backfilled.** A row registered before this carries no
|
|
11
|
+
* principal, and none can be recovered: most of the trail that might be mined for one names a token
|
|
12
|
+
* rather than a person, and a principal read off a token name is the self-assertion this issue exists to
|
|
13
|
+
* end. So null means *registered before principals were recorded*, the connection keeps working exactly
|
|
14
|
+
* as it did, its purpose may be set with `pithy dashboard connect --update --purpose`, and its principal
|
|
15
|
+
* is set only by registering again, under a signed-in session.
|
|
16
|
+
*
|
|
17
|
+
* **The Worker reads only `actorKind`**, to stamp it onto the audit rows a connection's calls write. The
|
|
18
|
+
* other two exist for the adopter's own review, on their own side.
|
|
19
|
+
*/
|
|
20
|
+
const controlplane_0003_connection_principal = {
|
|
21
|
+
up: async (db) => {
|
|
22
|
+
await db.schema.alterTable("pithyControlplaneConnections").addColumn("authorizedBy", "text").execute();
|
|
23
|
+
await db.schema.alterTable("pithyControlplaneConnections").addColumn("actorKind", "text").execute();
|
|
24
|
+
await db.schema.alterTable("pithyControlplaneConnections").addColumn("purpose", "text").execute();
|
|
25
|
+
},
|
|
26
|
+
down: async (db) => {
|
|
27
|
+
await db.schema.alterTable("pithyControlplaneConnections").dropColumn("purpose").execute();
|
|
28
|
+
await db.schema.alterTable("pithyControlplaneConnections").dropColumn("actorKind").execute();
|
|
29
|
+
await db.schema.alterTable("pithyControlplaneConnections").dropColumn("authorizedBy").execute();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { controlplane_0003_connection_principal };
|
|
@@ -50,8 +50,19 @@ export declare const MANIFEST_READ_SCOPE: ControlPlaneScope;
|
|
|
50
50
|
*/
|
|
51
51
|
export declare const KEYS_ROTATE_SCOPE: ControlPlaneScope;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* Read where each database this Worker binds stands: what is applied, what is pending, what is undeclared,
|
|
54
|
+
* and which run put it there (#729). Read-only by construction — every route behind it is a `GET`, and
|
|
55
|
+
* nothing over the seam runs, reverses or resets a migration. The two migration health keys on the seam's
|
|
56
|
+
* manifest entry sit behind it too, so a connection without it gets no number rather than a zero.
|
|
57
|
+
*/
|
|
58
|
+
export declare const MIGRATIONS_READ_SCOPE: ControlPlaneScope;
|
|
59
|
+
/**
|
|
60
|
+
* The seam's base grant — what `pithy dashboard connect` grants whatever the Worker composes. Ping is absent
|
|
61
|
+
* because it is not grantable; see {@link ANY_VERIFIED_CALLER}.
|
|
62
|
+
*
|
|
63
|
+
* **{@link MIGRATIONS_READ_SCOPE} is absent on purpose.** It is a read — every route requiring it is a `GET`
|
|
64
|
+
* — so `connect` derives it from the seam's `adminRoutes` the way it derives every capability's reads. The
|
|
65
|
+
* base exists for `keys:rotate`, which is not a read and would otherwise drop out.
|
|
55
66
|
*/
|
|
56
67
|
export declare const SEAM_SCOPES: readonly ControlPlaneScope[];
|
|
57
68
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/scope/scope.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAQ3B,CAAC;AACJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,MAA2D,CAAC;AAErG;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,OAAO,mBAAmB,CAAC;AAErF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAAmC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiC,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/scope/scope.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAQ3B,CAAC;AACJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,MAA2D,CAAC;AAErG;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,OAAO,mBAAmB,CAAC;AAErF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAAmC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAAqC,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,iBAAiB,EAA6C,CAAC;AAElG;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAIrH"}
|
|
@@ -40,8 +40,19 @@ const MANIFEST_READ_SCOPE = "manifest:read";
|
|
|
40
40
|
*/
|
|
41
41
|
const KEYS_ROTATE_SCOPE = "keys:rotate";
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Read where each database this Worker binds stands: what is applied, what is pending, what is undeclared,
|
|
44
|
+
* and which run put it there (#729). Read-only by construction — every route behind it is a `GET`, and
|
|
45
|
+
* nothing over the seam runs, reverses or resets a migration. The two migration health keys on the seam's
|
|
46
|
+
* manifest entry sit behind it too, so a connection without it gets no number rather than a zero.
|
|
47
|
+
*/
|
|
48
|
+
const MIGRATIONS_READ_SCOPE = "migrations:read";
|
|
49
|
+
/**
|
|
50
|
+
* The seam's base grant — what `pithy dashboard connect` grants whatever the Worker composes. Ping is absent
|
|
51
|
+
* because it is not grantable; see {@link ANY_VERIFIED_CALLER}.
|
|
52
|
+
*
|
|
53
|
+
* **{@link MIGRATIONS_READ_SCOPE} is absent on purpose.** It is a read — every route requiring it is a `GET`
|
|
54
|
+
* — so `connect` derives it from the seam's `adminRoutes` the way it derives every capability's reads. The
|
|
55
|
+
* base exists for `keys:rotate`, which is not a read and would otherwise drop out.
|
|
45
56
|
*/
|
|
46
57
|
const SEAM_SCOPES = [MANIFEST_READ_SCOPE, KEYS_ROTATE_SCOPE];
|
|
47
58
|
/**
|
|
@@ -62,4 +73,4 @@ function scopeCovers(required, presented, granted) {
|
|
|
62
73
|
return granted.includes(required);
|
|
63
74
|
}
|
|
64
75
|
//#endregion
|
|
65
|
-
export { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, SEAM_SCOPES, scopeCovers };
|
|
76
|
+
export { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, SEAM_SCOPES, scopeCovers };
|
package/dist/createBackend.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
+
import { z } from "zod";
|
|
4
5
|
import type { Capability, MergedDatabases, MergedKvNamespaces, MergedWorkflowParams, PithyVars } from "./capability/capability";
|
|
5
6
|
import { type DbRegistry } from "./data/databases";
|
|
6
7
|
import { type KvRegistry } from "./kv/namespaces";
|
|
@@ -39,6 +40,12 @@ type BackendEnv<Caps extends readonly Capability[]> = {
|
|
|
39
40
|
workflows: WorkflowDispatcher<MergedWorkflowParams<Caps>>;
|
|
40
41
|
};
|
|
41
42
|
};
|
|
43
|
+
/** What `GET /health` answers. */
|
|
44
|
+
export declare const HealthBody: z.ZodObject<{
|
|
45
|
+
status: z.ZodLiteral<"ok">;
|
|
46
|
+
version: z.ZodNullable<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type HealthBody = z.infer<typeof HealthBody>;
|
|
42
49
|
/**
|
|
43
50
|
* Assemble capabilities into a deployable Hono app — a valid Worker `fetch` handler.
|
|
44
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBackend.d.ts","sourceRoot":"","sources":["../src/createBackend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createBackend.d.ts","sourceRoot":"","sources":["../src/createBackend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EAEpB,SAAS,EACV,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMtF,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGvF,oGAAoG;AACpG,MAAM,WAAW,oBAAoB,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,EAAE,GAAG,SAAS,UAAU;IAC9F,2EAA2E;IAC3E,YAAY,EAAE,IAAI,CAAC;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IACV;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,iHAAiH;AACjH,KAAK,UAAU,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI;IACpD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW,CAAC,GAAG;QACtD,EAAE,EAAE,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,EAAE,EAAE,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,SAAS,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;KAC3D,CAAC;CACH,CAAC;AAuCF,kCAAkC;AAClC,eAAO,MAAM,UAAU;;;iBAQ+B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,EACxC,KAAK,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EACrF,OAAO,EAAE,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CA0MrF"}
|