@fgv/ts-res 5.0.0-9 → 5.0.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/CHANGELOG.json +21 -0
  2. package/CHANGELOG.md +14 -1
  3. package/README.md +794 -137
  4. package/dist/ts-res.d.ts +2257 -268
  5. package/dist/tsdoc-metadata.json +1 -1
  6. package/eslint.config.js +16 -0
  7. package/lib/index.d.ts +2 -1
  8. package/lib/index.js +3 -1
  9. package/lib/packlets/bundle/bundleBuilder.js +7 -4
  10. package/lib/packlets/bundle/bundleLoader.js +1 -0
  11. package/lib/packlets/bundle/bundleUtils.js +14 -16
  12. package/lib/packlets/bundle/index.d.ts +3 -1
  13. package/lib/packlets/bundle/index.js +14 -3
  14. package/lib/packlets/common/convert.d.ts +15 -0
  15. package/lib/packlets/common/convert.js +16 -1
  16. package/lib/packlets/common/helpers/context.js +1 -0
  17. package/lib/packlets/common/helpers/resources.d.ts +7 -0
  18. package/lib/packlets/common/helpers/resources.js +13 -0
  19. package/lib/packlets/common/resources.d.ts +44 -1
  20. package/lib/packlets/common/validate/conditions.d.ts +17 -1
  21. package/lib/packlets/common/validate/conditions.js +32 -6
  22. package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
  23. package/lib/packlets/common/validate/regularExpressions.js +5 -1
  24. package/lib/packlets/common/validate/resources.d.ts +35 -1
  25. package/lib/packlets/common/validate/resources.js +55 -0
  26. package/lib/packlets/conditions/condition.js +1 -0
  27. package/lib/packlets/conditions/conditionSet.d.ts +9 -0
  28. package/lib/packlets/conditions/conditionSet.js +75 -1
  29. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  30. package/lib/packlets/config/configInitFactory.js +302 -0
  31. package/lib/packlets/config/convert.d.ts +9 -0
  32. package/lib/packlets/config/convert.js +12 -1
  33. package/lib/packlets/config/index.d.ts +1 -0
  34. package/lib/packlets/config/index.js +1 -0
  35. package/lib/packlets/config/json.d.ts +1 -1
  36. package/lib/packlets/config/systemConfiguration.d.ts +16 -3
  37. package/lib/packlets/config/systemConfiguration.js +19 -40
  38. package/lib/packlets/import/fsItem.d.ts +2 -1
  39. package/lib/packlets/import/fsItem.js +9 -13
  40. package/lib/packlets/import/importManager.d.ts +2 -1
  41. package/lib/packlets/import/importers/jsonImporter.js +1 -0
  42. package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
  43. package/lib/packlets/import/importers/pathImporter.js +2 -1
  44. package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
  45. package/lib/packlets/qualifier-types/config/convert.js +67 -2
  46. package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
  47. package/lib/packlets/qualifier-types/config/json.js +11 -0
  48. package/lib/packlets/qualifier-types/convert.d.ts +1 -1
  49. package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
  50. package/lib/packlets/qualifier-types/helpers.js +2 -2
  51. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
  52. package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
  53. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
  54. package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
  55. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
  56. package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
  57. package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
  58. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
  59. package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
  60. package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
  61. package/lib/packlets/resource-json/compiled/convert.js +2 -1
  62. package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
  63. package/lib/packlets/resource-types/config/convert.d.ts +1 -1
  64. package/lib/packlets/resource-types/config/convert.js +3 -1
  65. package/lib/packlets/resource-types/config/json.d.ts +3 -1
  66. package/lib/packlets/resource-types/jsonResourceType.d.ts +10 -1
  67. package/lib/packlets/resource-types/jsonResourceType.js +7 -3
  68. package/lib/packlets/resource-types/resourceType.d.ts +100 -8
  69. package/lib/packlets/resource-types/resourceType.js +39 -3
  70. package/lib/packlets/resources/candidateReducer.js +3 -0
  71. package/lib/packlets/resources/candidateValue.d.ts +92 -0
  72. package/lib/packlets/resources/candidateValue.js +128 -0
  73. package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
  74. package/lib/packlets/resources/candidateValueCollector.js +96 -0
  75. package/lib/packlets/resources/common.d.ts +14 -0
  76. package/lib/packlets/resources/deltaGenerator.d.ts +189 -0
  77. package/lib/packlets/resources/deltaGenerator.js +344 -0
  78. package/lib/packlets/resources/index.d.ts +3 -0
  79. package/lib/packlets/resources/index.js +3 -0
  80. package/lib/packlets/resources/resource.d.ts +6 -6
  81. package/lib/packlets/resources/resource.js +5 -10
  82. package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
  83. package/lib/packlets/resources/resourceBuilder.js +4 -1
  84. package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
  85. package/lib/packlets/resources/resourceCandidate.js +17 -5
  86. package/lib/packlets/resources/resourceManagerBuilder.d.ts +131 -10
  87. package/lib/packlets/resources/resourceManagerBuilder.js +289 -45
  88. package/lib/packlets/runtime/compiledResourceCollection.d.ts +27 -11
  89. package/lib/packlets/runtime/compiledResourceCollection.js +71 -28
  90. package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
  91. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
  92. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
  93. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
  94. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
  95. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
  96. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
  97. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
  98. package/lib/packlets/runtime/iResourceManager.d.ts +17 -5
  99. package/lib/packlets/runtime/index.d.ts +1 -0
  100. package/lib/packlets/runtime/index.js +1 -0
  101. package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
  102. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
  103. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
  104. package/lib/packlets/runtime/resourceResolver.d.ts +43 -1
  105. package/lib/packlets/runtime/resourceResolver.js +56 -28
  106. package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
  107. package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
  108. package/lib/packlets/runtime/validate.js +1 -0
  109. package/lib/packlets/zip-archive/convert.d.ts +52 -0
  110. package/lib/packlets/zip-archive/convert.js +103 -0
  111. package/lib/packlets/zip-archive/index.d.ts +23 -0
  112. package/lib/packlets/zip-archive/index.js +95 -0
  113. package/lib/packlets/zip-archive/json.d.ts +64 -0
  114. package/lib/packlets/zip-archive/json.js +24 -0
  115. package/lib/packlets/zip-archive/types.d.ts +98 -0
  116. package/lib/packlets/zip-archive/types.js +39 -0
  117. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
  118. package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
  119. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
  120. package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
  121. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
  122. package/lib/packlets/zip-archive/zipArchiveLoader.js +286 -0
  123. package/package.json +26 -32
  124. package/CLAUDE.md +0 -186
  125. package/EXAMPLE_INIT_PARAMS.md +0 -88
  126. package/PROGRESS_SUMMARY.md +0 -48
  127. package/lib/index.d.ts.map +0 -1
  128. package/lib/index.js.map +0 -1
  129. package/lib/packlets/bundle/bundleBuilder.d.ts.map +0 -1
  130. package/lib/packlets/bundle/bundleBuilder.js.map +0 -1
  131. package/lib/packlets/bundle/bundleLoader.d.ts.map +0 -1
  132. package/lib/packlets/bundle/bundleLoader.js.map +0 -1
  133. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +0 -1
  134. package/lib/packlets/bundle/bundleNormalizer.js.map +0 -1
  135. package/lib/packlets/bundle/bundleUtils.d.ts.map +0 -1
  136. package/lib/packlets/bundle/bundleUtils.js.map +0 -1
  137. package/lib/packlets/bundle/convert.d.ts.map +0 -1
  138. package/lib/packlets/bundle/convert.js.map +0 -1
  139. package/lib/packlets/bundle/index.d.ts.map +0 -1
  140. package/lib/packlets/bundle/index.js.map +0 -1
  141. package/lib/packlets/bundle/model.d.ts.map +0 -1
  142. package/lib/packlets/bundle/model.js.map +0 -1
  143. package/lib/packlets/common/conditions.d.ts.map +0 -1
  144. package/lib/packlets/common/conditions.js.map +0 -1
  145. package/lib/packlets/common/convert.d.ts.map +0 -1
  146. package/lib/packlets/common/convert.js.map +0 -1
  147. package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
  148. package/lib/packlets/common/helpers/conditions.js.map +0 -1
  149. package/lib/packlets/common/helpers/context.d.ts.map +0 -1
  150. package/lib/packlets/common/helpers/context.js.map +0 -1
  151. package/lib/packlets/common/helpers/index.d.ts.map +0 -1
  152. package/lib/packlets/common/helpers/index.js.map +0 -1
  153. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
  154. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
  155. package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
  156. package/lib/packlets/common/helpers/resources.js.map +0 -1
  157. package/lib/packlets/common/index.d.ts.map +0 -1
  158. package/lib/packlets/common/index.js.map +0 -1
  159. package/lib/packlets/common/resources.d.ts.map +0 -1
  160. package/lib/packlets/common/resources.js.map +0 -1
  161. package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
  162. package/lib/packlets/common/validate/conditions.js.map +0 -1
  163. package/lib/packlets/common/validate/index.d.ts.map +0 -1
  164. package/lib/packlets/common/validate/index.js.map +0 -1
  165. package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
  166. package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
  167. package/lib/packlets/common/validate/resources.d.ts.map +0 -1
  168. package/lib/packlets/common/validate/resources.js.map +0 -1
  169. package/lib/packlets/conditions/condition.d.ts.map +0 -1
  170. package/lib/packlets/conditions/condition.js.map +0 -1
  171. package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
  172. package/lib/packlets/conditions/conditionCollector.js.map +0 -1
  173. package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
  174. package/lib/packlets/conditions/conditionDecls.js.map +0 -1
  175. package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
  176. package/lib/packlets/conditions/conditionSet.js.map +0 -1
  177. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
  178. package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
  179. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
  180. package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
  181. package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
  182. package/lib/packlets/conditions/conditionToken.js.map +0 -1
  183. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
  184. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
  185. package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
  186. package/lib/packlets/conditions/convert/decls.js.map +0 -1
  187. package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
  188. package/lib/packlets/conditions/convert/index.js.map +0 -1
  189. package/lib/packlets/conditions/index.d.ts.map +0 -1
  190. package/lib/packlets/conditions/index.js.map +0 -1
  191. package/lib/packlets/config/common.d.ts.map +0 -1
  192. package/lib/packlets/config/common.js.map +0 -1
  193. package/lib/packlets/config/convert.d.ts.map +0 -1
  194. package/lib/packlets/config/convert.js.map +0 -1
  195. package/lib/packlets/config/index.d.ts.map +0 -1
  196. package/lib/packlets/config/index.js.map +0 -1
  197. package/lib/packlets/config/json.d.ts.map +0 -1
  198. package/lib/packlets/config/json.js.map +0 -1
  199. package/lib/packlets/config/predefined/default.d.ts.map +0 -1
  200. package/lib/packlets/config/predefined/default.js.map +0 -1
  201. package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
  202. package/lib/packlets/config/predefined/extended.js.map +0 -1
  203. package/lib/packlets/config/predefined/index.d.ts.map +0 -1
  204. package/lib/packlets/config/predefined/index.js.map +0 -1
  205. package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
  206. package/lib/packlets/config/systemConfiguration.js.map +0 -1
  207. package/lib/packlets/context/contextDecls.d.ts.map +0 -1
  208. package/lib/packlets/context/contextDecls.js.map +0 -1
  209. package/lib/packlets/context/contextToken.d.ts.map +0 -1
  210. package/lib/packlets/context/contextToken.js.map +0 -1
  211. package/lib/packlets/context/convert/decls.d.ts.map +0 -1
  212. package/lib/packlets/context/convert/decls.js.map +0 -1
  213. package/lib/packlets/context/convert/index.d.ts.map +0 -1
  214. package/lib/packlets/context/convert/index.js.map +0 -1
  215. package/lib/packlets/context/index.d.ts.map +0 -1
  216. package/lib/packlets/context/index.js.map +0 -1
  217. package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
  218. package/lib/packlets/decisions/abstractDecision.js.map +0 -1
  219. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
  220. package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
  221. package/lib/packlets/decisions/candidate.d.ts.map +0 -1
  222. package/lib/packlets/decisions/candidate.js.map +0 -1
  223. package/lib/packlets/decisions/common.d.ts.map +0 -1
  224. package/lib/packlets/decisions/common.js.map +0 -1
  225. package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
  226. package/lib/packlets/decisions/concreteDecision.js.map +0 -1
  227. package/lib/packlets/decisions/decision.d.ts.map +0 -1
  228. package/lib/packlets/decisions/decision.js.map +0 -1
  229. package/lib/packlets/decisions/index.d.ts.map +0 -1
  230. package/lib/packlets/decisions/index.js.map +0 -1
  231. package/lib/packlets/import/fsItem.d.ts.map +0 -1
  232. package/lib/packlets/import/fsItem.js.map +0 -1
  233. package/lib/packlets/import/importContext.d.ts.map +0 -1
  234. package/lib/packlets/import/importContext.js.map +0 -1
  235. package/lib/packlets/import/importManager.d.ts.map +0 -1
  236. package/lib/packlets/import/importManager.js.map +0 -1
  237. package/lib/packlets/import/importable.d.ts.map +0 -1
  238. package/lib/packlets/import/importable.js.map +0 -1
  239. package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
  240. package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
  241. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
  242. package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
  243. package/lib/packlets/import/importers/importer.d.ts.map +0 -1
  244. package/lib/packlets/import/importers/importer.js.map +0 -1
  245. package/lib/packlets/import/importers/index.d.ts.map +0 -1
  246. package/lib/packlets/import/importers/index.js.map +0 -1
  247. package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
  248. package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
  249. package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
  250. package/lib/packlets/import/importers/pathImporter.js.map +0 -1
  251. package/lib/packlets/import/index.d.ts.map +0 -1
  252. package/lib/packlets/import/index.js.map +0 -1
  253. package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
  254. package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
  255. package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
  256. package/lib/packlets/qualifier-types/config/index.js.map +0 -1
  257. package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
  258. package/lib/packlets/qualifier-types/config/json.js.map +0 -1
  259. package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
  260. package/lib/packlets/qualifier-types/convert.js.map +0 -1
  261. package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
  262. package/lib/packlets/qualifier-types/helpers.js.map +0 -1
  263. package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
  264. package/lib/packlets/qualifier-types/index.js.map +0 -1
  265. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
  266. package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
  267. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
  268. package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
  269. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
  270. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
  271. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
  272. package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
  273. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
  274. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
  275. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
  276. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
  277. package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
  278. package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
  279. package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
  280. package/lib/packlets/qualifiers/convert/index.js.map +0 -1
  281. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
  282. package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
  283. package/lib/packlets/qualifiers/index.d.ts.map +0 -1
  284. package/lib/packlets/qualifiers/index.js.map +0 -1
  285. package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
  286. package/lib/packlets/qualifiers/qualifier.js.map +0 -1
  287. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
  288. package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
  289. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
  290. package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
  291. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
  292. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
  293. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
  294. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
  295. package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
  296. package/lib/packlets/resource-json/compiled/common.js.map +0 -1
  297. package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
  298. package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
  299. package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
  300. package/lib/packlets/resource-json/compiled/index.js.map +0 -1
  301. package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
  302. package/lib/packlets/resource-json/compiled/json.js.map +0 -1
  303. package/lib/packlets/resource-json/convert.d.ts.map +0 -1
  304. package/lib/packlets/resource-json/convert.js.map +0 -1
  305. package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
  306. package/lib/packlets/resource-json/helpers.js.map +0 -1
  307. package/lib/packlets/resource-json/index.d.ts.map +0 -1
  308. package/lib/packlets/resource-json/index.js.map +0 -1
  309. package/lib/packlets/resource-json/json.d.ts.map +0 -1
  310. package/lib/packlets/resource-json/json.js.map +0 -1
  311. package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
  312. package/lib/packlets/resource-json/normalized.js.map +0 -1
  313. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
  314. package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
  315. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
  316. package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
  317. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
  318. package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
  319. package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
  320. package/lib/packlets/resource-types/config/convert.js.map +0 -1
  321. package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
  322. package/lib/packlets/resource-types/config/index.js.map +0 -1
  323. package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
  324. package/lib/packlets/resource-types/config/json.js.map +0 -1
  325. package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
  326. package/lib/packlets/resource-types/helpers.js.map +0 -1
  327. package/lib/packlets/resource-types/index.d.ts.map +0 -1
  328. package/lib/packlets/resource-types/index.js.map +0 -1
  329. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
  330. package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
  331. package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
  332. package/lib/packlets/resource-types/resourceType.js.map +0 -1
  333. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
  334. package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
  335. package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
  336. package/lib/packlets/resources/candidateReducer.js.map +0 -1
  337. package/lib/packlets/resources/common.d.ts.map +0 -1
  338. package/lib/packlets/resources/common.js.map +0 -1
  339. package/lib/packlets/resources/index.d.ts.map +0 -1
  340. package/lib/packlets/resources/index.js.map +0 -1
  341. package/lib/packlets/resources/resource.d.ts.map +0 -1
  342. package/lib/packlets/resources/resource.js.map +0 -1
  343. package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
  344. package/lib/packlets/resources/resourceBuilder.js.map +0 -1
  345. package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
  346. package/lib/packlets/resources/resourceCandidate.js.map +0 -1
  347. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
  348. package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
  349. package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
  350. package/lib/packlets/runtime/cacheListener.js.map +0 -1
  351. package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
  352. package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
  353. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
  354. package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
  355. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
  356. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
  357. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
  358. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
  359. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
  360. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
  361. package/lib/packlets/runtime/context/index.d.ts.map +0 -1
  362. package/lib/packlets/runtime/context/index.js.map +0 -1
  363. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
  364. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
  365. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
  366. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
  367. package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
  368. package/lib/packlets/runtime/iResourceManager.js.map +0 -1
  369. package/lib/packlets/runtime/index.d.ts.map +0 -1
  370. package/lib/packlets/runtime/index.js.map +0 -1
  371. package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
  372. package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
  373. package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
  374. package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
  375. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
  376. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
  377. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
  378. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
  379. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
  380. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
  381. package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
  382. package/lib/packlets/runtime/resourceResolver.js.map +0 -1
  383. package/lib/packlets/runtime/validate.d.ts.map +0 -1
  384. package/lib/packlets/runtime/validate.js.map +0 -1
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.ValidatingResourceTypeFactory = exports.ResourceTypeFactory = exports.BuiltInResourceTypeFactory = exports.ValidatingQualifierTypeFactory = exports.QualifierTypeFactory = exports.BuiltInQualifierTypeFactory = exports.ChainedConfigInitFactory = void 0;
58
+ exports.createQualifierTypeFactory = createQualifierTypeFactory;
59
+ exports.createResourceTypeFactory = createResourceTypeFactory;
60
+ const ts_utils_1 = require("@fgv/ts-utils");
61
+ const QualifierTypes = __importStar(require("../qualifier-types"));
62
+ const ResourceTypes = __importStar(require("../resource-types"));
63
+ /**
64
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a factory function.
65
+ * @param fn - The factory function to wrap.
66
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
67
+ * @public
68
+ */
69
+ function createQualifierTypeFactory(fn) {
70
+ return {
71
+ create: fn
72
+ };
73
+ }
74
+ /**
75
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a resource type factory function.
76
+ * @param fn - The factory function to wrap.
77
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
78
+ * @public
79
+ */
80
+ function createResourceTypeFactory(fn) {
81
+ return {
82
+ create: fn
83
+ };
84
+ }
85
+ /**
86
+ * A factory that chains multiple factories together.
87
+ * @public
88
+ */
89
+ class ChainedConfigInitFactory {
90
+ /**
91
+ * Constructor for a chained config init factory.
92
+ * @param factories - The factories to chain.
93
+ */
94
+ constructor(factories) {
95
+ this.factories = factories;
96
+ }
97
+ /**
98
+ * Creates a new instance of a configuration object.
99
+ * @param config - The configuration object to create.
100
+ * @returns A result containing the new instance of the configuration object.
101
+ */
102
+ create(config) {
103
+ for (const factory of this.factories) {
104
+ const result = factory.create(config);
105
+ if (result.isSuccess()) {
106
+ return result;
107
+ }
108
+ }
109
+ return (0, ts_utils_1.fail)('No factory was able to create the configuration object');
110
+ }
111
+ }
112
+ exports.ChainedConfigInitFactory = ChainedConfigInitFactory;
113
+ /**
114
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
115
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
116
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
117
+ * if successful, `Failure` with an error message otherwise.
118
+ * @public
119
+ */
120
+ class BuiltInQualifierTypeFactory {
121
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
122
+ create(config) {
123
+ if (QualifierTypes.Config.isSystemQualifierTypeConfig(config)) {
124
+ return QualifierTypes.createQualifierTypeFromSystemConfig(config);
125
+ }
126
+ return (0, ts_utils_1.fail)(`${config.name}: unknown built-in qualifier type (${config.systemType})`);
127
+ }
128
+ }
129
+ exports.BuiltInQualifierTypeFactory = BuiltInQualifierTypeFactory;
130
+ /**
131
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
132
+ * supporting both built-in system types and custom external types.
133
+ *
134
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
135
+ * while maintaining support for all built-in types (Language, Territory, Literal).
136
+ *
137
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
138
+ *
139
+ * @example Creating a factory with custom qualifier types
140
+ * ```typescript
141
+ * // Define a custom qualifier type
142
+ * class CustomQualifierType extends QualifierType {
143
+ * // ... implementation
144
+ * }
145
+ *
146
+ * // Define a discriminated union of all types
147
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
148
+ *
149
+ * // Create a factory that handles custom types
150
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
151
+ * create(config) {
152
+ * // ... handle custom type creation
153
+ * }
154
+ * };
155
+ *
156
+ * // Create the combined factory
157
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
158
+ *
159
+ * // The factory returns T | SystemQualifierType, supporting all types
160
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
161
+ * ```
162
+ *
163
+ * @remarks
164
+ * - The factory chains custom factories with the built-in factory
165
+ * - Custom factories are tried first, falling back to built-in types
166
+ * - The return type is a union of custom types (T) and system types
167
+ *
168
+ * @public
169
+ */
170
+ class QualifierTypeFactory extends ChainedConfigInitFactory {
171
+ /**
172
+ * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
173
+ * @param factories - Array of factories for custom qualifier types. Can be:
174
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
175
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
176
+ * - A mix of both
177
+ * These are tried in order before falling back to built-in types.
178
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
179
+ * system qualifier types (Language, Territory, Literal).
180
+ */
181
+ constructor(factories) {
182
+ const normalizedFactories = factories.map((f) => typeof f === 'function' ? createQualifierTypeFactory(f) : f);
183
+ super([...normalizedFactories, new BuiltInQualifierTypeFactory()]);
184
+ }
185
+ }
186
+ exports.QualifierTypeFactory = QualifierTypeFactory;
187
+ /**
188
+ * A factory that validates and creates {@link QualifierTypes.QualifierType | QualifierType} instances
189
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
190
+ * string properties and validates them before delegating to the underlying factory chain.
191
+ *
192
+ * This pattern is useful at package boundaries where type identity issues may occur with
193
+ * branded types across different package instances.
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * // Accept weakly-typed config from external source
198
+ * const validatingFactory = new ValidatingQualifierTypeFactory([customFactory]);
199
+ *
200
+ * // Config can have plain string types instead of branded types
201
+ * const config = {
202
+ * name: 'my-qualifier', // plain string, not QualifierTypeName
203
+ * systemType: 'custom', // plain string
204
+ * configuration: { ... }
205
+ * };
206
+ *
207
+ * const result = validatingFactory.create(config); // Validates and converts internally
208
+ * ```
209
+ *
210
+ * @public
211
+ */
212
+ class ValidatingQualifierTypeFactory {
213
+ /**
214
+ * Constructor for a validating qualifier type factory.
215
+ * @param factories - Array of factories for custom qualifier types. Can be:
216
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
217
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
218
+ * - A mix of both
219
+ */
220
+ constructor(factories) {
221
+ this._innerFactory = new QualifierTypeFactory(factories);
222
+ }
223
+ /**
224
+ * Creates a qualifier type from a weakly-typed configuration object.
225
+ * @param config - The configuration object to validate and use for creation.
226
+ * @returns A result containing the new qualifier type if successful.
227
+ */
228
+ create(config) {
229
+ return QualifierTypes.Config.Convert.anyQualifierTypeConfig
230
+ .convert(config)
231
+ .onSuccess((validatedConfig) => {
232
+ return this._innerFactory.create(validatedConfig);
233
+ });
234
+ }
235
+ }
236
+ exports.ValidatingQualifierTypeFactory = ValidatingQualifierTypeFactory;
237
+ /**
238
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}.
239
+ * @public
240
+ */
241
+ class BuiltInResourceTypeFactory {
242
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
243
+ create(config) {
244
+ return ResourceTypes.createResourceTypeFromConfig(config);
245
+ }
246
+ }
247
+ exports.BuiltInResourceTypeFactory = BuiltInResourceTypeFactory;
248
+ /**
249
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}
250
+ * by chaining a supplied factory with a {@link Config.BuiltInResourceTypeFactory | built-in factory} that handles built-in resource types.
251
+ * @public
252
+ */
253
+ class ResourceTypeFactory extends ChainedConfigInitFactory {
254
+ /**
255
+ * Constructor for a resource type factory.
256
+ * @param factories - Array of factories for resource types. Can be:
257
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
258
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
259
+ * - A mix of both
260
+ * @remarks The {@link Config.BuiltInResourceTypeFactory | built-in factory} is always added to the end of the chain.
261
+ */
262
+ constructor(factories) {
263
+ factories = factories !== null && factories !== void 0 ? factories : [];
264
+ const normalizedFactories = factories.map((f) => typeof f === 'function' ? createResourceTypeFactory(f) : f);
265
+ super([...normalizedFactories, new BuiltInResourceTypeFactory()]);
266
+ }
267
+ }
268
+ exports.ResourceTypeFactory = ResourceTypeFactory;
269
+ /**
270
+ * A factory that validates and creates {@link ResourceTypes.ResourceType | ResourceType} instances
271
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
272
+ * string properties and validates them before delegating to the underlying factory chain.
273
+ *
274
+ * This pattern is useful at package boundaries where type identity issues may occur with
275
+ * branded types across different package instances.
276
+ *
277
+ * @public
278
+ */
279
+ class ValidatingResourceTypeFactory {
280
+ /**
281
+ * Constructor for a validating resource type factory.
282
+ * @param factories - Array of factories for resource types. Can be:
283
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
284
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
285
+ * - A mix of both
286
+ */
287
+ constructor(factories) {
288
+ this._innerFactory = new ResourceTypeFactory(factories);
289
+ }
290
+ /**
291
+ * Creates a resource type from a weakly-typed configuration object.
292
+ * @param config - The configuration object to validate and use for creation.
293
+ * @returns A result containing the new resource type if successful.
294
+ */
295
+ create(config) {
296
+ return ResourceTypes.Config.Convert.resourceTypeConfig.convert(config).onSuccess((validatedConfig) => {
297
+ return this._innerFactory.create(validatedConfig);
298
+ });
299
+ }
300
+ }
301
+ exports.ValidatingResourceTypeFactory = ValidatingResourceTypeFactory;
302
+ //# sourceMappingURL=configInitFactory.js.map
@@ -1,3 +1,4 @@
1
+ import { Result } from '@fgv/ts-utils';
1
2
  import { ISystemConfiguration } from './json';
