@cratis/scene.engine 4.37.0 → 4.39.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.
Files changed (59) hide show
  1. package/blueprints/BlueprintCatalogEntry.ts +58 -0
  2. package/blueprints/BlueprintSource.ts +24 -0
  3. package/blueprints/blueprintRules.ts +23 -0
  4. package/blueprints/describeBlueprintCatalog.ts +95 -0
  5. package/blueprints/evaluateBlueprintPin.ts +71 -0
  6. package/blueprints/index.ts +9 -0
  7. package/blueprints/verifyBlueprintPackage.ts +192 -0
  8. package/dist/cjs/blueprints/blueprintRules.js +32 -0
  9. package/dist/cjs/blueprints/blueprintRules.js.map +1 -0
  10. package/dist/cjs/blueprints/describeBlueprintCatalog.js +134 -0
  11. package/dist/cjs/blueprints/describeBlueprintCatalog.js.map +1 -0
  12. package/dist/cjs/blueprints/evaluateBlueprintPin.js +75 -0
  13. package/dist/cjs/blueprints/evaluateBlueprintPin.js.map +1 -0
  14. package/dist/cjs/blueprints/verifyBlueprintPackage.js +194 -0
  15. package/dist/cjs/blueprints/verifyBlueprintPackage.js.map +1 -0
  16. package/dist/cjs/index.js +17 -0
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/packageVersionRange.js +11 -0
  19. package/dist/cjs/packageVersionRange.js.map +1 -1
  20. package/dist/esm/blueprints/BlueprintCatalogEntry.d.ts +46 -0
  21. package/dist/esm/blueprints/BlueprintCatalogEntry.d.ts.map +1 -0
  22. package/dist/esm/blueprints/BlueprintCatalogEntry.js +2 -0
  23. package/dist/esm/blueprints/BlueprintCatalogEntry.js.map +1 -0
  24. package/dist/esm/blueprints/BlueprintSource.d.ts +8 -0
  25. package/dist/esm/blueprints/BlueprintSource.d.ts.map +1 -0
  26. package/dist/esm/blueprints/BlueprintSource.js +2 -0
  27. package/dist/esm/blueprints/BlueprintSource.js.map +1 -0
  28. package/dist/esm/blueprints/blueprintRules.d.ts +7 -0
  29. package/dist/esm/blueprints/blueprintRules.d.ts.map +1 -0
  30. package/dist/esm/blueprints/blueprintRules.js +25 -0
  31. package/dist/esm/blueprints/blueprintRules.js.map +1 -0
  32. package/dist/esm/blueprints/describeBlueprintCatalog.d.ts +5 -0
  33. package/dist/esm/blueprints/describeBlueprintCatalog.d.ts.map +1 -0
  34. package/dist/esm/blueprints/describeBlueprintCatalog.js +131 -0
  35. package/dist/esm/blueprints/describeBlueprintCatalog.js.map +1 -0
  36. package/dist/esm/blueprints/evaluateBlueprintPin.d.ts +15 -0
  37. package/dist/esm/blueprints/evaluateBlueprintPin.d.ts.map +1 -0
  38. package/dist/esm/blueprints/evaluateBlueprintPin.js +71 -0
  39. package/dist/esm/blueprints/evaluateBlueprintPin.js.map +1 -0
  40. package/dist/esm/blueprints/index.d.ts +7 -0
  41. package/dist/esm/blueprints/index.d.ts.map +1 -0
  42. package/dist/esm/blueprints/index.js +7 -0
  43. package/dist/esm/blueprints/index.js.map +1 -0
  44. package/dist/esm/blueprints/verifyBlueprintPackage.d.ts +8 -0
  45. package/dist/esm/blueprints/verifyBlueprintPackage.d.ts.map +1 -0
  46. package/dist/esm/blueprints/verifyBlueprintPackage.js +192 -0
  47. package/dist/esm/blueprints/verifyBlueprintPackage.js.map +1 -0
  48. package/dist/esm/index.d.ts +1 -0
  49. package/dist/esm/index.d.ts.map +1 -1
  50. package/dist/esm/index.js +5 -1
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/packageVersionRange.d.ts +1 -0
  53. package/dist/esm/packageVersionRange.d.ts.map +1 -1
  54. package/dist/esm/packageVersionRange.js +11 -1
  55. package/dist/esm/packageVersionRange.js.map +1 -1
  56. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  57. package/index.ts +1 -0
  58. package/package.json +3 -3
  59. package/packageVersionRange.ts +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeBlueprintCatalog.js","sources":["../../../blueprints/describeBlueprintCatalog.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 { PackageKind } from '@cratis/scene.model';\nimport { TemplateSource } from '../templates/TemplateSource';\nimport { BlueprintCatalogEntry, BlueprintCatalogFile } from './BlueprintCatalogEntry';\n\n/**\n * Describes every domain blueprint among the given packages - those of kind Blueprint that declare blueprint metadata - for a gallery:\n * its thumbnail and description, its screen set in navigation order, the templates it provides, and the sample data a preview can use.\n * A package that only provides foundation layouts and templates is not a domain blueprint and is not listed. The result is ordered by\n * package name so the file it is written to is stable. The C# engine (`BlueprintCatalog.Describe`) returns the same entries; both are\n * asserted against `blueprint-verification-fixtures.json`.\n */\nexport function describeBlueprintCatalog(sources: readonly TemplateSource[]): BlueprintCatalogEntry[] {\n return sources\n .filter(source => source.manifest.kind === PackageKind.Blueprint && source.manifest.blueprint !== undefined)\n .map((source): BlueprintCatalogEntry => {\n const manifest = source.manifest;\n const blueprint = manifest.blueprint!;\n const defaultId = blueprint.defaultSampleData ?? ((manifest.sampleData ?? []).length === 1 ? manifest.sampleData![0].id : undefined);\n const templates = [\n ...(source.layouts ?? []).map(template => ({ kind: 'Layout', template })),\n ...(source.screenTemplates ?? []).map(template => ({ kind: 'ScreenTemplate', template })),\n ...(source.dialogTemplates ?? []).map(template => ({ kind: 'DialogTemplate', template })),\n ];\n\n return {\n package: manifest.name,\n version: manifest.version,\n domain: blueprint.domain,\n ...(manifest.displayName === undefined ? {} : { displayName: manifest.displayName }),\n description: blueprint.description,\n thumbnail: blueprint.thumbnail,\n ...(manifest.license === undefined ? {} : { license: manifest.license }),\n ...(manifest.licenseUrl === undefined ? {} : { licenseUrl: manifest.licenseUrl }),\n dependencies: manifest.dependencies.map(dependency => ({ name: dependency.name, ...(dependency.versionRange === undefined ? {} : { versionRange: dependency.versionRange }) })),\n screens: orderedScreens(blueprint.screenSet ?? []).map(screen => ({\n name: screen.name,\n title: screen.title,\n ...(screen.description === undefined ? {} : { description: screen.description }),\n ...(screen.template === undefined ? {} : { template: screen.template }),\n ...(screen.parent === undefined ? {} : { parent: screen.parent }),\n ...(screen.order === undefined ? {} : { order: screen.order }),\n })),\n templates: templates.map(({ kind, template }) => {\n const described = template as { displayName?: string; description?: string; metadata?: { type?: string; category?: string; thumbnail?: string } };\n return {\n name: template.name,\n kind,\n ...(described.displayName === undefined ? {} : { displayName: described.displayName }),\n ...(described.description === undefined ? {} : { description: described.description }),\n ...(described.metadata?.type === undefined ? {} : { type: described.metadata.type }),\n ...(described.metadata?.category === undefined ? {} : { category: described.metadata.category }),\n ...(described.metadata?.thumbnail === undefined ? {} : { thumbnail: described.metadata.thumbnail }),\n };\n }),\n sampleData: (manifest.sampleData ?? []).map(reference => ({ id: reference.id, title: reference.title, locale: reference.locale, path: reference.path, default: reference.id === defaultId })),\n };\n })\n .sort((left, right) => (left.package < right.package ? -1 : left.package > right.package ? 1 : 0));\n}\n\n/** The catalog as the file a blueprint package ships. */\nexport const toBlueprintCatalogFile = (entries: BlueprintCatalogEntry[]): BlueprintCatalogFile => ({ schema: 1, blueprints: entries });\n\n/**\n * Puts screens in navigation order: siblings by `order` (a screen without one keeps its written place after those with one), each\n * screen directly followed by its children, so a flat list reads top to bottom as the navigation does.\n */\nfunction orderedScreens<T extends { name: string; parent?: string; order?: number }>(screens: readonly T[]): T[] {\n const names = new Set(screens.map(screen => screen.name));\n const childrenOf = (parent: string | undefined): T[] => {\n const siblings = screens.filter(screen => (parent === undefined ? screen.parent === undefined || !names.has(screen.parent) : screen.parent === parent));\n return siblings\n .map((screen, index) => ({ screen, index }))\n .sort((left, right) => (left.screen.order ?? Number.MAX_SAFE_INTEGER) - (right.screen.order ?? Number.MAX_SAFE_INTEGER) || left.index - right.index)\n .map(entry => entry.screen);\n };\n\n const result: T[] = [];\n const seen = new Set<string>();\n const walk = (level: T[]) => {\n for (const screen of level) {\n if (seen.has(screen.name)) continue;\n seen.add(screen.name);\n result.push(screen);\n walk(childrenOf(screen.name));\n }\n };\n\n walk(childrenOf(undefined));\n for (const screen of screens) if (!seen.has(screen.name)) result.push(screen);\n return result;\n}\n"],"names":["describeBlueprintCatalog","sources","filter","source","manifest","kind","PackageKind","Blueprint","blueprint","undefined","map","defaultId","defaultSampleData","sampleData","length","id","templates","layouts","template","screenTemplates","dialogTemplates","package","name","version","domain","displayName","description","thumbnail","license","licenseUrl","dependencies","dependency","versionRange","screens","orderedScreens","screenSet","screen","title","parent","order","described","metadata","type","category","reference","locale","path","default","sort","left","right","toBlueprintCatalogFile","entries","schema","blueprints","names","Set","childrenOf","siblings","has","index","Number","MAX_SAFE_INTEGER","entry","result","seen","walk","level","add","push"],"mappings":";;;;AAAA;AACA;AAMA;;;;;;IAOO,SAASA,wBAAAA,CAAyBC,OAAkC,EAAA;IACvE,OAAOA,OAAAA,CACFC,MAAM,CAACC,CAAAA,SAAUA,MAAAA,CAAOC,QAAQ,CAACC,IAAI,KAAKC,wBAAYC,SAAS,IAAIJ,OAAOC,QAAQ,CAACI,SAAS,KAAKC,SAAAA,CAAAA,CACjGC,GAAG,CAAC,CAACP,MAAAA,GAAAA;QACF,MAAMC,QAAAA,GAAWD,OAAOC,QAAQ;QAChC,MAAMI,SAAAA,GAAYJ,SAASI,SAAS;QACpC,MAAMG,SAAAA,GAAYH,SAAAA,CAAUI,iBAAiB,KAAK,CAACR,QAAAA,CAASS,UAAU,IAAI,EAAC,EAAGC,MAAM,KAAK,CAAA,GAAIV,QAAAA,CAASS,UAAW,CAAC,CAAA,CAAE,CAACE,EAAE,GAAGN,SAAQ,CAAA;AAClI,QAAA,MAAMO,SAAAA,GAAY;eACX,CAACb,MAAAA,CAAOc,OAAO,IAAI,EAAE,EAAEP,GAAG,CAACQ,CAAAA,QAAAA,IAAa;oBAAEb,IAAAA,EAAM,QAAA;AAAUa,oBAAAA;iBAAS,CAAA,CAAA;eACnE,CAACf,MAAAA,CAAOgB,eAAe,IAAI,EAAE,EAAET,GAAG,CAACQ,CAAAA,QAAAA,IAAa;oBAAEb,IAAAA,EAAM,gBAAA;AAAkBa,oBAAAA;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MAAAA,CAAAA;IACtE,OAAO4B,MAAAA;AACX;;;"}
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ var packageVersionRange = require('../packageVersionRange.js');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /** Where a blueprint reference's pin stands against what is installed and what is available. */ var BlueprintPinStatus = /*#__PURE__*/ function(BlueprintPinStatus) {
8
+ /** The installed version satisfies the pin and nothing newer is available. */ BlueprintPinStatus["Current"] = "Current";
9
+ /** A newer version the pin allows is available: taking it changes nothing the pin promised to keep. */ BlueprintPinStatus["UpdateAvailable"] = "UpdateAvailable";
10
+ /** A newer version is available that the pin does not allow - usually a new major version - so taking it is a deliberate move that rewrites the pin. */ BlueprintPinStatus["UpdateBlockedByPin"] = "UpdateBlockedByPin";
11
+ /** The installed version does not satisfy the pin: the reference was chosen from a version that is no longer there. */ BlueprintPinStatus["NotSatisfied"] = "NotSatisfied";
12
+ /** The pin or a version is not one the engine understands. */ BlueprintPinStatus["Invalid"] = "Invalid";
13
+ return BlueprintPinStatus;
14
+ }({});
15
+ /**
16
+ * The pin a reference gets when a template is chosen from a blueprint: the caret range of the installed version, so the reference accepts
17
+ * every compatible update and refuses a new major version until someone moves it on purpose.
18
+ */ const defaultBlueprintPin = (installedVersion)=>`^${installedVersion}`;
19
+ /**
20
+ * Decides whether "update available" applies to a template reference that pins a blueprint version (`TemplateReference.version`).
21
+ *
22
+ * A reference without a pin is held to {@link defaultBlueprintPin} of the installed version. The pin says which versions the reference
23
+ * is content to run against; the installed version must satisfy it, and a newer available version is an update - an ordinary one when
24
+ * the pin allows it, one the pin blocks (usually a major version) when it does not. Both engines implement this identically (`BlueprintVersionPin.Evaluate`) and are
25
+ * asserted against `blueprint-verification-fixtures.json`.
26
+ *
27
+ * @param pin The reference's version range, or undefined when it has none.
28
+ * @param installedVersion The version of the blueprint that is installed.
29
+ * @param latestVersion The newest version of the blueprint that is available; when undefined only the installed version is known.
30
+ */ function evaluateBlueprintPin(pin, installedVersion, latestVersion) {
31
+ const effective = pin === undefined || pin.trim() === '' ? defaultBlueprintPin(installedVersion) : pin.trim();
32
+ if (!packageVersionRange.isValidVersion(installedVersion)) return {
33
+ status: "Invalid",
34
+ pin: effective,
35
+ message: `Installed version '${installedVersion}' is not a version`
36
+ };
37
+ if (!packageVersionRange.isValidVersionRange(effective)) return {
38
+ status: "Invalid",
39
+ pin: effective,
40
+ message: `Pin '${effective}' is not a version range`
41
+ };
42
+ if (latestVersion !== undefined && !packageVersionRange.isValidVersion(latestVersion)) return {
43
+ status: "Invalid",
44
+ pin: effective,
45
+ message: `Latest version '${latestVersion}' is not a version`
46
+ };
47
+ if (!packageVersionRange.isVersionSatisfiedBy(installedVersion, effective)) {
48
+ return {
49
+ status: "NotSatisfied",
50
+ pin: effective,
51
+ message: `Version ${installedVersion} is installed but the reference pins ${effective}`
52
+ };
53
+ }
54
+ if (latestVersion === undefined || packageVersionRange.compareVersions(latestVersion, installedVersion) <= 0) {
55
+ return {
56
+ status: "Current",
57
+ pin: effective,
58
+ message: `Version ${installedVersion} is the latest`
59
+ };
60
+ }
61
+ return packageVersionRange.isVersionSatisfiedBy(latestVersion, effective) ? {
62
+ status: "UpdateAvailable",
63
+ pin: effective,
64
+ message: `Version ${latestVersion} is available, and ${effective} allows it`
65
+ } : {
66
+ status: "UpdateBlockedByPin",
67
+ pin: effective,
68
+ message: `Version ${latestVersion} is available but ${effective} does not allow it`
69
+ };
70
+ }
71
+
72
+ exports.BlueprintPinStatus = BlueprintPinStatus;
73
+ exports.defaultBlueprintPin = defaultBlueprintPin;
74
+ exports.evaluateBlueprintPin = evaluateBlueprintPin;
75
+ //# sourceMappingURL=evaluateBlueprintPin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluateBlueprintPin.js","sources":["../../../blueprints/evaluateBlueprintPin.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 { compareVersions, isValidVersion, isValidVersionRange, isVersionSatisfiedBy } from '../packageVersionRange';\n\n/** Where a blueprint reference's pin stands against what is installed and what is available. */\nexport enum BlueprintPinStatus {\n /** The installed version satisfies the pin and nothing newer is available. */\n Current = 'Current',\n\n /** A newer version the pin allows is available: taking it changes nothing the pin promised to keep. */\n UpdateAvailable = 'UpdateAvailable',\n\n /** A newer version is available that the pin does not allow - usually a new major version - so taking it is a deliberate move that rewrites the pin. */\n UpdateBlockedByPin = 'UpdateBlockedByPin',\n\n /** The installed version does not satisfy the pin: the reference was chosen from a version that is no longer there. */\n NotSatisfied = 'NotSatisfied',\n\n /** The pin or a version is not one the engine understands. */\n Invalid = 'Invalid',\n}\n\n/** The outcome of evaluating a pin. */\nexport interface BlueprintPinEvaluation {\n status: BlueprintPinStatus;\n\n /** The pin that was evaluated: the one given, or the default for the installed version when none was. */\n pin: string;\n\n /** Said in a sentence, for a tooltip or a diagnostic. */\n message: string;\n}\n\n/**\n * The pin a reference gets when a template is chosen from a blueprint: the caret range of the installed version, so the reference accepts\n * every compatible update and refuses a new major version until someone moves it on purpose.\n */\nexport const defaultBlueprintPin = (installedVersion: string): string => `^${installedVersion}`;\n\n/**\n * Decides whether \"update available\" applies to a template reference that pins a blueprint version (`TemplateReference.version`).\n *\n * A reference without a pin is held to {@link defaultBlueprintPin} of the installed version. The pin says which versions the reference\n * is content to run against; the installed version must satisfy it, and a newer available version is an update - an ordinary one when\n * the pin allows it, one the pin blocks (usually a major version) when it does not. Both engines implement this identically (`BlueprintVersionPin.Evaluate`) and are\n * asserted against `blueprint-verification-fixtures.json`.\n *\n * @param pin The reference's version range, or undefined when it has none.\n * @param installedVersion The version of the blueprint that is installed.\n * @param latestVersion The newest version of the blueprint that is available; when undefined only the installed version is known.\n */\nexport function evaluateBlueprintPin(pin: string | undefined, installedVersion: string, latestVersion?: string): BlueprintPinEvaluation {\n const effective = pin === undefined || pin.trim() === '' ? defaultBlueprintPin(installedVersion) : pin.trim();\n\n if (!isValidVersion(installedVersion)) return { status: BlueprintPinStatus.Invalid, pin: effective, message: `Installed version '${installedVersion}' is not a version` };\n if (!isValidVersionRange(effective)) return { status: BlueprintPinStatus.Invalid, pin: effective, message: `Pin '${effective}' is not a version range` };\n if (latestVersion !== undefined && !isValidVersion(latestVersion)) return { status: BlueprintPinStatus.Invalid, pin: effective, message: `Latest version '${latestVersion}' is not a version` };\n\n if (!isVersionSatisfiedBy(installedVersion, effective)) {\n return { status: BlueprintPinStatus.NotSatisfied, pin: effective, message: `Version ${installedVersion} is installed but the reference pins ${effective}` };\n }\n\n if (latestVersion === undefined || compareVersions(latestVersion, installedVersion) <= 0) {\n return { status: BlueprintPinStatus.Current, pin: effective, message: `Version ${installedVersion} is the latest` };\n }\n\n return isVersionSatisfiedBy(latestVersion, effective)\n ? { status: BlueprintPinStatus.UpdateAvailable, pin: effective, message: `Version ${latestVersion} is available, and ${effective} allows it` }\n : { status: BlueprintPinStatus.UpdateBlockedByPin, pin: effective, message: `Version ${latestVersion} is available but ${effective} does not allow it` };\n}\n"],"names":["BlueprintPinStatus","defaultBlueprintPin","installedVersion","evaluateBlueprintPin","pin","latestVersion","effective","undefined","trim","isValidVersion","status","message","isValidVersionRange","isVersionSatisfiedBy","compareVersions"],"mappings":";;;;AAAA;AACA;AAIA,iGACO,IAAKA,kBAAAA,iBAAAA,SAAAA,kBAAAA,EAAAA;mFACoE,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;4GAGyB,kBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;6JAGiD,kBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;4HAGjC,kBAAA,CAAA,cAAA,CAAA,GAAA,cAAA;mEAGzD,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;AAbpDA,IAAAA,OAAAA,kBAAAA;AAeX,CAAA,CAAA,EAAA;AAaD;;;UAIaC,mBAAAA,GAAsB,CAACC,mBAAqC,CAAC,CAAC,EAAEA,gBAA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H,qBAAqB,CAAA,EAAG;QACtF,OAAO;YAAEQ,MAAM,EAAA,SAAA;YAA8BN,GAAAA,EAAKE,SAAAA;AAAWK,YAAAA,OAAAA,EAAS,CAAC,QAAQ,EAAET,gBAAAA,CAAiB,cAAc;AAAE,SAAA;AACtH,IAAA;IAEA,OAAOW,wCAAAA,CAAqBR,eAAeC,SAAAA,CAAAA,GACrC;QAAEI,MAAM,EAAA,iBAAA;QAAsCN,GAAAA,EAAKE,SAAAA;QAAWK,OAAAA,EAAS,CAAC,QAAQ,EAAEN,aAAAA,CAAc,mBAAmB,EAAEC,SAAAA,CAAU,UAAU;KAAE,GAC3I;QAAEI,MAAM,EAAA,oBAAA;QAAyCN,GAAAA,EAAKE,SAAAA;QAAWK,OAAAA,EAAS,CAAC,QAAQ,EAAEN,aAAAA,CAAc,kBAAkB,EAAEC,SAAAA,CAAU,kBAAkB;AAAE,KAAA;AAC/J;;;;"}
@@ -0,0 +1,194 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var packageVersionRange = require('../packageVersionRange.js');
5
+ var resolveScreenTemplates = require('../resolveScreenTemplates.js');
6
+ var validateSampleDataPackages = require('../sampleData/validateSampleDataPackages.js');
7
+ var describeTemplateCatalog = require('../templates/describeTemplateCatalog.js');
8
+ var blueprintRules = require('./blueprintRules.js');
9
+
10
+ // Copyright (c) Cratis. All rights reserved.
11
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
12
+ /**
13
+ * The definition of done for a blueprint (spec Part B 6), as rules a package can be held to: valid manifest and version; for a domain
14
+ * blueprint its domain, description, thumbnail and screen set; every template with complete metadata, a category, a type from the
15
+ * vocabulary, a description and a thumbnail; every template placed by the slot resolver, with nothing unplaced, ambiguous or nested in
16
+ * itself (ambiguity is only a problem for a domain blueprint: the foundation's generic nesting chain fits slots many templates declare, and is chosen explicitly); sample data present, locale-tagged and valid; and a dependency on the foundation set. The C# engine
17
+ * (`BlueprintVerification.Verify`) reports the same problems in the same order; both are asserted against
18
+ * `blueprint-verification-fixtures.json`.
19
+ *
20
+ * @param source The blueprint to verify.
21
+ * @param library The other packages available - above all the foundation set - so templates can be placed into its layouts and checked against its versions.
22
+ * @param options How strictly to verify.
23
+ * @returns The problems; empty when the blueprint is done.
24
+ */ function verifyBlueprintPackage(source, library = [], options = {}) {
25
+ const manifest = source.manifest;
26
+ const name = manifest.name;
27
+ const label = `Blueprint '${name}'`;
28
+ const foundation = options.foundationPackage ?? blueprintRules.foundationPackageName;
29
+ if (manifest.kind !== scene_model.PackageKind.Blueprint) return [
30
+ `Package '${name}' is not a Blueprint package`
31
+ ];
32
+ const problems = [];
33
+ if (!packageVersionRange.isValidVersion(manifest.version)) problems.push(`${label} declares an invalid version '${manifest.version ?? ''}'`);
34
+ const blueprint = manifest.blueprint;
35
+ const domain = blueprint !== undefined;
36
+ const available = new Set([
37
+ ...source.screenTemplates ?? [],
38
+ ...library.flatMap((other)=>other.screenTemplates ?? [])
39
+ ].map((template)=>template.name));
40
+ if (!blueprint) {
41
+ if (options.requireBlueprintMetadata) problems.push(`${label} declares no blueprint metadata (domain, description, thumbnail and screen set)`);
42
+ } else {
43
+ if ((blueprint.domain ?? '').trim() === '') problems.push(`${label} declares no domain`);
44
+ else if (!blueprintRules.isValidBlueprintDomain(blueprint.domain)) problems.push(`${label} declares an invalid domain '${blueprint.domain}'; use lower-case words separated by '-'`);
45
+ if ((blueprint.description ?? '').trim() === '') problems.push(`${label} declares no description`);
46
+ else if (blueprint.description.length > blueprintRules.maximumBlueprintDescriptionLength) problems.push(`${label} declares a description longer than ${blueprintRules.maximumBlueprintDescriptionLength} characters`);
47
+ problems.push(...thumbnailProblems(label, blueprint.thumbnail, source.files));
48
+ problems.push(...screenSetProblems(source, label, available));
49
+ if (blueprint.defaultSampleData !== undefined && !(manifest.sampleData ?? []).some((reference)=>reference.id === blueprint.defaultSampleData)) {
50
+ problems.push(`${label} declares default sample data '${blueprint.defaultSampleData}', which is not one of its sample data packs`);
51
+ }
52
+ if ((manifest.sampleData ?? []).length === 0) problems.push(`${label} ships no sample data pack`);
53
+ else if ((manifest.sampleData ?? []).length > 1 && blueprint.defaultSampleData === undefined) problems.push(`${label} ships several sample data packs but declares no default`);
54
+ if (name !== foundation && !manifest.dependencies.some((dependency)=>dependency.name === foundation)) {
55
+ problems.push(`${label} does not depend on the foundation set '${foundation}'`);
56
+ }
57
+ }
58
+ problems.push(...validateSampleDataPackages.validateSampleDataPackages([
59
+ {
60
+ manifest,
61
+ packs: source.packs
62
+ }
63
+ ]));
64
+ for (const reference of manifest.sampleData ?? []){
65
+ if (source.files !== undefined && !source.files.includes(reference.path)) problems.push(`${label} sample data pack '${reference.id}' names '${reference.path}', which is not in the package`);
66
+ }
67
+ problems.push(...templateProblems(source, library, domain));
68
+ problems.push(...placementProblems(source, library, label, domain));
69
+ return problems;
70
+ }
71
+ function thumbnailProblems(owner, thumbnail, files) {
72
+ if ((thumbnail ?? '').trim() === '') return [
73
+ `${owner} declares no thumbnail`
74
+ ];
75
+ if (!blueprintRules.isValidThumbnailPath(thumbnail)) return [
76
+ `${owner} declares thumbnail '${thumbnail}', which is not 'thumbnails/<name>.png|webp|jpg|svg'`
77
+ ];
78
+ if (files !== undefined && !files.includes(thumbnail)) return [
79
+ `${owner} declares thumbnail '${thumbnail}', which is not in the package`
80
+ ];
81
+ return [];
82
+ }
83
+ function screenSetProblems(source, label, availableTemplates) {
84
+ const set = source.manifest.blueprint.screenSet ?? [];
85
+ if (set.length === 0) return [
86
+ `${label} declares no ready-to-use screen set`
87
+ ];
88
+ const problems = [];
89
+ const names = new Set();
90
+ for (const screen of set){
91
+ if ((screen.name ?? '').trim() === '') {
92
+ problems.push(`${label} declares a screen set entry without a name`);
93
+ continue;
94
+ }
95
+ if (names.has(screen.name)) problems.push(`${label} declares screen '${screen.name}' more than once`);
96
+ names.add(screen.name);
97
+ }
98
+ for (const screen of set){
99
+ if ((screen.name ?? '').trim() === '') continue;
100
+ const owner = `${label} screen '${screen.name}'`;
101
+ if ((screen.title ?? '').trim() === '') problems.push(`${owner} declares no title`);
102
+ if (screen.template !== undefined && !availableTemplates.has(screen.template)) problems.push(`${owner} uses template '${screen.template}', which is not available`);
103
+ if (screen.parent !== undefined && !names.has(screen.parent)) problems.push(`${owner} has parent '${screen.parent}', which is not in the screen set`);
104
+ if (source.screens !== undefined && !source.screens.some((candidate)=>candidate.name === screen.name)) problems.push(`${owner} is named in the screen set but the package does not provide it`);
105
+ }
106
+ for (const screen of set){
107
+ if (screen.parent !== undefined && names.has(screen.parent) && isOwnAncestor(screen.name, set)) problems.push(`${label} screen '${screen.name}' is its own ancestor`);
108
+ }
109
+ return problems;
110
+ }
111
+ function isOwnAncestor(name, set) {
112
+ const visited = new Set();
113
+ for(let current = set.find((screen)=>screen.name === name)?.parent; current !== undefined; current = set.find((screen)=>screen.name === current)?.parent){
114
+ if (current === name) return true;
115
+ if (visited.has(current)) return false;
116
+ visited.add(current);
117
+ }
118
+ return false;
119
+ }
120
+ function templateProblems(source, library, domain) {
121
+ const problems = [];
122
+ const described = [
123
+ ...source.screenTemplates ?? [],
124
+ ...source.dialogTemplates ?? []
125
+ ];
126
+ const everyTemplate = [
127
+ ...(source.layouts ?? []).map((layout)=>({
128
+ name: layout.name,
129
+ metadata: layout.metadata,
130
+ describable: false
131
+ })),
132
+ ...described.map((template)=>({
133
+ name: template.name,
134
+ displayName: template.displayName,
135
+ description: template.description,
136
+ metadata: template.metadata,
137
+ describable: true
138
+ }))
139
+ ];
140
+ const others = library.filter((other)=>other.manifest.name !== source.manifest.name);
141
+ for (const entry of describeTemplateCatalog.describeTemplateCatalog([
142
+ source,
143
+ ...others
144
+ ]).filter((candidate)=>candidate.package === source.manifest.name)){
145
+ problems.push(...entry.problems);
146
+ }
147
+ for (const template of everyTemplate){
148
+ const owner = `Template '${template.name}'`;
149
+ if (template.describable && (template.displayName ?? '').trim() === '') problems.push(`${owner} declares no display name`);
150
+ if (template.describable && (template.description ?? '').trim() === '') problems.push(`${owner} declares no description`);
151
+ if (!domain) continue;
152
+ const metadata = template.metadata;
153
+ if (metadata?.type === undefined) problems.push(`${owner} declares no type`);
154
+ else if (!blueprintRules.blueprintTemplateTypes.includes(metadata.type)) problems.push(`${owner} declares type '${metadata.type}', which is not one of ${blueprintRules.blueprintTemplateTypes.join(', ')}`);
155
+ if (metadata?.category !== undefined && metadata.category.trim() !== '' && !metadata.category.startsWith(blueprintRules.businessCategoryPrefix)) {
156
+ problems.push(`${owner} declares category '${metadata.category}', which does not start with '${blueprintRules.businessCategoryPrefix}'`);
157
+ }
158
+ problems.push(...thumbnailProblems(owner, metadata?.thumbnail, source.files));
159
+ }
160
+ return problems;
161
+ }
162
+ function placementProblems(source, library, label, domain) {
163
+ const own = (source.screenTemplates ?? []).filter((template)=>template.fitsSlot !== undefined);
164
+ if (own.length === 0) return [];
165
+ const layouts = [
166
+ ...source.layouts ?? [],
167
+ ...library.flatMap((other)=>other.layouts ?? [])
168
+ ];
169
+ const everyTemplate = [
170
+ ...source.screenTemplates ?? [],
171
+ ...library.flatMap((other)=>other.screenTemplates ?? [])
172
+ ];
173
+ if (layouts.length === 0) return [
174
+ `${label} has no layout to place its screen templates in`
175
+ ];
176
+ const resolutions = layouts.map((layout)=>({
177
+ layout,
178
+ resolution: resolveScreenTemplates.resolveScreenTemplates(layout, everyTemplate)
179
+ }));
180
+ const problems = [];
181
+ for (const template of own){
182
+ if (resolutions.some(({ resolution })=>resolution.placements.some((placement)=>placement.template === template.name))) continue;
183
+ const unplacedEverywhere = resolutions.flatMap(({ resolution })=>resolution.unplaced.filter((candidate)=>candidate.template === template.name));
184
+ const unplaced = unplacedEverywhere.find((candidate)=>candidate.candidates.length > 1);
185
+ const cyclic = resolutions.some(({ resolution })=>resolution.cycles.some((cycle)=>cycle.includes(template.name)));
186
+ if (cyclic) problems.push(`Template '${template.name}' is nested inside itself`);
187
+ else if (unplaced && domain) problems.push(`Template '${template.name}' is ambiguous: slot '${unplaced.slot}' is declared by ${unplaced.candidates.join(', ')}`);
188
+ else if (!unplaced) problems.push(`Template '${template.name}' is unplaced: no layout or template declares slot '${template.fitsSlot}'`);
189
+ }
190
+ return problems;
191
+ }
192
+
193
+ exports.verifyBlueprintPackage = verifyBlueprintPackage;
194
+ //# sourceMappingURL=verifyBlueprintPackage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyBlueprintPackage.js","sources":["../../../blueprints/verifyBlueprintPackage.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 { PackageKind, ScreenTemplate } from '@cratis/scene.model';\nimport { isValidVersion } from '../packageVersionRange';\nimport { resolveScreenTemplates } from '../resolveScreenTemplates';\nimport { validateSampleDataPackages } from '../sampleData/validateSampleDataPackages';\nimport { describeTemplateCatalog } from '../templates/describeTemplateCatalog';\nimport { TemplateSource } from '../templates/TemplateSource';\nimport { BlueprintSource } from './BlueprintSource';\nimport {\n blueprintTemplateTypes, businessCategoryPrefix, foundationPackageName, isValidBlueprintDomain, isValidThumbnailPath, maximumBlueprintDescriptionLength,\n} from './blueprintRules';\n\n/** How a blueprint is verified. */\nexport interface BlueprintVerificationOptions {\n /** The package that provides the foundation set a domain blueprint must depend on. Defaults to {@link foundationPackageName}. */\n foundationPackage?: string;\n\n /** Whether a package without blueprint metadata is a problem. Set for every domain blueprint; unset for a package that only provides foundation layouts and templates. */\n requireBlueprintMetadata?: boolean;\n}\n\n/**\n * The definition of done for a blueprint (spec Part B 6), as rules a package can be held to: valid manifest and version; for a domain\n * blueprint its domain, description, thumbnail and screen set; every template with complete metadata, a category, a type from the\n * vocabulary, a description and a thumbnail; every template placed by the slot resolver, with nothing unplaced, ambiguous or nested in\n * itself (ambiguity is only a problem for a domain blueprint: the foundation's generic nesting chain fits slots many templates declare, and is chosen explicitly); sample data present, locale-tagged and valid; and a dependency on the foundation set. The C# engine\n * (`BlueprintVerification.Verify`) reports the same problems in the same order; both are asserted against\n * `blueprint-verification-fixtures.json`.\n *\n * @param source The blueprint to verify.\n * @param library The other packages available - above all the foundation set - so templates can be placed into its layouts and checked against its versions.\n * @param options How strictly to verify.\n * @returns The problems; empty when the blueprint is done.\n */\nexport function verifyBlueprintPackage(source: BlueprintSource, library: readonly TemplateSource[] = [], options: BlueprintVerificationOptions = {}): string[] {\n const manifest = source.manifest;\n const name = manifest.name;\n const label = `Blueprint '${name}'`;\n const foundation = options.foundationPackage ?? foundationPackageName;\n\n if (manifest.kind !== PackageKind.Blueprint) return [`Package '${name}' is not a Blueprint package`];\n\n const problems: string[] = [];\n if (!isValidVersion(manifest.version)) problems.push(`${label} declares an invalid version '${manifest.version ?? ''}'`);\n\n const blueprint = manifest.blueprint;\n const domain = blueprint !== undefined;\n const available = new Set([...(source.screenTemplates ?? []), ...library.flatMap(other => other.screenTemplates ?? [])].map(template => template.name));\n\n if (!blueprint) {\n if (options.requireBlueprintMetadata) problems.push(`${label} declares no blueprint metadata (domain, description, thumbnail and screen set)`);\n } else {\n if ((blueprint.domain ?? '').trim() === '') problems.push(`${label} declares no domain`);\n else if (!isValidBlueprintDomain(blueprint.domain)) problems.push(`${label} declares an invalid domain '${blueprint.domain}'; use lower-case words separated by '-'`);\n\n if ((blueprint.description ?? '').trim() === '') problems.push(`${label} declares no description`);\n else if (blueprint.description.length > maximumBlueprintDescriptionLength) problems.push(`${label} declares a description longer than ${maximumBlueprintDescriptionLength} characters`);\n\n problems.push(...thumbnailProblems(label, blueprint.thumbnail, source.files));\n problems.push(...screenSetProblems(source, label, available));\n\n if (blueprint.defaultSampleData !== undefined && !(manifest.sampleData ?? []).some(reference => reference.id === blueprint.defaultSampleData)) {\n problems.push(`${label} declares default sample data '${blueprint.defaultSampleData}', which is not one of its sample data packs`);\n }\n\n if ((manifest.sampleData ?? []).length === 0) problems.push(`${label} ships no sample data pack`);\n else if ((manifest.sampleData ?? []).length > 1 && blueprint.defaultSampleData === undefined) problems.push(`${label} ships several sample data packs but declares no default`);\n\n if (name !== foundation && !manifest.dependencies.some(dependency => dependency.name === foundation)) {\n problems.push(`${label} does not depend on the foundation set '${foundation}'`);\n }\n }\n\n problems.push(...validateSampleDataPackages([{ manifest, packs: source.packs }]));\n for (const reference of manifest.sampleData ?? []) {\n if (source.files !== undefined && !source.files.includes(reference.path)) problems.push(`${label} sample data pack '${reference.id}' names '${reference.path}', which is not in the package`);\n }\n\n problems.push(...templateProblems(source, library, domain));\n problems.push(...placementProblems(source, library, label, domain));\n return problems;\n}\n\nfunction thumbnailProblems(owner: string, thumbnail: string | undefined, files: string[] | undefined): string[] {\n if ((thumbnail ?? '').trim() === '') return [`${owner} declares no thumbnail`];\n if (!isValidThumbnailPath(thumbnail)) return [`${owner} declares thumbnail '${thumbnail}', which is not 'thumbnails/<name>.png|webp|jpg|svg'`];\n if (files !== undefined && !files.includes(thumbnail!)) return [`${owner} declares thumbnail '${thumbnail}', which is not in the package`];\n return [];\n}\n\nfunction screenSetProblems(source: BlueprintSource, label: string, availableTemplates: Set<string>): string[] {\n const set = source.manifest.blueprint!.screenSet ?? [];\n if (set.length === 0) return [`${label} declares no ready-to-use screen set`];\n\n const problems: string[] = [];\n const names = new Set<string>();\n for (const screen of set) {\n if ((screen.name ?? '').trim() === '') {\n problems.push(`${label} declares a screen set entry without a name`);\n continue;\n }\n\n if (names.has(screen.name)) problems.push(`${label} declares screen '${screen.name}' more than once`);\n names.add(screen.name);\n }\n\n for (const screen of set) {\n if ((screen.name ?? '').trim() === '') continue;\n const owner = `${label} screen '${screen.name}'`;\n if ((screen.title ?? '').trim() === '') problems.push(`${owner} declares no title`);\n if (screen.template !== undefined && !availableTemplates.has(screen.template)) problems.push(`${owner} uses template '${screen.template}', which is not available`);\n if (screen.parent !== undefined && !names.has(screen.parent)) problems.push(`${owner} has parent '${screen.parent}', which is not in the screen set`);\n if (source.screens !== undefined && !source.screens.some(candidate => candidate.name === screen.name)) problems.push(`${owner} is named in the screen set but the package does not provide it`);\n }\n\n for (const screen of set) {\n if (screen.parent !== undefined && names.has(screen.parent) && isOwnAncestor(screen.name, set)) problems.push(`${label} screen '${screen.name}' is its own ancestor`);\n }\n\n return problems;\n}\n\nfunction isOwnAncestor(name: string, set: { name: string; parent?: string }[]): boolean {\n const visited = new Set<string>();\n for (let current = set.find(screen => screen.name === name)?.parent; current !== undefined; current = set.find(screen => screen.name === current)?.parent) {\n if (current === name) return true;\n if (visited.has(current)) return false;\n visited.add(current);\n }\n\n return false;\n}\n\nfunction templateProblems(source: BlueprintSource, library: readonly TemplateSource[], domain: boolean): string[] {\n const problems: string[] = [];\n const described = [...(source.screenTemplates ?? []), ...(source.dialogTemplates ?? [])];\n const everyTemplate: { name: string; displayName?: string; description?: string; metadata?: { type?: string; category?: string; thumbnail?: string }; describable: boolean }[] = [\n ...(source.layouts ?? []).map(layout => ({ name: layout.name, metadata: layout.metadata, describable: false })),\n ...described.map(template => ({ name: template.name, displayName: template.displayName, description: template.description, metadata: template.metadata, describable: true })),\n ];\n\n const others = library.filter(other => other.manifest.name !== source.manifest.name);\n for (const entry of describeTemplateCatalog([source, ...others]).filter(candidate => candidate.package === source.manifest.name)) {\n problems.push(...entry.problems);\n }\n\n for (const template of everyTemplate) {\n const owner = `Template '${template.name}'`;\n if (template.describable && (template.displayName ?? '').trim() === '') problems.push(`${owner} declares no display name`);\n if (template.describable && (template.description ?? '').trim() === '') problems.push(`${owner} declares no description`);\n if (!domain) continue;\n\n const metadata = template.metadata;\n if (metadata?.type === undefined) problems.push(`${owner} declares no type`);\n else if (!blueprintTemplateTypes.includes(metadata.type)) problems.push(`${owner} declares type '${metadata.type}', which is not one of ${blueprintTemplateTypes.join(', ')}`);\n\n if (metadata?.category !== undefined && metadata.category.trim() !== '' && !metadata.category.startsWith(businessCategoryPrefix)) {\n problems.push(`${owner} declares category '${metadata.category}', which does not start with '${businessCategoryPrefix}'`);\n }\n\n problems.push(...thumbnailProblems(owner, metadata?.thumbnail, source.files));\n }\n\n return problems;\n}\n\nfunction placementProblems(source: BlueprintSource, library: readonly TemplateSource[], label: string, domain: boolean): string[] {\n const own: ScreenTemplate[] = (source.screenTemplates ?? []).filter(template => template.fitsSlot !== undefined);\n if (own.length === 0) return [];\n\n const layouts = [...(source.layouts ?? []), ...library.flatMap(other => other.layouts ?? [])];\n const everyTemplate = [...(source.screenTemplates ?? []), ...library.flatMap(other => other.screenTemplates ?? [])];\n if (layouts.length === 0) return [`${label} has no layout to place its screen templates in`];\n\n const resolutions = layouts.map(layout => ({ layout, resolution: resolveScreenTemplates(layout, everyTemplate) }));\n const problems: string[] = [];\n\n for (const template of own) {\n if (resolutions.some(({ resolution }) => resolution.placements.some(placement => placement.template === template.name))) continue;\n\n const unplacedEverywhere = resolutions.flatMap(({ resolution }) => resolution.unplaced.filter(candidate => candidate.template === template.name));\n const unplaced = unplacedEverywhere.find(candidate => candidate.candidates.length > 1);\n const cyclic = resolutions.some(({ resolution }) => resolution.cycles.some(cycle => cycle.includes(template.name)));\n if (cyclic) problems.push(`Template '${template.name}' is nested inside itself`);\n else if (unplaced && domain) problems.push(`Template '${template.name}' is ambiguous: slot '${unplaced.slot}' is declared by ${unplaced.candidates.join(', ')}`);\n else if (!unplaced) problems.push(`Template '${template.name}' is unplaced: no layout or template declares slot '${template.fitsSlot}'`);\n }\n\n return problems;\n}\n"],"names":["verifyBlueprintPackage","source","library","options","manifest","name","label","foundation","foundationPackage","foundationPackageName","kind","PackageKind","Blueprint","problems","isValidVersion","version","push","blueprint","domain","undefined","available","Set","screenTemplates","flatMap","other","map","template","requireBlueprintMetadata","trim","isValidBlueprintDomain","description","length","maximumBlueprintDescriptionLength","thumbnailProblems","thumbnail","files","screenSetProblems","defaultSampleData","sampleData","some","reference","id","dependencies","dependency","validateSampleDataPackages","packs","includes","path","templateProblems","placementProblems","owner","isValidThumbnailPath","availableTemplates","set","screenSet","names","screen","has","add","title","parent","screens","candidate","isOwnAncestor","visited","current","find","described","dialogTemplates","everyTemplate","layouts","layout","metadata","describable","displayName","others","filter","entry","describeTemplateCatalog","package","type","blueprintTemplateTypes","join","category","startsWith","businessCategoryPrefix","own","fitsSlot","resolutions","resolution","resolveScreenTemplates","placements","placement","unplacedEverywhere","unplaced","candidates","cyclic","cycles","cycle","slot"],"mappings":";;;;;;;;;AAAA;AACA;AAsBA;;;;;;;;;;;;IAaO,SAASA,sBAAAA,CAAuBC,MAAuB,EAAEC,UAAqC,EAAE,EAAEC,OAAAA,GAAwC,EAAE,EAAA;IAC/I,MAAMC,QAAAA,GAAWH,OAAOG,QAAQ;IAChC,MAAMC,IAAAA,GAAOD,SAASC,IAAI;AAC1B,IAAA,MAAMC,QAAQ,CAAC,WAAW,EAAED,IAAAA,CAAK,CAAC,CAAC;IACnC,MAAME,UAAAA,GAAaJ,OAAAA,CAAQK,iBAAiB,IAAIC,oCAAAA;AAEhD,IAAA,IAAIL,SAASM,IAAI,KAAKC,uBAAAA,CAAYC,SAAS,EAAE,OAAO;AAAC,QAAA,CAAC,SAAS,EAAEP,IAAAA,CAAK,4BAA4B;AAAE,KAAA;AAEpG,IAAA,MAAMQ,WAAqB,EAAE;AAC7B,IAAA,IAAI,CAACC,kCAAAA,CAAeV,QAAAA,CAASW,OAAO,CAAA,EAAGF,SAASG,IAAI,CAAC,CAAA,EAAGV,KAAAA,CAAM,8BAA8B,EAAEF,QAAAA,CAASW,OAAO,IAAI,EAAA,CAAG,CAAC,CAAC,CAAA;IAEvH,MAAME,SAAAA,GAAYb,SAASa,SAAS;AACpC,IAAA,MAAMC,SAASD,SAAAA,KAAcE,SAAAA;IAC7B,MAAMC,SAAAA,GAAY,IAAIC,GAAAA,CAAI;WAAKpB,MAAAA,CAAOqB,eAAe,IAAI,EAAE;AAAMpB,QAAAA,GAAAA,OAAAA,CAAQqB,OAAO,CAACC,CAAAA,QAASA,KAAAA,CAAMF,eAAe,IAAI,EAAE;AAAE,KAAA,CAACG,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAASrB,IAAI,CAAA,CAAA;AAErJ,IAAA,IAAI,CAACY,SAAAA,EAAW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IAAI,CAAC,CAAC,UAAU,EAAEU,QAAAA,CAASrB,IAAI,CAAC,sBAAsB,EAAEyF,QAAAA,CAASK,IAAI,CAAC,iBAAiB,EAAEL,SAASC,UAAU,CAACb,IAAI,CAAC,IAAA,CAAA,CAAA,CAAO,CAAA;AAC1J,aAAA,IAAI,CAACY,QAAAA,EAAUjF,QAAAA,CAASG,IAAI,CAAC,CAAC,UAAU,EAAEU,QAAAA,CAASrB,IAAI,CAAC,oDAAoD,EAAEqB,SAAS6D,QAAQ,CAAC,CAAC,CAAC,CAAA;AAC3I,IAAA;IAEA,OAAO1E,QAAAA;AACX;;"}
package/dist/cjs/index.js CHANGED
@@ -51,6 +51,10 @@ var describeTemplateCatalog = require('./templates/describeTemplateCatalog.js');
51
51
  var resolveTemplateReference = require('./templates/resolveTemplateReference.js');
