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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +794 -137
  2. package/dist/ts-res.d.ts +2671 -355
  3. package/dist/tsdoc-metadata.json +1 -1
  4. package/eslint.config.js +16 -0
  5. package/lib/index.d.ts +11 -2
  6. package/lib/index.js +25 -2
  7. package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
  8. package/lib/packlets/bundle/bundleBuilder.js +134 -0
  9. package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
  10. package/lib/packlets/bundle/bundleLoader.js +105 -0
  11. package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
  12. package/lib/packlets/bundle/bundleNormalizer.js +142 -0
  13. package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
  14. package/lib/packlets/bundle/bundleUtils.js +117 -0
  15. package/lib/packlets/bundle/convert.d.ts +33 -0
  16. package/lib/packlets/bundle/convert.js +78 -0
  17. package/lib/packlets/bundle/index.d.ts +21 -0
  18. package/lib/packlets/bundle/index.js +83 -0
  19. package/lib/packlets/bundle/model.d.ts +100 -0
  20. package/lib/packlets/bundle/model.js +24 -0
  21. package/lib/packlets/common/convert.d.ts +15 -0
  22. package/lib/packlets/common/convert.js +16 -1
  23. package/lib/packlets/common/helpers/context.js +1 -0
  24. package/lib/packlets/common/helpers/resources.d.ts +7 -0
  25. package/lib/packlets/common/helpers/resources.js +13 -0
  26. package/lib/packlets/common/resources.d.ts +48 -1
  27. package/lib/packlets/common/validate/conditions.d.ts +17 -1
  28. package/lib/packlets/common/validate/conditions.js +32 -6
  29. package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
  30. package/lib/packlets/common/validate/regularExpressions.js +5 -1
  31. package/lib/packlets/common/validate/resources.d.ts +35 -1
  32. package/lib/packlets/common/validate/resources.js +55 -0
  33. package/lib/packlets/conditions/condition.js +1 -0
  34. package/lib/packlets/conditions/conditionSet.d.ts +9 -0
  35. package/lib/packlets/conditions/conditionSet.js +75 -1
  36. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  37. package/lib/packlets/config/configInitFactory.js +302 -0
  38. package/lib/packlets/config/convert.d.ts +9 -0
  39. package/lib/packlets/config/convert.js +12 -1
  40. package/lib/packlets/config/index.d.ts +1 -0
  41. package/lib/packlets/config/index.js +1 -0
  42. package/lib/packlets/config/json.d.ts +1 -1
  43. package/lib/packlets/config/systemConfiguration.d.ts +16 -3
  44. package/lib/packlets/config/systemConfiguration.js +19 -40
  45. package/lib/packlets/import/fsItem.d.ts +2 -1
  46. package/lib/packlets/import/fsItem.js +9 -13
  47. package/lib/packlets/import/importManager.d.ts +2 -1
  48. package/lib/packlets/import/importers/jsonImporter.js +1 -0
  49. package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
  50. package/lib/packlets/import/importers/pathImporter.js +2 -1
  51. package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
  52. package/lib/packlets/qualifier-types/config/convert.js +67 -2
  53. package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
  54. package/lib/packlets/qualifier-types/config/json.js +11 -0
  55. package/lib/packlets/qualifier-types/convert.d.ts +1 -1
  56. package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
  57. package/lib/packlets/qualifier-types/helpers.js +2 -2
  58. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
  59. package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
  60. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
  61. package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
  62. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
  63. package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
  64. package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
  65. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
  66. package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
  67. package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
  68. package/lib/packlets/resource-json/compiled/convert.js +2 -1
  69. package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
  70. package/lib/packlets/resource-types/config/convert.d.ts +1 -1
  71. package/lib/packlets/resource-types/config/convert.js +3 -1
  72. package/lib/packlets/resource-types/config/json.d.ts +3 -1
  73. package/lib/packlets/resource-types/jsonResourceType.d.ts +14 -5
  74. package/lib/packlets/resource-types/jsonResourceType.js +8 -4
  75. package/lib/packlets/resource-types/resourceType.d.ts +115 -14
  76. package/lib/packlets/resource-types/resourceType.js +39 -3
  77. package/lib/packlets/resources/candidateReducer.js +3 -0
  78. package/lib/packlets/resources/candidateValue.d.ts +92 -0
  79. package/lib/packlets/resources/candidateValue.js +128 -0
  80. package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
  81. package/lib/packlets/resources/candidateValueCollector.js +96 -0
  82. package/lib/packlets/resources/common.d.ts +26 -0
  83. package/lib/packlets/resources/index.d.ts +2 -0
  84. package/lib/packlets/resources/index.js +2 -0
  85. package/lib/packlets/resources/resource.d.ts +6 -6
  86. package/lib/packlets/resources/resource.js +5 -10
  87. package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
  88. package/lib/packlets/resources/resourceBuilder.js +4 -1
  89. package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
  90. package/lib/packlets/resources/resourceCandidate.js +17 -5
  91. package/lib/packlets/resources/resourceManagerBuilder.d.ts +189 -11
  92. package/lib/packlets/resources/resourceManagerBuilder.js +481 -17
  93. package/lib/packlets/runtime/cacheListener.d.ts +9 -0
  94. package/lib/packlets/runtime/cacheListener.js +6 -0
  95. package/lib/packlets/runtime/cacheMetrics.d.ts +6 -0
  96. package/lib/packlets/runtime/cacheMetrics.js +11 -0
  97. package/lib/packlets/runtime/compiledResourceCollection.d.ts +23 -11
  98. package/lib/packlets/runtime/compiledResourceCollection.js +65 -28
  99. package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
  100. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
  101. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
  102. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
  103. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
  104. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
  105. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
  106. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
  107. package/lib/packlets/runtime/iResourceManager.d.ts +13 -5
  108. package/lib/packlets/runtime/index.d.ts +1 -0
  109. package/lib/packlets/runtime/index.js +1 -0
  110. package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
  111. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
  112. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
  113. package/lib/packlets/runtime/resourceResolver.d.ts +60 -1
  114. package/lib/packlets/runtime/resourceResolver.js +89 -45
  115. package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
  116. package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
  117. package/lib/packlets/runtime/validate.js +1 -0
  118. package/lib/packlets/zip-archive/convert.d.ts +52 -0
  119. package/lib/packlets/zip-archive/convert.js +103 -0
  120. package/lib/packlets/zip-archive/index.d.ts +23 -0
  121. package/lib/packlets/zip-archive/index.js +95 -0
  122. package/lib/packlets/zip-archive/json.d.ts +64 -0
  123. package/lib/packlets/zip-archive/json.js +24 -0
  124. package/lib/packlets/zip-archive/types.d.ts +98 -0
  125. package/lib/packlets/zip-archive/types.js +39 -0
  126. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
  127. package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
  128. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
  129. package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
  130. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
  131. package/lib/packlets/zip-archive/zipArchiveLoader.js +285 -0
  132. package/package.json +26 -32
  133. package/CLAUDE.md +0 -186
  134. package/EXAMPLE_INIT_PARAMS.md +0 -88
  135. package/PROGRESS_SUMMARY.md +0 -48
  136. package/lib/index.d.ts.map +0 -1
  137. package/lib/index.js.map +0 -1
  138. package/lib/packlets/common/conditions.d.ts.map +0 -1
  139. package/lib/packlets/common/conditions.js.map +0 -1
  140. package/lib/packlets/common/convert.d.ts.map +0 -1
  141. package/lib/packlets/common/convert.js.map +0 -1
  142. package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
  143. package/lib/packlets/common/helpers/conditions.js.map +0 -1
  144. package/lib/packlets/common/helpers/context.d.ts.map +0 -1
  145. package/lib/packlets/common/helpers/context.js.map +0 -1
  146. package/lib/packlets/common/helpers/index.d.ts.map +0 -1
  147. package/lib/packlets/common/helpers/index.js.map +0 -1
  148. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
  149. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
  150. package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
  151. package/lib/packlets/common/helpers/resources.js.map +0 -1
  152. package/lib/packlets/common/index.d.ts.map +0 -1
  153. package/lib/packlets/common/index.js.map +0 -1
  154. package/lib/packlets/common/resources.d.ts.map +0 -1
  155. package/lib/packlets/common/resources.js.map +0 -1
  156. package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
  157. package/lib/packlets/common/validate/conditions.js.map +0 -1
  158. package/lib/packlets/common/validate/index.d.ts.map +0 -1
  159. package/lib/packlets/common/validate/index.js.map +0 -1
  160. package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
  161. package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
  162. package/lib/packlets/common/validate/resources.d.ts.map +0 -1
  163. package/lib/packlets/common/validate/resources.js.map +0 -1
  164. package/lib/packlets/conditions/condition.d.ts.map +0 -1
  165. package/lib/packlets/conditions/condition.js.map +0 -1
  166. package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
  167. package/lib/packlets/conditions/conditionCollector.js.map +0 -1
  168. package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
  169. package/lib/packlets/conditions/conditionDecls.js.map +0 -1
  170. package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
  171. package/lib/packlets/conditions/conditionSet.js.map +0 -1
  172. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
  173. package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
  174. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
  175. package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
  176. package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
  177. package/lib/packlets/conditions/conditionToken.js.map +0 -1
  178. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
  179. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
  180. package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
  181. package/lib/packlets/conditions/convert/decls.js.map +0 -1
  182. package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
  183. package/lib/packlets/conditions/convert/index.js.map +0 -1
  184. package/lib/packlets/conditions/index.d.ts.map +0 -1
  185. package/lib/packlets/conditions/index.js.map +0 -1
  186. package/lib/packlets/config/common.d.ts.map +0 -1
  187. package/lib/packlets/config/common.js.map +0 -1
  188. package/lib/packlets/config/convert.d.ts.map +0 -1
  189. package/lib/packlets/config/convert.js.map +0 -1
  190. package/lib/packlets/config/index.d.ts.map +0 -1
  191. package/lib/packlets/config/index.js.map +0 -1
  192. package/lib/packlets/config/json.d.ts.map +0 -1
  193. package/lib/packlets/config/json.js.map +0 -1
  194. package/lib/packlets/config/predefined/default.d.ts.map +0 -1
  195. package/lib/packlets/config/predefined/default.js.map +0 -1
  196. package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
  197. package/lib/packlets/config/predefined/extended.js.map +0 -1
  198. package/lib/packlets/config/predefined/index.d.ts.map +0 -1
  199. package/lib/packlets/config/predefined/index.js.map +0 -1
  200. package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
  201. package/lib/packlets/config/systemConfiguration.js.map +0 -1
  202. package/lib/packlets/context/contextDecls.d.ts.map +0 -1
  203. package/lib/packlets/context/contextDecls.js.map +0 -1
  204. package/lib/packlets/context/contextToken.d.ts.map +0 -1
  205. package/lib/packlets/context/contextToken.js.map +0 -1
  206. package/lib/packlets/context/convert/decls.d.ts.map +0 -1
  207. package/lib/packlets/context/convert/decls.js.map +0 -1
  208. package/lib/packlets/context/convert/index.d.ts.map +0 -1
  209. package/lib/packlets/context/convert/index.js.map +0 -1
  210. package/lib/packlets/context/index.d.ts.map +0 -1
  211. package/lib/packlets/context/index.js.map +0 -1
  212. package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
  213. package/lib/packlets/decisions/abstractDecision.js.map +0 -1
  214. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
  215. package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
  216. package/lib/packlets/decisions/candidate.d.ts.map +0 -1
  217. package/lib/packlets/decisions/candidate.js.map +0 -1
  218. package/lib/packlets/decisions/common.d.ts.map +0 -1
  219. package/lib/packlets/decisions/common.js.map +0 -1
  220. package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
  221. package/lib/packlets/decisions/concreteDecision.js.map +0 -1
  222. package/lib/packlets/decisions/decision.d.ts.map +0 -1
  223. package/lib/packlets/decisions/decision.js.map +0 -1
  224. package/lib/packlets/decisions/index.d.ts.map +0 -1
  225. package/lib/packlets/decisions/index.js.map +0 -1
  226. package/lib/packlets/import/fsItem.d.ts.map +0 -1
  227. package/lib/packlets/import/fsItem.js.map +0 -1
  228. package/lib/packlets/import/importContext.d.ts.map +0 -1
  229. package/lib/packlets/import/importContext.js.map +0 -1
  230. package/lib/packlets/import/importManager.d.ts.map +0 -1
  231. package/lib/packlets/import/importManager.js.map +0 -1
  232. package/lib/packlets/import/importable.d.ts.map +0 -1
  233. package/lib/packlets/import/importable.js.map +0 -1
  234. package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
  235. package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
  236. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
  237. package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
  238. package/lib/packlets/import/importers/importer.d.ts.map +0 -1
  239. package/lib/packlets/import/importers/importer.js.map +0 -1
  240. package/lib/packlets/import/importers/index.d.ts.map +0 -1
  241. package/lib/packlets/import/importers/index.js.map +0 -1
  242. package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
  243. package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
  244. package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
  245. package/lib/packlets/import/importers/pathImporter.js.map +0 -1
  246. package/lib/packlets/import/index.d.ts.map +0 -1
  247. package/lib/packlets/import/index.js.map +0 -1
  248. package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
  249. package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
  250. package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
  251. package/lib/packlets/qualifier-types/config/index.js.map +0 -1
  252. package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
  253. package/lib/packlets/qualifier-types/config/json.js.map +0 -1
  254. package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
  255. package/lib/packlets/qualifier-types/convert.js.map +0 -1
  256. package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
  257. package/lib/packlets/qualifier-types/helpers.js.map +0 -1
  258. package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
  259. package/lib/packlets/qualifier-types/index.js.map +0 -1
  260. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
  261. package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
  262. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
  263. package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
  264. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
  265. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
  266. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
  267. package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
  268. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
  269. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
  270. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
  271. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
  272. package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
  273. package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
  274. package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
  275. package/lib/packlets/qualifiers/convert/index.js.map +0 -1
  276. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
  277. package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
  278. package/lib/packlets/qualifiers/index.d.ts.map +0 -1
  279. package/lib/packlets/qualifiers/index.js.map +0 -1
  280. package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
  281. package/lib/packlets/qualifiers/qualifier.js.map +0 -1
  282. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
  283. package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
  284. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
  285. package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
  286. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
  287. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
  288. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
  289. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
  290. package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
  291. package/lib/packlets/resource-json/compiled/common.js.map +0 -1
  292. package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
  293. package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
  294. package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
  295. package/lib/packlets/resource-json/compiled/index.js.map +0 -1
  296. package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
  297. package/lib/packlets/resource-json/compiled/json.js.map +0 -1
  298. package/lib/packlets/resource-json/convert.d.ts.map +0 -1
  299. package/lib/packlets/resource-json/convert.js.map +0 -1
  300. package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
  301. package/lib/packlets/resource-json/helpers.js.map +0 -1
  302. package/lib/packlets/resource-json/index.d.ts.map +0 -1
  303. package/lib/packlets/resource-json/index.js.map +0 -1
  304. package/lib/packlets/resource-json/json.d.ts.map +0 -1
  305. package/lib/packlets/resource-json/json.js.map +0 -1
  306. package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
  307. package/lib/packlets/resource-json/normalized.js.map +0 -1
  308. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
  309. package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
  310. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
  311. package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
  312. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
  313. package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
  314. package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
  315. package/lib/packlets/resource-types/config/convert.js.map +0 -1
  316. package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
  317. package/lib/packlets/resource-types/config/index.js.map +0 -1
  318. package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
  319. package/lib/packlets/resource-types/config/json.js.map +0 -1
  320. package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
  321. package/lib/packlets/resource-types/helpers.js.map +0 -1
  322. package/lib/packlets/resource-types/index.d.ts.map +0 -1
  323. package/lib/packlets/resource-types/index.js.map +0 -1
  324. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
  325. package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
  326. package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
  327. package/lib/packlets/resource-types/resourceType.js.map +0 -1
  328. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
  329. package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
  330. package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
  331. package/lib/packlets/resources/candidateReducer.js.map +0 -1
  332. package/lib/packlets/resources/common.d.ts.map +0 -1
  333. package/lib/packlets/resources/common.js.map +0 -1
  334. package/lib/packlets/resources/index.d.ts.map +0 -1
  335. package/lib/packlets/resources/index.js.map +0 -1
  336. package/lib/packlets/resources/resource.d.ts.map +0 -1
  337. package/lib/packlets/resources/resource.js.map +0 -1
  338. package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
  339. package/lib/packlets/resources/resourceBuilder.js.map +0 -1
  340. package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
  341. package/lib/packlets/resources/resourceCandidate.js.map +0 -1
  342. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
  343. package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
  344. package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
  345. package/lib/packlets/runtime/cacheListener.js.map +0 -1
  346. package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
  347. package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
  348. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
  349. package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
  350. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
  351. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
  352. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
  353. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
  354. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
  355. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
  356. package/lib/packlets/runtime/context/index.d.ts.map +0 -1
  357. package/lib/packlets/runtime/context/index.js.map +0 -1
  358. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
  359. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
  360. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
  361. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
  362. package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
  363. package/lib/packlets/runtime/iResourceManager.js.map +0 -1
  364. package/lib/packlets/runtime/index.d.ts.map +0 -1
  365. package/lib/packlets/runtime/index.js.map +0 -1
  366. package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
  367. package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
  368. package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
  369. package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
  370. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
  371. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
  372. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
  373. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
  374. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
  375. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
  376. package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
  377. package/lib/packlets/runtime/resourceResolver.js.map +0 -1
  378. package/lib/packlets/runtime/validate.d.ts.map +0 -1
  379. package/lib/packlets/runtime/validate.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import { Brand } from '@fgv/ts-utils';