2
3
  /**
3
4
  * A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.
@@ -11,4 +12,12 @@ export declare const systemConfiguration: import("@fgv/ts-utils").ObjectConverte
11
12
  * @public
12
13
  */
13
14
  export declare const predefinedSystemConfiguration: import("@fgv/ts-utils").Converter<import("./common").PredefinedSystemConfiguration, readonly import("./common").PredefinedSystemConfiguration[]>;
15
+ /**
16
+ * Validate a {@link Config.Model.ISystemConfiguration | ISystemConfiguration} object.
17
+ * @param config - The system configuration to validate
18
+ * @returns `Success` with the validated system configuration if successful,
19
+ * or `Failure` with an error message if validation fails.
20
+ * @public
21
+ */
22
+ export declare function validateSystemConfiguration(config: unknown): Result<ISystemConfiguration>;
14
23
  //# sourceMappingURL=convert.d.ts.map
@@ -55,6 +55,7 @@ var __importStar = (this && this.__importStar) || (function () {
55
55
  })();
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
57
  exports.predefinedSystemConfiguration = exports.systemConfiguration = void 0;
58
+ exports.validateSystemConfiguration = validateSystemConfiguration;
58
59
  /* eslint-disable @rushstack/typedef-var */
59
60
  const ts_utils_1 = require("@fgv/ts-utils");
