@spacefast/common 0.0.23 → 0.0.26
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.js +1 -1
- package/dist/agents/private-key-oauth.d.ts +0 -1
- package/dist/agents/private-key-oauth.js +46 -63
- package/dist/brand-assets-build.js +4 -6
- package/dist/brand-assets.d.ts +5 -15
- package/dist/brand-assets.js +15 -14
- package/dist/config/domains.d.ts +47 -7
- package/dist/config/domains.js +66 -10
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +0 -1
- package/dist/contracts/abuse.d.ts +2 -0
- package/dist/contracts/abuse.js +12 -0
- package/dist/contracts/access.d.ts +124 -12
- package/dist/contracts/access.js +73 -9
- package/dist/contracts/activity.d.ts +1 -1
- package/dist/contracts/activity.js +5 -12
- package/dist/contracts/api-keys.d.ts +21 -21
- package/dist/contracts/api-keys.js +2 -2
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/billing.d.ts +3 -35
- package/dist/contracts/billing.js +33 -52
- package/dist/contracts/builds.d.ts +30 -18
- package/dist/contracts/builds.js +28 -9
- package/dist/contracts/channels.js +1 -1
- package/dist/contracts/cli.d.ts +10 -0
- package/dist/contracts/cli.js +10 -0
- package/dist/contracts/collab-public.d.ts +63 -0
- package/dist/contracts/collab-public.js +46 -0
- package/dist/contracts/comments.d.ts +282 -53
- package/dist/contracts/comments.js +173 -52
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +5 -5
- package/dist/contracts/crons.d.ts +35 -0
- package/dist/contracts/crons.js +42 -0
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +2 -2
- package/dist/contracts/docs.js +2 -2
- package/dist/contracts/domains.d.ts +38 -27
- package/dist/contracts/domains.js +29 -2
- package/dist/contracts/enums.d.ts +34 -30
- package/dist/contracts/enums.js +62 -48
- package/dist/contracts/error-code-meta.d.ts +50 -125
- package/dist/contracts/error-code-meta.js +29 -41
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +14 -33
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +53 -49
- package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
- package/dist/contracts/feature-lifecycle-core.js +2 -31
- package/dist/contracts/feature-lifecycle.d.ts +12 -52
- package/dist/contracts/feature-lifecycle.js +16 -59
- package/dist/contracts/features.d.ts +48 -60
- package/dist/contracts/features.js +59 -51
- package/dist/contracts/functions.d.ts +266 -72
- package/dist/contracts/functions.js +260 -37
- package/dist/contracts/git.d.ts +28 -34
- package/dist/contracts/git.js +10 -11
- package/dist/contracts/grants.d.ts +9 -5
- package/dist/contracts/grants.js +18 -9
- package/dist/contracts/ids.js +2 -2
- package/dist/contracts/internal.d.ts +8 -6
- package/dist/contracts/internal.js +12 -12
- package/dist/contracts/mcp.d.ts +11 -0
- package/dist/contracts/mcp.js +5 -0
- package/dist/contracts/me.js +1 -1
- package/dist/contracts/oauth-resources.d.ts +4 -3
- package/dist/contracts/oauth-resources.js +12 -3
- package/dist/contracts/operations.d.ts +90 -5
- package/dist/contracts/operations.js +77 -3
- package/dist/contracts/pages.d.ts +12 -7
- package/dist/contracts/pages.js +24 -1
- package/dist/contracts/plan-policy.d.ts +0 -2
- package/dist/contracts/plan-policy.js +2 -3
- package/dist/contracts/platform.d.ts +61 -148
- package/dist/contracts/platform.js +70 -126
- package/dist/contracts/publish-archive.d.ts +508 -0
- package/dist/contracts/publish-archive.js +32 -0
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +2 -2
- package/dist/contracts/repository-connections.d.ts +43 -30
- package/dist/contracts/repository-connections.js +11 -3
- package/dist/contracts/resources.d.ts +12 -24
- package/dist/contracts/resources.js +36 -16
- package/dist/contracts/runtime-api.d.ts +433 -192
- package/dist/contracts/runtime-api.js +421 -356
- package/dist/contracts/runtime-app.d.ts +127 -120
- package/dist/contracts/runtime-app.js +19 -10
- package/dist/contracts/runtime-db.d.ts +5 -5
- package/dist/contracts/runtime-db.js +2 -2
- package/dist/contracts/runtime-purge.d.ts +8 -0
- package/dist/contracts/runtime-purge.js +7 -0
- package/dist/contracts/runtime-services.d.ts +219 -0
- package/dist/contracts/runtime-services.js +437 -0
- package/dist/contracts/runtime-storage.d.ts +46 -32
- package/dist/contracts/runtime-storage.js +31 -8
- package/dist/contracts/sf-config-v1.d.ts +48 -10
- package/dist/contracts/space-config.d.ts +69 -18
- package/dist/contracts/space-config.js +226 -27
- package/dist/contracts/spaces.d.ts +236 -450
- package/dist/contracts/spaces.js +131 -151
- package/dist/contracts/superadmin-activity.d.ts +57 -4
- package/dist/contracts/superadmin-activity.js +48 -2
- package/dist/contracts/superadmin-search.d.ts +126 -0
- package/dist/contracts/superadmin-search.js +61 -0
- package/dist/contracts/superadmin-spaces.d.ts +361 -92
- package/dist/contracts/superadmin-spaces.js +97 -24
- package/dist/contracts/superadmin-teams.d.ts +28 -10
- package/dist/contracts/superadmin-teams.js +5 -8
- package/dist/contracts/superadmin-tenants.d.ts +0 -6
- package/dist/contracts/superadmin-tenants.js +1 -7
- package/dist/contracts/superadmin.d.ts +135 -54
- package/dist/contracts/superadmin.js +46 -23
- package/dist/contracts/tags.d.ts +12 -12
- package/dist/contracts/tags.js +3 -3
- package/dist/contracts/teams.d.ts +49 -14
- package/dist/contracts/teams.js +40 -22
- package/dist/contracts/transfers.d.ts +0 -49
- package/dist/contracts/transfers.js +4 -8
- package/dist/contracts/usage.d.ts +61 -0
- package/dist/contracts/usage.js +64 -0
- package/dist/contracts/variables.d.ts +2 -7
- package/dist/contracts/variables.js +9 -8
- package/dist/contracts/webhooks.d.ts +2 -2
- package/dist/contracts/zero.d.ts +102 -73
- package/dist/contracts/zero.js +94 -32
- package/dist/dashboard-paths/index.d.ts +1 -1
- package/dist/dashboard-paths/index.js +1 -0
- package/dist/docs/agent-prose.d.ts +2 -2
- package/dist/docs/agent-prose.js +63 -70
- package/dist/docs/agent-setup.js +45 -15
- package/dist/docs/catalog.d.ts +24 -24
- package/dist/docs/catalog.js +35 -24
- package/dist/docs/error-docs.js +194 -270
- package/dist/docs/skills.d.ts +12 -12
- package/dist/docs/skills.js +4 -4
- package/dist/test-helpers/fetch-stub.d.ts +16 -0
- package/dist/test-helpers/fetch-stub.js +25 -0
- package/dist/utils/build-settings.d.ts +5 -1
- package/dist/utils/build-settings.js +91 -13
- package/dist/utils/canonical-json.d.ts +10 -0
- package/dist/utils/canonical-json.js +22 -0
- package/dist/utils/cast-transport.d.ts +28 -0
- package/dist/utils/cast-transport.js +52 -0
- package/dist/utils/claim-token.d.ts +0 -8
- package/dist/utils/claim-token.js +3 -15
- package/dist/utils/concurrency.js +1 -0
- package/dist/utils/credential-policy.d.ts +1 -1
- package/dist/utils/credential-policy.js +4 -3
- package/dist/utils/dns-instructions.js +9 -9
- package/dist/utils/env-file.d.ts +17 -0
- package/dist/utils/env-file.js +96 -0
- package/dist/utils/error-code.d.ts +2 -0
- package/dist/utils/error-code.js +8 -0
- package/dist/utils/generate-space-name.d.ts +8 -10
- package/dist/utils/generate-space-name.js +206 -21
- package/dist/utils/grant-decision.fixtures.json +2938 -0
- package/dist/utils/grants.d.ts +2 -0
- package/dist/utils/grants.js +26 -1
- package/dist/utils/gravatar.d.ts +9 -0
- package/dist/utils/gravatar.js +31 -0
- package/dist/utils/idempotency.d.ts +6 -0
- package/dist/utils/idempotency.js +28 -0
- package/dist/utils/local-space-state.d.ts +9 -16
- package/dist/utils/local-space-state.js +20 -50
- package/dist/utils/one-shot-replay.d.ts +4 -1
- package/dist/utils/page-colors.d.ts +14 -12
- package/dist/utils/page-colors.js +15 -13
- package/dist/utils/page-fonts.d.ts +2 -2
- package/dist/utils/page-fonts.js +15 -4
- package/dist/utils/pages.d.ts +21 -3
- package/dist/utils/pages.js +42 -13
- package/dist/utils/publish-form-data.d.ts +12 -0
- package/dist/utils/publish-form-data.js +10 -0
- package/dist/utils/publish-policy.d.ts +27 -0
- package/dist/utils/publish-policy.fixtures.json +403 -0
- package/dist/utils/publish-policy.js +45 -20
- package/dist/utils/push-new.d.ts +7 -0
- package/dist/utils/push-new.js +7 -0
- package/dist/utils/query-keys.d.ts +4 -5
- package/dist/utils/query-keys.js +2 -3
- package/dist/utils/runtime-paths.d.ts +5 -0
- package/dist/utils/runtime-paths.js +5 -0
- package/dist/utils/runtime-upload-batch.d.ts +0 -5
- package/dist/utils/runtime-upload-batch.js +1 -27
- package/dist/utils/runtime-upload.d.ts +6 -11
- package/dist/utils/runtime-upload.js +10 -13
- package/dist/utils/secure-local-file.js +5 -16
- package/dist/utils/space-config.d.ts +1 -34
- package/dist/utils/space-config.js +8 -326
- package/dist/utils/static-runtime-policy.d.ts +9 -3
- package/dist/utils/static-runtime-policy.fixtures.json +38 -41
- package/dist/utils/static-runtime-policy.js +22 -56
- package/dist/utils/storage-policy.d.ts +1 -1
- package/dist/utils/storage-policy.js +3 -1
- package/dist/utils/structured-error.d.ts +14 -0
- package/dist/utils/structured-error.js +22 -0
- package/dist/utils/upload-session.d.ts +4 -1
- package/dist/utils/upload-session.js +33 -5
- package/dist/utils/version-path.js +13 -4
- package/dist/vocabulary.d.ts +13 -11
- package/dist/vocabulary.js +42 -28
- package/package.json +7 -17
- package/dist/config/postgres-budget.d.ts +0 -129
- package/dist/config/postgres-budget.js +0 -140
- package/dist/config/postgres-budget.json +0 -51
- package/dist/contracts/archives.d.ts +0 -331
- package/dist/contracts/archives.js +0 -120
- package/dist/contracts/deployments.d.ts +0 -574
- package/dist/contracts/deployments.js +0 -97
- package/dist/contracts/sites.d.ts +0 -416
- package/dist/contracts/sites.js +0 -168
- package/dist/contracts/superadmin-queues.d.ts +0 -414
- package/dist/contracts/superadmin-queues.js +0 -202
- package/dist/contracts/superadmin-runtime.d.ts +0 -27
- package/dist/contracts/superadmin-runtime.js +0 -38
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/utils/api.d.ts +0 -4
- package/dist/utils/api.js +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { appRoutePathSchema,
|
|
2
|
+
import { appRoutePathSchema, executionBase64Schema, executionCapabilitiesSchema, executionSha256Schema, httpMethodSchema, } from "./execution.js";
|
|
3
3
|
/**
|
|
4
4
|
* Spacefast Functions: tenant workers run as Cloudflare Dynamic Workers.
|
|
5
5
|
*
|
|
@@ -37,6 +37,13 @@ import { appRoutePathSchema, executionCapabilitiesSchema, executionLogEntrySchem
|
|
|
37
37
|
* than transactional. That is why capsules are a different product rather
|
|
38
38
|
* than a placement option — see `endpointIsPortable` in `./execution.js`.
|
|
39
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* The tag a compiled worker artifact carries — in `functionsSourceFinalizeSchema`
|
|
42
|
+
* and the runtime config built from it — so the PHP origin can tell what it is
|
|
43
|
+
* dispatching (`functions-dispatch.php` refuses a config tagged anything else).
|
|
44
|
+
* It is a property of the artifact the tree produced, not a kind a space or a
|
|
45
|
+
* version declares: a publish can carry this beside a capsule.
|
|
46
|
+
*/
|
|
40
47
|
export const FUNCTIONS_RUNTIME_KIND = "functions";
|
|
41
48
|
export const FUNCTIONS_SOURCE_METADATA_KEY = "spacefastFunctions";
|
|
42
49
|
export const FUNCTIONS_PLATFORM_ROUTE_PREFIX = "/__spacefast/functions";
|
|
@@ -44,7 +51,32 @@ export const FUNCTIONS_RUNTIME_ROUTE_PATHS = {
|
|
|
44
51
|
logs: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/logs`,
|
|
45
52
|
/** Where a dispatched worker calls back for brokered capabilities. */
|
|
46
53
|
relay: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/relay`,
|
|
54
|
+
/**
|
|
55
|
+
* Where the execution host asks the space origin to drop cached responses —
|
|
56
|
+
* an OpenNext `revalidatePath` must reach the CDN in front of wp.cloud, and
|
|
57
|
+
* only the origin can speak for its own cache. Authenticated with the
|
|
58
|
+
* version-scoped purge credential in the `sf-purge-token` request header.
|
|
59
|
+
*/
|
|
60
|
+
purge: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/purge`,
|
|
47
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* The header the execution host presents at the origin purge route. Outside the
|
|
64
|
+
* `sf-fx-` namespace on purpose: that prefix names dispatch instructions the
|
|
65
|
+
* origin SENDS, and is stripped from anything inbound before tenant code — a
|
|
66
|
+
* purge call is the host speaking for itself, like a relay call.
|
|
67
|
+
*/
|
|
68
|
+
export const FUNCTIONS_PURGE_TOKEN_HEADER = "sf-purge-token";
|
|
69
|
+
/**
|
|
70
|
+
* Where invocation counts are reported, on the CONTROL PLANE rather than the
|
|
71
|
+
* space origin.
|
|
72
|
+
*
|
|
73
|
+
* The two destinations are separate on purpose. Logs are the tenant's content
|
|
74
|
+
* and stay on their own origin; usage is a number the platform bills from and
|
|
75
|
+
* goes straight to us. Sharing one channel would make either destination a
|
|
76
|
+
* plausible place to look for the other's data, and would put log volume on the
|
|
77
|
+
* path that has to stay cheap.
|
|
78
|
+
*/
|
|
79
|
+
export const FUNCTIONS_USAGE_INTAKE_PATH = "/v1/runtime/functions/usage";
|
|
48
80
|
/** Public, signed read path. Distinct from storage so the token is never a filename. */
|
|
49
81
|
export const FUNCTIONS_BUNDLE_ROUTE_PREFIX = `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/b`;
|
|
50
82
|
export const FUNCTIONS_RUNTIME_STORAGE_ROOT = "__spacefast/functions";
|
|
@@ -71,7 +103,17 @@ export const FUNCTIONS_RUNTIME_STORAGE_ROOT = "__spacefast/functions";
|
|
|
71
103
|
* was never given.
|
|
72
104
|
*/
|
|
73
105
|
export const FUNCTIONS_RUNTIME_BUNDLE_ROOT = `${FUNCTIONS_RUNTIME_STORAGE_ROOT}/bundles`;
|
|
106
|
+
/**
|
|
107
|
+
* Where a version's Next-cache seed document lives — the build-time prerender
|
|
108
|
+
* and fetch-cache entries that warm the execution host's cache object so the
|
|
109
|
+
* first visitor gets the page the build rendered instead of a live re-render.
|
|
110
|
+
* A sibling of `bundles/` with the same properties: publishable through the
|
|
111
|
+
* ordinary upload path (its own carve-out in publish-policy), never servable
|
|
112
|
+
* as static content, read back only through the signed artifact route.
|
|
113
|
+
*/
|
|
114
|
+
export const FUNCTIONS_RUNTIME_SEED_ROOT = `${FUNCTIONS_RUNTIME_STORAGE_ROOT}/seeds`;
|
|
74
115
|
export const FUNCTIONS_BUNDLE_FORMAT = "spacefast.functions.bundle.v1";
|
|
116
|
+
export const FUNCTIONS_SEED_FORMAT = "spacefast.functions.seed.v1";
|
|
75
117
|
/**
|
|
76
118
|
* Ceiling on a bundle's decoded size.
|
|
77
119
|
*
|
|
@@ -82,13 +124,66 @@ export const FUNCTIONS_BUNDLE_FORMAT = "spacefast.functions.bundle.v1";
|
|
|
82
124
|
* modules are large, rather than at dispatch, where the tenant sees a 502.
|
|
83
125
|
*/
|
|
84
126
|
export const FUNCTIONS_BUNDLE_MAX_BYTES = 8 * 1024 * 1024;
|
|
127
|
+
/**
|
|
128
|
+
* Ceilings on the cache seed document. Per-entry mirrors the cache object's
|
|
129
|
+
* own row limit (an entry the object would refuse is dead weight in the
|
|
130
|
+
* document); the total bounds what the host pulls and ingests on a cold
|
|
131
|
+
* cache. Both are enforced in the CLI, where an overflow can say WHICH pages
|
|
132
|
+
* were left out — an omitted entry is not an error, it just renders live on
|
|
133
|
+
* first request like any cache miss.
|
|
134
|
+
*/
|
|
135
|
+
export const FUNCTIONS_SEED_ENTRY_MAX_BYTES = 2 * 1024 * 1024 - 8192;
|
|
136
|
+
// The Durable Object buffers the JSON once, then decoding/parsing temporarily
|
|
137
|
+
// holds the text and object graph beside it. Keep the document far below
|
|
138
|
+
// Cloudflare's 128 MiB SHARED-isolate ceiling; several objects can occupy that
|
|
139
|
+
// isolate, and the host enforces this bound again while streaming the response.
|
|
140
|
+
export const FUNCTIONS_SEED_MAX_BYTES = 8 * 1024 * 1024;
|
|
141
|
+
/**
|
|
142
|
+
* One warm-cache entry: exactly what the runtime's incremental-cache client
|
|
143
|
+
* would have written for `key` had it rendered the page itself. `valueJson`
|
|
144
|
+
* is carried as the JSON string it already is on disk (OpenNext's `.cache` /
|
|
145
|
+
* fetch-cache files) — re-parsing it here would only invite the seed writer
|
|
146
|
+
* and the cache client to disagree about serialization.
|
|
147
|
+
*/
|
|
148
|
+
export const functionsSeedEntrySchema = z
|
|
149
|
+
.object({
|
|
150
|
+
key: z.string().min(1).max(2048),
|
|
151
|
+
cacheType: z.enum(["cache", "fetch"]),
|
|
152
|
+
valueJson: z.string().min(1),
|
|
153
|
+
/** Epoch milliseconds the entry was built, so staleness math holds. */
|
|
154
|
+
lastModified: z.number().int().nonnegative(),
|
|
155
|
+
})
|
|
156
|
+
.strict();
|
|
157
|
+
/** The document served at a seed URL; host and CLI validate the same shape. */
|
|
158
|
+
export const functionsSeedManifestSchema = z
|
|
159
|
+
.object({
|
|
160
|
+
format: z.literal(FUNCTIONS_SEED_FORMAT),
|
|
161
|
+
entries: z.array(functionsSeedEntrySchema),
|
|
162
|
+
})
|
|
163
|
+
.strict();
|
|
85
164
|
const functionsRoutePathSchema = appRoutePathSchema({
|
|
86
165
|
subject: "Function routes",
|
|
87
166
|
});
|
|
167
|
+
/**
|
|
168
|
+
* How many entries the origin's dispatch table accepts.
|
|
169
|
+
*
|
|
170
|
+
* Exported because the CLI classifier has to compact its route claims BEFORE
|
|
171
|
+
* assembling the artifact — discovering the ceiling as a validation error at
|
|
172
|
+
* finalize would mean a build that classified fine fails at the last step — so
|
|
173
|
+
* the ceiling has to be a value both sides can read, not a literal each side
|
|
174
|
+
* spells for itself.
|
|
175
|
+
*/
|
|
176
|
+
export const FUNCTIONS_MAX_ROUTES = 256;
|
|
88
177
|
/**
|
|
89
178
|
* A worker's dynamic route table. Anything not matched here is answered from
|
|
90
179
|
* the version's static content by wp.cloud and never reaches Cloudflare, which
|
|
91
180
|
* is both the cheaper path and the one that keeps assets ours.
|
|
181
|
+
*
|
|
182
|
+
* A `subtree` entry covers its own path AND everything below it: the engine
|
|
183
|
+
* expands one into both `path` and `path/:splat`
|
|
184
|
+
* (`_stattic_runtime_functions_routes_artifact`, runtime/engine/admin/management.php),
|
|
185
|
+
* which is why `wholeSiteRoutes()` is a single `/` subtree entry and why an
|
|
186
|
+
* exact entry beside a subtree entry at the same path is dead weight.
|
|
92
187
|
*/
|
|
93
188
|
export const functionsRouteSchema = z
|
|
94
189
|
.object({
|
|
@@ -102,14 +197,17 @@ export const functionsRouteSchema = z
|
|
|
102
197
|
* One module in a bundle, in the shape the Worker Loader consumes.
|
|
103
198
|
*
|
|
104
199
|
* `commonjs` exists because bundlers still emit it and rejecting it would fail
|
|
105
|
-
* builds for a format the runtime accepts. Binary
|
|
106
|
-
*
|
|
200
|
+
* builds for a format the runtime accepts. Binary modules cross this JSON wire
|
|
201
|
+
* format as base64; the Functions host turns them back into ArrayBuffers at the
|
|
202
|
+
* Worker Loader boundary.
|
|
107
203
|
*/
|
|
108
204
|
export const functionsBundleModuleSchema = z.union([
|
|
109
205
|
z.object({ js: z.string() }).strict(),
|
|
110
206
|
z.object({ cjs: z.string() }).strict(),
|
|
111
207
|
z.object({ text: z.string() }).strict(),
|
|
112
208
|
z.object({ json: z.unknown() }).strict(),
|
|
209
|
+
z.object({ wasm: executionBase64Schema }).strict(),
|
|
210
|
+
z.object({ data: executionBase64Schema }).strict(),
|
|
113
211
|
]);
|
|
114
212
|
/**
|
|
115
213
|
* The document served at a bundle URL and parsed by the host.
|
|
@@ -150,6 +248,25 @@ export const functionsBundleRefSchema = z
|
|
|
150
248
|
size: z.number().int().nonnegative().max(FUNCTIONS_BUNDLE_MAX_BYTES),
|
|
151
249
|
})
|
|
152
250
|
.strict();
|
|
251
|
+
/**
|
|
252
|
+
* Where a version's cache seed document sits in its content store — the
|
|
253
|
+
* bundle ref's sibling, with the seed's own root and ceiling. `entries` is
|
|
254
|
+
* carried so status surfaces can say what the seed holds without fetching it.
|
|
255
|
+
*/
|
|
256
|
+
export const functionsSeedRefSchema = z
|
|
257
|
+
.object({
|
|
258
|
+
path: z
|
|
259
|
+
.string()
|
|
260
|
+
.min(1)
|
|
261
|
+
.startsWith(`${FUNCTIONS_RUNTIME_SEED_ROOT}/`)
|
|
262
|
+
.refine((path) => !path.split("/").includes(".."), {
|
|
263
|
+
message: "Function seed paths cannot traverse outside the seed root.",
|
|
264
|
+
}),
|
|
265
|
+
sha256: executionSha256Schema,
|
|
266
|
+
size: z.number().int().nonnegative().max(FUNCTIONS_SEED_MAX_BYTES),
|
|
267
|
+
entries: z.number().int().nonnegative(),
|
|
268
|
+
})
|
|
269
|
+
.strict();
|
|
153
270
|
/**
|
|
154
271
|
* The path a bundle is served from.
|
|
155
272
|
*
|
|
@@ -171,6 +288,15 @@ export const functionsBundleRefSchema = z
|
|
|
171
288
|
export function functionsBundlePath(input) {
|
|
172
289
|
return `${FUNCTIONS_BUNDLE_ROUTE_PREFIX}/${bundleDigest(input.sha256)}/${input.token}/bundle.json`;
|
|
173
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* The seed document's read path — the bundle route with a different terminal
|
|
293
|
+
* filename and its own token audience. One signed artifact route on the
|
|
294
|
+
* origin serves both: the filename says what the digest names, the token's
|
|
295
|
+
* audience says what the caller was authorised to read.
|
|
296
|
+
*/
|
|
297
|
+
export function functionsSeedPath(input) {
|
|
298
|
+
return `${FUNCTIONS_BUNDLE_ROUTE_PREFIX}/${bundleDigest(input.sha256)}/${input.token}/seed.json`;
|
|
299
|
+
}
|
|
174
300
|
/**
|
|
175
301
|
* Where the bundle actually sits in the published version — the same path minus
|
|
176
302
|
* the token segment. The token authorises the read; it does not name the file,
|
|
@@ -179,6 +305,10 @@ export function functionsBundlePath(input) {
|
|
|
179
305
|
export function functionsBundleStoragePath(input) {
|
|
180
306
|
return `${FUNCTIONS_RUNTIME_BUNDLE_ROOT}/${bundleDigest(input.sha256)}/bundle.json`;
|
|
181
307
|
}
|
|
308
|
+
/** The seed's storage twin of `functionsBundleStoragePath`. */
|
|
309
|
+
export function functionsSeedStoragePath(input) {
|
|
310
|
+
return `${FUNCTIONS_RUNTIME_SEED_ROOT}/${bundleDigest(input.sha256)}/seed.json`;
|
|
311
|
+
}
|
|
182
312
|
/**
|
|
183
313
|
* The digest is carried in contracts as `sha256:<hex>` but appears in paths as
|
|
184
314
|
* bare hex: a colon is legal in a path segment yet needlessly invites
|
|
@@ -211,9 +341,26 @@ export const functionsWorkerArtifactSchema = z
|
|
|
211
341
|
*/
|
|
212
342
|
mainModule: z.string().min(1).max(1024),
|
|
213
343
|
bundle: functionsBundleRefSchema,
|
|
344
|
+
/**
|
|
345
|
+
* The build-time cache seed, or null when the build produced nothing
|
|
346
|
+
* worth warming (no prerenders left with the worker, no fetch cache).
|
|
347
|
+
* A ref, not content: the document rides the version's own file tree
|
|
348
|
+
* like the bundle, and the host pulls it through a signed URL minted at
|
|
349
|
+
* finalize.
|
|
350
|
+
*/
|
|
351
|
+
seed: functionsSeedRefSchema.nullable().default(null),
|
|
214
352
|
compatibilityDate: functionsCompatibilityDateSchema,
|
|
215
353
|
compatibilityFlags: z.array(z.string().min(1).max(128)).max(32).default([]),
|
|
216
|
-
routes: z.array(functionsRouteSchema).max(
|
|
354
|
+
routes: z.array(functionsRouteSchema).max(FUNCTIONS_MAX_ROUTES).default([]),
|
|
355
|
+
/**
|
|
356
|
+
* Cookie names whose presence must skip the origin's static fast path on
|
|
357
|
+
* claimed routes — the framework's draft/preview session markers. Data
|
|
358
|
+
* from the classifier, not names the engine knows: the origin checks the
|
|
359
|
+
* Cookie header against this list and dispatches instead of serving the
|
|
360
|
+
* extracted file, which is what lets a fully-static page still honor a
|
|
361
|
+
* draft session without a build-wide draft-usage proof.
|
|
362
|
+
*/
|
|
363
|
+
bypassCookies: z.array(z.string().min(1).max(128)).max(8).default([]),
|
|
217
364
|
/**
|
|
218
365
|
* Aggregate of what the worker's handlers reach, used to decide which
|
|
219
366
|
* brokered capabilities the relay will honour for this version. A worker
|
|
@@ -221,6 +368,18 @@ export const functionsWorkerArtifactSchema = z
|
|
|
221
368
|
* so an injected dependency cannot widen authority at runtime.
|
|
222
369
|
*/
|
|
223
370
|
capabilities: executionCapabilitiesSchema,
|
|
371
|
+
/**
|
|
372
|
+
* Platform-owned runtime services this build needs. This is deliberately
|
|
373
|
+
* separate from author capabilities: an OpenNext build needs durable cache
|
|
374
|
+
* storage even when the application itself declares no database or fetch
|
|
375
|
+
* access, and that storage must never become a general tenant credential.
|
|
376
|
+
*/
|
|
377
|
+
platform: z
|
|
378
|
+
.object({
|
|
379
|
+
nextCache: z.boolean().default(false),
|
|
380
|
+
})
|
|
381
|
+
.strict()
|
|
382
|
+
.default({ nextCache: false }),
|
|
224
383
|
})
|
|
225
384
|
.strict();
|
|
226
385
|
/**
|
|
@@ -232,13 +391,24 @@ export const functionsWorkerArtifactSchema = z
|
|
|
232
391
|
* *grants*, resolved by the control plane at finalize so the origin forwards a
|
|
233
392
|
* decision rather than making one. Anything absent fails closed at the relay.
|
|
234
393
|
*/
|
|
235
|
-
export const FUNCTIONS_DISPATCH_CAPABILITIES = [
|
|
394
|
+
export const FUNCTIONS_DISPATCH_CAPABILITIES = [
|
|
395
|
+
"storage.read",
|
|
396
|
+
"storage.write",
|
|
397
|
+
"db.read",
|
|
398
|
+
"db.write",
|
|
399
|
+
"fetch",
|
|
400
|
+
"log",
|
|
401
|
+
"next.cache",
|
|
402
|
+
"gravatar.profile",
|
|
403
|
+
"spam.check",
|
|
404
|
+
"email.send",
|
|
405
|
+
];
|
|
236
406
|
export const functionsDispatchCapabilitySchema = z.enum(FUNCTIONS_DISPATCH_CAPABILITIES);
|
|
237
407
|
/**
|
|
238
408
|
* Resolves a build's declared capabilities into the grant a dispatch carries.
|
|
239
409
|
*
|
|
240
|
-
* Three
|
|
241
|
-
*
|
|
410
|
+
* Three declared capabilities have no dispatch counterpart, each for its own
|
|
411
|
+
* reason:
|
|
242
412
|
*
|
|
243
413
|
* - `env` is not a runtime call at all. Values are resolved at finalize and
|
|
244
414
|
* travel in the config, so a worker reading `env` reaches nothing.
|
|
@@ -250,9 +420,17 @@ export const functionsDispatchCapabilitySchema = z.enum(FUNCTIONS_DISPATCH_CAPAB
|
|
|
250
420
|
* touches the database, not how. Narrowing it would take per-statement analysis
|
|
251
421
|
* we do not do, and guessing "read-only" from a declaration would be a grant
|
|
252
422
|
* the author never asked for and cannot see.
|
|
423
|
+
*
|
|
424
|
+
* The three platform-service grants are named for the operation an author
|
|
425
|
+
* reaches for, and each covers its service's whole operation set for the same
|
|
426
|
+
* reason `db` widens: a declaration says a handler uses spam checking, not that
|
|
427
|
+
* it never files a correction.
|
|
253
428
|
*/
|
|
254
|
-
export function functionsDispatchCapabilities(capabilities) {
|
|
255
|
-
|
|
429
|
+
export function functionsDispatchCapabilities(capabilities, platform = {}) {
|
|
430
|
+
// Storage is the durable, unversioned substrate every app receives. It is a
|
|
431
|
+
// base binding like the Zero client's `storage`, not a source-declared
|
|
432
|
+
// capability that disappears when a new version omits an import.
|
|
433
|
+
const granted = new Set(["storage.read", "storage.write"]);
|
|
256
434
|
if (capabilities.db) {
|
|
257
435
|
granted.add("db.read");
|
|
258
436
|
granted.add("db.write");
|
|
@@ -263,14 +441,26 @@ export function functionsDispatchCapabilities(capabilities) {
|
|
|
263
441
|
if (capabilities.logging) {
|
|
264
442
|
granted.add("log");
|
|
265
443
|
}
|
|
444
|
+
if (capabilities.gravatar) {
|
|
445
|
+
granted.add("gravatar.profile");
|
|
446
|
+
}
|
|
447
|
+
if (capabilities.spam) {
|
|
448
|
+
granted.add("spam.check");
|
|
449
|
+
}
|
|
450
|
+
if (capabilities.email) {
|
|
451
|
+
granted.add("email.send");
|
|
452
|
+
}
|
|
453
|
+
if (platform.nextCache) {
|
|
454
|
+
granted.add("next.cache");
|
|
455
|
+
}
|
|
266
456
|
// Filtered from the canonical list so the order is stable: the grant is part
|
|
267
457
|
// of the host's isolate identity, and a reordering would retire warm isolates
|
|
268
458
|
// for no reason.
|
|
269
459
|
return FUNCTIONS_DISPATCH_CAPABILITIES.filter((capability) => granted.has(capability));
|
|
270
460
|
}
|
|
271
|
-
/**
|
|
461
|
+
/** Logs and the host-local Next cache do not transit the origin relay. */
|
|
272
462
|
export function functionsGrantNeedsRelay(granted) {
|
|
273
|
-
return granted.some((capability) => capability !== "log");
|
|
463
|
+
return granted.some((capability) => capability !== "log" && capability !== "next.cache");
|
|
274
464
|
}
|
|
275
465
|
/**
|
|
276
466
|
* What the space origin needs in order to dispatch to the host on its own. The
|
|
@@ -295,6 +485,13 @@ export const functionsHostConfigSchema = z
|
|
|
295
485
|
* single artifact.
|
|
296
486
|
*/
|
|
297
487
|
bundleUrl: z.string().url(),
|
|
488
|
+
/**
|
|
489
|
+
* Where the host pulls the version's cache seed, minted beside the bundle
|
|
490
|
+
* URL for the same reasons — null exactly when the artifact carries no
|
|
491
|
+
* seed. The host folds it into the cache object's cold-start path, never
|
|
492
|
+
* into request serving: an unreachable seed is a cold cache, not an error.
|
|
493
|
+
*/
|
|
494
|
+
seedUrl: z.string().url().nullable().default(null),
|
|
298
495
|
})
|
|
299
496
|
.strict();
|
|
300
497
|
/**
|
|
@@ -321,6 +518,43 @@ export const functionsRelayConfigSchema = z
|
|
|
321
518
|
maxConcurrentCalls: z.number().int().min(1).max(64),
|
|
322
519
|
})
|
|
323
520
|
.strict();
|
|
521
|
+
/**
|
|
522
|
+
* Where the execution host reports how much this version ran.
|
|
523
|
+
*
|
|
524
|
+
* Absent means uncounted, not refused: a space whose configuration predates
|
|
525
|
+
* usage reporting must keep serving, and an execution tier that cannot reach
|
|
526
|
+
* the control plane must never fail a request over it. Counting is reporting
|
|
527
|
+
* only — nothing here throttles, and no limit is enforced anywhere from it.
|
|
528
|
+
*/
|
|
529
|
+
export const functionsUsageConfigSchema = z
|
|
530
|
+
.object({
|
|
531
|
+
url: z.string().url(),
|
|
532
|
+
/**
|
|
533
|
+
* Minted and verified by the control plane alone; the space only forwards
|
|
534
|
+
* it. Version-scoped like the relay credential, and folded into the host's
|
|
535
|
+
* isolate identity for the same reason: a rotated credential must not
|
|
536
|
+
* outlive its rotation inside a warm isolate.
|
|
537
|
+
*/
|
|
538
|
+
token: z.string().min(1),
|
|
539
|
+
})
|
|
540
|
+
.strict();
|
|
541
|
+
/**
|
|
542
|
+
* The credential the execution host presents at the origin's purge route.
|
|
543
|
+
*
|
|
544
|
+
* Only the token lives here: the purge route is on whichever hostname the
|
|
545
|
+
* visitor actually hit, so the origin composes the URL from the request host at
|
|
546
|
+
* dispatch time — exactly as it does for log intake — instead of freezing one
|
|
547
|
+
* hostname at finalize. A third credential rather than a reuse of the relay's,
|
|
548
|
+
* for the relay's own reason: purging cached responses is a distinct authority,
|
|
549
|
+
* and a worker whose relay is unusable must still be able to invalidate what it
|
|
550
|
+
* rendered. Version-scoped and folded into the host's isolate identity like its
|
|
551
|
+
* siblings, so a republish revokes it.
|
|
552
|
+
*/
|
|
553
|
+
export const functionsPurgeConfigSchema = z
|
|
554
|
+
.object({
|
|
555
|
+
token: z.string().min(1),
|
|
556
|
+
})
|
|
557
|
+
.strict();
|
|
324
558
|
/**
|
|
325
559
|
* What a build declares about its worker — everything the CLI can know from the
|
|
326
560
|
* author's project alone.
|
|
@@ -349,15 +583,18 @@ export const functionsSourceFinalizeSchema = z
|
|
|
349
583
|
* The document the control plane sends to the runtime, which the engine stores
|
|
350
584
|
* beside the version's files and the origin reads on every dispatch.
|
|
351
585
|
*
|
|
352
|
-
* It is the build's declaration plus the
|
|
353
|
-
*
|
|
354
|
-
*
|
|
586
|
+
* It is the build's declaration plus the things only the platform can supply:
|
|
587
|
+
* where to dispatch, what the worker is allowed to do, the credentials that let
|
|
588
|
+
* it do those things and report what it did, and the resolved values of its
|
|
589
|
+
* variables.
|
|
355
590
|
*/
|
|
356
591
|
export const functionsRuntimeConfigSchema = functionsSourceFinalizeSchema
|
|
357
592
|
.extend({
|
|
358
593
|
host: functionsHostConfigSchema,
|
|
359
|
-
grantedCapabilities: z.array(functionsDispatchCapabilitySchema).max(
|
|
594
|
+
grantedCapabilities: z.array(functionsDispatchCapabilitySchema).max(10).default([]),
|
|
360
595
|
relay: functionsRelayConfigSchema.nullable().default(null),
|
|
596
|
+
usage: functionsUsageConfigSchema.nullable().default(null),
|
|
597
|
+
purge: functionsPurgeConfigSchema.nullable().default(null),
|
|
361
598
|
/**
|
|
362
599
|
* Resolved at finalize, so a worker reading configuration never calls back
|
|
363
600
|
* to us for it — and so rotating a variable is a republish with an audit
|
|
@@ -392,10 +629,13 @@ export function createFunctionsSourceFinalize(input) {
|
|
|
392
629
|
entry: input.entry,
|
|
393
630
|
mainModule: input.mainModule,
|
|
394
631
|
bundle: input.bundle,
|
|
632
|
+
seed: input.seed ?? null,
|
|
395
633
|
compatibilityDate: input.compatibilityDate,
|
|
396
634
|
compatibilityFlags: input.compatibilityFlags ?? [],
|
|
397
635
|
routes: input.routes ?? [],
|
|
636
|
+
bypassCookies: input.bypassCookies ?? [],
|
|
398
637
|
capabilities: input.capabilities ?? {},
|
|
638
|
+
platform: { nextCache: input.nextCache ?? false },
|
|
399
639
|
},
|
|
400
640
|
variables: {
|
|
401
641
|
source: "spacefast-variables",
|
|
@@ -421,10 +661,12 @@ export const functionsExecutionStateSchema = z.enum([
|
|
|
421
661
|
"serving",
|
|
422
662
|
]);
|
|
423
663
|
/**
|
|
424
|
-
* What a live worker is, as the `
|
|
664
|
+
* What a live worker is, as the `worker` member of a space's runtime status.
|
|
665
|
+
*
|
|
666
|
+
* It carries no kind tag. The member it rides in already says which product
|
|
667
|
+
* answered, and the same tree can carry a capsule beside it — a discriminant
|
|
668
|
+
* here could only repeat the field name or contradict its sibling.
|
|
425
669
|
*
|
|
426
|
-
* Shaped like `zeroAppSchema` and discriminated by the same `runtimeKind`, so a
|
|
427
|
-
* reader switches on one field rather than probing for which product answered.
|
|
428
670
|
* No `versionId`: the status response it rides in already names the live
|
|
429
671
|
* version.
|
|
430
672
|
*
|
|
@@ -435,7 +677,6 @@ export const functionsExecutionStateSchema = z.enum([
|
|
|
435
677
|
*/
|
|
436
678
|
export const functionsAppSchema = z
|
|
437
679
|
.object({
|
|
438
|
-
runtimeKind: z.literal(FUNCTIONS_RUNTIME_KIND),
|
|
439
680
|
artifactId: z.string().min(1),
|
|
440
681
|
appName: z.string().min(1),
|
|
441
682
|
entry: z.string().min(1),
|
|
@@ -455,21 +696,3 @@ export const functionsAppSchema = z
|
|
|
455
696
|
.strict(),
|
|
456
697
|
})
|
|
457
698
|
.strict();
|
|
458
|
-
/**
|
|
459
|
-
* The wire shape of the origin's log-read route, not a public API contract.
|
|
460
|
-
*
|
|
461
|
-
* Handler logs reach callers through `GET /v1/spaces/:spaceId/logs/runtime`,
|
|
462
|
-
* which serves the platform's own `runtimeLogListResponseSchema` for both
|
|
463
|
-
* execution tiers. These aliases describe the hop underneath it: a worker tails
|
|
464
|
-
* its output to the origin that dispatched it, and the control plane reads it
|
|
465
|
-
* back from there. Keeping them named after this product is the point — the
|
|
466
|
-
* origin is the only place a wp.cloud-hosted space keeps anything, and Zero's
|
|
467
|
-
* records never travel this path at all.
|
|
468
|
-
*/
|
|
469
|
-
export const functionsLogEntrySchema = executionLogEntrySchema;
|
|
470
|
-
export const functionsLogListQuerySchema = executionLogListQuerySchema;
|
|
471
|
-
export const functionsLogListResponseSchema = executionLogListResponseSchema;
|
|
472
|
-
/** Narrows a space's live runtime kind to this product. */
|
|
473
|
-
export function isFunctionsRuntime(kind) {
|
|
474
|
-
return kind === FUNCTIONS_RUNTIME_KIND;
|
|
475
|
-
}
|
package/dist/contracts/git.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare const buildTarget: z.ZodEnum<{
|
|
|
8
8
|
export declare const buildTrigger: z.ZodEnum<{
|
|
9
9
|
push: "push";
|
|
10
10
|
manual: "manual";
|
|
11
|
-
pull_request: "pull_request";
|
|
12
11
|
retry: "retry";
|
|
12
|
+
pull_request: "pull_request";
|
|
13
13
|
}>;
|
|
14
14
|
export declare const buildEnvironmentScopeValues: readonly ["runtime", "build", "build:production", "build:preview"];
|
|
15
15
|
export declare const buildEnvironmentScope: z.ZodEnum<{
|
|
@@ -96,16 +96,16 @@ export declare const gitConnectionCreateSchema: z.ZodPipe<z.ZodObject<{
|
|
|
96
96
|
autoDeployProduction: z.ZodDefault<z.ZodBoolean>;
|
|
97
97
|
autoDeployPreviews: z.ZodDefault<z.ZodBoolean>;
|
|
98
98
|
buildSettings: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
rootDirectory: z.ZodOptional<z.
|
|
100
|
-
installDirectory: z.ZodOptional<z.
|
|
101
|
-
installCommand: z.ZodOptional<z.
|
|
102
|
-
buildCommand: z.ZodOptional<z.
|
|
103
|
-
outputDirectory: z.ZodOptional<z.
|
|
104
|
-
ignoredBuildCommand: z.ZodOptional<z.
|
|
105
|
-
frameworkPreset: z.ZodOptional<z.
|
|
106
|
-
platformPreset: z.ZodOptional<z.
|
|
107
|
-
allowUnsupportedPlatformFeatures: z.ZodOptional<z.
|
|
108
|
-
timeoutSeconds: z.ZodOptional<z.
|
|
99
|
+
rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
|
+
installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
105
|
+
frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
109
109
|
}, z.core.$strip>>;
|
|
110
110
|
}, z.core.$strip>, z.ZodTransform<{
|
|
111
111
|
productionBranch: string;
|
|
@@ -163,16 +163,16 @@ export declare const gitConnectionPatchSchema: z.ZodObject<{
|
|
|
163
163
|
autoDeployProduction: z.ZodOptional<z.ZodBoolean>;
|
|
164
164
|
autoDeployPreviews: z.ZodOptional<z.ZodBoolean>;
|
|
165
165
|
buildSettings: z.ZodOptional<z.ZodObject<{
|
|
166
|
-
rootDirectory: z.ZodOptional<z.
|
|
167
|
-
installDirectory: z.ZodOptional<z.
|
|
168
|
-
installCommand: z.ZodOptional<z.
|
|
169
|
-
buildCommand: z.ZodOptional<z.
|
|
170
|
-
outputDirectory: z.ZodOptional<z.
|
|
171
|
-
ignoredBuildCommand: z.ZodOptional<z.
|
|
172
|
-
frameworkPreset: z.ZodOptional<z.
|
|
173
|
-
platformPreset: z.ZodOptional<z.
|
|
174
|
-
allowUnsupportedPlatformFeatures: z.ZodOptional<z.
|
|
175
|
-
timeoutSeconds: z.ZodOptional<z.
|
|
166
|
+
rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
167
|
+
installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
168
|
+
installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
|
+
buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
172
|
+
frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
173
|
+
platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
|
+
allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
176
176
|
}, z.core.$strip>>;
|
|
177
177
|
}, z.core.$strip>;
|
|
178
178
|
export declare const gitConnectionAnalyzeSchema: z.ZodObject<{
|
|
@@ -249,7 +249,13 @@ export declare const githubInstallationSchema: z.ZodObject<{
|
|
|
249
249
|
htmlUrl: z.ZodNullable<z.ZodString>;
|
|
250
250
|
}, z.core.$strip>;
|
|
251
251
|
export declare const githubInstallationsResponseSchema: z.ZodObject<{
|
|
252
|
-
|
|
252
|
+
readiness: z.ZodObject<{
|
|
253
|
+
canAuthorize: z.ZodBoolean;
|
|
254
|
+
canInstall: z.ZodBoolean;
|
|
255
|
+
webhookReady: z.ZodBoolean;
|
|
256
|
+
codeStorageReady: z.ZodBoolean;
|
|
257
|
+
ready: z.ZodBoolean;
|
|
258
|
+
}, z.core.$strip>;
|
|
253
259
|
installUrl: z.ZodNullable<z.ZodString>;
|
|
254
260
|
installations: z.ZodArray<z.ZodObject<{
|
|
255
261
|
id: z.ZodString;
|
|
@@ -258,18 +264,6 @@ export declare const githubInstallationsResponseSchema: z.ZodObject<{
|
|
|
258
264
|
htmlUrl: z.ZodNullable<z.ZodString>;
|
|
259
265
|
}, z.core.$strip>>;
|
|
260
266
|
}, z.core.$strip>;
|
|
261
|
-
export declare const githubInstallationClaimSchema: z.ZodObject<{
|
|
262
|
-
installationId: z.ZodString;
|
|
263
|
-
state: z.ZodString;
|
|
264
|
-
}, z.core.$strip>;
|
|
265
|
-
export declare const githubInstallationClaimResponseSchema: z.ZodObject<{
|
|
266
|
-
installation: z.ZodObject<{
|
|
267
|
-
id: z.ZodString;
|
|
268
|
-
accountLogin: z.ZodString;
|
|
269
|
-
accountType: z.ZodNullable<z.ZodString>;
|
|
270
|
-
htmlUrl: z.ZodNullable<z.ZodString>;
|
|
271
|
-
}, z.core.$strip>;
|
|
272
|
-
}, z.core.$strip>;
|
|
273
267
|
export declare const githubRepositorySchema: z.ZodObject<{
|
|
274
268
|
id: z.ZodString;
|
|
275
269
|
name: z.ZodString;
|
package/dist/contracts/git.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { BuildSettingsSchema } from "./builds.js";
|
|
2
|
+
import { BuildSettingsOverrideSchema, BuildSettingsSchema } from "./builds.js";
|
|
3
3
|
import { gitProvider } from "./enums.js";
|
|
4
4
|
const nullableString = z.string().trim().min(1).nullable();
|
|
5
5
|
export const buildTargetValues = ["production", "preview"];
|
|
@@ -55,7 +55,7 @@ export const gitConnectionCreateSchema = z
|
|
|
55
55
|
credential: z.string().trim().min(1).nullable().optional(),
|
|
56
56
|
autoDeployProduction: z.boolean().default(true),
|
|
57
57
|
autoDeployPreviews: z.boolean().default(true),
|
|
58
|
-
buildSettings:
|
|
58
|
+
buildSettings: BuildSettingsOverrideSchema.optional(),
|
|
59
59
|
})
|
|
60
60
|
.transform((value) => ({
|
|
61
61
|
...value,
|
|
@@ -67,7 +67,7 @@ export const gitConnectionPatchSchema = z.object({
|
|
|
67
67
|
credential: z.string().trim().min(1).nullable().optional(),
|
|
68
68
|
autoDeployProduction: z.boolean().optional(),
|
|
69
69
|
autoDeployPreviews: z.boolean().optional(),
|
|
70
|
-
buildSettings:
|
|
70
|
+
buildSettings: BuildSettingsOverrideSchema.optional(),
|
|
71
71
|
});
|
|
72
72
|
export const gitConnectionAnalyzeSchema = z.object({
|
|
73
73
|
ref: z.string().trim().min(1).optional(),
|
|
@@ -95,17 +95,16 @@ export const githubInstallationSchema = z.object({
|
|
|
95
95
|
htmlUrl: z.string().url().nullable(),
|
|
96
96
|
});
|
|
97
97
|
export const githubInstallationsResponseSchema = z.object({
|
|
98
|
-
|
|
98
|
+
readiness: z.object({
|
|
99
|
+
canAuthorize: z.boolean(),
|
|
100
|
+
canInstall: z.boolean(),
|
|
101
|
+
webhookReady: z.boolean(),
|
|
102
|
+
codeStorageReady: z.boolean(),
|
|
103
|
+
ready: z.boolean(),
|
|
104
|
+
}),
|
|
99
105
|
installUrl: z.string().url().nullable(),
|
|
100
106
|
installations: z.array(githubInstallationSchema),
|
|
101
107
|
});
|
|
102
|
-
export const githubInstallationClaimSchema = z.object({
|
|
103
|
-
installationId: z.string().trim().min(1),
|
|
104
|
-
state: z.string().trim().min(1),
|
|
105
|
-
});
|
|
106
|
-
export const githubInstallationClaimResponseSchema = z.object({
|
|
107
|
-
installation: githubInstallationSchema,
|
|
108
|
-
});
|
|
109
108
|
export const githubRepositorySchema = z.object({
|
|
110
109
|
id: z.string(),
|
|
111
110
|
name: z.string(),
|
|
@@ -8,15 +8,12 @@ export declare const grantCapabilitySchema: z.ZodEnum<{
|
|
|
8
8
|
"access.manage": "access.manage";
|
|
9
9
|
}>;
|
|
10
10
|
export type GrantCapability = z.infer<typeof grantCapabilitySchema>;
|
|
11
|
-
export declare const GRANT_CAPABILITY_PRESETS: readonly ["view", "comment", "publish", "manage"];
|
|
12
|
-
export type GrantCapabilityPreset = (typeof GRANT_CAPABILITY_PRESETS)[number];
|
|
13
|
-
export declare const GRANT_PRESET_CAPABILITIES: Record<GrantCapabilityPreset, GrantCapability[]>;
|
|
14
11
|
export declare const GRANT_AUDIENCE_KINDS: readonly ["public", "team", "person", "link", "password", "machine", "external"];
|
|
15
12
|
export declare const grantAudienceKindSchema: z.ZodEnum<{
|
|
16
13
|
link: "link";
|
|
17
14
|
team: "team";
|
|
18
|
-
external: "external";
|
|
19
15
|
public: "public";
|
|
16
|
+
external: "external";
|
|
20
17
|
person: "person";
|
|
21
18
|
password: "password";
|
|
22
19
|
machine: "machine";
|
|
@@ -427,8 +424,8 @@ export declare const grantCheckQuerySchema: z.ZodObject<{
|
|
|
427
424
|
audience: z.ZodDefault<z.ZodEnum<{
|
|
428
425
|
link: "link";
|
|
429
426
|
team: "team";
|
|
430
|
-
external: "external";
|
|
431
427
|
public: "public";
|
|
428
|
+
external: "external";
|
|
432
429
|
person: "person";
|
|
433
430
|
password: "password";
|
|
434
431
|
machine: "machine";
|
|
@@ -1079,6 +1076,13 @@ export declare const identityConnectionPublicKeySchema: z.ZodObject<{
|
|
|
1079
1076
|
publicKey: z.ZodString;
|
|
1080
1077
|
}, z.core.$strict>;
|
|
1081
1078
|
export type IdentityConnectionPublicKey = z.infer<typeof identityConnectionPublicKeySchema>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Issuers the platform stamps on its own external Grants. A Team-configured
|
|
1081
|
+
* connection may not claim one: the authority reference an external audience
|
|
1082
|
+
* resolves to is derived from (issuer, subject), and these three resolve into
|
|
1083
|
+
* the platform's own `member:` / `claim-preview:` / owner namespaces.
|
|
1084
|
+
*/
|
|
1085
|
+
export declare const RESERVED_IDENTITY_CONNECTION_ISSUERS: readonly ["spacefast-membership", "claim-preview", "spacefast-owner"];
|
|
1082
1086
|
export declare const identityConnectionCreateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1083
1087
|
type: z.ZodLiteral<"oidc">;
|
|
1084
1088
|
name: z.ZodString;
|