@inf-monkeys-tech/monkeys 1.0.0
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/README.md +38 -0
- package/lib/contracts/artifact.d.ts +112 -0
- package/lib/contracts/artifact.d.ts.map +1 -0
- package/lib/contracts/artifact.js +60 -0
- package/lib/contracts/artifact.js.map +1 -0
- package/lib/contracts/capability.d.ts +347 -0
- package/lib/contracts/capability.d.ts.map +1 -0
- package/lib/contracts/capability.js +135 -0
- package/lib/contracts/capability.js.map +1 -0
- package/lib/contracts/common.d.ts +32 -0
- package/lib/contracts/common.d.ts.map +1 -0
- package/lib/contracts/common.js +46 -0
- package/lib/contracts/common.js.map +1 -0
- package/lib/contracts/context.d.ts +213 -0
- package/lib/contracts/context.d.ts.map +1 -0
- package/lib/contracts/context.js +96 -0
- package/lib/contracts/context.js.map +1 -0
- package/lib/contracts/continuity.d.ts +142 -0
- package/lib/contracts/continuity.d.ts.map +1 -0
- package/lib/contracts/continuity.js +66 -0
- package/lib/contracts/continuity.js.map +1 -0
- package/lib/contracts/data.d.ts +135 -0
- package/lib/contracts/data.d.ts.map +1 -0
- package/lib/contracts/data.js +85 -0
- package/lib/contracts/data.js.map +1 -0
- package/lib/contracts/dtcg-format.schema.json +1759 -0
- package/lib/contracts/index.d.ts +14 -0
- package/lib/contracts/index.d.ts.map +1 -0
- package/lib/contracts/index.js +30 -0
- package/lib/contracts/index.js.map +1 -0
- package/lib/contracts/page.d.ts +482 -0
- package/lib/contracts/page.d.ts.map +1 -0
- package/lib/contracts/page.js +307 -0
- package/lib/contracts/page.js.map +1 -0
- package/lib/contracts/render.d.ts +1032 -0
- package/lib/contracts/render.d.ts.map +1 -0
- package/lib/contracts/render.js +386 -0
- package/lib/contracts/render.js.map +1 -0
- package/lib/contracts/semantic.d.ts +477 -0
- package/lib/contracts/semantic.d.ts.map +1 -0
- package/lib/contracts/semantic.js +111 -0
- package/lib/contracts/semantic.js.map +1 -0
- package/lib/contracts/tenant.d.ts +2495 -0
- package/lib/contracts/tenant.d.ts.map +1 -0
- package/lib/contracts/tenant.js +573 -0
- package/lib/contracts/tenant.js.map +1 -0
- package/lib/contracts/theme.d.ts +30 -0
- package/lib/contracts/theme.d.ts.map +1 -0
- package/lib/contracts/theme.js +55 -0
- package/lib/contracts/theme.js.map +1 -0
- package/lib/contracts/trend.d.ts +577 -0
- package/lib/contracts/trend.d.ts.map +1 -0
- package/lib/contracts/trend.js +276 -0
- package/lib/contracts/trend.js.map +1 -0
- package/lib/contracts/workflow-definition.d.ts +661 -0
- package/lib/contracts/workflow-definition.d.ts.map +1 -0
- package/lib/contracts/workflow-definition.js +337 -0
- package/lib/contracts/workflow-definition.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +34 -0
- package/lib/index.js.map +1 -0
- package/lib/json-schema/agent-runtime-event.schema.json +104 -0
- package/lib/json-schema/application-handoff.schema.json +377 -0
- package/lib/json-schema/application-run.schema.json +302 -0
- package/lib/json-schema/artifact-manifest.schema.json +375 -0
- package/lib/json-schema/body-relation-record.schema.json +177 -0
- package/lib/json-schema/brand-body.schema.json +140 -0
- package/lib/json-schema/brand-genetics-profile.schema.json +169 -0
- package/lib/json-schema/capability-manifest.schema.json +412 -0
- package/lib/json-schema/capability-registry.schema.json +474 -0
- package/lib/json-schema/change-impact-graph.schema.json +274 -0
- package/lib/json-schema/completion-event.schema.json +321 -0
- package/lib/json-schema/completion-header.schema.json +276 -0
- package/lib/json-schema/concept-definition.schema.json +101 -0
- package/lib/json-schema/conductor-workflow-definition.schema.json +404 -0
- package/lib/json-schema/data-continuity-envelope.schema.json +269 -0
- package/lib/json-schema/domain-command-definition.schema.json +121 -0
- package/lib/json-schema/domain-command.schema.json +204 -0
- package/lib/json-schema/domain-event.schema.json +161 -0
- package/lib/json-schema/execution-link.schema.json +190 -0
- package/lib/json-schema/expiring-access-grant.schema.json +127 -0
- package/lib/json-schema/hotword-body.schema.json +186 -0
- package/lib/json-schema/index.json +56 -0
- package/lib/json-schema/lineage-record.schema.json +370 -0
- package/lib/json-schema/ontology-definition.schema.json +91 -0
- package/lib/json-schema/output-record.schema.json +157 -0
- package/lib/json-schema/overlay-node.schema.json +892 -0
- package/lib/json-schema/page-definition.schema.json +527 -0
- package/lib/json-schema/page-runtime-descriptor.schema.json +720 -0
- package/lib/json-schema/page-runtime-projection.schema.json +464 -0
- package/lib/json-schema/product-body.schema.json +178 -0
- package/lib/json-schema/product-declaration.schema.json +1410 -0
- package/lib/json-schema/projection-spec.schema.json +151 -0
- package/lib/json-schema/radar-action-record.schema.json +144 -0
- package/lib/json-schema/radar-analysis-run.schema.json +424 -0
- package/lib/json-schema/radar-opportunity-matrix.schema.json +155 -0
- package/lib/json-schema/radar-panorama.schema.json +235 -0
- package/lib/json-schema/radar-query-body.schema.json +101 -0
- package/lib/json-schema/radar-score-model-body.schema.json +88 -0
- package/lib/json-schema/radar-score-projection.schema.json +184 -0
- package/lib/json-schema/radar-selection.schema.json +134 -0
- package/lib/json-schema/radar-writeback-record.schema.json +124 -0
- package/lib/json-schema/render-node.schema.json +776 -0
- package/lib/json-schema/render-tree.schema.json +815 -0
- package/lib/json-schema/request-scope.schema.json +193 -0
- package/lib/json-schema/saved-radar-query.schema.json +123 -0
- package/lib/json-schema/tenant-product-config.schema.json +2720 -0
- package/lib/json-schema/tenant-runtime-config.schema.json +2654 -0
- package/lib/json-schema/theme-tokens.schema.json +1836 -0
- package/lib/json-schema/trend-ingest-run.schema.json +73 -0
- package/lib/json-schema/trend-metric-snapshot.schema.json +126 -0
- package/lib/json-schema/trend-source-record.schema.json +206 -0
- package/lib/json-schema/view-provider-descriptor.schema.json +317 -0
- package/lib/json-schema/workflow-definition.schema.json +2174 -0
- package/lib/runtime/capability-registry.d.ts +28 -0
- package/lib/runtime/capability-registry.d.ts.map +1 -0
- package/lib/runtime/capability-registry.js +147 -0
- package/lib/runtime/capability-registry.js.map +1 -0
- package/lib/runtime/declaration-compiler.d.ts +44 -0
- package/lib/runtime/declaration-compiler.d.ts.map +1 -0
- package/lib/runtime/declaration-compiler.js +323 -0
- package/lib/runtime/declaration-compiler.js.map +1 -0
- package/lib/runtime/index.d.ts +12 -0
- package/lib/runtime/index.d.ts.map +1 -0
- package/lib/runtime/index.js +28 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/page-compiler.d.ts +36 -0
- package/lib/runtime/page-compiler.d.ts.map +1 -0
- package/lib/runtime/page-compiler.js +220 -0
- package/lib/runtime/page-compiler.js.map +1 -0
- package/lib/runtime/product-runtime.d.ts +37 -0
- package/lib/runtime/product-runtime.d.ts.map +1 -0
- package/lib/runtime/product-runtime.js +80 -0
- package/lib/runtime/product-runtime.js.map +1 -0
- package/lib/runtime/render-tree-compiler.d.ts +11 -0
- package/lib/runtime/render-tree-compiler.d.ts.map +1 -0
- package/lib/runtime/render-tree-compiler.js +85 -0
- package/lib/runtime/render-tree-compiler.js.map +1 -0
- package/lib/runtime/tenant-config.d.ts +13 -0
- package/lib/runtime/tenant-config.d.ts.map +1 -0
- package/lib/runtime/tenant-config.js +31 -0
- package/lib/runtime/tenant-config.js.map +1 -0
- package/lib/runtime/tenant-runtime-bindings.d.ts +21 -0
- package/lib/runtime/tenant-runtime-bindings.d.ts.map +1 -0
- package/lib/runtime/tenant-runtime-bindings.js +50 -0
- package/lib/runtime/tenant-runtime-bindings.js.map +1 -0
- package/lib/runtime/theme-tokens.d.ts +2 -0
- package/lib/runtime/theme-tokens.d.ts.map +1 -0
- package/lib/runtime/theme-tokens.js +13 -0
- package/lib/runtime/theme-tokens.js.map +1 -0
- package/lib/runtime/view-provider-registry.d.ts +23 -0
- package/lib/runtime/view-provider-registry.d.ts.map +1 -0
- package/lib/runtime/view-provider-registry.js +150 -0
- package/lib/runtime/view-provider-registry.js.map +1 -0
- package/lib/runtime/view-render-model.d.ts +28 -0
- package/lib/runtime/view-render-model.d.ts.map +1 -0
- package/lib/runtime/view-render-model.js +125 -0
- package/lib/runtime/view-render-model.js.map +1 -0
- package/lib/runtime/workflow-compiler.d.ts +29 -0
- package/lib/runtime/workflow-compiler.d.ts.map +1 -0
- package/lib/runtime/workflow-compiler.js +100 -0
- package/lib/runtime/workflow-compiler.js.map +1 -0
- package/lib/schemas/index.d.ts +4461 -0
- package/lib/schemas/index.d.ts.map +1 -0
- package/lib/schemas/index.js +187 -0
- package/lib/schemas/index.js.map +1 -0
- package/lib/theme-tokens/core.d.ts +65 -0
- package/lib/theme-tokens/core.d.ts.map +1 -0
- package/lib/theme-tokens/core.js +490 -0
- package/lib/theme-tokens/core.js.map +1 -0
- package/lib/types/i18n.d.ts +19 -0
- package/lib/types/i18n.d.ts.map +1 -0
- package/lib/types/i18n.js +3 -0
- package/lib/types/i18n.js.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +20 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/tool.d.ts +123 -0
- package/lib/types/tool.d.ts.map +1 -0
- package/lib/types/tool.js +20 -0
- package/lib/types/tool.js.map +1 -0
- package/lib/types/workflow.d.ts +80 -0
- package/lib/types/workflow.d.ts.map +1 -0
- package/lib/types/workflow.js +23 -0
- package/lib/types/workflow.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./capability-registry"), exports);
|
|
18
|
+
__exportStar(require("./declaration-compiler"), exports);
|
|
19
|
+
__exportStar(require("./page-compiler"), exports);
|
|
20
|
+
__exportStar(require("./product-runtime"), exports);
|
|
21
|
+
__exportStar(require("./render-tree-compiler"), exports);
|
|
22
|
+
__exportStar(require("./tenant-config"), exports);
|
|
23
|
+
__exportStar(require("./tenant-runtime-bindings"), exports);
|
|
24
|
+
__exportStar(require("./theme-tokens"), exports);
|
|
25
|
+
__exportStar(require("./view-provider-registry"), exports);
|
|
26
|
+
__exportStar(require("./view-render-model"), exports);
|
|
27
|
+
__exportStar(require("./workflow-compiler"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,yDAAuC;AACvC,kDAAgC;AAChC,oDAAkC;AAClC,yDAAuC;AACvC,kDAAgC;AAChC,4DAA0C;AAC1C,iDAA+B;AAC/B,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CapabilityManifest } from '../contracts/capability';
|
|
2
|
+
import type { PageDefinition, PageGuardProjection, PageNavigationProjection, PageRendererProjection, PageRouteProjection, PageRuntimeProjection } from '../contracts/page';
|
|
3
|
+
import type { ProductContext, ViewProviderDescriptor } from '../contracts/render';
|
|
4
|
+
export interface PageAccessContext {
|
|
5
|
+
authenticated: boolean;
|
|
6
|
+
permissionCodes: readonly string[];
|
|
7
|
+
featureFlags: Readonly<Record<string, boolean>>;
|
|
8
|
+
}
|
|
9
|
+
export interface PageAccessDecision {
|
|
10
|
+
allowed: boolean;
|
|
11
|
+
reasons: readonly ('authentication' | 'permission-all' | 'permission-any' | 'feature-flag')[];
|
|
12
|
+
}
|
|
13
|
+
export interface CompilePageRuntimeProjectionInput {
|
|
14
|
+
product: ProductContext;
|
|
15
|
+
pages: readonly PageDefinition[];
|
|
16
|
+
capabilities: readonly CapabilityManifest[];
|
|
17
|
+
providers: readonly ViewProviderDescriptor[];
|
|
18
|
+
}
|
|
19
|
+
export interface CompiledPageRuntimeProjection {
|
|
20
|
+
document: PageRuntimeProjection;
|
|
21
|
+
pagesById: ReadonlyMap<string, PageDefinition>;
|
|
22
|
+
providersById: ReadonlyMap<string, ViewProviderDescriptor>;
|
|
23
|
+
routesById: ReadonlyMap<string, PageRouteProjection>;
|
|
24
|
+
navigationByPageId: ReadonlyMap<string, PageNavigationProjection>;
|
|
25
|
+
guardsByPageId: ReadonlyMap<string, PageGuardProjection>;
|
|
26
|
+
renderersByPageId: ReadonlyMap<string, PageRendererProjection>;
|
|
27
|
+
evaluateAccess(pageId: string, context: PageAccessContext): PageAccessDecision;
|
|
28
|
+
visibleNavigation(context: PageAccessContext): readonly PageNavigationProjection[];
|
|
29
|
+
matchRoute(pathname: string): PageDefinition | undefined;
|
|
30
|
+
requireRoute(routeId: string): PageRouteProjection;
|
|
31
|
+
requireGuard(pageId: string): PageGuardProjection;
|
|
32
|
+
requireRenderer(pageId: string): PageRendererProjection;
|
|
33
|
+
}
|
|
34
|
+
/** Compiles route, navigation, guard and renderer tables from one canonical PageDefinition set. */
|
|
35
|
+
export declare const compilePageRuntimeProjection: (input: CompilePageRuntimeProjectionInput) => CompiledPageRuntimeProjection;
|
|
36
|
+
//# sourceMappingURL=page-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-compiler.d.ts","sourceRoot":"","sources":["../../src/runtime/page-compiler.ts"],"names":[],"mappings":"AA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;IAC/D,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC/E,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,wBAAwB,EAAE,CAAC;IACnF,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IACzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACnD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAAC;IAClD,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,CAAC;CACzD;AAED,mGAAmG;AACnG,eAAO,MAAM,4BAA4B,UAChC,iCAAiC,KACvC,6BA+JF,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compilePageRuntimeProjection = void 0;
|
|
4
|
+
const page_1 = require("../contracts/page");
|
|
5
|
+
const view_provider_registry_1 = require("./view-provider-registry");
|
|
6
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
|
+
const routePattern = (path) => {
|
|
8
|
+
const parts = path.split('/').filter(Boolean);
|
|
9
|
+
const expression = parts.map((part, index) => {
|
|
10
|
+
if (part === '*')
|
|
11
|
+
return index === parts.length - 1 ? '(?:/.*)?' : '/.*';
|
|
12
|
+
if (part.startsWith(':') || part.startsWith('$'))
|
|
13
|
+
return '/[^/]+';
|
|
14
|
+
if (part.endsWith('*'))
|
|
15
|
+
return `/${escapeRegExp(part.slice(0, -1))}.*`;
|
|
16
|
+
return `/${escapeRegExp(part)}`;
|
|
17
|
+
}).join('');
|
|
18
|
+
return new RegExp(`^${expression || '/'}\/?$`);
|
|
19
|
+
};
|
|
20
|
+
const routeSignature = (path) => path
|
|
21
|
+
.split('/')
|
|
22
|
+
.map((part) => {
|
|
23
|
+
if (part === '*' || part.endsWith('*'))
|
|
24
|
+
return '*';
|
|
25
|
+
if (part.startsWith(':') || part.startsWith('$'))
|
|
26
|
+
return ':';
|
|
27
|
+
return part;
|
|
28
|
+
})
|
|
29
|
+
.join('/');
|
|
30
|
+
const routeSpecificity = (path) => path.split('/').filter(Boolean).reduce((score, part) => {
|
|
31
|
+
if (part === '*' || part.endsWith('*'))
|
|
32
|
+
return score;
|
|
33
|
+
if (part.startsWith(':') || part.startsWith('$'))
|
|
34
|
+
return score + 1;
|
|
35
|
+
return score + 10;
|
|
36
|
+
}, 0);
|
|
37
|
+
const unique = (values, key, label) => {
|
|
38
|
+
const result = new Map();
|
|
39
|
+
for (const value of values) {
|
|
40
|
+
const id = key(value);
|
|
41
|
+
if (result.has(id))
|
|
42
|
+
throw new Error(`Duplicate ${label}: ${id}`);
|
|
43
|
+
result.set(id, value);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
const referenceVersion = (version) => version === undefined ? undefined : String(version);
|
|
48
|
+
const assertCapabilityReference = (owner, reference, capability) => {
|
|
49
|
+
if (!capability)
|
|
50
|
+
throw new Error(`${owner} references unknown capability ${reference.id}.`);
|
|
51
|
+
if (referenceVersion(reference.version) !== capability.capabilityVersion) {
|
|
52
|
+
throw new Error(`${owner} references inactive capability version ${String(reference.version)} for ${reference.id}.`);
|
|
53
|
+
}
|
|
54
|
+
if (reference.ownerRepo !== capability.ownerRepo) {
|
|
55
|
+
throw new Error(`${owner} capability ${reference.id} owner must be ${capability.ownerRepo}.`);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** Compiles route, navigation, guard and renderer tables from one canonical PageDefinition set. */
|
|
59
|
+
const compilePageRuntimeProjection = (input) => {
|
|
60
|
+
const pages = input.pages.map((page) => page_1.PageDefinitionSchema.parse(page));
|
|
61
|
+
const providerRegistry = (0, view_provider_registry_1.compileViewProviderRegistry)(input);
|
|
62
|
+
const capabilities = providerRegistry.capabilities;
|
|
63
|
+
const providers = providerRegistry.providers;
|
|
64
|
+
const pagesById = unique(pages, (page) => page.pageId, 'pageId');
|
|
65
|
+
unique(pages, (page) => page.routeId, 'routeId');
|
|
66
|
+
unique(pages, (page) => page.routePath, 'route path');
|
|
67
|
+
unique(pages, (page) => routeSignature(page.routePath), 'route pattern');
|
|
68
|
+
const capabilitiesById = providerRegistry.capabilitiesById;
|
|
69
|
+
const providersById = providerRegistry.providersById;
|
|
70
|
+
for (const page of pages) {
|
|
71
|
+
if (page.record.deleted) {
|
|
72
|
+
throw new Error(`Deleted page ${page.pageId} cannot be compiled into a runtime projection.`);
|
|
73
|
+
}
|
|
74
|
+
if (!page.visibility.productContexts.includes(input.product)) {
|
|
75
|
+
throw new Error(`Page ${page.pageId} is not visible in ${input.product}.`);
|
|
76
|
+
}
|
|
77
|
+
if (page.navigation.parentPageId && !pagesById.has(page.navigation.parentPageId)) {
|
|
78
|
+
throw new Error(`Page ${page.pageId} references unknown parent ${page.navigation.parentPageId}.`);
|
|
79
|
+
}
|
|
80
|
+
for (const reference of [page.capabilityRef, ...page.capabilityRefs]) {
|
|
81
|
+
assertCapabilityReference(`Page ${page.pageId}`, reference, capabilitiesById.get(reference.id));
|
|
82
|
+
}
|
|
83
|
+
const provider = providerRegistry.resolveProvider(page.capabilityRef.id, input.product);
|
|
84
|
+
if (provider.rendererKey !== page.rendererKey || provider.capabilityRef.id !== page.capabilityRef.id) {
|
|
85
|
+
throw new Error(`Page ${page.pageId} renderer ${page.rendererKey} does not match provider ${provider.providerId}.`);
|
|
86
|
+
}
|
|
87
|
+
if (!provider.supportedPageTypes.includes(page.pageType)) {
|
|
88
|
+
throw new Error(`Provider ${provider.providerId} does not support page type ${page.pageType}.`);
|
|
89
|
+
}
|
|
90
|
+
if (!provider.supportedSurfaces.includes(page.surface)) {
|
|
91
|
+
throw new Error(`Provider ${provider.providerId} does not support surface ${page.surface}.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const page of pages) {
|
|
95
|
+
const ancestors = new Set([page.pageId]);
|
|
96
|
+
let parent = page.navigation.parentPageId;
|
|
97
|
+
while (parent) {
|
|
98
|
+
if (ancestors.has(parent))
|
|
99
|
+
throw new Error(`Navigation cycle contains page ${page.pageId}.`);
|
|
100
|
+
ancestors.add(parent);
|
|
101
|
+
parent = pagesById.get(parent)?.navigation.parentPageId;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const routes = pages.map((page) => ({
|
|
105
|
+
pageId: page.pageId,
|
|
106
|
+
routeId: page.routeId,
|
|
107
|
+
path: page.routePath,
|
|
108
|
+
}));
|
|
109
|
+
const navigation = pages
|
|
110
|
+
.filter((page) => !page.navigation.hidden)
|
|
111
|
+
.map((page) => ({
|
|
112
|
+
pageId: page.pageId,
|
|
113
|
+
routeId: page.routeId,
|
|
114
|
+
path: page.routePath,
|
|
115
|
+
label: page.navigation.label,
|
|
116
|
+
iconRef: page.navigation.iconRef,
|
|
117
|
+
parentPageId: page.navigation.parentPageId,
|
|
118
|
+
order: page.navigation.order,
|
|
119
|
+
pinned: page.navigation.pinned,
|
|
120
|
+
}))
|
|
121
|
+
.sort((left, right) => (left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER)
|
|
122
|
+
|| left.pageId.localeCompare(right.pageId));
|
|
123
|
+
const guards = pages.map((page) => ({
|
|
124
|
+
pageId: page.pageId,
|
|
125
|
+
authenticated: page.visibility.authenticated,
|
|
126
|
+
permissionAllOf: page.visibility.permissionAllOf,
|
|
127
|
+
permissionAnyOf: page.visibility.permissionAnyOf,
|
|
128
|
+
featureFlags: page.visibility.featureFlags,
|
|
129
|
+
actions: page.access.actions,
|
|
130
|
+
}));
|
|
131
|
+
const renderers = pages.map((page) => {
|
|
132
|
+
const provider = providerRegistry.resolveProvider(page.capabilityRef.id, input.product);
|
|
133
|
+
return {
|
|
134
|
+
pageId: page.pageId,
|
|
135
|
+
surface: page.surface,
|
|
136
|
+
rendererKey: page.rendererKey,
|
|
137
|
+
capabilityRef: page.capabilityRef,
|
|
138
|
+
capabilityRefs: page.capabilityRefs,
|
|
139
|
+
providerRef: {
|
|
140
|
+
kind: 'view-provider',
|
|
141
|
+
id: provider.providerId,
|
|
142
|
+
version: provider.providerVersion,
|
|
143
|
+
ownerRepo: provider.ownerRepo,
|
|
144
|
+
},
|
|
145
|
+
binding: page.binding,
|
|
146
|
+
rendererConfig: page.rendererConfig,
|
|
147
|
+
workflowRef: page.workflowRef,
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
const document = page_1.PageRuntimeProjectionSchema.parse({
|
|
151
|
+
contract: 'PageRuntimeProjection',
|
|
152
|
+
product: input.product,
|
|
153
|
+
routes,
|
|
154
|
+
navigation,
|
|
155
|
+
guards,
|
|
156
|
+
renderers,
|
|
157
|
+
});
|
|
158
|
+
const routesById = unique(document.routes, (route) => route.routeId, 'projected routeId');
|
|
159
|
+
const navigationByPageId = unique(document.navigation, (item) => item.pageId, 'navigation pageId');
|
|
160
|
+
const guardsByPageId = unique(document.guards, (guard) => guard.pageId, 'guard pageId');
|
|
161
|
+
const renderersByPageId = unique(document.renderers, (renderer) => renderer.pageId, 'renderer pageId');
|
|
162
|
+
const matchers = pages
|
|
163
|
+
.map((page) => ({ page, pattern: routePattern(page.routePath), specificity: routeSpecificity(page.routePath) }))
|
|
164
|
+
.sort((left, right) => right.specificity - left.specificity || left.page.pageId.localeCompare(right.page.pageId));
|
|
165
|
+
const evaluateAccess = (pageId, context) => {
|
|
166
|
+
const guard = guardsByPageId.get(pageId);
|
|
167
|
+
if (!guard)
|
|
168
|
+
throw new Error(`Unknown page guard: ${pageId}`);
|
|
169
|
+
const reasons = [];
|
|
170
|
+
if (guard.authenticated && !context.authenticated)
|
|
171
|
+
reasons.push('authentication');
|
|
172
|
+
const permissions = new Set(context.permissionCodes);
|
|
173
|
+
if (guard.permissionAllOf.some((permission) => !permissions.has(permission))) {
|
|
174
|
+
reasons.push('permission-all');
|
|
175
|
+
}
|
|
176
|
+
if (guard.permissionAnyOf.length > 0 && !guard.permissionAnyOf.some((permission) => permissions.has(permission))) {
|
|
177
|
+
reasons.push('permission-any');
|
|
178
|
+
}
|
|
179
|
+
if (guard.featureFlags.some((flag) => context.featureFlags[flag] !== true))
|
|
180
|
+
reasons.push('feature-flag');
|
|
181
|
+
return Object.freeze({ allowed: reasons.length === 0, reasons: Object.freeze(reasons) });
|
|
182
|
+
};
|
|
183
|
+
return Object.freeze({
|
|
184
|
+
document: Object.freeze(document),
|
|
185
|
+
pagesById,
|
|
186
|
+
providersById,
|
|
187
|
+
routesById,
|
|
188
|
+
navigationByPageId,
|
|
189
|
+
guardsByPageId,
|
|
190
|
+
renderersByPageId,
|
|
191
|
+
evaluateAccess,
|
|
192
|
+
visibleNavigation(context) {
|
|
193
|
+
return Object.freeze(document.navigation.filter((item) => evaluateAccess(item.pageId, context).allowed));
|
|
194
|
+
},
|
|
195
|
+
matchRoute(pathname) {
|
|
196
|
+
const path = pathname.split('?')[0]?.split('#')[0] || '/';
|
|
197
|
+
return matchers.find((matcher) => matcher.pattern.test(path))?.page;
|
|
198
|
+
},
|
|
199
|
+
requireRoute(routeId) {
|
|
200
|
+
const route = routesById.get(routeId);
|
|
201
|
+
if (!route)
|
|
202
|
+
throw new Error(`Unknown route: ${routeId}`);
|
|
203
|
+
return route;
|
|
204
|
+
},
|
|
205
|
+
requireGuard(pageId) {
|
|
206
|
+
const guard = guardsByPageId.get(pageId);
|
|
207
|
+
if (!guard)
|
|
208
|
+
throw new Error(`Unknown page guard: ${pageId}`);
|
|
209
|
+
return guard;
|
|
210
|
+
},
|
|
211
|
+
requireRenderer(pageId) {
|
|
212
|
+
const renderer = renderersByPageId.get(pageId);
|
|
213
|
+
if (!renderer)
|
|
214
|
+
throw new Error(`Unknown page renderer: ${pageId}`);
|
|
215
|
+
return renderer;
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
exports.compilePageRuntimeProjection = compilePageRuntimeProjection;
|
|
220
|
+
//# sourceMappingURL=page-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-compiler.js","sourceRoot":"","sources":["../../src/runtime/page-compiler.ts"],"names":[],"mappings":";;;AASA,4CAG2B;AAE3B,qEAAuE;AAEvE,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAErF,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC3C,IAAI,IAAI,KAAK,GAAG;YAAE,OAAO,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,QAAQ,CAAC;QAClE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvE,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,IAAI,MAAM,CAAC,IAAI,UAAU,IAAI,GAAG,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI;KAClD,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,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C;AAjKW,QAAA,4BAA4B,gCAiKvC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CapabilityManifest } from '../contracts/capability';
|
|
2
|
+
import type { PageRuntimeProjection } from '../contracts/page';
|
|
3
|
+
import type { PageDefinition } from '../contracts/page';
|
|
4
|
+
import type { ProductDeclaration } from '../contracts/semantic';
|
|
5
|
+
import type { ApplicationHandoff, ProductContext, ViewProviderDescriptor } from '../contracts/render';
|
|
6
|
+
import type { PageAccessContext, PageAccessDecision } from './page-compiler';
|
|
7
|
+
import { type CompiledProductDeclaration } from './declaration-compiler';
|
|
8
|
+
export declare const APPLICATION_HANDOFF_QUERY_PARAMETER = "monkeys-handoff";
|
|
9
|
+
export interface ProductRuntimeCatalogInput {
|
|
10
|
+
product: ProductContext;
|
|
11
|
+
declaration: ProductDeclaration;
|
|
12
|
+
providers: readonly ViewProviderDescriptor[];
|
|
13
|
+
}
|
|
14
|
+
export interface ProductRuntimeCatalog {
|
|
15
|
+
product: ProductContext;
|
|
16
|
+
declaration: CompiledProductDeclaration;
|
|
17
|
+
pages: readonly PageDefinition[];
|
|
18
|
+
capabilities: readonly CapabilityManifest[];
|
|
19
|
+
providers: readonly ViewProviderDescriptor[];
|
|
20
|
+
pagesById: ReadonlyMap<string, PageDefinition>;
|
|
21
|
+
pagesByRouteId: ReadonlyMap<string, PageDefinition>;
|
|
22
|
+
capabilitiesById: ReadonlyMap<string, CapabilityManifest>;
|
|
23
|
+
providersById: ReadonlyMap<string, ViewProviderDescriptor>;
|
|
24
|
+
projection: PageRuntimeProjection;
|
|
25
|
+
document: PageRuntimeProjection;
|
|
26
|
+
navigation: readonly PageDefinition[];
|
|
27
|
+
evaluateAccess(pageId: string, context: PageAccessContext): PageAccessDecision;
|
|
28
|
+
matchPage(pathname: string): PageDefinition | undefined;
|
|
29
|
+
matchRoute(pathname: string): PageDefinition | undefined;
|
|
30
|
+
requireRenderer(pageId: string): PageRuntimeProjection['renderers'][number];
|
|
31
|
+
}
|
|
32
|
+
export declare const compileProductRuntimeCatalog: (input: ProductRuntimeCatalogInput) => ProductRuntimeCatalog;
|
|
33
|
+
export declare const serializeApplicationHandoff: (handoff: ApplicationHandoff) => string;
|
|
34
|
+
export declare const parseApplicationHandoff: (value: string | null | undefined) => ApplicationHandoff | undefined;
|
|
35
|
+
export declare const readApplicationHandoffFromUrl: (input: string | URL) => ApplicationHandoff | undefined;
|
|
36
|
+
export declare const buildApplicationHandoffUrl: (targetPath: string, handoff: ApplicationHandoff) => string;
|
|
37
|
+
//# sourceMappingURL=product-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/product-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAA6B,KAAK,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpG,eAAO,MAAM,mCAAmC,oBAAoB,CAAC;AAErE,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,0BAA0B,CAAC;IACxC,KAAK,EAAE,SAAS,cAAc,EAAE,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", { value: true });
|
|
3
|
+
exports.buildApplicationHandoffUrl = exports.readApplicationHandoffFromUrl = exports.parseApplicationHandoff = exports.serializeApplicationHandoff = exports.compileProductRuntimeCatalog = exports.APPLICATION_HANDOFF_QUERY_PARAMETER = void 0;
|
|
4
|
+
const render_1 = require("../contracts/render");
|
|
5
|
+
const page_compiler_1 = require("./page-compiler");
|
|
6
|
+
const declaration_compiler_1 = require("./declaration-compiler");
|
|
7
|
+
exports.APPLICATION_HANDOFF_QUERY_PARAMETER = 'monkeys-handoff';
|
|
8
|
+
const indexUnique = (values, key, label) => {
|
|
9
|
+
const result = new Map();
|
|
10
|
+
for (const value of values) {
|
|
11
|
+
const id = key(value);
|
|
12
|
+
if (result.has(id))
|
|
13
|
+
throw new Error(`Duplicate ${label}: ${id}`);
|
|
14
|
+
result.set(id, value);
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
const compileProductRuntimeCatalog = (input) => {
|
|
19
|
+
const declaration = (0, declaration_compiler_1.compileProductDeclaration)(input.declaration);
|
|
20
|
+
const compiled = (0, page_compiler_1.compilePageRuntimeProjection)({
|
|
21
|
+
product: input.product,
|
|
22
|
+
pages: declaration.declaration.pages,
|
|
23
|
+
capabilities: declaration.declaration.capabilities,
|
|
24
|
+
providers: input.providers,
|
|
25
|
+
});
|
|
26
|
+
const pages = [...compiled.pagesById.values()];
|
|
27
|
+
const capabilities = [...declaration.declaration.capabilities];
|
|
28
|
+
const providers = [...compiled.providersById.values()];
|
|
29
|
+
const pagesById = compiled.pagesById;
|
|
30
|
+
const pagesByRouteId = indexUnique(pages, (page) => page.routeId, 'routeId');
|
|
31
|
+
const capabilitiesById = indexUnique(capabilities, (capability) => capability.id, 'capability id');
|
|
32
|
+
const providersById = compiled.providersById;
|
|
33
|
+
const navigation = compiled.document.navigation.map((item) => pagesById.get(item.pageId));
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
product: input.product,
|
|
36
|
+
declaration,
|
|
37
|
+
pages: Object.freeze(pages),
|
|
38
|
+
capabilities: Object.freeze(capabilities),
|
|
39
|
+
providers: Object.freeze(providers),
|
|
40
|
+
pagesById,
|
|
41
|
+
pagesByRouteId,
|
|
42
|
+
capabilitiesById,
|
|
43
|
+
providersById,
|
|
44
|
+
projection: compiled.document,
|
|
45
|
+
document: compiled.document,
|
|
46
|
+
navigation: Object.freeze(navigation),
|
|
47
|
+
evaluateAccess: compiled.evaluateAccess,
|
|
48
|
+
matchPage: compiled.matchRoute,
|
|
49
|
+
matchRoute: compiled.matchRoute,
|
|
50
|
+
requireRenderer: compiled.requireRenderer,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.compileProductRuntimeCatalog = compileProductRuntimeCatalog;
|
|
54
|
+
const serializeApplicationHandoff = (handoff) => JSON.stringify(render_1.ApplicationHandoffSchema.parse(handoff));
|
|
55
|
+
exports.serializeApplicationHandoff = serializeApplicationHandoff;
|
|
56
|
+
const parseApplicationHandoff = (value) => {
|
|
57
|
+
if (!value)
|
|
58
|
+
return undefined;
|
|
59
|
+
try {
|
|
60
|
+
return render_1.ApplicationHandoffSchema.parse(JSON.parse(value));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.parseApplicationHandoff = parseApplicationHandoff;
|
|
67
|
+
const readApplicationHandoffFromUrl = (input) => {
|
|
68
|
+
const url = typeof input === 'string' ? new URL(input, 'https://monkeys.local') : input;
|
|
69
|
+
return (0, exports.parseApplicationHandoff)(url.searchParams.get(exports.APPLICATION_HANDOFF_QUERY_PARAMETER));
|
|
70
|
+
};
|
|
71
|
+
exports.readApplicationHandoffFromUrl = readApplicationHandoffFromUrl;
|
|
72
|
+
const buildApplicationHandoffUrl = (targetPath, handoff) => {
|
|
73
|
+
const parsed = render_1.ApplicationHandoffSchema.parse(handoff);
|
|
74
|
+
const isRelative = targetPath.startsWith('/') && !targetPath.startsWith('//');
|
|
75
|
+
const url = new URL(targetPath, 'https://monkeys.local');
|
|
76
|
+
url.searchParams.set(exports.APPLICATION_HANDOFF_QUERY_PARAMETER, (0, exports.serializeApplicationHandoff)(parsed));
|
|
77
|
+
return isRelative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
78
|
+
};
|
|
79
|
+
exports.buildApplicationHandoffUrl = buildApplicationHandoffUrl;
|
|
80
|
+
//# sourceMappingURL=product-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-runtime.js","sourceRoot":"","sources":["../../src/runtime/product-runtime.ts"],"names":[],"mappings":";;;AASA,gDAA+D;AAE/D,mDAA+D;AAC/D,iEAAoG;AAEvF,QAAA,mCAAmC,GAAG,iBAAiB,CAAC;AA2BrE,MAAM,WAAW,GAAG,CAAI,MAAoB,EAAE,GAAyB,EAAE,KAAa,EAA0B,EAAE;IAChH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAa,CAAC;IACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEK,MAAM,4BAA4B,GAAG,CAAC,KAAiC,EAAyB,EAAE;IACvG,MAAM,WAAW,GAAG,IAAA,gDAAyB,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,IAAA,4CAA4B,EAAC;QAC5C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK;QACpC,YAAY,EAAE,WAAW,CAAC,WAAW,CAA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U,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;IACzD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,2CAAmC,EAAE,IAAA,mCAA2B,EAAC,MAAM,CAAC,CAAC,CAAC;IAC/F,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACjF,CAAC,CAAC;AANW,QAAA,0BAA0B,8BAMrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RenderNode, RenderTree } from '../contracts/render';
|
|
2
|
+
export interface CompiledRenderTree {
|
|
3
|
+
tree: RenderTree;
|
|
4
|
+
root: RenderNode;
|
|
5
|
+
nodesById: ReadonlyMap<string, RenderNode>;
|
|
6
|
+
traversal: readonly RenderNode[];
|
|
7
|
+
childrenOf(nodeId: string): readonly RenderNode[];
|
|
8
|
+
ancestorsOf(nodeId: string): readonly RenderNode[];
|
|
9
|
+
}
|
|
10
|
+
export declare const compileRenderTree: (input: RenderTree) => CompiledRenderTree;
|
|
11
|
+
//# sourceMappingURL=render-tree-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-tree-compiler.d.ts","sourceRoot":"","sources":["../../src/runtime/render-tree-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3C,SAAS,EAAE,SAAS,UAAU,EAAE,CAAC;IACjC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,UAAU,EAAE,CAAC;IAClD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,UAAU,EAAE,CAAC;CACpD;AAED,eAAO,MAAM,iBAAiB,UAAW,UAAU,KAAG,kBAyErD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileRenderTree = void 0;
|
|
4
|
+
const render_1 = require("../contracts/render");
|
|
5
|
+
const compileRenderTree = (input) => {
|
|
6
|
+
const tree = render_1.RenderTreeSchema.parse(input);
|
|
7
|
+
const nodesById = new Map();
|
|
8
|
+
for (const node of tree.nodes) {
|
|
9
|
+
if (nodesById.has(node.nodeId))
|
|
10
|
+
throw new Error(`Duplicate render node id: ${node.nodeId}`);
|
|
11
|
+
nodesById.set(node.nodeId, node);
|
|
12
|
+
}
|
|
13
|
+
const root = nodesById.get(tree.rootNodeId);
|
|
14
|
+
if (!root)
|
|
15
|
+
throw new Error(`Render tree ${tree.treeId} has no root node ${tree.rootNodeId}.`);
|
|
16
|
+
if (root.parentNodeId !== undefined)
|
|
17
|
+
throw new Error(`Render tree root ${root.nodeId} cannot declare a parent.`);
|
|
18
|
+
for (const node of tree.nodes) {
|
|
19
|
+
if (node.nodeId !== root.nodeId && node.parentNodeId === undefined) {
|
|
20
|
+
throw new Error(`Render node ${node.nodeId} is disconnected from root ${root.nodeId}.`);
|
|
21
|
+
}
|
|
22
|
+
if (node.parentNodeId !== undefined) {
|
|
23
|
+
const parent = nodesById.get(node.parentNodeId);
|
|
24
|
+
if (!parent)
|
|
25
|
+
throw new Error(`Render node ${node.nodeId} references missing parent ${node.parentNodeId}.`);
|
|
26
|
+
if (!parent.children.includes(node.nodeId)) {
|
|
27
|
+
throw new Error(`Render node ${node.nodeId} is not declared by parent ${parent.nodeId}.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (const childId of node.children) {
|
|
31
|
+
const child = nodesById.get(childId);
|
|
32
|
+
if (!child)
|
|
33
|
+
throw new Error(`Render node ${node.nodeId} references missing child ${childId}.`);
|
|
34
|
+
if (child.parentNodeId !== node.nodeId) {
|
|
35
|
+
throw new Error(`Render child ${childId} does not point back to parent ${node.nodeId}.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const visiting = new Set();
|
|
40
|
+
const visited = new Set();
|
|
41
|
+
const traversal = [];
|
|
42
|
+
const visit = (node) => {
|
|
43
|
+
if (visiting.has(node.nodeId))
|
|
44
|
+
throw new Error(`Render tree ${tree.treeId} contains a cycle at ${node.nodeId}.`);
|
|
45
|
+
if (visited.has(node.nodeId))
|
|
46
|
+
return;
|
|
47
|
+
visiting.add(node.nodeId);
|
|
48
|
+
traversal.push(node);
|
|
49
|
+
node.children.forEach((childId) => visit(nodesById.get(childId)));
|
|
50
|
+
visiting.delete(node.nodeId);
|
|
51
|
+
visited.add(node.nodeId);
|
|
52
|
+
};
|
|
53
|
+
visit(root);
|
|
54
|
+
if (visited.size !== nodesById.size) {
|
|
55
|
+
const disconnected = tree.nodes.find((node) => !visited.has(node.nodeId));
|
|
56
|
+
throw new Error(`Render node ${disconnected.nodeId} is not reachable from root ${root.nodeId}.`);
|
|
57
|
+
}
|
|
58
|
+
const childrenOf = (nodeId) => {
|
|
59
|
+
const node = nodesById.get(nodeId);
|
|
60
|
+
if (!node)
|
|
61
|
+
throw new Error(`Unknown render node: ${nodeId}`);
|
|
62
|
+
return Object.freeze(node.children.map((childId) => nodesById.get(childId)));
|
|
63
|
+
};
|
|
64
|
+
const ancestorsOf = (nodeId) => {
|
|
65
|
+
let node = nodesById.get(nodeId);
|
|
66
|
+
if (!node)
|
|
67
|
+
throw new Error(`Unknown render node: ${nodeId}`);
|
|
68
|
+
const ancestors = [];
|
|
69
|
+
while (node.parentNodeId !== undefined) {
|
|
70
|
+
node = nodesById.get(node.parentNodeId);
|
|
71
|
+
ancestors.push(node);
|
|
72
|
+
}
|
|
73
|
+
return Object.freeze(ancestors);
|
|
74
|
+
};
|
|
75
|
+
return Object.freeze({
|
|
76
|
+
tree,
|
|
77
|
+
root,
|
|
78
|
+
nodesById,
|
|
79
|
+
traversal: Object.freeze(traversal),
|
|
80
|
+
childrenOf,
|
|
81
|
+
ancestorsOf,
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
exports.compileRenderTree = compileRenderTree;
|
|
85
|
+
//# sourceMappingURL=render-tree-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-tree-compiler.js","sourceRoot":"","sources":["../../src/runtime/render-tree-compiler.ts"],"names":[],"mappings":";;;AACA,gDAAuD;AAWhD,MAAM,iBAAiB,GAAG,CAAC,KAAiB,EAAsB,EAAE;IACzE,MAAM,IAAI,GAAG,yBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5F,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,MAAM,qBAAqB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IAC9F,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,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GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAyB,EAAE;QAC5D,IAAI,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC;QAC7D,MAAM,SAAS,GAAiB,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACvC,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAE,CAAC;YACzC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,IAAI;QACJ,SAAS;QACT,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,UAAU;QACV,WAAW;KACZ,CAAC,CAAC;AACL,CAAC,CAAC;AAzEW,QAAA,iBAAiB,qBAyE5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ThemeTokens } from '../contracts/theme';
|
|
2
|
+
import type { TenantProductConfig, TenantRuntimeConfig } from '../contracts/tenant';
|
|
3
|
+
export interface CompileTenantRuntimeConfigInput {
|
|
4
|
+
productConfig: TenantProductConfig;
|
|
5
|
+
resolvedDesignTokens: ThemeTokens;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Builds the only browser-facing tenant configuration projection.
|
|
9
|
+
* The source list is deliberately not copied, and resolving again guarantees
|
|
10
|
+
* that aliases cannot escape the server boundary.
|
|
11
|
+
*/
|
|
12
|
+
export declare const compileTenantRuntimeConfig: (input: CompileTenantRuntimeConfigInput) => TenantRuntimeConfig;
|
|
13
|
+
//# sourceMappingURL=tenant-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-config.d.ts","sourceRoot":"","sources":["../../src/runtime/tenant-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAO7B,MAAM,WAAW,+BAA+B;IAC9C,aAAa,EAAE,mBAAmB,CAAC;IACnC,oBAAoB,EAAE,WAAW,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,UAC9B,+BAA+B,KACrC,mBAmBF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileTenantRuntimeConfig = void 0;
|
|
4
|
+
const tenant_1 = require("../contracts/tenant");
|
|
5
|
+
const theme_tokens_1 = require("./theme-tokens");
|
|
6
|
+
/**
|
|
7
|
+
* Builds the only browser-facing tenant configuration projection.
|
|
8
|
+
* The source list is deliberately not copied, and resolving again guarantees
|
|
9
|
+
* that aliases cannot escape the server boundary.
|
|
10
|
+
*/
|
|
11
|
+
const compileTenantRuntimeConfig = (input) => {
|
|
12
|
+
const productConfig = tenant_1.TenantProductConfigSchema.parse(input.productConfig);
|
|
13
|
+
const designTokens = (0, theme_tokens_1.resolveThemeTokens)(input.resolvedDesignTokens).resolvedDocument;
|
|
14
|
+
return Object.freeze(tenant_1.TenantRuntimeConfigSchema.parse({
|
|
15
|
+
contract: 'TenantRuntimeConfig',
|
|
16
|
+
tenantId: productConfig.tenantId,
|
|
17
|
+
appId: productConfig.appId,
|
|
18
|
+
environment: productConfig.environment,
|
|
19
|
+
designTokens,
|
|
20
|
+
moduleRefs: productConfig.moduleRefs,
|
|
21
|
+
pageRefs: productConfig.pageRefs,
|
|
22
|
+
featureFlags: productConfig.featureFlags,
|
|
23
|
+
authBinding: productConfig.authBinding,
|
|
24
|
+
dataBinding: productConfig.dataBinding,
|
|
25
|
+
sourceMap: productConfig.sourceMap,
|
|
26
|
+
warnings: productConfig.warnings,
|
|
27
|
+
applicationConfig: productConfig.applicationConfig,
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
exports.compileTenantRuntimeConfig = compileTenantRuntimeConfig;
|
|
31
|
+
//# sourceMappingURL=tenant-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-config.js","sourceRoot":"","sources":["../../src/runtime/tenant-config.ts"],"names":[],"mappings":";;;AAKA,gDAG6B;AAC7B,iDAAoD;AAOpD;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CACxC,KAAsC,EACjB,EAAE;IACvB,MAAM,aAAa,GAAG,kCAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG,IAAA,iCAAkB,EAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,gBAAgB,CAAC;IAErF,OAAO,MAAM,CAAC,MAAM,CAAC,kCAAyB,CAAC,KAAK,CAAC;QACnD,QAAQ,EAAE,qBAAqB;QAC/B,QAAQ,EAAE,aAAa,CAAC,QAAQ;QAChC,KAAK,EAAE,aAAa,CAAC,KAAK;QAC1B,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,YAAY;QACZ,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,QAAQ,EAAE,aAAa,CAAC,QAAQ;QAChC,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,QAAQ,EAAE,aAAa,CAAC,QAAQ;QAChC,iBAAiB,EAAE,aAAa,CAAC,iBAAiB;KACnD,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AArBW,QAAA,0BAA0B,8BAqBrC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TenantAuthBinding, TenantDataBinding, TenantRuntimeConfig } from '../contracts/tenant';
|
|
2
|
+
export interface TenantRuntimeBindingPolicy {
|
|
3
|
+
authProviderIds: readonly string[];
|
|
4
|
+
dataProviderIds: readonly string[];
|
|
5
|
+
projectionRefs?: readonly string[];
|
|
6
|
+
requiredAuthBindings?: readonly string[];
|
|
7
|
+
requiredDataBindings?: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export interface CompiledTenantRuntimeBindings {
|
|
10
|
+
readonly auth: Readonly<Record<string, TenantAuthBinding>>;
|
|
11
|
+
readonly data: Readonly<Record<string, TenantDataBinding>>;
|
|
12
|
+
requireAuth(bindingId?: string): TenantAuthBinding;
|
|
13
|
+
requireData(bindingId?: string): TenantDataBinding;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compiles tenant provider references against the providers actually shipped by
|
|
17
|
+
* a product. This is the browser-side fail-closed boundary: a typo or an
|
|
18
|
+
* uninstalled provider cannot silently fall back to a legacy endpoint.
|
|
19
|
+
*/
|
|
20
|
+
export declare const compileTenantRuntimeBindings: (config: Pick<TenantRuntimeConfig, 'authBinding' | 'dataBinding'>, policy: TenantRuntimeBindingPolicy) => CompiledTenantRuntimeBindings;
|
|
21
|
+
//# sourceMappingURL=tenant-runtime-bindings.d.ts.map
|