@fgv/ts-res 5.1.0-19 → 5.1.0-20

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 (443) 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.map +1 -0
  17. package/dist/packlets/common/index.js.map +1 -0
  18. package/dist/packlets/common/resources.js.map +1 -0
  19. package/dist/packlets/common/validate/conditions.js.map +1 -0
  20. package/dist/packlets/common/validate/index.js.map +1 -0
  21. package/dist/packlets/common/validate/regularExpressions.js.map +1 -0
  22. package/dist/packlets/common/validate/resources.js.map +1 -0
  23. package/dist/packlets/conditions/condition.js.map +1 -0
  24. package/dist/packlets/conditions/conditionCollector.js.map +1 -0
  25. package/dist/packlets/conditions/conditionDecls.js.map +1 -0
  26. package/dist/packlets/conditions/conditionSet.js.map +1 -0
  27. package/dist/packlets/conditions/conditionSetCollector.js.map +1 -0
  28. package/dist/packlets/conditions/conditionSetDecls.js.map +1 -0
  29. package/dist/packlets/conditions/conditionToken.js.map +1 -0
  30. package/dist/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  31. package/dist/packlets/conditions/convert/decls.js.map +1 -0
  32. package/dist/packlets/conditions/convert/index.js.map +1 -0
  33. package/dist/packlets/conditions/index.js.map +1 -0
  34. package/dist/packlets/config/common.js.map +1 -0
  35. package/dist/packlets/config/configInitFactory.js.map +1 -0
  36. package/dist/packlets/config/convert.js.map +1 -0
  37. package/dist/packlets/config/index.browser.js.map +1 -0
  38. package/dist/packlets/config/index.js.map +1 -0
  39. package/dist/packlets/config/json.js.map +1 -0
  40. package/dist/packlets/config/predefined/default.js.map +1 -0
  41. package/dist/packlets/config/predefined/extended.js.map +1 -0
  42. package/dist/packlets/config/predefined/index.js.map +1 -0
  43. package/dist/packlets/config/systemConfiguration.js.map +1 -0
  44. package/dist/packlets/context/contextDecls.js.map +1 -0
  45. package/dist/packlets/context/contextToken.js.map +1 -0
  46. package/dist/packlets/context/convert/decls.js.map +1 -0
  47. package/dist/packlets/context/convert/index.js.map +1 -0
  48. package/dist/packlets/context/index.js.map +1 -0
  49. package/dist/packlets/decisions/abstractDecision.js.map +1 -0
  50. package/dist/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  51. package/dist/packlets/decisions/candidate.js.map +1 -0
  52. package/dist/packlets/decisions/common.js.map +1 -0
  53. package/dist/packlets/decisions/concreteDecision.js.map +1 -0
  54. package/dist/packlets/decisions/decision.js.map +1 -0
  55. package/dist/packlets/decisions/index.js.map +1 -0
  56. package/dist/packlets/import/fsItem.js.map +1 -0
  57. package/dist/packlets/import/importContext.js.map +1 -0
  58. package/dist/packlets/import/importManager.js.map +1 -0
  59. package/dist/packlets/import/importable.js.map +1 -0
  60. package/dist/packlets/import/importers/collectionImporter.js.map +1 -0
  61. package/dist/packlets/import/importers/fsItemImporter.js.map +1 -0
  62. package/dist/packlets/import/importers/importer.js.map +1 -0
  63. package/dist/packlets/import/importers/index.browser.js.map +1 -0
  64. package/dist/packlets/import/importers/index.js.map +1 -0
  65. package/dist/packlets/import/importers/jsonImporter.js.map +1 -0
  66. package/dist/packlets/import/importers/pathImporter.js.map +1 -0
  67. package/dist/packlets/import/index.browser.js.map +1 -0
  68. package/dist/packlets/import/index.js.map +1 -0
  69. package/dist/packlets/qualifier-types/config/convert.js.map +1 -0
  70. package/dist/packlets/qualifier-types/config/index.js.map +1 -0
  71. package/dist/packlets/qualifier-types/config/json.js.map +1 -0
  72. package/dist/packlets/qualifier-types/convert.js.map +1 -0
  73. package/dist/packlets/qualifier-types/helpers.js.map +1 -0
  74. package/dist/packlets/qualifier-types/index.js.map +1 -0
  75. package/dist/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  76. package/dist/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  77. package/dist/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  78. package/dist/packlets/qualifier-types/qualifierType.js.map +1 -0
  79. package/dist/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  80. package/dist/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  81. package/dist/packlets/qualifiers/convert/decls.js.map +1 -0
  82. package/dist/packlets/qualifiers/convert/index.js.map +1 -0
  83. package/dist/packlets/qualifiers/convert/qualifier.js.map +1 -0
  84. package/dist/packlets/qualifiers/index.js.map +1 -0
  85. package/dist/packlets/qualifiers/qualifier.js.map +1 -0
  86. package/dist/packlets/qualifiers/qualifierCollector.js.map +1 -0
  87. package/dist/packlets/qualifiers/qualifierDecl.js.map +1 -0
  88. package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  89. package/dist/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  90. package/dist/packlets/resource-json/compiled/common.js.map +1 -0
  91. package/dist/packlets/resource-json/compiled/convert.js.map +1 -0
  92. package/dist/packlets/resource-json/compiled/index.js.map +1 -0
  93. package/dist/packlets/resource-json/compiled/json.js.map +1 -0
  94. package/dist/packlets/resource-json/convert.js.map +1 -0
  95. package/dist/packlets/resource-json/helpers.js.map +1 -0
  96. package/dist/packlets/resource-json/index.js.map +1 -0
  97. package/dist/packlets/resource-json/json.js.map +1 -0
  98. package/dist/packlets/resource-json/normalized.js.map +1 -0
  99. package/dist/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  100. package/dist/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  101. package/dist/packlets/resource-json/resourceDeclTree.js.map +1 -0
  102. package/dist/packlets/resource-types/config/convert.js.map +1 -0
  103. package/dist/packlets/resource-types/config/index.js.map +1 -0
  104. package/dist/packlets/resource-types/config/json.js.map +1 -0
  105. package/dist/packlets/resource-types/helpers.js.map +1 -0
  106. package/dist/packlets/resource-types/index.js.map +1 -0
  107. package/dist/packlets/resource-types/jsonResourceType.js.map +1 -0
  108. package/dist/packlets/resource-types/resourceType.js.map +1 -0
  109. package/dist/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  110. package/dist/packlets/resources/candidateReducer.js.map +1 -0
  111. package/dist/packlets/resources/candidateValue.js.map +1 -0
  112. package/dist/packlets/resources/candidateValueCollector.js.map +1 -0
  113. package/dist/packlets/resources/common.js.map +1 -0
  114. package/dist/packlets/resources/deltaGenerator.js.map +1 -0
  115. package/dist/packlets/resources/index.js.map +1 -0
  116. package/dist/packlets/resources/resource.js.map +1 -0
  117. package/dist/packlets/resources/resourceBuilder.js.map +1 -0
  118. package/dist/packlets/resources/resourceCandidate.js.map +1 -0
  119. package/dist/packlets/resources/resourceManagerBuilder.js.map +1 -0
  120. package/dist/packlets/runtime/cacheListener.js.map +1 -0
  121. package/dist/packlets/runtime/cacheMetrics.js.map +1 -0
  122. package/dist/packlets/runtime/compiledResourceCollection.js.map +1 -0
  123. package/dist/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  124. package/dist/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  125. package/dist/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  126. package/dist/packlets/runtime/context/index.js.map +1 -0
  127. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  128. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  129. package/dist/packlets/runtime/iResourceManager.js.map +1 -0
  130. package/dist/packlets/runtime/index.js.map +1 -0
  131. package/dist/packlets/runtime/resource-tree/common.js.map +1 -0
  132. package/dist/packlets/runtime/resource-tree/index.js.map +1 -0
  133. package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  134. package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  135. package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  136. package/dist/packlets/runtime/resourceResolver.js.map +1 -0
  137. package/dist/packlets/runtime/resourceTreeResolver.js.map +1 -0
  138. package/dist/packlets/runtime/validate.js.map +1 -0
  139. package/dist/packlets/zip-archive/convert.js.map +1 -0
  140. package/dist/packlets/zip-archive/index.browser.js.map +1 -0
  141. package/dist/packlets/zip-archive/index.js.map +1 -0
  142. package/dist/packlets/zip-archive/json.js.map +1 -0
  143. package/dist/packlets/zip-archive/types.js.map +1 -0
  144. package/dist/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  145. package/dist/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  146. package/dist/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  147. package/lib/index.browser.d.ts.map +1 -0
  148. package/lib/index.browser.js.map +1 -0
  149. package/lib/index.d.ts.map +1 -0
  150. package/lib/index.js.map +1 -0
  151. package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
  152. package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
  153. package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
  154. package/lib/packlets/bundle/bundleLoader.js.map +1 -0
  155. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
  156. package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
  157. package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
  158. package/lib/packlets/bundle/bundleUtils.js.map +1 -0
  159. package/lib/packlets/bundle/convert.d.ts.map +1 -0
  160. package/lib/packlets/bundle/convert.js.map +1 -0
  161. package/lib/packlets/bundle/index.d.ts.map +1 -0
  162. package/lib/packlets/bundle/index.js.map +1 -0
  163. package/lib/packlets/bundle/model.d.ts.map +1 -0
  164. package/lib/packlets/bundle/model.js.map +1 -0
  165. package/lib/packlets/common/conditions.d.ts.map +1 -0
  166. package/lib/packlets/common/conditions.js.map +1 -0
  167. package/lib/packlets/common/convert.d.ts.map +1 -0
  168. package/lib/packlets/common/convert.js.map +1 -0
  169. package/lib/packlets/common/helpers/conditions.d.ts.map +1 -0
  170. package/lib/packlets/common/helpers/conditions.js.map +1 -0
  171. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  172. package/lib/packlets/common/helpers/context.js.map +1 -0
  173. package/lib/packlets/common/helpers/index.d.ts.map +1 -0
  174. package/lib/packlets/common/helpers/index.js.map +1 -0
  175. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  176. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  177. package/lib/packlets/common/helpers/resources.d.ts.map +1 -0
  178. package/lib/packlets/common/helpers/resources.js.map +1 -0
  179. package/lib/packlets/common/index.d.ts.map +1 -0
  180. package/lib/packlets/common/index.js.map +1 -0
  181. package/lib/packlets/common/resources.d.ts.map +1 -0
  182. package/lib/packlets/common/resources.js.map +1 -0
  183. package/lib/packlets/common/validate/conditions.d.ts.map +1 -0
  184. package/lib/packlets/common/validate/conditions.js.map +1 -0
  185. package/lib/packlets/common/validate/index.d.ts.map +1 -0
  186. package/lib/packlets/common/validate/index.js.map +1 -0
  187. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -0
  188. package/lib/packlets/common/validate/regularExpressions.js.map +1 -0
  189. package/lib/packlets/common/validate/resources.d.ts.map +1 -0
  190. package/lib/packlets/common/validate/resources.js.map +1 -0
  191. package/lib/packlets/conditions/condition.d.ts.map +1 -0
  192. package/lib/packlets/conditions/condition.js.map +1 -0
  193. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -0
  194. package/lib/packlets/conditions/conditionCollector.js.map +1 -0
  195. package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -0
  196. package/lib/packlets/conditions/conditionDecls.js.map +1 -0
  197. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -0
  198. package/lib/packlets/conditions/conditionSet.js.map +1 -0
  199. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -0
  200. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -0
  201. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -0
  202. package/lib/packlets/conditions/conditionSetDecls.js.map +1 -0
  203. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -0
  204. package/lib/packlets/conditions/conditionToken.js.map +1 -0
  205. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -0
  206. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  207. package/lib/packlets/conditions/convert/decls.d.ts.map +1 -0
  208. package/lib/packlets/conditions/convert/decls.js.map +1 -0
  209. package/lib/packlets/conditions/convert/index.d.ts.map +1 -0
  210. package/lib/packlets/conditions/convert/index.js.map +1 -0
  211. package/lib/packlets/conditions/index.d.ts.map +1 -0
  212. package/lib/packlets/conditions/index.js.map +1 -0
  213. package/lib/packlets/config/common.d.ts.map +1 -0
  214. package/lib/packlets/config/common.js.map +1 -0
  215. package/lib/packlets/config/configInitFactory.d.ts.map +1 -0
  216. package/lib/packlets/config/configInitFactory.js.map +1 -0
  217. package/lib/packlets/config/convert.d.ts.map +1 -0
  218. package/lib/packlets/config/convert.js.map +1 -0
  219. package/lib/packlets/config/index.browser.d.ts.map +1 -0
  220. package/lib/packlets/config/index.browser.js.map +1 -0
  221. package/lib/packlets/config/index.d.ts.map +1 -0
  222. package/lib/packlets/config/index.js.map +1 -0
  223. package/lib/packlets/config/json.d.ts.map +1 -0
  224. package/lib/packlets/config/json.js.map +1 -0
  225. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  226. package/lib/packlets/config/predefined/default.js.map +1 -0
  227. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  228. package/lib/packlets/config/predefined/extended.js.map +1 -0
  229. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  230. package/lib/packlets/config/predefined/index.js.map +1 -0
  231. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  232. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  233. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  234. package/lib/packlets/context/contextDecls.js.map +1 -0
  235. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  236. package/lib/packlets/context/contextToken.js.map +1 -0
  237. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  238. package/lib/packlets/context/convert/decls.js.map +1 -0
  239. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  240. package/lib/packlets/context/convert/index.js.map +1 -0
  241. package/lib/packlets/context/index.d.ts.map +1 -0
  242. package/lib/packlets/context/index.js.map +1 -0
  243. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -0
  244. package/lib/packlets/decisions/abstractDecision.js.map +1 -0
  245. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -0
  246. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  247. package/lib/packlets/decisions/candidate.d.ts.map +1 -0
  248. package/lib/packlets/decisions/candidate.js.map +1 -0
  249. package/lib/packlets/decisions/common.d.ts.map +1 -0
  250. package/lib/packlets/decisions/common.js.map +1 -0
  251. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -0
  252. package/lib/packlets/decisions/concreteDecision.js.map +1 -0
  253. package/lib/packlets/decisions/decision.d.ts.map +1 -0
  254. package/lib/packlets/decisions/decision.js.map +1 -0
  255. package/lib/packlets/decisions/index.d.ts.map +1 -0
  256. package/lib/packlets/decisions/index.js.map +1 -0
  257. package/lib/packlets/import/fsItem.d.ts.map +1 -0
  258. package/lib/packlets/import/fsItem.js.map +1 -0
  259. package/lib/packlets/import/importContext.d.ts.map +1 -0
  260. package/lib/packlets/import/importContext.js.map +1 -0
  261. package/lib/packlets/import/importManager.d.ts.map +1 -0
  262. package/lib/packlets/import/importManager.js.map +1 -0
  263. package/lib/packlets/import/importable.d.ts.map +1 -0
  264. package/lib/packlets/import/importable.js.map +1 -0
  265. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -0
  266. package/lib/packlets/import/importers/collectionImporter.js.map +1 -0
  267. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -0
  268. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -0
  269. package/lib/packlets/import/importers/importer.d.ts.map +1 -0
  270. package/lib/packlets/import/importers/importer.js.map +1 -0
  271. package/lib/packlets/import/importers/index.browser.d.ts.map +1 -0
  272. package/lib/packlets/import/importers/index.browser.js.map +1 -0
  273. package/lib/packlets/import/importers/index.d.ts.map +1 -0
  274. package/lib/packlets/import/importers/index.js.map +1 -0
  275. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -0
  276. package/lib/packlets/import/importers/jsonImporter.js.map +1 -0
  277. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -0
  278. package/lib/packlets/import/importers/pathImporter.js.map +1 -0
  279. package/lib/packlets/import/index.browser.d.ts.map +1 -0
  280. package/lib/packlets/import/index.browser.js.map +1 -0
  281. package/lib/packlets/import/index.d.ts.map +1 -0
  282. package/lib/packlets/import/index.js.map +1 -0
  283. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  284. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  285. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  286. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  287. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  288. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  289. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -0
  290. package/lib/packlets/qualifier-types/convert.js.map +1 -0
  291. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  292. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  293. package/lib/packlets/qualifier-types/index.d.ts.map +1 -0
  294. package/lib/packlets/qualifier-types/index.js.map +1 -0
  295. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -0
  296. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  297. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -0
  298. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  299. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  300. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  301. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -0
  302. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -0
  303. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -0
  304. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  305. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -0
  306. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  307. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -0
  308. package/lib/packlets/qualifiers/convert/decls.js.map +1 -0
  309. package/lib/packlets/qualifiers/convert/index.d.ts.map +1 -0
  310. package/lib/packlets/qualifiers/convert/index.js.map +1 -0
  311. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +1 -0
  312. package/lib/packlets/qualifiers/convert/qualifier.js.map +1 -0
  313. package/lib/packlets/qualifiers/index.d.ts.map +1 -0
  314. package/lib/packlets/qualifiers/index.js.map +1 -0
  315. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -0
  316. package/lib/packlets/qualifiers/qualifier.js.map +1 -0
  317. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -0
  318. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -0
  319. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -0
  320. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -0
  321. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  322. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  323. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  324. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  325. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  326. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  327. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  328. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  329. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  330. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  331. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  332. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  333. package/lib/packlets/resource-json/convert.d.ts.map +1 -0
  334. package/lib/packlets/resource-json/convert.js.map +1 -0
  335. package/lib/packlets/resource-json/helpers.d.ts.map +1 -0
  336. package/lib/packlets/resource-json/helpers.js.map +1 -0
  337. package/lib/packlets/resource-json/index.d.ts.map +1 -0
  338. package/lib/packlets/resource-json/index.js.map +1 -0
  339. package/lib/packlets/resource-json/json.d.ts.map +1 -0
  340. package/lib/packlets/resource-json/json.js.map +1 -0
  341. package/lib/packlets/resource-json/normalized.d.ts.map +1 -0
  342. package/lib/packlets/resource-json/normalized.js.map +1 -0
  343. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -0
  344. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  345. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -0
  346. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  347. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -0
  348. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -0
  349. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  350. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  351. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  352. package/lib/packlets/resource-types/config/index.js.map +1 -0
  353. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  354. package/lib/packlets/resource-types/config/json.js.map +1 -0
  355. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  356. package/lib/packlets/resource-types/helpers.js.map +1 -0
  357. package/lib/packlets/resource-types/index.d.ts.map +1 -0
  358. package/lib/packlets/resource-types/index.js.map +1 -0
  359. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -0
  360. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -0
  361. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -0
  362. package/lib/packlets/resource-types/resourceType.js.map +1 -0
  363. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +1 -0
  364. package/lib/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  365. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  366. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  367. package/lib/packlets/resources/candidateValue.d.ts.map +1 -0
  368. package/lib/packlets/resources/candidateValue.js.map +1 -0
  369. package/lib/packlets/resources/candidateValueCollector.d.ts.map +1 -0
  370. package/lib/packlets/resources/candidateValueCollector.js.map +1 -0
  371. package/lib/packlets/resources/common.d.ts.map +1 -0
  372. package/lib/packlets/resources/common.js.map +1 -0
  373. package/lib/packlets/resources/deltaGenerator.d.ts.map +1 -0
  374. package/lib/packlets/resources/deltaGenerator.js.map +1 -0
  375. package/lib/packlets/resources/index.d.ts.map +1 -0
  376. package/lib/packlets/resources/index.js.map +1 -0
  377. package/lib/packlets/resources/resource.d.ts.map +1 -0
  378. package/lib/packlets/resources/resource.js.map +1 -0
  379. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -0
  380. package/lib/packlets/resources/resourceBuilder.js.map +1 -0
  381. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -0
  382. package/lib/packlets/resources/resourceCandidate.js.map +1 -0
  383. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  384. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  385. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  386. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  387. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  388. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  389. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  390. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  391. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  392. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  393. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  394. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  395. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  396. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  397. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  398. package/lib/packlets/runtime/context/index.js.map +1 -0
  399. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  400. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  401. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  402. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  403. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  404. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  405. package/lib/packlets/runtime/index.d.ts.map +1 -0
  406. package/lib/packlets/runtime/index.js.map +1 -0
  407. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  408. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  409. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  410. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  411. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  412. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  413. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  414. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  415. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  416. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  417. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  418. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  419. package/lib/packlets/runtime/resourceTreeResolver.d.ts.map +1 -0
  420. package/lib/packlets/runtime/resourceTreeResolver.js.map +1 -0
  421. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  422. package/lib/packlets/runtime/validate.js.map +1 -0
  423. package/lib/packlets/zip-archive/convert.d.ts.map +1 -0
  424. package/lib/packlets/zip-archive/convert.js.map +1 -0
  425. package/lib/packlets/zip-archive/index.browser.d.ts.map +1 -0
  426. package/lib/packlets/zip-archive/index.browser.js.map +1 -0
  427. package/lib/packlets/zip-archive/index.d.ts.map +1 -0
  428. package/lib/packlets/zip-archive/index.js.map +1 -0
  429. package/lib/packlets/zip-archive/json.d.ts.map +1 -0
  430. package/lib/packlets/zip-archive/json.js.map +1 -0
  431. package/lib/packlets/zip-archive/types.d.ts.map +1 -0
  432. package/lib/packlets/zip-archive/types.js.map +1 -0
  433. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts.map +1 -0
  434. package/lib/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  435. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts.map +1 -0
  436. package/lib/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  437. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts.map +1 -0
  438. package/lib/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  439. package/package.json +9 -9
  440. package/dist/test/data/sample.json +0 -32
  441. package/dist/test/unit/qualifier-types/testQualifierType.js +0 -76
  442. package/dist/test/unit/resource-types/testDerivedResourceType.js +0 -109
  443. package/dist/test/unit/resources/deltaGenerator.helpers.js +0 -282
