@fgv/ts-res 5.0.0-3 → 5.0.0-31

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 (379) hide show
  1. package/README.md +794 -137
  2. package/dist/ts-res.d.ts +2671 -355
  3. package/dist/tsdoc-metadata.json +1 -1
  4. package/eslint.config.js +16 -0
  5. package/lib/index.d.ts +11 -2
  6. package/lib/index.js +25 -2
  7. package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
  8. package/lib/packlets/bundle/bundleBuilder.js +134 -0
  9. package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
  10. package/lib/packlets/bundle/bundleLoader.js +105 -0
  11. package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
  12. package/lib/packlets/bundle/bundleNormalizer.js +142 -0
  13. package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
  14. package/lib/packlets/bundle/bundleUtils.js +117 -0
  15. package/lib/packlets/bundle/convert.d.ts +33 -0
  16. package/lib/packlets/bundle/convert.js +78 -0
  17. package/lib/packlets/bundle/index.d.ts +21 -0
  18. package/lib/packlets/bundle/index.js +83 -0
  19. package/lib/packlets/bundle/model.d.ts +100 -0
  20. package/lib/packlets/bundle/model.js +24 -0
  21. package/lib/packlets/common/convert.d.ts +15 -0
  22. package/lib/packlets/common/convert.js +16 -1
  23. package/lib/packlets/common/helpers/context.js +1 -0
  24. package/lib/packlets/common/helpers/resources.d.ts +7 -0
  25. package/lib/packlets/common/helpers/resources.js +13 -0
  26. package/lib/packlets/common/resources.d.ts +48 -1
  27. package/lib/packlets/common/validate/conditions.d.ts +17 -1
  28. package/lib/packlets/common/validate/conditions.js +32 -6
  29. package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
  30. package/lib/packlets/common/validate/regularExpressions.js +5 -1
  31. package/lib/packlets/common/validate/resources.d.ts +35 -1
  32. package/lib/packlets/common/validate/resources.js +55 -0
  33. package/lib/packlets/conditions/condition.js +1 -0
  34. package/lib/packlets/conditions/conditionSet.d.ts +9 -0
  35. package/lib/packlets/conditions/conditionSet.js +75 -1
  36. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  37. package/lib/packlets/config/configInitFactory.js +302 -0
  38. package/lib/packlets/config/convert.d.ts +9 -0
  39. package/lib/packlets/config/convert.js +12 -1
  40. package/lib/packlets/config/index.d.ts +1 -0
  41. package/lib/packlets/config/index.js +1 -0
  42. package/lib/packlets/config/json.d.ts +1 -1
  43. package/lib/packlets/config/systemConfiguration.d.ts +16 -3
  44. package/lib/packlets/config/systemConfiguration.js +19 -40
  45. package/lib/packlets/import/fsItem.d.ts +2 -1
  46. package/lib/packlets/import/fsItem.js +9 -13
  47. package/lib/packlets/import/importManager.d.ts +2 -1
  48. package/lib/packlets/import/importers/jsonImporter.js +1 -0
  49. package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
  50. package/lib/packlets/import/importers/pathImporter.js +2 -1
  51. package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
  52. package/lib/packlets/qualifier-types/config/convert.js +67 -2
  53. package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
  54. package/lib/packlets/qualifier-types/config/json.js +11 -0
  55. package/lib/packlets/qualifier-types/convert.d.ts +1 -1
  56. package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
  57. package/lib/packlets/qualifier-types/helpers.js +2 -2
  58. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
  59. package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
  60. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
  61. package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
  62. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
  63. package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
  64. package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
  65. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
  66. package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
  67. package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
  68. package/lib/packlets/resource-json/compiled/convert.js +2 -1
  69. package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
  70. package/lib/packlets/resource-types/config/convert.d.ts +1 -1
  71. package/lib/packlets/resource-types/config/convert.js +3 -1
  72. package/lib/packlets/resource-types/config/json.d.ts +3 -1
  73. package/lib/packlets/resource-types/jsonResourceType.d.ts +14 -5
  74. package/lib/packlets/resource-types/jsonResourceType.js +8 -4
  75. package/lib/packlets/resource-types/resourceType.d.ts +115 -14
  76. package/lib/packlets/resource-types/resourceType.js +39 -3
  77. package/lib/packlets/resources/candidateReducer.js +3 -0
  78. package/lib/packlets/resources/candidateValue.d.ts +92 -0
  79. package/lib/packlets/resources/candidateValue.js +128 -0
  80. package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
  81. package/lib/packlets/resources/candidateValueCollector.js +96 -0
  82. package/lib/packlets/resources/common.d.ts +26 -0
  83. package/lib/packlets/resources/index.d.ts +2 -0
  84. package/lib/packlets/resources/index.js +2 -0
  85. package/lib/packlets/resources/resource.d.ts +6 -6
  86. package/lib/packlets/resources/resource.js +5 -10
  87. package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
  88. package/lib/packlets/resources/resourceBuilder.js +4 -1
  89. package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
  90. package/lib/packlets/resources/resourceCandidate.js +17 -5
  91. package/lib/packlets/resources/resourceManagerBuilder.d.ts +189 -11
  92. package/lib/packlets/resources/resourceManagerBuilder.js +481 -17
  93. package/lib/packlets/runtime/cacheListener.d.ts +9 -0
  94. package/lib/packlets/runtime/cacheListener.js +6 -0
  95. package/lib/packlets/runtime/cacheMetrics.d.ts +6 -0
  96. package/lib/packlets/runtime/cacheMetrics.js +11 -0
  97. package/lib/packlets/runtime/compiledResourceCollection.d.ts +23 -11
  98. package/lib/packlets/runtime/compiledResourceCollection.js +65 -28
  99. package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
  100. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
  101. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
  102. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
  103. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
  104. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
  105. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
  106. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
  107. package/lib/packlets/runtime/iResourceManager.d.ts +13 -5
  108. package/lib/packlets/runtime/index.d.ts +1 -0
  109. package/lib/packlets/runtime/index.js +1 -0
  110. package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
  111. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
  112. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
  113. package/lib/packlets/runtime/resourceResolver.d.ts +60 -1
  114. package/lib/packlets/runtime/resourceResolver.js +89 -45
  115. package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
  116. package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
  117. package/lib/packlets/runtime/validate.js +1 -0
  118. package/lib/packlets/zip-archive/convert.d.ts +52 -0
  119. package/lib/packlets/zip-archive/convert.js +103 -0
  120. package/lib/packlets/zip-archive/index.d.ts +23 -0
  121. package/lib/packlets/zip-archive/index.js +95 -0
  122. package/lib/packlets/zip-archive/json.d.ts +64 -0
  123. package/lib/packlets/zip-archive/json.js +24 -0
  124. package/lib/packlets/zip-archive/types.d.ts +98 -0
  125. package/lib/packlets/zip-archive/types.js +39 -0
  126. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
  127. package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
  128. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
  129. package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
  130. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
  131. package/lib/packlets/zip-archive/zipArchiveLoader.js +285 -0
  132. package/package.json +26 -32
  133. package/CLAUDE.md +0 -186
  134. package/EXAMPLE_INIT_PARAMS.md +0 -88
  135. package/PROGRESS_SUMMARY.md +0 -48
  136. package/lib/index.d.ts.map +0 -1
  137. package/lib/index.js.map +0 -1
  138. package/lib/packlets/common/conditions.d.ts.map +0 -1
  139. package/lib/packlets/common/conditions.js.map +0 -1
  140. package/lib/packlets/common/convert.d.ts.map +0 -1
  141. package/lib/packlets/common/convert.js.map +0 -1
  142. package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
  143. package/lib/packlets/common/helpers/conditions.js.map +0 -1
  144. package/lib/packlets/common/helpers/context.d.ts.map +0 -1
  145. package/lib/packlets/common/helpers/context.js.map +0 -1
  146. package/lib/packlets/common/helpers/index.d.ts.map +0 -1
  147. package/lib/packlets/common/helpers/index.js.map +0 -1
  148. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
  149. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
  150. package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
  151. package/lib/packlets/common/helpers/resources.js.map +0 -1
  152. package/lib/packlets/common/index.d.ts.map +0 -1
  153. package/lib/packlets/common/index.js.map +0 -1
  154. package/lib/packlets/common/resources.d.ts.map +0 -1
  155. package/lib/packlets/common/resources.js.map +0 -1
  156. package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
  157. package/lib/packlets/common/validate/conditions.js.map +0 -1
  158. package/lib/packlets/common/validate/index.d.ts.map +0 -1
  159. package/lib/packlets/common/validate/index.js.map +0 -1
  160. package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
  161. package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
  162. package/lib/packlets/common/validate/resources.d.ts.map +0 -1
  163. package/lib/packlets/common/validate/resources.js.map +0 -1
  164. package/lib/packlets/conditions/condition.d.ts.map +0 -1
  165. package/lib/packlets/conditions/condition.js.map +0 -1
  166. package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
  167. package/lib/packlets/conditions/conditionCollector.js.map +0 -1
  168. package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
  169. package/lib/packlets/conditions/conditionDecls.js.map +0 -1
  170. package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
  171. package/lib/packlets/conditions/conditionSet.js.map +0 -1
  172. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
  173. package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
  174. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
  175. package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
  176. package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
  177. package/lib/packlets/conditions/conditionToken.js.map +0 -1
  178. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
  179. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
  180. package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
  181. package/lib/packlets/conditions/convert/decls.js.map +0 -1
  182. package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
  183. package/lib/packlets/conditions/convert/index.js.map +0 -1
  184. package/lib/packlets/conditions/index.d.ts.map +0 -1
  185. package/lib/packlets/conditions/index.js.map +0 -1
  186. package/lib/packlets/config/common.d.ts.map +0 -1
  187. package/lib/packlets/config/common.js.map +0 -1
  188. package/lib/packlets/config/convert.d.ts.map +0 -1
  189. package/lib/packlets/config/convert.js.map +0 -1
  190. package/lib/packlets/config/index.d.ts.map +0 -1
  191. package/lib/packlets/config/index.js.map +0 -1
  192. package/lib/packlets/config/json.d.ts.map +0 -1
  193. package/lib/packlets/config/json.js.map +0 -1
  194. package/lib/packlets/config/predefined/default.d.ts.map +0 -1
  195. package/lib/packlets/config/predefined/default.js.map +0 -1
  196. package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
  197. package/lib/packlets/config/predefined/extended.js.map +0 -1
  198. package/lib/packlets/config/predefined/index.d.ts.map +0 -1
  199. package/lib/packlets/config/predefined/index.js.map +0 -1
  200. package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
  201. package/lib/packlets/config/systemConfiguration.js.map +0 -1
  202. package/lib/packlets/context/contextDecls.d.ts.map +0 -1
  203. package/lib/packlets/context/contextDecls.js.map +0 -1
  204. package/lib/packlets/context/contextToken.d.ts.map +0 -1
  205. package/lib/packlets/context/contextToken.js.map +0 -1
  206. package/lib/packlets/context/convert/decls.d.ts.map +0 -1
  207. package/lib/packlets/context/convert/decls.js.map +0 -1
  208. package/lib/packlets/context/convert/index.d.ts.map +0 -1
  209. package/lib/packlets/context/convert/index.js.map +0 -1
  210. package/lib/packlets/context/index.d.ts.map +0 -1
  211. package/lib/packlets/context/index.js.map +0 -1
  212. package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
  213. package/lib/packlets/decisions/abstractDecision.js.map +0 -1
  214. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
  215. package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
  216. package/lib/packlets/decisions/candidate.d.ts.map +0 -1
  217. package/lib/packlets/decisions/candidate.js.map +0 -1
  218. package/lib/packlets/decisions/common.d.ts.map +0 -1
  219. package/lib/packlets/decisions/common.js.map +0 -1
  220. package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
  221. package/lib/packlets/decisions/concreteDecision.js.map +0 -1
  222. package/lib/packlets/decisions/decision.d.ts.map +0 -1
  223. package/lib/packlets/decisions/decision.js.map +0 -1
  224. package/lib/packlets/decisions/index.d.ts.map +0 -1
  225. package/lib/packlets/decisions/index.js.map +0 -1
  226. package/lib/packlets/import/fsItem.d.ts.map +0 -1
  227. package/lib/packlets/import/fsItem.js.map +0 -1
  228. package/lib/packlets/import/importContext.d.ts.map +0 -1
  229. package/lib/packlets/import/importContext.js.map +0 -1
  230. package/lib/packlets/import/importManager.d.ts.map +0 -1
  231. package/lib/packlets/import/importManager.js.map +0 -1
  232. package/lib/packlets/import/importable.d.ts.map +0 -1
  233. package/lib/packlets/import/importable.js.map +0 -1
  234. package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
  235. package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
  236. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
  237. package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
  238. package/lib/packlets/import/importers/importer.d.ts.map +0 -1
  239. package/lib/packlets/import/importers/importer.js.map +0 -1
  240. package/lib/packlets/import/importers/index.d.ts.map +0 -1
  241. package/lib/packlets/import/importers/index.js.map +0 -1
  242. package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
  243. package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
  244. package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
  245. package/lib/packlets/import/importers/pathImporter.js.map +0 -1
  246. package/lib/packlets/import/index.d.ts.map +0 -1
  247. package/lib/packlets/import/index.js.map +0 -1
  248. package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
  249. package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
  250. package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
  251. package/lib/packlets/qualifier-types/config/index.js.map +0 -1
  252. package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
  253. package/lib/packlets/qualifier-types/config/json.js.map +0 -1
  254. package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
  255. package/lib/packlets/qualifier-types/convert.js.map +0 -1
  256. package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
  257. package/lib/packlets/qualifier-types/helpers.js.map +0 -1
  258. package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
  259. package/lib/packlets/qualifier-types/index.js.map +0 -1
  260. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
  261. package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
  262. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
  263. package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
  264. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
  265. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
  266. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
  267. package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
  268. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
  269. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
  270. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
  271. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
  272. package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
  273. package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
  274. package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
  275. package/lib/packlets/qualifiers/convert/index.js.map +0 -1
  276. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
  277. package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
  278. package/lib/packlets/qualifiers/index.d.ts.map +0 -1
  279. package/lib/packlets/qualifiers/index.js.map +0 -1
  280. package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
  281. package/lib/packlets/qualifiers/qualifier.js.map +0 -1
  282. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
  283. package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
  284. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
  285. package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
  286. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
  287. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
  288. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
  289. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
  290. package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
  291. package/lib/packlets/resource-json/compiled/common.js.map +0 -1
  292. package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
  293. package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
  294. package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
  295. package/lib/packlets/resource-json/compiled/index.js.map +0 -1
  296. package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
  297. package/lib/packlets/resource-json/compiled/json.js.map +0 -1
  298. package/lib/packlets/resource-json/convert.d.ts.map +0 -1
  299. package/lib/packlets/resource-json/convert.js.map +0 -1
  300. package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
  301. package/lib/packlets/resource-json/helpers.js.map +0 -1
  302. package/lib/packlets/resource-json/index.d.ts.map +0 -1
  303. package/lib/packlets/resource-json/index.js.map +0 -1
  304. package/lib/packlets/resource-json/json.d.ts.map +0 -1
  305. package/lib/packlets/resource-json/json.js.map +0 -1
  306. package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
  307. package/lib/packlets/resource-json/normalized.js.map +0 -1
  308. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
  309. package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
  310. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
  311. package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
  312. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
  313. package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
  314. package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
  315. package/lib/packlets/resource-types/config/convert.js.map +0 -1
  316. package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
  317. package/lib/packlets/resource-types/config/index.js.map +0 -1
  318. package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
  319. package/lib/packlets/resource-types/config/json.js.map +0 -1
  320. package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
  321. package/lib/packlets/resource-types/helpers.js.map +0 -1
  322. package/lib/packlets/resource-types/index.d.ts.map +0 -1
  323. package/lib/packlets/resource-types/index.js.map +0 -1
  324. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
  325. package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
  326. package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
  327. package/lib/packlets/resource-types/resourceType.js.map +0 -1
  328. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
  329. package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
  330. package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
  331. package/lib/packlets/resources/candidateReducer.js.map +0 -1
  332. package/lib/packlets/resources/common.d.ts.map +0 -1
  333. package/lib/packlets/resources/common.js.map +0 -1
  334. package/lib/packlets/resources/index.d.ts.map +0 -1
  335. package/lib/packlets/resources/index.js.map +0 -1
  336. package/lib/packlets/resources/resource.d.ts.map +0 -1
  337. package/lib/packlets/resources/resource.js.map +0 -1
  338. package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
  339. package/lib/packlets/resources/resourceBuilder.js.map +0 -1
  340. package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
  341. package/lib/packlets/resources/resourceCandidate.js.map +0 -1
  342. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
  343. package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
  344. package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
  345. package/lib/packlets/runtime/cacheListener.js.map +0 -1
  346. package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
  347. package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
  348. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
  349. package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
  350. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
  351. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
  352. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
  353. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
  354. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
  355. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
  356. package/lib/packlets/runtime/context/index.d.ts.map +0 -1
  357. package/lib/packlets/runtime/context/index.js.map +0 -1
  358. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
  359. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
  360. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
  361. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
  362. package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
  363. package/lib/packlets/runtime/iResourceManager.js.map +0 -1
  364. package/lib/packlets/runtime/index.d.ts.map +0 -1
  365. package/lib/packlets/runtime/index.js.map +0 -1
  366. package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
  367. package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
  368. package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
  369. package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
  370. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
  371. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
  372. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
  373. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
  374. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
  375. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
  376. package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
  377. package/lib/packlets/runtime/resourceResolver.js.map +0 -1
  378. package/lib/packlets/runtime/validate.d.ts.map +0 -1
  379. package/lib/packlets/runtime/validate.js.map +0 -1
