@pithy-sh/core 0.10.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/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 +98 -28
- package/dist/capability/capability.d.ts.map +1 -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 +86 -2
- package/dist/capability/settings.d.ts.map +1 -1
- package/dist/capability/settings.js +80 -1
- package/dist/cli/commandCatalog.generated.d.ts +184 -22
- package/dist/cli/commandCatalog.generated.d.ts.map +1 -1
- package/dist/cli/commandCatalog.generated.js +196 -22
- package/dist/cli/commandFacts.d.ts +1 -1
- package/dist/cli/commandFacts.d.ts.map +1 -1
- package/dist/cli/commandFacts.js +1 -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/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 +17 -1
- 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 +1 -0
- package/dist/controlPlane/http/routes.d.ts.map +1 -1
- package/dist/controlPlane/http/routes.js +17 -3
- 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.map +1 -1
- package/dist/createBackend.js +7 -2
- 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/error/http.d.ts +144 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +288 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +100 -4
- 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/scopeGates.d.ts +20 -0
- package/dist/http/scopeGates.d.ts.map +1 -0
- package/dist/http/scopeGates.js +36 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/logger/record.d.ts +84 -0
- package/dist/logger/record.d.ts.map +1 -1
- 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/registry.d.ts +26 -0
- package/dist/migrations/registry.d.ts.map +1 -1
- package/dist/migrations/registry.js +38 -7
- 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/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/provisionScope.d.ts +6 -0
- package/dist/naming/provisionScope.d.ts.map +1 -1
- package/dist/naming/provisionScope.js +8 -3
- 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/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/version.generated.d.ts +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/faults.d.ts +12 -1
- package/dist/workflow/faults.d.ts.map +1 -1
- package/dist/workflow/faults.js +22 -15
- package/package.json +2 -2
- 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/audit/auditEvent.ts +4 -0
- package/src/capability/bindings.ts +159 -13
- package/src/capability/capability.ts +99 -29
- package/src/capability/settings.ts +146 -2
- package/src/cli/commandCatalog.generated.ts +212 -22
- package/src/cli/commandFacts.ts +1 -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/http/cors.ts +4 -4
- package/src/controlPlane/http/guard.ts +21 -0
- 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 +25 -1
- 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 +24 -6
- 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/error/payload.ts +211 -4
- package/src/http/authContext.ts +13 -1
- package/src/http/scopeGates.ts +34 -0
- package/src/index.ts +1 -0
- package/src/migrations/capabilitySets.ts +87 -0
- package/src/migrations/registry.ts +46 -2
- package/src/migrations/state.ts +94 -0
- package/src/naming/feature.ts +46 -7
- package/src/naming/limits.ts +35 -3
- package/src/naming/provisionScope.ts +19 -1
- package/src/naming/resourceNames.ts +52 -5
- package/src/seed/writeD1.ts +13 -4
- package/src/seed/writeKv.ts +6 -2
- package/src/version.generated.ts +1 -1
- package/src/worker/serviceLoopback.ts +105 -0
- package/src/workflow/faults.ts +51 -24
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type { ExecutionContext, ForwardableEmailMessage } from "@cloudflare/workers-types";
|
|
4
|
-
import type { Hono } from "hono";
|
|
4
|
+
import type { Hono, MiddlewareHandler } from "hono";
|
|
5
5
|
import type { z } from "zod";
|
|
6
|
+
import type { ActingOrganizationResolver } from "../access/acting";
|
|
6
7
|
import type { AuditEmit } from "../audit/recorder";
|
|
7
8
|
import type { ControlPlaneContext } from "../controlPlane/context";
|
|
8
9
|
import type { AdminRoute } from "../controlPlane/discovery/adminRoute";
|
|
@@ -28,6 +29,19 @@ import type { CapabilitySettings } from "./settings";
|
|
|
28
29
|
export interface PithyVars {
|
|
29
30
|
/** The authenticated identity, populated by `@pithy-sh/auth`; `null` until a strategy sets it. */
|
|
30
31
|
auth: AuthContext | null;
|
|
32
|
+
/**
|
|
33
|
+
* Which organization this request acts for, and what the caller's role there allows — a resolver,
|
|
34
|
+
* populated by `@pithy-sh/organization`'s middleware. With no organization capability composed it is
|
|
35
|
+
* {@link import("../access/acting").noActingOrganization}, which answers `null`: nothing is in force,
|
|
36
|
+
* every record a request writes carries a null organization, and every rule that admits by organization
|
|
37
|
+
* admits nobody.
|
|
38
|
+
*
|
|
39
|
+
* **A seam beside {@link auth}, never a field on it.** `auth` says who is signed in; this says what they
|
|
40
|
+
* may do *here*, and a capability that gates on it — media, storage — must not import the capability
|
|
41
|
+
* that computes it. Lazy, because resolving it is a D1 read most requests never need; read it with
|
|
42
|
+
* `await c.var.actingOrganization()`, or through `accessCaller` in `access/access.ts`.
|
|
43
|
+
*/
|
|
44
|
+
actingOrganization: ActingOrganizationResolver;
|
|
31
45
|
/**
|
|
32
46
|
* The resolved request locale, populated by `@pithy-sh/i18n`'s middleware; `null` in a Worker that
|
|
33
47
|
* does not compose it — which is what "nothing was negotiated" looks like, as distinct from "the
|
|
@@ -129,6 +143,11 @@ export type PithyHonoEnv = {
|
|
|
129
143
|
Variables: PithyVars;
|
|
130
144
|
};
|
|
131
145
|
export type PithyMiddleware = (app: Hono<PithyHonoEnv>) => void;
|
|
146
|
+
/**
|
|
147
|
+
* One readiness guard: a handler that refuses because **this Worker** is in a bad state. See
|
|
148
|
+
* {@link Capability.readiness} for where it runs and where it does not.
|
|
149
|
+
*/
|
|
150
|
+
export type PithyReadinessGuard = MiddlewareHandler<PithyHonoEnv>;
|
|
132
151
|
/**
|
|
133
152
|
* The structural seam for one capability's secret-registry slice — secret name → its declaration.
|
|
134
153
|
* Core carries it on the {@link Capability} contract so a capability can declare which secrets it
|
|
@@ -223,27 +242,17 @@ export type SecretBranchSeam = Record<string, readonly string[]>;
|
|
|
223
242
|
*/
|
|
224
243
|
export type InapplicableSecretSeam = Record<string, string>;
|
|
225
244
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* `TokenProfile`, the permission catalog, `defineTokenProfile`, and the mint engine live in
|
|
231
|
-
* `@pithy-sh/cloudflare`/the CLI. `pithy token` aggregates every capability's slice into one registry.
|
|
245
|
+
* One route a capability gates on an `AuthContext` scope — see {@link Capability.scopeGates}.
|
|
246
|
+
*
|
|
247
|
+
* Descriptive, never behavioral: the gate itself is the capability's own middleware, and this is what a
|
|
248
|
+
* diagnostic reads to name it. `route` is the method and the mounted path, as the route table writes them.
|
|
232
249
|
*/
|
|
233
|
-
export interface
|
|
234
|
-
/** The
|
|
235
|
-
readonly
|
|
236
|
-
/** The
|
|
237
|
-
readonly
|
|
238
|
-
/** The secret-registry name the minted value is stored under — its backend decides the destination. */
|
|
239
|
-
readonly secret?: string;
|
|
240
|
-
/** A built-in destination override (`dev-vars` | `ephemeral` | `secrets-store`) for a tooling profile. */
|
|
241
|
-
readonly defaultStore?: string;
|
|
242
|
-
/** Why the profile exists / what consumes it — surfaced in `pithy token` help and docs. */
|
|
243
|
-
readonly description?: string;
|
|
250
|
+
export interface ScopeGate {
|
|
251
|
+
/** The scope the gate requires, as the resolved config names it — `leaderboard:submit`. */
|
|
252
|
+
readonly scope: string;
|
|
253
|
+
/** The method and mounted path it guards, `POST /leaderboard/:board`. */
|
|
254
|
+
readonly route: string;
|
|
244
255
|
}
|
|
245
|
-
/** A capability's token-profile slice: profile name → {@link TokenProfileSeam}. */
|
|
246
|
-
export type TokenProfileSeamMap = Record<string, TokenProfileSeam>;
|
|
247
256
|
/**
|
|
248
257
|
* One thing an **adopter** plugged into a capability — the capability's own name for something the kit
|
|
249
258
|
* did not ship and cannot enumerate. `@pithy-sh/auth` declares one per additional Better Auth plugin
|
|
@@ -358,13 +367,6 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
358
367
|
* whenever it is composed declares nothing, which is the ordinary case.
|
|
359
368
|
*/
|
|
360
369
|
inapplicableSecrets?: InapplicableSecretSeam;
|
|
361
|
-
/**
|
|
362
|
-
* The scoped CF API tokens this capability's code needs, as a token-profile slice (profile name →
|
|
363
|
-
* {@link TokenProfileSeam}). Additive and optional, and declared next to {@link Capability.secretRegistry}
|
|
364
|
-
* — the value of a minted token lands in the secret the profile names. `pithy token` aggregates every
|
|
365
|
-
* capability's slice with the built-in tooling profiles into one registry.
|
|
366
|
-
*/
|
|
367
|
-
tokenProfiles?: TokenProfileSeamMap;
|
|
368
370
|
/**
|
|
369
371
|
* Extra CF permissions this capability needs the **CI system token** to hold, as short catalog keys
|
|
370
372
|
* (e.g. `email:routing` for email provisioning, `kv:write` for a module that seeds KV in CI). They
|
|
@@ -372,6 +374,20 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
372
374
|
* extends what CI can do without the adopter hand-editing token scopes. Additive and optional.
|
|
373
375
|
*/
|
|
374
376
|
ciPermissions?: readonly string[];
|
|
377
|
+
/**
|
|
378
|
+
* The CF permissions this capability's **deployed Workers** call Cloudflare with, as short catalog keys
|
|
379
|
+
* (`secrets:write`, `images:write`, `analytics:read`). The runtime counterpart of {@link ciPermissions}.
|
|
380
|
+
*
|
|
381
|
+
* **A deployed application holds one Cloudflare API token, and this is the only way into it (#728).**
|
|
382
|
+
* Every composed capability's keys union into the project-level `runtime` profile, minted per
|
|
383
|
+
* environment into the Secrets Store and read by every Worker of that environment through one binding,
|
|
384
|
+
* the way every capability's `ciPermissions` union into the one `ci-system` token. A capability cannot
|
|
385
|
+
* declare a token of its own. A project whose composition declares none mints no runtime token.
|
|
386
|
+
*
|
|
387
|
+
* Build it from the resolved config, as `secretRegistry` is built: a capability configured to call
|
|
388
|
+
* nothing on Cloudflare declares nothing, and adds nothing to the token. Additive and optional.
|
|
389
|
+
*/
|
|
390
|
+
runtimePermissions?: readonly string[];
|
|
375
391
|
/**
|
|
376
392
|
* The admin routes this capability contributes behind the `control-plane` strategy, described well
|
|
377
393
|
* enough for a management client to call them — full mounted path, required scope, and a one-line
|
|
@@ -518,8 +534,30 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
518
534
|
* parsed with. A capability with no socket leaves it unset.
|
|
519
535
|
*/
|
|
520
536
|
sockets?: readonly SocketChannel[];
|
|
521
|
-
/**
|
|
537
|
+
/**
|
|
538
|
+
* Composable middleware (e.g. turnstile(), requireAuth()). Runs on every request, the control-plane
|
|
539
|
+
* surface included. A refusal that protects a route — a rate limit, authentication, a CSRF check —
|
|
540
|
+
* belongs here. A refusal because the Worker itself is broken belongs in {@link Capability.readiness}.
|
|
541
|
+
*/
|
|
522
542
|
middleware?: PithyMiddleware[];
|
|
543
|
+
/**
|
|
544
|
+
* Guards that refuse because **this Worker is misconfigured or unprovisioned** — `@pithy-sh/vector`'s
|
|
545
|
+
* `provisionGuard`, when the deployed index disagrees with config. Not for protecting a route: a rate
|
|
546
|
+
* limit, authentication and a CSRF check refuse a *caller*, and they belong in
|
|
547
|
+
* {@link Capability.middleware}.
|
|
548
|
+
*
|
|
549
|
+
* `createBackend` mounts every readiness guard after every capability's `middleware` and before any
|
|
550
|
+
* capability's routes, so the verifier, `emit` and every rate limit are already in place. It skips
|
|
551
|
+
* each guard on the admin surface — every composed capability's `adminRoutes`, the seam's own
|
|
552
|
+
* included, the set CORS is derived from. The control plane is the diagnostic surface, so it cannot
|
|
553
|
+
* sit behind the faults it diagnoses. Every other request meets the guard, `GET /health` aside, which
|
|
554
|
+
* is registered ahead of all of it.
|
|
555
|
+
*
|
|
556
|
+
* A handler rather than a registrar like `middleware`, because core decides where it mounts. A guard
|
|
557
|
+
* that wanted its own path would be deciding the exemption by path shape, which is the thing this
|
|
558
|
+
* exists to take away from it.
|
|
559
|
+
*/
|
|
560
|
+
readiness?: PithyReadinessGuard[];
|
|
523
561
|
/**
|
|
524
562
|
* Whether this capability fills the entitlement seam — replaces `c.var.entitlements` with a real
|
|
525
563
|
* resolver. `@pithy-sh/payments` declares it; nothing else does today.
|
|
@@ -531,6 +569,27 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
531
569
|
* flag and say so, which turns a fleet of production 403s into one line at startup.
|
|
532
570
|
*/
|
|
533
571
|
providesEntitlements?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Whether this capability fills `AuthContext.scopes` — whether anything will ever put a string in the
|
|
574
|
+
* array the scope gates read. `@pithy-sh/auth` declares it when an adopter supplies `resolveScopes`, and
|
|
575
|
+
* not otherwise (#560).
|
|
576
|
+
*
|
|
577
|
+
* The same reason {@link providesEntitlements} exists, one seam over. Every scope gate fails closed, so a
|
|
578
|
+
* Worker composing `leaderboard` with no resolver is not broken: it refuses every caller on the gated
|
|
579
|
+
* routes, forever, and the runtime cannot tell that from a caller who simply is not trusted. `pithy doctor`
|
|
580
|
+
* compares this flag against {@link scopeGates} and says so.
|
|
581
|
+
*/
|
|
582
|
+
providesScopes?: boolean;
|
|
583
|
+
/**
|
|
584
|
+
* The routes this capability gates on an `AuthContext` scope, built from the resolved config — a gate the
|
|
585
|
+
* config has switched off is not declared. Omit it when nothing is gated, which is the ordinary case.
|
|
586
|
+
*
|
|
587
|
+
* **Declared so the CLI can name what will deny.** With no capability composed that
|
|
588
|
+
* {@link providesScopes}, every route listed here answers 403 to every caller, and `pithy doctor` names
|
|
589
|
+
* each one. Each capability's route-contract test holds this list to the `scopes` its `describeRoute`s
|
|
590
|
+
* carry, so the declaration cannot drift from the routes.
|
|
591
|
+
*/
|
|
592
|
+
scopeGates?: readonly ScopeGate[];
|
|
534
593
|
/**
|
|
535
594
|
* This capability's client-safe projection — the **only** values of its config that may reach a
|
|
536
595
|
* browser bundle. Resolved at build time against a {@link ClientProjectionContext} (the environment),
|
|
@@ -578,6 +637,17 @@ export interface Capability<Databases extends DatabaseSpecMap = DatabaseSpecMap,
|
|
|
578
637
|
* time, and read by `pithy doctor`.
|
|
579
638
|
*/
|
|
580
639
|
extensions?: readonly CapabilityExtension[];
|
|
640
|
+
/**
|
|
641
|
+
* The role powers this capability's own routes gate on, through the acting-organization seam —
|
|
642
|
+
* `media:manage`, `storage:manage`. Omit it when a capability asks no power, which is the normal case.
|
|
643
|
+
*
|
|
644
|
+
* **Declared so the catalog requirement can be conditional.** `@pithy-sh/organization` refuses a role
|
|
645
|
+
* catalog in which no role holds a power a composed capability gates on — a route nobody could ever use
|
|
646
|
+
* — and a project that composes no media must not be refused for not placing `media:manage`. The
|
|
647
|
+
* organization capability reads this list at compose, across every composed capability, rather than
|
|
648
|
+
* importing any of them.
|
|
649
|
+
*/
|
|
650
|
+
powers?: readonly string[];
|
|
581
651
|
/** Bindings this capability needs in the env (normalized — `optional` is always set). */
|
|
582
652
|
requiredBindings: BindingSpec[];
|
|
583
653
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/capability/capability.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/capability/capability.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,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AE,KAAK,IAC7B,mBAAmB,CAAC,MAAM,CAAC,SAAS,MAAM,MAAM,GAAG,CAAC,MAAM,SAAS,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;AAEpH,sFAAsF;AACtF,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI,YAAY,CAC5E,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EACzB,eAAe,CAChB,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,kBAAkB,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI,YAAY,CAC/E,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC1B,kBAAkB,CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,SAAS,UAAU,EAAE,IAAI,YAAY,CACjF,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,CAAC"}
|
|
@@ -295,13 +295,14 @@ export declare const CapabilityManifest: z.ZodObject<{
|
|
|
295
295
|
name: z.ZodString;
|
|
296
296
|
package: z.ZodString;
|
|
297
297
|
requiredBindings: z.ZodArray<z.ZodObject<{
|
|
298
|
-
type: z.ZodUnion<readonly [z.ZodLiteral<"d1">, z.ZodLiteral<"kv">, z.ZodLiteral<"r2">, z.ZodLiteral<"ai">, z.ZodLiteral<"vectorize">, z.ZodLiteral<"queue">, z.ZodLiteral<"ratelimit">, z.ZodLiteral<"email">, z.ZodLiteral<"secret">, z.ZodLiteral<"workflow">, z.ZodLiteral<"service">, z.ZodLiteral<"durable_object">]>;
|
|
298
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"d1">, z.ZodLiteral<"kv">, z.ZodLiteral<"r2">, z.ZodLiteral<"ai">, z.ZodLiteral<"vectorize">, z.ZodLiteral<"queue">, z.ZodLiteral<"ratelimit">, z.ZodLiteral<"email">, z.ZodLiteral<"secret">, z.ZodLiteral<"workflow">, z.ZodLiteral<"service">, z.ZodLiteral<"durable_object">, z.ZodLiteral<"hyperdrive">, z.ZodLiteral<"browser">, z.ZodLiteral<"images">, z.ZodLiteral<"analytics_engine_datasets">, z.ZodLiteral<"pipelines">, z.ZodLiteral<"mtls_certificates">, z.ZodLiteral<"dispatch_namespaces">, z.ZodLiteral<"artifacts">]>;
|
|
299
299
|
name: z.ZodString;
|
|
300
300
|
optional: z.ZodDefault<z.ZodBoolean>;
|
|
301
301
|
className: z.ZodOptional<z.ZodString>;
|
|
302
302
|
classModule: z.ZodOptional<z.ZodString>;
|
|
303
303
|
job: z.ZodOptional<z.ZodString>;
|
|
304
304
|
service: z.ZodOptional<z.ZodString>;
|
|
305
|
+
target: z.ZodOptional<z.ZodString>;
|
|
305
306
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
306
307
|
scope: z.ZodOptional<z.ZodEnum<{
|
|
307
308
|
environment: "environment";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/capability/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgDxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,iBAAiB,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAEvH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAUgD,CAAC;AA6D5G;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CASlE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB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;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuE0D,CAAC;AAC1F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { ValidationError } from "../error/pithyError.js";
|
|
4
4
|
import { BindingSpec } from "./bindings.js";
|
|
5
|
+
import { NAMESPACE_PATTERN } from "../migrations/registry.js";
|
|
5
6
|
import { manifestRecord } from "./vanishingKey.js";
|
|
6
7
|
import { DevSecret } from "./devSecret.js";
|
|
7
|
-
import { NAMESPACE_PATTERN } from "../migrations/registry.js";
|
|
8
8
|
import { DeclaredSecret } from "./secretOrigin.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/capability/manifest.ts
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { InternalError } from "../error/pithyError";
|
|
4
5
|
import type { HostEnvReport } from "../workflow/hostEnv";
|
|
5
6
|
/**
|
|
6
7
|
* How a capability checks that its own settings **work** — the seam `pithy doctor` runs (#411).
|
|
@@ -81,8 +82,8 @@ export interface SettingsCheckContext {
|
|
|
81
82
|
*
|
|
82
83
|
* Closed for the reason `CapabilityHealth` is: handing a capability a raw Cloudflare client would make
|
|
83
84
|
* every capability a place a network call can be invented, and would put `@pithy-sh/cloudflare` in the
|
|
84
|
-
* dependency list of packages that need none of it.
|
|
85
|
-
*
|
|
85
|
+
* dependency list of packages that need none of it. A question lands here once a capability actually needs
|
|
86
|
+
* it, and not before: six cover what the checks ask.
|
|
86
87
|
*
|
|
87
88
|
* Every method may throw. A throw is the account failing to answer, and the runner reports that
|
|
88
89
|
* capability's account tier as unchecked rather than as a pass.
|
|
@@ -110,12 +111,84 @@ export interface SettingsAccountReader {
|
|
|
110
111
|
* created it with, so the check looks where the value went.
|
|
111
112
|
*/
|
|
112
113
|
storeEntry(name: string): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* The ids of the rows in one of the kit's own tables whose column holds one of `values`, in the app
|
|
116
|
+
* database a Worker binds as `DB` in one deployed environment (#727).
|
|
117
|
+
*
|
|
118
|
+
* Asked by media and storage after a project narrows `visibility.allowed`: narrowing never rewrites a
|
|
119
|
+
* record, so the records left outside the policy have to be *named*, and only the deployed database
|
|
120
|
+
* holds them. Closed in its own way — the table must be a `pithy_` one and the column an identifier,
|
|
121
|
+
* both refused otherwise, and the values are bound, never interpolated — so it reads a fact about a
|
|
122
|
+
* capability's own rows and cannot become a query language.
|
|
123
|
+
*/
|
|
124
|
+
appRows(request: AppRowsRequest): Promise<readonly string[]>;
|
|
125
|
+
/**
|
|
126
|
+
* Whether that environment's **D1 vault** holds a `json` secret that still carries a top-level `field` —
|
|
127
|
+
* asked of its manager Worker, which opens the value and answers a bit, never the value (#728). `false`
|
|
128
|
+
* for a secret that is not stored, since it carries nothing.
|
|
129
|
+
*
|
|
130
|
+
* Asked by media of `media-storage-credentials`, which held a supplied Cloudflare token until the runtime
|
|
131
|
+
* token replaced it: the upgrade is finished only once the bundle has been rewritten without it.
|
|
132
|
+
*/
|
|
133
|
+
vaultSecretField(request: {
|
|
134
|
+
name: string;
|
|
135
|
+
environment: string;
|
|
136
|
+
field: string;
|
|
137
|
+
}): Promise<boolean>;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the account holds a Cloudflare API token of exactly this name (#728). The name is the token's,
|
|
140
|
+
* composed with the namer that minted it — never a pattern, so a check names one credential it can see.
|
|
141
|
+
*
|
|
142
|
+
* Asked by secrets of the manager token the runtime token superseded, which nothing revokes for you.
|
|
143
|
+
*/
|
|
144
|
+
accountToken(name: string): Promise<boolean>;
|
|
145
|
+
}
|
|
146
|
+
/** What {@link SettingsAccountReader.appRows} is asked. */
|
|
147
|
+
export interface AppRowsRequest {
|
|
148
|
+
/** The deployed environment whose app database is read. `dev` is refused: it has no deployed database. */
|
|
149
|
+
readonly environment: string;
|
|
150
|
+
/** The Worker's `apps/` directory — whose `wrangler.jsonc` names the database for that environment. */
|
|
151
|
+
readonly workerDirectory: string;
|
|
152
|
+
/** The kit table, as it is named in SQL — `pithy_media_assets`. Must carry the `pithy_` prefix. */
|
|
153
|
+
readonly table: string;
|
|
154
|
+
/** The column compared, as it is named in SQL — `visibility`. */
|
|
155
|
+
readonly column: string;
|
|
156
|
+
/** The values that make a row worth naming. */
|
|
157
|
+
readonly values: readonly string[];
|
|
113
158
|
}
|
|
114
159
|
/** What the account tier is told: everything the local tier gets, plus the account it may ask. */
|
|
115
160
|
export interface SettingsAccountContext extends SettingsCheckContext {
|
|
116
161
|
/** The account, as the closed set of questions above. */
|
|
117
162
|
account: SettingsAccountReader;
|
|
118
163
|
}
|
|
164
|
+
/** One environment an account check could not answer for, and why. */
|
|
165
|
+
export interface UnansweredEnvironment {
|
|
166
|
+
/** The environment id. */
|
|
167
|
+
readonly environment: string;
|
|
168
|
+
/** What the account, or the project, said instead of an answer. */
|
|
169
|
+
readonly cause: unknown;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* An account check that answered for some environments and not for others.
|
|
173
|
+
*
|
|
174
|
+
* A check that asks per environment must not let one unanswerable environment cost the others their
|
|
175
|
+
* findings: staging stood up before prod is the ordinary bring-up, and a check that threw on prod's missing
|
|
176
|
+
* database would throw away what it had already found in staging. So it collects what it can, and throws
|
|
177
|
+
* this at the end carrying those findings. The runner reports them as findings and the tier as unchecked,
|
|
178
|
+
* both — a fault and an unanswered question are two facts, and neither hides the other.
|
|
179
|
+
*/
|
|
180
|
+
export declare class SettingsAccountIncomplete extends InternalError {
|
|
181
|
+
/** What the environments that did answer were found to have wrong. */
|
|
182
|
+
readonly findings: readonly SettingsFinding[];
|
|
183
|
+
/** The environments that did not answer, in the order they were asked. */
|
|
184
|
+
readonly unanswered: readonly string[];
|
|
185
|
+
constructor(findings: readonly SettingsFinding[], unanswered: readonly UnansweredEnvironment[]);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The findings an account check reached before it threw — none for an ordinary throw, and what it had
|
|
189
|
+
* collected for a {@link SettingsAccountIncomplete}.
|
|
190
|
+
*/
|
|
191
|
+
export declare function settingsFindingsBefore(error: unknown): readonly SettingsFinding[];
|
|
119
192
|
/**
|
|
120
193
|
* A capability's settings check, as it hangs off the capability.
|
|
121
194
|
*
|
|
@@ -129,6 +202,17 @@ export interface CapabilitySettings {
|
|
|
129
202
|
/** The half that costs a Cloudflare call. Omitted where a capability has nothing to ask the account. */
|
|
130
203
|
account?(context: SettingsAccountContext): Promise<SettingsFinding[]>;
|
|
131
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* **Two or more checks on one capability, as the one `settings` it declares (#728).** Media names records a
|
|
207
|
+
* narrowed visibility no longer admits and a bundle still holding a superseded token: two questions, one
|
|
208
|
+
* capability, one seam.
|
|
209
|
+
*
|
|
210
|
+
* Each tier runs every check's, in declaration order. A check that could not answer for some environments
|
|
211
|
+
* costs those environments and nothing else: the others' findings are kept, and the run ends in one
|
|
212
|
+
* {@link SettingsAccountIncomplete} carrying every finding and every unanswered environment. A check that
|
|
213
|
+
* throws outright is unanswered for every environment the context declares.
|
|
214
|
+
*/
|
|
215
|
+
export declare function allSettings(...checks: readonly CapabilitySettings[]): CapabilitySettings;
|
|
132
216
|
/**
|
|
133
217
|
* Turn a host env's own parse report into findings — the bridge that makes "one schema, two readers" real.
|
|
134
218
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/capability/settings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAA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,EAAE,OAAO,GAAG,SAAS,eAAe,EAAE,CAEjF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,KAAK,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACrF,wGAAwG;IACxG,OAAO,CAAC,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,GAAG,MAAM,EAAE,SAAS,kBAAkB,EAAE,GAAG,kBAAkB,CAwCxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CAU7G"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { InternalError } from "../error/pithyError.js";
|
|
3
4
|
import { hostEnvProviderSentence } from "../workflow/hostEnv.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/capability/settings.ts
|
|
@@ -49,6 +50,84 @@ const SettingsFinding = z.object({
|
|
|
49
50
|
fix: z.string().min(1).optional().describe("The `pithy` command that resolves it, whole and runnable as written, when one does. Absent when the remedy is an edit or an account action, and from a capability older than the field — `pithy doctor --json` reports either as `fix: null`.")
|
|
50
51
|
}).describe("One capability setting that does not work, with the action that resolves it.");
|
|
51
52
|
/**
|
|
53
|
+
* An account check that answered for some environments and not for others.
|
|
54
|
+
*
|
|
55
|
+
* A check that asks per environment must not let one unanswerable environment cost the others their
|
|
56
|
+
* findings: staging stood up before prod is the ordinary bring-up, and a check that threw on prod's missing
|
|
57
|
+
* database would throw away what it had already found in staging. So it collects what it can, and throws
|
|
58
|
+
* this at the end carrying those findings. The runner reports them as findings and the tier as unchecked,
|
|
59
|
+
* both — a fault and an unanswered question are two facts, and neither hides the other.
|
|
60
|
+
*/
|
|
61
|
+
var SettingsAccountIncomplete = class extends InternalError {
|
|
62
|
+
/** What the environments that did answer were found to have wrong. */
|
|
63
|
+
findings;
|
|
64
|
+
/** The environments that did not answer, in the order they were asked. */
|
|
65
|
+
unanswered;
|
|
66
|
+
constructor(findings, unanswered) {
|
|
67
|
+
const reasons = unanswered.map(({ environment, cause }) => `${environment}: ${describeCause(cause)}`).join("; ");
|
|
68
|
+
super({
|
|
69
|
+
message: `The account check could not answer for ${unanswered.map(({ environment }) => environment).join(", ")}.`,
|
|
70
|
+
detail: reasons
|
|
71
|
+
}, { cause: unanswered[0]?.cause });
|
|
72
|
+
this.findings = findings;
|
|
73
|
+
this.unanswered = unanswered.map(({ environment }) => environment);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/** A cause, as one line. */
|
|
77
|
+
function describeCause(cause) {
|
|
78
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The findings an account check reached before it threw — none for an ordinary throw, and what it had
|
|
82
|
+
* collected for a {@link SettingsAccountIncomplete}.
|
|
83
|
+
*/
|
|
84
|
+
function settingsFindingsBefore(error) {
|
|
85
|
+
return error instanceof SettingsAccountIncomplete ? error.findings : [];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* **Two or more checks on one capability, as the one `settings` it declares (#728).** Media names records a
|
|
89
|
+
* narrowed visibility no longer admits and a bundle still holding a superseded token: two questions, one
|
|
90
|
+
* capability, one seam.
|
|
91
|
+
*
|
|
92
|
+
* Each tier runs every check's, in declaration order. A check that could not answer for some environments
|
|
93
|
+
* costs those environments and nothing else: the others' findings are kept, and the run ends in one
|
|
94
|
+
* {@link SettingsAccountIncomplete} carrying every finding and every unanswered environment. A check that
|
|
95
|
+
* throws outright is unanswered for every environment the context declares.
|
|
96
|
+
*/
|
|
97
|
+
function allSettings(...checks) {
|
|
98
|
+
const accounts = checks.flatMap((check) => check.account ? [check.account.bind(check)] : []);
|
|
99
|
+
return {
|
|
100
|
+
async local(context) {
|
|
101
|
+
const findings = [];
|
|
102
|
+
for (const check of checks) findings.push(...await check.local(context));
|
|
103
|
+
return findings;
|
|
104
|
+
},
|
|
105
|
+
...accounts.length === 0 ? {} : { async account(context) {
|
|
106
|
+
const findings = [];
|
|
107
|
+
const unanswered = [];
|
|
108
|
+
for (const account of accounts) try {
|
|
109
|
+
findings.push(...await account(context));
|
|
110
|
+
} catch (cause) {
|
|
111
|
+
findings.push(...settingsFindingsBefore(cause));
|
|
112
|
+
if (cause instanceof SettingsAccountIncomplete) {
|
|
113
|
+
for (const environment of cause.unanswered) if (!unanswered.some((entry) => entry.environment === environment)) unanswered.push({
|
|
114
|
+
environment,
|
|
115
|
+
cause: cause.cause ?? cause
|
|
116
|
+
});
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (context.environments.length === 0) throw cause;
|
|
120
|
+
for (const { name } of context.environments) if (!unanswered.some((entry) => entry.environment === name)) unanswered.push({
|
|
121
|
+
environment: name,
|
|
122
|
+
cause
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (unanswered.length > 0) throw new SettingsAccountIncomplete(findings, unanswered);
|
|
126
|
+
return findings;
|
|
127
|
+
} }
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
52
131
|
* Turn a host env's own parse report into findings — the bridge that makes "one schema, two readers" real.
|
|
53
132
|
*
|
|
54
133
|
* A capability's local tier builds the env its host *would* be handed, runs {@link
|
|
@@ -67,4 +146,4 @@ function hostEnvFindings(report, environment) {
|
|
|
67
146
|
}));
|
|
68
147
|
}
|
|
69
148
|
//#endregion
|
|
70
|
-
export { SettingsFinding, hostEnvFindings };
|
|
149
|
+
export { SettingsAccountIncomplete, SettingsFinding, allSettings, hostEnvFindings, settingsFindingsBefore };
|