@@ -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,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AAC,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,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,C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AAO,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 @@
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 @@
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,MA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AAa,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 @@
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/config/convert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,2CAA2C;AAE3C,OAAO,EAAE,UAAU,EAAU,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,YAAY,CAAuB;IAC/E,IAAI,EAAE,UAAU,CAAC,cAAc;IAC/B,WAAW,EAAE,UAAU,CAAC,cAAc;IACtC,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC;IACxF,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC;IAChE,aAAa,EAAE,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;CACnF,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC,eAAe,CAAC,iCAAiC,CAAC,CAAC;AAE3G;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAe;IACzD,OAAO,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7C,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\n/* eslint-disable @rushstack/typedef-var */\n\nimport { Converters, Result } from '@fgv/ts-utils';\nimport { ISystemConfiguration } from './json';\nimport * as QualifierTypes from '../qualifier-types';\nimport * as Qualifiers from '../qualifiers';\nimport * as ResourceTypes from '../resource-types';\nimport { allPredefinedSystemConfigurations } from './common';\n\n/**\n * A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.\n * @returns A `Converter` for {@link Config.Model.ISystemConfiguration | ISystemConfiguration} objects.\n * @public\n */\nexport const systemConfiguration = Converters.strictObject<ISystemConfiguration>({\n name: Converters.optionalString,\n description: Converters.optionalString,\n qualifierTypes: Converters.arrayOf(QualifierTypes.Config.Convert.anyQualifierTypeConfig),\n qualifiers: Converters.arrayOf(Qualifiers.Convert.qualifierDecl),\n resourceTypes: Converters.arrayOf(ResourceTypes.Config.Convert.resourceTypeConfig)\n});\n\n/**\n * A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.\n * @returns A `Converter` for {@link Config.PredefinedSystemConfiguration | PredefinedSystemConfiguration} values.\n * @public\n */\nexport const predefinedSystemConfiguration = Converters.enumeratedValue(allPredefinedSystemConfigurations);\n\n/**\n * Validate a {@link Config.Model.ISystemConfiguration | ISystemConfiguration} object.\n * @param config - The system configuration to validate\n * @returns `Success` with the validated system configuration if successful,\n * or `Failure` with an error message if validation fails.\n * @public\n */\nexport function validateSystemConfiguration(config: unknown): Result<ISystemConfiguration> {\n return systemConfiguration.convert(config);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../src/packlets/config/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,yEAAyE;AAEzE,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,qBAAqB;AACrB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AAEzB,wFAAwF;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,oBAAoB;AACpB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAE1B,yBAAyB;AACzB,iFAAiF","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\n// Browser-safe config exports - excludes Node.js filesystem dependencies\n\nimport * as Model from './json';\nimport * as Convert from './convert';\n\n// Export all modules\nexport * from './configInitFactory';\nexport * from './common';\n\n// Export SystemConfiguration class but not as wildcard to avoid pulling in loadFromFile\nexport { SystemConfiguration } from './systemConfiguration';\n\n// Export namespaces\nexport { Model, Convert };\n\n// Excluded from browser:\n// - SystemConfiguration.loadFromFile() method (requires Node.js fs via JsonFile)\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,KAAK,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 Model from './json';\nimport * as Convert from './convert';\n\nexport * from './configInitFactory';\nexport * from './systemConfiguration';\nexport * from './common';\n\nexport { Model, Convert };\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/packlets/config/json.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 * as QualifierTypes from '../qualifier-types';\nimport * as Qualifiers from '../qualifiers';\nimport * as ResourceTypes from '../resource-types';\n\n/**\n * System configuration for both runtime or build.\n * @public\n */\nexport interface ISystemConfiguration {\n /** Optional human-readable name for the configuration. */\n\n name?: string;\n /** Optional description explaining the purpose and use case of the configuration. */\n description?: string;\n /** Qualifier type configurations that define the available qualifier types in the system. */\n qualifierTypes: QualifierTypes.Config.IAnyQualifierTypeConfig[];\n /** Qualifier declarations that define the available qualifiers in the system. */\n qualifiers: Qualifiers.IQualifierDecl[];\n /** Resource type configurations that define the available resource types in the system. */\n resourceTypes: ResourceTypes.Config.IResourceTypeConfig[];\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoE;IACpG;QACE,IAAI,EAAE,UAAU;QAChB,UAAU,EAA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wCAAwC;IACrD,cAAc,EAAE,CAAC,GAAG,qBAAqB,CAAC;IAC1C,UAAU,EAAE,CAAC,GAAG,0BAA0B,CAAC;IAC3C,aAAa,EAAE,CAAC,GAAG,oBAAoB,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC9D,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,8BAA8B;IAC3C,cAAc,EAAE,CAAC,GAAG,qBAAqB,CAAC;IAC1C,UAAU,EAAE,CAAC,GAAG,2BAA2B,CAAC;IAC5C,aAAa,EAAE,CAAC,GAAG,oBAAoB,CAAC;CACzC,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 { ISystemConfiguration } from '../json';\n\nimport * as QualifierTypes from '../../qualifier-types';\nimport * as Qualifiers from '../../qualifiers';\nimport * as ResourceTypes from '../../resource-types';\n\n/**\n * Default qualifier types.\n * @remarks\n * The default qualifier types are:\n * - language: recognizes BCP 47 language tags, accepts a comma-separated list of language tags in the context\n * - territory: recognizes ISO 3166-1 alpha-2 territory codes, accepts a single code in the context\n * @public\n */\nexport const DefaultQualifierTypes: ReadonlyArray<QualifierTypes.Config.ISystemQualifierTypeConfig> = [\n {\n name: 'language',\n systemType: 'language',\n configuration: {\n allowContextList: true\n }\n },\n {\n name: 'territory',\n systemType: 'territory',\n configuration: {\n allowContextList: false\n }\n }\n];\n\n/**\n * Qualifier definitions in which territory is the primary qualifier, with\n * language as a secondary qualifier.\n * @remarks\n * The default qualifiers are:\n * - currentTerritory(token: geo): territory qualifier, priority 850\n * - language(token: lang): language qualifier, priority 800\n * @public\n */\nexport const TerritoryPriorityQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 850\n },\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 800\n }\n];\n\n/**\n * Qualifier definitions in which language is the primary qualifier, with\n * territory as a secondary qualifier.\n * @remarks\n * The default qualifiers are:\n * - language(token: lang): language qualifier, priority 850\n * - currentTerritory(token: geo): territory qualifier, priority 800\n * @public\n */\nexport const LanguagePriorityQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 850\n },\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 800\n }\n];\n\n/**\n * Default resource types.\n * @public\n */\nexport const DefaultResourceTypes: ReadonlyArray<ResourceTypes.Config.IResourceTypeConfig> = [\n {\n name: 'json',\n typeName: 'json'\n }\n];\n\n/**\n * System configuration with territory as the primary qualifier, and\n * language as a secondary qualifier.\n * @public\n */\nexport const TerritoryPrioritySystemConfiguration: ISystemConfiguration = {\n name: 'territory-priority',\n description: 'Territory priority system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...TerritoryPriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n\n/**\n * System configuration with language as the primary qualifier, and\n * territory as a secondary qualifier.\n * @public\n */\nexport const LanguagePrioritySystemConfiguration: ISystemConfiguration = {\n name: 'language-priority',\n description: 'Language priority system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...LanguagePriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n\n/**\n * The default system configuration gives priority to territory as the primary qualifier,\n * with language as a secondary qualifier.\n * @public\n */\nexport const DefaultSystemConfiguration: ISystemConfiguration = {\n name: 'default',\n description: 'Default system configuration',\n qualifierTypes: [...DefaultQualifierTypes],\n qualifiers: [...TerritoryPriorityQualifiers],\n resourceTypes: [...DefaultResourceTypes]\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extended.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/extended.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAoE;IACrG;QACE,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,UAAU;QACtB,aAAa,EAAE;YACb,gBAAgB,EAAE,IAAI;SACvB;KACF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,WAAW;QACvB,aAAa,EAAE;YACb,gBAAgB,EAAE,KAAK;YACvB,eAAe,EAAE,KAAK;SACvB;KACF;IACD;QACE,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,SAAS;QACrB,aAAa,EAAE;YACb,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;SACtD;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,SAAS;QACrB,aAAa,EAAE;YACb,gBAAgB,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC;SACpF;KACF;IACD;QACE,IAAI,EAAE,UAA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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 ResourceTypes from '../../resource-types';\nimport * as QualifierTypes from '../../qualifier-types';\nimport * as Qualifiers from '../../qualifiers';\nimport { ISystemConfiguration } from '../json';\n\n/**\n * Example extended qualifier types.\n * @public\n */\nexport const ExtendedQualifierTypes: ReadonlyArray<QualifierTypes.Config.ISystemQualifierTypeConfig> = [\n {\n name: 'language',\n systemType: 'language',\n configuration: {\n allowContextList: true\n }\n },\n {\n name: 'territory',\n systemType: 'territory',\n configuration: {\n allowContextList: false,\n acceptLowercase: false\n }\n },\n {\n name: 'role',\n systemType: 'literal',\n configuration: {\n enumeratedValues: ['admin', 'agent', 'user', 'guest']\n }\n },\n {\n name: 'environment',\n systemType: 'literal',\n configuration: {\n enumeratedValues: ['production', 'integration', 'development', 'test', 'ephemeral']\n }\n },\n {\n name: 'currency',\n systemType: 'literal',\n configuration: {\n caseSensitive: true,\n enumeratedValues: ['USD', 'EUR', 'GBP', 'JPY', 'CNY']\n }\n },\n {\n name: 'market',\n systemType: 'literal',\n configuration: {\n enumeratedValues: [\n 'world',\n 'americas',\n 'europe',\n 'asia',\n 'oceania',\n 'africa',\n 'middle-east',\n 'latin-america',\n 'caribbean',\n 'central-america',\n 'south-america',\n 'north-america',\n 'nordics',\n 'baltic',\n 'balkans',\n 'eastern-europe',\n 'western-europe',\n 'central-europe',\n 'eastern-africa',\n 'western-africa',\n 'central-africa',\n 'north-africa',\n 'south-africa',\n 'middle-africa',\n 'southeast-asia'\n ],\n hierarchy: {\n americas: 'world',\n europe: 'world',\n asia: 'world',\n oceania: 'world',\n africa: 'world',\n 'middle-east': 'world',\n 'latin-america': 'americas',\n caribbean: 'americas',\n 'central-america': 'americas',\n 'south-america': 'americas',\n 'north-america': 'americas',\n nordics: 'europe',\n baltic: 'europe',\n balkans: 'europe',\n 'eastern-europe': 'europe',\n 'western-europe': 'europe',\n 'central-europe': 'europe',\n 'eastern-africa': 'africa',\n 'western-africa': 'africa',\n 'central-africa': 'africa',\n 'north-africa': 'africa',\n 'south-africa': 'africa',\n 'middle-africa': 'africa',\n 'southeast-asia': 'asia'\n }\n }\n }\n];\n\n/**\n * Example extended qualifiers.\n * @public\n */\nexport const ExtendedQualifiers: ReadonlyArray<Qualifiers.IQualifierDecl> = [\n {\n name: 'homeTerritory',\n token: 'home',\n typeName: 'territory',\n defaultPriority: 900\n },\n {\n name: 'currentTerritory',\n token: 'geo',\n typeName: 'territory',\n defaultPriority: 850\n },\n {\n name: 'language',\n token: 'lang',\n typeName: 'language',\n defaultPriority: 800\n },\n {\n name: 'market',\n typeName: 'market',\n defaultPriority: 750\n },\n {\n name: 'role',\n typeName: 'role',\n defaultPriority: 700\n },\n {\n name: 'environment',\n token: 'env',\n typeName: 'environment',\n defaultPriority: 650\n },\n {\n name: 'currency',\n typeName: 'currency',\n defaultPriority: 600\n }\n];\n\n/**\n * Example resource types.\n * @public\n */\nexport const ExtendedResourceTypes: ReadonlyArray<ResourceTypes.Config.IResourceTypeConfig> = [\n {\n name: 'json',\n typeName: 'json'\n }\n];\n\n/**\n * An example system configuration demonstrating various configuration options.\n * @public\n */\nexport const ExtendedSystemConfiguration: ISystemConfiguration = {\n name: 'extended-example',\n description: 'An example system configuration demonstrating various configuration options',\n qualifierTypes: [...ExtendedQualifierTypes],\n qualifiers: [...ExtendedQualifiers],\n resourceTypes: [...ExtendedResourceTypes]\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/config/predefined/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,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 Default from './default';\nimport * as Example from './extended';\n\nexport { Default, Example };\n"]}
@@ -0,0 +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,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAClF,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAC/C,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,SAAS;QACd,OAAO,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,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, mapResults, Result, fail, succeed, omit } from '@fgv/ts-utils';\nimport * as QualifierTypes from '../qualifier-types';\nimport * as ResourceTypes from '../resource-types';\nimport { QualifierType, QualifierTypeCollector, ReadOnlyQualifierTypeCollector } from '../qualifier-types';\nimport { IReadOnlyQualifierCollector, QualifierCollector } from '../qualifiers';\nimport { ReadOnlyResourceTypeCollector, ResourceType, ResourceTypeCollector } from '../resource-types';\nimport { ISystemConfiguration } from './json';\nimport { systemConfiguration } from './convert';\nimport { JsonFile, sanitizeJsonObject } from '@fgv/ts-json-base';\nimport {\n BuiltInQualifierTypeFactory,\n BuiltInResourceTypeFactory,\n IConfigInitFactory\n} from './configInitFactory';\n\n/**\n * Parameters used to initialize a {@link Config.SystemConfiguration | SystemConfiguration}.\n * @public\n */\nexport interface ISystemConfigurationInitParams {\n /**\n * Optional map of qualifier names to default values. If provided, qualifiers\n * in the system configuration will be updated with these default values.\n * Use `null` as the value to remove an existing default value.\n */\n qualifierDefaultValues?: Record<string, string | null>; // eslint-disable-line @rushstack/no-new-null\n qualifierTypeFactory?: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType>;\n resourceTypeFactory?: IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType>;\n}\n\n/**\n * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}\n * with updated qualifier default values.\n * @param config - The base {@link Config.Model.ISystemConfiguration | system configuration} to copy.\n * @param qualifierDefaultValues - Map of qualifier names to default values. Use `null` to remove existing values.\n * @returns `Success` with the updated {@link Config.Model.ISystemConfiguration | system configuration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function updateSystemConfigurationQualifierDefaultValues(\n config: ISystemConfiguration,\n qualifierDefaultValues: Record<string, string | null> // eslint-disable-line @rushstack/no-new-null\n): Result<ISystemConfiguration> {\n // Create a copy of the config\n return sanitizeJsonObject<ISystemConfiguration>(config).onSuccess((updatedConfig) => {\n // Create a map of existing qualifier names for validation\n const existingQualifierNames = new Set(updatedConfig.qualifiers.map((q) => q.name));\n\n // Validate that all specified qualifiers exist in the configuration\n for (const qualifierName of Object.keys(qualifierDefaultValues)) {\n if (!existingQualifierNames.has(qualifierName)) {\n return fail(`Qualifier '${qualifierName}' not found in system configuration`);\n }\n }\n\n // Update qualifier default values\n updatedConfig.qualifiers = updatedConfig.qualifiers.map((qualifier) => {\n if (qualifier.name in qualifierDefaultValues) {\n const newDefaultValue = qualifierDefaultValues[qualifier.name];\n\n // Create a copy of the qualifier\n const updatedQualifier = { ...qualifier };\n\n if (newDefaultValue === null) {\n // Remove the default value\n delete updatedQualifier.defaultValue;\n } else {\n // Set the new default value\n updatedQualifier.defaultValue = newDefaultValue;\n }\n\n return updatedQualifier;\n }\n return qualifier;\n });\n\n return succeed(updatedConfig);\n });\n}\n\n/**\n * A system configuration for both runtime or build.\n * @public\n */\nexport class SystemConfiguration {\n /**\n * The name of this system configuration.\n */\n public get name(): string | undefined {\n return this._config.name;\n }\n\n /**\n * The description of this system configuration.\n */\n public get description(): string | undefined {\n return this._config.description;\n }\n\n /**\n * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} that this system configuration uses.\n */\n public readonly qualifierTypes: ReadOnlyQualifierTypeCollector;\n\n /**\n * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} that this system configuration uses.\n * @public\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * The {@link ResourceTypes.ResourceTypeCollector | resource types} that this system configuration uses.\n */\n public readonly resourceTypes: ReadOnlyResourceTypeCollector;\n\n private readonly _config: ISystemConfiguration;\n\n /**\n * Constructs a new instance of a {@link Config.SystemConfiguration | SystemConfiguration} from the\n * supplied {@link Config.Model.ISystemConfiguration | system configuration}.\n * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.\n * @public\n */\n protected constructor(config: ISystemConfiguration, initParams?: ISystemConfigurationInitParams) {\n this._config = config;\n const qualifierTypeFactory = initParams?.qualifierTypeFactory ?? new BuiltInQualifierTypeFactory();\n const resourceTypeFactory = initParams?.resourceTypeFactory ?? new BuiltInResourceTypeFactory();\n\n this.qualifierTypes = QualifierTypeCollector.create({\n qualifierTypes: mapResults(config.qualifierTypes.map((tc) => qualifierTypeFactory.create(tc))).orThrow()\n }).orThrow();\n\n this.qualifiers = QualifierCollector.create({\n qualifierTypes: this.qualifierTypes,\n qualifiers: config.qualifiers\n }).orThrow();\n\n this.resourceTypes = ResourceTypeCollector.create({\n resourceTypes: mapResults(config.resourceTypes.map((rt) => resourceTypeFactory.create(rt))).orThrow()\n }).orThrow();\n }\n\n /**\n * Creates a new {@link Config.SystemConfiguration | SystemConfiguration} from the supplied\n * {@link Config.Model.ISystemConfiguration | system configuration}.\n * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.\n * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.\n * @returns `Success` with the new {@link Config.SystemConfiguration | SystemConfiguration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static create(\n config: ISystemConfiguration,\n initParams?: ISystemConfigurationInitParams\n ): Result<SystemConfiguration> {\n if (initParams?.qualifierDefaultValues) {\n /* c8 ignore next 9 - functional code tested but coverage intermittently missed */\n return updateSystemConfigurationQualifierDefaultValues(\n config,\n initParams.qualifierDefaultValues\n ).onSuccess((updatedConfig) =>\n captureResult(\n () => new SystemConfiguration(updatedConfig, omit(initParams, ['qualifierDefaultValues']))\n )\n );\n }\n return captureResult(() => new SystemConfiguration(config, initParams));\n }\n\n /**\n * Loads a {@link Config.SystemConfiguration | SystemConfiguration} from a file.\n * @param path - The path to the file to load.\n * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public static loadFromFile(\n path: string,\n initParams?: ISystemConfigurationInitParams\n ): Result<SystemConfiguration> {\n return JsonFile.convertJsonFileSync(path, systemConfiguration).onSuccess((config) =>\n SystemConfiguration.create(config, initParams)\n );\n }\n\n /**\n * Returns the {@link Config.Model.ISystemConfiguration | system configuration} that this\n * {@link Config.SystemConfiguration | SystemConfiguration} was created from.\n * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\n public getConfig(): Result<ISystemConfiguration> {\n return systemConfiguration.convert(this._config);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextDecls.js","sourceRoot":"","sources":["../../../src/packlets/context/contextDecls.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 { QualifierContextValue, QualifierName } from '../common';\nimport { Qualifier } from '../qualifiers';\n\n/**\n * Options to control matching of conditions against a context.\n * @public\n */\nexport interface IContextMatchOptions {\n /**\n * If true, then conditions which would otherwise yield\n * {@link NoMatch | NoMatch} but have a defined {@link Conditions.Condition.scoreAsDefault | scoreAsDefault}\n * will yield `scoreAsDefault`instead of `NoMatch`.\n */\n acceptDefaultScore?: boolean;\n\n /**\n * If true, then conditions for which a corresponding values is not present in the\n * context being matched will yield `undefined` instead of `NoMatch`.\n */\n partialContextMatch?: boolean;\n}\n\n/**\n * Non-validated declaration of a single context qualifier value.\n * @public\n */\nexport interface IContextQualifierValueDecl {\n qualifier: string;\n value: string;\n}\n\n/**\n * Non-validated declaration of a context, consisting of named\n * values.\n * @public\n */\nexport type IContextDecl = Record<string, string>;\n\n/**\n * Validated declaration of a single context qualifier value.\n * @public\n */\nexport interface IValidatedContextQualifierValueDecl {\n qualifier: Qualifier;\n value: QualifierContextValue;\n}\n\n/**\n * Validated declaration of a context, a record with strongly-typed\n * {@link QualifierTypeName | qualifier type names} as keys and\n * {@link QualifierContextValue | qualifier context values} as values.\n * @public\n */\nexport type IValidatedContextDecl = Record<QualifierName, QualifierContextValue>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextToken.js","sourceRoot":"","sources":["../../../src/packlets/context/contextToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAwC,MAAM,WAAW,CAAC;AAI3F;;;GAGG;AACH,MAAM,OAAO,aAAa;IAOxB;;;OAGG;IACH,YAAmB,UAAuC;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,0BAA0B,CAAC,KAAa;QAC7C,OAAO,aAAa,CAAC,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACI,iBAAiB,CAAC,KAAa;QACpC,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACI,yBAAyB,CAC9B,KAAuC;QAEvC,OAAO,aAAa,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,KAAa;QACxC,OAAO,aAAa,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,4BAA4B,CA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1C,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, QualifierName, QualifierContextValue } from '../common';\nimport { IValidatedContextQualifierValueDecl, IValidatedContextDecl } from './contextDecls';\nimport { IReadOnlyQualifierCollector, Qualifier } from '../qualifiers';\n\n/**\n * Helper class to parse and validate context tokens.\n * @public\n */\nexport class ContextTokens {\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 Context.ContextTokens | ContextTokens } 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 /**\n * Parses a {@link ContextQualifierToken | context qualifier token} string and validates the parts\n * against the qualifiers present in the {@link Context.ContextTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * if successful, `Failure` with an error message if not.\n */\n public parseContextQualifierToken(token: string): Result<IValidatedContextQualifierValueDecl> {\n return ContextTokens.parseContextQualifierToken(token, this.qualifiers);\n }\n\n /**\n * Parses a {@link ContextToken | context token} string and validates the parts\n * against the qualifiers present in the {@link Context.ContextTokens.qualifiers | qualifier collector}.\n * @param token - the token string to parse.\n * @returns `Success` with the array of {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declarations}\n * if successful, `Failure` with an error message if not.\n */\n public parseContextToken(token: string): Result<IValidatedContextQualifierValueDecl[]> {\n return ContextTokens.parseContextToken(token, this.qualifiers);\n }\n\n /**\n * Validates the {@link Helpers.IContextTokenParts | parts} of a {@link ContextToken | context 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 validateContextTokenParts(\n parts: CommonHelpers.IContextTokenParts\n ): Result<IValidatedContextQualifierValueDecl> {\n return ContextTokens.validateContextTokenParts(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 ContextTokens.findQualifierForValue(value, this.qualifiers);\n }\n\n /**\n * Converts a {@link ContextToken | context token} to a validated partial context.\n * @param token - the context token to convert\n * @returns `Success` with the validated partial context if successful, `Failure` with an error message if not.\n */\n public contextTokenToPartialContext(token: string): Result<IValidatedContextDecl> {\n return ContextTokens.contextTokenToPartialContext(token, this.qualifiers);\n }\n\n /**\n * Converts a validated partial context to a {@link ContextToken | context token}.\n * @param context - the validated partial context to convert\n * @returns `Success` with the context token if successful, `Failure` with an error message if not.\n */\n public partialContextToContextToken(context: IValidatedContextDecl): Result<string> {\n return ContextTokens.partialContextToContextToken(context);\n }\n\n /**\n * Parses a {@link ContextQualifierToken | context qualifier 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 Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static parseContextQualifierToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl> {\n return CommonHelpers.parseContextQualifierTokenParts(token).onSuccess((parts) => {\n return ContextTokens.validateContextTokenParts(parts, qualifiers);\n });\n }\n\n /**\n * Parses a {@link ContextToken | context 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 Context.IValidatedContextQualifierValueDecl | validated context qualifier value declarations}\n * if successful, `Failure` with an error message if not\n */\n public static parseContextToken(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl[]> {\n return CommonHelpers.parseContextTokenParts(token).onSuccess((parts) => {\n return mapResults(parts.map((part) => ContextTokens.validateContextTokenParts(part, qualifiers)));\n });\n }\n\n /**\n * Validates the parts of a context token against the qualifiers present in the supplied\n * {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.\n * @param parts - the {@link Helpers.IContextTokenParts | context 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 Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration} if successful,\n * `Failure` with an error message if not.\n */\n public static validateContextTokenParts(\n parts: CommonHelpers.IContextTokenParts,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextQualifierValueDecl> {\n const qualifierLookup =\n parts.qualifier === undefined\n ? ContextTokens.findQualifierForValue(parts.value, qualifiers)\n : qualifiers.getByNameOrToken(parts.qualifier);\n\n return qualifierLookup.onSuccess((qualifier) => {\n return qualifier.type\n .validateContextValue(parts.value)\n .onSuccess((value) => {\n return succeed({ qualifier, value });\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.validateContextValue(value).isSuccess()) {\n matched.push(qualifier);\n }\n }\n if (matched.length === 0) {\n return fail(`${value}: does not match any qualifier`);\n }\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 /**\n * Converts a {@link ContextToken | context token} to a validated partial context.\n * @param token - the context token to convert\n * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use\n * @returns `Success` with the validated partial context if successful, `Failure` with an error message if not.\n */\n public static contextTokenToPartialContext(\n token: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<IValidatedContextDecl> {\n return ContextTokens.parseContextToken(token, qualifiers).onSuccess((qualifierValues) => {\n const context: IValidatedContextDecl = {};\n\n for (const { qualifier, value } of qualifierValues) {\n const qualifierName = qualifier.name as QualifierName;\n const contextValue = value as QualifierContextValue;\n\n // Check for duplicate qualifiers\n if (qualifierName in context) {\n return fail(`${qualifier.name}: duplicate qualifier in context token`);\n }\n\n context[qualifierName] = contextValue;\n }\n\n return succeed(context);\n });\n }\n\n /**\n * Converts a validated partial context to a {@link ContextToken | context token}.\n * @param context - the validated partial context to convert\n * @returns `Success` with the context token if successful, `Failure` with an error message if not.\n */\n public static partialContextToContextToken(context: IValidatedContextDecl): Result<string> {\n const tokens: string[] = [];\n\n for (const [qualifierName, contextValue] of Object.entries(context)) {\n // Build token as \"qualifier=value\"\n tokens.push(`${qualifierName}=${contextValue}`);\n }\n\n if (tokens.length === 0) {\n return succeed('');\n }\n\n const tokenString = tokens.join('|');\n\n // Validate the generated token\n return CommonHelpers.buildContextToken(\n tokens.map((token) => {\n const [qualifier, value] = token.split('=');\n return { qualifier, value };\n })\n ).onSuccess(() => succeed(tokenString));\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decls.js","sourceRoot":"","sources":["../../../../src/packlets/context/convert/decls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAU,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQjG,2CAA2C;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,YAAY,CAA6B;IAC3F,SAAS,EAAE,UAAU,CAAC,MAAM;IAC5B,KAAK,EAAE,UAAU,CAAC,MAAM;CACzB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAalE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,UAAU,CAAC,OAAO,CAIlE,CACE,IAAa,EACb,MAAM,EACN,OAAoC,EACS,EAAE;IAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,yBAAyB,CAAC,OAAO,C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I,SAAS,KAAK,SAAS,EAAE,CAAC;oBAC5B,SAAS;yBACN,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;yBAC/B,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;wBACnB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;wBAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;oBACxB,CAAC,CAAC;yBACD,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converters, Failure, MessageAggregator, Result, succeed, Success } from '@fgv/ts-utils';\nimport {\n IContextQualifierValueDecl,\n IValidatedContextDecl,\n IValidatedContextQualifierValueDecl\n} from '../contextDecls';\nimport { IReadOnlyQualifierCollector } from '../../qualifiers';\n\n/* eslint-disable @rushstack/typedef-var */\n\n/**\n * Converter for a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}.\n * @public\n */\nexport const contextQualifierValueDecl = Converters.strictObject<IContextQualifierValueDecl>({\n qualifier: Converters.string,\n value: Converters.string\n});\n\n/**\n * Converter for a {@link Context.IContextDecl | context declaration}.\n * @public\n */\nexport const contextDecl = Converters.recordOf(Converters.string);\n\n/**\n * Context necessary to convert a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}\n * or {@link Context.IContextDecl | context declaration} to their\n * equivalent - {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * or {@link Context.IValidatedContextDecl | validated context declaration}, respectively.\n * @public\n */\nexport interface IContextDeclConvertContext {\n readonly qualifiers: IReadOnlyQualifierCollector;\n}\n\n/**\n * Converter which constructs a {@link Context.IValidatedContextQualifierValueDecl | validated context qualifier value declaration}\n * from a {@link Context.IContextQualifierValueDecl | context qualifier value declaration}, instantiating qualifiers by name\n * from a supplied {@link Context.Convert.IContextDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedContextQualifierValueDecl = Converters.generic<\n IValidatedContextQualifierValueDecl,\n IContextDeclConvertContext\n>(\n (\n from: unknown,\n __self,\n context?: IContextDeclConvertContext\n ): Result<IValidatedContextQualifierValueDecl> => {\n if (!context) {\n return Failure.with('validatedContextQualifierValueDecl converter requires a context');\n }\n return contextQualifierValueDecl.convert(from).onSuccess((decl) => {\n const { value: qualifier, message } = context.qualifiers.validating.get(decl.qualifier);\n if (message !== undefined) {\n return Failure.with(message);\n }\n return qualifier.validateContextValue(decl.value).onSuccess((value) => {\n return Success.with({\n qualifier,\n value\n });\n });\n });\n }\n);\n\n/**\n * Converter which constructs a {@link Context.IValidatedContextDecl | validated context declaration}\n * from a {@link Context.IContextDecl | context declaration}, instantiating qualifiers by name\n * from a supplied {@link Context.Convert.IContextDeclConvertContext | conversion context}.\n * @public\n */\nexport const validatedContextDecl = Converters.generic<IValidatedContextDecl, IContextDeclConvertContext>(\n (from: unknown, __self, context?: IContextDeclConvertContext): Result<IValidatedContextDecl> => {\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n if (!context) {\n return Failure.with('validatedContextDecl converter requires a context');\n }\n\n return contextDecl.convert(from).onSuccess((decl) => {\n const errors = new MessageAggregator();\n const result: IValidatedContextDecl = {};\n\n for (const key in decl) {\n if (key in decl) {\n const { value: qualifier } = context.qualifiers.validating.get(key).aggregateError(errors);\n if (qualifier !== undefined) {\n qualifier\n .validateContextValue(decl[key])\n .onSuccess((value) => {\n result[qualifier.name] = value;\n return succeed(value);\n })\n .aggregateError(errors);\n }\n }\n }\n return errors.returnOrReport(Success.with(result));\n });\n }\n);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/context/convert/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,SAAS,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';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,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';\nexport * from './contextDecls';\nexport * from './contextToken';\n\nexport { Convert };\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractDecision.js","sourceRoot":"","sources":["../../../src/packlets/decisions/abstractDecision.ts"],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* Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Result } from '@fgv/ts-utils';\nimport { ConditionSet } from '../conditions';\nimport { Candidate } from './candidate';\nimport { Decision } from './decision';\nimport * as ResourceJson from '../resource-json';\n\n/**\n * Parameters to create an {@link Decisions.AbstractDecision | AbstractDecision}.\n * @public\n */\nexport interface IAbstractDecisionCreateParams {\n conditionSets: ConditionSet[];\n index?: number;\n}\n\n/**\n * An abstract decision represents a class of decisions with candidates\n * that differ only in value. It is a {@link Decisions.Decision | IDecision<number>}\n * in which the `number` values are sequentially assigned indexes.\n * This allows us to represent each related {@link Decisions.IDecision | decision} as an\n * {@link Decisions.AbstractDecision | abstract decision} and a matching array containing\n * the corresponding value for each candidate. This representation is highly cacheable.\n * @public\n */\nexport class AbstractDecision extends Decision<number> {\n /**\n * Constructor for an {@link Decisions.AbstractDecision | AbstractDecision} object.\n * @param params - {@link Decisions.IAbstractDecisionCreateParams | Parameters}\n * used to create the decision.\n * @public\n */\n protected constructor(params: IAbstractDecisionCreateParams) {\n const candidates = Array.from(params.conditionSets)\n .map((conditionSet, value) => Candidate.createCandidate({ conditionSet, value }).orThrow())\n .sort(Candidate.compare);\n super({ candidates, index: params.index, isAbstract: true });\n }\n\n /**\n * Creates a new {@link Decisions.AbstractDecision | AbstractDecision} object.\n * @param params - {@link Decisions.IAbstractDecisionCreateParams | Parameters}\n * used to create the decision.\n * @returns `Success` with the new decision if successful, or `Failure` with an\n * error message if not.\n * @public\n */\n public static createAbstractDecision(params: IAbstractDecisionCreateParams): Result<AbstractDecision> {\n return captureResult(() => new AbstractDecision(params));\n }\n\n /**\n * Converts this abstract decision to a compiled abstract decision representation.\n * @param options - Optional compilation options controlling the output format.\n * @returns A compiled abstract decision object that can be used for serialization or runtime processing.\n * @public\n */\n public toCompiled(\n options?: ResourceJson.Compiled.ICompiledResourceOptions\n ): ResourceJson.Compiled.ICompiledAbstractDecision {\n return {\n conditionSets: this.candidates.map((c) => c.conditionSet.index!),\n ...(options?.includeMetadata === true ? { metadata: { key: this.key } } : {})\n };\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractDecisionCollector.js","sourceRoot":"","sources":["../../../src/packlets/decisions/abstractDecisionCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAU,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,aAAa,EAA8B,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAiC,MAAM,eAAe,CAAC;AAc5E;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAqC;IAOlF;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC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,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,OAAO,gBAAgB,CAAC,sBAAsB,CAAC;gBAC7C,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;QACL,CAAC;QACD,uFAAuF;QACvF,OAAO,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC3E,CAAC;IAEO,oBAAoB,CAAC,IAAa;QACxC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,YAAY,CAAC,CAAC;IAC7E,CAAC;;AAlDD;;GAEG;AACoB,4CAAkB,GAAkB,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AAEjG;;GAEG;AACoB,kDAAwB,GAAkB,QAAQ,CAAC,eAAe,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, Result, fail, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { AbstractDecision } from './abstractDecision';\nimport { Convert as CommonConvert, DecisionIndex, DecisionKey, Validate } from '../common';\nimport { ConditionSet, ReadOnlyConditionSetCollector } from '../conditions';\n\n/**\n * Parameters for creating a {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.\n * @public\n */\nexport interface IAbstractDecisionCollectorCreateParams {\n /**\n * {@link Conditions.ReadOnlyConditionSetCollector | ConditionSetCollector} used to create conditions\n * sets for decisions in this collector.\n */\n conditionSets: ReadOnlyConditionSetCollector;\n}\n\n/**\n * A `ValidatingCollector` for {@link Decisions.AbstractDecision | AbstractDecisions}.\n * @public\n */\nexport class AbstractDecisionCollector extends ValidatingCollector<AbstractDecision> {\n /**\n * The {@link Conditions.ReadOnlyConditionSetCollector | ConditionSetCollector} used to create conditions\n * sets for decisions in this collector.\n */\n public readonly conditionSets: ReadOnlyConditionSetCollector;\n\n /**\n * The empty decision (no condition sets) for this collector.\n */\n public get emptyDecision(): AbstractDecision {\n return this.getAt(AbstractDecisionCollector.EmptyDecisionIndex).orThrow();\n }\n\n /**\n * The default-only decision (one condition set with no conditions) for this collector.\n */\n public get defaultOnlyDecision(): AbstractDecision {\n return this.getAt(AbstractDecisionCollector.DefaultOnlyDecisionIndex).orThrow();\n }\n\n /**\n * The index for the empty decision.\n */\n public static readonly EmptyDecisionIndex: DecisionIndex = Validate.toDecisionIndex(0).orThrow();\n\n /**\n * The index for the default-only decision.\n */\n public static readonly DefaultOnlyDecisionIndex: DecisionIndex = Validate.toDecisionIndex(1).orThrow();\n\n /**\n * Creates a new instance of {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.\n */\n protected constructor(params: IAbstractDecisionCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<DecisionKey, AbstractDecision>({\n key: CommonConvert.decisionKey,\n value: (from: unknown) => this._toAbstractDecision(from)\n })\n });\n this.conditionSets = params.conditionSets;\n this.add(AbstractDecision.createAbstractDecision({ conditionSets: [] }).orThrow()).orThrow();\n const cs = this.conditionSets.validating.get('').orThrow();\n this.add(AbstractDecision.createAbstractDecision({ conditionSets: [cs] }).orThrow()).orThrow();\n }\n\n /**\n * Creates a new instance of {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.\n * @returns `Success` with the new instance, or `Failure` with an error if the instance could not be created.\n */\n public static create(params: IAbstractDecisionCollectorCreateParams): Result<AbstractDecisionCollector> {\n return captureResult(() => new AbstractDecisionCollector(params));\n }\n\n private _toAbstractDecision(from: unknown): Result<AbstractDecision> {\n /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */\n if (from instanceof AbstractDecision) {\n return succeed(from);\n }\n if (this._isConditionSetArray(from)) {\n return AbstractDecision.createAbstractDecision({\n conditionSets: from\n });\n }\n /* c8 ignore next 2 - functional code path tested but coverage intermittently missed */\n return fail('invalid value: not an abstract decision or condition sets');\n }\n\n private _isConditionSetArray(from: unknown): from is ConditionSet[] {\n return Array.isArray(from) && from.every((e) => e instanceof ConditionSet);\n }\n}\n\n/**\n * A read-only {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.\n * @public\n */\nexport type ReadOnlyAbstractDecisionCollector = Collections.IReadOnlyValidatingCollector<AbstractDecision>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidate.js","sourceRoot":"","sources":["../../../src/packlets/decisions/candidate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AAetD;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAMpB;;OAEG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,YAAsB,MAA0B;;QAC9C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,MAAA,MAAM,CAAC,WAAW,mCAAI,SAAS,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,eAAe,CAC3B,MAA0B;QAE1B,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,CAAC,EAAc,EAAE,EAAc;QAClD,OAAO,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,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 { JsonValue } from '@fgv/ts-json-base';\nimport { ConditionSet } from '../conditions';\nimport { captureResult, Result } from '@fgv/ts-utils';\nimport { ResourceValueMergeMethod } from '../common';\n\n/**\n * A {@link Decisions.ICandidate | resource candidate} represents a single\n * possible value for some resource, with the conditions under which it is valid.\n * @public\n */\nexport interface ICandidate<TVALUE extends JsonValue = JsonValue> {\n readonly conditionSet: ConditionSet;\n readonly value: TVALUE;\n readonly isPartial?: boolean;\n readonly mergeMethod?: ResourceValueMergeMethod;\n}\n\n/**\n * Simple implementation of {@link Decisions.ICandidate | ICandidate} with\n * helper methods for sorting and presentation.\n * @public\n */\nexport class Candidate<TVALUE extends JsonValue = JsonValue> implements ICandidate<TVALUE> {\n public readonly conditionSet: ConditionSet;\n public readonly value: TVALUE;\n public readonly isPartial: boolean;\n public readonly mergeMethod: ResourceValueMergeMethod;\n\n /**\n * Key of the condition set for this candidate.\n */\n public get key(): string {\n return this.conditionSet.key;\n }\n\n /**\n * Construct a new {@link Decisions.Candidate | Candidate}.\n * @param params - The {@link Decisions.ICandidate | parameters} to use to create the\n * new candidate.\n */\n protected constructor(params: ICandidate<TVALUE>) {\n this.conditionSet = params.conditionSet;\n this.value = params.value;\n this.isPartial = params.isPartial === true;\n this.mergeMethod = params.mergeMethod ?? 'augment';\n }\n\n /**\n * Create a new {@link Decisions.Candidate | candidate}.\n * @param params - The {@link Decisions.ICandidate | parameters} to use to create the\n * new candidate.\n * @returns `Success` with the new candidate if successful, or `Failure` if the\n * candidate could not be created.\n */\n public static createCandidate<TVALUE extends JsonValue>(\n params: ICandidate<TVALUE>\n ): Result<Candidate<TVALUE>> {\n return captureResult(() => new Candidate(params));\n }\n\n /**\n * Compare two {@link Decisions.ICandidate | candidates} for sorting purposes.\n * @param c1 - The first candidate to compare.\n * @param c2 - The second candidate to compare.\n * @returns A negative number if c1 should come before c2, a positive number if c1 should\n * come after c2, or zero if they are equivalent.\n */\n public static compare(c1: ICandidate, c2: ICandidate): number {\n return ConditionSet.compare(c1.conditionSet, c2.conditionSet);\n }\n\n /**\n * Returns a string representation of the {@link Decisions.Candidate | candidate}.\n * @returns A string representation of this candidate.\n */\n public toString(): string {\n return `${this.key}: ${JSON.stringify(this.value)}`;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/decisions/common.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 { DecisionIndex, DecisionKey } from '../common';\nimport { JsonValue } from '@fgv/ts-json-base';\nimport { ICandidate } from './candidate';\n\n/**\n * Represents a decision, which is comprised of zero or more\n * {@link Decisions.Candidate | candidates}, each of which represents a possible\n * value for some resource, along with the conditions under which that value is valid.\n * @public\n */\nexport interface IDecision<TVALUE extends JsonValue = JsonValue> {\n key: DecisionKey;\n candidates: ReadonlyArray<ICandidate<TVALUE>>;\n index?: DecisionIndex;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concreteDecision.js","sourceRoot":"","sources":["../../../src/packlets/decisions/concreteDecision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAIpD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,aAAa,EAA8B,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA0BtC;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAK3B;;;OAGG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACjC,CAAC;IAID;;;;;OAKG;IACH,YAAsB,MAAkD;QACtE,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,SAAS,CAAC,eAAe,CAAC,E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S,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC,CAAC,CACH,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACrB,0EAA0E;YAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjB,OAAO,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC3E,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACpF,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,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 { JsonValue } from '@fgv/ts-json-base';\nimport { Candidate, ICandidate } from './candidate';\nimport { IDecision } from './common';\nimport { AbstractDecisionCollector } from './abstractDecisionCollector';\nimport { AbstractDecision } from './abstractDecision';\nimport { captureResult, Collections, mapResults, Result, fail, succeed } from '@fgv/ts-utils';\nimport { ConditionSet } from '../conditions';\nimport { Convert as CommonConvert, DecisionIndex, DecisionKey } from '../common';\nimport { Decision } from './decision';\n\n/**\n * Parameters used to create a new {@link Decisions.ConcreteDecision | ConcreteDecision},\n * given an {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector} and a\n * list of {@link Decisions.ICandidate | candidates}.\n * @public\n */\nexport interface IConcreteDecisionCreateParams<TVALUE extends JsonValue = JsonValue> {\n decisions: AbstractDecisionCollector;\n candidates: ReadonlyArray<ICandidate<TVALUE>>;\n index?: number;\n}\n\n/**\n * Protected constructor parameters for {@link Decisions.ConcreteDecision | ConcreteDecision},\n * used to create a new concrete decision from an existing {@link Decisions.AbstractDecision | AbstractDecision}\n * and a list of values.\n * @public\n */\nexport interface IConcreteDecisionConstructorParams<TVALUE extends JsonValue = JsonValue> {\n baseDecision: AbstractDecision;\n values: TVALUE[];\n index?: DecisionIndex;\n}\n\n/**\n * A {@link Decisions.ConcreteDecision | concrete decision} is a {@link Decisions.IDecision | decision}\n * implemented as a reference to a common {@link Decisions.AbstractDecision | abstract decision} and a list of\n * values that correspond to the candidates in the abstract decision. This allows us to represent a large\n * number of related decisions with a single abstract decision and a list of values.\n * @public\n */\nexport class ConcreteDecision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {\n public readonly baseDecision: AbstractDecision;\n public readonly values: TVALUE[];\n public readonly candidates: ReadonlyArray<ICandidate<TVALUE>>;\n\n /**\n * Unique global key for this decision, derived from the condition set and\n * candidate values.\n */\n public get key(): DecisionKey {\n return this._collectible.key;\n }\n\n /**\n * Unique global index for this decision.\n */\n public get index(): DecisionIndex | undefined {\n return this._collectible.index;\n }\n\n private _collectible: Collections.Collectible<DecisionKey, DecisionIndex>;\n\n /**\n * Constructor for a {@link Decisions.ConcreteDecision | ConcreteDecision} object.\n * @param params - {@link Decisions.IConcreteDecisionConstructorParams | Parameters}\n * used to create the decision.\n * @public\n */\n protected constructor(params: IConcreteDecisionConstructorParams<TVALUE>) {\n this.baseDecision = params.baseDecision;\n this.values = params.values;\n this.candidates = this.baseDecision.candidates.map((candidate) => {\n const value = this.values[candidate.value];\n return Candidate.createCandidate({ conditionSet: candidate.conditionSet, value }).orThrow();\n });\n this._collectible = new Collections.Collectible({\n key: Decision.getKey(this.candidates),\n index: params.index,\n indexConverter: CommonConvert.decisionIndex\n });\n }\n\n /**\n * Creates a new {@link Decisions.ConcreteDecision | ConcreteDecision} object.\n * @param params - {@link Decisions.IConcreteDecisionCreateParams | Parameters}\n * used to create the decision.\n * @returns `Success` with the new decision if successful, or `Failure` with an\n * error message if not.\n * @public\n */\n public static create<TVALUE extends JsonValue = JsonValue>(\n params: IConcreteDecisionCreateParams<TVALUE>\n ): Result<ConcreteDecision<TVALUE>> {\n const conditionSets = params.candidates\n .map((candidate) => candidate.conditionSet)\n .sort(ConditionSet.compare)\n .reverse();\n\n const getBase = params.decisions.validating.getOrAdd(conditionSets);\n /* c8 ignore next 3 - defense in depth against internal error hard to repro */\n if (getBase.isFailure()) {\n return fail<ConcreteDecision<TVALUE>>(getBase.message);\n }\n const baseDecision = getBase.value;\n return mapResults(\n params.candidates.map((candidate, index) => {\n /* c8 ignore next 5 - defense in depth against internal error hard to repro */\n if (candidate.conditionSet.key !== baseDecision.candidates[index].conditionSet.key) {\n return fail<TVALUE>(\n `${candidate.conditionSet.key}: Candidate does not match base decision ${candidate.conditionSet.key}`\n );\n }\n return succeed(candidate.value);\n })\n ).onSuccess((values) => {\n /* c8 ignore next 5 - defense in depth against invalid index conversion */\n if (params.index) {\n return CommonConvert.decisionIndex.convert(params.index).onSuccess((index) => {\n return captureResult(() => new ConcreteDecision({ baseDecision, values, index }));\n });\n }\n return captureResult(() => new ConcreteDecision({ baseDecision, values }));\n });\n }\n\n /**\n * Sets the index for this decision. Once set, index is immutable.\n * @param index - The index to set.\n * @returns `Success` with the new index if successful, or `Failure` with an error message if not.\n */\n public setIndex(index: number): Result<DecisionIndex> {\n return this._collectible.setIndex(index);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../src/packlets/decisions/decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAU,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAA8B,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAuB7C;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAOnB;;;OAGG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACjC,CAAC;IAgBD;;;;OAIG;IACH,YAAsB,MAA0C;QAC9D,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aAClD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aACvB,OAAO,EAAE,CAAC;QAEb,qDAAqD;QACrD,MAAM,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CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;QACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAChG,OAAO,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,IAAI,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IACnF,CAAC;;AA9FD;;GAEG;AACoB,yBAAgB,GAAgB,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAEvG;;GAEG;AACoB,+BAAsB,GAAgB,aAAa,CAAC,WAAW;KACnF,OAAO,CAAC,UAAU,CAAC;KACnB,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, Hash, Result } from '@fgv/ts-utils';\nimport { Convert as CommonConvert, DecisionIndex, DecisionKey } from '../common';\nimport { JsonValue } from '@fgv/ts-json-base';\nimport { Candidate, ICandidate } from './candidate';\nimport { IDecision } from './common';\nimport { ConditionSet } from '../conditions';\n\n/**\n * Parameters used to create a new {@link Decisions.Decision | Decision}\n * with the {@link Decisions.Decision.createDecision | createDecision}\n * static method.\n * @public\n */\nexport interface IDecisionCreateParams<TVALUE extends JsonValue = JsonValue> {\n candidates: ReadonlyArray<ICandidate<TVALUE>>;\n index?: number;\n}\n\n/**\n * Parameters used to construct a new {@link Decisions.Decision | Decision} with\n * the protected constructor.\n * @public\n */\nexport interface IDecisionConstructorParams<TVALUE extends JsonValue = JsonValue>\n extends IDecisionCreateParams<TVALUE> {\n isAbstract: boolean;\n}\n\n/**\n * Simple collectible implementation of {@link Decisions.IDecision | IDecision}.\n * @public\n */\nexport class Decision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {\n /**\n * The sorted {@link Conditions.ConditionSet | ConditionSets} that make up this decision.\n * @public\n */\n public readonly candidates: ReadonlyArray<Candidate<TVALUE>>;\n\n /**\n * Unique global key for this decision, derived from the contents\n * of the decision.\n */\n public get key(): DecisionKey {\n return this._collectible.key;\n }\n\n /**\n * Unique global index for this decision.\n */\n public get index(): DecisionIndex | undefined {\n return this._collectible.index;\n }\n\n /**\n * Key for the empty decision (no condition sets).\n */\n public static readonly EmptyDecisionKey: DecisionKey = CommonConvert.decisionKey.convert('').orThrow();\n\n /**\n * Key for the default-only decision (single condition set with no conditions).\n */\n public static readonly DefaultOnlyDecisionKey: DecisionKey = CommonConvert.decisionKey\n .convert('00000000')\n .orThrow();\n\n private _collectible: Collections.Collectible<DecisionKey, DecisionIndex>;\n\n /**\n * Constructor for a {@link Decisions.Decision | Decision} object.\n * @param params - {@link Decisions.IDecisionConstructorParams | Parameters} used to create the decision.\n * @public\n */\n protected constructor(params: IDecisionConstructorParams<TVALUE>) {\n this.candidates = Array.from(params.candidates)\n .map((c) => Candidate.createCandidate(c).orThrow())\n .sort(Candidate.compare)\n .reverse();\n\n /* c8 ignore next 3 - coverage having a rough time */\n const key = params.isAbstract\n ? Decision.getAbstractKey(this.candidates.map((c) => c.conditionSet))\n : Decision.getKey(this.candidates);\n\n this._collectible = new Collections.Collectible<DecisionKey, DecisionIndex>({\n key,\n index: params.index,\n indexConverter: CommonConvert.decisionIndex\n });\n }\n\n /**\n * Creates a new {@link Decisions.Decision | Decision} object.\n * @param params - {@link Decisions.IDecisionCreateParams | Parameters} used to create the decision.\n * @returns `Success` with the new decision if successful, or `Failure` with an error message if not.\n * @public\n */\n public static createDecision(params: IDecisionCreateParams): Result<Decision> {\n return captureResult(() => new Decision({ ...params, isAbstract: false }));\n }\n\n /**\n * Sets the index for this decision. Once set, index is immutable.\n * @param index - The index to set.\n * @returns `Success` with the new index if successful, or `Failure` with an error message if not.\n * @public\n */\n public setIndex(index: number): Result<DecisionIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Helper function to return a stable key for a the condition sets that\n * make up a {@link Decisions.Decision | decision}. The abstract\n * key is a `+`-separated list of the hashes of the sorted condition sets\n * that make up the decision.\n * @param conditionSets - The condition sets to use to create the key.\n * @returns A key derived from the condition set hashes.\n * @public\n */\n public static getAbstractKey(conditionSets: ReadonlyArray<ConditionSet>): DecisionKey {\n return CommonConvert.decisionKey\n .convert(\n Array.from(conditionSets)\n .sort(ConditionSet.compare)\n .reverse()\n .map((c) => c.toHash())\n .join('+')\n )\n .orThrow();\n }\n\n /**\n * Helper function to return a stable key for a set of condition sets.\n * @param candidates - The candidates whose condition sets are used to create the key.\n * @returns A key derived from the condition set hashes.\n * @public\n */\n public static getKey<TVALUE extends JsonValue = JsonValue>(\n candidates: ReadonlyArray<ICandidate<TVALUE>>\n ): DecisionKey {\n if (candidates.length === 0) {\n /* c8 ignore next 2 - functional code path tested but coverage intermittently missed */\n return Decision.EmptyDecisionKey;\n }\n const abstractKey = Decision.getAbstractKey(candidates.map((c) => c.conditionSet));\n const valueKey = Hash.Crc32Normalizer.crc32Hash(candidates.map((c) => JSON.stringify(c.value)));\n return CommonConvert.decisionKey.convert(`${abstractKey}|${valueKey}`).orThrow();\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/decisions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,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 './common';\nexport * from './candidate';\nexport * from './decision';\nexport * from './abstractDecision';\nexport * from './abstractDecisionCollector';\nexport * from './concreteDecision';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsItem.js","sourceRoot":"","sources":["../../../src/packlets/import/fsItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,aAAa,EAEb,UAAU,EAEV,IAAI,EACJ,OAAO,EACP,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA+BhD;;;GAGG;AACH,MAAM,OAAO,MAAM;IAqBjB;;;;;OAKG;IACH,YAAsB,KAAmB,EAAE,UAAuC;QAChF,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,aAAa,CACzB,IAA2B,EAC3B,UAAuC;QAEvC,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAE1E,OAAO,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC;aACjD,eAAe,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,QAAQ,mCA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AC,CAAC,QAAQ;oBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;iBACrB,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QACtD,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 {\n captureResult,\n DetailedResult,\n mapResults,\n Result,\n fail,\n succeed,\n useOrInitialize\n} from '@fgv/ts-utils';\nimport { FileTree } from '@fgv/ts-json-base';\nimport { Helpers as CommonHelpers, Validate } from '../common';\nimport * as Conditions from '../conditions';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { ImportContext } from './importContext';\n\n/**\n * Result details for {@link Import.FsItem | FsItem} operations.\n * @public\n */\nexport type FsItemResultDetail = 'failed' | 'skipped' | 'succeeded';\n\n/**\n * Interface describing some single file system item.\n * @public\n */\nexport interface IFsItemProps {\n /**\n * The underlying `FileTreeItem` for this item.\n */\n readonly item: FileTree.FileTreeItem;\n\n /**\n * The base name of the file system item, once\n * any conditions set tokens have been removed.\n */\n readonly baseName: string;\n\n /**\n * {@link Conditions.IValidatedConditionDecl | Conditions} extracted\n * from the base name of the {@link Import.FsItem | FsItem}.\n */\n readonly conditions: Conditions.IValidatedConditionDecl[];\n}\n\n/**\n * Class describing some file system item to be imported.\n * @public\n */\nexport class FsItem implements IFsItemProps {\n /**\n * {@inheritDoc Import.IFsItemProps.baseName}\n */\n public readonly baseName: string;\n\n /**\n * {@inheritDoc Import.IFsItemProps.conditions}\n */\n public readonly conditions: Conditions.IValidatedConditionDecl[];\n\n /**\n * {@inheritDoc Import.IFsItemProps.item}\n */\n public readonly item: FileTree.FileTreeItem;\n\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for this item.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Protected constructor creates a new {@link Import.FsItem | FsItem}.\n * @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n */\n protected constructor(props: IFsItemProps, qualifiers: IReadOnlyQualifierCollector) {\n const { baseName, conditions, item } = props;\n this.baseName = baseName;\n this.conditions = conditions;\n this.item = item;\n this.qualifiers = qualifiers;\n }\n\n /**\n * Creates a new {@link Import.FsItem | FsItem} from a `FileTreeItem`.\n * @param item - The `FileTreeItem` to import.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`\n * containing an error message if not. Note that the result detail `skipped` indicates that the item\n * was not created because it is not relevant - this is a soft error that should be silently ignored.\n */\n public static createForItem(\n item: FileTree.FileTreeItem,\n qualifiers: IReadOnlyQualifierCollector\n ): DetailedResult<FsItem, FsItemResultDetail> {\n const baseName: string = item.type === 'file' ? item.baseName : item.name;\n\n return FsItem.tryParseBaseName(baseName, qualifiers)\n .withErrorFormat((msg) => `${baseName}: error extracting conditions - ${msg}`)\n .onSuccess(({ baseName: newBaseName, conditions }) => {\n return captureResult(() => new FsItem({ baseName: newBaseName, conditions, item }, qualifiers));\n })\n .withDetail('failed', 'succeeded');\n }\n\n /**\n * Creates a new {@link Import.FsItem | FsItem} from a file system path.\n * @param importPath - The path to the file system item to import.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @param tree - An optional {@link FileTree.FileTree | file tree} to use for this item.\n * @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created\n * successfully, or a `Failure` containing an error message if it is not. Note that the result detail\n * `skipped` indicates that the item was not created because it is not relevant - this is a soft error\n * that should be silently ignored.\n */\n public static createForPath(\n importPath: string,\n qualifiers: IReadOnlyQualifierCollector,\n tree?: FileTree.FileTree\n ): DetailedResult<FsItem, FsItemResultDetail> {\n return useOrInitialize(tree, () => FileTree.forFilesystem())\n .withDetail<FsItemResultDetail>('failed', 'succeeded')\n .onSuccess((tree) => {\n return tree\n .getItem(importPath)\n .withDetail<FsItemResultDetail>('failed')\n .onSuccess((item) => FsItem.createForItem(item, qualifiers));\n });\n }\n\n /**\n * Tries to parse a base name into a base name and a set of conditions.\n * @param baseName - The base name to parse.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @returns `Success` containing the parsed base name and conditions on success, or `Failure` containing\n * an error message if it is not.\n */\n public static tryParseBaseName(\n baseName: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<Omit<IFsItemProps, 'item'>> {\n const nameParts = baseName.split('.');\n const segmentToTest = nameParts.length > 1 ? nameParts[nameParts.length - 1] : nameParts[0];\n const validatedConditions = CommonHelpers.parseConditionSetTokenParts(segmentToTest).onSuccess(\n (parts) => {\n return mapResults(\n parts.map((part) => Conditions.ConditionTokens.validateConditionTokenParts(part, qualifiers))\n ).onFailure((msg) => {\n if (parts.length === 1 && parts[0].qualifier === undefined) {\n return succeed([]);\n }\n return fail(msg);\n });\n }\n );\n if (validatedConditions.isFailure()) {\n return fail(validatedConditions.message);\n }\n const conditions = validatedConditions.value;\n if (conditions.length > 0) {\n baseName = nameParts.filter((s) => s !== segmentToTest).join('.');\n }\n return succeed({ baseName, conditions });\n }\n\n /**\n * Gets the context for this file system item.\n * @returns `Success` containing the {@link Import.ImportContext | import context} for this item\n * if successful, or a `Failure` containing an error message if an error occurs.\n */\n public getContext(): Result<ImportContext> {\n return Validate.toOptionalResourceId(this.baseName).onSuccess((baseId) => {\n const conditions = this.conditions.map((c) => {\n return {\n qualifierName: c.qualifier.name,\n value: c.value,\n operator: c.operator,\n priority: c.priority\n };\n });\n return ImportContext.create({ baseId, conditions });\n });\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importContext.js","sourceRoot":"","sources":["../../../src/packlets/import/importContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAqC/D;;;GAGG;AACH,MAAM,OAAO,aAAa;IAWxB;;;;;OAKG;IACH,YAAsB,EAAE,MAAM,EAAE,UAAU,EAAkB;QAC1D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAChE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAAwB;QAC3C,oBAAoB;QACpB,OAAO,GAAG,OAAO,aAAP,OAAO,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AwB;;QAExB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;QACD,sBAAsB;QACtB,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,MAAA,SAAS,CAAC,WAAW,mCAAI,SAAS,CAAC;QAEvD,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,SAAS;gBACZ,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC3B,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,gEAAgE;gBAChE,2CAA2C;gBAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC9D,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC1E,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACtD,CAAC;YACD,KAAK,QAAQ;gBACX,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACH,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 { Helpers } from '../common';\nimport { captureResult, Result, succeed } from '@fgv/ts-utils';\nimport { IConditionDecl } from '../conditions';\nimport { ResourceId } from '../common';\nimport * as ResourceJson from '../resource-json';\n\n/**\n * Accumulated context of a resource import operation.\n * @public\n */\nexport interface IImportContext {\n /**\n * Base ID for the import context for resources imported\n * in this context.\n */\n readonly baseId?: string;\n /**\n * Conditions to be applied to resources imported in this context.\n */\n readonly conditions?: ReadonlyArray<IConditionDecl>;\n}\n\n/**\n * Accumulated context of a resource import operation.\n * @public\n */\nexport interface IValidatedImportContext {\n /**\n * Base ID for the import context for resources imported\n * in this context.\n */\n readonly baseId?: ResourceId;\n /**\n * Conditions to be applied to resources imported in this context.\n */\n readonly conditions: ReadonlyArray<IConditionDecl>;\n}\n\n/**\n * Class to accumulate context for a resource import operation.\n * @public\n */\nexport class ImportContext implements IValidatedImportContext {\n /**\n * {@inheritDoc Import.IImportContext.baseId}\n */\n public readonly baseId: ResourceId | undefined;\n\n /**\n * {@inheritDoc Import.IImportContext.conditions}\n */\n public readonly conditions: ReadonlyArray<IConditionDecl>;\n\n /**\n * Protected {@link Import.ImportContext | import context} for derived classes.\n * Public consumers use {@link Import.ImportContext.create | create} to create new instances.\n * @param params - The {@link Import.IImportContext | import context} parameters including\n * the base ID and conditions to be applied to resources imported in this context.\n */\n protected constructor({ baseId, conditions }: IImportContext) {\n this.baseId = Helpers.joinOptionalResourceIds(baseId).orThrow();\n this.conditions = Array.from(conditions ?? []);\n }\n\n /**\n * Factory method to create a new {@link Import.ImportContext | import context}.\n * @param context - The {@link Import.IImportContext | import context} to create\n * the new context from.\n * @returns `Success` with the new {@link Import.ImportContext | import context}\n * if successful, or `Failure` with an error message if creation fails.\n */\n public static create(context?: IImportContext): Result<ImportContext> {\n /* c8 ignore next */\n context = context ?? { conditions: [] };\n return captureResult(() => new ImportContext(context));\n }\n\n /**\n * Adds conditions to the import context.\n * @param conditions - Conditions to be added to the import context.\n * @returns `Success` with a new {@link Import.ImportContext | import context} containing the added conditions\n * if successful, or `Failure` with an error message if the operation fails.\n */\n public withConditions(conditions: IConditionDecl[]): Result<ImportContext> {\n return ImportContext.create({\n baseId: this.baseId,\n conditions: [...this.conditions, ...conditions]\n });\n }\n\n /**\n * Appends names to the base ID of the import context.\n * @param names - The name segments to append to the base ID.\n * @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID\n * if successful, or `Failure` with an error message if the operation fails.\n */\n public withName(...names: string[]): Result<ImportContext> {\n return Helpers.joinResourceIds(this.baseId, ...names).onSuccess((baseId) => {\n return ImportContext.create({ baseId, conditions: this.conditions });\n });\n }\n\n /**\n * Extends the import context with additional name segments and conditions.\n * @param context - The {@link Import.IImportContext | import context} to extend this context with.\n * @returns `Success` with a new {@link Import.ImportContext | import context}\n * containing the extended context if successful, or `Failure` with an error\n * message if the operation fails.\n */\n public extend(context?: IValidatedImportContext): Result<ImportContext> {\n /* c8 ignore next 1 */\n context = context ?? { conditions: [] };\n const conditions = [...this.conditions, ...context.conditions];\n return Helpers.joinOptionalResourceIds(this.baseId, context.baseId).onSuccess((baseId) => {\n return ImportContext.create({ baseId, conditions });\n });\n }\n\n /**\n * Creates a new {@link Import.ImportContext | import context} to import resources from a\n * container with the specified {@link ResourceJson.Normalized.IContainerContextDecl | container context declaration}e\n * @param container - The {@link ResourceJson.Normalized.IContainerContextDecl | container context declaration}\n * to consider when creating the new context.\n * @param importer - The base {@link Import.ImportContext | import context} to adjust for the container\n * context.\n * @returns `Success` with the new {@link Import.ImportContext | import context} if successful,\n * or `Failure` with an error message if the operation fails.\n * @remarks\n * A container context declaration may specify a merge method, which determines how the\n * container context is merged with the base context. The merge method can be one of the following:\n * - `augment`: The base context is augmented with the container context. This is the default behavior.\n * - `replace`: The base context is selectively replaced with the container context. If the container context\n * specifies a base ID or conditions, the corresponding values in the base context are ignored.\n * - `delete`: The base context is deleted. This means that the container context is not used at all.\n */\n public static forContainerImport(\n container?: ResourceJson.Normalized.IContainerContextDecl,\n importer?: ImportContext\n ): Result<ImportContext | undefined> {\n if (!importer) {\n return succeed(undefined);\n }\n /* c8 ignore next 1 */\n container = container ?? {};\n const mergeMethod = container.mergeMethod ?? 'augment';\n\n switch (mergeMethod) {\n case 'augment':\n return succeed(importer);\n case 'replace': {\n // if the container defines baseId or conditions, then we ignore\n // the corresponding values in the importer\n const baseId = container.baseId ? undefined : importer.baseId;\n const conditions = container.conditions ? undefined : importer.conditions;\n return ImportContext.create({ baseId, conditions });\n }\n case 'delete':\n return succeed(undefined);\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importManager.js","sourceRoot":"","sources":["../../../src/packlets/import/importManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAKlF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAa,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAwCxF;;;GAGG;AACH,MAAM,OAAO,aAAa;IAOxB;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAUD;;;OAGG;IACH,YAAsB,MAA6B;;QAPzC,WAAM,GAAkB,EAAE,CAAC;QAC3B,eAAU,GAAgB,EAAE,CAAC;QAOrC,IAAI,CAAC,SAAS,GAAG,MAAM,CA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AC,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,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, MessageAggregator, Result, succeed } from '@fgv/ts-utils';\nimport { FileTree } from '@fgv/ts-json-base';\nimport { Converter } from '@fgv/ts-utils';\nimport { JsonValue } from '@fgv/ts-json-base';\nimport { ResourceManagerBuilder } from '../resources';\nimport { ImportContext } from './importContext';\nimport { IImportable, IImportablePath } from './importable';\nimport { FsItemImporter } from './importers/fsItemImporter';\nimport { CollectionImporter, IImporter, JsonImporter, PathImporter } from './importers';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\n\n/**\n * Parameters for creating an {@link Import.ImportManager | ImportManager}.\n * @public\n */\nexport interface IImporterCreateParams {\n /**\n * The {@link Resources.ResourceManagerBuilder | resource manager builder} into which resources\n * will be imported.\n */\n resources: ResourceManagerBuilder;\n\n /**\n * An optional initial {@link Import.ImportContext | import context} for the import operation.\n */\n initialContext?: ImportContext;\n\n /**\n * An optional `FileTree` for importing path items.\n */\n fileTree?: FileTree.FileTree;\n\n /**\n * An optional list of {@link Import.Importers.IImporter | importers} to use for the import.\n */\n importers?: IImporter[];\n\n /**\n * An optional converter used to pre-process file contents before JSON import validation.\n */\n fileContentConverter?: Converter<JsonValue>;\n\n /**\n * Optional file extensions which should be parsed using the supplied file content converter.\n */\n fileContentExtensions?: ReadonlyArray<string>;\n}\n\n/**\n * Class to manage the import of resources from various sources.\n * @public\n */\nexport class ImportManager {\n /**\n * The {@link Resources.ResourceManagerBuilder | resource manager builder} into which resources\n * will be imported.\n */\n public readonly resources: ResourceManagerBuilder;\n\n /**\n * The list of {@link Import.Importers.IImporter | importers} to use for the\n * import operations.\n */\n public get importers(): ReadonlyArray<IImporter> {\n return this._importers;\n }\n\n /**\n * The initial {@link Import.ImportContext | import context} for the import operation.\n */\n public initialContext: ImportContext;\n\n protected _stack: IImportable[] = [];\n protected _importers: IImporter[] = [];\n\n /**\n * Protected constructor for the {@link Import.ImportManager | ImportManager}.\n * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.\n */\n protected constructor(params: IImporterCreateParams) {\n this.resources = params.resources;\n this.initialContext = params.initialContext ?? ImportContext.create().orThrow();\n this._importers = Array.from(\n params.importers ??\n ImportManager.getDefaultImporters(\n this.resources.qualifiers,\n params.fileTree,\n params.fileContentConverter,\n params.fileContentExtensions\n )\n );\n }\n\n /**\n * Factory method to create a new {@link Import.ImportManager | ImportManager}.\n * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.\n * @returns `Success` with the new {@link Import.ImportManager | ImportManager}\n * if successful, or `Failure` with an error message if creation fails.\n */\n public static create(params: IImporterCreateParams): Result<ImportManager> {\n return captureResult(() => new ImportManager(params));\n }\n\n /**\n * Imports resources from an {@link Import.IImportable | importable} object.\n * @param importable - The {@link Import.IImportable | importable} object to import.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n */\n public import(importable: IImportable): Result<ImportManager> {\n this._stack.push(importable);\n return this._import();\n }\n\n /**\n * Imports resources from a file system path.\n * @param filePath - The path to import resources from.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n */\n public importFromFileSystem(filePath: string): Result<ImportManager> {\n const importable: IImportablePath = { type: 'path', path: filePath };\n return this.import(importable);\n }\n\n /**\n * Gets the default importers using supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers}\n * and optional `FileTree`.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for the import.\n * @param tree - An optional `FileTree` for importing path items.\n * @param fileContentConverter - An optional converter used to pre-process raw file contents before JSON import\n * validation.\n * @param fileContentExtensions - Optional file extensions which should be parsed using the supplied file\n * content converter.\n * @returns A read-only array of {@link Import.Importers.IImporter | importers}.\n */\n public static getDefaultImporters(\n qualifiers: IReadOnlyQualifierCollector,\n tree?: FileTree.FileTree,\n fileContentConverter?: Converter<JsonValue>,\n fileContentExtensions?: ReadonlyArray<string>\n ): ReadonlyArray<IImporter> {\n return [\n PathImporter.create({ qualifiers, tree }).orThrow(),\n FsItemImporter.create({ qualifiers, fileContentConverter, fileContentExtensions }).orThrow(),\n JsonImporter.create().orThrow(),\n CollectionImporter.create().orThrow()\n ];\n }\n\n /**\n * Imports any items on the import stack.\n * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,\n * or `Failure` with an error message if the import fails.\n * @public\n */\n protected _import(): Result<ImportManager> {\n const errors: MessageAggregator = new MessageAggregator();\n\n while (this._stack.length > 0) {\n const item = this._stack.pop();\n if (item !== undefined) {\n let processed: boolean = false;\n let consumed: boolean = false;\n\n for (const importer of this._importers) {\n if (consumed || !importer.types.includes(item.type)) {\n continue;\n }\n\n const result = importer.import(item, this.resources).aggregateError(errors);\n processed = processed || result.detail !== 'skipped';\n consumed = consumed || result.detail === 'consumed';\n\n if (result.isSuccess()) {\n this._stack.push(...result.value);\n } else if (result.detail !== 'skipped') {\n errors.addMessage(`${item.type}: ${result.message}`);\n }\n }\n\n if (!processed) {\n errors.addMessage(`${item.type}: No matching importer found`);\n }\n }\n }\n\n return errors.returnOrReport(succeed(this));\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importable.js","sourceRoot":"","sources":["../../../src/packlets/import/importable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA6EH;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,CAAc;IACzC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3F,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 { JsonValue } from '@fgv/ts-json-base';\nimport * as ResourceJson from '../resource-json';\nimport { ImportContext } from './importContext';\nimport { FsItem } from './fsItem';\n\n/**\n * Base interface for importable entities.\n * @public\n */\nexport interface IImportable {\n type: string;\n context?: ImportContext;\n}\n\n/**\n * Represents a filesystem path to be imported.\n * @public\n */\nexport interface IImportablePath extends IImportable {\n type: 'path';\n path: string;\n context?: ImportContext;\n}\n\n/**\n * Represents a filesystem item to be imported.\n * @public\n */\nexport interface IImportableFsItem extends IImportable {\n type: 'fsItem';\n item: FsItem;\n context?: ImportContext;\n}\n\n/**\n * Represents some JSON to be imported.\n * @public\n */\nexport interface IImportableJson extends IImportable {\n type: 'json';\n json: JsonValue;\n context?: ImportContext;\n}\n\n/**\n * Represents a resource collection to be imported.\n * @public\n */\nexport interface IImportableResourceCollection extends IImportable {\n type: 'resourceCollection';\n collection: ResourceJson.ResourceDeclCollection;\n context?: ImportContext;\n}\n\n/**\n * Represents a resource tree to be imported.\n * @public\n */\nexport interface IImportableResourceTree extends IImportable {\n type: 'resourceTree';\n tree: ResourceJson.ResourceDeclTree;\n context?: ImportContext;\n}\n\n/**\n * Type of importable entities.\n * @public\n */\nexport type Importable =\n | IImportablePath\n | IImportableFsItem\n | IImportableJson\n | IImportableResourceCollection\n | IImportableResourceTree;\n\n/**\n * Type guard for {@link Import.Importable | importables}.\n * @param i - The entity to check.\n * @returns `true` if the supplied {@link Import.IImportable | IImportable} is a\n * {@link Import.Importable | known importable}, `false` otherwise.\n * @public\n */\nexport function isImportable(i: IImportable): i is Importable {\n return ['path', 'fsItem', 'json', 'resourceCollection', 'resourceTree'].includes(i.type);\n}\n"]}