@fgv/ts-res 5.0.0-8 → 5.0.1-0

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 (377) hide show
  1. package/CHANGELOG.json +21 -0
  2. package/CHANGELOG.md +14 -1
  3. package/README.md +794 -137
  4. package/dist/ts-res.d.ts +2533 -334
  5. package/dist/tsdoc-metadata.json +1 -1
  6. package/eslint.config.js +16 -0
  7. package/lib/index.d.ts +4 -1
  8. package/lib/index.js +8 -1
  9. package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
  10. package/lib/packlets/bundle/bundleBuilder.js +134 -0
  11. package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
  12. package/lib/packlets/bundle/bundleLoader.js +105 -0
  13. package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
  14. package/lib/packlets/bundle/bundleNormalizer.js +142 -0
  15. package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
  16. package/lib/packlets/bundle/bundleUtils.js +117 -0
  17. package/lib/packlets/bundle/convert.d.ts +33 -0
  18. package/lib/packlets/bundle/convert.js +78 -0
  19. package/lib/packlets/bundle/index.d.ts +21 -0
  20. package/lib/packlets/bundle/index.js +83 -0
  21. package/lib/packlets/bundle/model.d.ts +100 -0
  22. package/lib/packlets/bundle/model.js +24 -0
  23. package/lib/packlets/common/convert.d.ts +15 -0
  24. package/lib/packlets/common/convert.js +16 -1
  25. package/lib/packlets/common/helpers/context.js +1 -0
  26. package/lib/packlets/common/helpers/resources.d.ts +7 -0
  27. package/lib/packlets/common/helpers/resources.js +13 -0
  28. package/lib/packlets/common/resources.d.ts +40 -1
  29. package/lib/packlets/common/validate/conditions.d.ts +17 -1
  30. package/lib/packlets/common/validate/conditions.js +32 -6
  31. package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
  32. package/lib/packlets/common/validate/regularExpressions.js +5 -1
  33. package/lib/packlets/common/validate/resources.d.ts +35 -1
  34. package/lib/packlets/common/validate/resources.js +55 -0
  35. package/lib/packlets/conditions/condition.js +1 -0
  36. package/lib/packlets/conditions/conditionSet.d.ts +9 -0
  37. package/lib/packlets/conditions/conditionSet.js +75 -1
  38. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  39. package/lib/packlets/config/configInitFactory.js +302 -0
  40. package/lib/packlets/config/convert.d.ts +9 -0
  41. package/lib/packlets/config/convert.js +12 -1
  42. package/lib/packlets/config/index.d.ts +1 -0
  43. package/lib/packlets/config/index.js +1 -0
  44. package/lib/packlets/config/json.d.ts +1 -1
  45. package/lib/packlets/config/systemConfiguration.d.ts +16 -3
  46. package/lib/packlets/config/systemConfiguration.js +19 -40
  47. package/lib/packlets/import/fsItem.d.ts +2 -1
  48. package/lib/packlets/import/fsItem.js +9 -13
  49. package/lib/packlets/import/importManager.d.ts +2 -1
  50. package/lib/packlets/import/importers/jsonImporter.js +1 -0
  51. package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
  52. package/lib/packlets/import/importers/pathImporter.js +2 -1
  53. package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
  54. package/lib/packlets/qualifier-types/config/convert.js +67 -2
  55. package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
  56. package/lib/packlets/qualifier-types/config/json.js +11 -0
  57. package/lib/packlets/qualifier-types/convert.d.ts +1 -1
  58. package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
  59. package/lib/packlets/qualifier-types/helpers.js +2 -2
  60. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
  61. package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
  62. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
  63. package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
  64. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
  65. package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
  66. package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
  67. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
  68. package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
  69. package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
  70. package/lib/packlets/resource-json/compiled/convert.js +2 -1
  71. package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
  72. package/lib/packlets/resource-types/config/convert.d.ts +1 -1
  73. package/lib/packlets/resource-types/config/convert.js +3 -1
  74. package/lib/packlets/resource-types/config/json.d.ts +3 -1
  75. package/lib/packlets/resource-types/jsonResourceType.d.ts +10 -1
  76. package/lib/packlets/resource-types/jsonResourceType.js +7 -3
  77. package/lib/packlets/resource-types/resourceType.d.ts +100 -8
  78. package/lib/packlets/resource-types/resourceType.js +39 -3
  79. package/lib/packlets/resources/candidateReducer.js +3 -0
  80. package/lib/packlets/resources/candidateValue.d.ts +92 -0
  81. package/lib/packlets/resources/candidateValue.js +128 -0
  82. package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
  83. package/lib/packlets/resources/candidateValueCollector.js +96 -0
  84. package/lib/packlets/resources/common.d.ts +14 -0
  85. package/lib/packlets/resources/index.d.ts +2 -0
  86. package/lib/packlets/resources/index.js +2 -0
  87. package/lib/packlets/resources/resource.d.ts +6 -6
  88. package/lib/packlets/resources/resource.js +5 -10
  89. package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
  90. package/lib/packlets/resources/resourceBuilder.js +4 -1
  91. package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
  92. package/lib/packlets/resources/resourceCandidate.js +17 -5
  93. package/lib/packlets/resources/resourceManagerBuilder.d.ts +142 -11
  94. package/lib/packlets/resources/resourceManagerBuilder.js +314 -45
  95. package/lib/packlets/runtime/compiledResourceCollection.d.ts +23 -11
  96. package/lib/packlets/runtime/compiledResourceCollection.js +65 -28
  97. package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
  98. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
  99. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
  100. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
  101. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
  102. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
  103. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
  104. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
  105. package/lib/packlets/runtime/iResourceManager.d.ts +13 -5
  106. package/lib/packlets/runtime/index.d.ts +1 -0
  107. package/lib/packlets/runtime/index.js +1 -0
  108. package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
  109. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
  110. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
  111. package/lib/packlets/runtime/resourceResolver.d.ts +39 -1
  112. package/lib/packlets/runtime/resourceResolver.js +50 -28
  113. package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
  114. package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
  115. package/lib/packlets/runtime/validate.js +1 -0
  116. package/lib/packlets/zip-archive/convert.d.ts +52 -0
  117. package/lib/packlets/zip-archive/convert.js +103 -0
  118. package/lib/packlets/zip-archive/index.d.ts +23 -0
  119. package/lib/packlets/zip-archive/index.js +95 -0
  120. package/lib/packlets/zip-archive/json.d.ts +64 -0
  121. package/lib/packlets/zip-archive/json.js +24 -0
  122. package/lib/packlets/zip-archive/types.d.ts +98 -0
  123. package/lib/packlets/zip-archive/types.js +39 -0
  124. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
  125. package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
  126. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
  127. package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
  128. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
  129. package/lib/packlets/zip-archive/zipArchiveLoader.js +286 -0
  130. package/package.json +26 -32
  131. package/CLAUDE.md +0 -186
  132. package/EXAMPLE_INIT_PARAMS.md +0 -88
  133. package/PROGRESS_SUMMARY.md +0 -48
  134. package/lib/index.d.ts.map +0 -1
  135. package/lib/index.js.map +0 -1
  136. package/lib/packlets/common/conditions.d.ts.map +0 -1
  137. package/lib/packlets/common/conditions.js.map +0 -1
  138. package/lib/packlets/common/convert.d.ts.map +0 -1
  139. package/lib/packlets/common/convert.js.map +0 -1
  140. package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
  141. package/lib/packlets/common/helpers/conditions.js.map +0 -1
  142. package/lib/packlets/common/helpers/context.d.ts.map +0 -1
  143. package/lib/packlets/common/helpers/context.js.map +0 -1
  144. package/lib/packlets/common/helpers/index.d.ts.map +0 -1
  145. package/lib/packlets/common/helpers/index.js.map +0 -1
  146. package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
  147. package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
  148. package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
  149. package/lib/packlets/common/helpers/resources.js.map +0 -1
  150. package/lib/packlets/common/index.d.ts.map +0 -1
  151. package/lib/packlets/common/index.js.map +0 -1
  152. package/lib/packlets/common/resources.d.ts.map +0 -1
  153. package/lib/packlets/common/resources.js.map +0 -1
  154. package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
  155. package/lib/packlets/common/validate/conditions.js.map +0 -1
  156. package/lib/packlets/common/validate/index.d.ts.map +0 -1
  157. package/lib/packlets/common/validate/index.js.map +0 -1
  158. package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
  159. package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
  160. package/lib/packlets/common/validate/resources.d.ts.map +0 -1
  161. package/lib/packlets/common/validate/resources.js.map +0 -1
  162. package/lib/packlets/conditions/condition.d.ts.map +0 -1
  163. package/lib/packlets/conditions/condition.js.map +0 -1
  164. package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
  165. package/lib/packlets/conditions/conditionCollector.js.map +0 -1
  166. package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
  167. package/lib/packlets/conditions/conditionDecls.js.map +0 -1
  168. package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
  169. package/lib/packlets/conditions/conditionSet.js.map +0 -1
  170. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
  171. package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
  172. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
  173. package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
  174. package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
  175. package/lib/packlets/conditions/conditionToken.js.map +0 -1
  176. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
  177. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
  178. package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
  179. package/lib/packlets/conditions/convert/decls.js.map +0 -1
  180. package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
  181. package/lib/packlets/conditions/convert/index.js.map +0 -1
  182. package/lib/packlets/conditions/index.d.ts.map +0 -1
  183. package/lib/packlets/conditions/index.js.map +0 -1
  184. package/lib/packlets/config/common.d.ts.map +0 -1
  185. package/lib/packlets/config/common.js.map +0 -1
  186. package/lib/packlets/config/convert.d.ts.map +0 -1
  187. package/lib/packlets/config/convert.js.map +0 -1
  188. package/lib/packlets/config/index.d.ts.map +0 -1
  189. package/lib/packlets/config/index.js.map +0 -1
  190. package/lib/packlets/config/json.d.ts.map +0 -1
  191. package/lib/packlets/config/json.js.map +0 -1
  192. package/lib/packlets/config/predefined/default.d.ts.map +0 -1
  193. package/lib/packlets/config/predefined/default.js.map +0 -1
  194. package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
  195. package/lib/packlets/config/predefined/extended.js.map +0 -1
  196. package/lib/packlets/config/predefined/index.d.ts.map +0 -1
  197. package/lib/packlets/config/predefined/index.js.map +0 -1
  198. package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
  199. package/lib/packlets/config/systemConfiguration.js.map +0 -1
  200. package/lib/packlets/context/contextDecls.d.ts.map +0 -1
  201. package/lib/packlets/context/contextDecls.js.map +0 -1
  202. package/lib/packlets/context/contextToken.d.ts.map +0 -1
  203. package/lib/packlets/context/contextToken.js.map +0 -1
  204. package/lib/packlets/context/convert/decls.d.ts.map +0 -1
  205. package/lib/packlets/context/convert/decls.js.map +0 -1
  206. package/lib/packlets/context/convert/index.d.ts.map +0 -1
  207. package/lib/packlets/context/convert/index.js.map +0 -1
  208. package/lib/packlets/context/index.d.ts.map +0 -1
  209. package/lib/packlets/context/index.js.map +0 -1
  210. package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
  211. package/lib/packlets/decisions/abstractDecision.js.map +0 -1
  212. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
  213. package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
  214. package/lib/packlets/decisions/candidate.d.ts.map +0 -1
  215. package/lib/packlets/decisions/candidate.js.map +0 -1
  216. package/lib/packlets/decisions/common.d.ts.map +0 -1
  217. package/lib/packlets/decisions/common.js.map +0 -1
  218. package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
  219. package/lib/packlets/decisions/concreteDecision.js.map +0 -1
  220. package/lib/packlets/decisions/decision.d.ts.map +0 -1
  221. package/lib/packlets/decisions/decision.js.map +0 -1
  222. package/lib/packlets/decisions/index.d.ts.map +0 -1
  223. package/lib/packlets/decisions/index.js.map +0 -1
  224. package/lib/packlets/import/fsItem.d.ts.map +0 -1
  225. package/lib/packlets/import/fsItem.js.map +0 -1
  226. package/lib/packlets/import/importContext.d.ts.map +0 -1
  227. package/lib/packlets/import/importContext.js.map +0 -1
  228. package/lib/packlets/import/importManager.d.ts.map +0 -1
  229. package/lib/packlets/import/importManager.js.map +0 -1
  230. package/lib/packlets/import/importable.d.ts.map +0 -1
  231. package/lib/packlets/import/importable.js.map +0 -1
  232. package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
  233. package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
  234. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
  235. package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
  236. package/lib/packlets/import/importers/importer.d.ts.map +0 -1
  237. package/lib/packlets/import/importers/importer.js.map +0 -1
  238. package/lib/packlets/import/importers/index.d.ts.map +0 -1
  239. package/lib/packlets/import/importers/index.js.map +0 -1
  240. package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
  241. package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
  242. package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
  243. package/lib/packlets/import/importers/pathImporter.js.map +0 -1
  244. package/lib/packlets/import/index.d.ts.map +0 -1
  245. package/lib/packlets/import/index.js.map +0 -1
  246. package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
  247. package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
  248. package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
  249. package/lib/packlets/qualifier-types/config/index.js.map +0 -1
  250. package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
  251. package/lib/packlets/qualifier-types/config/json.js.map +0 -1
  252. package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
  253. package/lib/packlets/qualifier-types/convert.js.map +0 -1
  254. package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
  255. package/lib/packlets/qualifier-types/helpers.js.map +0 -1
  256. package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
  257. package/lib/packlets/qualifier-types/index.js.map +0 -1
  258. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
  259. package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
  260. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
  261. package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
  262. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
  263. package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
  264. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
  265. package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
  266. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
  267. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
  268. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
  269. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
  270. package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
  271. package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
  272. package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
  273. package/lib/packlets/qualifiers/convert/index.js.map +0 -1
  274. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
  275. package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
  276. package/lib/packlets/qualifiers/index.d.ts.map +0 -1
  277. package/lib/packlets/qualifiers/index.js.map +0 -1
  278. package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
  279. package/lib/packlets/qualifiers/qualifier.js.map +0 -1
  280. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
  281. package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
  282. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
  283. package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
  284. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
  285. package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
  286. package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
  287. package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
  288. package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
  289. package/lib/packlets/resource-json/compiled/common.js.map +0 -1
  290. package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
  291. package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
  292. package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
  293. package/lib/packlets/resource-json/compiled/index.js.map +0 -1
  294. package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
  295. package/lib/packlets/resource-json/compiled/json.js.map +0 -1
  296. package/lib/packlets/resource-json/convert.d.ts.map +0 -1
  297. package/lib/packlets/resource-json/convert.js.map +0 -1
  298. package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
  299. package/lib/packlets/resource-json/helpers.js.map +0 -1
  300. package/lib/packlets/resource-json/index.d.ts.map +0 -1
  301. package/lib/packlets/resource-json/index.js.map +0 -1
  302. package/lib/packlets/resource-json/json.d.ts.map +0 -1
  303. package/lib/packlets/resource-json/json.js.map +0 -1
  304. package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
  305. package/lib/packlets/resource-json/normalized.js.map +0 -1
  306. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
  307. package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
  308. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
  309. package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
  310. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
  311. package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
  312. package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
  313. package/lib/packlets/resource-types/config/convert.js.map +0 -1
  314. package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
  315. package/lib/packlets/resource-types/config/index.js.map +0 -1
  316. package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
  317. package/lib/packlets/resource-types/config/json.js.map +0 -1
  318. package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
  319. package/lib/packlets/resource-types/helpers.js.map +0 -1
  320. package/lib/packlets/resource-types/index.d.ts.map +0 -1
  321. package/lib/packlets/resource-types/index.js.map +0 -1
  322. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
  323. package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
  324. package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
  325. package/lib/packlets/resource-types/resourceType.js.map +0 -1
  326. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
  327. package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
  328. package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
  329. package/lib/packlets/resources/candidateReducer.js.map +0 -1
  330. package/lib/packlets/resources/common.d.ts.map +0 -1
  331. package/lib/packlets/resources/common.js.map +0 -1
  332. package/lib/packlets/resources/index.d.ts.map +0 -1
  333. package/lib/packlets/resources/index.js.map +0 -1
  334. package/lib/packlets/resources/resource.d.ts.map +0 -1
  335. package/lib/packlets/resources/resource.js.map +0 -1
  336. package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
  337. package/lib/packlets/resources/resourceBuilder.js.map +0 -1
  338. package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
  339. package/lib/packlets/resources/resourceCandidate.js.map +0 -1
  340. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
  341. package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
  342. package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
  343. package/lib/packlets/runtime/cacheListener.js.map +0 -1
  344. package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
  345. package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
  346. package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
  347. package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
  348. package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
  349. package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
  350. package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
  351. package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
  352. package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
  353. package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
  354. package/lib/packlets/runtime/context/index.d.ts.map +0 -1
  355. package/lib/packlets/runtime/context/index.js.map +0 -1
  356. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
  357. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
  358. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
  359. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
  360. package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
  361. package/lib/packlets/runtime/iResourceManager.js.map +0 -1
  362. package/lib/packlets/runtime/index.d.ts.map +0 -1
  363. package/lib/packlets/runtime/index.js.map +0 -1
  364. package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
  365. package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
  366. package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
  367. package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
  368. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
  369. package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
  370. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
  371. package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
  372. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
  373. package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
  374. package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
  375. package/lib/packlets/runtime/resourceResolver.js.map +0 -1
  376. package/lib/packlets/runtime/validate.d.ts.map +0 -1
  377. package/lib/packlets/runtime/validate.js.map +0 -1
