@fgv/ts-res 5.1.0-2 → 5.1.0-21

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 (571) hide show
  1. package/dist/index.browser.js.map +1 -0
  2. package/dist/index.js.map +1 -0
  3. package/dist/packlets/bundle/bundleBuilder.js.map +1 -0
  4. package/dist/packlets/bundle/bundleLoader.js.map +1 -0
  5. package/dist/packlets/bundle/bundleNormalizer.js.map +1 -0
  6. package/dist/packlets/bundle/bundleUtils.js.map +1 -0
  7. package/dist/packlets/bundle/convert.js.map +1 -0
  8. package/dist/packlets/bundle/index.js.map +1 -0
  9. package/dist/packlets/bundle/model.js.map +1 -0
  10. package/dist/packlets/common/conditions.js.map +1 -0
  11. package/dist/packlets/common/convert.js.map +1 -0
  12. package/dist/packlets/common/helpers/conditions.js.map +1 -0
  13. package/dist/packlets/common/helpers/context.js.map +1 -0
  14. package/dist/packlets/common/helpers/index.js.map +1 -0
  15. package/dist/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  16. package/dist/packlets/common/helpers/resources.js +2 -4
  17. package/dist/packlets/common/helpers/resources.js.map +1 -0
  18. package/dist/packlets/common/index.js.map +1 -0
  19. package/dist/packlets/common/resources.js.map +1 -0
  20. package/dist/packlets/common/validate/conditions.js +4 -4
  21. package/dist/packlets/common/validate/conditions.js.map +1 -0
  22. package/dist/packlets/common/validate/index.js.map +1 -0
  23. package/dist/packlets/common/validate/regularExpressions.js +2 -2
  24. package/dist/packlets/common/validate/regularExpressions.js.map +1 -0
  25. package/dist/packlets/common/validate/resources.js +1 -1
  26. package/dist/packlets/common/validate/resources.js.map +1 -0
  27. package/dist/packlets/conditions/condition.js +3 -7
  28. package/dist/packlets/conditions/condition.js.map +1 -0
  29. package/dist/packlets/conditions/conditionCollector.js.map +1 -0
  30. package/dist/packlets/conditions/conditionDecls.js.map +1 -0
  31. package/dist/packlets/conditions/conditionSet.js.map +1 -0
  32. package/dist/packlets/conditions/conditionSetCollector.js.map +1 -0
  33. package/dist/packlets/conditions/conditionSetDecls.js.map +1 -0
  34. package/dist/packlets/conditions/conditionToken.js.map +1 -0
  35. package/dist/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  36. package/dist/packlets/conditions/convert/decls.js.map +1 -0
  37. package/dist/packlets/conditions/convert/index.js.map +1 -0
  38. package/dist/packlets/conditions/index.js.map +1 -0
  39. package/dist/packlets/config/common.js +78 -0
  40. package/dist/packlets/config/common.js.map +1 -0
  41. package/dist/packlets/config/configInitFactory.js +258 -0
  42. package/dist/packlets/config/configInitFactory.js.map +1 -0
  43. package/dist/packlets/config/convert.js +56 -0
  44. package/dist/packlets/config/convert.js.map +1 -0
  45. package/dist/packlets/config/index.browser.js +34 -0
  46. package/dist/packlets/config/index.browser.js.map +1 -0
  47. package/dist/packlets/config/index.js +28 -0
  48. package/dist/packlets/config/index.js.map +1 -0
  49. package/dist/packlets/config/json.js +23 -0
  50. package/dist/packlets/config/json.js.map +1 -0
  51. package/dist/packlets/config/predefined/default.js +138 -0
  52. package/dist/packlets/config/predefined/default.js.map +1 -0
  53. package/dist/packlets/config/predefined/extended.js +190 -0
  54. package/dist/packlets/config/predefined/extended.js.map +1 -0
  55. package/dist/packlets/config/predefined/index.js +25 -0
  56. package/dist/packlets/config/predefined/index.js.map +1 -0
  57. package/dist/packlets/config/systemConfiguration.js +147 -0
  58. package/dist/packlets/config/systemConfiguration.js.map +1 -0
  59. package/dist/packlets/context/contextDecls.js.map +1 -0
  60. package/dist/packlets/context/contextToken.js.map +1 -0
  61. package/dist/packlets/context/convert/decls.js.map +1 -0
  62. package/dist/packlets/context/convert/index.js.map +1 -0
  63. package/dist/packlets/context/index.js.map +1 -0
  64. package/dist/packlets/decisions/abstractDecision.js.map +1 -0
  65. package/dist/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  66. package/dist/packlets/decisions/candidate.js.map +1 -0
  67. package/dist/packlets/decisions/common.js.map +1 -0
  68. package/dist/packlets/decisions/concreteDecision.js.map +1 -0
  69. package/dist/packlets/decisions/decision.js +1 -1
  70. package/dist/packlets/decisions/decision.js.map +1 -0
  71. package/dist/packlets/decisions/index.js.map +1 -0
  72. package/dist/packlets/import/fsItem.js +1 -4
  73. package/dist/packlets/import/fsItem.js.map +1 -0
  74. package/dist/packlets/import/importContext.js +3 -3
  75. package/dist/packlets/import/importContext.js.map +1 -0
  76. package/dist/packlets/import/importManager.js +7 -3
  77. package/dist/packlets/import/importManager.js.map +1 -0
  78. package/dist/packlets/import/importable.js.map +1 -0
  79. package/dist/packlets/import/importers/collectionImporter.js +2 -2
  80. package/dist/packlets/import/importers/collectionImporter.js.map +1 -0
  81. package/dist/packlets/import/importers/fsItemImporter.js +30 -14
  82. package/dist/packlets/import/importers/fsItemImporter.js.map +1 -0
  83. package/dist/packlets/import/importers/importer.js.map +1 -0
  84. package/dist/packlets/import/importers/index.browser.js.map +1 -0
  85. package/dist/packlets/import/importers/index.js.map +1 -0
  86. package/dist/packlets/import/importers/jsonImporter.js +2 -2
  87. package/dist/packlets/import/importers/jsonImporter.js.map +1 -0
  88. package/dist/packlets/import/importers/pathImporter.js +1 -1
  89. package/dist/packlets/import/importers/pathImporter.js.map +1 -0
  90. package/dist/packlets/import/index.browser.js.map +1 -0
  91. package/dist/packlets/import/index.js.map +1 -0
  92. package/dist/packlets/qualifier-types/config/convert.js +124 -0
  93. package/dist/packlets/qualifier-types/config/convert.js.map +1 -0
  94. package/dist/packlets/qualifier-types/config/index.js +25 -0
  95. package/dist/packlets/qualifier-types/config/index.js.map +1 -0
  96. package/dist/packlets/qualifier-types/config/json.js +32 -0
  97. package/dist/packlets/qualifier-types/config/json.js.map +1 -0
  98. package/dist/packlets/qualifier-types/convert.js.map +1 -0
  99. package/dist/packlets/qualifier-types/helpers.js.map +1 -0
  100. package/dist/packlets/qualifier-types/index.js.map +1 -0
  101. package/dist/packlets/qualifier-types/languageQualifierType.js +6 -7
  102. package/dist/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  103. package/dist/packlets/qualifier-types/literalQualifierType.js +7 -10
  104. package/dist/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  105. package/dist/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  106. package/dist/packlets/qualifier-types/qualifierType.js +12 -13
  107. package/dist/packlets/qualifier-types/qualifierType.js.map +1 -0
  108. package/dist/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  109. package/dist/packlets/qualifier-types/territoryQualifierType.js +5 -5
  110. package/dist/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  111. package/dist/packlets/qualifiers/convert/decls.js.map +1 -0
  112. package/dist/packlets/qualifiers/convert/index.js.map +1 -0
  113. package/dist/packlets/qualifiers/convert/qualifier.js.map +1 -0
  114. package/dist/packlets/qualifiers/index.js.map +1 -0
  115. package/dist/packlets/qualifiers/qualifier.js +6 -7
  116. package/dist/packlets/qualifiers/qualifier.js.map +1 -0
  117. package/dist/packlets/qualifiers/qualifierCollector.js +2 -2
  118. package/dist/packlets/qualifiers/qualifierCollector.js.map +1 -0
  119. package/dist/packlets/qualifiers/qualifierDecl.js.map +1 -0
  120. package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  121. package/dist/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  122. package/dist/packlets/resource-json/compiled/common.js.map +1 -0
  123. package/dist/packlets/resource-json/compiled/convert.js.map +1 -0
  124. package/dist/packlets/resource-json/compiled/index.js.map +1 -0
  125. package/dist/packlets/resource-json/compiled/json.js.map +1 -0
  126. package/dist/packlets/resource-json/convert.js.map +1 -0
  127. package/dist/packlets/resource-json/helpers.js.map +1 -0
  128. package/dist/packlets/resource-json/index.js.map +1 -0
  129. package/dist/packlets/resource-json/json.js.map +1 -0
  130. package/dist/packlets/resource-json/normalized.js.map +1 -0
  131. package/dist/packlets/resource-json/resourceDeclCollection.js +1 -1
  132. package/dist/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  133. package/dist/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  134. package/dist/packlets/resource-json/resourceDeclTree.js +1 -1
  135. package/dist/packlets/resource-json/resourceDeclTree.js.map +1 -0
  136. package/dist/packlets/resource-types/config/convert.js +35 -0
  137. package/dist/packlets/resource-types/config/convert.js.map +1 -0
  138. package/dist/packlets/resource-types/config/index.js +25 -0
  139. package/dist/packlets/resource-types/config/index.js.map +1 -0
  140. package/dist/packlets/resource-types/config/json.js +23 -0
  141. package/dist/packlets/resource-types/config/json.js.map +1 -0
  142. package/dist/packlets/resource-types/helpers.js.map +1 -0
  143. package/dist/packlets/resource-types/index.js.map +1 -0
  144. package/dist/packlets/resource-types/jsonResourceType.js +2 -2
  145. package/dist/packlets/resource-types/jsonResourceType.js.map +1 -0
  146. package/dist/packlets/resource-types/resourceType.js +2 -2
  147. package/dist/packlets/resource-types/resourceType.js.map +1 -0
  148. package/dist/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  149. package/dist/packlets/resources/candidateReducer.js.map +1 -0
  150. package/dist/packlets/resources/candidateValue.js.map +1 -0
  151. package/dist/packlets/resources/candidateValueCollector.js.map +1 -0
  152. package/dist/packlets/resources/common.js.map +1 -0
  153. package/dist/packlets/resources/deltaGenerator.js.map +1 -0
  154. package/dist/packlets/resources/index.js.map +1 -0
  155. package/dist/packlets/resources/resource.js.map +1 -0
  156. package/dist/packlets/resources/resourceBuilder.js +2 -2
  157. package/dist/packlets/resources/resourceBuilder.js.map +1 -0
  158. package/dist/packlets/resources/resourceCandidate.js.map +1 -0
  159. package/dist/packlets/resources/resourceManagerBuilder.js +5 -5
  160. package/dist/packlets/resources/resourceManagerBuilder.js.map +1 -0
  161. package/dist/packlets/runtime/cacheListener.js.map +1 -0
  162. package/dist/packlets/runtime/cacheMetrics.js.map +1 -0
  163. package/dist/packlets/runtime/compiledResourceCollection.js +5 -5
  164. package/dist/packlets/runtime/compiledResourceCollection.js.map +1 -0
  165. package/dist/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  166. package/dist/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  167. package/dist/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  168. package/dist/packlets/runtime/context/index.js.map +1 -0
  169. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  170. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  171. package/dist/packlets/runtime/iResourceManager.js.map +1 -0
  172. package/dist/packlets/runtime/index.js.map +1 -0
  173. package/dist/packlets/runtime/resource-tree/common.js.map +1 -0
  174. package/dist/packlets/runtime/resource-tree/index.js.map +1 -0
  175. package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  176. package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  177. package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  178. package/dist/packlets/runtime/resourceResolver.js.map +1 -0
  179. package/dist/packlets/runtime/resourceTreeResolver.js.map +1 -0
  180. package/dist/packlets/runtime/validate.js.map +1 -0
  181. package/dist/packlets/zip-archive/convert.js.map +1 -0
  182. package/dist/packlets/zip-archive/index.browser.js.map +1 -0
  183. package/dist/packlets/zip-archive/index.js.map +1 -0
  184. package/dist/packlets/zip-archive/json.js.map +1 -0
  185. package/dist/packlets/zip-archive/types.js.map +1 -0
  186. package/dist/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  187. package/dist/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  188. package/dist/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  189. package/dist/ts-res.d.ts +134 -112
  190. package/dist/tsdoc-metadata.json +1 -1
  191. package/lib/index.browser.d.ts.map +1 -0
  192. package/lib/index.browser.js.map +1 -0
  193. package/lib/index.d.ts.map +1 -0
  194. package/lib/index.js.map +1 -0
  195. package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
  196. package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
  197. package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
  198. package/lib/packlets/bundle/bundleLoader.js.map +1 -0
  199. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
  200. package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
  201. package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
  202. package/lib/packlets/bundle/bundleUtils.js.map +1 -0
  203. package/lib/packlets/bundle/convert.d.ts.map +1 -0
  204. package/lib/packlets/bundle/convert.js.map +1 -0
  205. package/lib/packlets/bundle/index.d.ts.map +1 -0
  206. package/lib/packlets/bundle/index.js.map +1 -0
  207. package/lib/packlets/bundle/model.d.ts.map +1 -0
  208. package/lib/packlets/bundle/model.js.map +1 -0
  209. package/lib/packlets/common/conditions.d.ts.map +1 -0
  210. package/lib/packlets/common/conditions.js.map +1 -0
  211. package/lib/packlets/common/convert.d.ts.map +1 -0
  212. package/lib/packlets/common/convert.js.map +1 -0
  213. package/lib/packlets/common/helpers/conditions.d.ts.map +1 -0
  214. package/lib/packlets/common/helpers/conditions.js.map +1 -0
  215. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  216. package/lib/packlets/common/helpers/context.js.map +1 -0
  217. package/lib/packlets/common/helpers/index.d.ts.map +1 -0
  218. package/lib/packlets/common/helpers/index.js.map +1 -0
  219. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  220. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  221. package/lib/packlets/common/helpers/resources.d.ts +2 -4
  222. package/lib/packlets/common/helpers/resources.d.ts.map +1 -0
  223. package/lib/packlets/common/helpers/resources.js +2 -4
  224. package/lib/packlets/common/helpers/resources.js.map +1 -0
  225. package/lib/packlets/common/index.d.ts.map +1 -0
  226. package/lib/packlets/common/index.js.map +1 -0
  227. package/lib/packlets/common/resources.d.ts.map +1 -0
  228. package/lib/packlets/common/resources.js.map +1 -0
  229. package/lib/packlets/common/validate/conditions.d.ts +4 -4
  230. package/lib/packlets/common/validate/conditions.d.ts.map +1 -0
  231. package/lib/packlets/common/validate/conditions.js +4 -4
  232. package/lib/packlets/common/validate/conditions.js.map +1 -0
  233. package/lib/packlets/common/validate/index.d.ts.map +1 -0
  234. package/lib/packlets/common/validate/index.js.map +1 -0
  235. package/lib/packlets/common/validate/regularExpressions.d.ts +2 -2
  236. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -0
  237. package/lib/packlets/common/validate/regularExpressions.js +2 -2
  238. package/lib/packlets/common/validate/regularExpressions.js.map +1 -0
  239. package/lib/packlets/common/validate/resources.d.ts +1 -1
  240. package/lib/packlets/common/validate/resources.d.ts.map +1 -0
  241. package/lib/packlets/common/validate/resources.js +1 -1
  242. package/lib/packlets/common/validate/resources.js.map +1 -0
  243. package/lib/packlets/conditions/condition.d.ts +3 -7
  244. package/lib/packlets/conditions/condition.d.ts.map +1 -0
  245. package/lib/packlets/conditions/condition.js +3 -7
  246. package/lib/packlets/conditions/condition.js.map +1 -0
  247. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -0
  248. package/lib/packlets/conditions/conditionCollector.js.map +1 -0
  249. package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -0
  250. package/lib/packlets/conditions/conditionDecls.js.map +1 -0
  251. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -0
  252. package/lib/packlets/conditions/conditionSet.js.map +1 -0
  253. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -0
  254. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -0
  255. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -0
  256. package/lib/packlets/conditions/conditionSetDecls.js.map +1 -0
  257. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -0
  258. package/lib/packlets/conditions/conditionToken.js.map +1 -0
  259. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -0
  260. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  261. package/lib/packlets/conditions/convert/decls.d.ts.map +1 -0
  262. package/lib/packlets/conditions/convert/decls.js.map +1 -0
  263. package/lib/packlets/conditions/convert/index.d.ts.map +1 -0
  264. package/lib/packlets/conditions/convert/index.js.map +1 -0
  265. package/lib/packlets/conditions/index.d.ts.map +1 -0
  266. package/lib/packlets/conditions/index.js.map +1 -0
  267. package/lib/packlets/config/common.d.ts +35 -0
  268. package/lib/packlets/config/common.d.ts.map +1 -0
  269. package/lib/packlets/config/common.js +97 -0
  270. package/lib/packlets/config/common.js.map +1 -0
  271. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  272. package/lib/packlets/config/configInitFactory.d.ts.map +1 -0
  273. package/lib/packlets/config/configInitFactory.js +303 -0
  274. package/lib/packlets/config/configInitFactory.js.map +1 -0
  275. package/lib/packlets/config/convert.d.ts +23 -0
  276. package/lib/packlets/config/convert.d.ts.map +1 -0
  277. package/lib/packlets/config/convert.js +93 -0
  278. package/lib/packlets/config/convert.js.map +1 -0
  279. package/lib/packlets/config/index.browser.d.ts +7 -0
  280. package/lib/packlets/config/index.browser.d.ts.map +1 -0
  281. package/lib/packlets/config/index.browser.js +74 -0
  282. package/lib/packlets/config/index.browser.js.map +1 -0
  283. package/lib/packlets/config/index.d.ts +7 -0
  284. package/lib/packlets/config/index.d.ts.map +1 -0
  285. package/lib/packlets/config/index.js +68 -0
  286. package/lib/packlets/config/index.js.map +1 -0
  287. package/lib/packlets/config/json.d.ts +20 -0
  288. package/lib/packlets/config/json.d.ts.map +1 -0
  289. package/lib/packlets/config/json.js +24 -0
  290. package/lib/packlets/config/json.js.map +1 -0
  291. package/lib/packlets/config/predefined/default.d.ts +57 -0
  292. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  293. package/lib/packlets/config/predefined/default.js +141 -0
  294. package/lib/packlets/config/predefined/default.js.map +1 -0
  295. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  296. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  297. package/lib/packlets/config/predefined/extended.js +193 -0
  298. package/lib/packlets/config/predefined/extended.js.map +1 -0
  299. package/lib/packlets/config/predefined/index.d.ts +4 -0
  300. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  301. package/lib/packlets/config/predefined/index.js +62 -0
  302. package/lib/packlets/config/predefined/index.js.map +1 -0
  303. package/lib/packlets/config/systemConfiguration.d.ts +94 -0
  304. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  305. package/lib/packlets/config/systemConfiguration.js +152 -0
  306. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  307. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  308. package/lib/packlets/context/contextDecls.js.map +1 -0
  309. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  310. package/lib/packlets/context/contextToken.js.map +1 -0
  311. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  312. package/lib/packlets/context/convert/decls.js.map +1 -0
  313. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  314. package/lib/packlets/context/convert/index.js.map +1 -0
  315. package/lib/packlets/context/index.d.ts.map +1 -0
  316. package/lib/packlets/context/index.js.map +1 -0
  317. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -0
  318. package/lib/packlets/decisions/abstractDecision.js.map +1 -0
  319. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -0
  320. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  321. package/lib/packlets/decisions/candidate.d.ts.map +1 -0
  322. package/lib/packlets/decisions/candidate.js.map +1 -0
  323. package/lib/packlets/decisions/common.d.ts.map +1 -0
  324. package/lib/packlets/decisions/common.js.map +1 -0
  325. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -0
  326. package/lib/packlets/decisions/concreteDecision.js.map +1 -0
  327. package/lib/packlets/decisions/decision.d.ts +1 -1
  328. package/lib/packlets/decisions/decision.d.ts.map +1 -0
  329. package/lib/packlets/decisions/decision.js +1 -1
  330. package/lib/packlets/decisions/decision.js.map +1 -0
  331. package/lib/packlets/decisions/index.d.ts.map +1 -0
  332. package/lib/packlets/decisions/index.js.map +1 -0
  333. package/lib/packlets/import/fsItem.d.ts +1 -4
  334. package/lib/packlets/import/fsItem.d.ts.map +1 -0
  335. package/lib/packlets/import/fsItem.js +1 -4
  336. package/lib/packlets/import/fsItem.js.map +1 -0
  337. package/lib/packlets/import/importContext.d.ts +5 -5
  338. package/lib/packlets/import/importContext.d.ts.map +1 -0
  339. package/lib/packlets/import/importContext.js +3 -3
  340. package/lib/packlets/import/importContext.js.map +1 -0
  341. package/lib/packlets/import/importManager.d.ts +15 -1
  342. package/lib/packlets/import/importManager.d.ts.map +1 -0
  343. package/lib/packlets/import/importManager.js +7 -3
  344. package/lib/packlets/import/importManager.js.map +1 -0
  345. package/lib/packlets/import/importable.d.ts.map +1 -0
  346. package/lib/packlets/import/importable.js.map +1 -0
  347. package/lib/packlets/import/importers/collectionImporter.d.ts +2 -2
  348. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -0
  349. package/lib/packlets/import/importers/collectionImporter.js +2 -2
  350. package/lib/packlets/import/importers/collectionImporter.js.map +1 -0
  351. package/lib/packlets/import/importers/fsItemImporter.d.ts +16 -2
  352. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -0
  353. package/lib/packlets/import/importers/fsItemImporter.js +29 -13
  354. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -0
  355. package/lib/packlets/import/importers/importer.d.ts.map +1 -0
  356. package/lib/packlets/import/importers/importer.js.map +1 -0
  357. package/lib/packlets/import/importers/index.browser.d.ts.map +1 -0
  358. package/lib/packlets/import/importers/index.browser.js.map +1 -0
  359. package/lib/packlets/import/importers/index.d.ts.map +1 -0
  360. package/lib/packlets/import/importers/index.js.map +1 -0
  361. package/lib/packlets/import/importers/jsonImporter.d.ts +2 -2
  362. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -0
  363. package/lib/packlets/import/importers/jsonImporter.js +2 -2
  364. package/lib/packlets/import/importers/jsonImporter.js.map +1 -0
  365. package/lib/packlets/import/importers/pathImporter.d.ts +1 -1
  366. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -0
  367. package/lib/packlets/import/importers/pathImporter.js +1 -1
  368. package/lib/packlets/import/importers/pathImporter.js.map +1 -0
  369. package/lib/packlets/import/index.browser.d.ts.map +1 -0
  370. package/lib/packlets/import/index.browser.js.map +1 -0
  371. package/lib/packlets/import/index.d.ts.map +1 -0
  372. package/lib/packlets/import/index.js.map +1 -0
  373. package/lib/packlets/qualifier-types/config/convert.d.ts +65 -0
  374. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  375. package/lib/packlets/qualifier-types/config/convert.js +161 -0
  376. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  377. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  378. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  379. package/lib/packlets/qualifier-types/config/index.js +64 -0
  380. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  381. package/lib/packlets/qualifier-types/config/json.d.ts +91 -0
  382. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  383. package/lib/packlets/qualifier-types/config/json.js +35 -0
  384. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  385. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -0
  386. package/lib/packlets/qualifier-types/convert.js.map +1 -0
  387. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  388. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  389. package/lib/packlets/qualifier-types/index.d.ts.map +1 -0
  390. package/lib/packlets/qualifier-types/index.js.map +1 -0
  391. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +6 -7
  392. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -0
  393. package/lib/packlets/qualifier-types/languageQualifierType.js +6 -7
  394. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  395. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +7 -10
  396. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -0
  397. package/lib/packlets/qualifier-types/literalQualifierType.js +7 -10
  398. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  399. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  400. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  401. package/lib/packlets/qualifier-types/qualifierType.d.ts +17 -18
  402. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -0
  403. package/lib/packlets/qualifier-types/qualifierType.js +12 -13
  404. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -0
  405. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -0
  406. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  407. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +8 -8
  408. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -0
  409. package/lib/packlets/qualifier-types/territoryQualifierType.js +5 -5
  410. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  411. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -0
  412. package/lib/packlets/qualifiers/convert/decls.js.map +1 -0
  413. package/lib/packlets/qualifiers/convert/index.d.ts.map +1 -0
  414. package/lib/packlets/qualifiers/convert/index.js.map +1 -0
  415. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +1 -0
  416. package/lib/packlets/qualifiers/convert/qualifier.js.map +1 -0
  417. package/lib/packlets/qualifiers/index.d.ts.map +1 -0
  418. package/lib/packlets/qualifiers/index.js.map +1 -0
  419. package/lib/packlets/qualifiers/qualifier.d.ts +6 -7
  420. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -0
  421. package/lib/packlets/qualifiers/qualifier.js +6 -7
  422. package/lib/packlets/qualifiers/qualifier.js.map +1 -0
  423. package/lib/packlets/qualifiers/qualifierCollector.d.ts +3 -3
  424. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -0
  425. package/lib/packlets/qualifiers/qualifierCollector.js +2 -2
  426. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -0
  427. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -0
  428. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -0
  429. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  430. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  431. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  432. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  433. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  434. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  435. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  436. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  437. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  438. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  439. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  440. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  441. package/lib/packlets/resource-json/convert.d.ts.map +1 -0
  442. package/lib/packlets/resource-json/convert.js.map +1 -0
  443. package/lib/packlets/resource-json/helpers.d.ts.map +1 -0
  444. package/lib/packlets/resource-json/helpers.js.map +1 -0
  445. package/lib/packlets/resource-json/index.d.ts.map +1 -0
  446. package/lib/packlets/resource-json/index.js.map +1 -0
  447. package/lib/packlets/resource-json/json.d.ts.map +1 -0
  448. package/lib/packlets/resource-json/json.js.map +1 -0
  449. package/lib/packlets/resource-json/normalized.d.ts.map +1 -0
  450. package/lib/packlets/resource-json/normalized.js.map +1 -0
  451. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +1 -1
  452. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -0
  453. package/lib/packlets/resource-json/resourceDeclCollection.js +1 -1
  454. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  455. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -0
  456. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  457. package/lib/packlets/resource-json/resourceDeclTree.d.ts +1 -1
  458. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -0
  459. package/lib/packlets/resource-json/resourceDeclTree.js +1 -1
  460. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -0
  461. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  462. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  463. package/lib/packlets/resource-types/config/convert.js +38 -0
  464. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  465. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  466. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  467. package/lib/packlets/resource-types/config/index.js +64 -0
  468. package/lib/packlets/resource-types/config/index.js.map +1 -0
  469. package/lib/packlets/resource-types/config/json.d.ts +11 -0
  470. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  471. package/lib/packlets/resource-types/config/json.js +24 -0
  472. package/lib/packlets/resource-types/config/json.js.map +1 -0
  473. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  474. package/lib/packlets/resource-types/helpers.js.map +1 -0
  475. package/lib/packlets/resource-types/index.d.ts.map +1 -0
  476. package/lib/packlets/resource-types/index.js.map +1 -0
  477. package/lib/packlets/resource-types/jsonResourceType.d.ts +17 -5
  478. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -0
  479. package/lib/packlets/resource-types/jsonResourceType.js +2 -2
  480. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -0
  481. package/lib/packlets/resource-types/resourceType.d.ts +5 -5
  482. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -0
  483. package/lib/packlets/resource-types/resourceType.js +2 -2
  484. package/lib/packlets/resource-types/resourceType.js.map +1 -0
  485. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +1 -0
  486. package/lib/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  487. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  488. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  489. package/lib/packlets/resources/candidateValue.d.ts.map +1 -0
  490. package/lib/packlets/resources/candidateValue.js.map +1 -0
  491. package/lib/packlets/resources/candidateValueCollector.d.ts.map +1 -0
  492. package/lib/packlets/resources/candidateValueCollector.js.map +1 -0
  493. package/lib/packlets/resources/common.d.ts.map +1 -0
  494. package/lib/packlets/resources/common.js.map +1 -0
  495. package/lib/packlets/resources/deltaGenerator.d.ts.map +1 -0
  496. package/lib/packlets/resources/deltaGenerator.js.map +1 -0
  497. package/lib/packlets/resources/index.d.ts.map +1 -0
  498. package/lib/packlets/resources/index.js.map +1 -0
  499. package/lib/packlets/resources/resource.d.ts.map +1 -0
  500. package/lib/packlets/resources/resource.js.map +1 -0
  501. package/lib/packlets/resources/resourceBuilder.d.ts +2 -2
  502. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -0
  503. package/lib/packlets/resources/resourceBuilder.js +2 -2
  504. package/lib/packlets/resources/resourceBuilder.js.map +1 -0
  505. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -0
  506. package/lib/packlets/resources/resourceCandidate.js.map +1 -0
  507. package/lib/packlets/resources/resourceManagerBuilder.d.ts +5 -5
  508. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  509. package/lib/packlets/resources/resourceManagerBuilder.js +5 -5
  510. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  511. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  512. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  513. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  514. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  515. package/lib/packlets/runtime/compiledResourceCollection.d.ts +5 -5
  516. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  517. package/lib/packlets/runtime/compiledResourceCollection.js +5 -5
  518. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  519. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  520. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  521. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  522. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  523. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  524. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  525. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  526. package/lib/packlets/runtime/context/index.js.map +1 -0
  527. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  528. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  529. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  530. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  531. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  532. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  533. package/lib/packlets/runtime/index.d.ts.map +1 -0
  534. package/lib/packlets/runtime/index.js.map +1 -0
  535. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  536. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  537. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  538. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  539. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  540. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  541. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  542. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  543. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  544. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  545. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  546. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  547. package/lib/packlets/runtime/resourceTreeResolver.d.ts.map +1 -0
  548. package/lib/packlets/runtime/resourceTreeResolver.js.map +1 -0
  549. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  550. package/lib/packlets/runtime/validate.js.map +1 -0
  551. package/lib/packlets/zip-archive/convert.d.ts.map +1 -0
  552. package/lib/packlets/zip-archive/convert.js.map +1 -0
  553. package/lib/packlets/zip-archive/index.browser.d.ts.map +1 -0
  554. package/lib/packlets/zip-archive/index.browser.js.map +1 -0
  555. package/lib/packlets/zip-archive/index.d.ts.map +1 -0
  556. package/lib/packlets/zip-archive/index.js.map +1 -0
  557. package/lib/packlets/zip-archive/json.d.ts.map +1 -0
  558. package/lib/packlets/zip-archive/json.js.map +1 -0
  559. package/lib/packlets/zip-archive/types.d.ts.map +1 -0
  560. package/lib/packlets/zip-archive/types.js.map +1 -0
  561. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts.map +1 -0
  562. package/lib/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  563. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts.map +1 -0
  564. package/lib/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  565. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts.map +1 -0
  566. package/lib/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  567. package/package.json +28 -26
  568. package/dist/test/data/sample.json +0 -32
  569. package/dist/test/unit/qualifier-types/testQualifierType.js +0 -76
  570. package/dist/test/unit/resource-types/testDerivedResourceType.js +0 -109
  571. package/dist/test/unit/resources/deltaGenerator.helpers.js +0 -282
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionCollector.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAU,OAAO,EAAE,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AC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Result, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { IConditionDecl } from './conditionDecls';\nimport { Condition } from './condition';\nimport { Convert as CommonConvert, ConditionKey } from '../common';\nimport { validatedConditionDecl } from './convert';\n\n/**\n * Parameters for creating a {@link Conditions.ConditionCollector | ConditionCollector}.\n * @public\n */\nexport interface IConditionCollectorCreateParams {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to\n * create conditions in this collector.\n */\n qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Optional array of condition declarations to add to the collector.\n */\n conditions?: IConditionDecl[];\n}\n\n/**\n * A `ValidatingCollector` for {@link Conditions.Condition | Conditions},\n * which collects conditions supplied as either {@link Conditions.Condition | Condition} or\n * {@link Conditions.IConditionDecl | IConditionDecl}.\n * @public\n */\nexport class ConditionCollector extends ValidatingCollector<Condition> {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to create conditions\n * in this collector.\n * @public\n */\n public qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Constructor for a {@link Conditions.ConditionCollector | ConditionCollector} object.\n * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for\n * creating the collector.\n */\n protected constructor(params: IConditionCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<ConditionKey, Condition>({\n key: CommonConvert.conditionKey,\n value: (from: unknown) => this._toCondition(from)\n })\n });\n this.qualifiers = params.qualifiers;\n /* c8 ignore next 1 - ? is defense in depth */\n params.conditions?.forEach((c) => this.validating.add(c).orThrow());\n }\n\n /**\n * Creates a new {@link Conditions.ConditionCollector | ConditionCollector} object.\n * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for\n * creating the collector.\n * @returns `Success` with the new collector if successful, or `Failure` with\n * an error message if not.\n */\n public static create(params: IConditionCollectorCreateParams): Result<ConditionCollector> {\n return captureResult(() => new ConditionCollector(params));\n }\n\n private _toCondition(from: unknown): Result<Condition> {\n if (from instanceof Condition) {\n return succeed(from);\n }\n return validatedConditionDecl\n .convert(from, { qualifiers: this.qualifiers, conditionIndex: this.size })\n .onSuccess((c) => Condition.create(c));\n }\n}\n\n/**\n * Type alias for a read-only {@link Conditions.ConditionCollector | ConditionCollector}.\n * @public\n */\nexport type ReadOnlyConditionCollector = Collections.IReadOnlyValidatingCollector<Condition>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionDecls.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionDecls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n ConditionIndex,\n ConditionOperator,\n ConditionPriority,\n QualifierConditionValue,\n QualifierMatchScore\n} from '../common';\nimport { Qualifier } from '../qualifiers';\nimport * as ResourceJson from '../resource-json';\n\n/**\n * Non-validated declaration of a {@link Conditions.Condition | condition}.\n * @public\n */\nexport type IConditionDecl = ResourceJson.Json.ILooseConditionDecl;\n\n/**\n * Validated declaration of a {@link Conditions.Condition | condition} with all defaults applied.\n * @public\n */\nexport interface IValidatedConditionDecl {\n qualifier: Qualifier;\n value: QualifierConditionValue;\n operator: ConditionOperator;\n priority: ConditionPriority;\n scoreAsDefault?: QualifierMatchScore;\n index?: ConditionIndex;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionSet.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAU,OAAO,EAAE,MAAM,eAA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ission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Hash, mapResults, Result, succeed } from '@fgv/ts-utils';\nimport { Condition } from './condition';\nimport {\n Convert as CommonConvert,\n ConditionSetIndex,\n ConditionSetKey,\n QualifierName,\n Validate\n} from '../common';\nimport { IValidatedConditionSetDecl } from './conditionSetDecls';\nimport * as ConditionsConvert from './convert';\nimport { ConditionCollector } from './conditionCollector';\nimport * as ResourceJson from '../resource-json';\nimport * as Context from '../context';\n\n/**\n * Options for creating a {@link Conditions.ConditionSet | ConditionSet} declaration.\n * @remarks\n * This interface extends the {@link ResourceJson.Helpers.IDeclarationOptions | declaration options}\n * interface to include a `reduceQualifiers` option.\n * @public\n */\nexport interface IConditionSetDeclOptions extends ResourceJson.Helpers.IDeclarationOptions {\n /**\n * If provided, reduces the qualifiers of the condition set by removing qualifiers that are made\n * irrelevant by the filterForContext.\n */\n qualifiersToReduce?: ReadonlySet<QualifierName>;\n}\n\n/**\n * Represents a set of {@link Conditions.Condition | conditions} that must all be met in some runtime\n * context for a resource instance to be valid.\n * @public\n */\nexport class ConditionSet implements IValidatedConditionSetDecl {\n protected readonly _collectible: Collections.Collectible<ConditionSetKey, ConditionSetIndex>;\n /**\n * The {@link Conditions.Condition | conditions} that make up this condition\n * set.\n * @public\n */\n public readonly conditions: ReadonlyArray<Condition>;\n\n /**\n * The key for this condition set.\n */\n public get key(): ConditionSetKey {\n return this._collectible.key;\n }\n\n /**\n * The number of conditions in this condition set.\n */\n public get size(): number {\n return this.conditions.length;\n }\n\n /**\n * The index for this condition set.\n */\n public get index(): ConditionSetIndex | undefined {\n return this._collectible.index;\n }\n\n /**\n * The key for an unconditional condition set.\n */\n public static UnconditionalKey: ConditionSetKey = Validate.toConditionSetKey('').orThrow();\n\n /**\n * Constructor for a {@link Conditions.ConditionSet | ConditionSet} object.\n * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}\n * used to create the condition set.\n */\n protected constructor(params: IValidatedConditionSetDecl) {\n const qualifiers = new Map<QualifierName, Condition>();\n for (const condition of params.conditions) {\n /* c8 ignore next 9 - there's a test for this but coverage is having a bad day */\n if (qualifiers.has(condition.qualifier.name)) {\n const existing = qualifiers.get(condition.qualifier.name)?.toString() ?? 'unknown';\n throw new Error(\n `${\n condition.qualifier.name\n }: Duplicate conditions ${existing} and ${condition.toString()} are not supported.`\n );\n }\n qualifiers.set(condition.qualifier.name, condition);\n }\n this.conditions = Array.from(params.conditions).sort(Condition.compare).reverse();\n this._collectible = new Collections.Collectible({\n key: this.toKey(),\n index: params.index,\n indexConverter: CommonConvert.conditionSetIndex\n });\n }\n\n /**\n * Creates a new {@link Conditions.ConditionSet | ConditionSet} object.\n * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}\n * used to create the condition set.\n * @returns `Success` with the new {@link Conditions.ConditionSet | ConditionSet} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params: IValidatedConditionSetDecl): Result<ConditionSet> {\n return captureResult(() => new ConditionSet(params));\n }\n\n /**\n * Compares two {@link Conditions.ConditionSet | ConditionSets} for sorting purposes.\n * @param cs1 - The first {@link Conditions.ConditionSet | ConditionSet} to compare.\n * @param cs2 - The second {@link Conditions.ConditionSet | ConditionSet} to compare.\n * @returns A negative number if `cs1` should come before `cs2`, a positive\n * number if `cs1` should come after `cs2`, or zero if they are equivalent.\n * @public\n */\n public static compare(cs1: ConditionSet, cs2: ConditionSet): number {\n const len = Math.min(cs1.conditions.length, cs2.conditions.length);\n for (let i = 0; i < len; i++) {\n const diff = Condition.compare(cs1.conditions[i], cs2.conditions[i]);\n if (diff !== 0) {\n return diff;\n }\n }\n return cs1.conditions.length - cs2.conditions.length;\n }\n\n /**\n * Sets the global index for this condition set. Once set, the index cannot be changed.\n * @param index - The index to set for this condition set.\n * @returns `Success` with the index if successful, `Failure` otherwise.\n */\n public setIndex(index: number): Result<ConditionSetIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Determines if this condition set can match a supplied context, even if the context is partial.\n * Returns true if all conditions in the set can match the context (using canMatchPartialContext).\n * Returns false otherwise.\n * @param context - The context to match.\n * @param options - Options to use when matching.\n * @returns `true` if all conditions can match the context, `false` otherwise.\n */\n public canMatchPartialContext(\n context: Context.IValidatedContextDecl,\n options?: Context.IContextMatchOptions\n ): boolean {\n return this.conditions.every((c) => c.canMatchPartialContext(context, options));\n }\n\n /**\n * Gets the {@link ConditionSetKey | key} for a supplied {@link Conditions.IValidatedConditionSetDecl | condition set declaration}.\n * @param decl - The {@link Conditions.IValidatedConditionSetDecl | condition set declaration} for which to get the key.\n * @returns `Success` with the condition set key if successful, `Failure` otherwise.\n * @public\n */\n public static getKeyForDecl(decl: IValidatedConditionSetDecl): Result<ConditionSetKey> {\n return Validate.toConditionSetKey(decl.conditions.map((c) => c.toKey()).join('+'));\n }\n\n /**\n * Gets a condition set key from a loose condition set declaration.\n * @param conditionSet - The loose condition set declaration to convert.\n * @param conditionCollector - The condition collector used for validation.\n * @returns `Success` with the condition set key if successful, `Failure` otherwise.\n * @public\n */\n public static getKeyFromLooseDecl(\n conditionSet: ResourceJson.Json.ConditionSetDecl | undefined,\n conditionCollector: ConditionCollector\n ): Result<ConditionSetKey> {\n if (!conditionSet) {\n return succeed(ConditionSet.UnconditionalKey);\n }\n\n // Convert ConditionSetDecl to IConditionSetDecl format\n let conditionSetDecl: { conditions: ResourceJson.Json.ILooseConditionDecl[] };\n\n if (Array.isArray(conditionSet)) {\n // ConditionSetDeclAsArray: array of ILooseConditionDecl\n conditionSetDecl = { conditions: conditionSet };\n } else {\n // ConditionSetDeclAsRecord: Record<string, string | IChildConditionDecl>\n const conditions = Object.entries(conditionSet).map(([qualifierName, value]) => {\n if (typeof value === 'string') {\n return { qualifierName, value };\n /* c8 ignore next 3 - edge case */\n } else {\n return { qualifierName, ...value };\n }\n });\n conditionSetDecl = { conditions };\n }\n\n // Validate and convert to IValidatedConditionSetDecl\n return ConditionsConvert.validatedConditionSetDecl\n .convert(conditionSetDecl, { conditions: conditionCollector })\n .onSuccess((validatedDecl) => {\n // Use proper ConditionSet.getKeyForDecl method to generate the key\n return ConditionSet.getKeyForDecl(validatedDecl);\n });\n }\n\n /**\n * Gets a {@link ConditionSetToken | condition set token} for this condition set,\n * if possible.\n * @param terse - If true, the token will be terse, omitting qualifier names where\n * possible.\n * @returns `Success` with the {@link ConditionSetToken | condition set token} if successful,\n * `Failure` with an error message otherwise.\n * @public\n */\n public toToken(terse?: boolean): Result<string> {\n return mapResults(this.conditions.map((c) => c.toToken(terse))).onSuccess((tokens) => {\n return Validate.toConditionSetToken(tokens.join(','));\n });\n }\n\n /**\n * Gets the {@link ConditionSetKey | key} for this condition set.\n * @returns The key for this condition set.\n */\n public toKey(): ConditionSetKey {\n return ConditionSet.getKeyForDecl(this).orThrow();\n }\n\n /**\n * Gets a hash of this condition set.\n * @returns A hash of this condition\n * set key.\n * @public\n */\n public toHash(): string {\n return Hash.Crc32Normalizer.crc32Hash([this.key]).padStart(8, '0');\n }\n\n /**\n * Gets a human-readable string representation of this condition set.\n * @returns A string representation of this condition set.\n */\n public toString(): string {\n return this.toKey();\n }\n\n /**\n * Gets the {@link ResourceJson.Json.ConditionSetDeclAsRecord | condition set declaration as a record} for this condition set.\n * @param options - {@link ResourceJson.Helpers.IDeclarationOptions | options} for the condition set declaration.\n * @returns The {@link ResourceJson.Json.ConditionSetDeclAsRecord | condition set declaration as a record} for this condition set.\n */\n public toConditionSetRecordDecl(\n options?: IConditionSetDeclOptions\n ): ResourceJson.Json.ConditionSetDeclAsRecord {\n const qualifiersToReduce = options?.qualifiersToReduce;\n const conditions = qualifiersToReduce\n ? /* c8 ignore next 1 - coverage intermittently misses the next line */\n this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))\n : this.conditions;\n return Object.fromEntries(\n conditions.map((c): [string, ResourceJson.Json.IChildConditionDecl | string] => {\n return [c.qualifier.name, c.toValueOrChildConditionDecl(options)];\n })\n );\n }\n\n /**\n * Gets the {@link ResourceJson.Json.ConditionSetDeclAsArray | condition set declaration as an array} for this condition set.\n * @param options - {@link ResourceJson.Helpers.IDeclarationOptions | options} for the condition set declaration.\n * @returns The {@link ResourceJson.Json.ConditionSetDeclAsArray | condition set declaration as an array} for this condition set.\n */\n public toConditionSetArrayDecl(\n options?: IConditionSetDeclOptions\n ): ResourceJson.Json.ConditionSetDeclAsArray {\n /* c8 ignore next 1 - defense in depth */\n const qualifiersToReduce = options?.qualifiersToReduce;\n const conditions = qualifiersToReduce\n ? this.conditions.filter((c) => !qualifiersToReduce.has(c.qualifier.name))\n : this.conditions;\n return conditions.map((c) => c.toLooseConditionDecl(options));\n }\n\n /**\n * Converts this condition set to a compiled condition set representation.\n * @param options - Optional compilation options controlling the output format.\n * @returns A compiled condition set object that can be used for serialization or runtime processing.\n * @public\n */\n public toCompiled(\n options?: ResourceJson.Compiled.ICompiledResourceOptions\n ): ResourceJson.Compiled.ICompiledConditionSet {\n return {\n conditions: this.conditions.map((c) => c.index!),\n ...(options?.includeMetadata === true ? { metadata: { key: this.key } } : {})\n };\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionSetCollector.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAU,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG7G,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAmB,OAAO,IAAI,aAAa,EAAqB,QAAQ,EAAE,MAAM,WAAW,CAAC;AAoBnG;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAiC;IAO1E;;;OAGG;IACH,IAAW,yBAAyB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,CAAC;IACxE,CAAC;IAOD;;;;OAIG;IACH,YAAsB,MAA0C;;QAC9D,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,WAAW,CAAC,kBAAkB,CAAgC;gBAC5E,GAAG,EAAE,aAAa,CAAC,eAAe;gBAClC,wEAAwE;gBACxE,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;aACrD,CAAC;SACH,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,+EAA+E;QAC/E,gBAAgB;QAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACjF,8CAA8C;QAC9C,MAAA,MAAM,CAAC,aAAa,0CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAA0C;QAC7D,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,eAAe,CAAC,IAAa;QACnC,IAAI,IAAI,YAAY,YAAY,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CACxF,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CACpD,CAAC;QACJ,CAAC;QACD,uFAAuF;QACvF,OAAO,yBAAyB;aAC7B,OAAO,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aAC5E,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;;AAlDD;;GAEG;AACW,wCAAkB,GAAsB,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,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 { captureResult, Collections, mapResults, Result, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { ConditionCollector } from './conditionCollector';\nimport { IConditionSetDecl } from './conditionSetDecls';\nimport { ConditionSet } from './conditionSet';\nimport { validatedConditionSetDecl } from './convert';\nimport { ConditionSetKey, Convert as CommonConvert, ConditionSetIndex, Validate } from '../common';\n\n/**\n * Parameters for creating a {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @public\n */\nexport interface IConditionSetCollectorCreateParams {\n /**\n * The {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions\n * for conditions in this collector.\n */\n conditions: ConditionCollector;\n\n /**\n * Optional array of {@link Conditions.IConditionSetDecl | condition set declarations} to add to\n * the collector.\n */\n conditionSets?: IConditionSetDecl[];\n}\n\n/**\n * A `ValidatingCollector` for {@link Conditions.ConditionSet | ConditionSets},\n * which collects condition sets supplied as {@link Conditions.ConditionSet | ConditionSet} or\n * as {@link Conditions.IConditionSetDecl | IConditionSetDecl} via the methods on the\n * `validating` property.\n * @public\n */\nexport class ConditionSetCollector extends ValidatingCollector<ConditionSet> {\n /**\n * Gets the {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions\n * for conditions in this collector.\n */\n public conditions: ConditionCollector;\n\n /**\n * Gets the {@link Conditions.ConditionSet | ConditionSet} at the unconditional\n * condition set index.\n */\n public get unconditionalConditionSet(): ConditionSet {\n return this.getAt(ConditionSetCollector.UnconditionalIndex).orThrow();\n }\n\n /**\n * The index of the unconditional condition set.\n */\n public static UnconditionalIndex: ConditionSetIndex = Validate.toConditionSetIndex(0).orThrow();\n\n /**\n * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create\n * the collector.\n */\n protected constructor(params: IConditionSetCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<ConditionSetKey, ConditionSet>({\n key: CommonConvert.conditionSetKey,\n /* c8 ignore next 1 - there's a test but coverage is having a bad day */\n value: (from: unknown) => this._toConditionSet(from)\n })\n });\n this.conditions = params.conditions;\n // it's very helpful for debugging if the unconditional condition set is always\n // in position 0\n this.validating.add(ConditionSet.create({ conditions: [] }).orThrow()).orThrow();\n /* c8 ignore next 1 - ? is defense in depth */\n params.conditionSets?.forEach((item) => this.validating.add(item).orThrow());\n }\n\n /**\n * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create\n * the collector.\n * @returns `Success` with the new collector if successful, or `Failure` with an error message\n * if not.\n */\n public static create(params: IConditionSetCollectorCreateParams): Result<ConditionSetCollector> {\n return captureResult(() => new ConditionSetCollector(params));\n }\n\n private _toConditionSet(from: unknown): Result<ConditionSet> {\n if (from instanceof ConditionSet) {\n return succeed(from);\n }\n if (Array.isArray(from)) {\n return mapResults(from.map((item) => this.conditions.validating.getOrAdd(item))).onSuccess(\n (conditions) => ConditionSet.create({ conditions })\n );\n }\n /* c8 ignore next 4 - functional code path tested but coverage intermittently missed */\n return validatedConditionSetDecl\n .convert(from, { conditions: this.conditions, conditionSetIndex: this.size })\n .onSuccess((c) => ConditionSet.create(c));\n }\n}\n\n/**\n * A read-only {@link Conditions.ConditionSetCollector | ConditionSetCollector}.\n * @public\n */\nexport type ReadOnlyConditionSetCollector = Collections.IReadOnlyValidatingCollector<ConditionSet>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionSetDecls.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionSetDecls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","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 { Condition } from './condition';\nimport { IConditionDecl } from './conditionDecls';\n\n/**\n * Non-validated declaration of a {@link Conditions.ConditionSet | set of conditions}.\n * @public\n */\nexport interface IConditionSetDecl {\n conditions: IConditionDecl[];\n}\n\n/**\n * Validated declaration of a {@link Conditions.ConditionSet | set of conditions}.\n * @public\n */\nexport interface IValidatedConditionSetDecl {\n conditions: ReadonlyArray<Condition>;\n index?: number;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionToken.js","sourceRoot":"","sources":["../../../src/packlets/conditions/conditionToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAqB,MAAM,WAAW,CAAC;AAIxE;;;GAGG;AACH,MAAM,OAAO,eAAe;IAO1B;;;OAGG;IACH,YAAmB,UAAuC;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,mBAAmB,CAAC,KAAa;QACtC,OAAO,eAAe,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;OAMG;IACI,sBAAsB,CAAC,KAAa;QACzC,OAAO,eAAe,CAAC,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAChC,KAAyC;QAEzC,OAAO,eAAe,CAAC,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,KAAa;QACxC,OAAO,eAAe,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,mBAAmB,CAC/B,KAAa,EACb,UAAuC;QAEvC,OAAO,aAAa,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACvE,OAAO,eAAe,CAAC,2BAA2B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAO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AM,EAAE,EAAE,CAAC;YAC5C,IAAI,SAAS,CAAC,eAAe,IAAI,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC;gBAChF,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,GAAG,KAAK,gCAAgC,CAAC,CAAC;QACxD,CAAC;QACD,uFAAuF;QACvF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,GAAG,KAAK,kCAAkC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF","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 { mapResults, Result, fail, succeed } from '@fgv/ts-utils';\nimport { Helpers as CommonHelpers, ConditionOperator } from '../common';\nimport { IValidatedConditionDecl } from './conditionDecls';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../qualifiers';\n\n/**\n * Helper class to parse and validate condition tokens.\n * @public\n */\nexport class ConditionTokens {\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to validate\n * qualifier names and values.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Constructs a new {@link Conditions.ConditionTokens | ConditionTokens } instance.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n */\n public constructor(qualifiers: IReadOnlyQualifierCollector) {\n this.qualifiers = qualifiers;\n }\n\n /**i\n * Parses a {@link ConditionToken | condition token} string and validates the parts\n * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the {@link Conditions.IValidatedConditionDecl | validated condition declaration}\n * if successful, `Failure` with an error message if not.\n */\n public parseConditionToken(token: string): Result<IValidatedConditionDecl> {\n return ConditionTokens.parseConditionToken(token, this.qualifiers);\n }\n\n /**\n * Parses a {@link ConditionSetToken | condition set token} string and validates the parts\n * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}\n * if successful, `Failure` with an error message if not.\n */\n public parseConditionSetToken(token: string): Result<IValidatedConditionDecl[]> {\n return ConditionTokens.parseConditionSetToken(token, this.qualifiers);\n }\n\n /**\n * Validates the {@link Helpers.IConditionTokenParts | parts} of a {@link ConditionToken | condition token}.\n * @param parts - the parts to validate\n * @returns `Success` with the validated declaration if successful, `Failure` with an error message if not.\n */\n public validateConditionTokenParts(\n parts: CommonHelpers.IConditionTokenParts\n ): Result<IValidatedConditionDecl> {\n return ConditionTokens.validateConditionTokenParts(parts, this.qualifiers);\n }\n\n /**\n * Given a value, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public findQualifierForValue(value: string): Result<Qualifier> {\n return ConditionTokens.findQualifierForValue(value, this.qualifiers);\n }\n\n /**\n * Parses a {@link ConditionToken | condition token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static parseConditionToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl> {\n return CommonHelpers.parseConditionTokenParts(token).onSuccess((parts) => {\n return ConditionTokens.validateConditionTokenParts(parts, qualifiers);\n });\n }\n\n /**\n * Parses a {@link ConditionSetToken | condition set token} and validates it against the qualifiers\n * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param token - the token string to parse.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with an array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}\n * if successful, `Failure` with an error message if not\n */\n public static parseConditionSetToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl[]> {\n return CommonHelpers.parseConditionSetTokenParts(token).onSuccess((parts) => {\n return mapResults(parts.map((part) => ConditionTokens.validateConditionTokenParts(part, qualifiers)));\n });\n }\n\n /**\n * Validates the parts of a condition token against the qualifiers present in the supplied\n * {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param parts - the {@link Helpers.IConditionTokenParts | condition token parts} to validate.\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to\n * validate qualifier names and values.\n * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static validateConditionTokenParts(\n parts: CommonHelpers.IConditionTokenParts,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedConditionDecl> {\n const qualifierLookup =\n parts.qualifier === undefined\n ? ConditionTokens.findQualifierForValue(parts.value, qualifiers)\n : qualifiers.getByNameOrToken(parts.qualifier);\n\n return qualifierLookup.onSuccess((qualifier) => {\n return qualifier.type\n .validateCondition(parts.value)\n .onSuccess((value) => {\n const operator: ConditionOperator = 'matches';\n const priority = qualifier.defaultPriority;\n return succeed({ qualifier, value, operator, priority });\n })\n .withDetail('failure', 'success');\n });\n }\n\n /**\n * Given a value and a set of qualifiers, finds a single token-optional qualifier that matches the value.\n * Fails if no qualifiers match, or if more than one qualifier matches.\n * @param value - the value to match.\n * @param qualifiers - the qualifiers to match against.\n * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.\n */\n public static findQualifierForValue(\n value: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<Qualifier> {\n const matched: Qualifier[] = [];\n for (const qualifier of qualifiers.values()) {\n if (qualifier.tokenIsOptional && qualifier.validateCondition(value).isSuccess()) {\n matched.push(qualifier);\n }\n }\n if (matched.length === 0) {\n return fail(`${value}: does not match any qualifier`);\n }\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n if (matched.length > 1) {\n return fail(`${value}: matches multiple qualifiers (${matched.map((q) => q.name).join(', ')})`);\n }\n return succeed(matched[0]);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionSetDecls.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/conditionSetDecls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAU,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,2CAA2C;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,YAAY,CAAoB;IACzE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC;CAC9C,CAAC,CAAC;AAYH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,CAGzD,CAAC,IAAa,EAAE,MAAM,EAAE,OAAyC,EAAsC,EAAE;IACzG,qDAAqD;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;QACvD,OAAO,UAAU,CACf,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CACtF,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE;YACzB,+CAA+C;YAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAClF,OAAO,OAAO,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 { Converters, Result, fail, mapResults, succeed } from '@fgv/ts-utils';\nimport { IConditionSetDecl, IValidatedConditionSetDecl } from '../conditionSetDecls';\nimport { conditionDecl } from './decls';\nimport { ConditionCollector } from '../conditionCollector';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter which converts to a {@link Conditions.IConditionSetDecl | condition set declaration}.\n * @public\n */\nexport const conditionSetDecl = Converters.strictObject<IConditionSetDecl>({\n conditions: Converters.arrayOf(conditionDecl)\n});\n\n/**\n * Context for converting a {@link Conditions.IConditionSetDecl | condition set declaration}\n * into an instantiated {@link Conditions.ConditionSet | condition set} object.\n * @public\n */\nexport interface IConditionSetDeclConvertContext {\n readonly conditions: ConditionCollector;\n conditionSetIndex?: number;\n}\n\n/**\n * Converter which constructs a {@link Conditions.IValidatedConditionSetDecl | validated condition set declaration}\n * from a {@link Conditions.IConditionSetDecl | condition set declaration}, instantiating qualifiers by name\n * from a supplied {@link Conditions.Convert.IConditionSetDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedConditionSetDecl = Converters.generic<\n IValidatedConditionSetDecl,\n IConditionSetDeclConvertContext\n>((from: unknown, __self, context?: IConditionSetDeclConvertContext): Result<IValidatedConditionSetDecl> => {\n /* c8 ignore next 3 - coverage is having a bad day */\n if (!context) {\n return fail('validatedConditionSetDecl converter requires a context');\n }\n\n return conditionSetDecl.convert(from).onSuccess((decl) => {\n return mapResults(\n decl.conditions.map((condition) => context.conditions.validating.getOrAdd(condition))\n ).onSuccess((conditions) => {\n /* c8 ignore next 1 - coverage having issues */\n const index = context.conditionSetIndex ? context.conditionSetIndex++ : undefined;\n return succeed({ conditions, index });\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decls.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/decls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIlF,2CAA2C;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,CAAiB;IACnE,aAAa,EAAE,UAAU,CAAC,MAAM;IAChC,KAAK,EAAE,UAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACrD,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;IACtC,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAYH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,CAGtD,CAAC,IAAa,EAAE,MAAM,EAAE,OAAsC,EAAmC,EAAE;IACnG,qDAAqD;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,qDAAqD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,aAAa,CAAC,O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C,cAAc,EAAE,CAAC;gBAC3B,CAAC;gBACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC,CAAC;iBACD,UAAU,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 * as Common from '../../common';\nimport { Converters, populateObject, Result, fail, succeed } from '@fgv/ts-utils';\nimport { IConditionDecl, IValidatedConditionDecl } from '../conditionDecls';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter for a {@link Conditions.IConditionDecl | condition declaration}.\n * @public\n */\nexport const conditionDecl = Converters.strictObject<IConditionDecl>({\n qualifierName: Converters.string,\n value: Converters.string,\n operator: Common.Convert.conditionOperator.optional(),\n priority: Converters.number.optional(),\n scoreAsDefault: Converters.number.optional()\n});\n\n/**\n * Conversion context to uses when converting\n * a {@link Conditions.IValidatedConditionDecl | validated condition declaration}.\n * @public\n */\nexport interface IConditionDeclConvertContext {\n readonly qualifiers: IReadOnlyQualifierCollector;\n conditionIndex?: number;\n}\n\n/**\n * Converter which constructs a {@link Conditions.IValidatedConditionDecl | validated condition declaration}\n * from a {@link Conditions.IConditionDecl | condition declaration}, instantiating qualifiers by name\n * from a supplied {@link Conditions.Convert.IConditionDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedConditionDecl = Converters.generic<\n IValidatedConditionDecl,\n IConditionDeclConvertContext\n>((from: unknown, __self, context?: IConditionDeclConvertContext): Result<IValidatedConditionDecl> => {\n /* c8 ignore next 3 - coverage is having a bad day */\n if (!context) {\n return fail('validatedConditionDecl converter requires a context');\n }\n return conditionDecl.convert(from).onSuccess((decl) => {\n const operator = decl.operator ?? 'matches';\n return context.qualifiers.validating.get(decl.qualifierName).onSuccess((qualifier) => {\n return populateObject<IValidatedConditionDecl>({\n qualifier: () => succeed(qualifier),\n value: () => qualifier.validateCondition(decl.value, operator),\n operator: () => succeed(operator),\n priority: () =>\n decl.priority\n ? Common.Convert.conditionPriority.convert(decl.priority)\n : succeed(qualifier.defaultPriority),\n scoreAsDefault: () =>\n decl.scoreAsDefault\n ? Common.Convert.qualifierMatchScore.convert(decl.scoreAsDefault)\n : succeed(undefined),\n index: () =>\n context.conditionIndex\n ? Common.Convert.conditionIndex.convert(context.conditionIndex)\n : succeed(undefined)\n })\n .onSuccess((result) => {\n if (context.conditionIndex !== undefined) {\n context.conditionIndex++;\n }\n return succeed(result);\n })\n .withDetail('success');\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/conditions/convert/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,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\nexport * from './decls';\nexport * from './conditionSetDecls';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/conditions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,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 * as Convert from './convert';\n\nexport * from './condition';\nexport * from './conditionCollector';\nexport * from './conditionDecls';\nexport * from './conditionSet';\nexport * from './conditionSetCollector';\nexport * from './conditionSetDecls';\nexport * from './conditionToken';\n\nexport { Convert };\n"]}
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { fail } from '@fgv/ts-utils';
23
+ import { SystemConfiguration, updateSystemConfigurationQualifierDefaultValues } from './systemConfiguration';
24
+ import { sanitizeJsonObject } from '@fgv/ts-json-base';
25
+ import { Default, Example } from './predefined';
26
+ /**
27
+ * An array of all well-known predefined system configurations.
28
+ * @public
29
+ */
30
+ export const allPredefinedSystemConfigurations = [
31
+ 'default',
32
+ 'language-priority',
33
+ 'territory-priority',
34
+ 'extended-example'
35
+ ];
36
+ export * from './predefined';
37
+ const predefinedDecls = {
38
+ default: Default.DefaultSystemConfiguration,
39
+ 'language-priority': Default.LanguagePrioritySystemConfiguration,
40
+ 'territory-priority': Default.TerritoryPrioritySystemConfiguration,
41
+ 'extended-example': Example.ExtendedSystemConfiguration
42
+ };
43
+ /**
44
+ * Returns the {@link Config.Model.ISystemConfiguration | system configuration} declaration for the
45
+ * specified predefined system configuration.
46
+ * @param name - The name of the predefined system configuration.
47
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
48
+ * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}
49
+ * declaration if successful, `Failure` with an error message otherwise.
50
+ * @public
51
+ */
52
+ export function getPredefinedDeclaration(name, initParams) {
53
+ if (name in predefinedDecls) {
54
+ const baseConfig = sanitizeJsonObject(predefinedDecls[name]);
55
+ if (initParams === null || initParams === void 0 ? void 0 : initParams.qualifierDefaultValues) {
56
+ return baseConfig.onSuccess((config) => updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues));
57
+ }
58
+ return baseConfig;
59
+ }
60
+ /* c8 ignore next 3 - defense in depth */
61
+ return fail(`Unknown predefined system configuration: ${name}`);
62
+ }
63
+ /**
64
+ * Returns the {@link Config.SystemConfiguration | SystemConfiguration} for the specified
65
+ * predefined system configuration.
66
+ * @param name - The name of the predefined system configuration.
67
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
68
+ * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
69
+ * if successful, `Failure` with an error message otherwise.
70
+ * @public
71
+ */
72
+ export function getPredefinedSystemConfiguration(name, initParams) {
73
+ if (name in predefinedDecls) {
74
+ return SystemConfiguration.create(predefinedDecls[name], initParams);
75
+ }
76
+ return fail(`Unknown predefined system configuration: ${name}`);
77
+ }
78
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/config/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAU,IAAI,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EACL,mBAAmB,EAEnB,+CAA+C,EAChD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAYhD;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAiD;IAC7F,SAAS;IACT,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;CACnB,CAAC;AAEF,cAAc,cAAc,CAAC;AAE7B,MAAM,eAAe,GAAgE;IACnF,OAAO,EAAE,OAAO,CAAC,0BAA0B;IAC3C,mBAAmB,EAAE,OAAO,CAAC,mCAAmC;IAChE,oBAAoB,EAAE,OAAO,CAAC,oCAAoC;IAClE,kBAAkB,EAAE,OAAO,CAAC,2BAA2B;CACxD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAmC,EACnC,UAA2C;IAE3C,IAAI,IAAI,IAAI,eAAe,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,sBAAsB,EAAE,CAAC;YACvC,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CACrC,+CAA+C,CAAC,MAAM,EAAE,UAAU,CAAC,sBAAuB,CAAC,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,yCAAyC;IACzC,OAAO,IAAI,CAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAmC,EACnC,UAA2C;IAE3C,IAAI,IAAI,IAAI,eAAe,EAAE,CAAC;QAC5B,OAAO,mBAAmB,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;AAClE,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 { Result, fail } from '@fgv/ts-utils';\nimport { ISystemConfiguration } from './json';\nimport {\n SystemConfiguration,\n ISystemConfigurationInitParams,\n updateSystemConfigurationQualifierDefaultValues\n} from './systemConfiguration';\nimport { sanitizeJsonObject } from '@fgv/ts-json-base';\nimport { Default, Example } from './predefined';\n\n/**\n * A `string` literal type representing a well-known predefined system configuration.\n * @public\n */\nexport type PredefinedSystemConfiguration =\n | 'default'\n | 'language-priority'\n | 'territory-priority'\n | 'extended-example';\n\n/**\n * An array of all well-known predefined system configurations.\n * @public\n */\nexport const allPredefinedSystemConfigurations: ReadonlyArray<PredefinedSystemConfiguration> = [\n 'default',\n 'language-priority',\n 'territory-priority',\n 'extended-example'\n];\n\nexport * from './predefined';\n\nconst predefinedDecls: Record<PredefinedSystemConfiguration, ISystemConfiguration> = {\n default: Default.DefaultSystemConfiguration,\n 'language-priority': Default.LanguagePrioritySystemConfiguration,\n 'territory-priority': Default.TerritoryPrioritySystemConfiguration,\n 'extended-example': Example.ExtendedSystemConfiguration\n};\n\n/**\n * Returns the {@link Config.Model.ISystemConfiguration | system configuration} declaration for the\n * specified predefined system configuration.\n * @param name - The name of the predefined system configuration.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}\n * declaration if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function getPredefinedDeclaration(\n name: PredefinedSystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n): Result<ISystemConfiguration> {\n if (name in predefinedDecls) {\n const baseConfig = sanitizeJsonObject(predefinedDecls[name]);\n if (initParams?.qualifierDefaultValues) {\n return baseConfig.onSuccess((config) =>\n updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues!)\n );\n }\n return baseConfig;\n }\n /* c8 ignore next 3 - defense in depth */\n return fail(`Unknown predefined system configuration: ${name}`);\n}\n\n/**\n * Returns the {@link Config.SystemConfiguration | SystemConfiguration} for the specified\n * predefined system configuration.\n * @param name - The name of the predefined system configuration.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function getPredefinedSystemConfiguration(\n name: PredefinedSystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n): Result<SystemConfiguration> {\n if (name in predefinedDecls) {\n return SystemConfiguration.create(predefinedDecls[name], initParams);\n }\n\n return fail(`Unknown predefined system configuration: ${name}`);\n}\n"]}
@@ -0,0 +1,258 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { fail } from '@fgv/ts-utils';
23
+ import * as QualifierTypes from '../qualifier-types';
24
+ import * as ResourceTypes from '../resource-types';
25
+ /**
26
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a factory function.
27
+ * @param fn - The factory function to wrap.
28
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
29
+ * @public
30
+ */
31
+ export function createQualifierTypeFactory(fn) {
32
+ return {
33
+ create: fn
34
+ };
35
+ }
36
+ /**
37
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a resource type factory function.
38
+ * @param fn - The factory function to wrap.
39
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
40
+ * @public
41
+ */
42
+ export function createResourceTypeFactory(fn) {
43
+ return {
44
+ create: fn
45
+ };
46
+ }
47
+ /**
48
+ * A factory that chains multiple factories together.
49
+ * @public
50
+ */
51
+ export class ChainedConfigInitFactory {
52
+ /**
53
+ * Constructor for a chained config init factory.
54
+ * @param factories - The factories to chain.
55
+ */
56
+ constructor(factories) {
57
+ this.factories = factories;
58
+ }
59
+ /**
60
+ * Creates a new instance of a configuration object.
61
+ * @param config - The configuration object to create.
62
+ * @returns A result containing the new instance of the configuration object.
63
+ */
64
+ create(config) {
65
+ for (const factory of this.factories) {
66
+ const result = factory.create(config);
67
+ if (result.isSuccess()) {
68
+ return result;
69
+ }
70
+ }
71
+ return fail('No factory was able to create the configuration object');
72
+ }
73
+ }
74
+ /**
75
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
76
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
77
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
78
+ * if successful, `Failure` with an error message otherwise.
79
+ * @public
80
+ */
81
+ export class BuiltInQualifierTypeFactory {
82
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
83
+ create(config) {
84
+ if (QualifierTypes.Config.isSystemQualifierTypeConfig(config)) {
85
+ return QualifierTypes.createQualifierTypeFromSystemConfig(config);
86
+ }
87
+ /* c8 ignore next 2 - functional code tested but coverage intermittently missed */
88
+ return fail(`${config.name}: unknown built-in qualifier type (${config.systemType})`);
89
+ }
90
+ }
91
+ /**
92
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
93
+ * supporting both built-in system types and custom external types.
94
+ *
95
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
96
+ * while maintaining support for all built-in types (Language, Territory, Literal).
97
+ *
98
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
99
+ *
100
+ * @example Creating a factory with custom qualifier types
101
+ * ```typescript
102
+ * // Define a custom qualifier type
103
+ * class CustomQualifierType extends QualifierType {
104
+ * // ... implementation
105
+ * }
106
+ *
107
+ * // Define a discriminated union of all types
108
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
109
+ *
110
+ * // Create a factory that handles custom types
111
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
112
+ * create(config) {
113
+ * // ... handle custom type creation
114
+ * }
115
+ * };
116
+ *
117
+ * // Create the combined factory
118
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
119
+ *
120
+ * // The factory returns T | SystemQualifierType, supporting all types
121
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
122
+ * ```
123
+ *
124
+ * @remarks
125
+ * - The factory chains custom factories with the built-in factory
126
+ * - Custom factories are tried first, falling back to built-in types
127
+ * - The return type is a union of custom types (T) and system types
128
+ *
129
+ * @public
130
+ */
131
+ export class QualifierTypeFactory extends ChainedConfigInitFactory {
132
+ /**
133
+ * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
134
+ * @param factories - Array of factories for custom qualifier types. Can be:
135
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
136
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
137
+ * - A mix of both
138
+ * These are tried in order before falling back to built-in types.
139
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
140
+ * system qualifier types (Language, Territory, Literal).
141
+ */
142
+ constructor(factories) {
143
+ const normalizedFactories = factories.map((f) => typeof f === 'function' ? createQualifierTypeFactory(f) : f);
144
+ super([...normalizedFactories, new BuiltInQualifierTypeFactory()]);
145
+ }
146
+ }
147
+ /**
148
+ * A factory that validates and creates {@link QualifierTypes.QualifierType | QualifierType} instances
149
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
150
+ * string properties and validates them before delegating to the underlying factory chain.
151
+ *
152
+ * This pattern is useful at package boundaries where type identity issues may occur with
153
+ * branded types across different package instances.
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * // Accept weakly-typed config from external source
158
+ * const validatingFactory = new ValidatingQualifierTypeFactory([customFactory]);
159
+ *
160
+ * // Config can have plain string types instead of branded types
161
+ * const config = {
162
+ * name: 'my-qualifier', // plain string, not QualifierTypeName
163
+ * systemType: 'custom', // plain string
164
+ * configuration: { ... }
165
+ * };
166
+ *
167
+ * const result = validatingFactory.create(config); // Validates and converts internally
168
+ * ```
169
+ *
170
+ * @public
171
+ */
172
+ export class ValidatingQualifierTypeFactory {
173
+ /**
174
+ * Constructor for a validating qualifier type factory.
175
+ * @param factories - Array of factories for custom qualifier types. Can be:
176
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
177
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
178
+ * - A mix of both
179
+ */
180
+ constructor(factories) {
181
+ this._innerFactory = new QualifierTypeFactory(factories);
182
+ }
183
+ /**
184
+ * Creates a qualifier type from a weakly-typed configuration object.
185
+ * @param config - The configuration object to validate and use for creation.
186
+ * @returns A result containing the new qualifier type if successful.
187
+ */
188
+ create(config) {
189
+ return QualifierTypes.Config.Convert.anyQualifierTypeConfig
190
+ .convert(config)
191
+ .onSuccess((validatedConfig) => {
192
+ return this._innerFactory.create(validatedConfig);
193
+ });
194
+ }
195
+ }
196
+ /**
197
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}.
198
+ * @public
199
+ */
200
+ export class BuiltInResourceTypeFactory {
201
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
202
+ create(config) {
203
+ return ResourceTypes.createResourceTypeFromConfig(config);
204
+ }
205
+ }
206
+ /**
207
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}
208
+ * by chaining a supplied factory with a {@link Config.BuiltInResourceTypeFactory | built-in factory} that handles built-in resource types.
209
+ * @public
210
+ */
211
+ export class ResourceTypeFactory extends ChainedConfigInitFactory {
212
+ /**
213
+ * Constructor for a resource type factory.
214
+ * @param factories - Array of factories for resource types. Can be:
215
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
216
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
217
+ * - A mix of both
218
+ * @remarks The {@link Config.BuiltInResourceTypeFactory | built-in factory} is always added to the end of the chain.
219
+ */
220
+ constructor(factories) {
221
+ factories = factories !== null && factories !== void 0 ? factories : [];
222
+ const normalizedFactories = factories.map((f) => typeof f === 'function' ? createResourceTypeFactory(f) : f);
223
+ super([...normalizedFactories, new BuiltInResourceTypeFactory()]);
224
+ }
225
+ }
226
+ /**
227
+ * A factory that validates and creates {@link ResourceTypes.ResourceType | ResourceType} instances
228
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
229
+ * string properties and validates them before delegating to the underlying factory chain.
230
+ *
231
+ * This pattern is useful at package boundaries where type identity issues may occur with
232
+ * branded types across different package instances.
233
+ *
234
+ * @public
235
+ */
236
+ export class ValidatingResourceTypeFactory {
237
+ /**
238
+ * Constructor for a validating resource type factory.
239
+ * @param factories - Array of factories for resource types. Can be:
240
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
241
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
242
+ * - A mix of both
243
+ */
244
+ constructor(factories) {
245
+ this._innerFactory = new ResourceTypeFactory(factories);
246
+ }
247
+ /**
248
+ * Creates a resource type from a weakly-typed configuration object.
249
+ * @param config - The configuration object to validate and use for creation.
250
+ * @returns A result containing the new resource type if successful.
251
+ */
252
+ create(config) {
253
+ return ResourceTypes.Config.Convert.resourceTypeConfig.convert(config).onSuccess((validatedConfig) => {
254
+ return this._innerFactory.create(validatedConfig);
255
+ });
256
+ }
257
+ }
258
+ //# sourceMappingURL=configInitFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configInitFactory.js","sourceRoot":"","sources":["../../../src/packlets/config/configInitFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAU,IAAI,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAgCnD;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,EAAmC;IAEnC,OAAO;QACL,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,EAA+B;IAE/B,OAAO;QACL,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAGnC;;;OAGG;IACH,YAAmB,SAA2C;QAC5D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAe;QAC3B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;gBACvB,OAAO,MAAM,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AAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IAGrC,qDAAqD;IAC9C,MAAM,CAAC,MAAgD;QAC5D,OAAO,aAAa,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,wBAGxC;IACC;;;;;;;OAOG;IACH,YACE,SAEC;QAED,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;QAC5B,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9C,OAAO,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3D,CAAC;QACF,KAAK,CAAC,CAAC,GAAG,mBAAmB,EAAE,IAAI,0BAA0B,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,6BAA6B;IAGxC;;;;;;OAMG;IACH,YACE,SAEC;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAe;QAC3B,OAAO,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,EAAE,EAAE;YACnG,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, fail } from '@fgv/ts-utils';\nimport { QualifierType, SystemQualifierType } from '../qualifier-types';\nimport * as QualifierTypes from '../qualifier-types';\nimport * as ResourceTypes from '../resource-types';\nimport { ResourceType } from '../resource-types';\n\n/**\n * Function signature for creating a qualifier type from configuration.\n * @public\n */\nexport type QualifierTypeFactoryFunction<T extends QualifierType = QualifierType> = (\n config: QualifierTypes.Config.IAnyQualifierTypeConfig\n) => Result<T>;\n\n/**\n * Function signature for creating a resource type from configuration.\n * @public\n */\nexport type ResourceTypeFactoryFunction = (\n config: ResourceTypes.Config.IResourceTypeConfig\n) => Result<ResourceType>;\n\n/**\n * Interface for a factory that creates a new instance of a configuration object.\n * @public\n */\nexport interface IConfigInitFactory<TConfig, T> {\n /**\n * Creates a new instance of a configuration object.\n * @param config - The configuration object to create.\n * @returns A result containing the new instance of the configuration object.\n */\n create(config: TConfig): Result<T>;\n}\n\n/**\n * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a factory function.\n * @param fn - The factory function to wrap.\n * @returns An `IConfigInitFactory` instance that delegates to the function.\n * @public\n */\nexport function createQualifierTypeFactory<T extends QualifierType = QualifierType>(\n fn: QualifierTypeFactoryFunction<T>\n): IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T> {\n return {\n create: fn\n };\n}\n\n/**\n * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a resource type factory function.\n * @param fn - The factory function to wrap.\n * @returns An `IConfigInitFactory` instance that delegates to the function.\n * @public\n */\nexport function createResourceTypeFactory(\n fn: ResourceTypeFactoryFunction\n): IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> {\n return {\n create: fn\n };\n}\n\n/**\n * A factory that chains multiple factories together.\n * @public\n */\nexport class ChainedConfigInitFactory<TConfig, T> implements IConfigInitFactory<TConfig, T> {\n public readonly factories: IConfigInitFactory<TConfig, T>[];\n\n /**\n * Constructor for a chained config init factory.\n * @param factories - The factories to chain.\n */\n public constructor(factories: IConfigInitFactory<TConfig, T>[]) {\n this.factories = factories;\n }\n\n /**\n * Creates a new instance of a configuration object.\n * @param config - The configuration object to create.\n * @returns A result containing the new instance of the configuration object.\n */\n public create(config: TConfig): Result<T> {\n for (const factory of this.factories) {\n const result = factory.create(config);\n if (result.isSuccess()) {\n return result;\n }\n }\n return fail('No factory was able to create the configuration object');\n }\n}\n\n/**\n * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from\n * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.\n * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport class BuiltInQualifierTypeFactory\n implements IConfigInitFactory<QualifierTypes.Config.ISystemQualifierTypeConfig, SystemQualifierType>\n{\n /** {@inheritDoc Config.IConfigInitFactory.create} */\n public create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<SystemQualifierType> {\n if (QualifierTypes.Config.isSystemQualifierTypeConfig(config)) {\n return QualifierTypes.createQualifierTypeFromSystemConfig(config);\n }\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n return fail(`${config.name}: unknown built-in qualifier type (${config.systemType})`);\n }\n}\n\n/**\n * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,\n * supporting both built-in system types and custom external types.\n *\n * This factory allows external consumers to extend the qualifier type system with their own custom types\n * while maintaining support for all built-in types (Language, Territory, Literal).\n *\n * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.\n *\n * @example Creating a factory with custom qualifier types\n * ```typescript\n * // Define a custom qualifier type\n * class CustomQualifierType extends QualifierType {\n * // ... implementation\n * }\n *\n * // Define a discriminated union of all types\n * type AppQualifierType = SystemQualifierType | CustomQualifierType;\n *\n * // Create a factory that handles custom types\n * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {\n * create(config) {\n * // ... handle custom type creation\n * }\n * };\n *\n * // Create the combined factory\n * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);\n *\n * // The factory returns T | SystemQualifierType, supporting all types\n * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>\n * ```\n *\n * @remarks\n * - The factory chains custom factories with the built-in factory\n * - Custom factories are tried first, falling back to built-in types\n * - The return type is a union of custom types (T) and system types\n *\n * @public\n */\nexport class QualifierTypeFactory<\n T extends QualifierType = SystemQualifierType\n> extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T | SystemQualifierType> {\n /**\n * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.\n * @param factories - Array of factories for custom qualifier types. Can be:\n * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances\n * - {@link Config.QualifierTypeFactoryFunction | Factory functions}\n * - A mix of both\n * These are tried in order before falling back to built-in types.\n * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle\n * system qualifier types (Language, Territory, Literal).\n */\n public constructor(\n factories: Array<\n IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T> | QualifierTypeFactoryFunction<T>\n >\n ) {\n const normalizedFactories = factories.map((f) =>\n typeof f === 'function' ? createQualifierTypeFactory(f) : f\n );\n super([...normalizedFactories, new BuiltInQualifierTypeFactory()]);\n }\n}\n\n/**\n * A factory that validates and creates {@link QualifierTypes.QualifierType | QualifierType} instances\n * from weakly-typed configuration objects. This factory accepts configurations with unvalidated\n * string properties and validates them before delegating to the underlying factory chain.\n *\n * This pattern is useful at package boundaries where type identity issues may occur with\n * branded types across different package instances.\n *\n * @example\n * ```typescript\n * // Accept weakly-typed config from external source\n * const validatingFactory = new ValidatingQualifierTypeFactory([customFactory]);\n *\n * // Config can have plain string types instead of branded types\n * const config = {\n * name: 'my-qualifier', // plain string, not QualifierTypeName\n * systemType: 'custom', // plain string\n * configuration: { ... }\n * };\n *\n * const result = validatingFactory.create(config); // Validates and converts internally\n * ```\n *\n * @public\n */\nexport class ValidatingQualifierTypeFactory<T extends QualifierType = SystemQualifierType>\n implements IConfigInitFactory<unknown, T | SystemQualifierType>\n{\n private readonly _innerFactory: QualifierTypeFactory<T>;\n\n /**\n * Constructor for a validating qualifier type factory.\n * @param factories - Array of factories for custom qualifier types. Can be:\n * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances\n * - {@link Config.QualifierTypeFactoryFunction | Factory functions}\n * - A mix of both\n */\n public constructor(\n factories: Array<\n IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T> | QualifierTypeFactoryFunction<T>\n >\n ) {\n this._innerFactory = new QualifierTypeFactory(factories);\n }\n\n /**\n * Creates a qualifier type from a weakly-typed configuration object.\n * @param config - The configuration object to validate and use for creation.\n * @returns A result containing the new qualifier type if successful.\n */\n public create(config: unknown): Result<T | SystemQualifierType> {\n return QualifierTypes.Config.Convert.anyQualifierTypeConfig\n .convert(config)\n .onSuccess((validatedConfig) => {\n return this._innerFactory.create(validatedConfig);\n });\n }\n}\n\n/**\n * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}.\n * @public\n */\nexport class BuiltInResourceTypeFactory\n implements IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType>\n{\n /** {@inheritDoc Config.IConfigInitFactory.create} */\n public create(config: ResourceTypes.Config.IResourceTypeConfig): Result<ResourceType> {\n return ResourceTypes.createResourceTypeFromConfig(config);\n }\n}\n\n/**\n * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}\n * by chaining a supplied factory with a {@link Config.BuiltInResourceTypeFactory | built-in factory} that handles built-in resource types.\n * @public\n */\nexport class ResourceTypeFactory extends ChainedConfigInitFactory<\n ResourceTypes.Config.IResourceTypeConfig,\n ResourceType\n> {\n /**\n * Constructor for a resource type factory.\n * @param factories - Array of factories for resource types. Can be:\n * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances\n * - {@link Config.ResourceTypeFactoryFunction | Factory functions}\n * - A mix of both\n * @remarks The {@link Config.BuiltInResourceTypeFactory | built-in factory} is always added to the end of the chain.\n */\n public constructor(\n factories: Array<\n IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> | ResourceTypeFactoryFunction\n >\n ) {\n factories = factories ?? [];\n const normalizedFactories = factories.map((f) =>\n typeof f === 'function' ? createResourceTypeFactory(f) : f\n );\n super([...normalizedFactories, new BuiltInResourceTypeFactory()]);\n }\n}\n\n/**\n * A factory that validates and creates {@link ResourceTypes.ResourceType | ResourceType} instances\n * from weakly-typed configuration objects. This factory accepts configurations with unvalidated\n * string properties and validates them before delegating to the underlying factory chain.\n *\n * This pattern is useful at package boundaries where type identity issues may occur with\n * branded types across different package instances.\n *\n * @public\n */\nexport class ValidatingResourceTypeFactory implements IConfigInitFactory<unknown, ResourceType> {\n private readonly _innerFactory: ResourceTypeFactory;\n\n /**\n * Constructor for a validating resource type factory.\n * @param factories - Array of factories for resource types. Can be:\n * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances\n * - {@link Config.ResourceTypeFactoryFunction | Factory functions}\n * - A mix of both\n */\n public constructor(\n factories: Array<\n IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> | ResourceTypeFactoryFunction\n >\n ) {\n this._innerFactory = new ResourceTypeFactory(factories);\n }\n\n /**\n * Creates a resource type from a weakly-typed configuration object.\n * @param config - The configuration object to validate and use for creation.\n * @returns A result containing the new resource type if successful.\n */\n public create(config: unknown): Result<ResourceType> {\n return ResourceTypes.Config.Convert.resourceTypeConfig.convert(config).onSuccess((validatedConfig) => {\n return this._innerFactory.create(validatedConfig);\n });\n }\n}\n"]}
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /* eslint-disable @rushstack/typedef-var */
23
+ import { Converters } from '@fgv/ts-utils';
24
+ import * as QualifierTypes from '../qualifier-types';
25
+ import * as Qualifiers from '../qualifiers';
26
+ import * as ResourceTypes from '../resource-types';
27
+ import { allPredefinedSystemConfigurations } from './common';
28
+ /**
29
+ * A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.
30
+ * @returns A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.
31
+ * @public
32
+ */
33
+ export const systemConfiguration = Converters.strictObject({
34
+ name: Converters.optionalString,
35
+ description: Converters.optionalString,
36
+ qualifierTypes: Converters.arrayOf(QualifierTypes.Config.Convert.anyQualifierTypeConfig),
37
+ qualifiers: Converters.arrayOf(Qualifiers.Convert.qualifierDecl),
38
+ resourceTypes: Converters.arrayOf(ResourceTypes.Config.Convert.resourceTypeConfig)
39
+ });
40
+ /**
41
+ * A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.
42
+ * @returns A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.
43
+ * @public
44
+ */
45
+ export const predefinedSystemConfiguration = Converters.enumeratedValue(allPredefinedSystemConfigurations);
46
+ /**
47
+ * Validate a {@link Config.Model.ISystemConfiguration | ISystemConfiguration} object.
48
+ * @param config - The system configuration to validate
49
+ * @returns `Success` with the validated system configuration if successful,
50
+ * or `Failure` with an error message if validation fails.
51
+ * @public
52
+ */
53
+ export function validateSystemConfiguration(config) {
54
+ return systemConfiguration.convert(config);
55
+ }
56
+ //# sourceMappingURL=convert.js.map