@inf-monkeys-tech/monkeys 1.1.0 → 1.1.1
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/lib/contracts/declarative-control-http.d.ts +55903 -73794
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control-http.js +703 -544
- package/lib/contracts/declarative-control-http.js.map +1 -1
- package/lib/contracts/declarative-control.d.ts +1623 -3
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +2107 -1136
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/render.d.ts +591 -1
- package/lib/contracts/render.d.ts.map +1 -1
- package/lib/contracts/render.js +331 -134
- package/lib/contracts/render.js.map +1 -1
- package/lib/contracts/tenant.d.ts +3 -3
- package/lib/contracts/theme.d.ts +1 -1
- package/lib/esm/contracts/index.mjs +1872 -409
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +3028 -672
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +3016 -670
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +1866 -412
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/overlay-node.schema.json +602 -0
- package/lib/json-schema/page-runtime-bundle.schema.json +602 -0
- package/lib/json-schema/page.schema.json +5619 -11743
- package/lib/json-schema/render-node.schema.json +602 -0
- package/lib/json-schema/render-tree.schema.json +602 -0
- package/lib/runtime/declarative-control-compiler.d.ts +52 -27
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +858 -366
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/schemas/index.d.ts +787 -2335
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +100 -99
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,11 +9,24 @@ const common_1 = require("./common");
|
|
|
9
9
|
const capability_1 = require("./capability");
|
|
10
10
|
const render_1 = require("./render");
|
|
11
11
|
const semantic_1 = require("./semantic");
|
|
12
|
-
exports.DECLARATIVE_CONTROL_API_PREFIX =
|
|
13
|
-
exports.DECLARATIVE_CONTROL_CONTROLLER_PATH =
|
|
14
|
-
exports.DeclarativeResourceKindSchema = zod_1.z.enum([
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
exports.DECLARATIVE_CONTROL_API_PREFIX = "/api/declarative-control";
|
|
13
|
+
exports.DECLARATIVE_CONTROL_CONTROLLER_PATH = "/declarative-control";
|
|
14
|
+
exports.DeclarativeResourceKindSchema = zod_1.z.enum([
|
|
15
|
+
"page",
|
|
16
|
+
"navigation",
|
|
17
|
+
"workbench",
|
|
18
|
+
]);
|
|
19
|
+
exports.DeclarativeAuthoringActionSchema = zod_1.z.enum([
|
|
20
|
+
"validate",
|
|
21
|
+
"preview",
|
|
22
|
+
"publish",
|
|
23
|
+
"rollback",
|
|
24
|
+
]);
|
|
25
|
+
exports.DeclarativeLegacyMigrationKindSchema = zod_1.z.enum([
|
|
26
|
+
"page",
|
|
27
|
+
"page-data-assets",
|
|
28
|
+
"workbench",
|
|
29
|
+
]);
|
|
17
30
|
const encodePath = (value) => encodeURIComponent(value);
|
|
18
31
|
exports.declarativeControlRoutes = {
|
|
19
32
|
validate: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/validate`,
|
|
@@ -36,8 +49,8 @@ exports.declarativeControlRoutes = {
|
|
|
36
49
|
navigationSeedMigration: (placement) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements/${encodePath(placement)}/seed-migration`,
|
|
37
50
|
migrationInspect: (kind, legacyResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/migrations/${kind}/${encodePath(legacyResourceId)}/inspect`,
|
|
38
51
|
migrationCreateDraft: (kind, legacyResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/migrations/${kind}/${encodePath(legacyResourceId)}/draft`,
|
|
39
|
-
migrationCutover: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind ===
|
|
40
|
-
migrationRollback: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind ===
|
|
52
|
+
migrationCutover: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind === "workbench" ? "workbench" : "page"}/${encodePath(targetResourceId)}/publish`,
|
|
53
|
+
migrationRollback: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind === "workbench" ? "workbench" : "page"}/${encodePath(targetResourceId)}/rollback`,
|
|
41
54
|
publicationPlan: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/publication-plans`,
|
|
42
55
|
runtimeResolve: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/resolve`,
|
|
43
56
|
runtimeNavigationBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/bootstrap`,
|
|
@@ -69,44 +82,50 @@ const DeclarativeRuntimePageTargetSchema = zod_1.z
|
|
|
69
82
|
})
|
|
70
83
|
.strict()
|
|
71
84
|
.superRefine((value, context) => {
|
|
72
|
-
if (value.activeReleaseRevisionRef.kind !==
|
|
85
|
+
if (value.activeReleaseRevisionRef.kind !== "page-release") {
|
|
73
86
|
context.addIssue({
|
|
74
|
-
code:
|
|
75
|
-
path: [
|
|
76
|
-
message:
|
|
87
|
+
code: "custom",
|
|
88
|
+
path: ["activeReleaseRevisionRef", "kind"],
|
|
89
|
+
message: "Runtime requests require an exact page-release revision.",
|
|
77
90
|
});
|
|
78
91
|
}
|
|
79
|
-
if (value.pageRevisionRef.kind !==
|
|
92
|
+
if (value.pageRevisionRef.kind !== "page") {
|
|
80
93
|
context.addIssue({
|
|
81
|
-
code:
|
|
82
|
-
path: [
|
|
83
|
-
message:
|
|
94
|
+
code: "custom",
|
|
95
|
+
path: ["pageRevisionRef", "kind"],
|
|
96
|
+
message: "Runtime requests require an exact page revision.",
|
|
84
97
|
});
|
|
85
98
|
}
|
|
86
99
|
});
|
|
87
|
-
const forbiddenRuntimeParameterKeys = new Set([
|
|
100
|
+
const forbiddenRuntimeParameterKeys = new Set([
|
|
101
|
+
"__proto__",
|
|
102
|
+
"prototype",
|
|
103
|
+
"constructor",
|
|
104
|
+
]);
|
|
88
105
|
const rejectRuntimePrototypeKeys = (value, context, path = []) => {
|
|
89
106
|
if (Array.isArray(value)) {
|
|
90
107
|
value.forEach((child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index]));
|
|
91
108
|
return;
|
|
92
109
|
}
|
|
93
|
-
if (!value || typeof value !==
|
|
110
|
+
if (!value || typeof value !== "object")
|
|
94
111
|
return;
|
|
95
112
|
for (const key of Object.keys(value)) {
|
|
96
113
|
if (forbiddenRuntimeParameterKeys.has(key)) {
|
|
97
114
|
context.addIssue({
|
|
98
|
-
code:
|
|
115
|
+
code: "custom",
|
|
99
116
|
path: [...path, key],
|
|
100
|
-
message:
|
|
117
|
+
message: "Prototype-mutating runtime parameter keys are forbidden.",
|
|
101
118
|
});
|
|
102
119
|
}
|
|
103
120
|
rejectRuntimePrototypeKeys(value[key], context, [...path, key]);
|
|
104
121
|
}
|
|
105
122
|
};
|
|
106
123
|
const runtimeParameterDepth = (value, depth = 0) => {
|
|
107
|
-
if (value === null || typeof value !==
|
|
124
|
+
if (value === null || typeof value !== "object")
|
|
108
125
|
return depth;
|
|
109
|
-
const values = Array.isArray(value)
|
|
126
|
+
const values = Array.isArray(value)
|
|
127
|
+
? value
|
|
128
|
+
: Object.values(value);
|
|
110
129
|
return values.reduce((maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)), depth);
|
|
111
130
|
};
|
|
112
131
|
const DeclarativeRuntimeParametersSchema = zod_1.z
|
|
@@ -116,41 +135,41 @@ const DeclarativeRuntimeParametersSchema = zod_1.z
|
|
|
116
135
|
const keys = Object.keys(value);
|
|
117
136
|
if (keys.length > 32)
|
|
118
137
|
context.addIssue({
|
|
119
|
-
code:
|
|
138
|
+
code: "custom",
|
|
120
139
|
path: [],
|
|
121
|
-
message:
|
|
140
|
+
message: "Runtime binding parameters cannot contain more than 32 keys.",
|
|
122
141
|
});
|
|
123
142
|
keys.forEach((key) => {
|
|
124
143
|
if (!common_1.ContractIdentifierSchema.safeParse(key).success)
|
|
125
144
|
context.addIssue({
|
|
126
|
-
code:
|
|
145
|
+
code: "custom",
|
|
127
146
|
path: [key],
|
|
128
|
-
message:
|
|
147
|
+
message: "Runtime parameter keys must be contract identifiers.",
|
|
129
148
|
});
|
|
130
149
|
});
|
|
131
150
|
if (runtimeParameterDepth(value) > 8)
|
|
132
151
|
context.addIssue({
|
|
133
|
-
code:
|
|
152
|
+
code: "custom",
|
|
134
153
|
path: [],
|
|
135
|
-
message:
|
|
154
|
+
message: "Runtime binding parameters cannot exceed 8 nested levels.",
|
|
136
155
|
});
|
|
137
156
|
const serialized = JSON.stringify(value);
|
|
138
157
|
if (new TextEncoder().encode(serialized).length > 16 * 1024)
|
|
139
158
|
context.addIssue({
|
|
140
|
-
code:
|
|
159
|
+
code: "custom",
|
|
141
160
|
path: [],
|
|
142
|
-
message:
|
|
161
|
+
message: "Runtime binding parameters cannot exceed 16 KiB.",
|
|
143
162
|
});
|
|
144
163
|
const visit = (entry, path) => {
|
|
145
|
-
if (typeof entry ===
|
|
164
|
+
if (typeof entry === "string" && entry.length > 2048)
|
|
146
165
|
context.addIssue({
|
|
147
|
-
code:
|
|
166
|
+
code: "custom",
|
|
148
167
|
path,
|
|
149
|
-
message:
|
|
168
|
+
message: "Runtime parameter string values cannot exceed 2048 characters.",
|
|
150
169
|
});
|
|
151
170
|
else if (Array.isArray(entry))
|
|
152
171
|
entry.forEach((child, index) => visit(child, [...path, index]));
|
|
153
|
-
else if (entry && typeof entry ===
|
|
172
|
+
else if (entry && typeof entry === "object")
|
|
154
173
|
Object.entries(entry).forEach(([key, child]) => visit(child, [...path, key]));
|
|
155
174
|
};
|
|
156
175
|
visit(value, []);
|
|
@@ -186,30 +205,60 @@ exports.DeclarativeRuntimeActionRoutePathSchema = zod_1.z
|
|
|
186
205
|
.string()
|
|
187
206
|
.min(1)
|
|
188
207
|
.max(8192)
|
|
189
|
-
.refine((value) => value.startsWith(
|
|
190
|
-
!value.startsWith(
|
|
208
|
+
.refine((value) => value.startsWith("/") &&
|
|
209
|
+
!value.startsWith("//") &&
|
|
191
210
|
value === value.trim() &&
|
|
192
211
|
!/[?#\\\u0000-\u0020\u007f]/.test(value) &&
|
|
193
|
-
!value.includes(
|
|
212
|
+
!value.includes("://"), "An Action route requires an application-relative pathname without query or fragment.");
|
|
194
213
|
exports.DeclarativeRuntimeActionExecuteIntentSchema = DeclarativeRuntimePageTargetSchema.safeExtend({
|
|
195
214
|
intent: common_1.JsonObjectSchema,
|
|
196
215
|
recoveryOnly: zod_1.z.literal(true).optional(),
|
|
197
216
|
pageState: DeclarativeRuntimeParametersSchema,
|
|
198
|
-
files: zod_1.z
|
|
199
|
-
|
|
200
|
-
zod_1.z
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
217
|
+
files: zod_1.z
|
|
218
|
+
.record(zod_1.z.string().min(1).max(256), zod_1.z.union([
|
|
219
|
+
zod_1.z
|
|
220
|
+
.object({
|
|
221
|
+
fileName: zod_1.z.string().min(1).max(255),
|
|
222
|
+
content: zod_1.z.string().max(1048576),
|
|
223
|
+
})
|
|
224
|
+
.strict(),
|
|
225
|
+
zod_1.z
|
|
226
|
+
.object({
|
|
227
|
+
fileName: zod_1.z.string().min(1).max(255),
|
|
228
|
+
canonicalUri: zod_1.z
|
|
229
|
+
.string()
|
|
230
|
+
.regex(/^file:\/\/[^\s/?#]+$/)
|
|
231
|
+
.max(1024),
|
|
232
|
+
})
|
|
233
|
+
.strict(),
|
|
234
|
+
]))
|
|
235
|
+
.superRefine((files, context) => {
|
|
236
|
+
if (Object.keys(files).length > 4 ||
|
|
237
|
+
Object.values(files).reduce((bytes, file) => bytes +
|
|
238
|
+
("content" in file
|
|
239
|
+
? new TextEncoder().encode(file.content).byteLength
|
|
240
|
+
: 0), 0) > 1048576)
|
|
241
|
+
context.addIssue({
|
|
242
|
+
code: "custom",
|
|
243
|
+
message: "Action files exceed the transient input budget.",
|
|
244
|
+
});
|
|
245
|
+
})
|
|
246
|
+
.optional(),
|
|
247
|
+
scope: zod_1.z
|
|
248
|
+
.unknown()
|
|
249
|
+
.superRefine((value, context) => {
|
|
206
250
|
try {
|
|
207
251
|
(0, page_expression_1.assertPageValueBudget)(value);
|
|
208
252
|
}
|
|
209
253
|
catch {
|
|
210
|
-
context.addIssue({
|
|
254
|
+
context.addIssue({
|
|
255
|
+
code: "custom",
|
|
256
|
+
message: "Action instance scope exceeds the safe JSON budget.",
|
|
257
|
+
});
|
|
211
258
|
}
|
|
212
|
-
})
|
|
259
|
+
})
|
|
260
|
+
.pipe(common_1.JsonObjectSchema)
|
|
261
|
+
.optional(),
|
|
213
262
|
routePath: exports.DeclarativeRuntimeActionRoutePathSchema.optional(),
|
|
214
263
|
idempotencyKey: zod_1.z.string().trim().min(1).max(256),
|
|
215
264
|
}).strict();
|
|
@@ -222,12 +271,14 @@ exports.DeclarativeNativeDownloadSchema = zod_1.z
|
|
|
222
271
|
.refine((value) => {
|
|
223
272
|
try {
|
|
224
273
|
const url = new URL(value);
|
|
225
|
-
return [
|
|
274
|
+
return (["http:", "https:"].includes(url.protocol) &&
|
|
275
|
+
!url.username &&
|
|
276
|
+
!url.password);
|
|
226
277
|
}
|
|
227
278
|
catch {
|
|
228
279
|
return false;
|
|
229
280
|
}
|
|
230
|
-
},
|
|
281
|
+
}, "A native download requires an HTTP URL without credentials."),
|
|
231
282
|
fileName: zod_1.z
|
|
232
283
|
.string()
|
|
233
284
|
.min(1)
|
|
@@ -245,7 +296,12 @@ exports.DeclarativeRuntimeActionExecuteResultSchema = zod_1.z
|
|
|
245
296
|
result: common_1.JsonObjectSchema,
|
|
246
297
|
download: exports.DeclarativeNativeDownloadSchema.optional(),
|
|
247
298
|
downloadError: zod_1.z
|
|
248
|
-
.object({
|
|
299
|
+
.object({
|
|
300
|
+
code: zod_1.z.enum([
|
|
301
|
+
"DECLARATIVE_DOWNLOAD_FORBIDDEN",
|
|
302
|
+
"DECLARATIVE_DOWNLOAD_UNAVAILABLE",
|
|
303
|
+
]),
|
|
304
|
+
})
|
|
249
305
|
.strict()
|
|
250
306
|
.optional(),
|
|
251
307
|
idempotentReplay: zod_1.z.boolean(),
|
|
@@ -258,9 +314,9 @@ exports.DeclarativeRuntimeActionExecuteResultSchema = zod_1.z
|
|
|
258
314
|
.superRefine((value, context) => {
|
|
259
315
|
if (value.download && value.downloadError)
|
|
260
316
|
context.addIssue({
|
|
261
|
-
code:
|
|
262
|
-
path: [
|
|
263
|
-
message:
|
|
317
|
+
code: "custom",
|
|
318
|
+
path: ["downloadError"],
|
|
319
|
+
message: "A download response cannot contain both a target and an error.",
|
|
264
320
|
});
|
|
265
321
|
});
|
|
266
322
|
const DeclarativeRuntimeNavigationTargetSchema = zod_1.z
|
|
@@ -270,18 +326,18 @@ const DeclarativeRuntimeNavigationTargetSchema = zod_1.z
|
|
|
270
326
|
})
|
|
271
327
|
.strict()
|
|
272
328
|
.superRefine((value, context) => {
|
|
273
|
-
if (value.activeReleaseRevisionRef.kind !==
|
|
329
|
+
if (value.activeReleaseRevisionRef.kind !== "navigation-release") {
|
|
274
330
|
context.addIssue({
|
|
275
|
-
code:
|
|
276
|
-
path: [
|
|
277
|
-
message:
|
|
331
|
+
code: "custom",
|
|
332
|
+
path: ["activeReleaseRevisionRef", "kind"],
|
|
333
|
+
message: "Navigation Action requests require an exact navigation-release revision.",
|
|
278
334
|
});
|
|
279
335
|
}
|
|
280
|
-
if (value.navigationRevisionRef.kind !==
|
|
336
|
+
if (value.navigationRevisionRef.kind !== "navigation") {
|
|
281
337
|
context.addIssue({
|
|
282
|
-
code:
|
|
283
|
-
path: [
|
|
284
|
-
message:
|
|
338
|
+
code: "custom",
|
|
339
|
+
path: ["navigationRevisionRef", "kind"],
|
|
340
|
+
message: "Navigation Action requests require an exact navigation revision.",
|
|
285
341
|
});
|
|
286
342
|
}
|
|
287
343
|
});
|
|
@@ -311,11 +367,11 @@ exports.DeclarativeAudienceSimulationSchema = zod_1.z
|
|
|
311
367
|
.default([])
|
|
312
368
|
.superRefine((references, context) => {
|
|
313
369
|
references.forEach((reference, index) => {
|
|
314
|
-
if (reference.kind !==
|
|
370
|
+
if (reference.kind !== "group")
|
|
315
371
|
context.addIssue({
|
|
316
|
-
code:
|
|
317
|
-
path: [index,
|
|
318
|
-
message:
|
|
372
|
+
code: "custom",
|
|
373
|
+
path: [index, "kind"],
|
|
374
|
+
message: "Audience simulation only accepts stable Group refs.",
|
|
319
375
|
});
|
|
320
376
|
});
|
|
321
377
|
}),
|
|
@@ -335,19 +391,20 @@ exports.DeclarativeReleaseTargetIntentSchema = zod_1.z
|
|
|
335
391
|
})
|
|
336
392
|
.strict()
|
|
337
393
|
.superRefine((value, context) => {
|
|
338
|
-
if (value.environmentRef.kind !==
|
|
394
|
+
if (value.environmentRef.kind !== "environment" ||
|
|
395
|
+
value.environmentRevisionRef.kind !== "environment") {
|
|
339
396
|
context.addIssue({
|
|
340
|
-
code:
|
|
341
|
-
path: [
|
|
342
|
-
message:
|
|
397
|
+
code: "custom",
|
|
398
|
+
path: ["environmentRevisionRef", "kind"],
|
|
399
|
+
message: "Release targets require an exact environment registration.",
|
|
343
400
|
});
|
|
344
401
|
}
|
|
345
402
|
if (value.environmentRef.id !== value.environmentRevisionRef.id ||
|
|
346
403
|
value.environmentRef.ownerRepo !== value.environmentRevisionRef.ownerRepo) {
|
|
347
404
|
context.addIssue({
|
|
348
|
-
code:
|
|
349
|
-
path: [
|
|
350
|
-
message:
|
|
405
|
+
code: "custom",
|
|
406
|
+
path: ["environmentRevisionRef"],
|
|
407
|
+
message: "The exact environment revision must identify the selected environment.",
|
|
351
408
|
});
|
|
352
409
|
}
|
|
353
410
|
});
|
|
@@ -367,32 +424,32 @@ exports.DeclarativeCommandIntentSchema = zod_1.z
|
|
|
367
424
|
.strict();
|
|
368
425
|
exports.DeclarativeBatchOperationIntentSchema = zod_1.z
|
|
369
426
|
.object({
|
|
370
|
-
action: zod_1.z.enum([
|
|
427
|
+
action: zod_1.z.enum(["publish", "rollback", "deactivate"]).default("publish"),
|
|
371
428
|
resourceKind: exports.DeclarativeResourceKindSchema,
|
|
372
429
|
resourceId: common_1.ContractIdentifierSchema,
|
|
373
430
|
intent: exports.DeclarativeCommandIntentSchema,
|
|
374
431
|
})
|
|
375
432
|
.strict()
|
|
376
433
|
.superRefine((value, context) => {
|
|
377
|
-
if (value.action !==
|
|
434
|
+
if (value.action !== "publish" && !value.intent.releaseSlotId) {
|
|
378
435
|
context.addIssue({
|
|
379
|
-
code:
|
|
380
|
-
path: [
|
|
436
|
+
code: "custom",
|
|
437
|
+
path: ["intent", "releaseSlotId"],
|
|
381
438
|
message: `${value.action} requires an exact active Release slot.`,
|
|
382
439
|
});
|
|
383
440
|
}
|
|
384
|
-
if (value.action ===
|
|
441
|
+
if (value.action === "rollback" && !value.intent.targetReleaseVersion) {
|
|
385
442
|
context.addIssue({
|
|
386
|
-
code:
|
|
387
|
-
path: [
|
|
388
|
-
message:
|
|
443
|
+
code: "custom",
|
|
444
|
+
path: ["intent", "targetReleaseVersion"],
|
|
445
|
+
message: "rollback requires an exact historical Release version.",
|
|
389
446
|
});
|
|
390
447
|
}
|
|
391
|
-
if (value.action !==
|
|
448
|
+
if (value.action !== "rollback" && value.intent.targetReleaseVersion) {
|
|
392
449
|
context.addIssue({
|
|
393
|
-
code:
|
|
394
|
-
path: [
|
|
395
|
-
message:
|
|
450
|
+
code: "custom",
|
|
451
|
+
path: ["intent", "targetReleaseVersion"],
|
|
452
|
+
message: "Only rollback may select a historical Release version.",
|
|
396
453
|
});
|
|
397
454
|
}
|
|
398
455
|
});
|
|
@@ -410,7 +467,7 @@ exports.DeclarativeAuthoringChoiceSchema = zod_1.z
|
|
|
410
467
|
label: declarative_control_1.I18nTextSchema,
|
|
411
468
|
accessPolicy: declarative_control_1.AccessPolicySchema.optional(),
|
|
412
469
|
surface: declarative_control_1.ProductSurfaceSchema.optional(),
|
|
413
|
-
status: zod_1.z.enum([
|
|
470
|
+
status: zod_1.z.enum(["active", "deprecated", "retired", "unavailable"]),
|
|
414
471
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).default({}),
|
|
415
472
|
})
|
|
416
473
|
.strict();
|
|
@@ -429,11 +486,11 @@ exports.DeclarativeCapabilitySchemaDocumentSchema = zod_1.z
|
|
|
429
486
|
})
|
|
430
487
|
.strict()
|
|
431
488
|
.superRefine((value, context) => {
|
|
432
|
-
if (value.schemaRevisionRef.kind !==
|
|
489
|
+
if (value.schemaRevisionRef.kind !== "schema") {
|
|
433
490
|
context.addIssue({
|
|
434
|
-
code:
|
|
435
|
-
path: [
|
|
436
|
-
message:
|
|
491
|
+
code: "custom",
|
|
492
|
+
path: ["schemaRevisionRef", "kind"],
|
|
493
|
+
message: "Capability schema documents must use schema RevisionRefs.",
|
|
437
494
|
});
|
|
438
495
|
}
|
|
439
496
|
});
|
|
@@ -454,12 +511,19 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
|
|
|
454
511
|
allowedChildCapabilityRefs: zod_1.z.array(declarative_control_1.StableRefSchema),
|
|
455
512
|
inputPorts: zod_1.z.array(DeclarativeCapabilityPortSchema),
|
|
456
513
|
outputPorts: zod_1.z.array(DeclarativeCapabilityPortSchema),
|
|
457
|
-
allowedSideEffects: zod_1.z.array(zod_1.z.enum([
|
|
514
|
+
allowedSideEffects: zod_1.z.array(zod_1.z.enum([
|
|
515
|
+
"network",
|
|
516
|
+
"storage",
|
|
517
|
+
"navigation",
|
|
518
|
+
"clipboard",
|
|
519
|
+
"worker",
|
|
520
|
+
"websocket",
|
|
521
|
+
])),
|
|
458
522
|
ontologyRequirements: zod_1.z.array(zod_1.z
|
|
459
523
|
.object({
|
|
460
524
|
inputPort: common_1.ContractIdentifierSchema,
|
|
461
525
|
renderModelSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
462
|
-
modes: zod_1.z.array(zod_1.z.enum([
|
|
526
|
+
modes: zod_1.z.array(zod_1.z.enum(["view", "filter"])).min(1),
|
|
463
527
|
requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
|
|
464
528
|
})
|
|
465
529
|
.strict()),
|
|
@@ -489,9 +553,9 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
|
|
|
489
553
|
const key = `${entry.schemaRevisionRef.ownerRepo}:${entry.schemaRevisionRef.id}@${entry.schemaRevisionRef.revision}:${entry.schemaRevisionRef.contentHash}`;
|
|
490
554
|
if (documents.has(key)) {
|
|
491
555
|
context.addIssue({
|
|
492
|
-
code:
|
|
493
|
-
path: [
|
|
494
|
-
message:
|
|
556
|
+
code: "custom",
|
|
557
|
+
path: ["schemaDocuments", index],
|
|
558
|
+
message: "Capability schema documents must be unique by exact RevisionRef.",
|
|
495
559
|
});
|
|
496
560
|
}
|
|
497
561
|
documents.set(key, index);
|
|
@@ -507,8 +571,8 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
|
|
|
507
571
|
const key = `${reference.ownerRepo}:${reference.id}@${reference.revision}:${reference.contentHash}`;
|
|
508
572
|
if (!documents.has(key)) {
|
|
509
573
|
context.addIssue({
|
|
510
|
-
code:
|
|
511
|
-
path: [
|
|
574
|
+
code: "custom",
|
|
575
|
+
path: ["schemaDocuments"],
|
|
512
576
|
message: `Missing exact schema document for ${reference.id}.`,
|
|
513
577
|
});
|
|
514
578
|
}
|
|
@@ -523,7 +587,7 @@ exports.DesignCapabilityCatalogEntrySchema = zod_1.z
|
|
|
523
587
|
.strict();
|
|
524
588
|
exports.DesignCapabilityCatalogArtifactSchema = zod_1.z
|
|
525
589
|
.object({
|
|
526
|
-
contract: zod_1.z.literal(
|
|
590
|
+
contract: zod_1.z.literal("DesignCapabilityCatalogArtifact"),
|
|
527
591
|
schemaVersion: zod_1.z.literal(1),
|
|
528
592
|
sourceRef: common_1.ContractIdentifierSchema,
|
|
529
593
|
sourceRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
@@ -532,29 +596,29 @@ exports.DesignCapabilityCatalogArtifactSchema = zod_1.z
|
|
|
532
596
|
})
|
|
533
597
|
.strict()
|
|
534
598
|
.superRefine((value, context) => {
|
|
535
|
-
if (value.sourceRevisionRef.kind !==
|
|
599
|
+
if (value.sourceRevisionRef.kind !== "design-capability-catalog" ||
|
|
536
600
|
value.sourceRevisionRef.id !== value.sourceRef ||
|
|
537
|
-
value.sourceRevisionRef.ownerRepo !==
|
|
538
|
-
value.sourceRevisionRef.visibility !==
|
|
601
|
+
value.sourceRevisionRef.ownerRepo !== "monkeys-design" ||
|
|
602
|
+
value.sourceRevisionRef.visibility !== "global") {
|
|
539
603
|
context.addIssue({
|
|
540
|
-
code:
|
|
541
|
-
path: [
|
|
542
|
-
message:
|
|
604
|
+
code: "custom",
|
|
605
|
+
path: ["sourceRevisionRef"],
|
|
606
|
+
message: "A Design catalog artifact must be a global monkeys-design release revision.",
|
|
543
607
|
});
|
|
544
608
|
}
|
|
545
609
|
const ids = value.entries.map((entry) => entry.manifest.id);
|
|
546
610
|
if (new Set(ids).size !== ids.length) {
|
|
547
611
|
context.addIssue({
|
|
548
|
-
code:
|
|
549
|
-
path: [
|
|
550
|
-
message:
|
|
612
|
+
code: "custom",
|
|
613
|
+
path: ["entries"],
|
|
614
|
+
message: "Design catalog capability identities must be unique.",
|
|
551
615
|
});
|
|
552
616
|
}
|
|
553
617
|
if (ids.some((id, index) => index > 0 && ids[index - 1].localeCompare(id) > 0)) {
|
|
554
618
|
context.addIssue({
|
|
555
|
-
code:
|
|
556
|
-
path: [
|
|
557
|
-
message:
|
|
619
|
+
code: "custom",
|
|
620
|
+
path: ["entries"],
|
|
621
|
+
message: "Design catalog entries must use deterministic capability identity order.",
|
|
558
622
|
});
|
|
559
623
|
}
|
|
560
624
|
});
|
|
@@ -574,73 +638,80 @@ exports.ProductDeclarativeCapabilityRegistrationSchema = zod_1.z
|
|
|
574
638
|
.superRefine((value, context) => {
|
|
575
639
|
const ownerRepo = value.manifest.ownerRepo;
|
|
576
640
|
const registration = value.declarativeRegistration;
|
|
577
|
-
if (ownerRepo ===
|
|
641
|
+
if (ownerRepo === "monkeys-design") {
|
|
578
642
|
context.addIssue({
|
|
579
|
-
code:
|
|
580
|
-
path: [
|
|
581
|
-
message:
|
|
643
|
+
code: "custom",
|
|
644
|
+
path: ["manifest", "ownerRepo"],
|
|
645
|
+
message: "Monkeys Design capabilities must come from the Design capability catalog.",
|
|
582
646
|
});
|
|
583
647
|
}
|
|
584
|
-
if (registration.capabilityRevisionRef.kind !==
|
|
648
|
+
if (registration.capabilityRevisionRef.kind !== "capability" ||
|
|
585
649
|
registration.capabilityRevisionRef.id !== value.manifest.id ||
|
|
586
650
|
registration.capabilityRevisionRef.ownerRepo !== ownerRepo ||
|
|
587
|
-
String(registration.capabilityRevisionRef.revision) !==
|
|
588
|
-
|
|
651
|
+
String(registration.capabilityRevisionRef.revision) !==
|
|
652
|
+
String(value.manifest.capabilityVersion) ||
|
|
653
|
+
registration.capabilityRevisionRef.visibility !== "global") {
|
|
589
654
|
context.addIssue({
|
|
590
|
-
code:
|
|
591
|
-
path: [
|
|
592
|
-
message:
|
|
655
|
+
code: "custom",
|
|
656
|
+
path: ["declarativeRegistration", "capabilityRevisionRef"],
|
|
657
|
+
message: "A product capability must pin its exact global product-owned manifest revision.",
|
|
593
658
|
});
|
|
594
659
|
}
|
|
595
|
-
if (registration.providerRevisionRef.kind !==
|
|
660
|
+
if (registration.providerRevisionRef.kind !== "view-provider" ||
|
|
596
661
|
registration.providerRevisionRef.id !== value.provider.providerId ||
|
|
597
662
|
registration.providerRevisionRef.ownerRepo !== ownerRepo ||
|
|
598
663
|
value.provider.ownerRepo !== ownerRepo ||
|
|
599
|
-
String(registration.providerRevisionRef.revision) !==
|
|
600
|
-
|
|
664
|
+
String(registration.providerRevisionRef.revision) !==
|
|
665
|
+
String(value.provider.providerVersion) ||
|
|
666
|
+
registration.providerRevisionRef.visibility !== "global") {
|
|
601
667
|
context.addIssue({
|
|
602
|
-
code:
|
|
603
|
-
path: [
|
|
604
|
-
message:
|
|
668
|
+
code: "custom",
|
|
669
|
+
path: ["declarativeRegistration", "providerRevisionRef"],
|
|
670
|
+
message: "A product capability must pin its exact global product-owned provider revision.",
|
|
605
671
|
});
|
|
606
672
|
}
|
|
607
|
-
if (value.provider.capabilityRef.kind !==
|
|
673
|
+
if (value.provider.capabilityRef.kind !== "capability" ||
|
|
608
674
|
value.provider.capabilityRef.id !== value.manifest.id ||
|
|
609
675
|
value.provider.capabilityRef.ownerRepo !== ownerRepo ||
|
|
610
|
-
String(value.provider.capabilityRef.version) !==
|
|
676
|
+
String(value.provider.capabilityRef.version) !==
|
|
677
|
+
String(value.manifest.capabilityVersion)) {
|
|
611
678
|
context.addIssue({
|
|
612
|
-
code:
|
|
613
|
-
path: [
|
|
614
|
-
message:
|
|
679
|
+
code: "custom",
|
|
680
|
+
path: ["provider", "capabilityRef"],
|
|
681
|
+
message: "A product provider must declare its exact capability owner.",
|
|
615
682
|
});
|
|
616
683
|
}
|
|
617
|
-
const providerBoundByManifest = value.manifest.runtime.providerBindings.some((binding) => binding.providerRef.kind ===
|
|
684
|
+
const providerBoundByManifest = value.manifest.runtime.providerBindings.some((binding) => binding.providerRef.kind === "view-provider" &&
|
|
618
685
|
binding.providerRef.id === value.provider.providerId &&
|
|
619
686
|
binding.providerRef.ownerRepo === ownerRepo &&
|
|
620
|
-
String(binding.providerRef.version) ===
|
|
687
|
+
String(binding.providerRef.version) ===
|
|
688
|
+
String(value.provider.providerVersion));
|
|
621
689
|
if (!providerBoundByManifest) {
|
|
622
690
|
context.addIssue({
|
|
623
|
-
code:
|
|
624
|
-
path: [
|
|
625
|
-
message:
|
|
691
|
+
code: "custom",
|
|
692
|
+
path: ["manifest", "runtime", "providerBindings"],
|
|
693
|
+
message: "The product capability manifest must bind the declared product provider.",
|
|
626
694
|
});
|
|
627
695
|
}
|
|
628
|
-
if (registration.registrationRevisionRef.kind !==
|
|
696
|
+
if (registration.registrationRevisionRef.kind !==
|
|
697
|
+
"product-capability-registration" ||
|
|
629
698
|
registration.registrationRevisionRef.ownerRepo !== ownerRepo ||
|
|
630
|
-
registration.registrationRevisionRef.visibility !==
|
|
631
|
-
registration.registrationRevisionRef.contentHash !==
|
|
699
|
+
registration.registrationRevisionRef.visibility !== "global" ||
|
|
700
|
+
registration.registrationRevisionRef.contentHash !==
|
|
701
|
+
registration.sourceContentHash) {
|
|
632
702
|
context.addIssue({
|
|
633
|
-
code:
|
|
634
|
-
path: [
|
|
635
|
-
message:
|
|
703
|
+
code: "custom",
|
|
704
|
+
path: ["declarativeRegistration", "registrationRevisionRef"],
|
|
705
|
+
message: "A product capability registration must have exact product-owned release provenance.",
|
|
636
706
|
});
|
|
637
707
|
}
|
|
638
708
|
registration.schemaDocuments.forEach((schema, index) => {
|
|
639
|
-
if (schema.schemaRevisionRef.ownerRepo !== ownerRepo ||
|
|
709
|
+
if (schema.schemaRevisionRef.ownerRepo !== ownerRepo ||
|
|
710
|
+
schema.schemaRevisionRef.visibility !== "global") {
|
|
640
711
|
context.addIssue({
|
|
641
|
-
code:
|
|
642
|
-
path: [
|
|
643
|
-
message:
|
|
712
|
+
code: "custom",
|
|
713
|
+
path: ["declarativeRegistration", "schemaDocuments", index],
|
|
714
|
+
message: "Embedded product capability Schemas require exact global product authority.",
|
|
644
715
|
});
|
|
645
716
|
}
|
|
646
717
|
});
|
|
@@ -648,9 +719,9 @@ exports.ProductDeclarativeCapabilityRegistrationSchema = zod_1.z
|
|
|
648
719
|
if (new Set(permissions).size !== permissions.length ||
|
|
649
720
|
permissions.some((permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0)) {
|
|
650
721
|
context.addIssue({
|
|
651
|
-
code:
|
|
652
|
-
path: [
|
|
653
|
-
message:
|
|
722
|
+
code: "custom",
|
|
723
|
+
path: ["requiredPermissionCodes"],
|
|
724
|
+
message: "Product capability permission codes must be unique and deterministically sorted.",
|
|
654
725
|
});
|
|
655
726
|
}
|
|
656
727
|
});
|
|
@@ -664,42 +735,47 @@ exports.DeclarativeCreateTemplateRegistrationSchema = zod_1.z
|
|
|
664
735
|
label: declarative_control_1.I18nTextSchema,
|
|
665
736
|
description: declarative_control_1.I18nTextSchema,
|
|
666
737
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
667
|
-
legacyMigrationSourcePageIds: zod_1.z
|
|
738
|
+
legacyMigrationSourcePageIds: zod_1.z
|
|
739
|
+
.array(common_1.ContractIdentifierSchema)
|
|
740
|
+
.min(1)
|
|
741
|
+
.max(256)
|
|
742
|
+
.optional(),
|
|
668
743
|
document: zod_1.z.union([declarative_control_1.PageSchema, declarative_control_1.NavigationSchema, declarative_control_1.WorkbenchSchema]),
|
|
669
744
|
sourceContentHash: common_1.Sha256Schema,
|
|
670
745
|
})
|
|
671
746
|
.strict()
|
|
672
747
|
.superRefine((value, context) => {
|
|
673
|
-
const expected = value.document.contract ===
|
|
674
|
-
?
|
|
675
|
-
: value.document.contract ===
|
|
676
|
-
?
|
|
677
|
-
:
|
|
748
|
+
const expected = value.document.contract === "Page"
|
|
749
|
+
? "page"
|
|
750
|
+
: value.document.contract === "Navigation"
|
|
751
|
+
? "navigation"
|
|
752
|
+
: "workbench";
|
|
678
753
|
if (value.resourceKind !== expected)
|
|
679
754
|
context.addIssue({
|
|
680
|
-
code:
|
|
681
|
-
path: [
|
|
682
|
-
message:
|
|
755
|
+
code: "custom",
|
|
756
|
+
path: ["resourceKind"],
|
|
757
|
+
message: "Create template kind must match its document contract.",
|
|
683
758
|
});
|
|
684
|
-
if (value.templateRevisionRef.kind !==
|
|
759
|
+
if (value.templateRevisionRef.kind !== "declarative-create-template")
|
|
685
760
|
context.addIssue({
|
|
686
|
-
code:
|
|
687
|
-
path: [
|
|
688
|
-
message:
|
|
761
|
+
code: "custom",
|
|
762
|
+
path: ["templateRevisionRef", "kind"],
|
|
763
|
+
message: "Create templates require declarative-create-template RevisionRefs.",
|
|
689
764
|
});
|
|
690
|
-
if (value.legacyMigrationSourcePageIds && value.resourceKind !==
|
|
765
|
+
if (value.legacyMigrationSourcePageIds && value.resourceKind !== "page") {
|
|
691
766
|
context.addIssue({
|
|
692
|
-
code:
|
|
693
|
-
path: [
|
|
694
|
-
message:
|
|
767
|
+
code: "custom",
|
|
768
|
+
path: ["legacyMigrationSourcePageIds"],
|
|
769
|
+
message: "Only Page templates can declare legacy Page migration sources.",
|
|
695
770
|
});
|
|
696
771
|
}
|
|
697
772
|
if (value.legacyMigrationSourcePageIds &&
|
|
698
|
-
new Set(value.legacyMigrationSourcePageIds).size !==
|
|
773
|
+
new Set(value.legacyMigrationSourcePageIds).size !==
|
|
774
|
+
value.legacyMigrationSourcePageIds.length) {
|
|
699
775
|
context.addIssue({
|
|
700
|
-
code:
|
|
701
|
-
path: [
|
|
702
|
-
message:
|
|
776
|
+
code: "custom",
|
|
777
|
+
path: ["legacyMigrationSourcePageIds"],
|
|
778
|
+
message: "Legacy Page migration source identities must be unique.",
|
|
703
779
|
});
|
|
704
780
|
}
|
|
705
781
|
});
|
|
@@ -711,24 +787,24 @@ exports.DeclarativeRouteSpaceRegistrationSchema = zod_1.z
|
|
|
711
787
|
})
|
|
712
788
|
.strict()
|
|
713
789
|
.superRefine((value, context) => {
|
|
714
|
-
if (value.routeSpaceRevisionRef.kind !==
|
|
790
|
+
if (value.routeSpaceRevisionRef.kind !== "route-space") {
|
|
715
791
|
context.addIssue({
|
|
716
|
-
code:
|
|
717
|
-
path: [
|
|
718
|
-
message:
|
|
792
|
+
code: "custom",
|
|
793
|
+
path: ["routeSpaceRevisionRef", "kind"],
|
|
794
|
+
message: "Route-space registrations require route-space RevisionRefs.",
|
|
719
795
|
});
|
|
720
796
|
}
|
|
721
797
|
if (value.routeSpaceRevisionRef.id !== value.routeSpace.routeSpaceId) {
|
|
722
798
|
context.addIssue({
|
|
723
|
-
code:
|
|
724
|
-
path: [
|
|
725
|
-
message:
|
|
799
|
+
code: "custom",
|
|
800
|
+
path: ["routeSpaceRevisionRef", "id"],
|
|
801
|
+
message: "Route-space registration identity must match its document.",
|
|
726
802
|
});
|
|
727
803
|
}
|
|
728
804
|
});
|
|
729
805
|
exports.DeclarativeShellResourceDocumentSchema = zod_1.z
|
|
730
806
|
.object({
|
|
731
|
-
contract: zod_1.z.literal(
|
|
807
|
+
contract: zod_1.z.literal("DeclarativeShell"),
|
|
732
808
|
schemaVersion: zod_1.z.literal(1),
|
|
733
809
|
hostCapabilityRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
734
810
|
hostProviderRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
@@ -738,32 +814,32 @@ exports.DeclarativeShellResourceDocumentSchema = zod_1.z
|
|
|
738
814
|
})
|
|
739
815
|
.strict()
|
|
740
816
|
.superRefine((value, context) => {
|
|
741
|
-
if (value.hostCapabilityRevisionRef.kind !==
|
|
817
|
+
if (value.hostCapabilityRevisionRef.kind !== "capability")
|
|
742
818
|
context.addIssue({
|
|
743
|
-
code:
|
|
744
|
-
path: [
|
|
745
|
-
message:
|
|
819
|
+
code: "custom",
|
|
820
|
+
path: ["hostCapabilityRevisionRef", "kind"],
|
|
821
|
+
message: "Shell host capability must reference a capability.",
|
|
746
822
|
});
|
|
747
|
-
if (value.hostProviderRevisionRef.kind !==
|
|
823
|
+
if (value.hostProviderRevisionRef.kind !== "view-provider")
|
|
748
824
|
context.addIssue({
|
|
749
|
-
code:
|
|
750
|
-
path: [
|
|
751
|
-
message:
|
|
825
|
+
code: "custom",
|
|
826
|
+
path: ["hostProviderRevisionRef", "kind"],
|
|
827
|
+
message: "Shell host provider must reference a view-provider.",
|
|
752
828
|
});
|
|
753
829
|
value.tokenRevisionRefs.forEach((reference, index) => {
|
|
754
|
-
if (reference.kind !==
|
|
830
|
+
if (reference.kind !== "design-token")
|
|
755
831
|
context.addIssue({
|
|
756
|
-
code:
|
|
757
|
-
path: [
|
|
758
|
-
message:
|
|
832
|
+
code: "custom",
|
|
833
|
+
path: ["tokenRevisionRefs", index, "kind"],
|
|
834
|
+
message: "Shell tokens must use design-token RevisionRefs.",
|
|
759
835
|
});
|
|
760
836
|
});
|
|
761
837
|
const seenSurfaces = new Set();
|
|
762
838
|
value.surfaceChrome.forEach((entry, index) => {
|
|
763
839
|
if (seenSurfaces.has(entry.surface))
|
|
764
840
|
context.addIssue({
|
|
765
|
-
code:
|
|
766
|
-
path: [
|
|
841
|
+
code: "custom",
|
|
842
|
+
path: ["surfaceChrome", index],
|
|
767
843
|
message: `Duplicate shell chrome declaration for ${entry.surface}.`,
|
|
768
844
|
});
|
|
769
845
|
seenSurfaces.add(entry.surface);
|
|
@@ -771,23 +847,25 @@ exports.DeclarativeShellResourceDocumentSchema = zod_1.z
|
|
|
771
847
|
});
|
|
772
848
|
exports.DeclarativeLayoutPolicyResourceDocumentSchema = zod_1.z
|
|
773
849
|
.object({
|
|
774
|
-
contract: zod_1.z.literal(
|
|
850
|
+
contract: zod_1.z.literal("DeclarativeLayoutPolicy"),
|
|
775
851
|
schemaVersion: zod_1.z.literal(1),
|
|
776
|
-
allowedModes: zod_1.z
|
|
852
|
+
allowedModes: zod_1.z
|
|
853
|
+
.array(zod_1.z.enum(["single", "tabs", "columns", "grid", "sidebar"]))
|
|
854
|
+
.min(1),
|
|
777
855
|
propertySchemaRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
778
856
|
})
|
|
779
857
|
.strict()
|
|
780
858
|
.superRefine((value, context) => {
|
|
781
|
-
if (value.propertySchemaRevisionRef.kind !==
|
|
859
|
+
if (value.propertySchemaRevisionRef.kind !== "schema")
|
|
782
860
|
context.addIssue({
|
|
783
|
-
code:
|
|
784
|
-
path: [
|
|
785
|
-
message:
|
|
861
|
+
code: "custom",
|
|
862
|
+
path: ["propertySchemaRevisionRef", "kind"],
|
|
863
|
+
message: "Layout policy properties must reference a schema.",
|
|
786
864
|
});
|
|
787
865
|
});
|
|
788
866
|
exports.DeclarativeEnvironmentResourceDocumentSchema = zod_1.z
|
|
789
867
|
.object({
|
|
790
|
-
contract: zod_1.z.literal(
|
|
868
|
+
contract: zod_1.z.literal("DeclarativeEnvironment"),
|
|
791
869
|
schemaVersion: zod_1.z.literal(1),
|
|
792
870
|
environmentId: common_1.ContractIdentifierSchema,
|
|
793
871
|
label: declarative_control_1.I18nTextSchema,
|
|
@@ -798,13 +876,13 @@ exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
|
|
|
798
876
|
.object({
|
|
799
877
|
resourceRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
800
878
|
resourceKind: zod_1.z.enum([
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
879
|
+
"shell",
|
|
880
|
+
"layout-policy",
|
|
881
|
+
"performance-budget",
|
|
882
|
+
"observation-policy",
|
|
883
|
+
"design-token",
|
|
884
|
+
"access-policy",
|
|
885
|
+
"environment",
|
|
808
886
|
]),
|
|
809
887
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
810
888
|
accessPolicy: declarative_control_1.AccessPolicySchema.optional(),
|
|
@@ -816,17 +894,17 @@ exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
|
|
|
816
894
|
.superRefine((value, context) => {
|
|
817
895
|
if (value.resourceRevisionRef.kind !== value.resourceKind) {
|
|
818
896
|
context.addIssue({
|
|
819
|
-
code:
|
|
820
|
-
path: [
|
|
821
|
-
message:
|
|
897
|
+
code: "custom",
|
|
898
|
+
path: ["resourceRevisionRef", "kind"],
|
|
899
|
+
message: "Product resource kind must match its RevisionRef.",
|
|
822
900
|
});
|
|
823
901
|
}
|
|
824
|
-
if (value.resourceKind ===
|
|
902
|
+
if (value.resourceKind === "shell") {
|
|
825
903
|
const parsed = exports.DeclarativeShellResourceDocumentSchema.safeParse(value.document);
|
|
826
904
|
if (!parsed.success)
|
|
827
905
|
context.addIssue({
|
|
828
|
-
code:
|
|
829
|
-
path: [
|
|
906
|
+
code: "custom",
|
|
907
|
+
path: ["document"],
|
|
830
908
|
message: `Invalid shell declaration: ${parsed.error.message}`,
|
|
831
909
|
});
|
|
832
910
|
if (parsed.success) {
|
|
@@ -835,50 +913,59 @@ exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
|
|
|
835
913
|
value.supportedSurfaces.forEach((surface) => {
|
|
836
914
|
if (!declaredSurfaces.has(surface))
|
|
837
915
|
context.addIssue({
|
|
838
|
-
code:
|
|
839
|
-
path: [
|
|
916
|
+
code: "custom",
|
|
917
|
+
path: ["document", "surfaceChrome"],
|
|
840
918
|
message: `Shell chrome is missing for supported surface ${surface}.`,
|
|
841
919
|
});
|
|
842
920
|
});
|
|
843
921
|
parsed.data.surfaceChrome.forEach((entry) => {
|
|
844
922
|
if (!supportedSurfaces.has(entry.surface))
|
|
845
923
|
context.addIssue({
|
|
846
|
-
code:
|
|
847
|
-
path: [
|
|
924
|
+
code: "custom",
|
|
925
|
+
path: ["document", "surfaceChrome"],
|
|
848
926
|
message: `Shell chrome declares unsupported surface ${entry.surface}.`,
|
|
849
927
|
});
|
|
850
928
|
});
|
|
851
929
|
}
|
|
852
930
|
}
|
|
853
|
-
if (value.resourceKind ===
|
|
931
|
+
if (value.resourceKind === "layout-policy") {
|
|
854
932
|
const parsed = exports.DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(value.document);
|
|
855
933
|
if (!parsed.success)
|
|
856
934
|
context.addIssue({
|
|
857
|
-
code:
|
|
858
|
-
path: [
|
|
935
|
+
code: "custom",
|
|
936
|
+
path: ["document"],
|
|
859
937
|
message: `Invalid layout-policy declaration: ${parsed.error.message}`,
|
|
860
938
|
});
|
|
861
939
|
}
|
|
862
|
-
if (value.resourceKind ===
|
|
940
|
+
if (value.resourceKind === "environment") {
|
|
863
941
|
const parsed = exports.DeclarativeEnvironmentResourceDocumentSchema.safeParse(value.document);
|
|
864
942
|
if (!parsed.success)
|
|
865
943
|
context.addIssue({
|
|
866
|
-
code:
|
|
867
|
-
path: [
|
|
944
|
+
code: "custom",
|
|
945
|
+
path: ["document"],
|
|
868
946
|
message: `Invalid environment declaration: ${parsed.error.message}`,
|
|
869
947
|
});
|
|
870
|
-
if (parsed.success &&
|
|
948
|
+
if (parsed.success &&
|
|
949
|
+
parsed.data.environmentId !== value.resourceRevisionRef.id) {
|
|
871
950
|
context.addIssue({
|
|
872
|
-
code:
|
|
873
|
-
path: [
|
|
874
|
-
message:
|
|
951
|
+
code: "custom",
|
|
952
|
+
path: ["document", "environmentId"],
|
|
953
|
+
message: "Environment registration identity must match its document.",
|
|
875
954
|
});
|
|
876
955
|
}
|
|
877
956
|
}
|
|
878
957
|
});
|
|
879
958
|
exports.DeclarativeDefaultPolicyRegistrationSchema = zod_1.z
|
|
880
959
|
.object({
|
|
881
|
-
role: zod_1.z.enum([
|
|
960
|
+
role: zod_1.z.enum([
|
|
961
|
+
"management",
|
|
962
|
+
"access",
|
|
963
|
+
"layout",
|
|
964
|
+
"performance",
|
|
965
|
+
"observability",
|
|
966
|
+
"tokens",
|
|
967
|
+
"environment",
|
|
968
|
+
]),
|
|
882
969
|
resourceRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
883
970
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
884
971
|
})
|
|
@@ -890,18 +977,18 @@ exports.DeclarativeDomainQueryDefinitionRegistrationSchema = zod_1.z
|
|
|
890
977
|
})
|
|
891
978
|
.strict()
|
|
892
979
|
.superRefine((value, context) => {
|
|
893
|
-
if (value.definitionRevisionRef.kind !==
|
|
980
|
+
if (value.definitionRevisionRef.kind !== "domain-query-definition") {
|
|
894
981
|
context.addIssue({
|
|
895
|
-
code:
|
|
896
|
-
path: [
|
|
897
|
-
message:
|
|
982
|
+
code: "custom",
|
|
983
|
+
path: ["definitionRevisionRef", "kind"],
|
|
984
|
+
message: "A Domain Query registration must pin a domain-query-definition revision.",
|
|
898
985
|
});
|
|
899
986
|
}
|
|
900
987
|
if (value.definitionRevisionRef.id !== value.definition.queryId) {
|
|
901
988
|
context.addIssue({
|
|
902
|
-
code:
|
|
903
|
-
path: [
|
|
904
|
-
message:
|
|
989
|
+
code: "custom",
|
|
990
|
+
path: ["definitionRevisionRef", "id"],
|
|
991
|
+
message: "A Domain Query registration identity must match its definition.",
|
|
905
992
|
});
|
|
906
993
|
}
|
|
907
994
|
});
|
|
@@ -912,18 +999,18 @@ exports.DeclarativeDomainCommandDefinitionRegistrationSchema = zod_1.z
|
|
|
912
999
|
})
|
|
913
1000
|
.strict()
|
|
914
1001
|
.superRefine((value, context) => {
|
|
915
|
-
if (value.definitionRevisionRef.kind !==
|
|
1002
|
+
if (value.definitionRevisionRef.kind !== "domain-command") {
|
|
916
1003
|
context.addIssue({
|
|
917
|
-
code:
|
|
918
|
-
path: [
|
|
919
|
-
message:
|
|
1004
|
+
code: "custom",
|
|
1005
|
+
path: ["definitionRevisionRef", "kind"],
|
|
1006
|
+
message: "A Domain Command registration must pin a domain-command revision.",
|
|
920
1007
|
});
|
|
921
1008
|
}
|
|
922
1009
|
if (value.definitionRevisionRef.id !== value.definition.commandName) {
|
|
923
1010
|
context.addIssue({
|
|
924
|
-
code:
|
|
925
|
-
path: [
|
|
926
|
-
message:
|
|
1011
|
+
code: "custom",
|
|
1012
|
+
path: ["definitionRevisionRef", "id"],
|
|
1013
|
+
message: "A Domain Command registration identity must match its definition.",
|
|
927
1014
|
});
|
|
928
1015
|
}
|
|
929
1016
|
});
|
|
@@ -934,42 +1021,50 @@ exports.DeclarativeSchemaDefinitionRegistrationSchema = zod_1.z
|
|
|
934
1021
|
})
|
|
935
1022
|
.strict()
|
|
936
1023
|
.superRefine((value, context) => {
|
|
937
|
-
if (value.definitionRevisionRef.kind !==
|
|
1024
|
+
if (value.definitionRevisionRef.kind !== "schema") {
|
|
938
1025
|
context.addIssue({
|
|
939
|
-
code:
|
|
940
|
-
path: [
|
|
941
|
-
message:
|
|
1026
|
+
code: "custom",
|
|
1027
|
+
path: ["definitionRevisionRef", "kind"],
|
|
1028
|
+
message: "A Schema registration must pin a schema revision.",
|
|
942
1029
|
});
|
|
943
1030
|
}
|
|
944
1031
|
if (value.definitionRevisionRef.id !== value.definition.schemaId) {
|
|
945
1032
|
context.addIssue({
|
|
946
|
-
code:
|
|
947
|
-
path: [
|
|
948
|
-
message:
|
|
1033
|
+
code: "custom",
|
|
1034
|
+
path: ["definitionRevisionRef", "id"],
|
|
1035
|
+
message: "A Schema registration identity must match its definition.",
|
|
949
1036
|
});
|
|
950
1037
|
}
|
|
951
1038
|
if (value.definitionRevisionRef.ownerRepo !== value.definition.ownerRepo) {
|
|
952
1039
|
context.addIssue({
|
|
953
|
-
code:
|
|
954
|
-
path: [
|
|
955
|
-
message:
|
|
1040
|
+
code: "custom",
|
|
1041
|
+
path: ["definitionRevisionRef", "ownerRepo"],
|
|
1042
|
+
message: "A Schema registration authority must match its definition.",
|
|
956
1043
|
});
|
|
957
1044
|
}
|
|
958
1045
|
});
|
|
959
1046
|
/** Release-owned product authoring inputs. Instances and releases remain Ontology records. */
|
|
960
1047
|
exports.ProductDeclarativeAuthoringCatalogSchema = zod_1.z
|
|
961
1048
|
.object({
|
|
962
|
-
contract: zod_1.z.literal(
|
|
1049
|
+
contract: zod_1.z.literal("ProductDeclarativeAuthoringCatalog"),
|
|
963
1050
|
schemaVersion: zod_1.z.literal(1),
|
|
964
1051
|
applicationId: common_1.ContractIdentifierSchema,
|
|
965
1052
|
createTemplates: zod_1.z.array(exports.DeclarativeCreateTemplateRegistrationSchema),
|
|
966
1053
|
routeSpaces: zod_1.z.array(exports.DeclarativeRouteSpaceRegistrationSchema),
|
|
967
1054
|
resourceRegistrations: zod_1.z.array(exports.DeclarativeProductResourceRegistrationSchema),
|
|
968
1055
|
defaultPolicies: zod_1.z.array(exports.DeclarativeDefaultPolicyRegistrationSchema),
|
|
969
|
-
domainQueryDefinitions: zod_1.z
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1056
|
+
domainQueryDefinitions: zod_1.z
|
|
1057
|
+
.array(exports.DeclarativeDomainQueryDefinitionRegistrationSchema)
|
|
1058
|
+
.default([]),
|
|
1059
|
+
domainCommandDefinitions: zod_1.z
|
|
1060
|
+
.array(exports.DeclarativeDomainCommandDefinitionRegistrationSchema)
|
|
1061
|
+
.default([]),
|
|
1062
|
+
schemaDefinitions: zod_1.z
|
|
1063
|
+
.array(exports.DeclarativeSchemaDefinitionRegistrationSchema)
|
|
1064
|
+
.default([]),
|
|
1065
|
+
capabilityRegistrations: zod_1.z
|
|
1066
|
+
.array(exports.ProductDeclarativeCapabilityRegistrationSchema)
|
|
1067
|
+
.default([]),
|
|
973
1068
|
})
|
|
974
1069
|
.strict()
|
|
975
1070
|
.superRefine((value, context) => {
|
|
@@ -977,84 +1072,88 @@ exports.ProductDeclarativeAuthoringCatalogSchema = zod_1.z
|
|
|
977
1072
|
const duplicateTemplate = duplicates(value.createTemplates.map((item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`));
|
|
978
1073
|
if (duplicateTemplate)
|
|
979
1074
|
context.addIssue({
|
|
980
|
-
code:
|
|
981
|
-
path: [
|
|
1075
|
+
code: "custom",
|
|
1076
|
+
path: ["createTemplates"],
|
|
982
1077
|
message: `Duplicate create template ${duplicateTemplate}.`,
|
|
983
1078
|
});
|
|
984
1079
|
const duplicateMigrationSource = duplicates(value.createTemplates.flatMap((item) => (item.legacyMigrationSourcePageIds ?? []).flatMap((pageId) => item.supportedSurfaces.map((surface) => `${surface}:${pageId}`))));
|
|
985
1080
|
if (duplicateMigrationSource)
|
|
986
1081
|
context.addIssue({
|
|
987
|
-
code:
|
|
988
|
-
path: [
|
|
1082
|
+
code: "custom",
|
|
1083
|
+
path: ["createTemplates"],
|
|
989
1084
|
message: `Duplicate legacy Page migration source ${duplicateMigrationSource}.`,
|
|
990
1085
|
});
|
|
991
1086
|
const duplicateRouteSpace = duplicates(value.routeSpaces.map((item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`));
|
|
992
1087
|
if (duplicateRouteSpace)
|
|
993
1088
|
context.addIssue({
|
|
994
|
-
code:
|
|
995
|
-
path: [
|
|
1089
|
+
code: "custom",
|
|
1090
|
+
path: ["routeSpaces"],
|
|
996
1091
|
message: `Duplicate route space ${duplicateRouteSpace}.`,
|
|
997
1092
|
});
|
|
998
1093
|
const duplicateResource = duplicates(value.resourceRegistrations.map((item) => `${item.resourceRevisionRef.kind}:${item.resourceRevisionRef.id}@${item.resourceRevisionRef.revision}`));
|
|
999
1094
|
if (duplicateResource)
|
|
1000
1095
|
context.addIssue({
|
|
1001
|
-
code:
|
|
1002
|
-
path: [
|
|
1096
|
+
code: "custom",
|
|
1097
|
+
path: ["resourceRegistrations"],
|
|
1003
1098
|
message: `Duplicate product resource ${duplicateResource}.`,
|
|
1004
1099
|
});
|
|
1005
1100
|
const duplicateQueryDefinition = duplicates(value.domainQueryDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
|
|
1006
1101
|
if (duplicateQueryDefinition)
|
|
1007
1102
|
context.addIssue({
|
|
1008
|
-
code:
|
|
1009
|
-
path: [
|
|
1103
|
+
code: "custom",
|
|
1104
|
+
path: ["domainQueryDefinitions"],
|
|
1010
1105
|
message: `Duplicate Domain Query definition ${duplicateQueryDefinition}.`,
|
|
1011
1106
|
});
|
|
1012
1107
|
const duplicateCommandDefinition = duplicates(value.domainCommandDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
|
|
1013
1108
|
if (duplicateCommandDefinition)
|
|
1014
1109
|
context.addIssue({
|
|
1015
|
-
code:
|
|
1016
|
-
path: [
|
|
1110
|
+
code: "custom",
|
|
1111
|
+
path: ["domainCommandDefinitions"],
|
|
1017
1112
|
message: `Duplicate Domain Command definition ${duplicateCommandDefinition}.`,
|
|
1018
1113
|
});
|
|
1019
1114
|
const duplicateSchemaDefinition = duplicates(value.schemaDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
|
|
1020
1115
|
if (duplicateSchemaDefinition)
|
|
1021
1116
|
context.addIssue({
|
|
1022
|
-
code:
|
|
1023
|
-
path: [
|
|
1117
|
+
code: "custom",
|
|
1118
|
+
path: ["schemaDefinitions"],
|
|
1024
1119
|
message: `Duplicate Schema definition ${duplicateSchemaDefinition}.`,
|
|
1025
1120
|
});
|
|
1026
1121
|
const duplicateCapabilityRegistration = duplicates(value.capabilityRegistrations.map((item) => `${item.declarativeRegistration.capabilityRevisionRef.id}@${item.declarativeRegistration.capabilityRevisionRef.revision}`));
|
|
1027
1122
|
if (duplicateCapabilityRegistration)
|
|
1028
1123
|
context.addIssue({
|
|
1029
|
-
code:
|
|
1030
|
-
path: [
|
|
1124
|
+
code: "custom",
|
|
1125
|
+
path: ["capabilityRegistrations"],
|
|
1031
1126
|
message: `Duplicate product capability registration ${duplicateCapabilityRegistration}.`,
|
|
1032
1127
|
});
|
|
1033
1128
|
value.defaultPolicies.forEach((selection, index) => {
|
|
1034
1129
|
const expectedKind = {
|
|
1035
|
-
management:
|
|
1036
|
-
access:
|
|
1037
|
-
layout:
|
|
1038
|
-
performance:
|
|
1039
|
-
observability:
|
|
1040
|
-
tokens:
|
|
1041
|
-
environment:
|
|
1130
|
+
management: "access-policy",
|
|
1131
|
+
access: "access-policy",
|
|
1132
|
+
layout: "layout-policy",
|
|
1133
|
+
performance: "performance-budget",
|
|
1134
|
+
observability: "observation-policy",
|
|
1135
|
+
tokens: "design-token",
|
|
1136
|
+
environment: "environment",
|
|
1042
1137
|
}[selection.role];
|
|
1043
1138
|
if (selection.resourceRevisionRef.kind !== expectedKind) {
|
|
1044
1139
|
context.addIssue({
|
|
1045
|
-
code:
|
|
1046
|
-
path: [
|
|
1140
|
+
code: "custom",
|
|
1141
|
+
path: ["defaultPolicies", index, "resourceRevisionRef", "kind"],
|
|
1047
1142
|
message: `Default ${selection.role} selection must reference ${expectedKind}.`,
|
|
1048
1143
|
});
|
|
1049
1144
|
}
|
|
1050
|
-
if (!value.resourceRegistrations.some((registration) => registration.resourceRevisionRef.kind ===
|
|
1051
|
-
|
|
1052
|
-
registration.resourceRevisionRef.
|
|
1053
|
-
|
|
1145
|
+
if (!value.resourceRegistrations.some((registration) => registration.resourceRevisionRef.kind ===
|
|
1146
|
+
selection.resourceRevisionRef.kind &&
|
|
1147
|
+
registration.resourceRevisionRef.id ===
|
|
1148
|
+
selection.resourceRevisionRef.id &&
|
|
1149
|
+
registration.resourceRevisionRef.revision ===
|
|
1150
|
+
selection.resourceRevisionRef.revision &&
|
|
1151
|
+
registration.resourceRevisionRef.contentHash ===
|
|
1152
|
+
selection.resourceRevisionRef.contentHash)) {
|
|
1054
1153
|
context.addIssue({
|
|
1055
|
-
code:
|
|
1056
|
-
path: [
|
|
1057
|
-
message:
|
|
1154
|
+
code: "custom",
|
|
1155
|
+
path: ["defaultPolicies", index, "resourceRevisionRef"],
|
|
1156
|
+
message: "Default policy must select an exact registered product resource.",
|
|
1058
1157
|
});
|
|
1059
1158
|
}
|
|
1060
1159
|
});
|
|
@@ -1071,7 +1170,7 @@ exports.DeclarativeProductResourceChoiceSchema = exports.DeclarativeAuthoringCho
|
|
|
1071
1170
|
exports.DeclarativeBindingAuthoringChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
|
|
1072
1171
|
bindingTemplate: zod_1.z
|
|
1073
1172
|
.object({
|
|
1074
|
-
kind: zod_1.z.enum([
|
|
1173
|
+
kind: zod_1.z.enum(["ontology", "view", "query", "action"]),
|
|
1075
1174
|
requiredRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema),
|
|
1076
1175
|
requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
|
|
1077
1176
|
inputTemplate: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
@@ -1091,11 +1190,18 @@ exports.DeclarativeWorkbenchTargetChoiceSchema = zod_1.z
|
|
|
1091
1190
|
targetRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1092
1191
|
providerRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1093
1192
|
inputSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1094
|
-
kind: zod_1.z.enum([
|
|
1193
|
+
kind: zod_1.z.enum([
|
|
1194
|
+
"built-in-application",
|
|
1195
|
+
"workflow-form",
|
|
1196
|
+
"workflow",
|
|
1197
|
+
"agent",
|
|
1198
|
+
"design",
|
|
1199
|
+
"capability",
|
|
1200
|
+
]),
|
|
1095
1201
|
name: declarative_control_1.I18nTextSchema,
|
|
1096
1202
|
targetAccessPolicy: declarative_control_1.AccessPolicySchema,
|
|
1097
1203
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
1098
|
-
status: zod_1.z.enum([
|
|
1204
|
+
status: zod_1.z.enum(["active", "deprecated", "retired", "unavailable"]),
|
|
1099
1205
|
provenanceContentHash: common_1.Sha256Schema,
|
|
1100
1206
|
})
|
|
1101
1207
|
.strict()
|
|
@@ -1103,23 +1209,23 @@ exports.DeclarativeWorkbenchTargetChoiceSchema = zod_1.z
|
|
|
1103
1209
|
if (value.targetRevisionRef.id !== value.stableTargetRef.id ||
|
|
1104
1210
|
value.targetRevisionRef.kind !== value.stableTargetRef.kind) {
|
|
1105
1211
|
context.addIssue({
|
|
1106
|
-
code:
|
|
1107
|
-
path: [
|
|
1108
|
-
message:
|
|
1212
|
+
code: "custom",
|
|
1213
|
+
path: ["targetRevisionRef"],
|
|
1214
|
+
message: "Workbench target identity and exact revision must match.",
|
|
1109
1215
|
});
|
|
1110
1216
|
}
|
|
1111
|
-
if (value.providerRevisionRef.kind !==
|
|
1217
|
+
if (value.providerRevisionRef.kind !== "view-provider") {
|
|
1112
1218
|
context.addIssue({
|
|
1113
|
-
code:
|
|
1114
|
-
path: [
|
|
1115
|
-
message:
|
|
1219
|
+
code: "custom",
|
|
1220
|
+
path: ["providerRevisionRef", "kind"],
|
|
1221
|
+
message: "Workbench targets require an exact view-provider revision.",
|
|
1116
1222
|
});
|
|
1117
1223
|
}
|
|
1118
|
-
if (value.inputSchemaRevisionRef.kind !==
|
|
1224
|
+
if (value.inputSchemaRevisionRef.kind !== "schema") {
|
|
1119
1225
|
context.addIssue({
|
|
1120
|
-
code:
|
|
1121
|
-
path: [
|
|
1122
|
-
message:
|
|
1226
|
+
code: "custom",
|
|
1227
|
+
path: ["inputSchemaRevisionRef", "kind"],
|
|
1228
|
+
message: "Workbench targets require an exact input schema revision.",
|
|
1123
1229
|
});
|
|
1124
1230
|
}
|
|
1125
1231
|
});
|
|
@@ -1142,15 +1248,21 @@ exports.DeclarativeCreateIntentSchema = zod_1.z
|
|
|
1142
1248
|
})
|
|
1143
1249
|
.strict()
|
|
1144
1250
|
.superRefine((value, context) => {
|
|
1145
|
-
if (Number(Boolean(value.templateRevisionRef)) +
|
|
1251
|
+
if (Number(Boolean(value.templateRevisionRef)) +
|
|
1252
|
+
Number(Boolean(value.sourceRevisionRef)) !==
|
|
1253
|
+
1) {
|
|
1146
1254
|
context.addIssue({
|
|
1147
|
-
code:
|
|
1148
|
-
path: [
|
|
1149
|
-
message:
|
|
1255
|
+
code: "custom",
|
|
1256
|
+
path: ["templateRevisionRef"],
|
|
1257
|
+
message: "Create intent requires exactly one governed template or source revision.",
|
|
1150
1258
|
});
|
|
1151
1259
|
}
|
|
1152
1260
|
});
|
|
1153
|
-
exports.DeclarativeDocumentSchema = zod_1.z.union([
|
|
1261
|
+
exports.DeclarativeDocumentSchema = zod_1.z.union([
|
|
1262
|
+
declarative_control_1.PageSchema,
|
|
1263
|
+
declarative_control_1.NavigationSchema,
|
|
1264
|
+
declarative_control_1.WorkbenchSchema,
|
|
1265
|
+
]);
|
|
1154
1266
|
exports.DeclarativeSaveDraftIntentSchema = zod_1.z
|
|
1155
1267
|
.object({
|
|
1156
1268
|
document: exports.DeclarativeDocumentSchema,
|
|
@@ -1195,25 +1307,26 @@ exports.DeclarativeAuthoringPageInfoSchema = zod_1.z
|
|
|
1195
1307
|
.superRefine((value, context) => {
|
|
1196
1308
|
if (value.returned > value.pageSize)
|
|
1197
1309
|
context.addIssue({
|
|
1198
|
-
code:
|
|
1199
|
-
path: [
|
|
1200
|
-
message:
|
|
1310
|
+
code: "custom",
|
|
1311
|
+
path: ["returned"],
|
|
1312
|
+
message: "Returned items cannot exceed pageSize.",
|
|
1201
1313
|
});
|
|
1202
1314
|
if (value.hasMore !== Boolean(value.nextPageToken))
|
|
1203
1315
|
context.addIssue({
|
|
1204
|
-
code:
|
|
1205
|
-
path: [
|
|
1206
|
-
message:
|
|
1316
|
+
code: "custom",
|
|
1317
|
+
path: ["nextPageToken"],
|
|
1318
|
+
message: "hasMore and nextPageToken must agree.",
|
|
1207
1319
|
});
|
|
1208
1320
|
});
|
|
1209
1321
|
exports.DeclarativeAuthoringChoiceKindSchema = zod_1.z.enum([
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1322
|
+
"capability",
|
|
1323
|
+
"ontology",
|
|
1324
|
+
"view",
|
|
1325
|
+
"query",
|
|
1326
|
+
"action",
|
|
1327
|
+
"access",
|
|
1328
|
+
"published-target",
|
|
1329
|
+
"workbench-target",
|
|
1217
1330
|
]);
|
|
1218
1331
|
const authoringChoicePage = (choiceKind, itemSchema) => zod_1.z
|
|
1219
1332
|
.object({
|
|
@@ -1225,19 +1338,19 @@ const authoringChoicePage = (choiceKind, itemSchema) => zod_1.z
|
|
|
1225
1338
|
.superRefine((value, context) => {
|
|
1226
1339
|
if (value.pageInfo.returned !== value.items.length)
|
|
1227
1340
|
context.addIssue({
|
|
1228
|
-
code:
|
|
1229
|
-
path: [
|
|
1230
|
-
message:
|
|
1341
|
+
code: "custom",
|
|
1342
|
+
path: ["pageInfo", "returned"],
|
|
1343
|
+
message: "PageInfo returned must match choice item count.",
|
|
1231
1344
|
});
|
|
1232
1345
|
});
|
|
1233
|
-
exports.DeclarativeAuthoringChoicePageSchema = zod_1.z.discriminatedUnion(
|
|
1234
|
-
authoringChoicePage(
|
|
1235
|
-
authoringChoicePage(
|
|
1236
|
-
authoringChoicePage(
|
|
1237
|
-
authoringChoicePage(
|
|
1238
|
-
authoringChoicePage(
|
|
1239
|
-
authoringChoicePage(
|
|
1240
|
-
authoringChoicePage(
|
|
1346
|
+
exports.DeclarativeAuthoringChoicePageSchema = zod_1.z.discriminatedUnion("choiceKind", [
|
|
1347
|
+
authoringChoicePage("capability", exports.DeclarativeCapabilityAuthoringChoiceSchema),
|
|
1348
|
+
authoringChoicePage("ontology", exports.DeclarativeBindingAuthoringChoiceSchema),
|
|
1349
|
+
authoringChoicePage("view", exports.DeclarativeBindingAuthoringChoiceSchema),
|
|
1350
|
+
authoringChoicePage("action", exports.DeclarativeBindingAuthoringChoiceSchema),
|
|
1351
|
+
authoringChoicePage("access", exports.DeclarativeAuthoringChoiceSchema),
|
|
1352
|
+
authoringChoicePage("published-target", exports.DeclarativeAuthoringChoiceSchema),
|
|
1353
|
+
authoringChoicePage("workbench-target", exports.DeclarativeWorkbenchTargetChoiceSchema),
|
|
1241
1354
|
]);
|
|
1242
1355
|
exports.DeclarativeAuthoringResourcePageQuerySchema = zod_1.z
|
|
1243
1356
|
.object({
|
|
@@ -1261,31 +1374,31 @@ exports.DeclarativeAuthoringChoicePageQuerySchema = zod_1.z
|
|
|
1261
1374
|
.strict();
|
|
1262
1375
|
const DeclarativePageDocumentSummarySchema = zod_1.z
|
|
1263
1376
|
.object({
|
|
1264
|
-
resourceKind: zod_1.z.literal(
|
|
1377
|
+
resourceKind: zod_1.z.literal("page"),
|
|
1265
1378
|
title: declarative_control_1.I18nTextSchema,
|
|
1266
1379
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
1267
1380
|
routeClaims: zod_1.z.array(declarative_control_1.RouteClaimSchema).min(1),
|
|
1268
|
-
lifecycle: zod_1.z.enum([
|
|
1381
|
+
lifecycle: zod_1.z.enum(["active", "deprecated", "retired"]),
|
|
1269
1382
|
accessPolicy: declarative_control_1.AccessPolicySchema,
|
|
1270
1383
|
managementAccess: declarative_control_1.ManagementAccessSchema,
|
|
1271
1384
|
})
|
|
1272
1385
|
.strict();
|
|
1273
1386
|
const DeclarativeNavigationDocumentSummarySchema = zod_1.z
|
|
1274
1387
|
.object({
|
|
1275
|
-
resourceKind: zod_1.z.literal(
|
|
1388
|
+
resourceKind: zod_1.z.literal("navigation"),
|
|
1276
1389
|
title: declarative_control_1.I18nTextSchema,
|
|
1277
1390
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
1278
1391
|
placements: zod_1.z.array(common_1.ContractIdentifierSchema).min(1),
|
|
1279
1392
|
nodeCount: zod_1.z.number().int().nonnegative(),
|
|
1280
|
-
lifecycle: zod_1.z.enum([
|
|
1393
|
+
lifecycle: zod_1.z.enum(["active", "deprecated", "retired"]),
|
|
1281
1394
|
managementAccess: declarative_control_1.ManagementAccessSchema,
|
|
1282
1395
|
})
|
|
1283
1396
|
.strict();
|
|
1284
1397
|
const DeclarativeWorkbenchDocumentSummarySchema = zod_1.z
|
|
1285
1398
|
.object({
|
|
1286
|
-
resourceKind: zod_1.z.literal(
|
|
1399
|
+
resourceKind: zod_1.z.literal("workbench"),
|
|
1287
1400
|
title: declarative_control_1.I18nTextSchema,
|
|
1288
|
-
purpose: zod_1.z.enum([
|
|
1401
|
+
purpose: zod_1.z.enum(["instance", "template"]),
|
|
1289
1402
|
supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
|
|
1290
1403
|
routeClaims: zod_1.z.array(declarative_control_1.RouteClaimSchema).min(1),
|
|
1291
1404
|
layout: zod_1.z
|
|
@@ -1296,26 +1409,26 @@ const DeclarativeWorkbenchDocumentSummarySchema = zod_1.z
|
|
|
1296
1409
|
})
|
|
1297
1410
|
.strict(),
|
|
1298
1411
|
instanceCount: zod_1.z.number().int().nonnegative(),
|
|
1299
|
-
lifecycle: zod_1.z.enum([
|
|
1412
|
+
lifecycle: zod_1.z.enum(["active", "deprecated", "retired"]),
|
|
1300
1413
|
accessPolicy: declarative_control_1.AccessPolicySchema,
|
|
1301
1414
|
managementAccess: declarative_control_1.ManagementAccessSchema,
|
|
1302
1415
|
})
|
|
1303
1416
|
.strict();
|
|
1304
|
-
exports.DeclarativeDocumentSummarySchema = zod_1.z.discriminatedUnion(
|
|
1417
|
+
exports.DeclarativeDocumentSummarySchema = zod_1.z.discriminatedUnion("resourceKind", [
|
|
1305
1418
|
DeclarativePageDocumentSummarySchema,
|
|
1306
1419
|
DeclarativeNavigationDocumentSummarySchema,
|
|
1307
1420
|
DeclarativeWorkbenchDocumentSummarySchema,
|
|
1308
1421
|
]);
|
|
1309
1422
|
const declarativeReferenceTenantScopeKey = (scope) => JSON.stringify(scope);
|
|
1310
1423
|
const DeclarativeDefinitionKindByResourceKind = {
|
|
1311
|
-
page:
|
|
1312
|
-
navigation:
|
|
1313
|
-
workbench:
|
|
1424
|
+
page: "page",
|
|
1425
|
+
navigation: "navigation",
|
|
1426
|
+
workbench: "workbench",
|
|
1314
1427
|
};
|
|
1315
1428
|
const DeclarativeReleaseKindByResourceKind = {
|
|
1316
|
-
page:
|
|
1317
|
-
navigation:
|
|
1318
|
-
workbench:
|
|
1429
|
+
page: "page-release",
|
|
1430
|
+
navigation: "navigation-release",
|
|
1431
|
+
workbench: "workbench-release",
|
|
1319
1432
|
};
|
|
1320
1433
|
exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
|
|
1321
1434
|
.object({
|
|
@@ -1323,7 +1436,7 @@ exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
|
|
|
1323
1436
|
resourceId: common_1.ContractIdentifierSchema,
|
|
1324
1437
|
tenantScope: declarative_control_1.TenantScopeSchema,
|
|
1325
1438
|
documentSummary: exports.DeclarativeDocumentSummarySchema,
|
|
1326
|
-
lifecycle: zod_1.z.enum([
|
|
1439
|
+
lifecycle: zod_1.z.enum(["active", "deprecated", "retired"]),
|
|
1327
1440
|
draftRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1328
1441
|
activeReleaseRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema),
|
|
1329
1442
|
placements: zod_1.z.array(common_1.ContractIdentifierSchema),
|
|
@@ -1350,52 +1463,60 @@ exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
|
|
|
1350
1463
|
const expectedTenantScope = declarativeReferenceTenantScopeKey(value.tenantScope);
|
|
1351
1464
|
const seenReleaseRefs = new Set();
|
|
1352
1465
|
value.releasePlacements.forEach((placement, index) => {
|
|
1353
|
-
const releasePath = [
|
|
1354
|
-
|
|
1466
|
+
const releasePath = [
|
|
1467
|
+
"releasePlacements",
|
|
1468
|
+
index,
|
|
1469
|
+
"releaseRevisionRef",
|
|
1470
|
+
];
|
|
1471
|
+
const definitionPath = [
|
|
1472
|
+
"releasePlacements",
|
|
1473
|
+
index,
|
|
1474
|
+
"definitionRevisionRef",
|
|
1475
|
+
];
|
|
1355
1476
|
if (placement.releaseRevisionRef.kind !== expectedReleaseKind) {
|
|
1356
1477
|
context.addIssue({
|
|
1357
|
-
code:
|
|
1358
|
-
path: [...releasePath,
|
|
1478
|
+
code: "custom",
|
|
1479
|
+
path: [...releasePath, "kind"],
|
|
1359
1480
|
message: `Release placement must reference ${expectedReleaseKind}.`,
|
|
1360
1481
|
});
|
|
1361
1482
|
}
|
|
1362
|
-
if (placement.releaseRevisionRef.visibility !==
|
|
1483
|
+
if (placement.releaseRevisionRef.visibility !== "tenant" ||
|
|
1363
1484
|
declarativeReferenceTenantScopeKey(placement.releaseRevisionRef.tenantScope) !== expectedTenantScope) {
|
|
1364
1485
|
context.addIssue({
|
|
1365
|
-
code:
|
|
1366
|
-
path: [...releasePath,
|
|
1367
|
-
message:
|
|
1486
|
+
code: "custom",
|
|
1487
|
+
path: [...releasePath, "tenantScope"],
|
|
1488
|
+
message: "Release placement must use the resource tenant scope.",
|
|
1368
1489
|
});
|
|
1369
1490
|
}
|
|
1370
1491
|
const releaseIdentity = `${placement.releaseRevisionRef.kind}:${placement.releaseRevisionRef.id}:${placement.releaseRevisionRef.revision}`;
|
|
1371
1492
|
if (seenReleaseRefs.has(releaseIdentity)) {
|
|
1372
1493
|
context.addIssue({
|
|
1373
|
-
code:
|
|
1494
|
+
code: "custom",
|
|
1374
1495
|
path: [...releasePath],
|
|
1375
|
-
message:
|
|
1496
|
+
message: "Release placements must not repeat an exact release revision.",
|
|
1376
1497
|
});
|
|
1377
1498
|
}
|
|
1378
1499
|
seenReleaseRefs.add(releaseIdentity);
|
|
1379
1500
|
if (placement.definitionRevisionRef.kind !== expectedDefinitionKind) {
|
|
1380
1501
|
context.addIssue({
|
|
1381
|
-
code:
|
|
1382
|
-
path: [...definitionPath,
|
|
1502
|
+
code: "custom",
|
|
1503
|
+
path: [...definitionPath, "kind"],
|
|
1383
1504
|
message: `Release placement definition must reference ${expectedDefinitionKind}.`,
|
|
1384
1505
|
});
|
|
1385
1506
|
}
|
|
1386
1507
|
if (placement.definitionRevisionRef.id !== value.resourceId) {
|
|
1387
1508
|
context.addIssue({
|
|
1388
|
-
code:
|
|
1389
|
-
path: [...definitionPath,
|
|
1390
|
-
message:
|
|
1509
|
+
code: "custom",
|
|
1510
|
+
path: [...definitionPath, "id"],
|
|
1511
|
+
message: "Release placement definition must reference the summary resource.",
|
|
1391
1512
|
});
|
|
1392
1513
|
}
|
|
1393
|
-
if (placement.definitionRevisionRef.visibility !==
|
|
1514
|
+
if (placement.definitionRevisionRef.visibility !== "tenant" ||
|
|
1394
1515
|
declarativeReferenceTenantScopeKey(placement.definitionRevisionRef.tenantScope) !== expectedTenantScope) {
|
|
1395
1516
|
context.addIssue({
|
|
1396
|
-
code:
|
|
1397
|
-
path: [...definitionPath,
|
|
1398
|
-
message:
|
|
1517
|
+
code: "custom",
|
|
1518
|
+
path: [...definitionPath, "tenantScope"],
|
|
1519
|
+
message: "Release placement definition must use the resource tenant scope.",
|
|
1399
1520
|
});
|
|
1400
1521
|
}
|
|
1401
1522
|
});
|
|
@@ -1409,19 +1530,19 @@ exports.DeclarativeAuthoringResourcePageSchema = zod_1.z
|
|
|
1409
1530
|
.superRefine((value, context) => {
|
|
1410
1531
|
if (value.pageInfo.returned !== value.items.length)
|
|
1411
1532
|
context.addIssue({
|
|
1412
|
-
code:
|
|
1413
|
-
path: [
|
|
1414
|
-
message:
|
|
1533
|
+
code: "custom",
|
|
1534
|
+
path: ["pageInfo", "returned"],
|
|
1535
|
+
message: "PageInfo returned must match resource item count.",
|
|
1415
1536
|
});
|
|
1416
1537
|
});
|
|
1417
1538
|
exports.DeclarativeAuthoringHistoryEntrySchema = zod_1.z
|
|
1418
1539
|
.object({
|
|
1419
1540
|
revisionRef: declarative_control_1.RevisionRefSchema,
|
|
1420
1541
|
version: zod_1.z.number().int().positive(),
|
|
1421
|
-
lifecycle: zod_1.z.enum([
|
|
1542
|
+
lifecycle: zod_1.z.enum(["active", "deprecated", "retired"]),
|
|
1422
1543
|
name: declarative_control_1.I18nTextSchema,
|
|
1423
1544
|
actorRef: declarative_control_1.StableRefSchema,
|
|
1424
|
-
source: zod_1.z.enum([
|
|
1545
|
+
source: zod_1.z.enum(["user", "migration", "rollback"]),
|
|
1425
1546
|
reason: zod_1.z.string().trim().min(1).optional(),
|
|
1426
1547
|
occurredAt: zod_1.z.string().datetime(),
|
|
1427
1548
|
activeRelease: zod_1.z.boolean(),
|
|
@@ -1436,26 +1557,29 @@ exports.DeclarativeAuthoringHistorySchema = zod_1.z
|
|
|
1436
1557
|
const DeclarativeRuntimeDiagnosticSchema = zod_1.z
|
|
1437
1558
|
.object({
|
|
1438
1559
|
code: common_1.ContractIdentifierSchema,
|
|
1439
|
-
severity: zod_1.z.enum([
|
|
1560
|
+
severity: zod_1.z.enum(["info", "warning", "error"]),
|
|
1440
1561
|
path: zod_1.z.string().trim().min(1),
|
|
1441
1562
|
message: zod_1.z.string().trim().min(1),
|
|
1442
1563
|
})
|
|
1443
1564
|
.strict();
|
|
1444
1565
|
exports.DeclarativeDraftResultSchema = zod_1.z
|
|
1445
1566
|
.object({
|
|
1446
|
-
action: zod_1.z.enum([
|
|
1567
|
+
action: zod_1.z.enum(["create", "save"]),
|
|
1447
1568
|
resourceKind: exports.DeclarativeResourceKindSchema,
|
|
1448
1569
|
resourceId: common_1.ContractIdentifierSchema,
|
|
1449
1570
|
document: exports.DeclarativeDocumentSchema,
|
|
1450
1571
|
revisionRef: declarative_control_1.RevisionRefSchema,
|
|
1451
1572
|
actorRef: declarative_control_1.StableRefSchema,
|
|
1452
1573
|
occurredAt: zod_1.z.string().datetime(),
|
|
1453
|
-
provenance: zod_1.z
|
|
1574
|
+
provenance: zod_1.z
|
|
1575
|
+
.object({ sourceRevisionRef: declarative_control_1.RevisionRefSchema })
|
|
1576
|
+
.strict()
|
|
1577
|
+
.optional(),
|
|
1454
1578
|
})
|
|
1455
1579
|
.strict();
|
|
1456
1580
|
exports.DeclarativeValidationResultSchema = zod_1.z
|
|
1457
1581
|
.object({
|
|
1458
|
-
action: zod_1.z.literal(
|
|
1582
|
+
action: zod_1.z.literal("validate"),
|
|
1459
1583
|
valid: zod_1.z.literal(true),
|
|
1460
1584
|
releaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1461
1585
|
bundleContentHash: common_1.Sha256Schema,
|
|
@@ -1464,12 +1588,16 @@ exports.DeclarativeValidationResultSchema = zod_1.z
|
|
|
1464
1588
|
.strict();
|
|
1465
1589
|
exports.DeclarativePreviewResultSchema = zod_1.z
|
|
1466
1590
|
.object({
|
|
1467
|
-
action: zod_1.z.literal(
|
|
1591
|
+
action: zod_1.z.literal("preview"),
|
|
1468
1592
|
token: zod_1.z.string().trim().min(1),
|
|
1469
1593
|
expiresAt: zod_1.z.string().datetime(),
|
|
1470
1594
|
revision: zod_1.z.number().int().positive(),
|
|
1471
1595
|
contentHash: common_1.Sha256Schema,
|
|
1472
|
-
bundle: zod_1.z.union([
|
|
1596
|
+
bundle: zod_1.z.union([
|
|
1597
|
+
declarative_control_1.PageRuntimeBundleSchema,
|
|
1598
|
+
declarative_control_1.NavigationRuntimeBundleSchema,
|
|
1599
|
+
declarative_control_1.WorkbenchRuntimeBundleSchema,
|
|
1600
|
+
]),
|
|
1473
1601
|
etag: zod_1.z.string().trim().min(1),
|
|
1474
1602
|
sourceContentHash: common_1.Sha256Schema,
|
|
1475
1603
|
})
|
|
@@ -1479,61 +1607,72 @@ exports.DeclarativePublicationItemResultSchema = zod_1.z
|
|
|
1479
1607
|
resourceKind: exports.DeclarativeResourceKindSchema,
|
|
1480
1608
|
resourceId: common_1.ContractIdentifierSchema,
|
|
1481
1609
|
releaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1482
|
-
release: zod_1.z.union([
|
|
1483
|
-
|
|
1610
|
+
release: zod_1.z.union([
|
|
1611
|
+
declarative_control_1.PageReleaseSchema,
|
|
1612
|
+
declarative_control_1.NavigationReleaseSchema,
|
|
1613
|
+
declarative_control_1.WorkbenchReleaseSchema,
|
|
1614
|
+
]),
|
|
1615
|
+
bundle: zod_1.z
|
|
1616
|
+
.union([
|
|
1617
|
+
declarative_control_1.PageRuntimeBundleSchema,
|
|
1618
|
+
declarative_control_1.NavigationRuntimeBundleSchema,
|
|
1619
|
+
declarative_control_1.WorkbenchRuntimeBundleSchema,
|
|
1620
|
+
])
|
|
1621
|
+
.optional(),
|
|
1484
1622
|
})
|
|
1485
1623
|
.strict()
|
|
1486
1624
|
.superRefine((value, context) => {
|
|
1487
1625
|
const expectedReleaseKind = {
|
|
1488
|
-
page:
|
|
1489
|
-
navigation:
|
|
1490
|
-
workbench:
|
|
1626
|
+
page: "page-release",
|
|
1627
|
+
navigation: "navigation-release",
|
|
1628
|
+
workbench: "workbench-release",
|
|
1491
1629
|
}[value.resourceKind];
|
|
1492
1630
|
const expectedReleaseContract = {
|
|
1493
|
-
page:
|
|
1494
|
-
navigation:
|
|
1495
|
-
workbench:
|
|
1631
|
+
page: "PageRelease",
|
|
1632
|
+
navigation: "NavigationRelease",
|
|
1633
|
+
workbench: "WorkbenchRelease",
|
|
1496
1634
|
}[value.resourceKind];
|
|
1497
1635
|
const expectedBundleContract = {
|
|
1498
|
-
page:
|
|
1499
|
-
navigation:
|
|
1500
|
-
workbench:
|
|
1636
|
+
page: "PageRuntimeBundle",
|
|
1637
|
+
navigation: "NavigationRuntimeBundle",
|
|
1638
|
+
workbench: "WorkbenchRuntimeBundle",
|
|
1501
1639
|
}[value.resourceKind];
|
|
1502
1640
|
if (value.releaseRevisionRef.kind !== expectedReleaseKind ||
|
|
1503
1641
|
value.releaseRevisionRef.id !== value.release.releaseSlotId ||
|
|
1504
1642
|
value.release.contract !== expectedReleaseContract) {
|
|
1505
1643
|
context.addIssue({
|
|
1506
|
-
code:
|
|
1507
|
-
path: [
|
|
1508
|
-
message:
|
|
1644
|
+
code: "custom",
|
|
1645
|
+
path: ["releaseRevisionRef"],
|
|
1646
|
+
message: "A publication item must return the exact release identity for its resource kind.",
|
|
1509
1647
|
});
|
|
1510
1648
|
}
|
|
1511
|
-
const definitionRef = value.release.contract ===
|
|
1649
|
+
const definitionRef = value.release.contract === "PageRelease"
|
|
1512
1650
|
? value.release.pageRevisionRef
|
|
1513
|
-
: value.release.contract ===
|
|
1651
|
+
: value.release.contract === "NavigationRelease"
|
|
1514
1652
|
? value.release.navigationRevisionRef
|
|
1515
1653
|
: value.release.workbenchRevisionRef;
|
|
1516
1654
|
if (definitionRef.id !== value.resourceId) {
|
|
1517
1655
|
context.addIssue({
|
|
1518
|
-
code:
|
|
1519
|
-
path: [
|
|
1520
|
-
message:
|
|
1656
|
+
code: "custom",
|
|
1657
|
+
path: ["resourceId"],
|
|
1658
|
+
message: "A publication item release must identify the requested resource.",
|
|
1521
1659
|
});
|
|
1522
1660
|
}
|
|
1523
|
-
const unavailable = value.release.operation ===
|
|
1661
|
+
const unavailable = value.release.operation === "deactivate" ||
|
|
1662
|
+
Boolean(value.release.legacyRestoration);
|
|
1524
1663
|
if (unavailable === Boolean(value.bundle)) {
|
|
1525
1664
|
context.addIssue({
|
|
1526
|
-
code:
|
|
1527
|
-
path: [
|
|
1665
|
+
code: "custom",
|
|
1666
|
+
path: ["bundle"],
|
|
1528
1667
|
message: unavailable
|
|
1529
|
-
?
|
|
1530
|
-
:
|
|
1668
|
+
? "A deactivated or legacy-restored Release cannot publish an active Runtime Bundle."
|
|
1669
|
+
: "An active declarative Release must publish its Runtime Bundle.",
|
|
1531
1670
|
});
|
|
1532
1671
|
}
|
|
1533
1672
|
if (value.bundle) {
|
|
1534
|
-
const bundleDefinitionRef = value.bundle.contract ===
|
|
1673
|
+
const bundleDefinitionRef = value.bundle.contract === "PageRuntimeBundle"
|
|
1535
1674
|
? value.bundle.pageRevisionRef
|
|
1536
|
-
: value.bundle.contract ===
|
|
1675
|
+
: value.bundle.contract === "NavigationRuntimeBundle"
|
|
1537
1676
|
? value.bundle.navigationRevisionRef
|
|
1538
1677
|
: value.bundle.workbenchRevisionRef;
|
|
1539
1678
|
const sameRevision = (left, right) => left.kind === right.kind &&
|
|
@@ -1546,36 +1685,36 @@ exports.DeclarativePublicationItemResultSchema = zod_1.z
|
|
|
1546
1685
|
!sameRevision(value.bundle.releaseRevisionRef, value.releaseRevisionRef) ||
|
|
1547
1686
|
!sameRevision(bundleDefinitionRef, definitionRef)) {
|
|
1548
1687
|
context.addIssue({
|
|
1549
|
-
code:
|
|
1550
|
-
path: [
|
|
1551
|
-
message:
|
|
1688
|
+
code: "custom",
|
|
1689
|
+
path: ["bundle"],
|
|
1690
|
+
message: "A publication item Runtime Bundle must pin the exact returned Release and definition revisions.",
|
|
1552
1691
|
});
|
|
1553
1692
|
}
|
|
1554
1693
|
}
|
|
1555
1694
|
});
|
|
1556
1695
|
const DeclarativeDirectPublicationResultSchema = zod_1.z
|
|
1557
1696
|
.object({
|
|
1558
|
-
action: zod_1.z.enum([
|
|
1697
|
+
action: zod_1.z.enum(["publish", "rollback"]),
|
|
1559
1698
|
generation: zod_1.z.number().int().nonnegative(),
|
|
1560
1699
|
items: zod_1.z.array(exports.DeclarativePublicationItemResultSchema).min(1),
|
|
1561
1700
|
etag: zod_1.z.string().trim().min(1),
|
|
1562
1701
|
})
|
|
1563
1702
|
.strict()
|
|
1564
1703
|
.superRefine((value, context) => {
|
|
1565
|
-
const expectedOperation = value.action ===
|
|
1704
|
+
const expectedOperation = value.action === "publish" ? "activate" : "rollback";
|
|
1566
1705
|
value.items.forEach((item, index) => {
|
|
1567
1706
|
if (item.release.operation !== expectedOperation) {
|
|
1568
1707
|
context.addIssue({
|
|
1569
|
-
code:
|
|
1570
|
-
path: [
|
|
1571
|
-
message:
|
|
1708
|
+
code: "custom",
|
|
1709
|
+
path: ["items", index, "release", "operation"],
|
|
1710
|
+
message: "A direct publication result must match its requested action.",
|
|
1572
1711
|
});
|
|
1573
1712
|
}
|
|
1574
1713
|
});
|
|
1575
1714
|
});
|
|
1576
1715
|
const DeclarativeAtomicPublicationPlanResultSchema = zod_1.z
|
|
1577
1716
|
.object({
|
|
1578
|
-
action: zod_1.z.literal(
|
|
1717
|
+
action: zod_1.z.literal("publication-plan"),
|
|
1579
1718
|
generation: zod_1.z.number().int().nonnegative(),
|
|
1580
1719
|
publicationPlanRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1581
1720
|
items: zod_1.z.array(exports.DeclarativePublicationItemResultSchema).min(1),
|
|
@@ -1583,11 +1722,11 @@ const DeclarativeAtomicPublicationPlanResultSchema = zod_1.z
|
|
|
1583
1722
|
})
|
|
1584
1723
|
.strict()
|
|
1585
1724
|
.superRefine((value, context) => {
|
|
1586
|
-
if (value.publicationPlanRevisionRef.kind !==
|
|
1725
|
+
if (value.publicationPlanRevisionRef.kind !== "publication-plan") {
|
|
1587
1726
|
context.addIssue({
|
|
1588
|
-
code:
|
|
1589
|
-
path: [
|
|
1590
|
-
message:
|
|
1727
|
+
code: "custom",
|
|
1728
|
+
path: ["publicationPlanRevisionRef", "kind"],
|
|
1729
|
+
message: "An atomic publication result must pin its Publication Plan revision.",
|
|
1591
1730
|
});
|
|
1592
1731
|
}
|
|
1593
1732
|
});
|
|
@@ -1597,8 +1736,8 @@ exports.DeclarativePublicationResultSchema = zod_1.z.union([
|
|
|
1597
1736
|
]);
|
|
1598
1737
|
exports.DeclarativeMigrationDiffEntrySchema = zod_1.z
|
|
1599
1738
|
.object({
|
|
1600
|
-
path: zod_1.z.string().trim().startsWith(
|
|
1601
|
-
status: zod_1.z.enum([
|
|
1739
|
+
path: zod_1.z.string().trim().startsWith("/").max(1024),
|
|
1740
|
+
status: zod_1.z.enum(["added", "changed", "removed", "unchanged"]),
|
|
1602
1741
|
legacyValueHash: common_1.Sha256Schema.optional(),
|
|
1603
1742
|
declarativeValueHash: common_1.Sha256Schema.optional(),
|
|
1604
1743
|
})
|
|
@@ -1617,7 +1756,7 @@ exports.DeclarativeMigrationBlockerSchema = zod_1.z
|
|
|
1617
1756
|
*/
|
|
1618
1757
|
exports.DeclarativeLegacyMigrationInspectionSchema = zod_1.z
|
|
1619
1758
|
.object({
|
|
1620
|
-
contract: zod_1.z.literal(
|
|
1759
|
+
contract: zod_1.z.literal("DeclarativeLegacyMigrationInspection"),
|
|
1621
1760
|
schemaVersion: zod_1.z.literal(1),
|
|
1622
1761
|
migrationKind: exports.DeclarativeLegacyMigrationKindSchema,
|
|
1623
1762
|
legacyResourceId: common_1.ContractIdentifierSchema,
|
|
@@ -1627,7 +1766,7 @@ exports.DeclarativeLegacyMigrationInspectionSchema = zod_1.z
|
|
|
1627
1766
|
targetResourceRef: declarative_control_1.StableRefSchema,
|
|
1628
1767
|
environmentRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1629
1768
|
routeSpaceRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1630
|
-
normalizedPath: zod_1.z.string().trim().startsWith(
|
|
1769
|
+
normalizedPath: zod_1.z.string().trim().startsWith("/").max(2048),
|
|
1631
1770
|
takeoverAuthorization: declarative_control_1.LegacyRouteTakeoverAuthorizationSchema,
|
|
1632
1771
|
diff: zod_1.z.array(exports.DeclarativeMigrationDiffEntrySchema).max(256),
|
|
1633
1772
|
blockers: zod_1.z.array(exports.DeclarativeMigrationBlockerSchema).max(128),
|
|
@@ -1636,30 +1775,34 @@ exports.DeclarativeLegacyMigrationInspectionSchema = zod_1.z
|
|
|
1636
1775
|
})
|
|
1637
1776
|
.strict()
|
|
1638
1777
|
.superRefine((value, context) => {
|
|
1639
|
-
const expectedKind = value.migrationKind ===
|
|
1778
|
+
const expectedKind = value.migrationKind === "workbench" ? "workbench" : "page";
|
|
1640
1779
|
if (value.targetResourceRef.kind !== expectedKind) {
|
|
1641
1780
|
context.addIssue({
|
|
1642
|
-
code:
|
|
1643
|
-
path: [
|
|
1781
|
+
code: "custom",
|
|
1782
|
+
path: ["targetResourceRef", "kind"],
|
|
1644
1783
|
message: `A ${value.migrationKind} migration must target ${expectedKind}.`,
|
|
1645
1784
|
});
|
|
1646
1785
|
}
|
|
1647
|
-
if (value.takeoverAuthorization.inspectedSourceContentHash !==
|
|
1786
|
+
if (value.takeoverAuthorization.inspectedSourceContentHash !==
|
|
1787
|
+
value.sourceContentHash ||
|
|
1648
1788
|
value.takeoverAuthorization.normalizedPath !== value.normalizedPath ||
|
|
1649
|
-
value.takeoverAuthorization.targetResourceRef.kind !==
|
|
1650
|
-
|
|
1651
|
-
value.takeoverAuthorization.targetResourceRef.
|
|
1789
|
+
value.takeoverAuthorization.targetResourceRef.kind !==
|
|
1790
|
+
value.targetResourceRef.kind ||
|
|
1791
|
+
value.takeoverAuthorization.targetResourceRef.id !==
|
|
1792
|
+
value.targetResourceRef.id ||
|
|
1793
|
+
value.takeoverAuthorization.targetResourceRef.ownerRepo !==
|
|
1794
|
+
value.targetResourceRef.ownerRepo) {
|
|
1652
1795
|
context.addIssue({
|
|
1653
|
-
code:
|
|
1654
|
-
path: [
|
|
1655
|
-
message:
|
|
1796
|
+
code: "custom",
|
|
1797
|
+
path: ["takeoverAuthorization"],
|
|
1798
|
+
message: "The takeover authority must bind the exact inspected source, path and target.",
|
|
1656
1799
|
});
|
|
1657
1800
|
}
|
|
1658
1801
|
if (value.canCreateDraft !== (value.blockers.length === 0)) {
|
|
1659
1802
|
context.addIssue({
|
|
1660
|
-
code:
|
|
1661
|
-
path: [
|
|
1662
|
-
message:
|
|
1803
|
+
code: "custom",
|
|
1804
|
+
path: ["canCreateDraft"],
|
|
1805
|
+
message: "Draft creation is allowed exactly when inspection has no blockers.",
|
|
1663
1806
|
});
|
|
1664
1807
|
}
|
|
1665
1808
|
});
|
|
@@ -1683,19 +1826,19 @@ exports.DeclarativeLegacyMigrationCreateDraftResultSchema = zod_1.z
|
|
|
1683
1826
|
})
|
|
1684
1827
|
.strict();
|
|
1685
1828
|
exports.DECLARATIVE_MIGRATION_ERROR_CODES = {
|
|
1686
|
-
sourceChanged:
|
|
1687
|
-
reservedTakeoverForbidden:
|
|
1688
|
-
takeoverScopeInvalid:
|
|
1689
|
-
workbenchDefaultConflict:
|
|
1690
|
-
legacyWriteBlocked:
|
|
1829
|
+
sourceChanged: "DECLARATIVE_LEGACY_SOURCE_CHANGED",
|
|
1830
|
+
reservedTakeoverForbidden: "DECLARATIVE_RESERVED_ROUTE_TAKEOVER_FORBIDDEN",
|
|
1831
|
+
takeoverScopeInvalid: "DECLARATIVE_ROUTE_TAKEOVER_SCOPE_INVALID",
|
|
1832
|
+
workbenchDefaultConflict: "DECLARATIVE_WORKBENCH_DEFAULT_CONFLICT",
|
|
1833
|
+
legacyWriteBlocked: "DECLARATIVE_LEGACY_WRITE_BLOCKED",
|
|
1691
1834
|
};
|
|
1692
1835
|
exports.DeclarativeRetireResultSchema = zod_1.z
|
|
1693
1836
|
.object({
|
|
1694
|
-
action: zod_1.z.literal(
|
|
1837
|
+
action: zod_1.z.literal("retire"),
|
|
1695
1838
|
resourceKind: exports.DeclarativeResourceKindSchema,
|
|
1696
1839
|
resourceId: common_1.ContractIdentifierSchema,
|
|
1697
1840
|
revisionRef: declarative_control_1.RevisionRefSchema,
|
|
1698
|
-
lifecycle: zod_1.z.literal(
|
|
1841
|
+
lifecycle: zod_1.z.literal("retired"),
|
|
1699
1842
|
actorRef: declarative_control_1.StableRefSchema,
|
|
1700
1843
|
occurredAt: zod_1.z.string().datetime(),
|
|
1701
1844
|
reason: zod_1.z.string().trim().min(1).max(4096),
|
|
@@ -1722,7 +1865,7 @@ const DeclarativeNavigationSeedMigrationDiffSchema = zod_1.z
|
|
|
1722
1865
|
.strict();
|
|
1723
1866
|
exports.DeclarativeNavigationSeedMigrationResultSchema = zod_1.z
|
|
1724
1867
|
.object({
|
|
1725
|
-
outcome: zod_1.z.enum([
|
|
1868
|
+
outcome: zod_1.z.enum(["already-active", "review-required", "published"]),
|
|
1726
1869
|
placement: common_1.ContractIdentifierSchema,
|
|
1727
1870
|
legacyContentHash: common_1.Sha256Schema,
|
|
1728
1871
|
templateRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
@@ -1733,18 +1876,20 @@ exports.DeclarativeNavigationSeedMigrationResultSchema = zod_1.z
|
|
|
1733
1876
|
})
|
|
1734
1877
|
.strict()
|
|
1735
1878
|
.superRefine((value, context) => {
|
|
1736
|
-
if (value.outcome ===
|
|
1879
|
+
if (value.outcome === "review-required" &&
|
|
1880
|
+
(!value.requiresReview || !value.draftRevisionRef)) {
|
|
1737
1881
|
context.addIssue({
|
|
1738
|
-
code:
|
|
1739
|
-
path: [
|
|
1740
|
-
message:
|
|
1882
|
+
code: "custom",
|
|
1883
|
+
path: ["outcome"],
|
|
1884
|
+
message: "Review-required migrations must expose their draft.",
|
|
1741
1885
|
});
|
|
1742
1886
|
}
|
|
1743
|
-
if ((value.outcome ===
|
|
1887
|
+
if ((value.outcome === "already-active" || value.outcome === "published") &&
|
|
1888
|
+
!value.activeReleaseRevisionRef) {
|
|
1744
1889
|
context.addIssue({
|
|
1745
|
-
code:
|
|
1746
|
-
path: [
|
|
1747
|
-
message:
|
|
1890
|
+
code: "custom",
|
|
1891
|
+
path: ["activeReleaseRevisionRef"],
|
|
1892
|
+
message: "Active migrations require an exact release revision.",
|
|
1748
1893
|
});
|
|
1749
1894
|
}
|
|
1750
1895
|
});
|
|
@@ -1752,7 +1897,7 @@ exports.DeclarativeNavigationPlacementSchema = zod_1.z
|
|
|
1752
1897
|
.object({
|
|
1753
1898
|
placement: common_1.ContractIdentifierSchema,
|
|
1754
1899
|
surface: declarative_control_1.ProductSurfaceSchema,
|
|
1755
|
-
authority: zod_1.z.enum([
|
|
1900
|
+
authority: zod_1.z.enum(["legacy", "declarative"]),
|
|
1756
1901
|
authorityRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
|
|
1757
1902
|
navigationRef: declarative_control_1.StableRefSchema.optional(),
|
|
1758
1903
|
draftRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
|
|
@@ -1780,7 +1925,9 @@ exports.DeclarativeAuthoringBootstrapSchema = zod_1.z
|
|
|
1780
1925
|
publishedTargets: zod_1.z.array(exports.DeclarativeAuthoringChoiceSchema),
|
|
1781
1926
|
workbenchTargets: zod_1.z.array(exports.DeclarativeWorkbenchTargetChoiceSchema),
|
|
1782
1927
|
resourcesPageInfo: exports.DeclarativeAuthoringPageInfoSchema.optional(),
|
|
1783
|
-
deferredChoiceKinds: zod_1.z
|
|
1928
|
+
deferredChoiceKinds: zod_1.z
|
|
1929
|
+
.array(exports.DeclarativeAuthoringChoiceKindSchema)
|
|
1930
|
+
.optional(),
|
|
1784
1931
|
compilerRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1785
1932
|
generation: zod_1.z.number().int().nonnegative(),
|
|
1786
1933
|
contentHash: common_1.Sha256Schema,
|
|
@@ -1791,7 +1938,7 @@ exports.DeclarativeRuntimeRedirectSchema = zod_1.z
|
|
|
1791
1938
|
statusCode: zod_1.z.literal(302),
|
|
1792
1939
|
source: zod_1.z
|
|
1793
1940
|
.object({
|
|
1794
|
-
resourceKind: zod_1.z.enum([
|
|
1941
|
+
resourceKind: zod_1.z.enum(["page", "workbench"]),
|
|
1795
1942
|
releaseSlotId: common_1.ContractIdentifierSchema,
|
|
1796
1943
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1797
1944
|
routeClaim: declarative_control_1.CompiledRouteClaimSchema,
|
|
@@ -1799,11 +1946,11 @@ exports.DeclarativeRuntimeRedirectSchema = zod_1.z
|
|
|
1799
1946
|
.strict(),
|
|
1800
1947
|
target: zod_1.z
|
|
1801
1948
|
.object({
|
|
1802
|
-
resourceKind: zod_1.z.enum([
|
|
1949
|
+
resourceKind: zod_1.z.enum(["page", "workbench"]),
|
|
1803
1950
|
stableTargetRef: declarative_control_1.StableRefSchema,
|
|
1804
1951
|
releaseSlotId: common_1.ContractIdentifierSchema,
|
|
1805
1952
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1806
|
-
normalizedPath: zod_1.z.string().trim().startsWith(
|
|
1953
|
+
normalizedPath: zod_1.z.string().trim().startsWith("/"),
|
|
1807
1954
|
})
|
|
1808
1955
|
.strict(),
|
|
1809
1956
|
})
|
|
@@ -1831,14 +1978,14 @@ exports.DeclarativeRuntimeResolvedSchema = zod_1.z
|
|
|
1831
1978
|
const outcomes = [value.page, value.workbench, value.redirect].filter(Boolean).length;
|
|
1832
1979
|
if (outcomes !== 1)
|
|
1833
1980
|
context.addIssue({
|
|
1834
|
-
code:
|
|
1835
|
-
path: [
|
|
1836
|
-
message:
|
|
1981
|
+
code: "custom",
|
|
1982
|
+
path: ["page"],
|
|
1983
|
+
message: "A resolved runtime must contain exactly one Page, Workbench, or governed redirect outcome.",
|
|
1837
1984
|
});
|
|
1838
1985
|
});
|
|
1839
1986
|
const DeclarativeRuntimeSafeBaseShape = {
|
|
1840
1987
|
surface: declarative_control_1.ProductSurfaceSchema,
|
|
1841
|
-
normalizedPath: zod_1.z.string().trim().startsWith(
|
|
1988
|
+
normalizedPath: zod_1.z.string().trim().startsWith("/").max(2048),
|
|
1842
1989
|
routeParameters: zod_1.z
|
|
1843
1990
|
.any()
|
|
1844
1991
|
.superRefine(rejectRuntimePrototypeKeys)
|
|
@@ -1846,9 +1993,9 @@ const DeclarativeRuntimeSafeBaseShape = {
|
|
|
1846
1993
|
.superRefine((parameters, context) => {
|
|
1847
1994
|
if (Object.keys(parameters).length > 32) {
|
|
1848
1995
|
context.addIssue({
|
|
1849
|
-
code:
|
|
1996
|
+
code: "custom",
|
|
1850
1997
|
path: [],
|
|
1851
|
-
message:
|
|
1998
|
+
message: "A resolved route cannot expose more than 32 parameters.",
|
|
1852
1999
|
});
|
|
1853
2000
|
}
|
|
1854
2001
|
}),
|
|
@@ -1858,33 +2005,34 @@ const DeclarativeRuntimeSafeBaseShape = {
|
|
|
1858
2005
|
};
|
|
1859
2006
|
const DeclarativeRuntimeLegacyOutcomeSchema = zod_1.z
|
|
1860
2007
|
.object({
|
|
1861
|
-
outcome: zod_1.z.literal(
|
|
2008
|
+
outcome: zod_1.z.literal("legacy"),
|
|
1862
2009
|
...DeclarativeRuntimeSafeBaseShape,
|
|
1863
2010
|
legacyAdapterRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
1864
2011
|
})
|
|
1865
2012
|
.strict()
|
|
1866
2013
|
.superRefine((value, context) => {
|
|
1867
|
-
if (value.legacyAdapterRevisionRef.kind !==
|
|
2014
|
+
if (value.legacyAdapterRevisionRef.kind !== "legacy-route-adapter") {
|
|
1868
2015
|
context.addIssue({
|
|
1869
|
-
code:
|
|
1870
|
-
path: [
|
|
1871
|
-
message:
|
|
2016
|
+
code: "custom",
|
|
2017
|
+
path: ["legacyAdapterRevisionRef", "kind"],
|
|
2018
|
+
message: "A legacy runtime outcome must pin a legacy-route-adapter revision.",
|
|
1872
2019
|
});
|
|
1873
2020
|
}
|
|
1874
2021
|
});
|
|
1875
2022
|
const DeclarativeRuntimeAuthorizedOutcomeSchema = zod_1.z
|
|
1876
2023
|
.object({
|
|
1877
|
-
outcome: zod_1.z.literal(
|
|
2024
|
+
outcome: zod_1.z.literal("declarative"),
|
|
1878
2025
|
...DeclarativeRuntimeSafeBaseShape,
|
|
1879
2026
|
resolved: exports.DeclarativeRuntimeResolvedSchema,
|
|
1880
2027
|
})
|
|
1881
2028
|
.strict()
|
|
1882
2029
|
.superRefine((value, context) => {
|
|
1883
|
-
if (value.resolved.surface !== value.surface ||
|
|
2030
|
+
if (value.resolved.surface !== value.surface ||
|
|
2031
|
+
value.resolved.normalizedPath !== value.normalizedPath) {
|
|
1884
2032
|
context.addIssue({
|
|
1885
|
-
code:
|
|
1886
|
-
path: [
|
|
1887
|
-
message:
|
|
2033
|
+
code: "custom",
|
|
2034
|
+
path: ["resolved"],
|
|
2035
|
+
message: "An authorized declarative outcome must match its safe route envelope.",
|
|
1888
2036
|
});
|
|
1889
2037
|
}
|
|
1890
2038
|
});
|
|
@@ -1895,31 +2043,32 @@ const DeclarativeRuntimeDeniedOutcomeSchema = (outcome, code) => zod_1.z
|
|
|
1895
2043
|
code: zod_1.z.literal(code),
|
|
1896
2044
|
})
|
|
1897
2045
|
.strict();
|
|
1898
|
-
const DeclarativeRuntimeForbiddenOutcomeSchema = zod_1.z.discriminatedUnion(
|
|
2046
|
+
const DeclarativeRuntimeForbiddenOutcomeSchema = zod_1.z.discriminatedUnion("resourceKind", [
|
|
1899
2047
|
zod_1.z
|
|
1900
2048
|
.object({
|
|
1901
|
-
outcome: zod_1.z.literal(
|
|
2049
|
+
outcome: zod_1.z.literal("forbidden"),
|
|
1902
2050
|
...DeclarativeRuntimeSafeBaseShape,
|
|
1903
|
-
resourceKind: zod_1.z.literal(
|
|
1904
|
-
code: zod_1.z.literal(
|
|
2051
|
+
resourceKind: zod_1.z.literal("page"),
|
|
2052
|
+
code: zod_1.z.literal("DECLARATIVE_PAGE_FORBIDDEN"),
|
|
1905
2053
|
presentation: declarative_control_1.PageRouteStatePresentationSchema.optional(),
|
|
1906
2054
|
})
|
|
1907
2055
|
.strict()
|
|
1908
2056
|
.superRefine((value, context) => {
|
|
1909
|
-
if (value.presentation &&
|
|
2057
|
+
if (value.presentation &&
|
|
2058
|
+
value.presentation.surface !== value.surface) {
|
|
1910
2059
|
context.addIssue({
|
|
1911
|
-
code:
|
|
1912
|
-
path: [
|
|
1913
|
-
message:
|
|
2060
|
+
code: "custom",
|
|
2061
|
+
path: ["presentation", "surface"],
|
|
2062
|
+
message: "A forbidden Page presentation must match the resolved route surface.",
|
|
1914
2063
|
});
|
|
1915
2064
|
}
|
|
1916
2065
|
}),
|
|
1917
2066
|
zod_1.z
|
|
1918
2067
|
.object({
|
|
1919
|
-
outcome: zod_1.z.literal(
|
|
2068
|
+
outcome: zod_1.z.literal("forbidden"),
|
|
1920
2069
|
...DeclarativeRuntimeSafeBaseShape,
|
|
1921
|
-
resourceKind: zod_1.z.literal(
|
|
1922
|
-
code: zod_1.z.literal(
|
|
2070
|
+
resourceKind: zod_1.z.literal("workbench"),
|
|
2071
|
+
code: zod_1.z.literal("DECLARATIVE_WORKBENCH_FORBIDDEN"),
|
|
1923
2072
|
})
|
|
1924
2073
|
.strict(),
|
|
1925
2074
|
]);
|
|
@@ -1931,8 +2080,8 @@ exports.DeclarativeRuntimeResolveResultSchema = zod_1.z.union([
|
|
|
1931
2080
|
DeclarativeRuntimeLegacyOutcomeSchema,
|
|
1932
2081
|
DeclarativeRuntimeAuthorizedOutcomeSchema,
|
|
1933
2082
|
DeclarativeRuntimeForbiddenOutcomeSchema,
|
|
1934
|
-
DeclarativeRuntimeDeniedOutcomeSchema(
|
|
1935
|
-
DeclarativeRuntimeDeniedOutcomeSchema(
|
|
2083
|
+
DeclarativeRuntimeDeniedOutcomeSchema("unavailable", "DECLARATIVE_ROUTE_UNAVAILABLE"),
|
|
2084
|
+
DeclarativeRuntimeDeniedOutcomeSchema("not-found", "DECLARATIVE_ROUTE_NOT_FOUND"),
|
|
1936
2085
|
]);
|
|
1937
2086
|
exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
|
|
1938
2087
|
.object({
|
|
@@ -1940,56 +2089,60 @@ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
|
|
|
1940
2089
|
.object({
|
|
1941
2090
|
placement: common_1.ContractIdentifierSchema,
|
|
1942
2091
|
surface: declarative_control_1.ProductSurfaceSchema,
|
|
1943
|
-
authority: zod_1.z.enum([
|
|
1944
|
-
state: zod_1.z.enum([
|
|
2092
|
+
authority: zod_1.z.enum(["legacy", "declarative"]),
|
|
2093
|
+
state: zod_1.z.enum(["active", "deactivated"]),
|
|
1945
2094
|
releaseSlotId: common_1.ContractIdentifierSchema.optional(),
|
|
1946
2095
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
|
|
1947
2096
|
bundle: declarative_control_1.NavigationRuntimeBundleSchema.optional(),
|
|
1948
2097
|
})
|
|
1949
2098
|
.strict()
|
|
1950
2099
|
.superRefine((value, context) => {
|
|
1951
|
-
if (value.authority ===
|
|
1952
|
-
if (value.releaseSlotId ||
|
|
2100
|
+
if (value.authority === "legacy") {
|
|
2101
|
+
if (value.releaseSlotId ||
|
|
2102
|
+
value.activeReleaseRevisionRef ||
|
|
2103
|
+
value.bundle) {
|
|
1953
2104
|
context.addIssue({
|
|
1954
|
-
code:
|
|
1955
|
-
path: [
|
|
1956
|
-
message:
|
|
2105
|
+
code: "custom",
|
|
2106
|
+
path: ["authority"],
|
|
2107
|
+
message: "Legacy navigation placements cannot expose declarative Release or Bundle state.",
|
|
1957
2108
|
});
|
|
1958
2109
|
}
|
|
1959
|
-
if (value.state !==
|
|
2110
|
+
if (value.state !== "active")
|
|
1960
2111
|
context.addIssue({
|
|
1961
|
-
code:
|
|
1962
|
-
path: [
|
|
1963
|
-
message:
|
|
2112
|
+
code: "custom",
|
|
2113
|
+
path: ["state"],
|
|
2114
|
+
message: "Legacy navigation placements are active until an explicit declarative cutover.",
|
|
1964
2115
|
});
|
|
1965
2116
|
return;
|
|
1966
2117
|
}
|
|
1967
2118
|
if (!value.releaseSlotId || !value.activeReleaseRevisionRef) {
|
|
1968
2119
|
context.addIssue({
|
|
1969
|
-
code:
|
|
1970
|
-
path: [
|
|
1971
|
-
message:
|
|
2120
|
+
code: "custom",
|
|
2121
|
+
path: ["releaseSlotId"],
|
|
2122
|
+
message: "Declarative navigation placements require an exact active Release reference.",
|
|
1972
2123
|
});
|
|
1973
2124
|
}
|
|
1974
|
-
if (value.state ===
|
|
2125
|
+
if (value.state === "active" && !value.bundle) {
|
|
1975
2126
|
context.addIssue({
|
|
1976
|
-
code:
|
|
1977
|
-
path: [
|
|
1978
|
-
message:
|
|
2127
|
+
code: "custom",
|
|
2128
|
+
path: ["bundle"],
|
|
2129
|
+
message: "An active declarative navigation placement requires its identity-filtered Runtime Bundle.",
|
|
1979
2130
|
});
|
|
1980
2131
|
}
|
|
1981
|
-
if (value.state ===
|
|
2132
|
+
if (value.state === "deactivated" && value.bundle) {
|
|
1982
2133
|
context.addIssue({
|
|
1983
|
-
code:
|
|
1984
|
-
path: [
|
|
1985
|
-
message:
|
|
2134
|
+
code: "custom",
|
|
2135
|
+
path: ["bundle"],
|
|
2136
|
+
message: "A deactivated declarative navigation placement cannot expose a Runtime Bundle.",
|
|
1986
2137
|
});
|
|
1987
2138
|
}
|
|
1988
|
-
if (value.bundle &&
|
|
2139
|
+
if (value.bundle &&
|
|
2140
|
+
(value.bundle.placement !== value.placement ||
|
|
2141
|
+
value.bundle.surface !== value.surface)) {
|
|
1989
2142
|
context.addIssue({
|
|
1990
|
-
code:
|
|
1991
|
-
path: [
|
|
1992
|
-
message:
|
|
2143
|
+
code: "custom",
|
|
2144
|
+
path: ["bundle"],
|
|
2145
|
+
message: "The Navigation Runtime Bundle must match its placement and surface.",
|
|
1993
2146
|
});
|
|
1994
2147
|
}
|
|
1995
2148
|
})),
|
|
@@ -2002,12 +2155,13 @@ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
|
|
|
2002
2155
|
})
|
|
2003
2156
|
.strict()
|
|
2004
2157
|
.superRefine((value, context) => {
|
|
2005
|
-
const active = value.placements.filter((entry) => entry.authority ===
|
|
2006
|
-
if (active.length !== value.bundles.length ||
|
|
2158
|
+
const active = value.placements.filter((entry) => entry.authority === "declarative" && entry.state === "active");
|
|
2159
|
+
if (active.length !== value.bundles.length ||
|
|
2160
|
+
active.length !== value.releaseSlotIds.length) {
|
|
2007
2161
|
context.addIssue({
|
|
2008
|
-
code:
|
|
2009
|
-
path: [
|
|
2010
|
-
message:
|
|
2162
|
+
code: "custom",
|
|
2163
|
+
path: ["placements"],
|
|
2164
|
+
message: "Compatibility bundle arrays must exactly project active declarative placements.",
|
|
2011
2165
|
});
|
|
2012
2166
|
return;
|
|
2013
2167
|
}
|
|
@@ -2015,9 +2169,9 @@ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
|
|
|
2015
2169
|
if (entry.bundle?.contentHash !== value.bundles[index]?.contentHash ||
|
|
2016
2170
|
entry.releaseSlotId !== value.releaseSlotIds[index]) {
|
|
2017
2171
|
context.addIssue({
|
|
2018
|
-
code:
|
|
2019
|
-
path: [
|
|
2020
|
-
message:
|
|
2172
|
+
code: "custom",
|
|
2173
|
+
path: ["placements", index],
|
|
2174
|
+
message: "Navigation placement and compatibility bundle order must match.",
|
|
2021
2175
|
});
|
|
2022
2176
|
}
|
|
2023
2177
|
});
|
|
@@ -2038,7 +2192,7 @@ exports.DeclarativeWorkbenchSummarySchema = zod_1.z
|
|
|
2038
2192
|
exports.DeclarativeLegacyWorkbenchSummarySchema = zod_1.z
|
|
2039
2193
|
.object({
|
|
2040
2194
|
workbenchId: common_1.ContractIdentifierSchema,
|
|
2041
|
-
authority: zod_1.z.literal(
|
|
2195
|
+
authority: zod_1.z.literal("legacy"),
|
|
2042
2196
|
identity: declarative_control_1.WorkbenchIdentitySchema,
|
|
2043
2197
|
order: zod_1.z.number().int(),
|
|
2044
2198
|
isDefaultCandidate: zod_1.z.boolean(),
|
|
@@ -2046,29 +2200,29 @@ exports.DeclarativeLegacyWorkbenchSummarySchema = zod_1.z
|
|
|
2046
2200
|
.strict();
|
|
2047
2201
|
exports.DeclarativeWorkbenchRuntimeBootstrapSchema = zod_1.z
|
|
2048
2202
|
.object({
|
|
2049
|
-
defaultAuthority: zod_1.z.literal(
|
|
2203
|
+
defaultAuthority: zod_1.z.literal("legacy"),
|
|
2050
2204
|
authorities: zod_1.z.array(zod_1.z
|
|
2051
2205
|
.object({
|
|
2052
2206
|
workbenchId: common_1.ContractIdentifierSchema,
|
|
2053
2207
|
releaseSlotId: common_1.ContractIdentifierSchema,
|
|
2054
|
-
authority: zod_1.z.enum([
|
|
2055
|
-
state: zod_1.z.enum([
|
|
2208
|
+
authority: zod_1.z.enum(["legacy", "declarative"]),
|
|
2209
|
+
state: zod_1.z.enum(["active", "deactivated"]),
|
|
2056
2210
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
2057
2211
|
visible: zod_1.z.boolean(),
|
|
2058
2212
|
})
|
|
2059
2213
|
.strict()
|
|
2060
2214
|
.superRefine((value, context) => {
|
|
2061
|
-
if (value.authority ===
|
|
2215
|
+
if (value.authority === "legacy" && value.visible)
|
|
2062
2216
|
context.addIssue({
|
|
2063
|
-
code:
|
|
2064
|
-
path: [
|
|
2065
|
-
message:
|
|
2217
|
+
code: "custom",
|
|
2218
|
+
path: ["visible"],
|
|
2219
|
+
message: "Legacy workbenches are delivered by the compatibility API, not by declarative summaries.",
|
|
2066
2220
|
});
|
|
2067
|
-
if (value.state ===
|
|
2221
|
+
if (value.state === "deactivated" && value.visible)
|
|
2068
2222
|
context.addIssue({
|
|
2069
|
-
code:
|
|
2070
|
-
path: [
|
|
2071
|
-
message:
|
|
2223
|
+
code: "custom",
|
|
2224
|
+
path: ["visible"],
|
|
2225
|
+
message: "Deactivated workbenches cannot be visible.",
|
|
2072
2226
|
});
|
|
2073
2227
|
})),
|
|
2074
2228
|
legacySummaries: zod_1.z.array(exports.DeclarativeLegacyWorkbenchSummarySchema),
|
|
@@ -2076,25 +2230,27 @@ exports.DeclarativeWorkbenchRuntimeBootstrapSchema = zod_1.z
|
|
|
2076
2230
|
selected: zod_1.z
|
|
2077
2231
|
.object({
|
|
2078
2232
|
workbenchId: common_1.ContractIdentifierSchema,
|
|
2079
|
-
authority: zod_1.z.enum([
|
|
2233
|
+
authority: zod_1.z.enum(["legacy", "declarative"]),
|
|
2080
2234
|
releaseSlotId: common_1.ContractIdentifierSchema.optional(),
|
|
2081
2235
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
|
|
2082
|
-
source: zod_1.z.enum([
|
|
2236
|
+
source: zod_1.z.enum(["explicit", "default", "first-accessible"]),
|
|
2083
2237
|
})
|
|
2084
2238
|
.strict()
|
|
2085
2239
|
.superRefine((value, context) => {
|
|
2086
|
-
if (value.authority ===
|
|
2240
|
+
if (value.authority === "declarative" &&
|
|
2241
|
+
(!value.releaseSlotId || !value.activeReleaseRevisionRef)) {
|
|
2087
2242
|
context.addIssue({
|
|
2088
|
-
code:
|
|
2089
|
-
path: [
|
|
2090
|
-
message:
|
|
2243
|
+
code: "custom",
|
|
2244
|
+
path: ["releaseSlotId"],
|
|
2245
|
+
message: "Declarative Workbench selection requires its exact Release slot and revision.",
|
|
2091
2246
|
});
|
|
2092
2247
|
}
|
|
2093
|
-
if (value.authority ===
|
|
2248
|
+
if (value.authority === "legacy" &&
|
|
2249
|
+
(value.releaseSlotId || value.activeReleaseRevisionRef)) {
|
|
2094
2250
|
context.addIssue({
|
|
2095
|
-
code:
|
|
2096
|
-
path: [
|
|
2097
|
-
message:
|
|
2251
|
+
code: "custom",
|
|
2252
|
+
path: ["releaseSlotId"],
|
|
2253
|
+
message: "Legacy Workbench selection cannot expose declarative Release state.",
|
|
2098
2254
|
});
|
|
2099
2255
|
}
|
|
2100
2256
|
})
|
|
@@ -2118,7 +2274,7 @@ exports.DeclarativeNavigationImportResultSchema = zod_1.z
|
|
|
2118
2274
|
revisionRef: declarative_control_1.RevisionRefSchema,
|
|
2119
2275
|
provenance: zod_1.z
|
|
2120
2276
|
.object({
|
|
2121
|
-
sourceKey: zod_1.z.literal(
|
|
2277
|
+
sourceKey: zod_1.z.literal("server.ui.menus"),
|
|
2122
2278
|
sourceRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
2123
2279
|
sourceContentHash: common_1.Sha256Schema,
|
|
2124
2280
|
})
|
|
@@ -2160,14 +2316,14 @@ const DeclarativeRuntimeRouteParametersSchema = zod_1.z
|
|
|
2160
2316
|
const keys = Object.keys(parameters);
|
|
2161
2317
|
if (keys.length > 32)
|
|
2162
2318
|
context.addIssue({
|
|
2163
|
-
code:
|
|
2319
|
+
code: "custom",
|
|
2164
2320
|
path: [],
|
|
2165
|
-
message:
|
|
2321
|
+
message: "A resolved route cannot expose more than 32 parameters.",
|
|
2166
2322
|
});
|
|
2167
2323
|
});
|
|
2168
2324
|
const DeclarativeLegacyRouteOwnerSchema = zod_1.z
|
|
2169
2325
|
.object({
|
|
2170
|
-
authority: zod_1.z.literal(
|
|
2326
|
+
authority: zod_1.z.literal("legacy"),
|
|
2171
2327
|
legacyAdapterRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
2172
2328
|
generation: zod_1.z.number().int().positive(),
|
|
2173
2329
|
etag: zod_1.z.string().trim().min(1),
|
|
@@ -2175,8 +2331,8 @@ const DeclarativeLegacyRouteOwnerSchema = zod_1.z
|
|
|
2175
2331
|
.strict();
|
|
2176
2332
|
const DeclarativeReleaseRouteOwnerSchema = zod_1.z
|
|
2177
2333
|
.object({
|
|
2178
|
-
authority: zod_1.z.literal(
|
|
2179
|
-
resourceKind: zod_1.z.enum([
|
|
2334
|
+
authority: zod_1.z.literal("declarative"),
|
|
2335
|
+
resourceKind: zod_1.z.enum(["page", "workbench"]),
|
|
2180
2336
|
releaseSlotId: common_1.ContractIdentifierSchema,
|
|
2181
2337
|
activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
|
|
2182
2338
|
generation: zod_1.z.number().int().positive(),
|
|
@@ -2186,9 +2342,12 @@ const DeclarativeReleaseRouteOwnerSchema = zod_1.z
|
|
|
2186
2342
|
exports.DeclarativeRuntimeRouteOwnerSchema = zod_1.z
|
|
2187
2343
|
.object({
|
|
2188
2344
|
surface: declarative_control_1.ProductSurfaceSchema,
|
|
2189
|
-
normalizedPath: zod_1.z.string().trim().startsWith(
|
|
2345
|
+
normalizedPath: zod_1.z.string().trim().startsWith("/").max(2048),
|
|
2190
2346
|
routeParameters: DeclarativeRuntimeRouteParametersSchema,
|
|
2191
|
-
owner: zod_1.z.discriminatedUnion(
|
|
2347
|
+
owner: zod_1.z.discriminatedUnion("authority", [
|
|
2348
|
+
DeclarativeLegacyRouteOwnerSchema,
|
|
2349
|
+
DeclarativeReleaseRouteOwnerSchema,
|
|
2350
|
+
]),
|
|
2192
2351
|
contentHash: common_1.Sha256Schema,
|
|
2193
2352
|
})
|
|
2194
2353
|
.strict();
|