@fgv/ts-res 4.5.0-3 → 5.0.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/CHANGELOG.json +26 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CLAUDE.md +186 -0
  4. package/EXAMPLE_INIT_PARAMS.md +88 -0
  5. package/PROGRESS_SUMMARY.md +48 -0
  6. package/README.md +535 -14
  7. package/dist/ts-res.d.ts +4241 -318
  8. package/dist/tsdoc-metadata.json +1 -1
  9. package/lib/index.d.ts +4 -1
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +7 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/packlets/common/conditions.d.ts +30 -0
  14. package/lib/packlets/common/conditions.d.ts.map +1 -1
  15. package/lib/packlets/common/conditions.js.map +1 -1
  16. package/lib/packlets/common/convert.d.ts +22 -2
  17. package/lib/packlets/common/convert.d.ts.map +1 -1
  18. package/lib/packlets/common/convert.js +21 -1
  19. package/lib/packlets/common/convert.js.map +1 -1
  20. package/lib/packlets/common/helpers/context.d.ts +39 -0
  21. package/lib/packlets/common/helpers/context.d.ts.map +1 -0
  22. package/lib/packlets/common/helpers/context.js +108 -0
  23. package/lib/packlets/common/helpers/context.js.map +1 -0
  24. package/lib/packlets/common/helpers/index.d.ts +2 -0
  25. package/lib/packlets/common/helpers/index.d.ts.map +1 -1
  26. package/lib/packlets/common/helpers/index.js +2 -0
  27. package/lib/packlets/common/helpers/index.js.map +1 -1
  28. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts +39 -0
  29. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +1 -0
  30. package/lib/packlets/common/helpers/qualifierDefaultValues.js +105 -0
  31. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +1 -0
  32. package/lib/packlets/common/helpers/resources.d.ts.map +1 -1
  33. package/lib/packlets/common/helpers/resources.js +6 -2
  34. package/lib/packlets/common/helpers/resources.js.map +1 -1
  35. package/lib/packlets/common/validate/conditions.d.ts +69 -1
  36. package/lib/packlets/common/validate/conditions.d.ts.map +1 -1
  37. package/lib/packlets/common/validate/conditions.js +126 -0
  38. package/lib/packlets/common/validate/conditions.js.map +1 -1
  39. package/lib/packlets/common/validate/regularExpressions.d.ts +20 -0
  40. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -1
  41. package/lib/packlets/common/validate/regularExpressions.js +21 -1
  42. package/lib/packlets/common/validate/regularExpressions.js.map +1 -1
  43. package/lib/packlets/conditions/condition.d.ts +37 -0
  44. package/lib/packlets/conditions/condition.d.ts.map +1 -1
  45. package/lib/packlets/conditions/condition.js +67 -1
  46. package/lib/packlets/conditions/condition.js.map +1 -1
  47. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -1
  48. package/lib/packlets/conditions/conditionCollector.js +1 -0
  49. package/lib/packlets/conditions/conditionCollector.js.map +1 -1
  50. package/lib/packlets/conditions/conditionSet.d.ts +34 -3
  51. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
  52. package/lib/packlets/conditions/conditionSet.js +31 -3
  53. package/lib/packlets/conditions/conditionSet.js.map +1 -1
  54. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -1
  55. package/lib/packlets/conditions/conditionSetCollector.js +3 -0
  56. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -1
  57. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -1
  58. package/lib/packlets/conditions/conditionToken.js +2 -1
  59. package/lib/packlets/conditions/conditionToken.js.map +1 -1
  60. package/lib/packlets/conditions/convert/decls.js +1 -1
  61. package/lib/packlets/conditions/convert/decls.js.map +1 -1
  62. package/lib/packlets/config/common.d.ts +35 -0
  63. package/lib/packlets/config/common.d.ts.map +1 -0
  64. package/lib/packlets/config/common.js +96 -0
  65. package/lib/packlets/config/common.js.map +1 -0
  66. package/lib/packlets/config/convert.d.ts +14 -0
  67. package/lib/packlets/config/convert.d.ts.map +1 -0
  68. package/lib/packlets/config/convert.js +82 -0
  69. package/lib/packlets/config/convert.js.map +1 -0
  70. package/lib/packlets/config/index.d.ts +6 -0
  71. package/lib/packlets/config/index.d.ts.map +1 -0
  72. package/lib/packlets/config/index.js +67 -0
  73. package/lib/packlets/config/index.js.map +1 -0
  74. package/lib/packlets/config/json.d.ts +20 -0
  75. package/lib/packlets/config/json.d.ts.map +1 -0
  76. package/lib/packlets/config/json.js +24 -0
  77. package/lib/packlets/config/json.js.map +1 -0
  78. package/lib/packlets/config/predefined/default.d.ts +57 -0
  79. package/lib/packlets/config/predefined/default.d.ts.map +1 -0
  80. package/lib/packlets/config/predefined/default.js +141 -0
  81. package/lib/packlets/config/predefined/default.js.map +1 -0
  82. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  83. package/lib/packlets/config/predefined/extended.d.ts.map +1 -0
  84. package/lib/packlets/config/predefined/extended.js +193 -0
  85. package/lib/packlets/config/predefined/extended.js.map +1 -0
  86. package/lib/packlets/config/predefined/index.d.ts +4 -0
  87. package/lib/packlets/config/predefined/index.d.ts.map +1 -0
  88. package/lib/packlets/config/predefined/index.js +62 -0
  89. package/lib/packlets/config/predefined/index.js.map +1 -0
  90. package/lib/packlets/config/systemConfiguration.d.ts +81 -0
  91. package/lib/packlets/config/systemConfiguration.d.ts.map +1 -0
  92. package/lib/packlets/config/systemConfiguration.js +172 -0
  93. package/lib/packlets/config/systemConfiguration.js.map +1 -0
  94. package/lib/packlets/context/contextDecls.d.ts +49 -0
  95. package/lib/packlets/context/contextDecls.d.ts.map +1 -0
  96. package/lib/packlets/context/contextDecls.js +24 -0
  97. package/lib/packlets/context/contextDecls.js.map +1 -0
  98. package/lib/packlets/context/contextToken.d.ts +111 -0
  99. package/lib/packlets/context/contextToken.d.ts.map +1 -0
  100. package/lib/packlets/context/contextToken.js +206 -0
  101. package/lib/packlets/context/contextToken.js.map +1 -0
  102. package/lib/packlets/context/convert/decls.d.ts +37 -0
  103. package/lib/packlets/context/convert/decls.d.ts.map +1 -0
  104. package/lib/packlets/context/convert/decls.js +94 -0
  105. package/lib/packlets/context/convert/decls.js.map +1 -0
  106. package/lib/packlets/context/convert/index.d.ts +2 -0
  107. package/lib/packlets/context/convert/index.d.ts.map +1 -0
  108. package/lib/packlets/context/convert/index.js +39 -0
  109. package/lib/packlets/context/convert/index.js.map +1 -0
  110. package/lib/packlets/context/index.d.ts +5 -0
  111. package/lib/packlets/context/index.d.ts.map +1 -0
  112. package/lib/packlets/context/index.js +65 -0
  113. package/lib/packlets/context/index.js.map +1 -0
  114. package/lib/packlets/decisions/abstractDecision.d.ts +8 -0
  115. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -1
  116. package/lib/packlets/decisions/abstractDecision.js +9 -0
  117. package/lib/packlets/decisions/abstractDecision.js.map +1 -1
  118. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -1
  119. package/lib/packlets/decisions/abstractDecisionCollector.js +2 -0
  120. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -1
  121. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -1
  122. package/lib/packlets/decisions/concreteDecision.js +1 -0
  123. package/lib/packlets/decisions/concreteDecision.js.map +1 -1
  124. package/lib/packlets/decisions/decision.d.ts.map +1 -1
  125. package/lib/packlets/decisions/decision.js +4 -0
  126. package/lib/packlets/decisions/decision.js.map +1 -1
  127. package/lib/packlets/import/fsItem.d.ts.map +1 -1
  128. package/lib/packlets/import/fsItem.js +1 -0
  129. package/lib/packlets/import/fsItem.js.map +1 -1
  130. package/lib/packlets/import/importContext.d.ts +19 -0
  131. package/lib/packlets/import/importContext.d.ts.map +1 -1
  132. package/lib/packlets/import/importContext.js +39 -0
  133. package/lib/packlets/import/importContext.js.map +1 -1
  134. package/lib/packlets/import/importManager.d.ts +5 -5
  135. package/lib/packlets/import/importManager.d.ts.map +1 -1
  136. package/lib/packlets/import/importManager.js.map +1 -1
  137. package/lib/packlets/import/importers/collectionImporter.d.ts +11 -13
  138. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -1
  139. package/lib/packlets/import/importers/collectionImporter.js +29 -20
  140. package/lib/packlets/import/importers/collectionImporter.js.map +1 -1
  141. package/lib/packlets/import/importers/fsItemImporter.d.ts +2 -2
  142. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -1
  143. package/lib/packlets/import/importers/fsItemImporter.js +2 -2
  144. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -1
  145. package/lib/packlets/import/importers/importer.d.ts +3 -3
  146. package/lib/packlets/import/importers/importer.d.ts.map +1 -1
  147. package/lib/packlets/import/importers/importer.js.map +1 -1
  148. package/lib/packlets/import/importers/jsonImporter.d.ts +2 -3
  149. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -1
  150. package/lib/packlets/import/importers/jsonImporter.js +10 -20
  151. package/lib/packlets/import/importers/jsonImporter.js.map +1 -1
  152. package/lib/packlets/import/importers/pathImporter.d.ts +2 -2
  153. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -1
  154. package/lib/packlets/import/importers/pathImporter.js.map +1 -1
  155. package/lib/packlets/qualifier-types/config/convert.d.ts +44 -0
  156. package/lib/packlets/qualifier-types/config/convert.d.ts.map +1 -0
  157. package/lib/packlets/qualifier-types/config/convert.js +96 -0
  158. package/lib/packlets/qualifier-types/config/convert.js.map +1 -0
  159. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  160. package/lib/packlets/qualifier-types/config/index.d.ts.map +1 -0
  161. package/lib/packlets/qualifier-types/config/index.js +64 -0
  162. package/lib/packlets/qualifier-types/config/index.js.map +1 -0
  163. package/lib/packlets/qualifier-types/config/json.d.ts +69 -0
  164. package/lib/packlets/qualifier-types/config/json.d.ts.map +1 -0
  165. package/lib/packlets/qualifier-types/config/json.js +24 -0
  166. package/lib/packlets/qualifier-types/config/json.js.map +1 -0
  167. package/lib/packlets/qualifier-types/convert.d.ts +10 -2
  168. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -1
  169. package/lib/packlets/qualifier-types/convert.js +15 -0
  170. package/lib/packlets/qualifier-types/convert.js.map +1 -1
  171. package/lib/packlets/qualifier-types/helpers.d.ts +27 -0
  172. package/lib/packlets/qualifier-types/helpers.d.ts.map +1 -0
  173. package/lib/packlets/qualifier-types/helpers.js +118 -0
  174. package/lib/packlets/qualifier-types/helpers.js.map +1 -0
  175. package/lib/packlets/qualifier-types/index.d.ts +4 -1
  176. package/lib/packlets/qualifier-types/index.d.ts.map +1 -1
  177. package/lib/packlets/qualifier-types/index.js +5 -1
  178. package/lib/packlets/qualifier-types/index.js.map +1 -1
  179. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +19 -8
  180. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -1
  181. package/lib/packlets/qualifier-types/languageQualifierType.js +28 -9
  182. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -1
  183. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +42 -13
  184. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -1
  185. package/lib/packlets/qualifier-types/literalQualifierType.js +58 -10
  186. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -1
  187. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +114 -0
  188. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +1 -0
  189. package/lib/packlets/qualifier-types/literalValueHierarchy.js +228 -0
  190. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +1 -0
  191. package/lib/packlets/qualifier-types/qualifierType.d.ts +33 -18
  192. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -1
  193. package/lib/packlets/qualifier-types/qualifierType.js +18 -4
  194. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -1
  195. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +4 -2
  196. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -1
  197. package/lib/packlets/qualifier-types/qualifierTypeCollector.js +2 -1
  198. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -1
  199. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +47 -11
  200. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -1
  201. package/lib/packlets/qualifier-types/territoryQualifierType.js +61 -17
  202. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -1
  203. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -1
  204. package/lib/packlets/qualifiers/convert/decls.js +17 -15
  205. package/lib/packlets/qualifiers/convert/decls.js.map +1 -1
  206. package/lib/packlets/qualifiers/index.d.ts +2 -0
  207. package/lib/packlets/qualifiers/index.d.ts.map +1 -1
  208. package/lib/packlets/qualifiers/index.js +2 -0
  209. package/lib/packlets/qualifiers/index.js.map +1 -1
  210. package/lib/packlets/qualifiers/qualifier.d.ts +22 -2
  211. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -1
  212. package/lib/packlets/qualifiers/qualifier.js +26 -1
  213. package/lib/packlets/qualifiers/qualifier.js.map +1 -1
  214. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
  215. package/lib/packlets/qualifiers/qualifierCollector.js +4 -0
  216. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
  217. package/lib/packlets/qualifiers/qualifierDecl.d.ts +6 -1
  218. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -1
  219. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -1
  220. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts +32 -0
  221. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +1 -0
  222. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js +24 -0
  223. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +1 -0
  224. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts +96 -0
  225. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +1 -0
  226. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js +179 -0
  227. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +1 -0
  228. package/lib/packlets/resource-json/compiled/common.d.ts +14 -0
  229. package/lib/packlets/resource-json/compiled/common.d.ts.map +1 -0
  230. package/lib/packlets/resource-json/compiled/common.js +24 -0
  231. package/lib/packlets/resource-json/compiled/common.js.map +1 -0
  232. package/lib/packlets/resource-json/compiled/convert.d.ts +63 -0
  233. package/lib/packlets/resource-json/compiled/convert.d.ts.map +1 -0
  234. package/lib/packlets/resource-json/compiled/convert.js +167 -0
  235. package/lib/packlets/resource-json/compiled/convert.js.map +1 -0
  236. package/lib/packlets/resource-json/compiled/index.d.ts +5 -0
  237. package/lib/packlets/resource-json/compiled/index.d.ts.map +1 -0
  238. package/lib/packlets/resource-json/compiled/index.js +65 -0
  239. package/lib/packlets/resource-json/compiled/index.js.map +1 -0
  240. package/lib/packlets/resource-json/compiled/json.d.ts +204 -0
  241. package/lib/packlets/resource-json/compiled/json.d.ts.map +1 -0
  242. package/lib/packlets/resource-json/compiled/json.js +3 -0
  243. package/lib/packlets/resource-json/compiled/json.js.map +1 -0
  244. package/lib/packlets/resource-json/convert.d.ts +16 -0
  245. package/lib/packlets/resource-json/convert.d.ts.map +1 -1
  246. package/lib/packlets/resource-json/convert.js +41 -6
  247. package/lib/packlets/resource-json/convert.js.map +1 -1
  248. package/lib/packlets/resource-json/helpers.d.ts +82 -3
  249. package/lib/packlets/resource-json/helpers.d.ts.map +1 -1
  250. package/lib/packlets/resource-json/helpers.js +185 -2
  251. package/lib/packlets/resource-json/helpers.js.map +1 -1
  252. package/lib/packlets/resource-json/index.d.ts +2 -1
  253. package/lib/packlets/resource-json/index.d.ts.map +1 -1
  254. package/lib/packlets/resource-json/index.js +3 -1
  255. package/lib/packlets/resource-json/index.js.map +1 -1
  256. package/lib/packlets/resource-json/json.d.ts +55 -3
  257. package/lib/packlets/resource-json/json.d.ts.map +1 -1
  258. package/lib/packlets/resource-json/json.js +16 -0
  259. package/lib/packlets/resource-json/json.js.map +1 -1
  260. package/lib/packlets/resource-json/normalized.d.ts +46 -3
  261. package/lib/packlets/resource-json/normalized.d.ts.map +1 -1
  262. package/lib/packlets/resource-json/normalized.js.map +1 -1
  263. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +14 -10
  264. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -1
  265. package/lib/packlets/resource-json/resourceDeclCollection.js +18 -14
  266. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -1
  267. package/lib/packlets/resource-json/resourceDeclContainer.d.ts +15 -2
  268. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -1
  269. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -1
  270. package/lib/packlets/resource-json/resourceDeclTree.d.ts +6 -2
  271. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -1
  272. package/lib/packlets/resource-json/resourceDeclTree.js +12 -3
  273. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -1
  274. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  275. package/lib/packlets/resource-types/config/convert.d.ts.map +1 -0
  276. package/lib/packlets/resource-types/config/convert.js +36 -0
  277. package/lib/packlets/resource-types/config/convert.js.map +1 -0
  278. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  279. package/lib/packlets/resource-types/config/index.d.ts.map +1 -0
  280. package/lib/packlets/resource-types/config/index.js +64 -0
  281. package/lib/packlets/resource-types/config/index.js.map +1 -0
  282. package/lib/packlets/resource-types/config/json.d.ts +9 -0
  283. package/lib/packlets/resource-types/config/json.d.ts.map +1 -0
  284. package/lib/packlets/resource-types/config/json.js +24 -0
  285. package/lib/packlets/resource-types/config/json.js.map +1 -0
  286. package/lib/packlets/resource-types/helpers.d.ts +13 -0
  287. package/lib/packlets/resource-types/helpers.d.ts.map +1 -0
  288. package/lib/packlets/resource-types/helpers.js +44 -0
  289. package/lib/packlets/resource-types/helpers.js.map +1 -0
  290. package/lib/packlets/resource-types/index.d.ts +3 -0
  291. package/lib/packlets/resource-types/index.d.ts.map +1 -1
  292. package/lib/packlets/resource-types/index.js +26 -0
  293. package/lib/packlets/resource-types/index.js.map +1 -1
  294. package/lib/packlets/resource-types/jsonResourceType.d.ts +5 -13
  295. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
  296. package/lib/packlets/resource-types/jsonResourceType.js +5 -2
  297. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
  298. package/lib/packlets/resource-types/resourceType.d.ts +31 -30
  299. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
  300. package/lib/packlets/resource-types/resourceType.js.map +1 -1
  301. package/lib/packlets/resources/candidateReducer.d.ts +98 -0
  302. package/lib/packlets/resources/candidateReducer.d.ts.map +1 -0
  303. package/lib/packlets/resources/candidateReducer.js +247 -0
  304. package/lib/packlets/resources/candidateReducer.js.map +1 -0
  305. package/lib/packlets/resources/common.d.ts +60 -0
  306. package/lib/packlets/resources/common.d.ts.map +1 -0
  307. package/lib/packlets/resources/common.js +24 -0
  308. package/lib/packlets/resources/common.js.map +1 -0
  309. package/lib/packlets/resources/index.d.ts +3 -1
  310. package/lib/packlets/resources/index.d.ts.map +1 -1
  311. package/lib/packlets/resources/index.js +3 -1
  312. package/lib/packlets/resources/index.js.map +1 -1
  313. package/lib/packlets/resources/resource.d.ts +57 -5
  314. package/lib/packlets/resources/resource.d.ts.map +1 -1
  315. package/lib/packlets/resources/resource.js +96 -6
  316. package/lib/packlets/resources/resource.js.map +1 -1
  317. package/lib/packlets/resources/resourceBuilder.d.ts +14 -0
  318. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -1
  319. package/lib/packlets/resources/resourceBuilder.js +19 -1
  320. package/lib/packlets/resources/resourceBuilder.js.map +1 -1
  321. package/lib/packlets/resources/resourceCandidate.d.ts +42 -6
  322. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -1
  323. package/lib/packlets/resources/resourceCandidate.js +40 -1
  324. package/lib/packlets/resources/resourceCandidate.js.map +1 -1
  325. package/lib/packlets/resources/resourceManagerBuilder.d.ts +220 -0
  326. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -0
  327. package/lib/packlets/resources/resourceManagerBuilder.js +451 -0
  328. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -0
  329. package/lib/packlets/runtime/cacheListener.d.ts +62 -0
  330. package/lib/packlets/runtime/cacheListener.d.ts.map +1 -0
  331. package/lib/packlets/runtime/cacheListener.js +56 -0
  332. package/lib/packlets/runtime/cacheListener.js.map +1 -0
  333. package/lib/packlets/runtime/cacheMetrics.d.ts +82 -0
  334. package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -0
  335. package/lib/packlets/runtime/cacheMetrics.js +143 -0
  336. package/lib/packlets/runtime/cacheMetrics.js.map +1 -0
  337. package/lib/packlets/runtime/compiledResourceCollection.d.ts +167 -0
  338. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +1 -0
  339. package/lib/packlets/runtime/compiledResourceCollection.js +466 -0
  340. package/lib/packlets/runtime/compiledResourceCollection.js.map +1 -0
  341. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts +70 -0
  342. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +1 -0
  343. package/lib/packlets/runtime/conditionSetResolutionResult.js +135 -0
  344. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +1 -0
  345. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +80 -0
  346. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +1 -0
  347. package/lib/packlets/runtime/context/contextQualifierProvider.js +33 -0
  348. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +1 -0
  349. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +165 -0
  350. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +1 -0
  351. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +179 -0
  352. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +1 -0
  353. package/lib/packlets/runtime/context/index.d.ts +5 -0
  354. package/lib/packlets/runtime/context/index.d.ts.map +1 -0
  355. package/lib/packlets/runtime/context/index.js +42 -0
  356. package/lib/packlets/runtime/context/index.js.map +1 -0
  357. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +111 -0
  358. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -0
  359. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +177 -0
  360. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -0
  361. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +47 -0
  362. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -0
  363. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +64 -0
  364. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -0
  365. package/lib/packlets/runtime/iResourceManager.d.ts +88 -0
  366. package/lib/packlets/runtime/iResourceManager.d.ts.map +1 -0
  367. package/lib/packlets/runtime/iResourceManager.js +24 -0
  368. package/lib/packlets/runtime/iResourceManager.js.map +1 -0
  369. package/lib/packlets/runtime/index.d.ts +12 -0
  370. package/lib/packlets/runtime/index.d.ts.map +1 -0
  371. package/lib/packlets/runtime/index.js +73 -0
  372. package/lib/packlets/runtime/index.js.map +1 -0
  373. package/lib/packlets/runtime/resource-tree/common.d.ts +91 -0
  374. package/lib/packlets/runtime/resource-tree/common.d.ts.map +1 -0
  375. package/lib/packlets/runtime/resource-tree/common.js +24 -0
  376. package/lib/packlets/runtime/resource-tree/common.js.map +1 -0
  377. package/lib/packlets/runtime/resource-tree/index.d.ts +5 -0
  378. package/lib/packlets/runtime/resource-tree/index.d.ts.map +1 -0
  379. package/lib/packlets/runtime/resource-tree/index.js +42 -0
  380. package/lib/packlets/runtime/resource-tree/index.js.map +1 -0
  381. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts +141 -0
  382. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +1 -0
  383. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js +224 -0
  384. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +1 -0
  385. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts +24 -0
  386. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +1 -0
  387. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +98 -0
  388. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +1 -0
  389. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +99 -0
  390. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +1 -0
  391. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +165 -0
  392. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +1 -0
  393. package/lib/packlets/runtime/resourceResolver.d.ts +196 -0
  394. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -0
  395. package/lib/packlets/runtime/resourceResolver.js +437 -0
  396. package/lib/packlets/runtime/resourceResolver.js.map +1 -0
  397. package/lib/packlets/runtime/validate.d.ts +13 -0
  398. package/lib/packlets/runtime/validate.d.ts.map +1 -0
  399. package/lib/packlets/runtime/validate.js +49 -0
  400. package/lib/packlets/runtime/validate.js.map +1 -0
  401. package/package.json +76 -75
  402. package/lib/packlets/resources/resourceManager.d.ts +0 -104
  403. package/lib/packlets/resources/resourceManager.d.ts.map +0 -1
  404. package/lib/packlets/resources/resourceManager.js +0 -201
  405. package/lib/packlets/resources/resourceManager.js.map +0 -1