1
+ import { JsonValue } from '@fgv/ts-json-base';
2
+ import { Brand, Result } from '@fgv/ts-utils';
2
3
  /**
3
4
  * Branded string representing a validated resource id. A resource ID
4
5
  * is a dot-separated sequence of resource names.
@@ -38,4 +39,50 @@ export type ResourceValueMergeMethod = 'augment' | 'delete' | 'replace';
38
39
  * @public
39
40
  */
40
41
  export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
42
+ /**
43
+ * The completeness of a resource candidate value. A full value is one that
44
+ * contains all of the required properties for the resource type. A partial
45
+ * value is one that contains some of the required properties for the resource
46
+ * type.
47
+ * @public
48
+ */
49
+ export type CandidateCompleteness = 'full' | 'partial';
50
+ /**
51
+ * Branded number representing a validated candidate value index.
52
+ * Candidate value indices are used to identify candidate values
53
+ * within a resource set and to enable sharing of like values.
54
+ * @public
55
+ */
56
+ export type CandidateValueIndex = Brand<number, 'CandidateValueIndex'>;
57
+ /**
58
+ * Branded string representing a validated candidate value key.
59
+ * Candidate value keys are used to identify candidate values
60
+ * within a resource set and to enable sharing of like values.
61
+ * @public
62
+ */
63
+ export type CandidateValueKey = Brand<string, 'CandidateValueKey'>;
64
+ /**
65
+ * Minimal resource resolver
66
+ * @public
67
+ */
68
+ export interface IResourceResolver {
69
+ /**
70
+ * Resolves a resource to a composed value by merging matching candidates according to their merge methods.
71
+ * Starting from the highest priority candidates, finds the first "full" candidate and merges all higher
72
+ * priority "partial" candidates into it in ascending order of priority.
73
+ * @param resource - The string id of the resource to resolve.
74
+ * @returns `Success` with the composed JsonValue if successful,
75
+ * or `Failure` with an error message if no candidates match or resolution fails.
76
+ * @public
77
+ */
78
+ resolveComposedResourceValue(resource: string): Result<JsonValue>;
79
+ /**
80
+ * Creates a new {@link IResourceResolver | resource resolver} with the given context.
81
+ * @param context - The context to use for the new resource resolver.
82
+ * @returns `Success` with the new resource resolver if successful,
83
+ * or `Failure` with an error message if the context is invalid.
84
+ * @public
85
+ */
86
+ withContext(context: Record<string, string>): Result<IResourceResolver>;
87
+ }
41
88
  //# sourceMappingURL=resources.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ConditionPriority, QualifierName, QualifierTypeName, QualifierIndex, QualifierTypeIndex, ConditionIndex, ConditionSetIndex, QualifierMatchScore, ConditionKey, ConditionSetKey, DecisionKey, DecisionIndex, ConditionSetHash, ConditionOperator, ConditionToken, ConditionSetToken, ContextQualifierToken, ContextToken, QualifierDefaultValueToken, QualifierDefaultValuesToken } from '../conditions';