60
61
  const QualifierTypes = __importStar(require("../qualifier-types"));
@@ -69,7 +70,7 @@ const common_1 = require("./common");
69
70
  exports.systemConfiguration = ts_utils_1.Converters.strictObject({
70
71
  name: ts_utils_1.Converters.optionalString,
71
72
  description: ts_utils_1.Converters.optionalString,
72
- qualifierTypes: ts_utils_1.Converters.arrayOf(QualifierTypes.Config.Convert.systemQualifierTypeConfig),
73
+ qualifierTypes: ts_utils_1.Converters.arrayOf(QualifierTypes.Config.Convert.anyQualifierTypeConfig),
73
74
  qualifiers: ts_utils_1.Converters.arrayOf(Qualifiers.Convert.qualifierDecl),
74
75
  resourceTypes: ts_utils_1.Converters.arrayOf(ResourceTypes.Config.Convert.resourceTypeConfig)
75
76
  });
@@ -79,4 +80,14 @@ exports.systemConfiguration = ts_utils_1.Converters.strictObject({
79
80
  * @public
80
81
  */
81
82
  exports.predefinedSystemConfiguration = ts_utils_1.Converters.enumeratedValue(common_1.allPredefinedSystemConfigurations);
83
+ /**
84
+ * Validate a {@link Config.Model.ISystemConfiguration | ISystemConfiguration} object.
85
+ * @param config - The system configuration to validate
86
+ * @returns `Success` with the validated system configuration if successful,
87
+ * or `Failure` with an error message if validation fails.
88
+ * @public
89
+ */
90
+ function validateSystemConfiguration(config) {
91
+ return exports.systemConfiguration.convert(config);
92
+ }
82
93
  //# sourceMappingURL=convert.js.map
@@ -1,5 +1,6 @@
1
1
  import * as Model from './json';
2
2
  import * as Convert from './convert';
3
+ export * from './configInitFactory';
3
4
  export * from './systemConfiguration';
4
5
  export * from './common';
5
6
  export { Model, Convert };
@@ -62,6 +62,7 @@ const Model = __importStar(require("./json"));
62
62
  exports.Model = Model;
63
63
  const Convert = __importStar(require("./convert"));
64
64
  exports.Convert = Convert;
65
+ __exportStar(require("./configInitFactory"), exports);
65
66
  __exportStar(require("./systemConfiguration"), exports);
66
67
  __exportStar(require("./common"), exports);
67
68
  //# sourceMappingURL=index.js.map
@@ -11,7 +11,7 @@ export interface ISystemConfiguration {
11
11
  /** Optional description explaining the purpose and use case of the configuration. */
12
12
  description?: string;
13
13
  /** Qualifier type configurations that define the available qualifier types in the system. */
14
- qualifierTypes: QualifierTypes.Config.ISystemQualifierTypeConfig[];
14
+ qualifierTypes: QualifierTypes.Config.IAnyQualifierTypeConfig[];
15
15
  /** Qualifier declarations that define the available qualifiers in the system. */
16
16
  qualifiers: Qualifiers.IQualifierDecl[];
17
17
  /** Resource type configurations that define the available resource types in the system. */
@@ -1,8 +1,11 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ReadOnlyQualifierTypeCollector } from '../qualifier-types';
2
+ import * as QualifierTypes from '../qualifier-types';
3
+ import * as ResourceTypes from '../resource-types';
4
+ import { QualifierType, ReadOnlyQualifierTypeCollector } from '../qualifier-types';
3
5
  import { IReadOnlyQualifierCollector } from '../qualifiers';
4
- import { ReadOnlyResourceTypeCollector } from '../resource-types';
6
+ import { ReadOnlyResourceTypeCollector, ResourceType } from '../resource-types';
5
7
  import { ISystemConfiguration } from './json';
8
+ import { IConfigInitFactory } from './configInitFactory';
6
9
  /**
7
10
  * Parameters used to initialize a {@link Config.SystemConfiguration | SystemConfiguration}.
8
11
  * @public
@@ -14,6 +17,8 @@ export interface ISystemConfigurationInitParams {
14
17
  * Use `null` as the value to remove an existing default value.
15
18
  */
16
19
  qualifierDefaultValues?: Record<string, string | null>;
20
+ qualifierTypeFactory?: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType>;
21
+ resourceTypeFactory?: IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType>;
17
22
  }
18
23
  /**
19
24
  * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}
@@ -58,7 +63,7 @@ export declare class SystemConfiguration {
58
63
  * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.
59
64
  * @public
60
65
  */
61
- protected constructor(config: ISystemConfiguration);
66
+ protected constructor(config: ISystemConfiguration, initParams?: ISystemConfigurationInitParams);
62
67
  /**
63
68
  * Creates a new {@link Config.SystemConfiguration | SystemConfiguration} from the supplied
64
69
  * {@link Config.Model.ISystemConfiguration | system configuration}.
@@ -69,6 +74,14 @@ export declare class SystemConfiguration {
69
74
  * @public
70
75
  */
71
76
  static create(config: ISystemConfiguration, initParams?: ISystemConfigurationInitParams): Result<SystemConfiguration>;
77
+ /**
78
+ * Loads a {@link Config.SystemConfiguration | SystemConfiguration} from a file.
79
+ * @param path - The path to the file to load.
80
+ * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
81
+ * if successful, `Failure` with an error message otherwise.
82
+ * @public
83
+ */
84
+ static loadFromFile(path: string, initParams?: ISystemConfigurationInitParams): Result<SystemConfiguration>;
72
85
  /**
73
86
  * Returns the {@link Config.Model.ISystemConfiguration | system configuration} that this
74
87
  * {@link Config.SystemConfiguration | SystemConfiguration} was created from.
@@ -20,50 +20,16 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || (function () {
40
- var ownKeys = function(o) {
41
- ownKeys = Object.getOwnPropertyNames || function (o) {
42
- var ar = [];
43
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
- return ar;
45
- };
46
- return ownKeys(o);
47
- };
48
- return function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
- __setModuleDefault(result, mod);
53
- return result;
54
- };
55
- })();
56
23
  Object.defineProperty(exports, "__esModule", { value: true });
57
24
  exports.SystemConfiguration = void 0;
58
25
  exports.updateSystemConfigurationQualifierDefaultValues = updateSystemConfigurationQualifierDefaultValues;
59
26
  const ts_utils_1 = require("@fgv/ts-utils");
60
- const QualifierTypes = __importStar(require("../qualifier-types"));
61
- const ResourceTypes = __importStar(require("../resource-types"));
62
27
  const qualifier_types_1 = require("../qualifier-types");
63
28
  const qualifiers_1 = require("../qualifiers");
64
29
  const resource_types_1 = require("../resource-types");
65
30
  const convert_1 = require("./convert");
66
31
  const ts_json_base_1 = require("@fgv/ts-json-base");
32
+ const configInitFactory_1 = require("./configInitFactory");
67
33
  /**
68
34
  * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}
69
35
  * with updated qualifier default values.
@@ -129,17 +95,20 @@ class SystemConfiguration {
129
95
  * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.
130
96
  * @public
131
97
  */
132
- constructor(config) {
98
+ constructor(config, initParams) {
99
+ var _a, _b;
133
100
  this._config = config;
101
+ const qualifierTypeFactory = (_a = initParams === null || initParams === void 0 ? void 0 : initParams.qualifierTypeFactory) !== null && _a !== void 0 ? _a : new configInitFactory_1.BuiltInQualifierTypeFactory();
102
+ const resourceTypeFactory = (_b = initParams === null || initParams === void 0 ? void 0 : initParams.resourceTypeFactory) !== null && _b !== void 0 ? _b : new configInitFactory_1.BuiltInResourceTypeFactory();
134
103
  this.qualifierTypes = qualifier_types_1.QualifierTypeCollector.create({
135
- qualifierTypes: (0, ts_utils_1.mapResults)(config.qualifierTypes.map(QualifierTypes.createQualifierTypeFromSystemConfig)).orThrow()
104
+ qualifierTypes: (0, ts_utils_1.mapResults)(config.qualifierTypes.map((tc) => qualifierTypeFactory.create(tc))).orThrow()
136
105
  }).orThrow();
137
106
  this.qualifiers = qualifiers_1.QualifierCollector.create({
138
107
  qualifierTypes: this.qualifierTypes,
139
108
  qualifiers: config.qualifiers
140
109
  }).orThrow();
141
110
  this.resourceTypes = resource_types_1.ResourceTypeCollector.create({
142
- resourceTypes: (0, ts_utils_1.mapResults)(config.resourceTypes.map(ResourceTypes.createResourceTypeFromConfig)).orThrow()
111
+ resourceTypes: (0, ts_utils_1.mapResults)(config.resourceTypes.map((rt) => resourceTypeFactory.create(rt))).orThrow()
143
112
  }).orThrow();
144
113
  }
145
114
  /**
@@ -153,9 +122,19 @@ class SystemConfiguration {
153
122
  */
154
123
  static create(config, initParams) {
155
124
  if (initParams === null || initParams === void 0 ? void 0 : initParams.qualifierDefaultValues) {
156
- return updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues).onSuccess((updatedConfig) => (0, ts_utils_1.captureResult)(() => new SystemConfiguration(updatedConfig)));
125
+ return updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues).onSuccess((updatedConfig) => (0, ts_utils_1.captureResult)(() => new SystemConfiguration(updatedConfig, (0, ts_utils_1.omit)(initParams, ['qualifierDefaultValues']))));
157
126
  }
158
- return (0, ts_utils_1.captureResult)(() => new SystemConfiguration(config));
127
+ return (0, ts_utils_1.captureResult)(() => new SystemConfiguration(config, initParams));
128
+ }
129
+ /**
130
+ * Loads a {@link Config.SystemConfiguration | SystemConfiguration} from a file.
131
+ * @param path - The path to the file to load.
132
+ * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
133
+ * if successful, `Failure` with an error message otherwise.
134
+ * @public
135
+ */
136
+ static loadFromFile(path, initParams) {
137
+ return ts_json_base_1.JsonFile.convertJsonFileSync(path, convert_1.systemConfiguration).onSuccess((config) => SystemConfiguration.create(config, initParams));
159
138
  }
