@spacefast/common 0.0.24 → 0.2.1
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/brand-assets/LICENSE-Haskoy.txt +93 -0
- package/brand-assets/haskoy-latin-variable.woff2 +0 -0
- package/brand-assets/spacefast-favicon.svg +4 -4
- package/brand-assets/spacefast-sf-full-bleed.svg +3 -3
- package/brand-assets/spacefast-wordmark.svg +2 -4
- package/dist/agents/connect-targets.d.ts +6 -146
- package/dist/agents/connect-targets.js +63 -295
- package/dist/agents/private-key-oauth.d.ts +31 -2
- package/dist/agents/private-key-oauth.js +166 -92
- package/dist/agents/registry/core.d.ts +292 -0
- package/dist/agents/registry/core.js +1388 -0
- package/dist/agents/registry/deeplink-probes.d.ts +23 -0
- package/dist/agents/registry/deeplink-probes.js +18 -0
- package/dist/agents/registry/node.d.ts +56 -0
- package/dist/agents/registry/node.js +339 -0
- package/dist/brand-assets-build.js +3 -6
- package/dist/brand-assets.d.ts +5 -15
- package/dist/brand-assets.js +12 -14
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +79 -12
- package/dist/config/domains.js +128 -29
- package/dist/config/index.js +1 -2
- package/dist/contracts/abuse.js +9 -24
- package/dist/contracts/access-profiles.d.ts +86 -0
- package/dist/contracts/access-profiles.js +89 -0
- package/dist/contracts/access.d.ts +24 -30
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +72 -26
- package/dist/contracts/analytics.js +8 -10
- package/dist/contracts/api-keys.d.ts +77 -52
- package/dist/contracts/api-keys.js +44 -24
- package/dist/contracts/application-journal.d.ts +216 -0
- package/dist/contracts/application-journal.js +167 -0
- package/dist/contracts/auth.d.ts +90 -17
- package/dist/contracts/auth.js +86 -17
- package/dist/contracts/beta.d.ts +9 -4
- package/dist/contracts/beta.js +20 -16
- package/dist/contracts/billing.d.ts +2 -1
- package/dist/contracts/billing.js +37 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +209 -18
- package/dist/contracts/builds.js +93 -27
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +25 -9
- package/dist/contracts/cli.d.ts +7 -0
- package/dist/contracts/cli.js +6 -0
- package/dist/contracts/collab-public.d.ts +1 -1
- package/dist/contracts/collab-public.js +5 -8
- package/dist/contracts/comments.d.ts +44 -34
- package/dist/contracts/comments.js +107 -77
- package/dist/contracts/commerce.d.ts +165 -0
- package/dist/contracts/commerce.js +146 -0
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +20 -31
- package/dist/contracts/content-contract-verification.d.ts +521 -0
- package/dist/contracts/content-contract-verification.js +320 -0
- package/dist/contracts/content-platform-fixture.d.ts +1278 -0
- package/dist/contracts/content-platform-fixture.js +44 -0
- package/dist/contracts/content-program.d.ts +994 -0
- package/dist/contracts/content-program.js +658 -0
- package/dist/contracts/content-sync.d.ts +290 -0
- package/dist/contracts/content-sync.js +167 -0
- package/dist/contracts/content.d.ts +432 -0
- package/dist/contracts/content.js +303 -0
- package/dist/contracts/continuation.d.ts +17 -1
- package/dist/contracts/continuation.js +23 -23
- package/dist/contracts/countries.js +3 -4
- package/dist/contracts/crons.d.ts +52 -0
- package/dist/contracts/crons.js +60 -0
- package/dist/contracts/dashboard-prefs.d.ts +56 -0
- package/dist/contracts/dashboard-prefs.js +51 -0
- package/dist/contracts/device-auth.d.ts +234 -37
- package/dist/contracts/device-auth.js +267 -53
- package/dist/contracts/docs.d.ts +1 -5
- package/dist/contracts/docs.js +7 -15
- package/dist/contracts/domains.d.ts +501 -93
- package/dist/contracts/domains.js +193 -55
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +27 -26
- package/dist/contracts/enums.js +68 -61
- package/dist/contracts/error-code-meta.d.ts +283 -7
- package/dist/contracts/error-code-meta.js +97 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +82 -17
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +48 -64
- package/dist/contracts/execution.js +52 -62
- package/dist/contracts/feature-lifecycle.d.ts +73 -27
- package/dist/contracts/feature-lifecycle.js +86 -26
- package/dist/contracts/features.d.ts +68 -19
- package/dist/contracts/features.js +42 -41
- package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
- package/dist/contracts/frame-session.d.ts +192 -0
- package/dist/contracts/frame-session.js +164 -0
- package/dist/contracts/functions.d.ts +338 -164
- package/dist/contracts/functions.js +367 -198
- package/dist/contracts/git.d.ts +27 -33
- package/dist/contracts/git.js +10 -11
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +62 -54
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +6 -3
- package/dist/contracts/internal.d.ts +8 -18
- package/dist/contracts/internal.js +13 -14
- package/dist/contracts/mcp.d.ts +28 -0
- package/dist/contracts/mcp.js +28 -0
- package/dist/contracts/me.d.ts +6 -1
- package/dist/contracts/me.js +12 -6
- package/dist/contracts/notifications.d.ts +27 -29
- package/dist/contracts/notifications.js +9 -4
- package/dist/contracts/oauth-resources.d.ts +112 -10
- package/dist/contracts/oauth-resources.js +116 -11
- package/dist/contracts/oauth-scope-actions.d.ts +90 -0
- package/dist/contracts/oauth-scope-actions.js +126 -0
- package/dist/contracts/operations.d.ts +27 -4
- package/dist/contracts/operations.js +12 -6
- package/dist/contracts/pages.d.ts +31 -7
- package/dist/contracts/pages.js +22 -5
- package/dist/contracts/partner-notifications.d.ts +3 -0
- package/dist/contracts/partner-notifications.js +65 -0
- package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
- package/dist/contracts/{platform.js → partner.js} +27 -40
- package/dist/contracts/plan-policy.js +1 -1
- package/dist/contracts/principal-assertion.d.ts +43 -0
- package/dist/contracts/principal-assertion.js +67 -0
- package/dist/contracts/principals.d.ts +73 -0
- package/dist/contracts/principals.js +59 -0
- package/dist/contracts/privacy.d.ts +11 -0
- package/dist/contracts/privacy.js +17 -0
- package/dist/contracts/problem-document.js +3 -4
- package/dist/contracts/publish-archive.d.ts +269 -161
- package/dist/contracts/publish-archive.js +11 -1
- package/dist/contracts/push-new.d.ts +8 -8
- package/dist/contracts/quotas.js +5 -5
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +44 -31
- package/dist/contracts/repository-connections.js +17 -5
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +150 -26
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +206 -82
- package/dist/contracts/runtime-api.js +131 -70
- package/dist/contracts/runtime-app.d.ts +13 -23
- package/dist/contracts/runtime-app.js +39 -24
- package/dist/contracts/runtime-components.d.ts +143 -0
- package/dist/contracts/runtime-components.js +199 -0
- package/dist/contracts/runtime-db.d.ts +49 -23
- package/dist/contracts/runtime-db.js +87 -22
- package/dist/contracts/runtime-purge.d.ts +8 -0
- package/dist/contracts/runtime-purge.js +5 -0
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +15 -14
- package/dist/contracts/runtime-storage.js +30 -14
- package/dist/contracts/sf-config-v1.d.ts +48 -14
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +283 -19
- package/dist/contracts/space-config.js +430 -80
- package/dist/contracts/spaces.d.ts +376 -290
- package/dist/contracts/spaces.js +200 -135
- package/dist/contracts/superadmin-activity.d.ts +3 -43
- package/dist/contracts/superadmin-activity.js +6 -30
- package/dist/contracts/superadmin-emails.d.ts +1 -0
- package/dist/contracts/superadmin-emails.js +17 -1
- package/dist/contracts/superadmin-runtime.d.ts +199 -0
- package/dist/contracts/superadmin-runtime.js +141 -0
- package/dist/contracts/superadmin-search.d.ts +22 -2
- package/dist/contracts/superadmin-search.js +14 -6
- package/dist/contracts/superadmin-spaces.d.ts +438 -189
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +5 -2
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -12
- package/dist/contracts/superadmin-tenants.js +32 -13
- package/dist/contracts/superadmin.d.ts +232 -37
- package/dist/contracts/superadmin.js +106 -22
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +47 -37
- package/dist/contracts/teams.d.ts +86 -26
- package/dist/contracts/teams.js +90 -31
- package/dist/contracts/tenants.d.ts +135 -0
- package/dist/contracts/tenants.js +120 -0
- package/dist/contracts/test-triggers.d.ts +70 -0
- package/dist/contracts/test-triggers.js +116 -0
- package/dist/contracts/theme-json.js +3 -8
- package/dist/contracts/transfers.d.ts +1 -0
- package/dist/contracts/transfers.js +3 -2
- package/dist/contracts/usage.d.ts +209 -0
- package/dist/contracts/usage.js +124 -12
- package/dist/contracts/variables.d.ts +2 -2
- package/dist/contracts/variables.js +9 -13
- package/dist/contracts/webhooks.d.ts +13 -5
- package/dist/contracts/webhooks.js +3 -1
- package/dist/contracts/zero.d.ts +72 -81
- package/dist/contracts/zero.js +80 -78
- package/dist/dashboard-paths/index.d.ts +24 -21
- package/dist/dashboard-paths/index.js +35 -47
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
- package/dist/dashboard-paths/route-reservations.generated.js +36 -0
- package/dist/docs/agent-arrival.d.ts +92 -0
- package/dist/docs/agent-arrival.js +227 -0
- package/dist/docs/agent-output-policy.d.ts +6 -0
- package/dist/docs/agent-output-policy.js +22 -0
- package/dist/docs/agent-prose.d.ts +12 -18
- package/dist/docs/agent-prose.js +73 -51
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +339 -436
- package/dist/docs/catalog.d.ts +153 -95
- package/dist/docs/catalog.js +163 -48
- package/dist/docs/error-docs.d.ts +2098 -1
- package/dist/docs/error-docs.js +421 -144
- package/dist/docs/index-build.d.ts +0 -1
- package/dist/docs/index-build.js +2 -3
- package/dist/docs/page-context-prompt.d.ts +77 -0
- package/dist/docs/page-context-prompt.js +131 -0
- package/dist/docs/reference-urls.d.ts +46 -0
- package/dist/docs/reference-urls.js +79 -0
- package/dist/docs/search.d.ts +6 -8
- package/dist/docs/search.js +10 -13
- package/dist/docs/skill-distribution.d.ts +4 -1
- package/dist/docs/skill-distribution.js +10 -5
- package/dist/docs/skills.d.ts +120 -120
- package/dist/docs/skills.js +121 -73
- package/dist/docs/start-prompts.d.ts +45 -0
- package/dist/docs/start-prompts.js +62 -0
- package/dist/domain-exploration.js +9 -13
- package/dist/og-template.d.ts +56 -0
- package/dist/og-template.js +56 -0
- package/dist/slug-policy/index.js +5 -11
- package/dist/test-helpers/fetch-stub.js +1 -0
- package/dist/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +21 -1
- package/dist/utils/build-settings.js +133 -15
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +4 -5
- package/dist/utils/cast-transport.d.ts +5 -17
- package/dist/utils/cast-transport.js +6 -19
- package/dist/utils/claim-token.js +1 -2
- package/dist/utils/comment-avatars.js +4 -6
- package/dist/utils/concurrency.js +3 -3
- package/dist/utils/content-type.d.ts +7 -6
- package/dist/utils/content-type.js +73 -51
- package/dist/utils/credential-policy.d.ts +50 -6
- package/dist/utils/credential-policy.js +126 -59
- package/dist/utils/dns-instructions.js +9 -9
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/error-code.js +1 -0
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grant-decision.fixtures.json +2 -2
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +7 -8
- package/dist/utils/gravatar.d.ts +2 -4
- package/dist/utils/gravatar.js +6 -12
- package/dist/utils/id-hints.js +14 -23
- package/dist/utils/idempotency.d.ts +3 -3
- package/dist/utils/idempotency.js +6 -7
- package/dist/utils/local-space-state.d.ts +23 -26
- package/dist/utils/local-space-state.js +46 -46
- package/dist/utils/oauth-signed-query.d.ts +3 -5
- package/dist/utils/oauth-signed-query.js +6 -9
- package/dist/utils/one-shot-replay.d.ts +7 -6
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +15 -19
- package/dist/utils/page-colors.js +23 -45
- package/dist/utils/page-fonts.d.ts +1 -1
- package/dist/utils/page-fonts.js +8 -20
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +33 -3
- package/dist/utils/pages.js +83 -30
- package/dist/utils/privacy-regions.d.ts +19 -0
- package/dist/utils/privacy-regions.js +91 -0
- package/dist/utils/publish-form-data.d.ts +4 -5
- package/dist/utils/publish-form-data.js +2 -3
- package/dist/utils/publish-policy.d.ts +11 -17
- package/dist/utils/publish-policy.fixtures.json +11 -5
- package/dist/utils/publish-policy.js +65 -110
- package/dist/utils/query-client.d.ts +2 -0
- package/dist/utils/query-client.js +10 -1
- package/dist/utils/runtime-paths.d.ts +4 -4
- package/dist/utils/runtime-paths.js +6 -8
- package/dist/utils/runtime-upload.d.ts +9 -0
- package/dist/utils/runtime-upload.js +12 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +23 -40
- package/dist/utils/space-config.d.ts +12 -15
- package/dist/utils/space-config.js +13 -16
- package/dist/utils/static-runtime-policy.d.ts +10 -7
- package/dist/utils/static-runtime-policy.fixtures.json +38 -41
- package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
- package/dist/utils/static-runtime-policy.generated.js +70 -0
- package/dist/utils/static-runtime-policy.js +31 -132
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.d.ts +4 -1
- package/dist/utils/upload-session.js +41 -19
- package/dist/utils/version-path.js +11 -19
- package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
- package/dist/utils/wpcom-auth-redirects.js +1 -4
- package/dist/vocabulary.d.ts +13 -13
- package/dist/vocabulary.js +52 -27
- package/package.json +15 -18
- package/dist/agents/client-registry.d.ts +0 -22
- package/dist/agents/client-registry.js +0 -41
- package/dist/docs/agent-handoff-document.d.ts +0 -15
- package/dist/docs/agent-handoff-document.js +0 -180
- package/dist/docs/agent-solutions.d.ts +0 -110
- package/dist/docs/agent-solutions.js +0 -183
- package/dist/utils/query-keys.d.ts +0 -84
- package/dist/utils/query-keys.js +0 -108
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runtimeCapabilityIdSchema: z.core.$ZodBranded<z.ZodString, "RuntimeCapabilityId", "out">;
|
|
3
|
+
export declare const runtimeComponentIdSchema: z.core.$ZodBranded<z.ZodString, "RuntimeComponentId", "out">;
|
|
4
|
+
export type RuntimeCapabilityId = z.infer<typeof runtimeCapabilityIdSchema>;
|
|
5
|
+
export type RuntimeComponentId = z.infer<typeof runtimeComponentIdSchema>;
|
|
6
|
+
export declare const RUNTIME_COMPONENT_V1_REQUIRED_IDS: readonly ["wordpress-core", "runtime-engine", "immutable-loader", "content-kernel", "managed-theme", "secure-custom-fields", "redirection", "block-transformer", "quickjs-abi"];
|
|
7
|
+
export declare const RUNTIME_COMPONENT_KINDS: readonly ["wordpress-core", "runtime-engine", "mu-plugin", "plugin", "theme", "block-transformer", "quickjs-abi"];
|
|
8
|
+
export declare const runtimeComponentKindSchema: z.ZodEnum<{
|
|
9
|
+
plugin: "plugin";
|
|
10
|
+
theme: "theme";
|
|
11
|
+
"wordpress-core": "wordpress-core";
|
|
12
|
+
"runtime-engine": "runtime-engine";
|
|
13
|
+
"block-transformer": "block-transformer";
|
|
14
|
+
"quickjs-abi": "quickjs-abi";
|
|
15
|
+
"mu-plugin": "mu-plugin";
|
|
16
|
+
}>;
|
|
17
|
+
export type RuntimeComponentKind = z.infer<typeof runtimeComponentKindSchema>;
|
|
18
|
+
export declare const runtimeComponentV1Schema: z.ZodObject<{
|
|
19
|
+
id: z.core.$ZodBranded<z.ZodString, "RuntimeComponentId", "out">;
|
|
20
|
+
kind: z.ZodEnum<{
|
|
21
|
+
plugin: "plugin";
|
|
22
|
+
theme: "theme";
|
|
23
|
+
"wordpress-core": "wordpress-core";
|
|
24
|
+
"runtime-engine": "runtime-engine";
|
|
25
|
+
"block-transformer": "block-transformer";
|
|
26
|
+
"quickjs-abi": "quickjs-abi";
|
|
27
|
+
"mu-plugin": "mu-plugin";
|
|
28
|
+
}>;
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
sha256: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
31
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"archive">;
|
|
33
|
+
url: z.ZodString;
|
|
34
|
+
bytes: z.ZodNumber;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"embedded">;
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
}, z.core.$strict>], "kind">;
|
|
39
|
+
provides: z.ZodArray<z.core.$ZodBranded<z.ZodString, "RuntimeCapabilityId", "out">>;
|
|
40
|
+
activation: z.ZodEnum<{
|
|
41
|
+
always: "always";
|
|
42
|
+
"on-demand": "on-demand";
|
|
43
|
+
}>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type RuntimeComponentV1 = z.infer<typeof runtimeComponentV1Schema>;
|
|
46
|
+
export declare const runtimeComponentInventoryV1Schema: z.ZodObject<{
|
|
47
|
+
format: z.ZodLiteral<"spacefast.wordpress-components">;
|
|
48
|
+
version: z.ZodLiteral<1>;
|
|
49
|
+
platformRelease: z.ZodString;
|
|
50
|
+
digest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
51
|
+
components: z.ZodArray<z.ZodObject<{
|
|
52
|
+
id: z.core.$ZodBranded<z.ZodString, "RuntimeComponentId", "out">;
|
|
53
|
+
kind: z.ZodEnum<{
|
|
54
|
+
plugin: "plugin";
|
|
55
|
+
theme: "theme";
|
|
56
|
+
"wordpress-core": "wordpress-core";
|
|
57
|
+
"runtime-engine": "runtime-engine";
|
|
58
|
+
"block-transformer": "block-transformer";
|
|
59
|
+
"quickjs-abi": "quickjs-abi";
|
|
60
|
+
"mu-plugin": "mu-plugin";
|
|
61
|
+
}>;
|
|
62
|
+
version: z.ZodString;
|
|
63
|
+
sha256: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
64
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
65
|
+
kind: z.ZodLiteral<"archive">;
|
|
66
|
+
url: z.ZodString;
|
|
67
|
+
bytes: z.ZodNumber;
|
|
68
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"embedded">;
|
|
70
|
+
path: z.ZodString;
|
|
71
|
+
}, z.core.$strict>], "kind">;
|
|
72
|
+
provides: z.ZodArray<z.core.$ZodBranded<z.ZodString, "RuntimeCapabilityId", "out">>;
|
|
73
|
+
activation: z.ZodEnum<{
|
|
74
|
+
always: "always";
|
|
75
|
+
"on-demand": "on-demand";
|
|
76
|
+
}>;
|
|
77
|
+
}, z.core.$strict>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export type RuntimeComponentInventoryV1 = z.infer<typeof runtimeComponentInventoryV1Schema>;
|
|
80
|
+
export declare const programRequirementsV1Schema: z.ZodObject<{
|
|
81
|
+
format: z.ZodLiteral<"spacefast.program-requirements">;
|
|
82
|
+
version: z.ZodLiteral<1>;
|
|
83
|
+
inputDigest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
84
|
+
wordpressAbi: z.ZodLiteral<1>;
|
|
85
|
+
capabilities: z.ZodArray<z.core.$ZodBranded<z.ZodString, "RuntimeCapabilityId", "out">>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
export type ProgramRequirementsV1 = z.infer<typeof programRequirementsV1Schema>;
|
|
88
|
+
export declare const runtimeComponentPlacementTargetV1Schema: z.ZodObject<{
|
|
89
|
+
spaceId: z.ZodTemplateLiteral<`spc_${string}`>;
|
|
90
|
+
runtimeInstanceId: z.ZodString;
|
|
91
|
+
siteId: z.ZodString;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export type RuntimeComponentPlacementTargetV1 = z.infer<typeof runtimeComponentPlacementTargetV1Schema>;
|
|
94
|
+
export declare const runtimeComponentPlacementReceiptV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
95
|
+
status: z.ZodLiteral<"ready">;
|
|
96
|
+
observedInventoryDigest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
97
|
+
substrate: z.ZodObject<{
|
|
98
|
+
wordpress: z.ZodObject<{
|
|
99
|
+
boot: z.ZodLiteral<"ready">;
|
|
100
|
+
database: z.ZodLiteral<"ready">;
|
|
101
|
+
tables: z.ZodLiteral<"ready">;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
routing: z.ZodObject<{
|
|
104
|
+
state: z.ZodLiteral<"ready">;
|
|
105
|
+
snapshotRevision: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
106
|
+
inventoryDigest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
mail: z.ZodObject<{
|
|
109
|
+
state: z.ZodLiteral<"ready">;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
journal: z.ZodObject<{
|
|
112
|
+
state: z.ZodLiteral<"ready">;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
format: z.ZodLiteral<"spacefast.component-placement">;
|
|
116
|
+
version: z.ZodLiteral<1>;
|
|
117
|
+
operationId: z.ZodString;
|
|
118
|
+
target: z.ZodObject<{
|
|
119
|
+
spaceId: z.ZodTemplateLiteral<`spc_${string}`>;
|
|
120
|
+
runtimeInstanceId: z.ZodString;
|
|
121
|
+
siteId: z.ZodString;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
platformRelease: z.ZodString;
|
|
124
|
+
expectedInventoryDigest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
status: z.ZodLiteral<"blocked">;
|
|
127
|
+
problems: z.ZodArray<z.ZodObject<{
|
|
128
|
+
componentId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "RuntimeComponentId", "out">>;
|
|
129
|
+
code: z.ZodString;
|
|
130
|
+
detail: z.ZodString;
|
|
131
|
+
}, z.core.$strict>>;
|
|
132
|
+
format: z.ZodLiteral<"spacefast.component-placement">;
|
|
133
|
+
version: z.ZodLiteral<1>;
|
|
134
|
+
operationId: z.ZodString;
|
|
135
|
+
target: z.ZodObject<{
|
|
136
|
+
spaceId: z.ZodTemplateLiteral<`spc_${string}`>;
|
|
137
|
+
runtimeInstanceId: z.ZodString;
|
|
138
|
+
siteId: z.ZodString;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
platformRelease: z.ZodString;
|
|
141
|
+
expectedInventoryDigest: z.core.$ZodBranded<z.ZodString, "ContentProgramSha256", "out">;
|
|
142
|
+
}, z.core.$strict>], "status">;
|
|
143
|
+
export type RuntimeComponentPlacementReceiptV1 = z.infer<typeof runtimeComponentPlacementReceiptV1Schema>;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { contentProgramSha256Schema } from "./content-program.js";
|
|
3
|
+
import { registeredIdSchema } from "./ids.js";
|
|
4
|
+
export const runtimeCapabilityIdSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.max(160)
|
|
8
|
+
.regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/)
|
|
9
|
+
.brand();
|
|
10
|
+
export const runtimeComponentIdSchema = z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(160)
|
|
14
|
+
.regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/)
|
|
15
|
+
.brand();
|
|
16
|
+
export const RUNTIME_COMPONENT_V1_REQUIRED_IDS = [
|
|
17
|
+
"wordpress-core",
|
|
18
|
+
"runtime-engine",
|
|
19
|
+
"immutable-loader",
|
|
20
|
+
"content-kernel",
|
|
21
|
+
"managed-theme",
|
|
22
|
+
"secure-custom-fields",
|
|
23
|
+
"redirection",
|
|
24
|
+
"block-transformer",
|
|
25
|
+
"quickjs-abi",
|
|
26
|
+
];
|
|
27
|
+
export const RUNTIME_COMPONENT_KINDS = [
|
|
28
|
+
"wordpress-core",
|
|
29
|
+
"runtime-engine",
|
|
30
|
+
"mu-plugin",
|
|
31
|
+
"plugin",
|
|
32
|
+
"theme",
|
|
33
|
+
"block-transformer",
|
|
34
|
+
"quickjs-abi",
|
|
35
|
+
];
|
|
36
|
+
export const runtimeComponentKindSchema = z.enum(RUNTIME_COMPONENT_KINDS);
|
|
37
|
+
const runtimeComponentV1RequiredKinds = {
|
|
38
|
+
"wordpress-core": "wordpress-core",
|
|
39
|
+
"runtime-engine": "runtime-engine",
|
|
40
|
+
"immutable-loader": "mu-plugin",
|
|
41
|
+
"content-kernel": "mu-plugin",
|
|
42
|
+
"managed-theme": "theme",
|
|
43
|
+
"secure-custom-fields": "plugin",
|
|
44
|
+
redirection: "plugin",
|
|
45
|
+
"block-transformer": "block-transformer",
|
|
46
|
+
"quickjs-abi": "quickjs-abi",
|
|
47
|
+
};
|
|
48
|
+
const runtimeComponentSourceSchema = z.discriminatedUnion("kind", [
|
|
49
|
+
z
|
|
50
|
+
.object({
|
|
51
|
+
kind: z.literal("archive"),
|
|
52
|
+
url: z.string().url(),
|
|
53
|
+
bytes: z.number().int().positive(),
|
|
54
|
+
})
|
|
55
|
+
.strict(),
|
|
56
|
+
z
|
|
57
|
+
.object({
|
|
58
|
+
kind: z.literal("embedded"),
|
|
59
|
+
path: z
|
|
60
|
+
.string()
|
|
61
|
+
.min(1)
|
|
62
|
+
.max(512)
|
|
63
|
+
.refine((path) => !path.startsWith("/") && !path.split("/").includes(".."), {
|
|
64
|
+
message: "embedded component paths must be relative and cannot traverse",
|
|
65
|
+
}),
|
|
66
|
+
})
|
|
67
|
+
.strict(),
|
|
68
|
+
]);
|
|
69
|
+
export const runtimeComponentV1Schema = z
|
|
70
|
+
.object({
|
|
71
|
+
id: runtimeComponentIdSchema,
|
|
72
|
+
kind: runtimeComponentKindSchema,
|
|
73
|
+
version: z.string().min(1).max(160),
|
|
74
|
+
sha256: contentProgramSha256Schema,
|
|
75
|
+
source: runtimeComponentSourceSchema,
|
|
76
|
+
provides: z.array(runtimeCapabilityIdSchema).max(100),
|
|
77
|
+
activation: z.enum(["always", "on-demand"]),
|
|
78
|
+
})
|
|
79
|
+
.strict()
|
|
80
|
+
.refine((component) => new Set(component.provides).size === component.provides.length, {
|
|
81
|
+
path: ["provides"],
|
|
82
|
+
message: "provided capabilities must be unique",
|
|
83
|
+
});
|
|
84
|
+
export const runtimeComponentInventoryV1Schema = z
|
|
85
|
+
.object({
|
|
86
|
+
format: z.literal("spacefast.wordpress-components"),
|
|
87
|
+
version: z.literal(1),
|
|
88
|
+
platformRelease: z.string().min(1).max(160),
|
|
89
|
+
digest: contentProgramSha256Schema,
|
|
90
|
+
components: z.array(runtimeComponentV1Schema).min(1).max(100),
|
|
91
|
+
})
|
|
92
|
+
.strict()
|
|
93
|
+
.superRefine((inventory, context) => {
|
|
94
|
+
const ids = inventory.components.map((component) => component.id);
|
|
95
|
+
if (new Set(ids).size !== ids.length) {
|
|
96
|
+
context.addIssue({
|
|
97
|
+
code: "custom",
|
|
98
|
+
path: ["components"],
|
|
99
|
+
message: "component ids must be unique",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
for (const required of RUNTIME_COMPONENT_V1_REQUIRED_IDS) {
|
|
103
|
+
const matching = inventory.components.filter((component) => component.id === required);
|
|
104
|
+
if (matching.length !== 1) {
|
|
105
|
+
context.addIssue({
|
|
106
|
+
code: "custom",
|
|
107
|
+
path: ["components"],
|
|
108
|
+
message: `component inventory requires exactly one ${required} component`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else if (matching[0]?.kind !== runtimeComponentV1RequiredKinds[required]) {
|
|
112
|
+
context.addIssue({
|
|
113
|
+
code: "custom",
|
|
114
|
+
path: ["components"],
|
|
115
|
+
message: `${required} must use component kind ${runtimeComponentV1RequiredKinds[required]}`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
export const programRequirementsV1Schema = z
|
|
121
|
+
.object({
|
|
122
|
+
format: z.literal("spacefast.program-requirements"),
|
|
123
|
+
version: z.literal(1),
|
|
124
|
+
inputDigest: contentProgramSha256Schema,
|
|
125
|
+
wordpressAbi: z.literal(1),
|
|
126
|
+
capabilities: z.array(runtimeCapabilityIdSchema).max(100),
|
|
127
|
+
})
|
|
128
|
+
.strict()
|
|
129
|
+
.refine((requirements) => new Set(requirements.capabilities).size === requirements.capabilities.length, {
|
|
130
|
+
path: ["capabilities"],
|
|
131
|
+
message: "program capabilities must be unique",
|
|
132
|
+
});
|
|
133
|
+
export const runtimeComponentPlacementTargetV1Schema = z
|
|
134
|
+
.object({
|
|
135
|
+
spaceId: registeredIdSchema("spc"),
|
|
136
|
+
runtimeInstanceId: z.string().min(1).max(255),
|
|
137
|
+
siteId: z.string().min(1).max(255),
|
|
138
|
+
})
|
|
139
|
+
.strict();
|
|
140
|
+
const runtimeComponentPlacementReceiptFields = {
|
|
141
|
+
format: z.literal("spacefast.component-placement"),
|
|
142
|
+
version: z.literal(1),
|
|
143
|
+
operationId: z.string().min(1).max(160),
|
|
144
|
+
target: runtimeComponentPlacementTargetV1Schema,
|
|
145
|
+
platformRelease: z.string().min(1).max(160),
|
|
146
|
+
expectedInventoryDigest: contentProgramSha256Schema,
|
|
147
|
+
};
|
|
148
|
+
const readyPlacementSubstrateV1Schema = z
|
|
149
|
+
.object({
|
|
150
|
+
wordpress: z
|
|
151
|
+
.object({
|
|
152
|
+
boot: z.literal("ready"),
|
|
153
|
+
database: z.literal("ready"),
|
|
154
|
+
tables: z.literal("ready"),
|
|
155
|
+
})
|
|
156
|
+
.strict(),
|
|
157
|
+
routing: z
|
|
158
|
+
.object({
|
|
159
|
+
state: z.literal("ready"),
|
|
160
|
+
snapshotRevision: contentProgramSha256Schema,
|
|
161
|
+
inventoryDigest: contentProgramSha256Schema,
|
|
162
|
+
})
|
|
163
|
+
.strict(),
|
|
164
|
+
mail: z.object({ state: z.literal("ready") }).strict(),
|
|
165
|
+
journal: z.object({ state: z.literal("ready") }).strict(),
|
|
166
|
+
})
|
|
167
|
+
.strict();
|
|
168
|
+
export const runtimeComponentPlacementReceiptV1Schema = z
|
|
169
|
+
.discriminatedUnion("status", [
|
|
170
|
+
z
|
|
171
|
+
.object({
|
|
172
|
+
...runtimeComponentPlacementReceiptFields,
|
|
173
|
+
status: z.literal("ready"),
|
|
174
|
+
observedInventoryDigest: contentProgramSha256Schema,
|
|
175
|
+
substrate: readyPlacementSubstrateV1Schema,
|
|
176
|
+
})
|
|
177
|
+
.strict(),
|
|
178
|
+
z
|
|
179
|
+
.object({
|
|
180
|
+
...runtimeComponentPlacementReceiptFields,
|
|
181
|
+
status: z.literal("blocked"),
|
|
182
|
+
problems: z
|
|
183
|
+
.array(z
|
|
184
|
+
.object({
|
|
185
|
+
componentId: runtimeComponentIdSchema.optional(),
|
|
186
|
+
code: z.string().min(1).max(160),
|
|
187
|
+
detail: z.string().min(1).max(2_000),
|
|
188
|
+
})
|
|
189
|
+
.strict())
|
|
190
|
+
.min(1)
|
|
191
|
+
.max(100),
|
|
192
|
+
})
|
|
193
|
+
.strict(),
|
|
194
|
+
])
|
|
195
|
+
.refine((receipt) => receipt.status !== "ready" ||
|
|
196
|
+
receipt.observedInventoryDigest === receipt.expectedInventoryDigest, {
|
|
197
|
+
path: ["observedInventoryDigest"],
|
|
198
|
+
message: "a ready receipt must observe the expected inventory digest",
|
|
199
|
+
});
|
|
@@ -2,22 +2,33 @@ import { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* The database surface, for whichever runtime a space is carrying.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* property of the wp.cloud site rather than of anything a version declared.
|
|
5
|
+
* One database per space, the site's own MySQL, and at most one runtime with a
|
|
6
|
+
* claim on it, so these contracts are runtime-neutral. Two exceptions: a
|
|
7
|
+
* migration plan is a capsule's declaration and no worker has one, and the
|
|
8
|
+
* console hand-off is a property of the wp.cloud site.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* `zeroMigrationOperationSchema`)
|
|
13
|
-
*
|
|
14
|
-
* the declaration-shaped fields empty. Those shapes stay Zero-named and stay in
|
|
15
|
-
* `./zero.js`: a declared table is the capsule's own statement about itself.
|
|
10
|
+
* Reads answer in the capsule's declaration shapes (`zeroTableSchema`,
|
|
11
|
+
* `zeroMigrationOperationSchema`); a worker's answer is the same shape with the
|
|
12
|
+
* declaration-shaped fields empty.
|
|
16
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Whether the live version's declared migration plan has actually run against
|
|
16
|
+
* the space database. `applied` compares the recorded application against the
|
|
17
|
+
* plan's target `schemaHash`; it is `null` when no application record exists —
|
|
18
|
+
* a version finalized before this record existed, or a finalize whose ready
|
|
19
|
+
* receipt was a replay — because the control plane then cannot prove the plan
|
|
20
|
+
* ran. Honest unknown, never a guess.
|
|
21
|
+
*/
|
|
22
|
+
export declare const runtimeDbPlanStateSchema: z.ZodObject<{
|
|
23
|
+
applied: z.ZodNullable<z.ZodBoolean>;
|
|
24
|
+
appliedSchemaHash: z.ZodNullable<z.ZodString>;
|
|
25
|
+
pendingOperationCount: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type RuntimeDbPlanState = z.infer<typeof runtimeDbPlanStateSchema>;
|
|
17
28
|
export declare const runtimeDbInspectResponseSchema: z.ZodObject<{
|
|
18
29
|
versionId: z.ZodNullable<z.ZodString>;
|
|
19
30
|
artifactId: z.ZodNullable<z.ZodString>;
|
|
20
|
-
backend: z.ZodNullable<z.ZodLiteral<"
|
|
31
|
+
backend: z.ZodNullable<z.ZodLiteral<"mysql">>;
|
|
21
32
|
migrationMode: z.ZodNullable<z.ZodEnum<{
|
|
22
33
|
safe: "safe";
|
|
23
34
|
drop: "drop";
|
|
@@ -91,13 +102,18 @@ export declare const runtimeDbInspectResponseSchema: z.ZodObject<{
|
|
|
91
102
|
to: z.ZodString;
|
|
92
103
|
explicit: z.ZodLiteral<"rename">;
|
|
93
104
|
}, z.core.$strict>], "op">>>;
|
|
105
|
+
plan: z.ZodNullable<z.ZodObject<{
|
|
106
|
+
applied: z.ZodNullable<z.ZodBoolean>;
|
|
107
|
+
appliedSchemaHash: z.ZodNullable<z.ZodString>;
|
|
108
|
+
pendingOperationCount: z.ZodNumber;
|
|
109
|
+
}, z.core.$strict>>;
|
|
94
110
|
}, z.core.$strict>;
|
|
95
111
|
export type RuntimeDbInspectResponse = z.infer<typeof runtimeDbInspectResponseSchema>;
|
|
96
112
|
export declare const runtimeDbInspectPublicResponseSchema: z.ZodObject<{
|
|
97
113
|
data: z.ZodObject<{
|
|
98
114
|
versionId: z.ZodNullable<z.ZodString>;
|
|
99
115
|
artifactId: z.ZodNullable<z.ZodString>;
|
|
100
|
-
backend: z.ZodNullable<z.ZodLiteral<"
|
|
116
|
+
backend: z.ZodNullable<z.ZodLiteral<"mysql">>;
|
|
101
117
|
migrationMode: z.ZodNullable<z.ZodEnum<{
|
|
102
118
|
safe: "safe";
|
|
103
119
|
drop: "drop";
|
|
@@ -171,15 +187,24 @@ export declare const runtimeDbInspectPublicResponseSchema: z.ZodObject<{
|
|
|
171
187
|
to: z.ZodString;
|
|
172
188
|
explicit: z.ZodLiteral<"rename">;
|
|
173
189
|
}, z.core.$strict>], "op">>>;
|
|
190
|
+
plan: z.ZodNullable<z.ZodObject<{
|
|
191
|
+
applied: z.ZodNullable<z.ZodBoolean>;
|
|
192
|
+
appliedSchemaHash: z.ZodNullable<z.ZodString>;
|
|
193
|
+
pendingOperationCount: z.ZodNumber;
|
|
194
|
+
}, z.core.$strict>>;
|
|
174
195
|
}, z.core.$strict>;
|
|
175
196
|
}, z.core.$strip>;
|
|
176
197
|
export declare const runtimeDbDumpQuerySchema: z.ZodObject<{
|
|
177
198
|
table: z.ZodOptional<z.ZodString>;
|
|
178
199
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
179
200
|
}, z.core.$strict>;
|
|
201
|
+
export type RuntimeDbCellValue = string | number | boolean | null | RuntimeDbCellValue[] | {
|
|
202
|
+
[key: string]: RuntimeDbCellValue;
|
|
203
|
+
};
|
|
204
|
+
export declare const runtimeDbCellValueSchema: z.ZodType<RuntimeDbCellValue>;
|
|
180
205
|
export declare const runtimeDbDumpTableSchema: z.ZodObject<{
|
|
181
206
|
name: z.ZodString;
|
|
182
|
-
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
207
|
+
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<RuntimeDbCellValue, unknown, z.core.$ZodTypeInternals<RuntimeDbCellValue, unknown>>>>>;
|
|
183
208
|
}, z.core.$strict>;
|
|
184
209
|
export declare const runtimeDbDumpResponseSchema: z.ZodObject<{
|
|
185
210
|
versionId: z.ZodNullable<z.ZodString>;
|
|
@@ -187,7 +212,7 @@ export declare const runtimeDbDumpResponseSchema: z.ZodObject<{
|
|
|
187
212
|
schemaHash: z.ZodNullable<z.ZodString>;
|
|
188
213
|
tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
189
214
|
name: z.ZodString;
|
|
190
|
-
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
215
|
+
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<RuntimeDbCellValue, unknown, z.core.$ZodTypeInternals<RuntimeDbCellValue, unknown>>>>>;
|
|
191
216
|
}, z.core.$strict>>>;
|
|
192
217
|
}, z.core.$strict>;
|
|
193
218
|
export type RuntimeDbDumpResponse = z.infer<typeof runtimeDbDumpResponseSchema>;
|
|
@@ -198,7 +223,7 @@ export declare const runtimeDbDumpPublicResponseSchema: z.ZodObject<{
|
|
|
198
223
|
schemaHash: z.ZodNullable<z.ZodString>;
|
|
199
224
|
tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
200
225
|
name: z.ZodString;
|
|
201
|
-
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
226
|
+
rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>>>;
|
|
202
227
|
}, z.core.$strict>>>;
|
|
203
228
|
}, z.core.$strict>;
|
|
204
229
|
}, z.core.$strip>;
|
|
@@ -237,15 +262,16 @@ export declare const runtimeDbExportPageQuerySchema: z.ZodObject<{
|
|
|
237
262
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
238
263
|
}, z.core.$strict>;
|
|
239
264
|
export declare const runtimeDbExportPageSchema: z.ZodObject<{
|
|
240
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
265
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<RuntimeDbCellValue, unknown, z.core.$ZodTypeInternals<RuntimeDbCellValue, unknown>>>>;
|
|
241
266
|
cursor: z.ZodNullable<z.ZodString>;
|
|
242
267
|
}, z.core.$strict>;
|
|
243
268
|
export type RuntimeDbExportPage = z.infer<typeof runtimeDbExportPageSchema>;
|
|
244
269
|
export declare const runtimeDbExportPagePublicResponseSchema: z.ZodObject<{
|
|
245
|
-
data: z.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
270
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>>;
|
|
271
|
+
pagination: z.ZodObject<{
|
|
272
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
273
|
+
hasMore: z.ZodBoolean;
|
|
274
|
+
}, z.core.$strip>;
|
|
249
275
|
}, z.core.$strip>;
|
|
250
276
|
export declare const runtimeDbMigrateResultSchema: z.ZodObject<{
|
|
251
277
|
versionId: z.ZodString;
|
|
@@ -399,7 +425,7 @@ export declare const runtimeDbMigrateResponseSchema: z.ZodObject<{
|
|
|
399
425
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
400
426
|
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
401
427
|
registrar: "registrar";
|
|
402
|
-
|
|
428
|
+
infra: "infra";
|
|
403
429
|
dns: "dns";
|
|
404
430
|
runtime: "runtime";
|
|
405
431
|
}>>>;
|
|
@@ -412,13 +438,13 @@ export declare const runtimeDbMigrateResponseSchema: z.ZodObject<{
|
|
|
412
438
|
}, z.core.$strip>>;
|
|
413
439
|
}, z.core.$strip>;
|
|
414
440
|
export declare const runtimeDbConsoleSchema: z.ZodObject<{
|
|
415
|
-
provider: z.ZodLiteral<"
|
|
441
|
+
provider: z.ZodLiteral<"phpmyadmin">;
|
|
416
442
|
url: z.ZodString;
|
|
417
443
|
}, z.core.$strict>;
|
|
418
444
|
export type RuntimeDbConsole = z.infer<typeof runtimeDbConsoleSchema>;
|
|
419
445
|
export declare const runtimeDbConsoleResponseSchema: z.ZodObject<{
|
|
420
446
|
data: z.ZodObject<{
|
|
421
|
-
provider: z.ZodLiteral<"
|
|
447
|
+
provider: z.ZodLiteral<"phpmyadmin">;
|
|
422
448
|
url: z.ZodString;
|
|
423
449
|
}, z.core.$strict>;
|
|
424
450
|
}, z.core.$strip>;
|
|
@@ -1,44 +1,77 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { dataEnvelope, mutationEnvelope } from "./common.js";
|
|
2
|
+
import { CursorPaginationSchema, dataEnvelope, mutationEnvelope } from "./common.js";
|
|
3
3
|
import { executionIdentifierSchema, executionSha256Schema } from "./execution.js";
|
|
4
4
|
import { ZERO_RUNTIME_KIND, zeroMigrationOperationSchema, zeroTableSchema } from "./zero.js";
|
|
5
5
|
/**
|
|
6
6
|
* The database surface, for whichever runtime a space is carrying.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* property of the wp.cloud site rather than of anything a version declared.
|
|
8
|
+
* One database per space, the site's own MySQL, and at most one runtime with a
|
|
9
|
+
* claim on it, so these contracts are runtime-neutral. Two exceptions: a
|
|
10
|
+
* migration plan is a capsule's declaration and no worker has one, and the
|
|
11
|
+
* console hand-off is a property of the wp.cloud site.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
* `zeroMigrationOperationSchema`)
|
|
16
|
-
*
|
|
17
|
-
* the declaration-shaped fields empty. Those shapes stay Zero-named and stay in
|
|
18
|
-
* `./zero.js`: a declared table is the capsule's own statement about itself.
|
|
13
|
+
* Reads answer in the capsule's declaration shapes (`zeroTableSchema`,
|
|
14
|
+
* `zeroMigrationOperationSchema`); a worker's answer is the same shape with the
|
|
15
|
+
* declaration-shaped fields empty.
|
|
19
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* Whether the live version's declared migration plan has actually run against
|
|
19
|
+
* the space database. `applied` compares the recorded application against the
|
|
20
|
+
* plan's target `schemaHash`; it is `null` when no application record exists —
|
|
21
|
+
* a version finalized before this record existed, or a finalize whose ready
|
|
22
|
+
* receipt was a replay — because the control plane then cannot prove the plan
|
|
23
|
+
* ran. Honest unknown, never a guess.
|
|
24
|
+
*/
|
|
25
|
+
export const runtimeDbPlanStateSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
applied: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.nullable()
|
|
30
|
+
.describe("Whether this plan has been run against the space database. `null` when the control plane has no application record and cannot truthfully say."),
|
|
31
|
+
appliedSchemaHash: executionSha256Schema
|
|
32
|
+
.nullable()
|
|
33
|
+
.describe("Schema hash recorded when a plan was last applied for this version, if any."),
|
|
34
|
+
pendingOperationCount: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.nonnegative()
|
|
38
|
+
.describe("Queued or running `db migrate` operations for this space. Non-zero means an apply is still waiting."),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
20
41
|
export const runtimeDbInspectResponseSchema = z
|
|
21
42
|
.object({
|
|
22
43
|
versionId: z.string().min(1).nullable(),
|
|
23
44
|
artifactId: z.string().min(1).nullable(),
|
|
24
|
-
backend: z.literal("
|
|
45
|
+
backend: z.literal("mysql").nullable(),
|
|
25
46
|
migrationMode: z.enum(["safe", "drop", "rename"]).nullable(),
|
|
26
47
|
schemaHash: executionSha256Schema.nullable(),
|
|
27
48
|
tables: z.array(zeroTableSchema).default([]),
|
|
28
49
|
migrations: z.array(zeroMigrationOperationSchema).default([]),
|
|
50
|
+
plan: runtimeDbPlanStateSchema
|
|
51
|
+
.nullable()
|
|
52
|
+
.describe("Applied-state of the live version's migration plan. `null` when the live version declares no migration plan."),
|
|
29
53
|
})
|
|
30
54
|
.strict();
|
|
31
55
|
export const runtimeDbInspectPublicResponseSchema = dataEnvelope(runtimeDbInspectResponseSchema);
|
|
32
56
|
export const runtimeDbDumpQuerySchema = z
|
|
33
57
|
.object({
|
|
34
|
-
table: executionIdentifierSchema
|
|
35
|
-
|
|
58
|
+
table: executionIdentifierSchema
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("Dump only this declared table. Omit it to dump every declared table."),
|
|
61
|
+
limit: z.coerce
|
|
62
|
+
.number()
|
|
63
|
+
.int()
|
|
64
|
+
.min(1)
|
|
65
|
+
.max(100)
|
|
66
|
+
.default(25)
|
|
67
|
+
.describe("Maximum rows to read per table."),
|
|
36
68
|
})
|
|
37
69
|
.strict();
|
|
70
|
+
export const runtimeDbCellValueSchema = z.json();
|
|
38
71
|
export const runtimeDbDumpTableSchema = z
|
|
39
72
|
.object({
|
|
40
73
|
name: executionIdentifierSchema,
|
|
41
|
-
rows: z.array(z.record(z.string(),
|
|
74
|
+
rows: z.array(z.record(z.string(), runtimeDbCellValueSchema)).default([]),
|
|
42
75
|
})
|
|
43
76
|
.strict();
|
|
44
77
|
export const runtimeDbDumpResponseSchema = z
|
|
@@ -49,7 +82,22 @@ export const runtimeDbDumpResponseSchema = z
|
|
|
49
82
|
tables: z.array(runtimeDbDumpTableSchema).default([]),
|
|
50
83
|
})
|
|
51
84
|
.strict();
|
|
52
|
-
|
|
85
|
+
// OpenAPI embeds a local recursive `$ref` below the route and cannot resolve
|
|
86
|
+
// it, so the same wire contract is spelled out non-recursively here.
|
|
87
|
+
const runtimeDbWireCellValueSchema = z.union([
|
|
88
|
+
z.string(),
|
|
89
|
+
z.number(),
|
|
90
|
+
z.boolean(),
|
|
91
|
+
z.null(),
|
|
92
|
+
z.array(z.unknown()),
|
|
93
|
+
z.record(z.string(), z.unknown()),
|
|
94
|
+
]);
|
|
95
|
+
const runtimeDbDumpPublicTableSchema = runtimeDbDumpTableSchema.extend({
|
|
96
|
+
rows: z.array(z.record(z.string(), runtimeDbWireCellValueSchema)).default([]),
|
|
97
|
+
});
|
|
98
|
+
export const runtimeDbDumpPublicResponseSchema = dataEnvelope(runtimeDbDumpResponseSchema.extend({
|
|
99
|
+
tables: z.array(runtimeDbDumpPublicTableSchema).default([]),
|
|
100
|
+
}));
|
|
53
101
|
export const runtimeDbExportOrderingSchema = z
|
|
54
102
|
.object({
|
|
55
103
|
tables: z.literal("name_asc"),
|
|
@@ -69,18 +117,35 @@ export const runtimeDbExportMetadataSchema = z
|
|
|
69
117
|
export const runtimeDbExportMetadataPublicResponseSchema = dataEnvelope(runtimeDbExportMetadataSchema);
|
|
70
118
|
export const runtimeDbExportPageQuerySchema = z
|
|
71
119
|
.object({
|
|
72
|
-
schemaHash: executionSha256Schema,
|
|
73
|
-
cursor: z
|
|
74
|
-
|
|
120
|
+
schemaHash: executionSha256Schema.describe("Schema fence from `GET /v1/spaces/{spaceId}/db/export`. A page whose table has changed shape since is rejected rather than mixed into the export."),
|
|
121
|
+
cursor: z
|
|
122
|
+
.string()
|
|
123
|
+
.min(1)
|
|
124
|
+
.max(4_096)
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("Opaque cursor from the previous page's `pagination.nextCursor`."),
|
|
127
|
+
limit: z.coerce
|
|
128
|
+
.number()
|
|
129
|
+
.int()
|
|
130
|
+
.min(1)
|
|
131
|
+
.max(1_000)
|
|
132
|
+
.default(500)
|
|
133
|
+
.describe("Maximum rows to return in this page."),
|
|
75
134
|
})
|
|
76
135
|
.strict();
|
|
136
|
+
// The runtime's own wire shape for an export page: rows plus a bare keyset
|
|
137
|
+
// `cursor` that is null at the end. The control plane re-envelopes it into the
|
|
138
|
+
// one platform list envelope below.
|
|
77
139
|
export const runtimeDbExportPageSchema = z
|
|
78
140
|
.object({
|
|
79
|
-
rows: z.array(z.record(z.string(),
|
|
141
|
+
rows: z.array(z.record(z.string(), runtimeDbCellValueSchema)),
|
|
80
142
|
cursor: z.string().nullable(),
|
|
81
143
|
})
|
|
82
144
|
.strict();
|
|
83
|
-
export const runtimeDbExportPagePublicResponseSchema =
|
|
145
|
+
export const runtimeDbExportPagePublicResponseSchema = z.object({
|
|
146
|
+
data: z.array(z.record(z.string(), runtimeDbWireCellValueSchema)),
|
|
147
|
+
pagination: CursorPaginationSchema,
|
|
148
|
+
});
|
|
84
149
|
export const runtimeDbMigrateResultSchema = z
|
|
85
150
|
.object({
|
|
86
151
|
versionId: z.string().min(1).describe("Live version whose migration plan this is."),
|
|
@@ -98,7 +163,7 @@ export const runtimeDbMigrateResultSchema = z
|
|
|
98
163
|
export const runtimeDbMigrateResponseSchema = mutationEnvelope(runtimeDbMigrateResultSchema);
|
|
99
164
|
export const runtimeDbConsoleSchema = z
|
|
100
165
|
.object({
|
|
101
|
-
provider: z.literal("
|
|
166
|
+
provider: z.literal("phpmyadmin"),
|
|
102
167
|
url: z
|
|
103
168
|
.string()
|
|
104
169
|
.url()
|