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