@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
|
@@ -3,46 +3,33 @@ import { type ExecutionCapabilities } from "./execution.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Spacefast Functions: tenant workers run as Cloudflare Dynamic Workers.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* negotiable and that together rule out the obvious architecture:
|
|
6
|
+
* Two constraints shape the product:
|
|
8
7
|
*
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
8
|
+
* 1. Cloudflare is reached from wp.cloud, never from the control plane. The
|
|
9
|
+
* control plane records intent; the space's own origin makes every
|
|
11
10
|
* Cloudflare call.
|
|
12
|
-
* 2.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `/_next/static/*` and friends never leave our origin.
|
|
11
|
+
* 2. Every asset is served by wp.cloud. A worker receives only the requests
|
|
12
|
+
* that could not be answered from bytes on disk, so `/_next/static/*` and
|
|
13
|
+
* friends never leave our origin.
|
|
16
14
|
*
|
|
17
|
-
* Dynamic Workers
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* script lifecycle
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* cache, not a record.
|
|
24
|
-
*
|
|
25
|
-
* That also keeps the exit cheap. The contract below is "here is a module
|
|
26
|
-
* graph, here is its configuration, run it", which is workerd's own shape; the
|
|
27
|
-
* managed runtime is an implementation of it rather than the thing we built
|
|
28
|
-
* against.
|
|
29
|
-
*
|
|
30
|
-
* What the worker gets in exchange is the thing we could not build: a real V8
|
|
31
|
-
* isolate that runs npm packages and framework output — OpenNext Next.js among
|
|
32
|
-
* them — without us having to sandbox any of it.
|
|
15
|
+
* Dynamic Workers holds both at once. There is no upload: a version's bundle
|
|
16
|
+
* stays in its own content store on wp.cloud and the host worker pulls it
|
|
17
|
+
* through the Worker Loader binding, so no artefact of ours lives on Cloudflare
|
|
18
|
+
* and there is no script lifecycle to manage. What the worker buys is a real V8
|
|
19
|
+
* isolate running npm packages and framework output, OpenNext Next.js among
|
|
20
|
+
* them, without us sandboxing any of it.
|
|
33
21
|
*
|
|
34
22
|
* The cost is that the worker is a continent away from the space's MySQL.
|
|
35
23
|
* `ctx.db` therefore travels back over an HTTPS relay to the same PHP broker
|
|
36
24
|
* the local tier speaks to over a pipe, which is slower and batched rather
|
|
37
25
|
* than transactional. That is why capsules are a different product rather
|
|
38
|
-
* than a placement option
|
|
26
|
+
* than a placement option. See `endpointIsPortable` in `./execution.js`.
|
|
39
27
|
*/
|
|
40
28
|
/**
|
|
41
|
-
* The tag a compiled worker artifact carries
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* version declares: a publish can carry this beside a capsule.
|
|
29
|
+
* The tag a compiled worker artifact carries, so the PHP origin can tell what
|
|
30
|
+
* it is dispatching. `functions-dispatch.php` refuses any other tag. It is a
|
|
31
|
+
* property of the artifact, not a kind a space or a version declares: a publish
|
|
32
|
+
* can carry this beside a capsule.
|
|
46
33
|
*/
|
|
47
34
|
export declare const FUNCTIONS_RUNTIME_KIND = "functions";
|
|
48
35
|
export declare const FUNCTIONS_SOURCE_METADATA_KEY = "spacefastFunctions";
|
|
@@ -51,59 +38,190 @@ export declare const FUNCTIONS_RUNTIME_ROUTE_PATHS: {
|
|
|
51
38
|
readonly logs: "/__spacefast/functions/logs";
|
|
52
39
|
/** Where a dispatched worker calls back for brokered capabilities. */
|
|
53
40
|
readonly relay: "/__spacefast/functions/relay";
|
|
41
|
+
/**
|
|
42
|
+
* Where the execution host asks the space origin to drop cached responses:
|
|
43
|
+
* an OpenNext `revalidatePath` must reach the CDN in front of wp.cloud, and
|
|
44
|
+
* only the origin can speak for its own cache. Authenticated with the
|
|
45
|
+
* version-scoped purge credential in the `sf-purge-token` request header.
|
|
46
|
+
*/
|
|
47
|
+
readonly purge: "/__spacefast/functions/purge";
|
|
54
48
|
};
|
|
55
49
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
50
|
+
* The header the execution host presents at the origin purge route. Outside the
|
|
51
|
+
* `sf-fx-` namespace because that prefix names dispatch instructions the origin
|
|
52
|
+
* SENDS, and is stripped from anything inbound before tenant code.
|
|
53
|
+
*/
|
|
54
|
+
export declare const FUNCTIONS_PURGE_TOKEN_HEADER = "sf-purge-token";
|
|
55
|
+
/**
|
|
56
|
+
* The credential a space origin presents to the execution host on every
|
|
57
|
+
* dispatch (`sf-fx-dispatch-token`), and the audience that identifies it.
|
|
58
|
+
*
|
|
59
|
+
* It is a PER-SITE token, not a fleet secret. The control plane mints one
|
|
60
|
+
* Ed25519 JWT per wp.cloud box, bound to that box's `runtime_instance_id`, and
|
|
61
|
+
* writes it into that box's persistent data. The host verifies the signature
|
|
62
|
+
* against the control plane's public key and takes the site identity from the
|
|
63
|
+
* verified claim rather than from anything the caller asserts.
|
|
58
64
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
65
|
+
* Tenant PHP runs on the same box and can read the box's own configuration, so
|
|
66
|
+
* assume the tenant can read this credential. A per-site token read once still
|
|
67
|
+
* speaks only for its own site: the host refuses any bundle whose signed token
|
|
68
|
+
* names a different `runtime_instance_id`. Signing is EdDSA rather than HMAC so
|
|
69
|
+
* that no signing material sits on the edge, where a host compromise would mint
|
|
70
|
+
* dispatch credentials for the whole fleet.
|
|
71
|
+
*/
|
|
72
|
+
export declare const FUNCTIONS_DISPATCH_TOKEN_AUD = "spacefast-functions-dispatch";
|
|
73
|
+
/**
|
|
74
|
+
* Pinned by every verifier rather than read from the token's own header.
|
|
75
|
+
* Accepting the presented `alg` is how `alg: none` forgeries work.
|
|
76
|
+
*/
|
|
77
|
+
export declare const FUNCTIONS_TOKEN_ALG = "EdDSA";
|
|
78
|
+
/**
|
|
79
|
+
* Ten years, like the bundle and relay credentials: the token is not re-mintable
|
|
80
|
+
* on any request path. It reaches a box only through a wp.cloud persistent-data
|
|
81
|
+
* sync at provisioning and on maintenance sweeps, so a shorter clock would take
|
|
82
|
+
* a quiet box offline rather than protect it. Scope is the boundary, and
|
|
83
|
+
* rotating the platform signing key invalidates every token at once.
|
|
84
|
+
*/
|
|
85
|
+
export declare const FUNCTIONS_DISPATCH_TOKEN_TTL_SECONDS: number;
|
|
86
|
+
/**
|
|
87
|
+
* What the execution host requires of a dispatch credential before it believes
|
|
88
|
+
* anything else in the request. One signing key mints every platform token, so
|
|
89
|
+
* the pinned audience is what keeps them from meaning one authority.
|
|
90
|
+
*/
|
|
91
|
+
export declare const functionsDispatchTokenClaimsSchema: z.ZodObject<{
|
|
92
|
+
aud: z.ZodLiteral<"spacefast-functions-dispatch">;
|
|
93
|
+
runtime_instance_id: z.ZodString;
|
|
94
|
+
exp: z.ZodNumber;
|
|
95
|
+
nbf: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export type FunctionsDispatchTokenClaims = z.infer<typeof functionsDispatchTokenClaimsSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* The claims carried by the token inside a signed bundle or seed URL. The
|
|
100
|
+
* audience stays open because both artifacts share this shape and are separated
|
|
101
|
+
* by their own audience check at the point of use: a bundle grant must never
|
|
102
|
+
* authorise a seed read.
|
|
103
|
+
*/
|
|
104
|
+
export declare const functionsArtifactTokenClaimsSchema: z.ZodObject<{
|
|
105
|
+
aud: z.ZodString;
|
|
106
|
+
runtime_instance_id: z.ZodString;
|
|
107
|
+
space_id: z.ZodString;
|
|
108
|
+
version_id: z.ZodString;
|
|
109
|
+
sha256: z.ZodString;
|
|
110
|
+
exp: z.ZodNumber;
|
|
111
|
+
nbf: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export type FunctionsArtifactTokenClaims = z.infer<typeof functionsArtifactTokenClaimsSchema>;
|
|
114
|
+
/**
|
|
115
|
+
* Whether a compact JWT's protected header declares the one algorithm this
|
|
116
|
+
* platform signs with. Pinned rather than trusted: a verifier that takes the
|
|
117
|
+
* token's own word for `alg` accepts `alg: none`.
|
|
118
|
+
*/
|
|
119
|
+
export declare function functionsTokenHeaderIsSigned(headerJson: string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Claim readers for an already signature-verified payload. They live beside the
|
|
122
|
+
* mint-side constants so the control plane's audiences and the host's required
|
|
123
|
+
* claims stay one definition rather than two that agree today.
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseFunctionsDispatchTokenClaims(claimsJson: string): FunctionsDispatchTokenClaims | null;
|
|
126
|
+
export declare function parseFunctionsArtifactTokenClaims(claimsJson: string): FunctionsArtifactTokenClaims | null;
|
|
127
|
+
/**
|
|
128
|
+
* Where invocation counts are reported, on the CONTROL PLANE rather than the
|
|
129
|
+
* space origin. Logs are the tenant's content and stay on their own origin;
|
|
130
|
+
* usage is a number the platform bills from. One shared channel would put log
|
|
131
|
+
* volume on the path that has to stay cheap.
|
|
64
132
|
*/
|
|
65
133
|
export declare const FUNCTIONS_USAGE_INTAKE_PATH = "/v1/runtime/functions/usage";
|
|
66
134
|
/** Public, signed read path. Distinct from storage so the token is never a filename. */
|
|
67
135
|
export declare const FUNCTIONS_BUNDLE_ROUTE_PREFIX = "/__spacefast/functions/b";
|
|
68
136
|
export declare const FUNCTIONS_RUNTIME_STORAGE_ROOT = "__spacefast/functions";
|
|
69
137
|
/**
|
|
70
|
-
* Where a version's compiled bundle lives
|
|
138
|
+
* Where a version's compiled bundle lives, under the same `__spacefast/` prefix
|
|
139
|
+
* as every other platform-owned path. Two consequences, both wanted:
|
|
71
140
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
141
|
+
* - Not servable as static content. The runtime treats the whole prefix as
|
|
142
|
+
* control paths, so a tenant's compiled source is not readable at a guessable
|
|
143
|
+
* URL, and the digest that would make it guessable appears in build output.
|
|
144
|
+
* - Written by the ordinary publish path. The upload policy carves out exactly
|
|
145
|
+
* this subtree (`publish-policy.ts`), so the bundle rides the normal manifest
|
|
146
|
+
* and upload passes.
|
|
75
147
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* build output.
|
|
80
|
-
* - It is written by the ordinary publish path anyway. The upload policy
|
|
81
|
-
* carves out exactly this subtree (`publish-policy.ts`), so the bundle rides
|
|
82
|
-
* the normal manifest and upload passes instead of needing a parallel one.
|
|
83
|
-
*
|
|
84
|
-
* The dispatch configuration — host, capabilities, relay credential — is not
|
|
85
|
-
* here and is not content at all. The engine writes it beside the version's
|
|
86
|
-
* file tree rather than inside it, exactly as it does for Zero, so a publish
|
|
87
|
-
* cannot reach it: no carve-out, no upload path, nothing to guard. A publish
|
|
88
|
-
* able to write that file would be a publish able to grant itself authority it
|
|
89
|
-
* was never given.
|
|
148
|
+
* The dispatch configuration is not here and is not content at all. The engine
|
|
149
|
+
* writes it beside the version's file tree, as it does for Zero, so a publish
|
|
150
|
+
* cannot reach it and cannot grant itself authority it was never given.
|
|
90
151
|
*/
|
|
91
152
|
export declare const FUNCTIONS_RUNTIME_BUNDLE_ROOT = "__spacefast/functions/bundles";
|
|
153
|
+
/**
|
|
154
|
+
* Where a version's Next-cache seed document lives: the build-time prerender
|
|
155
|
+
* and fetch-cache entries that warm the execution host's cache object, so the
|
|
156
|
+
* first visitor gets the page the build rendered. A sibling of `bundles/` with
|
|
157
|
+
* the same properties, publishable through the ordinary upload path with its
|
|
158
|
+
* own carve-out in publish-policy, never servable as static content, read back
|
|
159
|
+
* only through the signed artifact route.
|
|
160
|
+
*/
|
|
161
|
+
export declare const FUNCTIONS_RUNTIME_SEED_ROOT = "__spacefast/functions/seeds";
|
|
92
162
|
export declare const FUNCTIONS_BUNDLE_FORMAT = "spacefast.functions.bundle.v1";
|
|
163
|
+
export declare const FUNCTIONS_SEED_FORMAT = "spacefast.functions.seed.v1";
|
|
93
164
|
/**
|
|
94
|
-
* Ceiling on a bundle's decoded size
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* memory before instantiating anything. Set below the runtime's own script
|
|
99
|
-
* limit so an oversized build fails in our tooling, where we can say which
|
|
165
|
+
* Ceiling on a bundle's decoded size, and so on how much the host holds in
|
|
166
|
+
* memory before instantiating: the whole module graph arrives in one response,
|
|
167
|
+
* so a cold isolate costs a single round trip. Set below the runtime's own
|
|
168
|
+
* script limit, so an oversized build fails in our tooling, which can say which
|
|
100
169
|
* modules are large, rather than at dispatch, where the tenant sees a 502.
|
|
101
170
|
*/
|
|
102
171
|
export declare const FUNCTIONS_BUNDLE_MAX_BYTES: number;
|
|
103
172
|
/**
|
|
104
|
-
*
|
|
105
|
-
* the
|
|
106
|
-
*
|
|
173
|
+
* Ceilings on the cache seed document. Per-entry mirrors the cache object's own
|
|
174
|
+
* row limit; the total bounds what the host pulls and ingests on a cold cache.
|
|
175
|
+
* Both are enforced in the CLI, where an overflow can say WHICH pages were left
|
|
176
|
+
* out. An omitted entry renders live on first request like any cache miss.
|
|
177
|
+
*/
|
|
178
|
+
export declare const FUNCTIONS_SEED_ENTRY_MAX_BYTES: number;
|
|
179
|
+
export declare const FUNCTIONS_SEED_MAX_BYTES: number;
|
|
180
|
+
/**
|
|
181
|
+
* One warm-cache entry: what the runtime's incremental-cache client would have
|
|
182
|
+
* written for `key` had it rendered the page itself. `valueJson` stays the JSON
|
|
183
|
+
* string it already is on disk (OpenNext's `.cache` / fetch-cache files), so the
|
|
184
|
+
* seed writer and the cache client cannot disagree about serialization.
|
|
185
|
+
*/
|
|
186
|
+
export declare const functionsSeedEntrySchema: z.ZodObject<{
|
|
187
|
+
key: z.ZodString;
|
|
188
|
+
cacheType: z.ZodEnum<{
|
|
189
|
+
fetch: "fetch";
|
|
190
|
+
cache: "cache";
|
|
191
|
+
}>;
|
|
192
|
+
valueJson: z.ZodString;
|
|
193
|
+
lastModified: z.ZodNumber;
|
|
194
|
+
}, z.core.$strict>;
|
|
195
|
+
export type FunctionsSeedEntry = z.infer<typeof functionsSeedEntrySchema>;
|
|
196
|
+
/** The document served at a seed URL; host and CLI validate the same shape. */
|
|
197
|
+
export declare const functionsSeedManifestSchema: z.ZodObject<{
|
|
198
|
+
format: z.ZodLiteral<"spacefast.functions.seed.v1">;
|
|
199
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
200
|
+
key: z.ZodString;
|
|
201
|
+
cacheType: z.ZodEnum<{
|
|
202
|
+
fetch: "fetch";
|
|
203
|
+
cache: "cache";
|
|
204
|
+
}>;
|
|
205
|
+
valueJson: z.ZodString;
|
|
206
|
+
lastModified: z.ZodNumber;
|
|
207
|
+
}, z.core.$strict>>;
|
|
208
|
+
}, z.core.$strict>;
|
|
209
|
+
export type FunctionsSeedManifest = z.infer<typeof functionsSeedManifestSchema>;
|
|
210
|
+
/**
|
|
211
|
+
* How many entries the origin's dispatch table accepts. Exported because the CLI
|
|
212
|
+
* classifier compacts its route claims BEFORE assembling the artifact: meeting
|
|
213
|
+
* the ceiling as a finalize error would fail a build that classified fine.
|
|
214
|
+
*/
|
|
215
|
+
export declare const FUNCTIONS_MAX_ROUTES = 256;
|
|
216
|
+
/**
|
|
217
|
+
* A worker's dynamic route table. Anything not matched here is answered from the
|
|
218
|
+
* version's static content by wp.cloud and never reaches Cloudflare.
|
|
219
|
+
*
|
|
220
|
+
* A `subtree` entry covers its own path AND everything below it: the engine
|
|
221
|
+
* expands one into both `path` and `path/:splat`
|
|
222
|
+
* (`_stattic_runtime_functions_routes_artifact`, runtime/engine/admin/management.php).
|
|
223
|
+
* So `wholeSiteRoutes()` is a single `/` subtree entry, and an exact entry beside
|
|
224
|
+
* a subtree entry at the same path is dead weight.
|
|
107
225
|
*/
|
|
108
226
|
export declare const functionsRouteSchema: z.ZodObject<{
|
|
109
227
|
method: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
@@ -123,8 +241,9 @@ export type FunctionsRoute = z.infer<typeof functionsRouteSchema>;
|
|
|
123
241
|
* One module in a bundle, in the shape the Worker Loader consumes.
|
|
124
242
|
*
|
|
125
243
|
* `commonjs` exists because bundlers still emit it and rejecting it would fail
|
|
126
|
-
* builds for a format the runtime accepts. Binary
|
|
127
|
-
*
|
|
244
|
+
* builds for a format the runtime accepts. Binary modules cross this JSON wire
|
|
245
|
+
* format as base64; the Functions host turns them back into ArrayBuffers at the
|
|
246
|
+
* Worker Loader boundary.
|
|
128
247
|
*/
|
|
129
248
|
export declare const functionsBundleModuleSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
130
249
|
js: z.ZodString;
|
|
@@ -134,15 +253,16 @@ export declare const functionsBundleModuleSchema: z.ZodUnion<readonly [z.ZodObje
|
|
|
134
253
|
text: z.ZodString;
|
|
135
254
|
}, z.core.$strict>, z.ZodObject<{
|
|
136
255
|
json: z.ZodUnknown;
|
|
256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
257
|
+
wasm: z.ZodString;
|
|
258
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
259
|
+
data: z.ZodString;
|
|
137
260
|
}, z.core.$strict>]>;
|
|
138
261
|
export type FunctionsBundleModule = z.infer<typeof functionsBundleModuleSchema>;
|
|
139
262
|
/**
|
|
140
|
-
* The document served at a bundle URL and parsed by the host.
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* of it living here: the CLI's bundler and the host's loader are separate
|
|
144
|
-
* deployments that must agree, and the only thing keeping them honest is a
|
|
145
|
-
* shared definition of the bytes in between.
|
|
263
|
+
* The document served at a bundle URL and parsed by the host. The CLI's bundler
|
|
264
|
+
* and the host's loader are separate deployments, and this shared definition is
|
|
265
|
+
* the only thing keeping them agreed on the bytes in between.
|
|
146
266
|
*/
|
|
147
267
|
export declare const functionsBundleManifestSchema: z.ZodObject<{
|
|
148
268
|
format: z.ZodLiteral<"spacefast.functions.bundle.v1">;
|
|
@@ -155,15 +275,18 @@ export declare const functionsBundleManifestSchema: z.ZodObject<{
|
|
|
155
275
|
text: z.ZodString;
|
|
156
276
|
}, z.core.$strict>, z.ZodObject<{
|
|
157
277
|
json: z.ZodUnknown;
|
|
278
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
279
|
+
wasm: z.ZodString;
|
|
280
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
281
|
+
data: z.ZodString;
|
|
158
282
|
}, z.core.$strict>]>>;
|
|
159
283
|
}, z.core.$strict>;
|
|
160
284
|
export type FunctionsBundleManifest = z.infer<typeof functionsBundleManifestSchema>;
|
|
161
285
|
/**
|
|
162
286
|
* Where the worker's compiled bytes live in the version's own content store.
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* forbids.
|
|
287
|
+
* Not inline in the finalize payload like Zero's bundles: framework output runs
|
|
288
|
+
* to megabytes, and inlining it would push the whole thing through the control
|
|
289
|
+
* plane, which the direct-from-wp.cloud rule forbids.
|
|
167
290
|
*/
|
|
168
291
|
export declare const functionsBundleRefSchema: z.ZodObject<{
|
|
169
292
|
path: z.ZodString;
|
|
@@ -172,35 +295,56 @@ export declare const functionsBundleRefSchema: z.ZodObject<{
|
|
|
172
295
|
}, z.core.$strict>;
|
|
173
296
|
export type FunctionsBundleRef = z.infer<typeof functionsBundleRefSchema>;
|
|
174
297
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
|
|
179
|
-
|
|
298
|
+
* Where a version's cache seed document sits in its content store, the bundle
|
|
299
|
+
* ref's sibling with the seed's own root and ceiling. `entries` is carried so
|
|
300
|
+
* status surfaces can say what the seed holds without fetching it.
|
|
301
|
+
*/
|
|
302
|
+
export declare const functionsSeedRefSchema: z.ZodObject<{
|
|
303
|
+
path: z.ZodString;
|
|
304
|
+
sha256: z.ZodString;
|
|
305
|
+
size: z.ZodNumber;
|
|
306
|
+
entries: z.ZodNumber;
|
|
307
|
+
}, z.core.$strict>;
|
|
308
|
+
export type FunctionsSeedRef = z.infer<typeof functionsSeedRefSchema>;
|
|
309
|
+
/**
|
|
310
|
+
* The path a bundle is served from. Content-addressed, so the response is
|
|
311
|
+
* immutable and cacheable at our edge forever: a cold isolate anywhere costs one
|
|
312
|
+
* CDN hit rather than a round trip to the space's origin.
|
|
180
313
|
*
|
|
181
|
-
* The token rides in the path rather than the query string for
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* another space's URL.
|
|
314
|
+
* The token rides in the path rather than the query string for the same reason.
|
|
315
|
+
* A query parameter is subject to cache-key normalisation, and a token stripped
|
|
316
|
+
* from the key would let one space's cached bundle answer another space's URL.
|
|
185
317
|
*
|
|
186
|
-
* Both halves are load-bearing. The digest
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* rotating the site secret invalidates every URL at once.
|
|
318
|
+
* Both halves are load-bearing. The digest is derivable by anyone holding the
|
|
319
|
+
* bytes and shows up in build output and `sf runtime status`. The token adds
|
|
320
|
+
* what the digest cannot: holding the code does not entitle you to fetch it from
|
|
321
|
+
* us, and rotating the site secret invalidates every URL at once.
|
|
191
322
|
*/
|
|
192
323
|
export declare function functionsBundlePath(input: {
|
|
193
324
|
sha256: string;
|
|
194
325
|
token: string;
|
|
195
326
|
}): string;
|
|
196
327
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
328
|
+
* The seed document's read path: the bundle route with a different terminal
|
|
329
|
+
* filename and its own token audience. One signed artifact route on the origin
|
|
330
|
+
* serves both.
|
|
331
|
+
*/
|
|
332
|
+
export declare function functionsSeedPath(input: {
|
|
333
|
+
sha256: string;
|
|
334
|
+
token: string;
|
|
335
|
+
}): string;
|
|
336
|
+
/**
|
|
337
|
+
* Where the bundle sits in the published version, the same path minus the token
|
|
338
|
+
* segment. The token authorises the read; it does not name the file, so rotating
|
|
339
|
+
* the signing key changes every URL without moving a byte.
|
|
200
340
|
*/
|
|
201
341
|
export declare function functionsBundleStoragePath(input: {
|
|
202
342
|
sha256: string;
|
|
203
343
|
}): string;
|
|
344
|
+
/** The seed's storage twin of `functionsBundleStoragePath`. */
|
|
345
|
+
export declare function functionsSeedStoragePath(input: {
|
|
346
|
+
sha256: string;
|
|
347
|
+
}): string;
|
|
204
348
|
export declare const functionsWorkerArtifactSchema: z.ZodObject<{
|
|
205
349
|
format: z.ZodLiteral<"spacefast.functions.worker.v1">;
|
|
206
350
|
appName: z.ZodString;
|
|
@@ -211,6 +355,12 @@ export declare const functionsWorkerArtifactSchema: z.ZodObject<{
|
|
|
211
355
|
sha256: z.ZodString;
|
|
212
356
|
size: z.ZodNumber;
|
|
213
357
|
}, z.core.$strict>;
|
|
358
|
+
seed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
359
|
+
path: z.ZodString;
|
|
360
|
+
sha256: z.ZodString;
|
|
361
|
+
size: z.ZodNumber;
|
|
362
|
+
entries: z.ZodNumber;
|
|
363
|
+
}, z.core.$strict>>>;
|
|
214
364
|
compatibilityDate: z.ZodString;
|
|
215
365
|
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
216
366
|
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -226,6 +376,7 @@ export declare const functionsWorkerArtifactSchema: z.ZodObject<{
|
|
|
226
376
|
path: z.ZodString;
|
|
227
377
|
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
228
378
|
}, z.core.$strict>>>;
|
|
379
|
+
bypassCookies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
229
380
|
capabilities: z.ZodDefault<z.ZodObject<{
|
|
230
381
|
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
231
382
|
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -236,6 +387,7 @@ export declare const functionsWorkerArtifactSchema: z.ZodObject<{
|
|
|
236
387
|
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
237
388
|
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
238
389
|
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
390
|
+
content: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
239
391
|
}, z.core.$strip>>;
|
|
240
392
|
platform: z.ZodDefault<z.ZodObject<{
|
|
241
393
|
nextCache: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -244,12 +396,10 @@ export declare const functionsWorkerArtifactSchema: z.ZodObject<{
|
|
|
244
396
|
export type FunctionsWorkerArtifact = z.infer<typeof functionsWorkerArtifactSchema>;
|
|
245
397
|
/**
|
|
246
398
|
* The authority a dispatched worker may exercise, in the vocabulary the host
|
|
247
|
-
* speaks on the wire.
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* *grants*, resolved by the control plane at finalize so the origin forwards a
|
|
252
|
-
* decision rather than making one. Anything absent fails closed at the relay.
|
|
399
|
+
* speaks on the wire. Narrower than `executionCapabilitiesSchema`, which records
|
|
400
|
+
* what a build *declared* it uses; this is what the origin *grants*, resolved by
|
|
401
|
+
* the control plane at finalize so the origin forwards a decision rather than
|
|
402
|
+
* making one. Anything absent fails closed at the relay.
|
|
253
403
|
*/
|
|
254
404
|
export declare const FUNCTIONS_DISPATCH_CAPABILITIES: readonly ["storage.read", "storage.write", "db.read", "db.write", "fetch", "log", "next.cache", "gravatar.profile", "spam.check", "email.send"];
|
|
255
405
|
export declare const functionsDispatchCapabilitySchema: z.ZodEnum<{
|
|
@@ -268,24 +418,17 @@ export type FunctionsDispatchCapability = z.infer<typeof functionsDispatchCapabi
|
|
|
268
418
|
/**
|
|
269
419
|
* Resolves a build's declared capabilities into the grant a dispatch carries.
|
|
270
420
|
*
|
|
271
|
-
* Three declared capabilities have no dispatch counterpart
|
|
272
|
-
* reason:
|
|
421
|
+
* Three declared capabilities have no dispatch counterpart:
|
|
273
422
|
*
|
|
274
423
|
* - `env` is not a runtime call at all. Values are resolved at finalize and
|
|
275
424
|
* travel in the config, so a worker reading `env` reaches nothing.
|
|
276
|
-
* - `auth` and `realtime` bind a handler to the local tier
|
|
277
|
-
*
|
|
278
|
-
* never arrives here.
|
|
279
|
-
*
|
|
280
|
-
* `db` widens to both read and write because a declaration says a handler
|
|
281
|
-
* touches the database, not how. Narrowing it would take per-statement analysis
|
|
282
|
-
* we do not do, and guessing "read-only" from a declaration would be a grant
|
|
283
|
-
* the author never asked for and cannot see.
|
|
425
|
+
* - `auth` and `realtime` bind a handler to the local tier, so code declaring
|
|
426
|
+
* them deploys as a capsule and never arrives here. See `endpointIsPortable`.
|
|
284
427
|
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
428
|
+
* `db` widens to both read and write, and each platform-service grant covers its
|
|
429
|
+
* service's whole operation set, because a declaration says a handler touches
|
|
430
|
+
* the database or checks for spam, not how. Narrowing would take per-statement
|
|
431
|
+
* analysis we do not do.
|
|
289
432
|
*/
|
|
290
433
|
export declare function functionsDispatchCapabilities(capabilities: ExecutionCapabilities, platform?: {
|
|
291
434
|
nextCache?: boolean;
|
|
@@ -293,28 +436,26 @@ export declare function functionsDispatchCapabilities(capabilities: ExecutionCap
|
|
|
293
436
|
/** Logs and the host-local Next cache do not transit the origin relay. */
|
|
294
437
|
export declare function functionsGrantNeedsRelay(granted: readonly FunctionsDispatchCapability[]): boolean;
|
|
295
438
|
/**
|
|
296
|
-
* What the space origin needs
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* over HTTPS and holds no Cloudflare API credential at all.
|
|
439
|
+
* What the space origin needs to dispatch to the host on its own. The shared
|
|
440
|
+
* secret is a wp.cloud site secret, never part of a version's content and never
|
|
441
|
+
* reachable by tenant code, so it is not modelled here. There is no account id
|
|
442
|
+
* and no namespace: the origin talks to one host worker over HTTPS and holds no
|
|
443
|
+
* Cloudflare API credential.
|
|
302
444
|
*/
|
|
303
445
|
export declare const functionsHostConfigSchema: z.ZodObject<{
|
|
304
446
|
hostname: z.ZodString;
|
|
305
447
|
bundleUrl: z.ZodString;
|
|
448
|
+
seedUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
306
449
|
}, z.core.$strict>;
|
|
307
450
|
export type FunctionsHostConfig = z.infer<typeof functionsHostConfigSchema>;
|
|
308
451
|
/**
|
|
309
452
|
* The callback a dispatched worker uses for `ctx.db`, `ctx.fetch` and logging.
|
|
310
453
|
*
|
|
311
|
-
* Each relay call re-enters the space's PHP-FPM pool,
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* against the PHP broker, batching twenty writes into one call is 8.3x faster
|
|
317
|
-
* than twenty separate ones.
|
|
454
|
+
* Each relay call re-enters the space's PHP-FPM pool, the deadlock hazard this
|
|
455
|
+
* product's admission control bounds: a proxied request occupies a worker for
|
|
456
|
+
* its whole life while its relay calls demand more. Batching is the other half.
|
|
457
|
+
* Against the PHP broker, twenty writes in one call is 8.3x faster than twenty
|
|
458
|
+
* separate ones.
|
|
318
459
|
*/
|
|
319
460
|
export declare const functionsRelayConfigSchema: z.ZodObject<{
|
|
320
461
|
url: z.ZodString;
|
|
@@ -324,12 +465,10 @@ export declare const functionsRelayConfigSchema: z.ZodObject<{
|
|
|
324
465
|
}, z.core.$strict>;
|
|
325
466
|
export type FunctionsRelayConfig = z.infer<typeof functionsRelayConfigSchema>;
|
|
326
467
|
/**
|
|
327
|
-
* Where the execution host reports how much this version ran.
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* the control plane must never fail a request over it. Counting is reporting
|
|
332
|
-
* only — nothing here throttles, and no limit is enforced anywhere from it.
|
|
468
|
+
* Where the execution host reports how much this version ran. Absent means
|
|
469
|
+
* uncounted, not refused: a space whose configuration predates usage reporting
|
|
470
|
+
* must keep serving, and a tier that cannot reach the control plane must never
|
|
471
|
+
* fail a request over it. Nothing here throttles.
|
|
333
472
|
*/
|
|
334
473
|
export declare const functionsUsageConfigSchema: z.ZodObject<{
|
|
335
474
|
url: z.ZodString;
|
|
@@ -337,15 +476,28 @@ export declare const functionsUsageConfigSchema: z.ZodObject<{
|
|
|
337
476
|
}, z.core.$strict>;
|
|
338
477
|
export type FunctionsUsageConfig = z.infer<typeof functionsUsageConfigSchema>;
|
|
339
478
|
/**
|
|
340
|
-
*
|
|
479
|
+
* The credential the execution host presents at the origin's purge route.
|
|
480
|
+
*
|
|
481
|
+
* Only the token lives here: the purge route is on whichever hostname the
|
|
482
|
+
* visitor hit, so the origin composes the URL from the request host at dispatch
|
|
483
|
+
* time rather than freezing one hostname at finalize. A third credential rather
|
|
484
|
+
* than a reuse of the relay's, because a worker whose relay is unusable must
|
|
485
|
+
* still be able to invalidate what it rendered. Version-scoped, so a republish
|
|
486
|
+
* revokes it.
|
|
487
|
+
*/
|
|
488
|
+
export declare const functionsPurgeConfigSchema: z.ZodObject<{
|
|
489
|
+
token: z.ZodString;
|
|
490
|
+
}, z.core.$strict>;
|
|
491
|
+
export type FunctionsPurgeConfig = z.infer<typeof functionsPurgeConfigSchema>;
|
|
492
|
+
/**
|
|
493
|
+
* What a build declares about its worker, everything the CLI can know from the
|
|
341
494
|
* author's project alone.
|
|
342
495
|
*
|
|
343
|
-
* Unlike Zero, this is *not* the
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* field in which to assert authority it was not given.
|
|
496
|
+
* Unlike Zero, this is *not* the document the runtime receives. A build cannot
|
|
497
|
+
* name the host it is dispatched to, mint the credential its relay calls carry,
|
|
498
|
+
* or decide what authority it is granted. Keeping all three out of this schema
|
|
499
|
+
* leaves a version's own metadata no field in which to assert authority it was
|
|
500
|
+
* not given.
|
|
349
501
|
*/
|
|
350
502
|
export declare const functionsSourceFinalizeSchema: z.ZodObject<{
|
|
351
503
|
runtimeKind: z.ZodLiteral<"functions">;
|
|
@@ -359,6 +511,12 @@ export declare const functionsSourceFinalizeSchema: z.ZodObject<{
|
|
|
359
511
|
sha256: z.ZodString;
|
|
360
512
|
size: z.ZodNumber;
|
|
361
513
|
}, z.core.$strict>;
|
|
514
|
+
seed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
515
|
+
path: z.ZodString;
|
|
516
|
+
sha256: z.ZodString;
|
|
517
|
+
size: z.ZodNumber;
|
|
518
|
+
entries: z.ZodNumber;
|
|
519
|
+
}, z.core.$strict>>>;
|
|
362
520
|
compatibilityDate: z.ZodString;
|
|
363
521
|
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
364
522
|
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -374,6 +532,7 @@ export declare const functionsSourceFinalizeSchema: z.ZodObject<{
|
|
|
374
532
|
path: z.ZodString;
|
|
375
533
|
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
376
534
|
}, z.core.$strict>>>;
|
|
535
|
+
bypassCookies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
377
536
|
capabilities: z.ZodDefault<z.ZodObject<{
|
|
378
537
|
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
379
538
|
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -384,6 +543,7 @@ export declare const functionsSourceFinalizeSchema: z.ZodObject<{
|
|
|
384
543
|
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
385
544
|
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
386
545
|
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
546
|
+
content: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
387
547
|
}, z.core.$strip>>;
|
|
388
548
|
platform: z.ZodDefault<z.ZodObject<{
|
|
389
549
|
nextCache: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -399,10 +559,9 @@ export type FunctionsSourceFinalize = z.infer<typeof functionsSourceFinalizeSche
|
|
|
399
559
|
* The document the control plane sends to the runtime, which the engine stores
|
|
400
560
|
* beside the version's files and the origin reads on every dispatch.
|
|
401
561
|
*
|
|
402
|
-
* It is the build's declaration plus
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* variables.
|
|
562
|
+
* It is the build's declaration plus what only the platform can supply: where to
|
|
563
|
+
* dispatch, what the worker may do, the credentials for doing and reporting it,
|
|
564
|
+
* and the resolved variable values.
|
|
406
565
|
*/
|
|
407
566
|
export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
408
567
|
runtimeKind: z.ZodLiteral<"functions">;
|
|
@@ -416,6 +575,12 @@ export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
|
416
575
|
sha256: z.ZodString;
|
|
417
576
|
size: z.ZodNumber;
|
|
418
577
|
}, z.core.$strict>;
|
|
578
|
+
seed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
579
|
+
path: z.ZodString;
|
|
580
|
+
sha256: z.ZodString;
|
|
581
|
+
size: z.ZodNumber;
|
|
582
|
+
entries: z.ZodNumber;
|
|
583
|
+
}, z.core.$strict>>>;
|
|
419
584
|
compatibilityDate: z.ZodString;
|
|
420
585
|
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
421
586
|
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -431,6 +596,7 @@ export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
|
431
596
|
path: z.ZodString;
|
|
432
597
|
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
433
598
|
}, z.core.$strict>>>;
|
|
599
|
+
bypassCookies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
434
600
|
capabilities: z.ZodDefault<z.ZodObject<{
|
|
435
601
|
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
436
602
|
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -441,6 +607,7 @@ export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
|
441
607
|
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
442
608
|
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
443
609
|
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
610
|
+
content: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
444
611
|
}, z.core.$strip>>;
|
|
445
612
|
platform: z.ZodDefault<z.ZodObject<{
|
|
446
613
|
nextCache: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -453,6 +620,7 @@ export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
|
453
620
|
host: z.ZodObject<{
|
|
454
621
|
hostname: z.ZodString;
|
|
455
622
|
bundleUrl: z.ZodString;
|
|
623
|
+
seedUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
456
624
|
}, z.core.$strict>;
|
|
457
625
|
grantedCapabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
458
626
|
fetch: "fetch";
|
|
@@ -476,6 +644,9 @@ export declare const functionsRuntimeConfigSchema: z.ZodObject<{
|
|
|
476
644
|
url: z.ZodString;
|
|
477
645
|
token: z.ZodString;
|
|
478
646
|
}, z.core.$strict>>>;
|
|
647
|
+
purge: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
648
|
+
token: z.ZodString;
|
|
649
|
+
}, z.core.$strict>>>;
|
|
479
650
|
variableValues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
480
651
|
}, z.core.$strict>;
|
|
481
652
|
export type FunctionsRuntimeConfig = z.infer<typeof functionsRuntimeConfigSchema>;
|
|
@@ -493,6 +664,12 @@ export declare const functionsDeployMetadataSchema: z.ZodObject<{
|
|
|
493
664
|
sha256: z.ZodString;
|
|
494
665
|
size: z.ZodNumber;
|
|
495
666
|
}, z.core.$strict>;
|
|
667
|
+
seed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
668
|
+
path: z.ZodString;
|
|
669
|
+
sha256: z.ZodString;
|
|
670
|
+
size: z.ZodNumber;
|
|
671
|
+
entries: z.ZodNumber;
|
|
672
|
+
}, z.core.$strict>>>;
|
|
496
673
|
compatibilityDate: z.ZodString;
|
|
497
674
|
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
498
675
|
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -508,6 +685,7 @@ export declare const functionsDeployMetadataSchema: z.ZodObject<{
|
|
|
508
685
|
path: z.ZodString;
|
|
509
686
|
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
510
687
|
}, z.core.$strict>>>;
|
|
688
|
+
bypassCookies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
511
689
|
capabilities: z.ZodDefault<z.ZodObject<{
|
|
512
690
|
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
513
691
|
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -518,6 +696,7 @@ export declare const functionsDeployMetadataSchema: z.ZodObject<{
|
|
|
518
696
|
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
519
697
|
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
520
698
|
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
699
|
+
content: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
521
700
|
}, z.core.$strip>>;
|
|
522
701
|
platform: z.ZodDefault<z.ZodObject<{
|
|
523
702
|
nextCache: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -531,32 +710,29 @@ export declare const functionsDeployMetadataSchema: z.ZodObject<{
|
|
|
531
710
|
}, z.core.$strict>;
|
|
532
711
|
export type FunctionsDeployMetadata = z.infer<typeof functionsDeployMetadataSchema>;
|
|
533
712
|
/**
|
|
534
|
-
* Builds the declaration a publish attaches to its version
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* version agree on the shape by construction rather than by copying an object
|
|
538
|
-
* literal around — the same reason `createZeroRuntimeFinalizePayload` exists.
|
|
713
|
+
* Builds the declaration a publish attaches to its version, so the CLI's publish
|
|
714
|
+
* step and every test needing a Functions version agree on the shape by
|
|
715
|
+
* construction. Mirrors `createZeroRuntimeFinalizePayload`.
|
|
539
716
|
*/
|
|
540
717
|
export declare function createFunctionsSourceFinalize(input: {
|
|
541
718
|
appName: string;
|
|
542
719
|
entry: string;
|
|
543
720
|
mainModule: string;
|
|
544
721
|
bundle: z.input<typeof functionsBundleRefSchema>;
|
|
722
|
+
seed?: z.input<typeof functionsSeedRefSchema> | null;
|
|
545
723
|
compatibilityDate: string;
|
|
546
724
|
compatibilityFlags?: string[];
|
|
547
725
|
routes?: z.input<typeof functionsRouteSchema>[];
|
|
726
|
+
bypassCookies?: string[];
|
|
548
727
|
capabilities?: ExecutionCapabilities;
|
|
549
728
|
nextCache?: boolean;
|
|
550
729
|
variableNames?: string[];
|
|
551
730
|
}): FunctionsSourceFinalize;
|
|
552
731
|
/**
|
|
553
732
|
* What a version's worker is currently doing, as an observer of the space can
|
|
554
|
-
*
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
* content store or it is not, and dispatch is decided by which version is
|
|
558
|
-
* serving — so these three cover the whole space of answers, and each one is
|
|
559
|
-
* checkable rather than inferred from a job we ran earlier.
|
|
733
|
+
* determine. There is no upload state: a bundle is either in the version's
|
|
734
|
+
* content store or it is not, and dispatch follows whichever version is serving,
|
|
735
|
+
* so each of these three is checkable rather than inferred from an earlier job.
|
|
560
736
|
*/
|
|
561
737
|
export declare const functionsExecutionStateSchema: z.ZodEnum<{
|
|
562
738
|
ready: "ready";
|
|
@@ -567,17 +743,14 @@ export type FunctionsExecutionState = z.infer<typeof functionsExecutionStateSche
|
|
|
567
743
|
/**
|
|
568
744
|
* What a live worker is, as the `worker` member of a space's runtime status.
|
|
569
745
|
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
* version.
|
|
746
|
+
* No kind tag: the member it rides in already says which product answered, and
|
|
747
|
+
* the same tree can carry a capsule beside it. No `versionId`: the status
|
|
748
|
+
* response already names the live version. No `database` field:
|
|
749
|
+
* `capabilities.db` is the fact the whole `/db` family branches on, and stating
|
|
750
|
+
* it twice invites the two to disagree.
|
|
576
751
|
*
|
|
577
|
-
* Everything but `executionState`
|
|
578
|
-
*
|
|
579
|
-
* `database` field: `capabilities.db` is the fact the whole `/db` family
|
|
580
|
-
* branches on, and stating it twice invites the two to disagree.
|
|
752
|
+
* Everything but `executionState` comes from the version's finalize metadata, so
|
|
753
|
+
* this answers whether or not the origin is reachable.
|
|
581
754
|
*/
|
|
582
755
|
export declare const functionsAppSchema: z.ZodObject<{
|
|
583
756
|
artifactId: z.ZodString;
|
|
@@ -608,6 +781,7 @@ export declare const functionsAppSchema: z.ZodObject<{
|
|
|
608
781
|
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
609
782
|
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
610
783
|
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
784
|
+
content: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
611
785
|
}, z.core.$strip>>;
|
|
612
786
|
executionState: z.ZodEnum<{
|
|
613
787
|
ready: "ready";
|