@@ -0,0 +1,96 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.CandidateValueCollector = void 0;
25
+ const ts_json_base_1 = require("@fgv/ts-json-base");
26
+ const ts_utils_1 = require("@fgv/ts-utils");
27
+ const common_1 = require("../common");
28
+ const candidateValue_1 = require("./candidateValue");
29
+ /**
30
+ * A `ValidatingCollector` for {@link Resources.CandidateValue | CandidateValues},
31
+ * which collects candidate values supplied as either {@link Resources.CandidateValue | CandidateValue} or
32
+ * `JsonValue`.
33
+ * @public
34
+ */
35
+ class CandidateValueCollector extends ts_utils_1.ValidatingCollector {
36
+ /**
37
+ * Constructor for a {@link Resources.CandidateValueCollector} object.
38
+ * @param params - Parameters to create the collector.
39
+ * @internal
40
+ */
41
+ constructor(params = {}) {
42
+ var _a, _b;
43
+ super({
44
+ converters: new ts_utils_1.Collections.KeyValueConverters({
45
+ key: common_1.Convert.candidateValueKey,
46
+ value: (from) => this._toCandidateValue(from)
47
+ })
48
+ });
49
+ this.normalizer = (_a = params === null || params === void 0 ? void 0 : params.normalizer) !== null && _a !== void 0 ? _a : new ts_utils_1.Hash.Crc32Normalizer();
50
+ (_b = params.candidateValues) === null || _b === void 0 ? void 0 : _b.forEach((candidateValue) => this.validating.add(candidateValue));
51
+ }
52
+ /**
53
+ * Creates a new {@link Resources.CandidateValueCollector} object.
54
+ * @param params - Parameters to create the collector.
55
+ * @returns `Success` with the new collector if successful,
56
+ * or `Failure` with an error message if not.
57
+ * @public
58
+ */
59
+ static create(params) {
60
+ return (0, ts_utils_1.captureResult)(() => new CandidateValueCollector(params));
61
+ }
62
+ /**
63
+ * Returns an array of JSON values ordered by their indices.
64
+ * @returns Array of JsonValue objects in index order.
65
+ * @public
66
+ */
67
+ getValuesByIndex() {
68
+ // Use the base class valuesByIndex() method to get CandidateValues in index order,
69
+ // then extract their JSON values
70
+ return this.valuesByIndex().map((candidateValue) => candidateValue.json);
71
+ }
72
+ /**
73
+ * Converter method to handle CandidateValue | JsonValue.
74
+ * @param from - The value to convert.
75
+ * @returns `Success` with the CandidateValue if successful, or `Failure` with an error message if not.
76
+ * @internal
77
+ */
78
+ _toCandidateValue(from) {
79
+ /* c8 ignore next 3 - functional code tested but coverage intermittently missed */
80
+ if (from instanceof candidateValue_1.CandidateValue) {
81
+ return (0, ts_utils_1.succeed)(from);
82
+ }
83
+ // Validate as JsonValue and create new CandidateValue
84
+ return ts_json_base_1.Validators.jsonValue
85
+ .validate(from)
86
+ .withErrorFormat((msg) => `Invalid JSON value: ${msg}`)
87
+ .onSuccess((jsonValue) => {
88
+ return candidateValue_1.CandidateValue.create({
89
+ json: jsonValue,
90
+ normalizer: this.normalizer
91
+ });
92
+ });
93
+ }
94
+ }
95
+ exports.CandidateValueCollector = CandidateValueCollector;
96
+ //# sourceMappingURL=candidateValueCollector.js.map
@@ -1,5 +1,7 @@
1
1
  import * as ResourceJson from '../resource-json';