2
+ import { ConditionPriority, QualifierName, QualifierTypeName, QualifierIndex, QualifierTypeIndex, ConditionIndex, ConditionSetIndex, QualifierMatchScore, QualifierContextValue, ConditionKey, ConditionSetKey, DecisionKey, DecisionIndex, ConditionSetHash, ConditionOperator, ConditionToken, ConditionSetToken, ContextQualifierToken, ContextToken, QualifierDefaultValueToken, QualifierDefaultValuesToken } from '../conditions';
3
3
  /**
4
4
  * Determines whether a string is a valid qualifier name.
5
5
  * @param name - the string to validate
@@ -117,6 +117,14 @@ export declare function isValidDecisionKey(key: string): key is DecisionKey;
117
117
  * @public
118
118
  */
119
119
  export declare function isValidDecisionIndex(index: number): index is DecisionIndex;
120
+ /**
121
+ * Determines whether a string is a valid qualifier context value.
122
+ * For now, any non-empty string is considered a valid context value.
123
+ * @param value - the string to validate
124
+ * @returns true if the string is a valid qualifier context value, false otherwise.
125
+ * @public
126
+ */
127
+ export declare function isValidQualifierContextValue(value: string): value is QualifierContextValue;
120
128
  /**
121
129
  * Converts a string to a {@link QualifierName} if it is a valid qualifier name.
122
130
  * @param name - the string to convert
@@ -125,6 +133,14 @@ export declare function isValidDecisionIndex(index: number): index is DecisionIn
125
133
  * @public
126
134
  */
