@fgv/ts-res 5.0.0-2 → 5.0.0-21
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/.vscode/4.json +3 -0
- package/.vscode/launch.json +16 -0
- package/.vscode/settings.json +3 -0
- package/config/api-extractor.json +343 -0
- package/config/rig.json +16 -0
- package/dist/ts-res.d.ts +1528 -161
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.ts +11 -2
- package/lib/index.js +25 -2
- package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
- package/lib/packlets/bundle/bundleBuilder.js +134 -0
- package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
- package/lib/packlets/bundle/bundleLoader.js +105 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
- package/lib/packlets/bundle/bundleNormalizer.js +142 -0
- package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
- package/lib/packlets/bundle/bundleUtils.js +117 -0
- package/lib/packlets/bundle/convert.d.ts +33 -0
- package/lib/packlets/bundle/convert.js +78 -0
- package/lib/packlets/bundle/index.d.ts +21 -0
- package/lib/packlets/bundle/index.js +83 -0
- package/lib/packlets/bundle/model.d.ts +100 -0
- package/lib/packlets/bundle/model.js +24 -0
- package/lib/packlets/common/helpers/resources.d.ts +7 -0
- package/lib/packlets/common/helpers/resources.js +12 -0
- package/lib/packlets/common/resources.d.ts +8 -0
- package/lib/packlets/conditions/conditionSet.d.ts +9 -0
- package/lib/packlets/conditions/conditionSet.js +74 -1
- package/lib/packlets/config/configInitFactory.d.ts +78 -0
- package/lib/packlets/config/configInitFactory.js +147 -0
- package/lib/packlets/config/convert.d.ts +9 -0
- package/lib/packlets/config/convert.js +11 -0
- package/lib/packlets/config/index.d.ts +1 -0
- package/lib/packlets/config/index.js +1 -0
- package/lib/packlets/config/systemConfiguration.d.ts +16 -3
- package/lib/packlets/config/systemConfiguration.js +19 -40
- package/lib/packlets/import/fsItem.js +8 -13
- package/lib/packlets/import/importers/jsonImporter.js +1 -0
- package/lib/packlets/qualifier-types/config/json.d.ts +13 -0
- package/lib/packlets/qualifier-types/config/json.js +11 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +1 -1
- package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
- package/lib/packlets/resource-types/jsonResourceType.d.ts +9 -4
- package/lib/packlets/resource-types/jsonResourceType.js +8 -1
- package/lib/packlets/resource-types/resourceType.d.ts +102 -13
- package/lib/packlets/resource-types/resourceType.js +34 -2
- package/lib/packlets/resources/common.d.ts +26 -0
- package/lib/packlets/resources/resource.d.ts +6 -6
- package/lib/packlets/resources/resource.js +3 -8
- package/lib/packlets/resources/resourceCandidate.d.ts +5 -1
- package/lib/packlets/resources/resourceCandidate.js +6 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +182 -11
- package/lib/packlets/resources/resourceManagerBuilder.js +469 -15
- package/lib/packlets/runtime/cacheListener.d.ts +9 -0
- package/lib/packlets/runtime/cacheListener.js +6 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts +6 -0
- package/lib/packlets/runtime/cacheMetrics.js +11 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +3 -3
- package/lib/packlets/runtime/compiledResourceCollection.js +7 -0
- package/lib/packlets/runtime/iResourceManager.d.ts +13 -5
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
- package/lib/packlets/runtime/resourceResolver.d.ts +21 -0
- package/lib/packlets/runtime/resourceResolver.js +39 -17
- package/lib/packlets/runtime/validate.js +1 -0
- package/lib/packlets/zip-archive/convert.d.ts +52 -0
- package/lib/packlets/zip-archive/convert.js +104 -0
- package/lib/packlets/zip-archive/index.d.ts +23 -0
- package/lib/packlets/zip-archive/index.js +95 -0
- package/lib/packlets/zip-archive/json.d.ts +64 -0
- package/lib/packlets/zip-archive/json.js +24 -0
- package/lib/packlets/zip-archive/types.d.ts +98 -0
- package/lib/packlets/zip-archive/types.js +39 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.js +194 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.js +285 -0
- package/lib/test/data/sample.json +32 -0
- package/lib/test/unit/bundle/bundleBuilder.test.d.ts +2 -0
- package/lib/test/unit/bundle/bundleLoader.test.d.ts +2 -0
- package/lib/test/unit/bundle/bundleUtils.test.d.ts +2 -0
- package/lib/test/unit/bundle/convert.test.d.ts +2 -0
- package/lib/test/unit/bundle/integration.test.d.ts +2 -0
- package/lib/test/unit/bundle/model.test.d.ts +2 -0
- package/lib/test/unit/bundle/normalization.test.d.ts +2 -0
- package/lib/test/unit/common/conditions.test.d.ts +2 -0
- package/lib/test/unit/common/helpers/conditions.test.d.ts +2 -0
- package/lib/test/unit/common/helpers/contexts.test.d.ts +2 -0
- package/lib/test/unit/common/helpers/qualifierDefaultValues.test.d.ts +2 -0
- package/lib/test/unit/common/resources.test.d.ts +2 -0
- package/lib/test/unit/conditions/condition.test.d.ts +2 -0
- package/lib/test/unit/conditions/conditionCollector.test.d.ts +2 -0
- package/lib/test/unit/conditions/conditionScoreAsDefault.test.d.ts +2 -0
- package/lib/test/unit/conditions/conditionSet.test.d.ts +2 -0
- package/lib/test/unit/conditions/conditionSetCollector.test.d.ts +2 -0
- package/lib/test/unit/conditions/conditionToken.test.d.ts +2 -0
- package/lib/test/unit/conditions/convert.test.d.ts +2 -0
- package/lib/test/unit/config/common.test.d.ts +2 -0
- package/lib/test/unit/config/convert.test.d.ts +2 -0
- package/lib/test/unit/config/predefined/default.test.d.ts +2 -0
- package/lib/test/unit/config/predefined/extended.test.d.ts +2 -0
- package/lib/test/unit/config/systemConfiguration.test.d.ts +2 -0
- package/lib/test/unit/config/systemConfigurationInitParams.test.d.ts +2 -0
- package/lib/test/unit/context/contextToken.test.d.ts +2 -0
- package/lib/test/unit/context/convert.test.d.ts +2 -0
- package/lib/test/unit/decisions/abstractDecision.test.d.ts +2 -0
- package/lib/test/unit/decisions/abstractDecisionCollector.test.d.ts +2 -0
- package/lib/test/unit/decisions/candidate.test.d.ts +2 -0
- package/lib/test/unit/decisions/concreteDecision.test.d.ts +2 -0
- package/lib/test/unit/decisions/decision.test.d.ts +2 -0
- package/lib/test/unit/import/collectionImporter.test.d.ts +2 -0
- package/lib/test/unit/import/fsItem.test.d.ts +2 -0
- package/lib/test/unit/import/fsItemImporter.test.d.ts +2 -0
- package/lib/test/unit/import/importContext.test.d.ts +2 -0
- package/lib/test/unit/import/importManager.test.d.ts +2 -0
- package/lib/test/unit/import/jsonImporter.test.d.ts +2 -0
- package/lib/test/unit/import/pathImporter.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/convert.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/helpers.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/languageQualifierType.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/literalQualifierType.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/literalValueHierarchy.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/qualifierType.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/qualifierTypeCollector.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/territoryQualifierType.test.d.ts +2 -0
- package/lib/test/unit/qualifier-types/testQualifierType.d.ts +15 -0
- package/lib/test/unit/qualifier-types/testQualifierType.js +89 -0
- package/lib/test/unit/qualifiers/convert.test.d.ts +2 -0
- package/lib/test/unit/qualifiers/qualifierCollector.test.d.ts +2 -0
- package/lib/test/unit/qualifiers/qualifierDefaultValue.test.d.ts +2 -0
- package/lib/test/unit/qualifiers/qualifierDefaultValueToken.test.d.ts +2 -0
- package/lib/test/unit/resource-json/convert.test.d.ts +2 -0
- package/lib/test/unit/resource-json/nameInheritance.test.d.ts +2 -0
- package/lib/test/unit/resource-json/resourceDeclCollection.test.d.ts +2 -0
- package/lib/test/unit/resource-json/resourceDeclTree.test.d.ts +2 -0
- package/lib/test/unit/resource-types/jsonResourceType.test.d.ts +2 -0
- package/lib/test/unit/resource-types/resourceTypeCollector.test.d.ts +2 -0
- package/lib/test/unit/resources/candidateReducer.integration.test.d.ts +2 -0
- package/lib/test/unit/resources/candidateReducer.test.d.ts +2 -0
- package/lib/test/unit/resources/reduceCandidates.test.d.ts +2 -0
- package/lib/test/unit/resources/reduceQualifiers.comprehensive.test.d.ts +2 -0
- package/lib/test/unit/resources/reduceQualifiers.test.d.ts +2 -0
- package/lib/test/unit/resources/resource.test.d.ts +2 -0
- package/lib/test/unit/resources/resourceBuilder.test.d.ts +2 -0
- package/lib/test/unit/resources/resourceCandidate.test.d.ts +2 -0
- package/lib/test/unit/resources/resourceManagerBuilder.clone.test.d.ts +2 -0
- package/lib/test/unit/resources/resourceManagerBuilder.getBuiltResourceTree.test.d.ts +2 -0
- package/lib/test/unit/resources/resourceManagerBuilder.test.d.ts +2 -0
- package/lib/test/unit/runtime/cacheListener.test.d.ts +2 -0
- package/lib/test/unit/runtime/cacheMetrics.test.d.ts +2 -0
- package/lib/test/unit/runtime/compiledResourceCollection.test.d.ts +2 -0
- package/lib/test/unit/runtime/conditionSetResolutionResult.comprehensive.test.d.ts +2 -0
- package/lib/test/unit/runtime/conditionSetResolutionResult.test.d.ts +2 -0
- package/lib/test/unit/runtime/context/contextQualifierProvider.test.d.ts +2 -0
- package/lib/test/unit/runtime/context/contextQualifierProviderValidator.test.d.ts +2 -0
- package/lib/test/unit/runtime/context/simpleContextQualifierProvider.test.d.ts +2 -0
- package/lib/test/unit/runtime/context/validatingSimpleContextQualifierProvider.test.d.ts +2 -0
- package/lib/test/unit/runtime/resource-tree/readOnlyResourceTree.test.d.ts +2 -0
- package/lib/test/unit/runtime/resource-tree/resourceTreeChildren.test.d.ts +2 -0
- package/lib/test/unit/runtime/resource-tree/resourceTreeChildrenValidator.test.d.ts +2 -0
- package/lib/test/unit/runtime/resourceResolver.defaultResolution.test.d.ts +2 -0
- package/lib/test/unit/runtime/resourceResolver.test.d.ts +2 -0
- package/lib/test/unit/runtime/validate.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/convert.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/json.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/zipArchiveCreator.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/zipArchiveFormat.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/zipArchiveIdempotency.test.d.ts +2 -0
- package/lib/test/unit/zip-archive/zipArchiveLoader.test.d.ts +2 -0
- package/package.json +19 -25
- package/src/index.ts +75 -0
- package/src/packlets/bundle/bundleBuilder.ts +159 -0
- package/src/packlets/bundle/bundleLoader.ts +157 -0
- package/src/packlets/bundle/bundleNormalizer.ts +173 -0
- package/src/packlets/bundle/bundleUtils.ts +142 -0
- package/src/packlets/bundle/convert.ts +87 -0
- package/src/packlets/bundle/index.ts +52 -0
- package/src/packlets/bundle/model.ts +138 -0
- package/src/packlets/common/conditions.ts +226 -0
- package/src/packlets/common/convert.ts +184 -0
- package/src/packlets/common/helpers/conditions.ts +84 -0
- package/src/packlets/common/helpers/context.ts +88 -0
- package/src/packlets/common/helpers/index.ts +26 -0
- package/src/packlets/common/helpers/qualifierDefaultValues.ts +91 -0
- package/src/packlets/common/helpers/resources.ts +96 -0
- package/src/packlets/common/index.ts +30 -0
- package/src/packlets/common/resources.ts +78 -0
- package/src/packlets/common/validate/conditions.ts +595 -0
- package/src/packlets/common/validate/index.ts +27 -0
- package/src/packlets/common/validate/regularExpressions.ts +92 -0
- package/src/packlets/common/validate/resources.ts +170 -0
- package/src/packlets/conditions/condition.ts +351 -0
- package/src/packlets/conditions/conditionCollector.ts +103 -0
- package/src/packlets/conditions/conditionDecls.ts +50 -0
- package/src/packlets/conditions/conditionSet.ts +318 -0
- package/src/packlets/conditions/conditionSetCollector.ts +127 -0
- package/src/packlets/conditions/conditionSetDecls.ts +41 -0
- package/src/packlets/conditions/conditionToken.ts +180 -0
- package/src/packlets/conditions/convert/conditionSetDecls.ts +72 -0
- package/src/packlets/conditions/convert/decls.ts +95 -0
- package/src/packlets/conditions/convert/index.ts +24 -0
- package/src/packlets/conditions/index.ts +33 -0
- package/src/packlets/config/common.ts +107 -0
- package/src/packlets/config/configInitFactory.ts +142 -0
- package/src/packlets/config/convert.ts +61 -0
- package/src/packlets/config/index.ts +30 -0
- package/src/packlets/config/json.ts +43 -0
- package/src/packlets/config/predefined/default.ts +150 -0
- package/src/packlets/config/predefined/extended.ts +198 -0
- package/src/packlets/config/predefined/index.ts +26 -0
- package/src/packlets/config/systemConfiguration.ts +217 -0
- package/src/packlets/context/contextDecls.ts +76 -0
- package/src/packlets/context/contextToken.ts +252 -0
- package/src/packlets/context/convert/decls.ts +126 -0
- package/src/packlets/context/convert/index.ts +23 -0
- package/src/packlets/context/index.ts +27 -0
- package/src/packlets/decisions/abstractDecision.ts +87 -0
- package/src/packlets/decisions/abstractDecisionCollector.ts +122 -0
- package/src/packlets/decisions/candidate.ts +101 -0
- package/src/packlets/decisions/common.ts +37 -0
- package/src/packlets/decisions/concreteDecision.ts +157 -0
- package/src/packlets/decisions/decision.ts +172 -0
- package/src/packlets/decisions/index.ts +28 -0
- package/src/packlets/import/fsItem.ts +212 -0
- package/src/packlets/import/importContext.ts +183 -0
- package/src/packlets/import/importManager.ts +187 -0
- package/src/packlets/import/importable.ts +107 -0
- package/src/packlets/import/importers/collectionImporter.ts +153 -0
- package/src/packlets/import/importers/fsItemImporter.ts +154 -0
- package/src/packlets/import/importers/importer.ts +58 -0
- package/src/packlets/import/importers/index.ts +27 -0
- package/src/packlets/import/importers/jsonImporter.ts +133 -0
- package/src/packlets/import/importers/pathImporter.ts +134 -0
- package/src/packlets/import/index.ts +29 -0
- package/src/packlets/qualifier-types/config/convert.ts +108 -0
- package/src/packlets/qualifier-types/config/index.ts +27 -0
- package/src/packlets/qualifier-types/config/json.ts +126 -0
- package/src/packlets/qualifier-types/convert.ts +77 -0
- package/src/packlets/qualifier-types/helpers.ts +94 -0
- package/src/packlets/qualifier-types/index.ts +34 -0
- package/src/packlets/qualifier-types/languageQualifierType.ts +143 -0
- package/src/packlets/qualifier-types/literalQualifierType.ts +244 -0
- package/src/packlets/qualifier-types/literalValueHierarchy.ts +332 -0
- package/src/packlets/qualifier-types/qualifierType.ts +360 -0
- package/src/packlets/qualifier-types/qualifierTypeCollector.ts +102 -0
- package/src/packlets/qualifier-types/territoryQualifierType.ts +255 -0
- package/src/packlets/qualifiers/convert/decls.ts +90 -0
- package/src/packlets/qualifiers/convert/index.ts +24 -0
- package/src/packlets/qualifiers/convert/qualifier.ts +55 -0
- package/src/packlets/qualifiers/index.ts +31 -0
- package/src/packlets/qualifiers/qualifier.ts +169 -0
- package/src/packlets/qualifiers/qualifierCollector.ts +194 -0
- package/src/packlets/qualifiers/qualifierDecl.ts +80 -0
- package/src/packlets/qualifiers/qualifierDefaultValueDecls.ts +57 -0
- package/src/packlets/qualifiers/qualifierDefaultValueToken.ts +230 -0
- package/src/packlets/resource-json/compiled/common.ts +35 -0
- package/src/packlets/resource-json/compiled/convert.ts +143 -0
- package/src/packlets/resource-json/compiled/index.ts +27 -0
- package/src/packlets/resource-json/compiled/json.ts +239 -0
- package/src/packlets/resource-json/convert.ts +236 -0
- package/src/packlets/resource-json/helpers.ts +284 -0
- package/src/packlets/resource-json/index.ts +33 -0
- package/src/packlets/resource-json/json.ts +295 -0
- package/src/packlets/resource-json/normalized.ts +211 -0
- package/src/packlets/resource-json/resourceDeclCollection.ts +117 -0
- package/src/packlets/resource-json/resourceDeclContainer.ts +48 -0
- package/src/packlets/resource-json/resourceDeclTree.ts +116 -0
- package/src/packlets/resource-types/config/convert.ts +36 -0
- package/src/packlets/resource-types/config/index.ts +27 -0
- package/src/packlets/resource-types/config/json.ts +30 -0
- package/src/packlets/resource-types/helpers.ts +44 -0
- package/src/packlets/resource-types/index.ts +30 -0
- package/src/packlets/resource-types/jsonResourceType.ts +104 -0
- package/src/packlets/resource-types/resourceType.ts +259 -0
- package/src/packlets/resource-types/resourceTypeCollector.ts +79 -0
- package/src/packlets/resources/candidateReducer.ts +331 -0
- package/src/packlets/resources/common.ts +114 -0
- package/src/packlets/resources/index.ts +28 -0
- package/src/packlets/resources/resource.ts +307 -0
- package/src/packlets/resources/resourceBuilder.ts +269 -0
- package/src/packlets/resources/resourceCandidate.ts +333 -0
- package/src/packlets/resources/resourceManagerBuilder.ts +1169 -0
- package/src/packlets/runtime/cacheListener.ts +113 -0
- package/src/packlets/runtime/cacheMetrics.ts +206 -0
- package/src/packlets/runtime/compiledResourceCollection.ts +607 -0
- package/src/packlets/runtime/conditionSetResolutionResult.ts +160 -0
- package/src/packlets/runtime/context/contextQualifierProvider.ts +117 -0
- package/src/packlets/runtime/context/contextQualifierProviderValidator.ts +281 -0
- package/src/packlets/runtime/context/index.ts +26 -0
- package/src/packlets/runtime/context/simpleContextQualifierProvider.ts +225 -0
- package/src/packlets/runtime/context/validatingSimpleContextQualifierProvider.ts +96 -0
- package/src/packlets/runtime/iResourceManager.ts +130 -0
- package/src/packlets/runtime/index.ts +35 -0
- package/src/packlets/runtime/resource-tree/common.ts +126 -0
- package/src/packlets/runtime/resource-tree/index.ts +26 -0
- package/src/packlets/runtime/resource-tree/readOnlyResourceTree.ts +342 -0
- package/src/packlets/runtime/resource-tree/resourceTreeChildren.ts +125 -0
- package/src/packlets/runtime/resource-tree/resourceTreeChildrenValidator.ts +187 -0
- package/src/packlets/runtime/resourceResolver.ts +626 -0
- package/src/packlets/runtime/validate.ts +63 -0
- package/src/packlets/zip-archive/convert.ts +121 -0
- package/src/packlets/zip-archive/index.ts +76 -0
- package/src/packlets/zip-archive/json.ts +91 -0
- package/src/packlets/zip-archive/types.ts +140 -0
- package/src/packlets/zip-archive/zipArchiveCreator.ts +229 -0
- package/src/packlets/zip-archive/zipArchiveFormat.ts +158 -0
- package/src/packlets/zip-archive/zipArchiveLoader.ts +370 -0
- package/CHANGELOG.md +0 -14
- package/CLAUDE.md +0 -186
- package/EXAMPLE_INIT_PARAMS.md +0 -88
- package/PROGRESS_SUMMARY.md +0 -48
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/packlets/common/conditions.d.ts.map +0 -1
- package/lib/packlets/common/conditions.js.map +0 -1
- package/lib/packlets/common/convert.d.ts.map +0 -1
- package/lib/packlets/common/convert.js.map +0 -1
- package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
- package/lib/packlets/common/helpers/conditions.js.map +0 -1
- package/lib/packlets/common/helpers/context.d.ts.map +0 -1
- package/lib/packlets/common/helpers/context.js.map +0 -1
- package/lib/packlets/common/helpers/index.d.ts.map +0 -1
- package/lib/packlets/common/helpers/index.js.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
- package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
- package/lib/packlets/common/helpers/resources.js.map +0 -1
- package/lib/packlets/common/index.d.ts.map +0 -1
- package/lib/packlets/common/index.js.map +0 -1
- package/lib/packlets/common/resources.d.ts.map +0 -1
- package/lib/packlets/common/resources.js.map +0 -1
- package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
- package/lib/packlets/common/validate/conditions.js.map +0 -1
- package/lib/packlets/common/validate/index.d.ts.map +0 -1
- package/lib/packlets/common/validate/index.js.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
- package/lib/packlets/common/validate/resources.d.ts.map +0 -1
- package/lib/packlets/common/validate/resources.js.map +0 -1
- package/lib/packlets/conditions/condition.d.ts.map +0 -1
- package/lib/packlets/conditions/condition.js.map +0 -1
- package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSet.js.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionToken.js.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/decls.js.map +0 -1
- package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/index.js.map +0 -1
- package/lib/packlets/conditions/index.d.ts.map +0 -1
- package/lib/packlets/conditions/index.js.map +0 -1
- package/lib/packlets/config/common.d.ts.map +0 -1
- package/lib/packlets/config/common.js.map +0 -1
- package/lib/packlets/config/convert.d.ts.map +0 -1
- package/lib/packlets/config/convert.js.map +0 -1
- package/lib/packlets/config/index.d.ts.map +0 -1
- package/lib/packlets/config/index.js.map +0 -1
- package/lib/packlets/config/json.d.ts.map +0 -1
- package/lib/packlets/config/json.js.map +0 -1
- package/lib/packlets/config/predefined/default.d.ts.map +0 -1
- package/lib/packlets/config/predefined/default.js.map +0 -1
- package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
- package/lib/packlets/config/predefined/extended.js.map +0 -1
- package/lib/packlets/config/predefined/index.d.ts.map +0 -1
- package/lib/packlets/config/predefined/index.js.map +0 -1
- package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
- package/lib/packlets/config/systemConfiguration.js.map +0 -1
- package/lib/packlets/context/contextDecls.d.ts.map +0 -1
- package/lib/packlets/context/contextDecls.js.map +0 -1
- package/lib/packlets/context/contextToken.d.ts.map +0 -1
- package/lib/packlets/context/contextToken.js.map +0 -1
- package/lib/packlets/context/convert/decls.d.ts.map +0 -1
- package/lib/packlets/context/convert/decls.js.map +0 -1
- package/lib/packlets/context/convert/index.d.ts.map +0 -1
- package/lib/packlets/context/convert/index.js.map +0 -1
- package/lib/packlets/context/index.d.ts.map +0 -1
- package/lib/packlets/context/index.js.map +0 -1
- package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecision.js.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
- package/lib/packlets/decisions/candidate.d.ts.map +0 -1
- package/lib/packlets/decisions/candidate.js.map +0 -1
- package/lib/packlets/decisions/common.d.ts.map +0 -1
- package/lib/packlets/decisions/common.js.map +0 -1
- package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/concreteDecision.js.map +0 -1
- package/lib/packlets/decisions/decision.d.ts.map +0 -1
- package/lib/packlets/decisions/decision.js.map +0 -1
- package/lib/packlets/decisions/index.d.ts.map +0 -1
- package/lib/packlets/decisions/index.js.map +0 -1
- package/lib/packlets/import/fsItem.d.ts.map +0 -1
- package/lib/packlets/import/fsItem.js.map +0 -1
- package/lib/packlets/import/importContext.d.ts.map +0 -1
- package/lib/packlets/import/importContext.js.map +0 -1
- package/lib/packlets/import/importManager.d.ts.map +0 -1
- package/lib/packlets/import/importManager.js.map +0 -1
- package/lib/packlets/import/importable.d.ts.map +0 -1
- package/lib/packlets/import/importable.js.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
- package/lib/packlets/import/importers/importer.d.ts.map +0 -1
- package/lib/packlets/import/importers/importer.js.map +0 -1
- package/lib/packlets/import/importers/index.d.ts.map +0 -1
- package/lib/packlets/import/importers/index.js.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
- package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/pathImporter.js.map +0 -1
- package/lib/packlets/import/index.d.ts.map +0 -1
- package/lib/packlets/import/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/json.js.map +0 -1
- package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/helpers.js.map +0 -1
- package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/index.js.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
- package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/index.js.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/index.js.map +0 -1
- package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
- package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/common.js.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
- package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/index.js.map +0 -1
- package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/json.js.map +0 -1
- package/lib/packlets/resource-json/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/convert.js.map +0 -1
- package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-json/helpers.js.map +0 -1
- package/lib/packlets/resource-json/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/index.js.map +0 -1
- package/lib/packlets/resource-json/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/json.js.map +0 -1
- package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
- package/lib/packlets/resource-json/normalized.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
- package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/convert.js.map +0 -1
- package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/index.js.map +0 -1
- package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/json.js.map +0 -1
- package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-types/helpers.js.map +0 -1
- package/lib/packlets/resource-types/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/index.js.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
- package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
- package/lib/packlets/resources/candidateReducer.js.map +0 -1
- package/lib/packlets/resources/common.d.ts.map +0 -1
- package/lib/packlets/resources/common.js.map +0 -1
- package/lib/packlets/resources/index.d.ts.map +0 -1
- package/lib/packlets/resources/index.js.map +0 -1
- package/lib/packlets/resources/resource.d.ts.map +0 -1
- package/lib/packlets/resources/resource.js.map +0 -1
- package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceBuilder.js.map +0 -1
- package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
- package/lib/packlets/resources/resourceCandidate.js.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
- package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheListener.js.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
- package/lib/packlets/runtime/context/index.d.ts.map +0 -1
- package/lib/packlets/runtime/context/index.js.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
- package/lib/packlets/runtime/iResourceManager.js.map +0 -1
- package/lib/packlets/runtime/index.d.ts.map +0 -1
- package/lib/packlets/runtime/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
- package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
- package/lib/packlets/runtime/resourceResolver.js.map +0 -1
- package/lib/packlets/runtime/validate.d.ts.map +0 -1
- package/lib/packlets/runtime/validate.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regularExpressions.js","sourceRoot":"","sources":["../../../../src/packlets/common/validate/regularExpressions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH;;GAEG;AACU,QAAA,UAAU,GAAW,4BAA4B,CAAC;AAE/D;;GAEG;AACU,QAAA,mBAAmB,GAAW,yDAAyD,CAAC;AAErG;;GAEG;AACU,QAAA,cAAc,GAAW,wDAAwD,CAAC;AAE/F;;;;;GAKG;AACU,QAAA,YAAY,GACvB,wFAAwF,CAAC;AAE3F;;;;;GAKG;AACU,QAAA,cAAc,GAAW,iDAAiD,CAAC;AAExF;;;;GAIG;AACU,QAAA,YAAY,GAAW,oDAAoD,CAAC;AAEzF;;GAEG;AACU,QAAA,gBAAgB,GAAW,kBAAkB,CAAC;AAE3D;;GAEG;AACU,QAAA,WAAW,GAAW,4DAA4D,CAAC;AAEhG;;;;;GAKG;AACU,QAAA,0BAA0B,GAAW,oDAAoD,CAAC;AAEvG;;;;;GAKG;AACU,QAAA,2BAA2B,GACtC,2GAA2G,CAAC;AAE9G;;GAEG;AACU,QAAA,aAAa,GAAW,eAAe,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * @internal\n */\nexport const identifier: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*$/;\n\n/**\n * @internal\n */\nexport const segmentedIdentifier: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*(\\.[a-zA-Z_][a-zA-Z0-9_\\-]*)*$/;\n\n/**\n * @internal\n */\nexport const identifierList: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*(,[a-zA-Z_][a-zA-Z0-9_\\-]*)*$/;\n\n/**\n * The format of a {@link ConditionKey | condition key} is:\n * <qualifierName>-[<value>][\\@<priority>](<scoreAsDefault>) where operator is `matches`, or\n * <qualifierName>-<operator>-[<value>][\\@<priority>](<scoreAsDefault>)\n * @internal\n */\nexport const conditionKey: RegExp =\n /^[a-zA-Z_][a-zA-Z0-9_\\-]*(-matches)?-\\[.*\\](?:@[0-9]{1,4})?(?:\\([01](?:\\.[0-9]+)?\\))?$/;\n\n/**\n * A {@link ConditionToken | condition token} is a comma-separated list of one or more\n * condition specifiers, where a condition specifier has either the form\n * `<qualifierName>=<value>` or `<value>`.\n * @internal\n */\nexport const conditionToken: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*(?:=[a-zA-Z0-9_\\-]+)?$/;\n\n/**\n * A {@link ContextToken | context token} has the form `<qualifierName>=<value>` or `<value>`.\n * Context tokens allow broader character set including commas for comma-separated values.\n * @internal\n */\nexport const contextToken: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*(?:=[a-zA-Z0-9_\\-,\\s]+)?$/;\n\n/**\n * @internal\n */\nexport const conditionSetHash: RegExp = /^[a-zA-Z0-9]{8}$/;\n\n/**\n * @internal\n */\nexport const decisionKey: RegExp = /^[a-zA-Z0-9]{8}(?:\\+[a-zA-Z0-9]{8})*(?:\\|[a-zA-Z0-9]{8})?$/;\n\n/**\n * A {@link QualifierDefaultValueToken | qualifier default value token} has the form\n * `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).\n * Default values allow broader character set including commas for comma-separated values.\n * @internal\n */\nexport const qualifierDefaultValueToken: RegExp = /^[a-zA-Z_][a-zA-Z0-9_\\-]*=(?:[a-zA-Z0-9_\\-,\\s]*)?$/;\n\n/**\n * A {@link QualifierDefaultValuesToken | qualifier default values token} is a\n * pipe-separated list of one or more qualifier default value tokens.\n * Uses \"|\" as separator to avoid conflicts with comma-separated values within defaults.\n * @internal\n */\nexport const qualifierDefaultValuesToken: RegExp =\n /^[a-zA-Z_][a-zA-Z0-9_\\-]*=(?:[a-zA-Z0-9_\\-,\\s]*)?(?:\\|[a-zA-Z_][a-zA-Z0-9_\\-]*=(?:[a-zA-Z0-9_\\-,\\s]*)?)*$/;\n\n/**\n * @internal\n */\nexport const territoryCode: RegExp = /^[a-zA-Z]{2}$/;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../src/packlets/common/validate/resources.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5G;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,YAAY,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,UAAU,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAE1E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,gBAAgB,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAElF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAMjE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAK3D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC,CAEhF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAKpE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAMzE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAM5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../../src/packlets/common/validate/resources.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAaH,kDAEC;AASD,8CAEC;AASD,oDAEC;AASD,0DAEC;AASD,4DAEC;AAUD,wCAMC;AAUD,oCAKC;AAUD,oDAEC;AAUD,0CAKC;AAUD,gDAMC;AAUD,kDAMC;AAnJD,4CAAsD;AAEtD,6DAAuE;AAEvE;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,+BAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,OAAO,wCAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,KAAK,IAAI,CAAC,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,IAAY;IAClD,OAAO,+BAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,wBAAwB,CAAC,KAAa;IACpD,OAAO,KAAK,IAAI,CAAC,CAAC;AACpB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,+CAA+C;IAC/C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,I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5D,CAAC;IACD,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { fail, succeed, Result } from '@fgv/ts-utils';\nimport { ResourceId, ResourceIndex, ResourceName, ResourceTypeIndex, ResourceTypeName } from '../resources';\nimport { identifier, segmentedIdentifier } from './regularExpressions';\n\n/**\n * Checks if the given name is a valid resource name.\n *\n * @param name - The name to validate.\n * @returns `true` if the name is a valid resource name, otherwise `false`.\n * @public\n */\nexport function isValidResourceName(name: string): name is ResourceName {\n return identifier.test(name);\n}\n\n/**\n * Checks if the given ID is a valid resource ID.\n *\n * @param id - The ID to validate.\n * @returns `true` if the ID is a valid resource ID, otherwise `false`.\n * @public\n */\nexport function isValidResourceId(id: string): id is ResourceId {\n return segmentedIdentifier.test(id);\n}\n\n/**\n * Checks if the given index is a valid resource index.\n *\n * @param index - The index to validate.\n * @returns `true` if the index is a valid resource index, otherwise `false`.\n * @public\n */\nexport function isValidResourceIndex(index: number): index is ResourceIndex {\n return index >= 0;\n}\n\n/**\n * Checks if the given name is a valid resource type name.\n *\n * @param name - The name to validate.\n * @returns `true` if the name is a valid resource type name, otherwise `false`.\n * @public\n */\nexport function isValidResourceTypeName(name: string): name is ResourceTypeName {\n return identifier.test(name);\n}\n\n/**\n * Checks if the given index is a valid resource type index.\n *\n * @param index - The index to validate.\n * @returns `true` if the index is a valid resource type index, otherwise `false`.\n * @public\n */\nexport function isValidResourceTypeIndex(index: number): index is ResourceTypeIndex {\n return index >= 0;\n}\n\n/**\n * Converts a string to a {@link ResourceName | resource name}.\n *\n * @param id - The string to convert.\n * @returns `Success` with the converted name if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toResourceName(name: string): Result<ResourceName> {\n /* c8 ignore next 3 - coverage having issues */\n if (!isValidResourceName(name)) {\n return fail(`${name}: not a valid resource name.`);\n }\n return succeed(name);\n}\n\n/**\n * Converts a string to a {@link ResourceId | resource ID}.\n *\n * @param id - The string to convert.\n * @returns `Success` with the converted ID if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toResourceId(id: string): Result<ResourceId> {\n if (!isValidResourceId(id)) {\n return fail(`${id}: not a valid resource ID.`);\n }\n return succeed(id);\n}\n\n/**\n * Converts an optional string to an optional {@link ResourceId | resource ID}.\n *\n * @param id - The string to convert.\n * @returns `Success` with the converted ID if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toOptionalResourceId(id?: string): Result<ResourceId | undefined> {\n return id ? toResourceId(id) : succeed(undefined);\n}\n\n/**\n * Converts a number to a {@link ResourceIndex | resource index}.\n *\n * @param index - The number to convert.\n * @returns `Success` with the converted index if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toResourceIndex(index: number): Result<ResourceIndex> {\n if (!isValidResourceIndex(index)) {\n return fail(`${index}: not a valid resource index.`);\n }\n return succeed(index);\n}\n\n/**\n * Converts a string to a {@link ResourceTypeName | resource type name}.\n *\n * @param name - The string to convert.\n * @returns `Success` with the converted name if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toResourceTypeName(name: string): Result<ResourceTypeName> {\n /* c8 ignore next 3 - coverage having issues */\n if (!isValidResourceTypeName(name)) {\n return fail(`${name}: not a valid resource type name.`);\n }\n return succeed(name);\n}\n\n/**\n * Converts a number to a {@link ResourceTypeIndex | resource type index}.\n *\n * @param index - The number to convert.\n * @returns `Success` with the converted index if valid, or `Failure` with an error message\n * if not.\n * @public\n */\nexport function toResourceTypeIndex(index: number): Result<ResourceTypeIndex> {\n /* c8 ignore next 3 - coverage having issues */\n if (!isValidResourceTypeIndex(index)) {\n return fail(`${index}: not a valid resource type index.`);\n }\n return succeed(index);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/condition.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,WAAW,EAAE,MAAM,EAAQ,MAAM,eAAe,CAAC;AACzE,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EAEd,uBAAuB,EACvB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAKtC;;;GAGG;AACH,qBAAa,SAAU,YAAW,uBAAuB;IACvD;;OAEG;IACH,SAAgB,SAAS,EAAE,SAAS,CAAC;IAErC;;OAEG;IACH,SAAgB,KAAK,EAAE,uBAAuB,CAAC;IAE/C;;OAEG;IACH,SAAgB,QAAQ,EAAE,iBAAiB,CAAC;IAE5C;;OAEG;IACH,SAAgB,QAAQ,EAAE,iBAAiB,CAAC;IAE5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SAAS;YACzB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,GAAG,cAAc,EAAE;YAC5E,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,GAAG,cAAc,EAAE,CAAC;QAClG,OAAO,iBAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AA/SD,8BA+SC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Result, fail } from '@fgv/ts-utils';\nimport {\n Convert as CommonConvert,\n ConditionIndex,\n ConditionKey,\n ConditionOperator,\n ConditionPriority,\n ConditionToken,\n NoMatch,\n QualifierConditionValue,\n QualifierMatchScore,\n Validate\n} from '../common';\nimport { Qualifier } from '../qualifiers';\nimport { IValidatedConditionDecl } from './conditionDecls';\nimport * as ResourceJson from '../resource-json';\nimport * as Context from '../context';\n\n// eslint-disable-next-line @rushstack/typedef-var\nconst scoreFormatter = new Intl.NumberFormat('en-US', { minimumFractionDigits: 0, maximumFractionDigits: 3 });\n\n/**\n * Represents a single condition applied to some resource instance.\n * @public\n */\nexport class Condition implements IValidatedConditionDecl {\n /**\n * The {@link Qualifiers.Qualifier | qualifier} used in this condition.\n */\n public readonly qualifier: Qualifier;\n\n /**\n * The value to be matched in this condition.\n */\n public readonly value: QualifierConditionValue;\n\n /**\n * The {@link ConditionOperator | operator} used when matching context value to condition value.\n */\n public readonly operator: ConditionOperator;\n\n /**\n * The {@link ConditionPriority | relative priority} of this condition.\n */\n public readonly priority: ConditionPriority;\n\n /**\n * The {@link QualifierMatchScore | score} to be used when this condition is the default.\n */\n public readonly scoreAsDefault?: QualifierMatchScore;\n\n protected _collectible: Collections.Collectible<ConditionKey, ConditionIndex>;\n\n /**\n * Constructs a new {@link Conditions.Condition | Condition} object.\n * @param qualifier - The {@link Qualifiers.Qualifier | qualifier} used in this condition.\n * @param value - The value to be matched in this condition.\n * @param operator - The {@link ConditionOperator | operator} used when matching context value to condition value.\n * @param priority - The {@link ConditionPriority | relative priority} of this condition.\n * @param scoreAsDefault - The {@link QualifierMatchScore | score} to be used when this condition is the default.\n * @param index - The index of this condition.\n * @public\n */\n protected constructor({\n qualifier,\n value,\n operator,\n priority,\n scoreAsDefault,\n index\n }: IValidatedConditionDecl) {\n if (scoreAsDefault === undefined && qualifier.defaultValue !== undefined) {\n const defaultMatch = qualifier.type.matches(value, qualifier.defaultValue, 'matches');\n if (defaultMatch !== NoMatch) {\n scoreAsDefault = defaultMatch;\n }\n }\n this.qualifier = qualifier;\n this.operator = operator;\n this.value = qualifier.validateCondition(value, operator).orThrow();\n this.priority = priority;\n this.scoreAsDefault = scoreAsDefault;\n this._collectible = new Collections.Collectible({\n key: this.toKey(),\n index,\n indexConverter: CommonConvert.conditionIndex\n });\n }\n\n public get key(): ConditionKey {\n return this._collectible.key;\n }\n\n public get index(): ConditionIndex | undefined {\n return this._collectible.index;\n }\n\n public setIndex(index: ConditionIndex): Result<ConditionIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Creates a new {@link Conditions.Condition | Condition} object from the supplied\n * {@link Conditions.IValidatedConditionDecl | validated condition declaration}.\n * @param decl - The {@link Conditions.IValidatedConditionDecl | validated condition declaration}\n * describing the condition to create.\n * @returns `Success` with the new {@link Conditions.Condition | Condition} if successful,\n * `Failure` otherwise.\n * @public\n */\n public static create(decl: IValidatedConditionDecl): Result<Condition> {\n return captureResult(() => new Condition(decl));\n }\n\n /**\n * Determines if this condition matches the supplied {@link Context.IValidatedContextDecl | validated context}.\n * @param context - The {@link Context.IValidatedContextDecl | context} to match against.\n * @param options - The {@link Context.IContextMatchOptions | options} to use when matching the context.\n * @returns A {@link QualifierMatchScore | match score} indicating match quality if the condition is present\n * in the context to be matched, `undefined` otherwise.\n * @remarks\n * If {@link Context.IContextMatchOptions.partialContextMatch | `options.partialContextMatch``} is `true`, then\n * the method will return `undefined` if the corresponding qualifier is not present in the context.\n */\n public getContextMatch(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): QualifierMatchScore | undefined {\n options = options ?? {};\n if (this.qualifier.name in context) {\n const contextValue = context[this.qualifier.name];\n const match = this.qualifier.type.matches(this.value, contextValue, this.operator);\n if (match === NoMatch && options.acceptDefaultScore === true && this.scoreAsDefault !== undefined) {\n return this.scoreAsDefault;\n }\n return match;\n }\n return options.partialContextMatch === true ? undefined : NoMatch;\n }\n\n /**\n * Determines if this condition can match the supplied context, even if the context is partial.\n *\n * Returns true if:\n * - The qualifier specified in the condition is not present in the context\n * - The qualifier is present and matches the condition\n *\n * Returns false if:\n * - The qualifier is present in the context and does not match the condition\n *\n * @param context - The context to match against.\n * @param options - Options to use when matching the context.\n * @returns `true` if the condition can match the (possibly partial) context, `false` otherwise.\n * @public\n */\n public canMatchPartialContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): boolean {\n /* c8 ignore next 1 - defense in depth */\n const scoreAsDefault = this.scoreAsDefault ?? NoMatch;\n if (!(this.qualifier.name in context) || scoreAsDefault > NoMatch) {\n return true;\n }\n return this.qualifier.type.isPotentialMatch(this.value, context[this.qualifier.name]);\n }\n\n /**\n * Compares two conditions for sorting purposes.\n * @param c1 - The first {@link Conditions.Condition | condition} to compare.\n * @param c2 - The second {@link Conditions.Condition | condition} to compare.\n * @returns A negative number if c1 should come before c2, a positive number\n * if c2 should come before c1, or zero if they are equivalent.\n * @public\n */\n public static compare(c1: Condition, c2: Condition): number {\n let diff = c1.priority - c2.priority;\n diff = diff === 0 ? (c1.scoreAsDefault ?? 0) - (c2.scoreAsDefault ?? 0) : diff;\n diff = diff === 0 ? c1.qualifier.name.localeCompare(c2.qualifier.name) : diff;\n diff = diff === 0 ? c1.value.localeCompare(c2.value) : diff;\n return diff;\n }\n\n /**\n * Gets a {@link ConditionToken | condition token} for this condition, if possible.\n * It is not possible to get a token for a condition with an operator other than `matches`,\n * with other-than-default priority, or with a name or value that contains other than alphanumeric\n * characters, underscore or non-leading hyphen.\n * @param terse - if `true` and if the qualifier token is optional, the token will be omitted\n * from the generated {@link ConditionToken | condition token}.\n * @returns\n */\n public toToken(terse?: boolean): Result<ConditionToken> {\n /* c8 ignore next 3 - defense in depth very difficult to induce */\n if (this.operator !== 'matches') {\n return fail(`${this.operator}: cannot create condition token for operator other than 'matches'`);\n }\n if (this.priority !== this.qualifier.defaultPriority) {\n return fail(`${this.priority}: cannot create condition token for non-default priority`);\n }\n if (terse && this.qualifier.tokenIsOptional) {\n return Validate.toConditionToken(this.value);\n }\n /* c8 ignore next 1 - coverage having a bad day */\n const name = this.qualifier.token ?? this.qualifier.name;\n return Validate.toConditionToken(`${name}=${this.value}`);\n }\n\n /**\n * Gets the {@link ConditionKey | key} for this condition.\n * @returns -\n */\n public toKey(): ConditionKey {\n return Condition.getKeyForDecl(this).orThrow();\n }\n\n /**\n * Get a human-readable string representation of the condition.\n * @returns A string representation of the condition.\n * @public\n */\n public toString(): string {\n return this.toKey();\n }\n\n /**\n * Gets the {@link ResourceJson.Json.IChildConditionDecl | child condition declaration} for this condition.\n * @param options - The {@link ResourceJson.Helpers.IDeclarationOptions | options} to use when creating the child\n * condition declaration.\n * @returns The {@link ResourceJson.Json.IChildConditionDecl | child condition declaration} for this condition.\n * @public\n */\n public toChildConditionDecl(\n options?: ResourceJson.Helpers.IDeclarationOptions\n ): ResourceJson.Json.IChildConditionDecl {\n const showDefaults = options?.showDefaults === true;\n return {\n value: this.value,\n /* c8 ignore next 1 - not really possible to reproduce right now */\n ...(showDefaults || this.operator !== 'matches' ? { operator: this.operator } : {}),\n ...(showDefaults || this.priority !== this.qualifier.defaultPriority\n ? { priority: this.priority }\n : {}),\n ...(this.scoreAsDefault ? { scoreAsDefault: this.scoreAsDefault } : {})\n };\n }\n\n /**\n * Gets the value for this condition, or the {@link ResourceJson.Json.IChildConditionDecl | child condition declaration}\n * if the condition has non-default operator, priority or a score as default.\n * @param options - The {@link ResourceJson.Helpers.IDeclarationOptions | options} to use when creating the child\n * condition declaration.\n * @returns A string value for this condition, or the {@link ResourceJson.Json.IChildConditionDecl | child condition declaration}\n * if the condition has non-default operator, priority or a score as default.\n */\n public toValueOrChildConditionDecl(\n options?: ResourceJson.Helpers.IDeclarationOptions\n ): string | ResourceJson.Json.IChildConditionDecl {\n if (\n options?.showDefaults !== true &&\n this.operator === 'matches' &&\n this.priority === this.qualifier.defaultPriority &&\n this.scoreAsDefault === undefined\n ) {\n return this.value;\n }\n /* c8 ignore next 2 - unreachable: matches is the only real operator in practice */\n return this.toChildConditionDecl(options);\n }\n\n /**\n * Gets the {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration} for this condition.\n * @param options - The {@link ResourceJson.Helpers.IDeclarationOptions | options} to use when creating the loose\n * condition declaration.\n * @returns The {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration} for this condition.\n * @public\n */\n public toLooseConditionDecl(\n options?: ResourceJson.Helpers.IDeclarationOptions\n ): ResourceJson.Json.ILooseConditionDecl {\n const showDefaults = options?.showDefaults === true;\n return {\n qualifierName: this.qualifier.name,\n value: this.value,\n /* c8 ignore next 1 - not really possible to reproduce right now */\n ...(showDefaults || this.operator !== 'matches' ? { operator: this.operator } : {}),\n ...(showDefaults || this.priority !== this.qualifier.defaultPriority\n ? { priority: this.priority }\n : {}),\n ...(this.scoreAsDefault ? { scoreAsDefault: this.scoreAsDefault } : {})\n };\n }\n\n /**\n * Converts this condition to a compiled condition representation.\n * @param options - Optional compilation options controlling the output format.\n * @returns A compiled condition object that can be used for serialization or runtime processing.\n * @public\n */\n public toCompiled(\n options?: ResourceJson.Compiled.ICompiledResourceOptions\n ): ResourceJson.Compiled.ICompiledCondition {\n /* c8 ignore next 1 - defense in depth */\n const operator = this.operator === 'matches' ? undefined : this.operator;\n return {\n qualifierIndex: this.qualifier.index!,\n operator,\n value: this.value,\n priority: this.priority,\n scoreAsDefault: this.scoreAsDefault,\n ...(options?.includeMetadata === true ? { metadata: { key: this.key } } : {})\n };\n }\n\n /**\n * Gets the {@link ConditionKey | condition key} for a supplied {@link Conditions.IValidatedConditionDecl | condition declaration}.\n * @param decl - The {@link Conditions.IValidatedConditionDecl | condition declaration} for which to get the key.\n * @returns `Success` with the condition key if successful, `Failure` otherwise.\n * @public\n */\n public static getKeyForDecl(decl: IValidatedConditionDecl): Result<ConditionKey> {\n const scoreAsDefault = decl.scoreAsDefault ? `(${scoreFormatter.format(decl.scoreAsDefault)})` : '';\n const key =\n decl.operator === 'matches'\n ? `${decl.qualifier.name}-[${decl.value}]@${decl.priority}${scoreAsDefault}`\n : `${decl.qualifier.name}-${decl.operator}-[${decl.value}]@${decl.priority}${scoreAsDefault}`;\n return Validate.toConditionKey(key);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionCollector.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionCollector.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,WAAW,EAAE,MAAM,EAAW,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,UAAU,EAAE,2BAA2B,CAAC;IAExC;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB,CAAC,SAAS,CAAC;IACpE;;;;OAIG;IACI,UAAU,EAAE,2BAA2B,CAAC;IAE/C;;;;OAIG;IACH,SAAS,aAAa,MAAM,EAAE,+BAA+B;IAY7D;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,+BAA+B,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAIzF,OAAO,CAAC,YAAY;CAQrB;AAED;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionCollector.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionCollector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAiG;AAGjG,2CAAwC;AACxC,sCAAmE;AACnE,uCAAmD;AAmBnD;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,8BAA8B;IAQpE;;;;OAIG;IACH,YAAsB,MAAuC;;QAC3D,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,sBAAW,CAAC,kBAAkB,CAA0B;gBACtE,GAAG,EAAE,gBAAa,CAAC,YAAY;gBAC/B,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;aAClD,CAAC;SACH,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,8CAA8C;QAC9C,MAAA,MAAM,CAAC,UAAU,0CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAAuC;QAC1D,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,CAAC;IAEO,YAAY,CAAC,IAAa;QAChC,IAAI,IAAI,YAAY,qBAAS,EAAE,CAAC;YAC9B,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,gCAAsB;aAC1B,OAAO,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aACzE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,qBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AA5CD,gDA4CC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Result, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { IConditionDecl } from './conditionDecls';\nimport { Condition } from './condition';\nimport { Convert as CommonConvert, ConditionKey } from '../common';\nimport { validatedConditionDecl } from './convert';\n\n/**\n * Parameters for creating a {@link Conditions.ConditionCollector | ConditionCollector}.\n * @public\n */\nexport interface IConditionCollectorCreateParams {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to\n * create conditions in this collector.\n */\n qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Optional array of condition declarations to add to the collector.\n */\n conditions?: IConditionDecl[];\n}\n\n/**\n * A `ValidatingCollector` for {@link Conditions.Condition | Conditions},\n * which collects conditions supplied as either {@link Conditions.Condition | Condition} or\n * {@link Conditions.IConditionDecl | IConditionDecl}.\n * @public\n */\nexport class ConditionCollector extends ValidatingCollector<Condition> {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to create conditions\n * in this collector.\n * @public\n */\n public qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Constructor for a {@link Conditions.ConditionCollector | ConditionCollector} object.\n * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for\n * creating the collector.\n */\n protected constructor(params: IConditionCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<ConditionKey, Condition>({\n key: CommonConvert.conditionKey,\n value: (from: unknown) => this._toCondition(from)\n })\n });\n this.qualifiers = params.qualifiers;\n /* c8 ignore next 1 - ? is defense in depth */\n params.conditions?.forEach((c) => this.validating.add(c).orThrow());\n }\n\n /**\n * Creates a new {@link Conditions.ConditionCollector | ConditionCollector} object.\n * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for\n * creating the collector.\n * @returns `Success` with the new collector if successful, or `Failure` with\n * an error message if not.\n */\n public static create(params: IConditionCollectorCreateParams): Result<ConditionCollector> {\n return captureResult(() => new ConditionCollector(params));\n }\n\n private _toCondition(from: unknown): Result<Condition> {\n if (from instanceof Condition) {\n return succeed(from);\n }\n return validatedConditionDecl\n .convert(from, { qualifiers: this.qualifiers, conditionIndex: this.size })\n .onSuccess((c) => Condition.create(c));\n }\n}\n\n/**\n * Type alias for a read-only {@link Conditions.ConditionCollector | ConditionCollector}.\n * @public\n */\nexport type ReadOnlyConditionCollector = Collections.IReadOnlyValidatingCollector<Condition>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionDecls.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionDecls.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionDecls.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionDecls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n ConditionIndex,\n ConditionOperator,\n ConditionPriority,\n QualifierConditionValue,\n QualifierMatchScore\n} from '../common';\nimport { Qualifier } from '../qualifiers';\nimport * as ResourceJson from '../resource-json';\n\n/**\n * Non-validated declaration of a {@link Conditions.Condition | condition}.\n * @public\n */\nexport type IConditionDecl = ResourceJson.Json.ILooseConditionDecl;\n\n/**\n * Validated declaration of a {@link Conditions.Condition | condition} with all defaults applied.\n * @public\n */\nexport interface IValidatedConditionDecl {\n qualifier: Qualifier;\n value: QualifierConditionValue;\n operator: ConditionOperator;\n priority: ConditionPriority;\n scoreAsDefault?: QualifierMatchScore;\n index?: ConditionIndex;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSet.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSet.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,WAAW,EAAoB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAEL,iBAAiB,EACjB,eAAe,EACf,aAAa,EAEd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,WAAW,wBAAyB,SAAQ,YAAY,CAAC,OAAO,CAAC,mBAAmB;IACxF;;;OAGG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACjD;AAED;;;;GAIG;AACH,qBAAa,YAAa,YAAW,0BAA0B;IAC7D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,WAAW,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAC7F;;;;OAIG;IACH,SAAgB,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAErD;;OAEG;IACH,IAAW,GAAG,IAAI,eAAe,CAEhC;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,iBAAiB,GAAG,SAAS,CAEhD;IAED;;OAEG;IACH,OAAc,gBAAgB,EAAE,eAAe,CAA4C;IAE3F;;;;OAIG;IACH,SAAS,aAAa,MAAM,EAAE,0BAA0B;IAsBxD;;;;;;;OAOG;WACW,MAAM,CAAC,MAAM,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AAC,CAAC,CAAC,EAA4D,EAAE;YAC7E,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,uBAAuB,CAC5B,OAAkC;QAElC,MAAM,kBAAkB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,CAAC;QACvD,MAAM,UAAU,GAAG,kBAAkB;YACnC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC1E,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QACpB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACI,UAAU,CACf,OAAwD;QAExD,uBACE,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAM,CAAC,IAC7C,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,MAAK,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7E;IACJ,CAAC;;AAvNH,oCAwNC;AA1LC;;GAEG;AACW,6BAAgB,GAAoB,iBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Hash, mapResults, Result } from '@fgv/ts-utils';\nimport { Condition } from './condition';\nimport {\n Convert as CommonConvert,\n ConditionSetIndex,\n ConditionSetKey,\n QualifierName,\n Validate\n} from '../common';\nimport { IValidatedConditionSetDecl } from './conditionSetDecls';\nimport * as ResourceJson from '../resource-json';\nimport * as Context from '../context';\n\n/**\n * Options for creating a {@link Conditions.ConditionSet | ConditionSet} declaration.\n * @remarks\n * This interface extends the {@link ResourceJson.Helpers.IDeclarationOptions | declaration options}\n * interface to include a `reduceQualifiers` option.\n * @public\n */\nexport interface IConditionSetDeclOptions extends ResourceJson.Helpers.IDeclarationOptions {\n /**\n * If provided, reduces the qualifiers of the condition set by removing qualifiers that are made\n * irrelevant by the filterForContext.\n */\n qualifiersToReduce?: ReadonlySet<QualifierName>;\n}\n\n/**\n * Represents a set of {@link Conditions.Condition | conditions} that must all be met in some runtime\n * context for a resource instance to be valid.\n * @public\n */\nexport class ConditionSet implements IValidatedConditionSetDecl {\n protected readonly _collectible: Collections.Collectible<ConditionSetKey, ConditionSetIndex>;\n /**\n * The {@link Conditions.Condition | conditions} that make up this condition\n * set.\n * @public\n */\n public readonly conditions: ReadonlyArray<Condition>;\n\n /**\n * The key for this condition set.\n */\n public get key(): ConditionSetKey {\n return this._collectible.key;\n }\n\n /**\n * The number of conditions in this condition set.\n */\n public get size(): number {\n return this.conditions.length;\n }\n\n /**\n * The index for this condition set.\n */\n public get index(): ConditionSetIndex | undefined {\n return this._collectible.index;\n }\n\n /**\n * The key for an unconditional condition set.\n */\n public static UnconditionalKey: ConditionSetKey = Validate.toConditionSetKey('').orThrow();\n\n /**\n * Constructor for a {@link Conditions.ConditionSet | ConditionSet} object.\n * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}\n * used to create the condition set.\n */\n protected constructor(params: IValidatedConditionSetDecl) {\n const qualifiers = new Map<QualifierName, Condition>();\n for (const condition of params.conditions) {\n /* c8 ignore next 9 - there's a test for this but coverage is having a bad day */\n if (qualifiers.has(condition.qualifier.name)) {\n const existing = qualifiers.get(condition.qualifier.name)?.toString() ?? 'unknown';\n throw new Error(\n `${\n condition.qualifier.name\n }: Duplicate conditions ${existing} and ${condition.toString()} are not supported.`\n );\n }\n qualifiers.set(condition.qualifier.name, condition);\n }\n this.conditions = Array.from(params.conditions).sort(Condition.compare).reverse();\n this._collectible = new Collections.Collectible({\n key: this.toKey(),\n index: params.index,\n indexConverter: CommonConvert.conditionSetIndex\n });\n }\n\n /**\n * Creates a new {@link Conditions.ConditionSet | ConditionSet} object.\n * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}\n * used to create the condition set.\n * @returns `Success` with the new {@link Conditions.ConditionSet | ConditionSet} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params: IValidatedConditionSetDecl): Result<ConditionSet> {\n return captureResult(() => new ConditionSet(params));\n }\n\n /**\n * Compares two {@link Conditions.ConditionSet | ConditionSets} for sorting purposes.\n * @param cs1 - The first {@link Conditions.ConditionSet | ConditionSet} to compare.\n * @param cs2 - The second {@link Conditions.ConditionSet | ConditionSet} to compare.\n * @returns A negative number if `cs1` should come before `cs2`, a positive\n * number if `cs1` should come after `cs2`, or zero if they are equivalent.\n * @public\n */\n public static compare(cs1: ConditionSet, cs2: ConditionSet): number {\n const len = Math.min(cs1.conditions.length, cs2.conditions.length);\n for (let i = 0; i < len; i++) {\n const diff = Condition.compare(cs1.conditions[i], cs2.conditions[i]);\n if (diff !== 0) {\n return diff;\n }\n }\n return cs1.conditions.length - cs2.conditions.length;\n }\n\n /**\n * Sets the global index for this condition set. Once set, the index cannot be changed.\n * @param index - The index to set for this condition set.\n * @returns `Success` with the index if successful, `Failure` otherwise.\n */\n public setIndex(index: number): Result<ConditionSetIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Determines if this condition set can match a supplied context, even if the context is partial.\n * Returns true if all conditions in the set can match the context (using canMatchPartialContext).\n * Returns false otherwise.\n * @param context - The context to match.\n * @param options - Options to use when matching.\n * @returns `true` if all conditions can match the context, `false` otherwise.\n */\n public canMatchPartialContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): boolean {\n return this.conditions.every((c) => c.canMatchPartialContext(context, options));\n }\n\n /**\n * Gets the {@link ConditionSetKey | key} for a supplied {@link Conditions.IValidatedConditionSetDecl | condition set declaration}.\n * @param decl - The {@link Conditions.IValidatedConditionSetDecl | condition set declaration} for which to get the key.\n * @returns `Success` with the condition set key if successful, `Failure` otherwise.\n * @public\n */\n public static getKeyForDecl(decl: IValidatedConditionSetDecl): Result<ConditionSetKey> {\n return Validate.toConditionSetKey(decl.conditions.map((c) => c.toKey()).join('+'));\n }\n\n /**\n * Gets a {@link ConditionSetToken | condition set token} for this condition set,\n * if possible.\n * @param terse - If true, the token will be terse, omitting qualifier names where\n * possible.\n * @returns `Success` with the {@link ConditionSetToken | condition set token} if successful,\n * `Failure` with an error message otherwise.\n * @public\n */\n public toToken(terse?: boolean): Result<string> {\n return mapResults(this.conditions.map((c) => c.toToken(terse))).onSuccess((tokens) => {\n return Validate.toConditionSetToken(tokens.join(','));\n });\n }\n\n /**\n * Gets the {@link ConditionSetKey | key} for this condition set.\n * @returns The key for this condition set.\n */\n public toKey(): ConditionSetKey {\n return ConditionSet.getKeyForDecl(this).orThrow();\n }\n\n /**\n * Gets a hash of this condition set.\n * @returns A hash of this condition\n * set key.\n * @public\n */\n public toHash(): string {\n return Hash.Crc32Normalizer.crc32Hash([this.key]).padStart(8, '0');\n }\n\n /**\n * Gets a human-readable string representation of this condition set.\n * @returns A string representation of this condition set.\n */\n public toString(): string {\n return this.toKey();\n }\n\n /**\n * Gets the {@link ResourceJson.Json.ConditionSetDeclAsRecord | condition set declaration as a record} for this condition set.\n * @param options - {@link ResourceJson.Helpers.IDeclarationOptions | options} for the condition set declaration.\n * @returns The {@link ResourceJson.Json.ConditionSetDeclAsRecord | condition set declaration as a record} for this condition set.\n */\n public toConditionSetRecordDecl(\n options?: IConditionSetDeclOptions\n ): ResourceJson.Json.ConditionSetDeclAsRecord {\n const qualifiersToReduce = options?.qualifiersToReduce;\n const conditions = qualifiersToReduce\n ? this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))\n : this.conditions;\n return Object.fromEntries(\n conditions.map((c): [string, ResourceJson.Json.IChildConditionDecl | string] => {\n return [c.qualifier.name, c.toValueOrChildConditionDecl(options)];\n })\n );\n }\n\n /**\n * Gets the {@link ResourceJson.Json.ConditionSetDeclAsArray | condition set declaration as an array} for this condition set.\n * @param options - {@link ResourceJson.Helpers.IDeclarationOptions | options} for the condition set declaration.\n * @returns The {@link ResourceJson.Json.ConditionSetDeclAsArray | condition set declaration as an array} for this condition set.\n */\n public toConditionSetArrayDecl(\n options?: IConditionSetDeclOptions\n ): ResourceJson.Json.ConditionSetDeclAsArray {\n const qualifiersToReduce = options?.qualifiersToReduce;\n const conditions = qualifiersToReduce\n ? this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))\n : this.conditions;\n return conditions.map((c) => c.toLooseConditionDecl(options));\n }\n\n /**\n * Converts this condition set to a compiled condition set representation.\n * @param options - Optional compilation options controlling the output format.\n * @returns A compiled condition set object that can be used for serialization or runtime processing.\n * @public\n */\n public toCompiled(\n options?: ResourceJson.Compiled.ICompiledResourceOptions\n ): ResourceJson.Compiled.ICompiledConditionSet {\n return {\n conditions: this.conditions.map((c) => c.index!),\n ...(options?.includeMetadata === true ? { metadata: { key: this.key } } : {})\n };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetCollector.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetCollector.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,WAAW,EAAc,MAAM,EAAW,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAA6C,iBAAiB,EAAY,MAAM,WAAW,CAAC;AAEnG;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD;;;OAGG;IACH,UAAU,EAAE,kBAAkB,CAAC;IAE/B;;;OAGG;IACH,aAAa,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACrC;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IAC1E;;;OAGG;IACI,UAAU,EAAE,kBAAkB,CAAC;IAEtC;;;OAGG;IACH,IAAW,yBAAyB,IAAI,YAAY,CAEnD;IAED;;OAEG;IACH,OAAc,kBAAkB,EAAE,iBAAiB,CAA6C;IAEhG;;;;OAIG;IACH,SAAS,aAAa,MAAM,EAAE,kCAAkC;IAgBhE;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,kCAAkC,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAI/F,OAAO,CAAC,eAAe;CAcxB;AAED;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,WAAW,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetCollector.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetCollector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA6G;AAG7G,iDAA8C;AAC9C,uCAAsD;AACtD,sCAAmG;AAoBnG;;;;;;GAMG;AACH,MAAa,qBAAsB,SAAQ,8BAAiC;IAO1E;;;OAGG;IACH,IAAW,yBAAyB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,CAAC;IACxE,CAAC;IAOD;;;;OAIG;IACH,YAAsB,MAA0C;;QAC9D,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,sBAAW,CAAC,kBAAkB,CAAgC;gBAC5E,GAAG,EAAE,gBAAa,CAAC,eAAe;gBAClC,wEAAwE;gBACxE,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;aACrD,CAAC;SACH,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,+EAA+E;QAC/E,gBAAgB;QAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,2BAAY,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACjF,8CAA8C;QAC9C,MAAA,MAAM,CAAC,aAAa,0CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAA0C;QAC7D,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,eAAe,CAAC,IAAa;QACnC,IAAI,IAAI,YAAY,2BAAY,EAAE,CAAC;YACjC,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAA,qBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CACxF,CAAC,UAAU,EAAE,EAAE,CAAC,2BAAY,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CACpD,CAAC;QACJ,CAAC;QACD,uFAAuF;QACvF,OAAO,mCAAyB;aAC7B,OAAO,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aAC5E,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;;AAjEH,sDAkEC;AAnDC;;GAEG;AACW,wCAAkB,GAAsB,iBAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, mapResults, Result, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { ConditionCollector } from './conditionCollector';\nimport { IConditionSetDecl } from './conditionSetDecls';\nimport { ConditionSet } from './conditionSet';\nimport { validatedConditionSetDecl } from './convert';\nimport { ConditionSetKey, Convert as CommonConvert, ConditionSetIndex, Validate } from '../common';\n\n/**\n * Parameters for creating a {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @public\n */\nexport interface IConditionSetCollectorCreateParams {\n /**\n * The {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions\n * for conditions in this collector.\n */\n conditions: ConditionCollector;\n\n /**\n * Optional array of {@link Conditions.IConditionSetDecl | condition set declarations} to add to\n * the collector.\n */\n conditionSets?: IConditionSetDecl[];\n}\n\n/**\n * A `ValidatingCollector` for {@link Conditions.ConditionSet | ConditionSets},\n * which collects condition sets supplied as {@link Conditions.ConditionSet | ConditionSet} or\n * as {@link Conditions.IConditionSetDecl | IConditionSetDecl} via the methods on the\n * `validating` property.\n * @public\n */\nexport class ConditionSetCollector extends ValidatingCollector<ConditionSet> {\n /**\n * Gets the {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions\n * for conditions in this collector.\n */\n public conditions: ConditionCollector;\n\n /**\n * Gets the {@link Conditions.ConditionSet | ConditionSet} at the unconditional\n * condition set index.\n */\n public get unconditionalConditionSet(): ConditionSet {\n return this.getAt(ConditionSetCollector.UnconditionalIndex).orThrow();\n }\n\n /**\n * The index of the unconditional condition set.\n */\n public static UnconditionalIndex: ConditionSetIndex = Validate.toConditionSetIndex(0).orThrow();\n\n /**\n * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create\n * the collector.\n */\n protected constructor(params: IConditionSetCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<ConditionSetKey, ConditionSet>({\n key: CommonConvert.conditionSetKey,\n /* c8 ignore next 1 - there's a test but coverage is having a bad day */\n value: (from: unknown) => this._toConditionSet(from)\n })\n });\n this.conditions = params.conditions;\n // it's very helpful for debugging if the unconditional condition set is always\n // in position 0\n this.validating.add(ConditionSet.create({ conditions: [] }).orThrow()).orThrow();\n /* c8 ignore next 1 - ? is defense in depth */\n params.conditionSets?.forEach((item) => this.validating.add(item).orThrow());\n }\n\n /**\n * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create\n * the collector.\n * @returns `Success` with the new collector if successful, or `Failure` with an error message\n * if not.\n */\n public static create(params: IConditionSetCollectorCreateParams): Result<ConditionSetCollector> {\n return captureResult(() => new ConditionSetCollector(params));\n }\n\n private _toConditionSet(from: unknown): Result<ConditionSet> {\n if (from instanceof ConditionSet) {\n return succeed(from);\n }\n if (Array.isArray(from)) {\n return mapResults(from.map((item) => this.conditions.validating.getOrAdd(item))).onSuccess(\n (conditions) => ConditionSet.create({ conditions })\n );\n }\n /* c8 ignore next 4 - functional code path tested but coverage intermittently missed */\n return validatedConditionSetDecl\n .convert(from, { conditions: this.conditions, conditionSetIndex: this.size })\n .onSuccess((c) => ConditionSet.create(c));\n }\n}\n\n/**\n * A read-only {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @public\n */\nexport type ReadOnlyConditionSetCollector = Collections.IReadOnlyValidatingCollector<ConditionSet>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetDecls.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetDecls.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetDecls.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetDecls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Condition } from './condition';\nimport { IConditionDecl } from './conditionDecls';\n\n/**\n * Non-validated declaration of a {@link Conditions.ConditionSet | set of conditions}.\n * @public\n */\nexport interface IConditionSetDecl {\n conditions: IConditionDecl[];\n}\n\n/**\n * Validated declaration of a {@link Conditions.ConditionSet | set of conditions}.\n * @public\n */\nexport interface IValidatedConditionSetDecl {\n conditions: ReadonlyArray<Condition>;\n index?: number;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionToken.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionToken.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAc,MAAM,EAAiB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAqB,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvE;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;;OAGG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;;OAGG;gBACgB,UAAU,EAAE,2BAA2B;IAI1D;;;;;;OAMG;IACI,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAAC;IAI1E;;;;;;OAMG;IACI,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,uBAAuB,EAAE,CAAC;IAI/E;;;;OAIG;IACI,2BAA2B,CAChC,KAAK,EAAE,aAAa,CAAC,oBAAoB,GACxC,MAAM,CAAC,uBAAuB,CAAC;IAIlC;;;;;OAKG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;IAI9D;;;;;;;OAOG;WACW,mBAAmB,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,uBAAuB,CAAC;IAMlC;;;;;;;OAOG;WACW,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,uBAAuB,EAAE,CAAC;IAMpC;;;;;;;;OAQG;WACW,2BAA2B,CACvC,KAAK,EAAE,aAAa,CAAC,oBAAoB,EACzC,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,uBAAuB,CAAC;IAkBlC;;;;;;OAMG;WACW,qBAAqB,CACjC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,SAAS,CAAC;CAgBrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionToken.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionToken.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAkE;AAClE,sCAAwE;AAIxE;;;GAGG;AACH,MAAa,eAAe;IAO1B;;;OAGG;IACH,YAAmB,UAAuC;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,mBAAmB,CAAC,KAAa;QACtC,OAAO,eAAe,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;OAMG;IACI,sBAAsB,CAAC,KAAa;QACzC,OAAO,eAAe,CAAC,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAChC,KAAyC;QAEzC,OAAO,eAAe,CAAC,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC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,MAAM,QAAQ,GAAG,SAAS,CAAC,eAAe,CAAC;gBAC3C,OAAO,IAAA,kBAAO,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC3D,CAAC,CAAC;iBACD,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,qBAAqB,CACjC,KAAa,EACb,UAAuC;QAEvC,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,IAAI,SAAS,CAAC,eAAe,IAAI,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC;gBAChF,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAA,eAAI,EAAC,GAAG,KAAK,gCAAgC,CAAC,CAAC;QACxD,CAAC;QACD,uFAAuF;QACvF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,IAAA,eAAI,EAAC,GAAG,KAAK,kCAAkC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,IAAA,kBAAO,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF;AApJD,0CAoJC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults, Result, fail, succeed } from '@fgv/ts-utils';\nimport { Helpers as CommonHelpers, ConditionOperator } from '../common';\nimport { IValidatedConditionDecl } from './conditionDecls';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../qualifiers';\n\n/**\n * Helper class to parse and validate condition tokens.\n * @public\n */\nexport class ConditionTokens {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to validate\n * qualifier names and values.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Constructs a new {@link Conditions.ConditionTokens | ConditionTokens } instance.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n */\n public constructor(qualifiers: IReadOnlyQualifierCollector) {\n this.qualifiers = qualifiers;\n }\n\n /**i\n * Parses a {@link ConditionToken | condition token} string and validates the parts\n * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the {@link Conditions.IValidatedConditionDecl | validated condition declaration}\n * if successful, `Failure` with an error message if not.\n */\n public parseConditionToken(token: string): Result<IValidatedConditionDecl> {\n return ConditionTokens.parseConditionToken(token, this.qualifiers);\n }\n\n /**\n * Parses a {@link ConditionSetToken | condition set token} string and validates the parts\n * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}\n * if successful, `Failure` with an error message if not.\n */\n public parseConditionSetToken(token: string): Result<IValidatedConditionDecl[]> {\n return ConditionTokens.parseConditionSetToken(token, this.qualifiers);\n }\n\n /**\n * Validates the {@link Helpers.IConditionTokenParts | parts} of a {@link ConditionToken | condition token}.\n * @param parts - the parts to validate\n * @returns `Success` with the validated declaration if successful, `Failure` with an error message if not.\n */\n public validateConditionTokenParts(\n parts: CommonHelpers.IConditionTokenParts\n ): Result<IValidatedConditionDecl> {\n return ConditionTokens.validateConditionTokenParts(parts, this.qualifiers);\n }\n\n /**\n * Given a value, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public findQualifierForValue(value: string): Result<Qualifier> {\n return ConditionTokens.findQualifierForValue(value, this.qualifiers);\n }\n\n /**\n * Parses a {@link ConditionToken | condition token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static parseConditionToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl> {\n return CommonHelpers.parseConditionTokenParts(token).onSuccess((parts) => {\n return ConditionTokens.validateConditionTokenParts(parts, qualifiers);\n });\n }\n\n /**\n * Parses a {@link ConditionSetToken | condition set token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with an array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}\n * if successful, `Failure` with an error message if not\n */\n public static parseConditionSetToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl[]> {\n return CommonHelpers.parseConditionSetTokenParts(token).onSuccess((parts) => {\n return mapResults(parts.map((part) => ConditionTokens.validateConditionTokenParts(part, qualifiers)));\n });\n }\n\n /**\n * Validates the parts of a condition token against the qualifiers present in the supplied\n * {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param parts - the {@link Helpers.IConditionTokenParts | condition token parts} to validate.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to\n * validate qualifier names and values.\n * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static validateConditionTokenParts(\n parts: CommonHelpers.IConditionTokenParts,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl> {\n const qualifierLookup =\n parts.qualifier === undefined\n ? ConditionTokens.findQualifierForValue(parts.value, qualifiers)\n : qualifiers.getByNameOrToken(parts.qualifier);\n\n return qualifierLookup.onSuccess((qualifier) => {\n return qualifier.type\n .validateCondition(parts.value)\n .onSuccess((value) => {\n const operator: ConditionOperator = 'matches';\n const priority = qualifier.defaultPriority;\n return succeed({ qualifier, value, operator, priority });\n })\n .withDetail('failure', 'success');\n });\n }\n\n /**\n * Given a value and a set of qualifiers, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @param qualifiers - the qualifiers to match against.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public static findQualifierForValue(\n value: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<Qualifier> {\n const matched: Qualifier[] = [];\n for (const qualifier of qualifiers.values()) {\n if (qualifier.tokenIsOptional && qualifier.validateCondition(value).isSuccess()) {\n matched.push(qualifier);\n }\n }\n if (matched.length === 0) {\n return fail(`${value}: does not match any qualifier`);\n }\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n if (matched.length > 1) {\n return fail(`${value}: matches multiple qualifiers (${matched.map((q) => q.name).join(', ')})`);\n }\n return succeed(matched[0]);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetDecls.d.ts","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/conditionSetDecls.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,qEAE3B,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,gGAkBpC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conditionSetDecls.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/conditionSetDecls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA8E;AAE9E,mCAAwC;AAGxC,2CAA2C;AAE3C;;;GAGG;AACU,QAAA,gBAAgB,GAAG,qBAAU,CAAC,YAAY,CAAoB;IACzE,UAAU,EAAE,qBAAU,CAAC,OAAO,CAAC,qBAAa,CAAC;CAC9C,CAAC,CAAC;AAYH;;;;;GAKG;AACU,QAAA,yBAAyB,GAAG,qBAAU,CAAC,OAAO,CAGzD,CAAC,IAAa,EAAE,MAAM,EAAE,OAAyC,EAAsC,EAAE;IACzG,qDAAqD;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAA,eAAI,EAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,wBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;QACvD,OAAO,IAAA,qBAAU,EACf,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CACtF,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE;YACzB,+CAA+C;YAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAClF,OAAO,IAAA,kBAAO,EAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converters, Result, fail, mapResults, succeed } from '@fgv/ts-utils';\nimport { IConditionSetDecl, IValidatedConditionSetDecl } from '../conditionSetDecls';\nimport { conditionDecl } from './decls';\nimport { ConditionCollector } from '../conditionCollector';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter which converts to a {@link Conditions.IConditionSetDecl | condition set declaration}.\n * @public\n */\nexport const conditionSetDecl = Converters.strictObject<IConditionSetDecl>({\n conditions: Converters.arrayOf(conditionDecl)\n});\n\n/**\n * Context for converting a {@link Conditions.IConditionSetDecl | condition set declaration}\n * into an instantiated {@link Conditions.ConditionSet | condition set} object.\n * @public\n */\nexport interface IConditionSetDeclConvertContext {\n readonly conditions: ConditionCollector;\n conditionSetIndex?: number;\n}\n\n/**\n * Converter which constructs a {@link Conditions.IValidatedConditionSetDecl | validated condition set declaration}\n * from a {@link Conditions.IConditionSetDecl | condition set declaration}, instantiating qualifiers by name\n * from a supplied {@link Conditions.Convert.IConditionSetDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedConditionSetDecl = Converters.generic<\n IValidatedConditionSetDecl,\n IConditionSetDeclConvertContext\n>((from: unknown, __self, context?: IConditionSetDeclConvertContext): Result<IValidatedConditionSetDecl> => {\n /* c8 ignore next 3 - coverage is having a bad day */\n if (!context) {\n return fail('validatedConditionSetDecl converter requires a context');\n }\n\n return conditionSetDecl.convert(from).onSuccess((decl) => {\n return mapResults(\n decl.conditions.map((condition) => context.conditions.validating.getOrAdd(condition))\n ).onSuccess((conditions) => {\n /* c8 ignore next 1 - coverage having issues */\n const index = context.conditionSetIndex ? context.conditionSetIndex++ : undefined;\n return succeed({ conditions, index });\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decls.d.ts","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/decls.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAI/D;;;GAGG;AACH,eAAO,MAAM,aAAa,0GAMxB,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,0FAqCjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decls.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/decls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qDAAuC;AACvC,4CAAkF;AAIlF,2CAA2C;AAE3C;;;GAGG;AACU,QAAA,aAAa,GAAG,qBAAU,CAAC,YAAY,CAAiB;IACnE,aAAa,EAAE,qBAAU,CAAC,MAAM;IAChC,KAAK,EAAE,qBAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACrD,QAAQ,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;IACtC,cAAc,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAYH;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,qBAAU,CAAC,OAAO,CAGtD,CAAC,IAAa,EAAE,MAAM,EAAE,OAAsC,EAAmC,EAAE;IACnG,qDAAqD;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAA,eAAI,EAAC,qDAAqD,CAAC,CAAC;IACrE,C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;gBACpB,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;oBACzC,OAAO,CAAC,cAAc,EAAE,CAAC;gBAC3B,CAAC;gBACD,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,CAAC;YACzB,CAAC,CAAC;iBACD,UAAU,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Common from '../../common';\nimport { Converters, populateObject, Result, fail, succeed } from '@fgv/ts-utils';\nimport { IConditionDecl, IValidatedConditionDecl } from '../conditionDecls';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter for a {@link Conditions.IConditionDecl | condition declaration}.\n * @public\n */\nexport const conditionDecl = Converters.strictObject<IConditionDecl>({\n qualifierName: Converters.string,\n value: Converters.string,\n operator: Common.Convert.conditionOperator.optional(),\n priority: Converters.number.optional(),\n scoreAsDefault: Converters.number.optional()\n});\n\n/**\n * Conversion context to uses when converting\n * a {@link Conditions.IValidatedConditionDecl | validated condition declaration}.\n * @public\n */\nexport interface IConditionDeclConvertContext {\n readonly qualifiers: IReadOnlyQualifierCollector;\n conditionIndex?: number;\n}\n\n/**\n * Converter which constructs a {@link Conditions.IValidatedConditionDecl | validated condition declaration}\n * from a {@link Conditions.IConditionDecl | condition declaration}, instantiating qualifiers by name\n * from a supplied {@link Conditions.Convert.IConditionDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedConditionDecl = Converters.generic<\n IValidatedConditionDecl,\n IConditionDeclConvertContext\n>((from: unknown, __self, context?: IConditionDeclConvertContext): Result<IValidatedConditionDecl> => {\n /* c8 ignore next 3 - coverage is having a bad day */\n if (!context) {\n return fail('validatedConditionDecl converter requires a context');\n }\n return conditionDecl.convert(from).onSuccess((decl) => {\n const operator = decl.operator ?? 'matches';\n return context.qualifiers.validating.get(decl.qualifierName).onSuccess((qualifier) => {\n return populateObject<IValidatedConditionDecl>({\n qualifier: () => succeed(qualifier),\n value: () => qualifier.validateCondition(decl.value, operator),\n operator: () => succeed(operator),\n priority: () =>\n decl.priority\n ? Common.Convert.conditionPriority.convert(decl.priority)\n : succeed(qualifier.defaultPriority),\n scoreAsDefault: () =>\n decl.scoreAsDefault\n ? Common.Convert.qualifierMatchScore.convert(decl.scoreAsDefault)\n : succeed(undefined),\n index: () =>\n context.conditionIndex\n ? Common.Convert.conditionIndex.convert(context.conditionIndex)\n : succeed(undefined)\n })\n .onSuccess((result) => {\n if (context.conditionIndex !== undefined) {\n context.conditionIndex++;\n }\n return succeed(result);\n })\n .withDetail('success');\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/index.ts"],"names":[],"mappings":"AAsBA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,sDAAoC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './decls';\nexport * from './conditionSetDecls';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/conditions/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/conditions/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAU5B,0BAAO;AARhB,8CAA4B;AAC5B,uDAAqC;AACrC,mDAAiC;AACjC,iDAA+B;AAC/B,0DAAwC;AACxC,sDAAoC;AACpC,mDAAiC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Convert from './convert';\n\nexport * from './condition';\nexport * from './conditionCollector';\nexport * from './conditionDecls';\nexport * from './conditionSet';\nexport * from './conditionSetCollector';\nexport * from './conditionSetDecls';\nexport * from './conditionToken';\n\nexport { Convert };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/packlets/config/common.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAQ,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAE/B,MAAM,uBAAuB,CAAC;AAI/B;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACrC,SAAS,GACT,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,CAAC;AAEvB;;;GAGG;AACH,eAAO,MAAM,iCAAiC,EAAE,aAAa,CAAC,6BAA6B,CAK1F,CAAC;AAEF,cAAc,cAAc,CAAC;AAS7B;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,6BAA6B,EACnC,UAAU,CAAC,EAAE,8BAA8B,GAC1C,MAAM,CAAC,oBAAoB,CAAC,CAY9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,6BAA6B,EACnC,UAAU,CAAC,EAAE,8BAA8B,GAC1C,MAAM,CAAC,mBAAmB,CAAC,CAM7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/config/common.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;AAmDH,4DAeC;AAWD,4EASC;AApFD,4CAA6C;AAE7C,+DAI+B;AAC/B,oDAAuD;AACvD,6CAAgD;AAYhD;;;GAGG;AACU,QAAA,iCAAiC,GAAiD;IAC7F,SAAS;IACT,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;CACnB,CAAC;AAEF,+CAA6B;AAE7B,MAAM,eAAe,GAAgE;IACnF,OAAO,EAAE,oBAAO,CAAC,0BAA0B;IAC3C,mBAAmB,EAAE,oBAAO,CAAC,mCAAmC;IAChE,oBAAoB,EAAE,oBAAO,CAAC,oCAAoC;IAClE,kBAAkB,EAAE,oBAAO,CAAC,2BAA2B;CACxD,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,wBAAwB,CACtC,IAAmC,EACnC,UAA2C;IAE3C,IAAI,IAAI,IAAI,eAAe,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,IAAA,iCAAkB,EAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,sBAAsB,EAAE,CAAC;YACvC,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CACrC,IAAA,qEAA+C,EAAC,MAAM,EAAE,UAAU,CAAC,sBAAuB,CAAC,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,IAAA,eAAI,EAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,gCAAgC,CAC9C,IAAmC,EACnC,UAA2C;IAE3C,IAAI,IAAI,IAAI,eAAe,EAAE,CAAC;QAC5B,OAAO,yCAAmB,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAA,eAAI,EAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, fail } from '@fgv/ts-utils';\nimport { ISystemConfiguration } from './json';\nimport {\n SystemConfiguration,\n ISystemConfigurationInitParams,\n updateSystemConfigurationQualifierDefaultValues\n} from './systemConfiguration';\nimport { sanitizeJsonObject } from '@fgv/ts-json-base';\nimport { Default, Example } from './predefined';\n\n/**\n * A `string` literal type representing a well-known predefined system configuration.\n * @public\n */\nexport type PredefinedSystemConfiguration =\n | 'default'\n | 'language-priority'\n | 'territory-priority'\n | 'extended-example';\n\n/**\n * An array of all well-known predefined system configurations.\n * @public\n */\nexport const allPredefinedSystemConfigurations: ReadonlyArray<PredefinedSystemConfiguration> = [\n 'default',\n 'language-priority',\n 'territory-priority',\n 'extended-example'\n];\n\nexport * from './predefined';\n\nconst predefinedDecls: Record<PredefinedSystemConfiguration, ISystemConfiguration> = {\n default: Default.DefaultSystemConfiguration,\n 'language-priority': Default.LanguagePrioritySystemConfiguration,\n 'territory-priority': Default.TerritoryPrioritySystemConfiguration,\n 'extended-example': Example.ExtendedSystemConfiguration\n};\n\n/**\n * Returns the {@link Config.Model.ISystemConfiguration | system configuration} declaration for the\n * specified predefined system configuration.\n * @param name - The name of the predefined system configuration.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}\n * declaration if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function getPredefinedDeclaration(\n name: PredefinedSystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n): Result<ISystemConfiguration> {\n if (name in predefinedDecls) {\n const baseConfig = sanitizeJsonObject(predefinedDecls[name]);\n if (initParams?.qualifierDefaultValues) {\n return baseConfig.onSuccess((config) =>\n updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues!)\n );\n }\n return baseConfig;\n }\n\n return fail(`Unknown predefined system configuration: ${name}`);\n}\n\n/**\n * Returns the {@link Config.SystemConfiguration | SystemConfiguration} for the specified\n * predefined system configuration.\n * @param name - The name of the predefined system configuration.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function getPredefinedSystemConfiguration(\n name: PredefinedSystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n): Result<SystemConfiguration> {\n if (name in predefinedDecls) {\n return SystemConfiguration.create(predefinedDecls[name], initParams);\n }\n\n return fail(`Unknown predefined system configuration: ${name}`);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/packlets/config/convert.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAM9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,wEAM9B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,kJAAgE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/config/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA2C;AAE3C,4CAA2C;AAE3C,mEAAqD;AACrD,0DAA4C;AAC5C,iEAAmD;AACnD,qCAA6D;AAE7D;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,qBAAU,CAAC,YAAY,CAAuB;IAC/E,IAAI,EAAE,qBAAU,CAAC,cAAc;IAC/B,WAAW,EAAE,qBAAU,CAAC,cAAc;IACtC,cAAc,EAAE,qBAAU,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC;IAC3F,UAAU,EAAE,qBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC;IAChE,aAAa,EAAE,qBAAU,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;CACnF,CAAC,CAAC;AAEH;;;;GAIG;AACU,QAAA,6BAA6B,GAAG,qBAAU,CAAC,eAAe,CAAC,0CAAiC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/* eslint-disable @rushstack/typedef-var */\n\nimport { Converters } from '@fgv/ts-utils';\nimport { ISystemConfiguration } from './json';\nimport * as QualifierTypes from '../qualifier-types';\nimport * as Qualifiers from '../qualifiers';\nimport * as ResourceTypes from '../resource-types';\nimport { allPredefinedSystemConfigurations } from './common';\n\n/**\n * A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.\n * @returns A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.\n * @public\n */\nexport const systemConfiguration = Converters.strictObject<ISystemConfiguration>({\n name: Converters.optionalString,\n description: Converters.optionalString,\n qualifierTypes: Converters.arrayOf(QualifierTypes.Config.Convert.systemQualifierTypeConfig),\n qualifiers: Converters.arrayOf(Qualifiers.Convert.qualifierDecl),\n resourceTypes: Converters.arrayOf(ResourceTypes.Config.Convert.resourceTypeConfig)\n});\n\n/**\n * A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.\n * @returns A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.\n * @public\n */\nexport const predefinedSystemConfiguration = Converters.enumeratedValue(allPredefinedSystemConfigurations);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/config/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/config/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8CAAgC;AAMvB,sBAAK;AALd,mDAAqC;AAKrB,0BAAO;AAHvB,wDAAsC;AACtC,2CAAyB","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Model from './json';\nimport * as Convert from './convert';\n\nexport * from './systemConfiguration';\nexport * from './common';\n\nexport { Model, Convert };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/packlets/config/json.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAE1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;IACnE,iFAAiF;IACjF,UAAU,EAAE,UAAU,CAAC,cAAc,EAAE,CAAC;IACxC,2FAA2F;IAC3F,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;CAC3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/packlets/config/json.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as QualifierTypes from '../qualifier-types';\nimport * as Qualifiers from '../qualifiers';\nimport * as ResourceTypes from '../resource-types';\n\n/**\n * System configuration for both runtime or build.\n * @public\n */\nexport interface ISystemConfiguration {\n /** Optional human-readable name for the configuration. */\n\n name?: string;\n /** Optional description explaining the purpose and use case of the configuration. */\n description?: string;\n /** Qualifier type configurations that define the available qualifier types in the system. */\n qualifierTypes: QualifierTypes.Config.ISystemQualifierTypeConfig[];\n /** Qualifier declarations that define the available qualifiers in the system. */\n qualifiers: Qualifiers.IQualifierDecl[];\n /** Resource type configurations that define the available resource types in the system. */\n resourceTypes: ResourceTypes.Config.IResourceTypeConfig[];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/default.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,0BAA0B,CAejG,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,UAAU,CAAC,cAAc,CAahF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,UAAU,CAAC,cAAc,CAa/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,mBAAmB,CAKxF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,EAAE,oBAMlD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,EAAE,oBAMjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBAMxC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/default.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAQH;;;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mB;IACzB,WAAW,EAAE,wCAAwC;IACrD,cAAc,EAAE,CAAC,GAAG,6BAAqB,CAAC;IAC1C,UAAU,EAAE,CAAC,GAAG,kCAA0B,CAAC;IAC3C,aAAa,EAAE,CAAC,GAAG,4BAAoB,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACU,QAAA,0BAA0B,GAAyB;IAC9D,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,8BAA8B;IAC3C,cAAc,EAAE,CAAC,GAAG,6BAAqB,CAAC;IAC1C,UAAU,EAAE,CAAC,GAAG,mCAA2B,CAAC;IAC5C,aAAa,EAAE,CAAC,GAAG,4BAAoB,CAAC;CACzC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { ISystemConfiguration } from '../json';\n\nimport * as QualifierTypes from '../../qualifier-types';\nimport * as Qualifiers from '../../qualifiers';\nimport * as ResourceTypes from '../../resource-types';\n\n/**\n * Default qualifier types.\n * @remarks\n * The default qualifier types are:\n * - language: recognizes BCP 47 language tags, accepts a comma-separated list of language tags in the context\n * - territory: recognizes ISO 3166-1 alpha-2 territory codes, accepts a single code in the context\n * @public\n */\nexport const DefaultQualifierTypes: ReadonlyArray<QualifierTypes.Config.ISystemQualifierTypeConfig> = [\n {\n name: 'language',\n systemType: 'language',\n configuration: {\n allowContextList: true\n }\n },\n {\n name: 'territory',\n systemType: 'territory',\n configuration: {\n allowContextList: false\n }\n }\n];\n\n/**\n * Qualifier definitions in which territory is the primary qualifier, with\n * language as a secondary qualifier.\n * @remarks\n * The default qualifiers are:\n * - currentTerritory(token: geo): territory qualifier, priority 850\n * - language(token: lang): language qualifier, priority 800\n * @public\n */\nexport const TerritoryPriorityQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 850\n },\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 800\n }\n];\n\n/**\n * Qualifier definitions in which language is the primary qualifier, with\n * territory as a secondary qualifier.\n * @remarks\n * The default qualifiers are:\n * - language(token: lang): language qualifier, priority 850\n * - currentTerritory(token: geo): territory qualifier, priority 800\n * @public\n */\nexport const LanguagePriorityQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 850\n },\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 800\n }\n];\n\n/**\n * Default resource types.\n * @public\n */\nexport const DefaultResourceTypes: ReadonlyArray<ResourceTypes.Config.IResourceTypeConfig> = [\n {\n name: 'json',\n typeName: 'json'\n }\n];\n\n/**\n * System configuration with territory as the primary qualifier, and\n * language as a secondary qualifier.\n * @public\n */\nexport const TerritoryPrioritySystemConfiguration: ISystemConfiguration = {\n name: 'territory-priority',\n description: 'Territory priority system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...TerritoryPriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n\n/**\n * System configuration with language as the primary qualifier, and\n * territory as a secondary qualifier.\n * @public\n */\nexport const LanguagePrioritySystemConfiguration: ISystemConfiguration = {\n name: 'language-priority',\n description: 'Language priority system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...LanguagePriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n\n/**\n * The default system configuration gives priority to territory as the primary qualifier,\n * with language as a secondary qualifier.\n * @public\n */\nexport const DefaultSystemConfiguration: ISystemConfiguration = {\n name: 'default',\n description: 'Default system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...TerritoryPriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extended.d.ts","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/extended.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,0BAA0B,CAiGlG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,UAAU,CAAC,cAAc,CAwCvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,mBAAmB,CAKzF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAMzC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extended.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/extended.ts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QAChB,eAAe,EAAE,GAAG;KACrB;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,aAAa;QACvB,eAAe,EAAE,GAAG;KACrB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,GAAG;KACrB;CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,qBAAqB,GAA4D;IAC5F;QACE,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;KACjB;CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,2BAA2B,GAAyB;IAC/D,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,6EAA6E;IAC1F,cAAc,EAAE,CAAC,GAAG,8BAAsB,CAAC;IAC3C,UAAU,EAAE,CAAC,GAAG,0BAAkB,CAAC;IACnC,aAAa,EAAE,CAAC,GAAG,6BAAqB,CAAC;CAC1C,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as ResourceTypes from '../../resource-types';\nimport * as QualifierTypes from '../../qualifier-types';\nimport * as Qualifiers from '../../qualifiers';\nimport { ISystemConfiguration } from '../json';\n\n/**\n * Example extended qualifier types.\n * @public\n */\nexport const ExtendedQualifierTypes: ReadonlyArray<QualifierTypes.Config.ISystemQualifierTypeConfig> = [\n {\n name: 'language',\n systemType: 'language',\n configuration: {\n allowContextList: true\n }\n },\n {\n name: 'territory',\n systemType: 'territory',\n configuration: {\n allowContextList: false,\n acceptLowercase: false\n }\n },\n {\n name: 'role',\n systemType: 'literal',\n configuration: {\n enumeratedValues: ['admin', 'agent', 'user', 'guest']\n }\n },\n {\n name: 'environment',\n systemType: 'literal',\n configuration: {\n enumeratedValues: ['production', 'integration', 'development', 'test', 'ephemeral']\n }\n },\n {\n name: 'currency',\n systemType: 'literal',\n configuration: {\n caseSensitive: true,\n enumeratedValues: ['USD', 'EUR', 'GBP', 'JPY', 'CNY']\n }\n },\n {\n name: 'market',\n systemType: 'literal',\n configuration: {\n enumeratedValues: [\n 'world',\n 'americas',\n 'europe',\n 'asia',\n 'oceania',\n 'africa',\n 'middle-east',\n 'latin-america',\n 'caribbean',\n 'central-america',\n 'south-america',\n 'north-america',\n 'nordics',\n 'baltic',\n 'balkans',\n 'eastern-europe',\n 'western-europe',\n 'central-europe',\n 'eastern-africa',\n 'western-africa',\n 'central-africa',\n 'north-africa',\n 'south-africa',\n 'middle-africa',\n 'southeast-asia'\n ],\n hierarchy: {\n americas: 'world',\n europe: 'world',\n asia: 'world',\n oceania: 'world',\n africa: 'world',\n 'middle-east': 'world',\n 'latin-america': 'americas',\n caribbean: 'americas',\n 'central-america': 'americas',\n 'south-america': 'americas',\n 'north-america': 'americas',\n nordics: 'europe',\n baltic: 'europe',\n balkans: 'europe',\n 'eastern-europe': 'europe',\n 'western-europe': 'europe',\n 'central-europe': 'europe',\n 'eastern-africa': 'africa',\n 'western-africa': 'africa',\n 'central-africa': 'africa',\n 'north-africa': 'africa',\n 'south-africa': 'africa',\n 'middle-africa': 'africa',\n 'southeast-asia': 'asia'\n }\n }\n }\n];\n\n/**\n * Example extended qualifiers.\n * @public\n */\nexport const ExtendedQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'homeTerritory',\n token: 'home',\n typeName: 'territory',\n defaultPriority: 900\n },\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 850\n },\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 800\n },\n {\n name: 'market',\n typeName: 'market',\n defaultPriority: 750\n },\n {\n name: 'role',\n typeName: 'role',\n defaultPriority: 700\n },\n {\n name: 'environment',\n token: 'env',\n typeName: 'environment',\n defaultPriority: 650\n },\n {\n name: 'currency',\n typeName: 'currency',\n defaultPriority: 600\n }\n];\n\n/**\n * Example resource types.\n * @public\n */\nexport const ExtendedResourceTypes: ReadonlyArray<ResourceTypes.Config.IResourceTypeConfig> = [\n {\n name: 'json',\n typeName: 'json'\n }\n];\n\n/**\n * An example system configuration demonstrating various configuration options.\n * @public\n */\nexport const ExtendedSystemConfiguration: ISystemConfiguration = {\n name: 'extended-example',\n description: 'An example system configuration demonstrating various configuration options',\n qualifierTypes: [...ExtendedQualifierTypes],\n qualifiers: [...ExtendedQualifiers],\n resourceTypes: [...ExtendedResourceTypes]\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAG5B,0BAAO;AAFhB,oDAAsC;AAEpB,0BAAO","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Default from './default';\nimport * as Example from './extended';\n\nexport { Default, Example };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"systemConfiguration.d.ts","sourceRoot":"","sources":["../../../src/packlets/config/systemConfiguration.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA6B,MAAM,EAAiB,MAAM,eAAe,CAAC;AAGjF,OAAO,EAA0B,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAsB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAyB,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAI9C;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,+CAA+C,CAC7D,MAAM,EAAE,oBAAoB,EAC5B,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACpD,MAAM,CAAC,oBAAoB,CAAC,CAoC9B;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAE3C;IAED;;OAEG;IACH,SAAgB,cAAc,EAAE,8BAA8B,CAAC;IAE/D;;;OAGG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;OAEG;IACH,SAAgB,aAAa,EAAE,6BAA6B,CAAC;IAE7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAE/C;;;;;OAKG;IACH,SAAS,aAAa,MAAM,EAAE,oBAAoB;IAqBlD;;;;;;;;OAQG;WACW,MAAM,CAClB,MAAM,EAAE,oBAAoB,EAC5B,UAAU,CAAC,EAAE,8BAA8B,GAC1C,MAAM,CAAC,mBAAmB,CAAC;IAU9B;;;;;;OAMG;IACI,SAAS,IAAI,MAAM,CAAC,oBAAoB,CAAC;CAGjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"systemConfiguration.js","sourceRoot":"","sources":["../../../src/packlets/config/systemConfiguration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH,0GAuCC;AAvED,4CAAiF;AACjF,mEAAqD;AACrD,iEAAmD;AACnD,wDAA4F;AAC5F,8CAA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,EAAE,EAAE,CAAC,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACI,SAAS;QACd,OAAO,6BAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AA5FD,kDA4FC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, mapResults, Result, fail, succeed } from '@fgv/ts-utils';\nimport * as QualifierTypes from '../qualifier-types';\nimport * as ResourceTypes from '../resource-types';\nimport { QualifierTypeCollector, ReadOnlyQualifierTypeCollector } from '../qualifier-types';\nimport { IReadOnlyQualifierCollector, QualifierCollector } from '../qualifiers';\nimport { ReadOnlyResourceTypeCollector, ResourceTypeCollector } from '../resource-types';\nimport { ISystemConfiguration } from './json';\nimport { systemConfiguration } from './convert';\nimport { sanitizeJsonObject } from '@fgv/ts-json-base';\n\n/**\n * Parameters used to initialize a {@link Config.SystemConfiguration | SystemConfiguration}.\n * @public\n */\nexport interface ISystemConfigurationInitParams {\n /**\n * Optional map of qualifier names to default values. If provided, qualifiers\n * in the system configuration will be updated with these default values.\n * Use `null` as the value to remove an existing default value.\n */\n qualifierDefaultValues?: Record<string, string | null>; // eslint-disable-line @rushstack/no-new-null\n}\n\n/**\n * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}\n * with updated qualifier default values.\n * @param config - The base {@link Config.Model.ISystemConfiguration | system configuration} to copy.\n * @param qualifierDefaultValues - Map of qualifier names to default values. Use `null` to remove existing values.\n * @returns `Success` with the updated {@link Config.Model.ISystemConfiguration | system configuration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function updateSystemConfigurationQualifierDefaultValues(\n config: ISystemConfiguration,\n qualifierDefaultValues: Record<string, string | null> // eslint-disable-line @rushstack/no-new-null\n): Result<ISystemConfiguration> {\n // Create a copy of the config\n return sanitizeJsonObject<ISystemConfiguration>(config).onSuccess((updatedConfig) => {\n // Create a map of existing qualifier names for validation\n const existingQualifierNames = new Set(updatedConfig.qualifiers.map((q) => q.name));\n\n // Validate that all specified qualifiers exist in the configuration\n for (const qualifierName of Object.keys(qualifierDefaultValues)) {\n if (!existingQualifierNames.has(qualifierName)) {\n return fail(`Qualifier '${qualifierName}' not found in system configuration`);\n }\n }\n\n // Update qualifier default values\n updatedConfig.qualifiers = updatedConfig.qualifiers.map((qualifier) => {\n if (qualifier.name in qualifierDefaultValues) {\n const newDefaultValue = qualifierDefaultValues[qualifier.name];\n\n // Create a copy of the qualifier\n const updatedQualifier = { ...qualifier };\n\n if (newDefaultValue === null) {\n // Remove the default value\n delete updatedQualifier.defaultValue;\n } else {\n // Set the new default value\n updatedQualifier.defaultValue = newDefaultValue;\n }\n\n return updatedQualifier;\n }\n return qualifier;\n });\n\n return succeed(updatedConfig);\n });\n}\n\n/**\n * A system configuration for both runtime or build.\n * @public\n */\nexport class SystemConfiguration {\n /**\n * The name of this system configuration.\n */\n public get name(): string | undefined {\n return this._config.name;\n }\n\n /**\n * The description of this system configuration.\n */\n public get description(): string | undefined {\n return this._config.description;\n }\n\n /**\n * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} that this system configuration uses.\n */\n public readonly qualifierTypes: ReadOnlyQualifierTypeCollector;\n\n /**\n * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} that this system configuration uses.\n * @public\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * The {@link ResourceTypes.ResourceTypeCollector | resource types} that this system configuration uses.\n */\n public readonly resourceTypes: ReadOnlyResourceTypeCollector;\n\n private readonly _config: ISystemConfiguration;\n\n /**\n * Constructs a new instance of a {@link Config.SystemConfiguration | SystemConfiguration} from the\n * supplied {@link Config.Model.ISystemConfiguration | system configuration}.\n * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.\n * @public\n */\n protected constructor(config: ISystemConfiguration) {\n this._config = config;\n\n this.qualifierTypes = QualifierTypeCollector.create({\n qualifierTypes: mapResults(\n config.qualifierTypes.map(QualifierTypes.createQualifierTypeFromSystemConfig)\n ).orThrow()\n }).orThrow();\n\n this.qualifiers = QualifierCollector.create({\n qualifierTypes: this.qualifierTypes,\n qualifiers: config.qualifiers\n }).orThrow();\n\n this.resourceTypes = ResourceTypeCollector.create({\n resourceTypes: mapResults(\n config.resourceTypes.map(ResourceTypes.createResourceTypeFromConfig)\n ).orThrow()\n }).orThrow();\n }\n\n /**\n * Creates a new {@link Config.SystemConfiguration | SystemConfiguration} from the supplied\n * {@link Config.Model.ISystemConfiguration | system configuration}.\n * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the new {@link Config.SystemConfiguration | SystemConfiguration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static create(\n config: ISystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n ): Result<SystemConfiguration> {\n if (initParams?.qualifierDefaultValues) {\n return updateSystemConfigurationQualifierDefaultValues(\n config,\n initParams.qualifierDefaultValues\n ).onSuccess((updatedConfig) => captureResult(() => new SystemConfiguration(updatedConfig)));\n }\n return captureResult(() => new SystemConfiguration(config));\n }\n\n /**\n * Returns the {@link Config.Model.ISystemConfiguration | system configuration} that this\n * {@link Config.SystemConfiguration | SystemConfiguration} was created from.\n * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public getConfig(): Result<ISystemConfiguration> {\n return systemConfiguration.convert(this._config);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextDecls.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/contextDecls.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,mCAAmC;IAClD,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextDecls.js","sourceRoot":"","sources":["../../../src/packlets/context/contextDecls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { QualifierContextValue, QualifierName } from '../common';\nimport { Qualifier } from '../qualifiers';\n\n/**\n * Options to control matching of conditions against a context.\n * @public\n */\nexport interface IContextMatchOptions {\n /**\n * If true, then conditions which would otherwise yield\n * {@link NoMatch | NoMatch} but have a defined {@link Conditions.Condition.scoreAsDefault | scoreAsDefault}\n * will yield `scoreAsDefault`instead of `NoMatch`.\n */\n acceptDefaultScore?: boolean;\n\n /**\n * If true, then conditions for which a corresponding values is not present in the\n * context being matched will yield `undefined` instead of `NoMatch`.\n */\n partialContextMatch?: boolean;\n}\n\n/**\n * Non-validated declaration of a single context qualifier value.\n * @public\n */\nexport interface IContextQualifierValueDecl {\n qualifier: string;\n value: string;\n}\n\n/**\n * Non-validated declaration of a context, consisting of named\n * values.\n * @public\n */\nexport type IContextDecl = Record<string, string>;\n\n/**\n * Validated declaration of a single context qualifier value.\n * @public\n */\nexport interface IValidatedContextQualifierValueDecl {\n qualifier: Qualifier;\n value: QualifierContextValue;\n}\n\n/**\n * Validated declaration of a context, a record with strongly-typed\n * {@link QualifierTypeName | qualifier type names} as keys and\n * {@link QualifierContextValue | qualifier context values} as values.\n * @public\n */\nexport type IValidatedContextDecl = Record<QualifierName, QualifierContextValue>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextToken.d.ts","sourceRoot":"","sources":["../../../src/packlets/context/contextToken.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAc,MAAM,EAAiB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAwC,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,mCAAmC,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvE;;;GAGG;AACH,qBAAa,aAAa;IACxB;;;OAGG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;;OAGG;gBACgB,UAAU,EAAE,2BAA2B;IAI1D;;;;;;OAMG;IACI,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,mCAAmC,CAAC;IAI7F;;;;;;OAMG;IACI,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,mCAAmC,EAAE,CAAC;IAItF;;;;OAIG;IACI,yBAAyB,CAC9B,KAAK,EAAE,aAAa,CAAC,kBAAkB,GACtC,MAAM,CAAC,mCAAmC,CAAC;IAI9C;;;;;OAKG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;IAI9D;;;;OAIG;IACI,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAIjF;;;;OAIG;IACI,4BAA4B,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IAInF;;;;;;;OAOG;WACW,0BAA0B,CACtC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,mCAAmC,CAAC;IAM9C;;;;;;;OAOG;WACW,iBAAiB,CAC7B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,mCAAmC,EAAE,CAAC;IAMhD;;;;;;;;OAQG;WACW,yBAAyB,CACrC,KAAK,EAAE,aAAa,CAAC,kBAAkB,EACvC,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,mCAAmC,CAAC;IAgB9C;;;;;;OAMG;WACW,qBAAqB,CACjC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,SAAS,CAAC;IAgBpB;;;;;OAKG;WACW,4BAA4B,CACxC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,qBAAqB,CAAC;IAoBhC;;;;OAIG;WACW,4BAA4B,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;CAsB3F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextToken.js","sourceRoot":"","sources":["../../../src/packlets/context/contextToken.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAkE;AAClE,sCAA2F;AAI3F;;;GAGG;AACH,MAAa,aAAa;IAOxB;;;OAGG;IACH,YAAmB,UAAuC;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG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CAAmC;YACnC,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,IAAI,YAAY,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,IAAA,kBAAO,EAAC,EAAE,CAAC,CAAC;QACrB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErC,+BAA+B;QAC/B,OAAO,gBAAa,CAAC,iBAAiB,CACpC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC,CAAC,CACH,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAA,kBAAO,EAAC,WAAW,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF;AA5ND,sCA4NC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults, Result, fail, succeed } from '@fgv/ts-utils';\nimport { Helpers as CommonHelpers, QualifierName, QualifierContextValue } from '../common';\nimport { IValidatedContextQualifierValueDecl, IValidatedContextDecl } from './contextDecls';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../qualifiers';\n\n/**\n * Helper class to parse and validate context tokens.\n * @public\n */\nexport class ContextTokens {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to validate\n * qualifier names and values.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Constructs a new {@link Context.ContextTokens | ContextTokens } instance.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n */\n public constructor(qualifiers: IReadOnlyQualifierCollector) {\n this.qualifiers = qualifiers;\n }\n\n /**\n * Parses a {@link ContextQualifierToken | context qualifier token} string and validates the parts\n * against the qualifiers present in the {@link Context.ContextTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * if successful, `Failure` with an error message if not.\n */\n public parseContextQualifierToken(token: string): Result<IValidatedContextQualifierValueDecl> {\n return ContextTokens.parseContextQualifierToken(token, this.qualifiers);\n }\n\n /**\n * Parses a {@link ContextToken | context token} string and validates the parts\n * against the qualifiers present in the {@link Context.ContextTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the array of {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declarations}\n * if successful, `Failure` with an error message if not.\n */\n public parseContextToken(token: string): Result<IValidatedContextQualifierValueDecl[]> {\n return ContextTokens.parseContextToken(token, this.qualifiers);\n }\n\n /**\n * Validates the {@link Helpers.IContextTokenParts | parts} of a {@link ContextToken | context token}.\n * @param parts - the parts to validate\n * @returns `Success` with the validated declaration if successful, `Failure` with an error message if not.\n */\n public validateContextTokenParts(\n parts: CommonHelpers.IContextTokenParts\n ): Result<IValidatedContextQualifierValueDecl> {\n return ContextTokens.validateContextTokenParts(parts, this.qualifiers);\n }\n\n /**\n * Given a value, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public findQualifierForValue(value: string): Result<Qualifier> {\n return ContextTokens.findQualifierForValue(value, this.qualifiers);\n }\n\n /**\n * Converts a {@link ContextToken | context token} to a validated partial context.\n * @param token - the context token to convert\n * @returns `Success` with the validated partial context if successful, `Failure` with an error message if not.\n */\n public contextTokenToPartialContext(token: string): Result<IValidatedContextDecl> {\n return ContextTokens.contextTokenToPartialContext(token, this.qualifiers);\n }\n\n /**\n * Converts a validated partial context to a {@link ContextToken | context token}.\n * @param context - the validated partial context to convert\n * @returns `Success` with the context token if successful, `Failure` with an error message if not.\n */\n public partialContextToContextToken(context: IValidatedContextDecl): Result<string> {\n return ContextTokens.partialContextToContextToken(context);\n }\n\n /**\n * Parses a {@link ContextQualifierToken | context qualifier token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with a {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static parseContextQualifierToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl> {\n return CommonHelpers.parseContextQualifierTokenParts(token).onSuccess((parts) => {\n return ContextTokens.validateContextTokenParts(parts, qualifiers);\n });\n }\n\n /**\n * Parses a {@link ContextToken | context token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with an array of {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declarations}\n * if successful, `Failure` with an error message if not\n */\n public static parseContextToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl[]> {\n return CommonHelpers.parseContextTokenParts(token).onSuccess((parts) => {\n return mapResults(parts.map((part) => ContextTokens.validateContextTokenParts(part, qualifiers)));\n });\n }\n\n /**\n * Validates the parts of a context token against the qualifiers present in the supplied\n * {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param parts - the {@link Helpers.IContextTokenParts | context token parts} to validate.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to\n * validate qualifier names and values.\n * @returns `Success` with a {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static validateContextTokenParts(\n parts: CommonHelpers.IContextTokenParts,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl> {\n const qualifierLookup =\n parts.qualifier === undefined\n ? ContextTokens.findQualifierForValue(parts.value, qualifiers)\n : qualifiers.getByNameOrToken(parts.qualifier);\n\n return qualifierLookup.onSuccess((qualifier) => {\n return qualifier.type\n .validateContextValue(parts.value)\n .onSuccess((value) => {\n return succeed({ qualifier, value });\n })\n .withDetail('failure', 'success');\n });\n }\n\n /**\n * Given a value and a set of qualifiers, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @param qualifiers - the qualifiers to match against.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public static findQualifierForValue(\n value: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<Qualifier> {\n const matched: Qualifier[] = [];\n for (const qualifier of qualifiers.values()) {\n if (qualifier.tokenIsOptional && qualifier.validateContextValue(value).isSuccess()) {\n matched.push(qualifier);\n }\n }\n if (matched.length === 0) {\n return fail(`${value}: does not match any qualifier`);\n }\n if (matched.length > 1) {\n return fail(`${value}: matches multiple qualifiers (${matched.map((q) => q.name).join(', ')})`);\n }\n return succeed(matched[0]);\n }\n\n /**\n * Converts a {@link ContextToken | context token} to a validated partial context.\n * @param token - the context token to convert\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with the validated partial context if successful, `Failure` with an error message if not.\n */\n public static contextTokenToPartialContext(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextDecl> {\n return ContextTokens.parseContextToken(token, qualifiers).onSuccess((qualifierValues) => {\n const context: IValidatedContextDecl = {};\n\n for (const { qualifier, value } of qualifierValues) {\n const qualifierName = qualifier.name as QualifierName;\n const contextValue = value as QualifierContextValue;\n\n // Check for duplicate qualifiers\n if (qualifierName in context) {\n return fail(`${qualifier.name}: duplicate qualifier in context token`);\n }\n\n context[qualifierName] = contextValue;\n }\n\n return succeed(context);\n });\n }\n\n /**\n * Converts a validated partial context to a {@link ContextToken | context token}.\n * @param context - the validated partial context to convert\n * @returns `Success` with the context token if successful, `Failure` with an error message if not.\n */\n public static partialContextToContextToken(context: IValidatedContextDecl): Result<string> {\n const tokens: string[] = [];\n\n for (const [qualifierName, contextValue] of Object.entries(context)) {\n // Build token as \"qualifier=value\"\n tokens.push(`${qualifierName}=${contextValue}`);\n }\n\n if (tokens.length === 0) {\n return succeed('');\n }\n\n const tokenString = tokens.join('|');\n\n // Validate the generated token\n return CommonHelpers.buildContextToken(\n tokens.map((token) => {\n const [qualifier, value] = token.split('=');\n return { qualifier, value };\n })\n ).onSuccess(() => succeed(tokenString));\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decls.d.ts","sourceRoot":"","sources":["../../../../src/packlets/context/convert/decls.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,0BAA0B,EAC1B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,EAAE,EAAE;wBACnB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;wBAC/B,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;oBACxB,CAAC,CAAC;yBACD,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,cAAc,CAAC,kBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converters, Failure, MessageAggregator, Result, succeed, Success } from '@fgv/ts-utils';\nimport {\n IContextQualifierValueDecl,\n IValidatedContextDecl,\n IValidatedContextQualifierValueDecl\n} from '../contextDecls';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter for a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}.\n * @public\n */\nexport const contextQualifierValueDecl = Converters.strictObject<IContextQualifierValueDecl>({\n qualifier: Converters.string,\n value: Converters.string\n});\n\n/**\n * Converter for a {@link Context.IContextDecl | context declaration}.\n * @public\n */\nexport const contextDecl = Converters.recordOf(Converters.string);\n\n/**\n * Context necessary to convert a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}\n * or {@link Context.IContextDecl | context declaration} to their\n * equivalent - {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * or {@link Context.IValidatedContextDecl | validated context declaration}, respectively.\n * @public\n */\nexport interface IContextDeclConvertContext {\n readonly qualifiers: IReadOnlyQualifierCollector;\n}\n\n/**\n * Converter which constructs a {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * from a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}, instantiating qualifiers by name\n * from a supplied {@link Context.Convert.IContextDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedContextQualifierValueDecl = Converters.generic<\n IValidatedContextQualifierValueDecl,\n IContextDeclConvertContext\n>(\n (\n from: unknown,\n __self,\n context?: IContextDeclConvertContext\n ): Result<IValidatedContextQualifierValueDecl> => {\n if (!context) {\n return Failure.with('validatedContextQualifierValueDecl converter requires a context');\n }\n return contextQualifierValueDecl.convert(from).onSuccess((decl) => {\n const { value: qualifier, message } = context.qualifiers.validating.get(decl.qualifier);\n if (message !== undefined) {\n return Failure.with(message);\n }\n return qualifier.validateContextValue(decl.value).onSuccess((value) => {\n return Success.with({\n qualifier,\n value\n });\n });\n });\n }\n);\n\n/**\n * Converter which constructs a {@link Context.IValidatedContextDecl | validated context declaration}\n * from a {@link Context.IContextDecl | context declaration}, instantiating qualifiers by name\n * from a supplied {@link Context.Convert.IContextDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedContextDecl = Converters.generic<IValidatedContextDecl, IContextDeclConvertContext>(\n (from: unknown, __self, context?: IContextDeclConvertContext): Result<IValidatedContextDecl> => {\n if (!context) {\n /* c8 ignore next 2 - functional code path tested but coverage intermittently missed */\n return Failure.with('validatedContextDecl converter requires a context');\n }\n\n return contextDecl.convert(from).onSuccess((decl) => {\n const errors = new MessageAggregator();\n const result: IValidatedContextDecl = {};\n\n for (const key in decl) {\n if (key in decl) {\n const { value: qualifier } = context.qualifiers.validating.get(key).aggregateError(errors);\n if (qualifier !== undefined) {\n qualifier\n .validateContextValue(decl[key])\n .onSuccess((value) => {\n result[qualifier.name] = value;\n return succeed(value);\n })\n .aggregateError(errors);\n }\n }\n }\n return errors.returnOrReport(Success.with(result));\n });\n }\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packlets/context/convert/index.ts"],"names":[],"mappings":"AAsBA,cAAc,SAAS,CAAC"}
|