160
139
  /**
161
140
  * Returns the {@link Config.Model.ISystemConfiguration | system configuration} that this
@@ -1,4 +1,5 @@
1
- import { DetailedResult, FileTree, Result } from '@fgv/ts-utils';
1
+ import { DetailedResult, Result } from '@fgv/ts-utils';
2
+ import { FileTree } from '@fgv/ts-json-base';
2
3
  import * as Conditions from '../conditions';
3
4
  import { IReadOnlyQualifierCollector } from '../qualifiers';
4
5
  import { ImportContext } from './importContext';
@@ -56,6 +56,7 @@ var __importStar = (this && this.__importStar) || (function () {
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
57
  exports.FsItem = void 0;
58
58
  const ts_utils_1 = require("@fgv/ts-utils");
59
+ const ts_json_base_1 = require("@fgv/ts-json-base");
59
60
  const common_1 = require("../common");
60
61
  const Conditions = __importStar(require("../conditions"));
61
62
  const importContext_1 = require("./importContext");
@@ -110,19 +111,14 @@ class FsItem {
110
111
  * that should be silently ignored.
111
112
  */
112
113
  static createForPath(importPath, qualifiers, tree) {
113
- if (tree === undefined) {
114
- /* c8 ignore next 7 - functional code path tested but coverage intermittently missed */
115
- const treeResult = ts_utils_1.FileTree.forFilesystem();
116
- /* c8 ignore next 3 - defense in depth should never happen */
117
- if (treeResult.isFailure()) {
118
- return (0, ts_utils_1.failWithDetail)(treeResult.message, 'failed');
119
- }
120
- tree = treeResult.value;
121
- }
122
- return tree
123
- .getItem(importPath)
124
- .withDetail('failed')
125
- .onSuccess((item) => FsItem.createForItem(item, qualifiers));
114
+ return (0, ts_utils_1.useOrInitialize)(tree, () => ts_json_base_1.FileTree.forFilesystem())
115
+ .withDetail('failed', 'succeeded')
116
+ .onSuccess((tree) => {
117
+ return tree
118
+ .getItem(importPath)
119
+ .withDetail('failed')
120
+ .onSuccess((item) => FsItem.createForItem(item, qualifiers));
121
+ });
126
122
  }