@@ -1,8 +1,9 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
2
+ import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore, QualifierTypeName } from '../common';
3
3
  import { QualifierType } from './qualifierType';
4
- import { LiteralValueHierarchy, LiteralValueHierarchyDecl } from './literalValueHierarchy';
4
+ import { LiteralValueHierarchy } from './literalValueHierarchy';
5
5
  import * as Config from './config';
6
+ import { JsonCompatible } from '@fgv/ts-json-base';
6
7
  /**
7
8
  * Interface defining the parameters that can be used to create a new
8
9
  * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
@@ -29,10 +30,10 @@ export interface ILiteralQualifierTypeCreateParams {
29
30
  */
30
31
  enumeratedValues?: ReadonlyArray<string>;
31
32
  /**
32
- * Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
33
+ * Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
33
34
  * of literal values to use for matching. If not provided, no hierarchy will be used.
34
35
  */
35
- hierarchy?: LiteralValueHierarchyDecl<string>;
36
+ hierarchy?: Config.LiteralValueHierarchyDecl<string>;
36
37
  /**
37
38
  * Global index for this qualifier type.
38
39
  */
@@ -43,7 +44,11 @@ export interface ILiteralQualifierTypeCreateParams {
43
44
  * optionally case-sensitive or matching against an ordered list of values at runtime.
44
45
  * @public
45
46
  */
46
- export declare class LiteralQualifierType extends QualifierType {
47
+ export declare class LiteralQualifierType extends QualifierType<JsonCompatible<Config.ILiteralQualifierTypeConfig>> {
48
+ /**
49
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
50
+ */
51
+ readonly systemTypeName: QualifierTypeName;
47
52
  /**
48
53
  * Indicates whether the qualifier match is case-sensitive.
49
54
  */
@@ -79,6 +84,27 @@ export declare class LiteralQualifierType extends QualifierType {
79
84
  * {@inheritdoc QualifierTypes.IQualifierType.isPotentialMatch}
80
85
  */
81
86
  isPotentialMatch(conditionValue: string, contextValue: string): boolean;
87
+ /**
88
+ * Gets a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
89
+ * for this qualifier type.
90
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
91
+ */
92
+ getConfiguration(): Result<Config.ISystemLiteralQualifierTypeConfig>;
93
+ /**
94
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
95
+ */
96
+ getConfigurationJson(): Result<JsonCompatible<Config.ISystemLiteralQualifierTypeConfig>>;
97
+ /**
98
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
99
+ */
100
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.ISystemLiteralQualifierTypeConfig>>;
101
+ /**
102
+ * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
103
+ * for this qualifier type.
104
+ * @param from - The unknown data to validate as a configuration object.
105
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
106
+ */
107
+ validateConfiguration(from: unknown): Result<Config.ISystemLiteralQualifierTypeConfig>;
82
108
  /**
83
109
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
84
110
  */
@@ -20,12 +20,46 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
23
56
  Object.defineProperty(exports, "__esModule", { value: true });
24
57
  exports.LiteralQualifierType = void 0;
25
58
  const ts_utils_1 = require("@fgv/ts-utils");
26
59
  const common_1 = require("../common");
27
60
  const qualifierType_1 = require("./qualifierType");
28
61
  const literalValueHierarchy_1 = require("./literalValueHierarchy");
62
+ const Config = __importStar(require("./config"));
29
63
  const ts_json_base_1 = require("@fgv/ts-json-base");
30
64
  /**
31
65
  * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value,
@@ -49,6 +83,10 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
49
83
  allowContextList,
50
84
  index: index !== undefined ? common_1.Convert.qualifierTypeIndex.convert(index).orThrow() : undefined
51
85
  });
86
+ /**
87
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
88
+ */
89
+ this.systemTypeName = common_1.Convert.qualifierTypeName.convert('literal').orThrow();
52
90
  this.caseSensitive = caseSensitive === true;
53
91
  this.enumeratedValues = enumeratedValues
54
92
  ? (0, ts_utils_1.mapResults)(Array.from(enumeratedValues).map(LiteralQualifierType.toLiteralConditionValue)).orThrow()
@@ -91,6 +129,43 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
91
129
  }
92
130
  return false;
93
131
  }
132
+ /**
133
+ * Gets a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
134
+ * for this qualifier type.
135
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
136
+ */
137
+ getConfiguration() {
138
+ return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemLiteralQualifierTypeConfig.convert(json));
139
+ }
140
+ /**
141
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
142
+ */
143
+ getConfigurationJson() {
144
+ const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
145
+ const enumeratedValues = this.enumeratedValues
146
+ ? { enumeratedValues: [...this.enumeratedValues] }
147
+ : {};
148
+ return (0, ts_utils_1.succeed)({
149
+ name: this.name,
150
+ systemType: 'literal',
151
+ configuration: Object.assign(Object.assign({ allowContextList: this.allowContextList, caseSensitive: this.caseSensitive }, enumeratedValues), hierarchy)
152
+ });
153
+ }
154
+ /**
155
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
156
+ */
157
+ validateConfigurationJson(from) {
158
+ return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
159
+ }
160
+ /**
161
+ * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
162
+ * for this qualifier type.
163
+ * @param from - The unknown data to validate as a configuration object.
164
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
165
+ */
166
+ validateConfiguration(from) {
167
+ return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
168
+ }
94
169
  /**
95
170
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
96
171
  */
@@ -1,15 +1,6 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
3
- /**
4
- * Declares a hierarchy of literal values. The keys are the names of the values, and the
5
- * values are the names of their parents.
6
- * @remarks
7
- * The hierarchy is defined as a tree, where each value can have multiple children but
8
- * only one parent. The root of the tree has no parent. The hierarchy is used to
9
- * determine the relationship between values when matching conditions and contexts.
10
- * @public
11
- */
12
- export type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;
3
+ import { LiteralValueHierarchyDecl } from './config';
13
4
  /**
14
5
  * Describes a single valid literal value including optional parent and child values.
15
6
  * @public
@@ -26,7 +17,7 @@ export interface ILiteralValue<T extends string> {
26
17
  */
27
18
  export interface ILiteralValueHierarchyCreateParams<T extends string = string> {
28
19
  values: ReadonlyArray<T>;
29
- hierarchy?: LiteralValueHierarchyDecl<T>;
20
+ hierarchy?: Partial<LiteralValueHierarchyDecl<T>>;
30
21
  }
31
22
  /**
32
23
  * A class that implements a hierarchy of literal values. The hierarchy is defined as a
@@ -110,5 +101,10 @@ export declare class LiteralValueHierarchy<T extends string = string> {
110
101
  */
111
102
  match(condition: QualifierConditionValue, context: QualifierContextValue, __operator?: ConditionOperator): QualifierMatchScore;
112
103
  protected static _buildValuesFromHierarchy<T extends string>(params: ILiteralValueHierarchyCreateParams<T>): Result<ReadonlyMap<T, ILiteralValue<T>>>;
104
+ /**
105
+ * Converts the hierarchy to a record of parent-child relationships.
106
+ * @returns A record of parent-child relationships.
107
+ */
108
+ asRecord(): Record<string, string>;
113
109
  }