52
52
  var templateMetadataRules = require('./templates/templateMetadataRules.js');
53
53
  var validateTemplateMetadata = require('./templates/validateTemplateMetadata.js');
54
+ var blueprintRules = require('./blueprints/blueprintRules.js');
55
+ var verifyBlueprintPackage = require('./blueprints/verifyBlueprintPackage.js');
56
+ var describeBlueprintCatalog = require('./blueprints/describeBlueprintCatalog.js');
57
+ var evaluateBlueprintPin = require('./blueprints/evaluateBlueprintPin.js');
54
58
  var buildStarterProfile = require('./buildStarterProfile.js');
55
59
  var incompatibleStarterThemes = require('./incompatibleStarterThemes.js');
56
60
  var runActions = require('./runActions.js');
@@ -168,6 +172,7 @@ exports.applicableThemePackages = themeCompatibility.applicableThemePackages;
168
172
  exports.incompatiblePackages = themeCompatibility.incompatiblePackages;
169
173
  exports.isThemeCompatible = themeCompatibility.isThemeCompatible;
170
174
  exports.isPackageSelectionValid = PackageSelection.isPackageSelectionValid;
175
+ exports.compareVersions = packageVersionRange.compareVersions;
171
176
  exports.isValidVersion = packageVersionRange.isValidVersion;
