@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,209 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { policyDocSchema } from "./access.js";
|
|
3
|
+
import { AsyncOperationSchema, baseDiagnosticSchema } from "./common.js";
|
|
4
|
+
import { publishSourceKind, versionStatus, spaceDisabledReasonCode, spaceStatus } from "./enums.js";
|
|
5
|
+
import { pendingUploadSchema } from "./internal.js";
|
|
6
|
+
import { spaceConfigSchema } from "./space-config.js";
|
|
7
|
+
export const DiagnosticSchema = baseDiagnosticSchema.extend({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
versionId: z.string(),
|
|
10
|
+
createdAt: z.string().datetime(),
|
|
11
|
+
});
|
|
12
|
+
export const PrincipalRefSchema = z.object({
|
|
13
|
+
tenantId: z.string(),
|
|
14
|
+
principalType: z.enum(["team", "external"]),
|
|
15
|
+
principalId: z.string(),
|
|
16
|
+
});
|
|
17
|
+
// ChannelPointer (internal-docs/platform.md "ChannelPointer"): exactly one of
|
|
18
|
+
// `versionId` | `weighted` is present; an empty pointer is invalid. Weighted
|
|
19
|
+
// pointers (gradual rollouts) are a future write surface — the shape is final.
|
|
20
|
+
export const ChannelPointerSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
versionId: z.string().optional().describe("Version this channel serves."),
|
|
23
|
+
weighted: z
|
|
24
|
+
.array(z.object({
|
|
25
|
+
versionId: z.string(),
|
|
26
|
+
percentage: z.number().int().min(1).max(100),
|
|
27
|
+
}))
|
|
28
|
+
.min(2)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Weighted rollout across >=2 ready versions; percentages sum to 100."),
|
|
31
|
+
updatedAt: z.string().datetime(),
|
|
32
|
+
})
|
|
33
|
+
.superRefine((value, ctx) => {
|
|
34
|
+
const hasVersion = value.versionId !== undefined;
|
|
35
|
+
const hasWeighted = value.weighted !== undefined;
|
|
36
|
+
if (hasVersion === hasWeighted) {
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
message: "Exactly one of versionId or weighted must be present.",
|
|
40
|
+
});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (value.weighted &&
|
|
44
|
+
value.weighted.reduce((sum, entry) => sum + entry.percentage, 0) !== 100) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: z.ZodIssueCode.custom,
|
|
47
|
+
path: ["weighted"],
|
|
48
|
+
message: "Weighted percentages must sum to 100.",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export const SpaceSchema = z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
tenantId: z.string(),
|
|
55
|
+
siteId: z.string().nullable(),
|
|
56
|
+
teamId: z.string().nullable(),
|
|
57
|
+
teamSlug: z.string().nullable(),
|
|
58
|
+
principal: PrincipalRefSchema.nullable(),
|
|
59
|
+
anonymous: z.boolean(),
|
|
60
|
+
slug: z.string(),
|
|
61
|
+
title: z.string(),
|
|
62
|
+
status: spaceStatus.describe("Operation-lifecycle status. Serving state is the separate `disabled` axis."),
|
|
63
|
+
// Serving axis, distinct from the operation-lifecycle state: set whenever
|
|
64
|
+
// the space is dark. A disabled space can still be moving. Malware takedowns
|
|
65
|
+
// are `abuse_takedown` with `details.source = "malware_scan"`.
|
|
66
|
+
disabled: z
|
|
67
|
+
.object({
|
|
68
|
+
at: z.string().datetime().nullable(),
|
|
69
|
+
reasonCode: spaceDisabledReasonCode.describe("Why serving is disabled."),
|
|
70
|
+
})
|
|
71
|
+
.nullable(),
|
|
72
|
+
// Anonymous-claim lifecycle (internal-docs/platform.md Space.claimState): null
|
|
73
|
+
// for spaces that never went through the anonymous lifecycle. `purgeAfter` is
|
|
74
|
+
// the end of the one-day post-expiry recovery window before content deletion.
|
|
75
|
+
claimState: z
|
|
76
|
+
.object({
|
|
77
|
+
expiresAt: z.string().datetime().nullable(),
|
|
78
|
+
claimedAt: z.string().datetime().nullable(),
|
|
79
|
+
purgeAfter: z.string().datetime().nullable(),
|
|
80
|
+
})
|
|
81
|
+
.nullable(),
|
|
82
|
+
// Expiry rescue: present only on a claim-token read that just extended the
|
|
83
|
+
// anonymous hold; reports the new expiry so claim pages can confirm the grant.
|
|
84
|
+
expiryExtension: z.object({ extendedTo: z.string().datetime() }).nullable().optional(),
|
|
85
|
+
defaultHostname: z
|
|
86
|
+
.string()
|
|
87
|
+
.describe("Stable Spacefast-owned default hostname, built from the public project name under view.fast; survives slug renames."),
|
|
88
|
+
publicName: z.string().describe("Public project label used in the managed view.fast hostname."),
|
|
89
|
+
liveUrl: z
|
|
90
|
+
.string()
|
|
91
|
+
.describe("Live space URL: the primary bound domain when one exists, else the default hostname. Always present on non-deleted spaces."),
|
|
92
|
+
dataLocation: z
|
|
93
|
+
.string()
|
|
94
|
+
.describe('Resolved data-location region; immutable after ownership exists. "auto" only while no concrete region is known yet.'),
|
|
95
|
+
channels: z
|
|
96
|
+
.record(z.string(), ChannelPointerSchema)
|
|
97
|
+
.describe('Channel pointers by name; "live" is present once a version has been promoted.'),
|
|
98
|
+
config: spaceConfigSchema
|
|
99
|
+
.nullable()
|
|
100
|
+
.describe("Stored SpaceConfig overlay applied over the live version's sf.jsonc; null when nothing is overridden."),
|
|
101
|
+
noindex: z
|
|
102
|
+
.boolean()
|
|
103
|
+
.describe("When true, the live production hostnames serve platform noindex directives. Immutable version and preview hostnames are always noindex regardless of this setting."),
|
|
104
|
+
policy: policyDocSchema
|
|
105
|
+
.nullable()
|
|
106
|
+
.describe("Deprecated space-level access projection. Use /v1/spaces/{spaceId}/access and /effective for the unified policy lane."),
|
|
107
|
+
operation: AsyncOperationSchema.nullable(),
|
|
108
|
+
createdAt: z.string().datetime(),
|
|
109
|
+
updatedAt: z.string().datetime(),
|
|
110
|
+
});
|
|
111
|
+
// PublishSource (internal-docs/platform.md "PublishSource"): the single
|
|
112
|
+
// provenance shape for how a version came to exist. Sent on publish/version
|
|
113
|
+
// create and echoed on the Version resource. Structured CI/git detail beyond
|
|
114
|
+
// the named fields rides in `metadata` (string values only).
|
|
115
|
+
export const PublishSourceSchema = z.object({
|
|
116
|
+
kind: publishSourceKind.describe("How this version was produced."),
|
|
117
|
+
client: z
|
|
118
|
+
.string()
|
|
119
|
+
.max(255)
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Publishing client attribution, e.g. spacefast-cli/1.2.3."),
|
|
122
|
+
branch: z.string().max(255).optional().describe("Git branch the publish came from."),
|
|
123
|
+
commit: z.string().max(64).optional().describe("Git commit SHA the publish came from."),
|
|
124
|
+
message: z
|
|
125
|
+
.string()
|
|
126
|
+
.max(2000)
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("Plain-language description of the publish (the version changelog entry, commit message, or release note). This is THE spelling for the publish description; the version files-diff API is the fallback when none is given."),
|
|
129
|
+
dirty: z
|
|
130
|
+
.boolean()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe("True when the working tree had uncommitted changes at publish time."),
|
|
133
|
+
metadata: z
|
|
134
|
+
.record(z.string(), z.string())
|
|
135
|
+
.optional()
|
|
136
|
+
.describe("Additional provenance (repository, CI run URL, workflow, actor, ...)."),
|
|
137
|
+
git: z
|
|
138
|
+
.object({
|
|
139
|
+
repository: z.string().nullable().optional(),
|
|
140
|
+
repositoryFullName: z.string().nullable().optional(),
|
|
141
|
+
repositoryUrl: z.string().nullable().optional(),
|
|
142
|
+
ref: z.string().nullable().optional(),
|
|
143
|
+
branch: z.string().nullable().optional(),
|
|
144
|
+
branchAliasUrl: z.string().nullable().optional(),
|
|
145
|
+
commit: z.string().nullable().optional(),
|
|
146
|
+
commitSha: z.string().nullable().optional(),
|
|
147
|
+
pullRequestNumber: z.number().nullable().optional(),
|
|
148
|
+
})
|
|
149
|
+
.catchall(z.unknown())
|
|
150
|
+
.optional(),
|
|
151
|
+
});
|
|
152
|
+
export const VersionSchema = z.object({
|
|
153
|
+
id: z.string(),
|
|
154
|
+
ref: z
|
|
155
|
+
.string()
|
|
156
|
+
.nullable()
|
|
157
|
+
.describe('Human ref "v{number}"; null until the version reaches ready.'),
|
|
158
|
+
// Assigned in readiness order when the version reaches `ready`; null before.
|
|
159
|
+
number: z.number().int().positive().nullable(),
|
|
160
|
+
spaceId: z.string(),
|
|
161
|
+
source: PublishSourceSchema.nullable().describe("Publish provenance: who/what produced this version."),
|
|
162
|
+
status: versionStatus,
|
|
163
|
+
failureCode: z.string().nullable(),
|
|
164
|
+
failureMessage: z.string().nullable(),
|
|
165
|
+
failedStage: z.string().nullable(),
|
|
166
|
+
// `sha256:`-prefixed digest of the canonical manifest.
|
|
167
|
+
manifestHash: z.string().nullable(),
|
|
168
|
+
// Build (`bld_`) that produced this version; null for direct uploads.
|
|
169
|
+
buildId: z.string().nullable(),
|
|
170
|
+
// Import provenance: the source version this one was materialized from.
|
|
171
|
+
importedFromVersionId: z.string().nullable(),
|
|
172
|
+
// Finalize-time variable resolution provenance — names and value hashes only,
|
|
173
|
+
// never values.
|
|
174
|
+
variables: z.array(z.object({ name: z.string(), valueHash: z.string() })).nullable(),
|
|
175
|
+
fileCount: z.number().int().nullable(),
|
|
176
|
+
totalBytes: z.number().int().nullable(),
|
|
177
|
+
pendingUploads: z.array(pendingUploadSchema),
|
|
178
|
+
skippedPaths: z.array(z.string()),
|
|
179
|
+
immutableUrl: z
|
|
180
|
+
.string()
|
|
181
|
+
.nullable()
|
|
182
|
+
.describe("Permanent version URL (v{number}--{label}.view.fast form), computed once and stored at ready; survives slug changes, transfers, and channel repointing. Null before ready."),
|
|
183
|
+
isCurrentProduction: z.boolean(),
|
|
184
|
+
siteTitle: z.string(),
|
|
185
|
+
config: spaceConfigSchema
|
|
186
|
+
.nullable()
|
|
187
|
+
.describe("SpaceConfig overlay snapshot the version was finalized with."),
|
|
188
|
+
operation: AsyncOperationSchema.nullable(),
|
|
189
|
+
headersRuleCount: z.number().int(),
|
|
190
|
+
redirectsRuleCount: z.number().int(),
|
|
191
|
+
proxyRouteCount: z.number().int(),
|
|
192
|
+
functionsDetected: z.boolean(),
|
|
193
|
+
buildLog: z.string().nullable(),
|
|
194
|
+
diagnostics: z.array(DiagnosticSchema).default([]),
|
|
195
|
+
createdAt: z.string().datetime(),
|
|
196
|
+
// Retention anchor: stamped when the version first reaches "ready".
|
|
197
|
+
readyAt: z.string().datetime().nullable(),
|
|
198
|
+
// Retention axes computed from plan policy at read time, never stored per row
|
|
199
|
+
// (internal-docs/platform.md "Version retention"). Null = not subject to that
|
|
200
|
+
// axis (live/channel-referenced, anonymous claim lifecycle, or the plan
|
|
201
|
+
// retains indefinitely).
|
|
202
|
+
accessibleUntil: z.string().datetime().nullable(),
|
|
203
|
+
retainedUntil: z.string().datetime().nullable(),
|
|
204
|
+
updatedAt: z.string().datetime(),
|
|
205
|
+
});
|
|
206
|
+
const activeVersionStatuses = new Set(["created", "uploading", "uploaded", "finalizing"]);
|
|
207
|
+
export function hasActiveVersionStatus(status) {
|
|
208
|
+
return Boolean(status && activeVersionStatuses.has(status));
|
|
209
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const websiteRouteSchema: z.ZodObject<{
|
|
3
|
+
hostname: z.ZodString;
|
|
4
|
+
path_prefix: z.ZodDefault<z.ZodString>;
|
|
5
|
+
mount: z.ZodDefault<z.ZodEnum<{
|
|
6
|
+
strip_prefix: "strip_prefix";
|
|
7
|
+
preserve_path: "preserve_path";
|
|
8
|
+
}>>;
|
|
9
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"version">;
|
|
11
|
+
version_id: z.ZodString;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"channel">;
|
|
14
|
+
channel: z.ZodString;
|
|
15
|
+
}, z.core.$strip>], "type">;
|
|
16
|
+
options: z.ZodDefault<z.ZodObject<{
|
|
17
|
+
noindex: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
auth: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
19
|
+
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export declare const websiteRoutesConfigSchema: z.ZodObject<{
|
|
23
|
+
routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
24
|
+
hostname: z.ZodString;
|
|
25
|
+
path_prefix: z.ZodDefault<z.ZodString>;
|
|
26
|
+
mount: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
strip_prefix: "strip_prefix";
|
|
28
|
+
preserve_path: "preserve_path";
|
|
29
|
+
}>>;
|
|
30
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"version">;
|
|
32
|
+
version_id: z.ZodString;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"channel">;
|
|
35
|
+
channel: z.ZodString;
|
|
36
|
+
}, z.core.$strip>], "type">;
|
|
37
|
+
options: z.ZodDefault<z.ZodObject<{
|
|
38
|
+
noindex: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
auth: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
40
|
+
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$strict>>>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type WebsiteRoute = z.infer<typeof websiteRouteSchema>;
|
|
45
|
+
export type WebsiteRoutesConfig = z.infer<typeof websiteRoutesConfigSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const routeTargetSchema = z.discriminatedUnion("type", [
|
|
3
|
+
z.object({
|
|
4
|
+
type: z.literal("version"),
|
|
5
|
+
version_id: z.string().min(1),
|
|
6
|
+
}),
|
|
7
|
+
z.object({
|
|
8
|
+
type: z.literal("channel"),
|
|
9
|
+
channel: z.string().min(1),
|
|
10
|
+
}),
|
|
11
|
+
]);
|
|
12
|
+
export const websiteRouteSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
hostname: z.string().min(1),
|
|
15
|
+
path_prefix: z.string().default("/"),
|
|
16
|
+
mount: z.enum(["strip_prefix", "preserve_path"]).default("strip_prefix"),
|
|
17
|
+
target: routeTargetSchema,
|
|
18
|
+
options: z
|
|
19
|
+
.object({
|
|
20
|
+
noindex: z.boolean().optional(),
|
|
21
|
+
auth: z.unknown().nullable().optional(),
|
|
22
|
+
expires_at: z.string().nullable().optional(),
|
|
23
|
+
})
|
|
24
|
+
.default({}),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
export const websiteRoutesConfigSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
routes: z.array(websiteRouteSchema).default([]),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|