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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (571) hide show
  1. package/dist/index.browser.js.map +1 -0
  2. package/dist/index.js.map +1 -0
  3. package/dist/packlets/bundle/bundleBuilder.js.map +1 -0
  4. package/dist/packlets/bundle/bundleLoader.js.map +1 -0
  5. package/dist/packlets/bundle/bundleNormalizer.js.map +1 -0
  6. package/dist/packlets/bundle/bundleUtils.js.map +1 -0
  7. package/dist/packlets/bundle/convert.js.map +1 -0
  8. package/dist/packlets/bundle/index.js.map +1 -0
  9. package/dist/packlets/bundle/model.js.map +1 -0
  10. package/dist/packlets/common/conditions.js.map +1 -0
  11. package/dist/packlets/common/convert.js.map +1 -0
  12. package/dist/packlets/common/helpers/conditions.js.map +1 -0
  13. package/dist/packlets/common/helpers/context.js.map +1 -0
  14. package/dist/packlets/common/helpers/index.js.map +1 -0
  15. package/dist/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  16. package/dist/packlets/common/helpers/resources.js +2 -4
  17. package/dist/packlets/common/helpers/resources.js.map +1 -0
  18. package/dist/packlets/common/index.js.map +1 -0
  19. package/dist/packlets/common/resources.js.map +1 -0
  20. package/dist/packlets/common/validate/conditions.js +4 -4
  21. package/dist/packlets/common/validate/conditions.js.map +1 -0
  22. package/dist/packlets/common/validate/index.js.map +1 -0
  23. package/dist/packlets/common/validate/regularExpressions.js +2 -2
  24. package/dist/packlets/common/validate/regularExpressions.js.map +1 -0
  25. package/dist/packlets/common/validate/resources.js +1 -1
  26. package/dist/packlets/common/validate/resources.js.map +1 -0
  27. package/dist/packlets/conditions/condition.js +3 -7
  28. package/dist/packlets/conditions/condition.js.map +1 -0
  29. package/dist/packlets/conditions/conditionCollector.js.map +1 -0
  30. package/dist/packlets/conditions/conditionDecls.js.map +1 -0
  31. package/dist/packlets/conditions/conditionSet.js.map +1 -0
  32. package/dist/packlets/conditions/conditionSetCollector.js.map +1 -0
  33. package/dist/packlets/conditions/conditionSetDecls.js.map +1 -0
  34. package/dist/packlets/conditions/conditionToken.js.map +1 -0
  35. package/dist/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  36. package/dist/packlets/conditions/convert/decls.js.map +1 -0
  37. package/dist/packlets/conditions/convert/index.js.map +1 -0
  38. package/dist/packlets/conditions/index.js.map +1 -0
  39. package/dist/packlets/config/common.js +78 -0
  40. package/dist/packlets/config/common.js.map +1 -0
  41. package/dist/packlets/config/configInitFactory.js +258 -0
  42. package/dist/packlets/config/configInitFactory.js.map +1 -0
  43. package/dist/packlets/config/convert.js +56 -0
  44. package/dist/packlets/config/convert.js.map +1 -0
  45. package/dist/packlets/config/index.browser.js +34 -0
  46. package/dist/packlets/config/index.browser.js.map +1 -0
  47. package/dist/packlets/config/index.js +28 -0
  48. package/dist/packlets/config/index.js.map +1 -0
  49. package/dist/packlets/config/json.js +23 -0
  50. package/dist/packlets/config/json.js.map +1 -0
  51. package/dist/packlets/config/predefined/default.js +138 -0
  52. package/dist/packlets/config/predefined/default.js.map +1 -0
  53. package/dist/packlets/config/predefined/extended.js +190 -0
  54. package/dist/packlets/config/predefined/extended.js.map +1 -0
  55. package/dist/packlets/config/predefined/index.js +25 -0
  56. package/dist/packlets/config/predefined/index.js.map +1 -0
  57. package/dist/packlets/config/systemConfiguration.js +147 -0
  58. package/dist/packlets/config/systemConfiguration.js.map +1 -0
  59. package/dist/packlets/context/contextDecls.js.map +1 -0
  60. package/dist/packlets/context/contextToken.js.map +1 -0
  61. package/dist/packlets/context/convert/decls.js.map +1 -0
  62. package/dist/packlets/context/convert/index.js.map +1 -0
  63. package/dist/packlets/context/index.js.map +1 -0
  64. package/dist/packlets/decisions/abstractDecision.js.map +1 -0
  65. package/dist/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  66. package/dist/packlets/decisions/candidate.js.map +1 -0
  67. package/dist/packlets/decisions/common.js.map +1 -0
  68. package/dist/packlets/decisions/concreteDecision.js.map +1 -0
  69. package/dist/packlets/decisions/decision.js +1 -1
  70. package/dist/packlets/decisions/decision.js.map +1 -0
  71. package/dist/packlets/decisions/index.js.map +1 -0
  72. package/dist/packlets/import/fsItem.js +1 -4
  73. package/dist/packlets/import/fsItem.js.map +1 -0
  74. package/dist/packlets/import/importContext.js +3 -3
  75. package/dist/packlets/import/importContext.js.map +1 -0
  76. package/dist/packlets/import/importManager.js +7 -3
  77. package/dist/packlets/import/importManager.js.map +1 -0
  78. package/dist/packlets/import/importable.js.map +1 -0
  79. package/dist/packlets/import/importers/collectionImporter.js +2 -2
  80. package/dist/packlets/import/importers/collectionImporter.js.map +1 -0
  81. package/dist/packlets/import/importers/fsItemImporter.js +30 -14
  82. package/dist/packlets/import/importers/fsItemImporter.js.map +1 -0
  83. package/dist/packlets/import/importers/importer.js.map +1 -0
  84. package/dist/packlets/import/importers/index.browser.js.map +1 -0
  85. package/dist/packlets/import/importers/index.js.map +1 -0
  86. package/dist/packlets/import/importers/jsonImporter.js +2 -2
  87. package/dist/packlets/import/importers/jsonImporter.js.map +1 -0
  88. package/dist/packlets/import/importers/pathImporter.js +1 -1
  89. package/dist/packlets/import/importers/pathImporter.js.map +1 -0
  90. package/dist/packlets/import/index.browser.js.map +1 -0
  91. package/dist/packlets/import/index.js.map +1 -0
  92. package/dist/packlets/qualifier-types/config/convert.js +124 -0
  93. package/dist/packlets/qualifier-types/config/convert.js.map +1 -0
  94. package/dist/packlets/qualifier-types/config/index.js +25 -0
  95. package/dist/packlets/qualifier-types/config/index.js.map +1 -0
  96. package/dist/packlets/qualifier-types/config/json.js +32 -0
  97. package/dist/packlets/qualifier-types/config/json.js.map +1 -0
  98. package/dist/packlets/qualifier-types/convert.js.map +1 -0
  99. package/dist/packlets/qualifier-types/helpers.js.map +1 -0
  100. package/dist/packlets/qualifier-types/index.js.map +1 -0
  101. package/dist/packlets/qualifier-types/languageQualifierType.js +6 -7
  102. package/dist/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  103. package/dist/packlets/qualifier-types/literalQualifierType.js +7 -10
  104. package/dist/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  105. package/dist/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  106. package/dist/packlets/qualifier-types/qualifierType.js +12 -13
  107. package/dist/packlets/qualifier-types/qualifierType.js.map +1 -0
  108. package/dist/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  109. package/dist/packlets/qualifier-types/territoryQualifierType.js +5 -5
  110. package/dist/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  111. package/dist/packlets/qualifiers/convert/decls.js.map +1 -0
  112. package/dist/packlets/qualifiers/convert/index.js.map +1 -0
  113. package/dist/packlets/qualifiers/convert/qualifier.js.map +1 -0
  114. package/dist/packlets/qualifiers/index.js.map +1 -0
  115. package/dist/packlets/qualifiers/qualifier.js +6 -7
  116. package/dist/packlets/qualifiers/qualifier.js.map +1 -0
  117. package/dist/packlets/qualifiers/qualifierCollector.js +2 -2
  118. package/dist/packlets/qualifiers/qualifierCollector.js.map +1 -0
  119. package/dist/packlets/qualifiers/qualifierDecl.js.map +1 -0
  120. package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  121. package/dist/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  122. package/dist/packlets/resource-json/compiled/common.js.map +1 -0
  123. package/dist/packlets/resource-json/compiled/convert.js.map +1 -0
  124. package/dist/packlets/resource-json/compiled/index.js.map +1 -0
  125. package/dist/packlets/resource-json/compiled/json.js.map +1 -0
  126. package/dist/packlets/resource-json/convert.js.map +1 -0
  127. package/dist/packlets/resource-json/helpers.js.map +1 -0
  128. package/dist/packlets/resource-json/index.js.map +1 -0
  129. package/dist/packlets/resource-json/json.js.map +1 -0
  130. package/dist/packlets/resource-json/normalized.js.map +1 -0
  131. package/dist/packlets/resource-json/resourceDeclCollection.js +1 -1
  132. package/dist/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  133. package/dist/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  134. package/dist/packlets/resource-json/resourceDeclTree.js +1 -1
  135. package/dist/packlets/resource-json/resourceDeclTree.js.map +1 -0
  136. package/dist/packlets/resource-types/config/convert.js +35 -0
  137. package/dist/packlets/resource-types/config/convert.js.map +1 -0
  138. package/dist/packlets/resource-types/config/index.js +25 -0
  139. package/dist/packlets/resource-types/config/index.js.map +1 -0
  140. package/dist/packlets/resource-types/config/json.js +23 -0
  141. package/dist/packlets/resource-types/config/json.js.map +1 -0
  142. package/dist/packlets/resource-types/helpers.js.map +1 -0
  143. package/dist/packlets/resource-types/index.js.map +1 -0
  144. package/dist/packlets/resource-types/jsonResourceType.js +2 -2
  145. package/dist/packlets/resource-types/jsonResourceType.js.map +1 -0
  146. package/dist/packlets/resource-types/resourceType.js +2 -2
  147. package/dist/packlets/resource-types/resourceType.js.map +1 -0
  148. package/dist/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  149. package/dist/packlets/resources/candidateReducer.js.map +1 -0
  150. package/dist/packlets/resources/candidateValue.js.map +1 -0
  151. package/dist/packlets/resources/candidateValueCollector.js.map +1 -0
  152. package/dist/packlets/resources/common.js.map +1 -0
  153. package/dist/packlets/resources/deltaGenerator.js.map +1 -0
  154. package/dist/packlets/resources/index.js.map +1 -0
  155. package/dist/packlets/resources/resource.js.map +1 -0
  156. package/dist/packlets/resources/resourceBuilder.js +2 -2
  157. package/dist/packlets/resources/resourceBuilder.js.map +1 -0
  158. package/dist/packlets/resources/resourceCandidate.js.map +1 -0
  159. package/dist/packlets/resources/resourceManagerBuilder.js +5 -5
  160. package/dist/packlets/resources/resourceManagerBuilder.js.map +1 -0
  161. package/dist/packlets/runtime/cacheListener.js.map +1 -0
  162. package/dist/packlets/runtime/cacheMetrics.js.map +1 -0
  163. package/dist/packlets/runtime/compiledResourceCollection.js +5 -5
  164. package/dist/packlets/runtime/compiledResourceCollection.js.map +1 -0
  165. package/dist/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  166. package/dist/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  167. package/dist/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  168. package/dist/packlets/runtime/context/index.js.map +1 -0
  169. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  170. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  171. package/dist/packlets/runtime/iResourceManager.js.map +1 -0
  172. package/dist/packlets/runtime/index.js.map +1 -0
  173. package/dist/packlets/runtime/resource-tree/common.js.map +1 -0
  174. package/dist/packlets/runtime/resource-tree/index.js.map +1 -0
  175. package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  176. package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  177. package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  178. package/dist/packlets/runtime/resourceResolver.js.map +1 -0
  179. package/dist/packlets/runtime/resourceTreeResolver.js.map +1 -0
  180. package/dist/packlets/runtime/validate.js.map +1 -0
  181. package/dist/packlets/zip-archive/convert.js.map +1 -0
  182. package/dist/packlets/zip-archive/index.browser.js.map +1 -0
  183. package/dist/packlets/zip-archive/index.js.map +1 -0
  184. package/dist/packlets/zip-archive/json.js.map +1 -0
  185. package/dist/packlets/zip-archive/types.js.map +1 -0
  186. package/dist/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  187. package/dist/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  188. package/dist/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  189. package/dist/ts-res.d.ts +134 -112
  190. package/dist/tsdoc-metadata.json +1 -1
  191. package/lib/index.browser.d.ts.map +1 -0
  192. package/lib/index.browser.js.map +1 -0
  193. package/lib/index.d.ts.map +1 -0
  194. package/lib/index.js.map +1 -0
  195. package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
  196. package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
  197. package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
  198. package/lib/packlets/bundle/bundleLoader.js.map +1 -0
  199. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
  200. package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
  201. package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
  202. package/lib/packlets/bundle/bundleUtils.js.map +1 -0
  203. package/lib/packlets/bundle/convert.d.ts.map +1 -0
  204. package/lib/packlets/bundle/convert.js.map +1 -0
  205. package/lib/packlets/bundle/index.d.ts.map +1 -0
  206. package/lib/packlets/bundle/index.js.map +1 -0
  207. package/lib/packlets/bundle/model.d.ts.map +1 -0
  208. package/lib/packlets/bundle/model.js.map +1 -0
  209. package/lib/packlets/common/conditions.d.ts.map +1 -0
  210. package/lib/packlets/common/conditions.js.map +1 -0
  211. package/lib/packlets/common/convert.d.ts.map +1 -0
  212. package/lib/packlets/common/convert.js.map +1 -0
  213. package/lib/packlets/common/helpers/conditions.d.ts.map +1 -0
  214. package/lib/packlets/common/helpers/conditions.js.map +1 -0
  215. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  216. package/lib/packlets/common/helpers/context.js.map +1 -0
  217. package/lib/packlets/common/helpers/index.d.ts.map +1 -0
  218. package/lib/packlets/common/helpers/index.js.map +1 -0
  219. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  220. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  221. package/lib/packlets/common/helpers/resources.d.ts +2 -4
  222. package/lib/packlets/common/helpers/resources.d.ts.map +1 -0
  223. package/lib/packlets/common/helpers/resources.js +2 -4
  224. package/lib/packlets/common/helpers/resources.js.map +1 -0
  225. package/lib/packlets/common/index.d.ts.map +1 -0
  226. package/lib/packlets/common/index.js.map +1 -0
  227. package/lib/packlets/common/resources.d.ts.map +1 -0
  228. package/lib/packlets/common/resources.js.map +1 -0
  229. package/lib/packlets/common/validate/conditions.d.ts +4 -4
  230. package/lib/packlets/common/validate/conditions.d.ts.map +1 -0
  231. package/lib/packlets/common/validate/conditions.js +4 -4
  232. package/lib/packlets/common/validate/conditions.js.map +1 -0
  233. package/lib/packlets/common/validate/index.d.ts.map +1 -0
  234. package/lib/packlets/common/validate/index.js.map +1 -0
  235. package/lib/packlets/common/validate/regularExpressions.d.ts +2 -2
  236. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -0
  237. package/lib/packlets/common/validate/regularExpressions.js +2 -2
  238. package/lib/packlets/common/validate/regularExpressions.js.map +1 -0
  239. package/lib/packlets/common/validate/resources.d.ts +1 -1
  240. package/lib/packlets/common/validate/resources.d.ts.map +1 -0
  241. package/lib/packlets/common/validate/resources.js +1 -1
  242. package/lib/packlets/common/validate/resources.js.map +1 -0
  243. package/lib/packlets/conditions/condition.d.ts +3 -7
  244. package/lib/packlets/conditions/condition.d.ts.map +1 -0
  245. package/lib/packlets/conditions/condition.js +3 -7
  246. package/lib/packlets/conditions/condition.js.map +1 -0
  247. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -0
  248. package/lib/packlets/conditions/conditionCollector.js.map +1 -0
  249. package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -0
  250. package/lib/packlets/conditions/conditionDecls.js.map +1 -0
  251. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -0
  252. package/lib/packlets/conditions/conditionSet.js.map +1 -0
  253. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -0
  254. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -0
  255. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -0
  256. package/lib/packlets/conditions/conditionSetDecls.js.map +1 -0
  257. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -0
  258. package/lib/packlets/conditions/conditionToken.js.map +1 -0
  259. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -0
  260. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  261. package/lib/packlets/conditions/convert/decls.d.ts.map +1 -0
  262. package/lib/packlets/conditions/convert/decls.js.map +1 -0
  263. package/lib/packlets/conditions/convert/index.d.ts.map +1 -0
  264. package/lib/packlets/conditions/convert/index.js.map +1 -0
  265. package/lib/packlets/conditions/index.d.ts.map +1 -0
  266. package/lib/packlets/conditions/index.js.map +1 -0
  267. package/lib/packlets/config/common.d.ts +35 -0
  268. package/lib/packlets/config/common.d.ts.map +1 -0
  269. package/lib/packlets/config/common.js +97 -0
  270. package/lib/packlets/config/common.js.map +1 -0
  271. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  272. package/lib/packlets/config/configInitFactory.d.ts.map +1 -0
  273. package/lib/packlets/config/configInitFactory.js +303 -0
  274. package/lib/packlets/config/configInitFactory.js.map +1 -0
  275. package/lib/packlets/config/convert.d.ts +23 -0
  276. package/lib/packlets/config/convert.d.ts.map +1 -0
  277. package/lib/packlets/config/convert.js +93 -0
  278. package/lib/packlets/config/convert.js.map +1 -0
  279. package/lib/packlets/config/index.browser.d.ts +7 -0
  280. package/lib/packlets/config/index.browser.d.ts.map +1 -0
  281. package/lib/packlets/config/index.browser.js +74 -0
  282. package/lib/packlets/config/index.browser.js.map +1 -0
  283. package/lib/packlets/config/index.d.ts +7 -0
  284. package/lib/packlets/config/index.d.ts.map +1 -0
  285. package/lib/packlets/config/index.js +68 -0
  286. package/lib/packlets/config/index.js.map +1 -0
  287. package/lib/packlets/config/json.d.ts +20 -0
  288. package/lib/packlets/config/json.d.ts.map +1 -0
  289. package/lib/packlets/config/json.js +24 -0
  290. package/lib/packlets/config/json.js.map +1 -0
  291. package/lib/packlets/config/predefined/default.d.ts +57 -0
  292. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  293. package/lib/packlets/config/predefined/default.js +141 -0
  294. package/lib/packlets/config/predefined/default.js.map +1 -0
  295. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  296. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  297. package/lib/packlets/config/predefined/extended.js +193 -0
  298. package/lib/packlets/config/predefined/extended.js.map +1 -0
  299. package/lib/packlets/config/predefined/index.d.ts +4 -0
  300. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  301. package/lib/packlets/config/predefined/index.js +62 -0
  302. package/lib/packlets/config/predefined/index.js.map +1 -0
  303. package/lib/packlets/config/systemConfiguration.d.ts +94 -0
  304. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  305. package/lib/packlets/config/systemConfiguration.js +152 -0
  306. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  307. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  308. package/lib/packlets/context/contextDecls.js.map +1 -0
  309. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  310. package/lib/packlets/context/contextToken.js.map +1 -0
  311. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  312. package/lib/packlets/context/convert/decls.js.map +1 -0
  313. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  314. package/lib/packlets/context/convert/index.js.map +1 -0
  315. package/lib/packlets/context/index.d.ts.map +1 -0
  316. package/lib/packlets/context/index.js.map +1 -0
  317. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -0
  318. package/lib/packlets/decisions/abstractDecision.js.map +1 -0
  319. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -0
  320. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  321. package/lib/packlets/decisions/candidate.d.ts.map +1 -0
  322. package/lib/packlets/decisions/candidate.js.map +1 -0
  323. package/lib/packlets/decisions/common.d.ts.map +1 -0
  324. package/lib/packlets/decisions/common.js.map +1 -0
  325. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -0
  326. package/lib/packlets/decisions/concreteDecision.js.map +1 -0
  327. package/lib/packlets/decisions/decision.d.ts +1 -1
  328. package/lib/packlets/decisions/decision.d.ts.map +1 -0
  329. package/lib/packlets/decisions/decision.js +1 -1
  330. package/lib/packlets/decisions/decision.js.map +1 -0
  331. package/lib/packlets/decisions/index.d.ts.map +1 -0
  332. package/lib/packlets/decisions/index.js.map +1 -0
  333. package/lib/packlets/import/fsItem.d.ts +1 -4
  334. package/lib/packlets/import/fsItem.d.ts.map +1 -0
  335. package/lib/packlets/import/fsItem.js +1 -4
  336. package/lib/packlets/import/fsItem.js.map +1 -0
  337. package/lib/packlets/import/importContext.d.ts +5 -5
  338. package/lib/packlets/import/importContext.d.ts.map +1 -0
  339. package/lib/packlets/import/importContext.js +3 -3
  340. package/lib/packlets/import/importContext.js.map +1 -0
  341. package/lib/packlets/import/importManager.d.ts +15 -1
  342. package/lib/packlets/import/importManager.d.ts.map +1 -0
  343. package/lib/packlets/import/importManager.js +7 -3
  344. package/lib/packlets/import/importManager.js.map +1 -0
  345. package/lib/packlets/import/importable.d.ts.map +1 -0
  346. package/lib/packlets/import/importable.js.map +1 -0
  347. package/lib/packlets/import/importers/collectionImporter.d.ts +2 -2
  348. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -0
  349. package/lib/packlets/import/importers/collectionImporter.js +2 -2
  350. package/lib/packlets/import/importers/collectionImporter.js.map +1 -0
  351. package/lib/packlets/import/importers/fsItemImporter.d.ts +16 -2
  352. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -0
  353. package/lib/packlets/import/importers/fsItemImporter.js +29 -13
  354. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -0
  355. package/lib/packlets/import/importers/importer.d.ts.map +1 -0
  356. package/lib/packlets/import/importers/importer.js.map +1 -0
  357. package/lib/packlets/import/importers/index.browser.d.ts.map +1 -0
  358. package/lib/packlets/import/importers/index.browser.js.map +1 -0
  359. package/lib/packlets/import/importers/index.d.ts.map +1 -0
  360. package/lib/packlets/import/importers/index.js.map +1 -0
  361. package/lib/packlets/import/importers/jsonImporter.d.ts +2 -2
  362. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -0
  363. package/lib/packlets/import/importers/jsonImporter.js +2 -2
  364. package/lib/packlets/import/importers/jsonImporter.js.map +1 -0
  365. package/lib/packlets/import/importers/pathImporter.d.ts +1 -1
  366. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -0
  367. package/lib/packlets/import/importers/pathImporter.js +1 -1
  368. package/lib/packlets/import/importers/pathImporter.js.map +1 -0
  369. package/lib/packlets/import/index.browser.d.ts.map +1 -0
  370. package/lib/packlets/import/index.browser.js.map +1 -0
  371. package/lib/packlets/import/index.d.ts.map +1 -0
  372. package/lib/packlets/import/index.js.map +1 -0
  373. package/lib/packlets/qualifier-types/config/convert.d.ts +65 -0
  374. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  375. package/lib/packlets/qualifier-types/config/convert.js +161 -0
  376. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  377. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  378. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  379. package/lib/packlets/qualifier-types/config/index.js +64 -0
  380. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  381. package/lib/packlets/qualifier-types/config/json.d.ts +91 -0
  382. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  383. package/lib/packlets/qualifier-types/config/json.js +35 -0
  384. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  385. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -0
  386. package/lib/packlets/qualifier-types/convert.js.map +1 -0
  387. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  388. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  389. package/lib/packlets/qualifier-types/index.d.ts.map +1 -0
  390. package/lib/packlets/qualifier-types/index.js.map +1 -0
  391. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +6 -7
  392. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -0
  393. package/lib/packlets/qualifier-types/languageQualifierType.js +6 -7
  394. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  395. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +7 -10
  396. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -0
  397. package/lib/packlets/qualifier-types/literalQualifierType.js +7 -10
  398. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  399. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  400. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  401. package/lib/packlets/qualifier-types/qualifierType.d.ts +17 -18
  402. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -0
  403. package/lib/packlets/qualifier-types/qualifierType.js +12 -13
  404. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -0
  405. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -0
  406. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  407. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +8 -8
  408. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -0
  409. package/lib/packlets/qualifier-types/territoryQualifierType.js +5 -5
  410. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  411. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -0
  412. package/lib/packlets/qualifiers/convert/decls.js.map +1 -0
  413. package/lib/packlets/qualifiers/convert/index.d.ts.map +1 -0
  414. package/lib/packlets/qualifiers/convert/index.js.map +1 -0
  415. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +1 -0
  416. package/lib/packlets/qualifiers/convert/qualifier.js.map +1 -0
  417. package/lib/packlets/qualifiers/index.d.ts.map +1 -0
  418. package/lib/packlets/qualifiers/index.js.map +1 -0
  419. package/lib/packlets/qualifiers/qualifier.d.ts +6 -7
  420. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -0
  421. package/lib/packlets/qualifiers/qualifier.js +6 -7
  422. package/lib/packlets/qualifiers/qualifier.js.map +1 -0
  423. package/lib/packlets/qualifiers/qualifierCollector.d.ts +3 -3
  424. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -0
  425. package/lib/packlets/qualifiers/qualifierCollector.js +2 -2
  426. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -0
  427. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -0
  428. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -0
  429. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  430. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  431. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  432. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  433. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  434. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  435. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  436. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  437. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  438. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  439. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  440. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  441. package/lib/packlets/resource-json/convert.d.ts.map +1 -0
  442. package/lib/packlets/resource-json/convert.js.map +1 -0
  443. package/lib/packlets/resource-json/helpers.d.ts.map +1 -0
  444. package/lib/packlets/resource-json/helpers.js.map +1 -0
  445. package/lib/packlets/resource-json/index.d.ts.map +1 -0
  446. package/lib/packlets/resource-json/index.js.map +1 -0
  447. package/lib/packlets/resource-json/json.d.ts.map +1 -0
  448. package/lib/packlets/resource-json/json.js.map +1 -0
  449. package/lib/packlets/resource-json/normalized.d.ts.map +1 -0
  450. package/lib/packlets/resource-json/normalized.js.map +1 -0
  451. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +1 -1
  452. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -0
  453. package/lib/packlets/resource-json/resourceDeclCollection.js +1 -1
  454. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  455. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -0
  456. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  457. package/lib/packlets/resource-json/resourceDeclTree.d.ts +1 -1
  458. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -0
  459. package/lib/packlets/resource-json/resourceDeclTree.js +1 -1
  460. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -0
  461. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  462. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  463. package/lib/packlets/resource-types/config/convert.js +38 -0
  464. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  465. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  466. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  467. package/lib/packlets/resource-types/config/index.js +64 -0
  468. package/lib/packlets/resource-types/config/index.js.map +1 -0
  469. package/lib/packlets/resource-types/config/json.d.ts +11 -0
  470. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  471. package/lib/packlets/resource-types/config/json.js +24 -0
  472. package/lib/packlets/resource-types/config/json.js.map +1 -0
  473. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  474. package/lib/packlets/resource-types/helpers.js.map +1 -0
  475. package/lib/packlets/resource-types/index.d.ts.map +1 -0
  476. package/lib/packlets/resource-types/index.js.map +1 -0
  477. package/lib/packlets/resource-types/jsonResourceType.d.ts +17 -5
  478. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -0
  479. package/lib/packlets/resource-types/jsonResourceType.js +2 -2
  480. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -0
  481. package/lib/packlets/resource-types/resourceType.d.ts +5 -5
  482. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -0
  483. package/lib/packlets/resource-types/resourceType.js +2 -2
  484. package/lib/packlets/resource-types/resourceType.js.map +1 -0
  485. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +1 -0
  486. package/lib/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  487. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  488. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  489. package/lib/packlets/resources/candidateValue.d.ts.map +1 -0
  490. package/lib/packlets/resources/candidateValue.js.map +1 -0
  491. package/lib/packlets/resources/candidateValueCollector.d.ts.map +1 -0
  492. package/lib/packlets/resources/candidateValueCollector.js.map +1 -0
  493. package/lib/packlets/resources/common.d.ts.map +1 -0
  494. package/lib/packlets/resources/common.js.map +1 -0
  495. package/lib/packlets/resources/deltaGenerator.d.ts.map +1 -0
  496. package/lib/packlets/resources/deltaGenerator.js.map +1 -0
  497. package/lib/packlets/resources/index.d.ts.map +1 -0
  498. package/lib/packlets/resources/index.js.map +1 -0
  499. package/lib/packlets/resources/resource.d.ts.map +1 -0
  500. package/lib/packlets/resources/resource.js.map +1 -0
  501. package/lib/packlets/resources/resourceBuilder.d.ts +2 -2
  502. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -0
  503. package/lib/packlets/resources/resourceBuilder.js +2 -2
  504. package/lib/packlets/resources/resourceBuilder.js.map +1 -0
  505. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -0
  506. package/lib/packlets/resources/resourceCandidate.js.map +1 -0
  507. package/lib/packlets/resources/resourceManagerBuilder.d.ts +5 -5
  508. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  509. package/lib/packlets/resources/resourceManagerBuilder.js +5 -5
  510. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  511. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  512. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  513. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  514. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  515. package/lib/packlets/runtime/compiledResourceCollection.d.ts +5 -5
  516. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  517. package/lib/packlets/runtime/compiledResourceCollection.js +5 -5
  518. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  519. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  520. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  521. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  522. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  523. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  524. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  525. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  526. package/lib/packlets/runtime/context/index.js.map +1 -0
  527. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  528. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  529. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  530. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  531. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  532. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  533. package/lib/packlets/runtime/index.d.ts.map +1 -0
  534. package/lib/packlets/runtime/index.js.map +1 -0
  535. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  536. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  537. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  538. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  539. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  540. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  541. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  542. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  543. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  544. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  545. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  546. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  547. package/lib/packlets/runtime/resourceTreeResolver.d.ts.map +1 -0
  548. package/lib/packlets/runtime/resourceTreeResolver.js.map +1 -0
  549. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  550. package/lib/packlets/runtime/validate.js.map +1 -0
  551. package/lib/packlets/zip-archive/convert.d.ts.map +1 -0
  552. package/lib/packlets/zip-archive/convert.js.map +1 -0
  553. package/lib/packlets/zip-archive/index.browser.d.ts.map +1 -0
  554. package/lib/packlets/zip-archive/index.browser.js.map +1 -0
  555. package/lib/packlets/zip-archive/index.d.ts.map +1 -0
  556. package/lib/packlets/zip-archive/index.js.map +1 -0
  557. package/lib/packlets/zip-archive/json.d.ts.map +1 -0
  558. package/lib/packlets/zip-archive/json.js.map +1 -0
  559. package/lib/packlets/zip-archive/types.d.ts.map +1 -0
  560. package/lib/packlets/zip-archive/types.js.map +1 -0
  561. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts.map +1 -0
  562. package/lib/packlets/zip-archive/zipArchiveCreator.js.map +1 -0
  563. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts.map +1 -0
  564. package/lib/packlets/zip-archive/zipArchiveFormat.js.map +1 -0
  565. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts.map +1 -0
  566. package/lib/packlets/zip-archive/zipArchiveLoader.js.map +1 -0
  567. package/package.json +28 -26
  568. package/dist/test/data/sample.json +0 -32
  569. package/dist/test/unit/qualifier-types/testQualifierType.js +0 -76
  570. package/dist/test/unit/resource-types/testDerivedResourceType.js +0 -109
  571. package/dist/test/unit/resources/deltaGenerator.helpers.js +0 -282
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
57
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
58
+ };
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.Convert = void 0;
61
+ const Convert = __importStar(require("./convert"));
62
+ exports.Convert = Convert;
63
+ __exportStar(require("./json"), exports);
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/resource-types/config/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAI5B,0BAAO;AAFhB,yCAAuB","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 './json';\n\nexport { Convert };\n"]}
@@ -0,0 +1,11 @@
1
+ import { JsonObject } from '@fgv/ts-json-base';
2
+ /**
3
+ * Configuration for a {@link ResourceTypes.ResourceType | resource type}.
4
+ * @public
5
+ */
6
+ export interface IResourceTypeConfig<T extends JsonObject = JsonObject> {
7
+ name: string;
8
+ typeName: string;
9
+ template?: T;
10
+ }
11
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../src/packlets/resource-types/config/json.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC;CACd"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../src/packlets/resource-types/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 { JsonObject } from '@fgv/ts-json-base';\n\n/**\n * Configuration for a {@link ResourceTypes.ResourceType | resource type}.\n * @public\n */\nexport interface IResourceTypeConfig<T extends JsonObject = JsonObject> {\n name: string;\n typeName: string;\n template?: T;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/helpers.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAQ,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAAC,YAAY,CAAC,CAQ9F"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAgBH,oEAQC;AAtBD,4CAA6C;AAG7C,yDAAsD;AACtD,sCAAwD;AAExD;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAAC,MAA2B;IACtE,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,gBAAgB,CAAC,gBAAgB;aACrC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;aACpB,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,mCAAgB,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,kFAAkF;IAClF,OAAO,IAAA,eAAI,EAAC,GAAG,MAAM,CAAC,QAAQ,0BAA0B,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { fail, Result } from '@fgv/ts-utils';\nimport { IResourceTypeConfig } from './config';\nimport { ResourceType } from './resourceType';\nimport { JsonResourceType } from './jsonResourceType';\nimport { Convert as CommonConverters } from '../common';\n\n/**\n * Creates a {@link ResourceTypes.ResourceType | ResourceType} from a configuration object.\n * @param config - The {@link ResourceTypes.Config.IResourceTypeConfig | configuration object}\n * containing the name and type name of the resource type.\n * @returns `Success` with the new {@link ResourceTypes.ResourceType | ResourceType}\n * if successful, `Failure` with an error message otherwise.\n * @public\n */\nexport function createResourceTypeFromConfig(config: IResourceTypeConfig): Result<ResourceType> {\n if (config.typeName === 'json') {\n return CommonConverters.resourceTypeName\n .convert(config.name)\n .onSuccess((key) => JsonResourceType.create({ key }));\n }\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n return fail(`${config.typeName}: Unknown resource type.`);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAmC;AAO1B,wBAAM;AALf,iDAA+B;AAC/B,0DAAwC;AACxC,qDAAmC;AACnC,4CAA0B","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Config from './config';\n\nexport * from './resourceType';\nexport * from './resourceTypeCollector';\nexport * from './jsonResourceType';\nexport * from './helpers';\n\nexport { Config };\n"]}
@@ -29,7 +29,7 @@ export interface IJsonResourceTypeCreateParams {
29
29
  */
30
30
  export declare class JsonResourceType extends ResourceType<JsonObject> {
31
31
  /**
32
- * {@inheritdoc ResourceTypes.ResourceType.systemTypeName}
32
+ * {@inheritDoc ResourceTypes.ResourceType.systemTypeName}
33
33
  */
34
34
  readonly systemTypeName: ResourceTypeName;
35
35
  /**
@@ -47,19 +47,31 @@ export declare class JsonResourceType extends ResourceType<JsonObject> {
47
47
  */
48
48
  static create(params?: IJsonResourceTypeCreateParams): Result<JsonResourceType>;
49
49
  /**
50
- * {@inheritdoc ResourceTypes.ResourceType.validateDeclaration}
50
+ * {@inheritDoc ResourceTypes.ResourceType.validateDeclaration}
51
51
  */
52
52
  validateDeclaration(props: IResourceCandidateValidationProperties): Result<JsonObject>;
53
53
  /**
54
- * {@inheritdoc ResourceTypes.ResourceType.(validate:1)}
54
+ * Validates a JSON value for use as a resource instance value.
55
+ * @param json - The JSON value to validate.
56
+ * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
57
+ * @returns `Success` with the strongly-typed resource value if the JSON is valid,
58
+ * `Failure` with an error message otherwise.
55
59
  */
56
60
  validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;
57
61
  /**
58
- * {@inheritdoc ResourceTypes.ResourceType.(validate:2)}
62
+ * Validates a JSON value for use as a complete resource instance value.
63
+ * @param json - The JSON value to validate.
64
+ * @param completeness - Must be `'full'` to indicate a complete value.
65
+ * @returns `Success` with the strongly-typed resource value if the JSON is valid,
66
+ * `Failure` with an error message otherwise.
59
67
  */
60
68
  validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;
61
69
  /**
62
- * {@inheritdoc ResourceTypes.ResourceType.(validate:3)}
70
+ * Validates a JSON value for use as a partial resource instance value.
71
+ * @param json - The JSON value to validate.
72
+ * @param completeness - Must be `'partial'` to indicate a partial value.
73
+ * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,
74
+ * `Failure` with an error message otherwise.
63
75
  */
64
76
  validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;
65
77
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonResourceType.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/js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class JsonResourceType extends resourceType_1.ResourceType {
40
40
  constructor(key, index, template) {
41
41
  super(key, index, template);
42
42
  /**
43
- * {@inheritdoc ResourceTypes.ResourceType.systemTypeName}
43
+ * {@inheritDoc ResourceTypes.ResourceType.systemTypeName}
44
44
  */
45
45
  this.systemTypeName = common_1.Convert.resourceTypeName.convert('json').orThrow();
46
46
  }
@@ -57,7 +57,7 @@ class JsonResourceType extends resourceType_1.ResourceType {
57
57
  });
58
58
  }
59
59
  /**
60
- * {@inheritdoc ResourceTypes.ResourceType.validateDeclaration}
60
+ * {@inheritDoc ResourceTypes.ResourceType.validateDeclaration}
61
61
  */
62
62
  validateDeclaration(props) {
63
63
  return ts_json_base_1.Converters.jsonObject.convert(props.json);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonResourceType.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/jsonResourceType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,oDAA6E;AAC7E,iDAAsF;AACtF,sCAA6E;AAC7E,4CAAsD;AA0BtD;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,2BAAwB;IAM5D;;;;;OAKG;IACH,YAAsB,GAAqB,EAAE,KAAc,EAAE,QAAqB;QAChF,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAZ9B;;WAEG;QACa,mBAAc,GAAqB,gBAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;IAUtG,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,MAAsC;;QACzD,OAAO,gBAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;YAC/E,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,GAAG,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IAEI,mBAAmB,CAAC,KAA6C;QACtE,OAAO,yBAAc,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IA0BM,QAAQ,CAAC,IAAgB,EAAE,cAAsC;QACtE,OAAO,yBAAc,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;CACF;AA/DD,4CA+DC","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 as JsonConverters, JsonObject } from '@fgv/ts-json-base';\nimport { IResourceCandidateValidationProperties, ResourceType } from './resourceType';\nimport { CandidateCompleteness, Convert, ResourceTypeName } from '../common';\nimport { captureResult, Result } from '@fgv/ts-utils';\n\n/**\n * Parameters to create a {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @public\n */\nexport interface IJsonResourceTypeCreateParams {\n /**\n * Optional key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * Defaults to 'json'.\n */\n key?: string;\n\n /**\n * Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType}\n * instance.\n */\n index?: number;\n\n /**\n * Optional template for new instances of {@link ResourceTypes.JsonResourceType | JsonResourceType}\n * resources.\n */\n template?: JsonObject;\n}\n\n/**\n * Implementation of a {@link ResourceTypes.ResourceType | ResourceType} for JSON values.\n * @public\n */\nexport class JsonResourceType extends ResourceType<JsonObject> {\n /**\n * {@inheritDoc ResourceTypes.ResourceType.systemTypeName}\n */\n public readonly systemTypeName: ResourceTypeName = Convert.resourceTypeName.convert('json').orThrow();\n\n /**\n * Protected {@link ResourceTypes.JsonResourceType | JsonResourceType} constructor for use by subclasses.\n * Use {@link ResourceTypes.JsonResourceType.create | JsonResourceType.create} to create a new instance.\n * @param key - The key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @param index - Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n */\n protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject) {\n super(key, index, template);\n }\n\n /**\n * Factory method to create a new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @param params - {@link ResourceTypes.IJsonResourceTypeCreateParams | Parameters} to create the new instance.\n * @returns `Success` with the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance if successful\n * or `Failure` with an error message if not.\n */\n public static create(params?: IJsonResourceTypeCreateParams): Result<JsonResourceType> {\n return Convert.resourceTypeName.convert(params?.key ?? 'json').onSuccess((key) => {\n return captureResult(() => new JsonResourceType(key, params?.index, params?.template));\n });\n }\n\n /**\n * {@inheritDoc ResourceTypes.ResourceType.validateDeclaration}\n */\n\n public validateDeclaration(props: IResourceCandidateValidationProperties): Result<JsonObject> {\n return JsonConverters.jsonObject.convert(props.json);\n }\n\n /**\n * Validates a JSON value for use as a resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n */\n public validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;\n /**\n * Validates a JSON value for use as a complete resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Must be `'full'` to indicate a complete value.\n * @returns `Success` with the strongly-typed resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n */\n public validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;\n /**\n * Validates a JSON value for use as a partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Must be `'partial'` to indicate a partial value.\n * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n */\n public validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;\n public validate(json: JsonObject, __completeness?: CandidateCompleteness): Result<JsonObject> {\n return JsonConverters.jsonObject.convert(json);\n }\n}\n"]}
@@ -8,7 +8,7 @@ import * as ResourceJson from '../resource-json';
8
8
  */
9
9
  export interface IResourceCandidateValidationProperties {
10
10
  /**
11
- * {@inheritdoc ResourceJson.Json.ILooseResourceCandidateDecl.id}
11
+ * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.id}
12
12
  * @public
13
13
  */
14
14
  id: ResourceId;
@@ -18,12 +18,12 @@ export interface IResourceCandidateValidationProperties {
18
18
  */
19
19
  completeness: CandidateCompleteness;
20
20
  /**
21
- * {@inheritdoc ResourceJson.Json.ILooseResourceCandidateDecl.json}
21
+ * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.json}
22
22
  * @public
23
23
  */
24
24
  json: JsonValue;
25
25
  /**
26
- * {@inheritdoc ResourceJson.Json.ILooseResourceCandidateDecl.mergeMethod}
26
+ * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.mergeMethod}
27
27
  * @public
28
28
  */
29
29
  mergeMethod: ResourceValueMergeMethod;
@@ -105,7 +105,7 @@ export declare abstract class ResourceType<T = unknown> implements IResourceType
105
105
  private _collectible;
106
106
  private _template;
107
107
  /**
108
- * {@inheritdoc ResourceTypes.IResourceType.key}
108
+ * {@inheritDoc ResourceTypes.IResourceType.key}
109
109
  */
110
110
  get key(): ResourceTypeName;
111
111
  /**
@@ -113,7 +113,7 @@ export declare abstract class ResourceType<T = unknown> implements IResourceType
113
113
  */
114
114
  abstract readonly systemTypeName: ResourceTypeName;
115
115
  /**
116
- * {@inheritdoc ResourceTypes.IResourceType.index}
116
+ * {@inheritDoc ResourceTypes.IResourceType.index}
117
117
  */
118
118
  get index(): ResourceTypeIndex | undefined;
119
119
  protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceType.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/resourceType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAgB,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAqB,YAAY,EAAE,MAAM,EAAW,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,qBAAqB,EAGrB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD;;;OAGG;IACH,EAAE,EAAE,UAAU,CAAC;IAEf;;;OAGG;IACH,YAAY,EAAE,qBAAqB,CAAC;IAEpC;;;OAGG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,WAAW,EAAE,wBAAwB,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OA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I,CAAC,EAAE,SAAS,EAChB,UAAU,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAC/C,UAAU,CAAC,EAAE,iBAAiB,GAC7B,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC;CAmBzD"}
@@ -33,13 +33,13 @@ const common_1 = require("../common");
33
33
  */
34
34
  class ResourceType {
35
35
  /**
36
- * {@inheritdoc ResourceTypes.IResourceType.key}
36
+ * {@inheritDoc ResourceTypes.IResourceType.key}
37
37
  */
38
38
  get key() {
39
39
  return this._collectible.key;
40
40
  }
41
41
  /**
42
- * {@inheritdoc ResourceTypes.IResourceType.index}
42
+ * {@inheritDoc ResourceTypes.IResourceType.index}
43
43
  */
44
44
  get index() {
45
45
  return this._collectible.index;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceType.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/resourceType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,oDAAwE;AACxE,4CAAiF;AACjF,sCASmB;AAiHnB;;;;;GAKG;AACH,MAAsB,YAAY;IAGhC;;OAEG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/B,CAAC;IAOD;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACjC,CAAC;IAED,YAAsB,GAAqB,EAAE,KAAc,EAAE,QAAqB;QAChF,IAAI,CAAC,YAAY,GAAG,IAAI,sBAAW,CAAC,WAAW,CAAsC;YACnF,GAAG;YACH,qDAAqD;YACrD,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAQ,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;YACtF,cAAc,EAAE,gBAAa,CAAC,iBAAiB;SAChD,CAAC,CAAC;QACH,yCAAyC;QACzC,IAA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AE,CACd,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,kBAAO,kCAAM,SAAS,KAAE,SAAS,EAAE,IAAI,IAAG,CAAC,CAC/F,CAAC;IACN,CAAC;CACF;AAjJD,oCAiJC","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 { isJsonObject, JsonObject, JsonValue } from '@fgv/ts-json-base';\nimport { Collections, fail, ICollectible, Result, succeed } from '@fgv/ts-utils';\nimport {\n CandidateCompleteness,\n Convert as CommonConvert,\n Validate,\n ResourceTypeIndex,\n ResourceTypeName,\n ResourceValueMergeMethod,\n ResourceId,\n IResourceResolver\n} from '../common';\nimport * as ResourceJson from '../resource-json';\n\n/**\n * Parameters used to validate a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}.\n * @public\n */\nexport interface IResourceCandidateValidationProperties {\n /**\n * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.id}\n * @public\n */\n id: ResourceId;\n\n /**\n * Describes how complete the candidate value is.\n * @public\n */\n completeness: CandidateCompleteness;\n\n /**\n * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.json}\n * @public\n */\n json: JsonValue;\n\n /**\n * {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.mergeMethod}\n * @public\n */\n mergeMethod: ResourceValueMergeMethod;\n}\n\n/**\n * Interface for a resource type. Resource types are responsible for\n * validating and converting JSON values into the appropriate strongly-typed\n * resource value.\n * @public\n */\nexport interface IResourceType<T = unknown> extends ICollectible<ResourceTypeName, ResourceTypeIndex> {\n /**\n * The key for this resource type.\n */\n readonly key: ResourceTypeName;\n\n /**\n * The index for this resource type.\n */\n readonly index: ResourceTypeIndex | undefined;\n\n /**\n * Validates properties of a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration} for\n * a resource instance value.\n * @param props - The {@link ResourceTypes.IResourceCandidateValidationProperties | properties } to validate.\n * @returns `Success` with the strongly-typed resource value if the JSON and merge method\n * are valid, `Failure` with an error message otherwise.\n * @public\n */\n validateDeclaration(props: IResourceCandidateValidationProperties): Result<T | Partial<T>>;\n\n /**\n * Validates a JSON value for use as a partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n validate(json: JsonValue, completeness: CandidateCompleteness): Result<Partial<T>>;\n\n /**\n * Validates a JSON value for use as a complete resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n validate(json: JsonValue, completeness: 'full'): Result<T>;\n\n /**\n * Validates a JSON value for use as a partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n validate(json: JsonValue, completeness: 'partial'): Result<Partial<T>>;\n\n /**\n * Sets the index for this resource type. Once set, the index cannot be changed.\n */\n setIndex(index: number): Result<ResourceTypeIndex>;\n\n /**\n * Creates a template for a new resource of this type.\n * The template provides a default structure for creating new resource instances.\n * @param resourceId - The id for the new resource.\n * @param init - An optional initial value for the resource.\n * @param resolver - An optional resource resolver that can be used to create the template.\n * @param conditions - An optional set of conditions that must be met for the resource to be selected.\n * @returns A loose resource declaration with default values for this resource type.\n * @public\n */\n createTemplate(\n resourceId: ResourceId,\n init?: JsonValue,\n conditions?: ResourceJson.Json.ConditionSetDecl,\n resolver?: IResourceResolver\n ): Result<ResourceJson.Json.ILooseResourceDecl>;\n}\n\n/**\n * Abstract base class for resource types which are responsible for\n * validating and converting JSON values into the appropriate strongly-typed\n * resource value.\n * @public\n */\nexport abstract class ResourceType<T = unknown> implements IResourceType<T> {\n private _collectible: Collections.Collectible<ResourceTypeName, ResourceTypeIndex>;\n private _template: JsonObject;\n /**\n * {@inheritDoc ResourceTypes.IResourceType.key}\n */\n public get key(): ResourceTypeName {\n return this._collectible.key;\n }\n\n /**\n * Name of the underlying system type.\n */\n public abstract readonly systemTypeName: ResourceTypeName;\n\n /**\n * {@inheritDoc ResourceTypes.IResourceType.index}\n */\n public get index(): ResourceTypeIndex | undefined {\n return this._collectible.index;\n }\n\n protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject) {\n this._collectible = new Collections.Collectible<ResourceTypeName, ResourceTypeIndex>({\n key,\n /* c8 ignore next 1 - coverage having a rough time */\n index: index !== undefined ? Validate.toResourceTypeIndex(index).orThrow() : undefined,\n indexConverter: CommonConvert.resourceTypeIndex\n });\n /* c8 ignore next 1 - defense in depth */\n this._template = template ?? {};\n }\n\n /**\n * Validates properties of a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration} for\n * a resource instance value.\n * @param props - The {@link ResourceTypes.IResourceCandidateValidationProperties | properties } to validate.\n * @returns `Success` with the strongly-typed resource value if the JSON and merge method\n * are valid, `Failure` with an error message otherwise.\n * @public\n */\n public abstract validateDeclaration(props: IResourceCandidateValidationProperties): Result<T | Partial<T>>;\n\n /**\n * Validates a JSON value for use as a partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n public abstract validate(json: JsonValue, completeness: CandidateCompleteness): Result<Partial<T>>;\n\n /**\n * Validates a JSON value for use as a complete resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n public abstract validate(json: JsonValue, completeness: 'full'): Result<T>;\n\n /**\n * Validates a JSON value for use as a partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,\n * `Failure` with an error message otherwise.\n * @public\n */\n public abstract validate(json: JsonValue, completeness: 'partial'): Result<Partial<T>>;\n\n /**\n * Validates a JSON value for use as a full or partial resource instance value.\n * @param json - The JSON value to validate.\n * @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.\n * @returns `Success` with the strongly-typed full or partial resource value if\n * the JSON is valid, `Failure` with an error message otherwise.\n * @public\n */\n public abstract validate(json: JsonValue, completeness?: CandidateCompleteness): Result<T | Partial<T>>;\n\n /**\n * Sets the index for this resource type. Once set, the index cannot be changed.\n */\n public setIndex(index: number): Result<ResourceTypeIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Creates a template for a new resource of this type.\n * Default implementation provides a basic template.\n * Subclasses can override to provide type-specific templates.\n * @param resourceId - The id for the new resource\n * @param init - An optional initial value for the resource.\n * @param conditions - An optional set of conditions that must be met for the resource to be selected.\n * @param resolver - An optional resource resolver that can be used to create the template.\n * @returns A loose resource declaration with default values for this resource type\n * @public\n */\n public createTemplate(\n resourceId: ResourceId,\n init?: JsonValue,\n conditions?: ResourceJson.Json.ConditionSetDecl,\n resolver?: IResourceResolver\n ): Result<ResourceJson.Json.ILooseResourceDecl> {\n return this.getDefaultTemplateCandidate(init, conditions, resolver).onSuccess((candidate) =>\n succeed({\n id: resourceId,\n resourceTypeName: this.key,\n candidates: [candidate]\n })\n );\n }\n\n /**\n * Gets the default template value for this resource type.\n * Subclasses should override this to provide type-specific default values.\n * @returns The default JSON value for a new resource of this type\n * @public\n */\n public getDefaultTemplateCandidate(\n json?: JsonValue,\n conditions?: ResourceJson.Json.ConditionSetDecl,\n __resolver?: IResourceResolver\n ): Result<ResourceJson.Json.IChildResourceCandidateDecl> {\n json = json ?? this._template;\n\n if (!isJsonObject(json)) {\n return fail(`${this.key}: Invalid initial value \"${json}\" must be JSON object.`);\n }\n\n const candidate: ResourceJson.Json.IChildResourceCandidateDecl = {\n json,\n ...(conditions ? { conditions } : {}),\n mergeMethod: 'replace'\n };\n\n return this.validate(json, 'full')\n .onSuccess((json) => succeed({ ...candidate, isPartial: false }))\n .onFailure(() =>\n this.validate(json, 'partial').onSuccess((json) => succeed({ ...candidate, isPartial: true }))\n );\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceTypeCollector.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/resourceTypeCollector.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAiB,mBAAmB,EAAiB,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IAC1E,SAAS,aAAa,EAAE,aAAa,EAAE,EAAE,8BAA8B;IAevE;;;;;OAKG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,8BAA8B,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAM5F,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;CAM/D;AAED;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,WAAW,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceTypeCollector.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/resourceTypeCollector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAuG;AACvG,iDAA8C;AAC9C,sCAAuE;AAUvE;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,8BAAiC;IAC1E,YAAsB,EAAE,aAAa,EAAkC;QACrE,oDAAoD;QACpD,aAAa,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC;QAEpC,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,sBAAW,CAAC,kBAAkB,CAAiC;gBAC7E,GAAG,EAAE,gBAAa,CAAC,gBAAgB;gBACnC,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;aACrD,CAAC;SACH,CAAC,CAAC;QACH,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YACrC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,MAAuC;QAC1D,oDAAoD;QACpD,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;QACtB,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,eAAe,CAAC,IAAa;QACrC,IAAI,IAAI,YAAY,2BAAY,EAAE,CAAC;YACjC,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,IAAA,eAAI,EAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;CACF;AAlCD,sDAkCC","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 { Collections, Result, fail, succeed, ValidatingCollector, captureResult } from '@fgv/ts-utils';\nimport { ResourceType } from './resourceType';\nimport { Convert as CommonConvert, ResourceTypeName } from '../common';\n\n/**\n * Parameters for creating a {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.\n * @public\n */\nexport interface IResourceCollectorCreateParams {\n resourceTypes?: ResourceType[];\n}\n\n/**\n * Map {@link ResourceTypeName | resource type names} to {@link ResourceTypes.ResourceType | resource types}.\n * @public\n */\nexport class ResourceTypeCollector extends ValidatingCollector<ResourceType> {\n protected constructor({ resourceTypes }: IResourceCollectorCreateParams) {\n /* c8 ignore next 1 - coverage having a rough day */\n resourceTypes = resourceTypes ?? [];\n\n super({\n converters: new Collections.KeyValueConverters<ResourceTypeName, ResourceType>({\n key: CommonConvert.resourceTypeName,\n value: (from: unknown) => this._toResourceType(from)\n })\n });\n resourceTypes.forEach((resourceType) => {\n this.add(resourceType).orThrow();\n });\n }\n\n /**\n * Creates a new {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.\n * @param params - Optional for creating the new collector.\n * @returns `Success` with the new instance, or `Failure` with an error\n * message if the collector could not be created.\n */\n public static create(params?: IResourceCollectorCreateParams): Result<ResourceTypeCollector> {\n /* c8 ignore next 1 - coverage having a rough day */\n params = params ?? {};\n return captureResult(() => new ResourceTypeCollector(params));\n }\n\n protected _toResourceType(from: unknown): Result<ResourceType> {\n if (from instanceof ResourceType) {\n return succeed(from);\n }\n return fail('Not a resource type.');\n }\n}\n\n/**\n * A read-only version of {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.\n * @public\n */\nexport type ReadOnlyResourceTypeCollector = Collections.IReadOnlyValidatingCollector<ResourceType>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidateReducer.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/candidateReducer.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,UAAU,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAA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) 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 { QualifierName, ResourceId, ResourceValueMergeMethod } from '../common';\nimport * as Context from '../context';\nimport * as ResourceJson from '../resource-json';\nimport { ResourceCandidate } from './resourceCandidate';\nimport { JsonObject } from '@fgv/ts-json-base';\nimport { JsonEditor } from '@fgv/ts-json';\nimport { Result, succeed, fail, mapResults } from '@fgv/ts-utils';\n\n/**\n * Action taken on a candidate during reduction processing.\n * @public\n */\nexport type CandidateAction = 'unchanged' | 'reduced' | 'suppressed';\n\n/**\n * Information about a candidate being processed by the reducer.\n * @public\n */\nexport interface ICandidateInfo {\n readonly originalCandidate: ResourceCandidate;\n action: CandidateAction;\n conditions: ResourceJson.Json.ILooseConditionDecl[];\n conditionSetKey: string;\n readonly json?: JsonObject;\n}\n\n/**\n * Represents a reduced candidate after applying reduction logic.\n * @public\n */\nexport interface IReducedCandidate {\n readonly candidate: ResourceCandidate;\n readonly conditions: ResourceJson.Json.ConditionSetDecl;\n readonly json?: JsonObject;\n readonly isPartial?: boolean;\n readonly mergeMethod?: ResourceValueMergeMethod;\n}\n\n/**\n * Manages candidate reduction logic for filtering and qualifier reduction operations.\n * Encapsulates the state and logic needed to consistently process candidates for reduction.\n * @public\n */\nexport class CandidateReducer {\n private readonly _candidateInfos: ICandidateInfo[];\n private readonly _filterForContext: Context.IValidatedContextDecl;\n private readonly _qualifiersToReduce: ReadonlySet<QualifierName>;\n\n /**\n * Constructor for CandidateReducer.\n * @param candidates - The set of candidates to potentially reduce\n * @param filterForContext - Context to filter candidates against\n */\n public constructor(\n candidates: ReadonlyArray<ResourceCandidate>,\n filterForContext: Context.IValidatedContextDecl\n ) {\n this._filterForContext = filterForContext;\n\n // Use existing logic to determine reducible qualifiers\n this._qualifiersToReduce =\n ResourceCandidate.findReducibleQualifiers(candidates, filterForContext) ?? new Set();\n\n // Initialize candidate info array with initial reduction attempts\n this._candidateInfos = candidates.map((candidate): ICandidateInfo => {\n const filteredConditions = candidate.conditions.conditions.filter(\n (c) => !this._qualifiersToReduce.has(c.qualifier.name)\n );\n\n const reducedConditions = filteredConditions.map((c) => c.toLooseConditionDecl());\n const conditionSetKey = CandidateReducer._computeConditionSetKey(reducedConditions);\n\n const action: CandidateAction =\n filteredConditions.length < candidate.conditions.conditions.length ? 'reduced' : 'unchanged';\n\n return {\n originalCandidate: candidate,\n action,\n conditions: reducedConditions,\n conditionSetKey,\n json: undefined // Will be set later when needed\n };\n });\n\n // Resolve collisions by reverting reduced candidates to unchanged when they collide\n this._resolveCollisions();\n }\n\n /**\n * Computes a string key for a set of condition declarations for collision detection.\n * @param conditions - The conditions to compute a key for\n * @returns A string key representing the condition set\n */\n private static _computeConditionSetKey(conditions: ResourceJson.Json.ILooseConditionDecl[]): string {\n if (conditions.length === 0) {\n return '{}';\n }\n\n // Sort conditions by qualifier name for consistent keys\n const sortedConditions = [...conditions].sort((a, b) => a.qualifierName.localeCompare(b.qualifierName));\n const pairs = sortedConditions.map((c) => `${c.qualifierName}:${c.value}`);\n return `{${pairs.join(',')}}`;\n }\n\n /**\n * Merges a partial candidate's JSON value into a base candidate's JSON value.\n * @param baseJson - The base JSON value to merge into\n * @param partialJson - The partial JSON value to merge from\n * @returns The merged JSON value\n * @internal\n */\n private static _mergeJsonValues(baseJson: JsonObject, partialJson: JsonObject): JsonObject {\n // Create JsonEditor with array replacement behavior for candidate merging\n const editor = JsonEditor.create({\n merge: {\n arrayMergeBehavior: 'replace'\n }\n }).orThrow(); // Should never fail with valid options\n\n return editor.mergeObjectsInPlace({}, [baseJson, partialJson]).orThrow(); // Internal method should throw on error - this indicates a serious bug\n }\n\n /**\n * Resolves collisions using smart collision resolution rules.\n * - If a reduced candidate collides with an unchanged candidate and only one reduced candidate collides:\n * - If reduced candidate is complete: suppress unchanged, keep reduced\n * - If reduced candidate is partial: merge into unchanged, suppress reduced\n * - Otherwise: revert reduced candidates to unchanged to avoid collisions\n * @internal\n */\n private _resolveCollisions(): void {\n let hasCollisions = true;\n let iterationCount = 0;\n const maxIterations = this._candidateInfos.length; // Safety limit\n\n while (hasCollisions && iterationCount < maxIterations) {\n hasCollisions = false;\n iterationCount++;\n\n // Group candidates by their condition set keys (excluding suppressed)\n const conditionKeyGroups = new Map<string, ICandidateInfo[]>();\n\n for (const candidateInfo of this._candidateInfos) {\n if (candidateInfo.action !== 'suppressed') {\n // Don't include suppressed candidates\n const key = candidateInfo.conditionSetKey;\n if (!conditionKeyGroups.has(key)) {\n conditionKeyGroups.set(key, []);\n }\n conditionKeyGroups.get(key)!.push(candidateInfo);\n }\n }\n\n // Apply smart collision resolution\n for (const [, candidatesWithSameKey] of conditionKeyGroups) {\n if (candidatesWithSameKey.length > 1) {\n // Categorize candidates\n const unchangedCandidates = candidatesWithSameKey.filter((c) => c.action === 'unchanged');\n const reducedCandidates = candidatesWithSameKey.filter((c) => c.action === 'reduced');\n\n if (unchangedCandidates.length === 1 && reducedCandidates.length === 1) {\n // Simple case: one unchanged vs one reduced - apply smart resolution\n const unchangedCandidate = unchangedCandidates[0];\n const reducedCandidate = reducedCandidates[0];\n\n if (!reducedCandidate.originalCandidate.isPartial) {\n // Complete reduced candidate wins - suppress unchanged\n unchangedCandidate.action = 'suppressed';\n hasCollisions = true;\n } else {\n /* c8 ignore next 12 - complex collision handling for partial candidates rarely triggered */\n // Partial reduced candidate - merge into unchanged and suppress reduced\n const mergedJson = CandidateReducer._mergeJsonValues(\n unchangedCandidate.originalCandidate.json,\n reducedCandidate.originalCandidate.json\n );\n\n // Update unchanged candidate with merged JSON, keeping its isPartial status\n (unchangedCandidate as { json?: JsonObject }).json = mergedJson;\n\n // Suppress the reduced candidate\n reducedCandidate.action = 'suppressed';\n hasCollisions = true;\n }\n } else {\n /* c8 ignore next 15 - complex collision reversion logic rarely triggered in practice */\n // Complex collision case - revert all reduced candidates to unchanged\n for (const candidateInfo of reducedCandidates) {\n // Revert to original conditions and mark as unchanged\n const originalConditions = candidateInfo.originalCandidate.conditions.conditions.map((c) =>\n c.toLooseConditionDecl()\n );\n const originalKey = CandidateReducer._computeConditionSetKey(originalConditions);\n\n // Update the candidate info to revert to original state\n candidateInfo.action = 'unchanged';\n candidateInfo.conditions = originalConditions;\n candidateInfo.conditionSetKey = originalKey;\n\n hasCollisions = true;\n }\n }\n }\n }\n }\n }\n\n /**\n * Static convenience method to construct an array of properly reduced\n * {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declarations}\n * from a set of {@link Resources.ResourceCandidate | resource candidates}.\n * @param candidates - The candidates to reduce\n * @param filterForContext - Optional context to filter against\n * @returns Result with array of reduced candidate declarations, or Failure if reduction fails\n */\n public static reduceToChildResourceCandidateDecls(\n candidates: ReadonlyArray<ResourceCandidate>,\n filterForContext?: Context.IValidatedContextDecl\n ): Result<ResourceJson.Json.IChildResourceCandidateDecl[]> {\n if (!filterForContext || Object.keys(filterForContext).length === 0) {\n return succeed(candidates.map((candidate) => candidate.toChildResourceCandidateDecl()));\n }\n\n const reducer = new CandidateReducer(candidates, filterForContext);\n const reductionResults = mapResults(candidates.map((candidate) => reducer.reduceCandidate(candidate)));\n\n return reductionResults.onSuccess((reductions) => {\n const validReductions = reductions.filter(\n (reduction): reduction is IReducedCandidate => reduction !== undefined\n );\n\n return succeed(\n validReductions.map((reduction) => ({\n /* c8 ignore next 3 -- defense in depth */\n json: reduction.json ?? reduction.candidate.json,\n isPartial: reduction.isPartial ?? reduction.candidate.isPartial,\n mergeMethod: reduction.mergeMethod ?? reduction.candidate.mergeMethod,\n conditions: reduction.conditions\n }))\n );\n });\n }\n\n /**\n * Static convenience method to construct an array of properly reduced\n * {@link ResourceJson.Json.ILooseResourceCandidateDecl | loose resource candidate declarations}\n * from a set of {@link Resources.ResourceCandidate | resource candidates}.\n * @param id - The id of the resource\n * @param candidates - The candidates to reduce\n * @param filterForContext - Optional context to filter against\n * @returns Result with array of reduced candidate declarations, or Failure if reduction fails\n */\n public static reduceToLooseResourceCandidateDecls(\n id: ResourceId,\n candidates: ReadonlyArray<ResourceCandidate>,\n filterForContext?: Context.IValidatedContextDecl\n ): Result<ResourceJson.Json.ILooseResourceCandidateDecl[]> {\n if (!filterForContext || Object.keys(filterForContext).length === 0) {\n return succeed(candidates.map((candidate) => candidate.toLooseResourceCandidateDecl()));\n }\n\n const reducer = new CandidateReducer(candidates, filterForContext);\n const reductionResults = mapResults(candidates.map((candidate) => reducer.reduceCandidate(candidate)));\n\n return reductionResults.onSuccess((reductions) => {\n const validReductions = reductions.filter(\n (reduction): reduction is IReducedCandidate => reduction !== undefined\n );\n\n return succeed(\n validReductions.map((reduction) => ({\n id,\n /* c8 ignore next 3 -- defense in depth */\n json: reduction.json ?? reduction.candidate.json,\n isPartial: reduction.isPartial ?? reduction.candidate.isPartial,\n mergeMethod: reduction.mergeMethod ?? reduction.candidate.mergeMethod,\n conditions: reduction.conditions\n }))\n );\n });\n }\n\n /**\n * Reduces a single candidate according to the configured reduction rules.\n * @param candidate - The candidate to reduce\n * @returns Either a reduced candidate declaration or an error if the candidate is not found\n */\n public reduceCandidate(candidate: ResourceCandidate): Result<IReducedCandidate | undefined> {\n const candidateInfo = this._candidateInfos.find((info) => info.originalCandidate === candidate);\n /* c8 ignore next 3 - defensive coding: candidate should always be found if properly managed */\n if (!candidateInfo) {\n return fail(`Candidate not found in reducer state`);\n }\n\n if (candidateInfo.action === 'suppressed') {\n return succeed(undefined);\n }\n\n // Convert array of conditions back to ConditionSetDecl for compatibility\n const conditionsAsRecord = candidateInfo.conditions.reduce((acc, condition) => {\n return { ...acc, [condition.qualifierName]: condition.value };\n }, {} as ResourceJson.Json.ConditionSetDecl);\n\n return succeed({\n candidate,\n conditions: conditionsAsRecord,\n json: candidateInfo.json ?? candidate.json,\n isPartial: candidate.isPartial,\n mergeMethod: candidate.mergeMethod\n });\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidateValue.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/candidateValue.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAA+B,MAAM,WAAW,CAAC;AAGhG;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW,CAAC,YAAY,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;IACvG;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkE;IAC/F,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAElC;;OAEG;IACH,IAAW,GAAG,IAAI,iBAAiB,CAElC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,mBAAmB,GAAG,SAAS,CAElD;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,SAAS,CAE3B;IAED;;;;OAIG;IACH,SAAS,aAAa,MAAM,EAAE,2BAA2B;IAoBzD;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,CAAC,cAAc,CAAC;IAIjF;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;CAG5D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidateValue.js","sourceRoot":"","sources":["../../../src/packlets/resources/candidateValue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,4CAAyE;AACzE,sCAAgG;AAChG,kDAAoC;AAsDpC;;;;;GAKG;AACH,MAAa,cAAc;IAIzB;;OAEG;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;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,YAAsB,MAAmC;;QACvD,yCAAyC;QACzC,MAAM,UAAU,GAAG,MAAA,MAAM,CAAC,UAAU,mCAAI,IAAI,eAAI,CAAC,eAAe,EAAE,CAAC;QAEnE,2BAA2B;QAC3B,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAExC,2DAA2D;QAC3D,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAEtF,yDAAyD;QACzD,IAAI,CAAC,YAAY,GAAG,IAAI,sBAAW,CAAC,WAAW,CAAC;YAC9C,GAAG;YACH,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB;SACnD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,MAAmC;QACtD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF;AAtED,wCAsEC","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 { Collections, Hash, Result, captureResult } from '@fgv/ts-utils';\nimport { CandidateValueIndex, CandidateValueKey, Convert as CommonConverters } from '../common';\nimport * as Common from '../common';\n\n/**\n * Interface for a candidate value that can be collected and indexed.\n * Candidate values are normalized JSON values that can be shared across\n * multiple resource candidates to reduce duplication.\n * @public\n */\nexport interface ICandidateValue extends Collections.ICollectible<CandidateValueKey, CandidateValueIndex> {\n /**\n * The unique key for this candidate value, derived from the hash of the normalized JSON.\n */\n readonly key: CandidateValueKey;\n\n /**\n * The index of this candidate value in the collection.\n */\n readonly index: CandidateValueIndex | undefined;\n\n /**\n * The normalized JSON value.\n */\n readonly json: JsonValue;\n\n /**\n * Sets the index of this candidate value.\n * @param index - The index to set.\n * @returns `Success` with the index if successful, or `Failure` with an error message if not.\n */\n setIndex(index: number): Result<CandidateValueIndex>;\n}\n\n/**\n * Parameters for creating a {@link Resources.CandidateValue | CandidateValue}.\n * @public\n */\nexport interface ICandidateValueCreateParams {\n /**\n * The JSON value to store. Will be normalized during creation.\n */\n json: JsonValue;\n\n /**\n * Optional normalizer to use for normalizing the JSON value.\n * If not provided, a default Crc32Normalizer will be used.\n */\n normalizer?: Hash.Crc32Normalizer;\n\n /**\n * Optional index if the value is already indexed.\n */\n index?: number;\n}\n\n/**\n * Implementation of a candidate value that stores normalized JSON data.\n * The value is normalized on creation and a hash-based key is generated\n * for efficient deduplication.\n * @public\n */\nexport class CandidateValue implements ICandidateValue {\n private readonly _collectible: Collections.Collectible<CandidateValueKey, CandidateValueIndex>;\n private readonly _json: JsonValue;\n\n /**\n * The unique key for this candidate value.\n */\n public get key(): CandidateValueKey {\n return this._collectible.key;\n }\n\n /**\n * The index of this candidate value in the collection.\n */\n public get index(): CandidateValueIndex | undefined {\n return this._collectible.index;\n }\n\n /**\n * The normalized JSON value.\n */\n public get json(): JsonValue {\n return this._json;\n }\n\n /**\n * Constructor for a {@link Resources.CandidateValue} object.\n * @param params - Parameters to create the candidate value.\n * @internal\n */\n protected constructor(params: ICandidateValueCreateParams) {\n /* c8 ignore next 1 - defense in depth */\n const normalizer = params.normalizer ?? new Hash.Crc32Normalizer();\n\n // Normalize the JSON value\n const normalizedResult = normalizer.normalize(params.json);\n this._json = normalizedResult.orThrow();\n\n // Generate key from the normalized value using computeHash\n const keyResult = normalizer.computeHash(this._json);\n const key = CommonConverters.candidateValueKey.convert(keyResult.orThrow()).orThrow();\n\n // Create the collectible with the key and optional index\n this._collectible = new Collections.Collectible({\n key,\n index: params.index,\n indexConverter: Common.Convert.candidateValueIndex\n });\n }\n\n /**\n * Creates a new {@link Resources.CandidateValue} object.\n * @param params - Parameters to create the candidate value.\n * @returns `Success` with the new candidate value if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params: ICandidateValueCreateParams): Result<CandidateValue> {\n return captureResult(() => new CandidateValue(params));\n }\n\n /**\n * Sets the index of this candidate value.\n * @param index - The index to set.\n * @returns `Success` with the index if successful, or `Failure` with an error message if not.\n * @public\n */\n public setIndex(index: number): Result<CandidateValueIndex> {\n return this._collectible.setIndex(index);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidateValueCollector.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/candidateValueCollector.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAgC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAe,IAAI,EAAE,MAAM,EAA0B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC;IAEpC;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,cAAc,GAAG,SAAS,CAAC,EAAE,CAAC;CAClD;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,mBAAmB,CAAC,cAAc,CAAC;IAC9E,SAAgB,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC;IAEnD;;;;OAIG;IACH,SAAS,aAAa,MAAM,CAAC,EAAE,oCAAoC;IAanE;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,oCAAoC,GAAG,MAAM,CAAC,uBAAuB,CAAC;IAIpG;;;;OAIG;IACI,gBAAgB,IAAI,SAAS,EAAE;IAMtC;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAiB1B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidateValueCollector.js","sourceRoot":"","sources":["../../../src/packlets/resources/candidateValueCollector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,oDAA4E;AAC5E,4CAAuG;AACvG,sCAAwE;AACxE,qDAAkD;AAmBlD;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,8BAAmC;IAG9E;;;;OAIG;IACH,YAAsB,MAA6C;;QACjE,KAAK,CAAC;YACJ,UAAU,EAAE,IAAI,sBAAW,CAAC,kBAAkB,CAAoC;gBAChF,GAAG,EAAE,gBAAa,CAAC,iBAAiB;gBACpC,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;aACvD,CAA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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 { JsonValue, Validators as JsonValidators } from '@fgv/ts-json-base';\nimport { Collections, Hash, Result, captureResult, succeed, ValidatingCollector } from '@fgv/ts-utils';\nimport { Convert as CommonConvert, CandidateValueKey } from '../common';\nimport { CandidateValue } from './candidateValue';\n\n/**\n * Parameters for creating a {@link Resources.CandidateValueCollector}.\n * @public\n */\nexport interface ICandidateValueCollectorCreateParams {\n /**\n * Optional normalizer to use for normalizing JSON values.\n * If not provided, a default Crc32Normalizer will be used.\n */\n normalizer?: Hash.HashingNormalizer;\n\n /**\n * Optional initial candidate values to add to the collection.\n */\n candidateValues?: (CandidateValue | JsonValue)[];\n}\n\n/**\n * A `ValidatingCollector` for {@link Resources.CandidateValue | CandidateValues},\n * which collects candidate values supplied as either {@link Resources.CandidateValue | CandidateValue} or\n * `JsonValue`.\n * @public\n */\nexport class CandidateValueCollector extends ValidatingCollector<CandidateValue> {\n public readonly normalizer: Hash.HashingNormalizer;\n\n /**\n * Constructor for a {@link Resources.CandidateValueCollector} object.\n * @param params - Parameters to create the collector.\n * @internal\n */\n protected constructor(params?: ICandidateValueCollectorCreateParams) {\n super({\n converters: new Collections.KeyValueConverters<CandidateValueKey, CandidateValue>({\n key: CommonConvert.candidateValueKey,\n value: (from: unknown) => this._toCandidateValue(from)\n })\n });\n /* c8 ignore next 3 - defense in depth */\n params = params ?? {};\n this.normalizer = params.normalizer ?? new Hash.Crc32Normalizer();\n params.candidateValues?.forEach((candidateValue) => this.validating.add(candidateValue));\n }\n\n /**\n * Creates a new {@link Resources.CandidateValueCollector} object.\n * @param params - Parameters to create the collector.\n * @returns `Success` with the new collector if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params?: ICandidateValueCollectorCreateParams): Result<CandidateValueCollector> {\n return captureResult(() => new CandidateValueCollector(params));\n }\n\n /**\n * Returns an array of JSON values ordered by their indices.\n * @returns Array of JsonValue objects in index order.\n * @public\n */\n public getValuesByIndex(): JsonValue[] {\n // Use the base class valuesByIndex() method to get CandidateValues in index order,\n // then extract their JSON values\n return this.valuesByIndex().map((candidateValue) => candidateValue.json);\n }\n\n /**\n * Converter method to handle CandidateValue | JsonValue.\n * @param from - The value to convert.\n * @returns `Success` with the CandidateValue if successful, or `Failure` with an error message if not.\n * @internal\n */\n private _toCandidateValue(from: unknown): Result<CandidateValue> {\n /* c8 ignore next 3 - functional code tested but coverage intermittently missed */\n if (from instanceof CandidateValue) {\n return succeed(from);\n }\n\n // Validate as JsonValue and create new CandidateValue\n return JsonValidators.jsonValue\n .validate(from)\n .withErrorFormat((msg) => `Invalid JSON value: ${msg}`)\n .onSuccess((jsonValue) => {\n return CandidateValue.create({\n json: jsonValue,\n normalizer: this.normalizer\n });\n });\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/common.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,2BAA4B,SAAQ,YAAY,CAAC,OAAO,CAAC,mBAAmB;IAC3F;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IAEzC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,kCAAmC,SAAQ,YAAY,CAAC,QAAQ,CAAC,wBAAwB;IACxG;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,2BAA2B;IAC/E;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAEnF;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,2BAA2B,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC;CACxD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/resources/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 * as ResourceJson from '../resource-json';\nimport { IValidatedContextDecl } from '../context';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { ReadOnlyResourceTypeCollector } from '../resource-types';\n\n/**\n * Options for resource declaration operations with strongly-typed context filtering.\n * Extends the base IDeclarationOptions with proper type safety for context filtering.\n *\n * @example\n * ```typescript\n * // Preferred Result pattern with onSuccess chaining\n * resourceManager.validateContext({ language: 'en' })\n * .onSuccess((validatedContext) => {\n * return resourceManager.clone({ filterForContext: validatedContext });\n * })\n * .onSuccess((clonedManager) => {\n * return clonedManager.getResourceCollectionDecl();\n * })\n * .onFailure((error) => {\n * console.error('Failed to create filtered clone:', error);\n * });\n * ```\n * @public\n */\nexport interface IResourceDeclarationOptions extends ResourceJson.Helpers.IDeclarationOptions {\n /**\n * If provided, filters resource candidates to only include those that can match the\n * specified validated context. This provides strongly-typed context filtering.\n *\n * Use resourceManager.validateContext() to create a validated context from an IContextDecl.\n */\n filterForContext?: IValidatedContextDecl;\n\n /**\n * If true, reduces the qualifiers of the resource candidates by removing qualifiers that are made\n * irrelevant by the filterForContext.\n * @defaultValue false\n */\n reduceQualifiers?: boolean;\n\n /**\n * Whether to include metadata in compiled outputs.\n * Metadata includes human-readable information like semantic keys\n * that can be useful for debugging or tooling.\n * @defaultValue false\n */\n includeMetadata?: boolean;\n}\n\n/**\n * Extended compiled resource options that includes context filtering capabilities.\n * This interface combines the standard compilation options with strongly-typed\n * context filtering for resource candidates.\n * @public\n */\nexport interface ICompiledResourceOptionsWithFilter extends ResourceJson.Compiled.ICompiledResourceOptions {\n /**\n * If provided, filters resource candidates to only include those that can match the\n * specified validated context. This provides strongly-typed context filtering.\n *\n * Use resourceManager.validateContext() to create a validated context from an IContextDecl.\n */\n filterForContext?: IValidatedContextDecl;\n}\n\n/**\n * Options for ResourceManagerBuilder clone operations.\n * Extends IDeclarationOptions to include support for applying edits when cloning.\n * @public\n */\nexport interface IResourceManagerCloneOptions extends IResourceDeclarationOptions {\n /**\n * Optional array of loose condition declarations to be applied as edits during the clone operation.\n * These conditions can modify or extend the resource candidates in the cloned manager.\n */\n readonly candidates?: ReadonlyArray<ResourceJson.Json.ILooseResourceCandidateDecl>;\n\n /**\n * Optional qualifier collector to use for the cloned manager.\n * If not provided, uses the same qualifiers as the original manager.\n * This allows creating clones with different qualifier configurations.\n */\n readonly qualifiers?: IReadOnlyQualifierCollector;\n\n /**\n * Optional resource type collector to use for the cloned manager.\n * If not provided, uses the same resource types as the original manager.\n * This allows creating clones with different resource type configurations.\n */\n readonly resourceTypes?: ReadOnlyResourceTypeCollector;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaGenerator.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/deltaGenerator.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAuB,OAAO,EAAqB,MAAM,EAAW,MAAM,eAAe,CAAC;AAIjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,gBAAgB,EAAE,iBA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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, fail, Logging, MessageAggregator, Result, succeed } from '@fgv/ts-utils';\nimport { JsonValue, isJsonObject } from '@fgv/ts-json-base';\nimport { Diff } from '@fgv/ts-json';\nimport { ResourceId } from '../common';\nimport { IResourceResolver } from '../common';\nimport { ResourceManagerBuilder } from './resourceManagerBuilder';\nimport * as ResourceJson from '../resource-json';\nimport * as Context from '../context';\n\n/**\n * Interface for parameters to create a {@link Resources.DeltaGenerator | DeltaGenerator}.\n * @public\n */\nexport interface IDeltaGeneratorParams {\n /**\n * The baseline resource resolver to compare against.\n */\n baselineResolver: IResourceResolver;\n\n /**\n * The delta resource resolver containing changes.\n */\n deltaResolver: IResourceResolver;\n\n /**\n * The resource manager to clone and update.\n */\n resourceManager: ResourceManagerBuilder;\n\n /**\n * Optional logger for status and error reporting.\n */\n logger?: Logging.ILogger;\n}\n\n/**\n * Interface for options controlling delta generation behavior.\n * @public\n */\nexport interface IDeltaGeneratorOptions {\n /**\n * Context to use when resolving resources. If not provided, uses empty context.\n */\n context?: Context.IContextDecl;\n\n /**\n * Array of specific resource IDs to include in delta generation.\n * If not provided, generates deltas for all resources in the delta resolver.\n */\n resourceIds?: ReadonlyArray<string>;\n\n /**\n * Whether to skip resources that haven't changed. Default: true.\n */\n skipUnchanged?: boolean;\n}\n\n/**\n * Result of processing a single resource delta.\n * @internal\n */\ninterface IResourceDeltaResult {\n type: 'updated' | 'new' | 'skipped';\n resourceId: ResourceId;\n}\n\n/**\n * Class for generating resource deltas between baseline and delta resolvers.\n * Creates partial/augment candidates for updated resources and full/replace candidates for new resources.\n * Uses Diff.jsonThreeWayDiff for efficient delta computation.\n * @public\n */\nexport class DeltaGenerator {\n /**\n * The baseline resource resolver to compare against.\n * @internal\n */\n private readonly _baselineResolver: IResourceResolver;\n\n /**\n * The delta resource resolver containing changes.\n * @internal\n */\n private readonly _deltaResolver: IResourceResolver;\n\n /**\n * The resource manager to clone and update.\n * @internal\n */\n private readonly _resourceManager: ResourceManagerBuilder;\n\n /**\n * Logger for status and error reporting.\n * @internal\n */\n private readonly _logger: Logging.ILogger;\n\n /**\n * Constructor for a {@link Resources.DeltaGenerator | DeltaGenerator} object.\n * @param params - Parameters to create a new {@link Resources.DeltaGenerator | DeltaGenerator}.\n * @internal\n */\n protected constructor(params: IDeltaGeneratorParams) {\n this._baselineResolver = params.baselineResolver;\n this._deltaResolver = params.deltaResolver;\n this._resourceManager = params.resourceManager;\n this._logger = params.logger ?? new Logging.NoOpLogger();\n }\n\n /**\n * Creates a new {@link Resources.DeltaGenerator | DeltaGenerator} object.\n * @param params - Parameters to create a new {@link Resources.DeltaGenerator | DeltaGenerator}.\n * @returns `Success` with the new {@link Resources.DeltaGenerator | DeltaGenerator} object if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public static create(params: IDeltaGeneratorParams): Result<DeltaGenerator> {\n return captureResult(() => new DeltaGenerator(params));\n }\n\n /**\n * Generates deltas between baseline and delta resolvers.\n * Creates a cloned resource manager with partial/augment candidates for updates\n * and full/replace candidates for new resources.\n *\n * @param options - Options controlling delta generation behavior.\n * @returns `Success` with the updated resource manager if successful,\n * or `Failure` with an error message if not.\n * @public\n */\n public generate(options?: IDeltaGeneratorOptions): Result<ResourceManagerBuilder> {\n this._logger.info('Starting delta generation');\n\n const context = options?.context ?? {};\n const skipUnchanged = options?.skipUnchanged ?? true;\n\n return this._validateContext(context)\n .onSuccess((validatedContext) => this._enumerateTargetResources(options?.resourceIds, validatedContext))\n .onSuccess((resourceIds) => {\n return this._cloneResourceManager()\n .onSuccess((clonedManager) =>\n this._generateDeltas(clonedManager, resourceIds, context, skipUnchanged)\n )\n .onSuccess((manager) => {\n this._logger.info(`Delta generation completed successfully with ${manager.size} resources`);\n return succeed(manager);\n });\n });\n }\n\n /**\n * Validates the provided context declaration.\n * @param context - The context declaration to validate.\n * @returns `Success` with the validated context if successful, `Failure` otherwise.\n * @internal\n */\n private _validateContext(context: Context.IContextDecl): Result<Context.IValidatedContextDecl> {\n return this._resourceManager.validateContext(context);\n }\n\n /**\n * Enumerates target resource IDs for delta generation.\n * If specific resource IDs are provided, uses those. Otherwise, discovers all resources\n * from both the baseline resource manager and the delta resolver to ensure comprehensive\n * coverage of all potential resources.\n *\n * @param requestedIds - Optional array of specific resource IDs to target.\n * @param context - The validated context to use for resource discovery.\n * @returns `Success` with array of resource IDs if successful, `Failure` otherwise.\n * @internal\n */\n private _enumerateTargetResources(\n requestedIds: ReadonlyArray<string> | undefined,\n context: Context.IValidatedContextDecl\n ): Result<ReadonlyArray<ResourceId>> {\n /* c8 ignore next 20 - functional code tested but coverage intermittently missed */\n if (requestedIds && requestedIds.length > 0) {\n this._logger.info(`Using ${requestedIds.length} specified resource IDs`);\n // Validate the requested IDs\n const validatedIds: ResourceId[] = [];\n const errors = new MessageAggregator();\n\n for (const id of requestedIds) {\n const validationResult = this._resourceManager.getBuiltResource(id);\n if (validationResult.isSuccess()) {\n validatedIds.push(id as ResourceId);\n } else {\n errors.addMessage(`Invalid resource ID \"${id}\": ${validationResult.message}`);\n }\n }\n\n if (errors.hasMessages) {\n return fail(errors.toString());\n }\n\n return succeed(validatedIds);\n }\n\n // Discover resources from both baseline and delta resolvers to ensure comprehensive coverage\n this._logger.info('Discovering resources from both baseline and delta resolvers');\n\n return this._discoverAllResourceIds().onSuccess((allResourceIds) => {\n this._logger.info(`Discovered ${allResourceIds.length} unique resources across both resolvers`);\n return succeed(allResourceIds);\n });\n }\n\n /**\n * Discovers all unique resource IDs from both baseline and delta resolvers.\n * Creates a union of resource IDs from the baseline resource manager and delta resolver\n * to ensure comprehensive coverage of all resources.\n *\n * @returns `Success` with array of unique resource IDs if successful, `Failure` otherwise.\n * @internal\n */\n private _discoverAllResourceIds(): Result<ReadonlyArray<ResourceId>> {\n // Get resource IDs from baseline resource manager\n return this._resourceManager.getAllBuiltResources().onSuccess((baselineResources) => {\n const baselineResourceIds = baselineResources.map((r) => r.id);\n this._logger.detail(`Found ${baselineResourceIds.length} resources in baseline`);\n\n // Get resource IDs from delta resolver using the public interface\n const deltaResourceIds = this._deltaResolver.resourceIds;\n this._logger.detail(`Found ${deltaResourceIds.length} resources in delta`);\n\n // Create a union of resource IDs from both sources\n const allResourceIds = new Set<ResourceId>();\n\n // Add baseline resource IDs\n baselineResourceIds.forEach((id) => {\n allResourceIds.add(id);\n });\n\n // Add delta resource IDs\n deltaResourceIds.forEach((id) => {\n allResourceIds.add(id);\n });\n\n const uniqueResourceIds = Array.from(allResourceIds);\n this._logger.detail(`Created union of ${uniqueResourceIds.length} unique resource IDs`);\n\n return succeed(uniqueResourceIds);\n });\n }\n\n /**\n * Creates a clone of the resource manager for delta operations.\n * @returns `Success` with the cloned resource manager if successful, `Failure` otherwise.\n * @internal\n */\n private _cloneResourceManager(): Result<ResourceManagerBuilder> {\n this._logger.info('Cloning resource manager');\n return this._resourceManager.clone();\n }\n\n /**\n * Generates deltas for the specified resources and adds them to the cloned manager.\n *\n * @param clonedManager - The cloned resource manager to update.\n * @param resourceIds - Array of resource IDs to process.\n * @param context - The context to use for resource resolution.\n * @param skipUnchanged - Whether to skip resources that haven't changed.\n * @returns `Success` with the updated manager if successful, `Failure` otherwise.\n * @internal\n */\n private _generateDeltas(\n clonedManager: ResourceManagerBuilder,\n resourceIds: ReadonlyArray<ResourceId>,\n context: Context.IContextDecl,\n skipUnchanged: boolean\n ): Result<ResourceManagerBuilder> {\n this._logger.info(`Generating deltas for ${resourceIds.length} resources`);\n\n const errors = new MessageAggregator();\n let processedCount = 0;\n let changedCount = 0;\n let newCount = 0;\n let skippedCount = 0;\n\n for (const resourceId of resourceIds) {\n this._logger.detail(`Processing resource: ${resourceId}`);\n\n const result = this._generateResourceDelta(clonedManager, resourceId, context, skipUnchanged);\n /* c8 ignore next 3 - functional code tested but coverage intermittently missed */\n if (result.isFailure()) {\n errors.addMessage(`${resourceId}: ${result.message}`);\n continue;\n }\n\n processedCount++;\n\n // Track statistics based on result\n const deltaResult = result.value;\n if (deltaResult.type === 'skipped') {\n skippedCount++;\n } else if (deltaResult.type === 'new') {\n newCount++;\n } else {\n changedCount++;\n }\n }\n\n this._logger.info(\n `Processed ${processedCount} resources: ${changedCount} updated, ${newCount} new, ${skippedCount} skipped`\n );\n\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n if (errors.hasMessages) {\n return fail(`Delta generation failed with errors:\\n${errors.toString()}`);\n }\n\n return succeed(clonedManager);\n }\n\n /**\n * Generates a delta for a single resource and adds appropriate candidates to the manager.\n *\n * @param manager - The resource manager to update.\n * @param resourceId - The resource ID to process.\n * @param context - The context to use for resource resolution.\n * @param skipUnchanged - Whether to skip resources that haven't changed.\n * @returns `Success` with the resource delta result if successful, `Failure` otherwise.\n * @internal\n */\n private _generateResourceDelta(\n manager: ResourceManagerBuilder,\n resourceId: ResourceId,\n context: Context.IContextDecl,\n skipUnchanged: boolean\n ): Result<IResourceDeltaResult> {\n // Resolve values from both resolvers\n const baselineResult = this._baselineResolver.resolveComposedResourceValue(resourceId);\n const deltaResult = this._deltaResolver.resolveComposedResourceValue(resourceId);\n\n const baselineExists = baselineResult.isSuccess();\n const deltaExists = deltaResult.isSuccess();\n\n if (deltaExists && !baselineExists) {\n // New resource - exists in delta but not in baseline\n this._logger.detail(`${resourceId}: New resource detected (exists in delta only)`);\n return this._createNewResourceCandidate(manager, resourceId, deltaResult.value, context).onSuccess(() =>\n succeed({ type: 'new' as const, resourceId })\n );\n }\n\n if (baselineExists && !deltaExists) {\n // Baseline-only resource - exists in baseline but not in delta (potential deletion)\n // For now, skip these resources since delete merge method is not yet implemented\n // TODO: When 'delete' merge method is available, create deletion candidates here\n this._logger.detail(\n `${resourceId}: Baseline-only resource detected, skipping (delete merge method not yet implemented)`\n );\n return succeed({ type: 'skipped' as const, resourceId });\n }\n\n /* c8 ignore next 4 - defense in depth should not happen in practice */\n if (!baselineExists && !deltaExists) {\n // Resource doesn't exist in either resolver - this shouldn't happen due to enumeration logic\n return fail(`Resource ${resourceId} not found in either baseline or delta resolvers`);\n }\n\n // Both resolvers have the resource - check for changes\n // At this point, both results are successful so values are guaranteed to exist\n const baselineValue = baselineResult.value!; // Safe: baselineExists is true\n const deltaValue = deltaResult.value!; // Safe: deltaExists is true\n\n // Check if values are identical\n if (skipUnchanged && this._areValuesIdentical(baselineValue, deltaValue)) {\n this._logger.detail(`${resourceId}: No changes detected, skipping`);\n return succeed({ type: 'skipped' as const, resourceId });\n }\n\n // Updated resource - compute delta and create partial/augment candidate\n this._logger.detail(`${resourceId}: Changes detected, computing delta`);\n return this._createDeltaCandidate(manager, resourceId, baselineValue, deltaValue, context).onSuccess(() =>\n succeed({ type: 'updated' as const, resourceId })\n );\n }\n\n /**\n * Checks if two JSON values are identical.\n * @param value1 - First value to compare.\n * @param value2 - Second value to compare.\n * @returns True if values are identical, false otherwise.\n * @internal\n */\n private _areValuesIdentical(value1: JsonValue, value2: JsonValue): boolean {\n return JSON.stringify(value1) === JSON.stringify(value2);\n }\n\n /**\n * Creates a new resource candidate for a newly discovered resource.\n * Uses full/replace merge method since this is a completely new resource.\n *\n * @param manager - The resource manager to update.\n * @param resourceId - The resource ID for the new resource.\n * @param value - The resolved value for the new resource.\n * @param context - The context used for resolution.\n * @returns `Success` if the candidate was added successfully, `Failure` otherwise.\n * @internal\n */\n private _createNewResourceCandidate(\n manager: ResourceManagerBuilder,\n resourceId: ResourceId,\n value: JsonValue,\n context: Context.IContextDecl\n ): Result<void> {\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n if (!isJsonObject(value)) {\n return fail(`Resource value must be a JSON object, got ${typeof value}`);\n }\n\n const candidateDecl: ResourceJson.Json.ILooseResourceCandidateDecl = {\n id: resourceId,\n json: value,\n conditions: Object.keys(context).length > 0 ? context : undefined,\n isPartial: false,\n mergeMethod: 'replace',\n resourceTypeName: 'json' // Use 'json' resource type for new JSON resources\n };\n\n return manager.addLooseCandidate(candidateDecl).asResult.onSuccess(() => succeed(undefined));\n }\n\n /**\n * Creates a delta candidate for an updated resource.\n * Computes the difference between baseline and delta values and creates\n * a partial/augment candidate with only the changed properties.\n *\n * @param manager - The resource manager to update.\n * @param resourceId - The resource ID for the updated resource.\n * @param baselineValue - The baseline resolved value.\n * @param deltaValue - The delta resolved value.\n * @param context - The context used for resolution.\n * @returns `Success` if the candidate was added successfully, `Failure` otherwise.\n * @internal\n */\n private _createDeltaCandidate(\n manager: ResourceManagerBuilder,\n resourceId: ResourceId,\n baselineValue: JsonValue,\n deltaValue: JsonValue,\n context: Context.IContextDecl\n ): Result<void> {\n // Compute three-way diff to get only the changed properties\n return Diff.jsonThreeWayDiff(baselineValue, deltaValue).onSuccess((diff) => {\n if (diff.identical) {\n // This shouldn't happen if we checked for identity earlier, but be defensive\n this._logger.warn(`${resourceId}: Diff reports identical values, skipping`);\n return succeed(undefined);\n }\n\n // Use onlyInB (second object) which contains new/changed properties\n const deltaChanges = diff.onlyInB;\n\n /* c8 ignore next 2 - functional code tested but coverage intermittently missed */\n if (!isJsonObject(deltaChanges)) {\n return fail(`Delta changes must be a JSON object, got ${typeof deltaChanges}`);\n }\n\n // TODO: Handle deletions using 'augment' merge method with null values\n // Note: The 'delete' merge type is not yet implemented in ts-res, so we use 'augment'\n // with null values for deletion semantics (as used in ts-res-ui-components).\n // When the 'delete' merge type is available, this should be updated to use it.\n\n const candidateDecl: ResourceJson.Json.ILooseResourceCandidateDecl = {\n id: resourceId,\n json: deltaChanges,\n conditions: Object.keys(context).length > 0 ? context : undefined,\n isPartial: true,\n mergeMethod: 'augment',\n resourceTypeName: undefined // Will be inferred by the manager\n };\n\n return manager.addLooseCandidate(candidateDecl).asResult.onSuccess(() => succeed(undefined));\n });\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/index.ts"],"names":[],"mappings":"AAsBA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/resources/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,qDAAmC;AACnC,mDAAiC;AACjC,4DAA0C;AAC1C,mDAAiC;AACjC,sDAAoC;AACpC,6CAA2B;AAC3B,oDAAkC;AAClC,2DAAyC;AACzC,2CAAyB","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 './candidateReducer';\nexport * from './candidateValue';\nexport * from './candidateValueCollector';\nexport * from './deltaGenerator';\nexport * from './resourceCandidate';\nexport * from './resource';\nexport * from './resourceBuilder';\nexport * from './resourceManagerBuilder';\nexport * from './common';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/packlets/resources/resource.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAqB,MAAM,EAAgC,MAAM,eAAe,CAAC;AACxF,OAAO,EAAW,UAAU,EAAE,YAAY,EAAY,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAE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