127
135
  export declare function toQualifierName(name: string): Result<QualifierName>;
136
+ /**
137
+ * Converts a string to a {@link QualifierContextValue} if it is a valid qualifier context value.
138
+ * @param value - the string to convert
139
+ * @returns `Success` with the converted {@link QualifierContextValue} if successful, or `Failure` with an
140
+ * error message if not.
141
+ * @public
142
+ */
143
+ export declare function toQualifierContextValue(value: string): Result<QualifierContextValue>;
128
144
  /**
129
145
  * Converts a number to a {@link QualifierIndex} if it is a valid qualifier index.
130
146
  * @param index - the number to convert
@@ -37,7 +37,9 @@ exports.isValidConditionSetToken = isValidConditionSetToken;
37
37
  exports.isValidConditionSetHash = isValidConditionSetHash;
38
38
  exports.isValidDecisionKey = isValidDecisionKey;
39
39
  exports.isValidDecisionIndex = isValidDecisionIndex;
40
+ exports.isValidQualifierContextValue = isValidQualifierContextValue;
40
41
  exports.toQualifierName = toQualifierName;
42
+ exports.toQualifierContextValue = toQualifierContextValue;
41
43
  exports.toQualifierIndex = toQualifierIndex;
42
44
  exports.toQualifierTypeName = toQualifierTypeName;
43
45
  exports.toQualifierTypeIndex = toQualifierTypeIndex;
@@ -182,6 +184,7 @@ function isValidConditionSetKey(key) {
182
184
  if (key === '') {
183
185
  return true;
184
186
  }
187
+ /* c8 ignore next 2 - edge case: condition set key validation rarely fails */
185
188
  // a condition set key is a `+` separated list of condition keys