172
177
  exports.isValidVersionRange = packageVersionRange.isValidVersionRange;
173
178
  exports.isVersionSatisfiedBy = packageVersionRange.isVersionSatisfiedBy;
@@ -196,6 +201,18 @@ exports.isSpdxExpression = templateMetadataRules.isSpdxExpression;
196
201
  exports.templateCategoryMissingCode = validateTemplateMetadata.templateCategoryMissingCode;
197
202
  exports.validateTemplateCategory = validateTemplateMetadata.validateTemplateCategory;
198
203
  exports.validateTemplateMetadata = validateTemplateMetadata.validateTemplateMetadata;
204
+ exports.blueprintTemplateTypes = blueprintRules.blueprintTemplateTypes;
205
+ exports.businessCategoryPrefix = blueprintRules.businessCategoryPrefix;
206
+ exports.foundationPackageName = blueprintRules.foundationPackageName;
207
+ exports.isValidBlueprintDomain = blueprintRules.isValidBlueprintDomain;
208
+ exports.isValidThumbnailPath = blueprintRules.isValidThumbnailPath;
209
+ exports.maximumBlueprintDescriptionLength = blueprintRules.maximumBlueprintDescriptionLength;
210
+ exports.verifyBlueprintPackage = verifyBlueprintPackage.verifyBlueprintPackage;
211
+ exports.describeBlueprintCatalog = describeBlueprintCatalog.describeBlueprintCatalog;
212
+ exports.toBlueprintCatalogFile = describeBlueprintCatalog.toBlueprintCatalogFile;
213
+ exports.BlueprintPinStatus = evaluateBlueprintPin.BlueprintPinStatus;
214
+ exports.defaultBlueprintPin = evaluateBlueprintPin.defaultBlueprintPin;
215
+ exports.evaluateBlueprintPin = evaluateBlueprintPin.evaluateBlueprintPin;
199
216
  exports.buildStarterProfile = buildStarterProfile.buildStarterProfile;
