@fgv/ts-res 5.0.0-9 → 5.0.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +21 -0
- package/CHANGELOG.md +14 -1
- package/README.md +794 -137
- package/dist/ts-res.d.ts +2257 -268
- package/dist/tsdoc-metadata.json +1 -1
- package/eslint.config.js +16 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/packlets/bundle/bundleBuilder.js +7 -4
- package/lib/packlets/bundle/bundleLoader.js +1 -0
- package/lib/packlets/bundle/bundleUtils.js +14 -16
- package/lib/packlets/bundle/index.d.ts +3 -1
- package/lib/packlets/bundle/index.js +14 -3
- package/lib/packlets/common/convert.d.ts +15 -0
- package/lib/packlets/common/convert.js +16 -1
- package/lib/packlets/common/helpers/context.js +1 -0
- package/lib/packlets/common/helpers/resources.d.ts +7 -0
- package/lib/packlets/common/helpers/resources.js +13 -0
- package/lib/packlets/common/resources.d.ts +44 -1
- package/lib/packlets/common/validate/conditions.d.ts +17 -1
- package/lib/packlets/common/validate/conditions.js +32 -6
- package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
- package/lib/packlets/common/validate/regularExpressions.js +5 -1
- package/lib/packlets/common/validate/resources.d.ts +35 -1
- package/lib/packlets/common/validate/resources.js +55 -0
- package/lib/packlets/conditions/condition.js +1 -0
- package/lib/packlets/conditions/conditionSet.d.ts +9 -0
- package/lib/packlets/conditions/conditionSet.js +75 -1
- package/lib/packlets/config/configInitFactory.d.ts +217 -0
- package/lib/packlets/config/configInitFactory.js +302 -0
- package/lib/packlets/config/convert.d.ts +9 -0
- package/lib/packlets/config/convert.js +12 -1
- package/lib/packlets/config/index.d.ts +1 -0
- package/lib/packlets/config/index.js +1 -0
- package/lib/packlets/config/json.d.ts +1 -1
- package/lib/packlets/config/systemConfiguration.d.ts +16 -3
- package/lib/packlets/config/systemConfiguration.js +19 -40
- package/lib/packlets/import/fsItem.d.ts +2 -1
- package/lib/packlets/import/fsItem.js +9 -13
- package/lib/packlets/import/importManager.d.ts +2 -1
- package/lib/packlets/import/importers/jsonImporter.js +1 -0
- package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
- package/lib/packlets/import/importers/pathImporter.js +2 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
- package/lib/packlets/qualifier-types/config/convert.js +67 -2
- package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
- package/lib/packlets/qualifier-types/config/json.js +11 -0
- package/lib/packlets/qualifier-types/convert.d.ts +1 -1
- package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
- package/lib/packlets/qualifier-types/helpers.js +2 -2
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
- package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
- package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
- package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
- package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
- package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
- package/lib/packlets/resource-json/compiled/convert.js +2 -1
- package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
- package/lib/packlets/resource-types/config/convert.d.ts +1 -1
- package/lib/packlets/resource-types/config/convert.js +3 -1
- package/lib/packlets/resource-types/config/json.d.ts +3 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +10 -1
- package/lib/packlets/resource-types/jsonResourceType.js +7 -3
- package/lib/packlets/resource-types/resourceType.d.ts +100 -8
- package/lib/packlets/resource-types/resourceType.js +39 -3
- package/lib/packlets/resources/candidateReducer.js +3 -0
- package/lib/packlets/resources/candidateValue.d.ts +92 -0
- package/lib/packlets/resources/candidateValue.js +128 -0
- package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
- package/lib/packlets/resources/candidateValueCollector.js +96 -0
- package/lib/packlets/resources/common.d.ts +14 -0
- package/lib/packlets/resources/deltaGenerator.d.ts +189 -0
- package/lib/packlets/resources/deltaGenerator.js +344 -0
- package/lib/packlets/resources/index.d.ts +3 -0
- package/lib/packlets/resources/index.js +3 -0
- package/lib/packlets/resources/resource.d.ts +6 -6
- package/lib/packlets/resources/resource.js +5 -10
- package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
- package/lib/packlets/resources/resourceBuilder.js +4 -1
- package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
- package/lib/packlets/resources/resourceCandidate.js +17 -5
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +131 -10
- package/lib/packlets/resources/resourceManagerBuilder.js +289 -45
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +27 -11
- package/lib/packlets/runtime/compiledResourceCollection.js +71 -28
- package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
- package/lib/packlets/runtime/iResourceManager.d.ts +17 -5
- package/lib/packlets/runtime/index.d.ts +1 -0
- package/lib/packlets/runtime/index.js +1 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
- package/lib/packlets/runtime/resourceResolver.d.ts +43 -1
- package/lib/packlets/runtime/resourceResolver.js +56 -28
- package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
- package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
- package/lib/packlets/runtime/validate.js +1 -0
- package/lib/packlets/zip-archive/convert.d.ts +52 -0
- package/lib/packlets/zip-archive/convert.js +103 -0
- package/lib/packlets/zip-archive/index.d.ts +23 -0
- package/lib/packlets/zip-archive/index.js +95 -0
- package/lib/packlets/zip-archive/json.d.ts +64 -0
- package/lib/packlets/zip-archive/json.js +24 -0
- package/lib/packlets/zip-archive/types.d.ts +98 -0
- package/lib/packlets/zip-archive/types.js +39 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.js +286 -0
- package/package.json +26 -32
- package/CLAUDE.md +0 -186
- package/EXAMPLE_INIT_PARAMS.md +0 -88
- package/PROGRESS_SUMMARY.md +0 -48
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/packlets/bundle/bundleBuilder.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleBuilder.js.map +0 -1
- package/lib/packlets/bundle/bundleLoader.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleLoader.js.map +0 -1
- package/lib/packlets/bundle/bundleNormalizer.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleNormalizer.js.map +0 -1
- package/lib/packlets/bundle/bundleUtils.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleUtils.js.map +0 -1
- package/lib/packlets/bundle/convert.d.ts.map +0 -1
- package/lib/packlets/bundle/convert.js.map +0 -1
- package/lib/packlets/bundle/index.d.ts.map +0 -1
- package/lib/packlets/bundle/index.js.map +0 -1
- package/lib/packlets/bundle/model.d.ts.map +0 -1
- package/lib/packlets/bundle/model.js.map +0 -1
- package/lib/packlets/common/conditions.d.ts.map +0 -1
- package/lib/packlets/common/conditions.js.map +0 -1
- package/lib/packlets/common/convert.d.ts.map +0 -1
- package/lib/packlets/common/convert.js.map +0 -1
- package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
- package/lib/packlets/common/helpers/conditions.js.map +0 -1
- package/lib/packlets/common/helpers/context.d.ts.map +0 -1
- package/lib/packlets/common/helpers/context.js.map +0 -1
- package/lib/packlets/common/helpers/index.d.ts.map +0 -1
- package/lib/packlets/common/helpers/index.js.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
- package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
- package/lib/packlets/common/helpers/resources.js.map +0 -1
- package/lib/packlets/common/index.d.ts.map +0 -1
- package/lib/packlets/common/index.js.map +0 -1
- package/lib/packlets/common/resources.d.ts.map +0 -1
- package/lib/packlets/common/resources.js.map +0 -1
- package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
- package/lib/packlets/common/validate/conditions.js.map +0 -1
- package/lib/packlets/common/validate/index.d.ts.map +0 -1
- package/lib/packlets/common/validate/index.js.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
- package/lib/packlets/common/validate/resources.d.ts.map +0 -1
- package/lib/packlets/common/validate/resources.js.map +0 -1
- package/lib/packlets/conditions/condition.d.ts.map +0 -1
- package/lib/packlets/conditions/condition.js.map +0 -1
- package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSet.js.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionToken.js.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/decls.js.map +0 -1
- package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/index.js.map +0 -1
- package/lib/packlets/conditions/index.d.ts.map +0 -1
- package/lib/packlets/conditions/index.js.map +0 -1
- package/lib/packlets/config/common.d.ts.map +0 -1
- package/lib/packlets/config/common.js.map +0 -1
- package/lib/packlets/config/convert.d.ts.map +0 -1
- package/lib/packlets/config/convert.js.map +0 -1
- package/lib/packlets/config/index.d.ts.map +0 -1
- package/lib/packlets/config/index.js.map +0 -1
- package/lib/packlets/config/json.d.ts.map +0 -1
- package/lib/packlets/config/json.js.map +0 -1
- package/lib/packlets/config/predefined/default.d.ts.map +0 -1
- package/lib/packlets/config/predefined/default.js.map +0 -1
- package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
- package/lib/packlets/config/predefined/extended.js.map +0 -1
- package/lib/packlets/config/predefined/index.d.ts.map +0 -1
- package/lib/packlets/config/predefined/index.js.map +0 -1
- package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
- package/lib/packlets/config/systemConfiguration.js.map +0 -1
- package/lib/packlets/context/contextDecls.d.ts.map +0 -1
- package/lib/packlets/context/contextDecls.js.map +0 -1
- package/lib/packlets/context/contextToken.d.ts.map +0 -1
- package/lib/packlets/context/contextToken.js.map +0 -1
- package/lib/packlets/context/convert/decls.d.ts.map +0 -1
- package/lib/packlets/context/convert/decls.js.map +0 -1
- package/lib/packlets/context/convert/index.d.ts.map +0 -1
- package/lib/packlets/context/convert/index.js.map +0 -1
- package/lib/packlets/context/index.d.ts.map +0 -1
- package/lib/packlets/context/index.js.map +0 -1
- package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecision.js.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
- package/lib/packlets/decisions/candidate.d.ts.map +0 -1
- package/lib/packlets/decisions/candidate.js.map +0 -1
- package/lib/packlets/decisions/common.d.ts.map +0 -1
- package/lib/packlets/decisions/common.js.map +0 -1
- package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/concreteDecision.js.map +0 -1
- package/lib/packlets/decisions/decision.d.ts.map +0 -1
- package/lib/packlets/decisions/decision.js.map +0 -1
- package/lib/packlets/decisions/index.d.ts.map +0 -1
- package/lib/packlets/decisions/index.js.map +0 -1
- package/lib/packlets/import/fsItem.d.ts.map +0 -1
- package/lib/packlets/import/fsItem.js.map +0 -1
- package/lib/packlets/import/importContext.d.ts.map +0 -1
- package/lib/packlets/import/importContext.js.map +0 -1
- package/lib/packlets/import/importManager.d.ts.map +0 -1
- package/lib/packlets/import/importManager.js.map +0 -1
- package/lib/packlets/import/importable.d.ts.map +0 -1
- package/lib/packlets/import/importable.js.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
- package/lib/packlets/import/importers/importer.d.ts.map +0 -1
- package/lib/packlets/import/importers/importer.js.map +0 -1
- package/lib/packlets/import/importers/index.d.ts.map +0 -1
- package/lib/packlets/import/importers/index.js.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
- package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/pathImporter.js.map +0 -1
- package/lib/packlets/import/index.d.ts.map +0 -1
- package/lib/packlets/import/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/json.js.map +0 -1
- package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/helpers.js.map +0 -1
- package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/index.js.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
- package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/index.js.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/index.js.map +0 -1
- package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
- package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/common.js.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
- package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/index.js.map +0 -1
- package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/json.js.map +0 -1
- package/lib/packlets/resource-json/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/convert.js.map +0 -1
- package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-json/helpers.js.map +0 -1
- package/lib/packlets/resource-json/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/index.js.map +0 -1
- package/lib/packlets/resource-json/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/json.js.map +0 -1
- package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
- package/lib/packlets/resource-json/normalized.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
- package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/convert.js.map +0 -1
- package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/index.js.map +0 -1
- package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/json.js.map +0 -1
- package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-types/helpers.js.map +0 -1
- package/lib/packlets/resource-types/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/index.js.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
- package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
- package/lib/packlets/resources/candidateReducer.js.map +0 -1
- package/lib/packlets/resources/common.d.ts.map +0 -1
- package/lib/packlets/resources/common.js.map +0 -1
- package/lib/packlets/resources/index.d.ts.map +0 -1
- package/lib/packlets/resources/index.js.map +0 -1
- package/lib/packlets/resources/resource.d.ts.map +0 -1
- package/lib/packlets/resources/resource.js.map +0 -1
- package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceBuilder.js.map +0 -1
- package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
- package/lib/packlets/resources/resourceCandidate.js.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
- package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheListener.js.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
- package/lib/packlets/runtime/context/index.d.ts.map +0 -1
- package/lib/packlets/runtime/context/index.js.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
- package/lib/packlets/runtime/iResourceManager.js.map +0 -1
- package/lib/packlets/runtime/index.d.ts.map +0 -1
- package/lib/packlets/runtime/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
- package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
- package/lib/packlets/runtime/resourceResolver.js.map +0 -1
- package/lib/packlets/runtime/validate.d.ts.map +0 -1
- package/lib/packlets/runtime/validate.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Result } from '@fgv/ts-utils';
|
|
2
2
|
import { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';
|
|
3
3
|
import { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';
|
|
4
|
-
import { ContextQualifierProvider } from './contextQualifierProvider';
|
|
4
|
+
import { ContextQualifierProvider, IMutableContextQualifierProvider } from './contextQualifierProvider';
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for creating a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider}.
|
|
7
7
|
* @public
|
|
@@ -21,7 +21,12 @@ export interface ISimpleContextQualifierProviderCreateParams {
|
|
|
21
21
|
* using a `ResultMap` for qualifier value storage.
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
export declare class SimpleContextQualifierProvider extends ContextQualifierProvider {
|
|
24
|
+
export declare class SimpleContextQualifierProvider extends ContextQualifierProvider implements IMutableContextQualifierProvider {
|
|
25
|
+
/**
|
|
26
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
27
|
+
* Always `true` for mutable providers.
|
|
28
|
+
*/
|
|
29
|
+
readonly mutable: true;
|
|
25
30
|
/**
|
|
26
31
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
27
32
|
*/
|
|
@@ -99,6 +104,14 @@ export declare class SimpleContextQualifierProvider extends ContextQualifierProv
|
|
|
99
104
|
* @public
|
|
100
105
|
*/
|
|
101
106
|
clear(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resolves a qualifier from a name, index, or qualifier object.
|
|
109
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
110
|
+
* @returns `Success` with the {@link Qualifier | qualifier} if successful,
|
|
111
|
+
* or `Failure` with an error message if not found or invalid.
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
private _resolveQualifier;
|
|
102
115
|
/**
|
|
103
116
|
* Resolves a qualifier name from a name, index, or qualifier object.
|
|
104
117
|
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
@@ -107,5 +120,13 @@ export declare class SimpleContextQualifierProvider extends ContextQualifierProv
|
|
|
107
120
|
* @internal
|
|
108
121
|
*/
|
|
109
122
|
private _resolveQualifierName;
|
|
123
|
+
/**
|
|
124
|
+
* Resolves a qualifier name from a qualifier-like object.
|
|
125
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
126
|
+
* @returns `Success` with the {@link QualifierName | qualifier name} if successful,
|
|
127
|
+
* or `Failure` with an error message if not found or invalid.
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
private static _qualifierNameFromQualifierLike;
|
|
110
131
|
}
|
|
111
132
|
//# sourceMappingURL=simpleContextQualifierProvider.d.ts.map
|
|
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
exports.SimpleContextQualifierProvider = void 0;
|
|
25
25
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
26
|
const common_1 = require("../../common");
|
|
27
|
+
const qualifiers_1 = require("../../qualifiers");
|
|
27
28
|
const contextQualifierProvider_1 = require("./contextQualifierProvider");
|
|
28
29
|
/**
|
|
29
30
|
* Simple concrete implementation of {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider}
|
|
@@ -37,6 +38,11 @@ class SimpleContextQualifierProvider extends contextQualifierProvider_1.ContextQ
|
|
|
37
38
|
*/
|
|
38
39
|
constructor(params) {
|
|
39
40
|
super();
|
|
41
|
+
/**
|
|
42
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
43
|
+
* Always `true` for mutable providers.
|
|
44
|
+
*/
|
|
45
|
+
this.mutable = true;
|
|
40
46
|
this.qualifiers = params.qualifiers;
|
|
41
47
|
this._qualifierValues = new ts_utils_1.ResultMap();
|
|
42
48
|
if (params.qualifierValues) {
|
|
@@ -63,12 +69,9 @@ class SimpleContextQualifierProvider extends contextQualifierProvider_1.ContextQ
|
|
|
63
69
|
* or `Failure` with an error message if not found or an error occurs.
|
|
64
70
|
*/
|
|
65
71
|
get(nameOrIndexOrQualifier) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return (0, ts_utils_1.fail)(qualifierName.message);
|
|
70
|
-
}
|
|
71
|
-
return this._qualifierValues.get(qualifierName.value);
|
|
72
|
+
return this._resolveQualifierName(nameOrIndexOrQualifier).onSuccess((qualifierName) => {
|
|
73
|
+
return this._qualifierValues.get(qualifierName);
|
|
74
|
+
});
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
77
|
* Gets a validated qualifier context value by its name, index, or qualifier object.
|
|
@@ -78,12 +81,11 @@ class SimpleContextQualifierProvider extends contextQualifierProvider_1.ContextQ
|
|
|
78
81
|
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
79
82
|
*/
|
|
80
83
|
getValidated(nameOrIndexOrQualifier) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return (0, ts_utils_1.fail)(`getValidated not yet implemented for qualifier "${qualifierName.value}"`);
|
|
84
|
+
return this._resolveQualifier(nameOrIndexOrQualifier).onSuccess((qualifier) => {
|
|
85
|
+
return this._qualifierValues.get(qualifier.name).asResult.onSuccess((value) => {
|
|
86
|
+
return qualifier.validateContextValue(value);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Checks if a qualifier value exists with the given name.
|
|
@@ -143,34 +145,54 @@ class SimpleContextQualifierProvider extends contextQualifierProvider_1.ContextQ
|
|
|
143
145
|
this._qualifierValues.clear();
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
146
|
-
* Resolves a qualifier
|
|
148
|
+
* Resolves a qualifier from a name, index, or qualifier object.
|
|
147
149
|
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
148
|
-
* @returns `Success` with the {@link
|
|
150
|
+
* @returns `Success` with the {@link Qualifier | qualifier} if successful,
|
|
149
151
|
* or `Failure` with an error message if not found or invalid.
|
|
150
152
|
* @internal
|
|
151
153
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (typeof nameOrIndexOrQualifier === 'string') {
|
|
155
|
-
/* c8 ignore next 1 - functional code path tested but coverage intermittently missed */
|
|
154
|
+
_resolveQualifier(nameOrIndexOrQualifier) {
|
|
155
|
+
if (nameOrIndexOrQualifier instanceof qualifiers_1.Qualifier) {
|
|
156
156
|
return (0, ts_utils_1.succeed)(nameOrIndexOrQualifier);
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return (0, ts_utils_1.succeed)(nameOrIndexOrQualifier.name);
|
|
158
|
+
if (typeof nameOrIndexOrQualifier === 'string') {
|
|
159
|
+
return this.qualifiers.validating
|
|
160
|
+
.get(nameOrIndexOrQualifier)
|
|
161
|
+
.withErrorFormat((error) => `${nameOrIndexOrQualifier}: Not a valid qualifier name.`);
|
|
163
162
|
}
|
|
164
|
-
// If it's a QualifierIndex (number type with brand)
|
|
165
|
-
/* c8 ignore next 8 - functional code path tested but coverage intermittently missed */
|
|
166
163
|
if (typeof nameOrIndexOrQualifier === 'number') {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
return (0, ts_utils_1.fail)(`Qualifier not found at index ${nameOrIndexOrQualifier}`);
|
|
164
|
+
return this.qualifiers
|
|
165
|
+
.getAt(nameOrIndexOrQualifier)
|
|
166
|
+
.withErrorFormat((error) => `${nameOrIndexOrQualifier}: Not a valid qualifier index.`);
|
|
172
167
|
}
|
|
173
|
-
return
|
|
168
|
+
return SimpleContextQualifierProvider._qualifierNameFromQualifierLike(nameOrIndexOrQualifier)
|
|
169
|
+
.onSuccess((qualifierName) => this.qualifiers.validating.get(qualifierName))
|
|
170
|
+
.withErrorFormat((error) => `${nameOrIndexOrQualifier}: Not a valid Qualifier, name or index.`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Resolves a qualifier name from a name, index, or qualifier object.
|
|
174
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
175
|
+
* @returns `Success` with the {@link QualifierName | qualifier name} if successful,
|
|
176
|
+
* or `Failure` with an error message if not found or invalid.
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
_resolveQualifierName(nameOrIndexOrQualifier) {
|
|
180
|
+
return this._resolveQualifier(nameOrIndexOrQualifier).onSuccess((qualifier) => (0, ts_utils_1.succeed)(qualifier.name));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resolves a qualifier name from a qualifier-like object.
|
|
184
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
185
|
+
* @returns `Success` with the {@link QualifierName | qualifier name} if successful,
|
|
186
|
+
* or `Failure` with an error message if not found or invalid.
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
static _qualifierNameFromQualifierLike(nameOrIndexOrQualifier) {
|
|
190
|
+
return ts_utils_1.Converters.isA('Qualifier-like object', (v) => typeof v === 'object' &&
|
|
191
|
+
v !== null &&
|
|
192
|
+
'name' in v &&
|
|
193
|
+
typeof v.name === 'string')
|
|
194
|
+
.map((v) => common_1.Convert.qualifierName.convert(v.name))
|
|
195
|
+
.convert(nameOrIndexOrQualifier);
|
|
174
196
|
}
|
|
175
197
|
}
|
|
176
198
|
exports.SimpleContextQualifierProvider = SimpleContextQualifierProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Result } from '@fgv/ts-utils';
|
|
2
2
|
import { IReadOnlyQualifierCollector } from '../../qualifiers';
|
|
3
3
|
import { SimpleContextQualifierProvider } from './simpleContextQualifierProvider';
|
|
4
|
-
import {
|
|
4
|
+
import { IMutableContextQualifierProviderValidator } from './contextQualifierProviderValidator';
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for creating a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider}.
|
|
7
7
|
* @public
|
|
@@ -19,17 +19,17 @@ export interface IValidatingSimpleContextQualifierProviderCreateParams {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a
|
|
22
|
-
* {@link Runtime.Context.
|
|
22
|
+
* {@link Runtime.Context.MutableContextQualifierProviderValidator | validator} property that enables
|
|
23
23
|
* validated use of the underlying provider with string keys and values.
|
|
24
24
|
* This eliminates the need for type casting in consumer code.
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
export declare class ValidatingSimpleContextQualifierProvider extends SimpleContextQualifierProvider {
|
|
28
28
|
/**
|
|
29
|
-
* A {@link Runtime.Context.
|
|
29
|
+
* A {@link Runtime.Context.MutableContextQualifierProviderValidator | MutableContextQualifierProviderValidator} which validates
|
|
30
30
|
* string inputs before passing them to this provider.
|
|
31
31
|
*/
|
|
32
|
-
readonly validating:
|
|
32
|
+
readonly validating: IMutableContextQualifierProviderValidator;
|
|
33
33
|
/**
|
|
34
34
|
* Constructor for a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
|
|
35
35
|
* @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
|
|
@@ -27,7 +27,7 @@ const simpleContextQualifierProvider_1 = require("./simpleContextQualifierProvid
|
|
|
27
27
|
const contextQualifierProviderValidator_1 = require("./contextQualifierProviderValidator");
|
|
28
28
|
/**
|
|
29
29
|
* A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a
|
|
30
|
-
* {@link Runtime.Context.
|
|
30
|
+
* {@link Runtime.Context.MutableContextQualifierProviderValidator | validator} property that enables
|
|
31
31
|
* validated use of the underlying provider with string keys and values.
|
|
32
32
|
* This eliminates the need for type casting in consumer code.
|
|
33
33
|
* @public
|
|
@@ -47,7 +47,7 @@ class ValidatingSimpleContextQualifierProvider extends simpleContextQualifierPro
|
|
|
47
47
|
qualifiers: params.qualifiers,
|
|
48
48
|
qualifierValues: convertedValues
|
|
49
49
|
});
|
|
50
|
-
this.validating = new contextQualifierProviderValidator_1.
|
|
50
|
+
this.validating = new contextQualifierProviderValidator_1.MutableContextQualifierProviderValidator({ provider: this });
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Creates a new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
|
|
@@ -3,8 +3,9 @@ import { JsonObject } from '@fgv/ts-json-base';
|
|
|
3
3
|
import { ReadOnlyConditionCollector, ReadOnlyConditionSetCollector } from '../conditions';
|
|
4
4
|
import { ReadOnlyAbstractDecisionCollector, ConcreteDecision } from '../decisions';
|
|
5
5
|
import { ResourceId, ResourceValueMergeMethod } from '../common';
|
|
6
|
-
import {
|
|
6
|
+
import { IResourceType } from '../resource-types';
|
|
7
7
|
import { IContextDecl, IValidatedContextDecl } from '../context';
|
|
8
|
+
import { IReadOnlyResourceTreeRoot } from './resource-tree';
|
|
8
9
|
/**
|
|
9
10
|
* Runtime representation of a resource candidate with the minimal data needed for resolution.
|
|
10
11
|
* @public
|
|
@@ -30,8 +31,10 @@ export interface IResourceCandidate {
|
|
|
30
31
|
export interface IResource {
|
|
31
32
|
/** The resource identifier */
|
|
32
33
|
readonly id: string;
|
|
34
|
+
/** The resource name */
|
|
35
|
+
readonly name: string;
|
|
33
36
|
/** The resource type */
|
|
34
|
-
readonly resourceType:
|
|
37
|
+
readonly resourceType: IResourceType;
|
|
35
38
|
/** The decision used to select candidates */
|
|
36
39
|
readonly decision: ConcreteDecision;
|
|
37
40
|
/** The available candidates for this resource */
|
|
@@ -43,7 +46,7 @@ export interface IResource {
|
|
|
43
46
|
* implementations without requiring the full ResourceManagerBuilder build mechanics.
|
|
44
47
|
* @public
|
|
45
48
|
*/
|
|
46
|
-
export interface IResourceManager {
|
|
49
|
+
export interface IResourceManager<TR extends IResource = IResource> {
|
|
47
50
|
/**
|
|
48
51
|
* A {@link Conditions.ReadOnlyConditionCollector | ReadOnlyConditionCollector} which
|
|
49
52
|
* contains the {@link Conditions.Condition | conditions} used by resource candidates.
|
|
@@ -64,16 +67,25 @@ export interface IResourceManager {
|
|
|
64
67
|
* @param id - The resource identifier
|
|
65
68
|
* @returns Success with the runtime resource if found, Failure otherwise
|
|
66
69
|
*/
|
|
67
|
-
getBuiltResource(id: string): Result<
|
|
70
|
+
getBuiltResource(id: string): Result<TR>;
|
|
71
|
+
/**
|
|
72
|
+
* Gets a resource tree built from the resources in this resource manager.
|
|
73
|
+
* @returns Result containing the resource tree root, or failure if tree construction fails
|
|
74
|
+
*/
|
|
75
|
+
getBuiltResourceTree(): Result<IReadOnlyResourceTreeRoot<TR>>;
|
|
68
76
|
/**
|
|
69
77
|
* A read-only result map of all built resources, keyed by resource ID.
|
|
70
78
|
* Resources are built on-demand when accessed and returns Results for error handling.
|
|
71
79
|
*/
|
|
72
|
-
readonly builtResources: Collections.IReadOnlyValidatingResultMap<ResourceId,
|
|
80
|
+
readonly builtResources: Collections.IReadOnlyValidatingResultMap<ResourceId, TR>;
|
|
73
81
|
/**
|
|
74
82
|
* The number of resources in this resource manager.
|
|
75
83
|
*/
|
|
76
84
|
readonly numResources: number;
|
|
85
|
+
/**
|
|
86
|
+
* The resource IDs that this resource manager can resolve.
|
|
87
|
+
*/
|
|
88
|
+
readonly resourceIds: ReadonlyArray<ResourceId>;
|
|
77
89
|
/**
|
|
78
90
|
* The number of candidates in this resource manager.
|
|
79
91
|
*/
|
|
@@ -3,6 +3,7 @@ export * from './iResourceManager';
|
|
|
3
3
|
export * from './context/simpleContextQualifierProvider';
|
|
4
4
|
export * from './context/validatingSimpleContextQualifierProvider';
|
|
5
5
|
export * from './resourceResolver';
|
|
6
|
+
export * from './resourceTreeResolver';
|
|
6
7
|
export * from './conditionSetResolutionResult';
|
|
7
8
|
export * from './cacheListener';
|
|
8
9
|
export * from './cacheMetrics';
|
|
@@ -63,6 +63,7 @@ __exportStar(require("./iResourceManager"), exports);
|
|
|
63
63
|
__exportStar(require("./context/simpleContextQualifierProvider"), exports);
|
|
64
64
|
__exportStar(require("./context/validatingSimpleContextQualifierProvider"), exports);
|
|
65
65
|
__exportStar(require("./resourceResolver"), exports);
|
|
66
|
+
__exportStar(require("./resourceTreeResolver"), exports);
|
|
66
67
|
__exportStar(require("./conditionSetResolutionResult"), exports);
|
|
67
68
|
__exportStar(require("./cacheListener"), exports);
|
|
68
69
|
__exportStar(require("./cacheMetrics"), exports);
|
|
@@ -49,7 +49,7 @@ export type IReadOnlyResourceTreeNode<T> = IReadOnlyResourceTreeLeaf<T> | IReadO
|
|
|
49
49
|
* Interface for a read-only result-based resource tree with navigation methods.
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
export interface IReadOnlyResourceTreeChildren<T, TID extends string = ResourceId, TNAME extends string = ResourceName> extends IReadOnlyResultMap<
|
|
52
|
+
export interface IReadOnlyResourceTreeChildren<T, TID extends string = ResourceId, TNAME extends string = ResourceName> extends IReadOnlyResultMap<TNAME, IReadOnlyResourceTreeNode<T>> {
|
|
53
53
|
/**
|
|
54
54
|
* Gets a tree node by its full ResourceId path.
|
|
55
55
|
* @param id - The ResourceId path to look up
|
|
@@ -14,7 +14,7 @@ import { IReadOnlyResourceTreeBranch, IReadOnlyResourceTreeChildren, IReadOnlyRe
|
|
|
14
14
|
* strongly-typed internal tree operations, ensuring type safety and consistent
|
|
15
15
|
* error handling throughout the resource tree navigation.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export declare class ResourceTreeChildrenValidator<T> implements IReadOnlyResourceTreeChildren<T, string, string> {
|
|
20
20
|
private readonly _inner;
|
|
@@ -69,17 +69,17 @@ export declare class ResourceTreeChildrenValidator<T> implements IReadOnlyResour
|
|
|
69
69
|
*/
|
|
70
70
|
forEach(cb: (value: unknown, key: string, map: IReadOnlyResultMap<string, unknown>, thisArg?: unknown) => void, arg?: unknown): void;
|
|
71
71
|
/**
|
|
72
|
-
* Gets a child node by its
|
|
73
|
-
* @param key - The
|
|
72
|
+
* Gets a child node by its string key with detailed error information.
|
|
73
|
+
* @param key - The string key to look up
|
|
74
74
|
* @returns DetailedResult containing the node if found, or failure with details
|
|
75
75
|
*/
|
|
76
|
-
get(key:
|
|
76
|
+
get(key: string): DetailedResult<IReadOnlyResourceTreeNode<T>, Collections.ResultMapResultDetail>;
|
|
77
77
|
/**
|
|
78
|
-
* Checks if a child node exists at the given
|
|
79
|
-
* @param key - The
|
|
78
|
+
* Checks if a child node exists at the given string key.
|
|
79
|
+
* @param key - The string key to check
|
|
80
80
|
* @returns True if a child node exists at the key, false otherwise
|
|
81
81
|
*/
|
|
82
|
-
has(key:
|
|
82
|
+
has(key: string): boolean;
|
|
83
83
|
/**
|
|
84
84
|
* Returns an iterator of ResourceName keys for all child nodes.
|
|
85
85
|
* @returns Map iterator for all child node keys
|
|
@@ -37,7 +37,7 @@ const ts_utils_1 = require("@fgv/ts-utils");
|
|
|
37
37
|
* strongly-typed internal tree operations, ensuring type safety and consistent
|
|
38
38
|
* error handling throughout the resource tree navigation.
|
|
39
39
|
*
|
|
40
|
-
* @
|
|
40
|
+
* @public
|
|
41
41
|
*/
|
|
42
42
|
class ResourceTreeChildrenValidator {
|
|
43
43
|
/**
|
|
@@ -121,8 +121,8 @@ class ResourceTreeChildrenValidator {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Gets a child node by its
|
|
125
|
-
* @param key - The
|
|
124
|
+
* Gets a child node by its string key with detailed error information.
|
|
125
|
+
* @param key - The string key to look up
|
|
126
126
|
* @returns DetailedResult containing the node if found, or failure with details
|
|
127
127
|
*/
|
|
128
128
|
get(key) {
|
|
@@ -132,8 +132,8 @@ class ResourceTreeChildrenValidator {
|
|
|
132
132
|
return (0, ts_utils_1.failWithDetail)(`${key}: invalid resource name.`, 'invalid-key');
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
|
-
* Checks if a child node exists at the given
|
|
136
|
-
* @param key - The
|
|
135
|
+
* Checks if a child node exists at the given string key.
|
|
136
|
+
* @param key - The string key to check
|
|
137
137
|
* @returns True if a child node exists at the key, false otherwise
|
|
138
138
|
*/
|
|
139
139
|
has(key) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Result } from '@fgv/ts-utils';
|
|
2
2
|
import { JsonValue } from '@fgv/ts-json-base';
|
|
3
|
+
import { IResourceResolver, ResourceId } from '../common';
|
|
3
4
|
import { Condition, ConditionSet } from '../conditions';
|
|
4
5
|
import { AbstractDecision } from '../decisions';
|
|
5
6
|
import { ReadOnlyQualifierTypeCollector } from '../qualifier-types';
|
|
@@ -7,6 +8,7 @@ import { IContextQualifierProvider } from './context';
|
|
|
7
8
|
import { IResourceManager, IResource, IResourceCandidate } from './iResourceManager';
|
|
8
9
|
import { ConditionSetResolutionResult, IConditionMatchResult } from './conditionSetResolutionResult';
|
|
9
10
|
import { IResourceResolverCacheListener } from './cacheListener';
|
|
11
|
+
import { IReadOnlyQualifierCollector } from '../qualifiers';
|
|
10
12
|
/**
|
|
11
13
|
* Represents the cached result of resolving a decision.
|
|
12
14
|
* Contains either a failure indicator or a list of instance indices for matching condition sets,
|
|
@@ -68,7 +70,7 @@ export interface IResourceResolverCreateParams {
|
|
|
68
70
|
* and caching results for optimal performance.
|
|
69
71
|
* @public
|
|
70
72
|
*/
|
|
71
|
-
export declare class ResourceResolver {
|
|
73
|
+
export declare class ResourceResolver implements IResourceResolver {
|
|
72
74
|
/**
|
|
73
75
|
* The resource manager that defines available resources and provides condition access.
|
|
74
76
|
*/
|
|
@@ -85,6 +87,14 @@ export declare class ResourceResolver {
|
|
|
85
87
|
* The configuration options for this resource resolver.
|
|
86
88
|
*/
|
|
87
89
|
readonly options: IResourceResolverOptions;
|
|
90
|
+
/**
|
|
91
|
+
* The readonly qualifier collector that provides qualifier implementations.
|
|
92
|
+
*/
|
|
93
|
+
get qualifiers(): IReadOnlyQualifierCollector;
|
|
94
|
+
/**
|
|
95
|
+
* The resource IDs that this resolver can resolve.
|
|
96
|
+
*/
|
|
97
|
+
get resourceIds(): ReadonlyArray<ResourceId>;
|
|
88
98
|
/**
|
|
89
99
|
* The cache array for resolved conditions, indexed by condition index for O(1) lookup.
|
|
90
100
|
* Each entry stores the resolved {@link Runtime.IConditionMatchResult | condition match result} for
|
|
@@ -169,6 +179,15 @@ export declare class ResourceResolver {
|
|
|
169
179
|
* @public
|
|
170
180
|
*/
|
|
171
181
|
resolveResource(resource: IResource): Result<IResourceCandidate>;
|
|
182
|
+
/**
|
|
183
|
+
* Resolves a resource by finding the best matching candidate.
|
|
184
|
+
* Uses the resource's associated decision to determine the best match based on the current context.
|
|
185
|
+
* @param resource - The string id of the resource to resolve.
|
|
186
|
+
* @returns `Success` with the best matching candidate if successful,
|
|
187
|
+
* or `Failure` with an error message if no candidates match or resolution fails.
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
resolveResource(resource: string): Result<IResourceCandidate>;
|
|
172
191
|
/**
|
|
173
192
|
* Resolves all matching resource candidates in priority order.
|
|
174
193
|
* Uses the resource's associated decision to determine all matching candidates based on the current context.
|
|
@@ -178,6 +197,15 @@ export declare class ResourceResolver {
|
|
|
178
197
|
* @public
|
|
179
198
|
*/
|
|
180
199
|
resolveAllResourceCandidates(resource: IResource): Result<ReadonlyArray<IResourceCandidate>>;
|
|
200
|
+
/**
|
|
201
|
+
* Resolves all matching resource candidates in priority order.
|
|
202
|
+
* Uses the resource's associated decision to determine all matching candidates based on the current context.
|
|
203
|
+
* @param resource - The string id of the resource to resolve.
|
|
204
|
+
* @returns `Success` with an array of all matching candidates in priority order if successful,
|
|
205
|
+
* or `Failure` with an error message if no candidates match or resolution fails.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
resolveAllResourceCandidates(resource: string): Result<ReadonlyArray<IResourceCandidate>>;
|
|
181
209
|
/**
|
|
182
210
|
* Resolves a resource to a composed value by merging matching candidates according to their merge methods.
|
|
183
211
|
* Starting from the highest priority candidates, finds the first "full" candidate and merges all higher
|
|
@@ -188,6 +216,20 @@ export declare class ResourceResolver {
|
|
|
188
216
|
* @public
|
|
189
217
|
*/
|
|
190
218
|
resolveComposedResourceValue(resource: IResource): Result<JsonValue>;
|
|
219
|
+
/**
|
|
220
|
+
* Resolves a resource to a composed value by merging matching candidates according to their merge methods.
|
|
221
|
+
* Starting from the highest priority candidates, finds the first "full" candidate and merges all higher
|
|
222
|
+
* priority "partial" candidates into it in ascending order of priority.
|
|
223
|
+
* @param resource - The string id of the resource to resolve.
|
|
224
|
+
* @returns `Success` with the composed JsonValue if successful,
|
|
225
|
+
* or `Failure` with an error message if no candidates match or resolution fails.
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
228
|
+
resolveComposedResourceValue(resource: string): Result<JsonValue>;
|
|
229
|
+
/**
|
|
230
|
+
* {@inheritDoc IResourceResolver.withContext}
|
|
231
|
+
*/
|
|
232
|
+
withContext(context: Record<string, string>): Result<ResourceResolver>;
|
|
191
233
|
/**
|
|
192
234
|
* Clears all caches (condition, condition set, and decision), forcing all cached items
|
|
193
235
|
* to be re-evaluated on next access. This should be called when the context changes and cached
|
|
@@ -26,6 +26,7 @@ const ts_utils_1 = require("@fgv/ts-utils");
|
|
|
26
26
|
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
27
27
|
const ts_json_1 = require("@fgv/ts-json");
|
|
28
28
|
const common_1 = require("../common");
|
|
29
|
+
const context_1 = require("./context");
|
|
29
30
|
const conditionSetResolutionResult_1 = require("./conditionSetResolutionResult");
|
|
30
31
|
/**
|
|
31
32
|
* High-performance runtime resource resolver with O(1) condition caching.
|
|
@@ -34,6 +35,18 @@ const conditionSetResolutionResult_1 = require("./conditionSetResolutionResult")
|
|
|
34
35
|
* @public
|
|
35
36
|
*/
|
|
36
37
|
class ResourceResolver {
|
|
38
|
+
/**
|
|
39
|
+
* The readonly qualifier collector that provides qualifier implementations.
|
|
40
|
+
*/
|
|
41
|
+
get qualifiers() {
|
|
42
|
+
return this.contextQualifierProvider.qualifiers;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The resource IDs that this resolver can resolve.
|
|
46
|
+
*/
|
|
47
|
+
get resourceIds() {
|
|
48
|
+
return this.resourceManager.resourceIds;
|
|
49
|
+
}
|
|
37
50
|
/**
|
|
38
51
|
* The cache array for resolved conditions, indexed by condition index for O(1) lookup.
|
|
39
52
|
* Each entry stores the resolved {@link Runtime.IConditionMatchResult | condition match result} for
|
|
@@ -184,6 +197,7 @@ class ResourceResolver {
|
|
|
184
197
|
return (0, ts_utils_1.fail)(`${conditionSetIndex}: error creating condition set resolution result: ${err}`);
|
|
185
198
|
});
|
|
186
199
|
}
|
|
200
|
+
/* c8 ignore next 3 - edge case: matchAsDefault fallback logic rarely triggered */
|
|
187
201
|
if (conditionResult.matchType === 'matchAsDefault') {
|
|
188
202
|
matchType = 'matchAsDefault';
|
|
189
203
|
}
|
|
@@ -245,6 +259,7 @@ class ResourceResolver {
|
|
|
245
259
|
});
|
|
246
260
|
}
|
|
247
261
|
else if (resolution.matchType === 'matchAsDefault') {
|
|
262
|
+
/* c8 ignore next 4 - edge case: default matching instances rarely used in practice */
|
|
248
263
|
matchingDefaultInstanceResults.push({
|
|
249
264
|
index: instanceIndex,
|
|
250
265
|
result: resolution
|
|
@@ -268,15 +283,14 @@ class ResourceResolver {
|
|
|
268
283
|
(_c = this._listener) === null || _c === void 0 ? void 0 : _c.onCacheMiss('decision', decisionIndex);
|
|
269
284
|
return (0, ts_utils_1.succeed)(successResult);
|
|
270
285
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
resolveResource(resource) {
|
|
286
|
+
resolveResource(idOrResource) {
|
|
287
|
+
/* c8 ignore next 4 - defensive coding: string resource resolution should use direct resource calls */
|
|
288
|
+
if (typeof idOrResource === 'string') {
|
|
289
|
+
return this.resourceManager
|
|
290
|
+
.getBuiltResource(idOrResource)
|
|
291
|
+
.onSuccess((resource) => this.resolveResource(resource));
|
|
292
|
+
}
|
|
293
|
+
const resource = idOrResource;
|
|
280
294
|
// Get the abstract decision from the resource's concrete decision
|
|
281
295
|
const abstractDecision = resource.decision.baseDecision;
|
|
282
296
|
// Resolve the decision to get candidate indices in priority order
|
|
@@ -301,15 +315,14 @@ class ResourceResolver {
|
|
|
301
315
|
const bestCandidate = resource.candidates[candidateIndex];
|
|
302
316
|
return (0, ts_utils_1.succeed)(bestCandidate);
|
|
303
317
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
resolveAllResourceCandidates(resource) {
|
|
318
|
+
resolveAllResourceCandidates(idOrResource) {
|
|
319
|
+
/* c8 ignore next 4 - defensive coding: string resource resolution should use direct resource calls */
|
|
320
|
+
if (typeof idOrResource === 'string') {
|
|
321
|
+
return this.resourceManager
|
|
322
|
+
.getBuiltResource(idOrResource)
|
|
323
|
+
.onSuccess((resource) => this.resolveAllResourceCandidates(resource));
|
|
324
|
+
}
|
|
325
|
+
const resource = idOrResource;
|
|
313
326
|
// Get the abstract decision from the resource's concrete decision
|
|
314
327
|
const abstractDecision = resource.decision.baseDecision;
|
|
315
328
|
// Resolve the decision to get candidate indices in priority order
|
|
@@ -345,16 +358,14 @@ class ResourceResolver {
|
|
|
345
358
|
}
|
|
346
359
|
return (0, ts_utils_1.succeed)(candidates);
|
|
347
360
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
*/
|
|
357
|
-
resolveComposedResourceValue(resource) {
|
|
361
|
+
resolveComposedResourceValue(idOrResource) {
|
|
362
|
+
/* c8 ignore next 4 - defensive coding: string resource resolution should use direct resource calls */
|
|
363
|
+
if (typeof idOrResource === 'string') {
|
|
364
|
+
return this.resourceManager
|
|
365
|
+
.getBuiltResource(idOrResource)
|
|
366
|
+
.onSuccess((resource) => this.resolveComposedResourceValue(resource));
|
|
367
|
+
}
|
|
368
|
+
const resource = idOrResource;
|
|
358
369
|
return this.resolveAllResourceCandidates(resource).onSuccess((candidates) => {
|
|
359
370
|
/* c8 ignore next 3 - defense in depth should never occur */
|
|
360
371
|
if (candidates.length === 0) {
|
|
@@ -415,6 +426,23 @@ class ResourceResolver {
|
|
|
415
426
|
.withErrorFormat((err) => `${resource.id}: Composition failed: ${err}`);
|
|
416
427
|
});
|
|
417
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* {@inheritDoc IResourceResolver.withContext}
|
|
431
|
+
*/
|
|
432
|
+
withContext(context) {
|
|
433
|
+
const { resourceManager, qualifierTypes, options } = this;
|
|
434
|
+
return context_1.ValidatingSimpleContextQualifierProvider.create({
|
|
435
|
+
qualifiers: this.qualifiers,
|
|
436
|
+
qualifierValues: context
|
|
437
|
+
}).onSuccess((contextQualifierProvider) => {
|
|
438
|
+
return ResourceResolver.create({
|
|
439
|
+
resourceManager,
|
|
440
|
+
qualifierTypes,
|
|
441
|
+
options,
|
|
442
|
+
contextQualifierProvider
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}
|
|
418
446
|
/**
|
|
419
447
|
* Clears all caches (condition, condition set, and decision), forcing all cached items
|
|
420
448
|
* to be re-evaluated on next access. This should be called when the context changes and cached
|