@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,116 @@
|
|
|
1
|
+
// Reserved trigger values ("magic inputs") for LINKED TEST TENANTS
|
|
2
|
+
// (partner-operations spec §1 "Test mode", L31-34). Stripe models test-mode
|
|
3
|
+
// failures with magic inputs — a card number like `4000000000000341` that a
|
|
4
|
+
// LIVE charge treats as an ordinary (invalid) number but a TEST charge turns
|
|
5
|
+
// into a specific decline. We do the same for the partner API: a partner puts a
|
|
6
|
+
// reserved token into the NATURAL input of an existing operation and, on a TEST
|
|
7
|
+
// tenant only, that operation produces a specific failure state instead of
|
|
8
|
+
// succeeding. There is NO new route and NO new field — a trigger is an ordinary
|
|
9
|
+
// input value the caller already controls.
|
|
10
|
+
//
|
|
11
|
+
// The catalog itself is `TEST_TRIGGER_META` below — token, carrier and effect
|
|
12
|
+
// per trigger, in one record, so the published API documentation renders from
|
|
13
|
+
// the same data the detector matches on rather than a prose copy of it.
|
|
14
|
+
//
|
|
15
|
+
// The tokens carry a `sf-sim-` prefix so they are implausible as an organic name
|
|
16
|
+
// and are valid across every carrier (a DNS label, a URL hostname, a slug, and a
|
|
17
|
+
// principal id are all lowercase-hyphen-safe). A LIVE tenant treats the very same
|
|
18
|
+
// value as ordinary input — the gate is `mode === "test"`, applied by every
|
|
19
|
+
// interpreting call site (see `resolveTestTrigger`).
|
|
20
|
+
//
|
|
21
|
+
// FIDELITY (spec caveat): the `rate_limit` trigger FABRICATES a 429 problem
|
|
22
|
+
// document — the partner-API rate limiter of ops §8 does not exist yet, so this
|
|
23
|
+
// simulates the response a real limiter would return, not a real limiter. The
|
|
24
|
+
// domain/TLS triggers synthesize provider (wp.cloud) SSL-info responses through
|
|
25
|
+
// the simulated driver; there is no real DNS/cert in test mode.
|
|
26
|
+
import { z } from "zod";
|
|
27
|
+
export const testTriggerValues = [
|
|
28
|
+
"build_failure",
|
|
29
|
+
"domain_verification_pending",
|
|
30
|
+
"domain_verification_failed",
|
|
31
|
+
"tls_failure",
|
|
32
|
+
"rate_limit",
|
|
33
|
+
"webhook_retry",
|
|
34
|
+
"principal_suspension",
|
|
35
|
+
"usage_correction",
|
|
36
|
+
];
|
|
37
|
+
export const testTrigger = z.enum(testTriggerValues);
|
|
38
|
+
/**
|
|
39
|
+
* Every trigger, in one record: the reserved token, the input that carries it,
|
|
40
|
+
* and what a test tenant gets instead of success.
|
|
41
|
+
*
|
|
42
|
+
* `carrier` and `effect` are contract text, not commentary — the partner API
|
|
43
|
+
* document renders its trigger table straight from them, so a renamed token or
|
|
44
|
+
* a new trigger cannot leave the published contract describing something else.
|
|
45
|
+
*
|
|
46
|
+
* No token is a substring of another, so a plain `includes` scan is unambiguous.
|
|
47
|
+
* Keep them lowercase — the detector lowercases the input, and every carrier (a
|
|
48
|
+
* DNS label, a slug, a principal id) is compared case-insensitively.
|
|
49
|
+
*/
|
|
50
|
+
export const TEST_TRIGGER_META = {
|
|
51
|
+
build_failure: {
|
|
52
|
+
sentinel: "sf-sim-build-fail",
|
|
53
|
+
carrier: "space slug",
|
|
54
|
+
effect: "the space's next build fails",
|
|
55
|
+
},
|
|
56
|
+
domain_verification_pending: {
|
|
57
|
+
sentinel: "sf-sim-domain-pending",
|
|
58
|
+
carrier: "custom domain name",
|
|
59
|
+
effect: "domain verification stays pending",
|
|
60
|
+
},
|
|
61
|
+
domain_verification_failed: {
|
|
62
|
+
sentinel: "sf-sim-domain-fail",
|
|
63
|
+
carrier: "custom domain name",
|
|
64
|
+
effect: "domain verification fails",
|
|
65
|
+
},
|
|
66
|
+
tls_failure: {
|
|
67
|
+
sentinel: "sf-sim-tls-fail",
|
|
68
|
+
carrier: "custom domain name",
|
|
69
|
+
effect: "certificate issuance fails",
|
|
70
|
+
},
|
|
71
|
+
rate_limit: {
|
|
72
|
+
sentinel: "sf-sim-rate-limit",
|
|
73
|
+
carrier: "space slug (on create)",
|
|
74
|
+
effect: "the create returns 429 `rate_limited`",
|
|
75
|
+
},
|
|
76
|
+
webhook_retry: {
|
|
77
|
+
sentinel: "sf-sim-webhook-retry",
|
|
78
|
+
carrier: "webhook URL",
|
|
79
|
+
effect: "delivery fails and enters the retry schedule",
|
|
80
|
+
},
|
|
81
|
+
principal_suspension: {
|
|
82
|
+
sentinel: "sf-sim-suspend",
|
|
83
|
+
carrier: "external principal id",
|
|
84
|
+
effect: "the principal is suspended",
|
|
85
|
+
},
|
|
86
|
+
usage_correction: {
|
|
87
|
+
sentinel: "sf-sim-usage-correction",
|
|
88
|
+
carrier: "space slug",
|
|
89
|
+
effect: "the next settled usage sample appends a linked correction",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
// Return the trigger whose reserved token appears in `input`, or null. Carrier-
|
|
93
|
+
// agnostic: `input` may be a slug, a hostname, a URL, or a principal id. The
|
|
94
|
+
// token may be the whole value or a label within it (`sf-sim-tls-fail.acme.dev`).
|
|
95
|
+
// This does NOT gate on mode — it is pure detection; `resolveTestTrigger` adds
|
|
96
|
+
// the test-tenant gate.
|
|
97
|
+
export function detectTestTrigger(input) {
|
|
98
|
+
if (!input)
|
|
99
|
+
return null;
|
|
100
|
+
const haystack = input.toLowerCase();
|
|
101
|
+
for (const trigger of testTriggerValues) {
|
|
102
|
+
if (haystack.includes(TEST_TRIGGER_META[trigger].sentinel))
|
|
103
|
+
return trigger;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
// The one gate every interpreting call site shares: a trigger fires ONLY for a
|
|
108
|
+
// `mode === "test"` tenant. A live tenant (or any non-test mode) always resolves
|
|
109
|
+
// null, so the same input flows through the ordinary path — the no-leak-to-live
|
|
110
|
+
// guarantee, in one place. `mode` is the owning tenant's mode (a `TenantMode`, or
|
|
111
|
+
// the raw `tenants.mode` string).
|
|
112
|
+
export function resolveTestTrigger(mode, input) {
|
|
113
|
+
if (mode !== "test")
|
|
114
|
+
return null;
|
|
115
|
+
return detectTestTrigger(input);
|
|
116
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// WordPress `theme.json`-compatible subset used only to infer Pages tokens.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// actually consume: `settings.color.palette` and
|
|
7
|
-
// `settings.typography.fontFamilies`. Everything else rides through
|
|
8
|
-
// unvalidated and is simply never read — this is not a reimplementation of
|
|
9
|
-
// WP_Theme_JSON, just the safe slice that reaches presentation-only gate
|
|
10
|
-
// pages.
|
|
3
|
+
// The file is accepted as a loose object; only `settings.color.palette` and
|
|
4
|
+
// `settings.typography.fontFamilies` are validated. Every other WP key rides
|
|
5
|
+
// through unvalidated and is never read.
|
|
11
6
|
const presetSlug = z
|
|
12
7
|
.string()
|
|
13
8
|
.min(1)
|
|
@@ -16,6 +16,7 @@ export declare const transferPrincipalSchema: z.ZodObject<{
|
|
|
16
16
|
tenantId: z.ZodString;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
export declare const spaceTransferCreateSchema: z.ZodObject<{
|
|
19
|
+
spaceId: z.ZodString;
|
|
19
20
|
to: z.ZodObject<{
|
|
20
21
|
principalType: z.ZodEnum<{
|
|
21
22
|
team: "team";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { spaceTransferStatus } from "./enums.js";
|
|
3
|
-
// Tenant-local external principal id grammar (
|
|
3
|
+
// Tenant-local external principal id grammar (the platform spec
|
|
4
4
|
// "Principal"): 1-256 chars, no whitespace, no `/` or `\`, no
|
|
5
5
|
// control/non-printable characters. Team principal ids are Better Auth team
|
|
6
6
|
// ids and trivially satisfy the same grammar.
|
|
@@ -15,7 +15,7 @@ export const principalIdSchema = z
|
|
|
15
15
|
}))
|
|
16
16
|
.describe("Tenant-local principal id: a team id or an integrator external customer id.");
|
|
17
17
|
// Request `to` omits tenantId: transfers are tenant-local and the tenant is
|
|
18
|
-
// inferred from the space (
|
|
18
|
+
// inferred from the space (the platform spec "Transfer semantics").
|
|
19
19
|
export const transferPrincipalInputSchema = z.object({
|
|
20
20
|
principalType: z
|
|
21
21
|
.enum(["team", "external"])
|
|
@@ -27,6 +27,7 @@ export const transferPrincipalSchema = transferPrincipalInputSchema.extend({
|
|
|
27
27
|
tenantId: z.string().min(1).describe("Tenant both transfer parties live in."),
|
|
28
28
|
});
|
|
29
29
|
export const spaceTransferCreateSchema = z.object({
|
|
30
|
+
spaceId: z.string().min(1).describe("Space to transfer (`spc_`)."),
|
|
30
31
|
to: transferPrincipalInputSchema.describe("Receiving principal. Must live in the space's tenant; cross-tenant transfers are unsupported."),
|
|
31
32
|
});
|
|
32
33
|
export const spaceTransferSchema = z.object({
|
|
@@ -59,3 +59,212 @@ export declare const functionUsagePushSchema: z.ZodObject<{
|
|
|
59
59
|
observedAt: z.ZodString;
|
|
60
60
|
}, z.core.$strip>;
|
|
61
61
|
export type FunctionUsagePush = z.infer<typeof functionUsagePushSchema>;
|
|
62
|
+
export declare const USAGE_DIMENSIONS: readonly ["data_transfer_bytes", "served_requests", "stored_byte_hours", "build_minutes", "build_count", "custom_domain_days", "space_days"];
|
|
63
|
+
export declare const usageDimensionSchema: z.ZodEnum<{
|
|
64
|
+
data_transfer_bytes: "data_transfer_bytes";
|
|
65
|
+
served_requests: "served_requests";
|
|
66
|
+
stored_byte_hours: "stored_byte_hours";
|
|
67
|
+
build_minutes: "build_minutes";
|
|
68
|
+
build_count: "build_count";
|
|
69
|
+
custom_domain_days: "custom_domain_days";
|
|
70
|
+
space_days: "space_days";
|
|
71
|
+
}>;
|
|
72
|
+
export type UsageDimension = z.infer<typeof usageDimensionSchema>;
|
|
73
|
+
export declare const usageQuantitySchema: z.ZodString;
|
|
74
|
+
export declare const usageRecordSchema: z.ZodObject<{
|
|
75
|
+
usageRecordId: z.ZodString;
|
|
76
|
+
tenantId: z.ZodString;
|
|
77
|
+
principalType: z.ZodEnum<{
|
|
78
|
+
team: "team";
|
|
79
|
+
external: "external";
|
|
80
|
+
}>;
|
|
81
|
+
principalId: z.ZodString;
|
|
82
|
+
spaceId: z.ZodNullable<z.ZodString>;
|
|
83
|
+
bucketStart: z.ZodString;
|
|
84
|
+
bucketEnd: z.ZodString;
|
|
85
|
+
region: z.ZodNullable<z.ZodString>;
|
|
86
|
+
mode: z.ZodEnum<{
|
|
87
|
+
live: "live";
|
|
88
|
+
test: "test";
|
|
89
|
+
}>;
|
|
90
|
+
dimension: z.ZodEnum<{
|
|
91
|
+
data_transfer_bytes: "data_transfer_bytes";
|
|
92
|
+
served_requests: "served_requests";
|
|
93
|
+
stored_byte_hours: "stored_byte_hours";
|
|
94
|
+
build_minutes: "build_minutes";
|
|
95
|
+
build_count: "build_count";
|
|
96
|
+
custom_domain_days: "custom_domain_days";
|
|
97
|
+
space_days: "space_days";
|
|
98
|
+
}>;
|
|
99
|
+
measuredQuantity: z.ZodString;
|
|
100
|
+
billableQuantity: z.ZodString;
|
|
101
|
+
state: z.ZodEnum<{
|
|
102
|
+
final: "final";
|
|
103
|
+
estimated: "estimated";
|
|
104
|
+
}>;
|
|
105
|
+
corrects: z.ZodNullable<z.ZodString>;
|
|
106
|
+
correlationId: z.ZodNullable<z.ZodString>;
|
|
107
|
+
createdAt: z.ZodString;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export type UsageLedgerRecord = z.infer<typeof usageRecordSchema>;
|
|
110
|
+
export declare const usageListQuerySchema: z.ZodObject<{
|
|
111
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
112
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
113
|
+
from: z.ZodOptional<z.ZodString>;
|
|
114
|
+
to: z.ZodOptional<z.ZodString>;
|
|
115
|
+
principalId: z.ZodOptional<z.ZodString>;
|
|
116
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
117
|
+
dimension: z.ZodOptional<z.ZodEnum<{
|
|
118
|
+
data_transfer_bytes: "data_transfer_bytes";
|
|
119
|
+
served_requests: "served_requests";
|
|
120
|
+
stored_byte_hours: "stored_byte_hours";
|
|
121
|
+
build_minutes: "build_minutes";
|
|
122
|
+
build_count: "build_count";
|
|
123
|
+
custom_domain_days: "custom_domain_days";
|
|
124
|
+
space_days: "space_days";
|
|
125
|
+
}>>;
|
|
126
|
+
granularity: z.ZodDefault<z.ZodLiteral<"hour">>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type UsageListQuery = z.infer<typeof usageListQuerySchema>;
|
|
129
|
+
export declare const usageListResponseSchema: z.ZodObject<{
|
|
130
|
+
data: z.ZodArray<z.ZodObject<{
|
|
131
|
+
usageRecordId: z.ZodString;
|
|
132
|
+
tenantId: z.ZodString;
|
|
133
|
+
principalType: z.ZodEnum<{
|
|
134
|
+
team: "team";
|
|
135
|
+
external: "external";
|
|
136
|
+
}>;
|
|
137
|
+
principalId: z.ZodString;
|
|
138
|
+
spaceId: z.ZodNullable<z.ZodString>;
|
|
139
|
+
bucketStart: z.ZodString;
|
|
140
|
+
bucketEnd: z.ZodString;
|
|
141
|
+
region: z.ZodNullable<z.ZodString>;
|
|
142
|
+
mode: z.ZodEnum<{
|
|
143
|
+
live: "live";
|
|
144
|
+
test: "test";
|
|
145
|
+
}>;
|
|
146
|
+
dimension: z.ZodEnum<{
|
|
147
|
+
data_transfer_bytes: "data_transfer_bytes";
|
|
148
|
+
served_requests: "served_requests";
|
|
149
|
+
stored_byte_hours: "stored_byte_hours";
|
|
150
|
+
build_minutes: "build_minutes";
|
|
151
|
+
build_count: "build_count";
|
|
152
|
+
custom_domain_days: "custom_domain_days";
|
|
153
|
+
space_days: "space_days";
|
|
154
|
+
}>;
|
|
155
|
+
measuredQuantity: z.ZodString;
|
|
156
|
+
billableQuantity: z.ZodString;
|
|
157
|
+
state: z.ZodEnum<{
|
|
158
|
+
final: "final";
|
|
159
|
+
estimated: "estimated";
|
|
160
|
+
}>;
|
|
161
|
+
corrects: z.ZodNullable<z.ZodString>;
|
|
162
|
+
correlationId: z.ZodNullable<z.ZodString>;
|
|
163
|
+
createdAt: z.ZodString;
|
|
164
|
+
}, z.core.$strict>>;
|
|
165
|
+
pagination: z.ZodObject<{
|
|
166
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
167
|
+
hasMore: z.ZodBoolean;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
export declare const usagePeriodTotalsSchema: z.ZodObject<{
|
|
171
|
+
data_transfer_bytes: z.ZodOptional<z.ZodString>;
|
|
172
|
+
served_requests: z.ZodOptional<z.ZodString>;
|
|
173
|
+
stored_byte_hours: z.ZodOptional<z.ZodString>;
|
|
174
|
+
build_minutes: z.ZodOptional<z.ZodString>;
|
|
175
|
+
build_count: z.ZodOptional<z.ZodString>;
|
|
176
|
+
custom_domain_days: z.ZodOptional<z.ZodString>;
|
|
177
|
+
space_days: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strict>;
|
|
179
|
+
export declare const usagePeriodSchema: z.ZodObject<{
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
tenantId: z.ZodString;
|
|
182
|
+
mode: z.ZodEnum<{
|
|
183
|
+
live: "live";
|
|
184
|
+
test: "test";
|
|
185
|
+
}>;
|
|
186
|
+
periodStart: z.ZodString;
|
|
187
|
+
periodEnd: z.ZodString;
|
|
188
|
+
status: z.ZodEnum<{
|
|
189
|
+
final: "final";
|
|
190
|
+
open: "open";
|
|
191
|
+
}>;
|
|
192
|
+
totals: z.ZodObject<{
|
|
193
|
+
data_transfer_bytes: z.ZodOptional<z.ZodString>;
|
|
194
|
+
served_requests: z.ZodOptional<z.ZodString>;
|
|
195
|
+
stored_byte_hours: z.ZodOptional<z.ZodString>;
|
|
196
|
+
build_minutes: z.ZodOptional<z.ZodString>;
|
|
197
|
+
build_count: z.ZodOptional<z.ZodString>;
|
|
198
|
+
custom_domain_days: z.ZodOptional<z.ZodString>;
|
|
199
|
+
space_days: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
checksum: z.ZodNullable<z.ZodString>;
|
|
202
|
+
finalizedAt: z.ZodNullable<z.ZodString>;
|
|
203
|
+
}, z.core.$strict>;
|
|
204
|
+
export type UsagePeriod = z.infer<typeof usagePeriodSchema>;
|
|
205
|
+
export declare const usagePeriodListQuerySchema: z.ZodObject<{
|
|
206
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
207
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
208
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
live: "live";
|
|
210
|
+
test: "test";
|
|
211
|
+
}>>;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
export declare const usagePeriodListResponseSchema: z.ZodObject<{
|
|
214
|
+
data: z.ZodArray<z.ZodObject<{
|
|
215
|
+
id: z.ZodString;
|
|
216
|
+
tenantId: z.ZodString;
|
|
217
|
+
mode: z.ZodEnum<{
|
|
218
|
+
live: "live";
|
|
219
|
+
test: "test";
|
|
220
|
+
}>;
|
|
221
|
+
periodStart: z.ZodString;
|
|
222
|
+
periodEnd: z.ZodString;
|
|
223
|
+
status: z.ZodEnum<{
|
|
224
|
+
final: "final";
|
|
225
|
+
open: "open";
|
|
226
|
+
}>;
|
|
227
|
+
totals: z.ZodObject<{
|
|
228
|
+
data_transfer_bytes: z.ZodOptional<z.ZodString>;
|
|
229
|
+
served_requests: z.ZodOptional<z.ZodString>;
|
|
230
|
+
stored_byte_hours: z.ZodOptional<z.ZodString>;
|
|
231
|
+
build_minutes: z.ZodOptional<z.ZodString>;
|
|
232
|
+
build_count: z.ZodOptional<z.ZodString>;
|
|
233
|
+
custom_domain_days: z.ZodOptional<z.ZodString>;
|
|
234
|
+
space_days: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
checksum: z.ZodNullable<z.ZodString>;
|
|
237
|
+
finalizedAt: z.ZodNullable<z.ZodString>;
|
|
238
|
+
}, z.core.$strict>>;
|
|
239
|
+
pagination: z.ZodObject<{
|
|
240
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
241
|
+
hasMore: z.ZodBoolean;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
export declare const usagePeriodResponseSchema: z.ZodObject<{
|
|
245
|
+
data: z.ZodObject<{
|
|
246
|
+
id: z.ZodString;
|
|
247
|
+
tenantId: z.ZodString;
|
|
248
|
+
mode: z.ZodEnum<{
|
|
249
|
+
live: "live";
|
|
250
|
+
test: "test";
|
|
251
|
+
}>;
|
|
252
|
+
periodStart: z.ZodString;
|
|
253
|
+
periodEnd: z.ZodString;
|
|
254
|
+
status: z.ZodEnum<{
|
|
255
|
+
final: "final";
|
|
256
|
+
open: "open";
|
|
257
|
+
}>;
|
|
258
|
+
totals: z.ZodObject<{
|
|
259
|
+
data_transfer_bytes: z.ZodOptional<z.ZodString>;
|
|
260
|
+
served_requests: z.ZodOptional<z.ZodString>;
|
|
261
|
+
stored_byte_hours: z.ZodOptional<z.ZodString>;
|
|
262
|
+
build_minutes: z.ZodOptional<z.ZodString>;
|
|
263
|
+
build_count: z.ZodOptional<z.ZodString>;
|
|
264
|
+
custom_domain_days: z.ZodOptional<z.ZodString>;
|
|
265
|
+
space_days: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, z.core.$strict>;
|
|
267
|
+
checksum: z.ZodNullable<z.ZodString>;
|
|
268
|
+
finalizedAt: z.ZodNullable<z.ZodString>;
|
|
269
|
+
}, z.core.$strict>;
|
|
270
|
+
}, z.core.$strip>;
|
package/dist/contracts/usage.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
2
3
|
/**
|
|
3
4
|
* Resolutions the hosting provider keeps usage at. Hour is retained about a
|
|
4
5
|
* week, day about two months, month about two years.
|
|
5
6
|
*/
|
|
6
7
|
export const USAGE_RESOLUTIONS = ["hour", "day", "month"];
|
|
7
8
|
export const usageResolutionSchema = z.enum(USAGE_RESOLUTIONS);
|
|
8
|
-
// Served by `GET /v1/spaces/{spaceId}/usage`: what one Space
|
|
9
|
-
//
|
|
10
|
-
// was published.
|
|
9
|
+
// Served by `GET /v1/spaces/{spaceId}/usage`: what one Space consumed, measured
|
|
10
|
+
// by the infrastructure that served it.
|
|
11
11
|
//
|
|
12
|
-
// Every number
|
|
13
|
-
//
|
|
14
|
-
// when we last asked. Nothing in this response means "right now". The meter
|
|
15
|
-
// behind it is a time series with real ingestion delay, so a reading is only
|
|
16
|
-
// trusted once its period has settled — expect the period to end an hour or so
|
|
12
|
+
// Every number measures a past period, never "right now". The meter behind it
|
|
13
|
+
// has real ingestion delay, so expect the measured period to end an hour or so
|
|
17
14
|
// before you read it.
|
|
18
15
|
export const spaceUsageMeasurementSchema = z.object({
|
|
19
16
|
period: z
|
|
@@ -47,12 +44,11 @@ export const spaceUsageResponseSchema = z.object({
|
|
|
47
44
|
spaceId: z.string().describe("The space the usage was measured for."),
|
|
48
45
|
usage: spaceUsageMeasurementSchema
|
|
49
46
|
.nullable()
|
|
50
|
-
.describe("Null when this space has never been measured
|
|
47
|
+
.describe("Null when this space has never been measured, either because it has not served yet or because its first measurement period has not settled."),
|
|
51
48
|
});
|
|
52
49
|
// Posted by the Functions host's tail Worker after an isolate finishes serving.
|
|
53
|
-
// Counts only
|
|
54
|
-
// space's own log stream
|
|
55
|
-
// second log pipeline.
|
|
50
|
+
// Counts only, never messages. Function logs travel a different path, into the
|
|
51
|
+
// space's own log stream.
|
|
56
52
|
export const functionUsagePushSchema = z.object({
|
|
57
53
|
spaceId: z.string().min(1).describe("The space whose functions ran."),
|
|
58
54
|
versionId: z.string().min(1).describe("The version whose bundle served the requests."),
|
|
@@ -62,3 +58,119 @@ export const functionUsagePushSchema = z.object({
|
|
|
62
58
|
.string()
|
|
63
59
|
.describe("The reporter's clock at delivery. The control plane buckets by hour on receipt."),
|
|
64
60
|
});
|
|
61
|
+
export const USAGE_DIMENSIONS = [
|
|
62
|
+
"data_transfer_bytes",
|
|
63
|
+
"served_requests",
|
|
64
|
+
"stored_byte_hours",
|
|
65
|
+
"build_minutes",
|
|
66
|
+
"build_count",
|
|
67
|
+
"custom_domain_days",
|
|
68
|
+
"space_days",
|
|
69
|
+
];
|
|
70
|
+
export const usageDimensionSchema = z
|
|
71
|
+
.enum(USAGE_DIMENSIONS)
|
|
72
|
+
.describe("Meter that produced this usage record.");
|
|
73
|
+
export const usageQuantitySchema = z
|
|
74
|
+
.string()
|
|
75
|
+
.regex(/^-?[0-9]+$/)
|
|
76
|
+
.describe("Signed integer quantity in the dimension's normalized unit.");
|
|
77
|
+
export const usageRecordSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
usageRecordId: z.string().describe("Immutable usage record id."),
|
|
80
|
+
tenantId: z.string().describe("Tenant that owns the charge."),
|
|
81
|
+
principalType: z.enum(["external", "team"]).describe("Principal type for attribution."),
|
|
82
|
+
principalId: z.string().describe("Stable principal id for attribution."),
|
|
83
|
+
spaceId: z.string().nullable().describe("Space that produced the usage, when applicable."),
|
|
84
|
+
bucketStart: z.string().datetime().describe("Start of the UTC measurement bucket."),
|
|
85
|
+
bucketEnd: z.string().datetime().describe("End of the UTC measurement bucket."),
|
|
86
|
+
region: z.string().nullable().describe("Serving region that measured the usage."),
|
|
87
|
+
mode: z.enum(["live", "test"]).describe("Tenant mode that produced the usage."),
|
|
88
|
+
dimension: usageDimensionSchema,
|
|
89
|
+
measuredQuantity: usageQuantitySchema.describe("Quantity the meter observed."),
|
|
90
|
+
billableQuantity: usageQuantitySchema.describe("Quantity billed after included usage and credits. Test usage is always zero."),
|
|
91
|
+
state: z.enum(["estimated", "final"]).describe("Whether the measurement can still settle."),
|
|
92
|
+
corrects: z
|
|
93
|
+
.string()
|
|
94
|
+
.nullable()
|
|
95
|
+
.describe("Earlier usage record corrected by this append-only record."),
|
|
96
|
+
correlationId: z
|
|
97
|
+
.string()
|
|
98
|
+
.nullable()
|
|
99
|
+
.describe("Request or event id that caused this usage, when applicable."),
|
|
100
|
+
createdAt: z.string().datetime().describe("Time the ledger appended this record."),
|
|
101
|
+
})
|
|
102
|
+
.strict()
|
|
103
|
+
.describe("One immutable usage ledger record.");
|
|
104
|
+
export const usageListQuerySchema = cursorListQuerySchema
|
|
105
|
+
.extend({
|
|
106
|
+
from: z.string().datetime().optional().describe("Include buckets that end after this instant."),
|
|
107
|
+
to: z
|
|
108
|
+
.string()
|
|
109
|
+
.datetime()
|
|
110
|
+
.optional()
|
|
111
|
+
.describe("Include buckets that start before this instant."),
|
|
112
|
+
principalId: z
|
|
113
|
+
.string()
|
|
114
|
+
.trim()
|
|
115
|
+
.min(1)
|
|
116
|
+
.max(255)
|
|
117
|
+
.optional()
|
|
118
|
+
.describe("Return only records billed to this external principal."),
|
|
119
|
+
spaceId: z
|
|
120
|
+
.string()
|
|
121
|
+
.trim()
|
|
122
|
+
.min(1)
|
|
123
|
+
.max(64)
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Return only records for this space."),
|
|
126
|
+
dimension: usageDimensionSchema.optional(),
|
|
127
|
+
granularity: z
|
|
128
|
+
.literal("hour")
|
|
129
|
+
.default("hour")
|
|
130
|
+
.describe("Ledger bucket granularity. Version 1 records hourly buckets."),
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
export const usageListResponseSchema = z.object({
|
|
134
|
+
data: z.array(usageRecordSchema),
|
|
135
|
+
pagination: CursorPaginationSchema,
|
|
136
|
+
});
|
|
137
|
+
export const usagePeriodTotalsSchema = z
|
|
138
|
+
.object({
|
|
139
|
+
data_transfer_bytes: usageQuantitySchema.optional(),
|
|
140
|
+
served_requests: usageQuantitySchema.optional(),
|
|
141
|
+
stored_byte_hours: usageQuantitySchema.optional(),
|
|
142
|
+
build_minutes: usageQuantitySchema.optional(),
|
|
143
|
+
build_count: usageQuantitySchema.optional(),
|
|
144
|
+
custom_domain_days: usageQuantitySchema.optional(),
|
|
145
|
+
space_days: usageQuantitySchema.optional(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
export const usagePeriodSchema = z
|
|
149
|
+
.object({
|
|
150
|
+
id: z.string().describe("Billing period id."),
|
|
151
|
+
tenantId: z.string().describe("Tenant that owns this billing period."),
|
|
152
|
+
mode: z.enum(["live", "test"]),
|
|
153
|
+
periodStart: z.string().datetime(),
|
|
154
|
+
periodEnd: z.string().datetime(),
|
|
155
|
+
status: z.enum(["open", "final"]),
|
|
156
|
+
totals: usagePeriodTotalsSchema,
|
|
157
|
+
checksum: z
|
|
158
|
+
.string()
|
|
159
|
+
.nullable()
|
|
160
|
+
.describe("SHA-256 checksum of frozen final totals. Open periods have no checksum."),
|
|
161
|
+
finalizedAt: z.string().datetime().nullable(),
|
|
162
|
+
})
|
|
163
|
+
.strict();
|
|
164
|
+
export const usagePeriodListQuerySchema = cursorListQuerySchema
|
|
165
|
+
.extend({
|
|
166
|
+
mode: z
|
|
167
|
+
.enum(["live", "test"])
|
|
168
|
+
.optional()
|
|
169
|
+
.describe("Return periods for the live tenant or its linked test tenant."),
|
|
170
|
+
})
|
|
171
|
+
.strict();
|
|
172
|
+
export const usagePeriodListResponseSchema = z.object({
|
|
173
|
+
data: z.array(usagePeriodSchema),
|
|
174
|
+
pagination: CursorPaginationSchema,
|
|
175
|
+
});
|
|
176
|
+
export const usagePeriodResponseSchema = z.object({ data: usagePeriodSchema });
|
|
@@ -124,7 +124,7 @@ export declare const variableMutationResponseSchema: z.ZodObject<{
|
|
|
124
124
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
125
|
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
126
126
|
registrar: "registrar";
|
|
127
|
-
|
|
127
|
+
infra: "infra";
|
|
128
128
|
dns: "dns";
|
|
129
129
|
runtime: "runtime";
|
|
130
130
|
}>>>;
|
|
@@ -168,7 +168,7 @@ export declare const variableDeleteResponseSchema: z.ZodObject<{
|
|
|
168
168
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
169
|
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
170
170
|
registrar: "registrar";
|
|
171
|
-
|
|
171
|
+
infra: "infra";
|
|
172
172
|
dns: "dns";
|
|
173
173
|
runtime: "runtime";
|
|
174
174
|
}>>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AsyncOperationSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// by API, CLI, UI, diagnostics, logs, or activity.
|
|
3
|
+
// One model for every scope. Resolution order at finalize is space ->
|
|
4
|
+
// principal; a space IS a site, so there is no third scope underneath. Secret
|
|
5
|
+
// values are write-only after creation: never returned by API, CLI, UI,
|
|
6
|
+
// diagnostics, logs, or activity.
|
|
8
7
|
export const variableScope = z.enum(["space", "principal"]);
|
|
9
8
|
export const variableNameSchema = z
|
|
10
9
|
.string()
|
|
@@ -28,11 +27,10 @@ export const VariableSchema = z.object({
|
|
|
28
27
|
createdAt: z.string().datetime().describe("Instant when the variable was created."),
|
|
29
28
|
updatedAt: z.string().datetime().describe("Instant when the value was last written."),
|
|
30
29
|
});
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
// distinguish sealed-value hashes safely.
|
|
30
|
+
// Versions record the variable names and value hashes they were finalized
|
|
31
|
+
// with, never values. Internal to cascade and synchronization: never echoed on
|
|
32
|
+
// the public Version resource, because historical rows cannot distinguish
|
|
33
|
+
// sealed-value hashes safely.
|
|
36
34
|
export const variableProvenanceSchema = z
|
|
37
35
|
.array(z.object({
|
|
38
36
|
name: z.string().describe("Variable name the version was finalized with."),
|
|
@@ -66,9 +64,7 @@ export const spaceVariableListResponseSchema = z.object({
|
|
|
66
64
|
data: z.array(z.union([VariableSchema, SystemVariableSchema])),
|
|
67
65
|
pagination: CursorPaginationSchema,
|
|
68
66
|
});
|
|
69
|
-
//
|
|
70
|
-
// (internal-docs/platform.md "Debounce contract"): every coalesced PUT/DELETE
|
|
71
|
-
// returns the same pending `op_` id, so "mutation returns `operation`" holds.
|
|
67
|
+
// Every coalesced PUT/DELETE returns the same pending `op_` id.
|
|
72
68
|
export const variableMutationResponseSchema = z.object({
|
|
73
69
|
data: VariableSchema,
|
|
74
70
|
operation: AsyncOperationSchema.nullable().describe("The debounced re-finalize cascade this write coalesced into; null when no cascade was required."),
|
|
@@ -15,6 +15,10 @@ export declare const webhookPatchSchema: z.ZodObject<{
|
|
|
15
15
|
export declare const webhookSchema: z.ZodObject<{
|
|
16
16
|
id: z.ZodString;
|
|
17
17
|
tenantId: z.ZodString;
|
|
18
|
+
mode: z.ZodEnum<{
|
|
19
|
+
live: "live";
|
|
20
|
+
test: "test";
|
|
21
|
+
}>;
|
|
18
22
|
principal: z.ZodNullable<z.ZodObject<{
|
|
19
23
|
tenantId: z.ZodString;
|
|
20
24
|
principalType: z.ZodEnum<{
|
|
@@ -27,8 +31,8 @@ export declare const webhookSchema: z.ZodObject<{
|
|
|
27
31
|
events: z.ZodArray<z.ZodString>;
|
|
28
32
|
status: z.ZodEnum<{
|
|
29
33
|
active: "active";
|
|
30
|
-
deleted: "deleted";
|
|
31
34
|
disabled: "disabled";
|
|
35
|
+
deleted: "deleted";
|
|
32
36
|
failing: "failing";
|
|
33
37
|
}>;
|
|
34
38
|
secret: z.ZodOptional<z.ZodString>;
|
|
@@ -45,6 +49,10 @@ export declare const webhookListResponseSchema: z.ZodObject<{
|
|
|
45
49
|
data: z.ZodArray<z.ZodObject<{
|
|
46
50
|
id: z.ZodString;
|
|
47
51
|
tenantId: z.ZodString;
|
|
52
|
+
mode: z.ZodEnum<{
|
|
53
|
+
live: "live";
|
|
54
|
+
test: "test";
|
|
55
|
+
}>;
|
|
48
56
|
principal: z.ZodNullable<z.ZodObject<{
|
|
49
57
|
tenantId: z.ZodString;
|
|
50
58
|
principalType: z.ZodEnum<{
|
|
@@ -57,8 +65,8 @@ export declare const webhookListResponseSchema: z.ZodObject<{
|
|
|
57
65
|
events: z.ZodArray<z.ZodString>;
|
|
58
66
|
status: z.ZodEnum<{
|
|
59
67
|
active: "active";
|
|
60
|
-
deleted: "deleted";
|
|
61
68
|
disabled: "disabled";
|
|
69
|
+
deleted: "deleted";
|
|
62
70
|
failing: "failing";
|
|
63
71
|
}>;
|
|
64
72
|
secret: z.ZodOptional<z.ZodString>;
|
|
@@ -72,7 +80,7 @@ export declare const webhookListResponseSchema: z.ZodObject<{
|
|
|
72
80
|
hasMore: z.ZodBoolean;
|
|
73
81
|
}, z.core.$strip>;
|
|
74
82
|
}, z.core.$strip>;
|
|
75
|
-
export declare const
|
|
83
|
+
export declare const webhookRotateSchema: z.ZodObject<{
|
|
76
84
|
expireNow: z.ZodDefault<z.ZodBoolean>;
|
|
77
85
|
}, z.core.$strip>;
|
|
78
86
|
export declare const webhookDeliverySchema: z.ZodObject<{
|
|
@@ -101,7 +109,7 @@ export declare const webhookDeliverySchema: z.ZodObject<{
|
|
|
101
109
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
110
|
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
103
111
|
registrar: "registrar";
|
|
104
|
-
|
|
112
|
+
infra: "infra";
|
|
105
113
|
dns: "dns";
|
|
106
114
|
runtime: "runtime";
|
|
107
115
|
}>>>;
|
|
@@ -142,7 +150,7 @@ export declare const webhookDeliveryListResponseSchema: z.ZodObject<{
|
|
|
142
150
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
151
|
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
144
152
|
registrar: "registrar";
|
|
145
|
-
|
|
153
|
+
infra: "infra";
|
|
146
154
|
dns: "dns";
|
|
147
155
|
runtime: "runtime";
|
|
148
156
|
}>>>;
|