@cratis/scene.engine 4.12.0 → 4.13.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/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/NavigationDiagnosticCode.js +19 -0
- package/dist/cjs/navigation/NavigationDiagnosticCode.js.map +1 -0
- package/dist/cjs/navigation/collectOutlets.js +45 -0
- package/dist/cjs/navigation/collectOutlets.js.map +1 -0
- package/dist/cjs/navigation/diagnoseNavigation.js +116 -0
- package/dist/cjs/navigation/diagnoseNavigation.js.map +1 -0
- package/dist/cjs/navigation/findHostingCycles.js +43 -0
- package/dist/cjs/navigation/findHostingCycles.js.map +1 -0
- package/dist/cjs/navigation/navigationEntriesFrom.js +19 -0
- package/dist/cjs/navigation/navigationEntriesFrom.js.map +1 -0
- package/dist/cjs/navigation/navigationRoute.js +25 -0
- package/dist/cjs/navigation/navigationRoute.js.map +1 -0
- package/dist/cjs/packageVersionRange.js +16 -0
- package/dist/cjs/packageVersionRange.js.map +1 -1
- package/dist/cjs/templates/TemplateCatalogKind.js +15 -0
- package/dist/cjs/templates/TemplateCatalogKind.js.map +1 -0
- package/dist/cjs/templates/describeTemplateCatalog.js +89 -0
- package/dist/cjs/templates/describeTemplateCatalog.js.map +1 -0
- package/dist/cjs/templates/templateMetadataRules.js +32 -0
- package/dist/cjs/templates/templateMetadataRules.js.map +1 -0
- package/dist/cjs/templates/validateTemplateMetadata.js +50 -0
- package/dist/cjs/templates/validateTemplateMetadata.js.map +1 -0
- package/dist/cjs/validateNavigationDestinations.js +12 -38
- package/dist/cjs/validateNavigationDestinations.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/NavigationDiagnostic.d.ts +7 -0
- package/dist/esm/navigation/NavigationDiagnostic.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationDiagnostic.js +2 -0
- package/dist/esm/navigation/NavigationDiagnostic.js.map +1 -0
- package/dist/esm/navigation/NavigationDiagnosticCode.d.ts +9 -0
- package/dist/esm/navigation/NavigationDiagnosticCode.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationDiagnosticCode.js +17 -0
- package/dist/esm/navigation/NavigationDiagnosticCode.js.map +1 -0
- package/dist/esm/navigation/NavigationEntry.d.ts +6 -0
- package/dist/esm/navigation/NavigationEntry.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationEntry.js +2 -0
- package/dist/esm/navigation/NavigationEntry.js.map +1 -0
- package/dist/esm/navigation/NavigationGraph.d.ts +10 -0
- package/dist/esm/navigation/NavigationGraph.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationGraph.js +2 -0
- package/dist/esm/navigation/NavigationGraph.js.map +1 -0
- package/dist/esm/navigation/OutletOwner.d.ts +7 -0
- package/dist/esm/navigation/OutletOwner.d.ts.map +1 -0
- package/dist/esm/navigation/OutletOwner.js +2 -0
- package/dist/esm/navigation/OutletOwner.js.map +1 -0
- package/dist/esm/navigation/collectOutlets.d.ts +5 -0
- package/dist/esm/navigation/collectOutlets.d.ts.map +1 -0
- package/dist/esm/navigation/collectOutlets.js +43 -0
- package/dist/esm/navigation/collectOutlets.js.map +1 -0
- package/dist/esm/navigation/diagnoseNavigation.d.ts +5 -0
- package/dist/esm/navigation/diagnoseNavigation.d.ts.map +1 -0
- package/dist/esm/navigation/diagnoseNavigation.js +114 -0
- package/dist/esm/navigation/diagnoseNavigation.js.map +1 -0
- package/dist/esm/navigation/findHostingCycles.d.ts +2 -0
- package/dist/esm/navigation/findHostingCycles.d.ts.map +1 -0
- package/dist/esm/navigation/findHostingCycles.js +41 -0
- package/dist/esm/navigation/findHostingCycles.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +8 -0
- package/dist/esm/navigation/index.d.ts.map +1 -0
- package/dist/esm/navigation/index.js +8 -0
- package/dist/esm/navigation/index.js.map +1 -0
- package/dist/esm/navigation/navigationEntriesFrom.d.ts +4 -0
- package/dist/esm/navigation/navigationEntriesFrom.d.ts.map +1 -0
- package/dist/esm/navigation/navigationEntriesFrom.js +17 -0
- package/dist/esm/navigation/navigationEntriesFrom.js.map +1 -0
- package/dist/esm/navigation/navigationRoute.d.ts +5 -0
- package/dist/esm/navigation/navigationRoute.d.ts.map +1 -0
- package/dist/esm/navigation/navigationRoute.js +22 -0
- package/dist/esm/navigation/navigationRoute.js.map +1 -0
- package/dist/esm/packageVersionRange.d.ts +2 -0
- package/dist/esm/packageVersionRange.d.ts.map +1 -1
- package/dist/esm/packageVersionRange.js +15 -1
- package/dist/esm/packageVersionRange.js.map +1 -1
- package/dist/esm/templates/TemplateCatalogEntry.d.ts +20 -0
- package/dist/esm/templates/TemplateCatalogEntry.d.ts.map +1 -0
- package/dist/esm/templates/TemplateCatalogEntry.js +2 -0
- package/dist/esm/templates/TemplateCatalogEntry.js.map +1 -0
- package/dist/esm/templates/TemplateCatalogKind.d.ts +6 -0
- package/dist/esm/templates/TemplateCatalogKind.d.ts.map +1 -0
- package/dist/esm/templates/TemplateCatalogKind.js +13 -0
- package/dist/esm/templates/TemplateCatalogKind.js.map +1 -0
- package/dist/esm/templates/TemplateSource.d.ts +8 -0
- package/dist/esm/templates/TemplateSource.d.ts.map +1 -0
- package/dist/esm/templates/TemplateSource.js +2 -0
- package/dist/esm/templates/TemplateSource.js.map +1 -0
- package/dist/esm/templates/describeTemplateCatalog.d.ts +4 -0
- package/dist/esm/templates/describeTemplateCatalog.d.ts.map +1 -0
- package/dist/esm/templates/describeTemplateCatalog.js +87 -0
- package/dist/esm/templates/describeTemplateCatalog.js.map +1 -0
- package/dist/esm/templates/index.d.ts +7 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +7 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/templateMetadataRules.d.ts +3 -0
- package/dist/esm/templates/templateMetadataRules.d.ts.map +1 -0
- package/dist/esm/templates/templateMetadataRules.js +29 -0
- package/dist/esm/templates/templateMetadataRules.js.map +1 -0
- package/dist/esm/templates/validateTemplateMetadata.d.ts +3 -0
- package/dist/esm/templates/validateTemplateMetadata.d.ts.map +1 -0
- package/dist/esm/templates/validateTemplateMetadata.js +48 -0
- package/dist/esm/templates/validateTemplateMetadata.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/validateNavigationDestinations.d.ts +5 -5
- package/dist/esm/validateNavigationDestinations.d.ts.map +1 -1
- package/dist/esm/validateNavigationDestinations.js +12 -38
- package/dist/esm/validateNavigationDestinations.js.map +1 -1
- package/index.ts +2 -0
- package/navigation/NavigationDiagnostic.ts +18 -0
- package/navigation/NavigationDiagnosticCode.ts +26 -0
- package/navigation/NavigationEntry.ts +16 -0
- package/navigation/NavigationGraph.ts +26 -0
- package/navigation/OutletOwner.ts +13 -0
- package/navigation/collectOutlets.ts +36 -0
- package/navigation/diagnoseNavigation.ts +136 -0
- package/navigation/findHostingCycles.ts +41 -0
- package/navigation/index.ts +10 -0
- package/navigation/navigationEntriesFrom.ts +16 -0
- package/navigation/navigationRoute.ts +25 -0
- package/package.json +3 -3
- package/packageVersionRange.ts +18 -0
- package/templates/TemplateCatalogEntry.ts +35 -0
- package/templates/TemplateCatalogKind.ts +11 -0
- package/templates/TemplateSource.ts +15 -0
- package/templates/describeTemplateCatalog.ts +92 -0
- package/templates/index.ts +9 -0
- package/templates/templateMetadataRules.ts +25 -0
- package/templates/validateTemplateMetadata.ts +55 -0
- package/validateNavigationDestinations.ts +12 -32
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Whether a value is an absolute `https` URL with a host - the only kind of link a template browser
|
|
7
|
+
* should follow for attribution or license terms. Kept to plain string rules so the C# twin matches exactly.
|
|
8
|
+
*/ function isAbsoluteHttpsUrl(value) {
|
|
9
|
+
const prefix = 'https://';
|
|
10
|
+
return value.startsWith(prefix) && value.length > prefix.length && value[prefix.length] !== '/' && !/\s/.test(value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether a value is a simple SPDX license expression: identifiers such as `MIT`, `Apache-2.0` or
|
|
14
|
+
* `LicenseRef-Acme`, optionally joined by `AND`, `OR` or `WITH`. Parentheses are not supported.
|
|
15
|
+
*/ function isSpdxExpression(value) {
|
|
16
|
+
const tokens = value.split(' ');
|
|
17
|
+
if (tokens.length % 2 === 0) return false;
|
|
18
|
+
return tokens.every((token, index)=>index % 2 === 1 ? [
|
|
19
|
+
'AND',
|
|
20
|
+
'OR',
|
|
21
|
+
'WITH'
|
|
22
|
+
].includes(token) : isSpdxIdentifier(token));
|
|
23
|
+
}
|
|
24
|
+
function isSpdxIdentifier(token) {
|
|
25
|
+
return token.length > 0 && [
|
|
26
|
+
...token
|
|
27
|
+
].every((character)=>/[A-Za-z0-9.+-]/.test(character));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.isAbsoluteHttpsUrl = isAbsoluteHttpsUrl;
|
|
31
|
+
exports.isSpdxExpression = isSpdxExpression;
|
|
32
|
+
//# sourceMappingURL=templateMetadataRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateMetadataRules.js","sources":["../../../templates/templateMetadataRules.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Whether a value is an absolute `https` URL with a host - the only kind of link a template browser\n * should follow for attribution or license terms. Kept to plain string rules so the C# twin matches exactly.\n */\nexport function isAbsoluteHttpsUrl(value: string): boolean {\n const prefix = 'https://';\n return value.startsWith(prefix) && value.length > prefix.length && value[prefix.length] !== '/' && !/\\s/.test(value);\n}\n\n/**\n * Whether a value is a simple SPDX license expression: identifiers such as `MIT`, `Apache-2.0` or\n * `LicenseRef-Acme`, optionally joined by `AND`, `OR` or `WITH`. Parentheses are not supported.\n */\nexport function isSpdxExpression(value: string): boolean {\n const tokens = value.split(' ');\n if (tokens.length % 2 === 0) return false;\n return tokens.every((token, index) => (index % 2 === 1 ? ['AND', 'OR', 'WITH'].includes(token) : isSpdxIdentifier(token)));\n}\n\nfunction isSpdxIdentifier(token: string): boolean {\n return token.length > 0 && [...token].every(character => /[A-Za-z0-9.+-]/.test(character));\n}\n"],"names":["isAbsoluteHttpsUrl","value","prefix","startsWith","length","test","isSpdxExpression","tokens","split","every","token","index","includes","isSpdxIdentifier","character"],"mappings":";;AAAA;AACA;AAEA;;;IAIO,SAASA,kBAAAA,CAAmBC,KAAa,EAAA;AAC5C,IAAA,MAAMC,MAAAA,GAAS,UAAA;IACf,OAAOD,KAAAA,CAAME,UAAU,CAACD,MAAAA,CAAAA,IAAWD,MAAMG,MAAM,GAAGF,OAAOE,MAAM,IAAIH,KAAK,CAACC,MAAAA,CAAOE,MAAM,CAAC,KAAK,OAAO,CAAC,IAAA,CAAKC,IAAI,CAACJ,KAAAA,CAAAA;AAClH;AAEA;;;IAIO,SAASK,gBAAAA,CAAiBL,KAAa,EAAA;IAC1C,MAAMM,MAAAA,GAASN,KAAAA,CAAMO,KAAK,CAAC,GAAA,CAAA;AAC3B,IAAA,IAAID,MAAAA,CAAOH,MAAM,GAAG,CAAA,KAAM,GAAG,OAAO,KAAA;IACpC,OAAOG,MAAAA,CAAOE,KAAK,CAAC,CAACC,OAAOC,KAAAA,GAAWA,KAAAA,GAAQ,MAAM,CAAA,GAAI;AAAC,YAAA,KAAA;AAAO,YAAA,IAAA;AAAM,YAAA;SAAO,CAACC,QAAQ,CAACF,KAAAA,CAAAA,GAASG,gBAAAA,CAAiBH,KAAAA,CAAAA,CAAAA;AACtH;AAEA,SAASG,iBAAiBH,KAAa,EAAA;IACnC,OAAOA,KAAAA,CAAMN,MAAM,GAAG,CAAA,IAAK;AAAIM,QAAAA,GAAAA;AAAM,KAAA,CAACD,KAAK,CAACK,CAAAA,SAAAA,GAAa,gBAAA,CAAiBT,IAAI,CAACS,SAAAA,CAAAA,CAAAA;AACnF;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var packageVersionRange = require('../packageVersionRange.js');
|
|
4
|
+
var templateMetadataRules = require('./templateMetadataRules.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* Checks that a template carries the compatibility, attribution and license metadata every shipped template
|
|
10
|
+
* needs, and that each value is well formed. The C# engine (`TemplateMetadataValidation.Validate`) reports the
|
|
11
|
+
* same problems in the same order; both are asserted against `template-metadata-fixtures.json`.
|
|
12
|
+
*/ function validateTemplateMetadata(name, metadata) {
|
|
13
|
+
const problems = [];
|
|
14
|
+
const compatibility = metadata?.compatibility;
|
|
15
|
+
if (!compatibility) {
|
|
16
|
+
problems.push(`Template '${name}' declares no compatibility`);
|
|
17
|
+
} else {
|
|
18
|
+
if (!compatibility.scene?.trim()) {
|
|
19
|
+
problems.push(`Template '${name}' declares no Scene version range`);
|
|
20
|
+
} else if (!packageVersionRange.isValidVersionRange(compatibility.scene)) {
|
|
21
|
+
problems.push(`Template '${name}' declares an invalid Scene version range '${compatibility.scene}'`);
|
|
22
|
+
}
|
|
23
|
+
for (const requirement of compatibility.packages ?? []){
|
|
24
|
+
if (!requirement.name?.trim()) {
|
|
25
|
+
problems.push(`Template '${name}' declares a package requirement without a name`);
|
|
26
|
+
} else if (!packageVersionRange.isValidVersionRange(requirement.versionRange)) {
|
|
27
|
+
problems.push(`Template '${name}' declares an invalid version range '${requirement.versionRange}' for package '${requirement.name}'`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const attribution = metadata?.attribution;
|
|
32
|
+
if (!attribution?.author?.trim()) {
|
|
33
|
+
problems.push(`Template '${name}' declares no author`);
|
|
34
|
+
}
|
|
35
|
+
if (attribution?.url !== undefined && !templateMetadataRules.isAbsoluteHttpsUrl(attribution.url)) {
|
|
36
|
+
problems.push(`Template '${name}' declares an attribution URL '${attribution.url}' that is not an absolute https URL`);
|
|
37
|
+
}
|
|
38
|
+
if (!metadata?.license?.trim()) {
|
|
39
|
+
problems.push(`Template '${name}' declares no license`);
|
|
40
|
+
} else if (!templateMetadataRules.isSpdxExpression(metadata.license)) {
|
|
41
|
+
problems.push(`Template '${name}' declares '${metadata.license}', which is not an SPDX license expression`);
|
|
42
|
+
}
|
|
43
|
+
if (metadata?.licenseUrl !== undefined && !templateMetadataRules.isAbsoluteHttpsUrl(metadata.licenseUrl)) {
|
|
44
|
+
problems.push(`Template '${name}' declares a license URL '${metadata.licenseUrl}' that is not an absolute https URL`);
|
|
45
|
+
}
|
|
46
|
+
return problems;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
exports.validateTemplateMetadata = validateTemplateMetadata;
|
|
50
|
+
//# sourceMappingURL=validateTemplateMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateTemplateMetadata.js","sources":["../../../templates/validateTemplateMetadata.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { TemplateMetadata } from '@cratis/scene.model';\nimport { isValidVersionRange } from '../packageVersionRange';\nimport { isAbsoluteHttpsUrl, isSpdxExpression } from './templateMetadataRules';\n\n/**\n * Checks that a template carries the compatibility, attribution and license metadata every shipped template\n * needs, and that each value is well formed. The C# engine (`TemplateMetadataValidation.Validate`) reports the\n * same problems in the same order; both are asserted against `template-metadata-fixtures.json`.\n */\nexport function validateTemplateMetadata(name: string, metadata: TemplateMetadata | undefined): string[] {\n const problems: string[] = [];\n const compatibility = metadata?.compatibility;\n\n if (!compatibility) {\n problems.push(`Template '${name}' declares no compatibility`);\n } else {\n if (!compatibility.scene?.trim()) {\n problems.push(`Template '${name}' declares no Scene version range`);\n } else if (!isValidVersionRange(compatibility.scene)) {\n problems.push(`Template '${name}' declares an invalid Scene version range '${compatibility.scene}'`);\n }\n\n for (const requirement of compatibility.packages ?? []) {\n if (!requirement.name?.trim()) {\n problems.push(`Template '${name}' declares a package requirement without a name`);\n } else if (!isValidVersionRange(requirement.versionRange)) {\n problems.push(`Template '${name}' declares an invalid version range '${requirement.versionRange}' for package '${requirement.name}'`);\n }\n }\n }\n\n const attribution = metadata?.attribution;\n if (!attribution?.author?.trim()) {\n problems.push(`Template '${name}' declares no author`);\n }\n\n if (attribution?.url !== undefined && !isAbsoluteHttpsUrl(attribution.url)) {\n problems.push(`Template '${name}' declares an attribution URL '${attribution.url}' that is not an absolute https URL`);\n }\n\n if (!metadata?.license?.trim()) {\n problems.push(`Template '${name}' declares no license`);\n } else if (!isSpdxExpression(metadata.license)) {\n problems.push(`Template '${name}' declares '${metadata.license}', which is not an SPDX license expression`);\n }\n\n if (metadata?.licenseUrl !== undefined && !isAbsoluteHttpsUrl(metadata.licenseUrl)) {\n problems.push(`Template '${name}' declares a license URL '${metadata.licenseUrl}' that is not an absolute https URL`);\n }\n\n return problems;\n}\n"],"names":["validateTemplateMetadata","name","metadata","problems","compatibility","push","scene","trim","isValidVersionRange","requirement","packages","versionRange","attribution","author","url","undefined","isAbsoluteHttpsUrl","license","isSpdxExpression","licenseUrl"],"mappings":";;;;;AAAA;AACA;AAMA;;;;AAIC,IACM,SAASA,wBAAAA,CAAyBC,IAAY,EAAEC,QAAsC,EAAA;AACzF,IAAA,MAAMC,WAAqB,EAAE;AAC7B,IAAA,MAAMC,gBAAgBF,QAAAA,EAAUE,aAAAA;AAEhC,IAAA,IAAI,CAACA,aAAAA,EAAe;AAChBD,QAAAA,QAAAA,CAASE,IAAI,CAAC,CAAC,UAAU,EAAEJ,IAAAA,CAAK,2BAA2B,CAAC,CAA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a,CAACC,wCAAAA,CAAmBJ,WAAAA,CAAYE,GAAG,CAAA,EAAG;AACxEX,QAAAA,QAAAA,CAASE,IAAI,CAAC,CAAC,UAAU,EAAEJ,IAAAA,CAAK,+BAA+B,EAAEW,WAAAA,CAAYE,GAAG,CAAC,mCAAmC,CAAC,CAAA;AACzH,IAAA;IAEA,IAAI,CAACZ,QAAAA,EAAUe,OAAAA,EAASV,IAAAA,EAAAA,EAAQ;AAC5BJ,QAAAA,QAAAA,CAASE,IAAI,CAAC,CAAC,UAAU,EAAEJ,IAAAA,CAAK,qBAAqB,CAAC,CAAA;AAC1D,IAAA,CAAA,MAAO,IAAI,CAACiB,sCAAAA,CAAiBhB,QAAAA,CAASe,OAAO,CAAA,EAAG;AAC5Cd,QAAAA,QAAAA,CAASE,IAAI,CAAC,CAAC,UAAU,EAAEJ,IAAAA,CAAK,YAAY,EAAEC,QAAAA,CAASe,OAAO,CAAC,0CAA0C,CAAC,CAAA;AAC9G,IAAA;AAEA,IAAA,IAAIf,UAAUiB,UAAAA,KAAeJ,SAAAA,IAAa,CAACC,wCAAAA,CAAmBd,QAAAA,CAASiB,UAAU,CAAA,EAAG;AAChFhB,QAAAA,QAAAA,CAASE,IAAI,CAAC,CAAC,UAAU,EAAEJ,IAAAA,CAAK,0BAA0B,EAAEC,QAAAA,CAASiB,UAAU,CAAC,mCAAmC,CAAC,CAAA;AACxH,IAAA;IAEA,OAAOhB,QAAAA;AACX;;"}
|
|
@@ -1,47 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var diagnoseNavigation = require('./navigation/diagnoseNavigation.js');
|
|
4
|
+
|
|
3
5
|
// Copyright (c) Cratis. All rights reserved.
|
|
4
6
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
7
|
/**
|
|
6
|
-
* Validates destinations against the outlet/route declarations owned by layouts and templates
|
|
8
|
+
* Validates destinations against the outlet/route declarations owned by layouts and templates, and - when
|
|
9
|
+
* the screens and dialog templates are given - against the targets that actually exist.
|
|
10
|
+
*
|
|
11
|
+
* A shorthand for {@link diagnoseNavigation} over destinations without entry identities.
|
|
7
12
|
*/ function validateNavigationDestinations(destinations, surfaces = {}) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
...surfaces
|
|
13
|
-
|
|
14
|
-
]){
|
|
15
|
-
for (const outlet of surface.outlets ?? []){
|
|
16
|
-
if (outlets.has(outlet.name)) diagnostics.push({
|
|
17
|
-
code: 'duplicateOutlet',
|
|
18
|
-
message: `Outlet '${outlet.name}' is declared more than once.`
|
|
19
|
-
});
|
|
20
|
-
outlets.add(outlet.name);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
for (const destination of destinations){
|
|
24
|
-
if (destination.outlet && !outlets.has(destination.outlet)) {
|
|
25
|
-
diagnostics.push({
|
|
26
|
-
code: 'missingOutlet',
|
|
27
|
-
message: `Destination targets missing outlet '${destination.outlet}'.`
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (destination.route) {
|
|
31
|
-
if (routes.has(destination.route)) diagnostics.push({
|
|
32
|
-
code: 'duplicateRoute',
|
|
33
|
-
message: `Route '${destination.route}' is used by more than one destination.`
|
|
34
|
-
});
|
|
35
|
-
routes.add(destination.route);
|
|
36
|
-
}
|
|
37
|
-
if (!destination.screen && !destination.module && !destination.route && !destination.dialog) {
|
|
38
|
-
diagnostics.push({
|
|
39
|
-
code: 'unavailableTarget',
|
|
40
|
-
message: 'Destination must name a screen, stable identity, route or dialog.'
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return diagnostics;
|
|
13
|
+
return diagnoseNavigation.diagnoseNavigation({
|
|
14
|
+
entries: destinations.map((destination)=>({
|
|
15
|
+
destination
|
|
16
|
+
})),
|
|
17
|
+
...surfaces
|
|
18
|
+
});
|
|
45
19
|
}
|
|
46
20
|
|
|
47
21
|
exports.validateNavigationDestinations = validateNavigationDestinations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateNavigationDestinations.js","sources":["../../validateNavigationDestinations.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DestinationReference, Layout, ScreenTemplate } from '@cratis/scene.model';\n\
|
|
1
|
+
{"version":3,"file":"validateNavigationDestinations.js","sources":["../../validateNavigationDestinations.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DestinationReference, DialogTemplate, Layout, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { NavigationDiagnostic, diagnoseNavigation } from './navigation';\n\n/**\n * A navigation problem as {@link validateNavigationDestinations} reports it.\n */\nexport type NavigationDestinationDiagnostic = NavigationDiagnostic;\n\n/**\n * Validates destinations against the outlet/route declarations owned by layouts and templates, and - when\n * the screens and dialog templates are given - against the targets that actually exist.\n *\n * A shorthand for {@link diagnoseNavigation} over destinations without entry identities.\n */\nexport function validateNavigationDestinations(\n destinations: DestinationReference[],\n surfaces: { layouts?: Layout[]; screenTemplates?: ScreenTemplate[]; screens?: Screen[]; dialogTemplates?: DialogTemplate[] } = {},\n): NavigationDestinationDiagnostic[] {\n return diagnoseNavigation({ entries: destinations.map(destination => ({ destination })), ...surfaces });\n}\n"],"names":["validateNavigationDestinations","destinations","surfaces","diagnoseNavigation","entries","map","destination"],"mappings":";;;;AAAA;AACA;AAUA;;;;;AAKC,IACM,SAASA,8BAAAA,CACZC,YAAoC,EACpCC,QAAAA,GAA+H,EAAE,EAAA;AAEjI,IAAA,OAAOC,qCAAAA,CAAmB;AAAEC,QAAAA,OAAAA,EAASH,YAAAA,CAAaI,GAAG,CAACC,CAAAA,eAAgB;AAAEA,gBAAAA;aAAY,CAAA,CAAA;AAAK,QAAA,GAAGJ;AAAS,KAAA,CAAA;AACzG;;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -24,12 +24,14 @@ export * from './resolvePackageDependencies';
|
|
|
24
24
|
export * from './packageCatalog';
|
|
25
25
|
export * from './resolveScreenTemplates';
|
|
26
26
|
export * from './templateApplicability';
|
|
27
|
+
export * from './templates';
|
|
27
28
|
export * from './buildStarterProfile';
|
|
28
29
|
export * from './incompatibleStarterThemes';
|
|
29
30
|
export * from './ActionDispatcher';
|
|
30
31
|
export * from './runActions';
|
|
31
32
|
export * from './resolveBehaviors';
|
|
32
33
|
export * from './resolveStrings';
|
|
34
|
+
export * from './navigation';
|
|
33
35
|
export * from './validateNavigationDestinations';
|
|
34
36
|
export * from './editing';
|
|
35
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC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/dist/esm/index.js
CHANGED
|
@@ -26,16 +26,24 @@ export { evaluateFreeformSlotArrangement } from './evaluateFreeformSlotArrangeme
|
|
|
26
26
|
export { aggregateContributions } from './aggregateContributions.js';
|
|
27
27
|
export { applicableThemePackages, incompatiblePackages, isThemeCompatible } from './themeCompatibility.js';
|
|
28
28
|
export { isPackageSelectionValid } from './PackageSelection.js';
|
|
29
|
-
export { isVersionSatisfiedBy } from './packageVersionRange.js';
|
|
29
|
+
export { isValidVersion, isValidVersionRange, isVersionSatisfiedBy } from './packageVersionRange.js';
|
|
30
30
|
export { resolvePackageDependencies } from './resolvePackageDependencies.js';
|
|
31
31
|
export { availablePackagesFor, baseComponentLibraries, componentsForPackages, packagesOfKind, toComponentCatalog } from './packageCatalog.js';
|
|
32
32
|
export { isScreenTemplateResolutionValid, resolveScreenTemplates } from './resolveScreenTemplates.js';
|
|
33
33
|
export { filterApplicableScreenTemplates, validateDialogTemplateApplicability, validateLayoutApplicability, validateScreenTemplateApplicability } from './templateApplicability.js';
|
|
34
|
+
export { TemplateCatalogKind } from './templates/TemplateCatalogKind.js';
|
|
35
|
+
export { describeTemplateCatalog } from './templates/describeTemplateCatalog.js';
|
|
36
|
+
export { isAbsoluteHttpsUrl, isSpdxExpression } from './templates/templateMetadataRules.js';
|
|
37
|
+
export { validateTemplateMetadata } from './templates/validateTemplateMetadata.js';
|
|
34
38
|
export { buildStarterProfile } from './buildStarterProfile.js';
|
|
35
39
|
export { incompatibleStarterThemes } from './incompatibleStarterThemes.js';
|
|
36
40
|
export { InteractionStop, runActions, runBindings } from './runActions.js';
|
|
37
41
|
export { resolveApplicationTriggerBehaviors, resolveBehaviors, resolveEventBehaviors, resolveIntervalBehaviors } from './resolveBehaviors.js';
|
|
38
42
|
export { isStringsReference, resolveStringsInElement, resolveStringsValue } from './resolveStrings.js';
|
|
43
|
+
export { NavigationDiagnosticCode } from './navigation/NavigationDiagnosticCode.js';
|
|
44
|
+
export { diagnoseNavigation } from './navigation/diagnoseNavigation.js';
|
|
45
|
+
export { navigationEntriesFrom } from './navigation/navigationEntriesFrom.js';
|
|
46
|
+
export { authoredRouteKey, navigationTarget } from './navigation/navigationRoute.js';
|
|
39
47
|
export { validateNavigationDestinations } from './validateNavigationDestinations.js';
|
|
40
48
|
export { errorDiagnostic, hasErrors, warningDiagnostic } from './editing/diagnostics.js';
|
|
41
49
|
export { dialogTemplateNodeId, elementNodeId, flowNodeId, freeformNodeId, layoutNodeId, ownerArrangementId, placementNodeId, scopeInstanceId, scopeNodeId, screenNodeId, screenTemplateNodeId, slotNodeId } from './editing/nodeIds.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDiagnostic.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationDiagnostic.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,oBAAoB;IAEjC,IAAI,EAAE,wBAAwB,CAAC;IAG/B,OAAO,EAAE,MAAM,CAAC;IAGhB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDiagnostic.js","sourceRoot":"","sources":["../../../navigation/NavigationDiagnostic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum NavigationDiagnosticCode {
|
|
2
|
+
DuplicateRoute = "duplicateRoute",
|
|
3
|
+
DuplicateOutlet = "duplicateOutlet",
|
|
4
|
+
MissingOutlet = "missingOutlet",
|
|
5
|
+
IncompatibleOutlet = "incompatibleOutlet",
|
|
6
|
+
NavigationCycle = "navigationCycle",
|
|
7
|
+
UnavailableTarget = "unavailableTarget"
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NavigationDiagnosticCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDiagnosticCode.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationDiagnosticCode.ts"],"names":[],"mappings":"AAOA,oBAAY,wBAAwB;IAEhC,cAAc,mBAAmB;IAGjC,eAAe,oBAAoB;IAGnC,aAAa,kBAAkB;IAG/B,kBAAkB,uBAAuB;IAGzC,eAAe,oBAAoB;IAGnC,iBAAiB,sBAAsB;CAC1C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/**
|
|
4
|
+
* What is wrong with a navigation destination. The values are shared with the C# engine so both report
|
|
5
|
+
* the same code for the same model.
|
|
6
|
+
*/ var NavigationDiagnosticCode = /*#__PURE__*/ function(NavigationDiagnosticCode) {
|
|
7
|
+
/** Two destinations that go to different targets share one URL. */ NavigationDiagnosticCode["DuplicateRoute"] = "duplicateRoute";
|
|
8
|
+
/** Two surfaces declare an outlet with the same name, so a destination cannot tell them apart. */ NavigationDiagnosticCode["DuplicateOutlet"] = "duplicateOutlet";
|
|
9
|
+
/** A destination names an outlet that no layout or screen template declares. */ NavigationDiagnosticCode["MissingOutlet"] = "missingOutlet";
|
|
10
|
+
/** A destination names an outlet that cannot host what it opens. */ NavigationDiagnosticCode["IncompatibleOutlet"] = "incompatibleOutlet";
|
|
11
|
+
/** Screens are placed in outlets owned by each other, so composition never terminates. */ NavigationDiagnosticCode["NavigationCycle"] = "navigationCycle";
|
|
12
|
+
/** A destination opens a screen or dialog that does not exist, or names nothing to open. */ NavigationDiagnosticCode["UnavailableTarget"] = "unavailableTarget";
|
|
13
|
+
return NavigationDiagnosticCode;
|
|
14
|
+
}({});
|
|
15
|
+
|
|
16
|
+
export { NavigationDiagnosticCode };
|
|
17
|
+
//# sourceMappingURL=NavigationDiagnosticCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDiagnosticCode.js","sources":["../../../navigation/NavigationDiagnosticCode.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * What is wrong with a navigation destination. The values are shared with the C# engine so both report\n * the same code for the same model.\n */\nexport enum NavigationDiagnosticCode {\n /** Two destinations that go to different targets share one URL. */\n DuplicateRoute = 'duplicateRoute',\n\n /** Two surfaces declare an outlet with the same name, so a destination cannot tell them apart. */\n DuplicateOutlet = 'duplicateOutlet',\n\n /** A destination names an outlet that no layout or screen template declares. */\n MissingOutlet = 'missingOutlet',\n\n /** A destination names an outlet that cannot host what it opens. */\n IncompatibleOutlet = 'incompatibleOutlet',\n\n /** Screens are placed in outlets owned by each other, so composition never terminates. */\n NavigationCycle = 'navigationCycle',\n\n /** A destination opens a screen or dialog that does not exist, or names nothing to open. */\n UnavailableTarget = 'unavailableTarget',\n}\n"],"names":["NavigationDiagnosticCode"],"mappings":"AAAA;AACA;AAEA;;;IAIO,IAAKA,wBAAAA,iBAAAA,SAAAA,wBAAAA,EAAAA;wEACyD,wBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;uGAG+B,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;qFAGlB,wBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;yEAGZ,wBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;+FAGsB,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;iGAGE,wBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA;AAhBlFA,IAAAA,OAAAA,wBAAAA;AAkBX,CAAA,CAAA,EAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationEntry.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationEntry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAM3D,MAAM,WAAW,eAAe;IAE5B,EAAE,CAAC,EAAE,MAAM,CAAC;IAGZ,WAAW,EAAE,oBAAoB,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationEntry.js","sourceRoot":"","sources":["../../../navigation/NavigationEntry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DialogTemplate, Layout, Screen, ScreenTemplate } from '@cratis/scene.model';
|
|
2
|
+
import { NavigationEntry } from './NavigationEntry';
|
|
3
|
+
export interface NavigationGraph {
|
|
4
|
+
entries: NavigationEntry[];
|
|
5
|
+
screens?: Screen[];
|
|
6
|
+
layouts?: Layout[];
|
|
7
|
+
screenTemplates?: ScreenTemplate[];
|
|
8
|
+
dialogTemplates?: DialogTemplate[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=NavigationGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationGraph.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD,MAAM,WAAW,eAAe;IAE5B,OAAO,EAAE,eAAe,EAAE,CAAC;IAG3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAGnC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationGraph.js","sourceRoot":"","sources":["../../../navigation/NavigationGraph.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutletOwner.d.ts","sourceRoot":"","sources":["../../../navigation/OutletOwner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,QAAQ,GAAG,gBAAgB,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutletOwner.js","sourceRoot":"","sources":["../../../navigation/OutletOwner.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigationDiagnostic } from './NavigationDiagnostic';
|
|
2
|
+
import { NavigationGraph } from './NavigationGraph';
|
|
3
|
+
import { OutletOwner } from './OutletOwner';
|
|
4
|
+
export declare function collectOutlets(graph: NavigationGraph, diagnostics: NavigationDiagnostic[]): Map<string, OutletOwner>;
|
|
5
|
+
//# sourceMappingURL=collectOutlets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectOutlets.d.ts","sourceRoot":"","sources":["../../../navigation/collectOutlets.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAuBpH"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NavigationDiagnosticCode } from './NavigationDiagnosticCode.js';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Indexes every declared outlet by name, keeping the first declaration and reporting each later one as a
|
|
7
|
+
* duplicate - a destination names an outlet only by name, so two of them are ambiguous.
|
|
8
|
+
*/ function collectOutlets(graph, diagnostics) {
|
|
9
|
+
const owners = new Map();
|
|
10
|
+
const surfaces = [
|
|
11
|
+
...(graph.layouts ?? []).map((layout)=>({
|
|
12
|
+
name: layout.name,
|
|
13
|
+
kind: 'Layout',
|
|
14
|
+
outlets: layout.outlets ?? []
|
|
15
|
+
})),
|
|
16
|
+
...(graph.screenTemplates ?? []).map((template)=>({
|
|
17
|
+
name: template.name,
|
|
18
|
+
kind: 'ScreenTemplate',
|
|
19
|
+
outlets: template.outlets ?? []
|
|
20
|
+
}))
|
|
21
|
+
];
|
|
22
|
+
for (const surface of surfaces){
|
|
23
|
+
for (const outlet of surface.outlets){
|
|
24
|
+
const existing = owners.get(outlet.name);
|
|
25
|
+
if (existing) {
|
|
26
|
+
diagnostics.push({
|
|
27
|
+
code: NavigationDiagnosticCode.DuplicateOutlet,
|
|
28
|
+
message: `Outlet '${outlet.name}' is declared by both '${existing.owner}' and '${surface.name}'; destinations cannot tell them apart.`
|
|
29
|
+
});
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
owners.set(outlet.name, {
|
|
33
|
+
outlet,
|
|
34
|
+
owner: surface.name,
|
|
35
|
+
ownerKind: surface.kind
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return owners;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { collectOutlets };
|
|
43
|
+
//# sourceMappingURL=collectOutlets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectOutlets.js","sources":["../../../navigation/collectOutlets.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { NavigationDiagnostic } from './NavigationDiagnostic';\nimport { NavigationDiagnosticCode } from './NavigationDiagnosticCode';\nimport { NavigationGraph } from './NavigationGraph';\nimport { OutletOwner } from './OutletOwner';\n\n/**\n * Indexes every declared outlet by name, keeping the first declaration and reporting each later one as a\n * duplicate - a destination names an outlet only by name, so two of them are ambiguous.\n */\nexport function collectOutlets(graph: NavigationGraph, diagnostics: NavigationDiagnostic[]): Map<string, OutletOwner> {\n const owners = new Map<string, OutletOwner>();\n const surfaces = [\n ...(graph.layouts ?? []).map(layout => ({ name: layout.name, kind: 'Layout' as const, outlets: layout.outlets ?? [] })),\n ...(graph.screenTemplates ?? []).map(template => ({ name: template.name, kind: 'ScreenTemplate' as const, outlets: template.outlets ?? [] })),\n ];\n\n for (const surface of surfaces) {\n for (const outlet of surface.outlets) {\n const existing = owners.get(outlet.name);\n if (existing) {\n diagnostics.push({\n code: NavigationDiagnosticCode.DuplicateOutlet,\n message: `Outlet '${outlet.name}' is declared by both '${existing.owner}' and '${surface.name}'; destinations cannot tell them apart.`,\n });\n continue;\n }\n\n owners.set(outlet.name, { outlet, owner: surface.name, ownerKind: surface.kind });\n }\n }\n\n return owners;\n}\n"],"names":["collectOutlets","graph","diagnostics","owners","Map","surfaces","layouts","map","layout","name","kind","outlets","screenTemplates","template","surface","outlet","existing","get","push","code","NavigationDiagnosticCode","DuplicateOutlet","message","owner","set","ownerKind"],"mappings":";;AAAA;AACA;AAOA;;;AAGC,IACM,SAASA,cAAAA,CAAeC,KAAsB,EAAEC,WAAmC,EAAA;AACtF,IAAA,MAAMC,SAAS,IAAIC,GAAAA,EAAAA;AACnB,IAAA,MAAMC,QAAAA,GAAW;WACV,CAACJ,KAAAA,CAAMK,OAAO,IAAI,EAAE,EAAEC,GAAG,CAACC,CAAAA,MAAAA,IAAW;AAAEC,gBAAAA,IAAAA,EAAMD,OAAOC,IAAI;gBAAEC,IAAAA,EAAM,QAAA;gBAAmBC,OAAAA,EAASH,MAAAA,CAAOG,OAAO,IAAI;aAAG,CAAA,CAAA;WACjH,CAACV,KAAAA,CAAMW,eAAe,IAAI,EAAE,EAAEL,GAAG,CAACM,CAAAA,QAAAA,IAAa;AAAEJ,gBAAAA,IAAAA,EAAMI,SAASJ,IAAI;gBAAEC,IAAAA,EAAM,gBAAA;gBAA2BC,OAAAA,EAASE,QAAAA,CAASF,OAAO,IAAI;aAAG,CAAA;AAC7I,KAAA;IAED,KAAK,MAAMG,WAAWT,QAAAA,CAAU;AAC5B,QAAA,KAAK,MAAMU,MAAAA,IAAUD,OAAAA,CAAQH,OAAO,CAAE;AAClC,YAAA,MAAMK,QAAAA,GAAWb,MAAAA,CAAOc,GAAG,CAACF,OAAON,IAAI,CAAA;AACvC,YAAA,IAAIO,QAAAA,EAAU;AACVd,gBAAAA,WAAAA,CAAYgB,IAAI,CAAC;AACbC,oBAAAA,IAAAA,EAAMC,yBAAyBC,eAAe;AAC9CC,oBAAAA,OAAAA,EAAS,CAAC,QAAQ,EAAEP,MAAAA,CAAON,IAAI,CAAC,uBAAuB,EAAEO,QAAAA,CAASO,KAAK,CAAC,OAAO,EAAET,QAAQL,IAAI,CAAC,uCAAuC;AACzI,iBAAA,CAAA;AACA,gBAAA;AACJ,YAAA;AAEAN,YAAAA,MAAAA,CAAOqB,GAAG,CAACT,MAAAA,CAAON,IAAI,EAAE;AAAEM,gBAAAA,MAAAA;AAAQQ,gBAAAA,KAAAA,EAAOT,QAAQL,IAAI;AAAEgB,gBAAAA,SAAAA,EAAWX,QAAQJ;AAAK,aAAA,CAAA;AACnF,QAAA;AACJ,IAAA;IAEA,OAAOP,MAAAA;AACX;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigationDiagnostic } from './NavigationDiagnostic';
|
|
2
|
+
import { NavigationGraph } from './NavigationGraph';
|
|
3
|
+
import { NavigationRouteKey } from './navigationRoute';
|
|
4
|
+
export declare function diagnoseNavigation(graph: NavigationGraph, routeKey?: NavigationRouteKey): NavigationDiagnostic[];
|
|
5
|
+
//# sourceMappingURL=diagnoseNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnoseNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/diagnoseNavigation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAsC,MAAM,mBAAmB,CAAC;AAW3F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,GAAE,kBAAqC,GAAG,oBAAoB,EAAE,CA6ClI"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { DestinationKind } from '@cratis/scene.model';
|
|
2
|
+
import { collectOutlets } from './collectOutlets.js';
|
|
3
|
+
import { findHostingCycles } from './findHostingCycles.js';
|
|
4
|
+
import { NavigationDiagnosticCode } from './NavigationDiagnosticCode.js';
|
|
5
|
+
import { authoredRouteKey, navigationTarget } from './navigationRoute.js';
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* Diagnoses how destinations, outlets, routes and targets fit together: duplicate routes, duplicate,
|
|
11
|
+
* missing or incompatible outlets, hosting cycles and unavailable targets.
|
|
12
|
+
*
|
|
13
|
+
* Routes are compared by `routeKey` - by default the authored route override, since the engine constructs no
|
|
14
|
+
* URLs. Nothing is rewritten. The C# engine (`NavigationDiagnostics.Diagnose`) reports the same codes and
|
|
15
|
+
* messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`.
|
|
16
|
+
*/ function diagnoseNavigation(graph, routeKey = authoredRouteKey) {
|
|
17
|
+
const diagnostics = [];
|
|
18
|
+
const outlets = collectOutlets(graph, diagnostics);
|
|
19
|
+
const screens = graph.screens ? new Map(graph.screens.map((screen)=>[
|
|
20
|
+
screen.name,
|
|
21
|
+
screen
|
|
22
|
+
])) : undefined;
|
|
23
|
+
const routes = new Map();
|
|
24
|
+
const hostedIn = new Map();
|
|
25
|
+
graph.entries.forEach((navigationEntry, index)=>{
|
|
26
|
+
const entry = navigationEntry.id ?? `#${index + 1}`;
|
|
27
|
+
const destination = navigationEntry.destination;
|
|
28
|
+
const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);
|
|
29
|
+
const report = (code, message)=>diagnostics.push({
|
|
30
|
+
code,
|
|
31
|
+
message,
|
|
32
|
+
entry
|
|
33
|
+
});
|
|
34
|
+
if (!destination.screen && !destination.module && !destination.route && !destination.dialog) {
|
|
35
|
+
report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' names no screen, stable identity, route or dialog.`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
diagnoseTarget(graph, screens, destination, kind, entry, report);
|
|
39
|
+
const owner = diagnoseOutlet(graph, outlets, screens, destination, kind, entry, report);
|
|
40
|
+
if (owner?.ownerKind === 'ScreenTemplate' && destination.screen && screens?.has(destination.screen)) {
|
|
41
|
+
const hosts = graph.screens.filter((screen)=>screen.screenTemplate === owner.owner).map((screen)=>screen.name);
|
|
42
|
+
hostedIn.set(destination.screen, [
|
|
43
|
+
...new Set([
|
|
44
|
+
...hostedIn.get(destination.screen) ?? [],
|
|
45
|
+
...hosts
|
|
46
|
+
])
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
const route = kind === DestinationKind.External ? undefined : routeKey(destination);
|
|
50
|
+
if (route) {
|
|
51
|
+
const target = navigationTarget(destination, kind);
|
|
52
|
+
const existing = routes.get(route);
|
|
53
|
+
if (!existing) {
|
|
54
|
+
routes.set(route, {
|
|
55
|
+
entry,
|
|
56
|
+
target
|
|
57
|
+
});
|
|
58
|
+
} else if (existing.target !== target) {
|
|
59
|
+
report(NavigationDiagnosticCode.DuplicateRoute, `Route '${destination.route ?? route}' is used by destinations '${existing.entry}' and '${entry}', which open different targets.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
for (const cycle of findHostingCycles(graph.screens?.map((screen)=>screen.name) ?? [], hostedIn)){
|
|
64
|
+
diagnostics.push({
|
|
65
|
+
code: NavigationDiagnosticCode.NavigationCycle,
|
|
66
|
+
message: `Navigation cycle ${[
|
|
67
|
+
...cycle,
|
|
68
|
+
cycle[0]
|
|
69
|
+
].join(' -> ')}: each screen is placed in an outlet owned by the next, so composition never terminates.`
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return diagnostics;
|
|
73
|
+
}
|
|
74
|
+
function diagnoseTarget(graph, screens, destination, kind, entry, report) {
|
|
75
|
+
if (kind === DestinationKind.Dialog) {
|
|
76
|
+
if (!destination.dialog) {
|
|
77
|
+
report(NavigationDiagnosticCode.UnavailableTarget, `Dialog destination '${entry}' names no dialog.`);
|
|
78
|
+
} else if (graph.dialogTemplates && !graph.dialogTemplates.some((template)=>template.name === destination.dialog)) {
|
|
79
|
+
report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens dialog '${destination.dialog}', which no dialog template provides.`);
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (kind === DestinationKind.Outlet && destination.screen && screens && !screens.has(destination.screen)) {
|
|
84
|
+
report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens screen '${destination.screen}', which does not exist.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function diagnoseOutlet(graph, outlets, screens, destination, kind, entry, report) {
|
|
88
|
+
if (!destination.outlet) return undefined;
|
|
89
|
+
if (kind !== DestinationKind.Outlet) {
|
|
90
|
+
const opens = kind === DestinationKind.Dialog ? 'a dialog' : 'an external target';
|
|
91
|
+
report(NavigationDiagnosticCode.IncompatibleOutlet, `Destination '${entry}' opens ${opens} but names outlet '${destination.outlet}'; only outlet destinations render in outlets.`);
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const owner = outlets.get(destination.outlet);
|
|
95
|
+
if (!owner) {
|
|
96
|
+
report(NavigationDiagnosticCode.MissingOutlet, `Destination '${entry}' targets missing outlet '${destination.outlet}'.`);
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const screen = destination.screen ? screens?.get(destination.screen) : undefined;
|
|
100
|
+
if (!screen) return owner;
|
|
101
|
+
if (owner.ownerKind === 'Layout' && screen.layout !== owner.owner) {
|
|
102
|
+
report(NavigationDiagnosticCode.IncompatibleOutlet, `Outlet '${owner.outlet.name}' belongs to layout '${owner.owner}', but destination '${entry}' places '${screen.name}', which renders in layout '${screen.layout}'.`);
|
|
103
|
+
}
|
|
104
|
+
if (owner.outlet.accepts) {
|
|
105
|
+
const type = graph.screenTemplates?.find((template)=>template.name === screen.screenTemplate)?.metadata?.type;
|
|
106
|
+
if (!type || !owner.outlet.accepts.includes(type)) {
|
|
107
|
+
report(NavigationDiagnosticCode.IncompatibleOutlet, `Outlet '${owner.outlet.name}' accepts ${owner.outlet.accepts.join(', ')} screens, but destination '${entry}' places '${screen.name}' of type '${type ?? 'untyped'}'.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return owner;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { diagnoseNavigation };
|
|
114
|
+
//# sourceMappingURL=diagnoseNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnoseNavigation.js","sources":["../../../navigation/diagnoseNavigation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DestinationKind, DestinationReference, Screen } from '@cratis/scene.model';\nimport { collectOutlets } from './collectOutlets';\nimport { findHostingCycles } from './findHostingCycles';\nimport { NavigationDiagnostic } from './NavigationDiagnostic';\nimport { NavigationDiagnosticCode } from './NavigationDiagnosticCode';\nimport { NavigationGraph } from './NavigationGraph';\nimport { NavigationRouteKey, authoredRouteKey, navigationTarget } from './navigationRoute';\nimport { OutletOwner } from './OutletOwner';\n\n/**\n * Diagnoses how destinations, outlets, routes and targets fit together: duplicate routes, duplicate,\n * missing or incompatible outlets, hosting cycles and unavailable targets.\n *\n * Routes are compared by `routeKey` - by default the authored route override, since the engine constructs no\n * URLs. Nothing is rewritten. The C# engine (`NavigationDiagnostics.Diagnose`) reports the same codes and\n * messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`.\n */\nexport function diagnoseNavigation(graph: NavigationGraph, routeKey: NavigationRouteKey = authoredRouteKey): NavigationDiagnostic[] {\n const diagnostics: NavigationDiagnostic[] = [];\n const outlets = collectOutlets(graph, diagnostics);\n const screens = graph.screens ? new Map(graph.screens.map(screen => [screen.name, screen])) : undefined;\n const routes = new Map<string, { entry: string; target: string }>();\n const hostedIn = new Map<string, string[]>();\n\n graph.entries.forEach((navigationEntry, index) => {\n const entry = navigationEntry.id ?? `#${index + 1}`;\n const destination = navigationEntry.destination;\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const report = (code: NavigationDiagnosticCode, message: string) => diagnostics.push({ code, message, entry });\n\n if (!destination.screen && !destination.module && !destination.route && !destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' names no screen, stable identity, route or dialog.`);\n return;\n }\n\n diagnoseTarget(graph, screens, destination, kind, entry, report);\n const owner = diagnoseOutlet(graph, outlets, screens, destination, kind, entry, report);\n if (owner?.ownerKind === 'ScreenTemplate' && destination.screen && screens?.has(destination.screen)) {\n const hosts = graph.screens!.filter(screen => screen.screenTemplate === owner.owner).map(screen => screen.name);\n hostedIn.set(destination.screen, [...new Set([...(hostedIn.get(destination.screen) ?? []), ...hosts])]);\n }\n\n const route = kind === DestinationKind.External ? undefined : routeKey(destination);\n if (route) {\n const target = navigationTarget(destination, kind);\n const existing = routes.get(route);\n if (!existing) {\n routes.set(route, { entry, target });\n } else if (existing.target !== target) {\n report(NavigationDiagnosticCode.DuplicateRoute, `Route '${destination.route ?? route}' is used by destinations '${existing.entry}' and '${entry}', which open different targets.`);\n }\n }\n });\n\n for (const cycle of findHostingCycles(graph.screens?.map(screen => screen.name) ?? [], hostedIn)) {\n diagnostics.push({\n code: NavigationDiagnosticCode.NavigationCycle,\n message: `Navigation cycle ${[...cycle, cycle[0]].join(' -> ')}: each screen is placed in an outlet owned by the next, so composition never terminates.`,\n });\n }\n\n return diagnostics;\n}\n\ntype Report = (code: NavigationDiagnosticCode, message: string) => void;\n\nfunction diagnoseTarget(\n graph: NavigationGraph,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n) {\n if (kind === DestinationKind.Dialog) {\n if (!destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Dialog destination '${entry}' names no dialog.`);\n } else if (graph.dialogTemplates && !graph.dialogTemplates.some(template => template.name === destination.dialog)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens dialog '${destination.dialog}', which no dialog template provides.`);\n }\n return;\n }\n\n if (kind === DestinationKind.Outlet && destination.screen && screens && !screens.has(destination.screen)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens screen '${destination.screen}', which does not exist.`);\n }\n}\n\nfunction diagnoseOutlet(\n graph: NavigationGraph,\n outlets: Map<string, OutletOwner>,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n): OutletOwner | undefined {\n if (!destination.outlet) return undefined;\n\n if (kind !== DestinationKind.Outlet) {\n const opens = kind === DestinationKind.Dialog ? 'a dialog' : 'an external target';\n report(NavigationDiagnosticCode.IncompatibleOutlet, `Destination '${entry}' opens ${opens} but names outlet '${destination.outlet}'; only outlet destinations render in outlets.`);\n return undefined;\n }\n\n const owner = outlets.get(destination.outlet);\n if (!owner) {\n report(NavigationDiagnosticCode.MissingOutlet, `Destination '${entry}' targets missing outlet '${destination.outlet}'.`);\n return undefined;\n }\n\n const screen = destination.screen ? screens?.get(destination.screen) : undefined;\n if (!screen) return owner;\n\n if (owner.ownerKind === 'Layout' && screen.layout !== owner.owner) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' belongs to layout '${owner.owner}', but destination '${entry}' places '${screen.name}', which renders in layout '${screen.layout}'.`,\n );\n }\n\n if (owner.outlet.accepts) {\n const type = graph.screenTemplates?.find(template => template.name === screen.screenTemplate)?.metadata?.type;\n if (!type || !owner.outlet.accepts.includes(type)) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' accepts ${owner.outlet.accepts.join(', ')} screens, but destination '${entry}' places '${screen.name}' of type '${type ?? 'untyped'}'.`,\n );\n }\n }\n\n return owner;\n}\n"],"names":["diagnoseNavigation","graph","routeKey","authoredRouteKey","diagnostics","outlets","collectOutlets","screens","Map","map","screen","name","undefined","routes","hostedIn","entries","forEach","navigationEntry","index","entry","id","destination","kind","dialog","DestinationKind","Dialog","Outlet","report","code","message","push","module","route","NavigationDiagnosticCode","UnavailableTarget","diagnoseTarget","owner","diagnoseOutlet","ownerKind","has","hosts","filter","screenTemplate","set","Set","get","External","target","navigationTarget","existing","DuplicateRoute","cycle","findHostingCycles","NavigationCycle","join","dialogTemplates","some","template","outlet","opens","IncompatibleOutlet","MissingOutlet","layout","accepts","type","screenTemplates","find","metadata","includes"],"mappings":";;;;;;AAAA;AACA;AAWA;;;;;;;AAOC,IACM,SAASA,kBAAAA,CAAmBC,KAAsB,EAAEC,WAA+BC,gBAAgB,EAAA;AACtG,IAAA,MAAMC,cAAsC,EAAE;IAC9C,MAAMC,OAAAA,GAAUC,eAAeL,KAAAA,EAAOG,WAAAA,CAAAA;AACtC,IAAA,MAAMG,OAAAA,GAAUN,KAAAA,CAAM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