@fgv/ts-res 4.5.0-2 → 5.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +26 -0
- package/CHANGELOG.md +14 -0
- package/CLAUDE.md +186 -0
- package/EXAMPLE_INIT_PARAMS.md +88 -0
- package/PROGRESS_SUMMARY.md +48 -0
- package/README.md +535 -14
- package/dist/ts-res.d.ts +4225 -324
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/packlets/common/conditions.d.ts +30 -0
- package/lib/packlets/common/conditions.d.ts.map +1 -1
- package/lib/packlets/common/conditions.js.map +1 -1
- package/lib/packlets/common/convert.d.ts +22 -2
- package/lib/packlets/common/convert.d.ts.map +1 -1
- package/lib/packlets/common/convert.js +21 -1
- package/lib/packlets/common/convert.js.map +1 -1
- package/lib/packlets/common/helpers/context.d.ts +39 -0
- package/lib/packlets/common/helpers/context.d.ts.map +1 -0
- package/lib/packlets/common/helpers/context.js +108 -0
- package/lib/packlets/common/helpers/context.js.map +1 -0
- package/lib/packlets/common/helpers/index.d.ts +2 -0
- package/lib/packlets/common/helpers/index.d.ts.map +1 -1
- package/lib/packlets/common/helpers/index.js +2 -0
- package/lib/packlets/common/helpers/index.js.map +1 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts +39 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.js +105 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
- package/lib/packlets/common/helpers/resources.d.ts.map +1 -1
- package/lib/packlets/common/helpers/resources.js +6 -2
- package/lib/packlets/common/helpers/resources.js.map +1 -1
- package/lib/packlets/common/validate/conditions.d.ts +69 -1
- package/lib/packlets/common/validate/conditions.d.ts.map +1 -1
- package/lib/packlets/common/validate/conditions.js +126 -0
- package/lib/packlets/common/validate/conditions.js.map +1 -1
- package/lib/packlets/common/validate/regularExpressions.d.ts +20 -0
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -1
- package/lib/packlets/common/validate/regularExpressions.js +21 -1
- package/lib/packlets/common/validate/regularExpressions.js.map +1 -1
- package/lib/packlets/conditions/condition.d.ts +37 -0
- package/lib/packlets/conditions/condition.d.ts.map +1 -1
- package/lib/packlets/conditions/condition.js +67 -1
- package/lib/packlets/conditions/condition.js.map +1 -1
- package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionCollector.js +1 -0
- package/lib/packlets/conditions/conditionCollector.js.map +1 -1
- package/lib/packlets/conditions/conditionSet.d.ts +34 -3
- package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionSet.js +31 -3
- package/lib/packlets/conditions/conditionSet.js.map +1 -1
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionSetCollector.js +3 -0
- package/lib/packlets/conditions/conditionSetCollector.js.map +1 -1
- package/lib/packlets/conditions/conditionToken.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionToken.js +2 -1
- package/lib/packlets/conditions/conditionToken.js.map +1 -1
- package/lib/packlets/conditions/convert/decls.js +1 -1
- package/lib/packlets/conditions/convert/decls.js.map +1 -1
- package/lib/packlets/config/common.d.ts +35 -0
- package/lib/packlets/config/common.d.ts.map +1 -0
- package/lib/packlets/config/common.js +96 -0
- package/lib/packlets/config/common.js.map +1 -0
- package/lib/packlets/config/convert.d.ts +14 -0
- package/lib/packlets/config/convert.d.ts.map +1 -0
- package/lib/packlets/config/convert.js +82 -0
- package/lib/packlets/config/convert.js.map +1 -0
- package/lib/packlets/config/index.d.ts +6 -0
- package/lib/packlets/config/index.d.ts.map +1 -0
- package/lib/packlets/config/index.js +67 -0
- package/lib/packlets/config/index.js.map +1 -0
- package/lib/packlets/config/json.d.ts +20 -0
- package/lib/packlets/config/json.d.ts.map +1 -0
- package/lib/packlets/config/json.js +24 -0
- package/lib/packlets/config/json.js.map +1 -0
- package/lib/packlets/config/predefined/default.d.ts +57 -0
- package/lib/packlets/config/predefined/default.d.ts.map +1 -0
- package/lib/packlets/config/predefined/default.js +141 -0
- package/lib/packlets/config/predefined/default.js.map +1 -0
- package/lib/packlets/config/predefined/extended.d.ts +25 -0
- package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
- package/lib/packlets/config/predefined/extended.js +193 -0
- package/lib/packlets/config/predefined/extended.js.map +1 -0
- package/lib/packlets/config/predefined/index.d.ts +4 -0
- package/lib/packlets/config/predefined/index.d.ts.map +1 -0
- package/lib/packlets/config/predefined/index.js +62 -0
- package/lib/packlets/config/predefined/index.js.map +1 -0
- package/lib/packlets/config/systemConfiguration.d.ts +81 -0
- package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
- package/lib/packlets/config/systemConfiguration.js +172 -0
- package/lib/packlets/config/systemConfiguration.js.map +1 -0
- package/lib/packlets/context/contextDecls.d.ts +49 -0
- package/lib/packlets/context/contextDecls.d.ts.map +1 -0
- package/lib/packlets/context/contextDecls.js +24 -0
- package/lib/packlets/context/contextDecls.js.map +1 -0
- package/lib/packlets/context/contextToken.d.ts +111 -0
- package/lib/packlets/context/contextToken.d.ts.map +1 -0
- package/lib/packlets/context/contextToken.js +206 -0
- package/lib/packlets/context/contextToken.js.map +1 -0
- package/lib/packlets/context/convert/decls.d.ts +37 -0
- package/lib/packlets/context/convert/decls.d.ts.map +1 -0
- package/lib/packlets/context/convert/decls.js +94 -0
- package/lib/packlets/context/convert/decls.js.map +1 -0
- package/lib/packlets/context/convert/index.d.ts +2 -0
- package/lib/packlets/context/convert/index.d.ts.map +1 -0
- package/lib/packlets/context/convert/index.js +39 -0
- package/lib/packlets/context/convert/index.js.map +1 -0
- package/lib/packlets/context/index.d.ts +5 -0
- package/lib/packlets/context/index.d.ts.map +1 -0
- package/lib/packlets/context/index.js +65 -0
- package/lib/packlets/context/index.js.map +1 -0
- package/lib/packlets/decisions/abstractDecision.d.ts +8 -0
- package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -1
- package/lib/packlets/decisions/abstractDecision.js +9 -0
- package/lib/packlets/decisions/abstractDecision.js.map +1 -1
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -1
- package/lib/packlets/decisions/abstractDecisionCollector.js +2 -0
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -1
- package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -1
- package/lib/packlets/decisions/concreteDecision.js +3 -2
- package/lib/packlets/decisions/concreteDecision.js.map +1 -1
- package/lib/packlets/decisions/decision.d.ts.map +1 -1
- package/lib/packlets/decisions/decision.js +4 -0
- package/lib/packlets/decisions/decision.js.map +1 -1
- package/lib/packlets/import/fsItem.d.ts.map +1 -1
- package/lib/packlets/import/fsItem.js +1 -0
- package/lib/packlets/import/fsItem.js.map +1 -1
- package/lib/packlets/import/importContext.d.ts +19 -0
- package/lib/packlets/import/importContext.d.ts.map +1 -1
- package/lib/packlets/import/importContext.js +39 -0
- package/lib/packlets/import/importContext.js.map +1 -1
- package/lib/packlets/import/importManager.d.ts +5 -5
- package/lib/packlets/import/importManager.d.ts.map +1 -1
- package/lib/packlets/import/importManager.js.map +1 -1
- package/lib/packlets/import/importers/collectionImporter.d.ts +11 -13
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/collectionImporter.js +29 -20
- package/lib/packlets/import/importers/collectionImporter.js.map +1 -1
- package/lib/packlets/import/importers/fsItemImporter.d.ts +2 -2
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/fsItemImporter.js +2 -2
- package/lib/packlets/import/importers/fsItemImporter.js.map +1 -1
- package/lib/packlets/import/importers/importer.d.ts +3 -3
- package/lib/packlets/import/importers/importer.d.ts.map +1 -1
- package/lib/packlets/import/importers/importer.js.map +1 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts +2 -3
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/jsonImporter.js +10 -20
- package/lib/packlets/import/importers/jsonImporter.js.map +1 -1
- package/lib/packlets/import/importers/pathImporter.d.ts +2 -2
- package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/pathImporter.js.map +1 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts +44 -0
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/convert.js +96 -0
- package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
- package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
- package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/index.js +64 -0
- package/lib/packlets/qualifier-types/config/index.js.map +1 -0
- package/lib/packlets/qualifier-types/config/json.d.ts +69 -0
- package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/json.js +24 -0
- package/lib/packlets/qualifier-types/config/json.js.map +1 -0
- package/lib/packlets/qualifier-types/convert.d.ts +10 -2
- package/lib/packlets/qualifier-types/convert.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/convert.js +15 -0
- package/lib/packlets/qualifier-types/convert.js.map +1 -1
- package/lib/packlets/qualifier-types/helpers.d.ts +27 -0
- package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/helpers.js +118 -0
- package/lib/packlets/qualifier-types/helpers.js.map +1 -0
- package/lib/packlets/qualifier-types/index.d.ts +4 -1
- package/lib/packlets/qualifier-types/index.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/index.js +5 -1
- package/lib/packlets/qualifier-types/index.js.map +1 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +19 -8
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js +28 -9
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +38 -13
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/literalQualifierType.js +44 -10
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +107 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +215 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
- package/lib/packlets/qualifier-types/qualifierType.d.ts +22 -18
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/qualifierType.js +9 -4
- package/lib/packlets/qualifier-types/qualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +4 -2
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js +2 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +47 -11
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.js +61 -17
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -1
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -1
- package/lib/packlets/qualifiers/convert/decls.js +17 -15
- package/lib/packlets/qualifiers/convert/decls.js.map +1 -1
- package/lib/packlets/qualifiers/index.d.ts +2 -0
- package/lib/packlets/qualifiers/index.d.ts.map +1 -1
- package/lib/packlets/qualifiers/index.js +2 -0
- package/lib/packlets/qualifiers/index.js.map +1 -1
- package/lib/packlets/qualifiers/qualifier.d.ts +22 -2
- package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifier.js +26 -1
- package/lib/packlets/qualifiers/qualifier.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifierCollector.js +4 -0
- package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts +6 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts +32 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js +24 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts +96 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js +179 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
- package/lib/packlets/resource-json/compiled/common.d.ts +14 -0
- package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/common.js +24 -0
- package/lib/packlets/resource-json/compiled/common.js.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.d.ts +63 -0
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.js +167 -0
- package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
- package/lib/packlets/resource-json/compiled/index.d.ts +5 -0
- package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/index.js +65 -0
- package/lib/packlets/resource-json/compiled/index.js.map +1 -0
- package/lib/packlets/resource-json/compiled/json.d.ts +204 -0
- package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/json.js +3 -0
- package/lib/packlets/resource-json/compiled/json.js.map +1 -0
- package/lib/packlets/resource-json/convert.d.ts +16 -0
- package/lib/packlets/resource-json/convert.d.ts.map +1 -1
- package/lib/packlets/resource-json/convert.js +41 -6
- package/lib/packlets/resource-json/convert.js.map +1 -1
- package/lib/packlets/resource-json/helpers.d.ts +82 -3
- package/lib/packlets/resource-json/helpers.d.ts.map +1 -1
- package/lib/packlets/resource-json/helpers.js +185 -2
- package/lib/packlets/resource-json/helpers.js.map +1 -1
- package/lib/packlets/resource-json/index.d.ts +2 -1
- package/lib/packlets/resource-json/index.d.ts.map +1 -1
- package/lib/packlets/resource-json/index.js +3 -1
- package/lib/packlets/resource-json/index.js.map +1 -1
- package/lib/packlets/resource-json/json.d.ts +55 -3
- package/lib/packlets/resource-json/json.d.ts.map +1 -1
- package/lib/packlets/resource-json/json.js +16 -0
- package/lib/packlets/resource-json/json.js.map +1 -1
- package/lib/packlets/resource-json/normalized.d.ts +46 -3
- package/lib/packlets/resource-json/normalized.d.ts.map +1 -1
- package/lib/packlets/resource-json/normalized.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts +14 -10
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js +18 -14
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts +15 -2
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts +6 -2
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.js +12 -3
- package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -1
- package/lib/packlets/resource-types/config/convert.d.ts +8 -0
- package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/convert.js +36 -0
- package/lib/packlets/resource-types/config/convert.js.map +1 -0
- package/lib/packlets/resource-types/config/index.d.ts +4 -0
- package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/index.js +64 -0
- package/lib/packlets/resource-types/config/index.js.map +1 -0
- package/lib/packlets/resource-types/config/json.d.ts +9 -0
- package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/json.js +24 -0
- package/lib/packlets/resource-types/config/json.js.map +1 -0
- package/lib/packlets/resource-types/helpers.d.ts +13 -0
- package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
- package/lib/packlets/resource-types/helpers.js +44 -0
- package/lib/packlets/resource-types/helpers.js.map +1 -0
- package/lib/packlets/resource-types/index.d.ts +3 -0
- package/lib/packlets/resource-types/index.d.ts.map +1 -1
- package/lib/packlets/resource-types/index.js +26 -0
- package/lib/packlets/resource-types/index.js.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +5 -13
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.js +5 -2
- package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
- package/lib/packlets/resource-types/resourceType.d.ts +33 -32
- package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/resourceType.js.map +1 -1
- package/lib/packlets/resources/candidateReducer.d.ts +98 -0
- package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
- package/lib/packlets/resources/candidateReducer.js +247 -0
- package/lib/packlets/resources/candidateReducer.js.map +1 -0
- package/lib/packlets/resources/common.d.ts +60 -0
- package/lib/packlets/resources/common.d.ts.map +1 -0
- package/lib/packlets/resources/common.js +24 -0
- package/lib/packlets/resources/common.js.map +1 -0
- package/lib/packlets/resources/index.d.ts +3 -1
- package/lib/packlets/resources/index.d.ts.map +1 -1
- package/lib/packlets/resources/index.js +3 -1
- package/lib/packlets/resources/index.js.map +1 -1
- package/lib/packlets/resources/resource.d.ts +57 -5
- package/lib/packlets/resources/resource.d.ts.map +1 -1
- package/lib/packlets/resources/resource.js +96 -6
- package/lib/packlets/resources/resource.js.map +1 -1
- package/lib/packlets/resources/resourceBuilder.d.ts +14 -0
- package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -1
- package/lib/packlets/resources/resourceBuilder.js +19 -1
- package/lib/packlets/resources/resourceBuilder.js.map +1 -1
- package/lib/packlets/resources/resourceCandidate.d.ts +42 -6
- package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -1
- package/lib/packlets/resources/resourceCandidate.js +40 -1
- package/lib/packlets/resources/resourceCandidate.js.map +1 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +220 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +451 -0
- package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
- package/lib/packlets/runtime/cacheListener.d.ts +62 -0
- package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheListener.js +56 -0
- package/lib/packlets/runtime/cacheListener.js.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts +82 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.js +143 -0
- package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +167 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.js +466 -0
- package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts +70 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.js +135 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +80 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.js +33 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +165 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +179 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
- package/lib/packlets/runtime/context/index.d.ts +5 -0
- package/lib/packlets/runtime/context/index.d.ts.map +1 -0
- package/lib/packlets/runtime/context/index.js +42 -0
- package/lib/packlets/runtime/context/index.js.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +111 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +177 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +47 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +64 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/iResourceManager.d.ts +88 -0
- package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
- package/lib/packlets/runtime/iResourceManager.js +24 -0
- package/lib/packlets/runtime/iResourceManager.js.map +1 -0
- package/lib/packlets/runtime/index.d.ts +12 -0
- package/lib/packlets/runtime/index.d.ts.map +1 -0
- package/lib/packlets/runtime/index.js +73 -0
- package/lib/packlets/runtime/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts +91 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.js +24 -0
- package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.d.ts +5 -0
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.js +42 -0
- package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts +141 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js +224 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts +24 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +98 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +99 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +165 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
- package/lib/packlets/runtime/resourceResolver.d.ts +196 -0
- package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
- package/lib/packlets/runtime/resourceResolver.js +437 -0
- package/lib/packlets/runtime/resourceResolver.js.map +1 -0
- package/lib/packlets/runtime/validate.d.ts +13 -0
- package/lib/packlets/runtime/validate.d.ts.map +1 -0
- package/lib/packlets/runtime/validate.js +49 -0
- package/lib/packlets/runtime/validate.js.map +1 -0
- package/package.json +76 -75
- package/lib/packlets/resources/resourceManager.d.ts +0 -104
- package/lib/packlets/resources/resourceManager.d.ts.map +0 -1
- package/lib/packlets/resources/resourceManager.js +0 -201
- package/lib/packlets/resources/resourceManager.js.map +0 -1
|
@@ -25,20 +25,24 @@ exports.LiteralQualifierType = void 0;
|
|
|
25
25
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
26
|
const common_1 = require("../common");
|
|
27
27
|
const qualifierType_1 = require("./qualifierType");
|
|
28
|
+
const literalValueHierarchy_1 = require("./literalValueHierarchy");
|
|
29
|
+
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
28
30
|
/**
|
|
29
|
-
* A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value
|
|
30
|
-
* or matching against an ordered list of values at runtime.
|
|
31
|
+
* A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value,
|
|
32
|
+
* optionally case-sensitive or matching against an ordered list of values at runtime.
|
|
31
33
|
* @public
|
|
32
34
|
*/
|
|
33
35
|
class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
34
36
|
/**
|
|
35
37
|
* Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
36
38
|
* @param name - Optional name for the qualifier type. Defaults to 'literal'.
|
|
37
|
-
* @param caseSensitive - Optional flag indicating whether the match should be
|
|
38
|
-
*
|
|
39
|
+
* @param caseSensitive - Optional flag indicating whether the match should be
|
|
40
|
+
* case-sensitive. Defaults to `false`.
|
|
41
|
+
* @param allowContextList - Optional flag indicating whether the context can be a
|
|
42
|
+
* list of values. Defaults to `false`.
|
|
39
43
|
* @public
|
|
40
44
|
*/
|
|
41
|
-
constructor({ name, caseSensitive, allowContextList, enumeratedValues, index }) {
|
|
45
|
+
constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }) {
|
|
42
46
|
allowContextList = allowContextList !== false;
|
|
43
47
|
super({
|
|
44
48
|
name: name !== null && name !== void 0 ? name : 'literal',
|
|
@@ -49,10 +53,17 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
49
53
|
this.enumeratedValues = enumeratedValues
|
|
50
54
|
? (0, ts_utils_1.mapResults)(Array.from(enumeratedValues).map(LiteralQualifierType.toLiteralConditionValue)).orThrow()
|
|
51
55
|
: undefined;
|
|
56
|
+
if (hierarchy) {
|
|
57
|
+
/* c8 ignore next 5 - defensive coding: enumeratedValues ?? [] fallback enables open values mode */
|
|
58
|
+
this.hierarchy = literalValueHierarchy_1.LiteralValueHierarchy.create({
|
|
59
|
+
values: enumeratedValues !== null && enumeratedValues !== void 0 ? enumeratedValues : [],
|
|
60
|
+
hierarchy: hierarchy
|
|
61
|
+
}).orThrow();
|
|
62
|
+
}
|
|
52
63
|
}
|
|
53
64
|
/**
|
|
54
|
-
* Determines whether a value is a valid condition value for a literal qualifier.
|
|
55
|
-
* {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts
|
|
65
|
+
* Determines whether a value is a valid condition value for a literal qualifier.
|
|
66
|
+
* The {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts
|
|
56
67
|
* any identifier as a valid condition value.
|
|
57
68
|
* @param value - The value to validate.
|
|
58
69
|
* @returns `true` if the value is a valid condition value, `false` otherwise.
|
|
@@ -69,7 +80,10 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
69
80
|
/**
|
|
70
81
|
* {@inheritdoc QualifierTypes.QualifierType._matchOne}
|
|
71
82
|
*/
|
|
72
|
-
_matchOne(condition, context,
|
|
83
|
+
_matchOne(condition, context, __operator) {
|
|
84
|
+
if (this.hierarchy) {
|
|
85
|
+
return this.hierarchy.match(condition, context, __operator);
|
|
86
|
+
}
|
|
73
87
|
if (this.caseSensitive) {
|
|
74
88
|
return condition === context ? common_1.PerfectMatch : common_1.NoMatch;
|
|
75
89
|
}
|
|
@@ -88,6 +102,26 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
88
102
|
static create(params) {
|
|
89
103
|
return (0, ts_utils_1.captureResult)(() => new LiteralQualifierType(params !== null && params !== void 0 ? params : {}));
|
|
90
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} from a configuration object.
|
|
107
|
+
* @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing
|
|
108
|
+
* the name, systemType, and optional literal-specific configuration including case sensitivity,
|
|
109
|
+
* enumerated values, and hierarchy information.
|
|
110
|
+
* @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}
|
|
111
|
+
* if successful, `Failure` with an error message otherwise.
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
static createFromConfig(config) {
|
|
115
|
+
var _a;
|
|
116
|
+
const literalConfig = (_a = config.configuration) !== null && _a !== void 0 ? _a : {};
|
|
117
|
+
return (0, ts_json_base_1.sanitizeJsonObject)({
|
|
118
|
+
name: config.name,
|
|
119
|
+
allowContextList: literalConfig.allowContextList === true,
|
|
120
|
+
caseSensitive: literalConfig.caseSensitive,
|
|
121
|
+
enumeratedValues: literalConfig.enumeratedValues,
|
|
122
|
+
hierarchy: literalConfig.hierarchy
|
|
123
|
+
}).onSuccess(LiteralQualifierType.create);
|
|
124
|
+
}
|
|
91
125
|
/**
|
|
92
126
|
* Checks if the given value is a valid literal condition value.
|
|
93
127
|
* @param from - The value to validate.
|
|
@@ -100,8 +134,8 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
100
134
|
/**
|
|
101
135
|
* Converts a string to a {@link QualifierConditionValue | literal condition value}.
|
|
102
136
|
* @param from - The string to convert.
|
|
103
|
-
* @returns `Success` with the converted value if valid, or `Failure` with an error
|
|
104
|
-
* if not.
|
|
137
|
+
* @returns `Success` with the converted value if valid, or `Failure` with an error
|
|
138
|
+
* message if not.
|
|
105
139
|
* @public
|
|
106
140
|
*/
|
|
107
141
|
static toLiteralConditionValue(from) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literalQualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAiF;AACjF,sC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CACjB,SAAkC,EAClC,OAA8B,EAC9B,QAA2B;QAE3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,SAAS,KAAM,OAAkB,CAAC,CAAC,CAAC,qBAAY,CAAC,CAAC,CAAC,gBAAO,CAAC;QACpE,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,qBAAY,CAAC,CAAC,CAAC,gBAAO,CAAC;QACpF,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,MAA0C;QAC7D,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,oBAAoB,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAY;QACrD,OAAO,iBAAQ,CAAC,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,uBAAuB,CAAC,IAAY;QAChD,OAAO,oBAAoB,CAAC,4BAA4B,CAAC,IAAI,CAAC;YAC5D,CAAC,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC;YACf,CAAC,CAAC,IAAA,eAAI,EAAC,GAAG,IAAI,wCAAwC,CAAC,CAAC;IAC5D,CAAC;CACF;AAvGD,oDAuGC","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 {\n ConditionOperator,\n Convert,\n NoMatch,\n PerfectMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n Validate\n} from '../common';\nimport { QualifierType } from './qualifierType';\n\n/**\n * Interface defining the parameters that can be used to create a new\n * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @public\n */\nexport interface ILiteralQualifierTypeCreateParams {\n /**\n * Optional name for the qualifier type. Defaults to 'literal'.\n */\n name?: string;\n\n /**\n * Optional flag indicating whether the context can be a list of values.\n * Defaults to `true`.\n */\n allowContextList?: boolean;\n\n /**\n * Optional flag indicating whether the match should be case-sensitive. Defaults to false.\n */\n caseSensitive?: boolean;\n\n /**\n * Optional array of enumerated values to further constrain the type. Defaults to no\n * constraint.\n */\n enumeratedValues?: ReadonlyArray<string>;\n\n /**\n * Global index for this qualifier type.\n */\n index?: number;\n}\n\n/**\n * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value., optionally case-sensitive\n * or matching against an ordered list of values at runtime.\n * @public\n */\nexport class LiteralQualifierType extends QualifierType {\n /**\n * Indicates whether the qualifier match is case-sensitive.\n */\n public readonly caseSensitive: boolean;\n\n /**\n * Optional array of enumerated values to further constrain the type.\n */\n public readonly enumeratedValues?: ReadonlyArray<QualifierConditionValue>;\n\n /**\n * Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @param name - Optional name for the qualifier type. Defaults to 'literal'.\n * @param caseSensitive - Optional flag indicating whether the match should be case-sensitive. Defaults to false.\n * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to false.\n * @public\n */\n protected constructor({\n name,\n caseSensitive,\n allowContextList,\n enumeratedValues,\n index\n }: ILiteralQualifierTypeCreateParams) {\n allowContextList = allowContextList !== false;\n super({\n name: name ?? 'literal',\n allowContextList,\n index: index !== undefined ? Convert.qualifierTypeIndex.convert(index).orThrow() : undefined\n });\n this.caseSensitive = caseSensitive === true;\n this.enumeratedValues = enumeratedValues\n ? mapResults(Array.from(enumeratedValues).map(LiteralQualifierType.toLiteralConditionValue)).orThrow()\n : undefined;\n }\n\n /**\n * Determines whether a value is a valid condition value for a literal qualifier. The\n * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts\n * any identifier as a valid condition value.\n * @param value - The value to validate.\n * @returns `true` if the value is a valid condition value, `false` otherwise.\n */\n public isValidConditionValue(value: string): value is QualifierConditionValue {\n if (this.enumeratedValues) {\n if (this.caseSensitive) {\n return this.enumeratedValues.includes(value as QualifierConditionValue);\n }\n return this.enumeratedValues.some((v) => v.toLowerCase() === value.toLowerCase());\n }\n return LiteralQualifierType.isValidLiteralConditionValue(value);\n }\n\n /**\n * {@inheritdoc QualifierTypes.QualifierType._matchOne}\n */\n protected _matchOne(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore {\n if (this.caseSensitive) {\n return condition === (context as string) ? PerfectMatch : NoMatch;\n } else {\n return condition.toLowerCase() === context.toLowerCase() ? PerfectMatch : NoMatch;\n }\n }\n\n /**\n * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @param params - Optional {@link QualifierTypes.ILiteralQualifierTypeCreateParams | parameters}\n * to use when creating the new instance.\n * @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static create(params?: ILiteralQualifierTypeCreateParams): Result<LiteralQualifierType> {\n return captureResult(() => new LiteralQualifierType(params ?? {}));\n }\n\n /**\n * Checks if the given value is a valid literal condition value.\n * @param from - The value to validate.\n * @returns `true` if the value is a valid literal condition value, otherwise `false`.\n * @public\n */\n public static isValidLiteralConditionValue(from: string): from is QualifierConditionValue {\n return Validate.RegularExpressions.identifier.test(from);\n }\n\n /**\n * Converts a string to a {@link QualifierConditionValue | literal condition value}.\n * @param from - The string to convert.\n * @returns `Success` with the converted value if valid, or `Failure` with an error message\n * if not.\n * @public\n */\n public static toLiteralConditionValue(from: string): Result<QualifierConditionValue> {\n return LiteralQualifierType.isValidLiteralConditionValue(from)\n ? succeed(from)\n : fail(`${from}: not a valid literal condition value.`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"literalQualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAiF;AACjF,sCASmB;AACnB,mDAAgD;AAChD,mEAA2F;AAE3F,oDAAuD;AA2CvD;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,6BAAa;IAiBrD;;;;;;;;OAQG;IACH,YAAsB,EACpB,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,KAAK,EAC6B;QAClC,gBAAgB,GAAG,gBAAgB,KAAK,KAAK,CAAC;QAC9C,KAAK,CAAC;YACJ,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS;YACvB,gBAAgB;YAChB,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;SAC7F,CAAC,CAAC;QACH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AI,wCAAwC,CAAC,CAAC;IAC5D,CAAC;CACF;AAhJD,oDAgJC","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 {\n ConditionOperator,\n Convert,\n NoMatch,\n PerfectMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n Validate\n} from '../common';\nimport { QualifierType } from './qualifierType';\nimport { LiteralValueHierarchy, LiteralValueHierarchyDecl } from './literalValueHierarchy';\nimport * as Config from './config';\nimport { sanitizeJsonObject } from '@fgv/ts-json-base';\n\n/**\n * Interface defining the parameters that can be used to create a new\n * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @public\n */\nexport interface ILiteralQualifierTypeCreateParams {\n /**\n * Optional name for the qualifier type. Defaults to 'literal'.\n */\n name?: string;\n\n /**\n * Optional flag indicating whether the context can be a list of values.\n * Defaults to `true`.\n */\n allowContextList?: boolean;\n\n /**\n * Optional flag indicating whether the match should be case-sensitive.\n * Defaults to `false`.\n */\n caseSensitive?: boolean;\n\n /**\n * Optional array of enumerated values to further constrain the type.\n * Defaults to no constraint.\n */\n enumeratedValues?: ReadonlyArray<string>;\n\n /**\n * Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}\n * of literal values to use for matching. If not provided, no hierarchy will be used.\n */\n hierarchy?: LiteralValueHierarchyDecl<string>;\n\n /**\n * Global index for this qualifier type.\n */\n index?: number;\n}\n\n/**\n * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value,\n * optionally case-sensitive or matching against an ordered list of values at runtime.\n * @public\n */\nexport class LiteralQualifierType extends QualifierType {\n /**\n * Indicates whether the qualifier match is case-sensitive.\n */\n public readonly caseSensitive: boolean;\n\n /**\n * Optional array of enumerated values to further constrain the type.\n */\n public readonly enumeratedValues?: ReadonlyArray<QualifierConditionValue>;\n\n /**\n * Optional {@link QualifierTypes.LiteralValueHierarchy | hierarchy} of literal\n * values to use for matching. If not provided, no hierarchy will be used.\n */\n public readonly hierarchy?: LiteralValueHierarchy<string>;\n\n /**\n * Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @param name - Optional name for the qualifier type. Defaults to 'literal'.\n * @param caseSensitive - Optional flag indicating whether the match should be\n * case-sensitive. Defaults to `false`.\n * @param allowContextList - Optional flag indicating whether the context can be a\n * list of values. Defaults to `false`.\n * @public\n */\n protected constructor({\n name,\n caseSensitive,\n allowContextList,\n enumeratedValues,\n hierarchy,\n index\n }: ILiteralQualifierTypeCreateParams) {\n allowContextList = allowContextList !== false;\n super({\n name: name ?? 'literal',\n allowContextList,\n index: index !== undefined ? Convert.qualifierTypeIndex.convert(index).orThrow() : undefined\n });\n this.caseSensitive = caseSensitive === true;\n this.enumeratedValues = enumeratedValues\n ? mapResults(Array.from(enumeratedValues).map(LiteralQualifierType.toLiteralConditionValue)).orThrow()\n : undefined;\n if (hierarchy) {\n /* c8 ignore next 5 - defensive coding: enumeratedValues ?? [] fallback enables open values mode */\n this.hierarchy = LiteralValueHierarchy.create({\n values: enumeratedValues ?? [],\n hierarchy: hierarchy\n }).orThrow();\n }\n }\n\n /**\n * Determines whether a value is a valid condition value for a literal qualifier.\n * The {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts\n * any identifier as a valid condition value.\n * @param value - The value to validate.\n * @returns `true` if the value is a valid condition value, `false` otherwise.\n */\n public isValidConditionValue(value: string): value is QualifierConditionValue {\n if (this.enumeratedValues) {\n if (this.caseSensitive) {\n return this.enumeratedValues.includes(value as QualifierConditionValue);\n }\n return this.enumeratedValues.some((v) => v.toLowerCase() === value.toLowerCase());\n }\n return LiteralQualifierType.isValidLiteralConditionValue(value);\n }\n\n /**\n * {@inheritdoc QualifierTypes.QualifierType._matchOne}\n */\n protected _matchOne(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n __operator: ConditionOperator\n ): QualifierMatchScore {\n if (this.hierarchy) {\n return this.hierarchy.match(condition, context, __operator);\n }\n if (this.caseSensitive) {\n return condition === (context as string) ? PerfectMatch : NoMatch;\n } else {\n return condition.toLowerCase() === context.toLowerCase() ? PerfectMatch : NoMatch;\n }\n }\n\n /**\n * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.\n * @param params - Optional {@link QualifierTypes.ILiteralQualifierTypeCreateParams | parameters}\n * to use when creating the new instance.\n * @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static create(params?: ILiteralQualifierTypeCreateParams): Result<LiteralQualifierType> {\n return captureResult(() => new LiteralQualifierType(params ?? {}));\n }\n\n /**\n * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} from a configuration object.\n * @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing\n * the name, systemType, and optional literal-specific configuration including case sensitivity,\n * enumerated values, and hierarchy information.\n * @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static createFromConfig(\n config: Config.IQualifierTypeConfig<Config.ILiteralQualifierTypeConfig>\n ): Result<LiteralQualifierType> {\n const literalConfig = config.configuration ?? {};\n return sanitizeJsonObject<ILiteralQualifierTypeCreateParams>({\n name: config.name,\n allowContextList: literalConfig.allowContextList === true,\n caseSensitive: literalConfig.caseSensitive,\n enumeratedValues: literalConfig.enumeratedValues,\n hierarchy: literalConfig.hierarchy\n }).onSuccess(LiteralQualifierType.create);\n }\n\n /**\n * Checks if the given value is a valid literal condition value.\n * @param from - The value to validate.\n * @returns `true` if the value is a valid literal condition value, otherwise `false`.\n * @public\n */\n public static isValidLiteralConditionValue(from: string): from is QualifierConditionValue {\n return Validate.RegularExpressions.identifier.test(from);\n }\n\n /**\n * Converts a string to a {@link QualifierConditionValue | literal condition value}.\n * @param from - The string to convert.\n * @returns `Success` with the converted value if valid, or `Failure` with an error\n * message if not.\n * @public\n */\n public static toLiteralConditionValue(from: string): Result<QualifierConditionValue> {\n return LiteralQualifierType.isValidLiteralConditionValue(from)\n ? succeed(from)\n : fail(`${from}: not a valid literal condition value.`);\n }\n}\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Result } from '@fgv/ts-utils';
|
|
2
|
+
import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
|
|
3
|
+
/**
|
|
4
|
+
* Declares a hierarchy of literal values. The keys are the names of the values, and the
|
|
5
|
+
* values are the names of their parents.
|
|
6
|
+
* @remarks
|
|
7
|
+
* The hierarchy is defined as a tree, where each value can have multiple children but
|
|
8
|
+
* only one parent. The root of the tree has no parent. The hierarchy is used to
|
|
9
|
+
* determine the relationship between values when matching conditions and contexts.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Describes a single valid literal value including optional parent and child values.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface ILiteralValue<T extends string> {
|
|
18
|
+
readonly name: T;
|
|
19
|
+
readonly parent?: ILiteralValue<T>;
|
|
20
|
+
readonly children?: ReadonlyArray<T>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Describes the parameters used to create a new
|
|
24
|
+
* {@link QualifierTypes.LiteralValueHierarchy | LiteralValueHierarchy}.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export interface ILiteralValueHierarchyCreateParams<T extends string = string> {
|
|
28
|
+
values: ReadonlyArray<T>;
|
|
29
|
+
hierarchy?: LiteralValueHierarchyDecl<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A class that implements a hierarchy of literal values. The hierarchy is defined as a
|
|
33
|
+
* tree, where each value can have multiple children but only one parent. The root of the
|
|
34
|
+
* tree has no parent. The hierarchy is used to determine the relationship between values
|
|
35
|
+
* when matching conditions and contexts.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The hierarchy can be created in two modes:
|
|
39
|
+
* - **Constrained mode**: When enumerated values are provided, only those values are allowed
|
|
40
|
+
* in the hierarchy and matching operations.
|
|
41
|
+
* - **Open values mode**: When no enumerated values are provided, all values referenced in
|
|
42
|
+
* the hierarchy are automatically collected and used. This allows for flexible hierarchies
|
|
43
|
+
* where any value can be used in matching operations.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export declare class LiteralValueHierarchy<T extends string = string> {
|
|
47
|
+
/**
|
|
48
|
+
* A map of all allowed literal values to the corresponding
|
|
49
|
+
* {@link QualifierTypes.ILiteralValue | ILiteralValue} validated definition.
|
|
50
|
+
*/
|
|
51
|
+
readonly values: ReadonlyMap<T, ILiteralValue<T>>;
|
|
52
|
+
/**
|
|
53
|
+
* Indicates whether this hierarchy was created with open values (no enumerated values
|
|
54
|
+
* provided), allowing any value to be used in matching operations.
|
|
55
|
+
*/
|
|
56
|
+
readonly isOpenValues: boolean;
|
|
57
|
+
protected constructor(params: ILiteralValueHierarchyCreateParams<T>);
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new {@link QualifierTypes.LiteralValueHierarchy | LiteralValueHierarchy} instance.
|
|
60
|
+
* @param params - The {@link QualifierTypes.ILiteralValueHierarchyCreateParams | parameters}
|
|
61
|
+
* used to create the hierarchy.
|
|
62
|
+
* @returns `Success` with the new hierarchy or `Failure` with an error message.
|
|
63
|
+
*/
|
|
64
|
+
static create<T extends string>(params: ILiteralValueHierarchyCreateParams<T>): Result<LiteralValueHierarchy<T>>;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a value exists in the hierarchy.
|
|
67
|
+
* @param value - The value to check.
|
|
68
|
+
* @returns `true` if the value exists in the hierarchy, `false` otherwise.
|
|
69
|
+
*/
|
|
70
|
+
hasValue(value: T): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Gets all root values (values with no parent) in the hierarchy.
|
|
73
|
+
* @returns `Success` with an array of root values.
|
|
74
|
+
*/
|
|
75
|
+
getRoots(): Result<T[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Gets all ancestors of a value in the hierarchy.
|
|
78
|
+
* @param value - The value to get ancestors for.
|
|
79
|
+
* @returns `Success` with an array of ancestor values, ordered from immediate parent
|
|
80
|
+
* to root, or `Failure` if the value is not in the hierarchy.
|
|
81
|
+
*/
|
|
82
|
+
getAncestors(value: T): Result<T[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Gets all descendants of a value in the hierarchy.
|
|
85
|
+
* @param value - The value to get descendants for.
|
|
86
|
+
* @returns `Success` with an array of descendant values, or `Failure` if the value
|
|
87
|
+
* is not in the hierarchy.
|
|
88
|
+
*/
|
|
89
|
+
getDescendants(value: T): Result<T[]>;
|
|
90
|
+
match(condition: T, context: T): QualifierMatchScore;
|
|
91
|
+
/**
|
|
92
|
+
* Matches a condition value against a context value, where an exact match of the
|
|
93
|
+
* condition and context returns {@link PerfectMatch | PerfectMatch}, a condition
|
|
94
|
+
* value that does not match the context value or any of its ancestors returns
|
|
95
|
+
* {@link NoMatch | NoMatch}, and a condition value that matches the context value
|
|
96
|
+
* or any of its ancestors returns a positive score that is less than
|
|
97
|
+
* {@link PerfectMatch | PerfectMatch}, with the score decreasing with each ancestor
|
|
98
|
+
* in the hierarchy.
|
|
99
|
+
* @param condition - The condition value to match.
|
|
100
|
+
* @param context - The context value to match against.
|
|
101
|
+
* @param __operator - The operator used for matching (not used in this implementation).
|
|
102
|
+
* @returns A {@link QualifierMatchScore | QualifierMatchScore} indicating the match score.
|
|
103
|
+
*/
|
|
104
|
+
match(condition: QualifierConditionValue, context: QualifierContextValue, __operator?: ConditionOperator): QualifierMatchScore;
|
|
105
|
+
protected static _buildValuesFromHierarchy<T extends string>(params: ILiteralValueHierarchyCreateParams<T>): Result<ReadonlyMap<T, ILiteralValue<T>>>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=literalValueHierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literalValueHierarchy.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalValueHierarchy.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAoC,MAAM,EAAiB,MAAM,eAAe,CAAC;AACxF,OAAO,EACL,iBAAiB,EAGjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM;IAC7C,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;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uCtB,SAAS,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,SAAS,MAAM,EACzD,MAAM,EAAE,kCAAkC,CAAC,CAAC,CAAC,GAC5C,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CAkE5C"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.LiteralValueHierarchy = void 0;
|
|
25
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
const common_1 = require("../common");
|
|
27
|
+
/**
|
|
28
|
+
* A class that implements a hierarchy of literal values. The hierarchy is defined as a
|
|
29
|
+
* tree, where each value can have multiple children but only one parent. The root of the
|
|
30
|
+
* tree has no parent. The hierarchy is used to determine the relationship between values
|
|
31
|
+
* when matching conditions and contexts.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The hierarchy can be created in two modes:
|
|
35
|
+
* - **Constrained mode**: When enumerated values are provided, only those values are allowed
|
|
36
|
+
* in the hierarchy and matching operations.
|
|
37
|
+
* - **Open values mode**: When no enumerated values are provided, all values referenced in
|
|
38
|
+
* the hierarchy are automatically collected and used. This allows for flexible hierarchies
|
|
39
|
+
* where any value can be used in matching operations.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
class LiteralValueHierarchy {
|
|
43
|
+
constructor(params) {
|
|
44
|
+
const result = LiteralValueHierarchy._buildValuesFromHierarchy(params);
|
|
45
|
+
this.values = result.orThrow();
|
|
46
|
+
this.isOpenValues = !params.values || params.values.length === 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new {@link QualifierTypes.LiteralValueHierarchy | LiteralValueHierarchy} instance.
|
|
50
|
+
* @param params - The {@link QualifierTypes.ILiteralValueHierarchyCreateParams | parameters}
|
|
51
|
+
* used to create the hierarchy.
|
|
52
|
+
* @returns `Success` with the new hierarchy or `Failure` with an error message.
|
|
53
|
+
*/
|
|
54
|
+
static create(params) {
|
|
55
|
+
return (0, ts_utils_1.captureResult)(() => new LiteralValueHierarchy(params));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a value exists in the hierarchy.
|
|
59
|
+
* @param value - The value to check.
|
|
60
|
+
* @returns `true` if the value exists in the hierarchy, `false` otherwise.
|
|
61
|
+
*/
|
|
62
|
+
hasValue(value) {
|
|
63
|
+
return this.values.has(value);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets all root values (values with no parent) in the hierarchy.
|
|
67
|
+
* @returns `Success` with an array of root values.
|
|
68
|
+
*/
|
|
69
|
+
getRoots() {
|
|
70
|
+
return (0, ts_utils_1.succeed)(Array.from(this.values.values())
|
|
71
|
+
.filter((v) => !v.parent)
|
|
72
|
+
.map((v) => v.name));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets all ancestors of a value in the hierarchy.
|
|
76
|
+
* @param value - The value to get ancestors for.
|
|
77
|
+
* @returns `Success` with an array of ancestor values, ordered from immediate parent
|
|
78
|
+
* to root, or `Failure` if the value is not in the hierarchy.
|
|
79
|
+
*/
|
|
80
|
+
getAncestors(value) {
|
|
81
|
+
const current = this.values.get(value);
|
|
82
|
+
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
83
|
+
if (!current) {
|
|
84
|
+
return (0, ts_utils_1.fail)(`${value}: not found in hierarchy`);
|
|
85
|
+
}
|
|
86
|
+
const ancestors = [];
|
|
87
|
+
let ancestor = current.parent;
|
|
88
|
+
while (ancestor) {
|
|
89
|
+
ancestors.push(ancestor.name);
|
|
90
|
+
ancestor = ancestor.parent;
|
|
91
|
+
}
|
|
92
|
+
return (0, ts_utils_1.succeed)(ancestors);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets all descendants of a value in the hierarchy.
|
|
96
|
+
* @param value - The value to get descendants for.
|
|
97
|
+
* @returns `Success` with an array of descendant values, or `Failure` if the value
|
|
98
|
+
* is not in the hierarchy.
|
|
99
|
+
*/
|
|
100
|
+
getDescendants(value) {
|
|
101
|
+
const current = this.values.get(value);
|
|
102
|
+
if (!current) {
|
|
103
|
+
return (0, ts_utils_1.fail)(`${value}: not found in hierarchy`);
|
|
104
|
+
}
|
|
105
|
+
const descendants = [];
|
|
106
|
+
if (current.children) {
|
|
107
|
+
for (const childName of current.children) {
|
|
108
|
+
descendants.push(childName);
|
|
109
|
+
const childDescendants = this.getDescendants(childName);
|
|
110
|
+
if (childDescendants.isSuccess()) {
|
|
111
|
+
descendants.push(...childDescendants.value);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return (0, ts_utils_1.succeed)(descendants);
|
|
116
|
+
}
|
|
117
|
+
match(condition, context, __operator) {
|
|
118
|
+
var _a;
|
|
119
|
+
// For open hierarchies, skip validation and allow any values
|
|
120
|
+
if (!this.isOpenValues) {
|
|
121
|
+
// Validate that both condition and context exist in the hierarchy
|
|
122
|
+
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
123
|
+
if (!this.values.has(condition)) {
|
|
124
|
+
return common_1.NoMatch;
|
|
125
|
+
}
|
|
126
|
+
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
127
|
+
if (!this.values.has(context)) {
|
|
128
|
+
return common_1.NoMatch;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (condition === context) {
|
|
132
|
+
return common_1.PerfectMatch;
|
|
133
|
+
}
|
|
134
|
+
// For open hierarchies, if values aren't in the hierarchy, treat as no match
|
|
135
|
+
// but don't fail validation
|
|
136
|
+
const values = this.values;
|
|
137
|
+
/* c8 ignore next 1 - ? is defense in depth */
|
|
138
|
+
let value = (_a = values.get(context)) === null || _a === void 0 ? void 0 : _a.parent;
|
|
139
|
+
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
140
|
+
if (!value) {
|
|
141
|
+
return common_1.NoMatch;
|
|
142
|
+
}
|
|
143
|
+
let score = common_1.PerfectMatch;
|
|
144
|
+
while (value) {
|
|
145
|
+
score *= 0.9;
|
|
146
|
+
if (value.name === condition) {
|
|
147
|
+
return common_1.Convert.qualifierMatchScore.convert(score).orDefault(common_1.NoMatch);
|
|
148
|
+
}
|
|
149
|
+
value = value.parent;
|
|
150
|
+
}
|
|
151
|
+
return common_1.NoMatch;
|
|
152
|
+
}
|
|
153
|
+
static _buildValuesFromHierarchy(params) {
|
|
154
|
+
var _a;
|
|
155
|
+
const errors = new ts_utils_1.MessageAggregator();
|
|
156
|
+
const values = params.values;
|
|
157
|
+
const hierarchy = (_a = params.hierarchy) !== null && _a !== void 0 ? _a : {};
|
|
158
|
+
// If no values are provided, collect all values from the hierarchy
|
|
159
|
+
let allValues;
|
|
160
|
+
if (!values || values.length === 0) {
|
|
161
|
+
const hierarchyValues = new Set();
|
|
162
|
+
// Add all keys and values from the hierarchy
|
|
163
|
+
Object.keys(hierarchy).forEach((key) => hierarchyValues.add(key));
|
|
164
|
+
Object.values(hierarchy).forEach((value) => hierarchyValues.add(value));
|
|
165
|
+
allValues = Array.from(hierarchyValues);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
allValues = [...values];
|
|
169
|
+
}
|
|
170
|
+
const valueMap = new Map(allValues.map((name) => [name, { name }]));
|
|
171
|
+
if (hierarchy) {
|
|
172
|
+
for (const [valueName, parentName] of Object.entries(hierarchy)) {
|
|
173
|
+
const value = valueMap.get(valueName);
|
|
174
|
+
if (!value) {
|
|
175
|
+
errors.addMessage(`${valueName}: invalid literal value.`);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const parent = valueMap.get(parentName);
|
|
179
|
+
if (!parent) {
|
|
180
|
+
errors.addMessage(`${valueName}: parent ${parentName} is not a valid literal value.`);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
let ancestor = parent.parent;
|
|
184
|
+
let circular = false;
|
|
185
|
+
const ancestors = [];
|
|
186
|
+
while (ancestor) {
|
|
187
|
+
/* c8 ignore next 1 - defensive coding: complex circular reference detection intermittently missed */
|
|
188
|
+
ancestors.push(ancestor.name);
|
|
189
|
+
/* c8 ignore next 1 - defensive coding: ancestor.parent === value is very difficult to reach */
|
|
190
|
+
if (ancestor.parent === parent || ancestor.parent === value) {
|
|
191
|
+
/* c8 ignore next 3 - defensive coding: circular reference error reporting intermittently missed */
|
|
192
|
+
errors.addMessage(`${valueName}: Circular reference detected: ${ancestors.join('->')}`);
|
|
193
|
+
circular = true;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
ancestor = ancestor.parent;
|
|
197
|
+
}
|
|
198
|
+
/* c8 ignore next 2 - defensive coding: circular reference handling intermittently missed */
|
|
199
|
+
if (circular) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
value.parent = parent;
|
|
203
|
+
if (parent.children) {
|
|
204
|
+
parent.children.push(value.name);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
parent.children = [value.name];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)(valueMap));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.LiteralValueHierarchy = LiteralValueHierarchy;
|
|
215
|
+
//# sourceMappingURL=literalValueHierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literalValueHierarchy.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalValueHierarchy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAwF;AACxF,sCAQmB;AA4CnB;;;;;;;;;;;;;;GAcG;AACH,MAAa,qBAAqB;IAahC,YAAsB,MAA6C;QACjE,MAAM,MAAM,GAAG,qBAAqB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAClB,MAA6C;QAE7C,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAA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MAAM,GAAG,MAAM,CAAC;gBACtB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,IAAA,kBAAO,EAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC;CACF;AAnOD,sDAmOC","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, MessageAggregator, Result, succeed, fail } from '@fgv/ts-utils';\nimport {\n ConditionOperator,\n NoMatch,\n PerfectMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n Convert as CommonConverters\n} from '../common';\n\n/**\n * Declares a hierarchy of literal values. The keys are the names of the values, and the\n * values are the names of their parents.\n * @remarks\n * The hierarchy is defined as a tree, where each value can have multiple children but\n * only one parent. The root of the tree has no parent. The hierarchy is used to\n * determine the relationship between values when matching conditions and contexts.\n * @public\n */\nexport type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;\n\n/**\n * Describes a single valid literal value including optional parent and child values.\n * @public\n */\nexport interface ILiteralValue<T extends string> {\n readonly name: T;\n readonly parent?: ILiteralValue<T>;\n readonly children?: ReadonlyArray<T>;\n}\n\n/**\n * Describes the parameters used to create a new\n * {@link QualifierTypes.LiteralValueHierarchy | LiteralValueHierarchy}.\n * @public\n */\nexport interface ILiteralValueHierarchyCreateParams<T extends string = string> {\n values: ReadonlyArray<T>;\n hierarchy?: LiteralValueHierarchyDecl<T>;\n}\n\n/**\n * Internal interface used during hierarchy construction to build\n * {@link QualifierTypes.ILiteralValue | ILiteralValue} objects.\n * @public\n */\ninterface ILiteralValueBuilder<T extends string> {\n readonly name: T;\n parent?: ILiteralValue<T>;\n children?: T[];\n}\n\n/**\n * A class that implements a hierarchy of literal values. The hierarchy is defined as a\n * tree, where each value can have multiple children but only one parent. The root of the\n * tree has no parent. The hierarchy is used to determine the relationship between values\n * when matching conditions and contexts.\n *\n * @remarks\n * The hierarchy can be created in two modes:\n * - **Constrained mode**: When enumerated values are provided, only those values are allowed\n * in the hierarchy and matching operations.\n * - **Open values mode**: When no enumerated values are provided, all values referenced in\n * the hierarchy are automatically collected and used. This allows for flexible hierarchies\n * where any value can be used in matching operations.\n * @public\n */\nexport class LiteralValueHierarchy<T extends string = string> {\n /**\n * A map of all allowed literal values to the corresponding\n * {@link QualifierTypes.ILiteralValue | ILiteralValue} validated definition.\n */\n public readonly values: ReadonlyMap<T, ILiteralValue<T>>;\n\n /**\n * Indicates whether this hierarchy was created with open values (no enumerated values\n * provided), allowing any value to be used in matching operations.\n */\n public readonly isOpenValues: boolean;\n\n protected constructor(params: ILiteralValueHierarchyCreateParams<T>) {\n const result = LiteralValueHierarchy._buildValuesFromHierarchy(params);\n this.values = result.orThrow();\n this.isOpenValues = !params.values || params.values.length === 0;\n }\n\n /**\n * Creates a new {@link QualifierTypes.LiteralValueHierarchy | LiteralValueHierarchy} instance.\n * @param params - The {@link QualifierTypes.ILiteralValueHierarchyCreateParams | parameters}\n * used to create the hierarchy.\n * @returns `Success` with the new hierarchy or `Failure` with an error message.\n */\n public static create<T extends string>(\n params: ILiteralValueHierarchyCreateParams<T>\n ): Result<LiteralValueHierarchy<T>> {\n return captureResult(() => new LiteralValueHierarchy(params));\n }\n\n /**\n * Checks if a value exists in the hierarchy.\n * @param value - The value to check.\n * @returns `true` if the value exists in the hierarchy, `false` otherwise.\n */\n public hasValue(value: T): boolean {\n return this.values.has(value);\n }\n\n /**\n * Gets all root values (values with no parent) in the hierarchy.\n * @returns `Success` with an array of root values.\n */\n public getRoots(): Result<T[]> {\n return succeed(\n Array.from(this.values.values())\n .filter((v) => !v.parent)\n .map((v) => v.name)\n );\n }\n\n /**\n * Gets all ancestors of a value in the hierarchy.\n * @param value - The value to get ancestors for.\n * @returns `Success` with an array of ancestor values, ordered from immediate parent\n * to root, or `Failure` if the value is not in the hierarchy.\n */\n public getAncestors(value: T): Result<T[]> {\n const current = this.values.get(value);\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (!current) {\n return fail(`${value}: not found in hierarchy`);\n }\n\n const ancestors: T[] = [];\n let ancestor = current.parent;\n\n while (ancestor) {\n ancestors.push(ancestor.name);\n ancestor = ancestor.parent;\n }\n\n return succeed(ancestors);\n }\n\n /**\n * Gets all descendants of a value in the hierarchy.\n * @param value - The value to get descendants for.\n * @returns `Success` with an array of descendant values, or `Failure` if the value\n * is not in the hierarchy.\n */\n public getDescendants(value: T): Result<T[]> {\n const current = this.values.get(value);\n if (!current) {\n return fail(`${value}: not found in hierarchy`);\n }\n\n const descendants: T[] = [];\n if (current.children) {\n for (const childName of current.children) {\n descendants.push(childName);\n const childDescendants = this.getDescendants(childName);\n if (childDescendants.isSuccess()) {\n descendants.push(...childDescendants.value);\n }\n }\n }\n\n return succeed(descendants);\n }\n\n public match(condition: T, context: T): QualifierMatchScore;\n /**\n * Matches a condition value against a context value, where an exact match of the\n * condition and context returns {@link PerfectMatch | PerfectMatch}, a condition\n * value that does not match the context value or any of its ancestors returns\n * {@link NoMatch | NoMatch}, and a condition value that matches the context value\n * or any of its ancestors returns a positive score that is less than\n * {@link PerfectMatch | PerfectMatch}, with the score decreasing with each ancestor\n * in the hierarchy.\n * @param condition - The condition value to match.\n * @param context - The context value to match against.\n * @param __operator - The operator used for matching (not used in this implementation).\n * @returns A {@link QualifierMatchScore | QualifierMatchScore} indicating the match score.\n */\n public match(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n __operator?: ConditionOperator\n ): QualifierMatchScore;\n public match(condition: string, context: string, __operator?: ConditionOperator): QualifierMatchScore {\n // For open hierarchies, skip validation and allow any values\n if (!this.isOpenValues) {\n // Validate that both condition and context exist in the hierarchy\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (!this.values.has(condition as T)) {\n return NoMatch;\n }\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (!this.values.has(context as T)) {\n return NoMatch;\n }\n }\n\n if ((condition as string) === (context as string)) {\n return PerfectMatch;\n }\n\n // For open hierarchies, if values aren't in the hierarchy, treat as no match\n // but don't fail validation\n const values: ReadonlyMap<string, ILiteralValue<string>> = this.values;\n /* c8 ignore next 1 - ? is defense in depth */\n let value = values.get(context)?.parent;\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (!value) {\n return NoMatch;\n }\n let score = PerfectMatch as number;\n while (value) {\n score *= 0.9;\n if (value.name === condition) {\n return CommonConverters.qualifierMatchScore.convert(score).orDefault(NoMatch);\n }\n value = value.parent;\n }\n return NoMatch;\n }\n\n protected static _buildValuesFromHierarchy<T extends string>(\n params: ILiteralValueHierarchyCreateParams<T>\n ): Result<ReadonlyMap<T, ILiteralValue<T>>> {\n const errors = new MessageAggregator();\n const values = params.values;\n const hierarchy = params.hierarchy ?? {};\n\n // If no values are provided, collect all values from the hierarchy\n let allValues: T[];\n if (!values || values.length === 0) {\n const hierarchyValues = new Set<T>();\n // Add all keys and values from the hierarchy\n Object.keys(hierarchy).forEach((key) => hierarchyValues.add(key as T));\n Object.values(hierarchy).forEach((value) => hierarchyValues.add(value as T));\n allValues = Array.from(hierarchyValues);\n } else {\n allValues = [...values];\n }\n\n const valueMap = new Map<T, ILiteralValueBuilder<T>>(allValues.map((name) => [name, { name }]));\n\n if (hierarchy) {\n for (const [valueName, parentName] of Object.entries(hierarchy)) {\n const value = valueMap.get(valueName as T);\n if (!value) {\n errors.addMessage(`${valueName}: invalid literal value.`);\n continue;\n }\n\n const parent = valueMap.get(parentName as T);\n if (!parent) {\n errors.addMessage(`${valueName}: parent ${parentName} is not a valid literal value.`);\n continue;\n }\n\n let ancestor = parent.parent;\n let circular = false;\n const ancestors: T[] = [];\n\n while (ancestor) {\n /* c8 ignore next 1 - defensive coding: complex circular reference detection intermittently missed */\n ancestors.push(ancestor.name);\n /* c8 ignore next 1 - defensive coding: ancestor.parent === value is very difficult to reach */\n if (ancestor.parent === parent || ancestor.parent === value) {\n /* c8 ignore next 3 - defensive coding: circular reference error reporting intermittently missed */\n errors.addMessage(`${valueName}: Circular reference detected: ${ancestors.join('->')}`);\n circular = true;\n break;\n }\n ancestor = ancestor.parent;\n }\n\n /* c8 ignore next 2 - defensive coding: circular reference handling intermittently missed */\n if (circular) {\n continue;\n }\n\n value.parent = parent;\n if (parent.children) {\n parent.children.push(value.name);\n } else {\n parent.children = [value.name];\n }\n }\n }\n\n return errors.returnOrReport(succeed(valueMap));\n }\n}\n"]}
|
|
@@ -23,15 +23,17 @@ export interface IQualifierType extends ICollectible<QualifierTypeName, Qualifie
|
|
|
23
23
|
/**
|
|
24
24
|
* Validates a condition value for this qualifier type.
|
|
25
25
|
* @param value - The string value to validate.
|
|
26
|
-
* @returns `Success` with the {@link QualifierConditionValue | validated value}
|
|
27
|
-
* is valid for use in a condition, `Failure` with error details
|
|
26
|
+
* @returns `Success` with the {@link QualifierConditionValue | validated value}
|
|
27
|
+
* if the value is valid for use in a condition, `Failure` with error details
|
|
28
|
+
* otherwise.
|
|
28
29
|
*/
|
|
29
30
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
30
31
|
/**
|
|
31
32
|
* Validates a context value for this qualifier type.
|
|
32
33
|
* @param value - The string value to validate.
|
|
33
|
-
* @returns `Success` with the {@link QualifierContextValue | validated value}
|
|
34
|
-
* is valid for use in a runtime context, `Failure` with error
|
|
34
|
+
* @returns `Success` with the {@link QualifierContextValue | validated value}
|
|
35
|
+
* if the value is valid for use in a runtime context, `Failure` with error
|
|
36
|
+
* details otherwise.
|
|
35
37
|
*/
|
|
36
38
|
isValidContextValue(value: string): value is QualifierContextValue;
|
|
37
39
|
/**
|
|
@@ -42,24 +44,26 @@ export interface IQualifierType extends ICollectible<QualifierTypeName, Qualifie
|
|
|
42
44
|
*/
|
|
43
45
|
validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
|
|
44
46
|
/**
|
|
45
|
-
* Validates that a value is valid for use in a runtime context for qualifiers
|
|
47
|
+
* Validates that a value is valid for use in a runtime context for qualifiers
|
|
48
|
+
* of this type.
|
|
46
49
|
* @param value - The string value to validate.
|
|
47
|
-
* @returns `Success` with the {@link QualifierContextValue | validated value}
|
|
48
|
-
* is valid for use in a runtime context, `Failure` with error
|
|
50
|
+
* @returns `Success` with the {@link QualifierContextValue | validated value}
|
|
51
|
+
* if the value is valid for use in a runtime context, `Failure` with error
|
|
52
|
+
* details otherwise.
|
|
49
53
|
*/
|
|
50
54
|
validateContextValue(value: string): Result<QualifierContextValue>;
|
|
51
55
|
/**
|
|
52
|
-
* Determines the extent to which a condition matches a context value for this
|
|
56
|
+
* Determines the extent to which a condition matches a context value for this
|
|
57
|
+
* qualifier type.
|
|
53
58
|
* @param condition - The condition value to evaluate.
|
|
54
59
|
* @param context - The context value to evaluate.
|
|
55
60
|
* @param operator - The operator to use in evaluating the match.
|
|
56
|
-
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
57
|
-
* matches the context value.
|
|
61
|
+
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
62
|
+
* the condition matches the context value.
|
|
58
63
|
*/
|
|
59
64
|
matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
|
|
60
65
|
/**
|
|
61
|
-
* Sets the index for this qualifier type.
|
|
62
|
-
* immutable.
|
|
66
|
+
* Sets the index for this qualifier type. Once set, index is immutable.
|
|
63
67
|
*/
|
|
64
68
|
setIndex(index: number): Result<QualifierTypeIndex>;
|
|
65
69
|
}
|
|
@@ -157,8 +161,8 @@ export declare abstract class QualifierType implements IQualifierType {
|
|
|
157
161
|
* @param condition - The {@link QualifierConditionValue | condition value} to match.
|
|
158
162
|
* @param context - The {@link QualifierContextValue | context value} to match.
|
|
159
163
|
* @param operator - The {@link ConditionOperator | operator} to use in the match.
|
|
160
|
-
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
161
|
-
* matches the context value.
|
|
164
|
+
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
165
|
+
* the condition matches the context value.
|
|
162
166
|
* @public
|
|
163
167
|
*/
|
|
164
168
|
protected abstract _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
|
|
@@ -167,14 +171,14 @@ export declare abstract class QualifierType implements IQualifierType {
|
|
|
167
171
|
* @param condition - The {@link QualifierConditionValue | condition value} to match.
|
|
168
172
|
* @param context - The comma-separated list of {@link QualifierContextValue | context values} to match.
|
|
169
173
|
* @param operator - The {@link ConditionOperator | operator} to use in the match.
|
|
170
|
-
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
171
|
-
* matches the context value.
|
|
174
|
+
* @returns a {@link QualifierMatchScore | score} indicating the extent to which
|
|
175
|
+
* the condition matches the context value.
|
|
172
176
|
* @public
|
|
173
177
|
*/
|
|
174
178
|
protected _matchList(condition: QualifierConditionValue, context: QualifierContextValue[], operator: ConditionOperator): QualifierMatchScore;
|
|
175
179
|
/**
|
|
176
|
-
* Splits a comma-separated {@link QualifierContextValue | context value} into an
|
|
177
|
-
* individual values.
|
|
180
|
+
* Splits a comma-separated {@link QualifierContextValue | context value} into an
|
|
181
|
+
* array of individual values.
|
|
178
182
|
* @param value - The value to split.
|
|
179
183
|
* @returns an array of individual context values.
|
|
180
184
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/qualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,iBAAiB,EAIjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,WAAW,CAAC;AAEnB;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IACzF;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAE/C
|
|
1
|
+
{"version":3,"file":"qualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/qualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,iBAAiB,EAIjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAElB,MAAM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