@spacefast/common 0.0.12 → 0.0.17
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/client-registry.d.ts +22 -0
- package/dist/agents/client-registry.js +41 -0
- package/dist/agents/connect-targets.d.ts +51 -6
- package/dist/agents/connect-targets.js +93 -28
- package/dist/brand.d.ts +0 -11
- package/dist/brand.js +0 -20
- package/dist/config/domains.d.ts +15 -6
- package/dist/config/domains.js +24 -10
- package/dist/config/postgres-budget.d.ts +3 -0
- package/dist/config/postgres-budget.js +6 -1
- package/dist/config/postgres-budget.json +2 -1
- package/dist/contracts/abuse.js +1 -1
- package/dist/contracts/access.d.ts +486 -1196
- package/dist/contracts/access.js +323 -1054
- package/dist/contracts/activity.d.ts +1 -1
- package/dist/contracts/activity.js +11 -15
- package/dist/contracts/api-keys.d.ts +16 -0
- package/dist/contracts/api-keys.js +11 -9
- package/dist/contracts/archives.d.ts +1 -2
- package/dist/contracts/archives.js +15 -17
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/builds.js +14 -14
- package/dist/contracts/channels.js +2 -2
- package/dist/contracts/comments.d.ts +143 -99
- package/dist/contracts/comments.js +194 -79
- package/dist/contracts/common.d.ts +12 -12
- package/dist/contracts/common.js +33 -30
- package/dist/contracts/continuation.js +5 -5
- package/dist/contracts/countries.js +2 -7
- package/dist/contracts/data-source-routes.d.ts +20 -0
- package/dist/contracts/data-source-routes.js +15 -0
- package/dist/contracts/device-auth.d.ts +13 -9
- package/dist/contracts/device-auth.js +12 -12
- package/dist/contracts/docs.d.ts +10 -10
- package/dist/contracts/domains.js +39 -33
- package/dist/contracts/enums.d.ts +4 -14
- package/dist/contracts/enums.js +3 -10
- package/dist/contracts/error-code-meta.d.ts +122 -56
- package/dist/contracts/error-code-meta.js +43 -19
- package/dist/contracts/error-codes.d.ts +7 -4
- package/dist/contracts/error-codes.js +48 -24
- package/dist/contracts/events.d.ts +22 -15
- package/dist/contracts/events.js +33 -5
- package/dist/contracts/execution.d.ts +238 -0
- package/dist/contracts/execution.js +309 -0
- package/dist/contracts/feature-lifecycle.d.ts +39 -188
- package/dist/contracts/feature-lifecycle.js +52 -196
- package/dist/contracts/features.d.ts +13 -115
- package/dist/contracts/features.js +5 -35
- package/dist/contracts/functions.d.ts +597 -0
- package/dist/contracts/functions.js +475 -0
- package/dist/contracts/grants.d.ts +1175 -0
- package/dist/contracts/grants.js +783 -0
- package/dist/contracts/ids.d.ts +7 -5
- package/dist/contracts/ids.js +7 -7
- package/dist/contracts/internal.js +2 -2
- package/dist/contracts/mcp.d.ts +17 -556
- package/dist/contracts/mcp.js +9 -103
- package/dist/contracts/me.js +3 -4
- package/dist/contracts/notifications.d.ts +108 -0
- package/dist/contracts/notifications.js +54 -0
- package/dist/contracts/oauth-resources.d.ts +22 -5
- package/dist/contracts/oauth-resources.js +23 -2
- package/dist/contracts/operations.d.ts +0 -48
- package/dist/contracts/operations.js +0 -19
- package/dist/contracts/pages.d.ts +10 -14
- package/dist/contracts/pages.js +17 -21
- package/dist/contracts/plan-policy.d.ts +1 -8
- package/dist/contracts/plan-policy.js +1 -4
- package/dist/contracts/platform.d.ts +78 -30
- package/dist/contracts/platform.js +69 -20
- package/dist/contracts/problem-document.d.ts +14 -0
- package/dist/contracts/problem-document.js +35 -0
- package/dist/contracts/push-new.d.ts +41 -2
- package/dist/contracts/push-new.js +4 -0
- package/dist/contracts/quotas.d.ts +0 -1
- package/dist/contracts/quotas.js +0 -5
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/resources.d.ts +16 -71
- package/dist/contracts/resources.js +13 -16
- package/dist/contracts/runtime-api.d.ts +666 -303
- package/dist/contracts/runtime-api.js +272 -113
- package/dist/contracts/runtime-app.d.ts +168 -0
- package/dist/contracts/runtime-app.js +42 -0
- package/dist/contracts/runtime-db.d.ts +424 -0
- package/dist/contracts/runtime-db.js +108 -0
- package/dist/contracts/runtime-storage.d.ts +120 -0
- package/dist/contracts/runtime-storage.js +40 -0
- package/dist/contracts/sf-config-v1.d.ts +54 -1
- package/dist/contracts/sf-config-v1.js +2 -2
- package/dist/contracts/sites.d.ts +6 -0
- package/dist/contracts/sites.js +30 -11
- package/dist/contracts/space-config.d.ts +91 -121
- package/dist/contracts/space-config.js +464 -42
- package/dist/contracts/spaces.d.ts +300 -171
- package/dist/contracts/spaces.js +128 -98
- package/dist/contracts/superadmin-emails.d.ts +2 -2
- package/dist/contracts/superadmin-spaces.d.ts +26 -130
- package/dist/contracts/superadmin-spaces.js +22 -0
- package/dist/contracts/superadmin-tenants.js +4 -4
- package/dist/contracts/superadmin.d.ts +4 -0
- package/dist/contracts/superadmin.js +14 -1
- package/dist/contracts/tags.d.ts +6 -6
- package/dist/contracts/tags.js +1 -1
- package/dist/contracts/teams.d.ts +9 -9
- package/dist/contracts/teams.js +25 -16
- package/dist/contracts/theme-json.js +1 -1
- package/dist/contracts/transfers.d.ts +0 -1
- package/dist/contracts/transfers.js +4 -4
- package/dist/contracts/variables.js +3 -3
- package/dist/contracts/zero.d.ts +384 -596
- package/dist/contracts/zero.js +167 -299
- package/dist/dashboard-paths/index.d.ts +18 -3
- package/dist/dashboard-paths/index.js +19 -0
- package/dist/docs/agent-handoff-document.d.ts +2 -2
- package/dist/docs/agent-handoff-document.js +8 -7
- package/dist/docs/agent-prose.d.ts +22 -3
- package/dist/docs/agent-prose.js +227 -55
- package/dist/docs/agent-setup.d.ts +14 -11
- package/dist/docs/agent-setup.js +289 -61
- package/dist/docs/agent-solutions.d.ts +6 -6
- package/dist/docs/agent-solutions.js +24 -22
- package/dist/docs/catalog.d.ts +53 -98
- package/dist/docs/catalog.js +90 -117
- package/dist/docs/error-docs.js +304 -236
- package/dist/docs/skill-distribution.d.ts +2 -0
- package/dist/docs/skill-distribution.js +7 -4
- package/dist/docs/skills.d.ts +546 -0
- package/dist/docs/skills.js +340 -0
- package/dist/utils/auth-redirect.d.ts +1 -3
- package/dist/utils/auth-redirect.js +1 -21
- package/dist/utils/browser-credential.d.ts +19 -0
- package/dist/utils/browser-credential.js +62 -0
- package/dist/utils/build-settings.d.ts +2 -0
- package/dist/utils/build-settings.js +61 -9
- package/dist/utils/comment-avatars.d.ts +7 -0
- package/dist/utils/comment-avatars.js +42 -0
- package/dist/utils/content-type.d.ts +3 -3
- package/dist/utils/content-type.js +38 -61
- package/dist/utils/credential-policy.d.ts +1 -1
- package/dist/utils/credential-policy.js +4 -0
- package/dist/utils/domain-diagnostics.d.ts +5 -5
- package/dist/utils/domain-diagnostics.js +21 -10
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/grants.d.ts +53 -0
- package/dist/utils/grants.js +160 -0
- package/dist/utils/local-space-state.d.ts +78 -4
- package/dist/utils/local-space-state.js +384 -82
- package/dist/utils/one-shot-replay.d.ts +14 -0
- package/dist/utils/one-shot-replay.js +21 -0
- package/dist/utils/page-preview.d.ts +7 -0
- package/dist/utils/page-preview.js +9 -0
- package/dist/utils/pages.d.ts +2 -5
- package/dist/utils/pages.js +64 -33
- package/dist/utils/publish-form-data.d.ts +22 -0
- package/dist/utils/publish-form-data.js +26 -0
- package/dist/utils/publish-policy.d.ts +34 -4
- package/dist/utils/publish-policy.js +149 -62
- package/dist/utils/query-keys.d.ts +8 -10
- package/dist/utils/query-keys.js +14 -10
- package/dist/utils/runtime-paths.d.ts +3 -0
- package/dist/utils/runtime-paths.js +7 -0
- package/dist/utils/secure-local-file.d.ts +73 -0
- package/dist/utils/secure-local-file.js +1373 -0
- package/dist/utils/space-config.d.ts +17 -4
- package/dist/utils/space-config.js +151 -8
- package/dist/utils/static-runtime-policy.d.ts +5 -0
- package/dist/utils/static-runtime-policy.js +54 -10
- package/dist/utils/storage-policy.d.ts +20 -0
- package/dist/utils/storage-policy.fixtures.json +174 -0
- package/dist/utils/storage-policy.js +193 -0
- package/dist/utils/upload-session.d.ts +15 -1
- package/dist/utils/upload-session.js +68 -2
- package/dist/utils/version-file-browser.d.ts +13 -0
- package/dist/utils/version-file-browser.js +59 -0
- package/package.json +20 -1
- package/dist/contracts/mounts.d.ts +0 -142
- package/dist/contracts/mounts.js +0 -56
- package/dist/utils/access-grant.d.ts +0 -14
- package/dist/utils/access-grant.js +0 -88
- package/dist/utils/access-match.d.ts +0 -46
- package/dist/utils/access-match.fixtures.json +0 -513
- package/dist/utils/access-match.js +0 -312
- package/dist/utils/access-verdict.fixtures.json +0 -421
- package/dist/utils/asset-fingerprint.d.ts +0 -53
- package/dist/utils/asset-fingerprint.js +0 -574
- package/dist/utils/sf-config-v1.d.ts +0 -2
- package/dist/utils/sf-config-v1.fixtures.json +0 -9
- package/dist/utils/sf-config-v1.js +0 -551
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dataEnvelope, mutationEnvelope } from "./common.js";
|
|
3
|
+
import { executionIdentifierSchema, executionSha256Schema } from "./execution.js";
|
|
4
|
+
import { ZERO_RUNTIME_KIND, zeroMigrationOperationSchema, zeroTableSchema } from "./zero.js";
|
|
5
|
+
/**
|
|
6
|
+
* The database surface, for whichever runtime a space is carrying.
|
|
7
|
+
*
|
|
8
|
+
* There is one database per space — the site's own MySQL — and at most one
|
|
9
|
+
* runtime with a claim on it, so these contracts are runtime-neutral by
|
|
10
|
+
* default. The two exceptions are stated explicitly: a migration plan is a
|
|
11
|
+
* capsule's declaration and no worker has one, and the console hand-off is a
|
|
12
|
+
* property of the wp.cloud site rather than of anything a version declared.
|
|
13
|
+
*
|
|
14
|
+
* The reads answer in the capsule's declaration shapes (`zeroTableSchema`,
|
|
15
|
+
* `zeroMigrationOperationSchema`) because a capsule's declared schema is the
|
|
16
|
+
* richest answer either runtime can give and a worker's is the same answer with
|
|
17
|
+
* the declaration-shaped fields empty. Those shapes stay Zero-named and stay in
|
|
18
|
+
* `./zero.js`: a declared table is the capsule's own statement about itself.
|
|
19
|
+
*/
|
|
20
|
+
export const runtimeDbInspectResponseSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
versionId: z.string().min(1).nullable(),
|
|
23
|
+
artifactId: z.string().min(1).nullable(),
|
|
24
|
+
backend: z.literal("wpcloud-mysql").nullable(),
|
|
25
|
+
migrationMode: z.enum(["safe", "drop", "rename"]).nullable(),
|
|
26
|
+
schemaHash: executionSha256Schema.nullable(),
|
|
27
|
+
tables: z.array(zeroTableSchema).default([]),
|
|
28
|
+
migrations: z.array(zeroMigrationOperationSchema).default([]),
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
export const runtimeDbInspectPublicResponseSchema = dataEnvelope(runtimeDbInspectResponseSchema);
|
|
32
|
+
export const runtimeDbDumpQuerySchema = z
|
|
33
|
+
.object({
|
|
34
|
+
table: executionIdentifierSchema.optional(),
|
|
35
|
+
limit: z.coerce.number().int().min(1).max(100).default(25),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export const runtimeDbDumpTableSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
name: executionIdentifierSchema,
|
|
41
|
+
rows: z.array(z.record(z.string(), z.unknown())).default([]),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
export const runtimeDbDumpResponseSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
versionId: z.string().min(1).nullable(),
|
|
47
|
+
artifactId: z.string().min(1).nullable(),
|
|
48
|
+
schemaHash: executionSha256Schema.nullable(),
|
|
49
|
+
tables: z.array(runtimeDbDumpTableSchema).default([]),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
export const runtimeDbDumpPublicResponseSchema = dataEnvelope(runtimeDbDumpResponseSchema);
|
|
53
|
+
export const runtimeDbExportOrderingSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
tables: z.literal("name_asc"),
|
|
56
|
+
rows: z.literal("created_at_id_asc"),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
export const runtimeDbExportMetadataSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
spaceId: z.string().min(1).nullable(),
|
|
62
|
+
versionId: z.string().min(1).nullable(),
|
|
63
|
+
schemaHash: executionSha256Schema,
|
|
64
|
+
consistency: z.literal("per_page"),
|
|
65
|
+
ordering: runtimeDbExportOrderingSchema,
|
|
66
|
+
tables: z.array(executionIdentifierSchema),
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
69
|
+
export const runtimeDbExportMetadataPublicResponseSchema = dataEnvelope(runtimeDbExportMetadataSchema);
|
|
70
|
+
export const runtimeDbExportPageQuerySchema = z
|
|
71
|
+
.object({
|
|
72
|
+
schemaHash: executionSha256Schema,
|
|
73
|
+
cursor: z.string().min(1).max(4_096).optional(),
|
|
74
|
+
limit: z.coerce.number().int().min(1).max(1_000).default(500),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
export const runtimeDbExportPageSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
rows: z.array(z.record(z.string(), z.unknown())),
|
|
80
|
+
cursor: z.string().nullable(),
|
|
81
|
+
})
|
|
82
|
+
.strict();
|
|
83
|
+
export const runtimeDbExportPagePublicResponseSchema = dataEnvelope(runtimeDbExportPageSchema);
|
|
84
|
+
export const runtimeDbMigrateResultSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
versionId: z.string().min(1).describe("Live version whose migration plan this is."),
|
|
87
|
+
runtimeKind: z.literal(ZERO_RUNTIME_KIND),
|
|
88
|
+
schemaHash: executionSha256Schema.nullable(),
|
|
89
|
+
mode: z.enum(["safe", "drop", "rename"]).nullable(),
|
|
90
|
+
operations: z
|
|
91
|
+
.array(zeroMigrationOperationSchema)
|
|
92
|
+
.describe("The plan the live capsule declared, in the order it applies."),
|
|
93
|
+
queued: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.describe("Whether runtime finalize was queued to apply the plan. `false` when the plan is empty because there is nothing to run."),
|
|
96
|
+
})
|
|
97
|
+
.strict();
|
|
98
|
+
export const runtimeDbMigrateResponseSchema = mutationEnvelope(runtimeDbMigrateResultSchema);
|
|
99
|
+
export const runtimeDbConsoleSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
provider: z.literal("wpcloud-phpmyadmin"),
|
|
102
|
+
url: z
|
|
103
|
+
.string()
|
|
104
|
+
.url()
|
|
105
|
+
.describe("Short-lived, single-use phpMyAdmin sign-in URL for the space MySQL. Treat it as a credential."),
|
|
106
|
+
})
|
|
107
|
+
.strict();
|
|
108
|
+
export const runtimeDbConsoleResponseSchema = dataEnvelope(runtimeDbConsoleSchema);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runtimeStorageVisibilitySchema: z.ZodEnum<{
|
|
3
|
+
public: "public";
|
|
4
|
+
private: "private";
|
|
5
|
+
}>;
|
|
6
|
+
export type RuntimeStorageVisibility = z.infer<typeof runtimeStorageVisibilitySchema>;
|
|
7
|
+
export declare const runtimeStorageObjectIdSchema: z.ZodString;
|
|
8
|
+
export declare const runtimeStorageObjectKeySchema: z.ZodString;
|
|
9
|
+
export declare const runtimeStorageListQuerySchema: z.ZodObject<{
|
|
10
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
11
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
public: "public";
|
|
14
|
+
private: "private";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export declare const runtimeStorageObjectSchema: z.ZodObject<{
|
|
18
|
+
key: z.ZodString;
|
|
19
|
+
visibility: z.ZodEnum<{
|
|
20
|
+
public: "public";
|
|
21
|
+
private: "private";
|
|
22
|
+
}>;
|
|
23
|
+
contentType: z.ZodString;
|
|
24
|
+
createdAt: z.ZodString;
|
|
25
|
+
size: z.ZodNumber;
|
|
26
|
+
uploaderId: z.ZodString;
|
|
27
|
+
sha256: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export type RuntimeStorageObject = z.infer<typeof runtimeStorageObjectSchema>;
|
|
30
|
+
export declare const runtimeStorageListResponseSchema: z.ZodObject<{
|
|
31
|
+
objects: z.ZodArray<z.ZodObject<{
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
visibility: z.ZodEnum<{
|
|
34
|
+
public: "public";
|
|
35
|
+
private: "private";
|
|
36
|
+
}>;
|
|
37
|
+
contentType: z.ZodString;
|
|
38
|
+
createdAt: z.ZodString;
|
|
39
|
+
size: z.ZodNumber;
|
|
40
|
+
uploaderId: z.ZodString;
|
|
41
|
+
sha256: z.ZodString;
|
|
42
|
+
}, z.core.$strict>>;
|
|
43
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
44
|
+
hasMore: z.ZodBoolean;
|
|
45
|
+
usedBytes: z.ZodNumber;
|
|
46
|
+
quotaBytes: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type RuntimeStorageListResponse = z.infer<typeof runtimeStorageListResponseSchema>;
|
|
49
|
+
export declare const runtimeStorageListPublicResponseSchema: z.ZodObject<{
|
|
50
|
+
data: z.ZodObject<{
|
|
51
|
+
objects: z.ZodArray<z.ZodObject<{
|
|
52
|
+
key: z.ZodString;
|
|
53
|
+
visibility: z.ZodEnum<{
|
|
54
|
+
public: "public";
|
|
55
|
+
private: "private";
|
|
56
|
+
}>;
|
|
57
|
+
contentType: z.ZodString;
|
|
58
|
+
createdAt: z.ZodString;
|
|
59
|
+
size: z.ZodNumber;
|
|
60
|
+
uploaderId: z.ZodString;
|
|
61
|
+
sha256: z.ZodString;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
64
|
+
hasMore: z.ZodBoolean;
|
|
65
|
+
usedBytes: z.ZodNumber;
|
|
66
|
+
quotaBytes: z.ZodNumber;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const runtimeStorageDeleteResponseSchema: z.ZodObject<{
|
|
70
|
+
key: z.ZodString;
|
|
71
|
+
deleted: z.ZodBoolean;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export type RuntimeStorageDeleteResponse = z.infer<typeof runtimeStorageDeleteResponseSchema>;
|
|
74
|
+
export declare const runtimeStorageDeletePublicResponseSchema: z.ZodObject<{
|
|
75
|
+
data: z.ZodObject<{
|
|
76
|
+
key: z.ZodString;
|
|
77
|
+
deleted: z.ZodBoolean;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
operation: z.ZodNullable<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
kind: z.ZodString;
|
|
82
|
+
status: z.ZodEnum<{
|
|
83
|
+
failed: "failed";
|
|
84
|
+
canceled: "canceled";
|
|
85
|
+
queued: "queued";
|
|
86
|
+
running: "running";
|
|
87
|
+
succeeded: "succeeded";
|
|
88
|
+
}>;
|
|
89
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
90
|
+
type: z.ZodString;
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
total: z.ZodNumber;
|
|
95
|
+
completed: z.ZodNumber;
|
|
96
|
+
failed: z.ZodNumber;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
99
|
+
code: z.ZodString;
|
|
100
|
+
severity: z.ZodEnum<{
|
|
101
|
+
info: "info";
|
|
102
|
+
error: "error";
|
|
103
|
+
warning: "warning";
|
|
104
|
+
}>;
|
|
105
|
+
message: z.ZodString;
|
|
106
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
108
|
+
registrar: "registrar";
|
|
109
|
+
wpcloud: "wpcloud";
|
|
110
|
+
dns: "dns";
|
|
111
|
+
runtime: "runtime";
|
|
112
|
+
}>>>;
|
|
113
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
114
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
116
|
+
}, z.core.$strip>>>;
|
|
117
|
+
createdAt: z.ZodString;
|
|
118
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dataEnvelope, mutationEnvelope } from "./common.js";
|
|
3
|
+
export const runtimeStorageVisibilitySchema = z.enum(["public", "private"]);
|
|
4
|
+
export const runtimeStorageObjectIdSchema = z.string().regex(/^[a-f0-9]{32}$/);
|
|
5
|
+
export const runtimeStorageObjectKeySchema = z.string().regex(/^(public|private)\/[a-f0-9]{32}$/);
|
|
6
|
+
export const runtimeStorageListQuerySchema = z
|
|
7
|
+
.object({
|
|
8
|
+
cursor: z.string().min(1).max(2_048).optional(),
|
|
9
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
10
|
+
visibility: runtimeStorageVisibilitySchema.optional(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
export const runtimeStorageObjectSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
key: runtimeStorageObjectKeySchema,
|
|
16
|
+
visibility: runtimeStorageVisibilitySchema,
|
|
17
|
+
contentType: z.string().min(1).max(255),
|
|
18
|
+
createdAt: z.string().datetime(),
|
|
19
|
+
size: z.number().int().nonnegative(),
|
|
20
|
+
uploaderId: z.string().min(1).max(255),
|
|
21
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
export const runtimeStorageListResponseSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
objects: z.array(runtimeStorageObjectSchema),
|
|
27
|
+
cursor: z.string().nullable(),
|
|
28
|
+
hasMore: z.boolean(),
|
|
29
|
+
usedBytes: z.number().int().nonnegative(),
|
|
30
|
+
quotaBytes: z.number().int().positive(),
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const runtimeStorageListPublicResponseSchema = dataEnvelope(runtimeStorageListResponseSchema);
|
|
34
|
+
export const runtimeStorageDeleteResponseSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
key: runtimeStorageObjectKeySchema,
|
|
37
|
+
deleted: z.boolean(),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
export const runtimeStorageDeletePublicResponseSchema = mutationEnvelope(runtimeStorageDeleteResponseSchema);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { Grant } from "./grants.js";
|
|
1
2
|
export declare const SF_CONFIG_V1_CANONICAL_FILE = "sf.jsonc";
|
|
2
3
|
export declare const SF_CONFIG_V1_FILES: readonly ["sf.jsonc", "spacefast.jsonc", "spacefast.json", "sf.json", ".sf/sf.json", ".sf/config.jsonc", ".sf/config.json"];
|
|
3
4
|
/** Published JSON Schema URL for the strict `sf.jsonc` v1 contract. */
|
|
4
5
|
export declare const SF_CONFIG_V1_SCHEMA_URL: `${string}/schemas/sf.v1.json`;
|
|
6
|
+
/**
|
|
7
|
+
* How a redirect answers. Omitting it means 302. There is no 200: a rule that
|
|
8
|
+
* serves other content under the requested URL is a `rewrites` entry.
|
|
9
|
+
*/
|
|
10
|
+
export type SfConfigV1RedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
5
11
|
export type SfConfigV1 = {
|
|
6
12
|
$schema?: typeof SF_CONFIG_V1_SCHEMA_URL;
|
|
7
13
|
version: 1;
|
|
@@ -18,6 +24,38 @@ export type SfConfigV1 = {
|
|
|
18
24
|
cleanUrls?: boolean;
|
|
19
25
|
directoryListing?: boolean;
|
|
20
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Browser redirect rules, in the same matcher grammar as `_redirects`. The
|
|
29
|
+
* files match first; config rules add behavior where the files are silent.
|
|
30
|
+
*/
|
|
31
|
+
redirects?: {
|
|
32
|
+
source: string;
|
|
33
|
+
destination: string;
|
|
34
|
+
status?: SfConfigV1RedirectStatus;
|
|
35
|
+
}[];
|
|
36
|
+
/**
|
|
37
|
+
* Rewrite and proxy rules: the URL stays, the content comes from the
|
|
38
|
+
* destination. A path destination rewrites, an absolute URL proxies — the
|
|
39
|
+
* same 200 rules `_redirects` writes as `/from /to 200`, which is why they
|
|
40
|
+
* carry no status of their own.
|
|
41
|
+
*/
|
|
42
|
+
rewrites?: {
|
|
43
|
+
source: string;
|
|
44
|
+
destination: string;
|
|
45
|
+
/** Let shared caches store the proxy response. Absolute-URL destinations only. */
|
|
46
|
+
cache?: "shared";
|
|
47
|
+
}[];
|
|
48
|
+
/**
|
|
49
|
+
* Response headers to set on matching requests. Headers are a list, not a
|
|
50
|
+
* map, so repeated names (Set-Cookie) survive.
|
|
51
|
+
*/
|
|
52
|
+
headers?: {
|
|
53
|
+
source: string;
|
|
54
|
+
headers: {
|
|
55
|
+
key: string;
|
|
56
|
+
value: string;
|
|
57
|
+
}[];
|
|
58
|
+
}[];
|
|
21
59
|
metadata?: {
|
|
22
60
|
title?: string;
|
|
23
61
|
description?: string;
|
|
@@ -26,6 +64,9 @@ export type SfConfigV1 = {
|
|
|
26
64
|
substitute?: {
|
|
27
65
|
files: string[];
|
|
28
66
|
};
|
|
67
|
+
access?: {
|
|
68
|
+
public: string[];
|
|
69
|
+
};
|
|
29
70
|
};
|
|
30
71
|
export type EffectiveConfigV1 = {
|
|
31
72
|
version: 1;
|
|
@@ -39,11 +80,23 @@ export type EffectiveConfigV1 = {
|
|
|
39
80
|
cleanUrls: boolean;
|
|
40
81
|
directoryListing: boolean;
|
|
41
82
|
};
|
|
83
|
+
/** Every rule states its status; an omitted one resolves to 302. */
|
|
84
|
+
redirects?: (NonNullable<SfConfigV1["redirects"]>[number] & {
|
|
85
|
+
status: SfConfigV1RedirectStatus;
|
|
86
|
+
})[];
|
|
87
|
+
rewrites?: SfConfigV1["rewrites"];
|
|
88
|
+
headers?: SfConfigV1["headers"];
|
|
42
89
|
metadata?: SfConfigV1["metadata"];
|
|
43
90
|
substitute?: SfConfigV1["substitute"];
|
|
91
|
+
grants?: Grant[];
|
|
44
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Config-shape problems use the `config_*` codes; a bad routing rule reports
|
|
95
|
+
* the same code the `_redirects` / `_headers` compiler would give it, because
|
|
96
|
+
* it is the same grammar and the same compiler.
|
|
97
|
+
*/
|
|
45
98
|
export type SfConfigV1Issue = {
|
|
46
|
-
code: "config_alias" | "config_conflict" | "config_identity_moved" | "config_invalid" | "config_key_removed" | "config_unknown_key" | "serve_index_required" | "template_syntax_retired";
|
|
99
|
+
code: "config_alias" | "config_conflict" | "config_identity_moved" | "config_invalid" | "config_key_removed" | "config_unknown_key" | "header_basic_auth_unsupported" | "header_cache_control_platform_managed" | "header_cdn_cache_unsupported" | "header_name_invalid" | "header_name_unsupported" | "header_path_invalid" | "header_pattern_invalid" | "header_port_unsupported" | "header_value_invalid" | "redirect_cache_directive_invalid" | "redirect_cache_not_proxy" | "redirect_destination_invalid" | "redirect_destination_missing" | "redirect_host_invalid" | "redirect_loop_invalid" | "redirect_pattern_invalid" | "redirect_rewrite_destination_invalid" | "redirect_source_invalid" | "redirect_status_unsupported" | "redirect_status_use_rewrites" | "serve_index_required" | "template_syntax_retired";
|
|
47
100
|
severity: "error" | "warning";
|
|
48
101
|
path: string;
|
|
49
102
|
line: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serviceOrigin } from "../config/domains.js";
|
|
2
2
|
import { SPACE_CONFIG_ACCEPTED_FILES, SPACE_CONFIG_CANONICAL_FILE } from "./space-config.js";
|
|
3
3
|
export const SF_CONFIG_V1_CANONICAL_FILE = SPACE_CONFIG_CANONICAL_FILE;
|
|
4
4
|
export const SF_CONFIG_V1_FILES = SPACE_CONFIG_ACCEPTED_FILES;
|
|
5
5
|
/** Published JSON Schema URL for the strict `sf.jsonc` v1 contract. */
|
|
6
|
-
export const SF_CONFIG_V1_SCHEMA_URL = `${
|
|
6
|
+
export const SF_CONFIG_V1_SCHEMA_URL = `${serviceOrigin("www", "prod")}/schemas/sf.v1.json`;
|
|
@@ -104,6 +104,7 @@ export declare const operatorSiteProvisioningSchema: z.ZodOptional<z.ZodObject<{
|
|
|
104
104
|
}, z.core.$strip>>;
|
|
105
105
|
export declare const tenantSiteProvisioningSchema: z.ZodOptional<z.ZodObject<{}, z.core.$strict>>;
|
|
106
106
|
export declare const siteCreateSchema: z.ZodObject<{
|
|
107
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
107
108
|
kind: z.ZodDefault<z.ZodEnum<{
|
|
108
109
|
static_runtime: "static_runtime";
|
|
109
110
|
}>>;
|
|
@@ -407,4 +408,9 @@ export declare const SiteRebalanceResultSchema: z.ZodObject<{
|
|
|
407
408
|
spaceId: z.ZodString;
|
|
408
409
|
operationId: z.ZodString;
|
|
409
410
|
}, z.core.$strip>>;
|
|
411
|
+
warning: z.ZodString;
|
|
412
|
+
domainsRequiringReverification: z.ZodArray<z.ZodObject<{
|
|
413
|
+
spaceId: z.ZodString;
|
|
414
|
+
hostname: z.ZodString;
|
|
415
|
+
}, z.core.$strip>>;
|
|
410
416
|
}, z.core.$strip>;
|
package/dist/contracts/sites.js
CHANGED
|
@@ -11,7 +11,7 @@ export const SiteCapacitySchema = z
|
|
|
11
11
|
.int()
|
|
12
12
|
.nonnegative()
|
|
13
13
|
.optional()
|
|
14
|
-
.describe("Maximum spaces this site
|
|
14
|
+
.describe("Maximum number of spaces this site can host."),
|
|
15
15
|
usedSpaces: z
|
|
16
16
|
.number()
|
|
17
17
|
.int()
|
|
@@ -56,8 +56,8 @@ export const SitePressureSchema = z
|
|
|
56
56
|
// Provider linkage (`providerClientId`, `providerRef`) is operator-only and
|
|
57
57
|
// never appears in this tenant-facing shape.
|
|
58
58
|
export const SiteSchema = z.object({
|
|
59
|
-
id: z.string().describe("
|
|
60
|
-
tenantId: z.string().describe("
|
|
59
|
+
id: z.string().describe("The site id (`site_...`)."),
|
|
60
|
+
tenantId: z.string().describe("The owning tenant id (`ten_...`)."),
|
|
61
61
|
principal: PrincipalRefSchema.nullable().describe("Owning principal within the tenant; null for tenant-level and pool sites."),
|
|
62
62
|
kind: siteKind.describe("Runtime kind. Only the Spacefast static runtime exists today."),
|
|
63
63
|
isolation: siteIsolation.describe("Whether settings/access default to the site or to each space."),
|
|
@@ -67,7 +67,7 @@ export const SiteSchema = z.object({
|
|
|
67
67
|
.string()
|
|
68
68
|
.nullable()
|
|
69
69
|
.describe("Hostname the control plane manages the site runtime through."),
|
|
70
|
-
runtimeInstanceId: z.string().nullable().describe("Runtime instance
|
|
70
|
+
runtimeInstanceId: z.string().nullable().describe("Runtime instance id for this site."),
|
|
71
71
|
provider: z.literal("wpcloud").describe("Hosting provider."),
|
|
72
72
|
capacity: SiteCapacitySchema.nullable().describe("Capacity accounting; null when the site has no explicit budget."),
|
|
73
73
|
operation: AsyncOperationSchema.nullable(),
|
|
@@ -84,7 +84,7 @@ export const operatorSiteProvisioningSchema = z
|
|
|
84
84
|
.trim()
|
|
85
85
|
.min(1)
|
|
86
86
|
.optional()
|
|
87
|
-
.describe("Import an existing WP.Cloud site by its atomic_site_id (operator flows)."),
|
|
87
|
+
.describe("Import an existing WP.Cloud site by its `atomic_site_id` (operator flows)."),
|
|
88
88
|
})
|
|
89
89
|
.optional();
|
|
90
90
|
// An explicit empty object requests fresh provider provisioning while keeping
|
|
@@ -92,9 +92,15 @@ export const operatorSiteProvisioningSchema = z
|
|
|
92
92
|
export const tenantSiteProvisioningSchema = z.object({}).strict().optional();
|
|
93
93
|
export const siteCreateSchema = z
|
|
94
94
|
.object({
|
|
95
|
+
teamId: z
|
|
96
|
+
.string()
|
|
97
|
+
.trim()
|
|
98
|
+
.min(1)
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Team id or slug that will own the site. If omitted, the server infers it from the principal."),
|
|
95
101
|
kind: siteKind.default("static_runtime"),
|
|
96
102
|
isolation: siteIsolation.default("site"),
|
|
97
|
-
region: z.string().trim().min(1).optional().describe('Placement region
|
|
103
|
+
region: z.string().trim().min(1).optional().describe('Placement region. Defaults to `"auto"`.'),
|
|
98
104
|
provisioning: tenantSiteProvisioningSchema,
|
|
99
105
|
})
|
|
100
106
|
.strict();
|
|
@@ -113,14 +119,16 @@ export const SuperadminSiteSchema = SiteSchema.extend({
|
|
|
113
119
|
.string()
|
|
114
120
|
.nullable()
|
|
115
121
|
.describe("WP.Cloud client identity (`pvc_...`) the site is provisioned under."),
|
|
116
|
-
providerRef: z.string().nullable().describe("WP.Cloud atomic_site_id
|
|
122
|
+
providerRef: z.string().nullable().describe("WP.Cloud `atomic_site_id`."),
|
|
117
123
|
});
|
|
118
124
|
export const SuperadminSiteListSchema = z.object({
|
|
119
125
|
sites: z.array(SuperadminSiteSchema),
|
|
120
126
|
});
|
|
121
127
|
// Superadmin site create targets an explicit tenant (the tenant-facing
|
|
122
128
|
// `siteCreateSchema` derives the tenant from the principal).
|
|
123
|
-
export const superadminSiteCreateSchema = siteCreateSchema
|
|
129
|
+
export const superadminSiteCreateSchema = siteCreateSchema
|
|
130
|
+
.omit({ provisioning: true, teamId: true })
|
|
131
|
+
.extend({
|
|
124
132
|
tenantId: z.string().trim().min(1),
|
|
125
133
|
provisioning: operatorSiteProvisioningSchema,
|
|
126
134
|
});
|
|
@@ -133,17 +141,28 @@ export const siteRebalanceRequestSchema = z
|
|
|
133
141
|
.array(z.string().trim().min(1))
|
|
134
142
|
.max(100)
|
|
135
143
|
.optional()
|
|
136
|
-
.describe("Limit the rebalance to these space ids
|
|
144
|
+
.describe("Limit the rebalance to these space ids. If omitted, the server rebalances every live space on the site."),
|
|
137
145
|
})
|
|
138
|
-
.describe("Operator-only rebalance trigger: move spaces off this site.");
|
|
146
|
+
.describe("Operator-only rebalance trigger: move spaces off this site. This is the ONLY path that relocates an existing Space, and it is not free — see the reverification warning on the result.");
|
|
139
147
|
export const SiteRebalanceResultSchema = z
|
|
140
148
|
.object({
|
|
141
|
-
siteId: z.string().describe("The site spaces are being moved off."),
|
|
149
|
+
siteId: z.string().describe("The site id that spaces are being moved off."),
|
|
142
150
|
moves: z
|
|
143
151
|
.array(z.object({
|
|
144
152
|
spaceId: z.string().describe("Space queued to move."),
|
|
145
153
|
operationId: z.string().describe("The queued `space_move` operation id (`op_...`)."),
|
|
146
154
|
}))
|
|
147
155
|
.describe("One queued move operation per affected space."),
|
|
156
|
+
warning: z
|
|
157
|
+
.string()
|
|
158
|
+
.describe("Consequence of relocating these spaces. Each hostname moves to another provider site. The provider re-runs its domain-exclusivity check and rejects the move unless the ownership TXT record is still live in DNS."),
|
|
159
|
+
domainsRequiringReverification: z
|
|
160
|
+
.array(z.object({
|
|
161
|
+
spaceId: z.string().describe("Space the hostname serves."),
|
|
162
|
+
hostname: z
|
|
163
|
+
.string()
|
|
164
|
+
.describe("Custom hostname whose provider ownership check re-runs during the move."),
|
|
165
|
+
}))
|
|
166
|
+
.describe("Live custom hostnames on the moved spaces. Empty means no customer-visible hostname is at risk."),
|
|
148
167
|
})
|
|
149
168
|
.describe("Queued rebalance moves; track each operation for completion.");
|