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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) 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 +4223 -322
  8. package/dist/tsdoc-metadata.json +1 -1
  9. package/lib/index.d.ts +4 -1
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +7 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/packlets/common/conditions.d.ts +30 -0
  14. package/lib/packlets/common/conditions.d.ts.map +1 -1
  15. package/lib/packlets/common/conditions.js.map +1 -1
  16. package/lib/packlets/common/convert.d.ts +22 -2
  17. package/lib/packlets/common/convert.d.ts.map +1 -1
  18. package/lib/packlets/common/convert.js +21 -1
  19. package/lib/packlets/common/convert.js.map +1 -1
  20. package/lib/packlets/common/helpers/context.d.ts +39 -0
  21. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  22. package/lib/packlets/common/helpers/context.js +108 -0
  23. package/lib/packlets/common/helpers/context.js.map +1 -0
  24. package/lib/packlets/common/helpers/index.d.ts +2 -0
  25. package/lib/packlets/common/helpers/index.d.ts.map +1 -1
  26. package/lib/packlets/common/helpers/index.js +2 -0
  27. package/lib/packlets/common/helpers/index.js.map +1 -1
  28. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts +39 -0
  29. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  30. package/lib/packlets/common/helpers/qualifierDefaultValues.js +105 -0
  31. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  32. package/lib/packlets/common/helpers/resources.d.ts.map +1 -1
  33. package/lib/packlets/common/helpers/resources.js +6 -2
  34. package/lib/packlets/common/helpers/resources.js.map +1 -1
  35. package/lib/packlets/common/validate/conditions.d.ts +69 -1
  36. package/lib/packlets/common/validate/conditions.d.ts.map +1 -1
  37. package/lib/packlets/common/validate/conditions.js +126 -0
  38. package/lib/packlets/common/validate/conditions.js.map +1 -1
  39. package/lib/packlets/common/validate/regularExpressions.d.ts +20 -0
  40. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -1
  41. package/lib/packlets/common/validate/regularExpressions.js +21 -1
  42. package/lib/packlets/common/validate/regularExpressions.js.map +1 -1
  43. package/lib/packlets/conditions/condition.d.ts +37 -0
  44. package/lib/packlets/conditions/condition.d.ts.map +1 -1
  45. package/lib/packlets/conditions/condition.js +67 -1
  46. package/lib/packlets/conditions/condition.js.map +1 -1
  47. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -1
  48. package/lib/packlets/conditions/conditionCollector.js +1 -0
  49. package/lib/packlets/conditions/conditionCollector.js.map +1 -1
  50. package/lib/packlets/conditions/conditionSet.d.ts +34 -3
  51. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
  52. package/lib/packlets/conditions/conditionSet.js +31 -3
  53. package/lib/packlets/conditions/conditionSet.js.map +1 -1
  54. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -1
  55. package/lib/packlets/conditions/conditionSetCollector.js +3 -0
  56. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -1
  57. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -1
  58. package/lib/packlets/conditions/conditionToken.js +2 -1
  59. package/lib/packlets/conditions/conditionToken.js.map +1 -1
  60. package/lib/packlets/conditions/convert/decls.js +1 -1
  61. package/lib/packlets/conditions/convert/decls.js.map +1 -1
  62. package/lib/packlets/config/common.d.ts +35 -0
  63. package/lib/packlets/config/common.d.ts.map +1 -0
  64. package/lib/packlets/config/common.js +96 -0
  65. package/lib/packlets/config/common.js.map +1 -0
  66. package/lib/packlets/config/convert.d.ts +14 -0
  67. package/lib/packlets/config/convert.d.ts.map +1 -0
  68. package/lib/packlets/config/convert.js +82 -0
  69. package/lib/packlets/config/convert.js.map +1 -0
  70. package/lib/packlets/config/index.d.ts +6 -0
  71. package/lib/packlets/config/index.d.ts.map +1 -0
  72. package/lib/packlets/config/index.js +67 -0
  73. package/lib/packlets/config/index.js.map +1 -0
  74. package/lib/packlets/config/json.d.ts +20 -0
  75. package/lib/packlets/config/json.d.ts.map +1 -0
  76. package/lib/packlets/config/json.js +24 -0
  77. package/lib/packlets/config/json.js.map +1 -0
  78. package/lib/packlets/config/predefined/default.d.ts +57 -0
  79. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  80. package/lib/packlets/config/predefined/default.js +141 -0
  81. package/lib/packlets/config/predefined/default.js.map +1 -0
  82. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  83. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  84. package/lib/packlets/config/predefined/extended.js +193 -0
  85. package/lib/packlets/config/predefined/extended.js.map +1 -0
  86. package/lib/packlets/config/predefined/index.d.ts +4 -0
  87. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  88. package/lib/packlets/config/predefined/index.js +62 -0
  89. package/lib/packlets/config/predefined/index.js.map +1 -0
  90. package/lib/packlets/config/systemConfiguration.d.ts +81 -0
  91. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  92. package/lib/packlets/config/systemConfiguration.js +172 -0
  93. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  94. package/lib/packlets/context/contextDecls.d.ts +49 -0
  95. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  96. package/lib/packlets/context/contextDecls.js +24 -0
  97. package/lib/packlets/context/contextDecls.js.map +1 -0
  98. package/lib/packlets/context/contextToken.d.ts +111 -0
  99. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  100. package/lib/packlets/context/contextToken.js +206 -0
  101. package/lib/packlets/context/contextToken.js.map +1 -0
  102. package/lib/packlets/context/convert/decls.d.ts +37 -0
  103. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  104. package/lib/packlets/context/convert/decls.js +94 -0
  105. package/lib/packlets/context/convert/decls.js.map +1 -0
  106. package/lib/packlets/context/convert/index.d.ts +2 -0
  107. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  108. package/lib/packlets/context/convert/index.js +39 -0
  109. package/lib/packlets/context/convert/index.js.map +1 -0
  110. package/lib/packlets/context/index.d.ts +5 -0
  111. package/lib/packlets/context/index.d.ts.map +1 -0
  112. package/lib/packlets/context/index.js +65 -0
  113. package/lib/packlets/context/index.js.map +1 -0
  114. package/lib/packlets/decisions/abstractDecision.d.ts +8 -0
  115. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -1
  116. package/lib/packlets/decisions/abstractDecision.js +9 -0
  117. package/lib/packlets/decisions/abstractDecision.js.map +1 -1
  118. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -1
  119. package/lib/packlets/decisions/abstractDecisionCollector.js +2 -0
  120. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -1
  121. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -1
  122. package/lib/packlets/decisions/concreteDecision.js +1 -0
  123. package/lib/packlets/decisions/concreteDecision.js.map +1 -1
  124. package/lib/packlets/decisions/decision.d.ts.map +1 -1
  125. package/lib/packlets/decisions/decision.js +4 -0
  126. package/lib/packlets/decisions/decision.js.map +1 -1
  127. package/lib/packlets/import/fsItem.d.ts.map +1 -1
  128. package/lib/packlets/import/fsItem.js +1 -0
  129. package/lib/packlets/import/fsItem.js.map +1 -1
  130. package/lib/packlets/import/importContext.d.ts +19 -0
  131. package/lib/packlets/import/importContext.d.ts.map +1 -1
  132. package/lib/packlets/import/importContext.js +39 -0
  133. package/lib/packlets/import/importContext.js.map +1 -1
  134. package/lib/packlets/import/importManager.d.ts +5 -5
  135. package/lib/packlets/import/importManager.d.ts.map +1 -1
  136. package/lib/packlets/import/importManager.js.map +1 -1
  137. package/lib/packlets/import/importers/collectionImporter.d.ts +11 -13
  138. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -1
  139. package/lib/packlets/import/importers/collectionImporter.js +29 -20
  140. package/lib/packlets/import/importers/collectionImporter.js.map +1 -1
  141. package/lib/packlets/import/importers/fsItemImporter.d.ts +2 -2
  142. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -1
  143. package/lib/packlets/import/importers/fsItemImporter.js +2 -2
  144. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -1
  145. package/lib/packlets/import/importers/importer.d.ts +3 -3
  146. package/lib/packlets/import/importers/importer.d.ts.map +1 -1
  147. package/lib/packlets/import/importers/importer.js.map +1 -1
  148. package/lib/packlets/import/importers/jsonImporter.d.ts +2 -3
  149. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -1
  150. package/lib/packlets/import/importers/jsonImporter.js +10 -20
  151. package/lib/packlets/import/importers/jsonImporter.js.map +1 -1
  152. package/lib/packlets/import/importers/pathImporter.d.ts +2 -2
  153. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -1
  154. package/lib/packlets/import/importers/pathImporter.js.map +1 -1
  155. package/lib/packlets/qualifier-types/config/convert.d.ts +44 -0
  156. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  157. package/lib/packlets/qualifier-types/config/convert.js +96 -0
  158. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  159. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  160. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  161. package/lib/packlets/qualifier-types/config/index.js +64 -0
  162. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  163. package/lib/packlets/qualifier-types/config/json.d.ts +69 -0
  164. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  165. package/lib/packlets/qualifier-types/config/json.js +24 -0
  166. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  167. package/lib/packlets/qualifier-types/convert.d.ts +10 -2
  168. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -1
  169. package/lib/packlets/qualifier-types/convert.js +15 -0
  170. package/lib/packlets/qualifier-types/convert.js.map +1 -1
  171. package/lib/packlets/qualifier-types/helpers.d.ts +27 -0
  172. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  173. package/lib/packlets/qualifier-types/helpers.js +118 -0
  174. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  175. package/lib/packlets/qualifier-types/index.d.ts +4 -1
  176. package/lib/packlets/qualifier-types/index.d.ts.map +1 -1
  177. package/lib/packlets/qualifier-types/index.js +5 -1
  178. package/lib/packlets/qualifier-types/index.js.map +1 -1
  179. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +19 -8
  180. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -1
  181. package/lib/packlets/qualifier-types/languageQualifierType.js +28 -9
  182. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -1
  183. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +38 -13
  184. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -1
  185. package/lib/packlets/qualifier-types/literalQualifierType.js +44 -10
  186. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -1
  187. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +107 -0
  188. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  189. package/lib/packlets/qualifier-types/literalValueHierarchy.js +215 -0
  190. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  191. package/lib/packlets/qualifier-types/qualifierType.d.ts +22 -18
  192. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -1
  193. package/lib/packlets/qualifier-types/qualifierType.js +9 -4
  194. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -1
  195. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +4 -2
  196. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -1
  197. package/lib/packlets/qualifier-types/qualifierTypeCollector.js +2 -1
  198. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -1
  199. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +47 -11
  200. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -1
  201. package/lib/packlets/qualifier-types/territoryQualifierType.js +61 -17
  202. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -1
  203. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -1
  204. package/lib/packlets/qualifiers/convert/decls.js +17 -15
  205. package/lib/packlets/qualifiers/convert/decls.js.map +1 -1
  206. package/lib/packlets/qualifiers/index.d.ts +2 -0
  207. package/lib/packlets/qualifiers/index.d.ts.map +1 -1
  208. package/lib/packlets/qualifiers/index.js +2 -0
  209. package/lib/packlets/qualifiers/index.js.map +1 -1
  210. package/lib/packlets/qualifiers/qualifier.d.ts +22 -2
  211. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -1
  212. package/lib/packlets/qualifiers/qualifier.js +26 -1
  213. package/lib/packlets/qualifiers/qualifier.js.map +1 -1
  214. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
  215. package/lib/packlets/qualifiers/qualifierCollector.js +4 -0
  216. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
  217. package/lib/packlets/qualifiers/qualifierDecl.d.ts +6 -1
  218. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -1
  219. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -1
  220. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts +32 -0
  221. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  222. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js +24 -0
  223. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  224. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts +96 -0
  225. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  226. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js +179 -0
  227. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  228. package/lib/packlets/resource-json/compiled/common.d.ts +14 -0
  229. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  230. package/lib/packlets/resource-json/compiled/common.js +24 -0
  231. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  232. package/lib/packlets/resource-json/compiled/convert.d.ts +63 -0
  233. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  234. package/lib/packlets/resource-json/compiled/convert.js +167 -0
  235. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  236. package/lib/packlets/resource-json/compiled/index.d.ts +5 -0
  237. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  238. package/lib/packlets/resource-json/compiled/index.js +65 -0
  239. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  240. package/lib/packlets/resource-json/compiled/json.d.ts +204 -0
  241. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  242. package/lib/packlets/resource-json/compiled/json.js +3 -0
  243. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  244. package/lib/packlets/resource-json/convert.d.ts +16 -0
  245. package/lib/packlets/resource-json/convert.d.ts.map +1 -1
  246. package/lib/packlets/resource-json/convert.js +41 -6
  247. package/lib/packlets/resource-json/convert.js.map +1 -1
  248. package/lib/packlets/resource-json/helpers.d.ts +82 -3
  249. package/lib/packlets/resource-json/helpers.d.ts.map +1 -1
  250. package/lib/packlets/resource-json/helpers.js +185 -2
  251. package/lib/packlets/resource-json/helpers.js.map +1 -1
  252. package/lib/packlets/resource-json/index.d.ts +2 -1
  253. package/lib/packlets/resource-json/index.d.ts.map +1 -1
  254. package/lib/packlets/resource-json/index.js +3 -1
  255. package/lib/packlets/resource-json/index.js.map +1 -1
  256. package/lib/packlets/resource-json/json.d.ts +55 -3
  257. package/lib/packlets/resource-json/json.d.ts.map +1 -1
  258. package/lib/packlets/resource-json/json.js +16 -0
  259. package/lib/packlets/resource-json/json.js.map +1 -1
  260. package/lib/packlets/resource-json/normalized.d.ts +46 -3
  261. package/lib/packlets/resource-json/normalized.d.ts.map +1 -1
  262. package/lib/packlets/resource-json/normalized.js.map +1 -1
  263. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +14 -10
  264. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -1
  265. package/lib/packlets/resource-json/resourceDeclCollection.js +18 -14
  266. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -1
  267. package/lib/packlets/resource-json/resourceDeclContainer.d.ts +15 -2
  268. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -1
  269. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -1
  270. package/lib/packlets/resource-json/resourceDeclTree.d.ts +6 -2
  271. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -1
  272. package/lib/packlets/resource-json/resourceDeclTree.js +12 -3
  273. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -1
  274. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  275. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  276. package/lib/packlets/resource-types/config/convert.js +36 -0
  277. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  278. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  279. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  280. package/lib/packlets/resource-types/config/index.js +64 -0
  281. package/lib/packlets/resource-types/config/index.js.map +1 -0
  282. package/lib/packlets/resource-types/config/json.d.ts +9 -0
  283. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  284. package/lib/packlets/resource-types/config/json.js +24 -0
  285. package/lib/packlets/resource-types/config/json.js.map +1 -0
  286. package/lib/packlets/resource-types/helpers.d.ts +13 -0
  287. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  288. package/lib/packlets/resource-types/helpers.js +44 -0
  289. package/lib/packlets/resource-types/helpers.js.map +1 -0
  290. package/lib/packlets/resource-types/index.d.ts +3 -0
  291. package/lib/packlets/resource-types/index.d.ts.map +1 -1
  292. package/lib/packlets/resource-types/index.js +26 -0
  293. package/lib/packlets/resource-types/index.js.map +1 -1
  294. package/lib/packlets/resource-types/jsonResourceType.d.ts +5 -13
  295. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
  296. package/lib/packlets/resource-types/jsonResourceType.js +5 -2
  297. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
  298. package/lib/packlets/resource-types/resourceType.d.ts +31 -30
  299. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
  300. package/lib/packlets/resource-types/resourceType.js.map +1 -1
  301. package/lib/packlets/resources/candidateReducer.d.ts +98 -0
  302. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  303. package/lib/packlets/resources/candidateReducer.js +247 -0
  304. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  305. package/lib/packlets/resources/common.d.ts +60 -0
  306. package/lib/packlets/resources/common.d.ts.map +1 -0
  307. package/lib/packlets/resources/common.js +24 -0
  308. package/lib/packlets/resources/common.js.map +1 -0
  309. package/lib/packlets/resources/index.d.ts +3 -1
  310. package/lib/packlets/resources/index.d.ts.map +1 -1
  311. package/lib/packlets/resources/index.js +3 -1
  312. package/lib/packlets/resources/index.js.map +1 -1
  313. package/lib/packlets/resources/resource.d.ts +57 -5
  314. package/lib/packlets/resources/resource.d.ts.map +1 -1
  315. package/lib/packlets/resources/resource.js +96 -6
  316. package/lib/packlets/resources/resource.js.map +1 -1
  317. package/lib/packlets/resources/resourceBuilder.d.ts +14 -0
  318. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -1
  319. package/lib/packlets/resources/resourceBuilder.js +19 -1
  320. package/lib/packlets/resources/resourceBuilder.js.map +1 -1
  321. package/lib/packlets/resources/resourceCandidate.d.ts +42 -6
  322. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -1
  323. package/lib/packlets/resources/resourceCandidate.js +40 -1
  324. package/lib/packlets/resources/resourceCandidate.js.map +1 -1
  325. package/lib/packlets/resources/resourceManagerBuilder.d.ts +220 -0
  326. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  327. package/lib/packlets/resources/resourceManagerBuilder.js +451 -0
  328. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  329. package/lib/packlets/runtime/cacheListener.d.ts +62 -0
  330. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  331. package/lib/packlets/runtime/cacheListener.js +56 -0
  332. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  333. package/lib/packlets/runtime/cacheMetrics.d.ts +82 -0
  334. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  335. package/lib/packlets/runtime/cacheMetrics.js +143 -0
  336. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  337. package/lib/packlets/runtime/compiledResourceCollection.d.ts +167 -0
  338. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  339. package/lib/packlets/runtime/compiledResourceCollection.js +466 -0
  340. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  341. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts +70 -0
  342. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  343. package/lib/packlets/runtime/conditionSetResolutionResult.js +135 -0
  344. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  345. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +80 -0
  346. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  347. package/lib/packlets/runtime/context/contextQualifierProvider.js +33 -0
  348. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  349. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +165 -0
  350. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  351. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +179 -0
  352. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  353. package/lib/packlets/runtime/context/index.d.ts +5 -0
  354. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  355. package/lib/packlets/runtime/context/index.js +42 -0
  356. package/lib/packlets/runtime/context/index.js.map +1 -0
  357. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +111 -0
  358. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  359. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +177 -0
  360. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  361. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +47 -0
  362. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  363. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +64 -0
  364. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  365. package/lib/packlets/runtime/iResourceManager.d.ts +88 -0
  366. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  367. package/lib/packlets/runtime/iResourceManager.js +24 -0
  368. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  369. package/lib/packlets/runtime/index.d.ts +12 -0
  370. package/lib/packlets/runtime/index.d.ts.map +1 -0
  371. package/lib/packlets/runtime/index.js +73 -0
  372. package/lib/packlets/runtime/index.js.map +1 -0
  373. package/lib/packlets/runtime/resource-tree/common.d.ts +91 -0
  374. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  375. package/lib/packlets/runtime/resource-tree/common.js +24 -0
  376. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  377. package/lib/packlets/runtime/resource-tree/index.d.ts +5 -0
  378. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  379. package/lib/packlets/runtime/resource-tree/index.js +42 -0
  380. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  381. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts +141 -0
  382. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  383. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js +224 -0
  384. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  385. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts +24 -0
  386. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  387. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +98 -0
  388. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  389. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +99 -0
  390. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  391. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +165 -0
  392. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  393. package/lib/packlets/runtime/resourceResolver.d.ts +196 -0
  394. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  395. package/lib/packlets/runtime/resourceResolver.js +437 -0
  396. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  397. package/lib/packlets/runtime/validate.d.ts +13 -0
  398. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  399. package/lib/packlets/runtime/validate.js +49 -0
  400. package/lib/packlets/runtime/validate.js.map +1 -0
  401. package/package.json +76 -75
  402. package/lib/packlets/resources/resourceManager.d.ts +0 -104
  403. package/lib/packlets/resources/resourceManager.d.ts.map +0 -1
  404. package/lib/packlets/resources/resourceManager.js +0 -201
  405. package/lib/packlets/resources/resourceManager.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextQualifierProviderValidator.js","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/contextQualifierProviderValidator.ts"],"names":[],"mappings":"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","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 { Result, fail, succeed } from '@fgv/ts-utils';\nimport { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\nimport { IContextQualifierProvider } from './contextQualifierProvider';\n\n/**\n * A read-only interface exposing non-mutating methods of a {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.\n * @public\n */\nexport interface IReadOnlyContextQualifierProviderValidator {\n /**\n * {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.provider}\n */\n readonly provider: IContextQualifierProvider;\n\n /**\n * {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.qualifiers}\n */\n readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Gets a qualifier value by its string name, converting to strongly-typed QualifierName.\n * @param name - The string name to convert and look up.\n * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found or an error occurs.\n */\n get(name: string): Result<QualifierContextValue>;\n\n /**\n * Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.\n * @param index - The number index to convert and look up.\n * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found or an error occurs.\n */\n getByIndex(index: number): Result<QualifierContextValue>;\n\n /**\n * Gets a validated qualifier context value by its string name.\n * @param name - The string name to convert and look up.\n * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found, invalid, or an error occurs.\n */\n getValidated(name: string): Result<QualifierContextValue>;\n\n /**\n * Gets a validated qualifier context value by its number index.\n * @param index - The number index to convert and look up.\n * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found, invalid, or an error occurs.\n */\n getValidatedByIndex(index: number): Result<QualifierContextValue>;\n\n /**\n * Checks if a qualifier value exists with the given string name.\n * @param name - The string name to convert and check.\n * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,\n * or `Failure` with an error message if an error occurs during the check.\n */\n has(name: string): Result<boolean>;\n\n /**\n * Sets a qualifier value using string inputs, converting to strongly-typed values.\n * @param name - The string name to convert.\n * @param value - The string value to convert.\n * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if an error occurs.\n */\n set(name: string, value: string): Result<QualifierContextValue>;\n\n /**\n * Removes a qualifier value using string input, converting to strongly-typed QualifierName.\n * @param name - The string name to convert.\n * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if an error occurs.\n */\n remove(name: string): Result<QualifierContextValue>;\n}\n\n/**\n * Parameters for constructing a {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.\n * @public\n */\nexport interface IContextQualifierProviderValidatorCreateParams {\n provider: IContextQualifierProvider;\n}\n\n/**\n * A wrapper for {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider} that accepts\n * string inputs and converts them to strongly-typed values before calling the wrapped provider.\n * This eliminates the need for type casting in consumer code while maintaining type safety.\n * @public\n */\nexport class ContextQualifierProviderValidator implements IReadOnlyContextQualifierProviderValidator {\n /**\n * The wrapped context qualifier provider.\n */\n public readonly provider: IContextQualifierProvider;\n\n /**\n * The readonly qualifier collector that defines and validates the qualifiers for this context.\n */\n public get qualifiers(): IReadOnlyQualifierCollector {\n return this.provider.qualifiers;\n }\n\n /**\n * Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.\n * @param params - Required parameters for constructing the validator.\n */\n public constructor(params: IContextQualifierProviderValidatorCreateParams) {\n this.provider = params.provider;\n }\n\n /**\n * Gets a qualifier value by its string name, converting to strongly-typed QualifierName.\n * @param name - The string name to convert and look up.\n * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found or an error occurs.\n */\n public get(name: string): Result<QualifierContextValue> {\n return this._validateQualifierName(name).onSuccess((qualifierName) => {\n return this.provider.get(qualifierName);\n });\n }\n\n /**\n * Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.\n * @param index - The number index to convert and look up.\n * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found or an error occurs.\n */\n public getByIndex(index: number): Result<QualifierContextValue> {\n return this._validateQualifierIndex(index).onSuccess((qualifierIndex) => {\n return this.provider.get(qualifierIndex);\n });\n }\n\n /**\n * Gets a validated qualifier context value by its string name.\n * @param name - The string name to convert and look up.\n * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found, invalid, or an error occurs.\n */\n public getValidated(name: string): Result<QualifierContextValue> {\n return this._validateQualifierName(name).onSuccess((qualifierName) => {\n return this.provider.getValidated(qualifierName);\n });\n }\n\n /**\n * Gets a validated qualifier context value by its number index.\n * @param index - The number index to convert and look up.\n * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found, invalid, or an error occurs.\n */\n public getValidatedByIndex(index: number): Result<QualifierContextValue> {\n return this._validateQualifierIndex(index).onSuccess((qualifierIndex) => {\n return this.provider.getValidated(qualifierIndex);\n });\n }\n\n /**\n * Checks if a qualifier value exists with the given string name.\n * @param name - The string name to convert and check.\n * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,\n * or `Failure` with an error message if an error occurs during the check.\n */\n public has(name: string): Result<boolean> {\n return this._validateQualifierName(name).onSuccess((qualifierName) => {\n return this.provider.has(qualifierName);\n });\n }\n\n /**\n * Sets a qualifier value using string inputs, converting to strongly-typed values.\n * @param name - The string name to convert.\n * @param value - The string value to convert.\n * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if an error occurs.\n */\n public set(name: string, value: string): Result<QualifierContextValue> {\n return this._validateQualifierName(name)\n .onSuccess((qualifierName) => this._validateQualifierContextValue(value))\n .onSuccess((qualifierValue) => {\n // Check if the provider has a set method (only available on mutable providers)\n if ('set' in this.provider && typeof this.provider.set === 'function') {\n try {\n return (\n this.provider.set as (\n name: QualifierName,\n value: QualifierContextValue\n ) => Result<QualifierContextValue>\n )(name as QualifierName, qualifierValue);\n } catch {\n return fail(`Provider does not support setting values`);\n }\n }\n return fail(`Provider does not support setting values`);\n });\n }\n\n /**\n * Removes a qualifier value using string input, converting to strongly-typed QualifierName.\n * @param name - The string name to convert.\n * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if an error occurs.\n */\n public remove(name: string): Result<QualifierContextValue> {\n return this._validateQualifierName(name).onSuccess((qualifierName) => {\n // Check if the provider has a remove method (only available on mutable providers)\n if ('remove' in this.provider && typeof this.provider.remove === 'function') {\n try {\n return (this.provider.remove as (name: QualifierName) => Result<QualifierContextValue>)(\n qualifierName\n );\n } catch {\n return fail(`Provider does not support removing values`);\n }\n }\n return fail(`Provider does not support removing values`);\n });\n }\n\n /**\n * Validates a string as a QualifierName.\n * @param name - The string to validate.\n * @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.\n */\n private _validateQualifierName(name: string): Result<QualifierName> {\n if (typeof name !== 'string' || name.length === 0) {\n return fail(`Invalid qualifier name: \"${name}\"`);\n }\n return succeed(name as QualifierName);\n }\n\n /**\n * Validates a number as a QualifierIndex.\n * @param index - The number to validate.\n * @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.\n */\n private _validateQualifierIndex(index: number): Result<QualifierIndex> {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {\n return fail(`Invalid qualifier index: ${index}`);\n }\n return succeed(index as QualifierIndex);\n }\n\n /**\n * Validates a string as a QualifierContextValue.\n * @param value - The string to validate.\n * @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.\n */\n private _validateQualifierContextValue(value: string): Result<QualifierContextValue> {\n if (typeof value !== 'string') {\n return fail(`Invalid qualifier context value: \"${value}\"`);\n }\n return succeed(value as QualifierContextValue);\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './contextQualifierProvider';
2
+ export * from './contextQualifierProviderValidator';
3
+ export * from './simpleContextQualifierProvider';
4
+ export * from './validatingSimpleContextQualifierProvider';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/index.ts"],"names":[],"mappings":"AAsBA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ __exportStar(require("./contextQualifierProvider"), exports);
39
+ __exportStar(require("./contextQualifierProviderValidator"), exports);
40
+ __exportStar(require("./simpleContextQualifierProvider"), exports);
41
+ __exportStar(require("./validatingSimpleContextQualifierProvider"), exports);
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,6DAA2C;AAC3C,sEAAoD;AACpD,mEAAiD;AACjD,6EAA2D","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\nexport * from './contextQualifierProvider';\nexport * from './contextQualifierProviderValidator';\nexport * from './simpleContextQualifierProvider';\nexport * from './validatingSimpleContextQualifierProvider';\n"]}
@@ -0,0 +1,111 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';
3
+ import { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';
4
+ import { ContextQualifierProvider } from './contextQualifierProvider';
5
+ /**
6
+ * Parameters for creating a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider}.
7
+ * @public
8
+ */
9
+ export interface ISimpleContextQualifierProviderCreateParams {
10
+ /**
11
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | readonly qualifier collector} that defines and validates qualifiers.
12
+ */
13
+ qualifiers: IReadOnlyQualifierCollector;
14
+ /**
15
+ * Optional record of initial qualifier name-value pairs to populate the provider.
16
+ */
17
+ qualifierValues?: Record<string, QualifierContextValue>;
18
+ }
19
+ /**
20
+ * Simple concrete implementation of {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider}
21
+ * using a `ResultMap` for qualifier value storage.
22
+ * @public
23
+ */
24
+ export declare class SimpleContextQualifierProvider extends ContextQualifierProvider {
25
+ /**
26
+ * The readonly qualifier collector that defines and validates the qualifiers for this context.
27
+ */
28
+ readonly qualifiers: IReadOnlyQualifierCollector;
29
+ /**
30
+ * Internal storage for qualifier values using a ResultMap.
31
+ */
32
+ private readonly _qualifierValues;
33
+ /**
34
+ * Constructor for a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.
35
+ * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
36
+ */
37
+ protected constructor(params: ISimpleContextQualifierProviderCreateParams);
38
+ /**
39
+ * Creates a new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.
40
+ * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
41
+ * @returns `Success` with the new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object if successful,
42
+ * or `Failure` with an error message if not.
43
+ * @public
44
+ */
45
+ static create(params: ISimpleContextQualifierProviderCreateParams): Result<SimpleContextQualifierProvider>;
46
+ /**
47
+ * Gets a qualifier value by its name, index, or qualifier object.
48
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
49
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
50
+ * or `Failure` with an error message if not found or an error occurs.
51
+ */
52
+ get(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
53
+ /**
54
+ * Gets a validated qualifier context value by its name, index, or qualifier object.
55
+ * TODO: Implement validation logic using qualifier collectors.
56
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
57
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
58
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
59
+ */
60
+ getValidated(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
61
+ /**
62
+ * Checks if a qualifier value exists with the given name.
63
+ * @param name - The {@link QualifierName | qualifier name} to check.
64
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
65
+ * or `Failure` with an error message if an error occurs during the check.
66
+ */
67
+ has(name: QualifierName): Result<boolean>;
68
+ /**
69
+ * Gets all available qualifier names in this context.
70
+ * @returns `Success` with an array of all {@link QualifierName | qualifier names},
71
+ * or `Failure` with an error message if an error occurs.
72
+ */
73
+ getNames(): Result<ReadonlyArray<QualifierName>>;
74
+ /**
75
+ * Sets a qualifier value in this provider.
76
+ * @param name - The {@link QualifierName | qualifier name} to set.
77
+ * @param value - The {@link QualifierContextValue | qualifier context value} to set.
78
+ * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
79
+ * or `Failure` with an error message if not.
80
+ * @public
81
+ */
82
+ set(name: QualifierName, value: QualifierContextValue): Result<QualifierContextValue>;
83
+ /**
84
+ * Removes a qualifier value from this provider.
85
+ * @param name - The {@link QualifierName | qualifier name} to remove.
86
+ * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
87
+ * or `Failure` with an error message if not found or an error occurs.
88
+ * @public
89
+ */
90
+ remove(name: QualifierName): Result<QualifierContextValue>;
91
+ /**
92
+ * Gets the number of qualifier values in this provider.
93
+ * @returns The count of qualifier values.
94
+ * @public
95
+ */
96
+ get size(): number;
97
+ /**
98
+ * Clears all qualifier values from this provider.
99
+ * @public
100
+ */
101
+ clear(): void;
102
+ /**
103
+ * Resolves a qualifier name from a name, index, or qualifier object.
104
+ * @param nameOrIndexOrQualifier - The input to resolve.
105
+ * @returns `Success` with the {@link QualifierName | qualifier name} if successful,
106
+ * or `Failure` with an error message if not found or invalid.
107
+ * @internal
108
+ */
109
+ private _resolveQualifierName;
110
+ }
111
+ //# sourceMappingURL=simpleContextQualifierProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleContextQualifierProvider.d.ts","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/simpleContextQualifierProvider.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAA8D,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,cAAc,EAAY,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,2CAA2C;IAC1D;;OAEG;IACH,UAAU,EAAE,2BAA2B,CAAC;IAExC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CACzD;AAED;;;;GAIG;AACH,qBAAa,8BAA+B,SAAQ,wBAAwB;IAC1E;;OAEG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkD;IAEnF;;;OAGG;IACH,SAAS,aAAa,MAAM,EAAE,2CAA2C;IAazE;;;;;;OAMG;WACW,MAAM,CAClB,MAAM,EAAE,2CAA2C,GAClD,MAAM,CAAC,8BAA8B,CAAC;IAIzC;;;;;OAKG;IACI,GAAG,CACR,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GACjE,MAAM,CAAC,qBAAqB,CAAC;IAShC;;;;;;OAMG;IACI,YAAY,CACjB,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GACjE,MAAM,CAAC,qBAAqB,CAAC;IAShC;;;;;OAKG;IACI,GAAG,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC;IAIhD;;;;OAIG;IACI,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAIvD;;;;;;;OAOG;IACI,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAK5F;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAOjE;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;OAGG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;CA8B9B"}
@@ -0,0 +1,177 @@
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.SimpleContextQualifierProvider = void 0;
25
+ const ts_utils_1 = require("@fgv/ts-utils");
26
+ const common_1 = require("../../common");
27
+ const contextQualifierProvider_1 = require("./contextQualifierProvider");
28
+ /**
29
+ * Simple concrete implementation of {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider}
30
+ * using a `ResultMap` for qualifier value storage.
31
+ * @public
32
+ */
33
+ class SimpleContextQualifierProvider extends contextQualifierProvider_1.ContextQualifierProvider {
34
+ /**
35
+ * Constructor for a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.
36
+ * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
37
+ */
38
+ constructor(params) {
39
+ super();
40
+ this.qualifiers = params.qualifiers;
41
+ this._qualifierValues = new ts_utils_1.ResultMap();
42
+ if (params.qualifierValues) {
43
+ for (const [name, value] of Object.entries(params.qualifierValues)) {
44
+ const qualifierName = common_1.Validate.toQualifierName(name).orThrow();
45
+ this._qualifierValues.set(qualifierName, value);
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Creates a new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.
51
+ * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
52
+ * @returns `Success` with the new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object if successful,
53
+ * or `Failure` with an error message if not.
54
+ * @public
55
+ */
56
+ static create(params) {
57
+ return (0, ts_utils_1.captureResult)(() => new SimpleContextQualifierProvider(params));
58
+ }
59
+ /**
60
+ * Gets a qualifier value by its name, index, or qualifier object.
61
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
62
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
63
+ * or `Failure` with an error message if not found or an error occurs.
64
+ */
65
+ get(nameOrIndexOrQualifier) {
66
+ const qualifierName = this._resolveQualifierName(nameOrIndexOrQualifier);
67
+ /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
68
+ if (qualifierName.isFailure()) {
69
+ return (0, ts_utils_1.fail)(qualifierName.message);
70
+ }
71
+ return this._qualifierValues.get(qualifierName.value);
72
+ }
73
+ /**
74
+ * Gets a validated qualifier context value by its name, index, or qualifier object.
75
+ * TODO: Implement validation logic using qualifier collectors.
76
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
77
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
78
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
79
+ */
80
+ getValidated(nameOrIndexOrQualifier) {
81
+ const qualifierName = this._resolveQualifierName(nameOrIndexOrQualifier);
82
+ if (qualifierName.isFailure()) {
83
+ return (0, ts_utils_1.fail)(qualifierName.message);
84
+ }
85
+ // TODO: Implement validation logic
86
+ return (0, ts_utils_1.fail)(`getValidated not yet implemented for qualifier "${qualifierName.value}"`);
87
+ }
88
+ /**
89
+ * Checks if a qualifier value exists with the given name.
90
+ * @param name - The {@link QualifierName | qualifier name} to check.
91
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
92
+ * or `Failure` with an error message if an error occurs during the check.
93
+ */
94
+ has(name) {
95
+ return (0, ts_utils_1.succeed)(this._qualifierValues.has(name));
96
+ }
97
+ /**
98
+ * Gets all available qualifier names in this context.
99
+ * @returns `Success` with an array of all {@link QualifierName | qualifier names},
100
+ * or `Failure` with an error message if an error occurs.
101
+ */
102
+ getNames() {
103
+ return (0, ts_utils_1.succeed)(Array.from(this._qualifierValues.keys()));
104
+ }
105
+ /**
106
+ * Sets a qualifier value in this provider.
107
+ * @param name - The {@link QualifierName | qualifier name} to set.
108
+ * @param value - The {@link QualifierContextValue | qualifier context value} to set.
109
+ * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
110
+ * or `Failure` with an error message if not.
111
+ * @public
112
+ */
113
+ set(name, value) {
114
+ this._qualifierValues.set(name, value);
115
+ return (0, ts_utils_1.succeed)(value);
116
+ }
117
+ /**
118
+ * Removes a qualifier value from this provider.
119
+ * @param name - The {@link QualifierName | qualifier name} to remove.
120
+ * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
121
+ * or `Failure` with an error message if not found or an error occurs.
122
+ * @public
123
+ */
124
+ remove(name) {
125
+ return this._qualifierValues.get(name).onSuccess((value) => {
126
+ this._qualifierValues.delete(name);
127
+ return (0, ts_utils_1.succeedWithDetail)(value, 'success');
128
+ });
129
+ }
130
+ /**
131
+ * Gets the number of qualifier values in this provider.
132
+ * @returns The count of qualifier values.
133
+ * @public
134
+ */
135
+ get size() {
136
+ return this._qualifierValues.size;
137
+ }
138
+ /**
139
+ * Clears all qualifier values from this provider.
140
+ * @public
141
+ */
142
+ clear() {
143
+ this._qualifierValues.clear();
144
+ }
145
+ /**
146
+ * Resolves a qualifier name from a name, index, or qualifier object.
147
+ * @param nameOrIndexOrQualifier - The input to resolve.
148
+ * @returns `Success` with the {@link QualifierName | qualifier name} if successful,
149
+ * or `Failure` with an error message if not found or invalid.
150
+ * @internal
151
+ */
152
+ _resolveQualifierName(nameOrIndexOrQualifier) {
153
+ // If it's already a QualifierName (string type with brand)
154
+ if (typeof nameOrIndexOrQualifier === 'string') {
155
+ /* c8 ignore next 1 - functional code path tested but coverage intermittently missed */
156
+ return (0, ts_utils_1.succeed)(nameOrIndexOrQualifier);
157
+ }
158
+ // If it's a Qualifier object
159
+ if (typeof nameOrIndexOrQualifier === 'object' &&
160
+ nameOrIndexOrQualifier !== null &&
161
+ 'name' in nameOrIndexOrQualifier) {
162
+ return (0, ts_utils_1.succeed)(nameOrIndexOrQualifier.name);
163
+ }
164
+ // If it's a QualifierIndex (number type with brand)
165
+ /* c8 ignore next 8 - functional code path tested but coverage intermittently missed */
166
+ if (typeof nameOrIndexOrQualifier === 'number') {
167
+ const qualifier = this.qualifiers.getAt(nameOrIndexOrQualifier);
168
+ if (qualifier.isSuccess()) {
169
+ return (0, ts_utils_1.succeed)(qualifier.value.name);
170
+ }
171
+ return (0, ts_utils_1.fail)(`Qualifier not found at index ${nameOrIndexOrQualifier}`);
172
+ }
173
+ return (0, ts_utils_1.fail)(`Invalid qualifier parameter: ${nameOrIndexOrQualifier}`);
174
+ }
175
+ }
176
+ exports.SimpleContextQualifierProvider = SimpleContextQualifierProvider;
177
+ //# sourceMappingURL=simpleContextQualifierProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleContextQualifierProvider.js","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/simpleContextQualifierProvider.ts"],"names":[],"mappings":"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","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 { Result, ResultMap, captureResult, succeed, fail, succeedWithDetail } from '@fgv/ts-utils';\nimport { QualifierName, QualifierContextValue, QualifierIndex, Validate } from '../../common';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';\nimport { ContextQualifierProvider } from './contextQualifierProvider';\n\n/**\n * Parameters for creating a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider}.\n * @public\n */\nexport interface ISimpleContextQualifierProviderCreateParams {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | readonly qualifier collector} that defines and validates qualifiers.\n */\n qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Optional record of initial qualifier name-value pairs to populate the provider.\n */\n qualifierValues?: Record<string, QualifierContextValue>;\n}\n\n/**\n * Simple concrete implementation of {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider}\n * using a `ResultMap` for qualifier value storage.\n * @public\n */\nexport class SimpleContextQualifierProvider extends ContextQualifierProvider {\n /**\n * The readonly qualifier collector that defines and validates the qualifiers for this context.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Internal storage for qualifier values using a ResultMap.\n */\n private readonly _qualifierValues: ResultMap<QualifierName, QualifierContextValue>;\n\n /**\n * Constructor for a {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.\n * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.\n */\n protected constructor(params: ISimpleContextQualifierProviderCreateParams) {\n super();\n this.qualifiers = params.qualifiers;\n this._qualifierValues = new ResultMap<QualifierName, QualifierContextValue>();\n\n if (params.qualifierValues) {\n for (const [name, value] of Object.entries(params.qualifierValues)) {\n const qualifierName = Validate.toQualifierName(name).orThrow();\n this._qualifierValues.set(qualifierName, value);\n }\n }\n }\n\n /**\n * Creates a new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object.\n * @param params - {@link Runtime.ISimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.\n * @returns `Success` with the new {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(\n params: ISimpleContextQualifierProviderCreateParams\n ): Result<SimpleContextQualifierProvider> {\n return captureResult(() => new SimpleContextQualifierProvider(params));\n }\n\n /**\n * Gets a qualifier value by its name, index, or qualifier object.\n * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.\n * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found or an error occurs.\n */\n public get(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierContextValue> {\n const qualifierName = this._resolveQualifierName(nameOrIndexOrQualifier);\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n if (qualifierName.isFailure()) {\n return fail(qualifierName.message);\n }\n return this._qualifierValues.get(qualifierName.value);\n }\n\n /**\n * Gets a validated qualifier context value by its name, index, or qualifier object.\n * TODO: Implement validation logic using qualifier collectors.\n * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.\n * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,\n * or `Failure` with an error message if not found, invalid, or an error occurs.\n */\n public getValidated(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierContextValue> {\n const qualifierName = this._resolveQualifierName(nameOrIndexOrQualifier);\n if (qualifierName.isFailure()) {\n return fail(qualifierName.message);\n }\n // TODO: Implement validation logic\n return fail(`getValidated not yet implemented for qualifier \"${qualifierName.value}\"`);\n }\n\n /**\n * Checks if a qualifier value exists with the given name.\n * @param name - The {@link QualifierName | qualifier name} to check.\n * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,\n * or `Failure` with an error message if an error occurs during the check.\n */\n public has(name: QualifierName): Result<boolean> {\n return succeed(this._qualifierValues.has(name));\n }\n\n /**\n * Gets all available qualifier names in this context.\n * @returns `Success` with an array of all {@link QualifierName | qualifier names},\n * or `Failure` with an error message if an error occurs.\n */\n public getNames(): Result<ReadonlyArray<QualifierName>> {\n return succeed(Array.from(this._qualifierValues.keys()));\n }\n\n /**\n * Sets a qualifier value in this provider.\n * @param name - The {@link QualifierName | qualifier name} to set.\n * @param value - The {@link QualifierContextValue | qualifier context value} to set.\n * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public set(name: QualifierName, value: QualifierContextValue): Result<QualifierContextValue> {\n this._qualifierValues.set(name, value);\n return succeed(value);\n }\n\n /**\n * Removes a qualifier value from this provider.\n * @param name - The {@link QualifierName | qualifier name} to remove.\n * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,\n * or `Failure` with an error message if not found or an error occurs.\n * @public\n */\n public remove(name: QualifierName): Result<QualifierContextValue> {\n return this._qualifierValues.get(name).onSuccess((value) => {\n this._qualifierValues.delete(name);\n return succeedWithDetail(value, 'success');\n });\n }\n\n /**\n * Gets the number of qualifier values in this provider.\n * @returns The count of qualifier values.\n * @public\n */\n public get size(): number {\n return this._qualifierValues.size;\n }\n\n /**\n * Clears all qualifier values from this provider.\n * @public\n */\n public clear(): void {\n this._qualifierValues.clear();\n }\n\n /**\n * Resolves a qualifier name from a name, index, or qualifier object.\n * @param nameOrIndexOrQualifier - The input to resolve.\n * @returns `Success` with the {@link QualifierName | qualifier name} if successful,\n * or `Failure` with an error message if not found or invalid.\n * @internal\n */\n private _resolveQualifierName(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierName> {\n // If it's already a QualifierName (string type with brand)\n if (typeof nameOrIndexOrQualifier === 'string') {\n /* c8 ignore next 1 - functional code path tested but coverage intermittently missed */\n return succeed(nameOrIndexOrQualifier as QualifierName);\n }\n\n // If it's a Qualifier object\n if (\n typeof nameOrIndexOrQualifier === 'object' &&\n nameOrIndexOrQualifier !== null &&\n 'name' in nameOrIndexOrQualifier\n ) {\n return succeed(nameOrIndexOrQualifier.name);\n }\n\n // If it's a QualifierIndex (number type with brand)\n /* c8 ignore next 8 - functional code path tested but coverage intermittently missed */\n if (typeof nameOrIndexOrQualifier === 'number') {\n const qualifier = this.qualifiers.getAt(nameOrIndexOrQualifier as QualifierIndex);\n if (qualifier.isSuccess()) {\n return succeed(qualifier.value.name);\n }\n return fail(`Qualifier not found at index ${nameOrIndexOrQualifier}`);\n }\n\n return fail(`Invalid qualifier parameter: ${nameOrIndexOrQualifier}`);\n }\n}\n"]}
@@ -0,0 +1,47 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { IReadOnlyQualifierCollector } from '../../qualifiers';
3
+ import { SimpleContextQualifierProvider } from './simpleContextQualifierProvider';
4
+ import { IReadOnlyContextQualifierProviderValidator } from './contextQualifierProviderValidator';
5
+ /**
6
+ * Parameters for creating a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider}.
7
+ * @public
8
+ */
9
+ export interface IValidatingSimpleContextQualifierProviderCreateParams {
10
+ /**
11
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | readonly qualifier collector} that defines and validates qualifiers.
12
+ */
13
+ qualifiers: IReadOnlyQualifierCollector;
14
+ /**
15
+ * Optional record of initial qualifier name-value pairs to populate the provider.
16
+ * Accepts string keys and values which will be converted to strongly-typed values.
17
+ */
18
+ qualifierValues?: Record<string, string>;
19
+ }
20
+ /**
21
+ * A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a
22
+ * {@link Runtime.Context.ContextQualifierProviderValidator | validator} property that enables
23
+ * validated use of the underlying provider with string keys and values.
24
+ * This eliminates the need for type casting in consumer code.
25
+ * @public
26
+ */
27
+ export declare class ValidatingSimpleContextQualifierProvider extends SimpleContextQualifierProvider {
28
+ /**
29
+ * A {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator} which validates
30
+ * string inputs before passing them to this provider.
31
+ */
32
+ readonly validating: IReadOnlyContextQualifierProviderValidator;
33
+ /**
34
+ * Constructor for a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
35
+ * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
36
+ */
37
+ protected constructor(params: IValidatingSimpleContextQualifierProviderCreateParams);
38
+ /**
39
+ * Creates a new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
40
+ * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
41
+ * @returns `Success` with the new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object if successful,
42
+ * or `Failure` with an error message if not.
43
+ * @public
44
+ */
45
+ static create(params: IValidatingSimpleContextQualifierProviderCreateParams): Result<ValidatingSimpleContextQualifierProvider>;
46
+ }
47
+ //# sourceMappingURL=validatingSimpleContextQualifierProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validatingSimpleContextQualifierProvider.d.ts","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/validatingSimpleContextQualifierProvider.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAEL,0CAA0C,EAC3C,MAAM,qCAAqC,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,qDAAqD;IACpE;;OAEG;IACH,UAAU,EAAE,2BAA2B,CAAC;IAExC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,qBAAa,wCAAyC,SAAQ,8BAA8B;IAC1F;;;OAGG;IACH,SAAgB,UAAU,EAAE,0CAA0C,CAAC;IAEvE;;;OAGG;IACH,SAAS,aAAa,MAAM,EAAE,qDAAqD;IAiBnF;;;;;;OAMG;WACW,MAAM,CAClB,MAAM,EAAE,qDAAqD,GAC5D,MAAM,CAAC,wCAAwC,CAAC;CAGpD"}
@@ -0,0 +1,64 @@
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.ValidatingSimpleContextQualifierProvider = void 0;
25
+ const ts_utils_1 = require("@fgv/ts-utils");
26
+ const simpleContextQualifierProvider_1 = require("./simpleContextQualifierProvider");
27
+ const contextQualifierProviderValidator_1 = require("./contextQualifierProviderValidator");
28
+ /**
29
+ * A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a
30
+ * {@link Runtime.Context.ContextQualifierProviderValidator | validator} property that enables
31
+ * validated use of the underlying provider with string keys and values.
32
+ * This eliminates the need for type casting in consumer code.
33
+ * @public
34
+ */
35
+ class ValidatingSimpleContextQualifierProvider extends simpleContextQualifierProvider_1.SimpleContextQualifierProvider {
36
+ /**
37
+ * Constructor for a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
38
+ * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
39
+ */
40
+ constructor(params) {
41
+ // Convert string values to QualifierContextValue for the base class
42
+ /* c8 ignore next 5 - functional code path tested but coverage intermittently missed */
43
+ const convertedValues = params.qualifierValues
44
+ ? Object.fromEntries(Object.entries(params.qualifierValues).map(([key, value]) => [key, value]))
45
+ : undefined;
46
+ super({
47
+ qualifiers: params.qualifiers,
48
+ qualifierValues: convertedValues
49
+ });
50
+ this.validating = new contextQualifierProviderValidator_1.ContextQualifierProviderValidator({ provider: this });
51
+ }
52
+ /**
53
+ * Creates a new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
54
+ * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
55
+ * @returns `Success` with the new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object if successful,
56
+ * or `Failure` with an error message if not.
57
+ * @public
58
+ */
59
+ static create(params) {
60
+ return (0, ts_utils_1.captureResult)(() => new ValidatingSimpleContextQualifierProvider(params));
61
+ }
62
+ }
63
+ exports.ValidatingSimpleContextQualifierProvider = ValidatingSimpleContextQualifierProvider;
64
+ //# sourceMappingURL=validatingSimpleContextQualifierProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validatingSimpleContextQualifierProvider.js","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/validatingSimpleContextQualifierProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAsD;AAGtD,qFAAkF;AAClF,2FAG6C;AAmB7C;;;;;;GAMG;AACH,MAAa,wCAAyC,SAAQ,+DAA8B;IAO1F;;;OAGG;IACH,YAAsB,MAA6D;QACjF,oEAAoE;QACpE,uFAAuF;QACvF,MAAM,eAAe,GAAsD,MAAM,CAAC,eAAe;YAC/F,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAA8B,CAAC,CAAC,CACpG;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,KAAK,CAAC;YACJ,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,eAAe,EAAE,eAAe;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,IAAI,qEAAiC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAClB,MAA6D;QAE7D,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,wCAAwC,CAAC,MAAM,CAAC,CAAC,CAAC;IACnF,CAAC;CACF;AAxCD,4FAwCC","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 { Result, captureResult } from '@fgv/ts-utils';\nimport { QualifierContextValue } from '../../common';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\nimport { SimpleContextQualifierProvider } from './simpleContextQualifierProvider';\nimport {\n ContextQualifierProviderValidator,\n IReadOnlyContextQualifierProviderValidator\n} from './contextQualifierProviderValidator';\n\n/**\n * Parameters for creating a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider}.\n * @public\n */\nexport interface IValidatingSimpleContextQualifierProviderCreateParams {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | readonly qualifier collector} that defines and validates qualifiers.\n */\n qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Optional record of initial qualifier name-value pairs to populate the provider.\n * Accepts string keys and values which will be converted to strongly-typed values.\n */\n qualifierValues?: Record<string, string>;\n}\n\n/**\n * A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a\n * {@link Runtime.Context.ContextQualifierProviderValidator | validator} property that enables\n * validated use of the underlying provider with string keys and values.\n * This eliminates the need for type casting in consumer code.\n * @public\n */\nexport class ValidatingSimpleContextQualifierProvider extends SimpleContextQualifierProvider {\n /**\n * A {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator} which validates\n * string inputs before passing them to this provider.\n */\n public readonly validating: IReadOnlyContextQualifierProviderValidator;\n\n /**\n * Constructor for a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.\n * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.\n */\n protected constructor(params: IValidatingSimpleContextQualifierProviderCreateParams) {\n // Convert string values to QualifierContextValue for the base class\n /* c8 ignore next 5 - functional code path tested but coverage intermittently missed */\n const convertedValues: Record<string, QualifierContextValue> | undefined = params.qualifierValues\n ? Object.fromEntries(\n Object.entries(params.qualifierValues).map(([key, value]) => [key, value as QualifierContextValue])\n )\n : undefined;\n\n super({\n qualifiers: params.qualifiers,\n qualifierValues: convertedValues\n });\n\n this.validating = new ContextQualifierProviderValidator({ provider: this });\n }\n\n /**\n * Creates a new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.\n * @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.\n * @returns `Success` with the new {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(\n params: IValidatingSimpleContextQualifierProviderCreateParams\n ): Result<ValidatingSimpleContextQualifierProvider> {\n return captureResult(() => new ValidatingSimpleContextQualifierProvider(params));\n }\n}\n"]}