186
189
  return key.split('+').every(isValidConditionKey);
187
190
  }
@@ -224,6 +227,16 @@ function isValidDecisionKey(key) {
224
227
  function isValidDecisionIndex(index) {
225
228
  return index >= 0;
226
229
  }
230
+ /**
231
+ * Determines whether a string is a valid qualifier context value.
232
+ * For now, any non-empty string is considered a valid context value.
233
+ * @param value - the string to validate
234
+ * @returns true if the string is a valid qualifier context value, false otherwise.
235
+ * @public
236
+ */
237
+ function isValidQualifierContextValue(value) {
238
+ return typeof value === 'string' && value.length > 0;
239
+ }
227
240
  /**
228
241
  * Converts a string to a {@link QualifierName} if it is a valid qualifier name.
229
242
  * @param name - the string to convert
@@ -234,10 +247,23 @@ function isValidDecisionIndex(index) {
234
247
  function toQualifierName(name) {
235
248
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
236
249
  if (!isValidQualifierName(name)) {
237
- return (0, ts_utils_1.fail)(`${name}: not a valid qualifier name`);
250
+ return (0, ts_utils_1.fail)(`${name}: invalid qualifier name`);
238
251
  }
239
252
  return (0, ts_utils_1.succeed)(name);
240
253
  }
254
+ /**
255
+ * Converts a string to a {@link QualifierContextValue} if it is a valid qualifier context value.
256
+ * @param value - the string to convert
257
+ * @returns `Success` with the converted {@link QualifierContextValue} if successful, or `Failure` with an
258
+ * error message if not.
259
+ * @public
260
+ */
261
+ function toQualifierContextValue(value) {
262
+ if (!isValidQualifierContextValue(value)) {
263
+ return (0, ts_utils_1.fail)(`${value}: invalid qualifier context value`);
264
+ }
265
+ return (0, ts_utils_1.succeed)(value);
266
+ }
241
267
  /**
242
268
  * Converts a number to a {@link QualifierIndex} if it is a valid qualifier index.
243
269
  * @param index - the number to convert
@@ -248,7 +274,7 @@ function toQualifierName(name) {
248
274
  function toQualifierIndex(index) {
249
275
  /* c8 ignore next 3 - coverage is having a bad day */
250
276
  if (!isValidQualifierIndex(index)) {
251
- return (0, ts_utils_1.fail)(`${index}: not a valid qualifier index`);
277
+ return (0, ts_utils_1.fail)(`${index}: invalid qualifier index`);
252
278
  }
253
279
  return (0, ts_utils_1.succeed)(index);
254
280
  }