200
217
  exports.incompatibleStarterThemes = incompatibleStarterThemes.incompatibleStarterThemes;
201
218
  exports.InteractionStop = runActions.InteractionStop;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -56,6 +56,16 @@
56
56
  */ function isValidVersion(version) {
57
57
  return version !== undefined && version.trim().length > 0 && parseVersion(version) !== undefined;
58
58
  }
59
+ /**
60
+ * Compares two versions as `major.minor.patch`, pre-release and build suffixes ignored: negative when the first is older, zero when equal,
61
+ * positive when it is newer. A value that is not a version compares as older than every version, and equal to another that is not.
62
+ */ function compareVersions(left, right) {
63
+ const first = parseVersion(left);
64
+ const second = parseVersion(right);
65
+ if (!first) return second ? -1 : 0;
66
+ if (!second) return 1;
67
+ return compare(first, second);
68
+ }
59
69
  function splitRange(range) {
60
70
  for (const operator of [
61
71
  '>=',
@@ -123,6 +133,7 @@ function parseVersion(value) {
123
133
  return components;
124
134
  }
125
135
 
136
+ exports.compareVersions = compareVersions;
126
137
  exports.isValidVersion = isValidVersion;
127
138
  exports.isValidVersionRange = isValidVersionRange;
128
139
  exports.isVersionSatisfiedBy = isVersionSatisfiedBy;
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersionRange.js","sources":["../../packageVersionRange.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 * Checks a {@link PackageDependency.versionRange} against a package's actual version. A deliberately\n * small subset of semver — enough to express what a package declaration realistically needs, and small\n * enough that the C# twin in `Cratis.Scene.Engine` can match it exactly rather than approximately. Both\n * sides are asserted against the same shared fixture corpus.\n *\n * Supported: an empty range or `*` (anything), a bare or `=`-prefixed exact version, `^` (npm caret —\n * compatible within the leftmost non-zero component), `~` (patch-level changes), and the comparisons\n * `>=`, `>`, `<=`, `<`. Versions are read as `major.minor.patch` with any pre-release or build metadata\n * suffix ignored. Anything the parser does not recognize is treated as unsatisfiable rather than as\n * \"anything\", so a typo surfaces as a conflict instead of silently passing.\n */\nexport function isVersionSatisfiedBy(version: string, range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n\n const actual = parseVersion(version);\n if (!actual) return false;\n\n const [operator, literal] = splitRange(trimmed);\n const required = parseVersion(literal);\n if (!required) return false;\n\n switch (operator) {\n case '^':\n return compare(actual, required) >= 0 && compare(actual, caretUpperBound(required)) < 0;\n case '~':\n return compare(actual, required) >= 0 && compare(actual, [required[0], required[1] + 1, 0]) < 0;\n case '>=':\n return compare(actual, required) >= 0;\n case '>':\n return compare(actual, required) > 0;\n case '<=':\n return compare(actual, required) <= 0;\n case '<':\n return compare(actual, required) < 0;\n default:\n return compare(actual, required) === 0;\n }\n}\n\n/**\n * Whether a range is one {@link isVersionSatisfiedBy} understands. An empty range or `*` is valid and means\n * \"any version\"; anything the parser cannot read is invalid, so declarations can be rejected up front\n * instead of surfacing later as a conflict nobody can satisfy.\n */\nexport function isValidVersionRange(range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n return parseVersion(splitRange(trimmed)[1]) !== undefined;\n}\n\n/**\n * Whether a value is a `major.minor.patch` version, optionally with a pre-release or build suffix.\n */\nexport function isValidVersion(version: string | undefined): boolean {\n return version !== undefined && version.trim().length > 0 && parseVersion(version) !== undefined;\n}\n\ntype Version = [number, number, number];\n\nfunction splitRange(range: string): [string, string] {\n for (const operator of ['>=', '<=', '^', '~', '>', '<', '=']) {\n if (range.startsWith(operator)) {\n return [operator === '=' ? '' : operator, range.substring(operator.length).trim()];\n }\n }\n\n return ['', range];\n}\n\n/**\n * npm's caret rule: compatibility is bounded by the leftmost non-zero component, so `^1.2.3` allows\n * anything below `2.0.0`, `^0.2.3` anything below `0.3.0`, and `^0.0.3` only `0.0.3` itself.\n */\nfunction caretUpperBound(version: Version): Version {\n if (version[0] > 0) return [version[0] + 1, 0, 0];\n if (version[1] > 0) return [0, version[1] + 1, 0];\n return [0, 0, version[2] + 1];\n}\n\nfunction compare(left: Version, right: Version): number {\n if (left[0] !== right[0]) return left[0] - right[0];\n if (left[1] !== right[1]) return left[1] - right[1];\n return left[2] - right[2];\n}\n\nfunction parseVersion(value: string): Version | undefined {\n let numeric = value.trim();\n const suffix = numeric.search(/[-+]/);\n if (suffix >= 0) {\n numeric = numeric.substring(0, suffix);\n }\n\n const parts = numeric.split('.');\n if (parts.length === 0 || parts.length > 3) return undefined;\n\n const components: Version = [0, 0, 0];\n for (let index = 0; index < parts.length; index++) {\n if (!/^\\d+$/.test(parts[index])) return undefined;\n components[index] = parseInt(parts[index], 10);\n }\n\n return components;\n}\n"],"names":["isVersionSatisfiedBy","version","range","trimmed","trim","actual","parseVersion","operator","literal","splitRange","required","compare","caretUpperBound","isValidVersionRange","undefined","isValidVersion","length","startsWith","substring","left","right","value","numeric","suffix","search","parts","split","components","index","test","parseInt"],"mappings":";;AAAA;AACA;AAEA;;;;;;;;;;;AAWC,IACM,SAASA,oBAAAA,CAAqBC,OAAe,EAAEC,KAAyB,EAAA;AAC3E,IAAA,MAAMC,UAAUD,KAAAA,EAAOE,IAAAA,EAAAA;AACvB,IAAA,IAAI,CAACD,OAAAA,IAAWA,OAAAA,KAAY,GAAA,EAAK,OAAO,IAAA;AAExC,IAAA,MAAME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AAC/C,IAAA;IAEA,OAAOD,UAAAA;AACX;;;;"}
1
+ {"version":3,"file":"packageVersionRange.js","sources":["../../packageVersionRange.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 * Checks a {@link PackageDependency.versionRange} against a package's actual version. A deliberately\n * small subset of semver — enough to express what a package declaration realistically needs, and small\n * enough that the C# twin in `Cratis.Scene.Engine` can match it exactly rather than approximately. Both\n * sides are asserted against the same shared fixture corpus.\n *\n * Supported: an empty range or `*` (anything), a bare or `=`-prefixed exact version, `^` (npm caret —\n * compatible within the leftmost non-zero component), `~` (patch-level changes), and the comparisons\n * `>=`, `>`, `<=`, `<`. Versions are read as `major.minor.patch` with any pre-release or build metadata\n * suffix ignored. Anything the parser does not recognize is treated as unsatisfiable rather than as\n * \"anything\", so a typo surfaces as a conflict instead of silently passing.\n */\nexport function isVersionSatisfiedBy(version: string, range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n\n const actual = parseVersion(version);\n if (!actual) return false;\n\n const [operator, literal] = splitRange(trimmed);\n const required = parseVersion(literal);\n if (!required) return false;\n\n switch (operator) {\n case '^':\n return compare(actual, required) >= 0 && compare(actual, caretUpperBound(required)) < 0;\n case '~':\n return compare(actual, required) >= 0 && compare(actual, [required[0], required[1] + 1, 0]) < 0;\n case '>=':\n return compare(actual, required) >= 0;\n case '>':\n return compare(actual, required) > 0;\n case '<=':\n return compare(actual, required) <= 0;\n case '<':\n return compare(actual, required) < 0;\n default:\n return compare(actual, required) === 0;\n }\n}\n\n/**\n * Whether a range is one {@link isVersionSatisfiedBy} understands. An empty range or `*` is valid and means\n * \"any version\"; anything the parser cannot read is invalid, so declarations can be rejected up front\n * instead of surfacing later as a conflict nobody can satisfy.\n */\nexport function isValidVersionRange(range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n return parseVersion(splitRange(trimmed)[1]) !== undefined;\n}\n\n/**\n * Whether a value is a `major.minor.patch` version, optionally with a pre-release or build suffix.\n */\nexport function isValidVersion(version: string | undefined): boolean {\n return version !== undefined && version.trim().length > 0 && parseVersion(version) !== undefined;\n}\n\n/**\n * Compares two versions as `major.minor.patch`, pre-release and build suffixes ignored: negative when the first is older, zero when equal,\n * positive when it is newer. A value that is not a version compares as older than every version, and equal to another that is not.\n */\nexport function compareVersions(left: string, right: string): number {\n const first = parseVersion(left);\n const second = parseVersion(right);\n if (!first) return second ? -1 : 0;\n if (!second) return 1;\n return compare(first, second);\n}\n\ntype Version = [number, number, number];\n\nfunction splitRange(range: string): [string, string] {\n for (const operator of ['>=', '<=', '^', '~', '>', '<', '=']) {\n if (range.startsWith(operator)) {\n return [operator === '=' ? '' : operator, range.substring(operator.length).trim()];\n }\n }\n\n return ['', range];\n}\n\n/**\n * npm's caret rule: compatibility is bounded by the leftmost non-zero component, so `^1.2.3` allows\n * anything below `2.0.0`, `^0.2.3` anything below `0.3.0`, and `^0.0.3` only `0.0.3` itself.\n */\nfunction caretUpperBound(version: Version): Version {\n if (version[0] > 0) return [version[0] + 1, 0, 0];\n if (version[1] > 0) return [0, version[1] + 1, 0];\n return [0, 0, version[2] + 1];\n}\n\nfunction compare(left: Version, right: Version): number {\n if (left[0] !== right[0]) return left[0] - right[0];\n if (left[1] !== right[1]) return left[1] - right[1];\n return left[2] - right[2];\n}\n\nfunction parseVersion(value: string): Version | undefined {\n let numeric = value.trim();\n const suffix = numeric.search(/[-+]/);\n if (suffix >= 0) {\n numeric = numeric.substring(0, suffix);\n }\n\n const parts = numeric.split('.');\n if (parts.length === 0 || parts.length > 3) return undefined;\n\n const components: Version = [0, 0, 0];\n for (let index = 0; index < parts.length; index++) {\n if (!/^\\d+$/.test(parts[index])) return undefined;\n components[index] = parseInt(parts[index], 10);\n }\n\n return components;\n}\n"],"names":["isVersionSatisfiedBy","version","range","trimmed","trim","actual","parseVersion","operator","literal","splitRange","required","compare","caretUpperBound","isValidVersionRange","undefined","isValidVersion","length","compareVersions","left","right","first","second","startsWith","substring","value","numeric","suffix","search","parts","split","components","index","test","parseInt"],"mappings":";;AAAA;AACA;AAEA;;;;;;;;;;;AAWC,IACM,SAASA,oBAAAA,CAAqBC,OAAe,EAAEC,KAAyB,EAAA;AAC3E,IAAA,MAAMC,UAAUD,KAAAA,EAAOE,IAAAA,EAAAA;AACvB,IAAA,IAAI,CAACD,OAAAA,IAAWA,OAAAA,KAAY,GAAA,EAAK,OAAO,IAAA;AAExC,IAAA,MAAME,SAASC,YAAAA,CAAaL,OAAAA,CAAAA;IAC5B,IAAI,CAACI,QAAQ,OAAO,KAAA;AAEpB,IAAA,MAAM,CAACE,QAAAA,EAAUC,OAAAA,CAAQ,GAAGC,UAAAA,CAAWN,OAAAA,CAAAA;AACvC,IAAA,MAAMO,WAAWJ,YAAAA,CAAaE,OAAAA,CAAAA;IAC9B,IAAI,CAACE,UAAU,OAAO,KAAA;IAEtB,OAAQH,QAAAA;QACJ,KAAK,GAAA;AACD,YAAA,OAAOI,QAAQN,MAAAA,EAAQK,QAAAA,CAAAA,IAAa,KAAKC,OAAAA,CAAQN,MAAAA,EAAQO,gBAAgBF,QAAAA,CAAAA,CAAAA,GAAa,CAAA;QAC1F,KAAK,GAAA;AACD,YAAA,OAAOC,OAAAA,CAAQN,MAAAA,EAAQK,QAAAA,CAAAA,IAAa,CAAA,IAAKC,QAAQN,MAAAA,EAAQ;AAACK,gBAAAA,QAAQ,CAAC,CAAA,CAAE;gBAAEA,QAAQ,CAAC,EAAE,GAAG,CAAA;AAAG,gBAAA;aAAE,CAAA,GAAI,CAAA;QAClG,KAAK,IAAA;YACD,OAAOC,OAAAA,CAAQN,QAAQK,QAAAA,CAAAA,IAAa,CAAA;QACxC,KAAK,GAAA;YACD,OAAOC,OAAAA,CAAQN,QAAQK,QAAAA,CAAAA,GAAY,CAAA;QACvC,KAAK,IAAA;YACD,OAAOC,OAAAA,CAAQN,QAAQK,QAAAA,CAAAA,I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AQE,MAAM,CAAC,MAAA,CAAA;AAC9B,IAAA,IAAID,UAAU,CAAA,EAAG;QACbD,OAAAA,GAAUA,OAAAA,CAAQF,SAAS,CAAC,CAAA,EAAGG,MAAAA,CAAAA;AACnC,IAAA;IAEA,MAAME,KAAAA,GAAQH,OAAAA,CAAQI,KAAK,CAAC,GAAA,CAAA;IAC5B,IAAID,KAAAA,CAAMZ,MAAM,KAAK,CAAA,IAAKY,MAAMZ,MAAM,GAAG,GAAG,OAAOF,SAAAA;AAEnD,IAAA,MAAMgB,UAAAA,GAAsB;AAAC,QAAA,CAAA;AAAG,QAAA,CAAA;AAAG,QAAA;AAAE,KAAA;AACrC,IAAA,IAAK,IAAIC,KAAAA,GAAQ,CAAA,EAAGA,QAAQH,KAAAA,CAAMZ,MAAM,EAAEe,KAAAA,EAAAA,CAAS;QAC/C,IAAI,CAAC,QAAQC,IAAI,CAACJ,KAAK,CAACG,KAAAA,CAAM,GAAG,OAAOjB,SAAAA;AACxCgB,QAAAA,UAAU,CAACC,KAAAA,CAAM,GAAGE,SAASL,KAAK,CAACG,MAAM,EAAE,EAAA,CAAA;AAC/C,IAAA;IAEA,OAAOD,UAAAA;AACX;;;;;"}
@@ -0,0 +1,46 @@
1
+ export interface BlueprintCatalogScreen {
2
+ name: string;
3
+ title: string;
4
+ description?: string;
5
+ template?: string;
6
+ parent?: string;
7
+ order?: number;
8
+ }
9
+ export interface BlueprintCatalogTemplate {
10
+ name: string;
11
+ kind: string;
12
+ displayName?: string;
13
+ description?: string;
14
+ type?: string;
15
+ category?: string;
16
+ thumbnail?: string;
17
+ }
18
+ export interface BlueprintCatalogSampleData {
19
+ id: string;
20
+ title: string;
21
+ locale: string;
22
+ path: string;
23
+ default: boolean;
24
+ }
25
+ export interface BlueprintCatalogEntry {
26
+ package: string;
27
+ version: string;
28
+ domain: string;
29
+ displayName?: string;
30
+ description: string;
31
+ thumbnail: string;
32
+ license?: string;
33
+ licenseUrl?: string;
34
+ dependencies: {
35
+ name: string;
36
+ versionRange?: string;
37
+ }[];
38
+ screens: BlueprintCatalogScreen[];
39
+ templates: BlueprintCatalogTemplate[];
40
+ sampleData: BlueprintCatalogSampleData[];
41
+ }
42
+ export interface BlueprintCatalogFile {
43
+ schema: 1;
44
+ blueprints: BlueprintCatalogEntry[];
45
+ }
46
+ //# sourceMappingURL=BlueprintCatalogEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlueprintCatalogEntry.d.ts","sourceRoot":"","sources":["../../../blueprints/BlueprintCatalogEntry.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,0BAA0B;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB;AAMD,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAClC,SAAS,EAAE,wBAAwB,EAAE,CAAC;IACtC,UAAU,EAAE,0BAA0B,EAAE,CAAC;CAC5C;AAGD,MAAM,WAAW,oBAAoB;IAEjC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,qBAAqB,EAAE,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BlueprintCatalogEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlueprintCatalogEntry.js","sourceRoot":"","sources":["../../../blueprints/BlueprintCatalogEntry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { SampleDataPack, Screen } from '@cratis/scene.model';
2
+ import { TemplateSource } from '../templates/TemplateSource';
3
+ export interface BlueprintSource extends TemplateSource {
4
+ screens?: Screen[];
5
+ packs?: SampleDataPack[];
6
+ files?: string[];
7
+ }
8
+ //# sourceMappingURL=BlueprintSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlueprintSource.d.ts","sourceRoot":"","sources":["../../../blueprints/BlueprintSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO7D,MAAM,WAAW,eAAgB,SAAQ,cAAc;IAEnD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IAMzB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BlueprintSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlueprintSource.js","sourceRoot":"","sources":["../../../blueprints/BlueprintSource.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare const foundationPackageName = "Cratis.Blueprint.Default";
2
+ export declare const blueprintTemplateTypes: readonly string[];
3
+ export declare const businessCategoryPrefix = "Business / ";
4
+ export declare const maximumBlueprintDescriptionLength = 200;
5
+ export declare const isValidBlueprintDomain: (domain: string | undefined) => boolean;
6
+ export declare const isValidThumbnailPath: (path: string | undefined) => boolean;
7
+ //# sourceMappingURL=blueprintRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprintRules.d.ts","sourceRoot":"","sources":["../../../blueprints/blueprintRules.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAGhE,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAgH,CAAC;AAGrK,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAGpD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAMrD,eAAO,MAAM,sBAAsB,WAAY,MAAM,GAAG,SAAS,KAAG,OAA6D,CAAC;AAGlI,eAAO,MAAM,oBAAoB,SAAU,MAAM,GAAG,SAAS,KAAG,OAA4D,CAAC"}
@@ -0,0 +1,25 @@
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
+ /** The name of the package that provides the foundation layouts and templates every domain blueprint builds on. */ const foundationPackageName = 'Cratis.Blueprint.Default';
4
+ /** The template types a domain blueprint may declare (Part B 1.2). */ const blueprintTemplateTypes = [
5
+ 'Shell',
6
+ 'Workspace',
7
+ 'Dashboard',
8
+ 'List',
9
+ 'Board',
10
+ 'Detail',
11
+ 'Form',
12
+ 'Wizard',
13
+ 'Dialog',
14
+ 'Auth',
15
+ 'State'
16
+ ];
17
+ /** The prefix every template category of a domain blueprint starts with; the rest is the domain. */ const businessCategoryPrefix = 'Business / ';
18
+ /** The longest a blueprint description may be. */ const maximumBlueprintDescriptionLength = 200;
19
+ const domainPattern = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
20
+ const thumbnailPattern = /^thumbnails\/[A-Za-z0-9][A-Za-z0-9._-]*\.(png|webp|jpg|svg)$/;
21
+ /** Whether a value is a lower-case domain slug: `crm`, `project-tracker`. */ const isValidBlueprintDomain = (domain)=>domain !== undefined && domainPattern.test(domain);
22
+ /** Whether a value is a package-relative thumbnail path: `thumbnails/<name>.png`, `.webp`, `.jpg` or `.svg`. */ const isValidThumbnailPath = (path)=>path !== undefined && thumbnailPattern.test(path);
23
+
24
+ export { blueprintTemplateTypes, businessCategoryPrefix, foundationPackageName, isValidBlueprintDomain, isValidThumbnailPath, maximumBlueprintDescriptionLength };
25
+ //# sourceMappingURL=blueprintRules.js.map