@spacefast/common 0.0.21 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/connect-targets.d.ts +9 -6
- package/dist/agents/connect-targets.js +9 -6
- package/dist/config/domains.d.ts +1 -1
- package/dist/config/domains.js +1 -0
- 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 +121 -9
- package/dist/contracts/access.js +73 -9
- package/dist/contracts/activity.d.ts +1 -1
- package/dist/contracts/activity.js +0 -9
- package/dist/contracts/api-keys.d.ts +21 -21
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/billing.d.ts +1 -34
- package/dist/contracts/billing.js +4 -53
- package/dist/contracts/builds.d.ts +8 -8
- package/dist/contracts/builds.js +10 -3
- 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 +283 -54
- package/dist/contracts/comments.js +173 -52
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +1 -1
- package/dist/contracts/docs.d.ts +5 -5
- package/dist/contracts/domains.d.ts +36 -36
- package/dist/contracts/enums.d.ts +33 -30
- package/dist/contracts/enums.js +52 -38
- package/dist/contracts/error-code-meta.d.ts +37 -126
- package/dist/contracts/error-code-meta.js +12 -41
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +10 -32
- package/dist/contracts/execution.d.ts +35 -57
- package/dist/contracts/execution.js +41 -40
- 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 +8 -38
- package/dist/contracts/feature-lifecycle.js +16 -48
- package/dist/contracts/features.d.ts +15 -13
- package/dist/contracts/features.js +39 -38
- package/dist/contracts/functions.d.ts +97 -70
- package/dist/contracts/functions.js +101 -34
- package/dist/contracts/git.d.ts +1 -1
- package/dist/contracts/grants.d.ts +7 -3
- package/dist/contracts/grants.js +18 -9
- package/dist/contracts/internal.d.ts +14 -1
- package/dist/contracts/internal.js +17 -7
- 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 +75 -1
- package/dist/contracts/pages.d.ts +6 -1
- package/dist/contracts/pages.js +24 -1
- package/dist/contracts/plan-policy.d.ts +1 -3
- package/dist/contracts/plan-policy.js +1 -2
- package/dist/contracts/platform.d.ts +61 -148
- package/dist/contracts/platform.js +70 -126
- package/dist/contracts/publish-archive.d.ts +498 -0
- package/dist/contracts/publish-archive.js +25 -0
- package/dist/contracts/resources.d.ts +12 -24
- package/dist/contracts/resources.js +32 -12
- package/dist/contracts/runtime-api.d.ts +369 -175
- package/dist/contracts/runtime-api.js +372 -348
- package/dist/contracts/runtime-app.d.ts +127 -120
- package/dist/contracts/runtime-app.js +19 -10
- package/dist/contracts/runtime-db.d.ts +1 -1
- package/dist/contracts/runtime-services.d.ts +219 -0
- package/dist/contracts/runtime-services.js +437 -0
- package/dist/contracts/runtime-storage.d.ts +45 -32
- package/dist/contracts/runtime-storage.js +30 -8
- package/dist/contracts/space-config.d.ts +10 -16
- package/dist/contracts/space-config.js +14 -10
- package/dist/contracts/spaces.d.ts +241 -436
- package/dist/contracts/spaces.js +128 -145
- 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 +358 -89
- 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.d.ts +0 -32
- package/dist/contracts/superadmin.js +3 -11
- package/dist/contracts/tags.d.ts +9 -9
- package/dist/contracts/teams.d.ts +44 -2
- package/dist/contracts/teams.js +43 -23
- package/dist/contracts/transfers.d.ts +0 -49
- package/dist/contracts/transfers.js +2 -6
- 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 +6 -5
- package/dist/contracts/webhooks.d.ts +2 -2
- package/dist/contracts/zero.d.ts +87 -56
- package/dist/contracts/zero.js +82 -20
- package/dist/dashboard-paths/index.d.ts +1 -1
- package/dist/dashboard-paths/index.js +1 -0
- package/dist/docs/agent-prose.d.ts +1 -1
- package/dist/docs/agent-prose.js +62 -66
- package/dist/docs/agent-setup.js +49 -23
- package/dist/docs/agent-solutions.d.ts +4 -4
- package/dist/docs/agent-solutions.js +8 -8
- package/dist/docs/catalog.d.ts +19 -19
- package/dist/docs/catalog.js +30 -19
- package/dist/docs/error-docs.js +63 -151
- package/dist/docs/skills.d.ts +3 -3
- package/dist/docs/skills.js +1 -1
- package/dist/test-helpers/fetch-stub.d.ts +16 -0
- package/dist/test-helpers/fetch-stub.js +24 -0
- package/dist/utils/build-settings.js +9 -3
- package/dist/utils/canonical-json.d.ts +10 -0
- package/dist/utils/canonical-json.js +21 -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/credential-policy.d.ts +1 -1
- 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 +7 -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 +25 -2
- 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 +1 -5
- package/dist/utils/local-space-state.js +7 -26
- package/dist/utils/page-fonts.d.ts +2 -2
- package/dist/utils/page-fonts.js +22 -4
- package/dist/utils/pages.d.ts +1 -2
- package/dist/utils/pages.js +21 -5
- 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 +20 -0
- package/dist/utils/publish-policy.fixtures.json +397 -0
- package/dist/utils/publish-policy.js +36 -19
- package/dist/utils/push-new.d.ts +7 -0
- package/dist/utils/push-new.js +7 -0
- package/dist/utils/query-keys.d.ts +0 -1
- package/dist/utils/query-keys.js +0 -1
- 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 +3 -13
- package/dist/utils/runtime-upload.js +4 -14
- package/dist/utils/space-config.d.ts +0 -33
- package/dist/utils/space-config.js +5 -326
- 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/version-path.js +12 -3
- package/dist/vocabulary.d.ts +5 -3
- package/dist/vocabulary.js +13 -10
- package/package.json +10 -5
- 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
|
@@ -2,137 +2,144 @@ import { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* The one answer to "what is running on this space".
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* degenerate app, it is the absence of one.
|
|
5
|
+
* One published tree can carry static files, a worker and a capsule at once —
|
|
6
|
+
* every space owns a site, so what answers a request is a routing decision, not
|
|
7
|
+
* a kind the space declared. This is therefore two independent members rather
|
|
8
|
+
* than a discriminated union: each is `null` when the live tree carries none of
|
|
9
|
+
* that product, and both `null` is the overwhelmingly common answer. A static
|
|
10
|
+
* space is not a degenerate app, it is the absence of one.
|
|
11
|
+
*
|
|
12
|
+
* When both are present the capsule wins a path conflict — it is the one that
|
|
13
|
+
* owns the space's database and its transaction.
|
|
11
14
|
*
|
|
12
15
|
* It lives in its own module because it is the only place that needs to know
|
|
13
16
|
* about both products at once. `spaces.ts` imports it to describe runtime
|
|
14
17
|
* status; neither `zero.ts` nor `functions.ts` has to learn about the other.
|
|
15
18
|
*/
|
|
16
|
-
export declare const runtimeAppSchema: z.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
export declare const runtimeAppSchema: z.ZodObject<{
|
|
20
|
+
capsule: z.ZodNullable<z.ZodObject<{
|
|
21
|
+
artifactId: z.ZodString;
|
|
22
|
+
appName: z.ZodString;
|
|
23
|
+
serverRuntime: z.ZodLiteral<"quickjs-rust">;
|
|
24
|
+
inspect: z.ZodObject<{
|
|
25
|
+
policy: z.ZodEnum<{
|
|
26
|
+
public: "public";
|
|
27
|
+
private: "private";
|
|
28
|
+
}>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
install: z.ZodObject<{
|
|
31
|
+
runtimeKind: z.ZodLiteral<"zero">;
|
|
32
|
+
engine: z.ZodLiteral<"quickjs-rust">;
|
|
33
|
+
storageRoot: z.ZodLiteral<"__spacefast/zero">;
|
|
34
|
+
artifactPath: z.ZodLiteral<"__spacefast/zero/artifact.json">;
|
|
35
|
+
configPath: z.ZodLiteral<"__spacefast/zero/config.json">;
|
|
36
|
+
binary: z.ZodObject<{
|
|
37
|
+
path: z.ZodLiteral<"__spacefast/zero/bin/stattic-runtime">;
|
|
38
|
+
compatibilityTarget: z.ZodObject<{
|
|
39
|
+
profile: z.ZodLiteral<"wpcloud-linux-x86_64-gnu-v1">;
|
|
40
|
+
os: z.ZodLiteral<"linux">;
|
|
41
|
+
cpu: z.ZodLiteral<"x86_64">;
|
|
42
|
+
libc: z.ZodLiteral<"glibc">;
|
|
43
|
+
linking: z.ZodLiteral<"dynamic">;
|
|
44
|
+
requireExecutableBit: z.ZodLiteral<true>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
sha256: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
required: z.ZodLiteral<true>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
mysql: z.ZodObject<{
|
|
50
|
+
migrateAtFinalize: z.ZodLiteral<true>;
|
|
51
|
+
blockIncompatibleRollback: z.ZodLiteral<true>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
realtime: z.ZodObject<{
|
|
54
|
+
production: z.ZodLiteral<"central">;
|
|
55
|
+
local: z.ZodLiteral<"foreground-cli-ws">;
|
|
42
56
|
}, z.core.$strict>;
|
|
43
|
-
sha256: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
44
|
-
required: z.ZodLiteral<true>;
|
|
45
57
|
}, z.core.$strict>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
|
+
queries: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
60
|
+
mutations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
61
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
62
|
+
endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
63
|
+
method: z.ZodEnum<{
|
|
64
|
+
POST: "POST";
|
|
65
|
+
PUT: "PUT";
|
|
66
|
+
GET: "GET";
|
|
67
|
+
HEAD: "HEAD";
|
|
68
|
+
PATCH: "PATCH";
|
|
69
|
+
DELETE: "DELETE";
|
|
70
|
+
OPTIONS: "OPTIONS";
|
|
71
|
+
}>;
|
|
72
|
+
path: z.ZodString;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
74
|
+
sockets: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
75
|
+
migrationCount: z.ZodNumber;
|
|
76
|
+
schemaHash: z.ZodNullable<z.ZodString>;
|
|
77
|
+
variables: z.ZodObject<{
|
|
78
|
+
source: z.ZodLiteral<"stattic-variables">;
|
|
79
|
+
names: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
80
|
}, z.core.$strict>;
|
|
50
81
|
realtime: z.ZodObject<{
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
mode: z.ZodEnum<{
|
|
83
|
+
local: "local";
|
|
84
|
+
cast: "cast";
|
|
85
|
+
central: "central";
|
|
86
|
+
}>;
|
|
87
|
+
centralUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
path: z.ZodOptional<z.ZodString>;
|
|
89
|
+
replayPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
replayUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
runPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
runUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
resourceKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
ticketPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
|
+
socketPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
spaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
98
|
}, z.core.$strict>;
|
|
54
|
-
}, z.core.$strict
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
worker: z.ZodNullable<z.ZodObject<{
|
|
101
|
+
artifactId: z.ZodString;
|
|
102
|
+
appName: z.ZodString;
|
|
103
|
+
entry: z.ZodString;
|
|
104
|
+
compatibilityDate: z.ZodString;
|
|
105
|
+
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
106
|
+
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
107
|
+
method: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
108
|
+
POST: "POST";
|
|
109
|
+
PUT: "PUT";
|
|
110
|
+
GET: "GET";
|
|
111
|
+
HEAD: "HEAD";
|
|
112
|
+
PATCH: "PATCH";
|
|
113
|
+
DELETE: "DELETE";
|
|
114
|
+
OPTIONS: "OPTIONS";
|
|
115
|
+
}>>>;
|
|
116
|
+
path: z.ZodString;
|
|
117
|
+
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
118
|
+
}, z.core.$strict>>>;
|
|
119
|
+
capabilities: z.ZodDefault<z.ZodObject<{
|
|
120
|
+
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
121
|
+
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
122
|
+
auth: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
123
|
+
env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
124
|
+
realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
125
|
+
logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
126
|
+
gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
127
|
+
spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
128
|
+
email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
executionState: z.ZodEnum<{
|
|
131
|
+
ready: "ready";
|
|
132
|
+
absent: "absent";
|
|
133
|
+
serving: "serving";
|
|
83
134
|
}>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
socketPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
-
spaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
-
versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
|
-
}, z.core.$strict>;
|
|
96
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
-
runtimeKind: z.ZodLiteral<"functions">;
|
|
98
|
-
artifactId: z.ZodString;
|
|
99
|
-
appName: z.ZodString;
|
|
100
|
-
entry: z.ZodString;
|
|
101
|
-
compatibilityDate: z.ZodString;
|
|
102
|
-
compatibilityFlags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
103
|
-
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
104
|
-
method: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
105
|
-
POST: "POST";
|
|
106
|
-
PUT: "PUT";
|
|
107
|
-
GET: "GET";
|
|
108
|
-
HEAD: "HEAD";
|
|
109
|
-
PATCH: "PATCH";
|
|
110
|
-
DELETE: "DELETE";
|
|
111
|
-
OPTIONS: "OPTIONS";
|
|
112
|
-
}>>>;
|
|
113
|
-
path: z.ZodString;
|
|
114
|
-
subtree: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
-
}, z.core.$strict>>>;
|
|
116
|
-
capabilities: z.ZodDefault<z.ZodObject<{
|
|
117
|
-
db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
118
|
-
fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
119
|
-
auth: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
120
|
-
env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
121
|
-
realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
122
|
-
logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
123
|
-
}, z.core.$strip>>;
|
|
124
|
-
executionState: z.ZodEnum<{
|
|
125
|
-
ready: "ready";
|
|
126
|
-
absent: "absent";
|
|
127
|
-
serving: "serving";
|
|
128
|
-
}>;
|
|
129
|
-
bundleSize: z.ZodNumber;
|
|
130
|
-
bundleSha256: z.ZodString;
|
|
131
|
-
variables: z.ZodObject<{
|
|
132
|
-
source: z.ZodLiteral<"spacefast-variables">;
|
|
133
|
-
names: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
134
|
-
}, z.core.$strict>;
|
|
135
|
-
}, z.core.$strict>], "runtimeKind">;
|
|
135
|
+
bundleSize: z.ZodNumber;
|
|
136
|
+
bundleSha256: z.ZodString;
|
|
137
|
+
variables: z.ZodObject<{
|
|
138
|
+
source: z.ZodLiteral<"spacefast-variables">;
|
|
139
|
+
names: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
}, z.core.$strict>;
|
|
136
143
|
export type RuntimeApp = z.infer<typeof runtimeAppSchema>;
|
|
137
144
|
/**
|
|
138
145
|
* Replay of the invalidation events a live runtime emitted.
|
|
@@ -5,21 +5,30 @@ import { zeroAppSchema, zeroRealtimeEventSchema } from "./zero.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* The one answer to "what is running on this space".
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* degenerate app, it is the absence of one.
|
|
8
|
+
* One published tree can carry static files, a worker and a capsule at once —
|
|
9
|
+
* every space owns a site, so what answers a request is a routing decision, not
|
|
10
|
+
* a kind the space declared. This is therefore two independent members rather
|
|
11
|
+
* than a discriminated union: each is `null` when the live tree carries none of
|
|
12
|
+
* that product, and both `null` is the overwhelmingly common answer. A static
|
|
13
|
+
* space is not a degenerate app, it is the absence of one.
|
|
14
|
+
*
|
|
15
|
+
* When both are present the capsule wins a path conflict — it is the one that
|
|
16
|
+
* owns the space's database and its transaction.
|
|
14
17
|
*
|
|
15
18
|
* It lives in its own module because it is the only place that needs to know
|
|
16
19
|
* about both products at once. `spaces.ts` imports it to describe runtime
|
|
17
20
|
* status; neither `zero.ts` nor `functions.ts` has to learn about the other.
|
|
18
21
|
*/
|
|
19
|
-
export const runtimeAppSchema = z
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
export const runtimeAppSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
capsule: zeroAppSchema
|
|
25
|
+
.nullable()
|
|
26
|
+
.describe("The live version's Zero capsule, if it carries one."),
|
|
27
|
+
worker: functionsAppSchema
|
|
28
|
+
.nullable()
|
|
29
|
+
.describe("The live version's Functions worker, if it carries one."),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
23
32
|
/**
|
|
24
33
|
* Replay of the invalidation events a live runtime emitted.
|
|
25
34
|
*
|
|
@@ -392,8 +392,8 @@ export declare const runtimeDbMigrateResponseSchema: z.ZodObject<{
|
|
|
392
392
|
code: z.ZodString;
|
|
393
393
|
severity: z.ZodEnum<{
|
|
394
394
|
info: "info";
|
|
395
|
-
error: "error";
|
|
396
395
|
warning: "warning";
|
|
396
|
+
error: "error";
|
|
397
397
|
}>;
|
|
398
398
|
message: z.ZodString;
|
|
399
399
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform services that tenant code reaches through the runtime rather than
|
|
3
|
+
* through a credential of its own: Gravatar, spam checking, and mail.
|
|
4
|
+
*
|
|
5
|
+
* Three properties hold for all three, and they are the reason this file
|
|
6
|
+
* exists instead of three unrelated ones:
|
|
7
|
+
*
|
|
8
|
+
* - **The credential is never in tenant reach.** An Akismet key or a Gravatar
|
|
9
|
+
* token in a bundle is a published secret, and a wp.cloud `SMTP_PASS` in a
|
|
10
|
+
* capsule is worse. Every call below is brokered: the runtime attaches
|
|
11
|
+
* authority outside the code that asked for the call.
|
|
12
|
+
* - **The interface is the contract, not the accessor.** Zero hands these to a
|
|
13
|
+
* handler as `ctx.gravatar` / `ctx.spam` / `ctx.email`; Functions binds them
|
|
14
|
+
* as `env.GRAVATAR` / `env.SPAM` / `env.EMAIL`. Method names and semantic
|
|
15
|
+
* fields stay shared. Zero's `check` narrows the input because its HTTP host
|
|
16
|
+
* can add request metadata; a detached Functions call supplies that metadata
|
|
17
|
+
* explicitly.
|
|
18
|
+
* - **The client is the same source on both tiers.** See
|
|
19
|
+
* `RUNTIME_SERVICE_CLIENT_SOURCE`: normalization, validation and the pure
|
|
20
|
+
* avatar-URL construction are one implementation injected into both runtimes,
|
|
21
|
+
* so the two tiers cannot drift into behaving differently.
|
|
22
|
+
*
|
|
23
|
+
* What differs between tiers is the transport under `call()`, and only that.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* What Gravatar serves when an address has no image. `404` is here so callers
|
|
27
|
+
* can detect absence by status instead of receiving a generated face they then
|
|
28
|
+
* have to recognise as a placeholder.
|
|
29
|
+
*/
|
|
30
|
+
export declare const GRAVATAR_DEFAULTS: readonly ["404", "mp", "identicon", "monsterid", "wavatar", "retro", "robohash", "blank"];
|
|
31
|
+
export type GravatarDefault = (typeof GRAVATAR_DEFAULTS)[number];
|
|
32
|
+
export declare const GRAVATAR_RATINGS: readonly ["g", "pg", "r", "x"];
|
|
33
|
+
export type GravatarRating = (typeof GRAVATAR_RATINGS)[number];
|
|
34
|
+
/** Gravatar's own ceiling. Larger values are refused rather than clamped. */
|
|
35
|
+
export declare const GRAVATAR_AVATAR_MAX_SIZE = 2048;
|
|
36
|
+
export type GravatarAvatarOptions = {
|
|
37
|
+
/** Requested square edge in pixels, 1–2048. */
|
|
38
|
+
size?: number;
|
|
39
|
+
/** Image to serve when the address has no Gravatar. */
|
|
40
|
+
default?: GravatarDefault;
|
|
41
|
+
/** Maximum permitted self-rating. */
|
|
42
|
+
rating?: GravatarRating;
|
|
43
|
+
/** Serve `default` even when the address does have a Gravatar. */
|
|
44
|
+
forceDefault?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type GravatarVerifiedAccount = {
|
|
47
|
+
service: string;
|
|
48
|
+
url: string;
|
|
49
|
+
label: string | null;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The subset of the Gravatar profile that is stable, public, and useful to a
|
|
53
|
+
* page. Deliberately not the raw upstream document: passing that through would
|
|
54
|
+
* make every upstream field addition a silent contract change here.
|
|
55
|
+
*/
|
|
56
|
+
export type GravatarProfile = {
|
|
57
|
+
hash: string;
|
|
58
|
+
displayName: string | null;
|
|
59
|
+
profileUrl: string | null;
|
|
60
|
+
avatarUrl: string | null;
|
|
61
|
+
location: string | null;
|
|
62
|
+
description: string | null;
|
|
63
|
+
pronouns: string | null;
|
|
64
|
+
verifiedAccounts: GravatarVerifiedAccount[];
|
|
65
|
+
};
|
|
66
|
+
export type Gravatar = {
|
|
67
|
+
/**
|
|
68
|
+
* Pure and synchronous: an avatar URL is a hash and a query string, so it
|
|
69
|
+
* costs no network call and cannot fail. It stays on this interface anyway
|
|
70
|
+
* because an author looking for an avatar looks here, not in a utility
|
|
71
|
+
* module.
|
|
72
|
+
*/
|
|
73
|
+
avatarUrl(email: string, options?: GravatarAvatarOptions): string;
|
|
74
|
+
/** The profile behind an address, or null when the address has none. */
|
|
75
|
+
profile(email: string): Promise<GravatarProfile | null>;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Akismet's recognised content types. The vendor is not in the name of
|
|
79
|
+
* anything an author touches — `ctx.spam` outlives whichever service answers
|
|
80
|
+
* it — but the vocabulary is Akismet's because the classifier is trained on
|
|
81
|
+
* it, and inventing synonyms would only lose signal.
|
|
82
|
+
*/
|
|
83
|
+
export declare const SPAM_CONTENT_TYPES: readonly ["comment", "reply", "forum-post", "contact-form", "signup", "message"];
|
|
84
|
+
export type SpamContentType = (typeof SPAM_CONTENT_TYPES)[number];
|
|
85
|
+
/**
|
|
86
|
+
* One complete submission, as the classifier sees it. Detached runtimes such
|
|
87
|
+
* as Functions use this shape; Zero uses {@link RequestSpamSubmission} while
|
|
88
|
+
* handling an HTTP invocation and fills the network fields itself.
|
|
89
|
+
*
|
|
90
|
+
* `userIp` and `userAgent` are the two heaviest signals Akismet uses, and
|
|
91
|
+
* accuracy drops sharply without them — hence `userIp` being required rather
|
|
92
|
+
* than another optional field an author would skip.
|
|
93
|
+
*/
|
|
94
|
+
export type SpamSubmission = {
|
|
95
|
+
/** The text being classified. */
|
|
96
|
+
content: string;
|
|
97
|
+
/** The submitting visitor's IP. Required: without it the verdict is weak. */
|
|
98
|
+
userIp: string;
|
|
99
|
+
userAgent?: string;
|
|
100
|
+
referrer?: string;
|
|
101
|
+
/** Permalink of the page the content was submitted on. */
|
|
102
|
+
permalink?: string;
|
|
103
|
+
type?: SpamContentType;
|
|
104
|
+
authorName?: string;
|
|
105
|
+
authorEmail?: string;
|
|
106
|
+
authorUrl?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Set to `"administrator"` for a trusted, authenticated operator of the
|
|
109
|
+
* space. Akismet passes that role unconditionally, so this is an author's
|
|
110
|
+
* own escape hatch for their own team — it grants nothing beyond skipping a
|
|
111
|
+
* check the author asked for.
|
|
112
|
+
*/
|
|
113
|
+
authorRole?: "administrator";
|
|
114
|
+
/** ISO-8601 UTC. Defaults to the moment of the call. */
|
|
115
|
+
createdAt?: string;
|
|
116
|
+
/** ISO-639-1 hints, e.g. `["en"]`. */
|
|
117
|
+
languages?: string[];
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* A spam check made while handling a visitor request.
|
|
121
|
+
*
|
|
122
|
+
* Network evidence is deliberately absent. The runtime, not capsule code,
|
|
123
|
+
* supplies the visitor IP, user agent, referrer, and current URL from the
|
|
124
|
+
* trusted invocation envelope. This keeps a browser from claiming its own IP
|
|
125
|
+
* through mutation arguments or an endpoint body.
|
|
126
|
+
*/
|
|
127
|
+
export type RequestSpamSubmission = Omit<SpamSubmission, "userIp" | "userAgent" | "referrer" | "permalink">;
|
|
128
|
+
export type SpamVerdict = {
|
|
129
|
+
/** Whether the submission classifies as spam. */
|
|
130
|
+
spam: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Blatant, pervasive spam. Akismet's own guidance is that this may be
|
|
133
|
+
* dropped outright rather than held for review, so it is surfaced instead of
|
|
134
|
+
* being folded into `spam`.
|
|
135
|
+
*/
|
|
136
|
+
discard: boolean;
|
|
137
|
+
};
|
|
138
|
+
export type SpamCheck = {
|
|
139
|
+
check(submission: SpamSubmission): Promise<SpamVerdict>;
|
|
140
|
+
/** Correct a false negative: this passed, and should not have. */
|
|
141
|
+
reportSpam(submission: SpamSubmission): Promise<void>;
|
|
142
|
+
/** Correct a false positive: this was held, and should not have been. */
|
|
143
|
+
reportHam(submission: SpamSubmission): Promise<void>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Zero's request-aware spam surface. Corrections retain the original full
|
|
147
|
+
* submission because they usually run later, outside the visitor request.
|
|
148
|
+
*/
|
|
149
|
+
export type RequestSpamCheck = Omit<SpamCheck, "check"> & {
|
|
150
|
+
check(submission: RequestSpamSubmission): Promise<SpamVerdict>;
|
|
151
|
+
};
|
|
152
|
+
/** Trusted runtime metadata. This is host input, never capsule input. */
|
|
153
|
+
export type RuntimeSpamRequestContext = {
|
|
154
|
+
userIp: string;
|
|
155
|
+
userAgent?: string;
|
|
156
|
+
referrer?: string;
|
|
157
|
+
permalink?: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The structured subset of Cloudflare's `SendEmail` binding, field for field.
|
|
161
|
+
*
|
|
162
|
+
* Matching it is a portability decision, not an aesthetic one: a worker
|
|
163
|
+
* deployed straight to Cloudflare gets the native binding and the same
|
|
164
|
+
* message-building code has to typecheck against both.
|
|
165
|
+
*/
|
|
166
|
+
export type EmailAddress = {
|
|
167
|
+
email: string;
|
|
168
|
+
name?: string;
|
|
169
|
+
};
|
|
170
|
+
export type EmailMessage = {
|
|
171
|
+
from: string | EmailAddress;
|
|
172
|
+
to: string | EmailAddress | Array<string | EmailAddress>;
|
|
173
|
+
subject: string;
|
|
174
|
+
text?: string;
|
|
175
|
+
html?: string;
|
|
176
|
+
cc?: string | EmailAddress | Array<string | EmailAddress>;
|
|
177
|
+
bcc?: string | EmailAddress | Array<string | EmailAddress>;
|
|
178
|
+
replyTo?: string | EmailAddress;
|
|
179
|
+
headers?: Record<string, string>;
|
|
180
|
+
};
|
|
181
|
+
export type SendEmail = {
|
|
182
|
+
/**
|
|
183
|
+
* Accepts one email effect. The identifier names the message; it is not a
|
|
184
|
+
* claim that anything was delivered, and no state beyond "queued" is
|
|
185
|
+
* observable from here — see the runtime's message views for that.
|
|
186
|
+
*/
|
|
187
|
+
send(message: EmailMessage): Promise<{
|
|
188
|
+
messageId: string;
|
|
189
|
+
}>;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The hosts a broker may reach on a tenant's behalf are deliberately NOT listed
|
|
193
|
+
* here. That table lives in `stattic-runtime-core`'s egress policy, where it is
|
|
194
|
+
* generated into both the runtime's PHP constants and the Rust broker, so one
|
|
195
|
+
* declaration is enforced at both places a connection is actually made. A copy
|
|
196
|
+
* in this file would be a third statement of the same fact that nothing checks.
|
|
197
|
+
*
|
|
198
|
+
* The `gravatar.com` in the avatar URL below is not that table: it is a public
|
|
199
|
+
* URL handed to a browser, not an egress target.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* The client both runtimes inject, as source.
|
|
203
|
+
*
|
|
204
|
+
* It is a string rather than a module because neither runtime can import from
|
|
205
|
+
* npm at the point it needs this: Zero compiles a capsule to QuickJS bytecode
|
|
206
|
+
* with a generated prelude, and the Functions host injects modules into a
|
|
207
|
+
* tenant isolate it does not build. Shipping one source to both is what makes
|
|
208
|
+
* "the same API" a fact about the code rather than a promise in a doc.
|
|
209
|
+
*
|
|
210
|
+
* It closes over nothing of ours. The host defines `call(service, operation,
|
|
211
|
+
* payload)` and everything else — normalization, the pure avatar URL, the
|
|
212
|
+
* shapes returned to tenant code — is here, identical on both tiers.
|
|
213
|
+
*
|
|
214
|
+
* The SHA-256 is hand-rolled for the same reason: QuickJS has no WebCrypto,
|
|
215
|
+
* and Cloudflare's `crypto.subtle` is async, which would force `avatarUrl` to
|
|
216
|
+
* return a promise on one tier and a string on the other. A synchronous
|
|
217
|
+
* implementation is the only way the signature can be identical.
|
|
218
|
+
*/
|
|
219
|
+
export declare const RUNTIME_SERVICE_CLIENT_SOURCE: string;
|