@fgv/ts-res 5.0.0-8 → 5.0.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +21 -0
- package/CHANGELOG.md +14 -1
- package/README.md +794 -137
- package/dist/ts-res.d.ts +2533 -334
- package/dist/tsdoc-metadata.json +1 -1
- package/eslint.config.js +16 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +8 -1
- package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
- package/lib/packlets/bundle/bundleBuilder.js +134 -0
- package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
- package/lib/packlets/bundle/bundleLoader.js +105 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
- package/lib/packlets/bundle/bundleNormalizer.js +142 -0
- package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
- package/lib/packlets/bundle/bundleUtils.js +117 -0
- package/lib/packlets/bundle/convert.d.ts +33 -0
- package/lib/packlets/bundle/convert.js +78 -0
- package/lib/packlets/bundle/index.d.ts +21 -0
- package/lib/packlets/bundle/index.js +83 -0
- package/lib/packlets/bundle/model.d.ts +100 -0
- package/lib/packlets/bundle/model.js +24 -0
- package/lib/packlets/common/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 +40 -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/index.d.ts +2 -0
- package/lib/packlets/resources/index.js +2 -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 +142 -11
- package/lib/packlets/resources/resourceManagerBuilder.js +314 -45
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +23 -11
- package/lib/packlets/runtime/compiledResourceCollection.js +65 -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 +13 -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 +39 -1
- package/lib/packlets/runtime/resourceResolver.js +50 -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/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
|
@@ -75,14 +75,14 @@ const Context = __importStar(require("../context"));
|
|
|
75
75
|
*/
|
|
76
76
|
class CompiledResourceCollection {
|
|
77
77
|
/**
|
|
78
|
-
* A {@link QualifierTypes.
|
|
78
|
+
* A {@link QualifierTypes.ReadOnlyQualifierTypeCollector | ReadOnlyQualifierTypeCollector} which
|
|
79
79
|
* contains the {@link QualifierTypes.QualifierType | qualifier types} used in this collection.
|
|
80
80
|
*/
|
|
81
81
|
get qualifierTypes() {
|
|
82
82
|
return this._qualifierTypes;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* A {@link Qualifiers.
|
|
85
|
+
* A {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} which
|
|
86
86
|
* contains the {@link Qualifiers.Qualifier | qualifiers} used in this collection.
|
|
87
87
|
*/
|
|
88
88
|
get qualifiers() {
|
|
@@ -95,6 +95,12 @@ class CompiledResourceCollection {
|
|
|
95
95
|
get resourceTypes() {
|
|
96
96
|
return this._resourceTypes;
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* The candidate values in the collection.
|
|
100
|
+
*/
|
|
101
|
+
get candidateValues() {
|
|
102
|
+
return this._candidateValues;
|
|
103
|
+
}
|
|
98
104
|
/**
|
|
99
105
|
* {@inheritdoc Runtime.IResourceManager.builtResources}
|
|
100
106
|
*/
|
|
@@ -133,6 +139,7 @@ class CompiledResourceCollection {
|
|
|
133
139
|
this.conditions = conditionCollector;
|
|
134
140
|
this.conditionSets = conditionSetCollector;
|
|
135
141
|
this.decisions = decisionCollector;
|
|
142
|
+
this._candidateValues = [...params.compiledCollection.candidateValues];
|
|
136
143
|
// Build resources from compiled data
|
|
137
144
|
this._builtResources = this._buildResources(params.compiledCollection, this._resourceTypes, decisionCollector).orThrow();
|
|
138
145
|
}
|
|
@@ -257,6 +264,7 @@ class CompiledResourceCollection {
|
|
|
257
264
|
const conditionCollector = conditionCollectorResult.value;
|
|
258
265
|
for (const [index, compiledCondition] of compiled.conditions.entries()) {
|
|
259
266
|
const qualifierResult = qualifiers.getAt(compiledCondition.qualifierIndex);
|
|
267
|
+
/* c8 ignore next 5 - defensive coding: invalid qualifier index should not occur in compiled data */
|
|
260
268
|
if (qualifierResult.isFailure()) {
|
|
261
269
|
errors.addMessage(`Invalid qualifier index ${compiledCondition.qualifierIndex} at condition ${index}: ${qualifierResult.message}`);
|
|
262
270
|
continue;
|
|
@@ -354,6 +362,7 @@ class CompiledResourceCollection {
|
|
|
354
362
|
const decisionCollector = decisionCollectorResult.value;
|
|
355
363
|
for (const [index, compiledDecision] of compiled.decisions.entries()) {
|
|
356
364
|
const referencedConditionSetsResult = (0, ts_utils_1.mapResults)(compiledDecision.conditionSets.map((conditionSetIndex) => conditionSets.getAt(conditionSetIndex)));
|
|
365
|
+
/* c8 ignore next 5 - defensive coding: condition set resolution should not fail with valid compiled data */
|
|
357
366
|
if (referencedConditionSetsResult.isFailure()) {
|
|
358
367
|
errors.addMessage(`Failed to resolve condition sets for decision ${index}: ${referencedConditionSetsResult.message}`);
|
|
359
368
|
continue;
|
|
@@ -381,6 +390,22 @@ class CompiledResourceCollection {
|
|
|
381
390
|
}
|
|
382
391
|
return errors.hasMessages ? (0, ts_utils_1.fail)(errors.toString()) : (0, ts_utils_1.succeed)(decisionCollector);
|
|
383
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Gets a candidate value from the collection.
|
|
395
|
+
* @param valueIndex - The index of the candidate value to get.
|
|
396
|
+
* @returns
|
|
397
|
+
*/
|
|
398
|
+
_getCandidateValue(valueIndex) {
|
|
399
|
+
/* c8 ignore next 3 - defensive coding: candidate value index should be valid in compiled data */
|
|
400
|
+
if (valueIndex < 0 || valueIndex >= this._candidateValues.length) {
|
|
401
|
+
return (0, ts_utils_1.fail)(`Invalid candidate value index ${valueIndex}`);
|
|
402
|
+
}
|
|
403
|
+
/* c8 ignore next 3 - defensive coding for invalid candidate value conversion */
|
|
404
|
+
if (!(0, ts_json_base_1.isJsonObject)(this._candidateValues[valueIndex])) {
|
|
405
|
+
return (0, ts_utils_1.fail)(`${valueIndex}: candidate value not a JSON object.`);
|
|
406
|
+
}
|
|
407
|
+
return (0, ts_utils_1.succeed)(this._candidateValues[valueIndex]);
|
|
408
|
+
}
|
|
384
409
|
/**
|
|
385
410
|
* Reconstructs a ValidatingResultMap of resources from compiled data.
|
|
386
411
|
* @param compiled - The compiled resource collection
|
|
@@ -400,66 +425,78 @@ class CompiledResourceCollection {
|
|
|
400
425
|
})
|
|
401
426
|
});
|
|
402
427
|
for (const compiledResource of compiled.resources) {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
428
|
+
const resourceType = resourceTypes
|
|
429
|
+
.getAt(compiledResource.type)
|
|
430
|
+
.aggregateError(errors, (message) => `Invalid resource type index ${compiledResource.type} for resource ${compiledResource.id}: ${message}`)
|
|
431
|
+
.orDefault();
|
|
432
|
+
/* c8 ignore next 3 - defensive coding: resource type index should be valid in compiled data */
|
|
433
|
+
if (resourceType === undefined) {
|
|
406
434
|
continue;
|
|
407
435
|
}
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
436
|
+
const decision = decisions
|
|
437
|
+
.getAt(compiledResource.decision)
|
|
438
|
+
.aggregateError(errors, (message) => `Invalid decision index ${compiledResource.decision} for resource ${compiledResource.id}: ${message}`)
|
|
439
|
+
.orDefault();
|
|
440
|
+
/* c8 ignore next 3 - defensive coding: decision index should be valid in compiled data */
|
|
441
|
+
if (decision === undefined) {
|
|
412
442
|
continue;
|
|
413
443
|
}
|
|
414
|
-
const decision = decisionResult.value;
|
|
415
444
|
// Build candidates from compiled data
|
|
416
|
-
const
|
|
445
|
+
const candidateDecls = (0, ts_utils_1.mapResults)(compiledResource.candidates.map((compiledCandidate) => this._getCandidateValue(compiledCandidate.valueIndex)
|
|
446
|
+
.aggregateError(errors, (message) => `Failed to convert candidate JSON for resource ${compiledResource.id}: ${message}`)
|
|
447
|
+
.onSuccess((json) => {
|
|
417
448
|
return (0, ts_utils_1.succeed)({
|
|
418
449
|
json,
|
|
419
450
|
isPartial: compiledCandidate.isPartial,
|
|
420
451
|
mergeMethod: compiledCandidate.mergeMethod
|
|
421
452
|
});
|
|
422
|
-
})))
|
|
423
|
-
|
|
424
|
-
|
|
453
|
+
})))
|
|
454
|
+
.aggregateError(errors, (message) => `Failed to convert candidate JSON for resource ${compiledResource.id}: ${message}`)
|
|
455
|
+
.orDefault();
|
|
456
|
+
/* c8 ignore next 3 - defensive coding: candidate JSON conversion should not fail with valid compiled data */
|
|
457
|
+
if (candidateDecls === undefined) {
|
|
425
458
|
continue;
|
|
426
459
|
}
|
|
427
|
-
const candidateDecls = candidateDeclsResult.value;
|
|
428
460
|
// Create minimal candidates that implement IResourceCandidate
|
|
429
461
|
const candidates = candidateDecls.map((candidateDecl) => ({
|
|
430
462
|
json: candidateDecl.json,
|
|
431
463
|
isPartial: candidateDecl.isPartial,
|
|
432
464
|
mergeMethod: candidateDecl.mergeMethod
|
|
433
465
|
}));
|
|
434
|
-
// Create a ConcreteDecision from the abstract decision and candidate values
|
|
435
466
|
const candidatesWithConditionSets = decision.candidates.map((baseCandidate, idx) => ({
|
|
436
467
|
conditionSet: baseCandidate.conditionSet,
|
|
437
468
|
value: candidates[idx].json
|
|
438
469
|
}));
|
|
439
|
-
const
|
|
470
|
+
const concreteDecision = decisions_2.ConcreteDecision.create({
|
|
440
471
|
decisions,
|
|
441
472
|
candidates: candidatesWithConditionSets
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
473
|
+
})
|
|
474
|
+
.aggregateError(errors, (message) => `Failed to create concrete decision for resource ${compiledResource.id}: ${message}`)
|
|
475
|
+
.orDefault();
|
|
476
|
+
/* c8 ignore next 3 - defensive coding for ConcreteDecision creation failure */
|
|
477
|
+
if (concreteDecision === undefined) {
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
const name = common_1.Helpers.getNameForResourceId(compiledResource.id)
|
|
481
|
+
.aggregateError(errors, (message) => `Failed to get name for resource ${compiledResource.id}: ${message}`)
|
|
482
|
+
.orDefault();
|
|
483
|
+
/* c8 ignore next 3 - defensive coding: name should be valid in compiled data */
|
|
484
|
+
if (name === undefined) {
|
|
446
485
|
continue;
|
|
447
486
|
}
|
|
448
|
-
const concreteDecision = concreteDecisionResult.value;
|
|
449
487
|
// Create minimal resource that implements IResource
|
|
450
488
|
const resource = {
|
|
451
489
|
id: compiledResource.id,
|
|
490
|
+
name,
|
|
452
491
|
resourceType,
|
|
453
492
|
decision: concreteDecision,
|
|
454
493
|
candidates
|
|
455
494
|
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
errors.addMessage(`Failed to add resource ${compiledResource.id}: ${setResult.message}`);
|
|
460
|
-
}
|
|
495
|
+
resourceMap
|
|
496
|
+
.set(compiledResource.id, resource)
|
|
497
|
+
.aggregateError(errors, (message) => `Failed to add resource ${compiledResource.id}: ${message}`);
|
|
461
498
|
}
|
|
462
|
-
return errors.
|
|
499
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)(resourceMap));
|
|
463
500
|
}
|
|
464
501
|
}
|
|
465
502
|
exports.CompiledResourceCollection = CompiledResourceCollection;
|
|
@@ -72,6 +72,7 @@ class ConditionSetResolutionResult {
|
|
|
72
72
|
return -1;
|
|
73
73
|
}
|
|
74
74
|
else if (a.matchType === 'matchAsDefault') {
|
|
75
|
+
/* c8 ignore next 5 - edge case comparison for matchAsDefault rarely hit in practice */
|
|
75
76
|
if (b.matchType === 'match') {
|
|
76
77
|
return 1;
|
|
77
78
|
}
|
|
@@ -80,6 +81,7 @@ class ConditionSetResolutionResult {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
else {
|
|
84
|
+
/* c8 ignore next 7 - edge case comparison for noMatch rarely hit in practice */
|
|
83
85
|
// a.matchType === 'noMatch'
|
|
84
86
|
if (b.matchType === 'noMatch') {
|
|
85
87
|
return 0;
|
|
@@ -100,6 +102,7 @@ class ConditionSetResolutionResult {
|
|
|
100
102
|
}
|
|
101
103
|
// If priority matches, compare score
|
|
102
104
|
const scoreDiff = matchB.score - matchA.score;
|
|
105
|
+
/* c8 ignore next 3 - edge case: score comparison when priorities are equal */
|
|
103
106
|
if (scoreDiff !== 0) {
|
|
104
107
|
return scoreDiff;
|
|
105
108
|
}
|
|
@@ -2,11 +2,12 @@ import { Result } from '@fgv/ts-utils';
|
|
|
2
2
|
import { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';
|
|
3
3
|
import { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Base interface for providing qualifier values in an optimized runtime context.
|
|
6
|
+
* Contains common read-only operations shared by both mutable and immutable providers.
|
|
6
7
|
* Acts as a property bag using the Result pattern for qualifier value lookups.
|
|
7
8
|
* @public
|
|
8
9
|
*/
|
|
9
|
-
export interface
|
|
10
|
+
export interface IContextQualifierProviderBase {
|
|
10
11
|
/**
|
|
11
12
|
* Gets a qualifier value by its name, index, or qualifier object.
|
|
12
13
|
* @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
|
|
@@ -39,12 +40,61 @@ export interface IContextQualifierProvider {
|
|
|
39
40
|
*/
|
|
40
41
|
readonly qualifiers: IReadOnlyQualifierCollector;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Read-only interface for providing qualifier values in an optimized runtime context.
|
|
45
|
+
* Explicitly marked as immutable with compile-time type discrimination.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export interface IReadOnlyContextQualifierProvider extends IContextQualifierProviderBase {
|
|
49
|
+
/**
|
|
50
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
51
|
+
* Always `false` for read-only providers.
|
|
52
|
+
*/
|
|
53
|
+
readonly mutable: false;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Mutable interface for providing qualifier values in an optimized runtime context.
|
|
57
|
+
* Extends the base interface with mutation operations and explicit mutability marker.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export interface IMutableContextQualifierProvider extends IContextQualifierProviderBase {
|
|
61
|
+
/**
|
|
62
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
63
|
+
* Always `true` for mutable providers.
|
|
64
|
+
*/
|
|
65
|
+
readonly mutable: true;
|
|
66
|
+
/**
|
|
67
|
+
* Sets a qualifier value in this provider.
|
|
68
|
+
* @param name - The {@link QualifierName | qualifier name} to set.
|
|
69
|
+
* @param value - The {@link QualifierContextValue | qualifier context value} to set.
|
|
70
|
+
* @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
|
|
71
|
+
* or `Failure` with an error message if not.
|
|
72
|
+
*/
|
|
73
|
+
set(name: QualifierName, value: QualifierContextValue): Result<QualifierContextValue>;
|
|
74
|
+
/**
|
|
75
|
+
* Removes a qualifier value from this provider.
|
|
76
|
+
* @param name - The {@link QualifierName | qualifier name} to remove.
|
|
77
|
+
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
78
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
79
|
+
*/
|
|
80
|
+
remove(name: QualifierName): Result<QualifierContextValue>;
|
|
81
|
+
/**
|
|
82
|
+
* Clears all qualifier values from this provider.
|
|
83
|
+
*/
|
|
84
|
+
clear(): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Union type for context qualifier providers that can be either read-only or mutable.
|
|
88
|
+
* Provides compile-time type discrimination via the `mutable` property.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
export type IContextQualifierProvider = IReadOnlyContextQualifierProvider | IMutableContextQualifierProvider;
|
|
42
92
|
/**
|
|
43
93
|
* Abstract base class for implementing context qualifier providers.
|
|
44
94
|
* Provides common functionality and enforces the contract for derived classes.
|
|
45
95
|
* @public
|
|
46
96
|
*/
|
|
47
|
-
export declare abstract class ContextQualifierProvider implements
|
|
97
|
+
export declare abstract class ContextQualifierProvider implements IContextQualifierProviderBase {
|
|
48
98
|
/**
|
|
49
99
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
50
100
|
*/
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Result } from '@fgv/ts-utils';
|
|
2
2
|
import { QualifierContextValue } from '../../common';
|
|
3
3
|
import { IReadOnlyQualifierCollector } from '../../qualifiers';
|
|
4
|
-
import { IContextQualifierProvider } from './contextQualifierProvider';
|
|
4
|
+
import { IContextQualifierProvider, IReadOnlyContextQualifierProvider, IMutableContextQualifierProvider } from './contextQualifierProvider';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Base interface for shared operations between read-only and mutable context qualifier provider validators.
|
|
7
|
+
* Contains common methods that don't depend on provider mutability.
|
|
7
8
|
* @public
|
|
8
9
|
*/
|
|
9
|
-
export interface
|
|
10
|
+
export interface IContextQualifierProviderValidatorBase<T extends IContextQualifierProvider = IContextQualifierProvider> {
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* The wrapped context qualifier provider.
|
|
12
13
|
*/
|
|
13
|
-
readonly provider:
|
|
14
|
+
readonly provider: T;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
16
17
|
*/
|
|
17
18
|
readonly qualifiers: IReadOnlyQualifierCollector;
|
|
18
19
|
/**
|
|
@@ -50,6 +51,28 @@ export interface IReadOnlyContextQualifierProviderValidator {
|
|
|
50
51
|
* or `Failure` with an error message if an error occurs during the check.
|
|
51
52
|
*/
|
|
52
53
|
has(name: string): Result<boolean>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A read-only interface for validators wrapping read-only context qualifier providers.
|
|
57
|
+
* Only exposes read operations, providing compile-time type safety by excluding mutation methods.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export interface IReadOnlyContextQualifierProviderValidator<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> {
|
|
61
|
+
/**
|
|
62
|
+
* The wrapped read-only context qualifier provider.
|
|
63
|
+
*/
|
|
64
|
+
readonly provider: T;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A mutable interface for validators wrapping mutable context qualifier providers.
|
|
68
|
+
* Extends the base interface with mutation operations and provides compile-time type safety.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export interface IMutableContextQualifierProviderValidator<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> extends IContextQualifierProviderValidatorBase<T> {
|
|
72
|
+
/**
|
|
73
|
+
* The wrapped mutable context qualifier provider.
|
|
74
|
+
*/
|
|
75
|
+
readonly provider: T;
|
|
53
76
|
/**
|
|
54
77
|
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
55
78
|
* @param name - The string name to convert.
|
|
@@ -67,32 +90,37 @@ export interface IReadOnlyContextQualifierProviderValidator {
|
|
|
67
90
|
remove(name: string): Result<QualifierContextValue>;
|
|
68
91
|
}
|
|
69
92
|
/**
|
|
70
|
-
* Parameters for constructing a
|
|
93
|
+
* Parameters for constructing a read-only context qualifier provider validator.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export interface IReadOnlyContextQualifierProviderValidatorCreateParams<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> {
|
|
97
|
+
provider: T;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Parameters for constructing a mutable context qualifier provider validator.
|
|
71
101
|
* @public
|
|
72
102
|
*/
|
|
73
|
-
export interface
|
|
74
|
-
provider:
|
|
103
|
+
export interface IMutableContextQualifierProviderValidatorCreateParams<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> {
|
|
104
|
+
provider: T;
|
|
75
105
|
}
|
|
76
106
|
/**
|
|
77
|
-
*
|
|
78
|
-
* string inputs and converts them to strongly-typed values before calling the wrapped provider.
|
|
79
|
-
* This eliminates the need for type casting in consumer code while maintaining type safety.
|
|
107
|
+
* Union type for validator constructor parameters.
|
|
80
108
|
* @public
|
|
81
109
|
*/
|
|
82
|
-
export
|
|
110
|
+
export type IContextQualifierProviderValidatorCreateParams = IReadOnlyContextQualifierProviderValidatorCreateParams | IMutableContextQualifierProviderValidatorCreateParams;
|
|
111
|
+
/**
|
|
112
|
+
* Base implementation class containing shared validation logic for both read-only and mutable validators.
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
declare abstract class BaseContextQualifierProviderValidator<T extends IContextQualifierProvider = IContextQualifierProvider> implements IContextQualifierProviderValidatorBase<T> {
|
|
83
116
|
/**
|
|
84
117
|
* The wrapped context qualifier provider.
|
|
85
118
|
*/
|
|
86
|
-
readonly provider:
|
|
119
|
+
abstract readonly provider: T;
|
|
87
120
|
/**
|
|
88
121
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
89
122
|
*/
|
|
90
123
|
get qualifiers(): IReadOnlyQualifierCollector;
|
|
91
|
-
/**
|
|
92
|
-
* Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
|
|
93
|
-
* @param params - Required parameters for constructing the validator.
|
|
94
|
-
*/
|
|
95
|
-
constructor(params: IContextQualifierProviderValidatorCreateParams);
|
|
96
124
|
/**
|
|
97
125
|
* Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
|
|
98
126
|
* @param name - The string name to convert and look up.
|
|
@@ -128,6 +156,40 @@ export declare class ContextQualifierProviderValidator implements IReadOnlyConte
|
|
|
128
156
|
* or `Failure` with an error message if an error occurs during the check.
|
|
129
157
|
*/
|
|
130
158
|
has(name: string): Result<boolean>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A validator for read-only context qualifier providers that accepts string inputs
|
|
162
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
163
|
+
* Only provides read operations for compile-time type safety.
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
export declare class ReadOnlyContextQualifierProviderValidator<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> extends BaseContextQualifierProviderValidator<T> implements IReadOnlyContextQualifierProviderValidator<T> {
|
|
167
|
+
/**
|
|
168
|
+
* The wrapped read-only context qualifier provider.
|
|
169
|
+
*/
|
|
170
|
+
readonly provider: T;
|
|
171
|
+
/**
|
|
172
|
+
* Constructs a new {@link Runtime.Context.ReadOnlyContextQualifierProviderValidator | ReadOnlyContextQualifierProviderValidator}.
|
|
173
|
+
* @param params - Required parameters for constructing the validator.
|
|
174
|
+
*/
|
|
175
|
+
constructor(params: IReadOnlyContextQualifierProviderValidatorCreateParams<T>);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* A validator for mutable context qualifier providers that accepts string inputs
|
|
179
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
180
|
+
* Provides both read and mutation operations.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
export declare class MutableContextQualifierProviderValidator<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> extends BaseContextQualifierProviderValidator<T> implements IMutableContextQualifierProviderValidator<T> {
|
|
184
|
+
/**
|
|
185
|
+
* The wrapped mutable context qualifier provider.
|
|
186
|
+
*/
|
|
187
|
+
readonly provider: T;
|
|
188
|
+
/**
|
|
189
|
+
* Constructs a new {@link Runtime.Context.MutableContextQualifierProviderValidator | MutableContextQualifierProviderValidator}.
|
|
190
|
+
* @param params - Required parameters for constructing the validator.
|
|
191
|
+
*/
|
|
192
|
+
constructor(params: IMutableContextQualifierProviderValidatorCreateParams<T>);
|
|
131
193
|
/**
|
|
132
194
|
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
133
195
|
* @param name - The string name to convert.
|
|
@@ -143,23 +205,6 @@ export declare class ContextQualifierProviderValidator implements IReadOnlyConte
|
|
|
143
205
|
* or `Failure` with an error message if an error occurs.
|
|
144
206
|
*/
|
|
145
207
|
remove(name: string): Result<QualifierContextValue>;
|
|
146
|
-
/**
|
|
147
|
-
* Validates a string as a QualifierName.
|
|
148
|
-
* @param name - The string to validate.
|
|
149
|
-
* @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.
|
|
150
|
-
*/
|
|
151
|
-
private _validateQualifierName;
|
|
152
|
-
/**
|
|
153
|
-
* Validates a number as a QualifierIndex.
|
|
154
|
-
* @param index - The number to validate.
|
|
155
|
-
* @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.
|
|
156
|
-
*/
|
|
157
|
-
private _validateQualifierIndex;
|
|
158
|
-
/**
|
|
159
|
-
* Validates a string as a QualifierContextValue.
|
|
160
|
-
* @param value - The string to validate.
|
|
161
|
-
* @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.
|
|
162
|
-
*/
|
|
163
|
-
private _validateQualifierContextValue;
|
|
164
208
|
}
|
|
209
|
+
export {};
|
|
165
210
|
//# sourceMappingURL=contextQualifierProviderValidator.d.ts.map
|
|
@@ -21,28 +21,20 @@
|
|
|
21
21
|
* SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.
|
|
24
|
+
exports.MutableContextQualifierProviderValidator = exports.ReadOnlyContextQualifierProviderValidator = void 0;
|
|
25
25
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
const common_1 = require("../../common");
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* This eliminates the need for type casting in consumer code while maintaining type safety.
|
|
30
|
-
* @public
|
|
28
|
+
* Base implementation class containing shared validation logic for both read-only and mutable validators.
|
|
29
|
+
* @internal
|
|
31
30
|
*/
|
|
32
|
-
class
|
|
31
|
+
class BaseContextQualifierProviderValidator {
|
|
33
32
|
/**
|
|
34
33
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
35
34
|
*/
|
|
36
35
|
get qualifiers() {
|
|
37
36
|
return this.provider.qualifiers;
|
|
38
37
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
|
|
41
|
-
* @param params - Required parameters for constructing the validator.
|
|
42
|
-
*/
|
|
43
|
-
constructor(params) {
|
|
44
|
-
this.provider = params.provider;
|
|
45
|
-
}
|
|
46
38
|
/**
|
|
47
39
|
* Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
|
|
48
40
|
* @param name - The string name to convert and look up.
|
|
@@ -50,7 +42,7 @@ class ContextQualifierProviderValidator {
|
|
|
50
42
|
* or `Failure` with an error message if not found or an error occurs.
|
|
51
43
|
*/
|
|
52
44
|
get(name) {
|
|
53
|
-
return
|
|
45
|
+
return common_1.Convert.qualifierName.convert(name).onSuccess((qualifierName) => {
|
|
54
46
|
return this.provider.get(qualifierName);
|
|
55
47
|
});
|
|
56
48
|
}
|
|
@@ -61,7 +53,7 @@ class ContextQualifierProviderValidator {
|
|
|
61
53
|
* or `Failure` with an error message if not found or an error occurs.
|
|
62
54
|
*/
|
|
63
55
|
getByIndex(index) {
|
|
64
|
-
return
|
|
56
|
+
return common_1.Convert.qualifierIndex.convert(index).onSuccess((qualifierIndex) => {
|
|
65
57
|
return this.provider.get(qualifierIndex);
|
|
66
58
|
});
|
|
67
59
|
}
|
|
@@ -72,7 +64,7 @@ class ContextQualifierProviderValidator {
|
|
|
72
64
|
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
73
65
|
*/
|
|
74
66
|
getValidated(name) {
|
|
75
|
-
return
|
|
67
|
+
return common_1.Convert.qualifierName.convert(name).onSuccess((qualifierName) => {
|
|
76
68
|
return this.provider.getValidated(qualifierName);
|
|
77
69
|
});
|
|
78
70
|
}
|
|
@@ -83,7 +75,7 @@ class ContextQualifierProviderValidator {
|
|
|
83
75
|
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
84
76
|
*/
|
|
85
77
|
getValidatedByIndex(index) {
|
|
86
|
-
return
|
|
78
|
+
return common_1.Convert.qualifierIndex.convert(index).onSuccess((qualifierIndex) => {
|
|
87
79
|
return this.provider.getValidated(qualifierIndex);
|
|
88
80
|
});
|
|
89
81
|
}
|
|
@@ -94,10 +86,43 @@ class ContextQualifierProviderValidator {
|
|
|
94
86
|
* or `Failure` with an error message if an error occurs during the check.
|
|
95
87
|
*/
|
|
96
88
|
has(name) {
|
|
97
|
-
return
|
|
89
|
+
return common_1.Convert.qualifierName.convert(name).onSuccess((qualifierName) => {
|
|
98
90
|
return this.provider.has(qualifierName);
|
|
99
91
|
});
|
|
100
92
|
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A validator for read-only context qualifier providers that accepts string inputs
|
|
96
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
97
|
+
* Only provides read operations for compile-time type safety.
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
class ReadOnlyContextQualifierProviderValidator extends BaseContextQualifierProviderValidator {
|
|
101
|
+
/**
|
|
102
|
+
* Constructs a new {@link Runtime.Context.ReadOnlyContextQualifierProviderValidator | ReadOnlyContextQualifierProviderValidator}.
|
|
103
|
+
* @param params - Required parameters for constructing the validator.
|
|
104
|
+
*/
|
|
105
|
+
constructor(params) {
|
|
106
|
+
super();
|
|
107
|
+
this.provider = params.provider;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.ReadOnlyContextQualifierProviderValidator = ReadOnlyContextQualifierProviderValidator;
|
|
111
|
+
/**
|
|
112
|
+
* A validator for mutable context qualifier providers that accepts string inputs
|
|
113
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
114
|
+
* Provides both read and mutation operations.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
class MutableContextQualifierProviderValidator extends BaseContextQualifierProviderValidator {
|
|
118
|
+
/**
|
|
119
|
+
* Constructs a new {@link Runtime.Context.MutableContextQualifierProviderValidator | MutableContextQualifierProviderValidator}.
|
|
120
|
+
* @param params - Required parameters for constructing the validator.
|
|
121
|
+
*/
|
|
122
|
+
constructor(params) {
|
|
123
|
+
super();
|
|
124
|
+
this.provider = params.provider;
|
|
125
|
+
}
|
|
101
126
|
/**
|
|
102
127
|
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
103
128
|
* @param name - The string name to convert.
|
|
@@ -106,20 +131,9 @@ class ContextQualifierProviderValidator {
|
|
|
106
131
|
* or `Failure` with an error message if an error occurs.
|
|
107
132
|
*/
|
|
108
133
|
set(name, value) {
|
|
109
|
-
return this.
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
// Check if the provider has a set method (only available on mutable providers)
|
|
113
|
-
if ('set' in this.provider && typeof this.provider.set === 'function') {
|
|
114
|
-
try {
|
|
115
|
-
return this.provider.set(name, qualifierValue);
|
|
116
|
-
}
|
|
117
|
-
catch (_a) {
|
|
118
|
-
return (0, ts_utils_1.fail)(`Provider does not support setting values`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return (0, ts_utils_1.fail)(`Provider does not support setting values`);
|
|
122
|
-
});
|
|
134
|
+
return common_1.Convert.qualifierName.convert(name).onSuccess((qualifierName) => this.provider.qualifiers.validating.get(name).asResult.onSuccess((qualifier) => ts_utils_1.Converters.string.convert(value).onSuccess((stringValue) => qualifier.validateContextValue(stringValue).onSuccess((qualifierValue) => {
|
|
135
|
+
return (0, ts_utils_1.captureResult)(() => this.provider.set(qualifierName, qualifierValue)).onSuccess((result) => result);
|
|
136
|
+
}))));
|
|
123
137
|
}
|
|
124
138
|
/**
|
|
125
139
|
* Removes a qualifier value using string input, converting to strongly-typed QualifierName.
|
|
@@ -128,52 +142,10 @@ class ContextQualifierProviderValidator {
|
|
|
128
142
|
* or `Failure` with an error message if an error occurs.
|
|
129
143
|
*/
|
|
130
144
|
remove(name) {
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
if ('remove' in this.provider && typeof this.provider.remove === 'function') {
|
|
134
|
-
try {
|
|
135
|
-
return this.provider.remove(qualifierName);
|
|
136
|
-
}
|
|
137
|
-
catch (_a) {
|
|
138
|
-
return (0, ts_utils_1.fail)(`Provider does not support removing values`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return (0, ts_utils_1.fail)(`Provider does not support removing values`);
|
|
145
|
+
return common_1.Convert.qualifierName.convert(name).onSuccess((qualifierName) => {
|
|
146
|
+
return (0, ts_utils_1.captureResult)(() => this.provider.remove(qualifierName)).onSuccess((result) => result);
|
|
142
147
|
});
|
|
143
148
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Validates a string as a QualifierName.
|
|
146
|
-
* @param name - The string to validate.
|
|
147
|
-
* @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.
|
|
148
|
-
*/
|
|
149
|
-
_validateQualifierName(name) {
|
|
150
|
-
if (typeof name !== 'string' || name.length === 0) {
|
|
151
|
-
return (0, ts_utils_1.fail)(`Invalid qualifier name: "${name}"`);
|
|
152
|
-
}
|
|
153
|
-
return (0, ts_utils_1.succeed)(name);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Validates a number as a QualifierIndex.
|
|
157
|
-
* @param index - The number to validate.
|
|
158
|
-
* @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.
|
|
159
|
-
*/
|
|
160
|
-
_validateQualifierIndex(index) {
|
|
161
|
-
if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {
|
|
162
|
-
return (0, ts_utils_1.fail)(`Invalid qualifier index: ${index}`);
|
|
163
|
-
}
|
|
164
|
-
return (0, ts_utils_1.succeed)(index);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Validates a string as a QualifierContextValue.
|
|
168
|
-
* @param value - The string to validate.
|
|
169
|
-
* @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.
|
|
170
|
-
*/
|
|
171
|
-
_validateQualifierContextValue(value) {
|
|
172
|
-
if (typeof value !== 'string') {
|
|
173
|
-
return (0, ts_utils_1.fail)(`Invalid qualifier context value: "${value}"`);
|
|
174
|
-
}
|
|
175
|
-
return (0, ts_utils_1.succeed)(value);
|
|
176
|
-
}
|
|
177
149
|
}
|
|
178
|
-
exports.
|
|
150
|
+
exports.MutableContextQualifierProviderValidator = MutableContextQualifierProviderValidator;
|
|
179
151
|
//# sourceMappingURL=contextQualifierProviderValidator.js.map
|