@spacefast/common 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/brand-assets/spacefast-favicon.svg +16 -0
- package/brand-assets/spacefast-sf-full-bleed.svg +13 -0
- package/brand-assets/spacefast-wordmark.svg +5 -0
- package/dist/agents/connect-targets.d.ts +6 -1
- package/dist/agents/connect-targets.js +19 -0
- package/dist/brand-assets-build.d.ts +26 -0
- package/dist/brand-assets-build.js +81 -0
- package/dist/brand-assets.d.ts +42 -0
- package/dist/brand-assets.js +30 -0
- package/dist/contracts/access.d.ts +143 -0
- package/dist/contracts/access.js +33 -0
- package/dist/contracts/api-keys.d.ts +123 -0
- package/dist/contracts/api-keys.js +65 -0
- package/dist/contracts/builds.d.ts +40 -0
- package/dist/contracts/builds.js +17 -0
- package/dist/contracts/enums.js +5 -4
- package/dist/contracts/error-code-meta.d.ts +116 -4
- package/dist/contracts/error-code-meta.js +29 -1
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +28 -0
- package/dist/contracts/feature-lifecycle-core.d.ts +36 -0
- package/dist/contracts/feature-lifecycle-core.js +220 -0
- package/dist/contracts/feature-lifecycle.d.ts +7 -0
- package/dist/contracts/feature-lifecycle.js +31 -0
- package/dist/contracts/generated-feature-launch-entries.d.ts +2 -0
- package/dist/contracts/generated-feature-launch-entries.js +518 -0
- package/dist/contracts/ids.d.ts +4 -0
- package/dist/contracts/ids.js +8 -0
- package/dist/contracts/operations.d.ts +161 -1
- package/dist/contracts/operations.js +49 -1
- package/dist/contracts/platform.d.ts +6 -0
- package/dist/contracts/platform.js +6 -0
- package/dist/contracts/publishes.d.ts +130 -0
- package/dist/contracts/publishes.js +145 -0
- package/dist/contracts/repository-connections.d.ts +3 -0
- package/dist/contracts/repository-connections.js +13 -0
- package/dist/contracts/resources.d.ts +2 -0
- package/dist/contracts/resources.js +10 -2
- package/dist/contracts/runtime-api.d.ts +2 -0
- package/dist/contracts/runtime-api.js +1 -0
- package/dist/contracts/sf-config-v1.d.ts +75 -0
- package/dist/contracts/sf-config-v1.js +6 -0
- package/dist/contracts/spaces.d.ts +12 -3
- package/dist/contracts/spaces.js +22 -2
- package/dist/contracts/superadmin-spaces.d.ts +2 -0
- package/dist/contracts/superadmin-tenants.d.ts +6 -6
- package/dist/contracts/superadmin-tenants.js +6 -11
- package/dist/contracts/teams.d.ts +8 -11
- package/dist/contracts/teams.js +11 -16
- package/dist/docs/agent-setup.d.ts +51 -0
- package/dist/docs/agent-setup.js +168 -3
- package/dist/docs/error-docs.js +113 -1
- package/dist/slug-policy/blocklist.d.ts +4 -0
- package/dist/slug-policy/blocklist.js +122 -0
- package/dist/slug-policy/index.d.ts +17 -0
- package/dist/slug-policy/index.js +86 -0
- package/dist/utils/concurrency.d.ts +1 -0
- package/dist/utils/concurrency.js +22 -0
- package/dist/utils/email.d.ts +1 -0
- package/dist/utils/email.js +3 -0
- package/dist/utils/query-keys.d.ts +1 -0
- package/dist/utils/query-keys.js +4 -0
- package/dist/utils/sf-config-v1.d.ts +2 -0
- package/dist/utils/sf-config-v1.js +542 -0
- package/package.json +20 -1
|
@@ -1,4 +1,114 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const userOperationKindSchema: z.ZodEnum<{
|
|
3
|
+
approval: "approval";
|
|
4
|
+
version_finalize: "version_finalize";
|
|
5
|
+
version_promote_live: "version_promote_live";
|
|
6
|
+
version_delete: "version_delete";
|
|
7
|
+
build_start: "build_start";
|
|
8
|
+
domain_check: "domain_check";
|
|
9
|
+
domain_ssl_retry: "domain_ssl_retry";
|
|
10
|
+
domain_registration_submit: "domain_registration_submit";
|
|
11
|
+
domain_transfer_submit: "domain_transfer_submit";
|
|
12
|
+
domain_zone_publish: "domain_zone_publish";
|
|
13
|
+
domain_dns_apply: "domain_dns_apply";
|
|
14
|
+
domain_lifecycle: "domain_lifecycle";
|
|
15
|
+
variable_cascade: "variable_cascade";
|
|
16
|
+
webhook_deliver: "webhook_deliver";
|
|
17
|
+
integration_release: "integration_release";
|
|
18
|
+
agent_run: "agent_run";
|
|
19
|
+
}>;
|
|
20
|
+
export type UserOperationKind = z.infer<typeof userOperationKindSchema>;
|
|
21
|
+
export declare const UserOperationSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
status: z.ZodEnum<{
|
|
24
|
+
failed: "failed";
|
|
25
|
+
canceled: "canceled";
|
|
26
|
+
queued: "queued";
|
|
27
|
+
running: "running";
|
|
28
|
+
succeeded: "succeeded";
|
|
29
|
+
}>;
|
|
30
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
31
|
+
type: z.ZodString;
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
total: z.ZodNumber;
|
|
36
|
+
completed: z.ZodNumber;
|
|
37
|
+
failed: z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
code: z.ZodString;
|
|
41
|
+
severity: z.ZodEnum<{
|
|
42
|
+
info: "info";
|
|
43
|
+
warning: "warning";
|
|
44
|
+
error: "error";
|
|
45
|
+
}>;
|
|
46
|
+
message: z.ZodString;
|
|
47
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
49
|
+
registrar: "registrar";
|
|
50
|
+
wpcloud: "wpcloud";
|
|
51
|
+
dns: "dns";
|
|
52
|
+
runtime: "runtime";
|
|
53
|
+
}>>>;
|
|
54
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
55
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
58
|
+
createdAt: z.ZodString;
|
|
59
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
60
|
+
kind: z.ZodEnum<{
|
|
61
|
+
approval: "approval";
|
|
62
|
+
version_finalize: "version_finalize";
|
|
63
|
+
version_promote_live: "version_promote_live";
|
|
64
|
+
version_delete: "version_delete";
|
|
65
|
+
build_start: "build_start";
|
|
66
|
+
domain_check: "domain_check";
|
|
67
|
+
domain_ssl_retry: "domain_ssl_retry";
|
|
68
|
+
domain_registration_submit: "domain_registration_submit";
|
|
69
|
+
domain_transfer_submit: "domain_transfer_submit";
|
|
70
|
+
domain_zone_publish: "domain_zone_publish";
|
|
71
|
+
domain_dns_apply: "domain_dns_apply";
|
|
72
|
+
domain_lifecycle: "domain_lifecycle";
|
|
73
|
+
variable_cascade: "variable_cascade";
|
|
74
|
+
webhook_deliver: "webhook_deliver";
|
|
75
|
+
integration_release: "integration_release";
|
|
76
|
+
agent_run: "agent_run";
|
|
77
|
+
}>;
|
|
78
|
+
versionSource: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
direct_upload: "direct_upload";
|
|
80
|
+
git: "git";
|
|
81
|
+
settings: "settings";
|
|
82
|
+
}>>;
|
|
83
|
+
integrationRelease: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
environment: z.ZodEnum<{
|
|
85
|
+
production: "production";
|
|
86
|
+
preview: "preview";
|
|
87
|
+
development: "development";
|
|
88
|
+
}>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
agentRun: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
state: z.ZodEnum<{
|
|
92
|
+
failed: "failed";
|
|
93
|
+
completed: "completed";
|
|
94
|
+
canceled: "canceled";
|
|
95
|
+
queued: "queued";
|
|
96
|
+
running: "running";
|
|
97
|
+
approval_required: "approval_required";
|
|
98
|
+
}>;
|
|
99
|
+
tool: z.ZodString;
|
|
100
|
+
mode: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
approval: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
decision: z.ZodNullable<z.ZodEnum<{
|
|
104
|
+
deny: "deny";
|
|
105
|
+
approve: "approve";
|
|
106
|
+
}>>;
|
|
107
|
+
decidedAt: z.ZodNullable<z.ZodString>;
|
|
108
|
+
expiresAt: z.ZodString;
|
|
109
|
+
consumedAt: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
}, z.core.$strip>;
|
|
2
112
|
export declare const operationListQuerySchema: z.ZodObject<{
|
|
3
113
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
4
114
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -8,7 +118,6 @@ export declare const operationListQuerySchema: z.ZodObject<{
|
|
|
8
118
|
export declare const operationListResponseSchema: z.ZodObject<{
|
|
9
119
|
data: z.ZodArray<z.ZodObject<{
|
|
10
120
|
id: z.ZodString;
|
|
11
|
-
kind: z.ZodString;
|
|
12
121
|
status: z.ZodEnum<{
|
|
13
122
|
failed: "failed";
|
|
14
123
|
canceled: "canceled";
|
|
@@ -46,6 +155,57 @@ export declare const operationListResponseSchema: z.ZodObject<{
|
|
|
46
155
|
}, z.core.$strip>>>;
|
|
47
156
|
createdAt: z.ZodString;
|
|
48
157
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
158
|
+
kind: z.ZodEnum<{
|
|
159
|
+
approval: "approval";
|
|
160
|
+
version_finalize: "version_finalize";
|
|
161
|
+
version_promote_live: "version_promote_live";
|
|
162
|
+
version_delete: "version_delete";
|
|
163
|
+
build_start: "build_start";
|
|
164
|
+
domain_check: "domain_check";
|
|
165
|
+
domain_ssl_retry: "domain_ssl_retry";
|
|
166
|
+
domain_registration_submit: "domain_registration_submit";
|
|
167
|
+
domain_transfer_submit: "domain_transfer_submit";
|
|
168
|
+
domain_zone_publish: "domain_zone_publish";
|
|
169
|
+
domain_dns_apply: "domain_dns_apply";
|
|
170
|
+
domain_lifecycle: "domain_lifecycle";
|
|
171
|
+
variable_cascade: "variable_cascade";
|
|
172
|
+
webhook_deliver: "webhook_deliver";
|
|
173
|
+
integration_release: "integration_release";
|
|
174
|
+
agent_run: "agent_run";
|
|
175
|
+
}>;
|
|
176
|
+
versionSource: z.ZodOptional<z.ZodEnum<{
|
|
177
|
+
direct_upload: "direct_upload";
|
|
178
|
+
git: "git";
|
|
179
|
+
settings: "settings";
|
|
180
|
+
}>>;
|
|
181
|
+
integrationRelease: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
environment: z.ZodEnum<{
|
|
183
|
+
production: "production";
|
|
184
|
+
preview: "preview";
|
|
185
|
+
development: "development";
|
|
186
|
+
}>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
agentRun: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
state: z.ZodEnum<{
|
|
190
|
+
failed: "failed";
|
|
191
|
+
completed: "completed";
|
|
192
|
+
canceled: "canceled";
|
|
193
|
+
queued: "queued";
|
|
194
|
+
running: "running";
|
|
195
|
+
approval_required: "approval_required";
|
|
196
|
+
}>;
|
|
197
|
+
tool: z.ZodString;
|
|
198
|
+
mode: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
approval: z.ZodOptional<z.ZodObject<{
|
|
201
|
+
decision: z.ZodNullable<z.ZodEnum<{
|
|
202
|
+
deny: "deny";
|
|
203
|
+
approve: "approve";
|
|
204
|
+
}>>;
|
|
205
|
+
decidedAt: z.ZodNullable<z.ZodString>;
|
|
206
|
+
expiresAt: z.ZodString;
|
|
207
|
+
consumedAt: z.ZodNullable<z.ZodString>;
|
|
208
|
+
}, z.core.$strip>>;
|
|
49
209
|
}, z.core.$strip>>;
|
|
50
210
|
pagination: z.ZodObject<{
|
|
51
211
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AsyncOperationSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
+
export const userOperationKindSchema = z.enum([
|
|
4
|
+
"version_finalize",
|
|
5
|
+
"version_promote_live",
|
|
6
|
+
"version_delete",
|
|
7
|
+
"build_start",
|
|
8
|
+
"domain_check",
|
|
9
|
+
"domain_ssl_retry",
|
|
10
|
+
"domain_registration_submit",
|
|
11
|
+
"domain_transfer_submit",
|
|
12
|
+
"domain_zone_publish",
|
|
13
|
+
"domain_dns_apply",
|
|
14
|
+
"domain_lifecycle",
|
|
15
|
+
"variable_cascade",
|
|
16
|
+
"webhook_deliver",
|
|
17
|
+
"integration_release",
|
|
18
|
+
"agent_run",
|
|
19
|
+
"approval",
|
|
20
|
+
]);
|
|
21
|
+
export const UserOperationSchema = AsyncOperationSchema.extend({
|
|
22
|
+
kind: userOperationKindSchema,
|
|
23
|
+
versionSource: z
|
|
24
|
+
.enum(["direct_upload", "git", "settings"])
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Version provenance for version operations; settings marks a settings publish, while direct_upload and git mark content publishes. Omitted for legacy rows."),
|
|
27
|
+
integrationRelease: z
|
|
28
|
+
.object({
|
|
29
|
+
environment: z.enum(["production", "preview", "development"]),
|
|
30
|
+
})
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Release environment for an integration tag pointer flip."),
|
|
33
|
+
agentRun: z
|
|
34
|
+
.object({
|
|
35
|
+
state: z.enum(["queued", "running", "approval_required", "completed", "failed", "canceled"]),
|
|
36
|
+
tool: z.string(),
|
|
37
|
+
mode: z.string().optional(),
|
|
38
|
+
})
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Authoritative agent execution state and the tool invocation that produced it."),
|
|
41
|
+
approval: z
|
|
42
|
+
.object({
|
|
43
|
+
decision: z.enum(["approve", "deny"]).nullable(),
|
|
44
|
+
decidedAt: z.string().datetime().nullable(),
|
|
45
|
+
expiresAt: z.string().datetime(),
|
|
46
|
+
consumedAt: z.string().datetime().nullable(),
|
|
47
|
+
})
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Current approval decision and lifecycle timestamps from the approval authority."),
|
|
50
|
+
});
|
|
3
51
|
export const operationListQuerySchema = cursorListQuerySchema.extend({
|
|
4
52
|
resourceType: z
|
|
5
53
|
.string()
|
|
@@ -9,6 +57,6 @@ export const operationListQuerySchema = cursorListQuerySchema.extend({
|
|
|
9
57
|
resourceId: z.string().min(1).optional().describe("Filter to operations touching one resource."),
|
|
10
58
|
});
|
|
11
59
|
export const operationListResponseSchema = z.object({
|
|
12
|
-
data: z.array(
|
|
60
|
+
data: z.array(UserOperationSchema),
|
|
13
61
|
pagination: CursorPaginationSchema,
|
|
14
62
|
});
|
|
@@ -231,6 +231,12 @@ export declare const runtimeCertificateMutationResponseSchema: z.ZodObject<{
|
|
|
231
231
|
}, z.core.$strip>>;
|
|
232
232
|
raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
233
233
|
}, z.core.$strip>;
|
|
234
|
+
export declare const runtimeCertificateValidationResponseSchema: z.ZodObject<{
|
|
235
|
+
valid: z.ZodBoolean;
|
|
236
|
+
errors: z.ZodArray<z.ZodString>;
|
|
237
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
238
|
+
validations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
239
|
+
}, z.core.$strip>;
|
|
234
240
|
export declare const runtimeCertificateActivateSchema: z.ZodObject<{
|
|
235
241
|
domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
236
242
|
}, z.core.$strip>;
|
|
@@ -141,6 +141,12 @@ export const runtimeCertificateMutationResponseSchema = z.object({
|
|
|
141
141
|
certificate: runtimeCertificateSchema.nullable(),
|
|
142
142
|
raw: z.record(z.string(), z.unknown()),
|
|
143
143
|
});
|
|
144
|
+
export const runtimeCertificateValidationResponseSchema = z.object({
|
|
145
|
+
valid: z.boolean(),
|
|
146
|
+
errors: z.array(z.string()),
|
|
147
|
+
warnings: z.array(z.string()),
|
|
148
|
+
validations: z.record(z.string(), z.record(z.string(), z.unknown())),
|
|
149
|
+
});
|
|
144
150
|
export const runtimeCertificateActivateSchema = z.object({
|
|
145
151
|
domains: z.array(z.string()).optional(),
|
|
146
152
|
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const publishStates: readonly ["awaiting_upload", "uploaded", "parked", "materializing", "succeeded", "failed", "cancelled", "expired"];
|
|
3
|
+
export declare const publishStateSchema: z.ZodEnum<{
|
|
4
|
+
failed: "failed";
|
|
5
|
+
expired: "expired";
|
|
6
|
+
uploaded: "uploaded";
|
|
7
|
+
succeeded: "succeeded";
|
|
8
|
+
materializing: "materializing";
|
|
9
|
+
awaiting_upload: "awaiting_upload";
|
|
10
|
+
parked: "parked";
|
|
11
|
+
cancelled: "cancelled";
|
|
12
|
+
}>;
|
|
13
|
+
export type PublishState = z.infer<typeof publishStateSchema>;
|
|
14
|
+
export declare const publishIdSchema: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
15
|
+
export declare const publishAdmissionSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
17
|
+
idempotencyKey: z.ZodString;
|
|
18
|
+
requestFingerprint: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const publishSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
22
|
+
state: z.ZodLiteral<"awaiting_upload">;
|
|
23
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
spaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
|
|
25
|
+
baseVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
counts: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
received: z.ZodNumber;
|
|
29
|
+
missing: z.ZodNumber;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
32
|
+
upload: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
missing: z.ZodArray<z.ZodObject<{
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
36
|
+
size: z.ZodNumber;
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
39
|
+
expiresAt: z.ZodString;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
44
|
+
state: z.ZodLiteral<"uploaded">;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
47
|
+
state: z.ZodLiteral<"parked">;
|
|
48
|
+
reason: z.ZodLiteral<"capacity">;
|
|
49
|
+
queuePosition: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
nextCheckAfterSeconds: z.ZodNumber;
|
|
51
|
+
actions: z.ZodTuple<[z.ZodObject<{
|
|
52
|
+
kind: z.ZodLiteral<"cancel_publish">;
|
|
53
|
+
publishId: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
54
|
+
}, z.core.$strip>], null>;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
57
|
+
state: z.ZodLiteral<"materializing">;
|
|
58
|
+
operation: z.ZodObject<{
|
|
59
|
+
id: z.ZodCustom<`op_${string}`, `op_${string}`>;
|
|
60
|
+
kind: z.ZodLiteral<"publish.finalize">;
|
|
61
|
+
status: z.ZodEnum<{
|
|
62
|
+
queued: "queued";
|
|
63
|
+
running: "running";
|
|
64
|
+
}>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
68
|
+
state: z.ZodLiteral<"succeeded">;
|
|
69
|
+
outcome: z.ZodEnum<{
|
|
70
|
+
created: "created";
|
|
71
|
+
unchanged: "unchanged";
|
|
72
|
+
updated: "updated";
|
|
73
|
+
}>;
|
|
74
|
+
capturedBaseVersionId: z.ZodOptional<z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>>;
|
|
75
|
+
result: z.ZodObject<{
|
|
76
|
+
space: z.ZodObject<{
|
|
77
|
+
id: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
|
|
78
|
+
liveUrl: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
version: z.ZodObject<{
|
|
81
|
+
id: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
|
|
82
|
+
immutableUrl: z.ZodString;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
live: z.ZodObject<{
|
|
85
|
+
previousVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
|
|
86
|
+
versionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
91
|
+
state: z.ZodLiteral<"failed">;
|
|
92
|
+
errorCode: z.ZodString;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
95
|
+
state: z.ZodLiteral<"cancelled">;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
|
|
98
|
+
state: z.ZodLiteral<"expired">;
|
|
99
|
+
}, z.core.$strip>], "state">;
|
|
100
|
+
export type Publish = z.infer<typeof publishSchema>;
|
|
101
|
+
export type PublishAdmission = z.infer<typeof publishAdmissionSchema>;
|
|
102
|
+
export type DurablePublish = Publish & PublishAdmission;
|
|
103
|
+
export type PublishByState<State extends PublishState> = Extract<DurablePublish, {
|
|
104
|
+
state: State;
|
|
105
|
+
}>;
|
|
106
|
+
declare const allowedTransitions: {
|
|
107
|
+
readonly awaiting_upload: readonly ["uploaded", "cancelled", "expired"];
|
|
108
|
+
readonly uploaded: readonly ["parked", "materializing", "cancelled", "expired"];
|
|
109
|
+
readonly parked: readonly ["materializing", "cancelled", "expired"];
|
|
110
|
+
readonly materializing: readonly ["succeeded", "failed", "cancelled", "expired"];
|
|
111
|
+
readonly succeeded: readonly [];
|
|
112
|
+
readonly failed: readonly [];
|
|
113
|
+
readonly cancelled: readonly [];
|
|
114
|
+
readonly expired: readonly [];
|
|
115
|
+
};
|
|
116
|
+
export type NextPublishState<State extends PublishState> = (typeof allowedTransitions)[State][number];
|
|
117
|
+
export declare function canTransitionPublish<From extends PublishState>(from: From, to: PublishState): to is NextPublishState<From>;
|
|
118
|
+
export declare function transitionPublish<From extends PublishState, Next extends DurablePublish>(publish: PublishByState<From>, next: Next & (Next["state"] extends NextPublishState<From> ? unknown : never)): Next;
|
|
119
|
+
export type PublishAdmissionResult<Existing extends PublishAdmission = PublishAdmission> = {
|
|
120
|
+
outcome: "created";
|
|
121
|
+
publish: PublishAdmission;
|
|
122
|
+
} | {
|
|
123
|
+
outcome: "replayed";
|
|
124
|
+
publish: Existing;
|
|
125
|
+
} | {
|
|
126
|
+
outcome: "conflict";
|
|
127
|
+
publish: Existing;
|
|
128
|
+
};
|
|
129
|
+
export declare function convergePublishAdmission<Existing extends PublishAdmission>(existing: Existing | undefined, attempted: PublishAdmission): PublishAdmissionResult<Existing>;
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { registeredIdSchema } from "./ids.js";
|
|
3
|
+
export const publishStates = [
|
|
4
|
+
"awaiting_upload",
|
|
5
|
+
"uploaded",
|
|
6
|
+
"parked",
|
|
7
|
+
"materializing",
|
|
8
|
+
"succeeded",
|
|
9
|
+
"failed",
|
|
10
|
+
"cancelled",
|
|
11
|
+
"expired",
|
|
12
|
+
];
|
|
13
|
+
export const publishStateSchema = z.enum(publishStates);
|
|
14
|
+
export const publishIdSchema = registeredIdSchema("pub");
|
|
15
|
+
const spaceIdSchema = registeredIdSchema("spc");
|
|
16
|
+
const versionIdSchema = registeredIdSchema("ver");
|
|
17
|
+
export const publishAdmissionSchema = z.object({
|
|
18
|
+
id: publishIdSchema,
|
|
19
|
+
idempotencyKey: z.string().min(1),
|
|
20
|
+
requestFingerprint: z.string().min(1),
|
|
21
|
+
});
|
|
22
|
+
const cancellableActionSchema = z.object({
|
|
23
|
+
kind: z.literal("cancel_publish"),
|
|
24
|
+
publishId: publishIdSchema,
|
|
25
|
+
});
|
|
26
|
+
export const publishSchema = z.discriminatedUnion("state", [
|
|
27
|
+
z.object({
|
|
28
|
+
id: publishIdSchema,
|
|
29
|
+
state: z.literal("awaiting_upload"),
|
|
30
|
+
target: z
|
|
31
|
+
.object({
|
|
32
|
+
spaceId: spaceIdSchema,
|
|
33
|
+
baseVersionId: versionIdSchema.nullable(),
|
|
34
|
+
})
|
|
35
|
+
.optional(),
|
|
36
|
+
counts: z
|
|
37
|
+
.object({
|
|
38
|
+
received: z.number().int().nonnegative(),
|
|
39
|
+
missing: z.number().int().positive(),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
expiresAt: z.string().datetime().optional(),
|
|
43
|
+
upload: z.object({
|
|
44
|
+
missing: z.array(z.object({
|
|
45
|
+
path: z.string(),
|
|
46
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/).nullable(),
|
|
47
|
+
size: z.number().int().nonnegative(),
|
|
48
|
+
url: z.string().url(),
|
|
49
|
+
headers: z.record(z.string(), z.string()),
|
|
50
|
+
expiresAt: z.string().datetime(),
|
|
51
|
+
})).min(1),
|
|
52
|
+
}).optional(),
|
|
53
|
+
}).refine((publish) => publish.counts === undefined ||
|
|
54
|
+
publish.upload === undefined ||
|
|
55
|
+
publish.counts.missing === publish.upload.missing.length, {
|
|
56
|
+
message: "Upload instructions must match the missing upload count.",
|
|
57
|
+
path: ["upload", "missing"],
|
|
58
|
+
}).refine((publish) => publish.counts !== undefined || publish.upload !== undefined, {
|
|
59
|
+
message: "An awaiting_upload publish must carry counts or upload instructions.",
|
|
60
|
+
path: ["counts"],
|
|
61
|
+
}),
|
|
62
|
+
z.object({ id: publishIdSchema, state: z.literal("uploaded") }),
|
|
63
|
+
z
|
|
64
|
+
.object({
|
|
65
|
+
id: publishIdSchema,
|
|
66
|
+
state: z.literal("parked"),
|
|
67
|
+
reason: z.literal("capacity"),
|
|
68
|
+
queuePosition: z.number().int().positive().optional(),
|
|
69
|
+
nextCheckAfterSeconds: z.number().int().positive(),
|
|
70
|
+
actions: z.tuple([cancellableActionSchema]),
|
|
71
|
+
})
|
|
72
|
+
.refine((publish) => publish.actions.every((action) => action.publishId === publish.id), {
|
|
73
|
+
message: "Cancel actions must reference the enclosing publish.",
|
|
74
|
+
path: ["actions"],
|
|
75
|
+
}),
|
|
76
|
+
z.object({
|
|
77
|
+
id: publishIdSchema,
|
|
78
|
+
state: z.literal("materializing"),
|
|
79
|
+
operation: z.object({
|
|
80
|
+
id: registeredIdSchema("op"),
|
|
81
|
+
kind: z.literal("publish.finalize"),
|
|
82
|
+
status: z.enum(["queued", "running"]),
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
z.object({
|
|
86
|
+
id: publishIdSchema,
|
|
87
|
+
state: z.literal("succeeded"),
|
|
88
|
+
outcome: z.enum(["created", "updated", "unchanged"]),
|
|
89
|
+
capturedBaseVersionId: versionIdSchema.nullable().optional(),
|
|
90
|
+
result: z.object({
|
|
91
|
+
space: z.object({ id: spaceIdSchema, liveUrl: z.string().url() }),
|
|
92
|
+
version: z.object({ id: versionIdSchema, immutableUrl: z.string().url() }),
|
|
93
|
+
live: z.object({
|
|
94
|
+
previousVersionId: versionIdSchema.nullable(),
|
|
95
|
+
versionId: versionIdSchema,
|
|
96
|
+
}),
|
|
97
|
+
}),
|
|
98
|
+
}),
|
|
99
|
+
z.object({ id: publishIdSchema, state: z.literal("failed"), errorCode: z.string().min(1) }),
|
|
100
|
+
z.object({ id: publishIdSchema, state: z.literal("cancelled") }),
|
|
101
|
+
z.object({ id: publishIdSchema, state: z.literal("expired") }),
|
|
102
|
+
]);
|
|
103
|
+
// Cancellation may win during materialization only before the Version exists;
|
|
104
|
+
// afterwards it is not cancelable and the outcome is unchanged.
|
|
105
|
+
const allowedTransitions = {
|
|
106
|
+
awaiting_upload: ["uploaded", "cancelled", "expired"],
|
|
107
|
+
uploaded: ["parked", "materializing", "cancelled", "expired"],
|
|
108
|
+
parked: ["materializing", "cancelled", "expired"],
|
|
109
|
+
materializing: ["succeeded", "failed", "cancelled", "expired"],
|
|
110
|
+
succeeded: [],
|
|
111
|
+
failed: [],
|
|
112
|
+
cancelled: [],
|
|
113
|
+
expired: [],
|
|
114
|
+
};
|
|
115
|
+
export function canTransitionPublish(from, to) {
|
|
116
|
+
return allowedTransitions[from].some((candidate) => candidate === to);
|
|
117
|
+
}
|
|
118
|
+
export function transitionPublish(publish, next) {
|
|
119
|
+
if (publish.id !== next.id ||
|
|
120
|
+
publish.idempotencyKey !== next.idempotencyKey ||
|
|
121
|
+
publish.requestFingerprint !== next.requestFingerprint) {
|
|
122
|
+
throw new Error("A publish transition cannot change the durable publish identity.");
|
|
123
|
+
}
|
|
124
|
+
if (!canTransitionPublish(publish.state, next.state)) {
|
|
125
|
+
throw new Error(`Invalid publish transition: ${publish.state} -> ${next.state}`);
|
|
126
|
+
}
|
|
127
|
+
// Project through the wire schema so fields from the previous variant (e.g. a
|
|
128
|
+
// parked `reason` spread into a materializing publish) never leak downstream.
|
|
129
|
+
return {
|
|
130
|
+
...publishSchema.parse(next),
|
|
131
|
+
idempotencyKey: next.idempotencyKey,
|
|
132
|
+
requestFingerprint: next.requestFingerprint,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function convergePublishAdmission(existing, attempted) {
|
|
136
|
+
if (existing === undefined)
|
|
137
|
+
return { outcome: "created", publish: attempted };
|
|
138
|
+
if (existing.idempotencyKey !== attempted.idempotencyKey) {
|
|
139
|
+
throw new Error("Admission convergence requires one idempotency key.");
|
|
140
|
+
}
|
|
141
|
+
if (existing.requestFingerprint !== attempted.requestFingerprint) {
|
|
142
|
+
return { outcome: "conflict", publish: existing };
|
|
143
|
+
}
|
|
144
|
+
return { outcome: "replayed", publish: existing };
|
|
145
|
+
}
|
|
@@ -23,6 +23,9 @@ export declare const RepositoryConnectionSchema: z.ZodObject<{
|
|
|
23
23
|
connected: "connected";
|
|
24
24
|
}>;
|
|
25
25
|
repositoryId: z.ZodNullable<z.ZodString>;
|
|
26
|
+
installationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
cloneUrlConfigured: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
upstreamUrlConfigured: z.ZodDefault<z.ZodBoolean>;
|
|
26
29
|
repositoryName: z.ZodString;
|
|
27
30
|
repositoryFullName: z.ZodString;
|
|
28
31
|
defaultBranch: z.ZodString;
|
|
@@ -15,6 +15,19 @@ export const RepositoryConnectionSchema = z.object({
|
|
|
15
15
|
provider: gitProvider.describe("Git host family for the repository connection."),
|
|
16
16
|
connectionType: repositoryConnectionTypeSchema,
|
|
17
17
|
repositoryId: z.string().nullable(),
|
|
18
|
+
installationId: z
|
|
19
|
+
.string()
|
|
20
|
+
.nullable()
|
|
21
|
+
.default(null)
|
|
22
|
+
.describe("Repository app installation id, when configured."),
|
|
23
|
+
cloneUrlConfigured: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.default(false)
|
|
26
|
+
.describe("Whether a repository clone URL is configured."),
|
|
27
|
+
upstreamUrlConfigured: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.default(false)
|
|
30
|
+
.describe("Whether an upstream repository URL is configured."),
|
|
18
31
|
repositoryName: z.string(),
|
|
19
32
|
repositoryFullName: z.string(),
|
|
20
33
|
defaultBranch: z.string(),
|
|
@@ -38,6 +38,7 @@ export declare const ChannelPointerSchema: z.ZodObject<{
|
|
|
38
38
|
updatedAt: z.ZodString;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
export type ChannelPointer = z.infer<typeof ChannelPointerSchema>;
|
|
41
|
+
export declare const spaceSettingsDigestSchema: z.ZodString;
|
|
41
42
|
export declare const SpaceSchema: z.ZodObject<{
|
|
42
43
|
id: z.ZodString;
|
|
43
44
|
tenantId: z.ZodString;
|
|
@@ -221,6 +222,7 @@ export declare const SpaceSchema: z.ZodObject<{
|
|
|
221
222
|
noscript: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
222
223
|
}, z.core.$strip>>;
|
|
223
224
|
}, z.core.$strip>>;
|
|
225
|
+
settingsDigest: z.ZodString;
|
|
224
226
|
noindex: z.ZodBoolean;
|
|
225
227
|
policy: z.ZodNullable<z.ZodObject<{
|
|
226
228
|
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -49,6 +49,13 @@ export const ChannelPointerSchema = z
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
+
// The versioned-settings CAS token: always the lowercase hex sha256 the
|
|
53
|
+
// control plane computes over canonical {config, title}. Shared by the Space
|
|
54
|
+
// resource (`settingsDigest`) and the PATCH guard (`baseSettingsDigest`) so a
|
|
55
|
+
// caller can never persist an arbitrary string as a "digest".
|
|
56
|
+
export const spaceSettingsDigestSchema = z
|
|
57
|
+
.string()
|
|
58
|
+
.regex(/^[0-9a-f]{64}$/, "must be a 64-character lowercase hex sha256 digest");
|
|
52
59
|
export const SpaceSchema = z.object({
|
|
53
60
|
id: z.string(),
|
|
54
61
|
tenantId: z.string(),
|
|
@@ -61,8 +68,8 @@ export const SpaceSchema = z.object({
|
|
|
61
68
|
title: z.string(),
|
|
62
69
|
status: spaceStatus.describe("Operation-lifecycle status. Serving state is the separate `disabled` axis."),
|
|
63
70
|
// Serving axis, distinct from the operation-lifecycle state: set whenever
|
|
64
|
-
// the space is dark. A disabled space can still be moving.
|
|
65
|
-
//
|
|
71
|
+
// the space is dark. A disabled space can still be moving. Confirmed scan
|
|
72
|
+
// takedowns use `abuse_takedown`; verdict and claim state are separate axes.
|
|
66
73
|
disabled: z
|
|
67
74
|
.object({
|
|
68
75
|
at: z.string().datetime().nullable(),
|
|
@@ -122,6 +129,7 @@ export const SpaceSchema = z.object({
|
|
|
122
129
|
config: spaceConfigSchema
|
|
123
130
|
.nullable()
|
|
124
131
|
.describe("Stored SpaceConfig overlay applied over the live version's sf.jsonc; null when nothing is overridden."),
|
|
132
|
+
settingsDigest: spaceSettingsDigestSchema.describe("CAS token for versioned settings writes (digest over title + config overlay). Send it back as baseSettingsDigest on PATCH to get compare-and-swap semantics."),
|
|
125
133
|
noindex: z
|
|
126
134
|
.boolean()
|
|
127
135
|
.describe("When true, the live production hostnames serve platform noindex directives. Immutable version and preview hostnames are always noindex regardless of this setting."),
|
|
@@ -144,6 +144,7 @@ export declare const runtimeVersionFinalizeRequestSchema: z.ZodObject<{
|
|
|
144
144
|
auth: z.ZodOptional<z.ZodBoolean>;
|
|
145
145
|
env: z.ZodOptional<z.ZodBoolean>;
|
|
146
146
|
realtime: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
logging: z.ZodOptional<z.ZodBoolean>;
|
|
147
148
|
}, z.core.$strip>>>;
|
|
148
149
|
db: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
149
150
|
}, z.core.$strip>>>;
|
|
@@ -157,6 +158,7 @@ export declare const runtimeVersionFinalizeRequestSchema: z.ZodObject<{
|
|
|
157
158
|
auth: z.ZodOptional<z.ZodBoolean>;
|
|
158
159
|
env: z.ZodOptional<z.ZodBoolean>;
|
|
159
160
|
realtime: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
logging: z.ZodOptional<z.ZodBoolean>;
|
|
160
162
|
}, z.core.$strip>>>;
|
|
161
163
|
db: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
162
164
|
}, z.core.$strip>>>;
|
|
@@ -271,6 +271,7 @@ const runtimeZeroEndpointCapabilitiesSchema = z
|
|
|
271
271
|
auth: z.boolean().optional(),
|
|
272
272
|
env: z.boolean().optional(),
|
|
273
273
|
realtime: z.boolean().optional(),
|
|
274
|
+
logging: z.boolean().optional(),
|
|
274
275
|
})
|
|
275
276
|
.default({});
|
|
276
277
|
const runtimeZeroEndpointSchema = z.object({
|