114
110
  //# sourceMappingURL=literalValueHierarchy.d.ts.map
@@ -79,7 +79,7 @@ class LiteralValueHierarchy {
79
79
  */
80
80
  getAncestors(value) {
81
81
  const current = this.values.get(value);
82
- /* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
82
+ /* c8 ignore next 3 - functional error case tested but coverage intermittently missed */
83
83
  if (!current) {
84
84
  return (0, ts_utils_1.fail)(`${value}: not found in hierarchy`);
85
85
  }
@@ -102,6 +102,7 @@ class LiteralValueHierarchy {
102
102
  if (ancestors.isSuccess()) {
103
103
  return ancestors.value.includes(possibleAncestor);
104
104
  }
105
+ /* c8 ignore next 1 - edge case: ancestor validation fallback */
105
106
  return false;
106
107
  }
107
108
  /**
@@ -223,6 +224,16 @@ class LiteralValueHierarchy {
223
224
  }
224
225
  return errors.returnOrReport((0, ts_utils_1.succeed)(valueMap));
225
226
  }
227
+ /**
228
+ * Converts the hierarchy to a record of parent-child relationships.
229
+ * @returns A record of parent-child relationships.
230
+ */
231
+ asRecord() {
232
+ const entries = Array.from(this.values.values())
233
+ .filter((v) => v.parent !== undefined)
234
+ .map((v) => [v.name, v.parent.name]);
235
+ return Object.fromEntries(entries);
236
+ }
226
237
  }
227
238
  exports.LiteralValueHierarchy = LiteralValueHierarchy;
228
239
  //# sourceMappingURL=literalValueHierarchy.js.map
@@ -1,16 +1,22 @@
1
1
  import { Collections, ICollectible, Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore, QualifierTypeIndex, QualifierTypeName } from '../common';
3
+ import { JsonCompatible, JsonObject } from '@fgv/ts-json-base';
4
+ import * as Config from './config';
3
5
  /**
4
6
  * Interface for a qualifier type. A qualifier type implements the build and
5
7
  * runtime semantics for some class of related qualifiers (e.g. language,
6
8
  * territories, etc).
7
9
  * @public
8
10
  */
9
- export interface IQualifierType extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
11
+ export interface IQualifierType<TCFGJSON extends JsonObject = JsonObject> extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
10
12
  /**
11
13
  * The name of the qualifier type.
12
14
  */
13
15
  readonly name: QualifierTypeName;
16
+ /**
17
+ * Name of the underlying system type.
18
+ */
19
+ readonly systemTypeName: QualifierTypeName;
14
20
  /**
15
21
  * Unique key for this qualifier.
16
22
  */
@@ -73,6 +79,17 @@ export interface IQualifierType extends ICollectible<QualifierTypeName, Qualifie
73
79
  * Sets the index for this qualifier type. Once set, index is immutable.
74
80
  */
75
81
  setIndex(index: number): Result<QualifierTypeIndex>;
82
+ /**
83
+ * Gets the configuration for this qualifier type.
84
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
85
+ */
86
+ getConfigurationJson(): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
87
+ /**
88
+ * Validates configuration JSON data for this qualifier type.
89
+ * @param from - The unknown data to validate as configuration JSON.
90
+ * @returns `Success` with validated JSON configuration if valid, `Failure` with an error message otherwise.
91
+ */
92
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
76
93
  }
