@inf-monkeys-tech/monkeys 1.0.68 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/contracts/declarative-control-http.d.ts +1681 -369
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control.d.ts +740 -23
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +22 -3
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/esm/contracts/index.mjs +22 -3
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +98 -3
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +97 -3
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +22 -3
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/navigation-release.schema.json +582 -0
- package/lib/json-schema/navigation-runtime-bundle.schema.json +579 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +26 -0
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/runtime/index.d.ts +1 -0
- package/lib/runtime/index.d.ts.map +1 -1
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/menu-compiler.d.ts +19 -1
- package/lib/runtime/menu-compiler.d.ts.map +1 -1
- package/lib/runtime/menu-compiler.js +34 -0
- package/lib/runtime/menu-compiler.js.map +1 -1
- package/lib/runtime/navigation-availability.d.ts +6 -0
- package/lib/runtime/navigation-availability.d.ts.map +1 -0
- package/lib/runtime/navigation-availability.js +17 -0
- package/lib/runtime/navigation-availability.js.map +1 -0
- package/lib/schemas/index.d.ts +240 -1
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +5 -4
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
- package/test/fixtures/navigation-three-roots-topology.json +275 -0
package/lib/esm/index.mjs
CHANGED
|
@@ -9236,6 +9236,12 @@ var ResolvedNavigationTargetSchema = z10.object({
|
|
|
9236
9236
|
targetRevisionRef: RevisionRefSchema,
|
|
9237
9237
|
releaseRevisionRef: RevisionRefSchema.optional()
|
|
9238
9238
|
}).strict();
|
|
9239
|
+
var UnavailableNavigationTargetSchema = z10.object({
|
|
9240
|
+
nodeId: ContractIdentifierSchema,
|
|
9241
|
+
stableTargetRef: StableRefSchema.refine((reference) => reference.kind === "page", "Only missing Pages can be isolated."),
|
|
9242
|
+
reason: z10.literal("page-missing"),
|
|
9243
|
+
accessPolicy: AccessPolicySchema.nullable()
|
|
9244
|
+
}).strict();
|
|
9239
9245
|
var NavigationReleaseSchema = z10.object({
|
|
9240
9246
|
contract: z10.literal("NavigationRelease"),
|
|
9241
9247
|
...ReleaseBaseShape,
|
|
@@ -9245,13 +9251,17 @@ var NavigationReleaseSchema = z10.object({
|
|
|
9245
9251
|
surface: ProductSurfaceSchema,
|
|
9246
9252
|
placement: ContractIdentifierSchema
|
|
9247
9253
|
}).strict(),
|
|
9248
|
-
resolvedTargets: z10.array(ResolvedNavigationTargetSchema)
|
|
9254
|
+
resolvedTargets: z10.array(ResolvedNavigationTargetSchema),
|
|
9255
|
+
unavailableTargets: z10.array(UnavailableNavigationTargetSchema).optional()
|
|
9249
9256
|
}).strict().superRefine((value, context) => {
|
|
9250
9257
|
validateDependencySnapshot(value.dependencySnapshot, context);
|
|
9251
9258
|
validateReleaseExpectedHead(value, "navigation-release", context);
|
|
9252
9259
|
if (value.navigationRevisionRef.kind !== "navigation") context.addIssue({ code: "custom", path: ["navigationRevisionRef", "kind"], message: "Expected a navigation revision." });
|
|
9253
9260
|
if (value.target.environmentRef.kind !== "environment") context.addIssue({ code: "custom", path: ["target", "environmentRef", "kind"], message: "Navigation release target requires an environment reference." });
|
|
9254
9261
|
if (uniqueArray(value.resolvedTargets, (target) => target.nodeId)) context.addIssue({ code: "custom", path: ["resolvedTargets"], message: "Resolved Navigation node IDs must be unique." });
|
|
9262
|
+
if (uniqueArray([...value.resolvedTargets, ...value.unavailableTargets ?? []], (target) => target.nodeId)) {
|
|
9263
|
+
context.addIssue({ code: "custom", path: ["unavailableTargets"], message: "Navigation target resolutions must have unique node IDs." });
|
|
9264
|
+
}
|
|
9255
9265
|
});
|
|
9256
9266
|
var RuntimeDiagnosticSchema = z10.object({
|
|
9257
9267
|
code: ContractIdentifierSchema,
|
|
@@ -9339,7 +9349,8 @@ var CompiledNavigationDomainCommandTargetSchema = ResolvedNavigationTargetSchema
|
|
|
9339
9349
|
var CompiledNavigationResolvedTargetSchema = z10.discriminatedUnion("kind", [
|
|
9340
9350
|
CompiledNavigationTargetSchema,
|
|
9341
9351
|
CompiledNavigationRegisteredMenuActionTargetSchema,
|
|
9342
|
-
CompiledNavigationDomainCommandTargetSchema
|
|
9352
|
+
CompiledNavigationDomainCommandTargetSchema,
|
|
9353
|
+
UnavailableNavigationTargetSchema.omit({ reason: true }).extend({ kind: z10.literal("unavailable") }).strict()
|
|
9343
9354
|
]);
|
|
9344
9355
|
var CompiledNavigationGroupNodeSchema = NavigationGroupNodeSchema.extend({
|
|
9345
9356
|
ancestorAccessPolicies: z10.array(AccessPolicySchema)
|
|
@@ -9347,7 +9358,14 @@ var CompiledNavigationGroupNodeSchema = NavigationGroupNodeSchema.extend({
|
|
|
9347
9358
|
var CompiledNavigationTargetNodeSchema = NavigationTargetNodeSchema.extend({
|
|
9348
9359
|
ancestorAccessPolicies: z10.array(AccessPolicySchema),
|
|
9349
9360
|
resolvedTarget: CompiledNavigationResolvedTargetSchema
|
|
9350
|
-
}).strict()
|
|
9361
|
+
}).strict().superRefine((node, context) => {
|
|
9362
|
+
if (node.resolvedTarget.nodeId !== node.nodeId || stableRefIdentity(node.resolvedTarget.stableTargetRef) !== stableRefIdentity(node.targetRef)) {
|
|
9363
|
+
context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Resolved target identity must match the source node." });
|
|
9364
|
+
}
|
|
9365
|
+
if (node.resolvedTarget.kind === "unavailable" && (node.disabled !== true || Object.keys(node.parameterMapping).length > 0)) {
|
|
9366
|
+
context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Unavailable targets must be disabled and contain no executable input." });
|
|
9367
|
+
}
|
|
9368
|
+
});
|
|
9351
9369
|
var CompiledNavigationSeparatorNodeSchema = NavigationSeparatorNodeSchema.extend({
|
|
9352
9370
|
ancestorAccessPolicies: z10.array(AccessPolicySchema)
|
|
9353
9371
|
}).strict();
|
|
@@ -16388,7 +16406,14 @@ var compileNavigationRuntimeBundle = (input) => {
|
|
|
16388
16406
|
assertUniqueRegistryKeys(targetRegistry.map((registration) => stableRefKey(registration.stableTargetRef)), "targetRegistry");
|
|
16389
16407
|
const targetsByStableRef = new Map(targetRegistry.map((registration) => [stableRefKey(registration.stableTargetRef), registration]));
|
|
16390
16408
|
const releasedByNodeId = new Map(release.resolvedTargets.map((target) => [target.nodeId, target]));
|
|
16409
|
+
const unavailableByNodeId = new Map((release.unavailableTargets ?? []).map((target) => [target.nodeId, target]));
|
|
16391
16410
|
const nodesById = new Map(navigation.nodes.map((node) => [node.nodeId, node]));
|
|
16411
|
+
for (const target of release.unavailableTargets ?? []) {
|
|
16412
|
+
const node = nodesById.get(target.nodeId);
|
|
16413
|
+
if (node?.kind !== "target" || !sameStableRef(node.targetRef, target.stableTargetRef)) {
|
|
16414
|
+
throw new DeclarativeControlCompilationError("NAV_TARGET_UNRELEASED", "release.unavailableTargets", "An unavailable target must identify its source Page node exactly.");
|
|
16415
|
+
}
|
|
16416
|
+
}
|
|
16392
16417
|
const nodes = orderedNavigationNodes(navigation).map((node, index) => {
|
|
16393
16418
|
const ancestors = [];
|
|
16394
16419
|
let parentId = node.parentNodeId;
|
|
@@ -16403,6 +16428,25 @@ var compileNavigationRuntimeBundle = (input) => {
|
|
|
16403
16428
|
}
|
|
16404
16429
|
const registration = targetsByStableRef.get(stableRefKey(node.targetRef));
|
|
16405
16430
|
const released = releasedByNodeId.get(node.nodeId);
|
|
16431
|
+
const unavailable = unavailableByNodeId.get(node.nodeId);
|
|
16432
|
+
if (!registration && unavailable && node.targetRef.kind === "page" && sameStableRef(unavailable.stableTargetRef, node.targetRef)) {
|
|
16433
|
+
assertTenantCompatible(node.targetRef, scope, `nodes[${index}].targetRef`);
|
|
16434
|
+
if (unavailable.accessPolicy && !accessPolicyChainImplies([...ancestors, node.audience], unavailable.accessPolicy)) {
|
|
16435
|
+
throw new DeclarativeControlCompilationError("AUDIENCE_WIDER_THAN_TARGET", `nodes[${index}].audience`, "Effective Navigation audience is wider than the last verified target audience.");
|
|
16436
|
+
}
|
|
16437
|
+
return {
|
|
16438
|
+
...node,
|
|
16439
|
+
disabled: true,
|
|
16440
|
+
parameterMapping: {},
|
|
16441
|
+
ancestorAccessPolicies: ancestors,
|
|
16442
|
+
resolvedTarget: {
|
|
16443
|
+
kind: "unavailable",
|
|
16444
|
+
nodeId: node.nodeId,
|
|
16445
|
+
stableTargetRef: node.targetRef,
|
|
16446
|
+
accessPolicy: unavailable.accessPolicy
|
|
16447
|
+
}
|
|
16448
|
+
};
|
|
16449
|
+
}
|
|
16406
16450
|
if (!registration || !released || !sameStableRef(registration.stableTargetRef, stableFromRevision(registration.targetRevisionRef)) || !sameStableRef(registration.stableTargetRef, released.stableTargetRef) || !sameRevisionRef(registration.targetRevisionRef, released.targetRevisionRef) || registration.kind === "route" && (Boolean(registration.releaseRevisionRef) !== Boolean(released.releaseRevisionRef) || registration.releaseRevisionRef && released.releaseRevisionRef && !sameRevisionRef(registration.releaseRevisionRef, released.releaseRevisionRef))) {
|
|
16407
16451
|
throw new DeclarativeControlCompilationError("NAV_TARGET_UNRELEASED", `nodes[${index}].targetRef`, "Navigation target is not resolved to the exact active release recorded by NavigationRelease.");
|
|
16408
16452
|
}
|
|
@@ -16532,6 +16576,16 @@ var resolveWorkbenchEntry = (input) => {
|
|
|
16532
16576
|
return { status: "forbidden", workbenchId: "" };
|
|
16533
16577
|
};
|
|
16534
16578
|
|
|
16579
|
+
// src/runtime/navigation-availability.ts
|
|
16580
|
+
var NAVIGATION_UNAVAILABLE_CAPABILITY_HEADER = "x-monkeys-navigation-capabilities";
|
|
16581
|
+
var NAVIGATION_UNAVAILABLE_CAPABILITY = "unavailable-pages-v1";
|
|
16582
|
+
function projectNavigationCompatibility(bundle, supportsUnavailable) {
|
|
16583
|
+
if (supportsUnavailable || !bundle.nodes.some((node) => node.kind === "target" && node.resolvedTarget.kind === "unavailable")) return bundle;
|
|
16584
|
+
const { contentHash: _hash, ...unsigned } = bundle;
|
|
16585
|
+
const nodes = bundle.nodes.filter((node) => node.kind !== "target" || node.resolvedTarget.kind !== "unavailable");
|
|
16586
|
+
return NavigationRuntimeBundleSchema.parse({ ...unsigned, nodes, contentHash: canonicalContentHash({ ...unsigned, nodes }) });
|
|
16587
|
+
}
|
|
16588
|
+
|
|
16535
16589
|
// src/runtime/menu-compiler.ts
|
|
16536
16590
|
var MenuCompilationError = class extends Error {
|
|
16537
16591
|
constructor(code, path, message) {
|
|
@@ -16804,6 +16858,13 @@ var compileMenuRuntimeBundle = (input) => {
|
|
|
16804
16858
|
const contributionProviders = input.contributionProviders.map((registration) => MenuContributionProviderRegistrationSchema.parse(registration));
|
|
16805
16859
|
const inputValidators = input.inputValidators ?? /* @__PURE__ */ new Map();
|
|
16806
16860
|
const knownPermissions = new Set(input.permissionCodes.map((permission) => ContractIdentifierSchema.parse(permission)));
|
|
16861
|
+
const completeApplications = new Set(input.missingPagePolicy?.completeApplicationIds.map((id) => ContractIdentifierSchema.parse(id)) ?? []);
|
|
16862
|
+
const unavailableAccess = input.missingPagePolicy ? MenuAccessRequirementSchema.parse(input.missingPagePolicy.unavailableAccess) : void 0;
|
|
16863
|
+
if (unavailableAccess) {
|
|
16864
|
+
validatePermissionCodes(unavailableAccess.permissionAllOf, knownPermissions, "missingPagePolicy.unavailableAccess.permissionAllOf");
|
|
16865
|
+
validatePermissionCodes(unavailableAccess.permissionAnyOf, knownPermissions, "missingPagePolicy.unavailableAccess.permissionAnyOf");
|
|
16866
|
+
}
|
|
16867
|
+
const diagnostics = [];
|
|
16807
16868
|
pages.forEach((registration, index) => {
|
|
16808
16869
|
if (!registration.page.visibility.productContexts.some((context) => context === registration.applicationId)) {
|
|
16809
16870
|
throw new MenuCompilationError(
|
|
@@ -16868,6 +16929,35 @@ var compileMenuRuntimeBundle = (input) => {
|
|
|
16868
16929
|
if (node.behavior.kind === "navigate") {
|
|
16869
16930
|
const registration = pagesByKey.get(pageKey(node.behavior.page));
|
|
16870
16931
|
if (!registration) {
|
|
16932
|
+
if (unavailableAccess && completeApplications.has(node.behavior.page.applicationId)) {
|
|
16933
|
+
const activationId2 = resolveMenuActivationId(node.behavior.page, node.behavior.activationId);
|
|
16934
|
+
const identity2 = targetKey(node.behavior.page, activationId2);
|
|
16935
|
+
const signature2 = stableSerialize2({ ...node.behavior, activationId: activationId2 });
|
|
16936
|
+
const previous = targetSourceSignatures.get(identity2);
|
|
16937
|
+
if (previous !== void 0 && previous !== signature2) {
|
|
16938
|
+
throw new MenuCompilationError("conflicting-navigation-target", `${nodePath}.behavior`, "Missing navigation target has conflicting behavior or input.");
|
|
16939
|
+
}
|
|
16940
|
+
targetSourceSignatures.set(identity2, signature2);
|
|
16941
|
+
if (definition.applicationId === applicationId) {
|
|
16942
|
+
diagnostics.push({
|
|
16943
|
+
code: "missing-page",
|
|
16944
|
+
severity: "warning",
|
|
16945
|
+
applicationId: definition.applicationId,
|
|
16946
|
+
surface: definition.surface,
|
|
16947
|
+
menuId: definition.menuId,
|
|
16948
|
+
nodeId: node.nodeId,
|
|
16949
|
+
page: node.behavior.page,
|
|
16950
|
+
path: `${nodePath}.behavior.page`
|
|
16951
|
+
});
|
|
16952
|
+
}
|
|
16953
|
+
const { requiredPermission: requiredPermission3, behavior: _behavior3, ...presentation3 } = node;
|
|
16954
|
+
return CompiledMenuItemNodeSchema.parse({
|
|
16955
|
+
...presentation3,
|
|
16956
|
+
disabled: true,
|
|
16957
|
+
behavior: { kind: "navigate", page: node.behavior.page, activationId: activationId2 },
|
|
16958
|
+
access: { ...unavailableAccess, requiredPermission: requiredPermission3 }
|
|
16959
|
+
});
|
|
16960
|
+
}
|
|
16871
16961
|
throw new MenuCompilationError(
|
|
16872
16962
|
"unknown-page",
|
|
16873
16963
|
`${nodePath}.behavior.page`,
|
|
@@ -17030,6 +17120,7 @@ var compileMenuRuntimeBundle = (input) => {
|
|
|
17030
17120
|
};
|
|
17031
17121
|
return Object.freeze({
|
|
17032
17122
|
document: deepFreeze2(document),
|
|
17123
|
+
diagnostics: deepFreeze2(diagnostics),
|
|
17033
17124
|
menusByKey,
|
|
17034
17125
|
navigationTargetsByKey: documentTargetsByKey,
|
|
17035
17126
|
serverInputByTargetKey,
|
|
@@ -18033,6 +18124,8 @@ export {
|
|
|
18033
18124
|
MenuRuntimeBundleSchema,
|
|
18034
18125
|
MenuRuntimeInputBindingSchema,
|
|
18035
18126
|
MenuSourceInputBindingSchema,
|
|
18127
|
+
NAVIGATION_UNAVAILABLE_CAPABILITY,
|
|
18128
|
+
NAVIGATION_UNAVAILABLE_CAPABILITY_HEADER,
|
|
18036
18129
|
NavigationGroupNodeSchema,
|
|
18037
18130
|
NavigationNodeSchema,
|
|
18038
18131
|
NavigationReleaseSchema,
|
|
@@ -18167,6 +18260,7 @@ export {
|
|
|
18167
18260
|
TrendRadarCollectionSubjectRefSchema,
|
|
18168
18261
|
TrendSourceRecordSchema,
|
|
18169
18262
|
TrendSourceSchema,
|
|
18263
|
+
UnavailableNavigationTargetSchema,
|
|
18170
18264
|
ValidationIssueType,
|
|
18171
18265
|
ValidationReasonType,
|
|
18172
18266
|
ViewProviderDescriptorSchema,
|
|
@@ -18246,6 +18340,7 @@ export {
|
|
|
18246
18340
|
normalizeStudioAgentMode,
|
|
18247
18341
|
parseApplicationHandoff,
|
|
18248
18342
|
projectAgentSessionEvents,
|
|
18343
|
+
projectNavigationCompatibility,
|
|
18249
18344
|
publishOpenApiToolCapabilityManifests,
|
|
18250
18345
|
readApplicationHandoffFromUrl,
|
|
18251
18346
|
readMenuActivationFromSearch,
|