@fgv/ts-res 4.5.0-3 → 5.0.0-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +26 -0
- package/CHANGELOG.md +14 -0
- package/CLAUDE.md +186 -0
- package/EXAMPLE_INIT_PARAMS.md +88 -0
- package/PROGRESS_SUMMARY.md +48 -0
- package/README.md +535 -14
- package/dist/ts-res.d.ts +5253 -699
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +29 -2
- package/lib/index.js.map +1 -1
- package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
- package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleBuilder.js +134 -0
- package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
- package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
- package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleLoader.js +105 -0
- package/lib/packlets/bundle/bundleLoader.js.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.js +142 -0
- package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
- package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
- package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleUtils.js +117 -0
- package/lib/packlets/bundle/bundleUtils.js.map +1 -0
- package/lib/packlets/bundle/convert.d.ts +33 -0
- package/lib/packlets/bundle/convert.d.ts.map +1 -0
- package/lib/packlets/bundle/convert.js +78 -0
- package/lib/packlets/bundle/convert.js.map +1 -0
- package/lib/packlets/bundle/index.d.ts +21 -0
- package/lib/packlets/bundle/index.d.ts.map +1 -0
- package/lib/packlets/bundle/index.js +83 -0
- package/lib/packlets/bundle/index.js.map +1 -0
- package/lib/packlets/bundle/model.d.ts +100 -0
- package/lib/packlets/bundle/model.d.ts.map +1 -0
- package/lib/packlets/bundle/model.js +24 -0
- package/lib/packlets/bundle/model.js.map +1 -0
- package/lib/packlets/common/conditions.d.ts +30 -0
- package/lib/packlets/common/conditions.d.ts.map +1 -1
- package/lib/packlets/common/conditions.js.map +1 -1
- package/lib/packlets/common/convert.d.ts +22 -2
- package/lib/packlets/common/convert.d.ts.map +1 -1
- package/lib/packlets/common/convert.js +21 -1
- package/lib/packlets/common/convert.js.map +1 -1
- package/lib/packlets/common/helpers/context.d.ts +39 -0
- package/lib/packlets/common/helpers/context.d.ts.map +1 -0
- package/lib/packlets/common/helpers/context.js +108 -0
- package/lib/packlets/common/helpers/context.js.map +1 -0
- package/lib/packlets/common/helpers/index.d.ts +2 -0
- package/lib/packlets/common/helpers/index.d.ts.map +1 -1
- package/lib/packlets/common/helpers/index.js +2 -0
- package/lib/packlets/common/helpers/index.js.map +1 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts +39 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.js +105 -0
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
- package/lib/packlets/common/helpers/resources.d.ts.map +1 -1
- package/lib/packlets/common/helpers/resources.js +6 -2
- package/lib/packlets/common/helpers/resources.js.map +1 -1
- package/lib/packlets/common/resources.d.ts +8 -0
- package/lib/packlets/common/resources.d.ts.map +1 -1
- package/lib/packlets/common/resources.js.map +1 -1
- package/lib/packlets/common/validate/conditions.d.ts +69 -1
- package/lib/packlets/common/validate/conditions.d.ts.map +1 -1
- package/lib/packlets/common/validate/conditions.js +126 -0
- package/lib/packlets/common/validate/conditions.js.map +1 -1
- package/lib/packlets/common/validate/regularExpressions.d.ts +20 -0
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -1
- package/lib/packlets/common/validate/regularExpressions.js +21 -1
- package/lib/packlets/common/validate/regularExpressions.js.map +1 -1
- package/lib/packlets/conditions/condition.d.ts +37 -0
- package/lib/packlets/conditions/condition.d.ts.map +1 -1
- package/lib/packlets/conditions/condition.js +67 -1
- package/lib/packlets/conditions/condition.js.map +1 -1
- package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionCollector.js +1 -0
- package/lib/packlets/conditions/conditionCollector.js.map +1 -1
- package/lib/packlets/conditions/conditionSet.d.ts +43 -3
- package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionSet.js +104 -3
- package/lib/packlets/conditions/conditionSet.js.map +1 -1
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionSetCollector.js +3 -0
- package/lib/packlets/conditions/conditionSetCollector.js.map +1 -1
- package/lib/packlets/conditions/conditionToken.d.ts.map +1 -1
- package/lib/packlets/conditions/conditionToken.js +2 -1
- package/lib/packlets/conditions/conditionToken.js.map +1 -1
- package/lib/packlets/conditions/convert/decls.js +1 -1
- package/lib/packlets/conditions/convert/decls.js.map +1 -1
- package/lib/packlets/config/common.d.ts +35 -0
- package/lib/packlets/config/common.d.ts.map +1 -0
- package/lib/packlets/config/common.js +96 -0
- package/lib/packlets/config/common.js.map +1 -0
- package/lib/packlets/config/convert.d.ts +14 -0
- package/lib/packlets/config/convert.d.ts.map +1 -0
- package/lib/packlets/config/convert.js +82 -0
- package/lib/packlets/config/convert.js.map +1 -0
- package/lib/packlets/config/index.d.ts +6 -0
- package/lib/packlets/config/index.d.ts.map +1 -0
- package/lib/packlets/config/index.js +67 -0
- package/lib/packlets/config/index.js.map +1 -0
- package/lib/packlets/config/json.d.ts +20 -0
- package/lib/packlets/config/json.d.ts.map +1 -0
- package/lib/packlets/config/json.js +24 -0
- package/lib/packlets/config/json.js.map +1 -0
- package/lib/packlets/config/predefined/default.d.ts +57 -0
- package/lib/packlets/config/predefined/default.d.ts.map +1 -0
- package/lib/packlets/config/predefined/default.js +141 -0
- package/lib/packlets/config/predefined/default.js.map +1 -0
- package/lib/packlets/config/predefined/extended.d.ts +25 -0
- package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
- package/lib/packlets/config/predefined/extended.js +193 -0
- package/lib/packlets/config/predefined/extended.js.map +1 -0
- package/lib/packlets/config/predefined/index.d.ts +4 -0
- package/lib/packlets/config/predefined/index.d.ts.map +1 -0
- package/lib/packlets/config/predefined/index.js +62 -0
- package/lib/packlets/config/predefined/index.js.map +1 -0
- package/lib/packlets/config/systemConfiguration.d.ts +81 -0
- package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
- package/lib/packlets/config/systemConfiguration.js +172 -0
- package/lib/packlets/config/systemConfiguration.js.map +1 -0
- package/lib/packlets/context/contextDecls.d.ts +49 -0
- package/lib/packlets/context/contextDecls.d.ts.map +1 -0
- package/lib/packlets/context/contextDecls.js +24 -0
- package/lib/packlets/context/contextDecls.js.map +1 -0
- package/lib/packlets/context/contextToken.d.ts +111 -0
- package/lib/packlets/context/contextToken.d.ts.map +1 -0
- package/lib/packlets/context/contextToken.js +206 -0
- package/lib/packlets/context/contextToken.js.map +1 -0
- package/lib/packlets/context/convert/decls.d.ts +37 -0
- package/lib/packlets/context/convert/decls.d.ts.map +1 -0
- package/lib/packlets/context/convert/decls.js +94 -0
- package/lib/packlets/context/convert/decls.js.map +1 -0
- package/lib/packlets/context/convert/index.d.ts +2 -0
- package/lib/packlets/context/convert/index.d.ts.map +1 -0
- package/lib/packlets/context/convert/index.js +39 -0
- package/lib/packlets/context/convert/index.js.map +1 -0
- package/lib/packlets/context/index.d.ts +5 -0
- package/lib/packlets/context/index.d.ts.map +1 -0
- package/lib/packlets/context/index.js +65 -0
- package/lib/packlets/context/index.js.map +1 -0
- package/lib/packlets/decisions/abstractDecision.d.ts +8 -0
- package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -1
- package/lib/packlets/decisions/abstractDecision.js +9 -0
- package/lib/packlets/decisions/abstractDecision.js.map +1 -1
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -1
- package/lib/packlets/decisions/abstractDecisionCollector.js +2 -0
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -1
- package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -1
- package/lib/packlets/decisions/concreteDecision.js +1 -0
- package/lib/packlets/decisions/concreteDecision.js.map +1 -1
- package/lib/packlets/decisions/decision.d.ts.map +1 -1
- package/lib/packlets/decisions/decision.js +4 -0
- package/lib/packlets/decisions/decision.js.map +1 -1
- package/lib/packlets/import/fsItem.d.ts.map +1 -1
- package/lib/packlets/import/fsItem.js +8 -12
- package/lib/packlets/import/fsItem.js.map +1 -1
- package/lib/packlets/import/importContext.d.ts +19 -0
- package/lib/packlets/import/importContext.d.ts.map +1 -1
- package/lib/packlets/import/importContext.js +39 -0
- package/lib/packlets/import/importContext.js.map +1 -1
- package/lib/packlets/import/importManager.d.ts +5 -5
- package/lib/packlets/import/importManager.d.ts.map +1 -1
- package/lib/packlets/import/importManager.js.map +1 -1
- package/lib/packlets/import/importers/collectionImporter.d.ts +11 -13
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/collectionImporter.js +29 -20
- package/lib/packlets/import/importers/collectionImporter.js.map +1 -1
- package/lib/packlets/import/importers/fsItemImporter.d.ts +2 -2
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/fsItemImporter.js +2 -2
- package/lib/packlets/import/importers/fsItemImporter.js.map +1 -1
- package/lib/packlets/import/importers/importer.d.ts +3 -3
- package/lib/packlets/import/importers/importer.d.ts.map +1 -1
- package/lib/packlets/import/importers/importer.js.map +1 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts +2 -3
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/jsonImporter.js +11 -20
- package/lib/packlets/import/importers/jsonImporter.js.map +1 -1
- package/lib/packlets/import/importers/pathImporter.d.ts +2 -2
- package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -1
- package/lib/packlets/import/importers/pathImporter.js.map +1 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts +44 -0
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/convert.js +96 -0
- package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
- package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
- package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/index.js +64 -0
- package/lib/packlets/qualifier-types/config/index.js.map +1 -0
- package/lib/packlets/qualifier-types/config/json.d.ts +69 -0
- package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/config/json.js +24 -0
- package/lib/packlets/qualifier-types/config/json.js.map +1 -0
- package/lib/packlets/qualifier-types/convert.d.ts +10 -2
- package/lib/packlets/qualifier-types/convert.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/convert.js +15 -0
- package/lib/packlets/qualifier-types/convert.js.map +1 -1
- package/lib/packlets/qualifier-types/helpers.d.ts +27 -0
- package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/helpers.js +118 -0
- package/lib/packlets/qualifier-types/helpers.js.map +1 -0
- package/lib/packlets/qualifier-types/index.d.ts +4 -1
- package/lib/packlets/qualifier-types/index.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/index.js +5 -1
- package/lib/packlets/qualifier-types/index.js.map +1 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +19 -8
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js +28 -9
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +42 -13
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/literalQualifierType.js +58 -10
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +114 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +228 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
- package/lib/packlets/qualifier-types/qualifierType.d.ts +33 -18
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/qualifierType.js +18 -4
- package/lib/packlets/qualifier-types/qualifierType.js.map +1 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +4 -2
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js +2 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +47 -11
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.js +61 -17
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -1
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -1
- package/lib/packlets/qualifiers/convert/decls.js +17 -15
- package/lib/packlets/qualifiers/convert/decls.js.map +1 -1
- package/lib/packlets/qualifiers/index.d.ts +2 -0
- package/lib/packlets/qualifiers/index.d.ts.map +1 -1
- package/lib/packlets/qualifiers/index.js +2 -0
- package/lib/packlets/qualifiers/index.js.map +1 -1
- package/lib/packlets/qualifiers/qualifier.d.ts +22 -2
- package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifier.js +26 -1
- package/lib/packlets/qualifiers/qualifier.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifierCollector.js +3 -0
- package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts +6 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -1
- package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts +32 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js +24 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts +96 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js +179 -0
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
- package/lib/packlets/resource-json/compiled/common.d.ts +14 -0
- package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/common.js +24 -0
- package/lib/packlets/resource-json/compiled/common.js.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.d.ts +63 -0
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/convert.js +167 -0
- package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
- package/lib/packlets/resource-json/compiled/index.d.ts +5 -0
- package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/index.js +65 -0
- package/lib/packlets/resource-json/compiled/index.js.map +1 -0
- package/lib/packlets/resource-json/compiled/json.d.ts +204 -0
- package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
- package/lib/packlets/resource-json/compiled/json.js +3 -0
- package/lib/packlets/resource-json/compiled/json.js.map +1 -0
- package/lib/packlets/resource-json/convert.d.ts +16 -0
- package/lib/packlets/resource-json/convert.d.ts.map +1 -1
- package/lib/packlets/resource-json/convert.js +41 -6
- package/lib/packlets/resource-json/convert.js.map +1 -1
- package/lib/packlets/resource-json/helpers.d.ts +82 -3
- package/lib/packlets/resource-json/helpers.d.ts.map +1 -1
- package/lib/packlets/resource-json/helpers.js +185 -2
- package/lib/packlets/resource-json/helpers.js.map +1 -1
- package/lib/packlets/resource-json/index.d.ts +2 -1
- package/lib/packlets/resource-json/index.d.ts.map +1 -1
- package/lib/packlets/resource-json/index.js +3 -1
- package/lib/packlets/resource-json/index.js.map +1 -1
- package/lib/packlets/resource-json/json.d.ts +55 -3
- package/lib/packlets/resource-json/json.d.ts.map +1 -1
- package/lib/packlets/resource-json/json.js +16 -0
- package/lib/packlets/resource-json/json.js.map +1 -1
- package/lib/packlets/resource-json/normalized.d.ts +46 -3
- package/lib/packlets/resource-json/normalized.d.ts.map +1 -1
- package/lib/packlets/resource-json/normalized.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts +14 -10
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js +18 -14
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts +15 -2
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts +6 -2
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.js +12 -3
- package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -1
- package/lib/packlets/resource-types/config/convert.d.ts +8 -0
- package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/convert.js +36 -0
- package/lib/packlets/resource-types/config/convert.js.map +1 -0
- package/lib/packlets/resource-types/config/index.d.ts +4 -0
- package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/index.js +64 -0
- package/lib/packlets/resource-types/config/index.js.map +1 -0
- package/lib/packlets/resource-types/config/json.d.ts +9 -0
- package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
- package/lib/packlets/resource-types/config/json.js +24 -0
- package/lib/packlets/resource-types/config/json.js.map +1 -0
- package/lib/packlets/resource-types/helpers.d.ts +13 -0
- package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
- package/lib/packlets/resource-types/helpers.js +44 -0
- package/lib/packlets/resource-types/helpers.js.map +1 -0
- package/lib/packlets/resource-types/index.d.ts +3 -0
- package/lib/packlets/resource-types/index.d.ts.map +1 -1
- package/lib/packlets/resource-types/index.js +26 -0
- package/lib/packlets/resource-types/index.js.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +8 -16
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.js +6 -3
- package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
- package/lib/packlets/resource-types/resourceType.d.ts +45 -35
- package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/resourceType.js.map +1 -1
- package/lib/packlets/resources/candidateReducer.d.ts +98 -0
- package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
- package/lib/packlets/resources/candidateReducer.js +247 -0
- package/lib/packlets/resources/candidateReducer.js.map +1 -0
- package/lib/packlets/resources/common.d.ts +72 -0
- package/lib/packlets/resources/common.d.ts.map +1 -0
- package/lib/packlets/resources/common.js +24 -0
- package/lib/packlets/resources/common.js.map +1 -0
- package/lib/packlets/resources/index.d.ts +3 -1
- package/lib/packlets/resources/index.d.ts.map +1 -1
- package/lib/packlets/resources/index.js +3 -1
- package/lib/packlets/resources/index.js.map +1 -1
- package/lib/packlets/resources/resource.d.ts +57 -5
- package/lib/packlets/resources/resource.d.ts.map +1 -1
- package/lib/packlets/resources/resource.js +96 -6
- package/lib/packlets/resources/resource.js.map +1 -1
- package/lib/packlets/resources/resourceBuilder.d.ts +14 -0
- package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -1
- package/lib/packlets/resources/resourceBuilder.js +19 -1
- package/lib/packlets/resources/resourceBuilder.js.map +1 -1
- package/lib/packlets/resources/resourceCandidate.d.ts +46 -6
- package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -1
- package/lib/packlets/resources/resourceCandidate.js +46 -1
- package/lib/packlets/resources/resourceCandidate.js.map +1 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +347 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +893 -0
- package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
- package/lib/packlets/runtime/cacheListener.d.ts +71 -0
- package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheListener.js +62 -0
- package/lib/packlets/runtime/cacheListener.js.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts +88 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
- package/lib/packlets/runtime/cacheMetrics.js +154 -0
- package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +167 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
- package/lib/packlets/runtime/compiledResourceCollection.js +466 -0
- package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts +70 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.js +135 -0
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +80 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.js +33 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +165 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +179 -0
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
- package/lib/packlets/runtime/context/index.d.ts +5 -0
- package/lib/packlets/runtime/context/index.d.ts.map +1 -0
- package/lib/packlets/runtime/context/index.js +42 -0
- package/lib/packlets/runtime/context/index.js.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +111 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +177 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +47 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +64 -0
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
- package/lib/packlets/runtime/iResourceManager.d.ts +94 -0
- package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
- package/lib/packlets/runtime/iResourceManager.js +24 -0
- package/lib/packlets/runtime/iResourceManager.js.map +1 -0
- package/lib/packlets/runtime/index.d.ts +12 -0
- package/lib/packlets/runtime/index.d.ts.map +1 -0
- package/lib/packlets/runtime/index.js +73 -0
- package/lib/packlets/runtime/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts +91 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/common.js +24 -0
- package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.d.ts +5 -0
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/index.js +42 -0
- package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts +141 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js +224 -0
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts +24 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +98 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +99 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +165 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
- package/lib/packlets/runtime/resourceResolver.d.ts +217 -0
- package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
- package/lib/packlets/runtime/resourceResolver.js +459 -0
- package/lib/packlets/runtime/resourceResolver.js.map +1 -0
- package/lib/packlets/runtime/validate.d.ts +13 -0
- package/lib/packlets/runtime/validate.d.ts.map +1 -0
- package/lib/packlets/runtime/validate.js +49 -0
- package/lib/packlets/runtime/validate.js.map +1 -0
- package/package.json +76 -75
- package/lib/packlets/resources/resourceManager.d.ts +0 -104
- package/lib/packlets/resources/resourceManager.d.ts.map +0 -1
- package/lib/packlets/resources/resourceManager.js +0 -201
- package/lib/packlets/resources/resourceManager.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importManager.d.ts","sourceRoot":"","sources":["../../../src/packlets/import/importManager.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,QAAQ,EAAqB,MAAM,EAAW,MAAM,eAAe,CAAC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M,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBAC5E,SAAS,GAAG,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;oBACrD,QAAQ,GAAG,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;oBAEpD,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;wBACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;yBAAM,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACvC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AA7HD,sCA6HC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, FileTree, MessageAggregator, Result, succeed } from '@fgv/ts-utils';\nimport {
|
|
1
|
+
{"version":3,"file":"importManager.js","sourceRoot":"","sources":["../../../src/packlets/import/importManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA4F;AAE5F,mDAAgD;AAEhD,+DAA4D;AAC5D,2CAAwF;AA8BxF;;;GAGG;AACH,MAAa,aAAa;IAOxB;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAUD;;;OAGG;IACH,YAAsB,MAA6B;;QAPzC,WAAM,GAAkB,EAAE,CAAC;QAC3B,eAAU,GAAgB,EAAE,CAAC;QAOrC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,6BAAa,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;QAChF,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAC1B,MAAA,MAAM,CAAC,SAAS,mCAAI,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAClG,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,MAA6B;QAChD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,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CAAC;wBACpD,SAAS;oBACX,CAAC;oBAED,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBAC5E,SAAS,GAAG,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;oBACrD,QAAQ,GAAG,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;oBAEpD,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;wBACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;yBAAM,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACvC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AA7HD,sCA6HC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, FileTree, MessageAggregator, Result, succeed } from '@fgv/ts-utils';\nimport { ResourceManagerBuilder } from '../resources';\nimport { ImportContext } from './importContext';\nimport { IImportable, IImportablePath } from './importable';\nimport { FsItemImporter } from './importers/fsItemImporter';\nimport { CollectionImporter, IImporter, JsonImporter, PathImporter } from './importers';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\n\n/**\n * Parameters for creating an {@link Import.ImportManager | ImportManager}.\n * @public\n */\nexport interface IImporterCreateParams {\n /**\n * The {@link Resources.ResourceManagerBuilder | resource manager builder} into which resources\n * will be imported.\n */\n resources: ResourceManagerBuilder;\n\n /**\n * An optional initial {@link Import.ImportContext | import context} for the import operation.\n */\n initialContext?: ImportContext;\n\n /**\n * An optional `FileTree` for importing path items.\n */\n fileTree?: FileTree.FileTree;\n\n /**\n * An optional list of {@link Import.Importers.IImporter | importers} to use for the import.\n */\n importers?: IImporter[];\n}\n\n/**\n * Class to manage the import of resources from various sources.\n * @public\n */\nexport class ImportManager {\n /**\n * The {@link Resources.ResourceManagerBuilder | resource manager builder} into which resources\n * will be imported.\n */\n public readonly resources: ResourceManagerBuilder;\n\n /**\n * The list of {@link Import.Importers.IImporter | importers} to use for the\n * import operations.\n */\n public get importers(): ReadonlyArray<IImporter> {\n return this._importers;\n }\n\n /**\n * The initial {@link Import.ImportContext | import context} for the import operation.\n */\n public initialContext: ImportContext;\n\n protected _stack: IImportable[] = [];\n protected _importers: IImporter[] = [];\n\n /**\n * Protected constructor for the {@link Import.ImportManager | ImportManager}.\n * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.\n */\n protected constructor(params: IImporterCreateParams) {\n this.resources = params.resources;\n this.initialContext = params.initialContext ?? ImportContext.create().orThrow();\n this._importers = Array.from(\n params.importers ?? ImportManager.getDefaultImporters(this.resources.qualifiers, params.fileTree)\n );\n }\n\n /**\n * Factory method to create a new {@link Import.ImportManager | ImportManager}.\n * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.\n * @returns `Success` with the new {@link Import.ImportManager | ImportManager}\n * if successful, or `Failure` with an error message if creation fails.\n */\n public static create(params: IImporterCreateParams): Result<ImportManager> {\n return captureResult(() => new ImportManager(params));\n }\n\n /**\n * Imports resources from an {@link Import.IImportable | importable} object.\n * @param importable - The {@link Import.IImportable | importable} object to import.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n */\n public import(importable: IImportable): Result<ImportManager> {\n this._stack.push(importable);\n return this._import();\n }\n\n /**\n * Imports resources from a file system path.\n * @param filePath - The path to import resources from.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n */\n public importFromFileSystem(filePath: string): Result<ImportManager> {\n const importable: IImportablePath = { type: 'path', path: filePath };\n return this.import(importable);\n }\n\n /**\n * Gets the default importers using supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers}\n * and optional `FileTree`.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for the import.\n * @param tree - An optional `FileTree` for importing path items.\n * @returns A read-only array of {@link Import.Importers.IImporter | importers}.\n */\n public static getDefaultImporters(\n qualifiers: IReadOnlyQualifierCollector,\n tree?: FileTree.FileTree\n ): ReadonlyArray<IImporter> {\n return [\n PathImporter.create({ qualifiers, tree }).orThrow(),\n FsItemImporter.create({ qualifiers }).orThrow(),\n JsonImporter.create().orThrow(),\n CollectionImporter.create().orThrow()\n ];\n }\n\n /**\n * Imports any items on the import stack.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n * @public\n */\n protected _import(): Result<ImportManager> {\n const errors: MessageAggregator = new MessageAggregator();\n\n while (this._stack.length > 0) {\n const item = this._stack.pop();\n if (item !== undefined) {\n let processed: boolean = false;\n let consumed: boolean = false;\n\n for (const importer of this._importers) {\n if (consumed || !importer.types.includes(item.type)) {\n continue;\n }\n\n const result = importer.import(item, this.resources).aggregateError(errors);\n processed = processed || result.detail !== 'skipped';\n consumed = consumed || result.detail === 'consumed';\n\n if (result.isSuccess()) {\n this._stack.push(...result.value);\n } else if (result.detail !== 'skipped') {\n errors.addMessage(`${item.type}: ${result.message}`);\n }\n }\n\n if (!processed) {\n errors.addMessage(`${item.type}: No matching importer found`);\n }\n }\n }\n\n return errors.returnOrReport(succeed(this));\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DetailedResult, Result } from '@fgv/ts-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { ResourceManagerBuilder } from '../../resources';
|
|
3
3
|
import { IImportable } from '../importable';
|
|
4
4
|
import { IImporter, ImporterResultDetail } from './importer';
|
|
5
5
|
/**
|
|
@@ -20,22 +20,20 @@ export declare class CollectionImporter implements IImporter {
|
|
|
20
20
|
/**
|
|
21
21
|
* Creates a new {@link Import.Importers.CollectionImporter | CollectionImporter} instance.
|
|
22
22
|
* @returns `Success` with the new {@link Import.Importers.CollectionImporter | CollectionImporter} if successful,
|
|
23
|
-
* `Failure`
|
|
24
|
-
*
|
|
25
|
-
* therwise.
|
|
23
|
+
* `Failure` otherwise.
|
|
26
24
|
*/
|
|
27
25
|
static create(): Result<CollectionImporter>;
|
|
28
26
|
/**
|
|
29
27
|
* {@inheritdoc Import.Importers.IImporter.import}
|
|
30
28
|
*/
|
|
31
|
-
import(item: IImportable, manager:
|
|
29
|
+
import(item: IImportable, manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
32
30
|
/**
|
|
33
|
-
* Adds a {@link ResourceJson.Normalized.
|
|
34
|
-
* the supplied {@link Resources.
|
|
31
|
+
* Adds a {@link ResourceJson.Normalized.IImporterResourceDecl | declared resource} to
|
|
32
|
+
* the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an
|
|
35
33
|
* optional {@link Import.ImportContext | import context} if provided.
|
|
36
|
-
* @param manager - The {@link Resources.
|
|
34
|
+
* @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which
|
|
37
35
|
* the resource will be added.
|
|
38
|
-
* @param resource - The {@link ResourceJson.Normalized.
|
|
36
|
+
* @param resource - The {@link ResourceJson.Normalized.IImporterResourceDecl | resource}
|
|
39
37
|
* to add.
|
|
40
38
|
* @param context - Optional {@link Import.ImportContext | import context} to merge
|
|
41
39
|
* with the resource.
|
|
@@ -44,12 +42,12 @@ export declare class CollectionImporter implements IImporter {
|
|
|
44
42
|
*/
|
|
45
43
|
private _addResource;
|
|
46
44
|
/**
|
|
47
|
-
* Adds a {@link ResourceJson.Normalized.
|
|
48
|
-
* to the supplied {@link Resources.
|
|
45
|
+
* Adds a {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | declared resource candidate}
|
|
46
|
+
* to the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an optional
|
|
49
47
|
* {@link Import.ImportContext | import context} if provided.
|
|
50
|
-
* @param manager - The {@link Resources.
|
|
48
|
+
* @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which the
|
|
51
49
|
* candidate will be added.
|
|
52
|
-
* @param candidate - The {@link ResourceJson.Normalized.
|
|
50
|
+
* @param candidate - The {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | candidate}
|
|
53
51
|
* to add.
|
|
54
52
|
* @param context - Optional {@link Import.ImportContext | import context} to merge with the candidate.
|
|
55
53
|
* @returns `Success` with the {@link Resources.ResourceCandidate | resource candidate} if successful,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectionImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/collectionImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAGd,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAsC,
|
|
1
|
+
{"version":3,"file":"collectionImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/collectionImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAGd,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAsC,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAI7D;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAClD;;OAEG;IACH,SAAgB,KAAK,EAAE,MAAM,EAAE,CAA0C;IAEzE;;OAEG;IACH,SAAS;IAET;;;;OAIG;WACW,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC;IAIlD;;OAEG;IACI,MAAM,CACX,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAAC,WAAW,EAAE,EAAE,oBAAoB,CAAC;IAwBtD;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;CAkBtB"}
|
|
@@ -58,6 +58,7 @@ exports.CollectionImporter = void 0;
|
|
|
58
58
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
59
59
|
const importable_1 = require("../importable");
|
|
60
60
|
const ResourceJson = __importStar(require("../../resource-json"));
|
|
61
|
+
const importContext_1 = require("../importContext");
|
|
61
62
|
/**
|
|
62
63
|
* {@link Import.Importers.IImporter | Importer} implementation which imports
|
|
63
64
|
* a {@link ResourceJson.ResourceDeclCollection | resource collection} or
|
|
@@ -77,9 +78,7 @@ class CollectionImporter {
|
|
|
77
78
|
/**
|
|
78
79
|
* Creates a new {@link Import.Importers.CollectionImporter | CollectionImporter} instance.
|
|
79
80
|
* @returns `Success` with the new {@link Import.Importers.CollectionImporter | CollectionImporter} if successful,
|
|
80
|
-
* `Failure`
|
|
81
|
-
*
|
|
82
|
-
* therwise.
|
|
81
|
+
* `Failure` otherwise.
|
|
83
82
|
*/
|
|
84
83
|
static create() {
|
|
85
84
|
return (0, ts_utils_1.captureResult)(() => new CollectionImporter());
|
|
@@ -94,23 +93,27 @@ class CollectionImporter {
|
|
|
94
93
|
const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
|
|
95
94
|
return (0, ts_utils_1.failWithDetail)(`${name}: not a valid resource collection importable (${item.type})`, 'skipped');
|
|
96
95
|
}
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
const container = item.type === 'resourceCollection' ? item.collection : item.tree;
|
|
97
|
+
return importContext_1.ImportContext.forContainerImport(container.context, item.context)
|
|
98
|
+
.onSuccess((context) => {
|
|
99
|
+
const errors = new ts_utils_1.MessageAggregator();
|
|
100
|
+
for (const resource of container.getImporterResources()) {
|
|
101
|
+
this._addResource(manager, resource, context).aggregateError(errors);
|
|
102
|
+
}
|
|
103
|
+
for (const candidate of container.getImporterCandidates()) {
|
|
104
|
+
this._addCandidate(manager, candidate, context).aggregateError(errors);
|
|
105
|
+
}
|
|
106
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)([]));
|
|
107
|
+
})
|
|
108
|
+
.withDetail('failed', 'consumed');
|
|
106
109
|
}
|
|
107
110
|
/**
|
|
108
|
-
* Adds a {@link ResourceJson.Normalized.
|
|
109
|
-
* the supplied {@link Resources.
|
|
111
|
+
* Adds a {@link ResourceJson.Normalized.IImporterResourceDecl | declared resource} to
|
|
112
|
+
* the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an
|
|
110
113
|
* optional {@link Import.ImportContext | import context} if provided.
|
|
111
|
-
* @param manager - The {@link Resources.
|
|
114
|
+
* @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which
|
|
112
115
|
* the resource will be added.
|
|
113
|
-
* @param resource - The {@link ResourceJson.Normalized.
|
|
116
|
+
* @param resource - The {@link ResourceJson.Normalized.IImporterResourceDecl | resource}
|
|
114
117
|
* to add.
|
|
115
118
|
* @param context - Optional {@link Import.ImportContext | import context} to merge
|
|
116
119
|
* with the resource.
|
|
@@ -120,16 +123,19 @@ class CollectionImporter {
|
|
|
120
123
|
_addResource(manager, resource, context) {
|
|
121
124
|
if (context) {
|
|
122
125
|
return ResourceJson.Helpers.mergeLooseResource(resource, context.baseId, context.conditions).onSuccess((merged) => manager.addResource(merged));
|
|
126
|
+
} /* c8 ignore next 4 - defense in depth, should be guarded elsewhere */
|
|
127
|
+
else if (!ResourceJson.Json.isLooseResourceDecl(resource)) {
|
|
128
|
+
return fail('cannot add child resource to manager');
|
|
123
129
|
}
|
|
124
130
|
return manager.addResource(resource);
|
|
125
131
|
}
|
|
126
132
|
/**
|
|
127
|
-
* Adds a {@link ResourceJson.Normalized.
|
|
128
|
-
* to the supplied {@link Resources.
|
|
133
|
+
* Adds a {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | declared resource candidate}
|
|
134
|
+
* to the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an optional
|
|
129
135
|
* {@link Import.ImportContext | import context} if provided.
|
|
130
|
-
* @param manager - The {@link Resources.
|
|
136
|
+
* @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which the
|
|
131
137
|
* candidate will be added.
|
|
132
|
-
* @param candidate - The {@link ResourceJson.Normalized.
|
|
138
|
+
* @param candidate - The {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | candidate}
|
|
133
139
|
* to add.
|
|
134
140
|
* @param context - Optional {@link Import.ImportContext | import context} to merge with the candidate.
|
|
135
141
|
* @returns `Success` with the {@link Resources.ResourceCandidate | resource candidate} if successful,
|
|
@@ -138,6 +144,9 @@ class CollectionImporter {
|
|
|
138
144
|
_addCandidate(manager, candidate, context) {
|
|
139
145
|
if (context) {
|
|
140
146
|
return ResourceJson.Helpers.mergeLooseCandidate(candidate, context.baseId, context.conditions).onSuccess((merged) => manager.addLooseCandidate(merged));
|
|
147
|
+
} /* c8 ignore next 4 - defense in depth, should be guarded elsewhere */
|
|
148
|
+
else if (!ResourceJson.Json.isLooseResourceCandidateDecl(candidate)) {
|
|
149
|
+
return fail('cannot add child resource candidate to manager');
|
|
141
150
|
}
|
|
142
151
|
return manager.addLooseCandidate(candidate);
|
|
143
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectionImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/collectionImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAOuB;AAEvB,8CAA0D;AAE1D,kEAAoD;
|
|
1
|
+
{"version":3,"file":"collectionImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/collectionImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAOuB;AAEvB,8CAA0D;AAE1D,kEAAoD;AACpD,oDAAiD;AAEjD;;;;;GAKG;AACH,MAAa,kBAAkB;IAM7B;;OAEG;IACH;QARA;;WAEG;QACa,UAAK,GAAa,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC;IAKhD,CAAC;IAE1B;;;;OAIG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;IACvD,CAAC;I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,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,YAAY,CAClB,OAA+B,EAC/B,QAAuD,EACvD,OAAuB;QAEvB,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,SAAS,CACpG,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CACxC,CAAC;QACJ,CAAC,CAAC,sEAAsE;aAAM,IAC5E,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAChD,CAAC;YACD,OAAO,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;OAWG;IACK,aAAa,CACnB,OAA+B,EAC/B,SAAiE,EACjE,OAAuB;QAEvB,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAC7C,SAAS,EACT,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,UAAU,CACnB,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,sEAAsE;aAAM,IAC5E,CAAC,YAAY,CAAC,IAAI,CAAC,4BAA4B,CAAC,SAAS,CAAC,EAC1D,CAAC;YACD,OAAO,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AA9GD,gDA8GC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n DetailedResult,\n failWithDetail,\n MessageAggregator,\n Result,\n succeed\n} from '@fgv/ts-utils';\nimport { ResourceBuilder, ResourceCandidate, ResourceManagerBuilder } from '../../resources';\nimport { IImportable, isImportable } from '../importable';\nimport { IImporter, ImporterResultDetail } from './importer';\nimport * as ResourceJson from '../../resource-json';\nimport { ImportContext } from '../importContext';\n\n/**\n * {@link Import.Importers.IImporter | Importer} implementation which imports\n * a {@link ResourceJson.ResourceDeclCollection | resource collection} or\n * {@link ResourceJson.ResourceDeclTree | resource tree} from an importable item.\n * @public\n */\nexport class CollectionImporter implements IImporter {\n /**\n * {@inheritdoc Import.Importers.IImporter.types}\n */\n public readonly types: string[] = ['resourceCollection', 'resourceTree'];\n\n /**\n * Protected {@link Import.Importers.CollectionImporter | CollectionImporter} constructor for derived classes\n */\n protected constructor() {}\n\n /**\n * Creates a new {@link Import.Importers.CollectionImporter | CollectionImporter} instance.\n * @returns `Success` with the new {@link Import.Importers.CollectionImporter | CollectionImporter} if successful,\n * `Failure` otherwise.\n */\n public static create(): Result<CollectionImporter> {\n return captureResult(() => new CollectionImporter());\n }\n\n /**\n * {@inheritdoc Import.Importers.IImporter.import}\n */\n public import(\n item: IImportable,\n manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n if (!isImportable(item) || (item.type !== 'resourceCollection' && item.type !== 'resourceTree')) {\n /* c8 ignore next 1 - defense in depth */\n const name = item.context?.baseId ?? 'unknown';\n return failWithDetail(`${name}: not a valid resource collection importable (${item.type})`, 'skipped');\n }\n\n const container = item.type === 'resourceCollection' ? item.collection : item.tree;\n\n return ImportContext.forContainerImport(container.context, item.context)\n .onSuccess((context) => {\n const errors: MessageAggregator = new MessageAggregator();\n for (const resource of container.getImporterResources()) {\n this._addResource(manager, resource, context).aggregateError(errors);\n }\n\n for (const candidate of container.getImporterCandidates()) {\n this._addCandidate(manager, candidate, context).aggregateError(errors);\n }\n return errors.returnOrReport(succeed([]));\n })\n .withDetail('failed', 'consumed');\n }\n\n /**\n * Adds a {@link ResourceJson.Normalized.IImporterResourceDecl | declared resource} to\n * the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an\n * optional {@link Import.ImportContext | import context} if provided.\n * @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which\n * the resource will be added.\n * @param resource - The {@link ResourceJson.Normalized.IImporterResourceDecl | resource}\n * to add.\n * @param context - Optional {@link Import.ImportContext | import context} to merge\n * with the resource.\n * @returns `Success` with the {@link Resources.ResourceBuilder | resource builder}\n * for the resource if successful, `Failure` with an error message if not.\n */\n private _addResource(\n manager: ResourceManagerBuilder,\n resource: ResourceJson.Normalized.IImporterResourceDecl,\n context?: ImportContext\n ): Result<ResourceBuilder> {\n if (context) {\n return ResourceJson.Helpers.mergeLooseResource(resource, context.baseId, context.conditions).onSuccess(\n (merged) => manager.addResource(merged)\n );\n } /* c8 ignore next 4 - defense in depth, should be guarded elsewhere */ else if (\n !ResourceJson.Json.isLooseResourceDecl(resource)\n ) {\n return fail('cannot add child resource to manager');\n }\n return manager.addResource(resource);\n }\n\n /**\n * Adds a {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | declared resource candidate}\n * to the supplied {@link Resources.ResourceManagerBuilder | resource manager builder}, merging an optional\n * {@link Import.ImportContext | import context} if provided.\n * @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to which the\n * candidate will be added.\n * @param candidate - The {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | candidate}\n * to add.\n * @param context - Optional {@link Import.ImportContext | import context} to merge with the candidate.\n * @returns `Success` with the {@link Resources.ResourceCandidate | resource candidate} if successful,\n * `Failure` with an error message if not.\n */\n private _addCandidate(\n manager: ResourceManagerBuilder,\n candidate: ResourceJson.Normalized.IImporterResourceCandidateDecl,\n context?: ImportContext\n ): Result<ResourceCandidate> {\n if (context) {\n return ResourceJson.Helpers.mergeLooseCandidate(\n candidate,\n context.baseId,\n context.conditions\n ).onSuccess((merged) => manager.addLooseCandidate(merged));\n } /* c8 ignore next 4 - defense in depth, should be guarded elsewhere */ else if (\n !ResourceJson.Json.isLooseResourceCandidateDecl(candidate)\n ) {\n return fail('cannot add child resource candidate to manager');\n }\n return manager.addLooseCandidate(candidate);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DetailedResult, Result } from '@fgv/ts-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { ResourceManagerBuilder } from '../../resources';
|
|
3
3
|
import { IImportable } from '../importable';
|
|
4
4
|
import { IImporter, ImporterResultDetail } from './importer';
|
|
5
5
|
import { IReadOnlyQualifierCollector } from '../../qualifiers';
|
|
@@ -38,7 +38,7 @@ export declare class FsItemImporter implements IImporter {
|
|
|
38
38
|
/**
|
|
39
39
|
* {@inheritdoc Import.Importers.IImporter.import}
|
|
40
40
|
*/
|
|
41
|
-
import(item: IImportable, __manager:
|
|
41
|
+
import(item: IImportable, __manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
42
42
|
/**
|
|
43
43
|
* Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
|
|
44
44
|
* @param item - The importable to convert.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fsItemImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/fsItemImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAEd,MAAM,EAIP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fsItemImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/fsItemImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAEd,MAAM,EAIP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAA+B,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,2BAA2B,CAAC;CACzC;AAED;;;GAGG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C;;OAEG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;OAEG;IACH,SAAgB,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAc;IAE1D;;;OAGG;IACH,SAAS,aAAa,MAAM,EAAE,2BAA2B;IAIzD;;;;OAIG;WACW,MAAM,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,CAAC,cAAc,CAAC;IAIjF;;OAEG;IACI,MAAM,CACX,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,sBAAsB,GAChC,cAAc,CAAC,WAAW,EAAE,EAAE,oBAAoB,CAAC;IAuDtD;;;;OAIG;IACH,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC;CASxG"}
|
|
@@ -60,7 +60,7 @@ class FsItemImporter {
|
|
|
60
60
|
const { value: context, message: getContextMessage } = fsItem.getContext().onSuccess((fsItemContext) => {
|
|
61
61
|
return item.context ? item.context.extend(fsItemContext) : (0, ts_utils_1.succeed)(fsItemContext);
|
|
62
62
|
});
|
|
63
|
-
/* c8 ignore next 3 -
|
|
63
|
+
/* c8 ignore next 3 - defensive coding: getContext failure is extremely rare in practice */
|
|
64
64
|
if (getContextMessage) {
|
|
65
65
|
return (0, ts_utils_1.failWithDetail)(getContextMessage, 'failed');
|
|
66
66
|
}
|
|
@@ -98,7 +98,7 @@ class FsItemImporter {
|
|
|
98
98
|
.withDetail('failed', 'processed');
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
/* c8 ignore next 2 -
|
|
101
|
+
/* c8 ignore next 2 - defensive coding: fallback case for unsupported file types */
|
|
102
102
|
return (0, ts_utils_1.succeedWithDetail)([], 'skipped');
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fsItemImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/fsItemImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAQuB;AACvB,oDAAiE;AAKjE,sCAAuD;AAUvD;;;GAGG;AACH,MAAa,cAAc;IAWzB;;;OAGG;IACH,YAAsB,MAAmC;QATzD;;WAEG;QACa,UAAK,GAA0B,CAAC,QAAQ,CAAC,CAAC;QAOxD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,MAAmC;QACtD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,MAAM,CACX,IAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"fsItemImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/fsItemImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAQuB;AACvB,oDAAiE;AAKjE,sCAAuD;AAUvD;;;GAGG;AACH,MAAa,cAAc;IAWzB;;;OAGG;IACH,YAAsB,MAAmC;QATzD;;WAEG;QACa,UAAK,GAA0B,CAAC,QAAQ,CAAC,CAAC;QAOxD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,MAAmC;QACtD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,MAAM,CACX,IAAiB,EACjB,SAAiC;QAEjC,MAAM,EACJ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,aAAa,EACtB,GAAG,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAA,yBAAc,EAAC,cAAc,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC5F,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE;YACrG,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,C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,WAAW,CAAC,yBAAc,CAAC,SAAS,CAAC;qBACrC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;oBAClB,MAAM,QAAQ,GAAoB;wBAChC,IAAI,EAAE,MAAM;wBACZ,IAAI;wBACJ,OAAO;qBACR,CAAC;oBACF,OAAO,IAAA,kBAAO,EAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC7B,CAAC,CAAC;qBACD,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,mFAAmF;QACnF,OAAO,IAAA,4BAAiB,EAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACO,8BAA8B,CAAC,IAAiB;QACxD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,YAAY,eAAM,EAAE,CAAC;gBAClD,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,IAAA,yBAAc,EAAC,2DAA2D,EAAE,QAAQ,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,IAAA,yBAAc,EAAC,GAAG,IAAI,CAAC,IAAI,iDAAiD,EAAE,SAAS,CAAC,CAAC;IAClG,CAAC;CACF;AAvGD,wCAuGC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n DetailedResult,\n failWithDetail,\n Result,\n succeed,\n succeedWithDetail,\n MessageAggregator\n} from '@fgv/ts-utils';\nimport { Converters as JsonConverters } from '@fgv/ts-json-base';\nimport { ResourceManagerBuilder } from '../../resources';\nimport { IImportable, IImportableJson, Importable } from '../importable';\nimport { IImporter, ImporterResultDetail } from './importer';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\nimport { FsItem, FsItemResultDetail } from '../fsItem';\n\n/**\n * Parameters for creating a {@link Import.Importers.FsItemImporter | FsItemImporter}.\n * @public\n */\nexport interface IFsItemImporterCreateParams {\n qualifiers: IReadOnlyQualifierCollector;\n}\n\n/**\n * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`.\n * @public\n */\nexport class FsItemImporter implements IImporter {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use for this importer.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * The types of {@link Import.IImportable | importables} that this importer can handle.\n */\n public readonly types: ReadonlyArray<string> = ['fsItem'];\n\n /**\n * Protected constructor for the {@link Import.Importers.FsItemImporter | FsItemImporter}.\n * @param params - Parameters for creating the {@link Import.Importers.FsItemImporter | FsItemImporter}.\n */\n protected constructor(params: IFsItemImporterCreateParams) {\n this.qualifiers = params.qualifiers;\n }\n\n /**\n * Creates a new {@link Import.Importers.FsItemImporter | FsItemImporter}.\n * @param params - Parameters for creating the {@link Import.Importers.FsItemImporter | FsItemImporter}.\n * @returns `Success` with the new `FsItemImporter` if successful, `Failure` with an error message if not.\n */\n public static create(params: IFsItemImporterCreateParams): Result<FsItemImporter> {\n return captureResult(() => new FsItemImporter(params));\n }\n\n /**\n * {@inheritdoc Import.Importers.IImporter.import}\n */\n public import(\n item: IImportable,\n __manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n const {\n value: fsItem,\n message: getTreeMessage,\n detail: getTreeDetail\n } = this._getFileTreeItemFromImportable(item);\n if (getTreeMessage !== undefined) {\n return failWithDetail(getTreeMessage, getTreeDetail === 'skipped' ? 'skipped' : 'failed');\n }\n\n const { value: context, message: getContextMessage } = fsItem.getContext().onSuccess((fsItemContext) => {\n return item.context ? item.context.extend(fsItemContext) : succeed(fsItemContext);\n });\n\n /* c8 ignore next 3 - defensive coding: getContext failure is extremely rare in practice */\n if (getContextMessage) {\n return failWithDetail(getContextMessage, 'failed');\n }\n\n if (fsItem.item.type === 'directory') {\n return fsItem.item\n .getChildren()\n .onSuccess((children) => {\n const errors = new MessageAggregator();\n const items: Importable[] = [];\n for (const child of children) {\n const { value: item, message, detail } = FsItem.createForItem(child, this.qualifiers);\n if (item) {\n items.push({ type: 'fsItem', item, context });\n } else if (detail !== 'skipped') {\n errors.addMessage(message);\n }\n }\n return errors.returnOrReport(succeed(items));\n })\n .withDetail('failed', 'processed');\n } else if (fsItem.item.type === 'file') {\n if (fsItem.item.extension === '.json') {\n return fsItem.item\n .getContents(JsonConverters.jsonValue)\n .onSuccess((json) => {\n const jsonItem: IImportableJson = {\n type: 'json',\n json,\n context\n };\n return succeed([jsonItem]);\n })\n .withDetail('failed', 'processed');\n }\n }\n /* c8 ignore next 2 - defensive coding: fallback case for unsupported file types */\n return succeedWithDetail([], 'skipped');\n }\n\n /**\n * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.\n * @param item - The importable to convert.\n * @returns `Success` containing the `FsItem` if successful, `Failure` with an error message if not.\n */\n protected _getFileTreeItemFromImportable(item: IImportable): DetailedResult<FsItem, FsItemResultDetail> {\n if (item.type === 'fsItem') {\n if ('item' in item && item.item instanceof FsItem) {\n return succeedWithDetail(item.item, 'succeeded');\n }\n return failWithDetail(`malformed fsItem importable does not contain a valid item`, 'failed');\n }\n return failWithDetail(`${item.type}: invalid importable type for an FsItemImporter`, 'skipped');\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DetailedResult } from '@fgv/ts-utils';
|
|
2
2
|
import { IImportable } from '../importable';
|
|
3
|
-
import {
|
|
3
|
+
import { ResourceManagerBuilder } from '../../resources';
|
|
4
4
|
/**
|
|
5
5
|
* Possible results of an import operation.
|
|
6
6
|
* @public
|
|
@@ -22,10 +22,10 @@ export interface IImporter {
|
|
|
22
22
|
* Imports an item, extracting any resources or candidates from it and returns an optional
|
|
23
23
|
* list of additional importable items derived from it.
|
|
24
24
|
* @param item - The {@link Import.IImportable | importable} item to import.
|
|
25
|
-
* @param manager - The {@link Resources.
|
|
25
|
+
* @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to use for the import.
|
|
26
26
|
* @returns `Success` with a list of additional importable items derived from the original, or
|
|
27
27
|
* `Failure` with an error message and a {@link Import.Importers.ImporterResultDetail | result detail}.
|
|
28
28
|
*/
|
|
29
|
-
import(item: IImportable, manager:
|
|
29
|
+
import(item: IImportable, manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/importer.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/importer.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;;;OAOG;IACH,MAAM,CACJ,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAAC,WAAW,EAAE,EAAE,oBAAoB,CAAC,CAAC;CACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importer.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/importer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { DetailedResult } from '@fgv/ts-utils';\nimport { IImportable } from '../importable';\nimport {
|
|
1
|
+
{"version":3,"file":"importer.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/importer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { DetailedResult } from '@fgv/ts-utils';\nimport { IImportable } from '../importable';\nimport { ResourceManagerBuilder } from '../../resources';\n\n/**\n * Possible results of an import operation.\n * @public\n */\nexport type ImporterResultDetail = 'consumed' | 'processed' | 'skipped' | 'failed';\n\n/**\n * Generic interface for an importer than accepts a typed\n * {@link Import.IImportable | importable} item, extracts any resources\n * or candidates from it, and returns an optional list of\n * additional importable items derived from the original.\n * @public\n */\nexport interface IImporter {\n /**\n * The types of {@link Import.Importable | importable} items that this importer can process.\n */\n readonly types: ReadonlyArray<string>;\n\n /**\n * Imports an item, extracting any resources or candidates from it and returns an optional\n * list of additional importable items derived from it.\n * @param item - The {@link Import.IImportable | importable} item to import.\n * @param manager - The {@link Resources.ResourceManagerBuilder | resource manager builder} to use for the import.\n * @returns `Success` with a list of additional importable items derived from the original, or\n * `Failure` with an error message and a {@link Import.Importers.ImporterResultDetail | result detail}.\n */\n import(\n item: IImportable,\n manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail>;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DetailedResult, Result } from '@fgv/ts-utils';
|
|
2
2
|
import { IImporter, ImporterResultDetail } from './importer';
|
|
3
|
-
import {
|
|
3
|
+
import { ResourceManagerBuilder } from '../../resources';
|
|
4
4
|
import { IImportable } from '../importable';
|
|
5
5
|
/**
|
|
6
6
|
* {@link Import.Importers.IImporter | Importer} implementation which imports resources from a JSON object.
|
|
@@ -24,9 +24,8 @@ export declare class JsonImporter implements IImporter {
|
|
|
24
24
|
/**
|
|
25
25
|
* {@inheritdoc Import.Importers.IImporter.import}
|
|
26
26
|
*/
|
|
27
|
-
import(item: IImportable, manager:
|
|
27
|
+
import(item: IImportable, manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
28
28
|
private _tryImportResourceCollection;
|
|
29
29
|
private _tryImportResourceTree;
|
|
30
|
-
private _tryImportResource;
|
|
31
30
|
}
|
|
32
31
|
//# sourceMappingURL=jsonImporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/jsonImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,cAAc,EAAkB,MAAM,EAAW,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/jsonImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,cAAc,EAAkB,MAAM,EAAW,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAA6C,MAAM,eAAe,CAAC;AAGvF;;;GAGG;AACH,qBAAa,YAAa,YAAW,SAAS;IAC5C;;OAEG;IACH,SAAgB,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAY;IAExD;;OAEG;IACH,SAAS;IAET;;;;OAIG;WACW,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC;IAI5C;;OAEG;IACI,MAAM,CACX,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAAC,WAAW,EAAE,EAAE,oBAAoB,CAAC;IAsBtD,OAAO,CAAC,4BAA4B;IAepC,OAAO,CAAC,sBAAsB;CAqC/B"}
|
|
@@ -56,7 +56,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
exports.JsonImporter = void 0;
|
|
58
58
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
59
|
-
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
60
59
|
const importable_1 = require("../importable");
|
|
61
60
|
const ResourceJson = __importStar(require("../../resource-json"));
|
|
62
61
|
/**
|
|
@@ -86,14 +85,22 @@ class JsonImporter {
|
|
|
86
85
|
*/
|
|
87
86
|
import(item, manager) {
|
|
88
87
|
var _a, _b;
|
|
88
|
+
/* c8 ignore next 1 - coverage intermittently misses the next line */
|
|
89
89
|
if (!(0, importable_1.isImportable)(item) || item.type !== 'json') {
|
|
90
|
-
/* c8 ignore next
|
|
90
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
91
91
|
const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
|
|
92
92
|
return (0, ts_utils_1.failWithDetail)(`${name}: not a valid JSON importable (${item.type})`, 'skipped');
|
|
93
93
|
}
|
|
94
|
-
return this._tryImportResourceCollection(item)
|
|
94
|
+
return (this._tryImportResourceCollection(item)
|
|
95
95
|
.onFailure(() => this._tryImportResourceTree(item))
|
|
96
|
-
|
|
96
|
+
// experimenting with this, accepting any JSON object here makes it
|
|
97
|
+
// very hard to distinguish a collection or tree with a typo from a
|
|
98
|
+
// legitimate single loose resource, which yields extremely confusing
|
|
99
|
+
// error messages. Disabled until/unless we come up with a better plan.
|
|
100
|
+
//.onFailure(() => this._tryImportResource(item, manager));
|
|
101
|
+
.onFailure(() => { var _a, _b;
|
|
102
|
+
/* c8 ignore next 1 - defense in depth */
|
|
103
|
+
return (0, ts_utils_1.failWithDetail)(`${(_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown'}: unrecognized JSON format.`, 'failed'); }));
|
|
97
104
|
}
|
|
98
105
|
_tryImportResourceCollection(item) {
|
|
99
106
|
return ResourceJson.ResourceDeclCollection.create(item.json)
|
|
@@ -119,22 +126,6 @@ class JsonImporter {
|
|
|
119
126
|
})
|
|
120
127
|
.withDetail('skipped', 'consumed');
|
|
121
128
|
}
|
|
122
|
-
_tryImportResource(item, manager) {
|
|
123
|
-
return ts_json_base_1.Converters.jsonObject
|
|
124
|
-
.convert(item.json)
|
|
125
|
-
.onSuccess((json) => {
|
|
126
|
-
var _a, _b, _c;
|
|
127
|
-
/* c8 ignore next 2 - defense in depth */
|
|
128
|
-
const id = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : '';
|
|
129
|
-
const conditions = (_c = item.context) === null || _c === void 0 ? void 0 : _c.conditions;
|
|
130
|
-
const candidate = { id, conditions, json };
|
|
131
|
-
return manager.addLooseCandidate(candidate);
|
|
132
|
-
})
|
|
133
|
-
.onSuccess(() => {
|
|
134
|
-
return (0, ts_utils_1.succeed)([]);
|
|
135
|
-
})
|
|
136
|
-
.withDetail('failed', 'consumed');
|
|
137
|
-
}
|
|
138
129
|
}
|
|
139
130
|
exports.JsonImporter = JsonImporter;
|
|
140
131
|
//# sourceMappingURL=jsonImporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/jsonImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA+F;
|
|
1
|
+
{"version":3,"file":"jsonImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/jsonImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA+F;AAG/F,8CAAuF;AACvF,kEAAoD;AAEpD;;;GAGG;AACH,MAAa,YAAY;IAMvB;;OAEG;IACH;QARA;;WAEG;QACa,UAAK,GAA0B,CAAC,MAAM,CAAC,CAAC;IAK/B,CAAC;IAE1B;;;;OAIG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,MAAM,CACX,IAAiB,EACjB,OAA+B;;QAE/B,qEAAqE;QACrE,IAAI,CAAC,IAAA,yBAAY,EAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAChD,uFAAuF;YACvF,MAAM,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,mCAAI,SAAS,CAAC;YAC/C,OAAO,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;QAC/B,CAAC,CAAC;aACD,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;CA0BF;AApGD,oCAoGC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, DetailedResult, failWithDetail, Result, succeed } from '@fgv/ts-utils';\nimport { IImporter, ImporterResultDetail } from './importer';\nimport { ResourceManagerBuilder } from '../../resources';\nimport { IImportable, IImportableJson, Importable, isImportable } from '../importable';\nimport * as ResourceJson from '../../resource-json';\n\n/**\n * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a JSON object.\n * @public\n */\nexport class JsonImporter implements IImporter {\n /**\n * {@inheritdoc Import.Importers.IImporter.types}\n */\n public readonly types: ReadonlyArray<string> = ['json'];\n\n /**\n * Protected {@link Import.Importers.JsonImporter | JsonImporter} constructor for derived classes.\n */\n protected constructor() {}\n\n /**\n * Creates a new {@link Import.Importers.JsonImporter | JsonImporter} instance.\n * @returns `Success` with the new {@link Import.Importers.JsonImporter | JsonImporter} if successful,\n * `Failure` otherwise.\n */\n public static create(): Result<JsonImporter> {\n return captureResult(() => new JsonImporter());\n }\n\n /**\n * {@inheritdoc Import.Importers.IImporter.import}\n */\n public import(\n item: IImportable,\n manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n /* c8 ignore next 1 - coverage intermittently misses the next line */\n if (!isImportable(item) || item.type !== 'json') {\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n const name = item.context?.baseId ?? 'unknown';\n return failWithDetail(`${name}: not a valid JSON importable (${item.type})`, 'skipped');\n }\n return (\n this._tryImportResourceCollection(item)\n .onFailure(() => this._tryImportResourceTree(item))\n // experimenting with this, accepting any JSON object here makes it\n // very hard to distinguish a collection or tree with a typo from a\n // legitimate single loose resource, which yields extremely confusing\n // error messages. Disabled until/unless we come up with a better plan.\n //.onFailure(() => this._tryImportResource(item, manager));\n .onFailure(() =>\n /* c8 ignore next 1 - defense in depth */\n failWithDetail(`${item.context?.baseId ?? 'unknown'}: unrecognized JSON format.`, 'failed')\n )\n );\n }\n\n private _tryImportResourceCollection(\n item: IImportableJson\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n return ResourceJson.ResourceDeclCollection.create(item.json)\n .onSuccess((collection) => {\n const importable: Importable = {\n type: 'resourceCollection',\n collection,\n context: item.context\n };\n return succeed([importable]);\n })\n .withDetail('skipped', 'consumed');\n }\n\n private _tryImportResourceTree(item: IImportableJson): DetailedResult<IImportable[], ImporterResultDetail> {\n return ResourceJson.ResourceDeclTree.create(item.json)\n .onSuccess((tree) => {\n const importable: Importable = {\n type: 'resourceTree',\n tree,\n context: item.context\n };\n return succeed([importable]);\n })\n .withDetail('skipped', 'consumed');\n }\n\n /* \n * This is disabled for now because it's too easy to accidentally import\n * a single loose resource as a collection or tree, which yields extremely\n * confusing error messages.\n\n private _tryImportResource(\n item: IImportableJson,\n manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n return JsonConverters.jsonObject\n .convert(item.json)\n .onSuccess((json) => {\n // c8 ignore next 2 - defense in depth\n const id = item.context?.baseId ?? '';\n const conditions = item.context?.conditions;\n const candidate: ResourceJson.Json.ILooseResourceCandidateDecl = { id, conditions, json };\n return manager.addLooseCandidate(candidate);\n })\n .onSuccess(() => {\n return succeed([]);\n })\n .withDetail('failed', 'consumed');\n }\n */\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DetailedResult, Result, FileTree } from '@fgv/ts-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { ResourceManagerBuilder } from '../../resources';
|
|
3
3
|
import { IImportable } from '../importable';
|
|
4
4
|
import { IImporter, ImporterResultDetail } from './importer';
|
|
5
5
|
import { IReadOnlyQualifierCollector } from '../../qualifiers';
|
|
@@ -50,7 +50,7 @@ export declare class PathImporter implements IImporter {
|
|
|
50
50
|
/**
|
|
51
51
|
* {@inheritdoc Import.Importers.IImporter.import}
|
|
52
52
|
*/
|
|
53
|
-
import(item: IImportable, __manager:
|
|
53
|
+
import(item: IImportable, __manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
54
54
|
/**
|
|
55
55
|
* Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
|
|
56
56
|
* @param item - The importable to convert.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/pathImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAEd,MAAM,EAEN,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pathImporter.d.ts","sourceRoot":"","sources":["../../../../src/packlets/import/importers/pathImporter.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAEd,MAAM,EAEN,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAA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;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAOuB;AAKvB,sCAAuD;AAYvD;;;;GAIG;AACH,MAAa,YAAY;IAsBvB;;;OAGG;IACH,YAAsB,MAAiC;;QAfvD;;WAEG;QACa,UAAK,GAA0B,CAAC,MAAM,CAAC,CAAC;QAatD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,mCAAI,mBAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,CAAC;QAC9D,IAAI,CAAC,eAAe,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,MAAiC;QACpD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,MAAM,CACX,IAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"pathImporter.js","sourceRoot":"","sources":["../../../../src/packlets/import/importers/pathImporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAOuB;AAKvB,sCAAuD;AAYvD;;;;GAIG;AACH,MAAa,YAAY;IAsBvB;;;OAGG;IACH,YAAsB,MAAiC;;QAfvD;;WAEG;QACa,UAAK,GAA0B,CAAC,MAAM,CAAC,CAAC;QAatD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,mCAAI,mBAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,CAAC;QAC9D,IAAI,CAAC,eAAe,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,MAAiC;QACpD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IAAA,yBAAc,EAAC,0DAA0D,EAAE,QAAQ,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,IAAA,yBAAc,EAAC,GAAG,IAAI,CAAC,IAAI,8CAA8C,EAAE,SAAS,CAAC,CAAC;IAC/F,CAAC;CACF;AAlFD,oCAkFC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n DetailedResult,\n failWithDetail,\n Result,\n succeedWithDetail,\n FileTree\n} from '@fgv/ts-utils';\nimport { ResourceManagerBuilder } from '../../resources';\nimport { IImportable } from '../importable';\nimport { IImporter, ImporterResultDetail } from './importer';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\nimport { FsItem, FsItemResultDetail } from '../fsItem';\n\n/**\n * Parameters for creating a {@link Import.Importers.PathImporter | PathImporter}.\n * @public\n */\nexport interface IPathImporterCreateParams {\n qualifiers: IReadOnlyQualifierCollector;\n tree?: FileTree.FileTree;\n ignoreFileTypes?: string[];\n}\n\n/**\n * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`\n * given a path.\n * @public\n */\nexport class PathImporter implements IImporter {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use for this importer.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * The `FileTree` from which resources will be imported.\n */\n public readonly tree: FileTree.FileTree;\n\n /**\n * The types of {@link Import.IImportable | importables} that this importer can handle.\n */\n public readonly types: ReadonlyArray<string> = ['path'];\n\n /**\n * The types of files to ignore when importing. Any file not ignored is converted\n * to an {@link Import.IImportableFsItem | IImportableFsItem}.\n */\n public readonly ignoreFileTypes: string[];\n\n /**\n * Protected constructor for the {@link Import.Importers.PathImporter | PathImporter}.\n * @param params - Parameters for creating the {@link Import.Importers.PathImporter | PathImporter}.\n */\n protected constructor(params: IPathImporterCreateParams) {\n this.qualifiers = params.qualifiers;\n this.tree = params.tree ?? FileTree.forFilesystem().orThrow();\n this.ignoreFileTypes = params.ignoreFileTypes ?? [];\n }\n\n /**\n * Creates a new {@link Import.Importers.PathImporter | PathImporter}.\n * @param params - Parameters for creating the {@link Import.Importers.PathImporter | dirPathImporter}.\n * @returns `Success` with the new `PathImporter` if successful, `Failure` with an error message if not.\n */\n public static create(params: IPathImporterCreateParams): Result<PathImporter> {\n return captureResult(() => new PathImporter(params));\n }\n\n /**\n * {@inheritdoc Import.Importers.IImporter.import}\n */\n public import(\n item: IImportable,\n __manager: ResourceManagerBuilder\n ): DetailedResult<IImportable[], ImporterResultDetail> {\n const {\n value: fsItem,\n message: getTreeMessage,\n detail: getTreeDetail\n } = this._getFileTreeItemFromImportable(item);\n if (getTreeMessage !== undefined) {\n return failWithDetail(getTreeMessage, getTreeDetail === 'skipped' ? 'skipped' : 'failed');\n }\n\n if (fsItem.item.type === 'file' && this.ignoreFileTypes.includes(fsItem.item.extension)) {\n return succeedWithDetail([], 'processed');\n }\n\n // extracted characteristics are in the fsItem so add them to the context when\n // that is imported instead of now.\n const context = item.context;\n\n return succeedWithDetail([{ type: 'fsItem', item: fsItem, context }], 'processed');\n }\n\n /**\n * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.\n * @param item - The importable to convert.\n * @returns `Success` containing the `FsItem` if successful, `Failure` with an error message if not.\n */\n protected _getFileTreeItemFromImportable(item: IImportable): DetailedResult<FsItem, FsItemResultDetail> {\n if (item.type === 'path') {\n if ('path' in item && typeof item.path === 'string') {\n return FsItem.createForPath(item.path, this.qualifiers, this.tree);\n }\n return failWithDetail(`malformed path importable does not contain a string path`, 'failed');\n }\n return failWithDetail(`${item.type}: invalid importable type for a PathImporter`, 'skipped');\n }\n}\n"]}
|