@spacefast/common 0.0.2
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/README.md +42 -0
- package/dist/brand.d.ts +15 -0
- package/dist/brand.js +24 -0
- package/dist/config/domains.d.ts +30 -0
- package/dist/config/domains.js +75 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +3 -0
- package/dist/contracts/abuse.d.ts +93 -0
- package/dist/contracts/abuse.js +50 -0
- package/dist/contracts/access.d.ts +409 -0
- package/dist/contracts/access.js +396 -0
- package/dist/contracts/account.d.ts +28 -0
- package/dist/contracts/account.js +54 -0
- package/dist/contracts/activity.d.ts +118 -0
- package/dist/contracts/activity.js +180 -0
- package/dist/contracts/analytics.d.ts +56 -0
- package/dist/contracts/analytics.js +91 -0
- package/dist/contracts/annotations.d.ts +327 -0
- package/dist/contracts/annotations.js +234 -0
- package/dist/contracts/api-keys.d.ts +517 -0
- package/dist/contracts/api-keys.js +235 -0
- package/dist/contracts/archives.d.ts +332 -0
- package/dist/contracts/archives.js +120 -0
- package/dist/contracts/auth.d.ts +86 -0
- package/dist/contracts/auth.js +82 -0
- package/dist/contracts/beta.d.ts +106 -0
- package/dist/contracts/beta.js +104 -0
- package/dist/contracts/billing.d.ts +328 -0
- package/dist/contracts/billing.js +203 -0
- package/dist/contracts/builds.d.ts +504 -0
- package/dist/contracts/builds.js +248 -0
- package/dist/contracts/channels.d.ts +49 -0
- package/dist/contracts/channels.js +51 -0
- package/dist/contracts/common.d.ts +238 -0
- package/dist/contracts/common.js +175 -0
- package/dist/contracts/deployments.d.ts +574 -0
- package/dist/contracts/deployments.js +97 -0
- package/dist/contracts/device-auth.d.ts +194 -0
- package/dist/contracts/device-auth.js +162 -0
- package/dist/contracts/domains.d.ts +6115 -0
- package/dist/contracts/domains.js +1435 -0
- package/dist/contracts/enums.d.ts +196 -0
- package/dist/contracts/enums.js +211 -0
- package/dist/contracts/error-code-meta.d.ts +1560 -0
- package/dist/contracts/error-code-meta.js +400 -0
- package/dist/contracts/error-codes.d.ts +13 -0
- package/dist/contracts/error-codes.js +416 -0
- package/dist/contracts/events.d.ts +398 -0
- package/dist/contracts/events.js +320 -0
- package/dist/contracts/fast-domain-search.d.ts +19 -0
- package/dist/contracts/fast-domain-search.js +22 -0
- package/dist/contracts/features.d.ts +240 -0
- package/dist/contracts/features.js +406 -0
- package/dist/contracts/git.d.ts +288 -0
- package/dist/contracts/git.js +116 -0
- package/dist/contracts/ids.d.ts +35 -0
- package/dist/contracts/ids.js +45 -0
- package/dist/contracts/intercom.d.ts +6 -0
- package/dist/contracts/intercom.js +5 -0
- package/dist/contracts/internal.d.ts +103 -0
- package/dist/contracts/internal.js +92 -0
- package/dist/contracts/mcp.d.ts +788 -0
- package/dist/contracts/mcp.js +161 -0
- package/dist/contracts/me.d.ts +81 -0
- package/dist/contracts/me.js +104 -0
- package/dist/contracts/oauth-resources.d.ts +30 -0
- package/dist/contracts/oauth-resources.js +61 -0
- package/dist/contracts/operations.d.ts +54 -0
- package/dist/contracts/operations.js +14 -0
- package/dist/contracts/plan-policy.d.ts +85 -0
- package/dist/contracts/plan-policy.js +75 -0
- package/dist/contracts/platform.d.ts +359 -0
- package/dist/contracts/platform.js +216 -0
- package/dist/contracts/push-new.d.ts +156 -0
- package/dist/contracts/push-new.js +52 -0
- package/dist/contracts/quotas.d.ts +16 -0
- package/dist/contracts/quotas.js +36 -0
- package/dist/contracts/repository-connections.d.ts +231 -0
- package/dist/contracts/repository-connections.js +106 -0
- package/dist/contracts/resources.d.ts +529 -0
- package/dist/contracts/resources.js +209 -0
- package/dist/contracts/routes.d.ts +45 -0
- package/dist/contracts/routes.js +31 -0
- package/dist/contracts/runtime-api.d.ts +449 -0
- package/dist/contracts/runtime-api.js +513 -0
- package/dist/contracts/sites.d.ts +393 -0
- package/dist/contracts/sites.js +121 -0
- package/dist/contracts/slugs.d.ts +31 -0
- package/dist/contracts/slugs.js +47 -0
- package/dist/contracts/space-config.d.ts +216 -0
- package/dist/contracts/space-config.js +237 -0
- package/dist/contracts/space-theme.d.ts +25 -0
- package/dist/contracts/space-theme.js +49 -0
- package/dist/contracts/spaces.d.ts +2760 -0
- package/dist/contracts/spaces.js +589 -0
- package/dist/contracts/superadmin-activity.d.ts +205 -0
- package/dist/contracts/superadmin-activity.js +107 -0
- package/dist/contracts/superadmin-emails.d.ts +212 -0
- package/dist/contracts/superadmin-emails.js +112 -0
- package/dist/contracts/superadmin-queues.d.ts +414 -0
- package/dist/contracts/superadmin-queues.js +202 -0
- package/dist/contracts/superadmin-runtime.d.ts +27 -0
- package/dist/contracts/superadmin-runtime.js +38 -0
- package/dist/contracts/superadmin-spaces.d.ts +429 -0
- package/dist/contracts/superadmin-spaces.js +82 -0
- package/dist/contracts/superadmin-tenants.d.ts +180 -0
- package/dist/contracts/superadmin-tenants.js +117 -0
- package/dist/contracts/superadmin.d.ts +654 -0
- package/dist/contracts/superadmin.js +309 -0
- package/dist/contracts/tags.d.ts +1140 -0
- package/dist/contracts/tags.js +1050 -0
- package/dist/contracts/teams.d.ts +233 -0
- package/dist/contracts/teams.js +174 -0
- package/dist/contracts/telemetry.d.ts +2 -0
- package/dist/contracts/telemetry.js +1 -0
- package/dist/contracts/transfers.d.ts +105 -0
- package/dist/contracts/transfers.js +48 -0
- package/dist/contracts/variables.d.ts +189 -0
- package/dist/contracts/variables.js +82 -0
- package/dist/contracts/webhooks.d.ts +159 -0
- package/dist/contracts/webhooks.js +59 -0
- package/dist/contracts/zero.d.ts +1538 -0
- package/dist/contracts/zero.js +755 -0
- package/dist/docs/agent-prose.d.ts +35 -0
- package/dist/docs/agent-prose.js +153 -0
- package/dist/docs/agent-setup.d.ts +6 -0
- package/dist/docs/agent-setup.js +164 -0
- package/dist/docs/agent-solutions.d.ts +110 -0
- package/dist/docs/agent-solutions.js +181 -0
- package/dist/docs/error-docs.d.ts +12 -0
- package/dist/docs/error-docs.js +1601 -0
- package/dist/docs/skill-distribution.d.ts +12 -0
- package/dist/docs/skill-distribution.js +18 -0
- package/dist/domain-exploration.d.ts +108 -0
- package/dist/domain-exploration.js +488 -0
- package/dist/domain-normalize.d.ts +1 -0
- package/dist/domain-normalize.js +14 -0
- package/dist/domain-zones.d.ts +1 -0
- package/dist/domain-zones.js +5272 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/access-policy.d.ts +39 -0
- package/dist/utils/access-policy.js +232 -0
- package/dist/utils/api.d.ts +4 -0
- package/dist/utils/api.js +13 -0
- package/dist/utils/auth-redirect.d.ts +1 -0
- package/dist/utils/auth-redirect.js +48 -0
- package/dist/utils/auth.d.ts +5 -0
- package/dist/utils/auth.js +13 -0
- package/dist/utils/build-settings.d.ts +49 -0
- package/dist/utils/build-settings.js +366 -0
- package/dist/utils/claim-token.d.ts +1 -0
- package/dist/utils/claim-token.js +9 -0
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.js +5 -0
- package/dist/utils/concurrency.d.ts +1 -0
- package/dist/utils/concurrency.js +18 -0
- package/dist/utils/content-type.d.ts +10 -0
- package/dist/utils/content-type.js +145 -0
- package/dist/utils/error-display.d.ts +7 -0
- package/dist/utils/error-display.js +42 -0
- package/dist/utils/error.d.ts +1 -0
- package/dist/utils/error.js +3 -0
- package/dist/utils/generate-space-name.d.ts +14 -0
- package/dist/utils/generate-space-name.js +95 -0
- package/dist/utils/git-repository.d.ts +5 -0
- package/dist/utils/git-repository.js +99 -0
- package/dist/utils/guards.d.ts +1 -0
- package/dist/utils/guards.js +3 -0
- package/dist/utils/publish-detection.d.ts +10 -0
- package/dist/utils/publish-detection.js +118 -0
- package/dist/utils/publish-policy.d.ts +69 -0
- package/dist/utils/publish-policy.js +429 -0
- package/dist/utils/query-client.d.ts +7 -0
- package/dist/utils/query-client.js +21 -0
- package/dist/utils/query-keys.d.ts +75 -0
- package/dist/utils/query-keys.js +78 -0
- package/dist/utils/runtime-paths.d.ts +7 -0
- package/dist/utils/runtime-paths.js +28 -0
- package/dist/utils/runtime-upload.d.ts +19 -0
- package/dist/utils/runtime-upload.js +27 -0
- package/dist/utils/slug.d.ts +5 -0
- package/dist/utils/slug.js +13 -0
- package/dist/utils/space-config.d.ts +75 -0
- package/dist/utils/space-config.js +415 -0
- package/dist/utils/space-theme.d.ts +16 -0
- package/dist/utils/space-theme.js +89 -0
- package/dist/utils/static-runtime-policy.d.ts +17 -0
- package/dist/utils/static-runtime-policy.js +103 -0
- package/dist/utils/upload-session.d.ts +34 -0
- package/dist/utils/upload-session.js +69 -0
- package/dist/utils/urls.d.ts +2 -0
- package/dist/utils/urls.js +7 -0
- package/dist/utils/version-path.d.ts +6 -0
- package/dist/utils/version-path.js +51 -0
- package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
- package/dist/utils/wpcom-auth-redirects.js +49 -0
- package/dist/utils/zero-realtime-signature.d.ts +12 -0
- package/dist/utils/zero-realtime-signature.js +45 -0
- package/dist/vocabulary.d.ts +230 -0
- package/dist/vocabulary.js +218 -0
- package/package.json +58 -0
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AsyncOperationSchema, baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema, } from "./common.js";
|
|
3
|
+
import { versionStatus, spaceStatus } from "./enums.js";
|
|
4
|
+
import { conventionFilesSchema, uploadInstructionsSchema, manifestFileSchema } from "./internal.js";
|
|
5
|
+
import { ChannelPointerSchema, VersionSchema, PublishSourceSchema, SpaceSchema, } from "./resources.js";
|
|
6
|
+
import { spaceConfigSchema } from "./space-config.js";
|
|
7
|
+
import { principalIdSchema } from "./transfers.js";
|
|
8
|
+
import { zeroRuntimeKindSchema } from "./zero.js";
|
|
9
|
+
export const AnonymousSpaceAccessSchema = z.object({
|
|
10
|
+
claimToken: z
|
|
11
|
+
.string()
|
|
12
|
+
.nullable()
|
|
13
|
+
.describe("One-time, space-scoped credential returned only at anonymous space creation. Save it immediately — it is never shown again and is required to publish and manage the space until it is claimed."),
|
|
14
|
+
claimUrl: z
|
|
15
|
+
.string()
|
|
16
|
+
.nullable()
|
|
17
|
+
.describe("Browser-only link that lets a human log in with WordPress.com and claim this space into an team. Not an API credential."),
|
|
18
|
+
expiresAt: z
|
|
19
|
+
.string()
|
|
20
|
+
.datetime()
|
|
21
|
+
.nullable()
|
|
22
|
+
.describe("When the unclaimed space expires if nobody publishes to it or claims it."),
|
|
23
|
+
warning: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe("Human-readable notice explaining that the space is anonymous and will expire unless claimed."),
|
|
26
|
+
});
|
|
27
|
+
export const SpaceCreateResponseSchema = z.object({
|
|
28
|
+
space: SpaceSchema,
|
|
29
|
+
anonymousAccess: AnonymousSpaceAccessSchema.optional(),
|
|
30
|
+
});
|
|
31
|
+
// Stored per-version diagnostic surfaced on the space diagnostics feed: the shared
|
|
32
|
+
// Diagnostic shape (contracts/common.ts) plus persistence identity.
|
|
33
|
+
export const spaceDiagnosticSchema = baseDiagnosticSchema.extend({
|
|
34
|
+
id: z.string().describe("Stable diagnostic record id."),
|
|
35
|
+
versionId: z.string().describe("Version the diagnostic was recorded against."),
|
|
36
|
+
createdAt: z.string().datetime(),
|
|
37
|
+
});
|
|
38
|
+
export const spaceDiagnosticListResponseSchema = z.object({
|
|
39
|
+
data: z.array(spaceDiagnosticSchema),
|
|
40
|
+
pagination: CursorPaginationSchema,
|
|
41
|
+
});
|
|
42
|
+
export const principalRefInputSchema = z.object({
|
|
43
|
+
type: z.enum(["team", "external"]).describe("Owning principal kind."),
|
|
44
|
+
id: principalIdSchema,
|
|
45
|
+
});
|
|
46
|
+
export const spaceCreateSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
// `siteId` selects the static site the space lives under. Optional today:
|
|
49
|
+
// when omitted the tenant's default static site is resolved (internal-docs/platform.md "Site
|
|
50
|
+
// Context Resolution"). Spaces are valid only under static sites.
|
|
51
|
+
siteId: z.string().min(1).optional(),
|
|
52
|
+
teamId: z.string().nullable().optional(),
|
|
53
|
+
principal: principalRefInputSchema.optional(),
|
|
54
|
+
slug: z.string().min(2).max(55).optional(),
|
|
55
|
+
title: z.string().min(1).max(255).optional(),
|
|
56
|
+
config: spaceConfigSchema.optional().describe("Initial SpaceConfig overlay for the new space."),
|
|
57
|
+
dataLocation: z.string().min(1).optional(),
|
|
58
|
+
})
|
|
59
|
+
.superRefine((value, ctx) => {
|
|
60
|
+
if (value.teamId && value.principal?.type === "team" && value.teamId !== value.principal.id) {
|
|
61
|
+
ctx.addIssue({
|
|
62
|
+
code: z.ZodIssueCode.custom,
|
|
63
|
+
message: "teamId must match principal.id when principal.type is team.",
|
|
64
|
+
path: ["principal", "id"],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
.optional()
|
|
69
|
+
.default({});
|
|
70
|
+
export const spacePatchSchema = z.object({
|
|
71
|
+
title: z.string().min(1).max(255).optional(),
|
|
72
|
+
config: spaceConfigSchema
|
|
73
|
+
.nullable()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("Replaces the stored SpaceConfig overlay; null clears it."),
|
|
76
|
+
dataLocation: z.string().min(1).optional(),
|
|
77
|
+
noindex: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("Hide the live production site from search engines. Applies only to claimed spaces' live hostnames; preview and version hostnames are always noindex."),
|
|
81
|
+
password: z
|
|
82
|
+
.string()
|
|
83
|
+
.min(1)
|
|
84
|
+
.max(255)
|
|
85
|
+
.nullable()
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("Sets (string) or removes (null) space password protection."),
|
|
88
|
+
});
|
|
89
|
+
export const spaceClaimSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
claimToken: z
|
|
92
|
+
.string()
|
|
93
|
+
.min(1)
|
|
94
|
+
.describe("One-time claim token returned at anonymous creation. Rides the body, never URLs; claiming revokes it."),
|
|
95
|
+
teamId: z
|
|
96
|
+
.string()
|
|
97
|
+
.min(1)
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Team receiving the space. Inferred when you belong to exactly one team; otherwise required (`team_required`)."),
|
|
100
|
+
targetTeamId: z
|
|
101
|
+
.string()
|
|
102
|
+
.min(1)
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Alias of teamId; must match when both are provided."),
|
|
105
|
+
})
|
|
106
|
+
.superRefine((value, ctx) => {
|
|
107
|
+
if (value.teamId && value.targetTeamId && value.teamId !== value.targetTeamId) {
|
|
108
|
+
ctx.addIssue({
|
|
109
|
+
code: z.ZodIssueCode.custom,
|
|
110
|
+
path: ["teamId"],
|
|
111
|
+
message: "teamId and targetTeamId must match when both are provided.",
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
export const spaceClaimReminderSchema = z.object({
|
|
116
|
+
email: z
|
|
117
|
+
.string()
|
|
118
|
+
.email()
|
|
119
|
+
.max(320)
|
|
120
|
+
.describe("Expiry-reminder address for an unclaimed anonymous space. Stored only until the space is claimed or expires, then deleted; never logged."),
|
|
121
|
+
});
|
|
122
|
+
export const spaceClaimReminderResponseSchema = z.object({
|
|
123
|
+
accepted: z.literal(true),
|
|
124
|
+
});
|
|
125
|
+
export const spaceVersionCreateSchema = z
|
|
126
|
+
.object({
|
|
127
|
+
source: PublishSourceSchema.optional().describe('Publish provenance recorded on the version; defaults to {kind: "direct_upload"}.'),
|
|
128
|
+
publishMode: z
|
|
129
|
+
.enum(["additive", "snapshot"])
|
|
130
|
+
.default("additive")
|
|
131
|
+
.describe("How to interpret omitted paths in files: additive retains existing paths unless explicitly replaced; snapshot treats files as the complete desired manifest."),
|
|
132
|
+
sourceMetadata: z
|
|
133
|
+
.record(z.string(), z.unknown())
|
|
134
|
+
.optional()
|
|
135
|
+
.describe("Additional control-plane-only provenance for build/deploy read models."),
|
|
136
|
+
buildLog: z
|
|
137
|
+
.string()
|
|
138
|
+
.max(64_000)
|
|
139
|
+
.optional()
|
|
140
|
+
.describe("Bounded build transcript for deploys that ran a local build before publishing."),
|
|
141
|
+
files: z
|
|
142
|
+
.array(manifestFileSchema)
|
|
143
|
+
.optional()
|
|
144
|
+
.describe("Full desired file manifest. For first deploys, send path/size/contentType without hashes so upload can begin immediately. For updates, include sha256 to let the server skip unchanged files. Omit entirely for an open session: the upload token then authorizes any policy-valid path within plan caps and finalize derives the manifest from what was uploaded."),
|
|
145
|
+
deletePaths: z
|
|
146
|
+
.array(z.string().min(1))
|
|
147
|
+
.default([])
|
|
148
|
+
.describe("Explicit paths to remove when publishMode is additive. Omitted paths are retained; only paths listed here are deleted."),
|
|
149
|
+
})
|
|
150
|
+
.superRefine((value, ctx) => {
|
|
151
|
+
if (value.files === undefined && value.deletePaths.length > 0) {
|
|
152
|
+
ctx.addIssue({
|
|
153
|
+
code: z.ZodIssueCode.custom,
|
|
154
|
+
message: "deletePaths requires a declared files manifest.",
|
|
155
|
+
path: ["deletePaths"],
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
export const spaceVersionListSchema = z.object({
|
|
160
|
+
data: z.array(VersionSchema),
|
|
161
|
+
pagination: CursorPaginationSchema,
|
|
162
|
+
});
|
|
163
|
+
export const spaceListSchema = z.object({
|
|
164
|
+
data: z.array(SpaceSchema),
|
|
165
|
+
pagination: CursorPaginationSchema,
|
|
166
|
+
});
|
|
167
|
+
export const spaceListQuerySchema = cursorListQuerySchema.extend({
|
|
168
|
+
team: z.string().min(1).optional().describe("Filter to spaces owned by this team id or slug."),
|
|
169
|
+
});
|
|
170
|
+
export const spaceVersionListQuerySchema = cursorListQuerySchema;
|
|
171
|
+
// Version processing log lines (upload/finalize/promote output), newest-first.
|
|
172
|
+
export const versionLogEntrySchema = z.object({
|
|
173
|
+
timestamp: z.string().datetime().describe("When the version last changed state."),
|
|
174
|
+
level: z.string().describe("Log severity: info or error."),
|
|
175
|
+
code: z.string().describe("Stable version.{status} code for the line."),
|
|
176
|
+
message: z.string().describe("Human-readable log line."),
|
|
177
|
+
});
|
|
178
|
+
export const VERSION_BUILD_LOG_MAX_LENGTH = 512 * 1024;
|
|
179
|
+
export const versionLogListResponseSchema = z.object({
|
|
180
|
+
data: z.array(versionLogEntrySchema),
|
|
181
|
+
pagination: CursorPaginationSchema,
|
|
182
|
+
});
|
|
183
|
+
export const spaceVersionGeneratedPreviewSchema = z.object({
|
|
184
|
+
kind: z.literal("image"),
|
|
185
|
+
status: z.enum(["ready", "pending"]),
|
|
186
|
+
key: z.string(),
|
|
187
|
+
cacheScope: z.enum(["hash", "version-path"]),
|
|
188
|
+
contentType: z.literal("image/webp"),
|
|
189
|
+
width: z.number().int().positive(),
|
|
190
|
+
height: z.number().int().positive(),
|
|
191
|
+
});
|
|
192
|
+
export const spaceVersionFileSchema = manifestFileSchema.extend({
|
|
193
|
+
previewable: z.boolean(),
|
|
194
|
+
generatedPreview: spaceVersionGeneratedPreviewSchema.nullable(),
|
|
195
|
+
});
|
|
196
|
+
export const spaceVersionFileIndexEntrySchema = z.object({
|
|
197
|
+
key: z.string(),
|
|
198
|
+
selector: z.discriminatedUnion("kind", [
|
|
199
|
+
z.object({ kind: z.literal("hash"), sha256: z.string() }),
|
|
200
|
+
z.object({ kind: z.literal("path"), path: z.string() }),
|
|
201
|
+
]),
|
|
202
|
+
primaryPath: z.string(),
|
|
203
|
+
paths: z.array(z.string()),
|
|
204
|
+
count: z.number().int().nonnegative(),
|
|
205
|
+
size: z.number().int().nonnegative(),
|
|
206
|
+
totalBytes: z.number().int().nonnegative(),
|
|
207
|
+
contentTypes: z.array(z.string()),
|
|
208
|
+
previewable: z.boolean(),
|
|
209
|
+
generatedPreview: spaceVersionGeneratedPreviewSchema.nullable(),
|
|
210
|
+
searchText: z.string(),
|
|
211
|
+
});
|
|
212
|
+
export const spaceVersionFileIndexSchema = z.object({
|
|
213
|
+
entries: z.array(spaceVersionFileIndexEntrySchema),
|
|
214
|
+
byHash: z.record(z.string(), spaceVersionFileIndexEntrySchema),
|
|
215
|
+
byPath: z.record(z.string(), spaceVersionFileIndexEntrySchema),
|
|
216
|
+
});
|
|
217
|
+
export const spaceVersionFilesQuerySchema = z.object({
|
|
218
|
+
q: z.string().trim().min(1).max(255).optional(),
|
|
219
|
+
});
|
|
220
|
+
export const spaceVersionFilesSearchSchema = z.object({
|
|
221
|
+
query: z.string().nullable(),
|
|
222
|
+
total: z.number().int().nonnegative(),
|
|
223
|
+
matched: z.number().int().nonnegative(),
|
|
224
|
+
});
|
|
225
|
+
export const spaceVersionFilesResponseSchema = z.object({
|
|
226
|
+
versionId: z.string(),
|
|
227
|
+
files: z.array(spaceVersionFileSchema),
|
|
228
|
+
index: spaceVersionFileIndexSchema,
|
|
229
|
+
search: spaceVersionFilesSearchSchema,
|
|
230
|
+
});
|
|
231
|
+
export const spaceFilesResponseSchema = z.object({
|
|
232
|
+
channel: z.literal("live"),
|
|
233
|
+
versionId: z.string().nullable(),
|
|
234
|
+
files: z.array(spaceVersionFileSchema),
|
|
235
|
+
index: spaceVersionFileIndexSchema,
|
|
236
|
+
search: spaceVersionFilesSearchSchema,
|
|
237
|
+
});
|
|
238
|
+
export const spaceVersionFileQuerySchema = z.object({
|
|
239
|
+
path: z.string().min(1),
|
|
240
|
+
download: z.string().optional(),
|
|
241
|
+
});
|
|
242
|
+
export const spaceVersionFileResponseSchema = z.object({
|
|
243
|
+
versionId: z.string(),
|
|
244
|
+
path: z.string(),
|
|
245
|
+
size: z.number().int().nonnegative(),
|
|
246
|
+
contentType: z.string().nullable(),
|
|
247
|
+
sha256: z.string().nullable(),
|
|
248
|
+
encoding: z.enum(["utf8", "base64"]),
|
|
249
|
+
content: z.string(),
|
|
250
|
+
truncated: z.boolean(),
|
|
251
|
+
cached: z.boolean(),
|
|
252
|
+
});
|
|
253
|
+
export const spaceVersionFileDirectUrlResponseSchema = z.object({
|
|
254
|
+
versionId: z.string(),
|
|
255
|
+
path: z.string(),
|
|
256
|
+
url: z.string().url(),
|
|
257
|
+
managementHostname: z.string(),
|
|
258
|
+
expiresInSeconds: z.number().int().positive(),
|
|
259
|
+
});
|
|
260
|
+
export const spaceVersionFileUrlPreviewSchema = z.object({
|
|
261
|
+
versionId: z.string(),
|
|
262
|
+
path: z.string(),
|
|
263
|
+
sha256: z.string().nullable(),
|
|
264
|
+
source: z.enum(["internet-shortcut", "webloc", "plain-url"]),
|
|
265
|
+
url: z.string().url(),
|
|
266
|
+
fetchedUrl: z.string().url().nullable(),
|
|
267
|
+
title: z.string().nullable(),
|
|
268
|
+
description: z.string().nullable(),
|
|
269
|
+
siteName: z.string().nullable(),
|
|
270
|
+
providerName: z.string().nullable(),
|
|
271
|
+
authorName: z.string().nullable(),
|
|
272
|
+
imageUrl: z.string().url().nullable(),
|
|
273
|
+
oEmbedUrl: z.string().url().nullable(),
|
|
274
|
+
status: z.enum(["ready", "unavailable"]),
|
|
275
|
+
cached: z.boolean(),
|
|
276
|
+
});
|
|
277
|
+
export const spaceVersionConventionArtifactKindSchema = z.enum(["redirects", "headers"]);
|
|
278
|
+
export const spaceVersionConventionArtifactPathSchema = z.enum(["_redirects", "_headers"]);
|
|
279
|
+
export const spaceVersionConventionArtifactSourceSchema = z.enum([
|
|
280
|
+
"uploaded",
|
|
281
|
+
"inherited",
|
|
282
|
+
"override",
|
|
283
|
+
"generated",
|
|
284
|
+
"missing",
|
|
285
|
+
]);
|
|
286
|
+
export const spaceVersionConventionArtifactMetadataSchema = z.object({
|
|
287
|
+
kind: spaceVersionConventionArtifactKindSchema,
|
|
288
|
+
path: spaceVersionConventionArtifactPathSchema,
|
|
289
|
+
source: spaceVersionConventionArtifactSourceSchema,
|
|
290
|
+
present: z.boolean(),
|
|
291
|
+
size: z.number().int().nonnegative().nullable(),
|
|
292
|
+
sha256: z.string().nullable(),
|
|
293
|
+
contentType: z.string().nullable(),
|
|
294
|
+
compiledRuleCount: z.number().int().nonnegative(),
|
|
295
|
+
warningCount: z.number().int().nonnegative(),
|
|
296
|
+
errorCount: z.number().int().nonnegative(),
|
|
297
|
+
});
|
|
298
|
+
export const spaceVersionConventionArtifactsResponseSchema = z.object({
|
|
299
|
+
versionId: z.string(),
|
|
300
|
+
artifacts: z.array(spaceVersionConventionArtifactMetadataSchema),
|
|
301
|
+
});
|
|
302
|
+
export const spaceVersionConventionArtifactQuerySchema = z.object({
|
|
303
|
+
kind: spaceVersionConventionArtifactKindSchema.optional(),
|
|
304
|
+
path: spaceVersionConventionArtifactPathSchema.optional(),
|
|
305
|
+
});
|
|
306
|
+
export const spaceVersionConventionArtifactContentResponseSchema = spaceVersionConventionArtifactMetadataSchema.extend({
|
|
307
|
+
encoding: z.enum(["utf8", "base64"]),
|
|
308
|
+
content: z.string(),
|
|
309
|
+
truncated: z.boolean(),
|
|
310
|
+
});
|
|
311
|
+
export const spaceVersionRoutingDiagnosticSchema = z.object({
|
|
312
|
+
file: spaceVersionConventionArtifactPathSchema,
|
|
313
|
+
line: z.number().int().nonnegative(),
|
|
314
|
+
severity: z.enum(["warning", "error"]),
|
|
315
|
+
code: z.string(),
|
|
316
|
+
message: z.string(),
|
|
317
|
+
source: z.string(),
|
|
318
|
+
});
|
|
319
|
+
export const spaceVersionComputedRoutingSummarySchema = z.object({
|
|
320
|
+
versionId: z.string(),
|
|
321
|
+
source: z.object({
|
|
322
|
+
artifacts: z.array(spaceVersionConventionArtifactMetadataSchema),
|
|
323
|
+
}),
|
|
324
|
+
compiled: z.object({
|
|
325
|
+
redirectRuleCount: z.number().int().nonnegative(),
|
|
326
|
+
headerRuleCount: z.number().int().nonnegative(),
|
|
327
|
+
staticRedirectCount: z.number().int().nonnegative(),
|
|
328
|
+
dynamicRedirectCount: z.number().int().nonnegative(),
|
|
329
|
+
basicAuthRuleCount: z.number().int().nonnegative(),
|
|
330
|
+
proxyRuleCount: z.number().int().nonnegative(),
|
|
331
|
+
}),
|
|
332
|
+
diagnostics: z.array(spaceVersionRoutingDiagnosticSchema),
|
|
333
|
+
});
|
|
334
|
+
export const spaceVersionFileDiffStatusSchema = z.enum([
|
|
335
|
+
"added",
|
|
336
|
+
"modified",
|
|
337
|
+
"deleted",
|
|
338
|
+
"renamed",
|
|
339
|
+
"unchanged",
|
|
340
|
+
"binary",
|
|
341
|
+
"too_large",
|
|
342
|
+
]);
|
|
343
|
+
export const spaceVersionFileDiffEntrySchema = z.object({
|
|
344
|
+
path: z.string(),
|
|
345
|
+
oldPath: z.string().nullable(),
|
|
346
|
+
status: spaceVersionFileDiffStatusSchema,
|
|
347
|
+
before: spaceVersionFileSchema.nullable(),
|
|
348
|
+
after: spaceVersionFileSchema.nullable(),
|
|
349
|
+
patch: z
|
|
350
|
+
.object({
|
|
351
|
+
format: z.literal("unified"),
|
|
352
|
+
content: z.string(),
|
|
353
|
+
truncated: z.boolean(),
|
|
354
|
+
})
|
|
355
|
+
.nullable(),
|
|
356
|
+
});
|
|
357
|
+
export const spaceVersionFileDiffQuerySchema = z.object({
|
|
358
|
+
baseVersionId: z.string().optional(),
|
|
359
|
+
});
|
|
360
|
+
export const spaceVersionFileDiffResponseSchema = z.object({
|
|
361
|
+
versionId: z.string(),
|
|
362
|
+
baseVersionId: z.string().nullable(),
|
|
363
|
+
files: z.array(spaceVersionFileDiffEntrySchema),
|
|
364
|
+
});
|
|
365
|
+
// Upload state is inferable (internal-docs/platform.md L2216): `upload` present means bytes are
|
|
366
|
+
// still needed (then finalize); `versionId` null means the manifest matched and nothing changed.
|
|
367
|
+
// No redundant booleans ride along.
|
|
368
|
+
export const spaceVersionIntentResponseSchema = z.object({
|
|
369
|
+
versionId: z
|
|
370
|
+
.string()
|
|
371
|
+
.nullable()
|
|
372
|
+
.describe("Created version id, or null when the manifest matched and nothing changed."),
|
|
373
|
+
upload: uploadInstructionsSchema
|
|
374
|
+
.nullable()
|
|
375
|
+
.describe("Runtime upload session, present only while bytes still need uploading. Upload, then finalize."),
|
|
376
|
+
ignoredPaths: z
|
|
377
|
+
.array(z.string())
|
|
378
|
+
.default([])
|
|
379
|
+
.describe("Manifest paths ignored by the server because the current plan does not allow them."),
|
|
380
|
+
});
|
|
381
|
+
export const publishRequestSchema = z
|
|
382
|
+
.object({
|
|
383
|
+
spaceId: z.string().min(1).optional(),
|
|
384
|
+
siteId: z.string().min(1).optional(),
|
|
385
|
+
teamId: z.string().nullable().optional(),
|
|
386
|
+
principal: principalRefInputSchema.optional(),
|
|
387
|
+
files: z
|
|
388
|
+
.array(manifestFileSchema)
|
|
389
|
+
.optional()
|
|
390
|
+
.describe("Desired file manifest for a declared publish session. Clients upload returned paths, then finalize. Omit for inline one-shot and open-session publishes."),
|
|
391
|
+
deletePaths: z
|
|
392
|
+
.array(z.string().min(1))
|
|
393
|
+
.default([])
|
|
394
|
+
.describe("Explicit paths to remove when publishMode is additive. Omitted paths are retained; only paths listed here are deleted."),
|
|
395
|
+
source: PublishSourceSchema.optional().describe('Publish provenance recorded on the version; defaults to {kind: "direct_upload"}.'),
|
|
396
|
+
publishMode: z
|
|
397
|
+
.enum(["additive", "snapshot"])
|
|
398
|
+
.default("additive")
|
|
399
|
+
.describe("How to interpret omitted paths in files: additive retains existing paths unless explicitly replaced; snapshot treats files as the complete desired manifest."),
|
|
400
|
+
email: z
|
|
401
|
+
.string()
|
|
402
|
+
.email()
|
|
403
|
+
.max(320)
|
|
404
|
+
.optional()
|
|
405
|
+
.describe("Optional expiry-reminder address for anonymous publishes. Stored only until the space is claimed or expires, then deleted; never logged."),
|
|
406
|
+
channel: z
|
|
407
|
+
.enum(["live"])
|
|
408
|
+
.nullable()
|
|
409
|
+
.optional()
|
|
410
|
+
.describe("Omit for live publish, or pass null to create a ready version without promotion."),
|
|
411
|
+
space: z
|
|
412
|
+
.object({
|
|
413
|
+
slug: z.string().min(2).max(55).optional(),
|
|
414
|
+
title: z.string().min(1).max(255).optional(),
|
|
415
|
+
dataLocation: z.string().min(1).optional(),
|
|
416
|
+
})
|
|
417
|
+
.optional(),
|
|
418
|
+
config: spaceConfigSchema
|
|
419
|
+
.optional()
|
|
420
|
+
.describe("SpaceConfig overlay to store on the space (sf.jsonc contents)."),
|
|
421
|
+
})
|
|
422
|
+
.superRefine((value, ctx) => {
|
|
423
|
+
if (value.teamId && value.principal?.type === "team" && value.teamId !== value.principal.id) {
|
|
424
|
+
ctx.addIssue({
|
|
425
|
+
code: z.ZodIssueCode.custom,
|
|
426
|
+
message: "teamId must match principal.id when principal.type is team.",
|
|
427
|
+
path: ["principal", "id"],
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (value.files === undefined && value.deletePaths.length > 0) {
|
|
431
|
+
ctx.addIssue({
|
|
432
|
+
code: z.ZodIssueCode.custom,
|
|
433
|
+
message: "deletePaths requires a declared files manifest.",
|
|
434
|
+
path: ["deletePaths"],
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
export const publishUploadReceiptSchema = z.object({
|
|
439
|
+
...uploadInstructionsSchema.shape,
|
|
440
|
+
});
|
|
441
|
+
export const publishReceiptSpaceSchema = z.object({
|
|
442
|
+
id: z.string(),
|
|
443
|
+
slug: z.string(),
|
|
444
|
+
publicName: z.string(),
|
|
445
|
+
defaultHostname: z.string(),
|
|
446
|
+
liveUrl: z.string().nullable(),
|
|
447
|
+
});
|
|
448
|
+
export const publishReceiptVersionSchema = z.object({
|
|
449
|
+
id: z.string(),
|
|
450
|
+
status: VersionSchema.shape.status,
|
|
451
|
+
immutableUrl: z.string().nullable(),
|
|
452
|
+
manifestHash: z.string().nullable(),
|
|
453
|
+
});
|
|
454
|
+
export const publishReceiptSchema = z.object({
|
|
455
|
+
space: publishReceiptSpaceSchema,
|
|
456
|
+
version: publishReceiptVersionSchema,
|
|
457
|
+
operation: AsyncOperationSchema.optional().describe("Background finalize operation when publish work continues asynchronously."),
|
|
458
|
+
// Paste-ready one-liner (URL + claim nudge) so agents propagate consistent
|
|
459
|
+
// claim copy into transcripts (internal-docs/platform.md M1a "share blurb").
|
|
460
|
+
shareBlurb: z.string(),
|
|
461
|
+
upload: publishUploadReceiptSchema.optional(),
|
|
462
|
+
claim: z
|
|
463
|
+
.object({
|
|
464
|
+
token: z.string().optional(),
|
|
465
|
+
url: z.string(),
|
|
466
|
+
expiresAt: z.string().datetime(),
|
|
467
|
+
})
|
|
468
|
+
.optional(),
|
|
469
|
+
diagnostics: z
|
|
470
|
+
.array(baseDiagnosticSchema)
|
|
471
|
+
.optional()
|
|
472
|
+
.describe("Publish diagnostics: the `noop_publish` info diagnostic when nothing changed (the only noop signal), manifest warnings such as `path_case_collision`, and serving-shape notes such as `single_html_index` or `files_mode_inferred`."),
|
|
473
|
+
links: z
|
|
474
|
+
.object({
|
|
475
|
+
resume: z
|
|
476
|
+
.string()
|
|
477
|
+
.optional()
|
|
478
|
+
.describe("Resume endpoint; present while bytes still need uploading."),
|
|
479
|
+
finalize: z
|
|
480
|
+
.string()
|
|
481
|
+
.optional()
|
|
482
|
+
.describe("Finalize endpoint; present while bytes still need uploading."),
|
|
483
|
+
promote: z
|
|
484
|
+
.string()
|
|
485
|
+
.optional()
|
|
486
|
+
.describe('Promote endpoint; followable once the version reaches status "ready".'),
|
|
487
|
+
operation: z.string().optional().describe("Operation polling endpoint when publish queued."),
|
|
488
|
+
inspect: z.string().optional().describe("Space resource URL for follow-up reads."),
|
|
489
|
+
})
|
|
490
|
+
.optional()
|
|
491
|
+
.describe("Follow-up links so agents can act on the receipt without knowing the full API."),
|
|
492
|
+
});
|
|
493
|
+
// Same inferable contract as the intent response: `upload` present means bytes are still
|
|
494
|
+
// needed (then finalize); absent means everything declared has already landed.
|
|
495
|
+
export const spaceVersionResumeResponseSchema = z.object({
|
|
496
|
+
versionId: z.string(),
|
|
497
|
+
upload: uploadInstructionsSchema
|
|
498
|
+
.nullable()
|
|
499
|
+
.describe("Fresh runtime upload session, present only while files still need uploading. Upload, then finalize."),
|
|
500
|
+
ignoredPaths: z
|
|
501
|
+
.array(z.string())
|
|
502
|
+
.default([])
|
|
503
|
+
.describe("Manifest paths ignored by the server because the current plan does not allow them."),
|
|
504
|
+
});
|
|
505
|
+
export const spaceVersionRefreshResponseSchema = spaceVersionResumeResponseSchema;
|
|
506
|
+
// Promote body (spec "Explicit version routes"): `{ channel? }` defaulting to
|
|
507
|
+
// "live". Channels beyond live arrive additively; non-live names reject with
|
|
508
|
+
// `channel_unsupported` until then. Rollback is promoting an older ready
|
|
509
|
+
// version to the same channel.
|
|
510
|
+
export const versionPromoteSchema = z
|
|
511
|
+
.object({
|
|
512
|
+
channel: z
|
|
513
|
+
.string()
|
|
514
|
+
.min(1)
|
|
515
|
+
.optional()
|
|
516
|
+
.describe('Channel to point at this version; defaults to "live". Non-live channel names are rejected with channel_unsupported until additional channels ship.'),
|
|
517
|
+
})
|
|
518
|
+
.optional()
|
|
519
|
+
.default({});
|
|
520
|
+
export const spaceFinalizeSchema = z
|
|
521
|
+
.object({
|
|
522
|
+
conventionFiles: conventionFilesSchema.optional(),
|
|
523
|
+
channel: z
|
|
524
|
+
.enum(["live"])
|
|
525
|
+
.nullable()
|
|
526
|
+
.optional()
|
|
527
|
+
.describe("Omit for live publish, or pass null to finalize the version without promoting it."),
|
|
528
|
+
})
|
|
529
|
+
.optional()
|
|
530
|
+
.default({});
|
|
531
|
+
export const spaceRuntimeStatusSchema = z.object({
|
|
532
|
+
liveVersionId: z
|
|
533
|
+
.string()
|
|
534
|
+
.nullable()
|
|
535
|
+
.describe("Version that the live space URL currently points to, if any."),
|
|
536
|
+
pendingVersionId: z
|
|
537
|
+
.string()
|
|
538
|
+
.nullable()
|
|
539
|
+
.describe("Version that live traffic is trying to publish, if any."),
|
|
540
|
+
liveUrl: z
|
|
541
|
+
.string()
|
|
542
|
+
.nullable()
|
|
543
|
+
.describe("Live space URL. Flips to the latest version after a successful publish to `live`."),
|
|
544
|
+
runtimeState: spaceStatus.describe("Space operation-lifecycle status."),
|
|
545
|
+
liveVersionStatus: versionStatus.nullable(),
|
|
546
|
+
liveRuntimeKind: zeroRuntimeKindSchema
|
|
547
|
+
.nullable()
|
|
548
|
+
.describe("Runtime kind declared by the live version, if any."),
|
|
549
|
+
pendingVersionStatus: versionStatus.nullable(),
|
|
550
|
+
operation: AsyncOperationSchema.nullable(),
|
|
551
|
+
});
|
|
552
|
+
// Channel listing entry: the channel name plus its spec ChannelPointer.
|
|
553
|
+
export const spaceChannelSchema = z.object({
|
|
554
|
+
name: z.string().describe('Channel name; "live" is the default channel.'),
|
|
555
|
+
pointer: ChannelPointerSchema,
|
|
556
|
+
});
|
|
557
|
+
export const spaceChannelListResponseSchema = z.object({
|
|
558
|
+
data: z.array(spaceChannelSchema),
|
|
559
|
+
pagination: CursorPaginationSchema,
|
|
560
|
+
});
|
|
561
|
+
export const spaceApplyChangeBaseSchema = z.object({
|
|
562
|
+
kind: z.enum(["variable", "routing", "password", "settings"]),
|
|
563
|
+
name: z.string(),
|
|
564
|
+
label: z.string(),
|
|
565
|
+
});
|
|
566
|
+
export const spaceApplyModeSchema = z.enum(["stage", "apply"]);
|
|
567
|
+
export const spaceApplyChangeSchema = spaceApplyChangeBaseSchema.extend({
|
|
568
|
+
id: z.string(),
|
|
569
|
+
sourceSurface: z.string(),
|
|
570
|
+
applyMode: spaceApplyModeSchema,
|
|
571
|
+
changesetId: z.string().optional(),
|
|
572
|
+
before: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
573
|
+
after: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
574
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
575
|
+
});
|
|
576
|
+
export const spaceApplyStateSchema = z.object({
|
|
577
|
+
status: z.enum(["live", "pending", "applying", "failed"]),
|
|
578
|
+
desiredRevision: z.string().nullable(),
|
|
579
|
+
appliedRevision: z.string().nullable(),
|
|
580
|
+
pendingChangeCount: z.number().int(),
|
|
581
|
+
changes: z.array(spaceApplyChangeSchema),
|
|
582
|
+
operation: AsyncOperationSchema.nullable(),
|
|
583
|
+
lastError: z.string().nullable(),
|
|
584
|
+
canApplyNow: z.boolean(),
|
|
585
|
+
});
|
|
586
|
+
export const spaceApplyResponseSchema = z.object({
|
|
587
|
+
applied: z.boolean(),
|
|
588
|
+
applyState: spaceApplyStateSchema,
|
|
589
|
+
});
|