77
94
  /**
78
95
  * Parameters used to create a base {@link QualifierTypes.QualifierType | qualifier type}.
@@ -98,11 +115,15 @@ export interface IQualifierTypeCreateParams {
98
115
  * the {@link QualifierTypes.IQualifierType | IQualifierType} interface.
99
116
  * @public
100
117
  */
101
- export declare abstract class QualifierType implements IQualifierType {
118
+ export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject> implements IQualifierType<TCFGJSON> {
102
119
  /**
103
120
  * {@inheritdoc QualifierTypes.IQualifierType.name}
104
121
  */
105
122
  readonly name: QualifierTypeName;
123
+ /**
124
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
125
+ */
126
+ abstract readonly systemTypeName: QualifierTypeName;
106
127
  /**
107
128
  * {@inheritdoc QualifierTypes.IQualifierType.key}
108
129
  */
@@ -148,6 +169,14 @@ export declare abstract class QualifierType implements IQualifierType {
148
169
  * {@inheritdoc QualifierTypes.IQualifierType.matches}
149
170
  */
150
171
  matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
172
+ /**
173
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
174
+ */
175
+ abstract getConfigurationJson(): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
176
+ /**
177
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
178
+ */
179
+ abstract validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
151
180
  /**
152
181
  * {@inheritdoc QualifierTypes.IQualifierType.setIndex}
153
182
  */
@@ -1,8 +1,9 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { QualifierConditionValue, QualifierContextValue, QualifierMatchScore, ConditionOperator } from '../common';
2
+ import { QualifierConditionValue, QualifierContextValue, QualifierMatchScore, ConditionOperator, QualifierTypeName } from '../common';
3
3
  import { QualifierType } from './qualifierType';
4
- import { LiteralValueHierarchy, LiteralValueHierarchyDecl } from './literalValueHierarchy';
4
+ import { LiteralValueHierarchy } from './literalValueHierarchy';
5
5
  import * as Config from './config';
6
+ import { JsonCompatible } from '@fgv/ts-json-base';
6
7
  /**
7
8
  * Parameters used to create a new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} instance.
8
9
  * @public
@@ -30,10 +31,10 @@ export interface ITerritoryQualifierTypeCreateParams {
30
31
  */
31
32
  acceptLowercase?: boolean;
32
33
  /**
33
- * Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
34
+ * Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
34
35
  * of territory values to use for matching. If not provided, no hierarchy will be used.
35
36
  */
36
- hierarchy?: LiteralValueHierarchyDecl<string>;
37
+ hierarchy?: Config.LiteralValueHierarchyDecl<string>;
37
38
  }
38
39
  /**
39
40
  * Qualifier type for territory values. Territories are two-letter ISO-3166-2
@@ -41,7 +42,11 @@ export interface ITerritoryQualifierTypeCreateParams {
41
42
  * implementation handles incorrect casing.
42
43
  * @public
43
44
  */
44
- export declare class TerritoryQualifierType extends QualifierType {
45
+ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible<Config.ITerritoryQualifierTypeConfig>> {
46
+ /**
47
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
48
+ */
49
+ readonly systemTypeName: QualifierTypeName;
45
50
  /**
46
51
  * Optional array enumerating allowed territories to further constrain the type.
47
52
  */
@@ -83,6 +88,27 @@ export declare class TerritoryQualifierType extends QualifierType {
83
88
  * @public
84
89
  */
85
90
  static createFromConfig(config: Config.IQualifierTypeConfig<Config.ITerritoryQualifierTypeConfig>): Result<TerritoryQualifierType>;
91
+ /**
92
+ * Gets the {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration}
93
+ * for this qualifier type.
94
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
95
+ */
96
+ getConfiguration(): Result<Config.ISystemTerritoryQualifierTypeConfig>;
97
+ /**
98
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
99
+ */
100
+ getConfigurationJson(): Result<JsonCompatible<Config.ISystemTerritoryQualifierTypeConfig>>;
101
+ /**
102
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
103
+ */
104
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.ISystemTerritoryQualifierTypeConfig>>;
105
+ /**
106
+ * Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
107
+ * for this qualifier type.
108
+ * @param from - The unknown data to validate as a configuration object.
109
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
110
+ */
111
+ validateConfiguration(from: unknown): Result<Config.ISystemTerritoryQualifierTypeConfig>;
86
112
  /**
87
113
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
88
114
  */
@@ -20,12 +20,46 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
23
56
  Object.defineProperty(exports, "__esModule", { value: true });
24
57
  exports.TerritoryQualifierType = void 0;
25
58
  const ts_utils_1 = require("@fgv/ts-utils");
26
59
  const common_1 = require("../common");
27
60
  const qualifierType_1 = require("./qualifierType");
28
61
  const literalValueHierarchy_1 = require("./literalValueHierarchy");
62
+ const Config = __importStar(require("./config"));
29
63
  const ts_json_base_1 = require("@fgv/ts-json-base");
30
64
  /**
31
65
  * Qualifier type for territory values. Territories are two-letter ISO-3166-2
@@ -51,6 +85,12 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
51
85
  allowContextList,
52
86
  index: validIndex
53
87
  });
88
+ /**
89
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
90
+ */
91
+ this.systemTypeName = common_1.Convert.qualifierTypeName
92
+ .convert('territory')
93
+ .orThrow();
54
94
  this.allowedTerritories = validTerritories;
55
95
  this.acceptLowercase = acceptLowercase === true;
56
96
  if (hierarchy) {
@@ -66,6 +106,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
66
106
  */
67
107
  isValidConditionValue(value) {
68
108
  const normalized = this.acceptLowercase ? value.toUpperCase() : value;
109
+ /* c8 ignore next 6 - edge case: invalid territory values and allowed territory filtering rarely hit */
69
110
  if (!TerritoryQualifierType.isValidTerritoryConditionValue(normalized)) {
70
111
  return false;
71
112
  }
@@ -106,6 +147,43 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
106
147
  hierarchy: territoryConfig.hierarchy
107
148
  }).onSuccess(TerritoryQualifierType.create);
108
149
  }
150
+ /**
151
+ * Gets the {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration}
152
+ * for this qualifier type.
153
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
154
+ */
155
+ getConfiguration() {
156
+ return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
157
+ }
158
+ /**
159
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
160
+ */
161
+ getConfigurationJson() {
162
+ const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
163
+ const allowedTerritories = this.allowedTerritories
164
+ ? { allowedTerritories: [...this.allowedTerritories] }
165
+ : {};
166
+ return (0, ts_utils_1.succeed)({
167
+ name: this.name,
168
+ systemType: 'territory',
169
+ configuration: Object.assign(Object.assign({ allowContextList: this.allowContextList, acceptLowercase: this.acceptLowercase }, allowedTerritories), hierarchy)
170
+ });
171
+ }
172
+ /**
173
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
174
+ */
175
+ validateConfigurationJson(from) {
176
+ return Config.Convert.systemTerritoryQualifierTypeConfig.convert(from);
177
+ }
178
+ /**
179
+ * Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
180
+ * for this qualifier type.
181
+ * @param from - The unknown data to validate as a configuration object.
182
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
183
+ */
184
+ validateConfiguration(from) {
185
+ return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
186
+ }
109
187
  /**
110
188
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
111
189
  */
@@ -117,6 +195,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
117
195
  if (normalizedCondition === normalizedContext) {
118
196
  return common_1.PerfectMatch;
119
197
  }
198
+ /* c8 ignore next 8 - edge case: hierarchy matching and fallback logic rarely used */
120
199
  if (this.hierarchy) {
121
200
  return this.hierarchy.match(normalizedCondition, normalizedContext, __operator);
122
201
  }
@@ -132,6 +211,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
132
211
  * @public
133
212
  */
134
213
  static isValidTerritoryConditionValue(value, acceptLowercase) {
214
+ /* c8 ignore next 3 - edge case: lowercase validation rarely fails */
135
215
  if (acceptLowercase !== true && value !== value.toUpperCase()) {
136
216
  return false;
137
217
  }
@@ -144,12 +144,11 @@ class QualifierCollector extends ts_utils_1.ValidatingConvertingCollector {
144
144
  return convert_1.validatedQualifierDecl
145
145
  .convert(decl, convertContext)
146
146
  .onSuccess((validated) => {
147
+ /* c8 ignore next 9 - coverage intermittently misses this block */
147
148
  if (this.hasNameOrToken(validated.token)) {
148
- /* c8 ignore next 3 - functional error case tested but coverage intermittently missed */
149
149
  return (0, ts_utils_1.fail)(`Qualifier token '${validated.token}' is not unique or collides with name`);
150
150
  }
151
151
  else if (this.hasNameOrToken(validated.name)) {
152
- /* c8 ignore next 4 - functional error case tested but coverage intermittently missed */
153
152
  return (0, ts_utils_1.fail)(`Qualifier name '${validated.name}' is not unique or collides with token`);
154
153
  }
155
154
  return (0, ts_utils_1.succeed)(validated);
@@ -136,7 +136,7 @@ exports.compiledAbstractDecision = ts_utils_1.Converters.strictObject({
136
136
  * @public
137
137
  */
138
138
  exports.compiledCandidate = ts_utils_1.Converters.strictObject({
139
- json: ts_json_base_1.Converters.jsonValue,
139
+ valueIndex: Common.Convert.candidateValueIndex,
140
140
  isPartial: ts_utils_1.Converters.boolean,
141
141
  mergeMethod: Common.Convert.resourceValueMergeMethod
142
142
  });
@@ -162,6 +162,7 @@ exports.compiledResourceCollection = ts_utils_1.Converters.strictObject({
162
162
  conditions: ts_utils_1.Converters.arrayOf(exports.compiledCondition),
163
163
  conditionSets: ts_utils_1.Converters.arrayOf(exports.compiledConditionSet),
164
164
  decisions: ts_utils_1.Converters.arrayOf(exports.compiledAbstractDecision),
165
+ candidateValues: ts_utils_1.Converters.arrayOf(ts_json_base_1.Converters.jsonValue),
165
166
  resources: ts_utils_1.Converters.arrayOf(exports.compiledResource)
166
167
  });
167
168
  //# sourceMappingURL=convert.js.map
@@ -132,9 +132,9 @@ export interface ICompiledAbstractDecision {
132
132
  */
133
133
  export interface ICompiledCandidate {
134
134
  /**
135
- * The JSON value of the candidate.
135
+ * The global index of the JSON value of the candidate.
136
136
  */
137
- json: JsonValue;
137
+ valueIndex: Common.CandidateValueIndex;
138
138
  /**
139
139
  * Indicates if this is a partial resource that needs to be merged.
140
140
  */
@@ -196,6 +196,10 @@ export interface ICompiledResourceCollection {
196
196
  * Array of all decisions in the collection.
197
197
  */
198
198
  decisions: ReadonlyArray<ICompiledAbstractDecision>;
199
+ /**
200
+ * Array of all candidate values in the collection.
201
+ */
202
+ candidateValues: ReadonlyArray<JsonValue>;
199
203
  /**
200
204
  * Array of all resources in the collection.
201
205
  */
@@ -4,5 +4,5 @@ import { IResourceTypeConfig } from './json';
4
4
  * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
5
5
  * @public
6
6
  */
7
- export declare const resourceTypeConfig: import("@fgv/ts-utils").ObjectConverter<IResourceTypeConfig, unknown>;
7
+ export declare const resourceTypeConfig: import("@fgv/ts-utils").ObjectConverter<IResourceTypeConfig<import("@fgv/ts-json-base").JsonObject>, unknown>;
8
8
  //# sourceMappingURL=convert.d.ts.map
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.resourceTypeConfig = void 0;
25
25
  /* eslint-disable @rushstack/typedef-var */
26
26
  const ts_utils_1 = require("@fgv/ts-utils");
27
+ const ts_json_base_1 = require("@fgv/ts-json-base");
27
28
  /**
28
29
  * A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
29
30
  * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
@@ -31,6 +32,7 @@ const ts_utils_1 = require("@fgv/ts-utils");
31
32
  */
32
33
  exports.resourceTypeConfig = ts_utils_1.Converters.strictObject({
33
34
  name: ts_utils_1.Converters.string,
34
- typeName: ts_utils_1.Converters.string
35
+ typeName: ts_utils_1.Converters.string,
36
+ template: ts_json_base_1.Converters.jsonObject.optional()
35
37
  });
36
38
  //# sourceMappingURL=convert.js.map
@@ -1,9 +1,11 @@
1
+ import { JsonObject } from '@fgv/ts-json-base';
1
2
  /**
2
3
  * Configuration for a {@link ResourceTypes.ResourceType | resource type}.
3
4
  * @public
4
5
  */
5
- export interface IResourceTypeConfig {
6
+ export interface IResourceTypeConfig<T extends JsonObject = JsonObject> {
6
7
  name: string;
7
8
  typeName: string;
9
+ template?: T;
8
10
  }
9
11
  //# sourceMappingURL=json.d.ts.map
@@ -17,19 +17,28 @@ export interface IJsonResourceTypeCreateParams {
17
17
  * instance.
18
18
  */
19
19
  index?: number;
20
+ /**
21
+ * Optional template for new instances of {@link ResourceTypes.JsonResourceType | JsonResourceType}
22
+ * resources.
23
+ */
24
+ template?: JsonObject;
20
25
  }
21
26
  /**
22
27
  * Implementation of a {@link ResourceTypes.ResourceType | ResourceType} for JSON values.
23
28
  * @public
24
29
  */
25
30
  export declare class JsonResourceType extends ResourceType<JsonObject> {
31
+ /**
32
+ * {@inheritdoc ResourceTypes.ResourceType.systemTypeName}
33
+ */
34
+ readonly systemTypeName: ResourceTypeName;
26
35
  /**
27
36
  * Protected {@link ResourceTypes.JsonResourceType | JsonResourceType} constructor for use by subclasses.
28
37
  * Use {@link ResourceTypes.JsonResourceType.create | JsonResourceType.create} to create a new instance.
29
38
  * @param key - The key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
30
39
  * @param index - Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
31
40
  */
32
- protected constructor(key: ResourceTypeName, index?: number);
41
+ protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject);
33
42
  /**
34
43
  * Factory method to create a new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
35
44
  * @param params - {@link ResourceTypes.IJsonResourceTypeCreateParams | Parameters} to create the new instance.
@@ -37,8 +37,12 @@ class JsonResourceType extends resourceType_1.ResourceType {
37
37
  * @param key - The key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
38
38
  * @param index - Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
39
39
  */
40
- constructor(key, index) {
41
- super(key, index);
40
+ constructor(key, index, template) {
41
+ super(key, index, template);
42
+ /**
43
+ * {@inheritdoc ResourceTypes.ResourceType.systemTypeName}
44
+ */
45
+ this.systemTypeName = common_1.Convert.resourceTypeName.convert('json').orThrow();
42
46
  }
43
47
  /**
44
48
  * Factory method to create a new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
@@ -49,7 +53,7 @@ class JsonResourceType extends resourceType_1.ResourceType {
49
53
  static create(params) {
50
54
  var _a;
51
55
  return common_1.Convert.resourceTypeName.convert((_a = params === null || params === void 0 ? void 0 : params.key) !== null && _a !== void 0 ? _a : 'json').onSuccess((key) => {
52
- return (0, ts_utils_1.captureResult)(() => new JsonResourceType(key, params === null || params === void 0 ? void 0 : params.index));
56
+ return (0, ts_utils_1.captureResult)(() => new JsonResourceType(key, params === null || params === void 0 ? void 0 : params.index, params === null || params === void 0 ? void 0 : params.template));
53
57
  });
54
58
  }
55
59
  /**