127
123
  /**
128
124
  * Tries to parse a base name into a base name and a set of conditions.
@@ -1,4 +1,5 @@
1
- import { FileTree, Result } from '@fgv/ts-utils';
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { FileTree } from '@fgv/ts-json-base';
2
3
  import { ResourceManagerBuilder } from '../resources';
3
4
  import { ImportContext } from './importContext';
4
5
  import { IImportable } from './importable';
@@ -85,6 +85,7 @@ class JsonImporter {
85
85
  */
86
86
  import(item, manager) {
87
87
  var _a, _b;
88
+ /* c8 ignore next 1 - coverage intermittently misses the next line */
88
89
  if (!(0, importable_1.isImportable)(item) || item.type !== 'json') {
89
90
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
90
91
  const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
@@ -1,4 +1,5 @@
1
- import { DetailedResult, Result, FileTree } from '@fgv/ts-utils';
1
+ import { DetailedResult, Result } from '@fgv/ts-utils';
2
+ import { FileTree } from '@fgv/ts-json-base';
2
3
  import { ResourceManagerBuilder } from '../../resources';
3
4
  import { IImportable } from '../importable';
4
5
  import { IImporter, ImporterResultDetail } from './importer';
@@ -23,6 +23,7 @@
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.PathImporter = void 0;
25
25
  const ts_utils_1 = require("@fgv/ts-utils");
26
+ const ts_json_base_1 = require("@fgv/ts-json-base");
26
27
  const fsItem_1 = require("../fsItem");
27
28
  /**
28
29
  * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`
@@ -41,7 +42,7 @@ class PathImporter {
41
42
  */
42
43
  this.types = ['path'];
43
44
  this.qualifiers = params.qualifiers;
44
- this.tree = (_a = params.tree) !== null && _a !== void 0 ? _a : ts_utils_1.FileTree.forFilesystem().orThrow();
45
+ this.tree = (_a = params.tree) !== null && _a !== void 0 ? _a : ts_json_base_1.FileTree.forFilesystem().orThrow();
45
46
  this.ignoreFileTypes = (_b = params.ignoreFileTypes) !== null && _b !== void 0 ? _b : [];
46
47
  }
47
48
  /**
@@ -1,4 +1,6 @@
1
+ import { Converter } from '@fgv/ts-utils';
1
2
  import * as Model from './json';
3
+ import { Converters as JsonConverters } from '@fgv/ts-json-base';
2
4
  /**
3
5
  * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
4
6
  * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
@@ -40,5 +42,24 @@ export declare const systemLiteralQualifierTypeConfig: import("@fgv/ts-utils").O
40
42
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
41
43
  * @public
42
44
  */
43
- export declare const systemQualifierTypeConfig: import("@fgv/ts-utils").Converter<Model.ISystemQualifierTypeConfig, unknown>;
45
+ export declare const systemQualifierTypeConfig: Converter<Model.ISystemQualifierTypeConfig, unknown>;
46
+ /**
47
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
48
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
49
+ * @param config - A `Converter` for the configuration object.
50
+ * @public
51
+ */
52
+ export declare function qualifierTypeConfig<T, TD = unknown>(config: Converter<T, TD>): Converter<Model.IQualifierTypeConfig<T>, TD>;
53
+ /**
54
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
55
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
56
+ * @public
57
+ */
58
+ export declare const jsonQualifierTypeConfig: Converter<Model.IQualifierTypeConfig<import("@fgv/ts-json-base").JsonObject>, JsonConverters.IJsonConverterContext>;
59
+ /**
60
+ * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
61
+ * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
62
+ * @public
63
+ */
64
+ export declare const anyQualifierTypeConfig: Converter<Model.IAnyQualifierTypeConfig, unknown>;
44
65
  //# sourceMappingURL=convert.d.ts.map