@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
@@ -22,6 +22,7 @@
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.qualifierType = void 0;
25
+ exports.literalValueHierarchyCreateParams = literalValueHierarchyCreateParams;
25
26
  const ts_utils_1 = require("@fgv/ts-utils");
26
27
  /**
27
28
  * Converter for {@link QualifierTypes.QualifierType | QualifierType} objects,
@@ -42,4 +43,18 @@ exports.qualifierType = ts_utils_1.Converters.generic((from, __self, context) =>
42
43
  }
43
44
  return (0, ts_utils_1.fail)('qualifierType converter requires a string or number');
44
45
  });
46
+ /**
47
+ * Gets a converter for {@link QualifierTypes.ILiteralValueHierarchyCreateParams | ILiteralValueHierarchyCreateParams}
48
+ * objects with values validated by a supplied value converter.
49
+ * @param valueConverter - Converter for the literal value type.
50
+ * @public
51
+ */
52
+ function literalValueHierarchyCreateParams(valueConverter) {
53
+ return ts_utils_1.Converters.object({
54
+ values: ts_utils_1.Converters.arrayOf(valueConverter),
55
+ hierarchy: ts_utils_1.Converters.recordOf(valueConverter, {
56
+ keyConverter: valueConverter
57
+ })
58
+ });
59
+ }
45
60
  //# sourceMappingURL=convert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAoE;AAapE;;;;;GAKG;AACH,kDAAkD;AACrC,QAAA,aAAa,GAAG,qBAAU,CAAC,OAAO,CAC7C,CACE,IAAa,EACb,MAA8D,EAC9D,OAAsC,EACf,EAAE;IACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAA,eAAI,EAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,IAAA,eAAI,EAAC,qDAAqD,CAAC,CAAC;AACrE,CAAC,CACF,CAAC","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 { Converter, Converters, Result, fail } from '@fgv/ts-utils';\nimport { QualifierType } from './qualifierType';\nimport { ReadOnlyQualifierTypeCollector } from './qualifierTypeCollector';\n\n/**\n * Context necessary to convert a qualifier name or number to an\n * instantiated {@link QualifierTypes.QualifierType}.\n * @public\n */\nexport interface IQualifierTypeConvertContext {\n qualifierTypes: ReadOnlyQualifierTypeCollector;\n}\n\n/**\n * Converter for {@link QualifierTypes.QualifierType | QualifierType} objects,\n * retrieves a {@link QualifierTypes.QualifierType | QualifierType} by name or\n * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.\n * @public\n */\n// eslint-disable-next-line @rushstack/typedef-var\nexport const qualifierType = Converters.generic<QualifierType, IQualifierTypeConvertContext>(\n (\n from: unknown,\n __self: Converter<QualifierType, IQualifierTypeConvertContext>,\n context?: IQualifierTypeConvertContext\n ): Result<QualifierType> => {\n if (!context) {\n return fail('qualifierType converter requires a context');\n }\n if (typeof from === 'string') {\n return context.qualifierTypes.validating.get(from);\n } else if (typeof from === 'number') {\n return context.qualifierTypes.getAt(from);\n }\n return fail('qualifierType converter requires a string or number');\n }\n);\n"]}
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA+CH,8EASC;AAtDD,4CAAoE;AAcpE;;;;;GAKG;AACH,kDAAkD;AACrC,QAAA,aAAa,GAAG,qBAAU,CAAC,OAAO,CAC7C,CACE,IAAa,EACb,MAA8D,EAC9D,OAAsC,EACf,EAAE;IACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAA,eAAI,EAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,IAAA,eAAI,EAAC,qDAAqD,CAAC,CAAC;AACrE,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,cAA4B;IAE5B,OAAO,qBAAU,CAAC,MAAM,CAAwC;QAC9D,MAAM,EAAE,qBAAU,CAAC,OAAO,CAAC,cAAc,CAAC;QAC1C,SAAS,EAAE,qBAAU,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC7C,YAAY,EAAE,cAAc;SAC7B,CAAC;KACH,CAAC,CAAC;AACL,CAAC","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 { Converter, Converters, Result, fail } from '@fgv/ts-utils';\nimport { QualifierType } from './qualifierType';\nimport { ReadOnlyQualifierTypeCollector } from './qualifierTypeCollector';\nimport { ILiteralValueHierarchyCreateParams } from './literalValueHierarchy';\n\n/**\n * Context necessary to convert a qualifier name or number to an instantiated\n * {@link QualifierTypes.QualifierType}.\n * @public\n */\nexport interface IQualifierTypeConvertContext {\n qualifierTypes: ReadOnlyQualifierTypeCollector;\n}\n\n/**\n * Converter for {@link QualifierTypes.QualifierType | QualifierType} objects,\n * retrieves a {@link QualifierTypes.QualifierType | QualifierType} by name or\n * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.\n * @public\n */\n// eslint-disable-next-line @rushstack/typedef-var\nexport const qualifierType = Converters.generic<QualifierType, IQualifierTypeConvertContext>(\n (\n from: unknown,\n __self: Converter<QualifierType, IQualifierTypeConvertContext>,\n context?: IQualifierTypeConvertContext\n ): Result<QualifierType> => {\n if (!context) {\n return fail('qualifierType converter requires a context');\n }\n if (typeof from === 'string') {\n return context.qualifierTypes.validating.get(from);\n } else if (typeof from === 'number') {\n return context.qualifierTypes.getAt(from);\n }\n return fail('qualifierType converter requires a string or number');\n }\n);\n\n/**\n * Gets a converter for {@link QualifierTypes.ILiteralValueHierarchyCreateParams | ILiteralValueHierarchyCreateParams}\n * objects with values validated by a supplied value converter.\n * @param valueConverter - Converter for the literal value type.\n * @public\n */\nexport function literalValueHierarchyCreateParams<T extends string>(\n valueConverter: Converter<T>\n): Converter<ILiteralValueHierarchyCreateParams<T>> {\n return Converters.object<ILiteralValueHierarchyCreateParams<T>>({\n values: Converters.arrayOf(valueConverter),\n hierarchy: Converters.recordOf(valueConverter, {\n keyConverter: valueConverter\n })\n });\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import * as Config from './config';
3
+ import { QualifierType } from './qualifierType';
4
+ import { JsonObject } from '@fgv/ts-json-base';
5
+ /**
6
+ * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.
7
+ * This factory function determines the appropriate qualifier type based on the systemType
8
+ * and delegates to the appropriate type-specific createFromConfig method.
9
+ * @param typeConfig - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object}
10
+ * containing the name, systemType, and optional type-specific configuration.
11
+ * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
12
+ * if successful, `Failure` with an error message otherwise.
13
+ * @public
14
+ */
15
+ export declare function createQualifierTypeFromConfig(typeConfig: Config.IQualifierTypeConfig<JsonObject>): Result<QualifierType>;
16
+ /**
17
+ * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
18
+ * This factory function determines the appropriate qualifier type based on the systemType
19
+ * and delegates to the appropriate type-specific createFromConfig method.
20
+ * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
21
+ * containing the name, systemType, and optional type-specific configuration.
22
+ * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
23
+ * if successful, `Failure` with an error message otherwise.
24
+ * @public
25
+ */
26
+ export declare function createQualifierTypeFromSystemConfig(typeConfig: Config.ISystemQualifierTypeConfig): Result<QualifierType>;
27
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/helpers.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAQ,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAClD,MAAM,CAAC,aAAa,CAAC,CAyBvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,MAAM,CAAC,0BAA0B,GAC5C,MAAM,CAAC,aAAa,CAAC,CAYvB"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.createQualifierTypeFromConfig = createQualifierTypeFromConfig;
58
+ exports.createQualifierTypeFromSystemConfig = createQualifierTypeFromSystemConfig;
59
+ const ts_utils_1 = require("@fgv/ts-utils");
60
+ const Config = __importStar(require("./config"));
61
+ const languageQualifierType_1 = require("./languageQualifierType");
62
+ const territoryQualifierType_1 = require("./territoryQualifierType");
63
+ const literalQualifierType_1 = require("./literalQualifierType");
64
+ /**
65
+ * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.
66
+ * This factory function determines the appropriate qualifier type based on the systemType
67
+ * and delegates to the appropriate type-specific createFromConfig method.
68
+ * @param typeConfig - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object}
69
+ * containing the name, systemType, and optional type-specific configuration.
70
+ * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
71
+ * if successful, `Failure` with an error message otherwise.
72
+ * @public
73
+ */
74
+ function createQualifierTypeFromConfig(typeConfig) {
75
+ var _a;
76
+ /* c8 ignore next 1 - defense in depth */
77
+ const childConfig = (_a = typeConfig.configuration) !== null && _a !== void 0 ? _a : {};
78
+ switch (typeConfig.systemType) {
79
+ case 'language':
80
+ return Config.Convert.languageQualifierTypeConfig
81
+ .convert(childConfig)
82
+ .onSuccess((configuration) => languageQualifierType_1.LanguageQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
83
+ case 'territory':
84
+ return Config.Convert.territoryQualifierTypeConfig
85
+ .convert(childConfig)
86
+ .onSuccess((configuration) => territoryQualifierType_1.TerritoryQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
87
+ case 'literal':
88
+ return Config.Convert.literalQualifierTypeConfig
89
+ .convert(childConfig)
90
+ .onSuccess((configuration) => literalQualifierType_1.LiteralQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
91
+ default:
92
+ return (0, ts_utils_1.fail)(`Unknown qualifier type: ${typeConfig.systemType}`);
93
+ }
94
+ }
95
+ /**
96
+ * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
97
+ * This factory function determines the appropriate qualifier type based on the systemType
98
+ * and delegates to the appropriate type-specific createFromConfig method.
99
+ * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
100
+ * containing the name, systemType, and optional type-specific configuration.
101
+ * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
102
+ * if successful, `Failure` with an error message otherwise.
103
+ * @public
104
+ */
105
+ function createQualifierTypeFromSystemConfig(typeConfig) {
106
+ const { systemType } = typeConfig;
107
+ switch (systemType) {
108
+ case 'language':
109
+ return languageQualifierType_1.LanguageQualifierType.createFromConfig(typeConfig);
110
+ case 'territory':
111
+ return territoryQualifierType_1.TerritoryQualifierType.createFromConfig(typeConfig);
112
+ case 'literal':
113
+ return literalQualifierType_1.LiteralQualifierType.createFromConfig(typeConfig);
114
+ default:
115
+ return (0, ts_utils_1.fail)(`${systemType}: Unknown system qualifier type.`);
116
+ }
117
+ }
118
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBH,sEA2BC;AAYD,kFAcC;AAvED,4CAA6C;AAC7C,iDAAmC;AAEnC,mEAAgE;AAChE,qEAAkE;AAClE,iEAA8D;AAG9D;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAC3C,UAAmD;;IAEnD,yCAAyC;IACzC,MAAM,WAAW,GAAG,MAAA,UAAU,CAAC,aAAa,mCAAI,EAAE,CAAC;IACnD,QAAQ,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9B,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,OAAO,CAAC,2BAA2B;iBAC9C,OAAO,CAAC,WAAW,CAAC;iBACpB,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE,CAC3B,6CAAqB,CAAC,gBAAgB,iCAAM,UAAU,KAAE,aAAa,IAAG,CACzE,CAAC;QACN,KAAK,WAAW;YACd,OAAO,MAAM,CAAC,OAAO,CAAC,4BAA4B;iBAC/C,OAAO,CAAC,WAAW,CAAC;iBACpB,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE,CAC3B,+CAAsB,CAAC,gBAAgB,iCAAM,UAAU,KAAE,aAAa,IAAG,CAC1E,CAAC;QACN,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,0BAA0B;iBAC7C,OAAO,CAAC,WAAW,CAAC;iBACpB,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE,CAC3B,2CAAoB,CAAC,gBAAgB,iCAAM,UAAU,KAAE,aAAa,IAAG,CACxE,CAAC;QACN;YACE,OAAO,IAAA,eAAI,EAAC,2BAA2B,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,mCAAmC,CACjD,UAA6C;IAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;IAClC,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,6CAAqB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC5D,KAAK,WAAW;YACd,OAAO,+CAAsB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC7D,KAAK,SAAS;YACZ,OAAO,2CAAoB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC3D;YACE,OAAO,IAAA,eAAI,EAAC,GAAG,UAAU,kCAAkC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC","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 { fail, Result } from '@fgv/ts-utils';\nimport * as Config from './config';\nimport { QualifierType } from './qualifierType';\nimport { LanguageQualifierType } from './languageQualifierType';\nimport { TerritoryQualifierType } from './territoryQualifierType';\nimport { LiteralQualifierType } from './literalQualifierType';\nimport { JsonObject } from '@fgv/ts-json-base';\n\n/**\n * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.\n * This factory function determines the appropriate qualifier type based on the systemType\n * and delegates to the appropriate type-specific createFromConfig method.\n * @param typeConfig - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object}\n * containing the name, systemType, and optional type-specific configuration.\n * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function createQualifierTypeFromConfig(\n typeConfig: Config.IQualifierTypeConfig<JsonObject>\n): Result<QualifierType> {\n /* c8 ignore next 1 - defense in depth */\n const childConfig = typeConfig.configuration ?? {};\n switch (typeConfig.systemType) {\n case 'language':\n return Config.Convert.languageQualifierTypeConfig\n .convert(childConfig)\n .onSuccess((configuration) =>\n LanguageQualifierType.createFromConfig({ ...typeConfig, configuration })\n );\n case 'territory':\n return Config.Convert.territoryQualifierTypeConfig\n .convert(childConfig)\n .onSuccess((configuration) =>\n TerritoryQualifierType.createFromConfig({ ...typeConfig, configuration })\n );\n case 'literal':\n return Config.Convert.literalQualifierTypeConfig\n .convert(childConfig)\n .onSuccess((configuration) =>\n LiteralQualifierType.createFromConfig({ ...typeConfig, configuration })\n );\n default:\n return fail(`Unknown qualifier type: ${typeConfig.systemType}`);\n }\n}\n\n/**\n * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.\n * This factory function determines the appropriate qualifier type based on the systemType\n * and delegates to the appropriate type-specific createFromConfig method.\n * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}\n * containing the name, systemType, and optional type-specific configuration.\n * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function createQualifierTypeFromSystemConfig(\n typeConfig: Config.ISystemQualifierTypeConfig\n): Result<QualifierType> {\n const { systemType } = typeConfig;\n switch (systemType) {\n case 'language':\n return LanguageQualifierType.createFromConfig(typeConfig);\n case 'territory':\n return TerritoryQualifierType.createFromConfig(typeConfig);\n case 'literal':\n return LiteralQualifierType.createFromConfig(typeConfig);\n default:\n return fail(`${systemType}: Unknown system qualifier type.`);\n }\n}\n"]}
@@ -1,8 +1,11 @@
1
+ import * as Config from './config';
1
2
  import * as Convert from './convert';
2
3
  export * from './qualifierType';
3
4
  export * from './languageQualifierType';
4
5
  export * from './literalQualifierType';
6
+ export * from './literalValueHierarchy';
5
7
  export * from './territoryQualifierType';
6
8
  export * from './qualifierTypeCollector';
7
- export { Convert };
9
+ export * from './helpers';
10
+ export { Config, Convert };
8
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
@@ -57,12 +57,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
57
57
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
58
58
  };
59
59
  Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.Convert = void 0;
60
+ exports.Convert = exports.Config = void 0;
61
+ const Config = __importStar(require("./config"));
62
+ exports.Config = Config;
61
63
  const Convert = __importStar(require("./convert"));
62
64
  exports.Convert = Convert;
63
65
  __exportStar(require("./qualifierType"), exports);
64
66
  __exportStar(require("./languageQualifierType"), exports);
65
67
  __exportStar(require("./literalQualifierType"), exports);
68
+ __exportStar(require("./literalValueHierarchy"), exports);
66
69
  __exportStar(require("./territoryQualifierType"), exports);
67
70
  __exportStar(require("./qualifierTypeCollector"), exports);
71
+ __exportStar(require("./helpers"), exports);
68
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAQ5B,0BAAO;AANhB,kDAAgC;AAChC,0DAAwC;AACxC,yDAAuC;AACvC,2DAAyC;AACzC,2DAAyC","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 * as Convert from './convert';\n\nexport * from './qualifierType';\nexport * from './languageQualifierType';\nexport * from './literalQualifierType';\nexport * from './territoryQualifierType';\nexport * from './qualifierTypeCollector';\n\nexport { Convert };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAmC;AAW1B,wBAAM;AAVf,mDAAqC;AAUpB,0BAAO;AARxB,kDAAgC;AAChC,0DAAwC;AACxC,yDAAuC;AACvC,0DAAwC;AACxC,2DAAyC;AACzC,2DAAyC;AACzC,4CAA0B","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 * as Config from './config';\nimport * as Convert from './convert';\n\nexport * from './qualifierType';\nexport * from './languageQualifierType';\nexport * from './literalQualifierType';\nexport * from './literalValueHierarchy';\nexport * from './territoryQualifierType';\nexport * from './qualifierTypeCollector';\nexport * from './helpers';\n\nexport { Config, Convert };\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
3
3
  import { IQualifierTypeCreateParams, QualifierType } from './qualifierType';
4
+ import * as Config from './config';
4
5
  /**
5
6
  * Interface defining the parameters that can be used to create a new
6
7
  * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.
@@ -18,8 +19,8 @@ export interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTy
18
19
  allowContextList?: boolean;
19
20
  }
20
21
  /**
21
- * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags applying
22
- * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
22
+ * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags
23
+ * applying {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
23
24
  * Accepts a list of language tags in the context by default.
24
25
  * @public
25
26
  */
@@ -27,18 +28,28 @@ export declare class LanguageQualifierType extends QualifierType {
27
28
  /**
28
29
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
29
30
  * @param name - Optional name for the qualifier type. Defaults to 'language'.
30
- * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to `true`.
31
+ * @param allowContextList - Optional flag indicating whether the context can be a
32
+ * list of values. Defaults to `true`.
31
33
  * @public
32
34
  */
33
35
  protected constructor({ name, allowContextList, index }: ILanguageQualifierTypeCreateParams);
34
36
  /**
35
37
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
36
- * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters} to use when creating
37
- * the new instance.
38
- * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type} if successful, `Failure`
39
- * otherwise.
38
+ * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters}
39
+ * to use when creating the new instance.
40
+ * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type}
41
+ * if successful, `Failure` otherwise.
40
42
  */
41
43
  static create(params?: ILanguageQualifierTypeCreateParams): Result<LanguageQualifierType>;
44
+ /**
45
+ * Creates a new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType} from a configuration object.
46
+ * @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing
47
+ * the name, systemType, and optional language-specific configuration.
48
+ * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}
49
+ * if successful, `Failure` with an error message otherwise.
50
+ * @public
51
+ */
52
+ static createFromConfig(config: Config.IQualifierTypeConfig<Config.ILanguageQualifierTypeConfig>): Result<LanguageQualifierType>;
42
53
  /**
43
54
  * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
44
55
  */
@@ -49,7 +60,7 @@ export declare class LanguageQualifierType extends QualifierType {
49
60
  * @param condition - The language condition value to match.
50
61
  * @param context - The language context value to match against.
51
62
  * @param operator - The operator to use for the match. Must be 'matches'.
52
- * @returns - The match score, or `noMatch` if the match fails.
63
+ * @returns The match score, or `noMatch` if the match fails.
53
64
  */
54
65
  protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
55
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"languageQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/languageQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,iBAAiB,EAGjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC7F;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD;;;;;OAKG;IACH,SAAS,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,kCAAkC;IAa3F;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,kCAAkC,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAMhG;;OAEG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB;IAI7E;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,CACjB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB;CASvB"}
1
+ {"version":3,"file":"languageQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/languageQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAA0B,MAAM,eAAe,CAAC;AAE/D,OAAO,EACL,iBAAiB,EAGjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC7F;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD;;;;;;OAMG;IACH,SAAS,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,kCAAkC;IAa3F;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,kCAAkC,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAMhG;;;;;;;OAOG;WACW,gBAAgB,CAC5B,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,4BAA4B,CAAC,GACvE,MAAM,CAAC,qBAAqB,CAAC;IAOhC;;OAEG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB;IAM7E;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,CACjB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB;CASvB"}
@@ -26,9 +26,10 @@ const ts_utils_1 = require("@fgv/ts-utils");
26
26
  const ts_bcp47_1 = require("@fgv/ts-bcp47");
27
27
  const common_1 = require("../common");
28
28
  const qualifierType_1 = require("./qualifierType");
29
+ const ts_json_base_1 = require("@fgv/ts-json-base");
29
30
  /**
30
- * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags applying
31
- * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
31
+ * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags
32
+ * applying {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
32
33
  * Accepts a list of language tags in the context by default.
33
34
  * @public
34
35
  */
@@ -36,7 +37,8 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
36
37
  /**
37
38
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
38
39
  * @param name - Optional name for the qualifier type. Defaults to 'language'.
39
- * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to `true`.
40
+ * @param allowContextList - Optional flag indicating whether the context can be a
41
+ * list of values. Defaults to `true`.
40
42
  * @public
41
43
  */
42
44
  constructor({ name, allowContextList, index }) {
@@ -49,21 +51,38 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
49
51
  }
50
52
  /**
51
53
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
52
- * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters} to use when creating
53
- * the new instance.
54
- * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type} if successful, `Failure`
55
- * otherwise.
54
+ * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters}
55
+ * to use when creating the new instance.
56
+ * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type}
57
+ * if successful, `Failure` otherwise.
56
58
  */
57
59
  static create(params) {
58
60
  /* c8 ignore next 1 - coverage seems to intermittently miss the branch even though it's tested */
59
61
  params = params !== null && params !== void 0 ? params : {};
60
62
  return (0, ts_utils_1.captureResult)(() => new LanguageQualifierType(params));
61
63
  }
64
+ /**
65
+ * Creates a new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType} from a configuration object.
66
+ * @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing
67
+ * the name, systemType, and optional language-specific configuration.
68
+ * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}
69
+ * if successful, `Failure` with an error message otherwise.
70
+ * @public
71
+ */
72
+ static createFromConfig(config) {
73
+ var _a;
74
+ return (0, ts_json_base_1.sanitizeJsonObject)({
75
+ name: config.name,
76
+ allowContextList: ((_a = config.configuration) === null || _a === void 0 ? void 0 : _a.allowContextList) === true
77
+ }).onSuccess(LanguageQualifierType.create);
78
+ }
62
79
  /**
63
80
  * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
64
81
  */
65
82
  isValidConditionValue(value) {
66
- return ts_bcp47_1.Bcp47.tag(value).isSuccess();
83
+ return ts_bcp47_1.Bcp47.tag(value)
84
+ .onSuccess((tag) => (0, ts_utils_1.succeed)(tag.isValid))
85
+ .orDefault(false);
67
86
  }
68
87
  /**
69
88
  * Matches a single language condition against a single language context value using
@@ -71,7 +90,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
71
90
  * @param condition - The language condition value to match.
72
91
  * @param context - The language context value to match against.
73
92
  * @param operator - The operator to use for the match. Must be 'matches'.
74
- * @returns - The match score, or `noMatch` if the match fails.
93
+ * @returns The match score, or `noMatch` if the match fails.
75
94
  */
76
95
  _matchOne(condition, context, operator) {
77
96
  if (operator === 'matches') {
@@ -1 +1 @@
1
- {"version":3,"file":"languageQualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/languageQualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAsD;AACtD,4CAAsC;AACtC,sCAQmB;AACnB,mDAA4E;AAoB5E;;;;;GAKG;AACH,MAAa,qBAAsB,SAAQ,6BAAa;IACtD;;;;;OAKG;IACH,YAAsB,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAsC;QACzF,gBAAgB,GAAG,gBAAgB,KAAK,KAAK,CAAC;QAC9C,iGAAiG;QACjG,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,UAAU,CAAC;QAC1B,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAE9F,KAAK,iBACH,IAAI;YACJ,gBAAgB,IACb,SAAS,EACZ,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAA2C;QAC9D,iGAAiG;QACjG,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;QACtB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,KAAa;QACxC,OAAO,gBAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACO,SAAS,CACjB,SAAkC,EAClC,OAA8B,EAC9B,QAA2B;QAE3B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,gBAAK,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,gBAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC5F,IAAI,UAAU,GAAG,GAAG,IAAI,iBAAQ,CAAC,0BAA0B,CAAC,UAAU,CAAC,EAAE,CAAC;gBACxE,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;QACD,OAAO,gBAAO,CAAC;IACjB,CAAC;CACF;AA7DD,sDA6DC","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 { Bcp47 } from '@fgv/ts-bcp47';\nimport {\n ConditionOperator,\n Convert,\n NoMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n Validate\n} from '../common';\nimport { IQualifierTypeCreateParams, QualifierType } from './qualifierType';\n\n/**\n * Interface defining the parameters that can be used to create a new\n * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.\n * @public\n */\nexport interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTypeCreateParams> {\n /**\n * Optional name for the qualifier type. Defaults to 'language'.\n */\n name?: string;\n\n /**\n * Optional flag indicating whether the context can be a list of values.\n * Defaults to `true`.\n */\n allowContextList?: boolean;\n}\n\n/**\n * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags applying\n * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.\n * Accepts a list of language tags in the context by default.\n * @public\n */\nexport class LanguageQualifierType extends QualifierType {\n /**\n * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.\n * @param name - Optional name for the qualifier type. Defaults to 'language'.\n * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to `true`.\n * @public\n */\n protected constructor({ name, allowContextList, index }: ILanguageQualifierTypeCreateParams) {\n allowContextList = allowContextList !== false;\n /* c8 ignore next 2 - coverage intermittently drops these two lines even though they're tested */\n name = name ?? 'language';\n const validated = index ? { index: Convert.qualifierTypeIndex.convert(index).orThrow() } : {};\n\n super({\n name,\n allowContextList,\n ...validated\n });\n }\n\n /**\n * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.\n * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters} to use when creating\n * the new instance.\n * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type} if successful, `Failure`\n * otherwise.\n */\n public static create(params?: ILanguageQualifierTypeCreateParams): Result<LanguageQualifierType> {\n /* c8 ignore next 1 - coverage seems to intermittently miss the branch even though it's tested */\n params = params ?? {};\n return captureResult(() => new LanguageQualifierType(params));\n }\n\n /**\n * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}\n */\n public isValidConditionValue(value: string): value is QualifierConditionValue {\n return Bcp47.tag(value).isSuccess();\n }\n\n /**\n * Matches a single language condition against a single language context value using\n * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.\n * @param condition - The language condition value to match.\n * @param context - The language context value to match against.\n * @param operator - The operator to use for the match. Must be 'matches'.\n * @returns - The match score, or `noMatch` if the match fails.\n */\n protected _matchOne(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore {\n if (operator === 'matches') {\n const similarity = Bcp47.similarity(condition, context).orDefault(Bcp47.tagSimilarity.none);\n if (similarity > 0.0 && Validate.isValidQualifierMatchScore(similarity)) {\n return similarity;\n }\n }\n return NoMatch;\n }\n}\n"]}
1
+ {"version":3,"file":"languageQualifierType.js","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/languageQualifierType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA+D;AAC/D,4CAAsC;AACtC,sCAQmB;AACnB,mDAA4E;AAE5E,oDAAuD;AAoBvD;;;;;GAKG;AACH,MAAa,qBAAsB,SAAQ,6BAAa;IACtD;;;;;;OAMG;IACH,YAAsB,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAsC;QACzF,gBAAgB,GAAG,gBAAgB,KAAK,KAAK,CAAC;QAC9C,iGAAiG;QACjG,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,UAAU,CAAC;QAC1B,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAE9F,KAAK,iBACH,IAAI;YACJ,gBAAgB,IACb,SAAS,EACZ,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAA2C;QAC9D,iGAAiG;QACjG,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;QACtB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAC5B,MAAwE;;QAExE,OAAO,IAAA,iCAAkB,EAAqC;YAC5D,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,gBAAgB,EAAE,CAAA,MAAA,MAAM,CAAC,aAAa,0CAAE,gBAAgB,MAAK,IAAI;SAClE,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,KAAa;QACxC,OAAO,gBAAK,CAAC,GAAG,CAAC,KAAK,CAAC;aACpB,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,kBAAO,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aACxC,SAAS,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;;OAOG;IACO,SAAS,CACjB,SAAkC,EAClC,OAA8B,EAC9B,QAA2B;QAE3B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,gBAAK,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,gBAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC5F,IAAI,UAAU,GAAG,GAAG,IAAI,iBAAQ,CAAC,0BAA0B,CAAC,UAAU,CAAC,EAAE,CAAC;gBACxE,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;QACD,OAAO,gBAAO,CAAC;IACjB,CAAC;CACF;AAjFD,sDAiFC","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, succeed } from '@fgv/ts-utils';\nimport { Bcp47 } from '@fgv/ts-bcp47';\nimport {\n ConditionOperator,\n Convert,\n NoMatch,\n QualifierConditionValue,\n QualifierContextValue,\n QualifierMatchScore,\n Validate\n} from '../common';\nimport { IQualifierTypeCreateParams, QualifierType } from './qualifierType';\nimport * as Config from './config';\nimport { sanitizeJsonObject } from '@fgv/ts-json-base';\n\n/**\n * Interface defining the parameters that can be used to create a new\n * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.\n * @public\n */\nexport interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTypeCreateParams> {\n /**\n * Optional name for the qualifier type. Defaults to 'language'.\n */\n name?: string;\n\n /**\n * Optional flag indicating whether the context can be a list of values.\n * Defaults to `true`.\n */\n allowContextList?: boolean;\n}\n\n/**\n * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags\n * applying {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.\n * Accepts a list of language tags in the context by default.\n * @public\n */\nexport class LanguageQualifierType extends QualifierType {\n /**\n * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.\n * @param name - Optional name for the qualifier type. Defaults to 'language'.\n * @param allowContextList - Optional flag indicating whether the context can be a\n * list of values. Defaults to `true`.\n * @public\n */\n protected constructor({ name, allowContextList, index }: ILanguageQualifierTypeCreateParams) {\n allowContextList = allowContextList !== false;\n /* c8 ignore next 2 - coverage intermittently drops these two lines even though they're tested */\n name = name ?? 'language';\n const validated = index ? { index: Convert.qualifierTypeIndex.convert(index).orThrow() } : {};\n\n super({\n name,\n allowContextList,\n ...validated\n });\n }\n\n /**\n * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.\n * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters}\n * to use when creating the new instance.\n * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type}\n * if successful, `Failure` otherwise.\n */\n public static create(params?: ILanguageQualifierTypeCreateParams): Result<LanguageQualifierType> {\n /* c8 ignore next 1 - coverage seems to intermittently miss the branch even though it's tested */\n params = params ?? {};\n return captureResult(() => new LanguageQualifierType(params));\n }\n\n /**\n * Creates a new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType} from a configuration object.\n * @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing\n * the name, systemType, and optional language-specific configuration.\n * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static createFromConfig(\n config: Config.IQualifierTypeConfig<Config.ILanguageQualifierTypeConfig>\n ): Result<LanguageQualifierType> {\n return sanitizeJsonObject<ILanguageQualifierTypeCreateParams>({\n name: config.name,\n allowContextList: config.configuration?.allowContextList === true\n }).onSuccess(LanguageQualifierType.create);\n }\n\n /**\n * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}\n */\n public isValidConditionValue(value: string): value is QualifierConditionValue {\n return Bcp47.tag(value)\n .onSuccess((tag) => succeed(tag.isValid))\n .orDefault(false);\n }\n\n /**\n * Matches a single language condition against a single language context value using\n * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.\n * @param condition - The language condition value to match.\n * @param context - The language context value to match against.\n * @param operator - The operator to use for the match. Must be 'matches'.\n * @returns The match score, or `noMatch` if the match fails.\n */\n protected _matchOne(\n condition: QualifierConditionValue,\n context: QualifierContextValue,\n operator: ConditionOperator\n ): QualifierMatchScore {\n if (operator === 'matches') {\n const similarity = Bcp47.similarity(condition, context).orDefault(Bcp47.tagSimilarity.none);\n if (similarity > 0.0 && Validate.isValidQualifierMatchScore(similarity)) {\n return similarity;\n }\n }\n return NoMatch;\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
3
3
  import { QualifierType } from './qualifierType';
4
+ import { LiteralValueHierarchy, LiteralValueHierarchyDecl } from './literalValueHierarchy';
5
+ import * as Config from './config';
4
6
  /**
5
7
  * Interface defining the parameters that can be used to create a new
6
8
  * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
@@ -17,22 +19,28 @@ export interface ILiteralQualifierTypeCreateParams {
17
19
  */
18
20
  allowContextList?: boolean;
19
21
  /**
20
- * Optional flag indicating whether the match should be case-sensitive. Defaults to false.
22
+ * Optional flag indicating whether the match should be case-sensitive.
23
+ * Defaults to `false`.
21
24
  */
22
25
  caseSensitive?: boolean;
23
26
  /**
24
- * Optional array of enumerated values to further constrain the type. Defaults to no
25
- * constraint.
27
+ * Optional array of enumerated values to further constrain the type.
28
+ * Defaults to no constraint.
26
29
  */
27
30
  enumeratedValues?: ReadonlyArray<string>;
31
+ /**
32
+ * Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
33
+ * of literal values to use for matching. If not provided, no hierarchy will be used.
34
+ */
35
+ hierarchy?: LiteralValueHierarchyDecl<string>;
28
36
  /**
29
37
  * Global index for this qualifier type.
30
38
  */
31
39
  index?: number;
32
40
  }
33
41
  /**
34
- * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value., optionally case-sensitive
35
- * or matching against an ordered list of values at runtime.
42
+ * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value,
43
+ * optionally case-sensitive or matching against an ordered list of values at runtime.
36
44
  * @public
37
45
  */
38
46
  export declare class LiteralQualifierType extends QualifierType {
@@ -44,17 +52,24 @@ export declare class LiteralQualifierType extends QualifierType {
44
52
  * Optional array of enumerated values to further constrain the type.
45
53
  */
46
54
  readonly enumeratedValues?: ReadonlyArray<QualifierConditionValue>;
55
+ /**
56
+ * Optional {@link QualifierTypes.LiteralValueHierarchy | hierarchy} of literal
57
+ * values to use for matching. If not provided, no hierarchy will be used.
58
+ */
59
+ readonly hierarchy?: LiteralValueHierarchy<string>;
47
60
  /**
48
61
  * Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
49
62
  * @param name - Optional name for the qualifier type. Defaults to 'literal'.
50
- * @param caseSensitive - Optional flag indicating whether the match should be case-sensitive. Defaults to false.
51
- * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to false.
63
+ * @param caseSensitive - Optional flag indicating whether the match should be
64
+ * case-sensitive. Defaults to `false`.
65
+ * @param allowContextList - Optional flag indicating whether the context can be a
66
+ * list of values. Defaults to `false`.
52
67
  * @public
53
68
  */
54
- protected constructor({ name, caseSensitive, allowContextList, enumeratedValues, index }: ILiteralQualifierTypeCreateParams);
69
+ protected constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }: ILiteralQualifierTypeCreateParams);
55
70
  /**
56
- * Determines whether a value is a valid condition value for a literal qualifier. The
57
- * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts
71
+ * Determines whether a value is a valid condition value for a literal qualifier.
72
+ * The {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts
58
73
  * any identifier as a valid condition value.
59
74
  * @param value - The value to validate.
60
75
  * @returns `true` if the value is a valid condition value, `false` otherwise.
@@ -63,7 +78,7 @@ export declare class LiteralQualifierType extends QualifierType {
63
78
  /**
64
79
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
65
80
  */
66
- protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
81
+ protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, __operator: ConditionOperator): QualifierMatchScore;
67
82
  /**
68
83
  * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
69
84
  * @param params - Optional {@link QualifierTypes.ILiteralQualifierTypeCreateParams | parameters}
@@ -73,6 +88,16 @@ export declare class LiteralQualifierType extends QualifierType {
73
88
  * @public
74
89
  */
75
90
  static create(params?: ILiteralQualifierTypeCreateParams): Result<LiteralQualifierType>;
91
+ /**
92
+ * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} from a configuration object.
93
+ * @param config - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object} containing
94
+ * the name, systemType, and optional literal-specific configuration including case sensitivity,
95
+ * enumerated values, and hierarchy information.
96
+ * @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}
97
+ * if successful, `Failure` with an error message otherwise.
98
+ * @public
99
+ */
100
+ static createFromConfig(config: Config.IQualifierTypeConfig<Config.ILiteralQualifierTypeConfig>): Result<LiteralQualifierType>;
76
101
  /**
77
102
  * Checks if the given value is a valid literal condition value.
78
103
  * @param from - The value to validate.
@@ -83,8 +108,8 @@ export declare class LiteralQualifierType extends QualifierType {
83
108
  /**
84
109
  * Converts a string to a {@link QualifierConditionValue | literal condition value}.
85
110
  * @param from - The string to convert.
86
- * @returns `Success` with the converted value if valid, or `Failure` with an error message
87
- * if not.
111
+ * @returns `Success` with the converted value if valid, or `Failure` with an error
112
+ * message if not.
88
113
  * @public
89
114
  */
90
115
  static toLiteralConditionValue(from: string): Result<QualifierConditionValue>;
@@ -1 +1 @@
1
- {"version":3,"file":"literalQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA6B,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,iBAAiB,EAIjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;OAEG;IACH,SAAgB,aAAa,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,SAAgB,gBAAgB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAE1E;;;;;;OAMG;IACH,SAAS,aAAa,EACpB,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACN,EAAE,iCAAiC;IAapC;;;;;;OAMG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB;IAU7E;;OAEG;IACH,SAAS,CAAC,SAAS,CACjB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB;IAQtB;;;;;;;OAOG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,iCAAiC,GAAG,MAAM,CAAC,oBAAoB,CAAC;IAI9F;;;;;OAKG;WACW,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,uBAAuB;IAIzF;;;;;;OAMG;WACW,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAAC;CAKrF"}
1
+ {"version":3,"file":"literalQualifierType.d.ts","sourceRoot":"","sources":["../../../src/packlets/qualifier-types/literalQualifierType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA6B,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,iBAAiB,EAIjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEzC;;;OAGG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAE9C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;OAEG;IACH,SAAgB,aAAa,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,SAAgB,gBAAgB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAE1E;;;OAGG;IACH,SAAgB,SAAS,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE1D;;;;;;;;OAQG;IACH,SAAS,aAAa,EACpB,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,KAAK,EACN,EAAE,iCAAiC;IAoBpC;;;;;;OAMG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB;IAU7E;;OAEG;IACH,SAAS,CAAC,SAAS,CACjB,SAAS,EAAE,uBAAuB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,iBAAiB,GAC5B,mBAAmB;IAWtB;;;;;;;OAOG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,iCAAiC,GAAG,MAAM,CAAC,oBAAoB,CAAC;IAI9F;;;;;;;;OAQG;WACW,gBAAgB,CAC5B,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,2BAA2B,CAAC,GACtE,MAAM,CAAC,oBAAoB,CAAC;IAW/B;;;;;OAKG;WACW,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,uBAAuB;IAIzF;;;;;;OAMG;WACW,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAAC;CAKrF"}