@fgv/ts-res 5.1.0-3 → 5.1.0-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/packlets/bundle/bundleBuilder.js.map +1 -0
- package/dist/packlets/bundle/bundleLoader.js.map +1 -0
- package/dist/packlets/bundle/bundleNormalizer.js.map +1 -0
- package/dist/packlets/bundle/bundleUtils.js.map +1 -0
- package/dist/packlets/bundle/convert.js.map +1 -0
- package/dist/packlets/bundle/index.js.map +1 -0
- package/dist/packlets/bundle/model.js.map +1 -0
- package/dist/packlets/common/conditions.js.map +1 -0
- package/dist/packlets/common/convert.js.map +1 -0
- package/dist/packlets/common/helpers/conditions.js.map +1 -0
- package/dist/packlets/common/helpers/context.js.map +1 -0
- package/dist/packlets/common/helpers/index.js.map +1 -0
- package/dist/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
- package/dist/packlets/common/helpers/resources.js +2 -4
- package/dist/packlets/common/helpers/resources.js.map +1 -0
- package/dist/packlets/common/index.js.map +1 -0
- package/dist/packlets/common/resources.js.map +1 -0
- package/dist/packlets/common/validate/conditions.js +4 -4
- package/dist/packlets/common/validate/conditions.js.map +1 -0
- package/dist/packlets/common/validate/index.js.map +1 -0
- package/dist/packlets/common/validate/regularExpressions.js +2 -2
- package/dist/packlets/common/validate/regularExpressions.js.map +1 -0
- package/dist/packlets/common/validate/resources.js +1 -1
- package/dist/packlets/common/validate/resources.js.map +1 -0
- package/dist/packlets/conditions/condition.js +3 -7
- package/dist/packlets/conditions/condition.js.map +1 -0
- package/dist/packlets/conditions/conditionCollector.js.map +1 -0
- package/dist/packlets/conditions/conditionDecls.js.map +1 -0
- package/dist/packlets/conditions/conditionSet.js +14 -5
- package/dist/packlets/conditions/conditionSet.js.map +1 -0
- package/dist/packlets/conditions/conditionSetCollector.js.map +1 -0
- package/dist/packlets/conditions/conditionSetDecls.js.map +1 -0
- package/dist/packlets/conditions/conditionToken.js.map +1 -0
- package/dist/packlets/conditions/convert/conditionSetDecls.js +50 -6
- package/dist/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
- package/dist/packlets/conditions/convert/decls.js +61 -5
- package/dist/packlets/conditions/convert/decls.js.map +1 -0
- package/dist/packlets/conditions/convert/index.js.map +1 -0
- package/dist/packlets/conditions/index.js.map +1 -0
- package/dist/packlets/config/common.js.map +1 -0
- package/dist/packlets/config/configInitFactory.js.map +1 -0
- package/dist/packlets/config/convert.js.map +1 -0
- package/dist/packlets/config/index.browser.js.map +1 -0
- package/dist/packlets/config/index.js.map +1 -0
- package/dist/packlets/config/json.js.map +1 -0
- package/dist/packlets/config/predefined/default.js.map +1 -0
- package/dist/packlets/config/predefined/extended.js.map +1 -0
- package/dist/packlets/config/predefined/index.js.map +1 -0
- package/dist/packlets/config/systemConfiguration.js.map +1 -0
- package/dist/packlets/context/contextDecls.js.map +1 -0
- package/dist/packlets/context/contextToken.js.map +1 -0
- package/dist/packlets/context/convert/decls.js.map +1 -0
- package/dist/packlets/context/convert/index.js.map +1 -0
- package/dist/packlets/context/index.js.map +1 -0
- package/dist/packlets/decisions/abstractDecision.js.map +1 -0
- package/dist/packlets/decisions/abstractDecisionCollector.js.map +1 -0
- package/dist/packlets/decisions/candidate.js.map +1 -0
- package/dist/packlets/decisions/common.js.map +1 -0
- package/dist/packlets/decisions/concreteDecision.js.map +1 -0
- package/dist/packlets/decisions/decision.js +1 -1
- package/dist/packlets/decisions/decision.js.map +1 -0
- package/dist/packlets/decisions/index.js.map +1 -0
- package/dist/packlets/import/fsItem.js +1 -4
- package/dist/packlets/import/fsItem.js.map +1 -0
- package/dist/packlets/import/importContext.js +3 -3
- package/dist/packlets/import/importContext.js.map +1 -0
- package/dist/packlets/import/importManager.js +7 -3
- package/dist/packlets/import/importManager.js.map +1 -0
- package/dist/packlets/import/importable.js.map +1 -0
- package/dist/packlets/import/importers/collectionImporter.js +2 -2
- package/dist/packlets/import/importers/collectionImporter.js.map +1 -0
- package/dist/packlets/import/importers/fsItemImporter.js +30 -14
- package/dist/packlets/import/importers/fsItemImporter.js.map +1 -0
- package/dist/packlets/import/importers/importer.js.map +1 -0
- package/dist/packlets/import/importers/index.browser.js.map +1 -0
- package/dist/packlets/import/importers/index.js.map +1 -0
- package/dist/packlets/import/importers/jsonImporter.js +2 -2
- package/dist/packlets/import/importers/jsonImporter.js.map +1 -0
- package/dist/packlets/import/importers/pathImporter.js +1 -1
- package/dist/packlets/import/importers/pathImporter.js.map +1 -0
- package/dist/packlets/import/index.browser.js.map +1 -0
- package/dist/packlets/import/index.js.map +1 -0
- package/dist/packlets/qualifier-types/config/convert.js.map +1 -0
- package/dist/packlets/qualifier-types/config/index.js.map +1 -0
- package/dist/packlets/qualifier-types/config/json.js.map +1 -0
- package/dist/packlets/qualifier-types/convert.js.map +1 -0
- package/dist/packlets/qualifier-types/helpers.js.map +1 -0
- package/dist/packlets/qualifier-types/index.js.map +1 -0
- package/dist/packlets/qualifier-types/languageQualifierType.js +6 -7
- package/dist/packlets/qualifier-types/languageQualifierType.js.map +1 -0
- package/dist/packlets/qualifier-types/literalQualifierType.js +7 -10
- package/dist/packlets/qualifier-types/literalQualifierType.js.map +1 -0
- package/dist/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
- package/dist/packlets/qualifier-types/qualifierType.js +12 -13
- package/dist/packlets/qualifier-types/qualifierType.js.map +1 -0
- package/dist/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
- package/dist/packlets/qualifier-types/territoryQualifierType.js +5 -5
- package/dist/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
- package/dist/packlets/qualifiers/convert/decls.js.map +1 -0
- package/dist/packlets/qualifiers/convert/index.js.map +1 -0
- package/dist/packlets/qualifiers/convert/qualifier.js.map +1 -0
- package/dist/packlets/qualifiers/index.js.map +1 -0
- package/dist/packlets/qualifiers/qualifier.js +6 -7
- package/dist/packlets/qualifiers/qualifier.js.map +1 -0
- package/dist/packlets/qualifiers/qualifierCollector.js +153 -9
- package/dist/packlets/qualifiers/qualifierCollector.js.map +1 -0
- package/dist/packlets/qualifiers/qualifierDecl.js.map +1 -0
- package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
- package/dist/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
- package/dist/packlets/resource-json/compiled/common.js.map +1 -0
- package/dist/packlets/resource-json/compiled/convert.js.map +1 -0
- package/dist/packlets/resource-json/compiled/index.js.map +1 -0
- package/dist/packlets/resource-json/compiled/json.js.map +1 -0
- package/dist/packlets/resource-json/convert.js +225 -0
- package/dist/packlets/resource-json/convert.js.map +1 -0
- package/dist/packlets/resource-json/helpers.js.map +1 -0
- package/dist/packlets/resource-json/index.js.map +1 -0
- package/dist/packlets/resource-json/json.js +2 -2
- package/dist/packlets/resource-json/json.js.map +1 -0
- package/dist/packlets/resource-json/normalized.js.map +1 -0
- package/dist/packlets/resource-json/resourceDeclCollection.js +1 -1
- package/dist/packlets/resource-json/resourceDeclCollection.js.map +1 -0
- package/dist/packlets/resource-json/resourceDeclContainer.js.map +1 -0
- package/dist/packlets/resource-json/resourceDeclTree.js +1 -1
- package/dist/packlets/resource-json/resourceDeclTree.js.map +1 -0
- package/dist/packlets/resource-types/config/convert.js.map +1 -0
- package/dist/packlets/resource-types/config/index.js.map +1 -0
- package/dist/packlets/resource-types/config/json.js.map +1 -0
- package/dist/packlets/resource-types/helpers.js.map +1 -0
- package/dist/packlets/resource-types/index.js.map +1 -0
- package/dist/packlets/resource-types/jsonResourceType.js +2 -2
- package/dist/packlets/resource-types/jsonResourceType.js.map +1 -0
- package/dist/packlets/resource-types/resourceType.js +2 -2
- package/dist/packlets/resource-types/resourceType.js.map +1 -0
- package/dist/packlets/resource-types/resourceTypeCollector.js.map +1 -0
- package/dist/packlets/resources/candidateReducer.js.map +1 -0
- package/dist/packlets/resources/candidateValue.js.map +1 -0
- package/dist/packlets/resources/candidateValueCollector.js.map +1 -0
- package/dist/packlets/resources/common.js.map +1 -0
- package/dist/packlets/resources/deltaGenerator.js.map +1 -0
- package/dist/packlets/resources/index.js.map +1 -0
- package/dist/packlets/resources/resource.js.map +1 -0
- package/dist/packlets/resources/resourceBuilder.js +2 -2
- package/dist/packlets/resources/resourceBuilder.js.map +1 -0
- package/dist/packlets/resources/resourceCandidate.js.map +1 -0
- package/dist/packlets/resources/resourceManagerBuilder.js +5 -5
- package/dist/packlets/resources/resourceManagerBuilder.js.map +1 -0
- package/dist/packlets/runtime/cacheListener.js.map +1 -0
- package/dist/packlets/runtime/cacheMetrics.js.map +1 -0
- package/dist/packlets/runtime/compiledResourceCollection.js +5 -5
- package/dist/packlets/runtime/compiledResourceCollection.js.map +1 -0
- package/dist/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
- package/dist/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
- package/dist/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
- package/dist/packlets/runtime/context/index.js.map +1 -0
- package/dist/packlets/runtime/context/simpleContextQualifierProvider.js +3 -0
- package/dist/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
- package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +3 -5
- package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
- package/dist/packlets/runtime/iResourceManager.js.map +1 -0
- package/dist/packlets/runtime/index.js.map +1 -0
- package/dist/packlets/runtime/resource-tree/common.js.map +1 -0
- package/dist/packlets/runtime/resource-tree/index.js.map +1 -0
- package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
- package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
- package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
- package/dist/packlets/runtime/resourceResolver.js.map +1 -0
- package/dist/packlets/runtime/resourceTreeResolver.js.map +1 -0
- package/dist/packlets/runtime/validate.js.map +1 -0
- package/dist/packlets/zip-archive/convert.js.map +1 -0
- package/dist/packlets/zip-archive/index.browser.js.map +1 -0
- package/dist/packlets/zip-archive/index.js.map +1 -0
- package/dist/packlets/zip-archive/json.js.map +1 -0
- package/dist/packlets/zip-archive/types.js.map +1 -0
- package/dist/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
- package/dist/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
- package/dist/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
- package/dist/ts-res.d.ts +576 -164
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts.map +1 -0
- package/lib/index.browser.js.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
- package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleLoader.js.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
- package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleUtils.js.map +1 -0
- package/lib/packlets/bundle/convert.d.ts.map +1 -0
- package/lib/packlets/bundle/convert.js.map +1 -0
- package/lib/packlets/bundle/index.d.ts.map +1 -0
- package/lib/packlets/bundle/index.js.map +1 -0
- package/lib/packlets/bundle/model.d.ts.map +1 -0
- package/lib/packlets/bundle/model.js.map +1 -0
- package/lib/packlets/common/conditions.d.ts.map +1 -0
- package/lib/packlets/common/conditions.js.map +1 -0
- package/lib/packlets/common/convert.d.ts.map +1 -0
- package/lib/packlets/common/convert.js.map +1 -0
- package/lib/packlets/common/helpers/conditions.d.ts.map +1 -0
- package/lib/packlets/common/helpers/conditions.js.map +1 -0
- package/lib/packlets/common/helpers/context.d.ts.map +1 -0
- package/lib/packlets/common/helpers/context.js.map +1 -0
- package/lib/packlets/common/helpers/index.d.ts.map +1 -0
- package/lib/packlets/common/helpers/index.js.map +1 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
- package/lib/packlets/common/helpers/resources.d.ts +2 -4
- package/lib/packlets/common/helpers/resources.d.ts.map +1 -0
- package/lib/packlets/common/helpers/resources.js +2 -4
- package/lib/packlets/common/helpers/resources.js.map +1 -0
- package/lib/packlets/common/index.d.ts.map +1 -0
- package/lib/packlets/common/index.js.map +1 -0
- package/lib/packlets/common/resources.d.ts.map +1 -0
- package/lib/packlets/common/resources.js.map +1 -0
- package/lib/packlets/common/validate/conditions.d.ts +4 -4
- package/lib/packlets/common/validate/conditions.d.ts.map +1 -0
- package/lib/packlets/common/validate/conditions.js +4 -4
- package/lib/packlets/common/validate/conditions.js.map +1 -0
- package/lib/packlets/common/validate/index.d.ts.map +1 -0
- package/lib/packlets/common/validate/index.js.map +1 -0
- package/lib/packlets/common/validate/regularExpressions.d.ts +2 -2
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -0
- package/lib/packlets/common/validate/regularExpressions.js +2 -2
- package/lib/packlets/common/validate/regularExpressions.js.map +1 -0
- package/lib/packlets/common/validate/resources.d.ts +1 -1
- package/lib/packlets/common/validate/resources.d.ts.map +1 -0
- package/lib/packlets/common/validate/resources.js +1 -1
- package/lib/packlets/common/validate/resources.js.map +1 -0
- package/lib/packlets/conditions/condition.d.ts +3 -7
- package/lib/packlets/conditions/condition.d.ts.map +1 -0
- package/lib/packlets/conditions/condition.js +3 -7
- package/lib/packlets/conditions/condition.js.map +1 -0
- package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionCollector.js.map +1 -0
- package/lib/packlets/conditions/conditionDecls.d.ts +6 -1
- package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionDecls.js.map +1 -0
- package/lib/packlets/conditions/conditionSet.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionSet.js +14 -5
- package/lib/packlets/conditions/conditionSet.js.map +1 -0
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionSetCollector.js.map +1 -0
- package/lib/packlets/conditions/conditionSetDecls.d.ts +7 -2
- package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionSetDecls.js.map +1 -0
- package/lib/packlets/conditions/conditionToken.d.ts.map +1 -0
- package/lib/packlets/conditions/conditionToken.js.map +1 -0
- package/lib/packlets/conditions/convert/conditionSetDecls.d.ts +30 -2
- package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -0
- package/lib/packlets/conditions/convert/conditionSetDecls.js +51 -5
- package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
- package/lib/packlets/conditions/convert/decls.d.ts +39 -3
- package/lib/packlets/conditions/convert/decls.d.ts.map +1 -0
- package/lib/packlets/conditions/convert/decls.js +63 -5
- package/lib/packlets/conditions/convert/decls.js.map +1 -0
- package/lib/packlets/conditions/convert/index.d.ts.map +1 -0
- package/lib/packlets/conditions/convert/index.js.map +1 -0
- package/lib/packlets/conditions/index.d.ts.map +1 -0
- package/lib/packlets/conditions/index.js.map +1 -0
- package/lib/packlets/config/common.d.ts.map +1 -0
- package/lib/packlets/config/common.js.map +1 -0
- package/lib/packlets/config/configInitFactory.d.ts.map +1 -0
- package/lib/packlets/config/configInitFactory.js.map +1 -0
- package/lib/packlets/config/convert.d.ts.map +1 -0
- package/lib/packlets/config/convert.js.map +1 -0
- package/lib/packlets/config/index.browser.d.ts.map +1 -0
- package/lib/packlets/config/index.browser.js.map +1 -0
- package/lib/packlets/config/index.d.ts.map +1 -0
- package/lib/packlets/config/index.js.map +1 -0
- package/lib/packlets/config/json.d.ts.map +1 -0
- package/lib/packlets/config/json.js.map +1 -0
- package/lib/packlets/config/predefined/default.d.ts.map +1 -0
- package/lib/packlets/config/predefined/default.js.map +1 -0
- package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
- package/lib/packlets/config/predefined/extended.js.map +1 -0
- package/lib/packlets/config/predefined/index.d.ts.map +1 -0
- package/lib/packlets/config/predefined/index.js.map +1 -0
- package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
- package/lib/packlets/config/systemConfiguration.js.map +1 -0
- package/lib/packlets/context/contextDecls.d.ts.map +1 -0
- package/lib/packlets/context/contextDecls.js.map +1 -0
- package/lib/packlets/context/contextToken.d.ts.map +1 -0
- package/lib/packlets/context/contextToken.js.map +1 -0
- package/lib/packlets/context/convert/decls.d.ts.map +1 -0
- package/lib/packlets/context/convert/decls.js.map +1 -0
- package/lib/packlets/context/convert/index.d.ts.map +1 -0
- package/lib/packlets/context/convert/index.js.map +1 -0
- package/lib/packlets/context/index.d.ts.map +1 -0
- package/lib/packlets/context/index.js.map +1 -0
- package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -0
- package/lib/packlets/decisions/abstractDecision.js.map +1 -0
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -0
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -0
- package/lib/packlets/decisions/candidate.d.ts.map +1 -0
- package/lib/packlets/decisions/candidate.js.map +1 -0
- package/lib/packlets/decisions/common.d.ts.map +1 -0
- package/lib/packlets/decisions/common.js.map +1 -0
- package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -0
- package/lib/packlets/decisions/concreteDecision.js.map +1 -0
- package/lib/packlets/decisions/decision.d.ts +1 -1
- package/lib/packlets/decisions/decision.d.ts.map +1 -0
- package/lib/packlets/decisions/decision.js +1 -1
- package/lib/packlets/decisions/decision.js.map +1 -0
- package/lib/packlets/decisions/index.d.ts.map +1 -0
- package/lib/packlets/decisions/index.js.map +1 -0
- package/lib/packlets/import/fsItem.d.ts +1 -4
- package/lib/packlets/import/fsItem.d.ts.map +1 -0
- package/lib/packlets/import/fsItem.js +1 -4
- package/lib/packlets/import/fsItem.js.map +1 -0
- package/lib/packlets/import/importContext.d.ts +5 -5
- package/lib/packlets/import/importContext.d.ts.map +1 -0
- package/lib/packlets/import/importContext.js +3 -3
- package/lib/packlets/import/importContext.js.map +1 -0
- package/lib/packlets/import/importManager.d.ts +15 -1
- package/lib/packlets/import/importManager.d.ts.map +1 -0
- package/lib/packlets/import/importManager.js +7 -3
- package/lib/packlets/import/importManager.js.map +1 -0
- package/lib/packlets/import/importable.d.ts.map +1 -0
- package/lib/packlets/import/importable.js.map +1 -0
- package/lib/packlets/import/importers/collectionImporter.d.ts +2 -2
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -0
- package/lib/packlets/import/importers/collectionImporter.js +2 -2
- package/lib/packlets/import/importers/collectionImporter.js.map +1 -0
- package/lib/packlets/import/importers/fsItemImporter.d.ts +16 -2
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -0
- package/lib/packlets/import/importers/fsItemImporter.js +29 -13
- package/lib/packlets/import/importers/fsItemImporter.js.map +1 -0
- package/lib/packlets/import/importers/importer.d.ts.map +1 -0
- package/lib/packlets/import/importers/importer.js.map +1 -0
- package/lib/packlets/import/importers/index.browser.d.ts.map +1 -0
- package/lib/packlets/import/importers/index.browser.js.map +1 -0
- package/lib/packlets/import/importers/index.d.ts.map +1 -0
- package/lib/packlets/import/importers/index.js.map +1 -0
- package/lib/packlets/import/importers/jsonImporter.d.ts +2 -2
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -0
- package/lib/packlets/import/importers/jsonImporter.js +2 -2
- package/lib/packlets/import/importers/jsonImporter.js.map +1 -0
- package/lib/packlets/import/importers/pathImporter.d.ts +1 -1
- package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -0
- package/lib/packlets/import/importers/pathImporter.js +1 -1
- package/lib/packlets/import/importers/pathImporter.js.map +1 -0
- package/lib/packlets/import/index.browser.d.ts.map +1 -0
- package/lib/packlets/import/index.browser.js.map +1 -0
- package/lib/packlets/import/index.d.ts.map +1 -0
- package/lib/packlets/import/index.js.map +1 -0
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
- package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/index.js.map +1 -0
- package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/json.js.map +1 -0
- package/lib/packlets/qualifier-types/convert.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/convert.js.map +1 -0
- package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/helpers.js.map +1 -0
- package/lib/packlets/qualifier-types/index.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/index.js.map +1 -0
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +6 -7
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/languageQualifierType.js +6 -7
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -0
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +7 -10
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/literalQualifierType.js +7 -10
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
- package/lib/packlets/qualifier-types/qualifierType.d.ts +17 -18
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/qualifierType.js +12 -13
- package/lib/packlets/qualifier-types/qualifierType.js.map +1 -0
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +8 -8
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/territoryQualifierType.js +5 -5
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -0
- package/lib/packlets/qualifiers/convert/decls.js.map +1 -0
- package/lib/packlets/qualifiers/convert/index.d.ts.map +1 -0
- package/lib/packlets/qualifiers/convert/index.js.map +1 -0
- package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +1 -0
- package/lib/packlets/qualifiers/convert/qualifier.js.map +1 -0
- package/lib/packlets/qualifiers/index.d.ts.map +1 -0
- package/lib/packlets/qualifiers/index.js.map +1 -0
- package/lib/packlets/qualifiers/qualifier.d.ts +6 -7
- package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifier.js +6 -7
- package/lib/packlets/qualifiers/qualifier.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierCollector.d.ts +107 -9
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierCollector.js +152 -8
- package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
- package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/common.js.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
- package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/index.js.map +1 -0
- package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/json.js.map +1 -0
- package/lib/packlets/resource-json/convert.d.ts +85 -0
- package/lib/packlets/resource-json/convert.d.ts.map +1 -0
- package/lib/packlets/resource-json/convert.js +237 -0
- package/lib/packlets/resource-json/convert.js.map +1 -0
- package/lib/packlets/resource-json/helpers.d.ts.map +1 -0
- package/lib/packlets/resource-json/helpers.js.map +1 -0
- package/lib/packlets/resource-json/index.d.ts.map +1 -0
- package/lib/packlets/resource-json/index.js.map +1 -0
- package/lib/packlets/resource-json/json.d.ts +128 -39
- package/lib/packlets/resource-json/json.d.ts.map +1 -0
- package/lib/packlets/resource-json/json.js +2 -2
- package/lib/packlets/resource-json/json.js.map +1 -0
- package/lib/packlets/resource-json/normalized.d.ts.map +1 -0
- package/lib/packlets/resource-json/normalized.js.map +1 -0
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -0
- package/lib/packlets/resource-json/resourceDeclCollection.js +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -0
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -0
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -0
- package/lib/packlets/resource-json/resourceDeclTree.d.ts +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -0
- package/lib/packlets/resource-json/resourceDeclTree.js +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -0
- package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/convert.js.map +1 -0
- package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/index.js.map +1 -0
- package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/json.js.map +1 -0
- package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
- package/lib/packlets/resource-types/helpers.js.map +1 -0
- package/lib/packlets/resource-types/index.d.ts.map +1 -0
- package/lib/packlets/resource-types/index.js.map +1 -0
- package/lib/packlets/resource-types/jsonResourceType.d.ts +17 -5
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -0
- package/lib/packlets/resource-types/jsonResourceType.js +2 -2
- package/lib/packlets/resource-types/jsonResourceType.js.map +1 -0
- package/lib/packlets/resource-types/resourceType.d.ts +5 -5
- package/lib/packlets/resource-types/resourceType.d.ts.map +1 -0
- package/lib/packlets/resource-types/resourceType.js +2 -2
- package/lib/packlets/resource-types/resourceType.js.map +1 -0
- package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +1 -0
- package/lib/packlets/resource-types/resourceTypeCollector.js.map +1 -0
- package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
- package/lib/packlets/resources/candidateReducer.js.map +1 -0
- package/lib/packlets/resources/candidateValue.d.ts.map +1 -0
- package/lib/packlets/resources/candidateValue.js.map +1 -0
- package/lib/packlets/resources/candidateValueCollector.d.ts.map +1 -0
- package/lib/packlets/resources/candidateValueCollector.js.map +1 -0
- package/lib/packlets/resources/common.d.ts.map +1 -0
- package/lib/packlets/resources/common.js.map +1 -0
- package/lib/packlets/resources/deltaGenerator.d.ts.map +1 -0
- package/lib/packlets/resources/deltaGenerator.js.map +1 -0
- package/lib/packlets/resources/index.d.ts.map +1 -0
- package/lib/packlets/resources/index.js.map +1 -0
- package/lib/packlets/resources/resource.d.ts.map +1 -0
- package/lib/packlets/resources/resource.js.map +1 -0
- package/lib/packlets/resources/resourceBuilder.d.ts +2 -2
- package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -0
- package/lib/packlets/resources/resourceBuilder.js +2 -2
- package/lib/packlets/resources/resourceBuilder.js.map +1 -0
- package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -0
- package/lib/packlets/resources/resourceCandidate.js.map +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +5 -5
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +5 -5
- package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
- package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheListener.js.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +5 -5
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.js +5 -5
- package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
- package/lib/packlets/runtime/context/index.d.ts.map +1 -0
- package/lib/packlets/runtime/context/index.js.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +9 -2
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +3 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +8 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +3 -5
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
- package/lib/packlets/runtime/iResourceManager.js.map +1 -0
- package/lib/packlets/runtime/index.d.ts.map +1 -0
- package/lib/packlets/runtime/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
- package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
- package/lib/packlets/runtime/resourceResolver.js.map +1 -0
- package/lib/packlets/runtime/resourceTreeResolver.d.ts.map +1 -0
- package/lib/packlets/runtime/resourceTreeResolver.js.map +1 -0
- package/lib/packlets/runtime/validate.d.ts.map +1 -0
- package/lib/packlets/runtime/validate.js.map +1 -0
- package/lib/packlets/zip-archive/convert.d.ts.map +1 -0
- package/lib/packlets/zip-archive/convert.js.map +1 -0
- package/lib/packlets/zip-archive/index.browser.d.ts.map +1 -0
- package/lib/packlets/zip-archive/index.browser.js.map +1 -0
- package/lib/packlets/zip-archive/index.d.ts.map +1 -0
- package/lib/packlets/zip-archive/index.js.map +1 -0
- package/lib/packlets/zip-archive/json.d.ts.map +1 -0
- package/lib/packlets/zip-archive/json.js.map +1 -0
- package/lib/packlets/zip-archive/types.d.ts.map +1 -0
- package/lib/packlets/zip-archive/types.js.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.d.ts.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.d.ts.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.d.ts.map +1 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
- package/package.json +12 -10
- package/dist/test/data/sample.json +0 -32
- package/dist/test/unit/qualifier-types/testQualifierType.js +0 -76
- package/dist/test/unit/resource-types/testDerivedResourceType.js +0 -109
- package/dist/test/unit/resources/deltaGenerator.helpers.js +0 -282
|
@@ -46,7 +46,7 @@ export interface ILiteralQualifierTypeCreateParams {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare class LiteralQualifierType extends QualifierType<JsonCompatibleType<Config.ILiteralQualifierTypeConfig>> {
|
|
48
48
|
/**
|
|
49
|
-
* {@
|
|
49
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
50
50
|
*/
|
|
51
51
|
readonly systemTypeName: QualifierTypeName;
|
|
52
52
|
/**
|
|
@@ -64,11 +64,8 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
64
64
|
readonly hierarchy?: LiteralValueHierarchy<string>;
|
|
65
65
|
/**
|
|
66
66
|
* Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
67
|
-
* @param
|
|
68
|
-
*
|
|
69
|
-
* case-sensitive. Defaults to `false`.
|
|
70
|
-
* @param allowContextList - Optional flag indicating whether the context can be a
|
|
71
|
-
* list of values. Defaults to `false`.
|
|
67
|
+
* @param params - The {@link QualifierTypes.ILiteralQualifierTypeCreateParams | create parameters}
|
|
68
|
+
* for this qualifier type.
|
|
72
69
|
* @public
|
|
73
70
|
*/
|
|
74
71
|
protected constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }: ILiteralQualifierTypeCreateParams);
|
|
@@ -81,7 +78,7 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
81
78
|
*/
|
|
82
79
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
83
80
|
/**
|
|
84
|
-
* {@
|
|
81
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
85
82
|
*/
|
|
86
83
|
isPotentialMatch(conditionValue: string, contextValue: string): boolean;
|
|
87
84
|
/**
|
|
@@ -91,11 +88,11 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
91
88
|
*/
|
|
92
89
|
getConfiguration(): Result<Config.ISystemLiteralQualifierTypeConfig>;
|
|
93
90
|
/**
|
|
94
|
-
* {@
|
|
91
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
95
92
|
*/
|
|
96
93
|
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
97
94
|
/**
|
|
98
|
-
* {@
|
|
95
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
99
96
|
*/
|
|
100
97
|
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
101
98
|
/**
|
|
@@ -106,7 +103,7 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
106
103
|
*/
|
|
107
104
|
validateConfiguration(from: unknown): Result<Config.ISystemLiteralQualifierTypeConfig>;
|
|
108
105
|
/**
|
|
109
|
-
* {@
|
|
106
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
110
107
|
*/
|
|
111
108
|
protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, __operator: ConditionOperator): QualifierMatchScore;
|
|
112
109
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literalQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA6B,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,iBAAiB,EAIjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,iB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;OAIG;IACI,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAAC,iCAAiC,CAAC;IAM3E;;OAEG;IACI,oBAAoB,IAAI,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;IAiBnG;;OAEG;IACI,yBAAyB,CAC9B,IAAI,EAAE,OAAO,GACZ,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;IAIvE;;;;;OAKG;IACI,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,iCAAiC,CAAC;IAI7F;;OAEG;IACH,SAAS,CAAC,SAAS,CACjB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,iBAAiB,GAC5B,mBAAmB;IAWtB;;;;;;;OAOG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,iCAAiC,GAAG,MAAM,CAAC,oBAAoB,CAAC;IAI9F;;;;;;;;OAQG;WACW,gBAAgB,CAC5B,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,2BAA2B,CAAC,GACtE,MAAM,CAAC,oBAAoB,CAAC;IAW/B;;;;;OAKG;WACW,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,uBAAuB;IAIzF;;;;;;OAMG;WACW,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAAC;CAKrF"}
|
|
@@ -69,11 +69,8 @@ const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
|
69
69
|
class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
70
70
|
/**
|
|
71
71
|
* Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
72
|
-
* @param
|
|
73
|
-
*
|
|
74
|
-
* case-sensitive. Defaults to `false`.
|
|
75
|
-
* @param allowContextList - Optional flag indicating whether the context can be a
|
|
76
|
-
* list of values. Defaults to `false`.
|
|
72
|
+
* @param params - The {@link QualifierTypes.ILiteralQualifierTypeCreateParams | create parameters}
|
|
73
|
+
* for this qualifier type.
|
|
77
74
|
* @public
|
|
78
75
|
*/
|
|
79
76
|
constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }) {
|
|
@@ -84,7 +81,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
84
81
|
index: index !== undefined ? common_1.Convert.qualifierTypeIndex.convert(index).orThrow() : undefined
|
|
85
82
|
});
|
|
86
83
|
/**
|
|
87
|
-
* {@
|
|
84
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
88
85
|
*/
|
|
89
86
|
this.systemTypeName = common_1.Convert.qualifierTypeName.convert('literal').orThrow();
|
|
90
87
|
this.caseSensitive = caseSensitive === true;
|
|
@@ -116,7 +113,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
116
113
|
return LiteralQualifierType.isValidLiteralConditionValue(value);
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
119
|
-
* {@
|
|
116
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
120
117
|
*/
|
|
121
118
|
isPotentialMatch(conditionValue, contextValue) {
|
|
122
119
|
if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {
|
|
@@ -138,7 +135,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
138
135
|
return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemLiteralQualifierTypeConfig.convert(json));
|
|
139
136
|
}
|
|
140
137
|
/**
|
|
141
|
-
* {@
|
|
138
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
142
139
|
*/
|
|
143
140
|
getConfigurationJson() {
|
|
144
141
|
const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
|
|
@@ -152,7 +149,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
152
149
|
});
|
|
153
150
|
}
|
|
154
151
|
/**
|
|
155
|
-
* {@
|
|
152
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
156
153
|
*/
|
|
157
154
|
validateConfigurationJson(from) {
|
|
158
155
|
return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
|
|
@@ -167,7 +164,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
167
164
|
return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
|
|
168
165
|
}
|
|
169
166
|
/**
|
|
170
|
-
* {@
|
|
167
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
171
168
|
*/
|
|
172
169
|
_matchOne(condition, context, __operator) {
|
|
173
170
|
if (this.hierarchy) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literalQualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAiF;AACjF,sCAUmB;AACnB,mDAAgD;AAChD,mEAAgE;AAChE,iDAAmC;AACnC,oDAAuF;AA2CvF;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,6BAEzC;IAsBC;;;;;OAKG;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,CA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SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC5C,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,oCAAoC,CAAC,CAAC;IACxD,CAAC;CACF;AArND,oDAqNC","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 QualifierTypeName,\n Validate\n} from '../common';\nimport { QualifierType } from './qualifierType';\nimport { LiteralValueHierarchy } from './literalValueHierarchy';\nimport * as Config from './config';\nimport { JsonCompatibleType, JsonObject, 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.Config.LiteralValueHierarchyDecl | hierarchy declaration}\n * of literal values to use for matching. If not provided, no hierarchy will be used.\n */\n hierarchy?: Config.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 JsonCompatibleType<Config.ILiteralQualifierTypeConfig>\n> {\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}\n */\n public readonly systemTypeName: QualifierTypeName = Convert.qualifierTypeName.convert('literal').orThrow();\n\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 params - The {@link QualifierTypes.ILiteralQualifierTypeCreateParams | create parameters}\n * for this qualifier type.\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.IQualifierType.isPotentialMatch}\n */\n public isPotentialMatch(conditionValue: string, contextValue: string): boolean {\n if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {\n if (this._matchOne(conditionValue, contextValue, 'matches') !== NoMatch) {\n return true;\n }\n if (this.hierarchy) {\n return this.hierarchy.isAncestor(conditionValue, contextValue);\n }\n }\n return false;\n }\n\n /**\n * Gets a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}\n * for this qualifier type.\n * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.\n */\n public getConfiguration(): Result<Config.ISystemLiteralQualifierTypeConfig> {\n return this.getConfigurationJson().onSuccess((json) =>\n Config.Convert.systemLiteralQualifierTypeConfig.convert(json)\n );\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}\n */\n public getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>> {\n const hierarchy: JsonObject = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};\n const enumeratedValues: JsonObject = this.enumeratedValues\n ? { enumeratedValues: [...this.enumeratedValues] }\n : {};\n return succeed({\n name: this.name,\n systemType: 'literal' as const,\n configuration: {\n allowContextList: this.allowContextList,\n caseSensitive: this.caseSensitive,\n ...enumeratedValues,\n ...hierarchy\n }\n });\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}\n */\n public validateConfigurationJson(\n from: unknown\n ): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>> {\n return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);\n }\n\n /**\n * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}\n * for this qualifier type.\n * @param from - The unknown data to validate as a configuration object.\n * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.\n */\n public validateConfiguration(from: unknown): Result<Config.ISystemLiteralQualifierTypeConfig> {\n return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);\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}: invalid literal condition value.`);\n }\n}\n"]}
|
|
@@ -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;AACnB,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD;;;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;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC3E,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC;CACnD;AAaD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC1D;;;OAGG;IACH,SAAgB,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD;;;OAGG;IACH,SAAgB,YAAY,EAAE,OAAO,CAAC;IAEtC,SAAS,aAAa,MAAM,EAAE,kCAAkC,CAAC,CAAC,CAAC;IAMnE;;;;;OAKG;WACW,MAAM,CAAC,CAAC,SAAS,MAAM,EACnC,MAAM,EAAE,kCAAkC,CAAC,CA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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AA9PD,sDA8PC","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';\nimport { LiteralValueHierarchyDecl } from './config';\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?: Partial<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 3 - 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 * Determines if a value is an ancestor of a possible ancestor value.\n * @param value - The value to check.\n * @param possibleAncestor - The possible ancestor value.\n * @returns `true` if the value is an ancestor of the possible ancestor, `false` otherwise.\n */\n public isAncestor(value: T, possibleAncestor: T): boolean {\n const ancestors = this.getAncestors(value);\n if (ancestors.isSuccess()) {\n return ancestors.value.includes(possibleAncestor);\n }\n /* c8 ignore next 2 - edge case: ancestor validation fallback */\n return false;\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 3 - functional error case tested but coverage intermittently missed */\n if (!this.values.has(condition as T)) {\n return NoMatch;\n }\n /* c8 ignore next 3 - 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 /* c8 ignore next 1 - defense in depth */\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 invalid 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 4 - 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 3 - 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 /**\n * Converts the hierarchy to a record of parent-child relationships.\n * @returns A record of parent-child relationships.\n */\n public asRecord(): Record<string, string> {\n const entries = Array.from(this.values.values())\n .filter((v) => v.parent !== undefined)\n .map((v) => [v.name, v.parent!.name]);\n return Object.fromEntries(entries);\n }\n}\n"]}
|
|
@@ -117,19 +117,19 @@ export interface IQualifierTypeCreateParams {
|
|
|
117
117
|
*/
|
|
118
118
|
export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject> implements IQualifierType<TCFGJSON> {
|
|
119
119
|
/**
|
|
120
|
-
* {@
|
|
120
|
+
* {@inheritDoc QualifierTypes.IQualifierType.name}
|
|
121
121
|
*/
|
|
122
122
|
readonly name: QualifierTypeName;
|
|
123
123
|
/**
|
|
124
|
-
* {@
|
|
124
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
125
125
|
*/
|
|
126
126
|
abstract readonly systemTypeName: QualifierTypeName;
|
|
127
127
|
/**
|
|
128
|
-
* {@
|
|
128
|
+
* {@inheritDoc QualifierTypes.IQualifierType.key}
|
|
129
129
|
*/
|
|
130
130
|
get key(): QualifierTypeName;
|
|
131
131
|
/**
|
|
132
|
-
* {@
|
|
132
|
+
* {@inheritDoc QualifierTypes.IQualifierType.index}
|
|
133
133
|
*/
|
|
134
134
|
get index(): QualifierTypeIndex | undefined;
|
|
135
135
|
protected readonly _collectible: Collections.Collectible<QualifierTypeName, QualifierTypeIndex>;
|
|
@@ -140,53 +140,52 @@ export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonOb
|
|
|
140
140
|
readonly allowContextList: boolean;
|
|
141
141
|
/**
|
|
142
142
|
* Constructor for use by derived classes.
|
|
143
|
-
* @param
|
|
144
|
-
*
|
|
145
|
-
* comma-separated list of runtime values in the context. Defaults to `false`.
|
|
143
|
+
* @param params - The {@link QualifierTypes.IQualifierTypeCreateParams | create parameters}
|
|
144
|
+
* for this qualifier type.
|
|
146
145
|
*/
|
|
147
146
|
protected constructor({ name, index, allowContextList }: IQualifierTypeCreateParams);
|
|
148
147
|
/**
|
|
149
|
-
* {@
|
|
148
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidConditionValue}
|
|
150
149
|
*/
|
|
151
150
|
abstract isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
152
151
|
/**
|
|
153
|
-
* {@
|
|
152
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidContextValue}
|
|
154
153
|
*/
|
|
155
154
|
isValidContextValue(value: string): value is QualifierContextValue;
|
|
156
155
|
/**
|
|
157
|
-
* {@
|
|
156
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
158
157
|
*/
|
|
159
158
|
isPotentialMatch(conditionValue: string, contextValue: string): boolean;
|
|
160
159
|
/**
|
|
161
|
-
* {@
|
|
160
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateCondition}
|
|
162
161
|
*/
|
|
163
162
|
validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
|
|
164
163
|
/**
|
|
165
|
-
* {@
|
|
164
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateContextValue}
|
|
166
165
|
*/
|
|
167
166
|
validateContextValue(value: string): Result<QualifierContextValue>;
|
|
168
167
|
/**
|
|
169
|
-
* {@
|
|
168
|
+
* {@inheritDoc QualifierTypes.IQualifierType.matches}
|
|
170
169
|
*/
|
|
171
170
|
matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
|
|
172
171
|
/**
|
|
173
|
-
* {@
|
|
172
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
174
173
|
*/
|
|
175
174
|
abstract getConfigurationJson(): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;
|
|
176
175
|
/**
|
|
177
|
-
* {@
|
|
176
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
178
177
|
*/
|
|
179
178
|
abstract validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;
|
|
180
179
|
/**
|
|
181
|
-
* {@
|
|
180
|
+
* {@inheritDoc QualifierTypes.IQualifierType.setIndex}
|
|
182
181
|
*/
|
|
183
182
|
setIndex(index: number): Result<QualifierTypeIndex>;
|
|
184
183
|
/**
|
|
185
|
-
* {@
|
|
184
|
+
* {@inheritDoc Validate.isValidQualifierTypeName}
|
|
186
185
|
*/
|
|
187
186
|
static isValidName(name: string): name is QualifierTypeName;
|
|
188
187
|
/**
|
|
189
|
-
* {@
|
|
188
|
+
* {@inheritDoc Validate.isValidQualifierTypeIndex}
|
|
190
189
|
*/
|
|
191
190
|
static isValidIndex(index: number): index is QualifierTypeIndex;
|
|
192
191
|
/**
|
|
@@ -0,0 +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;AACnB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU,CACtE,SAAQ,YAAY,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAE/C;;;;;;OAMG;IACH,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB,CAAC;IAEvE;;;;;;OAMG;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AC;IAEpE;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAI1D;;OAEG;WACW,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,iBAAiB;IAIlE;;OAEG;WACW,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB;IAItE;;;;;OAKG;WACW,OAAO,CAAC,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,aAAa,GAAG,MAAM;IAYnE;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC1B,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB;IAEtB;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,CAClB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAAE,EAChC,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB;IAiBtB;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,qBAAqB,EAAE;CAGtF"}
|
|
@@ -31,22 +31,21 @@ const common_1 = require("../common");
|
|
|
31
31
|
*/
|
|
32
32
|
class QualifierType {
|
|
33
33
|
/**
|
|
34
|
-
* {@
|
|
34
|
+
* {@inheritDoc QualifierTypes.IQualifierType.key}
|
|
35
35
|
*/
|
|
36
36
|
get key() {
|
|
37
37
|
return this._collectible.key;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* {@
|
|
40
|
+
* {@inheritDoc QualifierTypes.IQualifierType.index}
|
|
41
41
|
*/
|
|
42
42
|
get index() {
|
|
43
43
|
return this._collectible.index;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Constructor for use by derived classes.
|
|
47
|
-
* @param
|
|
48
|
-
*
|
|
49
|
-
* comma-separated list of runtime values in the context. Defaults to `false`.
|
|
47
|
+
* @param params - The {@link QualifierTypes.IQualifierTypeCreateParams | create parameters}
|
|
48
|
+
* for this qualifier type.
|
|
50
49
|
*/
|
|
51
50
|
constructor({ name, index, allowContextList }) {
|
|
52
51
|
this.name = common_1.Convert.qualifierTypeName.convert(name).orThrow();
|
|
@@ -58,7 +57,7 @@ class QualifierType {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
/**
|
|
61
|
-
* {@
|
|
60
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidContextValue}
|
|
62
61
|
*/
|
|
63
62
|
isValidContextValue(value) {
|
|
64
63
|
if (this.isValidConditionValue(value)) {
|
|
@@ -72,7 +71,7 @@ class QualifierType {
|
|
|
72
71
|
return false;
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
|
-
* {@
|
|
74
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
76
75
|
*/
|
|
77
76
|
isPotentialMatch(conditionValue, contextValue) {
|
|
78
77
|
if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {
|
|
@@ -82,7 +81,7 @@ class QualifierType {
|
|
|
82
81
|
return false;
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* {@
|
|
84
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateCondition}
|
|
86
85
|
*/
|
|
87
86
|
validateCondition(value, operator) {
|
|
88
87
|
operator = operator !== null && operator !== void 0 ? operator : 'matches';
|
|
@@ -97,7 +96,7 @@ class QualifierType {
|
|
|
97
96
|
return (0, ts_utils_1.succeed)(value);
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
|
-
* {@
|
|
99
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateContextValue}
|
|
101
100
|
*/
|
|
102
101
|
validateContextValue(value) {
|
|
103
102
|
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
@@ -107,7 +106,7 @@ class QualifierType {
|
|
|
107
106
|
return (0, ts_utils_1.succeed)(value);
|
|
108
107
|
}
|
|
109
108
|
/**
|
|
110
|
-
* {@
|
|
109
|
+
* {@inheritDoc QualifierTypes.IQualifierType.matches}
|
|
111
110
|
*/
|
|
112
111
|
matches(condition, context, operator) {
|
|
113
112
|
if (this.allowContextList) {
|
|
@@ -116,19 +115,19 @@ class QualifierType {
|
|
|
116
115
|
return this._matchOne(condition, context, operator);
|
|
117
116
|
}
|
|
118
117
|
/**
|
|
119
|
-
* {@
|
|
118
|
+
* {@inheritDoc QualifierTypes.IQualifierType.setIndex}
|
|
120
119
|
*/
|
|
121
120
|
setIndex(index) {
|
|
122
121
|
return this._collectible.setIndex(index);
|
|
123
122
|
}
|
|
124
123
|
/**
|
|
125
|
-
* {@
|
|
124
|
+
* {@inheritDoc Validate.isValidQualifierTypeName}
|
|
126
125
|
*/
|
|
127
126
|
static isValidName(name) {
|
|
128
127
|
return common_1.Validate.isValidQualifierTypeName(name);
|
|
129
128
|
}
|
|
130
129
|
/**
|
|
131
|
-
* {@
|
|
130
|
+
* {@inheritDoc Validate.isValidQualifierTypeIndex}
|
|
132
131
|
*/
|
|
133
132
|
static isValidIndex(index) {
|
|
134
133
|
return common_1.Validate.isValidQualifierTypeIndex(index);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/qualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAiF;AACjF,sCAWmB;AAqInB;;;;GAIG;AACH,MAAsB,aAAa;IAajC;;OAEG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACjC,CAAC;IAUD;;;;OAIG;IACH,YAAsB,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAA8B;QAC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C;IACjB,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,aAAa,CAAC,KAA4B;QACzD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAA2B,CAAC,CAAC;IACxE,CAAC;CACF;AAnOD,sCAmOC","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 { Collections, ICollectible, Result, fail, succeed } from '@fgv/ts-utils';\nimport {\n ConditionOperator,\n Convert,\n NoMatch,\n PerfectMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n QualifierTypeIndex,\n QualifierTypeName,\n Validate\n} from '../common';\nimport { JsonCompatibleType, JsonObject } from '@fgv/ts-json-base';\nimport * as Config from './config';\n\n/**\n * Interface for a qualifier type. A qualifier type implements the build and\n * runtime semantics for some class of related qualifiers (e.g. language,\n * territories, etc).\n * @public\n */\nexport interface IQualifierType<TCFGJSON extends JsonObject = JsonObject>\n extends ICollectible<QualifierTypeName, QualifierTypeIndex> {\n /**\n * The name of the qualifier type.\n */\n readonly name: QualifierTypeName;\n\n /**\n * Name of the underlying system type.\n */\n readonly systemTypeName: QualifierTypeName;\n\n /**\n * Unique key for this qualifier.\n */\n readonly key: QualifierTypeName;\n\n /**\n * Global index for this qualifier type. Immutable once set, either at\n * construction or using {@link QualifierTypes.IQualifierType.setIndex | setIndex}.\n */\n readonly index: QualifierTypeIndex | undefined;\n\n /**\n * Validates a condition value for this qualifier type.\n * @param value - The string value to validate.\n * @returns `Success` with the {@link QualifierConditionValue | validated value}\n * if the value is valid for use in a condition, `Failure` with error details\n * otherwise.\n */\n isValidConditionValue(value: string): value is QualifierConditionValue;\n\n /**\n * Validates a context value for this qualifier type.\n * @param value - The string value to validate.\n * @returns `Success` with the {@link QualifierContextValue | validated value}\n * if the value is valid for use in a runtime context, `Failure` with error\n * details otherwise.\n */\n isValidContextValue(value: string): value is QualifierContextValue;\n\n /**\n * Determines if a supplied condition value is a potential match for a possible context value.\n * @param conditionValue - The condition value.\n * @param contextValue - The context value.\n * @returns `true` if the condition value is a potential match for the context value, `false` otherwise.\n */\n isPotentialMatch(conditionValue: string, contextValue: string): boolean;\n\n /**\n * Validates that a value and optional operator are valid for use in a condition\n * for qualifiers of this type.\n * @param value - The string value to validate.\n * @param operator - An optional operator to validate. Defaults to 'matches'.\n */\n validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;\n\n /**\n * Validates that a value is valid for use in a runtime context for qualifiers\n * of this type.\n * @param value - The string value to validate.\n * @returns `Success` with the {@link QualifierContextValue | validated value}\n * if the value is valid for use in a runtime context, `Failure` with error\n * details otherwise.\n */\n validateContextValue(value: string): Result<QualifierContextValue>;\n\n /**\n * Determines the extent to which a condition matches a context value for this\n * qualifier type.\n * @param condition - The condition value to evaluate.\n * @param context - The context value to evaluate.\n * @param operator - The operator to use in evaluating the match.\n * @returns a {@link QualifierMatchScore | score} indicating the extent to which\n * the condition matches the context value.\n */\n matches(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore;\n\n /**\n * Sets the index for this qualifier type. Once set, index is immutable.\n */\n setIndex(index: number): Result<QualifierTypeIndex>;\n\n /**\n * Gets the configuration for this qualifier type.\n * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.\n */\n getConfigurationJson(): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;\n\n /**\n * Validates configuration JSON data for this qualifier type.\n * @param from - The unknown data to validate as configuration JSON.\n * @returns `Success` with validated JSON configuration if valid, `Failure` with an error message otherwise.\n */\n validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;\n}\n\n/**\n * Parameters used to create a base {@link QualifierTypes.QualifierType | qualifier type}.\n * @public\n */\nexport interface IQualifierTypeCreateParams {\n /**\n * The name of the qualifier type. No default value.\n */\n name: string;\n\n /**\n * Global index for this qualifier type.\n */\n index?: number;\n\n /**\n * Flag indicating whether this qualifier type allows a list of values in a context.\n * Defaults to `false`.\n */\n allowContextList?: boolean;\n}\n\n/**\n * Abstract base class for qualifier types. Provides default implementations for\n * the {@link QualifierTypes.IQualifierType | IQualifierType} interface.\n * @public\n */\nexport abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject>\n implements IQualifierType<TCFGJSON>\n{\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.name}\n */\n public readonly name: QualifierTypeName;\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}\n */\n public abstract readonly systemTypeName: QualifierTypeName;\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.key}\n */\n public get key(): QualifierTypeName {\n return this._collectible.key;\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.index}\n */\n public get index(): QualifierTypeIndex | undefined {\n return this._collectible.index;\n }\n\n protected readonly _collectible: Collections.Collectible<QualifierTypeName, QualifierTypeIndex>;\n\n /**\n * Flag indicating whether this qualifier type allows a list of values in a context.\n * @public\n */\n public readonly allowContextList: boolean;\n\n /**\n * Constructor for use by derived classes.\n * @param params - The {@link QualifierTypes.IQualifierTypeCreateParams | create parameters}\n * for this qualifier type.\n */\n protected constructor({ name, index, allowContextList }: IQualifierTypeCreateParams) {\n this.name = Convert.qualifierTypeName.convert(name).orThrow();\n this.allowContextList = allowContextList === true;\n this._collectible = new Collections.Collectible<QualifierTypeName, QualifierTypeIndex>({\n key: this.name,\n index: index,\n indexConverter: Convert.qualifierTypeIndex\n });\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.isValidConditionValue}\n */\n public abstract isValidConditionValue(value: string): value is QualifierConditionValue;\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.isValidContextValue}\n */\n public isValidContextValue(value: string): value is QualifierContextValue {\n if (this.isValidConditionValue(value)) {\n return true;\n }\n if (this.allowContextList) {\n /* c8 ignore next 1 - functional code tested but coverage intermittently missed */\n return value.split(',').every((v) => this.isValidConditionValue(v.trim()));\n }\n /* c8 ignore next 1 - functional code tested but coverage intermittently missed */\n return false;\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}\n */\n public isPotentialMatch(conditionValue: string, contextValue: string): boolean {\n if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {\n return this._matchOne(conditionValue, contextValue, 'matches') !== NoMatch;\n }\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n return false;\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.validateCondition}\n */\n public validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue> {\n operator = operator ?? 'matches';\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (operator !== 'matches') {\n return fail(`${operator}: invalid condition operator`);\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n } else if (!this.isValidConditionValue(value)) {\n return fail(`${value}: invalid condition value for qualifierType ${this.name}`);\n }\n return succeed(value);\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.validateContextValue}\n */\n public validateContextValue(value: string): Result<QualifierContextValue> {\n /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */\n if (!this.isValidContextValue(value)) {\n return fail(`${value}: invalid context value for qualifierType ${this.name}`);\n }\n return succeed(value);\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.matches}\n */\n public matches(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore {\n if (this.allowContextList) {\n return this._matchList(condition, QualifierType._splitContext(context), operator);\n }\n return this._matchOne(condition, context, operator);\n }\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}\n */\n public abstract getConfigurationJson(): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}\n */\n public abstract validateConfigurationJson(\n from: unknown\n ): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;\n\n /**\n * {@inheritDoc QualifierTypes.IQualifierType.setIndex}\n */\n public setIndex(index: number): Result<QualifierTypeIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * {@inheritDoc Validate.isValidQualifierTypeName}\n */\n public static isValidName(name: string): name is QualifierTypeName {\n return Validate.isValidQualifierTypeName(name);\n }\n\n /**\n * {@inheritDoc Validate.isValidQualifierTypeIndex}\n */\n public static isValidIndex(index: number): index is QualifierTypeIndex {\n return Validate.isValidQualifierTypeIndex(index);\n }\n\n /**\n * Compares two qualifier types by index.\n * @param t1 - The first qualifier type to compare.\n * @param t2 - The second qualifier type to compare.\n * @returns a number indicating the relative order of the two qualifier types.\n */\n public static compare(t1: QualifierType, t2: QualifierType): number {\n const i1 = t1._collectible.index ?? -1;\n const i2 = t2._collectible.index ?? -1;\n let diff = i1 - i2;\n\n if (diff === 0) {\n diff = t1.name.localeCompare(t2.name);\n }\n\n return diff;\n }\n\n /**\n * Matches a single condition value against a single context value.\n * @param condition - The {@link QualifierConditionValue | condition value} to match.\n * @param context - The {@link QualifierContextValue | context value} to match.\n * @param operator - The {@link ConditionOperator | operator} to use in the match.\n * @returns a {@link QualifierMatchScore | score} indicating the extent to which\n * the condition matches the context value.\n * @public\n */\n protected abstract _matchOne(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore;\n\n /**\n * Matches a single condition value against a list of context values.\n * @param condition - The {@link QualifierConditionValue | condition value} to match.\n * @param context - The comma-separated list of {@link QualifierContextValue | context values} to match.\n * @param operator - The {@link ConditionOperator | operator} to use in the match.\n * @returns a {@link QualifierMatchScore | score} indicating the extent to which\n * the condition matches the context value.\n * @public\n */\n protected _matchList(\n condition: QualifierConditionValue,\n context: QualifierContextValue[],\n operator: ConditionOperator\n ): QualifierMatchScore {\n const scorePerPosition = 1 / context.length;\n let baseScore = PerfectMatch - scorePerPosition;\n\n for (let i = 0; i < context.length; i++) {\n const score = this._matchOne(condition, context[i], operator);\n if (score > NoMatch) {\n const adjusted = baseScore + scorePerPosition * score;\n if (Validate.isValidQualifierMatchScore(adjusted)) {\n return adjusted;\n }\n }\n baseScore -= scorePerPosition;\n }\n return NoMatch;\n }\n\n /**\n * Splits a comma-separated {@link QualifierContextValue | context value} into an\n * array of individual values.\n * @param value - The value to split.\n * @returns an array of individual context values.\n * @public\n */\n protected static _splitContext(value: QualifierContextValue): QualifierContextValue[] {\n return value.split(',').map((s) => s.trim() as QualifierContextValue);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qualifierTypeCollector.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/qualifierTypeCollector.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,WAAW,EACX,MAAM,EACN,6BAA6B,EAI9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,6BAA6B,CAAC,aAAa,EAAE,aAAa,CAAC;IACrG;;;;OAIG;IACH,SAAS,aAAa,EAAE,cAAc,EAAE,EAAE,mCAAmC;IAe7E;;;;;OAKG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,mCAAmC,GAAG,MAAM,CAAC,sBAAsB,CAAC;IAMlG,SAAS,CAAC,MAAM,CAAC,qBAAqB,CACpC,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GACnB,MAAM,CAAC,aAAa,CAAC;IAIxB,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC;CAGxE;AAED;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG,WAAW,CAAC,4BAA4B,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qualifierTypeCollector.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/qualifierTypeCollector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;AACpC,4CAOuB;AACvB,mDAAgD;AAehD;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,wCAA2D;IACrG;;;;OAIG;IACH,YAAsB,EAAE,cAAc,EAAuC;QAC3E,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,sBAAW,CAAC,kBAAkB,CAAC;gBAC7C,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB;gBACrC,KAAK,EAAE,sBAAsB,CAAC,gBAAgB;aAC/C,CAAC;YACF,OAAO,EAAE,sBAAsB,CAAC,qBAAqB;SACtD,CAAC,CAAC;QAEH,yEAAyE;QACzE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAC7B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,MAA4C;QAC/D,yEAAyE;QACzE,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;QACtB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC;IAES,MAAM,CAAC,qBAAqB,CACpC,GAAsB,EACtB,KAAa,EACb,KAAoB;QAEpB,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAES,MAAM,CAAC,gBAAgB,CAAC,IAAa;QAC7C,OAAO,IAAI,YAAY,6BAAa,CAAC,CAAC,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,eAAI,EAAC,qBAAqB,CAAC,CAAC;IACrF,CAAC;CACF;AA5CD,wDA4CC","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 {\n Collections,\n Result,\n ValidatingConvertingCollector,\n captureResult,\n fail,\n succeed\n} from '@fgv/ts-utils';\nimport { QualifierType } from './qualifierType';\nimport { QualifierTypeName } from '../common';\n\n/**\n * Parameters for creating a new {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector}.\n * @public\n */\nexport interface IQualifierTypeCollectorCreateParams {\n /**\n * Optional list of {@link QualifierTypes.QualifierType | QualifierTypes} to add to the collector\n * on creation.\n */\n qualifierTypes?: QualifierType[];\n}\n\n/**\n * Collector for {@link QualifierTypes.QualifierType | QualifierType} objects.\n * @public\n */\nexport class QualifierTypeCollector extends ValidatingConvertingCollector<QualifierType, QualifierType> {\n /**\n * Constructor for a {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector} object.\n * @param params - Optional {@link QualifierTypes.IQualifierTypeCollectorCreateParams | parameters}\n * used to construct the collector.\n */\n protected constructor({ qualifierTypes }: IQualifierTypeCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters({\n key: Common.Convert.qualifierTypeName,\n value: QualifierTypeCollector._toQualifierType\n }),\n factory: QualifierTypeCollector._qualifierTypeFactory\n });\n\n /* c8 ignore next 1 - coverage seems to intermittently miss the branch */\n qualifierTypes?.forEach((qt) => {\n this.add(qt).orThrow();\n });\n }\n\n /**\n * Creates a new {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector} object.\n * @param params - Optional {@link QualifierTypes.IQualifierTypeCollectorCreateParams | parameters}\n * used to create the collector.\n * @returns `Success` with the new collector if successful, or `Failure` if not.\n */\n public static create(params?: IQualifierTypeCollectorCreateParams): Result<QualifierTypeCollector> {\n /* c8 ignore next 1 - coverage seems to miss the branch intermittently */\n params = params ?? {};\n return captureResult(() => new QualifierTypeCollector(params));\n }\n\n protected static _qualifierTypeFactory(\n key: QualifierTypeName,\n index: number,\n value: QualifierType\n ): Result<QualifierType> {\n return succeed(value);\n }\n\n protected static _toQualifierType(from: unknown): Result<QualifierType> {\n return from instanceof QualifierType ? succeed(from) : fail('not a QualifierType');\n }\n}\n\n/**\n * Interface exposing non-mutating members of a\n * {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector}.\n * @public\n */\nexport type ReadOnlyQualifierTypeCollector = Collections.IReadOnlyValidatingCollector<QualifierType>;\n"]}
|
|
@@ -10,15 +10,15 @@ import { JsonCompatibleType } from '@fgv/ts-json-base';
|
|
|
10
10
|
*/
|
|
11
11
|
export interface ITerritoryQualifierTypeCreateParams {
|
|
12
12
|
/**
|
|
13
|
-
* {@
|
|
13
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.name}
|
|
14
14
|
*/
|
|
15
15
|
name?: string;
|
|
16
16
|
/**
|
|
17
|
-
* {@
|
|
17
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.allowContextList}
|
|
18
18
|
*/
|
|
19
19
|
allowContextList?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* {@
|
|
21
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.index}
|
|
22
22
|
*/
|
|
23
23
|
index?: number;
|
|
24
24
|
/**
|
|
@@ -44,7 +44,7 @@ export interface ITerritoryQualifierTypeCreateParams {
|
|
|
44
44
|
*/
|
|
45
45
|
export declare class TerritoryQualifierType extends QualifierType<JsonCompatibleType<Config.ITerritoryQualifierTypeConfig>> {
|
|
46
46
|
/**
|
|
47
|
-
* {@
|
|
47
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
48
48
|
*/
|
|
49
49
|
readonly systemTypeName: QualifierTypeName;
|
|
50
50
|
/**
|
|
@@ -67,7 +67,7 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
67
67
|
*/
|
|
68
68
|
protected constructor({ acceptLowercase, allowedTerritories, allowContextList, name, index, hierarchy }: ITerritoryQualifierTypeCreateParams);
|
|
69
69
|
/**
|
|
70
|
-
* {@
|
|
70
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
71
71
|
*/
|
|
72
72
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
73
73
|
/**
|
|
@@ -95,11 +95,11 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
95
95
|
*/
|
|
96
96
|
getConfiguration(): Result<Config.ISystemTerritoryQualifierTypeConfig>;
|
|
97
97
|
/**
|
|
98
|
-
* {@
|
|
98
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
99
99
|
*/
|
|
100
100
|
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemTerritoryQualifierTypeConfig>>;
|
|
101
101
|
/**
|
|
102
|
-
* {@
|
|
102
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
103
103
|
*/
|
|
104
104
|
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemTerritoryQualifierTypeConfig>>;
|
|
105
105
|
/**
|
|
@@ -110,7 +110,7 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
110
110
|
*/
|
|
111
111
|
validateConfiguration(from: unknown): Result<Config.ISystemTerritoryQualifierTypeConfig>;
|
|
112
112
|
/**
|
|
113
|
-
* {@
|
|
113
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
114
114
|
*/
|
|
115
115
|
protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, __operator?: ConditionOperator): QualifierMatchScore;
|
|
116
116
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"territoryQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/territoryQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,MAAM,EAA6B,MAAM,eAAe,CAAC;AACjF,OAAO,EAIL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAkC,MAAM,mBAAmB,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,mCAAmC;IAClD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;CACtD;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,aAAa,CACvD,kBAAkB,CAAC,MAAM,CAAC,6BAA6B,CAAC,CACzD;IACC;;OAEG;IACH,SAAgB,cAAc,EAAE,iBAAiB,CAEpC;IAEb;;OAEG;IACH,SAAgB,kBAAkB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAE5E;;;OAGG;IACH,SAAgB,eAAe,EAAE,OAAO,CAAC;IAEzC;;;OAGG;IACH,SAAgB,SAAS,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC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 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
86
86
|
index: validIndex
|
|
87
87
|
});
|
|
88
88
|
/**
|
|
89
|
-
* {@
|
|
89
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
90
90
|
*/
|
|
91
91
|
this.systemTypeName = common_1.Convert.qualifierTypeName
|
|
92
92
|
.convert('territory')
|
|
@@ -102,7 +102,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* {@
|
|
105
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
106
106
|
*/
|
|
107
107
|
isValidConditionValue(value) {
|
|
108
108
|
const normalized = this.acceptLowercase ? value.toUpperCase() : value;
|
|
@@ -156,7 +156,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
156
156
|
return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* {@
|
|
159
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
160
160
|
*/
|
|
161
161
|
getConfigurationJson() {
|
|
162
162
|
const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
|
|
@@ -170,7 +170,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* {@
|
|
173
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
174
174
|
*/
|
|
175
175
|
validateConfigurationJson(from) {
|
|
176
176
|
return Config.Convert.systemTerritoryQualifierTypeConfig.convert(from);
|
|
@@ -185,7 +185,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
185
185
|
return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* {@
|
|
188
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
189
189
|
*/
|
|
190
190
|
_matchOne(condition, context, __operator) {
|
|
191
191
|
if (this.isValidConditionValue(condition) && this.isValidContextValue(context)) {
|