@@ -0,0 +1,65 @@
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("./common"), exports);
64
+ __exportStar(require("./json"), exports);
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/resource-json/compiled/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAI5B,0BAAO;AAFhB,2CAAyB;AACzB,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 './common';\nexport * from './json';\nexport { Convert };\n"]}
@@ -0,0 +1,204 @@
1
+ import * as Common from '../../common';
2
+ import { JsonValue } from '@fgv/ts-json-base';
3
+ /**
4
+ * Metadata for a compiled condition, containing human-readable information.
5
+ * @public
6
+ */
7
+ export interface ICompiledConditionMetadata {
8
+ /**
9
+ * The semantic key of the condition (e.g., "language=en-US").
10
+ */
11
+ key: Common.ConditionKey;
12
+ }
13
+ /**
14
+ * Metadata for a compiled condition set, containing human-readable information.
15
+ * @public
16
+ */
17
+ export interface ICompiledConditionSetMetadata {
18
+ /**
19
+ * The semantic key of the condition set (e.g., "language=en-US,territory=US").
20
+ */
21
+ key: Common.ConditionSetKey;
22
+ }
23
+ /**
24
+ * Metadata for a compiled decision, containing human-readable information.
25
+ * @public
26
+ */
27
+ export interface ICompiledDecisionMetadata {
28
+ /**
29
+ * The semantic key of the decision (e.g., "language=en-US,territory=US OR language=fr,territory=CA").
30
+ */
31
+ key: Common.DecisionKey;
32
+ }
33
+ /**
34
+ * Represents a compiled qualifier type with a name.
35
+ * @public
36
+ */
37
+ export interface ICompiledQualifierType {
38
+ /**
39
+ * The name of the qualifier type.
40
+ */
41
+ name: Common.QualifierTypeName;
42
+ }
43
+ /**
44
+ * Represents a compiled qualifier with a name and type reference.
45
+ * @public
46
+ */
47
+ export interface ICompiledQualifier {
48
+ /**
49
+ * The name of the qualifier.
50
+ */
51
+ name: Common.QualifierName;
52
+ /**
53
+ * Index reference to the qualifier type.
54
+ */
55
+ type: Common.QualifierTypeIndex;
56
+ /**
57
+ * The token used to identify the qualifier in resource names or paths.
58
+ */
59
+ defaultPriority: Common.ConditionPriority;
60
+ }
61
+ /**
62
+ * Represents a compiled resource type with a name.
63
+ * @public
64
+ */
65
+ export interface ICompiledResourceType {
66
+ /**
67
+ * The name of the resource type.
68
+ */
69
+ name: Common.ResourceTypeName;
70
+ }
71
+ /**
72
+ * Represents a compiled condition used for resource selection.
73
+ * @public
74
+ */
75
+ export interface ICompiledCondition {
76
+ /**
77
+ * Index reference to the qualifier being evaluated.
78
+ */
79
+ qualifierIndex: Common.QualifierIndex;
80
+ /**
81
+ * Optional operator to apply in the condition evaluation.
82
+ */
83
+ operator?: Common.ConditionOperator;
84
+ /**
85
+ * The value to compare against when evaluating the condition.
86
+ */
87
+ value: string;
88
+ /**
89
+ * The priority of the condition when multiple conditions match.
90
+ */
91
+ priority: Common.ConditionPriority;
92
+ /**
93
+ * Optional score to use when treating this condition as a default.
94
+ */
95
+ scoreAsDefault?: Common.QualifierMatchScore;
96
+ /**
97
+ * Optional metadata containing human-readable information about this condition.
98
+ */
99
+ metadata?: ICompiledConditionMetadata;
100
+ }
101
+ /**
102
+ * Represents a compiled set of conditions that must be satisfied together.
103
+ * @public
104
+ */
105
+ export interface ICompiledConditionSet {
106
+ /**
107
+ * Array of indices referencing the conditions in this set.
108
+ */
109
+ conditions: ReadonlyArray<Common.ConditionIndex>;
110
+ /**
111
+ * Optional metadata containing human-readable information about this condition set.
112
+ */
113
+ metadata?: ICompiledConditionSetMetadata;
114
+ }
115
+ /**
116
+ * Represents a compiled abstract decision with condition sets.
117
+ * @public
118
+ */
119
+ export interface ICompiledAbstractDecision {
120
+ /**
121
+ * Array of indices referencing the condition sets for this decision.
122
+ */
123
+ conditionSets: ReadonlyArray<Common.ConditionSetIndex>;
124
+ /**
125
+ * Optional metadata containing human-readable information about this decision.
126
+ */
127
+ metadata?: ICompiledDecisionMetadata;
128
+ }
129
+ /**
130
+ * Represents a compiled resource candidate with JSON value and merge properties.
131
+ * @public
132
+ */
133
+ export interface ICompiledCandidate {
134
+ /**
135
+ * The JSON value of the candidate.
136
+ */
137
+ json: JsonValue;
138
+ /**
139
+ * Indicates if this is a partial resource that needs to be merged.
140
+ */
141
+ isPartial: boolean;
142
+ /**
143
+ * The method to use when merging this candidate with others.
144
+ */
145
+ mergeMethod: Common.ResourceValueMergeMethod;
146
+ }
147
+ /**
148
+ * Represents a compiled resource with an identifier and associated candidates.
149
+ * @public
150
+ */
151
+ export interface ICompiledResource {
152
+ /**
153
+ * The unique identifier of the resource.
154
+ */
155
+ id: Common.ResourceId;
156
+ /**
157
+ * Index reference to the resource type of this resource.
158
+ */
159
+ type: Common.ResourceTypeIndex;
160
+ /**
161
+ * Index reference to the decision that determines when this resource applies.
162
+ */
163
+ decision: Common.DecisionIndex;
164
+ /**
165
+ * Array of candidate values for this resource.
166
+ */
167
+ candidates: ReadonlyArray<ICompiledCandidate>;
168
+ }
169
+ /**
170
+ * Represents a complete compiled collection of resources with their associated
171
+ * qualifiers, types, conditions, and decisions.
172
+ * @public
173
+ */
174
+ export interface ICompiledResourceCollection {
175
+ /**
176
+ * Array of all qualifier types in the collection.
177
+ */
178
+ qualifierTypes: ReadonlyArray<ICompiledQualifierType>;
179
+ /**
180
+ * Array of all qualifiers in the collection.
181
+ */
182
+ qualifiers: ReadonlyArray<ICompiledQualifier>;
183
+ /**
184
+ * Array of all resource types in the collection.
185
+ */
186
+ resourceTypes: ReadonlyArray<ICompiledResourceType>;
187
+ /**
188
+ * Array of all conditions in the collection.
189
+ */
190
+ conditions: ReadonlyArray<ICompiledCondition>;
191
+ /**
192
+ * Array of all condition sets in the collection.
193
+ */
194
+ conditionSets: ReadonlyArray<ICompiledConditionSet>;
195
+ /**
196
+ * Array of all decisions in the collection.
197
+ */
198
+ decisions: ReadonlyArray<ICompiledAbstractDecision>;
199
+ /**
200
+ * Array of all resources in the collection.
201
+ */
202
+ resources: ReadonlyArray<ICompiledResource>;
203
+ }
204
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../src/packlets/resource-json/compiled/json.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SA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ineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../src/packlets/resource-json/compiled/json.ts"],"names":[],"mappings":"","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 */\nimport * as Common from '../../common';\nimport { JsonValue } from '@fgv/ts-json-base';\n\n/**\n * Metadata for a compiled condition, containing human-readable information.\n * @public\n */\nexport interface ICompiledConditionMetadata {\n /**\n * The semantic key of the condition (e.g., \"language=en-US\").\n */\n key: Common.ConditionKey;\n}\n\n/**\n * Metadata for a compiled condition set, containing human-readable information.\n * @public\n */\nexport interface ICompiledConditionSetMetadata {\n /**\n * The semantic key of the condition set (e.g., \"language=en-US,territory=US\").\n */\n key: Common.ConditionSetKey;\n}\n\n/**\n * Metadata for a compiled decision, containing human-readable information.\n * @public\n */\nexport interface ICompiledDecisionMetadata {\n /**\n * The semantic key of the decision (e.g., \"language=en-US,territory=US OR language=fr,territory=CA\").\n */\n key: Common.DecisionKey;\n}\n\n/**\n * Represents a compiled qualifier type with a name.\n * @public\n */\nexport interface ICompiledQualifierType {\n /**\n * The name of the qualifier type.\n */\n name: Common.QualifierTypeName;\n}\n\n/**\n * Represents a compiled qualifier with a name and type reference.\n * @public\n */\nexport interface ICompiledQualifier {\n /**\n * The name of the qualifier.\n */\n name: Common.QualifierName;\n /**\n * Index reference to the qualifier type.\n */\n type: Common.QualifierTypeIndex;\n\n /**\n * The token used to identify the qualifier in resource names or paths.\n */\n defaultPriority: Common.ConditionPriority;\n}\n\n/**\n * Represents a compiled resource type with a name.\n * @public\n */\nexport interface ICompiledResourceType {\n /**\n * The name of the resource type.\n */\n name: Common.ResourceTypeName;\n}\n\n/**\n * Represents a compiled condition used for resource selection.\n * @public\n */\nexport interface ICompiledCondition {\n /**\n * Index reference to the qualifier being evaluated.\n */\n qualifierIndex: Common.QualifierIndex;\n /**\n * Optional operator to apply in the condition evaluation.\n */\n operator?: Common.ConditionOperator;\n /**\n * The value to compare against when evaluating the condition.\n */\n value: string;\n /**\n * The priority of the condition when multiple conditions match.\n */\n priority: Common.ConditionPriority;\n /**\n * Optional score to use when treating this condition as a default.\n */\n scoreAsDefault?: Common.QualifierMatchScore;\n /**\n * Optional metadata containing human-readable information about this condition.\n */\n metadata?: ICompiledConditionMetadata;\n}\n\n/**\n * Represents a compiled set of conditions that must be satisfied together.\n * @public\n */\nexport interface ICompiledConditionSet {\n /**\n * Array of indices referencing the conditions in this set.\n */\n conditions: ReadonlyArray<Common.ConditionIndex>;\n /**\n * Optional metadata containing human-readable information about this condition set.\n */\n metadata?: ICompiledConditionSetMetadata;\n}\n\n/**\n * Represents a compiled abstract decision with condition sets.\n * @public\n */\nexport interface ICompiledAbstractDecision {\n /**\n * Array of indices referencing the condition sets for this decision.\n */\n conditionSets: ReadonlyArray<Common.ConditionSetIndex>;\n /**\n * Optional metadata containing human-readable information about this decision.\n */\n metadata?: ICompiledDecisionMetadata;\n}\n\n/**\n * Represents a compiled resource candidate with JSON value and merge properties.\n * @public\n */\nexport interface ICompiledCandidate {\n /**\n * The JSON value of the candidate.\n */\n json: JsonValue;\n /**\n * Indicates if this is a partial resource that needs to be merged.\n */\n isPartial: boolean;\n /**\n * The method to use when merging this candidate with others.\n */\n mergeMethod: Common.ResourceValueMergeMethod;\n}\n\n/**\n * Represents a compiled resource with an identifier and associated candidates.\n * @public\n */\nexport interface ICompiledResource {\n /**\n * The unique identifier of the resource.\n */\n id: Common.ResourceId;\n\n /**\n * Index reference to the resource type of this resource.\n */\n type: Common.ResourceTypeIndex;\n\n /**\n * Index reference to the decision that determines when this resource applies.\n */\n decision: Common.DecisionIndex;\n /**\n * Array of candidate values for this resource.\n */\n candidates: ReadonlyArray<ICompiledCandidate>;\n}\n\n/**\n * Represents a complete compiled collection of resources with their associated\n * qualifiers, types, conditions, and decisions.\n * @public\n */\nexport interface ICompiledResourceCollection {\n /**\n * Array of all qualifier types in the collection.\n */\n qualifierTypes: ReadonlyArray<ICompiledQualifierType>;\n /**\n * Array of all qualifiers in the collection.\n */\n qualifiers: ReadonlyArray<ICompiledQualifier>;\n /**\n * Array of all resource types in the collection.\n */\n resourceTypes: ReadonlyArray<ICompiledResourceType>;\n /**\n * Array of all conditions in the collection.\n */\n conditions: ReadonlyArray<ICompiledCondition>;\n /**\n * Array of all condition sets in the collection.\n */\n conditionSets: ReadonlyArray<ICompiledConditionSet>;\n /**\n * Array of all decisions in the collection.\n */\n decisions: ReadonlyArray<ICompiledAbstractDecision>;\n /**\n * Array of all resources in the collection.\n */\n resources: ReadonlyArray<ICompiledResource>;\n}\n"]}
@@ -21,6 +21,11 @@ export declare const conditionSetDecl: Converter<Normalized.ConditionSetDecl>;
21
21
  * @public
