@pithy-sh/core 0.13.0 → 0.15.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/README.md +54 -0
- package/dist/audit/auditEvent.js +1 -1
- package/dist/audit/chain.d.ts +289 -0
- package/dist/audit/chain.d.ts.map +1 -0
- package/dist/audit/chain.js +400 -0
- package/dist/audit/citations.d.ts +52 -0
- package/dist/audit/citations.d.ts.map +1 -0
- package/dist/audit/citations.js +13 -0
- package/dist/capability/bindings.d.ts +22 -0
- package/dist/capability/bindings.d.ts.map +1 -1
- package/dist/capability/bindings.js +32 -2
- package/dist/capability/capability.d.ts +123 -16
- package/dist/capability/capability.d.ts.map +1 -1
- package/dist/capability/capability.js +17 -2
- package/dist/capability/erasure.d.ts +75 -0
- package/dist/capability/erasure.d.ts.map +1 -0
- package/dist/capability/erasure.js +2 -0
- package/dist/capability/manifest.d.ts +5 -0
- package/dist/capability/manifest.d.ts.map +1 -1
- package/dist/capability/personColumns.d.ts +28 -0
- package/dist/capability/personColumns.d.ts.map +1 -0
- package/dist/capability/personColumns.js +66 -0
- package/dist/capability/personRows.d.ts +62 -0
- package/dist/capability/personRows.d.ts.map +1 -0
- package/dist/capability/personRows.js +59 -0
- package/dist/capability/purge.d.ts +86 -19
- package/dist/capability/purge.d.ts.map +1 -1
- package/dist/capability/purge.js +83 -5
- package/dist/capability/settings.d.ts +10 -0
- package/dist/capability/settings.d.ts.map +1 -1
- package/dist/capability/vectorIndex.d.ts +36 -0
- package/dist/capability/vectorIndex.d.ts.map +1 -0
- package/dist/capability/vectorIndex.js +25 -0
- package/dist/cli/commandCatalog.generated.d.ts +438 -3
- package/dist/cli/commandCatalog.generated.d.ts.map +1 -1
- package/dist/cli/commandCatalog.generated.js +454 -2
- package/dist/cli/commandFacts.d.ts +8 -5
- package/dist/cli/commandFacts.d.ts.map +1 -1
- package/dist/cli/commandFacts.js +12 -3
- package/dist/consent/purpose.d.ts +70 -0
- package/dist/consent/purpose.d.ts.map +1 -0
- package/dist/consent/purpose.js +97 -0
- package/dist/consent/reader.d.ts +99 -0
- package/dist/consent/reader.d.ts.map +1 -0
- package/dist/consent/reader.js +33 -0
- package/dist/controlPlane/audit/actions.d.ts +15 -4
- package/dist/controlPlane/audit/actions.d.ts.map +1 -1
- package/dist/controlPlane/audit/actions.js +16 -5
- package/dist/controlPlane/capability.d.ts +10 -0
- package/dist/controlPlane/capability.d.ts.map +1 -1
- package/dist/controlPlane/capability.js +56 -8
- package/dist/controlPlane/context.d.ts +4 -0
- package/dist/controlPlane/context.d.ts.map +1 -1
- package/dist/controlPlane/context.js +3 -2
- package/dist/controlPlane/data/connection.d.ts +21 -2
- package/dist/controlPlane/data/connection.d.ts.map +1 -1
- package/dist/controlPlane/data/connection.js +13 -4
- package/dist/controlPlane/data/connections.d.ts +94 -0
- package/dist/controlPlane/data/connections.d.ts.map +1 -0
- package/dist/controlPlane/data/connections.js +151 -0
- package/dist/controlPlane/data/hold.d.ts +46 -0
- package/dist/controlPlane/data/hold.d.ts.map +1 -0
- package/dist/controlPlane/data/hold.js +36 -0
- package/dist/controlPlane/data/oidcTrust.d.ts +122 -0
- package/dist/controlPlane/data/oidcTrust.d.ts.map +1 -0
- package/dist/controlPlane/data/oidcTrust.js +173 -0
- package/dist/controlPlane/data/tables.d.ts +4 -0
- package/dist/controlPlane/data/tables.d.ts.map +1 -1
- package/dist/controlPlane/data/tables.js +9 -4
- package/dist/controlPlane/data/trustFirstCall.d.ts +16 -0
- package/dist/controlPlane/data/trustFirstCall.d.ts.map +1 -0
- package/dist/controlPlane/data/trustFirstCall.js +25 -0
- package/dist/controlPlane/discovery/adminRoute.d.ts +165 -2
- package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -1
- package/dist/controlPlane/discovery/adminRoute.js +32 -8
- package/dist/controlPlane/discovery/routeInput.d.ts +23 -0
- package/dist/controlPlane/discovery/routeInput.d.ts.map +1 -0
- package/dist/controlPlane/discovery/routeInput.js +80 -0
- package/dist/controlPlane/discovery/toolName.d.ts +21 -0
- package/dist/controlPlane/discovery/toolName.d.ts.map +1 -0
- package/dist/controlPlane/discovery/toolName.js +25 -0
- package/dist/controlPlane/erasure/attest.d.ts +78 -0
- package/dist/controlPlane/erasure/attest.d.ts.map +1 -0
- package/dist/controlPlane/erasure/attest.js +164 -0
- package/dist/controlPlane/erasure/read.d.ts +39 -0
- package/dist/controlPlane/erasure/read.d.ts.map +1 -0
- package/dist/controlPlane/erasure/read.js +140 -0
- package/dist/controlPlane/error/errors.d.ts +61 -2
- package/dist/controlPlane/error/errors.d.ts.map +1 -1
- package/dist/controlPlane/error/errors.js +13 -0
- package/dist/controlPlane/evidence/derive.d.ts +124 -0
- package/dist/controlPlane/evidence/derive.d.ts.map +1 -0
- package/dist/controlPlane/evidence/derive.js +343 -0
- package/dist/controlPlane/evidence/mapping.d.ts +85 -0
- package/dist/controlPlane/evidence/mapping.d.ts.map +1 -0
- package/dist/controlPlane/evidence/mapping.js +114 -0
- package/dist/controlPlane/evidence/pack.d.ts +46 -0
- package/dist/controlPlane/evidence/pack.d.ts.map +1 -0
- package/dist/controlPlane/evidence/pack.js +124 -0
- package/dist/controlPlane/http/connections.d.ts +96 -0
- package/dist/controlPlane/http/connections.d.ts.map +1 -0
- package/dist/controlPlane/http/connections.js +109 -0
- package/dist/controlPlane/http/guard.d.ts +23 -2
- package/dist/controlPlane/http/guard.d.ts.map +1 -1
- package/dist/controlPlane/http/guard.js +69 -12
- package/dist/controlPlane/http/handlers.d.ts +212 -10
- package/dist/controlPlane/http/handlers.d.ts.map +1 -1
- package/dist/controlPlane/http/handlers.js +117 -26
- package/dist/controlPlane/http/holds.d.ts +57 -0
- package/dist/controlPlane/http/holds.d.ts.map +1 -0
- package/dist/controlPlane/http/holds.js +98 -0
- package/dist/controlPlane/http/presence.d.ts +27 -0
- package/dist/controlPlane/http/presence.d.ts.map +1 -0
- package/dist/controlPlane/http/presence.js +67 -0
- package/dist/controlPlane/http/processing.d.ts +73 -0
- package/dist/controlPlane/http/processing.d.ts.map +1 -0
- package/dist/controlPlane/http/processing.js +17 -0
- package/dist/controlPlane/http/responses.d.ts +927 -3
- package/dist/controlPlane/http/responses.d.ts.map +1 -1
- package/dist/controlPlane/http/responses.js +283 -7
- package/dist/controlPlane/http/routes.d.ts +12 -2
- package/dist/controlPlane/http/routes.d.ts.map +1 -1
- package/dist/controlPlane/http/routes.js +182 -5
- package/dist/controlPlane/http/schemas.d.ts +63 -0
- package/dist/controlPlane/http/schemas.d.ts.map +1 -1
- package/dist/controlPlane/http/schemas.js +39 -1
- package/dist/controlPlane/http/verify.d.ts.map +1 -1
- package/dist/controlPlane/http/verify.js +13 -1
- package/dist/controlPlane/http/verifyTrust.d.ts +76 -0
- package/dist/controlPlane/http/verifyTrust.d.ts.map +1 -0
- package/dist/controlPlane/http/verifyTrust.js +75 -0
- package/dist/controlPlane/migrations/0004_connection_trusts.d.ts +15 -0
- package/dist/controlPlane/migrations/0004_connection_trusts.d.ts.map +1 -0
- package/dist/controlPlane/migrations/0004_connection_trusts.js +23 -0
- package/dist/controlPlane/migrations/0005_holds.d.ts +12 -0
- package/dist/controlPlane/migrations/0005_holds.d.ts.map +1 -0
- package/dist/controlPlane/migrations/0005_holds.js +26 -0
- package/dist/controlPlane/processing/derive.d.ts +77 -0
- package/dist/controlPlane/processing/derive.d.ts.map +1 -0
- package/dist/controlPlane/processing/derive.js +206 -0
- package/dist/controlPlane/processing/read.d.ts +10 -0
- package/dist/controlPlane/processing/read.d.ts.map +1 -0
- package/dist/controlPlane/processing/read.js +89 -0
- package/dist/controlPlane/scope/kind.d.ts +46 -0
- package/dist/controlPlane/scope/kind.d.ts.map +1 -0
- package/dist/controlPlane/scope/kind.js +52 -0
- package/dist/controlPlane/scope/scope.d.ts +58 -3
- package/dist/controlPlane/scope/scope.d.ts.map +1 -1
- package/dist/controlPlane/scope/scope.js +59 -4
- package/dist/controlPlane/token/jws.js +1 -1
- package/dist/controlPlane/token/mint.js +1 -1
- package/dist/controlPlane/wire.d.ts +23 -0
- package/dist/controlPlane/wire.d.ts.map +1 -1
- package/dist/controlPlane/wire.js +24 -1
- package/dist/createBackend.d.ts +13 -0
- package/dist/createBackend.d.ts.map +1 -1
- package/dist/createBackend.js +11 -3
- package/dist/createEntrypoint.d.ts +7 -0
- package/dist/createEntrypoint.d.ts.map +1 -1
- package/dist/createEntrypoint.js +4 -0
- package/dist/error/http.d.ts +168 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +336 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +112 -0
- package/dist/error/pithyError.d.ts +22 -0
- package/dist/error/pithyError.d.ts.map +1 -1
- package/dist/error/pithyError.js +31 -1
- package/dist/http/routeSpec.d.ts +46 -1
- package/dist/http/routeSpec.d.ts.map +1 -1
- package/dist/http/routeSpec.js +39 -5
- package/dist/http/verification.d.ts.map +1 -1
- package/dist/http/verification.js +1 -1
- package/dist/i18n/translator.d.ts +2 -1
- package/dist/i18n/translator.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/logger/record.d.ts +98 -0
- package/dist/logger/record.d.ts.map +1 -1
- package/dist/mcp/annotations.d.ts +20 -0
- package/dist/mcp/annotations.d.ts.map +1 -0
- package/dist/mcp/annotations.js +23 -0
- package/dist/mcp/tools.d.ts +75 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +118 -0
- package/dist/openapi/document.d.ts.map +1 -1
- package/dist/openapi/document.js +8 -26
- package/dist/openapi/operations.d.ts +35 -0
- package/dist/openapi/operations.d.ts.map +1 -0
- package/dist/openapi/operations.js +37 -0
- package/dist/presence/channel.d.ts +11 -0
- package/dist/presence/channel.d.ts.map +1 -0
- package/dist/presence/channel.js +65 -0
- package/dist/presence/declaration.d.ts +154 -0
- package/dist/presence/declaration.d.ts.map +1 -0
- package/dist/presence/declaration.js +164 -0
- package/dist/presence/durableObject.d.ts +61 -0
- package/dist/presence/durableObject.d.ts.map +1 -0
- package/dist/presence/durableObject.js +257 -0
- package/dist/presence/frames.d.ts +166 -0
- package/dist/presence/frames.d.ts.map +1 -0
- package/dist/presence/frames.js +90 -0
- package/dist/presence/http/guard.d.ts +11 -0
- package/dist/presence/http/guard.d.ts.map +1 -0
- package/dist/presence/http/guard.js +20 -0
- package/dist/presence/http/responses.d.ts +31 -0
- package/dist/presence/http/responses.d.ts.map +1 -0
- package/dist/presence/http/responses.js +34 -0
- package/dist/presence/http/routes.d.ts +24 -0
- package/dist/presence/http/routes.d.ts.map +1 -0
- package/dist/presence/http/routes.js +127 -0
- package/dist/presence/http/schemas.d.ts +29 -0
- package/dist/presence/http/schemas.d.ts.map +1 -0
- package/dist/presence/http/schemas.js +28 -0
- package/dist/presence/names.d.ts +23 -0
- package/dist/presence/names.d.ts.map +1 -0
- package/dist/presence/names.js +22 -0
- package/dist/presence/room.d.ts +95 -0
- package/dist/presence/room.d.ts.map +1 -0
- package/dist/presence/room.js +105 -0
- package/dist/presence/ticket.d.ts +55 -0
- package/dist/presence/ticket.d.ts.map +1 -0
- package/dist/presence/ticket.js +109 -0
- package/dist/privacy/classify.js +1 -1
- package/dist/privacy/encrypted.js +1 -1
- package/dist/processing/activity.d.ts +134 -0
- package/dist/processing/activity.d.ts.map +1 -0
- package/dist/processing/activity.js +161 -0
- package/dist/processing/composed.d.ts +18 -0
- package/dist/processing/composed.d.ts.map +1 -0
- package/dist/processing/composed.js +28 -0
- package/dist/processing/vocabulary.d.ts +26 -0
- package/dist/processing/vocabulary.d.ts.map +1 -0
- package/dist/processing/vocabulary.js +35 -0
- package/dist/queue/consumer.d.ts +59 -0
- package/dist/queue/consumer.d.ts.map +1 -0
- package/dist/queue/consumer.js +46 -0
- package/dist/retention/composed.d.ts +37 -0
- package/dist/retention/composed.d.ts.map +1 -0
- package/dist/retention/composed.js +66 -0
- package/dist/retention/holds.d.ts +61 -0
- package/dist/retention/holds.d.ts.map +1 -0
- package/dist/retention/holds.js +107 -0
- package/dist/retention/holdsPurge.d.ts +22 -0
- package/dist/retention/holdsPurge.d.ts.map +1 -0
- package/dist/retention/holdsPurge.js +50 -0
- package/dist/retention/policy.d.ts +132 -0
- package/dist/retention/policy.d.ts.map +1 -0
- package/dist/retention/policy.js +197 -0
- package/dist/session/rotated.d.ts +34 -0
- package/dist/session/rotated.d.ts.map +1 -0
- package/dist/session/rotated.js +25 -0
- package/dist/test-utils/connectionFixtures.d.ts +13 -0
- package/dist/test-utils/connectionFixtures.d.ts.map +1 -0
- package/dist/test-utils/connectionFixtures.js +58 -0
- package/dist/test-utils/interleave.d.ts +12 -0
- package/dist/test-utils/interleave.d.ts.map +1 -0
- package/dist/test-utils/interleave.js +26 -0
- package/dist/testWorker.d.ts +8 -0
- package/dist/testWorker.d.ts.map +1 -0
- package/dist/testWorker.js +9 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workflow/dispatchRoute.js +1 -1
- package/package.json +1 -1
- package/src/audit/auditEvent.ts +1 -1
- package/src/audit/chain.ts +551 -0
- package/src/audit/citations.ts +63 -0
- package/src/capability/bindings.ts +61 -0
- package/src/capability/capability.ts +156 -19
- package/src/capability/erasure.ts +82 -0
- package/src/capability/personColumns.ts +83 -0
- package/src/capability/personRows.ts +125 -0
- package/src/capability/purge.ts +158 -21
- package/src/capability/settings.ts +7 -0
- package/src/capability/vectorIndex.ts +60 -0
- package/src/cli/commandCatalog.generated.ts +487 -2
- package/src/cli/commandFacts.ts +12 -3
- package/src/cloudflare-test.d.ts +3 -1
- package/src/consent/purpose.ts +160 -0
- package/src/consent/reader.ts +134 -0
- package/src/controlPlane/audit/actions.ts +15 -4
- package/src/controlPlane/capability.ts +99 -20
- package/src/controlPlane/context.ts +10 -2
- package/src/controlPlane/data/connection.ts +16 -2
- package/src/controlPlane/data/connections.ts +231 -0
- package/src/controlPlane/data/hold.ts +52 -0
- package/src/controlPlane/data/oidcTrust.ts +249 -0
- package/src/controlPlane/data/tables.ts +7 -0
- package/src/controlPlane/data/trustFirstCall.ts +37 -0
- package/src/controlPlane/discovery/adminRoute.ts +71 -9
- package/src/controlPlane/discovery/routeInput.ts +86 -0
- package/src/controlPlane/discovery/toolName.ts +23 -0
- package/src/controlPlane/erasure/attest.ts +205 -0
- package/src/controlPlane/erasure/read.ts +169 -0
- package/src/controlPlane/error/errors.ts +69 -2
- package/src/controlPlane/evidence/derive.ts +426 -0
- package/src/controlPlane/evidence/mapping.ts +118 -0
- package/src/controlPlane/evidence/pack.ts +190 -0
- package/src/controlPlane/http/connections.ts +129 -0
- package/src/controlPlane/http/guard.ts +118 -9
- package/src/controlPlane/http/handlers.ts +172 -40
- package/src/controlPlane/http/holds.ts +108 -0
- package/src/controlPlane/http/presence.ts +71 -0
- package/src/controlPlane/http/processing.ts +19 -0
- package/src/controlPlane/http/responses.ts +590 -7
- package/src/controlPlane/http/routes.ts +302 -3
- package/src/controlPlane/http/schemas.ts +126 -0
- package/src/controlPlane/http/verify.ts +19 -2
- package/src/controlPlane/http/verifyTrust.ts +176 -0
- package/src/controlPlane/migrations/0004_connection_trusts.ts +30 -0
- package/src/controlPlane/migrations/0005_holds.ts +40 -0
- package/src/controlPlane/processing/derive.ts +359 -0
- package/src/controlPlane/processing/read.ts +102 -0
- package/src/controlPlane/scope/kind.ts +63 -0
- package/src/controlPlane/scope/scope.ts +65 -3
- package/src/controlPlane/wire.ts +26 -0
- package/src/createBackend.ts +31 -6
- package/src/createEntrypoint.ts +17 -0
- package/src/error/payload.ts +234 -0
- package/src/error/pithyError.ts +42 -0
- package/src/http/routeSpec.ts +75 -5
- package/src/http/verification.ts +3 -1
- package/src/i18n/translator.ts +2 -1
- package/src/index.ts +2 -0
- package/src/mcp/annotations.ts +38 -0
- package/src/mcp/tools.ts +220 -0
- package/src/openapi/document.ts +8 -28
- package/src/openapi/operations.ts +62 -0
- package/src/presence/channel.ts +46 -0
- package/src/presence/declaration.ts +283 -0
- package/src/presence/durableObject.ts +287 -0
- package/src/presence/frames.ts +153 -0
- package/src/presence/http/guard.ts +23 -0
- package/src/presence/http/responses.ts +63 -0
- package/src/presence/http/routes.ts +165 -0
- package/src/presence/http/schemas.ts +39 -0
- package/src/presence/names.ts +45 -0
- package/src/presence/room.ts +145 -0
- package/src/presence/ticket.ts +145 -0
- package/src/processing/activity.ts +289 -0
- package/src/processing/composed.ts +33 -0
- package/src/processing/vocabulary.ts +43 -0
- package/src/queue/consumer.ts +104 -0
- package/src/retention/composed.ts +75 -0
- package/src/retention/holds.ts +175 -0
- package/src/retention/holdsPurge.ts +50 -0
- package/src/retention/policy.ts +305 -0
- package/src/session/rotated.ts +53 -0
- package/src/test-utils/connectionFixtures.ts +58 -0
- package/src/test-utils/interleave.ts +31 -0
- package/src/testWorker.ts +13 -0
- package/src/version.generated.ts +1 -1
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { PrivacyPosture } from "../../privacy/posture";
|
|
6
6
|
import { PRIVACY_SOURCES } from "../../privacy/report";
|
|
7
|
-
import {
|
|
7
|
+
import { BASIS_SOURCES, LegalBasis, PROCESSING_GAP_KINDS, RECIPIENT_SOURCES } from "../../processing/vocabulary";
|
|
8
|
+
import {
|
|
9
|
+
ConnectionCredentialKind,
|
|
10
|
+
ConnectionPrincipal,
|
|
11
|
+
ConnectionPurpose,
|
|
12
|
+
ControlPlaneActorKind,
|
|
13
|
+
Ed25519PublicJwk,
|
|
14
|
+
} from "../data/connection";
|
|
15
|
+
import { EvidenceControlId, EvidenceSource, EvidenceState } from "../evidence/mapping";
|
|
8
16
|
|
|
9
17
|
/**
|
|
10
18
|
* What the seam's own routes return, as Zod objects a management client can validate against.
|
|
@@ -44,6 +52,35 @@ export const PublicKeyView = z
|
|
|
44
52
|
.describe("One registered public key and its validity window. Two live at once during a rotation overlap.");
|
|
45
53
|
export type PublicKeyView = z.output<typeof PublicKeyView>;
|
|
46
54
|
|
|
55
|
+
/**
|
|
56
|
+
* One OIDC trust as `GET {basePath}/keys` lists it: who it admits, beside who sanctioned it.
|
|
57
|
+
*
|
|
58
|
+
* **The subject constraint is on the face of the listing**, because it *is* the population: a trust pinned to a
|
|
59
|
+
* workflow is usable by anyone who can run that workflow, and the claims are the only place that is written down.
|
|
60
|
+
* Nothing here is secret — an issuer, an audience and claim values are all public facts about a workload.
|
|
61
|
+
*/
|
|
62
|
+
export const TrustView = z
|
|
63
|
+
.object({
|
|
64
|
+
trustId: z.string().describe("The trust's id, as a call names it on `pithy-control-plane-trust`."),
|
|
65
|
+
issuer: z.string().describe("The `iss` the trust accepts."),
|
|
66
|
+
audience: z.string().describe("The `aud` a token must name."),
|
|
67
|
+
claims: z
|
|
68
|
+
.record(z.string().describe("A claim name."), z.string().describe("The value that claim must have."))
|
|
69
|
+
.describe("The subject constraint: every named claim must equal its value. This is who may use the trust."),
|
|
70
|
+
authorizedBy: z.string().describe("Who sanctioned the trust — never who may use it."),
|
|
71
|
+
validFrom: z.iso.datetime().describe("When the trust was registered, ISO-8601."),
|
|
72
|
+
revokedAt: z.iso
|
|
73
|
+
.datetime()
|
|
74
|
+
.nullable()
|
|
75
|
+
.describe("When it was revoked, ISO-8601, or null. A token already minted stays usable until it expires."),
|
|
76
|
+
firstCallAt: z.iso
|
|
77
|
+
.datetime()
|
|
78
|
+
.nullable()
|
|
79
|
+
.describe("When a call first verified under it, ISO-8601, or null while it is awaiting a first call."),
|
|
80
|
+
})
|
|
81
|
+
.describe("One OIDC trust: who it admits, and who sanctioned it.");
|
|
82
|
+
export type TrustView = z.output<typeof TrustView>;
|
|
83
|
+
|
|
47
84
|
/**
|
|
48
85
|
* `GET /control-plane/ping`.
|
|
49
86
|
*
|
|
@@ -67,8 +104,7 @@ export const ControlPlaneKeysResponse = z
|
|
|
67
104
|
connectionId: z.string().describe("The connection these keys belong to."),
|
|
68
105
|
environment: z.string().describe("The environment that connection is bound to."),
|
|
69
106
|
keys: z.array(PublicKeyView).describe("Every registered key, expired and revoked ones included."),
|
|
70
|
-
//
|
|
71
|
-
// predates the three columns receives none of them, and must still parse the answer.
|
|
107
|
+
// `.optional()` as well as `.nullable()`: a Worker that predates the three columns sends none of them.
|
|
72
108
|
authorizedBy: ConnectionPrincipal.nullable()
|
|
73
109
|
.optional()
|
|
74
110
|
.describe(
|
|
@@ -84,8 +120,12 @@ export const ControlPlaneKeysResponse = z
|
|
|
84
120
|
.describe(
|
|
85
121
|
"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.",
|
|
86
122
|
),
|
|
123
|
+
trusts: z
|
|
124
|
+
.array(TrustView)
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("Every OIDC trust on this connection, revoked ones included. Absent from a Worker older than trusts."),
|
|
87
127
|
})
|
|
88
|
-
.describe("Every key registered against this connection,
|
|
128
|
+
.describe("Every key and trust registered against this connection, and who authorized it for what.");
|
|
89
129
|
export type ControlPlaneKeysResponse = z.output<typeof ControlPlaneKeysResponse>;
|
|
90
130
|
|
|
91
131
|
/** `POST /control-plane/keys` — the appended key, and the set as it now stands. */
|
|
@@ -232,9 +272,9 @@ export const ControlPlaneMigrationsResponse = z
|
|
|
232
272
|
export type ControlPlaneMigrationsResponse = z.output<typeof ControlPlaneMigrationsResponse>;
|
|
233
273
|
|
|
234
274
|
/**
|
|
235
|
-
* One marked field, as `GET {basePath}/privacy` reports it
|
|
275
|
+
* One marked field, as `GET {basePath}/privacy` reports it.
|
|
236
276
|
*
|
|
237
|
-
* **The per-field record.**
|
|
277
|
+
* **The per-field record.** It says whether the field rests encrypted beside `class`, so "which of
|
|
238
278
|
* your PHI fields are encrypted" is a derivation over this list rather than a second inventory to keep.
|
|
239
279
|
*/
|
|
240
280
|
export const PrivacyFieldView = z
|
|
@@ -306,7 +346,7 @@ export const PrivacySchemaView = z
|
|
|
306
346
|
export type PrivacySchemaView = z.output<typeof PrivacySchemaView>;
|
|
307
347
|
|
|
308
348
|
/**
|
|
309
|
-
* `GET /control-plane/privacy` — the full inventory, behind `privacy:read
|
|
349
|
+
* `GET /control-plane/privacy` — the full inventory, behind `privacy:read`.
|
|
310
350
|
*
|
|
311
351
|
* Derived at runtime from the schemas this Worker composed, walked once per isolate. The manifest's `privacy`
|
|
312
352
|
* block is the headline; this is the detail, and it names fields, which is why it has a scope of its own.
|
|
@@ -328,3 +368,546 @@ export const ControlPlanePrivacyResponse = z
|
|
|
328
368
|
"Every schema this Worker stores that holds a marked field, each field's path and class, and where it lives.",
|
|
329
369
|
);
|
|
330
370
|
export type ControlPlanePrivacyResponse = z.output<typeof ControlPlanePrivacyResponse>;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* One value a fact carries: a scalar, a list of names, or null where the record holds nothing.
|
|
374
|
+
*
|
|
375
|
+
* Scalars and string lists only, so a fact can never carry a row, a secret, or a key: it names and counts.
|
|
376
|
+
*/
|
|
377
|
+
export const EvidenceValue = z
|
|
378
|
+
.union([z.string(), z.number(), z.boolean(), z.null(), z.array(z.string().describe("One name."))])
|
|
379
|
+
.describe("A fact's value: a word, a number, a flag, a list of names, or null where the record holds none.");
|
|
380
|
+
export type EvidenceValue = z.output<typeof EvidenceValue>;
|
|
381
|
+
|
|
382
|
+
/** One fact the Worker read for a control, and the declaration it read it from. */
|
|
383
|
+
export const EvidenceFact = z
|
|
384
|
+
.object({
|
|
385
|
+
fact: z.string().describe("What the fact is, as one camelCase name: `auditRecorder`, `liveKeys`, `pending`."),
|
|
386
|
+
subject: z
|
|
387
|
+
.string()
|
|
388
|
+
.optional()
|
|
389
|
+
.describe(
|
|
390
|
+
"What the fact is about where a control reads several of one thing: a connection id, a database name, a capability, a class, a strategy. Absent where the fact is about the Worker as a whole.",
|
|
391
|
+
),
|
|
392
|
+
value: EvidenceValue.describe("What the Worker read."),
|
|
393
|
+
source: EvidenceSource.describe("The declaration or record it was read from."),
|
|
394
|
+
})
|
|
395
|
+
.describe("One fact behind a control, and where it came from.");
|
|
396
|
+
export type EvidenceFact = z.output<typeof EvidenceFact>;
|
|
397
|
+
|
|
398
|
+
/** One control in the pack: its references, the facts read, and what the Worker could say. */
|
|
399
|
+
export const EvidenceEntry = z
|
|
400
|
+
.object({
|
|
401
|
+
control: EvidenceControlId,
|
|
402
|
+
title: z.string().describe("The control in one line, as the mapping table names it."),
|
|
403
|
+
soc2: z
|
|
404
|
+
.array(z.string().describe("One criterion, such as `CC6.1`."))
|
|
405
|
+
.describe("The AICPA Trust Services Criteria this control answers."),
|
|
406
|
+
iso27001: z
|
|
407
|
+
.array(z.string().describe("One Annex A control, such as `A.8.15`."))
|
|
408
|
+
.describe("The ISO/IEC 27001:2022 Annex A controls this control answers."),
|
|
409
|
+
state: EvidenceState,
|
|
410
|
+
reasons: z
|
|
411
|
+
.array(z.string().describe("One sentence."))
|
|
412
|
+
.describe(
|
|
413
|
+
"For `gap`, what is missing. For `not-derivable`, why the Worker cannot say. Empty when `evidenced`. Where both kinds apply, the gaps come first.",
|
|
414
|
+
),
|
|
415
|
+
facts: z
|
|
416
|
+
.array(EvidenceFact)
|
|
417
|
+
.describe("Every fact read for this control, each naming its source. Read from declarations, never typed in."),
|
|
418
|
+
})
|
|
419
|
+
.describe("One control: what it answers, what the Worker read, and what it could say. Evidence, never a judgment.");
|
|
420
|
+
export type EvidenceEntry = z.output<typeof EvidenceEntry>;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* `GET /control-plane/evidence` — the evidence pack, behind `evidence:read`.
|
|
424
|
+
*
|
|
425
|
+
* Computed in the Worker because the Worker is the deployed build: every fact is read from what this build
|
|
426
|
+
* composes and records. It proves controls present and performs nothing.
|
|
427
|
+
*/
|
|
428
|
+
export const ControlPlaneEvidenceResponse = z
|
|
429
|
+
.object({
|
|
430
|
+
environment: z.string().describe("The environment this Worker answers for."),
|
|
431
|
+
generatedAt: z.iso.datetime().describe("When this Worker read the facts, ISO-8601."),
|
|
432
|
+
version: z
|
|
433
|
+
.string()
|
|
434
|
+
.nullable()
|
|
435
|
+
.describe("The Cloudflare version id of the build that answered, or null where the binding is absent."),
|
|
436
|
+
mappingVersion: z
|
|
437
|
+
.number()
|
|
438
|
+
.int()
|
|
439
|
+
.positive()
|
|
440
|
+
.describe(
|
|
441
|
+
"The version of the kit's mapping table these entries follow. A control, a reference or a rule moving is a new version.",
|
|
442
|
+
),
|
|
443
|
+
controls: z
|
|
444
|
+
.array(EvidenceEntry)
|
|
445
|
+
.describe("One entry per control in the mapping table, in its order. Evidence for an auditor to weigh."),
|
|
446
|
+
})
|
|
447
|
+
.describe(
|
|
448
|
+
"SOC 2 and ISO 27001 evidence this Worker derives from its own declarations. Each control names its facts, their sources and what could be said. An auditor decides the rest.",
|
|
449
|
+
);
|
|
450
|
+
export type ControlPlaneEvidenceResponse = z.output<typeof ControlPlaneEvidenceResponse>;
|
|
451
|
+
|
|
452
|
+
/** Where a purge stands. */
|
|
453
|
+
export const ErasureState = z
|
|
454
|
+
.enum(["scheduled", "in_progress", "complete", "failed"])
|
|
455
|
+
.describe(
|
|
456
|
+
"Where the purge stands: `scheduled`, deleted with its window still open and nothing erased yet; `in_progress`, due and not yet finished; `complete`, every step ran and the `purged` record is written; `failed`, the purge gave up at the step it names, until the next daily pass starts it again.",
|
|
457
|
+
);
|
|
458
|
+
export type ErasureState = z.output<typeof ErasureState>;
|
|
459
|
+
|
|
460
|
+
/** One recorded audit event, cited by id and chain position. Never its personal values. */
|
|
461
|
+
export const ErasureCitation = z
|
|
462
|
+
.object({
|
|
463
|
+
eventId: z.string().describe("The audit event's stable public id."),
|
|
464
|
+
action: z.string().describe("Its `domain/reason` action."),
|
|
465
|
+
occurredAt: z.iso.datetime().describe("When it was recorded, ISO-8601."),
|
|
466
|
+
tenant: z
|
|
467
|
+
.string()
|
|
468
|
+
.nullable()
|
|
469
|
+
.describe("The tenant whose chain holds it, or null for the untenanted chain. `pithy audit verify` walks it."),
|
|
470
|
+
seq: z
|
|
471
|
+
.number()
|
|
472
|
+
.int()
|
|
473
|
+
.nullable()
|
|
474
|
+
.describe("Its 1-based position in that chain, or null for an event recorded before the chain began."),
|
|
475
|
+
hash: z.string().nullable().describe("Its chain hash, or null for an event recorded before the chain began."),
|
|
476
|
+
})
|
|
477
|
+
.describe(
|
|
478
|
+
"One audit event the attestation rests on, by id and chain position. The chain (#822) is what makes it tamper-evident; nothing here is signed.",
|
|
479
|
+
);
|
|
480
|
+
export type ErasureCitation = z.output<typeof ErasureCitation>;
|
|
481
|
+
|
|
482
|
+
/** One purge step: whose rows, what happened to them, and the event that records it. */
|
|
483
|
+
export const ErasureStepView = z
|
|
484
|
+
.object({
|
|
485
|
+
capability: z.string().describe("The capability whose rows this step answered for."),
|
|
486
|
+
disposition: z
|
|
487
|
+
.enum(["erased", "retained"])
|
|
488
|
+
.describe(
|
|
489
|
+
"`erased`, the rows were deleted or anonymized; `retained`, the capability kept them under the reason it stated (#814). A retained step never reads as erased.",
|
|
490
|
+
),
|
|
491
|
+
reason: z
|
|
492
|
+
.string()
|
|
493
|
+
.nullable()
|
|
494
|
+
.describe(
|
|
495
|
+
"For a retained step, the basis the capability stated, written for the person. Null for an erased step.",
|
|
496
|
+
),
|
|
497
|
+
summary: z
|
|
498
|
+
.string()
|
|
499
|
+
.nullable()
|
|
500
|
+
.describe(
|
|
501
|
+
"For an erased step, what the capability says it erases. Null for a retained step, and when none was given.",
|
|
502
|
+
),
|
|
503
|
+
completedAt: z.iso.datetime().describe("When the step finished, ISO-8601."),
|
|
504
|
+
audit: ErasureCitation.nullable().describe(
|
|
505
|
+
"The audit event that records this step, or null when the trail holds none: no audit composed, or a step run before #823.",
|
|
506
|
+
),
|
|
507
|
+
})
|
|
508
|
+
.describe("One step of a purge: one capability's rows, erased or kept with a reason, and the event that records it.");
|
|
509
|
+
export type ErasureStepView = z.output<typeof ErasureStepView>;
|
|
510
|
+
|
|
511
|
+
/** The subject an attestation is about: its kind and its id, and nothing else. */
|
|
512
|
+
export const ErasureSubjectView = z
|
|
513
|
+
.object({
|
|
514
|
+
type: z.enum(["user", "organization"]).describe("The kind of subject."),
|
|
515
|
+
id: z.string().describe("Its id, the one value the trail keeps about it."),
|
|
516
|
+
})
|
|
517
|
+
.describe("Who was erased: the kind of subject and its id. No address, no name.");
|
|
518
|
+
export type ErasureSubjectView = z.output<typeof ErasureSubjectView>;
|
|
519
|
+
|
|
520
|
+
/** One subject's erasure, attested. */
|
|
521
|
+
export const ErasureAttestation = z
|
|
522
|
+
.object({
|
|
523
|
+
subject: ErasureSubjectView,
|
|
524
|
+
deletion: z
|
|
525
|
+
.object({
|
|
526
|
+
at: z.iso.datetime().describe("When the subject was deleted, ISO-8601."),
|
|
527
|
+
actorType: z
|
|
528
|
+
.string()
|
|
529
|
+
.describe(
|
|
530
|
+
"Who deleted it: `control-plane` (a management client), `user` (the account's own holder) or `system`.",
|
|
531
|
+
),
|
|
532
|
+
reason: z.string().nullable().describe("Why, in the words of whoever deleted it. Null when nobody had to say."),
|
|
533
|
+
mode: z
|
|
534
|
+
.enum(["soft", "hard"])
|
|
535
|
+
.nullable()
|
|
536
|
+
.describe(
|
|
537
|
+
"`soft`, with a window to restore it; `hard`, with none — a soft deletion brought forward reads as `hard`. Null for a deletion recorded before #823.",
|
|
538
|
+
),
|
|
539
|
+
purgeAfter: z.iso
|
|
540
|
+
.datetime()
|
|
541
|
+
.nullable()
|
|
542
|
+
.describe("When the purge came due, ISO-8601. Null for a deletion recorded before #823."),
|
|
543
|
+
audit: ErasureCitation.nullable().describe(
|
|
544
|
+
"The audit event that records the deletion, or null when the trail holds none.",
|
|
545
|
+
),
|
|
546
|
+
})
|
|
547
|
+
.describe("The deletion the purge erases under."),
|
|
548
|
+
state: ErasureState,
|
|
549
|
+
overdue: z
|
|
550
|
+
.boolean()
|
|
551
|
+
.describe("True when the purge came due more than two days ago and has not completed: a daily pass was missed."),
|
|
552
|
+
stoppedAt: z
|
|
553
|
+
.string()
|
|
554
|
+
.nullable()
|
|
555
|
+
.describe(
|
|
556
|
+
"For a failed purge, the step it gave up at. For an overdue one, the last step it finished, or `due` when none has run. Null otherwise.",
|
|
557
|
+
),
|
|
558
|
+
steps: z
|
|
559
|
+
.array(ErasureStepView)
|
|
560
|
+
.describe(
|
|
561
|
+
"Every step that has run, in the order it first ran. A step run again on a later pass is shown once, as it last finished.",
|
|
562
|
+
),
|
|
563
|
+
completedAt: z.iso.datetime().nullable().describe("When the purge finished, ISO-8601. Null until it has."),
|
|
564
|
+
completion: ErasureCitation.nullable().describe(
|
|
565
|
+
"The audit event that records the purge finishing, or null until it has, or when the trail holds none.",
|
|
566
|
+
),
|
|
567
|
+
failure: ErasureCitation.nullable().describe("The audit event that records the purge giving up, or null."),
|
|
568
|
+
trail: z
|
|
569
|
+
.enum(["recorded", "absent"])
|
|
570
|
+
.describe(
|
|
571
|
+
"`recorded` when an audit capability is composed and its events are cited; `absent` when none is, so nothing here is cited and the lifecycle rows are the only record.",
|
|
572
|
+
),
|
|
573
|
+
})
|
|
574
|
+
.describe(
|
|
575
|
+
"Proof that one subject's erasure happened: the deletion, every step with its disposition, the state, and the audit events that record each one.",
|
|
576
|
+
);
|
|
577
|
+
export type ErasureAttestation = z.output<typeof ErasureAttestation>;
|
|
578
|
+
|
|
579
|
+
/** `GET /control-plane/erasure/:subjectType/:subjectId` — one subject's attestation, behind `erasure:read`. */
|
|
580
|
+
export const ControlPlaneErasureSubjectResponse = z
|
|
581
|
+
.object({
|
|
582
|
+
generatedAt: z.iso.datetime().describe("When this Worker read the records, ISO-8601."),
|
|
583
|
+
attestation: ErasureAttestation,
|
|
584
|
+
})
|
|
585
|
+
.describe("One subject's erasure attestation, read from the purge's own record and cited in the audit chain.");
|
|
586
|
+
export type ControlPlaneErasureSubjectResponse = z.output<typeof ControlPlaneErasureSubjectResponse>;
|
|
587
|
+
|
|
588
|
+
/** One purge in a period: who, where it stands, and where it stopped. */
|
|
589
|
+
export const ErasurePeriodEntry = z
|
|
590
|
+
.object({
|
|
591
|
+
subject: ErasureSubjectView,
|
|
592
|
+
state: ErasureState,
|
|
593
|
+
overdue: z.boolean().describe("True when it came due more than two days ago and has not completed."),
|
|
594
|
+
purgeAfter: z.iso.datetime().nullable().describe("When it came due, or null for a deletion recorded before #823."),
|
|
595
|
+
completedAt: z.iso.datetime().nullable().describe("When it finished, or null until it has."),
|
|
596
|
+
stoppedAt: z
|
|
597
|
+
.string()
|
|
598
|
+
.nullable()
|
|
599
|
+
.describe("For a failed or overdue purge, the step it stopped at — `due` when none has run. Null otherwise."),
|
|
600
|
+
})
|
|
601
|
+
.describe("One purge in the period, summarized. Its full record is the subject read.");
|
|
602
|
+
export type ErasurePeriodEntry = z.output<typeof ErasurePeriodEntry>;
|
|
603
|
+
|
|
604
|
+
/** `GET /control-plane/erasure` — every purge in a period, counted. */
|
|
605
|
+
export const ControlPlaneErasurePeriodResponse = z
|
|
606
|
+
.object({
|
|
607
|
+
generatedAt: z.iso.datetime().describe("When this Worker read the records, ISO-8601."),
|
|
608
|
+
since: z.iso.datetime().describe("The window's inclusive start, ISO-8601."),
|
|
609
|
+
until: z.iso.datetime().describe("The window's inclusive end, ISO-8601."),
|
|
610
|
+
subjects: z
|
|
611
|
+
.array(z.enum(["user", "organization"]).describe("One kind of subject."))
|
|
612
|
+
.describe(
|
|
613
|
+
"The kinds of subject this Worker records purges for. A kind not listed was not read, because nothing composed records it.",
|
|
614
|
+
),
|
|
615
|
+
counts: z
|
|
616
|
+
.object({
|
|
617
|
+
scheduled: z.number().int().describe("Deleted, with the window still open."),
|
|
618
|
+
inProgress: z.number().int().describe("Due, and not yet finished."),
|
|
619
|
+
complete: z.number().int().describe("Finished."),
|
|
620
|
+
failed: z.number().int().describe("Gave up, until the next pass."),
|
|
621
|
+
overdue: z
|
|
622
|
+
.number()
|
|
623
|
+
.int()
|
|
624
|
+
.describe("Not finished more than two days after coming due. Counted within the states above."),
|
|
625
|
+
})
|
|
626
|
+
.describe("How many purges in the window stand where."),
|
|
627
|
+
attention: z
|
|
628
|
+
.array(ErasurePeriodEntry)
|
|
629
|
+
.describe("Every failed or overdue purge in the window, each with the step it stopped at."),
|
|
630
|
+
purges: z.array(ErasurePeriodEntry).describe("Every purge in the window, oldest due first."),
|
|
631
|
+
})
|
|
632
|
+
.describe(
|
|
633
|
+
"Every purge in a period: counts of complete, in-progress and failed, and each failed or overdue one named with the step it stopped at.",
|
|
634
|
+
);
|
|
635
|
+
export type ControlPlaneErasurePeriodResponse = z.output<typeof ControlPlaneErasurePeriodResponse>;
|
|
636
|
+
|
|
637
|
+
/** One legal hold, as the holds routes answer it. */
|
|
638
|
+
export const LegalHoldView = z
|
|
639
|
+
.object({
|
|
640
|
+
id: z.string().describe("The hold's id. Name it to release the hold."),
|
|
641
|
+
subjectType: z
|
|
642
|
+
.enum(["user", "organization", "audit"])
|
|
643
|
+
.describe("What the hold preserves: a user, an organization, or a tenant's audit trail."),
|
|
644
|
+
subjectId: z
|
|
645
|
+
.string()
|
|
646
|
+
.nullable()
|
|
647
|
+
.describe(
|
|
648
|
+
"The held user's or organization's id, or the tenant whose trail is held. Null for the untenanted trail.",
|
|
649
|
+
),
|
|
650
|
+
reason: z.string().describe("Why it was placed."),
|
|
651
|
+
placedBy: z.string().describe("The management client's user id that placed it."),
|
|
652
|
+
placedAt: z.iso.datetime().describe("When it was placed, ISO-8601."),
|
|
653
|
+
state: z.enum(["active", "released"]).describe("`active` while it stands; `released` once lifted."),
|
|
654
|
+
releasedAt: z.iso.datetime().nullable().describe("When it was released, ISO-8601, or null while it stands."),
|
|
655
|
+
releasedBy: z.string().nullable().describe("Who released it, or null while it stands."),
|
|
656
|
+
releaseReason: z.string().nullable().describe("Why it was released, or null while it stands."),
|
|
657
|
+
})
|
|
658
|
+
.describe("A legal hold on one user, one organization or one tenant's audit trail.");
|
|
659
|
+
export type LegalHoldView = z.output<typeof LegalHoldView>;
|
|
660
|
+
|
|
661
|
+
/** `GET /control-plane/holds`. */
|
|
662
|
+
export const ControlPlaneHoldsResponse = z
|
|
663
|
+
.object({
|
|
664
|
+
active: z.number().int().nonnegative().describe("How many holds stand, whatever the listing was narrowed to."),
|
|
665
|
+
holds: z.array(LegalHoldView).describe("The holds, standing first, newest first within each."),
|
|
666
|
+
})
|
|
667
|
+
.describe("This Worker's legal holds.");
|
|
668
|
+
export type ControlPlaneHoldsResponse = z.output<typeof ControlPlaneHoldsResponse>;
|
|
669
|
+
|
|
670
|
+
/** `POST /control-plane/holds` and `POST /control-plane/holds/:holdId/release`: the hold as it now stands. */
|
|
671
|
+
export const ControlPlaneHoldResponse = z
|
|
672
|
+
.object({ hold: LegalHoldView })
|
|
673
|
+
.describe("One legal hold, as the call left it.");
|
|
674
|
+
export type ControlPlaneHoldResponse = z.output<typeof ControlPlaneHoldResponse>;
|
|
675
|
+
|
|
676
|
+
/** What kind of gap the processing record names. */
|
|
677
|
+
export const ProcessingGapKind = z
|
|
678
|
+
.enum(PROCESSING_GAP_KINDS)
|
|
679
|
+
.describe(
|
|
680
|
+
"What is missing: `no-legal-basis` (an activity states none), `no-consent-purpose` (a consent basis names no purpose the catalog holds), `class-not-stored` (an activity claims a class nothing stores), `class-unclaimed` (a capability stores a class no activity claims), `phi-not-covered` (a stored `phi` field no consent purpose covers), or `no-standing-grant` (a purpose covering a class holds no standing grant).",
|
|
681
|
+
);
|
|
682
|
+
export type ProcessingGapKind = z.infer<typeof ProcessingGapKind>;
|
|
683
|
+
|
|
684
|
+
/** One gap in the processing record. */
|
|
685
|
+
export const ProcessingGap = z
|
|
686
|
+
.object({
|
|
687
|
+
kind: ProcessingGapKind,
|
|
688
|
+
subject: z
|
|
689
|
+
.string()
|
|
690
|
+
.describe(
|
|
691
|
+
"What the gap is about: an activity id, a capability name, a consent purpose id, or a stored field as `<capability>/<table>.<path>`. A stored field is named only to a connection that also holds `privacy:read`; without it, the gap names the capability.",
|
|
692
|
+
),
|
|
693
|
+
detail: z.string().describe("What is missing, in one sentence."),
|
|
694
|
+
})
|
|
695
|
+
.describe("Something the record needs and the Worker does not declare. Named, never filled in.");
|
|
696
|
+
export type ProcessingGap = z.infer<typeof ProcessingGap>;
|
|
697
|
+
|
|
698
|
+
/** Where a recipient in the record came from. */
|
|
699
|
+
export const ProcessingRecipientSource = z
|
|
700
|
+
.enum(RECIPIENT_SOURCES)
|
|
701
|
+
.describe(
|
|
702
|
+
"Where the recipient came from: `platform`, Cloudflare, which runs every Worker; `binding`, a binding this Worker has, such as Workers AI; `declared`, an activity's own declaration, built from the resolved config.",
|
|
703
|
+
);
|
|
704
|
+
|
|
705
|
+
/** One recipient of personal data. */
|
|
706
|
+
export const ProcessingRecipientView = z
|
|
707
|
+
.object({
|
|
708
|
+
name: z.string().describe("Who receives the data."),
|
|
709
|
+
receives: z.string().describe("What they receive."),
|
|
710
|
+
classes: z.array(z.string()).describe("The data classes in what they receive."),
|
|
711
|
+
source: ProcessingRecipientSource,
|
|
712
|
+
})
|
|
713
|
+
.describe("One recipient: who, what it receives, the classes in it, and where the record learned of it.");
|
|
714
|
+
export type ProcessingRecipientView = z.infer<typeof ProcessingRecipientView>;
|
|
715
|
+
|
|
716
|
+
/** A consent-based activity's purpose, with where its subjects stand. */
|
|
717
|
+
export const ProcessingConsentView = z
|
|
718
|
+
.object({
|
|
719
|
+
purpose: z.string().describe("The consent purpose id the activity rests on."),
|
|
720
|
+
noticeVersion: z
|
|
721
|
+
.number()
|
|
722
|
+
.int()
|
|
723
|
+
.nullable()
|
|
724
|
+
.describe("The purpose's current notice version. Null when no composed catalog declares the purpose."),
|
|
725
|
+
explicit: z.boolean().nullable().describe("Whether the purpose needs explicit consent. Null when undeclared."),
|
|
726
|
+
grants: z
|
|
727
|
+
.number()
|
|
728
|
+
.int()
|
|
729
|
+
.nullable()
|
|
730
|
+
.describe("Subjects whose latest choice is a grant. Null when the consent record could not be read."),
|
|
731
|
+
withdrawals: z
|
|
732
|
+
.number()
|
|
733
|
+
.int()
|
|
734
|
+
.nullable()
|
|
735
|
+
.describe("Subjects whose latest choice is a withdrawal. Null when the consent record could not be read."),
|
|
736
|
+
standing: z
|
|
737
|
+
.number()
|
|
738
|
+
.int()
|
|
739
|
+
.nullable()
|
|
740
|
+
.describe(
|
|
741
|
+
"Subjects whose grant stands now: current notice, at the minimum method, unexpired. Null when the consent record could not be read.",
|
|
742
|
+
),
|
|
743
|
+
})
|
|
744
|
+
.describe("The consent purpose a consent-based activity rests on, and its grant counts.");
|
|
745
|
+
export type ProcessingConsentView = z.infer<typeof ProcessingConsentView>;
|
|
746
|
+
|
|
747
|
+
/** How long the data an activity uses is kept. */
|
|
748
|
+
export const ProcessingRetentionView = z
|
|
749
|
+
.object({
|
|
750
|
+
classAges: z
|
|
751
|
+
.array(
|
|
752
|
+
z
|
|
753
|
+
.object({
|
|
754
|
+
class: z.string().describe("The privacy class."),
|
|
755
|
+
days: z.number().int().describe("The longest an account holding it may sit inactive, in days."),
|
|
756
|
+
})
|
|
757
|
+
.describe("One class age."),
|
|
758
|
+
)
|
|
759
|
+
.describe("The retention block's class ages for the classes this activity uses, strictest first."),
|
|
760
|
+
purgeWindows: z
|
|
761
|
+
.array(
|
|
762
|
+
z
|
|
763
|
+
.object({
|
|
764
|
+
subject: z.enum(["user", "organization"]).describe("Whose deletion the window governs."),
|
|
765
|
+
days: z.number().int().describe("How many days a deletion stays restorable before its purge."),
|
|
766
|
+
source: z.enum(["policy", "capability", "floor"]).describe("Where the value came from."),
|
|
767
|
+
})
|
|
768
|
+
.describe("One soft-delete window."),
|
|
769
|
+
)
|
|
770
|
+
.describe("Every soft-delete window the Worker runs, as it takes effect."),
|
|
771
|
+
})
|
|
772
|
+
.describe("The effective retention behind an activity: its classes' ages and the purge windows.");
|
|
773
|
+
export type ProcessingRetentionView = z.infer<typeof ProcessingRetentionView>;
|
|
774
|
+
|
|
775
|
+
/** One activity in the record. */
|
|
776
|
+
export const ProcessingEntry = z
|
|
777
|
+
.object({
|
|
778
|
+
id: z.string().describe("The activity id, `<domain>.<name>`."),
|
|
779
|
+
purpose: z.string().describe("Why the data is processed."),
|
|
780
|
+
declaredBy: z.string().describe("The capability that declared it, or `config` for the adopter's own."),
|
|
781
|
+
classes: z.array(z.string()).describe("The data classes it uses."),
|
|
782
|
+
legalBasis: LegalBasis.nullable().describe("Its legal basis, or null: a gap the record names."),
|
|
783
|
+
basisSource: z
|
|
784
|
+
.enum(BASIS_SOURCES)
|
|
785
|
+
.nullable()
|
|
786
|
+
.describe("Where the basis came from: the declaring `capability`, or the `config` block. Null with no basis."),
|
|
787
|
+
consent: ProcessingConsentView.nullable().describe("For a consent basis, its purpose and grant counts. Else null."),
|
|
788
|
+
recipients: z
|
|
789
|
+
.array(ProcessingRecipientView)
|
|
790
|
+
.describe("Who receives its data: Cloudflare always, then any binding or declared recipient."),
|
|
791
|
+
retention: ProcessingRetentionView.nullable().describe(
|
|
792
|
+
"How long its data is kept, from the Worker's resolved retention. Null when the Worker recorded none.",
|
|
793
|
+
),
|
|
794
|
+
measures: z
|
|
795
|
+
.array(EvidenceControlId)
|
|
796
|
+
.describe("The evidence pack's controls that protect this activity's data, by id. `measures` states each."),
|
|
797
|
+
gaps: z.array(ProcessingGap).describe("What this activity is missing. Empty when nothing is."),
|
|
798
|
+
})
|
|
799
|
+
.describe("One processing activity, as GDPR Article 30 lists it.");
|
|
800
|
+
export type ProcessingEntry = z.infer<typeof ProcessingEntry>;
|
|
801
|
+
|
|
802
|
+
/** One security measure, as the evidence pack names it. */
|
|
803
|
+
export const ProcessingMeasure = z
|
|
804
|
+
.object({
|
|
805
|
+
control: EvidenceControlId,
|
|
806
|
+
title: z.string().describe("What the control is."),
|
|
807
|
+
soc2: z.array(z.string()).describe("Its SOC 2 Trust Services Criteria references."),
|
|
808
|
+
iso27001: z.array(z.string()).describe("Its ISO/IEC 27001:2022 Annex A references."),
|
|
809
|
+
state: EvidenceState.nullable().describe(
|
|
810
|
+
"What the evidence pack says of it now. Null when the connection does not hold `evidence:read`.",
|
|
811
|
+
),
|
|
812
|
+
})
|
|
813
|
+
.describe("A technical or organizational security measure, cited from the evidence pack.");
|
|
814
|
+
export type ProcessingMeasure = z.infer<typeof ProcessingMeasure>;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* `GET /control-plane/processing` — the record of processing activities, behind `processing:read`. It describes
|
|
818
|
+
* the processing and changes none of it.
|
|
819
|
+
*/
|
|
820
|
+
export const ControlPlaneProcessingResponse = z
|
|
821
|
+
.object({
|
|
822
|
+
environment: z.string().describe("The environment this Worker serves."),
|
|
823
|
+
generatedAt: z.iso.datetime().describe("When the record was derived, ISO-8601."),
|
|
824
|
+
version: z.string().nullable().describe("The Cloudflare version id of the build answering, or null."),
|
|
825
|
+
activities: z
|
|
826
|
+
.array(ProcessingEntry)
|
|
827
|
+
.describe("Every activity: each capability's, in composition order, then the adopter's."),
|
|
828
|
+
recipients: z
|
|
829
|
+
.array(ProcessingRecipientView)
|
|
830
|
+
.describe("Every recipient across the record, once each: Cloudflare first, then by binding, then declared."),
|
|
831
|
+
measures: z.array(ProcessingMeasure).describe("Every security measure the activities cite."),
|
|
832
|
+
gaps: z
|
|
833
|
+
.array(ProcessingGap)
|
|
834
|
+
.describe("Gaps about no single activity: unclaimed classes, uncovered `phi`, purposes with no standing grant."),
|
|
835
|
+
notDerivable: z
|
|
836
|
+
.array(z.string())
|
|
837
|
+
.describe("What the record could not read, and why. Empty when it read everything it needs."),
|
|
838
|
+
})
|
|
839
|
+
.describe(
|
|
840
|
+
"The GDPR Article 30 record this Worker derives: each activity's purpose, data classes, legal basis, recipients, retention and measures, and every gap named.",
|
|
841
|
+
);
|
|
842
|
+
export type ControlPlaneProcessingResponse = z.infer<typeof ControlPlaneProcessingResponse>;
|
|
843
|
+
|
|
844
|
+
/** One trust's subject constraint, as a connection listing shows it: the population that may use the trust. */
|
|
845
|
+
export const ConnectionTrustView = z
|
|
846
|
+
.object({
|
|
847
|
+
trustId: z.string().describe("The trust's id."),
|
|
848
|
+
issuer: z.string().describe("The `iss` the trust accepts."),
|
|
849
|
+
claims: z
|
|
850
|
+
.record(z.string().describe("A claim name."), z.string().describe("The value that claim must have."))
|
|
851
|
+
.describe("The subject constraint: every named claim must equal its value. This is who may use the trust."),
|
|
852
|
+
revokedAt: z.iso.datetime().nullable().describe("When the trust was revoked, ISO-8601, or null while it stands."),
|
|
853
|
+
})
|
|
854
|
+
.describe("One OIDC trust's subject constraint, on the face of the listing.");
|
|
855
|
+
export type ConnectionTrustView = z.output<typeof ConnectionTrustView>;
|
|
856
|
+
|
|
857
|
+
/** One connection, as `GET {basePath}/connections` lists it. No key material and no secret. */
|
|
858
|
+
export const ConnectionView = z
|
|
859
|
+
.object({
|
|
860
|
+
id: z.string().describe("The connection's id. Name it to revoke the connection."),
|
|
861
|
+
environment: z.string().describe("The environment the connection is bound to."),
|
|
862
|
+
actorKind: ControlPlaneActorKind.nullable().describe(
|
|
863
|
+
"What kind of client the connection is for: `agent`, `dashboard` or `script`. Null for one registered before it was recorded.",
|
|
864
|
+
),
|
|
865
|
+
purpose: ConnectionPurpose.nullable().describe(
|
|
866
|
+
"What the client is for, in the registering operator's words. Untrusted text: render it escaped. Null for one registered before it was recorded.",
|
|
867
|
+
),
|
|
868
|
+
authorizedBy: ConnectionPrincipal.nullable().describe(
|
|
869
|
+
"The email of the person who sanctioned the connection. Null for one registered before principals were recorded.",
|
|
870
|
+
),
|
|
871
|
+
credentialKind: ConnectionCredentialKind,
|
|
872
|
+
scopes: z.array(z.string()).describe("The scopes the connection was granted."),
|
|
873
|
+
trusts: z.array(ConnectionTrustView).describe("Every OIDC trust on the connection, revoked ones included."),
|
|
874
|
+
live: z.boolean().describe("Whether any key or trust on the connection can verify a call now."),
|
|
875
|
+
registeredAt: z.iso.datetime().describe("When the connection was registered, ISO-8601."),
|
|
876
|
+
revokedAt: z.iso
|
|
877
|
+
.datetime()
|
|
878
|
+
.nullable()
|
|
879
|
+
.describe(
|
|
880
|
+
"When the connection was revoked, ISO-8601: the latest revocation once every credential was revoked. Null while anything is live, and for one whose keys merely expired.",
|
|
881
|
+
),
|
|
882
|
+
})
|
|
883
|
+
.describe("One connection: who authorized it, for what, with which credentials and grant, and whether it is live.");
|
|
884
|
+
export type ConnectionView = z.output<typeof ConnectionView>;
|
|
885
|
+
|
|
886
|
+
/** `GET /control-plane/connections`. */
|
|
887
|
+
export const ControlPlaneConnectionsResponse = z
|
|
888
|
+
.object({
|
|
889
|
+
connections: z
|
|
890
|
+
.array(ConnectionView)
|
|
891
|
+
.describe("Every connection with a recorded principal, matching the filter when one was given, oldest first."),
|
|
892
|
+
unattributed: z
|
|
893
|
+
.array(ConnectionView)
|
|
894
|
+
.describe(
|
|
895
|
+
"Every connection registered before principals were recorded, oldest first. Listed apart for a person to read; never matched by a principal.",
|
|
896
|
+
),
|
|
897
|
+
})
|
|
898
|
+
.describe("Every connection bound to this Worker's environment, attributed ones and unattributed ones apart.");
|
|
899
|
+
export type ControlPlaneConnectionsResponse = z.output<typeof ControlPlaneConnectionsResponse>;
|
|
900
|
+
|
|
901
|
+
/** `POST /control-plane/connections/:connectionId/revoke`. */
|
|
902
|
+
export const RevokeConnectionResponse = z
|
|
903
|
+
.object({
|
|
904
|
+
connection: ConnectionView.describe("The connection as it now stands."),
|
|
905
|
+
revokedKeyIds: z
|
|
906
|
+
.array(z.string())
|
|
907
|
+
.describe("The keys this call revoked. Empty when every key was already revoked."),
|
|
908
|
+
revokedTrustIds: z
|
|
909
|
+
.array(z.string())
|
|
910
|
+
.describe("The trusts this call revoked. Empty when every trust was already revoked."),
|
|
911
|
+
})
|
|
912
|
+
.describe("A revoked connection, and the credentials the revocation ended.");
|
|
913
|
+
export type RevokeConnectionResponse = z.output<typeof RevokeConnectionResponse>;
|