@@ -262,7 +288,7 @@ function toQualifierIndex(index) {
262
288
  function toQualifierTypeName(name) {
263
289
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
264
290
  if (!isValidQualifierTypeName(name)) {
265
- return (0, ts_utils_1.fail)(`${name}: not a valid qualifier type name`);
291
+ return (0, ts_utils_1.fail)(`${name}: invalid qualifier type name`);
266
292
  }
267
293
  return (0, ts_utils_1.succeed)(name);
268
294
  }
@@ -276,7 +302,7 @@ function toQualifierTypeName(name) {
276
302
  function toQualifierTypeIndex(index) {
277
303
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
278
304
  if (!isValidQualifierTypeIndex(index)) {
279
- return (0, ts_utils_1.fail)(`${index}: not a valid qualifier type index`);
305
+ return (0, ts_utils_1.fail)(`${index}: invalid qualifier type index`);
280
306
  }
281
307
  return (0, ts_utils_1.succeed)(index);
282
308
  }
@@ -541,7 +567,7 @@ function isValidQualifierDefaultValuesToken(token) {
541
567
  function toQualifierDefaultValueToken(token) {
542
568
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
543
569
  if (!isValidQualifierDefaultValueToken(token)) {
544
- return (0, ts_utils_1.fail)(`${token}: not a valid qualifier default value token`);
570
+ return (0, ts_utils_1.fail)(`${token}: invalid qualifier default value token`);
545
571
  }
546
572
  return (0, ts_utils_1.succeed)(token);
547
573
  }
@@ -555,7 +581,7 @@ function toQualifierDefaultValueToken(token) {
555
581
  function toQualifierDefaultValuesToken(token) {
556
582
  /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
557
583
  if (!isValidQualifierDefaultValuesToken(token)) {
558
- return (0, ts_utils_1.fail)(`${token}: not a valid qualifier default values token`);
584
+ return (0, ts_utils_1.fail)(`${token}: invalid qualifier default values token`);
559
585
  }
560
586
  return (0, ts_utils_1.succeed)(token);
561
587
  }
@@ -38,6 +38,10 @@ export declare const conditionSetHash: RegExp;
38
38
  * @internal
39
39
  */
40
40
  export declare const decisionKey: RegExp;
41
+ /**
42
+ * @internal
43
+ */
44
+ export declare const candidateValueKey: RegExp;
41
45
  /**
42
46
  * A {@link QualifierDefaultValueToken | qualifier default value token} has the form
43
47
  * `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).
@@ -21,7 +21,7 @@
21
21
  * SOFTWARE.
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.territoryCode = exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.decisionKey = exports.conditionSetHash = exports.contextToken = exports.conditionToken = exports.conditionKey = exports.identifierList = exports.segmentedIdentifier = exports.identifier = void 0;
24
+ exports.territoryCode = exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.candidateValueKey = exports.decisionKey = exports.conditionSetHash = exports.contextToken = exports.conditionToken = exports.conditionKey = exports.identifierList = exports.segmentedIdentifier = exports.identifier = void 0;
25
25
  /**
26
26
  * @internal
27
27
  */
@@ -62,6 +62,10 @@ exports.conditionSetHash = /^[a-zA-Z0-9]{8}$/;
62
62
  * @internal
63
63
  */
64
64
  exports.decisionKey = /^[a-zA-Z0-9]{8}(?:\+[a-zA-Z0-9]{8})*(?:\|[a-zA-Z0-9]{8})?$/;
65
+ /**
66
+ * @internal
67
+ */
68
+ exports.candidateValueKey = /^[a-zA-Z0-9]+$/;
65
69
  /**
66
70
  * A {@link QualifierDefaultValueToken | qualifier default value token} has the form
67
71
  * `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).
@@ -1,5 +1,5 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ResourceId, ResourceIndex, ResourceName, ResourceTypeIndex, ResourceTypeName } from '../resources';
2
+ import { CandidateValueIndex, CandidateValueKey, ResourceId, ResourceIndex, ResourceName, ResourceTypeIndex, ResourceTypeName } from '../resources';
3
3
  /**
4
4
  * Checks if the given name is a valid resource name.
5
5
  *
@@ -40,6 +40,22 @@ export declare function isValidResourceTypeName(name: string): name is ResourceT
40
40
  * @public
41
41
  */
42
42
  export declare function isValidResourceTypeIndex(index: number): index is ResourceTypeIndex;
43
+ /**
44
+ * Checks if the given index is a valid candidate value index.
45
+ *
46
+ * @param index - The index to validate.
47
+ * @returns `true` if the index is a valid candidate value index, otherwise `false`.
48
+ * @public
49
+ */
50
+ export declare function isValidCandidateValueIndex(index: number): index is CandidateValueIndex;
51
+ /**
52
+ * Checks if the given key is a valid candidate value key.
53
+ *
54
+ * @param key - The key to validate.
55
+ * @returns `true` if the key is a valid candidate value key, otherwise `false`.
56
+ * @public
57
+ */
58
+ export declare function isValidCandidateValueKey(key: string): key is CandidateValueKey;
43
59
  /**
44
60
  * Converts a string to a {@link ResourceName | resource name}.
45
61
  *
@@ -94,4 +110,22 @@ export declare function toResourceTypeName(name: string): Result<ResourceTypeNam
94
110
  * @public
95
111
  */
96
112
  export declare function toResourceTypeIndex(index: number): Result<ResourceTypeIndex>;
113
+ /**
114
+ * Converts a string to a {@link CandidateValueKey | candidate value key}.
115
+ *
116
+ * @param key - The key to convert.
117
+ * @returns `Success` with the converted key if valid, or `Failure` with an error message
118
+ * if not.
119
+ * @public
120
+ */
121
+ export declare function toCandidateValueKey(key: string): Result<CandidateValueKey>;
122
+ /**
123
+ * Converts a number to a {@link CandidateValueIndex | candidate value index}.
124
+ *
125
+ * @param index - The number to convert.
126
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
127
+ * if not.
128
+ * @public
129
+ */
130
+ export declare function toCandidateValueIndex(index: number): Result<CandidateValueIndex>;
97
131
  //# sourceMappingURL=resources.d.ts.map
@@ -26,12 +26,16 @@ exports.isValidResourceId = isValidResourceId;
26
26
  exports.isValidResourceIndex = isValidResourceIndex;
27
27
  exports.isValidResourceTypeName = isValidResourceTypeName;
28
28
  exports.isValidResourceTypeIndex = isValidResourceTypeIndex;
29
+ exports.isValidCandidateValueIndex = isValidCandidateValueIndex;
30
+ exports.isValidCandidateValueKey = isValidCandidateValueKey;
29
31
  exports.toResourceName = toResourceName;
30
32
  exports.toResourceId = toResourceId;
31
33
  exports.toOptionalResourceId = toOptionalResourceId;
32
34
  exports.toResourceIndex = toResourceIndex;
33
35
  exports.toResourceTypeName = toResourceTypeName;
34
36
  exports.toResourceTypeIndex = toResourceTypeIndex;
37
+ exports.toCandidateValueKey = toCandidateValueKey;
38
+ exports.toCandidateValueIndex = toCandidateValueIndex;
35
39
  const ts_utils_1 = require("@fgv/ts-utils");
36
40
  const regularExpressions_1 = require("./regularExpressions");
37
41
  /**
@@ -84,6 +88,26 @@ function isValidResourceTypeName(name) {
84
88
  function isValidResourceTypeIndex(index) {
85
89
  return index >= 0;
86
90
  }
91
+ /**
92
+ * Checks if the given index is a valid candidate value index.
93
+ *
94
+ * @param index - The index to validate.
95
+ * @returns `true` if the index is a valid candidate value index, otherwise `false`.
96
+ * @public
97
+ */
98
+ function isValidCandidateValueIndex(index) {
99
+ return index >= 0;
100
+ }
101
+ /**
102
+ * Checks if the given key is a valid candidate value key.
103
+ *
104
+ * @param key - The key to validate.
105
+ * @returns `true` if the key is a valid candidate value key, otherwise `false`.
106
+ * @public
107
+ */
108
+ function isValidCandidateValueKey(key) {
109
+ return regularExpressions_1.candidateValueKey.test(key);
110
+ }
87
111
  /**
88
112
  * Converts a string to a {@link ResourceName | resource name}.
89
113
  *
@@ -108,6 +132,7 @@ function toResourceName(name) {
108
132
  * @public
109
133
  */
110
134
  function toResourceId(id) {
135
+ /* c8 ignore next 3 - defensive coding: resource ID validation should prevent invalid IDs */
111
136
  if (!isValidResourceId(id)) {
112
137
  return (0, ts_utils_1.fail)(`${id}: not a valid resource ID.`);
113
138
  }
@@ -168,4 +193,34 @@ function toResourceTypeIndex(index) {
168
193
  }
169
194
  return (0, ts_utils_1.succeed)(index);
170
195
  }
196
+ /**
197
+ * Converts a string to a {@link CandidateValueKey | candidate value key}.
198
+ *
199
+ * @param key - The key to convert.
200
+ * @returns `Success` with the converted key if valid, or `Failure` with an error message
201
+ * if not.
202
+ * @public
203
+ */
204
+ function toCandidateValueKey(key) {
205
+ /* c8 ignore next 3 - coverage having issues */
206
+ if (!isValidCandidateValueKey(key)) {
207
+ return (0, ts_utils_1.fail)(`${key}: not a valid candidate value key.`);
208
+ }
209
+ return (0, ts_utils_1.succeed)(key);
210
+ }
211
+ /**
212
+ * Converts a number to a {@link CandidateValueIndex | candidate value index}.
213
+ *
214
+ * @param index - The number to convert.
215
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
216
+ * if not.
217
+ * @public
218
+ */
219
+ function toCandidateValueIndex(index) {
220
+ /* c8 ignore next 3 - coverage having issues */
221
+ if (!isValidCandidateValueIndex(index)) {
222
+ return (0, ts_utils_1.fail)(`${index}: not a valid candidate value index.`);
223
+ }
224
+ return (0, ts_utils_1.succeed)(index);
225
+ }
171
226
  //# sourceMappingURL=resources.js.map
@@ -43,6 +43,7 @@ class Condition {
43
43
  */
44
44
  constructor({ qualifier, value, operator, priority, scoreAsDefault, index }) {
45
45
  if (scoreAsDefault === undefined && qualifier.defaultValue !== undefined) {
46
+ /* c8 ignore next 4 - edge case: default value matching logic rarely triggered */
46
47
  const defaultMatch = qualifier.type.matches(value, qualifier.defaultValue, 'matches');
47
48
  if (defaultMatch !== common_1.NoMatch) {
48
49
  scoreAsDefault = defaultMatch;
@@ -2,6 +2,7 @@ import { Collections, Result } from '@fgv/ts-utils';
2
2
  import { Condition } from './condition';
3
3
  import { ConditionSetIndex, ConditionSetKey, QualifierName } from '../common';
4
4
  import { IValidatedConditionSetDecl } from './conditionSetDecls';
5
+ import { ConditionCollector } from './conditionCollector';
5
6
  import * as ResourceJson from '../resource-json';
6
7
  import * as Context from '../context';
7
8
  /**
@@ -93,6 +94,14 @@ export declare class ConditionSet implements IValidatedConditionSetDecl {
93
94
  * @public
94
95
  */
95
96
  static getKeyForDecl(decl: IValidatedConditionSetDecl): Result<ConditionSetKey>;
97
+ /**
98
+ * Gets a condition set key from a loose condition set declaration.
99
+ * @param conditionSet - The loose condition set declaration to convert.
100
+ * @param conditionCollector - The condition collector used for validation.
101
+ * @returns `Success` with the condition set key if successful, `Failure` otherwise.
102
+ * @public
103
+ */
104
+ static getKeyFromLooseDecl(conditionSet: ResourceJson.Json.ConditionSetDecl | undefined, conditionCollector: ConditionCollector): Result<ConditionSetKey>;
96
105
  /**
97
106
  * Gets a {@link ConditionSetToken | condition set token} for this condition set,
98
107
  * if possible.
@@ -20,11 +20,45 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
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
+ })();
23
56
  Object.defineProperty(exports, "__esModule", { value: true });
24
57
  exports.ConditionSet = void 0;
25
58
  const ts_utils_1 = require("@fgv/ts-utils");
26
59
  const condition_1 = require("./condition");
27
60
  const common_1 = require("../common");
61
+ const ConditionsConvert = __importStar(require("./convert"));
28
62
  /**
29
63
  * Represents a set of {@link Conditions.Condition | conditions} that must all be met in some runtime
30
64
  * context for a resource instance to be valid.
@@ -129,6 +163,44 @@ class ConditionSet {
129
163
  static getKeyForDecl(decl) {
130
164
  return common_1.Validate.toConditionSetKey(decl.conditions.map((c) => c.toKey()).join('+'));
131
165
  }
166
+ /**
167
+ * Gets a condition set key from a loose condition set declaration.
168
+ * @param conditionSet - The loose condition set declaration to convert.
169
+ * @param conditionCollector - The condition collector used for validation.
170
+ * @returns `Success` with the condition set key if successful, `Failure` otherwise.
171
+ * @public
172
+ */
173
+ static getKeyFromLooseDecl(conditionSet, conditionCollector) {
174
+ if (!conditionSet) {
175
+ return (0, ts_utils_1.succeed)(ConditionSet.UnconditionalKey);
176
+ }
177
+ // Convert ConditionSetDecl to IConditionSetDecl format
178
+ let conditionSetDecl;
179
+ if (Array.isArray(conditionSet)) {
180
+ // ConditionSetDeclAsArray: array of ILooseConditionDecl
181
+ conditionSetDecl = { conditions: conditionSet };
182
+ }
183
+ else {
184
+ // ConditionSetDeclAsRecord: Record<string, string | IChildConditionDecl>
185
+ const conditions = Object.entries(conditionSet).map(([qualifierName, value]) => {
186
+ if (typeof value === 'string') {
187
+ return { qualifierName, value };
188
+ }
189
+ else {
190
+ /* c8 ignore next 1 - edge case: object spread pattern rarely used */
191
+ return Object.assign({ qualifierName }, value);
192
+ }
193
+ });
194
+ conditionSetDecl = { conditions };
195
+ }
196
+ // Validate and convert to IValidatedConditionSetDecl
197
+ return ConditionsConvert.validatedConditionSetDecl
198
+ .convert(conditionSetDecl, { conditions: conditionCollector })
199
+ .onSuccess((validatedDecl) => {
200
+ // Use proper ConditionSet.getKeyForDecl method to generate the key
201
+ return ConditionSet.getKeyForDecl(validatedDecl);
202
+ });
203
+ }
132
204
  /**
133
205
  * Gets a {@link ConditionSetToken | condition set token} for this condition set,
134
206
  * if possible.
@@ -174,7 +246,8 @@ class ConditionSet {
174
246
  toConditionSetRecordDecl(options) {
175
247
  const qualifiersToReduce = options === null || options === void 0 ? void 0 : options.qualifiersToReduce;
176
248
  const conditions = qualifiersToReduce
177
- ? this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))
249
+ ? /* c8 ignore next 1 - coverage intermittently misses the next line */
250
+ this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))
178
251
  : this.conditions;
179
252
  return Object.fromEntries(conditions.map((c) => {
180
253
  return [c.qualifier.name, c.toValueOrChildConditionDecl(options)];
@@ -186,6 +259,7 @@ class ConditionSet {
186
259
  * @returns The {@link ResourceJson.Json.ConditionSetDeclAsArray | condition set declaration as an array} for this condition set.
187
260
  */
188
261
  toConditionSetArrayDecl(options) {
262
+ /* c8 ignore next 1 - defense in depth */
189
263
  const qualifiersToReduce = options === null || options === void 0 ? void 0 : options.qualifiersToReduce;
190
264
  const conditions = qualifiersToReduce
191
265
  ? this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))