@spacefast/common 0.0.26 → 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/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 -1
- package/dist/agents/private-key-oauth.js +124 -33
- 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 +1 -2
- package/dist/brand-assets.js +4 -7
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +55 -28
- package/dist/config/domains.js +85 -41
- 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 +21 -27
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +70 -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.js +7 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +186 -7
- package/dist/contracts/builds.js +75 -21
- 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 +45 -35
- 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 +18 -29
- 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 +17 -0
- package/dist/contracts/crons.js +33 -15
- 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 +6 -10
- package/dist/contracts/docs.js +5 -13
- package/dist/contracts/domains.d.ts +499 -102
- package/dist/contracts/domains.js +169 -58
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +26 -26
- package/dist/contracts/enums.js +61 -54
- package/dist/contracts/error-code-meta.d.ts +269 -7
- package/dist/contracts/error-code-meta.js +80 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +78 -16
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +51 -64
- package/dist/contracts/feature-lifecycle.d.ts +70 -14
- package/dist/contracts/feature-lifecycle.js +86 -15
- package/dist/contracts/features.d.ts +100 -37
- package/dist/contracts/features.js +21 -27
- 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 +218 -211
- package/dist/contracts/functions.js +273 -260
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +64 -56
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +4 -1
- package/dist/contracts/internal.d.ts +5 -4
- package/dist/contracts/internal.js +12 -3
- package/dist/contracts/mcp.d.ts +17 -0
- package/dist/contracts/mcp.js +23 -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 +11 -5
- package/dist/contracts/pages.d.ts +29 -5
- 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.d.ts +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 +116 -18
- package/dist/contracts/publish-archive.js +6 -3
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +3 -3
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/repository-connections.js +6 -2
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +145 -21
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +112 -35
- package/dist/contracts/runtime-api.js +86 -66
- package/dist/contracts/runtime-app.d.ts +11 -21
- 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 +45 -19
- package/dist/contracts/runtime-db.js +85 -20
- package/dist/contracts/runtime-purge.js +3 -5
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +14 -14
- package/dist/contracts/runtime-storage.js +28 -13
- package/dist/contracts/sf-config-v1.d.ts +14 -18
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +235 -28
- package/dist/contracts/space-config.js +246 -91
- package/dist/contracts/spaces.d.ts +360 -255
- package/dist/contracts/spaces.js +190 -122
- 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 +435 -186
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +3 -0
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -6
- package/dist/contracts/superadmin-tenants.js +32 -7
- package/dist/contracts/superadmin.d.ts +98 -16
- package/dist/contracts/superadmin.js +63 -10
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +44 -34
- package/dist/contracts/teams.d.ts +72 -9
- package/dist/contracts/teams.js +84 -25
- 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 +1 -0
- 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 +57 -64
- package/dist/contracts/zero.js +68 -66
- 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 +11 -17
- package/dist/docs/agent-prose.js +62 -37
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +336 -436
- package/dist/docs/catalog.d.ts +147 -89
- package/dist/docs/catalog.js +157 -42
- package/dist/docs/error-docs.d.ts +2098 -1
- package/dist/docs/error-docs.js +281 -16
- 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 +117 -117
- package/dist/docs/skills.js +120 -72
- 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/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +16 -0
- package/dist/utils/build-settings.js +63 -17
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +3 -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 +2 -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 +123 -57
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +4 -7
- 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 +15 -15
- package/dist/utils/local-space-state.js +34 -23
- 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 +3 -5
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +4 -10
- package/dist/utils/page-colors.js +11 -35
- package/dist/utils/page-fonts.js +6 -11
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +22 -11
- package/dist/utils/pages.js +70 -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 +10 -23
- package/dist/utils/publish-policy.js +63 -116
- 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 +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +18 -24
- package/dist/utils/space-config.d.ts +11 -14
- package/dist/utils/space-config.js +10 -16
- package/dist/utils/static-runtime-policy.d.ts +5 -8
- 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 +17 -84
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.js +8 -14
- 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 +7 -7
- package/dist/vocabulary.js +30 -16
- package/package.json +14 -2
- 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,165 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Partner commerce contracts (companion spec `2026-08-23-partner-commerce-design.md`
|
|
4
|
+
* §2 usage, §3 entitlements, and §4 principal lifecycle.
|
|
5
|
+
*
|
|
6
|
+
* This is the single home for the commercial layer: the principal lifecycle
|
|
7
|
+
* status/actor vocabulary, the per-tenant plan catalog declared in the
|
|
8
|
+
* system-space manifest, and the imperative plan-assignment request. The
|
|
9
|
+
* principal directory shape (`principals.ts`) and the manifest schema
|
|
10
|
+
* (`space-config.ts`) both import from here, so the vocabulary has one owner.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PRINCIPAL_LIFECYCLE_STATUSES: readonly ["active", "suspended", "closed"];
|
|
13
|
+
export declare const principalLifecycleStatusSchema: z.ZodEnum<{
|
|
14
|
+
active: "active";
|
|
15
|
+
suspended: "suspended";
|
|
16
|
+
closed: "closed";
|
|
17
|
+
}>;
|
|
18
|
+
export type PrincipalLifecycleStatus = z.infer<typeof principalLifecycleStatusSchema>;
|
|
19
|
+
export declare const PRINCIPAL_STATUS_ACTORS: readonly ["partner", "spacefast"];
|
|
20
|
+
export declare const principalStatusActorSchema: z.ZodEnum<{
|
|
21
|
+
spacefast: "spacefast";
|
|
22
|
+
partner: "partner";
|
|
23
|
+
}>;
|
|
24
|
+
export type PrincipalStatusActor = z.infer<typeof principalStatusActorSchema>;
|
|
25
|
+
export declare const PLAN_CATALOG_CAPS: {
|
|
26
|
+
/** Max distinct plans a tenant may declare. */
|
|
27
|
+
readonly plans: 64;
|
|
28
|
+
/** Max plan-name length (also the assigned-plan and defaultPlan bound). */
|
|
29
|
+
readonly planNameChars: 64;
|
|
30
|
+
/** A plan can grant at most every known feature key. */
|
|
31
|
+
readonly features: number;
|
|
32
|
+
};
|
|
33
|
+
export declare const QUOTA_ENFORCEMENT_POLICIES: readonly ["warn", "block"];
|
|
34
|
+
export declare const quotaEnforcementPolicySchema: z.ZodEnum<{
|
|
35
|
+
warn: "warn";
|
|
36
|
+
block: "block";
|
|
37
|
+
}>;
|
|
38
|
+
export type QuotaEnforcementPolicy = z.infer<typeof quotaEnforcementPolicySchema>;
|
|
39
|
+
export declare const planCatalogEntrySchema: z.ZodObject<{
|
|
40
|
+
features: z.ZodArray<z.ZodEnum<{
|
|
41
|
+
zero: "zero";
|
|
42
|
+
"plans.paid.available": "plans.paid.available";
|
|
43
|
+
"anonymous.publishing": "anonymous.publishing";
|
|
44
|
+
"beta.enrollment_gate": "beta.enrollment_gate";
|
|
45
|
+
"domains.search": "domains.search";
|
|
46
|
+
"domains.registration": "domains.registration";
|
|
47
|
+
"domains.dns_management": "domains.dns_management";
|
|
48
|
+
"domains.wpcom_dns": "domains.wpcom_dns";
|
|
49
|
+
"domains.domain_connect": "domains.domain_connect";
|
|
50
|
+
"domains.proxy_bindings": "domains.proxy_bindings";
|
|
51
|
+
"collab.notices": "collab.notices";
|
|
52
|
+
"collab.comments": "collab.comments";
|
|
53
|
+
"content.managed": "content.managed";
|
|
54
|
+
"sites.dedicated_runtime": "sites.dedicated_runtime";
|
|
55
|
+
"collab.drawing": "collab.drawing";
|
|
56
|
+
tags: "tags";
|
|
57
|
+
functions: "functions";
|
|
58
|
+
"spaces.slug_rename": "spaces.slug_rename";
|
|
59
|
+
"pages.templates": "pages.templates";
|
|
60
|
+
"branding.hide": "branding.hide";
|
|
61
|
+
}>>;
|
|
62
|
+
quotas: z.ZodObject<{
|
|
63
|
+
spaces: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
storageBytes: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
buildMinutesPerMonth: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
customDomains: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
quotaPolicy: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
warn: "warn";
|
|
70
|
+
block: "block";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export type PlanCatalogEntry = z.infer<typeof planCatalogEntrySchema>;
|
|
74
|
+
export declare const planCatalogSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
75
|
+
features: z.ZodArray<z.ZodEnum<{
|
|
76
|
+
zero: "zero";
|
|
77
|
+
"plans.paid.available": "plans.paid.available";
|
|
78
|
+
"anonymous.publishing": "anonymous.publishing";
|
|
79
|
+
"beta.enrollment_gate": "beta.enrollment_gate";
|
|
80
|
+
"domains.search": "domains.search";
|
|
81
|
+
"domains.registration": "domains.registration";
|
|
82
|
+
"domains.dns_management": "domains.dns_management";
|
|
83
|
+
"domains.wpcom_dns": "domains.wpcom_dns";
|
|
84
|
+
"domains.domain_connect": "domains.domain_connect";
|
|
85
|
+
"domains.proxy_bindings": "domains.proxy_bindings";
|
|
86
|
+
"collab.notices": "collab.notices";
|
|
87
|
+
"collab.comments": "collab.comments";
|
|
88
|
+
"content.managed": "content.managed";
|
|
89
|
+
"sites.dedicated_runtime": "sites.dedicated_runtime";
|
|
90
|
+
"collab.drawing": "collab.drawing";
|
|
91
|
+
tags: "tags";
|
|
92
|
+
functions: "functions";
|
|
93
|
+
"spaces.slug_rename": "spaces.slug_rename";
|
|
94
|
+
"pages.templates": "pages.templates";
|
|
95
|
+
"branding.hide": "branding.hide";
|
|
96
|
+
}>>;
|
|
97
|
+
quotas: z.ZodObject<{
|
|
98
|
+
spaces: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
storageBytes: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
buildMinutesPerMonth: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
customDomains: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
quotaPolicy: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
warn: "warn";
|
|
105
|
+
block: "block";
|
|
106
|
+
}>>;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
export type PlanCatalog = z.infer<typeof planCatalogSchema>;
|
|
109
|
+
export declare const defaultPlanNameSchema: z.ZodString;
|
|
110
|
+
export declare const materializedPlanCatalogSchema: z.ZodObject<{
|
|
111
|
+
plans: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
112
|
+
features: z.ZodArray<z.ZodEnum<{
|
|
113
|
+
zero: "zero";
|
|
114
|
+
"plans.paid.available": "plans.paid.available";
|
|
115
|
+
"anonymous.publishing": "anonymous.publishing";
|
|
116
|
+
"beta.enrollment_gate": "beta.enrollment_gate";
|
|
117
|
+
"domains.search": "domains.search";
|
|
118
|
+
"domains.registration": "domains.registration";
|
|
119
|
+
"domains.dns_management": "domains.dns_management";
|
|
120
|
+
"domains.wpcom_dns": "domains.wpcom_dns";
|
|
121
|
+
"domains.domain_connect": "domains.domain_connect";
|
|
122
|
+
"domains.proxy_bindings": "domains.proxy_bindings";
|
|
123
|
+
"collab.notices": "collab.notices";
|
|
124
|
+
"collab.comments": "collab.comments";
|
|
125
|
+
"content.managed": "content.managed";
|
|
126
|
+
"sites.dedicated_runtime": "sites.dedicated_runtime";
|
|
127
|
+
"collab.drawing": "collab.drawing";
|
|
128
|
+
tags: "tags";
|
|
129
|
+
functions: "functions";
|
|
130
|
+
"spaces.slug_rename": "spaces.slug_rename";
|
|
131
|
+
"pages.templates": "pages.templates";
|
|
132
|
+
"branding.hide": "branding.hide";
|
|
133
|
+
}>>;
|
|
134
|
+
quotas: z.ZodObject<{
|
|
135
|
+
spaces: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
storageBytes: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
buildMinutesPerMonth: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
customDomains: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
quotaPolicy: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
warn: "warn";
|
|
142
|
+
block: "block";
|
|
143
|
+
}>>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
defaultPlan: z.ZodNullable<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
export type MaterializedPlanCatalog = z.infer<typeof materializedPlanCatalogSchema>;
|
|
148
|
+
export declare const PRINCIPAL_STATUS_REASON_CHARS = 512;
|
|
149
|
+
export declare const principalSuspendSchema: z.ZodObject<{
|
|
150
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
export type PrincipalSuspend = z.infer<typeof principalSuspendSchema>;
|
|
153
|
+
export declare const principalUnsuspendSchema: z.ZodObject<{
|
|
154
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export type PrincipalUnsuspend = z.infer<typeof principalUnsuspendSchema>;
|
|
157
|
+
export declare const principalCloseSchema: z.ZodObject<{
|
|
158
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
159
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
export type PrincipalClose = z.infer<typeof principalCloseSchema>;
|
|
162
|
+
export declare const principalPlanAssignSchema: z.ZodObject<{
|
|
163
|
+
plan: z.ZodString;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
export type PrincipalPlanAssign = z.infer<typeof principalPlanAssignSchema>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FEATURE_KEYS, featureKeySchema } from "./features.js";
|
|
3
|
+
/**
|
|
4
|
+
* Partner commerce contracts (companion spec `2026-08-23-partner-commerce-design.md`
|
|
5
|
+
* §2 usage, §3 entitlements, and §4 principal lifecycle.
|
|
6
|
+
*
|
|
7
|
+
* This is the single home for the commercial layer: the principal lifecycle
|
|
8
|
+
* status/actor vocabulary, the per-tenant plan catalog declared in the
|
|
9
|
+
* system-space manifest, and the imperative plan-assignment request. The
|
|
10
|
+
* principal directory shape (`principals.ts`) and the manifest schema
|
|
11
|
+
* (`space-config.ts`) both import from here, so the vocabulary has one owner.
|
|
12
|
+
*/
|
|
13
|
+
// Principal lifecycle status (§4). `active` is the default; `suspended` is
|
|
14
|
+
// reversible (spaces serve the suspended page, mutations rejected); `closed` is
|
|
15
|
+
// terminal (retention window then deletion).
|
|
16
|
+
export const PRINCIPAL_LIFECYCLE_STATUSES = ["active", "suspended", "closed"];
|
|
17
|
+
export const principalLifecycleStatusSchema = z
|
|
18
|
+
.enum(PRINCIPAL_LIFECYCLE_STATUSES)
|
|
19
|
+
.describe("Principal lifecycle status: active, suspended (reversible), or closed (terminal).");
|
|
20
|
+
// Who applied the current status. `partner` is the tenant's own management key;
|
|
21
|
+
// `spacefast` is a platform-applied (legal/abuse) action the partner cannot
|
|
22
|
+
// lift. The status surface distinguishes the actor so a Spacefast suspension is
|
|
23
|
+
// visibly unliftable by the partner (§4).
|
|
24
|
+
export const PRINCIPAL_STATUS_ACTORS = ["partner", "spacefast"];
|
|
25
|
+
export const principalStatusActorSchema = z
|
|
26
|
+
.enum(PRINCIPAL_STATUS_ACTORS)
|
|
27
|
+
.describe("Actor that applied the current status: the partner, or Spacefast.");
|
|
28
|
+
// Bounds for the plan catalog. Self-contained (not in SPACE_CONFIG_CAPS) so the
|
|
29
|
+
// manifest schema imports from commerce, never the reverse. A plan may grant at
|
|
30
|
+
// most every known feature; plan names are short arbitrary per-tenant strings.
|
|
31
|
+
export const PLAN_CATALOG_CAPS = {
|
|
32
|
+
/** Max distinct plans a tenant may declare. */
|
|
33
|
+
plans: 64,
|
|
34
|
+
/** Max plan-name length (also the assigned-plan and defaultPlan bound). */
|
|
35
|
+
planNameChars: 64,
|
|
36
|
+
/** A plan can grant at most every known feature key. */
|
|
37
|
+
features: FEATURE_KEYS.length,
|
|
38
|
+
};
|
|
39
|
+
const planNameSchema = z.string().trim().min(1).max(PLAN_CATALOG_CAPS.planNameChars);
|
|
40
|
+
// How a tripped quota is enforced (companion spec §3c). `block` rejects the
|
|
41
|
+
// triggering mutation with a typed problem naming the quota; `warn` records an
|
|
42
|
+
// event and lets the mutation through. Serving is NEVER cut by quota — only by
|
|
43
|
+
// suspension (§4). Omitted = `block`.
|
|
44
|
+
export const QUOTA_ENFORCEMENT_POLICIES = ["warn", "block"];
|
|
45
|
+
export const quotaEnforcementPolicySchema = z
|
|
46
|
+
.enum(QUOTA_ENFORCEMENT_POLICIES)
|
|
47
|
+
.describe("How a tripped quota is enforced: warn (event only) or block (reject).");
|
|
48
|
+
const quotaLimitSchema = z.number().int().safe().nonnegative();
|
|
49
|
+
// One plan's entitlements: feature keys plus mutation-time quotas. Feature
|
|
50
|
+
// names are validated against the live `FEATURE_KEYS` vocabulary.
|
|
51
|
+
export const planCatalogEntrySchema = z
|
|
52
|
+
.object({
|
|
53
|
+
features: z
|
|
54
|
+
.array(featureKeySchema)
|
|
55
|
+
.max(PLAN_CATALOG_CAPS.features)
|
|
56
|
+
.describe("Feature keys this plan grants. Each must be a known Spacefast feature key."),
|
|
57
|
+
quotas: z
|
|
58
|
+
.object({
|
|
59
|
+
spaces: z
|
|
60
|
+
.number()
|
|
61
|
+
.int()
|
|
62
|
+
.nonnegative()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Max spaces a principal on this plan may own. Omitted = no space-count cap."),
|
|
65
|
+
storageBytes: quotaLimitSchema
|
|
66
|
+
.optional()
|
|
67
|
+
.describe("Max measured bytes stored by the principal. Omitted = no storage cap."),
|
|
68
|
+
buildMinutesPerMonth: quotaLimitSchema
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Max build minutes in one UTC month. Omitted = no monthly build cap."),
|
|
71
|
+
customDomains: quotaLimitSchema
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Max active custom domains. Omitted = no custom-domain cap."),
|
|
74
|
+
})
|
|
75
|
+
.strict()
|
|
76
|
+
.describe("Quotas that the platform checks at the mutation that can exceed each limit."),
|
|
77
|
+
quotaPolicy: quotaEnforcementPolicySchema
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("Enforcement policy for this plan's quotas. Omitted = block."),
|
|
80
|
+
})
|
|
81
|
+
.strict()
|
|
82
|
+
.describe("Entitlements for one plan: granted features and enforced quotas.");
|
|
83
|
+
// The per-tenant plan catalog: plan name → entitlements. Plan NAMES are
|
|
84
|
+
// arbitrary per-tenant strings (the reseller's own vocabulary); feature keys
|
|
85
|
+
// inside each plan are the fixed Spacefast vocabulary.
|
|
86
|
+
export const planCatalogSchema = z
|
|
87
|
+
.record(planNameSchema, planCatalogEntrySchema)
|
|
88
|
+
.refine((plans) => Object.keys(plans).length <= PLAN_CATALOG_CAPS.plans, `at most ${PLAN_CATALOG_CAPS.plans} plans`)
|
|
89
|
+
.describe("Per-tenant plan catalog declared in the system-space manifest.");
|
|
90
|
+
// The plan unassigned principals fall back to. A bare name here; the manifest
|
|
91
|
+
// schema cross-checks it against the declared `plans` keys.
|
|
92
|
+
export const defaultPlanNameSchema = planNameSchema.describe("Name of the plan unassigned principals fall back to. Must be a key in `plans`.");
|
|
93
|
+
// What the plan-catalog materializer freezes onto the tenant: the declared
|
|
94
|
+
// catalog paired with the manifest's `defaultPlan` (null when the manifest
|
|
95
|
+
// declared `plans` without a default). Entitlement resolution reads this one
|
|
96
|
+
// blob — the assigned plan resolves against `plans`, and an unassigned or
|
|
97
|
+
// stale principal falls back to `defaultPlan`.
|
|
98
|
+
export const materializedPlanCatalogSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
plans: planCatalogSchema,
|
|
101
|
+
defaultPlan: defaultPlanNameSchema.nullable(),
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
.describe("Materialized per-tenant plan catalog: the declared plans plus the default plan name.");
|
|
105
|
+
// The free-text reason a lifecycle transition records on the principal
|
|
106
|
+
// (`external_principals.status_reason`, bounded by the column). Optional on
|
|
107
|
+
// every transition; surfaced back on the principal so an operator sees why.
|
|
108
|
+
export const PRINCIPAL_STATUS_REASON_CHARS = 512;
|
|
109
|
+
const statusReasonSchema = z
|
|
110
|
+
.string()
|
|
111
|
+
.trim()
|
|
112
|
+
.min(1)
|
|
113
|
+
.max(PRINCIPAL_STATUS_REASON_CHARS)
|
|
114
|
+
.describe("Free-text reason recorded with the status change.");
|
|
115
|
+
// Suspend a principal (§4): reversibly darken its spaces (402 suspended page)
|
|
116
|
+
// and reject its mutations. Idempotent.
|
|
117
|
+
export const principalSuspendSchema = z
|
|
118
|
+
.object({ reason: statusReasonSchema.optional() })
|
|
119
|
+
.strict()
|
|
120
|
+
.describe("Suspend an external principal: its spaces serve the suspended page and writes are blocked.");
|
|
121
|
+
// Lift a suspension (§4). A partner may only lift a suspension it applied; a
|
|
122
|
+
// Spacefast-applied (legal/abuse) suspension is not liftable by the partner.
|
|
123
|
+
export const principalUnsuspendSchema = z
|
|
124
|
+
.object({ reason: statusReasonSchema.optional() })
|
|
125
|
+
.strict()
|
|
126
|
+
.describe("Lift a principal suspension and restore its spaces.");
|
|
127
|
+
// Close a principal (§4): terminal. Refused while the principal still owns
|
|
128
|
+
// spaces unless `force` tombstones them in the same call. Idempotent.
|
|
129
|
+
export const principalCloseSchema = z
|
|
130
|
+
.object({
|
|
131
|
+
reason: statusReasonSchema.optional(),
|
|
132
|
+
force: z
|
|
133
|
+
.boolean()
|
|
134
|
+
.optional()
|
|
135
|
+
.describe("Tombstone the principal's remaining spaces instead of refusing the close."),
|
|
136
|
+
})
|
|
137
|
+
.strict()
|
|
138
|
+
.describe("Close an external principal (terminal). Requires no owned spaces, or `force` to tombstone them.");
|
|
139
|
+
// Imperative plan assignment (§3b): `PUT /v1/principals/{type}/{id}/plan` with a
|
|
140
|
+
// plan name from the live manifest. Runtime state, not manifest config.
|
|
141
|
+
export const principalPlanAssignSchema = z
|
|
142
|
+
.object({
|
|
143
|
+
plan: planNameSchema.describe("Plan name from the live system-space manifest to assign to this principal."),
|
|
144
|
+
})
|
|
145
|
+
.strict()
|
|
146
|
+
.describe("Assign a principal to a plan from the tenant's live plan catalog.");
|
|
@@ -9,8 +9,8 @@ export declare const baseDiagnosticSchema: z.ZodObject<{
|
|
|
9
9
|
code: z.ZodString;
|
|
10
10
|
severity: z.ZodEnum<{
|
|
11
11
|
info: "info";
|
|
12
|
-
error: "error";
|
|
13
12
|
warning: "warning";
|
|
13
|
+
error: "error";
|
|
14
14
|
}>;
|
|
15
15
|
message: z.ZodString;
|
|
16
16
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -176,8 +176,8 @@ export declare const AsyncOperationSchema: z.ZodObject<{
|
|
|
176
176
|
code: z.ZodString;
|
|
177
177
|
severity: z.ZodEnum<{
|
|
178
178
|
info: "info";
|
|
179
|
-
error: "error";
|
|
180
179
|
warning: "warning";
|
|
180
|
+
error: "error";
|
|
181
181
|
}>;
|
|
182
182
|
message: z.ZodString;
|
|
183
183
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -220,8 +220,8 @@ export declare function mutationEnvelope<T extends z.ZodType>(data: T): z.ZodObj
|
|
|
220
220
|
code: z.ZodString;
|
|
221
221
|
severity: z.ZodEnum<{
|
|
222
222
|
info: "info";
|
|
223
|
-
error: "error";
|
|
224
223
|
warning: "warning";
|
|
224
|
+
error: "error";
|
|
225
225
|
}>;
|
|
226
226
|
message: z.ZodString;
|
|
227
227
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/dist/contracts/common.js
CHANGED
|
@@ -6,14 +6,13 @@ export const SpaceViewerSchema = z.object({
|
|
|
6
6
|
description: z.string().nullable(),
|
|
7
7
|
ogImagePath: z.string().nullable(),
|
|
8
8
|
});
|
|
9
|
-
// The ONE Diagnostic shape (the platform spec). Every lifecycle
|
|
10
|
-
// resource (versions, builds, bindings, assignments, exports, imports, transfers)
|
|
9
|
+
// The ONE Diagnostic shape (the platform spec). Every lifecycle resource
|
|
11
10
|
// carries `diagnostics: Diagnostic[]` using exactly this vocabulary.
|
|
12
11
|
export const baseDiagnosticSchema = z.object({
|
|
13
12
|
code: z
|
|
14
13
|
.string()
|
|
15
14
|
.describe("Stable snake_case diagnostic code naming the public contract that produced it."),
|
|
16
|
-
severity: diagnosticSeverity.describe("How actionable the diagnostic is
|
|
15
|
+
severity: diagnosticSeverity.describe("How actionable the diagnostic is."),
|
|
17
16
|
message: z.string().describe("Human-readable explanation with enough detail to act on."),
|
|
18
17
|
path: z
|
|
19
18
|
.string()
|
|
@@ -26,7 +25,7 @@ export const baseDiagnosticSchema = z.object({
|
|
|
26
25
|
fix: z
|
|
27
26
|
.string()
|
|
28
27
|
.nullish()
|
|
29
|
-
.describe("Concrete, agent-actionable remediation hint
|
|
28
|
+
.describe("Concrete, agent-actionable remediation hint, when one can be derived."),
|
|
30
29
|
retryable: z
|
|
31
30
|
.boolean()
|
|
32
31
|
.nullish()
|
|
@@ -41,9 +40,9 @@ export const DnsInstructionSchema = z.object({
|
|
|
41
40
|
ttl: z.number().int().optional(),
|
|
42
41
|
purpose: z.enum(["verification", "routing", "ssl"]).describe("Why this record is needed."),
|
|
43
42
|
});
|
|
44
|
-
// One shared requiredActions vocabulary (the platform spec):
|
|
45
|
-
//
|
|
46
|
-
//
|
|
43
|
+
// One shared requiredActions vocabulary (the platform spec): the concrete user
|
|
44
|
+
// steps that unblock a resource. New action types are added HERE, never
|
|
45
|
+
// as per-resource variants.
|
|
47
46
|
export const requiredActionSchema = z.discriminatedUnion("type", [
|
|
48
47
|
z
|
|
49
48
|
.object({
|
|
@@ -64,14 +63,13 @@ export const requiredActionSchema = z.discriminatedUnion("type", [
|
|
|
64
63
|
export const requiredActionsSchema = z
|
|
65
64
|
.array(requiredActionSchema)
|
|
66
65
|
.describe("Concrete user steps that unblock this resource, using the one shared vocabulary.");
|
|
67
|
-
// The error shape (the platform spec "Global API Conventions"): every 4xx/5xx
|
|
68
|
-
// is one RFC 9457 problem
|
|
69
|
-
// `title`
|
|
70
|
-
// `pointer` (RFC 6901), `details`, `suggestions`, `next`, and `requestId` are extension members.
|
|
66
|
+
// The error shape (the platform spec "Global API Conventions"): every 4xx/5xx
|
|
67
|
+
// body is one RFC 9457 problem document served as `application/problem+json`.
|
|
68
|
+
// `type` and `title` derive mechanically from `code` (see contracts/error-codes.ts).
|
|
71
69
|
export const ProblemDetailsSchema = z.object({
|
|
72
70
|
type: z
|
|
73
71
|
.string()
|
|
74
|
-
.describe("Problem type URI
|
|
72
|
+
.describe("Problem type URI resolving to the error docs page. The server derives it mechanically from `code` against the docs origin."),
|
|
75
73
|
title: z
|
|
76
74
|
.string()
|
|
77
75
|
.describe("Short human-readable summary of the problem type. The server derives it mechanically from `code`."),
|
|
@@ -95,7 +93,7 @@ export const ProblemDetailsSchema = z.object({
|
|
|
95
93
|
});
|
|
96
94
|
// Success envelope (the platform spec "Global API Conventions"): `{ data: T }` for
|
|
97
95
|
// single resources and mutations, `{ data: T[], pagination }` for lists. Mutations whose work
|
|
98
|
-
// outlives the request also carry `operation
|
|
96
|
+
// outlives the request also carry `operation`. Wrap with `.extend({ operation: ... })`.
|
|
99
97
|
export function dataEnvelope(data) {
|
|
100
98
|
return z.object({ data });
|
|
101
99
|
}
|
|
@@ -121,16 +119,10 @@ export const CursorPaginationSchema = z.object({
|
|
|
121
119
|
hasMore: z.boolean().describe("Whether another page exists after this one."),
|
|
122
120
|
});
|
|
123
121
|
export const CURSOR_MAX_LENGTH = 4_096;
|
|
124
|
-
// The ONE list query shape
|
|
125
|
-
//
|
|
122
|
+
// The ONE list query shape, newest-first. Extend with module-specific filters;
|
|
123
|
+
// never redeclare `limit`/`cursor`.
|
|
126
124
|
export const cursorListQuerySchema = z.object({
|
|
127
|
-
limit: z.coerce
|
|
128
|
-
.number()
|
|
129
|
-
.int()
|
|
130
|
-
.min(1)
|
|
131
|
-
.max(100)
|
|
132
|
-
.default(20)
|
|
133
|
-
.describe("Page size: default 20, maximum 100."),
|
|
125
|
+
limit: z.coerce.number().int().min(1).max(100).default(20).describe("Page size."),
|
|
134
126
|
cursor: z
|
|
135
127
|
.string()
|
|
136
128
|
.min(1)
|
|
@@ -138,9 +130,7 @@ export const cursorListQuerySchema = z.object({
|
|
|
138
130
|
.optional()
|
|
139
131
|
.describe("Opaque cursor from the previous page's `nextCursor`."),
|
|
140
132
|
});
|
|
141
|
-
// The operator-only offset list-response shape (superadmin surfaces)
|
|
142
|
-
// items array, plus `total`/`limit`/`offset` and the offset `pagination` block.
|
|
143
|
-
// Callers pass the items key, item schema, and their pagination schema so the
|
|
133
|
+
// The operator-only offset list-response shape (superadmin surfaces). The
|
|
144
134
|
// emitted object is byte-for-byte the hand-written
|
|
145
135
|
// `z.object({ <key>: z.array(...), total, limit, offset, pagination })`.
|
|
146
136
|
export function makeOffsetListSchema(itemsKey, item, pagination) {
|
|
@@ -172,10 +162,9 @@ export const AsyncOperationSchema = z.object({
|
|
|
172
162
|
createdAt: z.string().datetime(),
|
|
173
163
|
finishedAt: z.string().datetime().optional(),
|
|
174
164
|
});
|
|
175
|
-
// Mutation envelope for async-capable verbs: the post-mutation resource in
|
|
176
|
-
// plus `operation` when work outlives the request
|
|
177
|
-
//
|
|
178
|
-
// synchronously, so the wire shape is deterministic per route.
|
|
165
|
+
// Mutation envelope for async-capable verbs: the post-mutation resource in
|
|
166
|
+
// `data`, plus `operation` when work outlives the request. `operation` is always
|
|
167
|
+
// present, so the wire shape is deterministic per route.
|
|
179
168
|
export function mutationEnvelope(data) {
|
|
180
169
|
return z.object({
|
|
181
170
|
data,
|