22
22
  */
23
23
  export declare const looseResourceCandidateDecl: Converter<Normalized.ILooseResourceCandidateDecl>;
24
+ /**
25
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | importer resource candidate declaration}.
26
+ * @public
27
+ */
28
+ export declare const importerResourceCandidateDecl: Converter<Normalized.IImporterResourceCandidateDecl>;
24
29
  /**
25
30
  * `Converter` for a normalized {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}.
26
31
  * @public
@@ -36,6 +41,11 @@ export declare const looseResourceDecl: Converter<Normalized.ILooseResourceDecl>
36
41
  * @public
37
42
  */
38
43
  export declare const childResourceDecl: Converter<Normalized.IChildResourceDecl>;
44
+ /**
45
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IContainerContextDecl | resource context declaration}.
46
+ * @public
47
+ */
48
+ export declare const containerContextDecl: Converter<Normalized.IContainerContextDecl>;
39
49
  /**
40
50
  * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeChildNodeDecl | resource tree child node declaration}.
41
51
  * @public
@@ -51,4 +61,10 @@ export declare const resourceTreeRootDecl: Converter<Normalized.IResourceTreeRoo
51
61
  * @public
52
62
  */
53
63
  export declare const resourceCollectionDecl: Converter<Normalized.IResourceCollectionDecl>;
