@inf-monkeys-tech/monkeys 1.1.52 → 1.1.54
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/action-program-http.d.ts +202 -0
- package/lib/contracts/action-program-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control-http.d.ts +44345 -12496
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control-http.js +37 -4
- package/lib/contracts/declarative-control-http.js.map +1 -1
- package/lib/contracts/declarative-control.d.ts +1738 -246
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +166 -20
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/declarative-document-import.d.ts +640 -10
- package/lib/contracts/declarative-document-import.d.ts.map +1 -1
- package/lib/contracts/declarative-publication-job.d.ts +3318 -578
- package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
- package/lib/contracts/menu.d.ts +329 -0
- package/lib/contracts/menu.d.ts.map +1 -1
- package/lib/contracts/page-expression.d.ts +1 -0
- package/lib/contracts/page-expression.d.ts.map +1 -1
- package/lib/contracts/page-expression.js +1 -1
- package/lib/contracts/page-expression.js.map +1 -1
- package/lib/contracts/page.d.ts +989 -0
- package/lib/contracts/page.d.ts.map +1 -1
- package/lib/contracts/page.js +24 -1
- package/lib/contracts/page.js.map +1 -1
- package/lib/contracts/semantic.d.ts +329 -0
- package/lib/contracts/semantic.d.ts.map +1 -1
- package/lib/contracts/tenant.d.ts +1645 -0
- package/lib/contracts/tenant.d.ts.map +1 -1
- package/lib/esm/{chunk-EMZG7H6M.mjs → chunk-66A4GGOV.mjs} +2 -2
- package/lib/esm/{chunk-LQ72DLZI.mjs → chunk-DIIMDX7F.mjs} +220 -23
- package/lib/esm/chunk-DIIMDX7F.mjs.map +1 -0
- package/lib/esm/{chunk-E46Y3E7E.mjs → chunk-E6YPJ4DR.mjs} +2 -2
- package/lib/esm/{chunk-TFNKWLY6.mjs → chunk-ITGLKSCE.mjs} +295 -13
- package/lib/esm/chunk-ITGLKSCE.mjs.map +1 -0
- package/lib/esm/{chunk-BNFELJET.mjs → chunk-RMZW3SVL.mjs} +3 -3
- package/lib/esm/{chunk-CB4WTYNQ.mjs → chunk-TROZIHS4.mjs} +2 -2
- package/lib/esm/contracts/index.mjs +28 -4
- package/lib/esm/index.mjs +48 -6
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +21 -3
- package/lib/esm/schemas/index.mjs +3 -3
- package/lib/json-schema/declarative-route-owner-index.schema.json +10 -2
- package/lib/json-schema/navigation-runtime-bundle.schema.json +21 -1
- package/lib/json-schema/navigation.schema.json +21 -1
- package/lib/json-schema/overlay-node.schema.json +2 -1
- package/lib/json-schema/page-definition.schema.json +1739 -3
- package/lib/json-schema/page-release.schema.json +80 -6
- package/lib/json-schema/page-runtime-bundle.schema.json +2453 -372
- package/lib/json-schema/page-runtime-descriptor.schema.json +1739 -3
- package/lib/json-schema/page.schema.json +958 -215
- package/lib/json-schema/product-declaration.schema.json +1736 -0
- package/lib/json-schema/render-node.schema.json +2 -1
- package/lib/json-schema/render-tree.schema.json +2 -1
- package/lib/json-schema/tenant-product-config.schema.json +1736 -0
- package/lib/json-schema/tenant-runtime-config.schema.json +1736 -0
- package/lib/runtime/declarative-control-compiler.d.ts +5 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +105 -12
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/runtime/index.d.ts +2 -0
- package/lib/runtime/index.d.ts.map +1 -1
- package/lib/runtime/index.js +2 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/native-page-composition.d.ts +319 -0
- package/lib/runtime/native-page-composition.d.ts.map +1 -0
- package/lib/runtime/native-page-composition.js +19 -0
- package/lib/runtime/native-page-composition.js.map +1 -0
- package/lib/runtime/page-composition.js +1 -1
- package/lib/runtime/page-composition.js.map +1 -1
- package/lib/runtime/page-expression.d.ts +1 -1
- package/lib/runtime/page-expression.d.ts.map +1 -1
- package/lib/runtime/page-mount.d.ts +26 -0
- package/lib/runtime/page-mount.d.ts.map +1 -0
- package/lib/runtime/page-mount.js +203 -0
- package/lib/runtime/page-mount.js.map +1 -0
- package/lib/runtime/runtime-definition-wire.d.ts +6759 -357
- package/lib/runtime/runtime-definition-wire.d.ts.map +1 -1
- package/lib/schemas/index.d.ts +2544 -349
- package/lib/schemas/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/lib/esm/chunk-LQ72DLZI.mjs.map +0 -1
- package/lib/esm/chunk-TFNKWLY6.mjs.map +0 -1
- /package/lib/esm/{chunk-EMZG7H6M.mjs.map → chunk-66A4GGOV.mjs.map} +0 -0
- /package/lib/esm/{chunk-E46Y3E7E.mjs.map → chunk-E6YPJ4DR.mjs.map} +0 -0
- /package/lib/esm/{chunk-BNFELJET.mjs.map → chunk-RMZW3SVL.mjs.map} +0 -0
- /package/lib/esm/{chunk-CB4WTYNQ.mjs.map → chunk-TROZIHS4.mjs.map} +0 -0
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ManagedFileUriSchema,
|
|
15
15
|
RevisionRefSchema,
|
|
16
16
|
Sha256Schema
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DIIMDX7F.mjs";
|
|
18
18
|
|
|
19
19
|
// src/contracts/agent-data.ts
|
|
20
20
|
import { z } from "zod";
|
|
@@ -573,4 +573,4 @@ export {
|
|
|
573
573
|
PlatformNotificationSnapshotSchema,
|
|
574
574
|
platformNotificationRoutes
|
|
575
575
|
};
|
|
576
|
-
//# sourceMappingURL=chunk-
|
|
576
|
+
//# sourceMappingURL=chunk-E6YPJ4DR.mjs.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PAGE_STREAM_MAX_FRAME_BYTES,
|
|
5
5
|
PageStreamDescriptorSchema,
|
|
6
6
|
PageStreamEventSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TROZIHS4.mjs";
|
|
8
8
|
import {
|
|
9
9
|
AccessPolicySchema,
|
|
10
10
|
ActionProgramDefinitionSchema,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
require_validation,
|
|
116
116
|
require_validation_error,
|
|
117
117
|
resolveThemeTokens
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-DIIMDX7F.mjs";
|
|
119
119
|
import {
|
|
120
120
|
__commonJS,
|
|
121
121
|
__toESM
|
|
@@ -2269,6 +2269,13 @@ var renderTreeDepth = (tree) => {
|
|
|
2269
2269
|
};
|
|
2270
2270
|
var compareLegacyEntityRef = (reference, revision) => reference.kind === revision.kind && reference.id === revision.id && String(reference.version) === String(revision.revision) && reference.ownerRepo === revision.ownerRepo;
|
|
2271
2271
|
var pageDependencies = (page, compilerRevisionRef) => [
|
|
2272
|
+
...page.parametersSchemaRevisionRef ? [{ role: "schema", revisionRef: page.parametersSchemaRevisionRef }] : [],
|
|
2273
|
+
...(page.outputs ?? []).map((output) => ({ role: "schema", revisionRef: output.schemaRevisionRef })),
|
|
2274
|
+
...(page.mounts ?? []).flatMap((mount) => [
|
|
2275
|
+
{ role: "page", revisionRef: mount.targetRevisionRef },
|
|
2276
|
+
{ role: "page-release", revisionRef: mount.targetReleaseRevisionRef },
|
|
2277
|
+
...mount.parametersSchemaRevisionRef ? [{ role: "schema", revisionRef: mount.parametersSchemaRevisionRef }] : []
|
|
2278
|
+
]),
|
|
2272
2279
|
...page.routeClaims.map((claim) => ({
|
|
2273
2280
|
role: "route-space",
|
|
2274
2281
|
revisionRef: claim.routeSpaceRevisionRef
|
|
@@ -2921,16 +2928,103 @@ var resolvePage = (input) => {
|
|
|
2921
2928
|
children.forEach((child) => visitNode(child, node.id));
|
|
2922
2929
|
};
|
|
2923
2930
|
visitNode(page.body);
|
|
2931
|
+
const parametersSchemaRevisionRef = page.parametersSchema ? stateSchemaById.get(page.parametersSchema) : void 0;
|
|
2932
|
+
if (page.parametersSchema && !parametersSchemaRevisionRef)
|
|
2933
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", "parametersSchema", "Page inputs require an exact registered Schema.");
|
|
2934
|
+
const outputs = page.outputs?.map((output) => {
|
|
2935
|
+
const node = nodesById.get(output.nodeId);
|
|
2936
|
+
const registration = capabilityRegistrations.find((candidate) => candidate.revisionRef.id === node?.component);
|
|
2937
|
+
const port = registration?.outputPorts.find((candidate) => candidate.name === output.port);
|
|
2938
|
+
if (!port) throw new DeclarativeControlCompilationError("PORT_TYPE_MISMATCH", `outputs.${output.name}`, "Page output must reference a registered component output port.");
|
|
2939
|
+
const action = actionBindings.find((binding) => binding.source.capabilityInstanceId === output.nodeId && binding.source.port === output.port);
|
|
2940
|
+
const program = programBindings.find((binding) => binding.source.capabilityInstanceId === output.nodeId && binding.source.port === output.port);
|
|
2941
|
+
const schemaRevisionRef = output.phase === "success" ? action?.resultSchemaRevisionRef ?? program?.definition.resultSchemaRevisionRef : port.schemaRevisionRef;
|
|
2942
|
+
if (!schemaRevisionRef) throw new DeclarativeControlCompilationError("PORT_TYPE_MISMATCH", `outputs.${output.name}`, "A success output requires an Action or Program on the exported port.");
|
|
2943
|
+
return { ...output, capabilityInstanceId: output.nodeId, schemaRevisionRef };
|
|
2944
|
+
});
|
|
2945
|
+
const mounts = page.mounts?.map((mount) => {
|
|
2946
|
+
const matches = (input.pageMountRegistry ?? []).filter((candidate) => candidate.bundle.pageId === mount.target.id);
|
|
2947
|
+
if (matches.length !== 1) throw new DeclarativeControlCompilationError("PAGE_ENTRY_TARGET_UNRELEASED", `mounts.${mount.mountId}`, "Page mount requires one exact published child definition.");
|
|
2948
|
+
const child = PageRuntimeBundleSchema.parse(matches[0].bundle);
|
|
2949
|
+
if (child.schemaVersion !== 2 || child.usage === "route" || child.surface !== page.surface)
|
|
2950
|
+
throw new DeclarativeControlCompilationError("PAGE_ENTRY_TARGET_UNRELEASED", `mounts.${mount.mountId}`, "The target does not permit embedding on this surface.");
|
|
2951
|
+
if (mount.route && page.stateRetention !== "mounted-while-child-active")
|
|
2952
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", `mounts.${mount.mountId}`, "A routed child requires an explicit parent retention policy.");
|
|
2953
|
+
const urlInputs = /* @__PURE__ */ new Set([...Object.values(mount.route?.pathParameters ?? {}), ...Object.values(mount.route?.query ?? {}).map((codec) => codec.parameter)]);
|
|
2954
|
+
if ((mount.consumeStateIds ?? []).some((id) => !stateDefinitions.some((state) => state.stateId === id && state.persistence === "none")))
|
|
2955
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.consumeStateIds`, "One-shot mount activation may consume only declared transient state.");
|
|
2956
|
+
if ([...urlInputs].some((name) => ["constant", "identity"].includes(mount.inputs[name]?.kind)))
|
|
2957
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", `mounts.${mount.mountId}.inputs`, "Location inputs cannot override constant or identity bindings.");
|
|
2958
|
+
const schema = child.parametersSchemaRevisionRef ? schemaRegistrations.find((candidate) => sameRevisionRef(candidate.revisionRef, child.parametersSchemaRevisionRef))?.definition.document : void 0;
|
|
2959
|
+
if (child.parametersSchemaRevisionRef && !schema)
|
|
2960
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}`, "Child input schema must be registered exactly.");
|
|
2961
|
+
const properties = schema?.properties;
|
|
2962
|
+
const required = schema?.required;
|
|
2963
|
+
if ([...Object.keys(mount.inputs), ...urlInputs].some((name) => !properties?.[name]))
|
|
2964
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.inputs`, "Mount maps an undeclared child input.");
|
|
2965
|
+
if (mount.instanceKey?.some((name) => !properties?.[name]))
|
|
2966
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.instanceKey`, "Instance identity must use declared child inputs.");
|
|
2967
|
+
for (const name of required ?? []) {
|
|
2968
|
+
const source = mount.inputs[name];
|
|
2969
|
+
if (!source && !urlInputs.has(name) && properties?.[name]?.default === void 0)
|
|
2970
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.inputs.${name}`, "Required child input is not mapped.");
|
|
2971
|
+
if (mount.route && source?.kind === "page-state" && !urlInputs.has(name) && properties?.[name]?.default === void 0)
|
|
2972
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.inputs.${name}`, "A deep link cannot depend on transient parent state.");
|
|
2973
|
+
}
|
|
2974
|
+
for (const source of Object.values(mount.inputs)) {
|
|
2975
|
+
if (!["constant", "page-state", "page-parameter", "route-parameter", "query-parameter", "identity"].includes(source.kind))
|
|
2976
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.inputs`, "Unsupported Page mount input source.");
|
|
2977
|
+
if (source.kind === "page-state" && !stateDefinitions.some((state) => state.stateId === source.stateId))
|
|
2978
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.inputs`, "Unknown parent state.");
|
|
2979
|
+
}
|
|
2980
|
+
let count = 0;
|
|
2981
|
+
const visit = (id, children, ancestors) => {
|
|
2982
|
+
if (++count > 32 || ancestors.length > 8 || ancestors.includes(id))
|
|
2983
|
+
throw new DeclarativeControlCompilationError("PAGE_ENTRY_TARGET_UNRELEASED", `mounts.${mount.mountId}`, "Page mount graph is cyclic or exceeds its budget.");
|
|
2984
|
+
for (const nested of children) {
|
|
2985
|
+
const target = (input.pageMountRegistry ?? []).find((candidate) => sameRevisionRef(candidate.bundle.pageRevisionRef, nested.targetRevisionRef));
|
|
2986
|
+
if (!target) throw new DeclarativeControlCompilationError("DEPENDENCY_MISSING", `mounts.${mount.mountId}`, "A nested Page snapshot is missing.");
|
|
2987
|
+
visit(target.bundle.pageId, target.bundle.mounts ?? [], [...ancestors, id]);
|
|
2988
|
+
}
|
|
2989
|
+
};
|
|
2990
|
+
visit(child.pageId, child.mounts ?? [], [page.pageId]);
|
|
2991
|
+
const slot = nodesById.get(mount.slot);
|
|
2992
|
+
if (!slot) throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", `mounts.${mount.mountId}.slot`, "Mount outlet must identify a declared parent node.");
|
|
2993
|
+
for (const [event, handler] of Object.entries(mount.on)) {
|
|
2994
|
+
if (event !== "close" && !child.outputs?.some((output) => output.name === event))
|
|
2995
|
+
throw new DeclarativeControlCompilationError("PORT_TYPE_MISMATCH", `mounts.${mount.mountId}.on.${event}`, "Unknown child output event.");
|
|
2996
|
+
if (handler.kind === "state" && !stateDefinitions.some((state) => state.stateId === handler.stateId))
|
|
2997
|
+
throw new DeclarativeControlCompilationError("SCHEMA_DEFINITION_MISMATCH", `mounts.${mount.mountId}.on.${event}`, "Unknown parent state.");
|
|
2998
|
+
if (handler.kind === "refresh" && handler.bindingIds.some((id) => !queryBindings.some((binding) => binding.bindingId === id)))
|
|
2999
|
+
throw new DeclarativeControlCompilationError("QUERY_DEFINITION_MISMATCH", `mounts.${mount.mountId}.on.${event}`, "Unknown parent query binding.");
|
|
3000
|
+
}
|
|
3001
|
+
return {
|
|
3002
|
+
...mount,
|
|
3003
|
+
targetRevisionRef: child.pageRevisionRef,
|
|
3004
|
+
targetReleaseRevisionRef: child.releaseRevisionRef,
|
|
3005
|
+
targetAccessPolicy: child.pageAccessPolicy,
|
|
3006
|
+
...child.parametersSchemaRevisionRef ? { parametersSchemaRevisionRef: child.parametersSchemaRevisionRef } : {},
|
|
3007
|
+
outputs: child.outputs ?? []
|
|
3008
|
+
};
|
|
3009
|
+
});
|
|
2924
3010
|
const resolved = {
|
|
2925
3011
|
contract: "Page",
|
|
2926
|
-
schemaVersion:
|
|
3012
|
+
schemaVersion: page.schemaVersion,
|
|
3013
|
+
...page.schemaVersion === 2 ? {
|
|
3014
|
+
usage: page.usage,
|
|
3015
|
+
...parametersSchemaRevisionRef ? { parametersSchemaRevisionRef } : {},
|
|
3016
|
+
...page.parameterBindings ? { parameterBindings: page.parameterBindings } : {},
|
|
3017
|
+
...outputs ? { outputs } : {},
|
|
3018
|
+
...mounts ? { mounts } : {},
|
|
3019
|
+
...page.stateRetention ? { stateRetention: page.stateRetention } : {}
|
|
3020
|
+
} : {},
|
|
2927
3021
|
pageId: page.pageId,
|
|
2928
3022
|
tenantScope: page.tenantScope,
|
|
2929
3023
|
identity: page.identity,
|
|
2930
3024
|
supportedSurfaces: [page.surface],
|
|
2931
3025
|
lifecycle: page.lifecycle,
|
|
2932
3026
|
...page.routeStatePresentations ? { routeStatePresentations: page.routeStatePresentations } : {},
|
|
2933
|
-
routeClaims: [
|
|
3027
|
+
routeClaims: page.usage === "embedded" ? [] : [
|
|
2934
3028
|
{
|
|
2935
3029
|
kind: "canonical",
|
|
2936
3030
|
surface: page.surface,
|
|
@@ -3015,6 +3109,8 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
3015
3109
|
};
|
|
3016
3110
|
const pageRevisionRef = RevisionRefSchema.parse(input.pageRevisionRef);
|
|
3017
3111
|
const release = PageReleaseSchema.parse(input.release);
|
|
3112
|
+
if (release.schemaVersion !== parsedPage.schemaVersion || release.target.mode === "embedded" !== (parsedPage.usage === "embedded"))
|
|
3113
|
+
throw new DeclarativeControlCompilationError("ROUTE_SPACE_MISMATCH", "release.target", "Page protocol and publication target disagree.");
|
|
3018
3114
|
const releaseRevisionRef = RevisionRefSchema.parse(input.releaseRevisionRef);
|
|
3019
3115
|
const compilerRevisionRef = RevisionRefSchema.parse(
|
|
3020
3116
|
input.compilerRevisionRef
|
|
@@ -3058,7 +3154,9 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
3058
3154
|
const target = (input.targetRegistry ?? []).find(
|
|
3059
3155
|
(candidate) => page.entryTransitions.some((entry) => sameStableRef(entry.targetRef, candidate.stableTargetRef)) && [candidate.targetRevisionRef, candidate.releaseRevisionRef].some((ref2) => ref2 && sameRevisionRef(ref2, reference))
|
|
3060
3156
|
);
|
|
3061
|
-
|
|
3157
|
+
const mount = page.mounts?.find((candidate) => [candidate.targetRevisionRef, candidate.targetReleaseRevisionRef, candidate.parametersSchemaRevisionRef].some((ref2) => ref2 && sameRevisionRef(ref2, reference)));
|
|
3158
|
+
const mountedShared = mount && [mount.targetRevisionRef, mount.targetReleaseRevisionRef, mount.parametersSchemaRevisionRef].filter(Boolean).every((ref2) => ref2.ownerRepo === "monkeys-server" && ref2.tenantScope?.tenantRef.id === "0" && ref2.tenantScope?.teamRef?.id === "0");
|
|
3159
|
+
if (release.target.surface !== "studio" || reference.visibility !== "tenant" || reference.ownerRepo !== "monkeys-server" || !["page", "page-release", ...mountedShared ? ["schema"] : []].includes(reference.kind) || reference.tenantScope?.tenantRef.id !== "0" || reference.tenantScope?.teamRef?.id !== "0" || !mountedShared && (!target || target.surface !== "studio" || target.targetRevisionRef.kind !== "page" || scopeKey(target.targetRevisionRef.tenantScope) !== scopeKey(reference.tenantScope) || target.releaseRevisionRef && (target.releaseRevisionRef.kind !== "page-release" || !target.releaseRevisionRef.tenantScope || scopeKey(target.releaseRevisionRef.tenantScope) !== scopeKey(reference.tenantScope)))) throw new DeclarativeControlCompilationError(
|
|
3062
3160
|
"CROSS_TENANT_REFERENCE",
|
|
3063
3161
|
`verifiedSharedPageReferences[${index}]`,
|
|
3064
3162
|
"Shared Studio Page references must pin an authenticated catalog route target in the shared scope."
|
|
@@ -3533,7 +3631,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
3533
3631
|
}
|
|
3534
3632
|
}
|
|
3535
3633
|
);
|
|
3536
|
-
const routeClaims = compileRouteClaims({
|
|
3634
|
+
const routeClaims = page.usage === "embedded" ? [] : compileRouteClaims({
|
|
3537
3635
|
claims: page.routeClaims,
|
|
3538
3636
|
routeSpaces: input.routeSpaces,
|
|
3539
3637
|
surface: release.target.surface,
|
|
@@ -3542,10 +3640,10 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
3542
3640
|
const releaseRoute = routeClaims.find(
|
|
3543
3641
|
(claim) => claim.kind === "canonical" && claim.normalizedPath === release.target.normalizedPath
|
|
3544
3642
|
);
|
|
3545
|
-
if (!releaseRoute || !sameRevisionRef(
|
|
3643
|
+
if (page.usage !== "embedded" && (!releaseRoute || !sameRevisionRef(
|
|
3546
3644
|
releaseRoute.routeSpaceRevisionRef,
|
|
3547
3645
|
release.target.routeSpaceRevisionRef
|
|
3548
|
-
)) {
|
|
3646
|
+
))) {
|
|
3549
3647
|
throw new DeclarativeControlCompilationError(
|
|
3550
3648
|
"ROUTE_SPACE_MISMATCH",
|
|
3551
3649
|
"release.target",
|
|
@@ -3659,7 +3757,15 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
3659
3757
|
});
|
|
3660
3758
|
const unsigned = {
|
|
3661
3759
|
contract: "PageRuntimeBundle",
|
|
3662
|
-
schemaVersion:
|
|
3760
|
+
schemaVersion: page.schemaVersion,
|
|
3761
|
+
...page.schemaVersion === 2 ? {
|
|
3762
|
+
usage: page.usage,
|
|
3763
|
+
...page.parametersSchemaRevisionRef ? { parametersSchemaRevisionRef: page.parametersSchemaRevisionRef } : {},
|
|
3764
|
+
...page.parameterBindings ? { parameterBindings: page.parameterBindings } : {},
|
|
3765
|
+
...page.outputs ? { outputs: page.outputs } : {},
|
|
3766
|
+
...page.mounts ? { mounts: page.mounts } : {},
|
|
3767
|
+
...page.stateRetention ? { stateRetention: page.stateRetention } : {}
|
|
3768
|
+
} : {},
|
|
3663
3769
|
tenantScope: scope,
|
|
3664
3770
|
releaseRevisionRef,
|
|
3665
3771
|
compilerRevisionRef,
|
|
@@ -7313,7 +7419,7 @@ function compilePageComposition(input) {
|
|
|
7313
7419
|
ids.add(value.id);
|
|
7314
7420
|
return { ...value, ...value.children ? { children: value.children.map((child) => expand(child, depth + 1)) } : {} };
|
|
7315
7421
|
};
|
|
7316
|
-
return PageSchema.parse({ ...source.page, contract: "Page", schemaVersion: 1, body: expand(source.body, 0) });
|
|
7422
|
+
return PageSchema.parse({ ...source.page, contract: "Page", schemaVersion: source.page.schemaVersion ?? 1, body: expand(source.body, 0) });
|
|
7317
7423
|
}
|
|
7318
7424
|
|
|
7319
7425
|
// src/runtime/file-reference.ts
|
|
@@ -7361,6 +7467,173 @@ function resolveFileResourceReference(reference, manifest, documentPath = manife
|
|
|
7361
7467
|
return manifest.resources.find((resource) => resource.path === parts.join("/"))?.uri;
|
|
7362
7468
|
}
|
|
7363
7469
|
|
|
7470
|
+
// src/runtime/page-mount.ts
|
|
7471
|
+
var import__3 = __toESM(require__());
|
|
7472
|
+
var fail3 = (code, message) => {
|
|
7473
|
+
throw Object.assign(new TypeError(message), { code });
|
|
7474
|
+
};
|
|
7475
|
+
var scalar = (value) => {
|
|
7476
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean")
|
|
7477
|
+
return fail3("PAGE_LOCATION_PARAMETER_INVALID", "A URL parameter must be a scalar.");
|
|
7478
|
+
return String(value);
|
|
7479
|
+
};
|
|
7480
|
+
function createPageParameterValidator(schema) {
|
|
7481
|
+
if (schema.type !== "object") fail3("PAGE_PARAMETER_SCHEMA_INVALID", "Page input schema must describe an object.");
|
|
7482
|
+
const validate = new import__3.default({ strict: false, allErrors: true, useDefaults: true, coerceTypes: false }).compile(schema);
|
|
7483
|
+
return (input) => {
|
|
7484
|
+
assertPageValueBudget(input);
|
|
7485
|
+
const value = structuredClone(input);
|
|
7486
|
+
if (!validate(value)) fail3("PAGE_PARAMETERS_INVALID", "Page inputs do not satisfy the published schema.");
|
|
7487
|
+
return value;
|
|
7488
|
+
};
|
|
7489
|
+
}
|
|
7490
|
+
function compilePageMountRoute(parent, mount) {
|
|
7491
|
+
if (!mount.route) return fail3("PAGE_MOUNT_ROUTE_MISSING", "The mount has no route.");
|
|
7492
|
+
const names = Object.keys(mount.route.pathParameters);
|
|
7493
|
+
if (names.some((name) => parent.matcher.parameters.some((parameter) => parameter.name === name)))
|
|
7494
|
+
fail3("PAGE_MOUNT_ROUTE_CONFLICT", "Parent and child path parameter names must be distinct.");
|
|
7495
|
+
const normalizedPath = `${parent.normalizedPath.replace(/\/+$/, "")}/${mount.route.path}`;
|
|
7496
|
+
return {
|
|
7497
|
+
...parent,
|
|
7498
|
+
kind: "canonical",
|
|
7499
|
+
pathTemplate: normalizedPath,
|
|
7500
|
+
normalizedPath,
|
|
7501
|
+
matcher: { ...parent.matcher, parameters: [...parent.matcher.parameters, ...names.map((name) => ({ name, type: "identifier", required: true }))] }
|
|
7502
|
+
};
|
|
7503
|
+
}
|
|
7504
|
+
function matchPageMountLocation(page, pathname, search) {
|
|
7505
|
+
const matches = [];
|
|
7506
|
+
for (const parent of page.routeClaims.filter((claim) => claim.kind === "canonical")) {
|
|
7507
|
+
for (const mount of page.mounts ?? []) {
|
|
7508
|
+
if (!mount.route) continue;
|
|
7509
|
+
const claim = compilePageMountRoute(parent, mount);
|
|
7510
|
+
const match = matchCompiledRouteClaim(claim, pathname);
|
|
7511
|
+
if (!match.matched) continue;
|
|
7512
|
+
const parameters = {};
|
|
7513
|
+
for (const [name, parameter] of Object.entries(mount.route.pathParameters)) parameters[parameter] = match.parameters[name];
|
|
7514
|
+
const query = new URLSearchParams(search);
|
|
7515
|
+
for (const [key, codec] of Object.entries(mount.route.query)) {
|
|
7516
|
+
const values = query.getAll(key);
|
|
7517
|
+
if (!values.length) continue;
|
|
7518
|
+
if (values.length !== 1) fail3("PAGE_LOCATION_PARAMETER_INVALID", `Duplicate query key ${key}.`);
|
|
7519
|
+
const raw = values[0];
|
|
7520
|
+
if (codec.type === "json") {
|
|
7521
|
+
try {
|
|
7522
|
+
const decoded = JSON.parse(raw);
|
|
7523
|
+
assertPageValueBudget(decoded);
|
|
7524
|
+
parameters[codec.parameter] = decoded;
|
|
7525
|
+
} catch {
|
|
7526
|
+
fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid structured input ${key}.`);
|
|
7527
|
+
}
|
|
7528
|
+
} else if (codec.type === "integer") {
|
|
7529
|
+
if (!/^-?(0|[1-9][0-9]*)$/.test(raw) || !Number.isSafeInteger(Number(raw))) fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid integer ${key}.`);
|
|
7530
|
+
parameters[codec.parameter] = Number(raw);
|
|
7531
|
+
} else if (codec.type === "boolean") {
|
|
7532
|
+
if (raw !== "true" && raw !== "false") fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid boolean ${key}.`);
|
|
7533
|
+
parameters[codec.parameter] = raw === "true";
|
|
7534
|
+
} else parameters[codec.parameter] = raw;
|
|
7535
|
+
}
|
|
7536
|
+
const size = parent.normalizedPath.split("/").filter(Boolean).length;
|
|
7537
|
+
const parentPathname = `/${pathname.split("/").filter(Boolean).slice(0, size).join("/")}`;
|
|
7538
|
+
const parentParameters = Object.fromEntries(parent.matcher.parameters.map((parameter) => [parameter.name, match.parameters[parameter.name]]));
|
|
7539
|
+
matches.push({ mount, parentPathname, parameters, parentParameters });
|
|
7540
|
+
}
|
|
7541
|
+
}
|
|
7542
|
+
if (matches.length > 1) fail3("PAGE_MOUNT_ROUTE_CONFLICT", "More than one child mount owns this location.");
|
|
7543
|
+
return matches[0];
|
|
7544
|
+
}
|
|
7545
|
+
function resolvePageInputBindings(inputs, context) {
|
|
7546
|
+
const result = {};
|
|
7547
|
+
const query = new URLSearchParams(context.search);
|
|
7548
|
+
for (const [name, source] of Object.entries(inputs)) {
|
|
7549
|
+
let value;
|
|
7550
|
+
if (source.kind === "constant") value = source.value;
|
|
7551
|
+
else if (source.kind === "page-parameter") value = context.parameters?.[source.name];
|
|
7552
|
+
else if (source.kind === "page-state") value = context.state?.[source.stateId];
|
|
7553
|
+
else if (source.kind === "route-parameter") value = context.pathParameters?.[source.name];
|
|
7554
|
+
else if (source.kind === "query-parameter") value = query.get(source.name) ?? void 0;
|
|
7555
|
+
else if (source.kind === "identity") value = context.identity?.[source.name];
|
|
7556
|
+
else fail3("PAGE_MOUNT_INPUT_SOURCE_INVALID", "Mount inputs require an explicit Page, state, location, identity or constant source.");
|
|
7557
|
+
if (value !== void 0) result[name] = value;
|
|
7558
|
+
}
|
|
7559
|
+
return result;
|
|
7560
|
+
}
|
|
7561
|
+
function resolvePageMountInputs(mount, context, locationInputs = {}) {
|
|
7562
|
+
const result = resolvePageInputBindings(mount.inputs, context);
|
|
7563
|
+
const owned = /* @__PURE__ */ new Set([...Object.values(mount.route?.pathParameters ?? {}), ...Object.values(mount.route?.query ?? {}).map((codec) => codec.parameter)]);
|
|
7564
|
+
for (const [name, value] of Object.entries(locationInputs)) {
|
|
7565
|
+
if (!owned.has(name)) fail3("PAGE_MOUNT_INPUT_SOURCE_INVALID", "Unexpected location input.");
|
|
7566
|
+
result[name] = value;
|
|
7567
|
+
}
|
|
7568
|
+
return result;
|
|
7569
|
+
}
|
|
7570
|
+
function resolvePageRootParameters(page, schema, context) {
|
|
7571
|
+
const result = resolvePageInputBindings(page.parameterBindings ?? {}, context);
|
|
7572
|
+
const properties = schema.properties;
|
|
7573
|
+
for (const [name, source] of Object.entries(page.parameterBindings ?? {})) {
|
|
7574
|
+
if (!["route-parameter", "query-parameter"].includes(source.kind) || result[name] === void 0) continue;
|
|
7575
|
+
const raw = String(result[name]);
|
|
7576
|
+
const codec = "codec" in source ? source.codec : void 0;
|
|
7577
|
+
if (codec === "json" || codec === "page-state") {
|
|
7578
|
+
if (codec === "page-state" && !raw.startsWith("json:")) continue;
|
|
7579
|
+
try {
|
|
7580
|
+
result[name] = JSON.parse(raw.startsWith("json:") ? raw.slice(5) : raw);
|
|
7581
|
+
} catch {
|
|
7582
|
+
fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid structured input ${name}.`);
|
|
7583
|
+
}
|
|
7584
|
+
} else if (codec === "integer" || !codec && properties?.[name]?.type === "integer") {
|
|
7585
|
+
if (!/^-?(0|[1-9][0-9]*)$/.test(raw) || !Number.isSafeInteger(Number(raw))) fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid integer ${name}.`);
|
|
7586
|
+
result[name] = Number(raw);
|
|
7587
|
+
} else if (codec === "boolean" || !codec && properties?.[name]?.type === "boolean") {
|
|
7588
|
+
if (raw !== "true" && raw !== "false") fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid boolean ${name}.`);
|
|
7589
|
+
result[name] = raw === "true";
|
|
7590
|
+
}
|
|
7591
|
+
}
|
|
7592
|
+
return createPageParameterValidator(schema)(result);
|
|
7593
|
+
}
|
|
7594
|
+
function buildPageMountHref(parentHref, mount, input) {
|
|
7595
|
+
if (!mount.route) return fail3("PAGE_MOUNT_ROUTE_MISSING", "The mount has no route.");
|
|
7596
|
+
if (!parentHref.startsWith("/") || parentHref.startsWith("//") || parentHref.includes("\\")) fail3("PAGE_LOCATION_INVALID", "Expected an application-relative parent URL.");
|
|
7597
|
+
const parent = new URL(parentHref, "https://page.invalid");
|
|
7598
|
+
const path = mount.route.path.replace(/:([A-Za-z][A-Za-z0-9_-]*)/g, (_match, name) => encodeURIComponent(scalar(input[mount.route.pathParameters[name]])));
|
|
7599
|
+
for (const [key, codec] of Object.entries(mount.route.query)) {
|
|
7600
|
+
const value = input[codec.parameter];
|
|
7601
|
+
if (value === void 0 || value === null) parent.searchParams.delete(key);
|
|
7602
|
+
else {
|
|
7603
|
+
if (codec.type === "integer" && (typeof value !== "number" || !Number.isSafeInteger(value))) fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid integer ${key}.`);
|
|
7604
|
+
if (codec.type === "boolean" && typeof value !== "boolean") fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid boolean ${key}.`);
|
|
7605
|
+
if (codec.type === "string" && typeof value !== "string") fail3("PAGE_LOCATION_PARAMETER_INVALID", `Invalid string ${key}.`);
|
|
7606
|
+
if (codec.type === "json") assertPageValueBudget(value);
|
|
7607
|
+
parent.searchParams.set(key, codec.type === "json" ? JSON.stringify(value) : scalar(value));
|
|
7608
|
+
}
|
|
7609
|
+
}
|
|
7610
|
+
if (parent.search.length > 8192 || `${parent.pathname.replace(/\/+$/, "")}/${path}`.length > 2048) fail3("PAGE_LOCATION_PARAMETER_INVALID", "Page location exceeds its budget.");
|
|
7611
|
+
return `${parent.pathname.replace(/\/+$/, "")}/${path}${parent.search}`;
|
|
7612
|
+
}
|
|
7613
|
+
function pageMountParentHref(parentPathname, search, mount) {
|
|
7614
|
+
const query = new URLSearchParams(search);
|
|
7615
|
+
Object.keys(mount.route?.query ?? {}).forEach((key) => query.delete(key));
|
|
7616
|
+
for (const key of [...query.keys()]) if (key.startsWith(`${mount.mountId}.state.`)) query.delete(key);
|
|
7617
|
+
return `${parentPathname}${query.size ? `?${query}` : ""}`;
|
|
7618
|
+
}
|
|
7619
|
+
|
|
7620
|
+
// src/runtime/native-page-composition.ts
|
|
7621
|
+
function nativePageMountPlan(page, catalogRevision) {
|
|
7622
|
+
if (!page.composition || catalogRevision.kind !== "legacy-route-adapter" || catalogRevision.id !== page.pageId)
|
|
7623
|
+
throw new TypeError("The native Page must have a composition bound to its exact catalog revision.");
|
|
7624
|
+
const path = page.routePath.replace(/^\/(?:\$|:)teamId(?=\/|$)/, "").replace(/\$([A-Za-z][A-Za-z0-9_]*)/g, ":$1").replace(/\/+$/, "") || "/";
|
|
7625
|
+
const parameters = [...path.matchAll(/:([A-Za-z][A-Za-z0-9_-]*)/g)].map((match) => ({ name: match[1], type: "identifier", required: true }));
|
|
7626
|
+
const claim = CompiledRouteClaimSchema.parse({
|
|
7627
|
+
kind: "canonical",
|
|
7628
|
+
surface: "studio",
|
|
7629
|
+
pathTemplate: path,
|
|
7630
|
+
normalizedPath: path,
|
|
7631
|
+
routeSpaceRevisionRef: { ...catalogRevision, kind: "route-space", id: `${page.pageId}.native-route-space` },
|
|
7632
|
+
matcher: { surface: "studio", caseSensitive: true, trailingSlash: "remove", parameters }
|
|
7633
|
+
});
|
|
7634
|
+
return { routeClaims: [claim], mounts: page.composition.mounts };
|
|
7635
|
+
}
|
|
7636
|
+
|
|
7364
7637
|
export {
|
|
7365
7638
|
extractOpenApiCapabilityManifests,
|
|
7366
7639
|
createCapabilityRegistrySource,
|
|
@@ -7491,6 +7764,15 @@ export {
|
|
|
7491
7764
|
compilePageComposition,
|
|
7492
7765
|
parseManagedFileReference,
|
|
7493
7766
|
collectManagedFileReferences,
|
|
7494
|
-
resolveFileResourceReference
|
|
7495
|
-
|
|
7496
|
-
|
|
7767
|
+
resolveFileResourceReference,
|
|
7768
|
+
createPageParameterValidator,
|
|
7769
|
+
compilePageMountRoute,
|
|
7770
|
+
matchPageMountLocation,
|
|
7771
|
+
resolvePageInputBindings,
|
|
7772
|
+
resolvePageMountInputs,
|
|
7773
|
+
resolvePageRootParameters,
|
|
7774
|
+
buildPageMountHref,
|
|
7775
|
+
pageMountParentHref,
|
|
7776
|
+
nativePageMountPlan
|
|
7777
|
+
};
|
|
7778
|
+
//# sourceMappingURL=chunk-ITGLKSCE.mjs.map
|