2
2
  import { IValidatedContextDecl } from '../context';
3
+ import { IReadOnlyQualifierCollector } from '../qualifiers';
4
+ import { ReadOnlyResourceTypeCollector } from '../resource-types';
3
5
  /**
4
6
  * Options for resource declaration operations with strongly-typed context filtering.
5
7
  * Extends the base IDeclarationOptions with proper type safety for context filtering.
@@ -57,4 +59,28 @@ export interface ICompiledResourceOptionsWithFilter extends ResourceJson.Compile
57
59
  */
58
60
  filterForContext?: IValidatedContextDecl;
59
61
  }
62
+ /**
63
+ * Options for ResourceManagerBuilder clone operations.
64
+ * Extends IDeclarationOptions to include support for applying edits when cloning.
65
+ * @public
66
+ */
67
+ export interface IResourceManagerCloneOptions extends IResourceDeclarationOptions {
68
+ /**
69
+ * Optional array of loose condition declarations to be applied as edits during the clone operation.
70
+ * These conditions can modify or extend the resource candidates in the cloned manager.
71
+ */
72
+ readonly candidates?: ReadonlyArray<ResourceJson.Json.ILooseResourceCandidateDecl>;
73
+ /**
74
+ * Optional qualifier collector to use for the cloned manager.
75
+ * If not provided, uses the same qualifiers as the original manager.
76
+ * This allows creating clones with different qualifier configurations.
77
+ */
78
+ readonly qualifiers?: IReadOnlyQualifierCollector;
79
+ /**
80
+ * Optional resource type collector to use for the cloned manager.
81
+ * If not provided, uses the same resource types as the original manager.
82
+ * This allows creating clones with different resource type configurations.
83
+ */
84
+ readonly resourceTypes?: ReadOnlyResourceTypeCollector;
85
+ }
60
86
  //# sourceMappingURL=common.d.ts.map