64
+ /**
65
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCollectionDecl | importer resource collection declaration}.
66
+ * This allows for a mix of loose and child resource declarations.
67
+ * @public
68
+ */
69
+ export declare const importerResourceCollectionDecl: Converter<Normalized.IImporterResourceCollectionDecl>;
54
70
  //# sourceMappingURL=convert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-json/convert.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAwC,MAAM,eAAe,CAAC;AAGhF,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAO/D,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,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S,CAAC,UAAU,CAAC,gBAAgB,CACoC,CAAC;AAEzG;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,CAAC,UAAU,CAAC,2BAA2B,CAQrF,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,CAAC,UAAU,CAAC,8BAA8B,CAQ3F,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,CAAC,UAAU,CAAC,2BAA2B,CAMrF,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAKnE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAInE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAKzE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,CAAC,UAAU,CAAC,0BAA0B,CActF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAKzE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,CAAC,UAAU,CAAC,uBAAuB,CAiBhF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,CAAC,UAAU,CAAC,+BAA+B,CAe9F,CAAC"}
@@ -21,7 +21,7 @@
21
21
  * SOFTWARE.
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.resourceCollectionDecl = exports.resourceTreeRootDecl = exports.resourceTreeChildNodeDecl = exports.childResourceDecl = exports.looseResourceDecl = exports.childResourceCandidateDecl = exports.looseResourceCandidateDecl = exports.conditionSetDecl = exports.childConditionDecl = exports.looseConditionDecl = void 0;
24
+ exports.importerResourceCollectionDecl = exports.resourceCollectionDecl = exports.resourceTreeRootDecl = exports.resourceTreeChildNodeDecl = exports.containerContextDecl = exports.childResourceDecl = exports.looseResourceDecl = exports.childResourceCandidateDecl = exports.importerResourceCandidateDecl = exports.looseResourceCandidateDecl = exports.conditionSetDecl = exports.childConditionDecl = exports.looseConditionDecl = void 0;
25
25
  const ts_utils_1 = require("@fgv/ts-utils");
