@fgv/ts-res 4.5.0-2 → 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 +4225 -324
  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 +3 -2
  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 +33 -32
  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,135 @@
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.ConditionSetResolutionResult = void 0;
25
+ const ts_utils_1 = require("@fgv/ts-utils");
26
+ /**
27
+ * Represents the result of resolving a condition set.
28
+ * Contains either a failure indicator or a list of condition priority/score tuples sorted by priority then score.
29
+ * @public
30
+ */
31
+ class ConditionSetResolutionResult {
32
+ /**
33
+ * Constructor for a {@link Runtime.ConditionSetResolutionResult | ConditionSetResolutionResult}.
34
+ * @param success - Whether the condition set resolution was successful.
35
+ * @param matches - Array of condition match results, if successful.
36
+ */
37
+ constructor(matchType, matches) {
38
+ this.matchType = matchType;
39
+ this.matches = [...matches];
40
+ }
41
+ /**
42
+ * Creates a new condition set resolution result.
43
+ * @param matchType - The type of match.
44
+ * @param matches - Array of condition match results.
45
+ * @returns A new {@link Runtime.ConditionSetResolutionResult | ConditionSetResolutionResult}.
46
+ * @public
47
+ */
48
+ static create(matchType, matches) {
49
+ return (0, ts_utils_1.captureResult)(() => new ConditionSetResolutionResult(matchType, matches));
50
+ }
51
+ /**
52
+ * Compares two condition set resolution results for sorting purposes.
53
+ * The priority of a condition set result cannot be boiled down to a single number -
54
+ * we have to examine each condition result in turn.
55
+ *
56
+ * Comparison logic:
57
+ * - If priority differs, return the higher priority
58
+ * - If priority matches but score is different, return the higher score
59
+ * - If priority and score both match, proceed to the next condition
60
+ * - Failed results are considered lower priority than successful results
61
+ *
62
+ * @param a - The first condition set resolution result to compare.
63
+ * @param b - The second condition set resolution result to compare.
64
+ * @returns A negative number if a should come before b, a positive number if a should
65
+ * come after b, or zero if they are equivalent.
66
+ * @public
67
+ */
68
+ static compare(a, b) {
69
+ // Failed results are always lower priority than default match which are lower than match
70
+ if (a.matchType === 'match') {
71
+ if (b.matchType !== 'match')
72
+ return -1;
73
+ }
74
+ else if (a.matchType === 'matchAsDefault') {
75
+ if (b.matchType === 'match') {
76
+ return 1;
77
+ }
78
+ else if (b.matchType === 'noMatch') {
79
+ return -1;
80
+ }
81
+ }
82
+ else {
83
+ // a.matchType === 'noMatch'
84
+ if (b.matchType === 'noMatch') {
85
+ return 0;
86
+ }
87
+ else {
88
+ return 1; // noMatch comes after any other match type
89
+ }
90
+ }
91
+ // Both are successful with the same match type - compare condition by condition
92
+ const minLength = Math.min(a.matches.length, b.matches.length);
93
+ for (let i = 0; i < minLength; i++) {
94
+ const matchA = a.matches[i];
95
+ const matchB = b.matches[i];
96
+ // Compare priority first
97
+ const priorityDiff = matchB.priority - matchA.priority;
98
+ if (priorityDiff !== 0) {
99
+ return priorityDiff;
100
+ }
101
+ // If priority matches, compare score
102
+ const scoreDiff = matchB.score - matchA.score;
103
+ if (scoreDiff !== 0) {
104
+ return scoreDiff;
105
+ }
106
+ // If both priority and score match, continue to next condition
107
+ }
108
+ // If all compared conditions are equal, the one with more conditions wins
109
+ return b.matches.length - a.matches.length;
110
+ }
111
+ /**
112
+ * Gets the highest priority among all condition matches.
113
+ * @returns The highest priority, or 0 if no matches.
114
+ * @public
115
+ */
116
+ get maxPriority() {
117
+ if (this.matchType === 'noMatch' || this.matches.length === 0) {
118
+ return 0;
119
+ }
120
+ return Math.max(...this.matches.map((m) => m.priority));
121
+ }
122
+ /**
123
+ * Gets the total score by summing all condition match scores.
124
+ * @returns The total score, or 0 if no matches.
125
+ * @public
126
+ */
127
+ get totalScore() {
128
+ if (this.matchType === 'noMatch' || this.matches.length === 0) {
129
+ return 0;
130
+ }
131
+ return this.matches.reduce((sum, match) => sum + match.score, 0);
132
+ }
133
+ }
134
+ exports.ConditionSetResolutionResult = ConditionSetResolutionResult;
135
+ //# sourceMappingURL=conditionSetResolutionResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionSetResolutionResult.js","sourceRoot":"","sources":["../../../src/packlets/runtime/conditionSetResolutionResult.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAsD;AAmBtD;;;;GAIG;AACH,MAAa,4BAA4B;IAIvC;;;;OAIG;IACH,YAAoB,SAA6B,EAAE,OAA6C;QAC9F,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAClB,SAA6B,EAC7B,OAA6C;QAE7C,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,4BAA4B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,CAAC,OAAO,CAAC,CAA+B,EAAE,CAA+B;QACpF,yFAAyF;QACzF,IAAI,CAAC,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,SAAS,KAAK,OAAO;gBAAE,OAAO,CAAC,CAAC,CAAC;QACzC,CAAC;aAAM,IAAI,CAAC,CAAC,SAAS,KAAK,gBAAgB,EAAE,CAAC;YAC5C,IAAI,CAAC,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;gBAC5B,OAAO,CAAC,CAAC;YACX,CAAC;iBAAM,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBACrC,OAAO,CAAC,CAAC,CAAC;YACZ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,4BAA4B;YAC5B,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,CAAC,CAAC;YACX,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,CAAC,CAAC,2CAA2C;YACvD,CAAC;QACH,CAAC;QAED,gFAAgF;QAChF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAE5B,yBAAyB;YACzB,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YACvD,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,YAAY,CAAC;YACtB,CAAC;YAED,qCAAqC;YACrC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAC9C,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;gBACpB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,+DAA+D;QACjE,CAAC;QAED,0EAA0E;QAC1E,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QACpB,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9D,OAAO,CAAsB,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAsB,CAAC;IAC/E,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACnB,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9D,OAAO,CAAwB,CAAC;QAClC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAwB,CAAC;IAC1F,CAAC;CACF;AAjHD,oEAiHC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Result } from '@fgv/ts-utils';\nimport { QualifierMatchScore, ConditionPriority } from '../common';\n\n/**\n * The outcome of a condition match.\n * @public\n */\nexport type ConditionMatchType = 'match' | 'matchAsDefault' | 'noMatch';\n\n/**\n * Represents a single condition match result with priority and outcome.\n * @public\n */\nexport interface IConditionMatchResult {\n readonly priority: ConditionPriority;\n readonly matchType: ConditionMatchType;\n readonly score: QualifierMatchScore;\n}\n\n/**\n * Represents the result of resolving a condition set.\n * Contains either a failure indicator or a list of condition priority/score tuples sorted by priority then score.\n * @public\n */\nexport class ConditionSetResolutionResult {\n public readonly matchType: ConditionMatchType;\n public readonly matches: ReadonlyArray<IConditionMatchResult>;\n\n /**\n * Constructor for a {@link Runtime.ConditionSetResolutionResult | ConditionSetResolutionResult}.\n * @param success - Whether the condition set resolution was successful.\n * @param matches - Array of condition match results, if successful.\n */\n private constructor(matchType: ConditionMatchType, matches: ReadonlyArray<IConditionMatchResult>) {\n this.matchType = matchType;\n this.matches = [...matches];\n }\n\n /**\n * Creates a new condition set resolution result.\n * @param matchType - The type of match.\n * @param matches - Array of condition match results.\n * @returns A new {@link Runtime.ConditionSetResolutionResult | ConditionSetResolutionResult}.\n * @public\n */\n public static create(\n matchType: ConditionMatchType,\n matches: ReadonlyArray<IConditionMatchResult>\n ): Result<ConditionSetResolutionResult> {\n return captureResult(() => new ConditionSetResolutionResult(matchType, matches));\n }\n\n /**\n * Compares two condition set resolution results for sorting purposes.\n * The priority of a condition set result cannot be boiled down to a single number -\n * we have to examine each condition result in turn.\n *\n * Comparison logic:\n * - If priority differs, return the higher priority\n * - If priority matches but score is different, return the higher score\n * - If priority and score both match, proceed to the next condition\n * - Failed results are considered lower priority than successful results\n *\n * @param a - The first condition set resolution result to compare.\n * @param b - The second condition set resolution result to compare.\n * @returns A negative number if a should come before b, a positive number if a should\n * come after b, or zero if they are equivalent.\n * @public\n */\n public static compare(a: ConditionSetResolutionResult, b: ConditionSetResolutionResult): number {\n // Failed results are always lower priority than default match which are lower than match\n if (a.matchType === 'match') {\n if (b.matchType !== 'match') return -1;\n } else if (a.matchType === 'matchAsDefault') {\n if (b.matchType === 'match') {\n return 1;\n } else if (b.matchType === 'noMatch') {\n return -1;\n }\n } else {\n // a.matchType === 'noMatch'\n if (b.matchType === 'noMatch') {\n return 0;\n } else {\n return 1; // noMatch comes after any other match type\n }\n }\n\n // Both are successful with the same match type - compare condition by condition\n const minLength = Math.min(a.matches.length, b.matches.length);\n\n for (let i = 0; i < minLength; i++) {\n const matchA = a.matches[i];\n const matchB = b.matches[i];\n\n // Compare priority first\n const priorityDiff = matchB.priority - matchA.priority;\n if (priorityDiff !== 0) {\n return priorityDiff;\n }\n\n // If priority matches, compare score\n const scoreDiff = matchB.score - matchA.score;\n if (scoreDiff !== 0) {\n return scoreDiff;\n }\n\n // If both priority and score match, continue to next condition\n }\n\n // If all compared conditions are equal, the one with more conditions wins\n return b.matches.length - a.matches.length;\n }\n\n /**\n * Gets the highest priority among all condition matches.\n * @returns The highest priority, or 0 if no matches.\n * @public\n */\n public get maxPriority(): ConditionPriority {\n if (this.matchType === 'noMatch' || this.matches.length === 0) {\n return 0 as ConditionPriority;\n }\n return Math.max(...this.matches.map((m) => m.priority)) as ConditionPriority;\n }\n\n /**\n * Gets the total score by summing all condition match scores.\n * @returns The total score, or 0 if no matches.\n * @public\n */\n public get totalScore(): QualifierMatchScore {\n if (this.matchType === 'noMatch' || this.matches.length === 0) {\n return 0 as QualifierMatchScore;\n }\n return this.matches.reduce((sum, match) => sum + match.score, 0) as QualifierMatchScore;\n }\n}\n"]}
@@ -0,0 +1,80 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';
3
+ import { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';
4
+ /**
5
+ * Abstract interface for providing qualifier values in an optimized runtime context.
6
+ * Acts as a property bag using the Result pattern for qualifier value lookups.
7
+ * @public
8
+ */
9
+ export interface IContextQualifierProvider {
10
+ /**
11
+ * Gets a qualifier value by its name, index, or qualifier object.
12
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
13
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
14
+ * or `Failure` with an error message if not found or an error occurs.
15
+ */
16
+ get(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
17
+ /**
18
+ * Gets a validated qualifier context value by its name, index, or qualifier object.
19
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
20
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
21
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
22
+ */
23
+ getValidated(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
24
+ /**
25
+ * Checks if a qualifier value exists with the given name.
26
+ * @param name - The {@link QualifierName | qualifier name} to check.
27
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
28
+ * or `Failure` with an error message if an error occurs during the check.
29
+ */
30
+ has(name: QualifierName): Result<boolean>;
31
+ /**
32
+ * Gets all available qualifier names in this context.
33
+ * @returns `Success` with an array of all {@link QualifierName | qualifier names},
34
+ * or `Failure` with an error message if an error occurs.
35
+ */
36
+ getNames(): Result<ReadonlyArray<QualifierName>>;
37
+ /**
38
+ * The readonly qualifier collector that defines and validates the qualifiers for this context.
39
+ */
40
+ readonly qualifiers: IReadOnlyQualifierCollector;
41
+ }
42
+ /**
43
+ * Abstract base class for implementing context qualifier providers.
44
+ * Provides common functionality and enforces the contract for derived classes.
45
+ * @public
46
+ */
47
+ export declare abstract class ContextQualifierProvider implements IContextQualifierProvider {
48
+ /**
49
+ * The readonly qualifier collector that defines and validates the qualifiers for this context.
50
+ */
51
+ abstract readonly qualifiers: IReadOnlyQualifierCollector;
52
+ /**
53
+ * Gets a qualifier value by its name, index, or qualifier object.
54
+ * @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
55
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
56
+ * or `Failure` with an error message if not found or an error occurs.
57
+ */
58
+ abstract get(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
59
+ /**
60
+ * Gets a validated qualifier context 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 validated {@link QualifierContextValue | qualifier context value} if found,
63
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
64
+ */
65
+ abstract getValidated(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;
66
+ /**
67
+ * Checks if a qualifier value exists with the given name.
68
+ * @param name - The {@link QualifierName | qualifier name} to check.
69
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
70
+ * or `Failure` with an error message if an error occurs during the check.
71
+ */
72
+ abstract has(name: QualifierName): Result<boolean>;
73
+ /**
74
+ * Gets all available qualifier names in this context.
75
+ * @returns `Success` with an array of all {@link QualifierName | qualifier names},
76
+ * or `Failure` with an error message if an error occurs.
77
+ */
78
+ abstract getNames(): Result<ReadonlyArray<QualifierName>>;
79
+ }
80
+ //# sourceMappingURL=contextQualifierProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextQualifierProvider.d.ts","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/contextQualifierProvider.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,GAAG,CAAC,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEvG;;;;;OAKG;IACH,YAAY,CACV,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GACjE,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;OAIG;IACH,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;CAClD;AAED;;;;GAIG;AACH,8BAAsB,wBAAyB,YAAW,yBAAyB;IACjF;;OAEG;IACH,kBAAyB,UAAU,EAAE,2BAA2B,CAAC;IAEjE;;;;;OAKG;aACa,GAAG,CACjB,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GACjE,MAAM,CAAC,qBAAqB,CAAC;IAEhC;;;;;OAKG;aACa,YAAY,CAC1B,sBAAsB,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GACjE,MAAM,CAAC,qBAAqB,CAAC;IAEhC;;;;;OAKG;aACa,GAAG,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC;IAEzD;;;;OAIG;aACa,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;CACjE"}
@@ -0,0 +1,33 @@
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.ContextQualifierProvider = void 0;
25
+ /**
26
+ * Abstract base class for implementing context qualifier providers.
27
+ * Provides common functionality and enforces the contract for derived classes.
28
+ * @public
29
+ */
30
+ class ContextQualifierProvider {
31
+ }
32
+ exports.ContextQualifierProvider = ContextQualifierProvider;
33
+ //# sourceMappingURL=contextQualifierProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextQualifierProvider.js","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/contextQualifierProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAmDH;;;;GAIG;AACH,MAAsB,wBAAwB;CAwC7C;AAxCD,4DAwCC","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 } from '@fgv/ts-utils';\nimport { QualifierName, QualifierContextValue, QualifierIndex } from '../../common';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../../qualifiers';\n\n/**\n * Abstract interface for providing qualifier values in an optimized runtime context.\n * Acts as a property bag using the Result pattern for qualifier value lookups.\n * @public\n */\nexport interface IContextQualifierProvider {\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 get(nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier): Result<QualifierContextValue>;\n\n /**\n * Gets a validated qualifier context 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 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(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierContextValue>;\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 has(name: QualifierName): Result<boolean>;\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 getNames(): Result<ReadonlyArray<QualifierName>>;\n\n /**\n * The readonly qualifier collector that defines and validates the qualifiers for this context.\n */\n readonly qualifiers: IReadOnlyQualifierCollector;\n}\n\n/**\n * Abstract base class for implementing context qualifier providers.\n * Provides common functionality and enforces the contract for derived classes.\n * @public\n */\nexport abstract class ContextQualifierProvider implements IContextQualifierProvider {\n /**\n * The readonly qualifier collector that defines and validates the qualifiers for this context.\n */\n public abstract readonly qualifiers: IReadOnlyQualifierCollector;\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 abstract get(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierContextValue>;\n\n /**\n * Gets a validated qualifier context 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 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 abstract getValidated(\n nameOrIndexOrQualifier: QualifierName | QualifierIndex | Qualifier\n ): Result<QualifierContextValue>;\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 abstract has(name: QualifierName): Result<boolean>;\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 abstract getNames(): Result<ReadonlyArray<QualifierName>>;\n}\n"]}
@@ -0,0 +1,165 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { QualifierContextValue } from '../../common';
3
+ import { IReadOnlyQualifierCollector } from '../../qualifiers';
4
+ import { IContextQualifierProvider } from './contextQualifierProvider';
5
+ /**
6
+ * A read-only interface exposing non-mutating methods of a {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
7
+ * @public
8
+ */
9
+ export interface IReadOnlyContextQualifierProviderValidator {
10
+ /**
11
+ * {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.provider}
12
+ */
13
+ readonly provider: IContextQualifierProvider;
14
+ /**
15
+ * {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.qualifiers}
16
+ */
17
+ readonly qualifiers: IReadOnlyQualifierCollector;
18
+ /**
19
+ * Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
20
+ * @param name - The string name to convert and look up.
21
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
22
+ * or `Failure` with an error message if not found or an error occurs.
23
+ */
24
+ get(name: string): Result<QualifierContextValue>;
25
+ /**
26
+ * Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
27
+ * @param index - The number index to convert and look up.
28
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
29
+ * or `Failure` with an error message if not found or an error occurs.
30
+ */
31
+ getByIndex(index: number): Result<QualifierContextValue>;
32
+ /**
33
+ * Gets a validated qualifier context value by its string name.
34
+ * @param name - The string name to convert and look up.
35
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
36
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
37
+ */
38
+ getValidated(name: string): Result<QualifierContextValue>;
39
+ /**
40
+ * Gets a validated qualifier context value by its number index.
41
+ * @param index - The number index to convert and look up.
42
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
43
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
44
+ */
45
+ getValidatedByIndex(index: number): Result<QualifierContextValue>;
46
+ /**
47
+ * Checks if a qualifier value exists with the given string name.
48
+ * @param name - The string name to convert and check.
49
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
50
+ * or `Failure` with an error message if an error occurs during the check.
51
+ */
52
+ has(name: string): Result<boolean>;
53
+ /**
54
+ * Sets a qualifier value using string inputs, converting to strongly-typed values.
55
+ * @param name - The string name to convert.
56
+ * @param value - The string value to convert.
57
+ * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
58
+ * or `Failure` with an error message if an error occurs.
59
+ */
60
+ set(name: string, value: string): Result<QualifierContextValue>;
61
+ /**
62
+ * Removes a qualifier value using string input, converting to strongly-typed QualifierName.
63
+ * @param name - The string name to convert.
64
+ * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
65
+ * or `Failure` with an error message if an error occurs.
66
+ */
67
+ remove(name: string): Result<QualifierContextValue>;
68
+ }
69
+ /**
70
+ * Parameters for constructing a {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
71
+ * @public
72
+ */
73
+ export interface IContextQualifierProviderValidatorCreateParams {
74
+ provider: IContextQualifierProvider;
75
+ }
76
+ /**
77
+ * A wrapper for {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider} that accepts
78
+ * string inputs and converts them to strongly-typed values before calling the wrapped provider.
79
+ * This eliminates the need for type casting in consumer code while maintaining type safety.
80
+ * @public
81
+ */
82
+ export declare class ContextQualifierProviderValidator implements IReadOnlyContextQualifierProviderValidator {
83
+ /**
84
+ * The wrapped context qualifier provider.
85
+ */
86
+ readonly provider: IContextQualifierProvider;
87
+ /**
88
+ * The readonly qualifier collector that defines and validates the qualifiers for this context.
89
+ */
90
+ get qualifiers(): IReadOnlyQualifierCollector;
91
+ /**
92
+ * Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
93
+ * @param params - Required parameters for constructing the validator.
94
+ */
95
+ constructor(params: IContextQualifierProviderValidatorCreateParams);
96
+ /**
97
+ * Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
98
+ * @param name - The string name to convert and look up.
99
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
100
+ * or `Failure` with an error message if not found or an error occurs.
101
+ */
102
+ get(name: string): Result<QualifierContextValue>;
103
+ /**
104
+ * Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
105
+ * @param index - The number index to convert and look up.
106
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
107
+ * or `Failure` with an error message if not found or an error occurs.
108
+ */
109
+ getByIndex(index: number): Result<QualifierContextValue>;
110
+ /**
111
+ * Gets a validated qualifier context value by its string name.
112
+ * @param name - The string name to convert and look up.
113
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
114
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
115
+ */
116
+ getValidated(name: string): Result<QualifierContextValue>;
117
+ /**
118
+ * Gets a validated qualifier context value by its number index.
119
+ * @param index - The number index to convert and look up.
120
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
121
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
122
+ */
123
+ getValidatedByIndex(index: number): Result<QualifierContextValue>;
124
+ /**
125
+ * Checks if a qualifier value exists with the given string name.
126
+ * @param name - The string name to convert and check.
127
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
128
+ * or `Failure` with an error message if an error occurs during the check.
129
+ */
130
+ has(name: string): Result<boolean>;
131
+ /**
132
+ * Sets a qualifier value using string inputs, converting to strongly-typed values.
133
+ * @param name - The string name to convert.
134
+ * @param value - The string value to convert.
135
+ * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
136
+ * or `Failure` with an error message if an error occurs.
137
+ */
138
+ set(name: string, value: string): Result<QualifierContextValue>;
139
+ /**
140
+ * Removes a qualifier value using string input, converting to strongly-typed QualifierName.
141
+ * @param name - The string name to convert.
142
+ * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
143
+ * or `Failure` with an error message if an error occurs.
144
+ */
145
+ remove(name: string): Result<QualifierContextValue>;
146
+ /**
147
+ * Validates a string as a QualifierName.
148
+ * @param name - The string to validate.
149
+ * @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.
150
+ */
151
+ private _validateQualifierName;
152
+ /**
153
+ * Validates a number as a QualifierIndex.
154
+ * @param index - The number to validate.
155
+ * @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.
156
+ */
157
+ private _validateQualifierIndex;
158
+ /**
159
+ * Validates a string as a QualifierContextValue.
160
+ * @param value - The string to validate.
161
+ * @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.
162
+ */
163
+ private _validateQualifierContextValue;
164
+ }
165
+ //# sourceMappingURL=contextQualifierProviderValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextQualifierProviderValidator.d.ts","sourceRoot":"","sources":["../../../../src/packlets/runtime/context/contextQualifierProviderValidator.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAiB,qBAAqB,EAAkB,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,0CAA0C;IACzD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IAEjD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEzD;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAElE;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnC;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,8CAA8C;IAC7D,QAAQ,EAAE,yBAAyB,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,iCAAkC,YAAW,0CAA0C;IAClG;;OAEG;IACH,SAAgB,QAAQ,EAAE,yBAAyB,CAAC;IAEpD;;OAEG;IACH,IAAW,UAAU,IAAI,2BAA2B,CAEnD;IAED;;;OAGG;gBACgB,MAAM,EAAE,8CAA8C;IAIzE;;;;;OAKG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAMvD;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAM/D;;;;;OAKG;IACI,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAMhE;;;;;OAKG;IACI,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAMxE;;;;;OAKG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;IAMzC;;;;;;OAMG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAqBtE;;;;;OAKG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAgB1D;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAO/B;;;;OAIG;IACH,OAAO,CAAC,8BAA8B;CAMvC"}
@@ -0,0 +1,179 @@
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.ContextQualifierProviderValidator = void 0;
25
+ const ts_utils_1 = require("@fgv/ts-utils");
26
+ /**
27
+ * A wrapper for {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider} that accepts
28
+ * string inputs and converts them to strongly-typed values before calling the wrapped provider.
29
+ * This eliminates the need for type casting in consumer code while maintaining type safety.
30
+ * @public
31
+ */
32
+ class ContextQualifierProviderValidator {
33
+ /**
34
+ * The readonly qualifier collector that defines and validates the qualifiers for this context.
35
+ */
36
+ get qualifiers() {
37
+ return this.provider.qualifiers;
38
+ }
39
+ /**
40
+ * Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
41
+ * @param params - Required parameters for constructing the validator.
42
+ */
43
+ constructor(params) {
44
+ this.provider = params.provider;
45
+ }
46
+ /**
47
+ * Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
48
+ * @param name - The string name to convert and 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(name) {
53
+ return this._validateQualifierName(name).onSuccess((qualifierName) => {
54
+ return this.provider.get(qualifierName);
55
+ });
56
+ }
57
+ /**
58
+ * Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
59
+ * @param index - The number index to convert and look up.
60
+ * @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
61
+ * or `Failure` with an error message if not found or an error occurs.
62
+ */
63
+ getByIndex(index) {
64
+ return this._validateQualifierIndex(index).onSuccess((qualifierIndex) => {
65
+ return this.provider.get(qualifierIndex);
66
+ });
67
+ }
68
+ /**
69
+ * Gets a validated qualifier context value by its string name.
70
+ * @param name - The string name to convert and look up.
71
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
72
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
73
+ */
74
+ getValidated(name) {
75
+ return this._validateQualifierName(name).onSuccess((qualifierName) => {
76
+ return this.provider.getValidated(qualifierName);
77
+ });
78
+ }
79
+ /**
80
+ * Gets a validated qualifier context value by its number index.
81
+ * @param index - The number index to convert and look up.
82
+ * @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
83
+ * or `Failure` with an error message if not found, invalid, or an error occurs.
84
+ */
85
+ getValidatedByIndex(index) {
86
+ return this._validateQualifierIndex(index).onSuccess((qualifierIndex) => {
87
+ return this.provider.getValidated(qualifierIndex);
88
+ });
89
+ }
90
+ /**
91
+ * Checks if a qualifier value exists with the given string name.
92
+ * @param name - The string name to convert and check.
93
+ * @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
94
+ * or `Failure` with an error message if an error occurs during the check.
95
+ */
96
+ has(name) {
97
+ return this._validateQualifierName(name).onSuccess((qualifierName) => {
98
+ return this.provider.has(qualifierName);
99
+ });
100
+ }
101
+ /**
102
+ * Sets a qualifier value using string inputs, converting to strongly-typed values.
103
+ * @param name - The string name to convert.
104
+ * @param value - The string value to convert.
105
+ * @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
106
+ * or `Failure` with an error message if an error occurs.
107
+ */
108
+ set(name, value) {
109
+ return this._validateQualifierName(name)
110
+ .onSuccess((qualifierName) => this._validateQualifierContextValue(value))
111
+ .onSuccess((qualifierValue) => {
112
+ // Check if the provider has a set method (only available on mutable providers)
113
+ if ('set' in this.provider && typeof this.provider.set === 'function') {
114
+ try {
115
+ return this.provider.set(name, qualifierValue);
116
+ }
117
+ catch (_a) {
118
+ return (0, ts_utils_1.fail)(`Provider does not support setting values`);
119
+ }
120
+ }
121
+ return (0, ts_utils_1.fail)(`Provider does not support setting values`);
122
+ });
123
+ }
124
+ /**
125
+ * Removes a qualifier value using string input, converting to strongly-typed QualifierName.
126
+ * @param name - The string name to convert.
127
+ * @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
128
+ * or `Failure` with an error message if an error occurs.
129
+ */
130
+ remove(name) {
131
+ return this._validateQualifierName(name).onSuccess((qualifierName) => {
132
+ // Check if the provider has a remove method (only available on mutable providers)
133
+ if ('remove' in this.provider && typeof this.provider.remove === 'function') {
134
+ try {
135
+ return this.provider.remove(qualifierName);
136
+ }
137
+ catch (_a) {
138
+ return (0, ts_utils_1.fail)(`Provider does not support removing values`);
139
+ }
140
+ }
141
+ return (0, ts_utils_1.fail)(`Provider does not support removing values`);
142
+ });
143
+ }
144
+ /**
145
+ * Validates a string as a QualifierName.
146
+ * @param name - The string to validate.
147
+ * @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.
148
+ */
149
+ _validateQualifierName(name) {
150
+ if (typeof name !== 'string' || name.length === 0) {
151
+ return (0, ts_utils_1.fail)(`Invalid qualifier name: "${name}"`);
152
+ }
153
+ return (0, ts_utils_1.succeed)(name);
154
+ }
155
+ /**
156
+ * Validates a number as a QualifierIndex.
157
+ * @param index - The number to validate.
158
+ * @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.
159
+ */
160
+ _validateQualifierIndex(index) {
161
+ if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {
162
+ return (0, ts_utils_1.fail)(`Invalid qualifier index: ${index}`);
163
+ }
164
+ return (0, ts_utils_1.succeed)(index);
165
+ }
166
+ /**
167
+ * Validates a string as a QualifierContextValue.
168
+ * @param value - The string to validate.
169
+ * @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.
170
+ */
171
+ _validateQualifierContextValue(value) {
172
+ if (typeof value !== 'string') {
173
+ return (0, ts_utils_1.fail)(`Invalid qualifier context value: "${value}"`);
174
+ }
175
+ return (0, ts_utils_1.succeed)(value);
176
+ }
177
+ }
178
+ exports.ContextQualifierProviderValidator = ContextQualifierProviderValidator;
179
+ //# sourceMappingURL=contextQualifierProviderValidator.js.map