@@ -1,4 +1,6 @@
1
1
  export * from './candidateReducer';
2
+ export * from './candidateValue';
3
+ export * from './candidateValueCollector';
2
4
  export * from './resourceCandidate';
3
5
  export * from './resource';
4
6
  export * from './resourceBuilder';
@@ -36,6 +36,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  __exportStar(require("./candidateReducer"), exports);
39
+ __exportStar(require("./candidateValue"), exports);
40
+ __exportStar(require("./candidateValueCollector"), exports);
39
41
  __exportStar(require("./resourceCandidate"), exports);
40
42
  __exportStar(require("./resource"), exports);
41
43
  __exportStar(require("./resourceBuilder"), exports);
@@ -1,5 +1,5 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ResourceId } from '../common';
2
+ import { ResourceId, ResourceName } from '../common';
3
3
  import { ResourceCandidate } from './resourceCandidate';
4
4
  import { ResourceType } from '../resource-types';
5
5
  import { ConcreteDecision, AbstractDecisionCollector } from '../decisions';
@@ -40,10 +40,14 @@ export declare class Resource implements IResource {
40
40
  * The unique {@link ResourceId | id} of the resource.
41
41
  */
42
42
  readonly id: ResourceId;
43
+ /**
44
+ * The name of the resource.
45
+ */
46
+ readonly name: ResourceName;
43
47
  /**
44
48
  * The {@link ResourceTypes.ResourceType | type} of the resource.
45
49
  */
46
- readonly _resourceType: ResourceType;
50
+ readonly resourceType: ResourceType;
47
51
  /**
48
52
  * The array of {@link Resources.ResourceCandidate | candidates} for the resource.
49
53
  */
@@ -52,10 +56,6 @@ export declare class Resource implements IResource {
52
56
  * {@link Decisions.ConcreteDecision | Decision} for optimized resource resolution.
53
57
  */
54
58
  readonly decision: ConcreteDecision;
55
- /**
56
- * Gets the resource type (implements IResource interface).
57
- */
58
- get resourceType(): ResourceType;
59
59
  /**
60
60
  * Gets the resource type name as a string.
61
61
  */
@@ -33,17 +33,11 @@ const decisions_1 = require("../decisions");
33
33
  * @public
34
34
  */
35
35
  class Resource {
36
- /**
37
- * Gets the resource type (implements IResource interface).
38
- */
39
- get resourceType() {
40
- return this._resourceType;
41
- }
42
36
  /**
43
37
  * Gets the resource type name as a string.
44
38
  */
45
39
  get resourceTypeName() {
46
- return this._resourceType.key;
40
+ return this.resourceType.key;
47
41
  }
48
42
  /**
49
43
  * Constructor for a {@link Resources.Resource | Resource} object.
@@ -53,7 +47,8 @@ class Resource {
53
47
  constructor(params) {
54
48
  const id = params.id ? common_1.Validate.toResourceId(params.id).orThrow() : undefined;
55
49
  this.id = Resource._validateCandidateResourceIds(id, params.candidates).orThrow();
56
- this._resourceType = resourceCandidate_1.ResourceCandidate.validateResourceTypes(params.candidates, params.resourceType)
50
+ this.name = common_1.Helpers.getNameForResourceId(this.id).orThrow();
51
+ this.resourceType = resourceCandidate_1.ResourceCandidate.validateResourceTypes(params.candidates, params.resourceType)
57
52
  .onSuccess((t) => {
58
53
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
59
54
  if (t === undefined) {
@@ -120,9 +115,9 @@ class Resource {
120
115
  */
121
116
  toCompiled(options) {
122
117
  const candidates = this._getMatchingCandidates(options).map((c) => ({
123
- json: c.json,
124
118
  isPartial: c.isPartial,
125
- mergeMethod: c.mergeMethod
119
+ mergeMethod: c.mergeMethod,
120
+ valueIndex: c.candidateValue.index
126
121
  }));
127
122
  return {
128
123
  id: this.id,
@@ -5,6 +5,7 @@ import { ReadOnlyResourceTypeCollector, ResourceType } from '../resource-types';
5
5
  import { Resource } from './resource';
6
6
  import { ConditionSetCollector } from '../conditions';
7
7
  import { AbstractDecisionCollector } from '../decisions';
8
+ import { CandidateValueCollector } from './candidateValueCollector';
8
9
  import * as ResourceJson from '../resource-json';
9
10
  import * as Context from '../context';
10
11
  /**
@@ -17,6 +18,7 @@ export interface IResourceBuilderCreateParams {
17
18
  conditionSets: ConditionSetCollector;
18
19
  resourceTypes: ReadOnlyResourceTypeCollector;
19
20
  decisions: AbstractDecisionCollector;
21
+ candidateValues: CandidateValueCollector;
20
22
  }
21
23
  /**
22
24
  * Possible result details returned by the resource builder
@@ -66,6 +68,10 @@ export declare class ResourceBuilder {
66
68
  * Collector for {@link Decisions.AbstractDecision | abstract decisions}.
67
69
  */
68
70
  protected _decisions: AbstractDecisionCollector;
71
+ /**
72
+ * Collector for candidate values.
73
+ */
74
+ protected _candidateValues: CandidateValueCollector;
69
75
  /**
70
76
  * Constructor for a {@link Resources.ResourceBuilder | ResourceBuilder} object.
71
77
  * @param params - Parameters to construct the new {@link Resources.ResourceBuilder | ResourceBuilder}.
@@ -56,6 +56,7 @@ class ResourceBuilder {
56
56
  this._resourceTypes = params.resourceTypes;
57
57
  this._conditionSets = params.conditionSets;
58
58
  this._decisions = params.decisions;
59
+ this._candidateValues = params.candidateValues;
59
60
  this._candidates = new ts_utils_1.ResultMap();
60
61
  if (params.typeName) {
61
62
  this._resourceType = this._resourceTypes.validating.get(params.typeName).orThrow();
@@ -93,7 +94,8 @@ class ResourceBuilder {
93
94
  id: this.id,
94
95
  resourceType: this._resourceType,
95
96
  decl: childDecl,
96
- conditionSets: this._conditionSets
97
+ conditionSets: this._conditionSets,
98
+ candidateValues: this._candidateValues
97
99
  })
98
100
  .withDetail('failure', 'success')
99
101
  .onSuccess((candidate) => {
@@ -101,6 +103,7 @@ class ResourceBuilder {
101
103
  .getOrAdd(candidate.conditions.toString(), candidate)
102
104
  .onSuccess((added, detail) => {
103
105
  if (detail === 'exists') {
106
+ /* c8 ignore next 5 - defensive coding: conflicting candidates with same conditions should not occur */
104
107
  if (!resourceCandidate_1.ResourceCandidate.equal(added, candidate)) {
105
108
  return (0, ts_utils_1.failWithDetail)(`${this.id}: conflicting candidates.`, 'exists');
106
109
  }
@@ -1,8 +1,10 @@
1
1
  import { JsonObject } from '@fgv/ts-json-base';
2
- import { QualifierName, ResourceId, ResourceValueMergeMethod } from '../common';
2
+ import { CandidateCompleteness, QualifierName, ResourceId, ResourceValueMergeMethod } from '../common';
3
3
  import { Condition, ConditionSet, ConditionSetCollector } from '../conditions';
4
4
  import * as ResourceJson from '../resource-json';
5
5
  import { ResourceType } from '../resource-types';
6
+ import { CandidateValue } from './candidateValue';
7
+ import { CandidateValueCollector } from './candidateValueCollector';
6
8
  import { Result } from '@fgv/ts-utils';
7
9
  import * as Context from '../context';
8
10
  import { IResourceCandidate } from '../runtime';
@@ -16,6 +18,7 @@ export interface IResourceCandidateCreateParams {
16
18
  resourceType?: ResourceType;
17
19
  parentConditions?: ReadonlyArray<Condition>;
18
20
  conditionSets: ConditionSetCollector;
21
+ candidateValues: CandidateValueCollector;
19
22
  }
20
23
  /**
21
24
  * Options for creating a {@link Resources.ResourceCandidate | ResourceCandidate} declaration.
@@ -43,10 +46,16 @@ export declare class ResourceCandidate implements IResourceCandidate {
43
46
  * is a possible instance.
44
47
  */
45
48
  readonly id: ResourceId;
49
+ /**
50
+ * The candidate value that contains the JSON representation of the instance data.
51
+ */
52
+ readonly candidateValue: CandidateValue;
46
53
  /**
47
54
  * The JSON representation of the instance data to be applied.
55
+ * @remarks
56
+ * This property provides access to the JSON data from the underlying candidate value.
48
57
  */
49
- readonly json: JsonObject;
58
+ get json(): JsonObject;
50
59
  /**
51
60
  * The conditions under which this candidate applies.
52
61
  */
@@ -64,6 +73,10 @@ export declare class ResourceCandidate implements IResourceCandidate {
64
73
  * this candidate belongs.
65
74
  */
66
75
  readonly resourceType: ResourceType | undefined;
76
+ /**
77
+ * The completeness of the candidate value.
78
+ */
79
+ get completeness(): CandidateCompleteness;
67
80
  /**
68
81
  * Constructor for a {@link Resources.ResourceCandidate | ResourceCandidate} object.
69
82
  * @param params - Parameters to create a new {@link Resources.ResourceCandidate | ResourceCandidate}.
@@ -66,6 +66,20 @@ const ts_utils_1 = require("@fgv/ts-utils");
66
66
  * @public
67
67
  */
68
68
  class ResourceCandidate {
69
+ /**
70
+ * The JSON representation of the instance data to be applied.
71
+ * @remarks
72
+ * This property provides access to the JSON data from the underlying candidate value.
73
+ */
74
+ get json() {
75
+ return this.candidateValue.json;
76
+ }
77
+ /**
78
+ * The completeness of the candidate value.
79
+ */
80
+ get completeness() {
81
+ return this.isPartial ? 'partial' : 'full';
82
+ }
69
83
  /**
70
84
  * Constructor for a {@link Resources.ResourceCandidate | ResourceCandidate} object.
71
85
  * @param params - Parameters to create a new {@link Resources.ResourceCandidate | ResourceCandidate}.
@@ -74,7 +88,7 @@ class ResourceCandidate {
74
88
  constructor(params) {
75
89
  var _a, _b;
76
90
  this.id = common_1.Validate.toResourceId(params.id).orThrow();
77
- this.json = params.decl.json;
91
+ this.candidateValue = params.candidateValues.validating.getOrAdd(params.decl.json).orThrow();
78
92
  this.conditions = ResourceCandidate._mergeConditions(params.conditionSets, params.decl.conditions, params.parentConditions).orThrow();
79
93
  this.isPartial = (_a = params.decl.isPartial) !== null && _a !== void 0 ? _a : false;
80
94
  this.mergeMethod = (_b = params.decl.mergeMethod) !== null && _b !== void 0 ? _b : 'augment';
@@ -175,10 +189,8 @@ class ResourceCandidate {
175
189
  rc1.mergeMethod === rc2.mergeMethod &&
176
190
  conditions_1.ConditionSet.compare(rc1.conditions, rc2.conditions) === 0;
177
191
  if (equal) {
178
- const normalizer = new ts_utils_1.Hash.Crc32Normalizer();
179
- const n1 = normalizer.computeHash(rc1.json).orDefault('(n1 normalization failed)');
180
- const n2 = normalizer.computeHash(rc2.json).orDefault('(n2 normalization failed)');
181
- equal = n1 === n2;
192
+ // Compare candidate values by their keys for efficient JSON comparison
193
+ equal = rc1.candidateValue.key === rc2.candidateValue.key;
182
194
  }
183
195
  return equal;
184
196
  }
@@ -1,16 +1,19 @@
1
1
  import { Collections, DetailedResult, Result, ValidatingResultMap } from '@fgv/ts-utils';
2
- import { ConditionCollector, ConditionSetCollector, ReadOnlyConditionCollector, ReadOnlyConditionSetCollector } from '../conditions';
2
+ import { ConditionCollector, ConditionSetCollector, ReadOnlyConditionCollector, ReadOnlyConditionSetCollector, Condition, ConditionSet } from '../conditions';
3
3
  import { AbstractDecisionCollector, ReadOnlyAbstractDecisionCollector } from '../decisions';
4
4
  import { IReadOnlyQualifierCollector } from '../qualifiers';
5
5
  import { ReadOnlyResourceTypeCollector } from '../resource-types';
6
6
  import { ResourceId } from '../common';
7
- import { IResourceManager } from '../runtime';
7
+ import { IResourceManager, ResourceTree } from '../runtime';
8
8
  import { ResourceBuilder, ResourceBuilderResultDetail } from './resourceBuilder';
9
9
  import { Resource } from './resource';
10
10
  import { ResourceCandidate } from './resourceCandidate';
11
- import { IResourceDeclarationOptions } from './common';
11
+ import { CandidateValueCollector } from './candidateValueCollector';
12
+ import { IResourceDeclarationOptions, IResourceManagerCloneOptions } from './common';
12
13
  import * as ResourceJson from '../resource-json';
13
14
  import * as Context from '../context';
15
+ import * as Config from '../config';
16
+ import { ReadOnlyQualifierTypeCollector } from '../qualifier-types';
14
17
  /**
15
18
  * Interface for parameters to the {@link Resources.ResourceManagerBuilder.create | ResourceManagerBuilder create method}.
16
19
  * @public
@@ -31,15 +34,59 @@ export type ResourceManagerBuilderResultDetail = Collections.ResultMapResultDeta
31
34
  * and builds a collection of {@link Resources.Resource | resources} once all candidates are collected.
32
35
  * @public
33
36
  */
34
- export declare class ResourceManagerBuilder implements IResourceManager {
37
+ export declare class ResourceManagerBuilder implements IResourceManager<Resource> {
38
+ /**
39
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used by this resource manager.
40
+ */
35
41
  readonly qualifiers: IReadOnlyQualifierCollector;
42
+ /**
43
+ * The {@link ResourceTypes.ReadOnlyResourceTypeCollector | resource types} used by this resource manager.
44
+ */
36
45
  readonly resourceTypes: ReadOnlyResourceTypeCollector;
46
+ /**
47
+ * The {@link Conditions.ConditionCollector | condition collector} used by this resource manager.
48
+ * @internal
49
+ */
37
50
  protected readonly _conditions: ConditionCollector;
51
+ /**
52
+ * The {@link Conditions.ConditionSetCollector | condition set collector} used by this resource manager.
53
+ * @internal
54
+ */
38
55
  protected readonly _conditionSets: ConditionSetCollector;
56
+ /**
57
+ * The {@link Decisions.AbstractDecisionCollector | abstract decision collector} used by this resource manager.
58
+ * @internal
59
+ */
39
60
  protected readonly _decisions: AbstractDecisionCollector;
61
+ /**
62
+ * The candidate value collector used by this resource manager.
63
+ * @internal
64
+ */
65
+ protected readonly _candidateValues: CandidateValueCollector;
66
+ /**
67
+ * The {@link Resources.ResourceBuilder | resource builders} used by this resource manager.
68
+ * @internal
69
+ */
40
70
  protected readonly _resources: ValidatingResultMap<ResourceId, ResourceBuilder>;
41
- readonly _builtResources: ValidatingResultMap<ResourceId, Resource>;
71
+ /**
72
+ * The {@link Resources.Resource | resources} built by this resource manager.
73
+ * @internal
74
+ */
75
+ protected readonly _builtResources: ValidatingResultMap<ResourceId, Resource>;
76
+ /**
77
+ * Whether the resources have been built.
78
+ * @internal
79
+ */
42
80
  protected _built: boolean;
81
+ /**
82
+ * The cached resource tree for this resource manager.
83
+ * @internal
84
+ */
85
+ protected _cachedResourceTree?: ResourceTree.IReadOnlyResourceTreeRoot<Resource>;
86
+ /**
87
+ * The {@link QualifierTypes.ReadOnlyQualifierTypeCollector | qualifier types} used by this resource manager.
88
+ */
89
+ get qualifierTypes(): ReadOnlyQualifierTypeCollector;
43
90
  /**
44
91
  * A {@link Conditions.ConditionCollector | ConditionCollector} which
45
92
  * contains the {@link Conditions.Condition | conditions} used so far by
@@ -96,6 +143,26 @@ export declare class ResourceManagerBuilder implements IResourceManager {
96
143
  * @public
97
144
  */
98
145
  static create(params: IResourceManagerBuilderCreateParams): Result<ResourceManagerBuilder>;
146
+ /**
147
+ * Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object from a predefined system configuration.
148
+ * @param name - The name of the predefined system configuration to use.
149
+ * @param qualifierDefaultValues - Optional default values for qualifiers.
150
+ * @returns `Success` with the new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object if successful,
151
+ * or `Failure` with an error message if not.
152
+ * @public
153
+ */
154
+ static createPredefined(name: Config.PredefinedSystemConfiguration, qualifierDefaultValues?: Config.ISystemConfigurationInitParams['qualifierDefaultValues']): Result<ResourceManagerBuilder>;
155
+ /**
156
+ * Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} from a
157
+ * {@link ResourceJson.Compiled.ICompiledResourceCollection | compiled resource collection}.
158
+ * This method reconstructs an exactly equivalent builder where all qualifier, condition,
159
+ * condition set, and decision indices match the original compiled collection.
160
+ * @param compiledCollection - The compiled resource collection to reconstruct from.
161
+ * @param systemConfig - The system configuration containing qualifiers and resource types.
162
+ * @returns `Success` with the new manager if successful, or `Failure` with an error message if not.
163
+ * @public
164
+ */
165
+ static createFromCompiledResourceCollection(compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection, systemConfig: Config.SystemConfiguration): Result<ResourceManagerBuilder>;
99
166
  /**
100
167
  * Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, builds and adds
101
168
  * a {@link Resources.ResourceCandidate | candidate} to the manager.
@@ -105,6 +172,20 @@ export declare class ResourceManagerBuilder implements IResourceManager {
105
172
  */
106
173
  addLooseCandidate(decl: ResourceJson.Json.ILooseResourceCandidateDecl): DetailedResult<ResourceCandidate, ResourceBuilderResultDetail>;
107
174
  addResource(decl: ResourceJson.Json.ILooseResourceDecl): DetailedResult<ResourceBuilder, ResourceBuilderResultDetail>;
175
+ /**
176
+ * Adds a condition to the manager.
177
+ * @param decl - The condition declaration to add.
178
+ * @returns `Success` with the condition if successful, or `Failure` with an error message if not.
179
+ * @public
180
+ */
181
+ addCondition(decl: ResourceJson.Json.ILooseConditionDecl): Result<Condition>;
182
+ /**
183
+ * Adds a condition set to the manager.
184
+ * @param decl - The condition set declaration to add.
185
+ * @returns `Success` with the condition set if successful, or `Failure` with an error message if not.
186
+ * @public
187
+ */
188
+ addConditionSet(conditions: ResourceJson.Normalized.ConditionSetDecl): Result<ConditionSet>;
108
189
  /**
109
190
  * Gets a read-only array of all {@link Resources.ResourceBuilder | resource builders} present in the manager.
110
191
  * @returns `Success` with the {@link Resources.ResourceBuilder | resource builder} if successful,
@@ -135,6 +216,19 @@ export declare class ResourceManagerBuilder implements IResourceManager {
135
216
  * @public
136
217
  */
137
218
  getAllBuiltResources(): Result<ReadonlyArray<Resource>>;
219
+ /**
220
+ * Builds and returns a hierarchical tree representation of all resources managed by this builder.
221
+ * Resources are organized based on their dot-separated resource IDs (e.g., "app.messages.welcome"
222
+ * becomes a tree with "app" as root, "messages" as branch, and "welcome" as leaf).
223
+ *
224
+ * String-based validation is available through the `children.validating` property,
225
+ * allowing callers to use `tree.children.validating.getById(stringId)` for validated access.
226
+ *
227
+ * Uses lazy initialization with caching for performance.
228
+ * @returns Result containing the resource tree root, or failure if tree construction fails
229
+ * @public
230
+ */
231
+ getBuiltResourceTree(): Result<ResourceTree.IReadOnlyResourceTreeRoot<Resource>>;
138
232
  /**
139
233
  * Gets a read-only array of all {@link Resources.Resource | built resources} in the manager.
140
234
  * @returns `Success` with an array of resources if successful, or `Failure` with an error message if not.
@@ -208,13 +302,97 @@ export declare class ResourceManagerBuilder implements IResourceManager {
208
302
  */
209
303
  getResourceCollectionDecl(options?: IResourceDeclarationOptions): Result<ResourceJson.Normalized.IResourceCollectionDecl>;
210
304
  /**
211
- * Creates a filtered clone of this ResourceManagerBuilder using the specified context.
212
- * This is a convenience method that creates a new ResourceManagerBuilder with the same
213
- * configuration but filtered to include only candidates that match the provided context.
214
- * @param options - Options for the cloning operation, including the strongly-typed filterForContext property.
215
- * @returns A Result containing the new filtered ResourceManagerBuilder.
305
+ * Creates a clone of this ResourceManagerBuilder with optional configuration overrides.
306
+ * This method creates a new ResourceManagerBuilder that can optionally use different
307
+ * qualifiers and/or resource types than the original. It can also be filtered to include
308
+ * only candidates that match the provided context and apply candidate edits.
309
+ *
310
+ * @param options - Options for the cloning operation:
311
+ * - `qualifiers`: Optional qualifier collector to use instead of the original
312
+ * - `resourceTypes`: Optional resource type collector to use instead of the original
313
+ * - `filterForContext`: Optional context filter for candidates
314
+ * - `candidates`: Optional candidate edits to apply during cloning
315
+ * @returns A Result containing the new ResourceManagerBuilder with the specified configuration.
216
316
  * @public
217
317
  */
218
- clone(options?: IResourceDeclarationOptions): Result<ResourceManagerBuilder>;
318
+ clone(options?: IResourceManagerCloneOptions): Result<ResourceManagerBuilder>;
319
+ /**
320
+ * Creates a resource ID keyed map from an array of loose resource candidate declarations.
321
+ * This enables efficient detection of edit collisions by grouping candidates by their target resource.
322
+ * @param candidates - Array of loose resource candidate declarations to organize
323
+ * @returns A Result containing a Map where keys are validated ResourceIds and values are arrays of candidates for that resource
324
+ * @internal
325
+ */
326
+ private static _createCandidatesByResourceMap;
327
+ /**
328
+ * Generates a proper ConditionSet token for collision detection using the existing ConditionSet.getKeyForDecl method.
329
+ * @param conditionSet - The condition set to generate a token for
330
+ * @param conditionCollector - The condition collector needed for validation context
331
+ * @returns A Result containing the ConditionSet token if successful, or failure if validation fails
332
+ * @internal
333
+ */
334
+ /**
335
+ * Applies candidate edits to a resource declaration, handling collisions using condition set tokens.
336
+ * If there's no collision, adds the candidate. If there's a collision, replaces the original candidate with the edit.
337
+ * @param resourceDecl - The original resource declaration to potentially modify
338
+ * @param candidatesByResource - Map of resource IDs to arrays of candidate edits
339
+ * @param conditionCollector - The condition collector needed for generating condition tokens
340
+ * @returns A Result containing the resource declaration to use (original or modified)
341
+ * @internal
342
+ */
343
+ private static _applyEditsToResourceDeclaration;
344
+ /**
345
+ * Creates a new resource declaration from an array of candidate declarations.
346
+ * This is used when cloning to create new resources that don't exist in the original manager.
347
+ * @param resourceId - The validated resource ID for the new resource
348
+ * @param candidates - Array of loose candidate declarations for the new resource
349
+ * @param conditionCollector - The condition collector for validation context
350
+ * @returns A Result containing the new resource declaration if successful, or failure if validation fails
351
+ * @internal
352
+ */
353
+ private static _createResourceDeclFromCandidates;
354
+ /**
355
+ * Reconstructs conditions from a compiled collection and adds them to the builder.
356
+ * @param builder - The builder to add conditions to.
357
+ * @param compiledCollection - The compiled collection containing conditions.
358
+ * @returns `Success` if all conditions were added successfully, `Failure` otherwise.
359
+ * @internal
360
+ */
361
+ private static _reconstructConditions;
362
+ /**
363
+ * Reconstructs condition sets from a compiled collection and adds them to the builder.
364
+ * @param builder - The builder to add condition sets to.
365
+ * @param compiledCollection - The compiled collection containing condition sets.
366
+ * @returns `Success` if all condition sets were added successfully, `Failure` otherwise.
367
+ * @internal
368
+ */
369
+ private static _reconstructConditionSets;
370
+ /**
371
+ * Reconstructs decisions from a compiled collection and adds them to the builder.
372
+ * @param builder - The builder to add decisions to.
373
+ * @param compiledCollection - The compiled collection containing decisions.
374
+ * @returns `Success` if all decisions were added successfully, `Failure` otherwise.
375
+ * @internal
376
+ */
377
+ private static _reconstructDecisions;
378
+ /**
379
+ * Reconstructs resources and their candidates from a compiled collection and adds them to the builder.
380
+ * @param builder - The builder to add resources to.
381
+ * @param compiledCollection - The compiled collection containing resources.
382
+ * @returns `Success` if all resources were added successfully, `Failure` otherwise.
383
+ * @internal
384
+ */
385
+ private static _reconstructResources;
386
+ /**
387
+ * Helper method to create candidates from a decision's condition sets.
388
+ * @param compiledResource - The compiled resource containing candidates.
389
+ * @param decision - The decision containing condition sets.
390
+ * @param resourceType - The resource type for the candidates.
391
+ * @param builder - The builder to add candidates to.
392
+ * @param candidateValues - Array of candidate values indexed by valueIndex.
393
+ * @returns `Success` if all candidates were added successfully, `Failure` otherwise.
394
+ * @internal
395
+ */
396
+ private static _createCandidatesFromDecision;
219
397
  }
220
398
  //# sourceMappingURL=resourceManagerBuilder.d.ts.map