26
26
  const common_1 = require("../common");
27
27
  const ts_json_base_1 = require("@fgv/ts-json-base");
@@ -50,7 +50,7 @@ function _isConditionSetRecord(from) {
50
50
  return (0, ts_json_base_1.isJsonObject)(from);
51
51
  }
52
52
  const conditionSetDeclFromArray = ts_utils_1.Converters.arrayOf(exports.looseConditionDecl);
53
- const conditionSetDeclFromRecord = ts_utils_1.Converters.generic((from, self, context) => {
53
+ const conditionSetDeclFromRecord = ts_utils_1.Converters.generic((from, __self, context) => {
54
54
  /* c8 ignore next 3 - this is tested but coverage is confused */
55
55
  if (!_isConditionSetRecord(from)) {
56
56
  return (0, ts_utils_1.fail)('Expected an object');
@@ -77,6 +77,18 @@ exports.looseResourceCandidateDecl = ts_utils_1.Converters.strictObject({
77
77
  isPartial: ts_utils_1.Converters.boolean.optional(),
78
78
  resourceTypeName: common_1.Convert.resourceTypeName.optional()
79
79
  });
80
+ /**
81
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | importer resource candidate declaration}.
82
+ * @public
83
+ */
84
+ exports.importerResourceCandidateDecl = ts_utils_1.Converters.strictObject({
85
+ id: common_1.Convert.resourceId.optional(),
86
+ json: ts_json_base_1.Converters.jsonObject,
87
+ conditions: exports.conditionSetDecl.optional(),
88
+ mergeMethod: common_1.Convert.resourceValueMergeMethod.optional(),
89
+ isPartial: ts_utils_1.Converters.boolean.optional(),
90
+ resourceTypeName: common_1.Convert.resourceTypeName.optional()
91
+ });
80
92
  /**
81
93
  * `Converter` for a normalized {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}.
82
94
  * @public
@@ -104,6 +116,15 @@ exports.childResourceDecl = ts_utils_1.Converters.strictObject({
104
116
  resourceTypeName: common_1.Convert.resourceTypeName,
105
117
  candidates: ts_utils_1.Converters.arrayOf(exports.childResourceCandidateDecl).optional()
106
118
  });
119
+ /**
120
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IContainerContextDecl | resource context declaration}.
121
+ * @public
122
+ */
123
+ exports.containerContextDecl = ts_utils_1.Converters.strictObject({
124
+ baseId: ts_utils_1.Converters.oneOf([common_1.Convert.resourceId, ts_utils_1.Converters.literal('')]).optional(),
125
+ conditions: exports.conditionSetDecl.optional(),
126
+ mergeMethod: common_1.Convert.resourceValueMergeMethod.optional()
127
+ });
107
128
  /**
108
129
  * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeChildNodeDecl | resource tree child node declaration}.
109
130
  * @public
@@ -119,7 +140,7 @@ exports.resourceTreeChildNodeDecl = ts_utils_1.Converters.generic((from, self, c
119
140
  * @public
120
141
  */
121
142
  exports.resourceTreeRootDecl = ts_utils_1.Converters.strictObject({
122
- baseName: common_1.Convert.resourceId.optional(),
143
+ context: exports.containerContextDecl.optional(),
123
144
  resources: ts_utils_1.Converters.recordOf(exports.childResourceDecl).optional(),
124
145
  children: ts_utils_1.Converters.recordOf(exports.resourceTreeChildNodeDecl).optional()
125
146
  });
@@ -129,11 +150,25 @@ exports.resourceTreeRootDecl = ts_utils_1.Converters.strictObject({
129
150
  */
130
151
  exports.resourceCollectionDecl = ts_utils_1.Converters.generic((from, self, context) => {
131
152
  return ts_utils_1.Converters.strictObject({
132
- baseName: common_1.Convert.resourceId.optional(),
133
- baseConditions: exports.conditionSetDecl.optional(),
153
+ context: exports.containerContextDecl.optional(),
134
154
  candidates: ts_utils_1.Converters.arrayOf(exports.looseResourceCandidateDecl).optional(),
135
155
  resources: ts_utils_1.Converters.arrayOf(exports.looseResourceDecl).optional(),
136
- collections: ts_utils_1.Converters.arrayOf(self).optional()
156
+ collections: ts_utils_1.Converters.arrayOf(self).optional(),
157
+ metadata: ts_json_base_1.Converters.jsonObject.optional()
158
+ }).convert(from, context);
159
+ });
160
+ /**
161
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCollectionDecl | importer resource collection declaration}.
162
+ * This allows for a mix of loose and child resource declarations.
163
+ * @public
164
+ */
165
+ exports.importerResourceCollectionDecl = ts_utils_1.Converters.generic((from, self, context) => {
166
+ return ts_utils_1.Converters.strictObject({
167
+ context: exports.containerContextDecl.optional(),
168
+ candidates: ts_utils_1.Converters.arrayOf(exports.importerResourceCandidateDecl).optional(),
169
+ resources: ts_utils_1.Converters.arrayOf(ts_utils_1.Converters.oneOf([exports.looseResourceDecl, exports.childResourceDecl])).optional(),
170
+ collections: ts_utils_1.Converters.arrayOf(self).optional(),
171
+ metadata: ts_json_base_1.Converters.jsonObject.optional()
137
172
  }).convert(from, context);
138
173
  });
139
174
  //# sourceMappingURL=convert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/resource-json/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAgF;AAChF,sCAAqD;AACrD,oDAA+E;AAI/E;;;GAGG;AACU,QAAA,kBAAkB,GAC7B,qBAAU,CAAC,YAAY,CAA2B;IAChD,aAAa,EAAE,gBAAa,CAAC,aAAa;IAC1C,KAAK,EAAE,qBAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,cAAc,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAEL;;;GAGG;AACU,QAAA,kBAAkB,GAC7B,qBAAU,CAAC,YAAY,CAA2B;IAChD,KAAK,EAAE,qBAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,gBAAa,CAAC,iBAAiB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5D,QAAQ,EAAE,qBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;KAC/C,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC,CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,oBAAoB,GAC/B,qBAAU,CAAC,YAAY,CAAmC;IACxD,QAAQ,EAAE,gBAAa,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC7C,SAAS,EAAE,qBAAU,CAAC,QAAQ,CAAC,yBAAiB,CAAC,CAAC,QAAQ,EAAE;IAC5D,QAAQ,EAAE,qBAAU,CAAC,QAAQ,CAAC,iCAAyB,CAAC,CAAC,QAAQ,EAAE;CACpE,CAAC,CAAC;AAEL;;;GAGG;AACU,QAAA,sBAAsB,GAAkD,qBAAU,CAAC,OAAO,CAIrG,CACE,IAAa,EACb,IAA4D,EAC5D,OAAiB,EAC2B,EAAE;IAC9C,OAAO,qBAAU,CAAC,YAAY,CAAqC;QACjE,QAAQ,EAAE,gBAAa,CAAC,UAAU,CAAC,QAAQ,EAAE;QAC7C,cAAc,EAAE,wBAAgB,CAAC,QAAQ,EAAE;QAC3C,UAAU,EAAE,qBAAU,CAAC,OAAO,CAAC,kCAA0B,CAAC,CAAC,QAAQ,EAAE;QACrE,SAAS,EAAE,qBAAU,CAAC,OAAO,CAAC,yBAAiB,CAAC,CAAC,QAAQ,EAAE;QAC3D,WAAW,EAAE,qBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;KACjD,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC,CACF,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converter, Converters, mapResults, Result, fail } from '@fgv/ts-utils';\nimport { Convert as CommonConvert } from '../common';\nimport { isJsonObject, Converters as JsonConverters } from '@fgv/ts-json-base';\nimport * as Json from './json';\nimport * as Normalized from './normalized';\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration}.\n * @public\n */\nexport const looseConditionDecl: Converter<Json.ILooseConditionDecl> =\n Converters.strictObject<Json.ILooseConditionDecl>({\n qualifierName: CommonConvert.qualifierName,\n value: Converters.string,\n operator: CommonConvert.conditionOperator.optional(),\n priority: CommonConvert.conditionPriority.optional(),\n scoreAsDefault: Converters.number.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.IChildConditionDecl | child condition declaration}.\n * @public\n */\nexport const childConditionDecl: Converter<Json.IChildConditionDecl> =\n Converters.strictObject<Json.IChildConditionDecl>({\n value: Converters.string,\n operator: CommonConvert.conditionOperator.optional(),\n priority: CommonConvert.conditionPriority.optional(),\n scoreAsDefault: Converters.number.optional()\n });\n\nfunction _isConditionSetRecord(from: unknown): from is Record<string, string | Json.IChildConditionDecl> {\n return isJsonObject(from);\n}\n\nconst conditionSetDeclFromArray: Converter<Normalized.ConditionSetDecl> =\n Converters.arrayOf(looseConditionDecl);\nconst conditionSetDeclFromRecord: Converter<Normalized.ConditionSetDecl> = Converters.generic<\n Normalized.ConditionSetDecl,\n unknown\n>(\n (\n from: unknown,\n self: Converter<Normalized.ConditionSetDecl, unknown>,\n context?: unknown\n ): Result<Normalized.ConditionSetDecl> => {\n /* c8 ignore next 3 - this is tested but coverage is confused */\n if (!_isConditionSetRecord(from)) {\n return fail('Expected an object');\n }\n return mapResults(\n Array.from(Object.entries(from)).map(([qualifierName, value]) => {\n const toConvert: Json.ILooseConditionDecl =\n typeof value === 'string' ? { qualifierName, value } : { qualifierName, ...value };\n return looseConditionDecl.convert(toConvert, context);\n })\n );\n }\n);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.ConditionSetDecl | condition set declaration}.\n * @public\n */\nexport const conditionSetDecl: Converter<Normalized.ConditionSetDecl> =\n Converters.oneOf<Normalized.ConditionSetDecl>([conditionSetDeclFromArray, conditionSetDeclFromRecord]);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.ILooseResourceCandidateDecl | loose resource candidate declaration}.\n * @public\n */\nexport const looseResourceCandidateDecl: Converter<Normalized.ILooseResourceCandidateDecl> =\n Converters.strictObject<Normalized.ILooseResourceCandidateDecl>({\n id: CommonConvert.resourceId,\n json: JsonConverters.jsonObject,\n conditions: conditionSetDecl.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional(),\n isPartial: Converters.boolean.optional(),\n resourceTypeName: CommonConvert.resourceTypeName.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}.\n * @public\n */\nexport const childResourceCandidateDecl: Converter<Normalized.IChildResourceCandidateDecl> =\n Converters.strictObject<Normalized.IChildResourceCandidateDecl>({\n json: JsonConverters.jsonObject,\n conditions: conditionSetDecl.optional(),\n isPartial: Converters.boolean.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.ILooseResourceDecl | loose resource declaration}.\n * @public\n */\nexport const looseResourceDecl: Converter<Normalized.ILooseResourceDecl> =\n Converters.strictObject<Normalized.ILooseResourceDecl>({\n id: CommonConvert.resourceId,\n resourceTypeName: CommonConvert.resourceTypeName,\n candidates: Converters.arrayOf(childResourceCandidateDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IChildResourceDecl | child resource declaration}.\n * @public\n */\nexport const childResourceDecl: Converter<Normalized.IChildResourceDecl> =\n Converters.strictObject<Normalized.IChildResourceDecl>({\n resourceTypeName: CommonConvert.resourceTypeName,\n candidates: Converters.arrayOf(childResourceCandidateDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeChildNodeDecl | resource tree child node declaration}.\n * @public\n */\nexport const resourceTreeChildNodeDecl: Converter<Normalized.IResourceTreeChildNodeDecl> = Converters.generic<\n Normalized.IResourceTreeChildNodeDecl,\n unknown\n>(\n (\n from: unknown,\n self: Converter<Normalized.IResourceTreeChildNodeDecl, unknown>,\n context?: unknown\n ): Result<Normalized.IResourceTreeChildNodeDecl> => {\n return Converters.strictObject<Normalized.IResourceTreeChildNodeDecl>({\n resources: Converters.recordOf(childResourceDecl).optional(),\n children: Converters.recordOf(self).optional()\n }).convert(from, context);\n }\n);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeRootDecl | resource tree root declaration}.\n * @public\n */\nexport const resourceTreeRootDecl: Converter<Normalized.IResourceTreeRootDecl> =\n Converters.strictObject<Normalized.IResourceTreeRootDecl>({\n baseName: CommonConvert.resourceId.optional(),\n resources: Converters.recordOf(childResourceDecl).optional(),\n children: Converters.recordOf(resourceTreeChildNodeDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceCollectionDecl | resource collection declaration}.\n * @public\n */\nexport const resourceCollectionDecl: Converter<Normalized.IResourceCollectionDecl> = Converters.generic<\n Normalized.IResourceCollectionDecl,\n unknown\n>(\n (\n from: unknown,\n self: Converter<Normalized.IResourceCollectionDecl, unknown>,\n context?: unknown\n ): Result<Normalized.IResourceCollectionDecl> => {\n return Converters.strictObject<Normalized.IResourceCollectionDecl>({\n baseName: CommonConvert.resourceId.optional(),\n baseConditions: conditionSetDecl.optional(),\n candidates: Converters.arrayOf(looseResourceCandidateDecl).optional(),\n resources: Converters.arrayOf(looseResourceDecl).optional(),\n collections: Converters.arrayOf(self).optional()\n }).convert(from, context);\n }\n);\n"]}
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/resource-json/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAgF;AAChF,sCAAqD;AACrD,oDAA+E;AAI/E;;;GAGG;AACU,QAAA,kBAAkB,GAC7B,qBAAU,CAAC,YAAY,CAA2B;IAChD,aAAa,EAAE,gBAAa,CAAC,aAAa;IAC1C,KAAK,EAAE,qBAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,cAAc,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAEL;;;GAGG;AACU,QAAA,kBAAkB,GAC7B,qBAAU,CAAC,YAAY,CAA2B;IAChD,KAAK,EAAE,qBAAU,CAAC,MAAM;IACxB,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,QAAQ,EAAE,gBAAa,CAAC,iBAAiB,CAAC,QAAQ,EAAE;IACpD,cAAc,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAEL,SAAS,qBAAqB,CAAC,IAAa;IAC1C,OAAO,IAAA,2BAAY,EAAC,IAAI,CAAC,CAAC;AA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,SAAS,EAAE,qBAAU,CAAC,OAAO,CAAC,yBAAiB,CAAC,CAAC,QAAQ,EAAE;QAC3D,WAAW,EAAE,qBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAChD,QAAQ,EAAE,yBAAc,CAAC,UAAU,CAAC,QAAQ,EAAE;KAC/C,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC,CACF,CAAC;AAEF;;;;GAIG;AACU,QAAA,8BAA8B,GACzC,qBAAU,CAAC,OAAO,CAChB,CACE,IAAa,EACb,IAAoE,EACpE,OAAiB,EACmC,EAAE;IACtD,OAAO,qBAAU,CAAC,YAAY,CAA6C;QACzE,OAAO,EAAE,4BAAoB,CAAC,QAAQ,EAAE;QACxC,UAAU,EAAE,qBAAU,CAAC,OAAO,CAAC,qCAA6B,CAAC,CAAC,QAAQ,EAAE;QACxE,SAAS,EAAE,qBAAU,CAAC,OAAO,CAAC,qBAAU,CAAC,KAAK,CAAC,CAAC,yBAAiB,EAAE,yBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAClG,WAAW,EAAE,qBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAChD,QAAQ,EAAE,yBAAc,CAAC,UAAU,CAAC,QAAQ,EAAE;KAC/C,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC,CACF,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converter, Converters, mapResults, Result, fail } from '@fgv/ts-utils';\nimport { Convert as CommonConvert } from '../common';\nimport { isJsonObject, Converters as JsonConverters } from '@fgv/ts-json-base';\nimport * as Json from './json';\nimport * as Normalized from './normalized';\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration}.\n * @public\n */\nexport const looseConditionDecl: Converter<Json.ILooseConditionDecl> =\n Converters.strictObject<Json.ILooseConditionDecl>({\n qualifierName: CommonConvert.qualifierName,\n value: Converters.string,\n operator: CommonConvert.conditionOperator.optional(),\n priority: CommonConvert.conditionPriority.optional(),\n scoreAsDefault: Converters.number.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.IChildConditionDecl | child condition declaration}.\n * @public\n */\nexport const childConditionDecl: Converter<Json.IChildConditionDecl> =\n Converters.strictObject<Json.IChildConditionDecl>({\n value: Converters.string,\n operator: CommonConvert.conditionOperator.optional(),\n priority: CommonConvert.conditionPriority.optional(),\n scoreAsDefault: Converters.number.optional()\n });\n\nfunction _isConditionSetRecord(from: unknown): from is Record<string, string | Json.IChildConditionDecl> {\n return isJsonObject(from);\n}\n\nconst conditionSetDeclFromArray: Converter<Normalized.ConditionSetDecl> =\n Converters.arrayOf(looseConditionDecl);\nconst conditionSetDeclFromRecord: Converter<Normalized.ConditionSetDecl> = Converters.generic<\n Normalized.ConditionSetDecl,\n unknown\n>(\n (\n from: unknown,\n __self: Converter<Normalized.ConditionSetDecl, unknown>,\n context?: unknown\n ): Result<Normalized.ConditionSetDecl> => {\n /* c8 ignore next 3 - this is tested but coverage is confused */\n if (!_isConditionSetRecord(from)) {\n return fail('Expected an object');\n }\n return mapResults(\n Array.from(Object.entries(from)).map(([qualifierName, value]) => {\n const toConvert: Json.ILooseConditionDecl =\n typeof value === 'string' ? { qualifierName, value } : { qualifierName, ...value };\n return looseConditionDecl.convert(toConvert, context);\n })\n );\n }\n);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.ConditionSetDecl | condition set declaration}.\n * @public\n */\nexport const conditionSetDecl: Converter<Normalized.ConditionSetDecl> =\n Converters.oneOf<Normalized.ConditionSetDecl>([conditionSetDeclFromArray, conditionSetDeclFromRecord]);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.ILooseResourceCandidateDecl | loose resource candidate declaration}.\n * @public\n */\nexport const looseResourceCandidateDecl: Converter<Normalized.ILooseResourceCandidateDecl> =\n Converters.strictObject<Normalized.ILooseResourceCandidateDecl>({\n id: CommonConvert.resourceId,\n json: JsonConverters.jsonObject,\n conditions: conditionSetDecl.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional(),\n isPartial: Converters.boolean.optional(),\n resourceTypeName: CommonConvert.resourceTypeName.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCandidateDecl | importer resource candidate declaration}.\n * @public\n */\nexport const importerResourceCandidateDecl: Converter<Normalized.IImporterResourceCandidateDecl> =\n Converters.strictObject<Normalized.IImporterResourceCandidateDecl>({\n id: CommonConvert.resourceId.optional(),\n json: JsonConverters.jsonObject,\n conditions: conditionSetDecl.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional(),\n isPartial: Converters.boolean.optional(),\n resourceTypeName: CommonConvert.resourceTypeName.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}.\n * @public\n */\nexport const childResourceCandidateDecl: Converter<Normalized.IChildResourceCandidateDecl> =\n Converters.strictObject<Normalized.IChildResourceCandidateDecl>({\n json: JsonConverters.jsonObject,\n conditions: conditionSetDecl.optional(),\n isPartial: Converters.boolean.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.ILooseResourceDecl | loose resource declaration}.\n * @public\n */\nexport const looseResourceDecl: Converter<Normalized.ILooseResourceDecl> =\n Converters.strictObject<Normalized.ILooseResourceDecl>({\n id: CommonConvert.resourceId,\n resourceTypeName: CommonConvert.resourceTypeName,\n candidates: Converters.arrayOf(childResourceCandidateDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IChildResourceDecl | child resource declaration}.\n * @public\n */\nexport const childResourceDecl: Converter<Normalized.IChildResourceDecl> =\n Converters.strictObject<Normalized.IChildResourceDecl>({\n resourceTypeName: CommonConvert.resourceTypeName,\n candidates: Converters.arrayOf(childResourceCandidateDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IContainerContextDecl | resource context declaration}.\n * @public\n */\nexport const containerContextDecl: Converter<Normalized.IContainerContextDecl> =\n Converters.strictObject<Normalized.IContainerContextDecl>({\n baseId: Converters.oneOf([CommonConvert.resourceId, Converters.literal('')]).optional(),\n conditions: conditionSetDecl.optional(),\n mergeMethod: CommonConvert.resourceValueMergeMethod.optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeChildNodeDecl | resource tree child node declaration}.\n * @public\n */\nexport const resourceTreeChildNodeDecl: Converter<Normalized.IResourceTreeChildNodeDecl> = Converters.generic<\n Normalized.IResourceTreeChildNodeDecl,\n unknown\n>(\n (\n from: unknown,\n self: Converter<Normalized.IResourceTreeChildNodeDecl, unknown>,\n context?: unknown\n ): Result<Normalized.IResourceTreeChildNodeDecl> => {\n return Converters.strictObject<Normalized.IResourceTreeChildNodeDecl>({\n resources: Converters.recordOf(childResourceDecl).optional(),\n children: Converters.recordOf(self).optional()\n }).convert(from, context);\n }\n);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeRootDecl | resource tree root declaration}.\n * @public\n */\nexport const resourceTreeRootDecl: Converter<Normalized.IResourceTreeRootDecl> =\n Converters.strictObject<Normalized.IResourceTreeRootDecl>({\n context: containerContextDecl.optional(),\n resources: Converters.recordOf(childResourceDecl).optional(),\n children: Converters.recordOf(resourceTreeChildNodeDecl).optional()\n });\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceCollectionDecl | resource collection declaration}.\n * @public\n */\nexport const resourceCollectionDecl: Converter<Normalized.IResourceCollectionDecl> = Converters.generic<\n Normalized.IResourceCollectionDecl,\n unknown\n>(\n (\n from: unknown,\n self: Converter<Normalized.IResourceCollectionDecl, unknown>,\n context?: unknown\n ): Result<Normalized.IResourceCollectionDecl> => {\n return Converters.strictObject<Normalized.IResourceCollectionDecl>({\n context: containerContextDecl.optional(),\n candidates: Converters.arrayOf(looseResourceCandidateDecl).optional(),\n resources: Converters.arrayOf(looseResourceDecl).optional(),\n collections: Converters.arrayOf(self).optional(),\n metadata: JsonConverters.jsonObject.optional()\n }).convert(from, context);\n }\n);\n\n/**\n * `Converter` for a normalized {@link ResourceJson.Normalized.IImporterResourceCollectionDecl | importer resource collection declaration}.\n * This allows for a mix of loose and child resource declarations.\n * @public\n */\nexport const importerResourceCollectionDecl: Converter<Normalized.IImporterResourceCollectionDecl> =\n Converters.generic<Normalized.IImporterResourceCollectionDecl, unknown>(\n (\n from: unknown,\n self: Converter<Normalized.IImporterResourceCollectionDecl, unknown>,\n context?: unknown\n ): Result<Normalized.IImporterResourceCollectionDecl> => {\n return Converters.strictObject<Normalized.IImporterResourceCollectionDecl>({\n context: containerContextDecl.optional(),\n candidates: Converters.arrayOf(importerResourceCandidateDecl).optional(),\n resources: Converters.arrayOf(Converters.oneOf([looseResourceDecl, childResourceDecl])).optional(),\n collections: Converters.arrayOf(self).optional(),\n metadata: JsonConverters.jsonObject.optional()\n }).convert(from, context);\n }\n );\n"]}
@@ -8,10 +8,24 @@ import * as Json from './json';
8
8
  export interface IDeclarationOptions {
9
9
  /**
10
10
  * If `true`, properties with default values will be included in the
11
- * output. IF omitted or `false`, properties with default values will be omitted.
11
+ * output. If omitted or `false`, properties with default values will be omitted.
12
12
  */
13
13
  showDefaults?: boolean;
14
+ /**
15
+ * If `true`, the output will be normalized using hash-based ordering for consistent structure.
16
+ * If omitted or `false`, no normalization will be applied. Defaults to `false`.
17
+ */
18
+ normalized?: boolean;
14
19
  }
20
+ /**
21
+ * Helper method to merge a resource context declaration with a parent name and conditions.
22
+ * @param decl - The resource context declaration to merge.
23
+ * @param parentName - The name of the parent resource.
24
+ * @param parentConditions - The conditions of the parent resource.
25
+ * @returns `Success` with the merged resource context declaration if successful, otherwise `Failure`.
26
+ * @public
27
+ */
28
+ export declare function mergeContextDecl(decl?: Normalized.IContainerContextDecl, parentName?: string, parentConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.IContainerContextDecl>;
15
29
  /**
16
30
  * Helper method to merge a loose candidate with a base name and conditions.
17
31
  * @param candidate - The candidate to merge.
@@ -20,7 +34,34 @@ export interface IDeclarationOptions {
20
34
  * @returns `Success` with the merged candidate if successful, otherwise `Failure`.
21
35
  * @public
22
36
  */
23
- export declare function mergeLooseCandidate(candidate: Normalized.ILooseResourceCandidateDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.ILooseResourceCandidateDecl>;
37
+ export declare function mergeLooseCandidate(candidate: Normalized.IImporterResourceCandidateDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.ILooseResourceCandidateDecl>;
38
+ /**
39
+ * Helper method to merge a resource candidate with a base name and conditions from import context.
40
+ * This function enables name inheritance for resource candidates, similar to resources.
41
+ *
42
+ * @param candidate - The candidate to merge. Can have an optional ID that will be joined with baseName.
43
+ * @param baseName - The base name from import context to merge with the candidate.
44
+ * When provided, this will be used as the parent component of the candidate ID.
45
+ * @param baseConditions - The base conditions from import context to merge with the candidate's conditions.
46
+ * @returns `Success` with the merged candidate if successful, otherwise `Failure`.
47
+ *
48
+ * @remarks
49
+ * This function supports name inheritance for candidates:
50
+ * - Joins baseName with candidate's existing ID using dot notation
51
+ * - If candidate has no ID, uses baseName as the full ID
52
+ * - Always merges base conditions with candidate's existing conditions
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Candidate inherits full name from import context
57
+ * const candidate = { value: "Hello", conditions: [...] }; // No id field
58
+ * const result = mergeImporterCandidate(candidate, "pages.home.greeting", []);
59
+ * // Result: { id: "pages.home.greeting", value: "Hello", conditions: [...] }
60
+ * ```
61
+ *
62
+ * @public
63
+ */
64
+ export declare function mergeImporterCandidate(candidate: Normalized.IImporterResourceCandidateDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.IImporterResourceCandidateDecl>;
24
65
  /**
25
66
  * Helper method to merge a child candidate with base conditions.
26
67
  * @param candidate - The candidate to merge.
@@ -37,11 +78,49 @@ export declare function mergeChildCandidate(candidate: Normalized.IChildResource
37
78
  * @returns `Success` with the merged resource if successful, otherwise `Failure`.
38
79
  * @public
39
80
  */
40
- export declare function mergeLooseResource(resource: Normalized.ILooseResourceDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.ILooseResourceDecl>;
81
+ export declare function mergeLooseResource(resource: Normalized.IImporterResourceDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.ILooseResourceDecl>;
82
+ /**
83
+ * Helper method to merge a resource with a base name and conditions from import context.
84
+ * This function enables name inheritance where resources can automatically inherit their
85
+ * resource ID from the import context when no explicit ID is provided in the resource declaration.
86
+ *
87
+ * @param resource - The resource to merge. Can be either a loose resource (with optional ID)
88
+ * or a child resource (without ID).
89
+ * @param baseName - The base name from import context to merge with the resource.
90
+ * When provided, this will be used as the parent component of the resource ID.
91
+ * @param baseConditions - The base conditions from import context to merge with the resource's conditions.
92
+ * @returns `Success` with the merged resource if successful, otherwise `Failure`.
93
+ *
94
+ * @remarks
95
+ * This function supports several scenarios for name inheritance:
96
+ * - **Explicit ID + Base Name**: Joins baseName.resourceId (e.g., "pages.home" + "greeting" = "pages.home.greeting")
97
+ * - **No ID + Base Name**: Uses baseName as the resource ID (enables name inheritance from import context)
98
+ * - **Explicit ID + No Base Name**: Uses the resource's existing ID
99
+ * - **No ID + No Base Name**: Returns resource without ID (for child resources)
100
+ *
101
+ * Base conditions are always merged with the resource's existing conditions.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * // Resource without ID inherits name from import context
106
+ * const resource = { candidates: [...] }; // No id field
107
+ * const result = mergeImporterResource(resource, "pages.home", []);
108
+ * // Result: { id: "pages.home", candidates: [...] }
109
+ *
110
+ * // Resource with ID gets joined with base name
111
+ * const resource = { id: "greeting", candidates: [...] };
112
+ * const result = mergeImporterResource(resource, "pages.home", []);
113
+ * // Result: { id: "pages.home.greeting", candidates: [...] }
114
+ * ```
115
+ *
116
+ * @public
117
+ */
118
+ export declare function mergeImporterResource(resource: Normalized.IImporterResourceDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl>): Result<Normalized.IImporterResourceDecl>;
41
119
  /**
42
120
  * Helper method to merge a child resource with a parent name and conditions.
43
121
  * @param resource - The resource to merge.
44
122
  * @param name - The name of the resource.
123
+ *
45
124
  * @param parentName - The name of the parent resource.
46
125
  * @param parentConditions - The conditions of the parent resource.
47
126
  * @returns `Success` with the merged resource if successful, otherwise `Failure`.
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-json/helpers.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAc,MAAM,EAAW,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK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