@fgv/ts-res 4.5.0-3 → 5.0.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/CHANGELOG.json +26 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CLAUDE.md +186 -0
  4. package/EXAMPLE_INIT_PARAMS.md +88 -0
  5. package/PROGRESS_SUMMARY.md +48 -0
  6. package/README.md +535 -14
  7. package/dist/ts-res.d.ts +5253 -699
  8. package/dist/tsdoc-metadata.json +1 -1
  9. package/lib/index.d.ts +13 -2
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +29 -2
  12. package/lib/index.js.map +1 -1
  13. package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
  14. package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
  15. package/lib/packlets/bundle/bundleBuilder.js +134 -0
  16. package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
  17. package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
  18. package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
  19. package/lib/packlets/bundle/bundleLoader.js +105 -0
  20. package/lib/packlets/bundle/bundleLoader.js.map +1 -0
  21. package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
  22. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
  23. package/lib/packlets/bundle/bundleNormalizer.js +142 -0
  24. package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
  25. package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
  26. package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
  27. package/lib/packlets/bundle/bundleUtils.js +117 -0
  28. package/lib/packlets/bundle/bundleUtils.js.map +1 -0
  29. package/lib/packlets/bundle/convert.d.ts +33 -0
  30. package/lib/packlets/bundle/convert.d.ts.map +1 -0
  31. package/lib/packlets/bundle/convert.js +78 -0
  32. package/lib/packlets/bundle/convert.js.map +1 -0
  33. package/lib/packlets/bundle/index.d.ts +21 -0
  34. package/lib/packlets/bundle/index.d.ts.map +1 -0
  35. package/lib/packlets/bundle/index.js +83 -0
  36. package/lib/packlets/bundle/index.js.map +1 -0
  37. package/lib/packlets/bundle/model.d.ts +100 -0
  38. package/lib/packlets/bundle/model.d.ts.map +1 -0
  39. package/lib/packlets/bundle/model.js +24 -0
  40. package/lib/packlets/bundle/model.js.map +1 -0
  41. package/lib/packlets/common/conditions.d.ts +30 -0
  42. package/lib/packlets/common/conditions.d.ts.map +1 -1
  43. package/lib/packlets/common/conditions.js.map +1 -1
  44. package/lib/packlets/common/convert.d.ts +22 -2
  45. package/lib/packlets/common/convert.d.ts.map +1 -1
  46. package/lib/packlets/common/convert.js +21 -1
  47. package/lib/packlets/common/convert.js.map +1 -1
  48. package/lib/packlets/common/helpers/context.d.ts +39 -0
  49. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  50. package/lib/packlets/common/helpers/context.js +108 -0
  51. package/lib/packlets/common/helpers/context.js.map +1 -0
  52. package/lib/packlets/common/helpers/index.d.ts +2 -0
  53. package/lib/packlets/common/helpers/index.d.ts.map +1 -1
  54. package/lib/packlets/common/helpers/index.js +2 -0
  55. package/lib/packlets/common/helpers/index.js.map +1 -1
  56. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts +39 -0
  57. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  58. package/lib/packlets/common/helpers/qualifierDefaultValues.js +105 -0
  59. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  60. package/lib/packlets/common/helpers/resources.d.ts.map +1 -1
  61. package/lib/packlets/common/helpers/resources.js +6 -2
  62. package/lib/packlets/common/helpers/resources.js.map +1 -1
  63. package/lib/packlets/common/resources.d.ts +8 -0
  64. package/lib/packlets/common/resources.d.ts.map +1 -1
  65. package/lib/packlets/common/resources.js.map +1 -1
  66. package/lib/packlets/common/validate/conditions.d.ts +69 -1
  67. package/lib/packlets/common/validate/conditions.d.ts.map +1 -1
  68. package/lib/packlets/common/validate/conditions.js +126 -0
  69. package/lib/packlets/common/validate/conditions.js.map +1 -1
  70. package/lib/packlets/common/validate/regularExpressions.d.ts +20 -0
  71. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -1
  72. package/lib/packlets/common/validate/regularExpressions.js +21 -1
  73. package/lib/packlets/common/validate/regularExpressions.js.map +1 -1
  74. package/lib/packlets/conditions/condition.d.ts +37 -0
  75. package/lib/packlets/conditions/condition.d.ts.map +1 -1
  76. package/lib/packlets/conditions/condition.js +67 -1
  77. package/lib/packlets/conditions/condition.js.map +1 -1
  78. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -1
  79. package/lib/packlets/conditions/conditionCollector.js +1 -0
  80. package/lib/packlets/conditions/conditionCollector.js.map +1 -1
  81. package/lib/packlets/conditions/conditionSet.d.ts +43 -3
  82. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
  83. package/lib/packlets/conditions/conditionSet.js +104 -3
  84. package/lib/packlets/conditions/conditionSet.js.map +1 -1
  85. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -1
  86. package/lib/packlets/conditions/conditionSetCollector.js +3 -0
  87. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -1
  88. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -1
  89. package/lib/packlets/conditions/conditionToken.js +2 -1
  90. package/lib/packlets/conditions/conditionToken.js.map +1 -1
  91. package/lib/packlets/conditions/convert/decls.js +1 -1
  92. package/lib/packlets/conditions/convert/decls.js.map +1 -1
  93. package/lib/packlets/config/common.d.ts +35 -0
  94. package/lib/packlets/config/common.d.ts.map +1 -0
  95. package/lib/packlets/config/common.js +96 -0
  96. package/lib/packlets/config/common.js.map +1 -0
  97. package/lib/packlets/config/convert.d.ts +14 -0
  98. package/lib/packlets/config/convert.d.ts.map +1 -0
  99. package/lib/packlets/config/convert.js +82 -0
  100. package/lib/packlets/config/convert.js.map +1 -0
  101. package/lib/packlets/config/index.d.ts +6 -0
  102. package/lib/packlets/config/index.d.ts.map +1 -0
  103. package/lib/packlets/config/index.js +67 -0
  104. package/lib/packlets/config/index.js.map +1 -0
  105. package/lib/packlets/config/json.d.ts +20 -0
  106. package/lib/packlets/config/json.d.ts.map +1 -0
  107. package/lib/packlets/config/json.js +24 -0
  108. package/lib/packlets/config/json.js.map +1 -0
  109. package/lib/packlets/config/predefined/default.d.ts +57 -0
  110. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  111. package/lib/packlets/config/predefined/default.js +141 -0
  112. package/lib/packlets/config/predefined/default.js.map +1 -0
  113. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  114. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  115. package/lib/packlets/config/predefined/extended.js +193 -0
  116. package/lib/packlets/config/predefined/extended.js.map +1 -0
  117. package/lib/packlets/config/predefined/index.d.ts +4 -0
  118. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  119. package/lib/packlets/config/predefined/index.js +62 -0
  120. package/lib/packlets/config/predefined/index.js.map +1 -0
  121. package/lib/packlets/config/systemConfiguration.d.ts +81 -0
  122. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  123. package/lib/packlets/config/systemConfiguration.js +172 -0
  124. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  125. package/lib/packlets/context/contextDecls.d.ts +49 -0
  126. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  127. package/lib/packlets/context/contextDecls.js +24 -0
  128. package/lib/packlets/context/contextDecls.js.map +1 -0
  129. package/lib/packlets/context/contextToken.d.ts +111 -0
  130. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  131. package/lib/packlets/context/contextToken.js +206 -0
  132. package/lib/packlets/context/contextToken.js.map +1 -0
  133. package/lib/packlets/context/convert/decls.d.ts +37 -0
  134. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  135. package/lib/packlets/context/convert/decls.js +94 -0
  136. package/lib/packlets/context/convert/decls.js.map +1 -0
  137. package/lib/packlets/context/convert/index.d.ts +2 -0
  138. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  139. package/lib/packlets/context/convert/index.js +39 -0
  140. package/lib/packlets/context/convert/index.js.map +1 -0
  141. package/lib/packlets/context/index.d.ts +5 -0
  142. package/lib/packlets/context/index.d.ts.map +1 -0
  143. package/lib/packlets/context/index.js +65 -0
  144. package/lib/packlets/context/index.js.map +1 -0
  145. package/lib/packlets/decisions/abstractDecision.d.ts +8 -0
  146. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -1
  147. package/lib/packlets/decisions/abstractDecision.js +9 -0
  148. package/lib/packlets/decisions/abstractDecision.js.map +1 -1
  149. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -1
  150. package/lib/packlets/decisions/abstractDecisionCollector.js +2 -0
  151. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -1
  152. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -1
  153. package/lib/packlets/decisions/concreteDecision.js +1 -0
  154. package/lib/packlets/decisions/concreteDecision.js.map +1 -1
  155. package/lib/packlets/decisions/decision.d.ts.map +1 -1
  156. package/lib/packlets/decisions/decision.js +4 -0
  157. package/lib/packlets/decisions/decision.js.map +1 -1
  158. package/lib/packlets/import/fsItem.d.ts.map +1 -1
  159. package/lib/packlets/import/fsItem.js +8 -12
  160. package/lib/packlets/import/fsItem.js.map +1 -1
  161. package/lib/packlets/import/importContext.d.ts +19 -0
  162. package/lib/packlets/import/importContext.d.ts.map +1 -1
  163. package/lib/packlets/import/importContext.js +39 -0
  164. package/lib/packlets/import/importContext.js.map +1 -1
  165. package/lib/packlets/import/importManager.d.ts +5 -5
  166. package/lib/packlets/import/importManager.d.ts.map +1 -1
  167. package/lib/packlets/import/importManager.js.map +1 -1
  168. package/lib/packlets/import/importers/collectionImporter.d.ts +11 -13
  169. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -1
  170. package/lib/packlets/import/importers/collectionImporter.js +29 -20
  171. package/lib/packlets/import/importers/collectionImporter.js.map +1 -1
  172. package/lib/packlets/import/importers/fsItemImporter.d.ts +2 -2
  173. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -1
  174. package/lib/packlets/import/importers/fsItemImporter.js +2 -2
  175. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -1
  176. package/lib/packlets/import/importers/importer.d.ts +3 -3
  177. package/lib/packlets/import/importers/importer.d.ts.map +1 -1
  178. package/lib/packlets/import/importers/importer.js.map +1 -1
  179. package/lib/packlets/import/importers/jsonImporter.d.ts +2 -3
  180. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -1
  181. package/lib/packlets/import/importers/jsonImporter.js +11 -20
  182. package/lib/packlets/import/importers/jsonImporter.js.map +1 -1
  183. package/lib/packlets/import/importers/pathImporter.d.ts +2 -2
  184. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -1
  185. package/lib/packlets/import/importers/pathImporter.js.map +1 -1
  186. package/lib/packlets/qualifier-types/config/convert.d.ts +44 -0
  187. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  188. package/lib/packlets/qualifier-types/config/convert.js +96 -0
  189. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  190. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  191. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  192. package/lib/packlets/qualifier-types/config/index.js +64 -0
  193. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  194. package/lib/packlets/qualifier-types/config/json.d.ts +69 -0
  195. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  196. package/lib/packlets/qualifier-types/config/json.js +24 -0
  197. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  198. package/lib/packlets/qualifier-types/convert.d.ts +10 -2
  199. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -1
  200. package/lib/packlets/qualifier-types/convert.js +15 -0
  201. package/lib/packlets/qualifier-types/convert.js.map +1 -1
  202. package/lib/packlets/qualifier-types/helpers.d.ts +27 -0
  203. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  204. package/lib/packlets/qualifier-types/helpers.js +118 -0
  205. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  206. package/lib/packlets/qualifier-types/index.d.ts +4 -1
  207. package/lib/packlets/qualifier-types/index.d.ts.map +1 -1
  208. package/lib/packlets/qualifier-types/index.js +5 -1
  209. package/lib/packlets/qualifier-types/index.js.map +1 -1
  210. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +19 -8
  211. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -1
  212. package/lib/packlets/qualifier-types/languageQualifierType.js +28 -9
  213. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -1
  214. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +42 -13
  215. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -1
  216. package/lib/packlets/qualifier-types/literalQualifierType.js +58 -10
  217. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -1
  218. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +114 -0
  219. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  220. package/lib/packlets/qualifier-types/literalValueHierarchy.js +228 -0
  221. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  222. package/lib/packlets/qualifier-types/qualifierType.d.ts +33 -18
  223. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -1
  224. package/lib/packlets/qualifier-types/qualifierType.js +18 -4
  225. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -1
  226. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +4 -2
  227. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -1
  228. package/lib/packlets/qualifier-types/qualifierTypeCollector.js +2 -1
  229. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -1
  230. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +47 -11
  231. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -1
  232. package/lib/packlets/qualifier-types/territoryQualifierType.js +61 -17
  233. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -1
  234. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -1
  235. package/lib/packlets/qualifiers/convert/decls.js +17 -15
  236. package/lib/packlets/qualifiers/convert/decls.js.map +1 -1
  237. package/lib/packlets/qualifiers/index.d.ts +2 -0
  238. package/lib/packlets/qualifiers/index.d.ts.map +1 -1
  239. package/lib/packlets/qualifiers/index.js +2 -0
  240. package/lib/packlets/qualifiers/index.js.map +1 -1
  241. package/lib/packlets/qualifiers/qualifier.d.ts +22 -2
  242. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -1
  243. package/lib/packlets/qualifiers/qualifier.js +26 -1
  244. package/lib/packlets/qualifiers/qualifier.js.map +1 -1
  245. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
  246. package/lib/packlets/qualifiers/qualifierCollector.js +3 -0
  247. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
  248. package/lib/packlets/qualifiers/qualifierDecl.d.ts +6 -1
  249. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -1
  250. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -1
  251. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts +32 -0
  252. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  253. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js +24 -0
  254. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  255. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts +96 -0
  256. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  257. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js +179 -0
  258. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  259. package/lib/packlets/resource-json/compiled/common.d.ts +14 -0
  260. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  261. package/lib/packlets/resource-json/compiled/common.js +24 -0
  262. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  263. package/lib/packlets/resource-json/compiled/convert.d.ts +63 -0
  264. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  265. package/lib/packlets/resource-json/compiled/convert.js +167 -0
  266. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  267. package/lib/packlets/resource-json/compiled/index.d.ts +5 -0
  268. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  269. package/lib/packlets/resource-json/compiled/index.js +65 -0
  270. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  271. package/lib/packlets/resource-json/compiled/json.d.ts +204 -0
  272. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  273. package/lib/packlets/resource-json/compiled/json.js +3 -0
  274. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  275. package/lib/packlets/resource-json/convert.d.ts +16 -0
  276. package/lib/packlets/resource-json/convert.d.ts.map +1 -1
  277. package/lib/packlets/resource-json/convert.js +41 -6
  278. package/lib/packlets/resource-json/convert.js.map +1 -1
  279. package/lib/packlets/resource-json/helpers.d.ts +82 -3
  280. package/lib/packlets/resource-json/helpers.d.ts.map +1 -1
  281. package/lib/packlets/resource-json/helpers.js +185 -2
  282. package/lib/packlets/resource-json/helpers.js.map +1 -1
  283. package/lib/packlets/resource-json/index.d.ts +2 -1
  284. package/lib/packlets/resource-json/index.d.ts.map +1 -1
  285. package/lib/packlets/resource-json/index.js +3 -1
  286. package/lib/packlets/resource-json/index.js.map +1 -1
  287. package/lib/packlets/resource-json/json.d.ts +55 -3
  288. package/lib/packlets/resource-json/json.d.ts.map +1 -1
  289. package/lib/packlets/resource-json/json.js +16 -0
  290. package/lib/packlets/resource-json/json.js.map +1 -1
  291. package/lib/packlets/resource-json/normalized.d.ts +46 -3
  292. package/lib/packlets/resource-json/normalized.d.ts.map +1 -1
  293. package/lib/packlets/resource-json/normalized.js.map +1 -1
  294. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +14 -10
  295. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -1
  296. package/lib/packlets/resource-json/resourceDeclCollection.js +18 -14
  297. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -1
  298. package/lib/packlets/resource-json/resourceDeclContainer.d.ts +15 -2
  299. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -1
  300. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -1
  301. package/lib/packlets/resource-json/resourceDeclTree.d.ts +6 -2
  302. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -1
  303. package/lib/packlets/resource-json/resourceDeclTree.js +12 -3
  304. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -1
  305. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  306. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  307. package/lib/packlets/resource-types/config/convert.js +36 -0
  308. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  309. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  310. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  311. package/lib/packlets/resource-types/config/index.js +64 -0
  312. package/lib/packlets/resource-types/config/index.js.map +1 -0
  313. package/lib/packlets/resource-types/config/json.d.ts +9 -0
  314. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  315. package/lib/packlets/resource-types/config/json.js +24 -0
  316. package/lib/packlets/resource-types/config/json.js.map +1 -0
  317. package/lib/packlets/resource-types/helpers.d.ts +13 -0
  318. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  319. package/lib/packlets/resource-types/helpers.js +44 -0
  320. package/lib/packlets/resource-types/helpers.js.map +1 -0
  321. package/lib/packlets/resource-types/index.d.ts +3 -0
  322. package/lib/packlets/resource-types/index.d.ts.map +1 -1
  323. package/lib/packlets/resource-types/index.js +26 -0
  324. package/lib/packlets/resource-types/index.js.map +1 -1
  325. package/lib/packlets/resource-types/jsonResourceType.d.ts +8 -16
  326. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
  327. package/lib/packlets/resource-types/jsonResourceType.js +6 -3
  328. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
  329. package/lib/packlets/resource-types/resourceType.d.ts +45 -35
  330. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
  331. package/lib/packlets/resource-types/resourceType.js.map +1 -1
  332. package/lib/packlets/resources/candidateReducer.d.ts +98 -0
  333. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  334. package/lib/packlets/resources/candidateReducer.js +247 -0
  335. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  336. package/lib/packlets/resources/common.d.ts +72 -0
  337. package/lib/packlets/resources/common.d.ts.map +1 -0
  338. package/lib/packlets/resources/common.js +24 -0
  339. package/lib/packlets/resources/common.js.map +1 -0
  340. package/lib/packlets/resources/index.d.ts +3 -1
  341. package/lib/packlets/resources/index.d.ts.map +1 -1
  342. package/lib/packlets/resources/index.js +3 -1
  343. package/lib/packlets/resources/index.js.map +1 -1
  344. package/lib/packlets/resources/resource.d.ts +57 -5
  345. package/lib/packlets/resources/resource.d.ts.map +1 -1
  346. package/lib/packlets/resources/resource.js +96 -6
  347. package/lib/packlets/resources/resource.js.map +1 -1
  348. package/lib/packlets/resources/resourceBuilder.d.ts +14 -0
  349. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -1
  350. package/lib/packlets/resources/resourceBuilder.js +19 -1
  351. package/lib/packlets/resources/resourceBuilder.js.map +1 -1
  352. package/lib/packlets/resources/resourceCandidate.d.ts +46 -6
  353. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -1
  354. package/lib/packlets/resources/resourceCandidate.js +46 -1
  355. package/lib/packlets/resources/resourceCandidate.js.map +1 -1
  356. package/lib/packlets/resources/resourceManagerBuilder.d.ts +347 -0
  357. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  358. package/lib/packlets/resources/resourceManagerBuilder.js +893 -0
  359. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  360. package/lib/packlets/runtime/cacheListener.d.ts +71 -0
  361. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  362. package/lib/packlets/runtime/cacheListener.js +62 -0
  363. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  364. package/lib/packlets/runtime/cacheMetrics.d.ts +88 -0
  365. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  366. package/lib/packlets/runtime/cacheMetrics.js +154 -0
  367. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  368. package/lib/packlets/runtime/compiledResourceCollection.d.ts +167 -0
  369. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  370. package/lib/packlets/runtime/compiledResourceCollection.js +466 -0
  371. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  372. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts +70 -0
  373. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  374. package/lib/packlets/runtime/conditionSetResolutionResult.js +135 -0
  375. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  376. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +80 -0
  377. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  378. package/lib/packlets/runtime/context/contextQualifierProvider.js +33 -0
  379. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  380. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +165 -0
  381. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  382. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +179 -0
  383. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  384. package/lib/packlets/runtime/context/index.d.ts +5 -0
  385. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  386. package/lib/packlets/runtime/context/index.js +42 -0
  387. package/lib/packlets/runtime/context/index.js.map +1 -0
  388. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +111 -0
  389. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  390. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +177 -0
  391. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  392. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +47 -0
  393. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  394. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +64 -0
  395. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  396. package/lib/packlets/runtime/iResourceManager.d.ts +94 -0
  397. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  398. package/lib/packlets/runtime/iResourceManager.js +24 -0
  399. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  400. package/lib/packlets/runtime/index.d.ts +12 -0
  401. package/lib/packlets/runtime/index.d.ts.map +1 -0
  402. package/lib/packlets/runtime/index.js +73 -0
  403. package/lib/packlets/runtime/index.js.map +1 -0
  404. package/lib/packlets/runtime/resource-tree/common.d.ts +91 -0
  405. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  406. package/lib/packlets/runtime/resource-tree/common.js +24 -0
  407. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  408. package/lib/packlets/runtime/resource-tree/index.d.ts +5 -0
  409. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  410. package/lib/packlets/runtime/resource-tree/index.js +42 -0
  411. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  412. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts +141 -0
  413. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  414. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js +224 -0
  415. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  416. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts +24 -0
  417. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  418. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +98 -0
  419. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  420. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +99 -0
  421. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  422. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +165 -0
  423. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  424. package/lib/packlets/runtime/resourceResolver.d.ts +217 -0
  425. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  426. package/lib/packlets/runtime/resourceResolver.js +459 -0
  427. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  428. package/lib/packlets/runtime/validate.d.ts +13 -0
  429. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  430. package/lib/packlets/runtime/validate.js +49 -0
  431. package/lib/packlets/runtime/validate.js.map +1 -0
  432. package/package.json +76 -75
  433. package/lib/packlets/resources/resourceManager.d.ts +0 -104
  434. package/lib/packlets/resources/resourceManager.d.ts.map +0 -1
  435. package/lib/packlets/resources/resourceManager.js +0 -201
  436. package/lib/packlets/resources/resourceManager.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceManagerBuilder.js","sourceRoot":"","sources":["../../../src/packlets/resources/resourceManagerBuilder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAauB;AACvB,oDAAiE;AACjE,8CASuB;AACvB,4CAA8G;AAG9G,sCAA0D;AAC1D,wCAA4D;AAC5D,uDAAiF;AACjF,yCAAsC;AAGtC,+DAAiD;AACjD,oDAAsC;AACt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,GAAG,SAAS,CAAC;gBACzB,CAAC;YACH,CAAC;YAED,4DAA4D;YAC5D,yCAAyC;YACzC,MAAM,OAAO,GAAG,MAAA,SAAS,CAAC,IAAI,mCAAI,EAAE,CAAC;YACrC,yBAAc,CAAC,UAAU;iBACtB,OAAO,CAAC,OAAO,CAAC;iBAChB,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;gBAClB,MAAM,aAAa,GAAkD;oBACnE,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,IAAI;oBACJ,UAAU;oBACV,SAAS,EAAE,SAAS,CAAC,SAAS;oBAC9B,WAAW,EAAE,SAAS,CAAC,WAAW;oBAClC,gBAAgB,EAAE,YAAY,CAAC,GAAG;iBACnC,CAAC;gBAEF,OAAO,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACzE,CAAC,CAAC;iBACD,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AAtgCD,wDAsgCC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n Collections,\n DetailedResult,\n fail,\n failWithDetail,\n Hash,\n mapResults,\n MessageAggregator,\n Result,\n succeed,\n succeedWithDetail,\n ValidatingResultMap\n} from '@fgv/ts-utils';\nimport { Converters as JsonConverters } from '@fgv/ts-json-base';\nimport {\n ConditionCollector,\n ConditionSetCollector,\n ReadOnlyConditionCollector,\n ReadOnlyConditionSetCollector,\n Convert as ConditionsConvert,\n Condition,\n ConditionSet,\n IConditionSetDecl\n} from '../conditions';\nimport { AbstractDecisionCollector, ReadOnlyAbstractDecisionCollector, AbstractDecision } from '../decisions';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { ReadOnlyResourceTypeCollector, ResourceType } from '../resource-types';\nimport { Convert, ResourceId, Validate } from '../common';\nimport { IResourceManager, ResourceTree } from '../runtime';\nimport { ResourceBuilder, ResourceBuilderResultDetail } from './resourceBuilder';\nimport { Resource } from './resource';\nimport { ResourceCandidate } from './resourceCandidate';\nimport { IResourceDeclarationOptions, IResourceManagerCloneOptions } from './common';\nimport * as ResourceJson from '../resource-json';\nimport * as Context from '../context';\nimport * as Config from '../config';\nimport { JsonEditor } from '@fgv/ts-json';\n\n/**\n * Interface for parameters to the {@link Resources.ResourceManagerBuilder.create | ResourceManagerBuilder create method}.\n * @public\n */\nexport interface IResourceManagerBuilderCreateParams {\n qualifiers: IReadOnlyQualifierCollector;\n resourceTypes: ReadOnlyResourceTypeCollector;\n}\n\n/**\n * Error details that can be returned by a {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder}.\n * @public\n */\nexport type ResourceManagerBuilderResultDetail =\n | Collections.ResultMapResultDetail\n | ResourceBuilderResultDetail;\n\n/**\n * Builder for a collection of {@link Resources.Resource | resources}. Collects\n * {@link Resources.ResourceCandidate | candidates} for each resource into a\n * {@link Resources.ResourceBuilder | ResourceBuilder} per resource, validates them against each other,\n * and builds a collection of {@link Resources.Resource | resources} once all candidates are collected.\n * @public\n */\nexport class ResourceManagerBuilder implements IResourceManager<Resource> {\n public readonly qualifiers: IReadOnlyQualifierCollector;\n public readonly resourceTypes: ReadOnlyResourceTypeCollector;\n\n protected readonly _conditions: ConditionCollector;\n protected readonly _conditionSets: ConditionSetCollector;\n protected readonly _decisions: AbstractDecisionCollector;\n protected readonly _resources: ValidatingResultMap<ResourceId, ResourceBuilder>;\n public readonly _builtResources: ValidatingResultMap<ResourceId, Resource>;\n\n protected _built: boolean;\n protected _cachedResourceTree?: ResourceTree.IReadOnlyResourceTreeRoot<Resource>;\n\n /**\n * A {@link Conditions.ConditionCollector | ConditionCollector} which\n * contains the {@link Conditions.Condition | conditions} used so far by\n * the {@link Resources.ResourceCandidate | resource candidates} in this manager.\n */\n public get conditions(): ReadOnlyConditionCollector {\n return this._conditions;\n }\n\n /**\n * A {@link Conditions.ConditionSetCollector | ConditionSetCollector} which\n * contains the {@link Conditions.ConditionSet | condition sets} used so far by\n * the {@link Resources.ResourceCandidate | resource candidates} in this manager.\n */\n public get conditionSets(): ReadOnlyConditionSetCollector {\n return this._conditionSets;\n }\n\n /**\n * A {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector} which\n * contains the {@link Decisions.Decision | abstract decisions} used so far by\n * the {@link Resources.ResourceCandidate | resource candidates} in this manager.\n */\n public get decisions(): ReadOnlyAbstractDecisionCollector {\n return this._decisions;\n }\n\n /**\n * A read-only map of {@link Resources.ResourceBuilder | resource builders} used by the manager.\n */\n public get resources(): Collections.IReadOnlyValidatingResultMap<ResourceId, ResourceBuilder> {\n return this._resources;\n }\n\n /**\n * The number of {@link Resources.Resource | resources} contained by the manager.\n */\n public get size(): number {\n return this._resources.size;\n }\n\n /**\n * {@inheritdoc Runtime.IResourceManager.numResources}\n */\n public get numResources(): number {\n return this._resources.size;\n }\n\n /**\n * The number of candidates in this resource manager.\n */\n protected _numCandidates?: number;\n\n /**\n * {@inheritdoc Runtime.IResourceManager.numCandidates}\n */\n public get numCandidates(): number {\n if (this._numCandidates === undefined) {\n this._numCandidates = this.getAllCandidates().length;\n }\n return this._numCandidates;\n }\n\n /**\n * {@inheritdoc Runtime.IResourceManager.builtResources}\n */\n public get builtResources(): Collections.IReadOnlyValidatingResultMap<ResourceId, Resource> {\n return this._performBuild().orThrow();\n }\n\n /**\n * Constructor for a {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object.\n * @param params - Parameters to create a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder}.\n * @public\n */\n protected constructor(params: IResourceManagerBuilderCreateParams) {\n this.qualifiers = params.qualifiers;\n this.resourceTypes = params.resourceTypes;\n this._conditions = ConditionCollector.create({ qualifiers: params.qualifiers }).orThrow();\n this._conditionSets = ConditionSetCollector.create({ conditions: this._conditions }).orThrow();\n this._decisions = AbstractDecisionCollector.create({ conditionSets: this._conditionSets }).orThrow();\n this._resources = new ValidatingResultMap({\n converters: new Collections.KeyValueConverters<ResourceId, ResourceBuilder>({\n key: Convert.resourceId,\n /* c8 ignore next 2 - defense in depth against internal error */\n value: (from: unknown) =>\n from instanceof ResourceBuilder ? succeed(from) : fail('not a resource builder')\n })\n });\n this._builtResources = new ValidatingResultMap({\n converters: new Collections.KeyValueConverters<ResourceId, Resource>({\n key: Convert.resourceId,\n /* c8 ignore next 1 - defense in depth against internal error */\n value: (from: unknown) => (from instanceof Resource ? succeed(from) : fail('not a resource'))\n })\n });\n this._built = false;\n this._cachedResourceTree = undefined;\n }\n\n /**\n * Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object.\n * @param params - Parameters to create a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder}.\n * @returns `Success` with the new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params: IResourceManagerBuilderCreateParams): Result<ResourceManagerBuilder> {\n return captureResult(() => new ResourceManagerBuilder(params));\n }\n\n /**\n * Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object from a predefined system configuration.\n * @param name - The name of the predefined system configuration to use.\n * @param qualifierDefaultValues - Optional default values for qualifiers.\n * @returns `Success` with the new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static createPredefined(\n name: Config.PredefinedSystemConfiguration,\n qualifierDefaultValues?: Config.ISystemConfigurationInitParams['qualifierDefaultValues']\n ): Result<ResourceManagerBuilder> {\n return Config.getPredefinedSystemConfiguration(\n name,\n /* c8 ignore next 1 - defense in depth */\n qualifierDefaultValues ? { qualifierDefaultValues } : undefined\n ).onSuccess((systemConfig) => {\n return ResourceManagerBuilder.create({\n qualifiers: systemConfig.qualifiers,\n resourceTypes: systemConfig.resourceTypes\n });\n });\n }\n\n /**\n * Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} from a\n * {@link ResourceJson.Compiled.ICompiledResourceCollection | compiled resource collection}.\n * This method reconstructs an exactly equivalent builder where all qualifier, condition,\n * condition set, and decision indices match the original compiled collection.\n * @param compiledCollection - The compiled resource collection to reconstruct from.\n * @param systemConfig - The system configuration containing qualifiers and resource types.\n * @returns `Success` with the new manager if successful, or `Failure` with an error message if not.\n * @public\n */\n public static createFromCompiledResourceCollection(\n compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection,\n systemConfig: Config.SystemConfiguration\n ): Result<ResourceManagerBuilder> {\n // Create the base builder with system configuration\n return ResourceManagerBuilder.create({\n qualifiers: systemConfig.qualifiers,\n resourceTypes: systemConfig.resourceTypes\n }).onSuccess((builder) => {\n // Reconstruct all entities in order to preserve indices\n return ResourceManagerBuilder._reconstructConditions(builder, compiledCollection)\n .onSuccess(() => ResourceManagerBuilder._reconstructConditionSets(builder, compiledCollection))\n .onSuccess(() => ResourceManagerBuilder._reconstructDecisions(builder, compiledCollection))\n .onSuccess(() => ResourceManagerBuilder._reconstructResources(builder, compiledCollection))\n .onSuccess(() => succeed(builder));\n });\n }\n\n /**\n * Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, builds and adds\n * a {@link Resources.ResourceCandidate | candidate} to the manager.\n * @param candidate - The {@link Resources.ResourceCandidate | candidate} to add.\n * @returns `Success` with the candidate if successful, or `Failure` with an error message if not.\n * @public\n */\n public addLooseCandidate(\n decl: ResourceJson.Json.ILooseResourceCandidateDecl\n ): DetailedResult<ResourceCandidate, ResourceBuilderResultDetail> {\n const { value: id, message } = Validate.toResourceId(decl.id);\n if (message !== undefined) {\n return failWithDetail(`${id}: invalid id - ${message}`, 'failure');\n }\n\n const builderResult = this._resources.getOrAdd(id, () =>\n ResourceBuilder.create({\n id,\n resourceTypes: this.resourceTypes,\n conditionSets: this._conditionSets,\n decisions: this._decisions\n })\n );\n /* c8 ignore next 6 - defense in depth against internal error */\n if (builderResult.isFailure()) {\n return failWithDetail(\n `${id}: unable to get or add resource\\n${builderResult.message}`,\n builderResult.detail\n );\n }\n return builderResult.value.addLooseCandidate(decl).onSuccess((c, d) => {\n this._builtResources.delete(id);\n this._built = false;\n this._numCandidates = undefined;\n this._cachedResourceTree = undefined;\n return succeedWithDetail(c, d);\n });\n }\n\n public addResource(\n decl: ResourceJson.Json.ILooseResourceDecl\n ): DetailedResult<ResourceBuilder, ResourceBuilderResultDetail> {\n const { value: id, message } = Validate.toResourceId(decl.id);\n if (message !== undefined) {\n return failWithDetail(`${id}: invalid id - ${message}`, 'failure');\n }\n\n const {\n value: builder,\n message: getOrAddMessage,\n detail\n } = this._resources.getOrAdd(id, () =>\n ResourceBuilder.create({\n id,\n typeName: decl.resourceTypeName,\n resourceTypes: this.resourceTypes,\n conditionSets: this._conditionSets,\n decisions: this._decisions\n })\n );\n /* c8 ignore next 3 - defense in depth against internal error */\n if (getOrAddMessage !== undefined) {\n return failWithDetail(`${id}: unable to get or add resource\\n${getOrAddMessage}`, detail);\n }\n\n if (detail === 'exists') {\n const { message } = builder.setResourceType(decl.resourceTypeName);\n if (message !== undefined) {\n return failWithDetail(`${id}: unable to set resource type\\n${message}`, 'type-mismatch');\n }\n }\n\n const candidates = decl.candidates ?? [];\n return mapResults(candidates.map((c) => builder.addChildCandidate(c)))\n .onSuccess(() => {\n return succeed(builder);\n })\n .withDetail('failure', detail);\n }\n\n /**\n * Adds a condition to the manager.\n * @param decl - The condition declaration to add.\n * @returns `Success` with the condition if successful, or `Failure` with an error message if not.\n * @public\n */\n public addCondition(decl: ResourceJson.Json.ILooseConditionDecl): Result<Condition> {\n return ConditionsConvert.validatedConditionDecl\n .convert(decl, { qualifiers: this.qualifiers })\n .onSuccess((validated) => {\n return Condition.getKeyForDecl(validated).onSuccess((key) => {\n return this._conditions.validating.getOrAdd(key, () => Condition.create(validated));\n });\n });\n }\n\n /**\n * Adds a condition set to the manager.\n * @param decl - The condition set declaration to add.\n * @returns `Success` with the condition set if successful, or `Failure` with an error message if not.\n * @public\n */\n public addConditionSet(conditions: ResourceJson.Normalized.ConditionSetDecl): Result<ConditionSet> {\n const decl: IConditionSetDecl = { conditions: [...conditions] };\n return ConditionsConvert.validatedConditionSetDecl\n .convert(decl, { conditions: this._conditions })\n .onSuccess((validated) => {\n return ConditionSet.getKeyForDecl(validated).onSuccess((key) => {\n return this._conditionSets.validating.getOrAdd(key, () => ConditionSet.create(validated));\n });\n });\n }\n\n /**\n * Gets a read-only array of all {@link Resources.ResourceBuilder | resource builders} present in the manager.\n * @returns `Success` with the {@link Resources.ResourceBuilder | resource builder} if successful,\n * or `Failure` with an error message if not.\n */\n public getAllResources(): ReadonlyArray<ResourceBuilder> {\n return Array.from(this._resources.values()).sort((a, b) => a.id.localeCompare(b.id));\n }\n\n /**\n * Gets a read-only array of all {@link Resources.ResourceCandidate | resource candidates} present in the manager.\n */\n public getAllCandidates(): ReadonlyArray<ResourceCandidate> {\n return this.getAllResources().flatMap((r) => r.candidates);\n }\n\n /**\n * Gets an individual {@link Resources.Resource | built resource} from the manager.\n * @param id - The {@link ResourceId | id} of the resource to get.\n * @returns `Success` with the resource if successful, or `Failure` with an error message if not.\n * @public\n */\n public getBuiltResource(id: string): Result<Resource> {\n return this._resources.validating\n .get(id)\n .onSuccess((builder) => this._builtResources.validating.getOrAdd(id, () => builder.build()));\n }\n\n /**\n * Validates a context declaration against the qualifiers managed by this resource manager.\n * @param context - The context declaration to validate\n * @returns Success with the validated context if successful, Failure otherwise\n * @public\n */\n /* c8 ignore next 5 - functional code path tested but coverage intermittently missed */\n public validateContext(context: Context.IContextDecl): Result<Context.IValidatedContextDecl> {\n return Context.Convert.validatedContextDecl.convert(context, {\n qualifiers: this.qualifiers\n });\n }\n\n /**\n * Gets a read-only array of all {@link Resources.Resource | built resources} in the manager.\n * @returns `Success` with an array of resources if successful, or `Failure` with an error message if not.\n * @public\n */\n public getAllBuiltResources(): Result<ReadonlyArray<Resource>> {\n return this.build().onSuccess((manager) =>\n succeed(Array.from(manager._builtResources.values()).sort((a, b) => a.id.localeCompare(b.id)))\n );\n }\n\n /**\n * Builds and returns a hierarchical tree representation of all resources managed by this builder.\n * Resources are organized based on their dot-separated resource IDs (e.g., \"app.messages.welcome\"\n * becomes a tree with \"app\" as root, \"messages\" as branch, and \"welcome\" as leaf).\n *\n * String-based validation is available through the `children.validating` property,\n * allowing callers to use `tree.children.validating.getById(stringId)` for validated access.\n *\n * Uses lazy initialization with caching for performance.\n * @returns Result containing the resource tree root, or failure if tree construction fails\n * @public\n */\n public getBuiltResourceTree(): Result<ResourceTree.IReadOnlyResourceTreeRoot<Resource>> {\n // Ensure resources are built first\n return this.build().onSuccess((manager) => {\n if (manager._cachedResourceTree) {\n return succeed(manager._cachedResourceTree);\n }\n\n // Convert all built resources to [ResourceId, Resource] pairs\n const resources: [ResourceId, Resource][] = [];\n for (const [id, resource] of manager._builtResources.entries()) {\n resources.push([id, resource]);\n }\n\n // Create the resource tree with lazy initialization\n return ResourceTree.ReadOnlyResourceTreeRoot.create(resources).onSuccess((tree) => {\n manager._cachedResourceTree = tree;\n return succeed(tree);\n });\n });\n }\n\n /**\n * Gets a read-only array of all {@link Resources.Resource | built resources} in the manager.\n * @returns `Success` with an array of resources if successful, or `Failure` with an error message if not.\n * @public\n */\n public getAllBuiltCandidates(): Result<ReadonlyArray<ResourceCandidate>> {\n return this.getAllBuiltResources().onSuccess((built) => succeed(built.flatMap((r) => r.candidates)));\n }\n\n /**\n * Internal helper method that performs the actual building of resources.\n * @returns `Success` with the built resources if all resources were built successfully, `Failure` otherwise.\n * @internal\n */\n public _performBuild(): Result<Collections.IReadOnlyValidatingResultMap<ResourceId, Resource>> {\n if (this._built) {\n return succeed(this._builtResources);\n }\n\n const errors: MessageAggregator = new MessageAggregator();\n this._resources.forEach((r, id) => {\n this._builtResources.getOrAdd(id, () => r.build()).aggregateError(errors);\n });\n /* c8 ignore next 3 - defense in depth against internal error */\n if (errors.hasMessages) {\n return fail(`build failed: ${errors.toString()}`);\n }\n this._built = true;\n return succeed(this._builtResources);\n }\n\n /**\n * Builds the {@link Resources.Resource | resources} from the collected {@link Resources.ResourceCandidate | candidates}.\n * @returns `Success` with the {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public build(): Result<this> {\n return this._performBuild().onSuccess(() => succeed(this));\n }\n\n /**\n * Gets a read-only array of all {@link Resources.ResourceCandidate | resource candidates} that can match the supplied context.\n * @param context - The {@link Context.IValidatedContextDecl | context} to match against.\n * @param options - {@link Context.IContextMatchOptions | options} for the context match.\n * @returns A read-only array of {@link Resources.ResourceCandidate | candidates} that can match the context.\n * @public\n */\n public getCandidatesForContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): ReadonlyArray<ResourceCandidate> {\n return this.getAllCandidates().filter((candidate) => candidate.canMatchPartialContext(context, options));\n }\n\n /**\n * Gets a read-only array of all {@link Resources.ResourceBuilder | resource builders} that have at least one candidate\n * that can match the supplied context.\n * @param context - The {@link Context.IValidatedContextDecl | context} to match against.\n * @param options - {@link Context.IContextMatchOptions | options} for the context match.\n * @returns A read-only array of {@link Resources.ResourceBuilder | resource builders} with matching candidates.\n * @public\n */\n public getResourcesForContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): ReadonlyArray<ResourceBuilder> {\n return this.getAllResources().filter(\n (resource) => resource.getCandidatesForContext(context, options).length > 0\n );\n }\n\n /**\n * Gets a read-only array of all {@link Resources.ResourceCandidate | built resource candidates} that can match the supplied context.\n * @param context - The {@link Context.IValidatedContextDecl | context} to match against.\n * @param options - {@link Context.IContextMatchOptions | options} for the context match.\n * @returns `Success` with an array of {@link Resources.ResourceCandidate | candidates} if successful, or `Failure` with an error message if not.\n * @public\n */\n public getBuiltCandidatesForContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): Result<ReadonlyArray<ResourceCandidate>> {\n return this.getAllBuiltCandidates().onSuccess((candidates) =>\n succeed(candidates.filter((candidate) => candidate.canMatchPartialContext(context, options)))\n );\n }\n\n /**\n * Gets a read-only array of all {@link Resources.Resource | built resources} that have at least one candidate\n * that can match the supplied context.\n * @param context - The {@link Context.IValidatedContextDecl | context} to match against.\n * @param options - {@link Context.IContextMatchOptions | options} for the context match.\n * @returns `Success` with an array of {@link Resources.Resource | resources} if successful, or `Failure` with an error message if not.\n * @public\n */\n public getBuiltResourcesForContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): Result<ReadonlyArray<Resource>> {\n return this.getAllBuiltResources().onSuccess((resources) =>\n succeed(resources.filter((resource) => resource.getCandidatesForContext(context, options).length > 0))\n );\n }\n\n /**\n * Gets a compiled resource collection from the current state of the resource manager builder.\n * This method generates an optimized, index-based representation of all resources, conditions,\n * and decisions that can be used for serialization or efficient runtime processing.\n * @param options - Optional compilation options controlling the output format.\n * @returns Success with the compiled resource collection if successful, Failure otherwise.\n * @public\n */\n public getCompiledResourceCollection(\n options?: ResourceJson.Compiled.ICompiledResourceOptions\n ): Result<ResourceJson.Compiled.ICompiledResourceCollection> {\n // Build resources first to ensure all data is available\n const buildResult = this._performBuild();\n if (buildResult.isFailure()) {\n return fail(`Failed to build resources: ${buildResult.message}`);\n }\n\n // Generate compiled data from internal collections using the new toCompiled methods\n // Note: All objects have a defined index property due to the collector pattern - indices are assigned during collection building\n const compiledData = {\n qualifierTypes: Array.from(this.qualifiers.qualifierTypes.values()).map((qt) => ({\n name: qt.name\n })),\n qualifiers: Array.from(this.qualifiers.values()).map((q) => ({\n name: q.name,\n type: q.type.index!,\n defaultPriority: q.defaultPriority\n })),\n resourceTypes: Array.from(this.resourceTypes.values()).map((rt) => ({\n name: rt.key\n })),\n conditions: Array.from(this._conditions.values()).map((c) => c.toCompiled(options)),\n conditionSets: Array.from(this._conditionSets.values()).map((cs) => cs.toCompiled(options)),\n decisions: Array.from(this._decisions.values()).map((d) => d.toCompiled(options)),\n resources: Array.from(this._builtResources.values()).map((r) => r.toCompiled(options))\n };\n\n // Apply validation through the converter\n return ResourceJson.Compiled.Convert.compiledResourceCollection.convert(compiledData);\n }\n\n /**\n * Gets a resource collection declaration containing all built resources in a flat array structure.\n * This method returns all built resources as an {@link ResourceJson.Normalized.IResourceCollectionDecl | IResourceCollectionDecl}\n * that can be used for serialization, export, or re-import. Resources are sorted by ID for consistent ordering.\n * @param options - Optional {@link Resources.IResourceDeclarationOptions | declaration options} controlling the output format.\n * If `options.normalized` is `true`, applies hash-based normalization for additional consistency guarantees.\n * @returns Success with the resource collection declaration if successful, Failure otherwise.\n * @public\n */\n public getResourceCollectionDecl(\n options?: IResourceDeclarationOptions\n ): Result<ResourceJson.Normalized.IResourceCollectionDecl> {\n return this._performBuild().onSuccess(() => {\n // Get all built resources and convert to loose resource declarations\n const resources = Array.from(this._builtResources.values()).map((resource) =>\n resource.toLooseResourceDecl(options)\n );\n\n // Sort resources by ID for consistent ordering\n resources.sort((a, b) => a.id.localeCompare(b.id));\n\n // Create the collection declaration structure\n const collectionData = {\n resources\n };\n\n // Convert and validate using the normalized converter\n return ResourceJson.Convert.resourceCollectionDecl\n .convert(collectionData)\n .onSuccess((compiledCollection) => {\n // Apply hash-based normalization only if requested\n if (options?.normalized === true) {\n const normalizer = new Hash.Crc32Normalizer();\n return normalizer\n .normalize(compiledCollection)\n .withErrorFormat((e) => `Failed to normalize resource collection: ${e}`);\n }\n return succeed(compiledCollection);\n });\n });\n }\n\n /**\n * Creates a filtered clone of this ResourceManagerBuilder using the specified context.\n * This is a convenience method that creates a new ResourceManagerBuilder with the same\n * configuration but filtered to include only candidates that match the provided context.\n * If candidates are provided for editing, they will be applied with collision detection.\n * @param options - Options for the cloning operation, including the strongly-typed filterForContext property and optional candidates for edits.\n * @returns A Result containing the new filtered ResourceManagerBuilder.\n * @public\n */\n /* c8 ignore next 21 - functional code path tested but coverage intermittently missed */\n public clone(options?: IResourceManagerCloneOptions): Result<ResourceManagerBuilder> {\n return this.getResourceCollectionDecl(options).onSuccess((collection) => {\n return ResourceManagerBuilder.create({\n qualifiers: this.qualifiers,\n resourceTypes: this.resourceTypes\n }).onSuccess((newManager) => {\n // Check if we have candidates to apply as edits\n const editCandidates = options?.candidates || [];\n const candidatesByResourceResult =\n editCandidates.length > 0\n ? ResourceManagerBuilder._createCandidatesByResourceMap(editCandidates)\n : succeed(new Map());\n\n return candidatesByResourceResult.onSuccess((candidatesByResource) => {\n // Track which resource IDs have been processed from the original collection\n const processedResourceIds = new Set<ResourceId>();\n\n // Add each resource from the filtered collection to the new manager\n if (collection.resources) {\n for (const resourceDecl of collection.resources) {\n processedResourceIds.add(resourceDecl.id as ResourceId);\n\n // Apply edits if there are candidates for this resource\n const editedDeclResult = ResourceManagerBuilder._applyEditsToResourceDeclaration(\n resourceDecl,\n candidatesByResource,\n this._conditions\n );\n\n if (editedDeclResult.isFailure()) {\n return fail(`${resourceDecl.id}: Failed to apply edits: ${editedDeclResult.message}`);\n }\n\n const addResult = newManager.addResource(editedDeclResult.value);\n /* c8 ignore next 5 - edge case (nearly?) impossible to reproduce */\n if (addResult.isFailure()) {\n return fail(\n `${resourceDecl.id}: Failed to add resource to cloned manager: ${addResult.message}`\n );\n }\n }\n }\n\n // Handle any remaining candidates that target new resources not in the original collection\n const errors = new MessageAggregator();\n for (const [resourceId, candidates] of candidatesByResource) {\n if (!processedResourceIds.has(resourceId)) {\n // Create a new resource declaration for candidates targeting a new resource ID\n ResourceManagerBuilder._createResourceDeclFromCandidates(\n resourceId,\n candidates,\n this._conditions\n )\n .withErrorFormat((e) => `${resourceId}: Failed to create new resource from candidates: ${e}`)\n .onSuccess((newResourceDecl) => {\n return newManager\n .addResource(newResourceDecl)\n .withErrorFormat(\n (e) => `${resourceId}: Failed to add new resource to cloned manager: ${e}`\n );\n })\n .aggregateError(errors);\n }\n }\n\n return errors.returnOrReport(succeed(newManager));\n });\n });\n });\n }\n\n /**\n * Creates a resource ID keyed map from an array of loose resource candidate declarations.\n * This enables efficient detection of edit collisions by grouping candidates by their target resource.\n * @param candidates - Array of loose resource candidate declarations to organize\n * @returns A Result containing a Map where keys are validated ResourceIds and values are arrays of candidates for that resource\n * @internal\n */\n private static _createCandidatesByResourceMap(\n candidates: ReadonlyArray<ResourceJson.Json.ILooseResourceCandidateDecl>\n ): Result<Map<ResourceId, ResourceJson.Json.ILooseResourceCandidateDecl[]>> {\n const candidatesByResource = new Map<ResourceId, ResourceJson.Json.ILooseResourceCandidateDecl[]>();\n\n for (const candidate of candidates) {\n const { value: resourceId, message } = Validate.toResourceId(candidate.id);\n if (message !== undefined) {\n return fail(`Invalid resource ID \"${candidate.id}\": ${message}`);\n }\n\n const existingCandidates = candidatesByResource.get(resourceId);\n if (existingCandidates) {\n existingCandidates.push(candidate);\n } else {\n candidatesByResource.set(resourceId, [candidate]);\n }\n }\n\n return succeed(candidatesByResource);\n }\n\n /**\n * Generates a proper ConditionSet token for collision detection using the existing ConditionSet.getKeyForDecl method.\n * @param conditionSet - The condition set to generate a token for\n * @param conditionCollector - The condition collector needed for validation context\n * @returns A Result containing the ConditionSet token if successful, or failure if validation fails\n * @internal\n */\n\n /**\n * Applies candidate edits to a resource declaration, handling collisions using condition set tokens.\n * If there's no collision, adds the candidate. If there's a collision, replaces the original candidate with the edit.\n * @param resourceDecl - The original resource declaration to potentially modify\n * @param candidatesByResource - Map of resource IDs to arrays of candidate edits\n * @param conditionCollector - The condition collector needed for generating condition tokens\n * @returns A Result containing the resource declaration to use (original or modified)\n * @internal\n */\n private static _applyEditsToResourceDeclaration(\n resourceDecl: ResourceJson.Json.ILooseResourceDecl,\n candidatesByResource: Map<ResourceId, ResourceJson.Json.ILooseResourceCandidateDecl[]>,\n conditionCollector: ConditionCollector\n ): Result<ResourceJson.Json.ILooseResourceDecl> {\n const { value: resourceId, message } = Validate.toResourceId(resourceDecl.id);\n /* c8 ignore next 3 - defensive validation: resource IDs are validated when added to builder, but this protects against corrupted data */\n if (message !== undefined) {\n return fail(`Invalid resource ID \"${resourceDecl.id}\": ${message}`);\n }\n\n const editCandidates = candidatesByResource.get(resourceId);\n if (!editCandidates || editCandidates.length === 0) {\n return succeed(resourceDecl);\n }\n\n // Use Map approach: apply original candidates first, then replace with edits on collision\n const candidatesByConditionKey = new Map<string, ResourceJson.Json.IChildResourceCandidateDecl>();\n\n /* c8 ignore next 1 - ?? is defense in depth */\n const declCandidates = resourceDecl.candidates ?? [];\n\n // First, add all original candidates keyed by their condition set token\n for (const candidate of declCandidates) {\n const conditionTokenResult = ConditionSet.getKeyFromLooseDecl(candidate.conditions, conditionCollector);\n /* c8 ignore next 5 - edge case or internal error (nearly?) impossible to reproduce */\n if (conditionTokenResult.isFailure()) {\n return fail(\n `Failed to generate condition token for original candidate: ${conditionTokenResult.message}`\n );\n }\n candidatesByConditionKey.set(conditionTokenResult.value, candidate);\n }\n\n // Then, apply edits (this replaces any colliding original candidates)\n // Convert edit candidates (which have ids) to child candidates (without ids) for merging\n for (const editCandidate of editCandidates) {\n const conditionTokenResult = ConditionSet.getKeyFromLooseDecl(\n editCandidate.conditions,\n conditionCollector\n );\n if (conditionTokenResult.isFailure()) {\n return fail(`Failed to generate condition token for edit candidate: ${conditionTokenResult.message}`);\n }\n let editedJson = editCandidate.json;\n const previousJson = candidatesByConditionKey.get(conditionTokenResult.value)?.json;\n if (previousJson && previousJson !== editedJson) {\n editedJson = JsonEditor.create({\n merge: {\n arrayMergeBehavior: 'replace',\n nullAsDelete: false\n }\n })\n .onSuccess((editor) => {\n return editor.mergeObjectsInPlace({}, [previousJson, editedJson]);\n })\n .orThrow();\n }\n\n const childCandidate: ResourceJson.Json.IChildResourceCandidateDecl = {\n json: editedJson,\n conditions: editCandidate.conditions,\n isPartial: editCandidate.isPartial,\n mergeMethod: editCandidate.mergeMethod\n };\n candidatesByConditionKey.set(conditionTokenResult.value, childCandidate);\n }\n\n // Extract the final merged candidate list\n const mergedCandidates = Array.from(candidatesByConditionKey.values());\n\n const modifiedDecl: ResourceJson.Json.ILooseResourceDecl = {\n ...resourceDecl,\n candidates: mergedCandidates\n };\n\n return succeed(modifiedDecl);\n }\n\n /**\n * Creates a new resource declaration from an array of candidate declarations.\n * This is used when cloning to create new resources that don't exist in the original manager.\n * @param resourceId - The validated resource ID for the new resource\n * @param candidates - Array of loose candidate declarations for the new resource\n * @param conditionCollector - The condition collector for validation context\n * @returns A Result containing the new resource declaration if successful, or failure if validation fails\n * @internal\n */\n private static _createResourceDeclFromCandidates(\n resourceId: ResourceId,\n candidates: ResourceJson.Json.ILooseResourceCandidateDecl[],\n conditionCollector: ConditionCollector\n ): Result<ResourceJson.Json.ILooseResourceDecl> {\n // Convert candidate declarations to child candidate declarations\n const childCandidates: ResourceJson.Json.IChildResourceCandidateDecl[] = [];\n\n // Ensure we have candidates\n /* c8 ignore next 3 - defense in depth against internal error */\n if (candidates.length === 0) {\n return fail('Cannot create resource declaration from empty candidates array');\n }\n\n // Extract resourceTypeName from the first candidate (all candidates for the same resource should have the same type)\n const resourceTypeName = candidates[0].resourceTypeName;\n /* c8 ignore next 3 - defense in depth */\n if (!resourceTypeName) {\n return fail('resourceTypeName is required for new resource candidates');\n }\n\n for (const candidate of candidates) {\n const childCandidate: ResourceJson.Json.IChildResourceCandidateDecl = {\n json: candidate.json,\n conditions: candidate.conditions,\n isPartial: candidate.isPartial,\n mergeMethod: candidate.mergeMethod\n };\n childCandidates.push(childCandidate);\n }\n\n // Create the new resource declaration\n const newResourceDecl: ResourceJson.Json.ILooseResourceDecl = {\n id: resourceId,\n candidates: childCandidates,\n resourceTypeName\n };\n\n return succeed(newResourceDecl);\n }\n\n /**\n * Reconstructs conditions from a compiled collection and adds them to the builder.\n * @param builder - The builder to add conditions to.\n * @param compiledCollection - The compiled collection containing conditions.\n * @returns `Success` if all conditions were added successfully, `Failure` otherwise.\n * @internal\n */\n private static _reconstructConditions(\n builder: ResourceManagerBuilder,\n compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection\n ): Result<boolean> {\n const errors = new MessageAggregator();\n\n for (const compiledCondition of compiledCollection.conditions) {\n // Get the qualifier by index\n const qualifierResult = builder.qualifiers.getAt(compiledCondition.qualifierIndex);\n /* c8 ignore next 4 - edge case or internal error (nearly?) impossible to reproduce */\n if (qualifierResult.isFailure()) {\n qualifierResult.aggregateError(errors);\n continue;\n }\n\n // Create condition declaration from compiled condition\n const conditionDecl: ResourceJson.Json.ILooseConditionDecl = {\n qualifierName: qualifierResult.value.name,\n operator: compiledCondition.operator,\n value: compiledCondition.value,\n priority: compiledCondition.priority,\n scoreAsDefault: compiledCondition.scoreAsDefault\n };\n\n // Add condition to builder (it will get the next sequential index)\n builder.addCondition(conditionDecl).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Reconstructs condition sets from a compiled collection and adds them to the builder.\n * @param builder - The builder to add condition sets to.\n * @param compiledCollection - The compiled collection containing condition sets.\n * @returns `Success` if all condition sets were added successfully, `Failure` otherwise.\n * @internal\n */\n private static _reconstructConditionSets(\n builder: ResourceManagerBuilder,\n compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection\n ): Result<boolean> {\n const errors = new MessageAggregator();\n\n for (const compiledConditionSet of compiledCollection.conditionSets) {\n // Get conditions by their indices\n const conditionResults = compiledConditionSet.conditions.map((idx) => builder._conditions.getAt(idx));\n\n // Check for any failures\n const failedIndex = conditionResults.findIndex((r) => r.isFailure());\n /* c8 ignore next 4 - edge case or internal error (nearly?) impossible to reproduce */\n if (failedIndex >= 0) {\n conditionResults[failedIndex].aggregateError(errors);\n continue;\n }\n\n // Create condition set from conditions (not declarations)\n const conditions = conditionResults.map((r) => r.orThrow());\n // Convert conditions to declarations for addConditionSet\n const conditionDecls = conditions.map((c) => c.toLooseConditionDecl());\n builder.addConditionSet(conditionDecls).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Reconstructs decisions from a compiled collection and adds them to the builder.\n * @param builder - The builder to add decisions to.\n * @param compiledCollection - The compiled collection containing decisions.\n * @returns `Success` if all decisions were added successfully, `Failure` otherwise.\n * @internal\n */\n private static _reconstructDecisions(\n builder: ResourceManagerBuilder,\n compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection\n ): Result<boolean> {\n const errors = new MessageAggregator();\n\n for (const compiledDecision of compiledCollection.decisions) {\n // Get condition sets by their indices\n const conditionSetResults = compiledDecision.conditionSets.map((idx) =>\n builder._conditionSets.getAt(idx)\n );\n\n // Check for any failures\n const failedIndex = conditionSetResults.findIndex((r) => r.isFailure());\n if (failedIndex >= 0) {\n conditionSetResults[failedIndex].aggregateError(errors);\n continue;\n }\n\n // Get condition sets from successful results\n const conditionSets = conditionSetResults.map((r) => r.orThrow());\n // Create AbstractDecision from condition sets and add to collector\n AbstractDecision.createAbstractDecision({ conditionSets })\n .onSuccess((decision) => builder._decisions.getOrAdd(decision))\n .aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Reconstructs resources and their candidates from a compiled collection and adds them to the builder.\n * @param builder - The builder to add resources to.\n * @param compiledCollection - The compiled collection containing resources.\n * @returns `Success` if all resources were added successfully, `Failure` otherwise.\n * @internal\n */\n private static _reconstructResources(\n builder: ResourceManagerBuilder,\n compiledCollection: ResourceJson.Compiled.ICompiledResourceCollection\n ): Result<boolean> {\n const errors = new MessageAggregator();\n\n for (const compiledResource of compiledCollection.resources) {\n // Get the resource type by index\n const resourceTypeResult = builder.resourceTypes.getAt(compiledResource.type);\n /* c8 ignore next 4 - edge case or internal error (nearly?) impossible to reproduce */\n if (resourceTypeResult.isFailure()) {\n resourceTypeResult.aggregateError(errors);\n continue;\n }\n\n // Get the decision by index\n const decisionResult = builder._decisions.getAt(compiledResource.decision);\n /* c8 ignore next 4 - edge case or internal error (nearly?) impossible to reproduce */\n if (decisionResult.isFailure()) {\n decisionResult.aggregateError(errors);\n continue;\n }\n\n const decision = decisionResult.value;\n const resourceType = resourceTypeResult.value;\n\n // Create candidates from the decision's condition sets\n ResourceManagerBuilder._createCandidatesFromDecision(\n compiledResource,\n decision,\n resourceType,\n builder\n ).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Helper method to create candidates from a decision's condition sets.\n * @param compiledResource - The compiled resource containing candidates.\n * @param decision - The decision containing condition sets.\n * @param resourceType - The resource type for the candidates.\n * @param builder - The builder to add candidates to.\n * @returns `Success` if all candidates were added successfully, `Failure` otherwise.\n * @internal\n */\n private static _createCandidatesFromDecision(\n compiledResource: ResourceJson.Compiled.ICompiledResource,\n decision: AbstractDecision,\n resourceType: ResourceType,\n builder: ResourceManagerBuilder\n ): Result<boolean> {\n const errors = new MessageAggregator();\n\n // Match each candidate to its corresponding condition set\n for (let i = 0; i < compiledResource.candidates.length; i++) {\n const candidate = compiledResource.candidates[i];\n\n // Build conditions from the corresponding condition set (if available)\n let conditions: Record<string, string> | undefined;\n if (i < decision.candidates.length) {\n const decisionCandidate = decision.candidates[i];\n conditions = {};\n for (const condition of decisionCandidate.conditionSet.conditions) {\n conditions[condition.qualifier.name] = condition.value;\n }\n /* c8 ignore next 3 - defense in depth */\n if (Object.keys(conditions).length === 0) {\n conditions = undefined;\n }\n }\n\n // Convert json value to JsonObject, handling undefined case\n /* c8 ignore next 1 - defense in depth */\n const rawJson = candidate.json ?? {};\n JsonConverters.jsonObject\n .convert(rawJson)\n .onSuccess((json) => {\n const candidateDecl: ResourceJson.Json.ILooseResourceCandidateDecl = {\n id: compiledResource.id,\n json,\n conditions,\n isPartial: candidate.isPartial,\n mergeMethod: candidate.mergeMethod,\n resourceTypeName: resourceType.key\n };\n\n return builder.addLooseCandidate(candidateDecl).aggregateError(errors);\n })\n .aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n}\n"]}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Type indicating which {@link Runtime.ResourceResolver | ResourceResolver} cache is affected.
3
+ * @public
4
+ */
5
+ export type ResourceResolverCacheType = 'condition' | 'conditionSet' | 'decision';
6
+ /**
7
+ * Type indicating the action performed on a {@link Runtime.ResourceResolver | ResourceResolver} cache.
8
+ * @public
9
+ */
10
+ export type ResourceResolverCacheActivity = 'hit' | 'miss' | 'error' | 'clear';
11
+ /**
12
+ * A listener for {@link Runtime.ResourceResolver | ResourceResolver} cache activity.
13
+ * @public
14
+ */
15
+ export interface IResourceResolverCacheListener {
16
+ /**
17
+ * Called when a cache hit occurs.
18
+ * @param cache - The type of cache that was hit.
19
+ * @param index - The index of the cache that was hit.
20
+ */
21
+ onCacheHit(cache: ResourceResolverCacheType, index: number): void;
22
+ /**
23
+ * Called when a cache miss occurs.
24
+ * @param cache - The type of cache that was missed.
25
+ * @param index - The index of the cache that was missed.
26
+ */
27
+ onCacheMiss(cache: ResourceResolverCacheType, index: number): void;
28
+ /**
29
+ * Called when a cache error occurs.
30
+ * @param cache - The type of cache that had an error.
31
+ * @param index - The index of the cache that had an error.
32
+ */
33
+ onCacheError(cache: ResourceResolverCacheType, index: number): void;
34
+ /**
35
+ * Called when a context error occurs.
36
+ * @param error - The error that occurred.
37
+ */
38
+ onContextError(qualifier: string, error: string): void;
39
+ /**
40
+ * Called when a cache is cleared.
41
+ * @param cache - The type of cache that was cleared.
42
+ */
43
+ onCacheClear(cache: ResourceResolverCacheType): void;
44
+ }
45
+ /**
46
+ * A no-op implementation of {@link Runtime.IResourceResolverCacheListener}.
47
+ * @public
48
+ */
49
+ export declare class NoOpResourceResolverCacheListener implements IResourceResolverCacheListener {
50
+ /**
51
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}
52
+ */
53
+ onCacheHit(cache: ResourceResolverCacheType, index: number): void;
54
+ /**
55
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}
56
+ */
57
+ onCacheMiss(cache: ResourceResolverCacheType, index: number): void;
58
+ /**
59
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
60
+ */
61
+ onCacheError(cache: ResourceResolverCacheType, index: number): void;
62
+ /**
63
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
64
+ */
65
+ onContextError(qualifier: string, error: string): void;
66
+ /**
67
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
68
+ */
69
+ onCacheClear(cache: ResourceResolverCacheType): void;
70
+ }
71
+ //# sourceMappingURL=cacheListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheListener.d.ts","sourceRoot":"","sources":["../../../src/packlets/runtime/cacheListener.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,CAAC;AAElF;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAElE;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnE;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpE;;;OAGG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACtD;AAED;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,8BAA8B;IACtF;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxE;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzE;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1E;;OAEG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7D;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI;CAG5D"}
@@ -0,0 +1,62 @@
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.NoOpResourceResolverCacheListener = void 0;
25
+ /**
26
+ * A no-op implementation of {@link Runtime.IResourceResolverCacheListener}.
27
+ * @public
28
+ */
29
+ class NoOpResourceResolverCacheListener {
30
+ /**
31
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}
32
+ */
33
+ onCacheHit(cache, index) {
34
+ // no-op
35
+ }
36
+ /**
37
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}
38
+ */
39
+ onCacheMiss(cache, index) {
40
+ // no-op
41
+ }
42
+ /**
43
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
44
+ */
45
+ onCacheError(cache, index) {
46
+ // no-op
47
+ }
48
+ /**
49
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
50
+ */
51
+ onContextError(qualifier, error) {
52
+ // no-op
53
+ }
54
+ /**
55
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
56
+ */
57
+ onCacheClear(cache) {
58
+ // no-op
59
+ }
60
+ }
61
+ exports.NoOpResourceResolverCacheListener = NoOpResourceResolverCacheListener;
62
+ //# sourceMappingURL=cacheListener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheListener.js","sourceRoot":"","sources":["../../../src/packlets/runtime/cacheListener.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAqDH;;;GAGG;AACH,MAAa,iCAAiC;IAC5C;;OAEG;IACI,UAAU,CAAC,KAAgC,EAAE,KAAa;QAC/D,QAAQ;IACV,CAAC;IAED;;OAEG;IACI,WAAW,CAAC,KAAgC,EAAE,KAAa;QAChE,QAAQ;IACV,CAAC;IAED;;OAEG;IACI,YAAY,CAAC,KAAgC,EAAE,KAAa;QACjE,QAAQ;IACV,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QACpD,QAAQ;IACV,CAAC;IAED;;OAEG;IACI,YAAY,CAAC,KAAgC;QAClD,QAAQ;IACV,CAAC;CACF;AAnCD,8EAmCC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Type indicating which {@link Runtime.ResourceResolver | ResourceResolver} cache is affected.\n * @public\n */\nexport type ResourceResolverCacheType = 'condition' | 'conditionSet' | 'decision';\n\n/**\n * Type indicating the action performed on a {@link Runtime.ResourceResolver | ResourceResolver} cache.\n * @public\n */\nexport type ResourceResolverCacheActivity = 'hit' | 'miss' | 'error' | 'clear';\n\n/**\n * A listener for {@link Runtime.ResourceResolver | ResourceResolver} cache activity.\n * @public\n */\nexport interface IResourceResolverCacheListener {\n /**\n * Called when a cache hit occurs.\n * @param cache - The type of cache that was hit.\n * @param index - The index of the cache that was hit.\n */\n onCacheHit(cache: ResourceResolverCacheType, index: number): void;\n\n /**\n * Called when a cache miss occurs.\n * @param cache - The type of cache that was missed.\n * @param index - The index of the cache that was missed.\n */\n onCacheMiss(cache: ResourceResolverCacheType, index: number): void;\n\n /**\n * Called when a cache error occurs.\n * @param cache - The type of cache that had an error.\n * @param index - The index of the cache that had an error.\n */\n onCacheError(cache: ResourceResolverCacheType, index: number): void;\n\n /**\n * Called when a context error occurs.\n * @param error - The error that occurred.\n */\n onContextError(qualifier: string, error: string): void;\n\n /**\n * Called when a cache is cleared.\n * @param cache - The type of cache that was cleared.\n */\n onCacheClear(cache: ResourceResolverCacheType): void;\n}\n\n/**\n * A no-op implementation of {@link Runtime.IResourceResolverCacheListener}.\n * @public\n */\nexport class NoOpResourceResolverCacheListener implements IResourceResolverCacheListener {\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}\n */\n public onCacheHit(cache: ResourceResolverCacheType, index: number): void {\n // no-op\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}\n */\n public onCacheMiss(cache: ResourceResolverCacheType, index: number): void {\n // no-op\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}\n */\n public onCacheError(cache: ResourceResolverCacheType, index: number): void {\n // no-op\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}\n */\n public onContextError(qualifier: string, error: string): void {\n // no-op\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}\n */\n public onCacheClear(cache: ResourceResolverCacheType): void {\n // no-op\n }\n}\n"]}
@@ -0,0 +1,88 @@
1
+ import { IResourceResolverCacheListener, ResourceResolverCacheType } from './cacheListener';
2
+ /**
3
+ * Cache metrics interface for tracking cache performance.
4
+ * @public
5
+ */
6
+ export interface ICacheMetrics {
7
+ hits: number;
8
+ misses: number;
9
+ errors: number;
10
+ clears: number;
11
+ totalAccesses: number;
12
+ hitRate: number;
13
+ onHit(index: number): void;
14
+ onMiss(index: number): void;
15
+ onError(index: number): void;
16
+ onClear(): void;
17
+ reset(): void;
18
+ }
19
+ /**
20
+ * Aggregate cache metrics for a specific cache type.
21
+ * @public
22
+ */
23
+ export declare class AggregateCacheMetrics implements ICacheMetrics {
24
+ private _hits;
25
+ private _misses;
26
+ private _errors;
27
+ private _clears;
28
+ constructor();
29
+ onHit(__index: number): void;
30
+ onMiss(__index: number): void;
31
+ onError(__index: number): void;
32
+ onClear(): void;
33
+ get hits(): number;
34
+ get misses(): number;
35
+ get errors(): number;
36
+ get clears(): number;
37
+ get totalAccesses(): number;
38
+ get hitRate(): number;
39
+ get errorRate(): number;
40
+ reset(): void;
41
+ }
42
+ /**
43
+ * Overall cache metrics across all cache types.
44
+ * @public
45
+ */
46
+ export type OverallCacheMetrics<TM extends ICacheMetrics = ICacheMetrics> = Record<ResourceResolverCacheType, TM>;
47
+ /**
48
+ * A metrics implementation of {@link Runtime.IResourceResolverCacheListener} that tracks
49
+ * hit counts and rates across all cache types.
50
+ * @public
51
+ */
52
+ export declare class ResourceResolverCacheMetricsListener<TM extends ICacheMetrics> implements IResourceResolverCacheListener {
53
+ private readonly _metrics;
54
+ private _contextErrors;
55
+ get numContextErrors(): number;
56
+ constructor(factory: () => TM);
57
+ constructor(metrics: OverallCacheMetrics<TM>);
58
+ /**
59
+ * Get the metrics for all cache types.
60
+ * @returns The metrics for all cache types.
61
+ */
62
+ get metrics(): Readonly<OverallCacheMetrics>;
63
+ /**
64
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}
65
+ */
66
+ onCacheHit(cache: ResourceResolverCacheType, index: number): void;
67
+ /**
68
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}
69
+ */
70
+ onCacheMiss(cache: ResourceResolverCacheType, index: number): void;
71
+ /**
72
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
73
+ */
74
+ onCacheError(cache: ResourceResolverCacheType, index: number): void;
75
+ /**
76
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
77
+ */
78
+ onContextError(qualifier: string, error: string): void;
79
+ /**
80
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
81
+ */
82
+ onCacheClear(cache: ResourceResolverCacheType): void;
83
+ /**
84
+ * Reset all metrics to zero.
85
+ */
86
+ reset(): void;
87
+ }
88
+ //# sourceMappingURL=cacheMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheMetrics.d.ts","sourceRoot":"","sources":["../../../src/packlets/runtime/cacheMetrics.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,KAAK,CAAa;IAC1B,OA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yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1E;;OAEG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7D;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI;IAI3D;;OAEG;IACI,KAAK,IAAI,IAAI;CAMrB"}
@@ -0,0 +1,154 @@
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.ResourceResolverCacheMetricsListener = exports.AggregateCacheMetrics = void 0;
25
+ /**
26
+ * Aggregate cache metrics for a specific cache type.
27
+ * @public
28
+ */
29
+ class AggregateCacheMetrics {
30
+ constructor() {
31
+ this._hits = 0;
32
+ this._misses = 0;
33
+ this._errors = 0;
34
+ this._clears = 0;
35
+ this._hits = 0;
36
+ this._misses = 0;
37
+ this._errors = 0;
38
+ this._clears = 0;
39
+ }
40
+ onHit(__index) {
41
+ this._hits++;
42
+ }
43
+ onMiss(__index) {
44
+ this._misses++;
45
+ }
46
+ onError(__index) {
47
+ this._errors++;
48
+ }
49
+ onClear() {
50
+ this._hits = 0;
51
+ this._misses = 0;
52
+ this._errors = 0;
53
+ this._clears++;
54
+ }
55
+ get hits() {
56
+ return this._hits;
57
+ }
58
+ get misses() {
59
+ return this._misses;
60
+ }
61
+ get errors() {
62
+ return this._errors;
63
+ }
64
+ get clears() {
65
+ return this._clears;
66
+ }
67
+ get totalAccesses() {
68
+ return this._hits + this._misses + this._errors;
69
+ }
70
+ get hitRate() {
71
+ return this.totalAccesses > 0 ? (this._hits / this.totalAccesses) * 100 : 0;
72
+ }
73
+ get errorRate() {
74
+ return this.totalAccesses > 0 ? (this._errors / this.totalAccesses) * 100 : 0;
75
+ }
76
+ reset() {
77
+ this._hits = 0;
78
+ this._misses = 0;
79
+ this._errors = 0;
80
+ this._clears = 0;
81
+ }
82
+ }
83
+ exports.AggregateCacheMetrics = AggregateCacheMetrics;
84
+ /**
85
+ * A metrics implementation of {@link Runtime.IResourceResolverCacheListener} that tracks
86
+ * hit counts and rates across all cache types.
87
+ * @public
88
+ */
89
+ class ResourceResolverCacheMetricsListener {
90
+ get numContextErrors() {
91
+ return this._contextErrors;
92
+ }
93
+ constructor(factoryOrMetrics) {
94
+ if (typeof factoryOrMetrics === 'function') {
95
+ this._metrics = {
96
+ condition: factoryOrMetrics(),
97
+ conditionSet: factoryOrMetrics(),
98
+ decision: factoryOrMetrics()
99
+ };
100
+ }
101
+ else {
102
+ this._metrics = factoryOrMetrics;
103
+ }
104
+ this._contextErrors = 0;
105
+ }
106
+ /**
107
+ * Get the metrics for all cache types.
108
+ * @returns The metrics for all cache types.
109
+ */
110
+ get metrics() {
111
+ return this._metrics;
112
+ }
113
+ /**
114
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}
115
+ */
116
+ onCacheHit(cache, index) {
117
+ this._metrics[cache].onHit(index);
118
+ }
119
+ /**
120
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}
121
+ */
122
+ onCacheMiss(cache, index) {
123
+ this._metrics[cache].onMiss(index);
124
+ }
125
+ /**
126
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
127
+ */
128
+ onCacheError(cache, index) {
129
+ this._metrics[cache].onError(index);
130
+ }
131
+ /**
132
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
133
+ */
134
+ onContextError(qualifier, error) {
135
+ this._contextErrors++;
136
+ }
137
+ /**
138
+ * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
139
+ */
140
+ onCacheClear(cache) {
141
+ this._metrics[cache].onClear();
142
+ }
143
+ /**
144
+ * Reset all metrics to zero.
145
+ */
146
+ reset() {
147
+ this._metrics.condition.reset();
148
+ this._metrics.conditionSet.reset();
149
+ this._metrics.decision.reset();
150
+ this._contextErrors = 0;
151
+ }
152
+ }
153
+ exports.ResourceResolverCacheMetricsListener = ResourceResolverCacheMetricsListener;
154
+ //# sourceMappingURL=cacheMetrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheMetrics.js","sourceRoot":"","sources":["../../../src/packlets/runtime/cacheMetrics.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAsBH;;;GAGG;AACH,MAAa,qBAAqB;IAMhC;QALQ,UAAK,GAAW,CAAC,CAAC;QAClB,YAAO,GAAW,CAAC,CAAC;QACpB,YAAO,GAAW,CAAC,CAAC;QACpB,YAAO,GAAW,CAAC,CAAC;QAG1B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC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QAClD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF;AA7ED,oFA6EC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { IResourceResolverCacheListener, ResourceResolverCacheType } from './cacheListener';\n\n/**\n * Cache metrics interface for tracking cache performance.\n * @public\n */\nexport interface ICacheMetrics {\n hits: number;\n misses: number;\n errors: number;\n clears: number;\n totalAccesses: number;\n hitRate: number;\n onHit(index: number): void;\n onMiss(index: number): void;\n onError(index: number): void;\n onClear(): void;\n reset(): void;\n}\n\n/**\n * Aggregate cache metrics for a specific cache type.\n * @public\n */\nexport class AggregateCacheMetrics implements ICacheMetrics {\n private _hits: number = 0;\n private _misses: number = 0;\n private _errors: number = 0;\n private _clears: number = 0;\n\n public constructor() {\n this._hits = 0;\n this._misses = 0;\n this._errors = 0;\n this._clears = 0;\n }\n\n public onHit(__index: number): void {\n this._hits++;\n }\n\n public onMiss(__index: number): void {\n this._misses++;\n }\n\n public onError(__index: number): void {\n this._errors++;\n }\n\n public onClear(): void {\n this._hits = 0;\n this._misses = 0;\n this._errors = 0;\n this._clears++;\n }\n\n public get hits(): number {\n return this._hits;\n }\n\n public get misses(): number {\n return this._misses;\n }\n\n public get errors(): number {\n return this._errors;\n }\n\n public get clears(): number {\n return this._clears;\n }\n\n public get totalAccesses(): number {\n return this._hits + this._misses + this._errors;\n }\n\n public get hitRate(): number {\n return this.totalAccesses > 0 ? (this._hits / this.totalAccesses) * 100 : 0;\n }\n\n public get errorRate(): number {\n return this.totalAccesses > 0 ? (this._errors / this.totalAccesses) * 100 : 0;\n }\n\n public reset(): void {\n this._hits = 0;\n this._misses = 0;\n this._errors = 0;\n this._clears = 0;\n }\n}\n\n/**\n * Overall cache metrics across all cache types.\n * @public\n */\nexport type OverallCacheMetrics<TM extends ICacheMetrics = ICacheMetrics> = Record<\n ResourceResolverCacheType,\n TM\n>;\n\n/**\n * A metrics implementation of {@link Runtime.IResourceResolverCacheListener} that tracks\n * hit counts and rates across all cache types.\n * @public\n */\nexport class ResourceResolverCacheMetricsListener<TM extends ICacheMetrics>\n implements IResourceResolverCacheListener\n{\n private readonly _metrics: OverallCacheMetrics<TM>;\n private _contextErrors: number;\n\n public get numContextErrors(): number {\n return this._contextErrors;\n }\n\n public constructor(factory: () => TM);\n public constructor(metrics: OverallCacheMetrics<TM>);\n public constructor(factoryOrMetrics: OverallCacheMetrics<TM> | (() => TM)) {\n if (typeof factoryOrMetrics === 'function') {\n this._metrics = {\n condition: factoryOrMetrics(),\n conditionSet: factoryOrMetrics(),\n decision: factoryOrMetrics()\n };\n } else {\n this._metrics = factoryOrMetrics;\n }\n this._contextErrors = 0;\n }\n\n /**\n * Get the metrics for all cache types.\n * @returns The metrics for all cache types.\n */\n public get metrics(): Readonly<OverallCacheMetrics> {\n return this._metrics;\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheHit}\n */\n public onCacheHit(cache: ResourceResolverCacheType, index: number): void {\n this._metrics[cache].onHit(index);\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheMiss}\n */\n public onCacheMiss(cache: ResourceResolverCacheType, index: number): void {\n this._metrics[cache].onMiss(index);\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}\n */\n public onCacheError(cache: ResourceResolverCacheType, index: number): void {\n this._metrics[cache].onError(index);\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}\n */\n public onContextError(qualifier: string, error: string): void {\n this._contextErrors++;\n }\n\n /**\n * {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}\n */\n public onCacheClear(cache: ResourceResolverCacheType): void {\n this._metrics[cache].onClear();\n }\n\n /**\n * Reset all metrics to zero.\n */\n public reset(): void {\n this._metrics.condition.reset();\n this._metrics.conditionSet.reset();\n this._metrics.decision.reset();\n this._contextErrors = 0;\n }\n}\n"]}