@fgv/ts-res 4.5.0-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 (293) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/dist/ts-res.d.ts +4282 -0
  4. package/dist/tsdoc-metadata.json +11 -0
  5. package/lib/index.d.ts +12 -0
  6. package/lib/index.d.ts.map +1 -0
  7. package/lib/index.js +79 -0
  8. package/lib/index.js.map +1 -0
  9. package/lib/packlets/common/conditions.d.ts +148 -0
  10. package/lib/packlets/common/conditions.d.ts.map +1 -0
  11. package/lib/packlets/common/conditions.js +50 -0
  12. package/lib/packlets/common/conditions.js.map +1 -0
  13. package/lib/packlets/common/convert.d.ts +111 -0
  14. package/lib/packlets/common/convert.d.ts.map +1 -0
  15. package/lib/packlets/common/convert.js +173 -0
  16. package/lib/packlets/common/convert.js.map +1 -0
  17. package/lib/packlets/common/helpers/conditions.d.ts +39 -0
  18. package/lib/packlets/common/helpers/conditions.d.ts.map +1 -0
  19. package/lib/packlets/common/helpers/conditions.js +105 -0
  20. package/lib/packlets/common/helpers/conditions.js.map +1 -0
  21. package/lib/packlets/common/helpers/index.d.ts +3 -0
  22. package/lib/packlets/common/helpers/index.d.ts.map +1 -0
  23. package/lib/packlets/common/helpers/index.js +40 -0
  24. package/lib/packlets/common/helpers/index.js.map +1 -0
  25. package/lib/packlets/common/helpers/resources.d.ts +34 -0
  26. package/lib/packlets/common/helpers/resources.d.ts.map +1 -0
  27. package/lib/packlets/common/helpers/resources.js +81 -0
  28. package/lib/packlets/common/helpers/resources.js.map +1 -0
  29. package/lib/packlets/common/index.d.ts +7 -0
  30. package/lib/packlets/common/index.d.ts.map +1 -0
  31. package/lib/packlets/common/index.js +69 -0
  32. package/lib/packlets/common/index.js.map +1 -0
  33. package/lib/packlets/common/resources.d.ts +41 -0
  34. package/lib/packlets/common/resources.d.ts.map +1 -0
  35. package/lib/packlets/common/resources.js +30 -0
  36. package/lib/packlets/common/resources.js.map +1 -0
  37. package/lib/packlets/common/validate/conditions.d.ts +248 -0
  38. package/lib/packlets/common/validate/conditions.d.ts.map +1 -0
  39. package/lib/packlets/common/validate/conditions.js +436 -0
  40. package/lib/packlets/common/validate/conditions.js.map +1 -0
  41. package/lib/packlets/common/validate/index.d.ts +5 -0
  42. package/lib/packlets/common/validate/index.d.ts.map +1 -0
  43. package/lib/packlets/common/validate/index.js +65 -0
  44. package/lib/packlets/common/validate/index.js.map +1 -0
  45. package/lib/packlets/common/validate/regularExpressions.d.ts +39 -0
  46. package/lib/packlets/common/validate/regularExpressions.d.ts.map +1 -0
  47. package/lib/packlets/common/validate/regularExpressions.js +63 -0
  48. package/lib/packlets/common/validate/regularExpressions.js.map +1 -0
  49. package/lib/packlets/common/validate/resources.d.ts +97 -0
  50. package/lib/packlets/common/validate/resources.d.ts.map +1 -0
  51. package/lib/packlets/common/validate/resources.js +171 -0
  52. package/lib/packlets/common/validate/resources.js.map +1 -0
  53. package/lib/packlets/conditions/condition.d.ts +91 -0
  54. package/lib/packlets/conditions/condition.d.ts.map +1 -0
  55. package/lib/packlets/conditions/condition.js +146 -0
  56. package/lib/packlets/conditions/condition.js.map +1 -0
  57. package/lib/packlets/conditions/conditionCollector.d.ts +54 -0
  58. package/lib/packlets/conditions/conditionCollector.d.ts.map +1 -0
  59. package/lib/packlets/conditions/conditionCollector.js +72 -0
  60. package/lib/packlets/conditions/conditionCollector.js.map +1 -0
  61. package/lib/packlets/conditions/conditionDecls.d.ts +26 -0
  62. package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -0
  63. package/lib/packlets/conditions/conditionDecls.js +24 -0
  64. package/lib/packlets/conditions/conditionDecls.js.map +1 -0
  65. package/lib/packlets/conditions/conditionSet.d.ts +99 -0
  66. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -0
  67. package/lib/packlets/conditions/conditionSet.js +164 -0
  68. package/lib/packlets/conditions/conditionSet.js.map +1 -0
  69. package/lib/packlets/conditions/conditionSetCollector.d.ts +65 -0
  70. package/lib/packlets/conditions/conditionSetCollector.d.ts.map +1 -0
  71. package/lib/packlets/conditions/conditionSetCollector.js +90 -0
  72. package/lib/packlets/conditions/conditionSetCollector.js.map +1 -0
  73. package/lib/packlets/conditions/conditionSetDecls.d.ts +18 -0
  74. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -0
  75. package/lib/packlets/conditions/conditionSetDecls.js +24 -0
  76. package/lib/packlets/conditions/conditionSetDecls.js.map +1 -0
  77. package/lib/packlets/conditions/conditionToken.d.ts +86 -0
  78. package/lib/packlets/conditions/conditionToken.d.ts.map +1 -0
  79. package/lib/packlets/conditions/conditionToken.js +150 -0
  80. package/lib/packlets/conditions/conditionToken.js.map +1 -0
  81. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts +24 -0
  82. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -0
  83. package/lib/packlets/conditions/convert/conditionSetDecls.js +54 -0
  84. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -0
  85. package/lib/packlets/conditions/convert/decls.d.ts +24 -0
  86. package/lib/packlets/conditions/convert/decls.d.ts.map +1 -0
  87. package/lib/packlets/conditions/convert/decls.js +111 -0
  88. package/lib/packlets/conditions/convert/decls.js.map +1 -0
  89. package/lib/packlets/conditions/convert/index.d.ts +3 -0
  90. package/lib/packlets/conditions/convert/index.d.ts.map +1 -0
  91. package/lib/packlets/conditions/convert/index.js +40 -0
  92. package/lib/packlets/conditions/convert/index.js.map +1 -0
  93. package/lib/packlets/conditions/index.d.ts +10 -0
  94. package/lib/packlets/conditions/index.d.ts.map +1 -0
  95. package/lib/packlets/conditions/index.js +70 -0
  96. package/lib/packlets/conditions/index.js.map +1 -0
  97. package/lib/packlets/decisions/abstractDecision.d.ts +39 -0
  98. package/lib/packlets/decisions/abstractDecision.d.ts.map +1 -0
  99. package/lib/packlets/decisions/abstractDecision.js +63 -0
  100. package/lib/packlets/decisions/abstractDecision.js.map +1 -0
  101. package/lib/packlets/decisions/abstractDecisionCollector.d.ts +59 -0
  102. package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +1 -0
  103. package/lib/packlets/decisions/abstractDecisionCollector.js +92 -0
  104. package/lib/packlets/decisions/abstractDecisionCollector.js.map +1 -0
  105. package/lib/packlets/decisions/candidate.d.ts +58 -0
  106. package/lib/packlets/decisions/candidate.d.ts.map +1 -0
  107. package/lib/packlets/decisions/candidate.js +80 -0
  108. package/lib/packlets/decisions/candidate.js.map +1 -0
  109. package/lib/packlets/decisions/common.d.ts +15 -0
  110. package/lib/packlets/decisions/common.d.ts.map +1 -0
  111. package/lib/packlets/decisions/common.js +24 -0
  112. package/lib/packlets/decisions/common.js.map +1 -0
  113. package/lib/packlets/decisions/concreteDecision.d.ts +74 -0
  114. package/lib/packlets/decisions/concreteDecision.d.ts.map +1 -0
  115. package/lib/packlets/decisions/concreteDecision.js +114 -0
  116. package/lib/packlets/decisions/concreteDecision.js.map +1 -0
  117. package/lib/packlets/decisions/decision.d.ts +91 -0
  118. package/lib/packlets/decisions/decision.d.ts.map +1 -0
  119. package/lib/packlets/decisions/decision.js +126 -0
  120. package/lib/packlets/decisions/decision.js.map +1 -0
  121. package/lib/packlets/decisions/index.d.ts +7 -0
  122. package/lib/packlets/decisions/index.d.ts.map +1 -0
  123. package/lib/packlets/decisions/index.js +44 -0
  124. package/lib/packlets/decisions/index.js.map +1 -0
  125. package/lib/packlets/import/fsItem.d.ts +99 -0
  126. package/lib/packlets/import/fsItem.d.ts.map +1 -0
  127. package/lib/packlets/import/fsItem.js +174 -0
  128. package/lib/packlets/import/fsItem.js.map +1 -0
  129. package/lib/packlets/import/importContext.d.ts +85 -0
  130. package/lib/packlets/import/importContext.d.ts.map +1 -0
  131. package/lib/packlets/import/importContext.js +94 -0
  132. package/lib/packlets/import/importContext.js.map +1 -0
  133. package/lib/packlets/import/importManager.d.ts +93 -0
  134. package/lib/packlets/import/importManager.d.ts.map +1 -0
  135. package/lib/packlets/import/importManager.js +133 -0
  136. package/lib/packlets/import/importManager.js.map +1 -0
  137. package/lib/packlets/import/importable.d.ts +71 -0
  138. package/lib/packlets/import/importable.d.ts.map +1 -0
  139. package/lib/packlets/import/importable.js +35 -0
  140. package/lib/packlets/import/importable.js.map +1 -0
  141. package/lib/packlets/import/importers/collectionImporter.d.ts +60 -0
  142. package/lib/packlets/import/importers/collectionImporter.d.ts.map +1 -0
  143. package/lib/packlets/import/importers/collectionImporter.js +146 -0
  144. package/lib/packlets/import/importers/collectionImporter.js.map +1 -0
  145. package/lib/packlets/import/importers/fsItemImporter.d.ts +49 -0
  146. package/lib/packlets/import/importers/fsItemImporter.d.ts.map +1 -0
  147. package/lib/packlets/import/importers/fsItemImporter.js +120 -0
  148. package/lib/packlets/import/importers/fsItemImporter.js.map +1 -0
  149. package/lib/packlets/import/importers/importer.d.ts +31 -0
  150. package/lib/packlets/import/importers/importer.d.ts.map +1 -0
  151. package/lib/packlets/import/importers/importer.js +24 -0
  152. package/lib/packlets/import/importers/importer.js.map +1 -0
  153. package/lib/packlets/import/importers/index.d.ts +6 -0
  154. package/lib/packlets/import/importers/index.d.ts.map +1 -0
  155. package/lib/packlets/import/importers/index.js +43 -0
  156. package/lib/packlets/import/importers/index.js.map +1 -0
  157. package/lib/packlets/import/importers/jsonImporter.d.ts +32 -0
  158. package/lib/packlets/import/importers/jsonImporter.d.ts.map +1 -0
  159. package/lib/packlets/import/importers/jsonImporter.js +140 -0
  160. package/lib/packlets/import/importers/jsonImporter.js.map +1 -0
  161. package/lib/packlets/import/importers/pathImporter.d.ts +61 -0
  162. package/lib/packlets/import/importers/pathImporter.d.ts.map +1 -0
  163. package/lib/packlets/import/importers/pathImporter.js +87 -0
  164. package/lib/packlets/import/importers/pathImporter.js.map +1 -0
  165. package/lib/packlets/import/index.d.ts +7 -0
  166. package/lib/packlets/import/index.d.ts.map +1 -0
  167. package/lib/packlets/import/index.js +67 -0
  168. package/lib/packlets/import/index.js.map +1 -0
  169. package/lib/packlets/qualifier-types/convert.d.ts +19 -0
  170. package/lib/packlets/qualifier-types/convert.d.ts.map +1 -0
  171. package/lib/packlets/qualifier-types/convert.js +45 -0
  172. package/lib/packlets/qualifier-types/convert.js.map +1 -0
  173. package/lib/packlets/qualifier-types/index.d.ts +8 -0
  174. package/lib/packlets/qualifier-types/index.d.ts.map +1 -0
  175. package/lib/packlets/qualifier-types/index.js +68 -0
  176. package/lib/packlets/qualifier-types/index.js.map +1 -0
  177. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +56 -0
  178. package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +1 -0
  179. package/lib/packlets/qualifier-types/languageQualifierType.js +87 -0
  180. package/lib/packlets/qualifier-types/languageQualifierType.js.map +1 -0
  181. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +92 -0
  182. package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +1 -0
  183. package/lib/packlets/qualifier-types/literalQualifierType.js +114 -0
  184. package/lib/packlets/qualifier-types/literalQualifierType.js.map +1 -0
  185. package/lib/packlets/qualifier-types/qualifierType.d.ts +184 -0
  186. package/lib/packlets/qualifier-types/qualifierType.d.ts.map +1 -0
  187. package/lib/packlets/qualifier-types/qualifierType.js +173 -0
  188. package/lib/packlets/qualifier-types/qualifierType.js.map +1 -0
  189. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts +40 -0
  190. package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +1 -0
  191. package/lib/packlets/qualifier-types/qualifierTypeCollector.js +102 -0
  192. package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +1 -0
  193. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +74 -0
  194. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +1 -0
  195. package/lib/packlets/qualifier-types/territoryQualifierType.js +113 -0
  196. package/lib/packlets/qualifier-types/territoryQualifierType.js.map +1 -0
  197. package/lib/packlets/qualifiers/convert/decls.d.ts +23 -0
  198. package/lib/packlets/qualifiers/convert/decls.d.ts.map +1 -0
  199. package/lib/packlets/qualifiers/convert/decls.js +71 -0
  200. package/lib/packlets/qualifiers/convert/decls.js.map +1 -0
  201. package/lib/packlets/qualifiers/convert/index.d.ts +3 -0
  202. package/lib/packlets/qualifiers/convert/index.d.ts.map +1 -0
  203. package/lib/packlets/qualifiers/convert/index.js +40 -0
  204. package/lib/packlets/qualifiers/convert/index.js.map +1 -0
  205. package/lib/packlets/qualifiers/convert/qualifier.d.ts +17 -0
  206. package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +1 -0
  207. package/lib/packlets/qualifiers/convert/qualifier.js +43 -0
  208. package/lib/packlets/qualifiers/convert/qualifier.js.map +1 -0
  209. package/lib/packlets/qualifiers/index.d.ts +6 -0
  210. package/lib/packlets/qualifiers/index.d.ts.map +1 -0
  211. package/lib/packlets/qualifiers/index.js +66 -0
  212. package/lib/packlets/qualifiers/index.js.map +1 -0
  213. package/lib/packlets/qualifiers/qualifier.d.ts +68 -0
  214. package/lib/packlets/qualifiers/qualifier.d.ts.map +1 -0
  215. package/lib/packlets/qualifiers/qualifier.js +87 -0
  216. package/lib/packlets/qualifiers/qualifier.js.map +1 -0
  217. package/lib/packlets/qualifiers/qualifierCollector.d.ts +90 -0
  218. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -0
  219. package/lib/packlets/qualifiers/qualifierCollector.js +157 -0
  220. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -0
  221. package/lib/packlets/qualifiers/qualifierDecl.d.ts +46 -0
  222. package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +1 -0
  223. package/lib/packlets/qualifiers/qualifierDecl.js +24 -0
  224. package/lib/packlets/qualifiers/qualifierDecl.js.map +1 -0
  225. package/lib/packlets/resource-json/convert.d.ts +54 -0
  226. package/lib/packlets/resource-json/convert.d.ts.map +1 -0
  227. package/lib/packlets/resource-json/convert.js +139 -0
  228. package/lib/packlets/resource-json/convert.js.map +1 -0
  229. package/lib/packlets/resource-json/helpers.d.ts +41 -0
  230. package/lib/packlets/resource-json/helpers.d.ts.map +1 -0
  231. package/lib/packlets/resource-json/helpers.js +96 -0
  232. package/lib/packlets/resource-json/helpers.js.map +1 -0
  233. package/lib/packlets/resource-json/index.d.ts +9 -0
  234. package/lib/packlets/resource-json/index.d.ts.map +1 -0
  235. package/lib/packlets/resource-json/index.js +72 -0
  236. package/lib/packlets/resource-json/index.js.map +1 -0
  237. package/lib/packlets/resource-json/json.d.ts +182 -0
  238. package/lib/packlets/resource-json/json.d.ts.map +1 -0
  239. package/lib/packlets/resource-json/json.js +24 -0
  240. package/lib/packlets/resource-json/json.js.map +1 -0
  241. package/lib/packlets/resource-json/normalized.d.ts +123 -0
  242. package/lib/packlets/resource-json/normalized.d.ts.map +1 -0
  243. package/lib/packlets/resource-json/normalized.js +24 -0
  244. package/lib/packlets/resource-json/normalized.js.map +1 -0
  245. package/lib/packlets/resource-json/resourceDeclCollection.d.ts +39 -0
  246. package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +1 -0
  247. package/lib/packlets/resource-json/resourceDeclCollection.js +121 -0
  248. package/lib/packlets/resource-json/resourceDeclCollection.js.map +1 -0
  249. package/lib/packlets/resource-json/resourceDeclContainer.d.ts +11 -0
  250. package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +1 -0
  251. package/lib/packlets/resource-json/resourceDeclContainer.js +24 -0
  252. package/lib/packlets/resource-json/resourceDeclContainer.js.map +1 -0
  253. package/lib/packlets/resource-json/resourceDeclTree.d.ts +39 -0
  254. package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +1 -0
  255. package/lib/packlets/resource-json/resourceDeclTree.js +122 -0
  256. package/lib/packlets/resource-json/resourceDeclTree.js.map +1 -0
  257. package/lib/packlets/resource-types/index.d.ts +4 -0
  258. package/lib/packlets/resource-types/index.d.ts.map +1 -0
  259. package/lib/packlets/resource-types/index.js +41 -0
  260. package/lib/packlets/resource-types/index.js.map +1 -0
  261. package/lib/packlets/resource-types/jsonResourceType.d.ts +65 -0
  262. package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -0
  263. package/lib/packlets/resource-types/jsonResourceType.js +63 -0
  264. package/lib/packlets/resource-types/jsonResourceType.js.map +1 -0
  265. package/lib/packlets/resource-types/resourceType.d.ts +87 -0
  266. package/lib/packlets/resource-types/resourceType.d.ts.map +1 -0
  267. package/lib/packlets/resource-types/resourceType.js +62 -0
  268. package/lib/packlets/resource-types/resourceType.js.map +1 -0
  269. package/lib/packlets/resource-types/resourceTypeCollector.d.ts +30 -0
  270. package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +1 -0
  271. package/lib/packlets/resource-types/resourceTypeCollector.js +65 -0
  272. package/lib/packlets/resource-types/resourceTypeCollector.js.map +1 -0
  273. package/lib/packlets/resources/index.d.ts +5 -0
  274. package/lib/packlets/resources/index.d.ts.map +1 -0
  275. package/lib/packlets/resources/index.js +42 -0
  276. package/lib/packlets/resources/index.js.map +1 -0
  277. package/lib/packlets/resources/resource.d.ts +75 -0
  278. package/lib/packlets/resources/resource.d.ts.map +1 -0
  279. package/lib/packlets/resources/resource.js +109 -0
  280. package/lib/packlets/resources/resource.js.map +1 -0
  281. package/lib/packlets/resources/resourceBuilder.d.ts +112 -0
  282. package/lib/packlets/resources/resourceBuilder.d.ts.map +1 -0
  283. package/lib/packlets/resources/resourceBuilder.js +162 -0
  284. package/lib/packlets/resources/resourceBuilder.js.map +1 -0
  285. package/lib/packlets/resources/resourceCandidate.d.ts +102 -0
  286. package/lib/packlets/resources/resourceCandidate.d.ts.map +1 -0
  287. package/lib/packlets/resources/resourceCandidate.js +180 -0
  288. package/lib/packlets/resources/resourceCandidate.js.map +1 -0
  289. package/lib/packlets/resources/resourceManager.d.ts +104 -0
  290. package/lib/packlets/resources/resourceManager.d.ts.map +1 -0
  291. package/lib/packlets/resources/resourceManager.js +193 -0
  292. package/lib/packlets/resources/resourceManager.js.map +1 -0
  293. package/package.json +76 -0
@@ -0,0 +1,4282 @@
1
+ import { Brand } from '@fgv/ts-utils';
2
+ import { Collections } from '@fgv/ts-utils';
3
+ import { Converter } from '@fgv/ts-utils';
4
+ import { DetailedResult } from '@fgv/ts-utils';
5
+ import { FileTree } from '@fgv/ts-utils';
6
+ import { ICollectible } from '@fgv/ts-utils';
7
+ import { JsonObject } from '@fgv/ts-json-base';
8
+ import { JsonValue } from '@fgv/ts-json-base';
9
+ import { ObjectConverter } from '@fgv/ts-utils';
10
+ import { Result } from '@fgv/ts-utils';
11
+ import { ResultMap } from '@fgv/ts-utils';
12
+ import { ValidatingCollector } from '@fgv/ts-utils';
13
+ import { ValidatingConvertingCollector } from '@fgv/ts-utils';
14
+ import { ValidatingResultMap } from '@fgv/ts-utils';
15
+
16
+ /**
17
+ * An abstract decision represents a class of decisions with candidates
18
+ * that differ only in value. It is a {@link Decisions.Decision | IDecision<number>}
19
+ * in which the `number` values are sequentially assigned indexes.
20
+ * This allows us to represent each related {@link Decisions.IDecision | decision} as an
21
+ * {@link Decisions.AbstractDecision | abstract decision} and a matching array containing
22
+ * the corresponding value for each candidate. This representation is highly cacheable.
23
+ * @public
24
+ */
25
+ declare class AbstractDecision extends Decision<number> {
26
+ /**
27
+ * Constructor for an {@link Decisions.AbstractDecision | AbstractDecision} object.
28
+ * @param params - {@link Decisions.IAbstractDecisionCreateParams | Parameters}
29
+ * used to create the decision.
30
+ * @public
31
+ */
32
+ protected constructor(params: IAbstractDecisionCreateParams);
33
+ /**
34
+ * Creates a new {@link Decisions.AbstractDecision | AbstractDecision} object.
35
+ * @param params - {@link Decisions.IAbstractDecisionCreateParams | Parameters}
36
+ * used to create the decision.
37
+ * @returns `Success` with the new decision if successful, or `Failure` with an
38
+ * error message if not.
39
+ * @public
40
+ */
41
+ static createAbstractDecision(params: IAbstractDecisionCreateParams): Result<AbstractDecision>;
42
+ }
43
+
44
+ /**
45
+ * A `ValidatingCollector` for {@link Decisions.AbstractDecision | AbstractDecisions}.
46
+ * @public
47
+ */
48
+ declare class AbstractDecisionCollector extends ValidatingCollector<AbstractDecision> {
49
+ /**
50
+ * The {@link Conditions.ReadOnlyConditionSetCollector | ConditionSetCollector} used to create conditions
51
+ * sets for decisions in this collector.
52
+ */
53
+ readonly conditionSets: ReadOnlyConditionSetCollector;
54
+ /**
55
+ * The empty decision (no condition sets) for this collector.
56
+ */
57
+ get emptyDecision(): AbstractDecision;
58
+ /**
59
+ * The default-only decision (one condition set with no conditions) for this collector.
60
+ */
61
+ get defaultOnlyDecision(): AbstractDecision;
62
+ /**
63
+ * The index for the empty decision.
64
+ */
65
+ static readonly EmptyDecisionIndex: DecisionIndex;
66
+ /**
67
+ * The index for the default-only decision.
68
+ */
69
+ static readonly DefaultOnlyDecisionIndex: DecisionIndex;
70
+ /**
71
+ * Creates a new instance of {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.
72
+ */
73
+ protected constructor(params: IAbstractDecisionCollectorCreateParams);
74
+ /**
75
+ * Creates a new instance of {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.
76
+ * @returns `Success` with the new instance, or `Failure` with an error if the instance could not be created.
77
+ */
78
+ static create(params: IAbstractDecisionCollectorCreateParams): Result<AbstractDecisionCollector>;
79
+ private _toAbstractDecision;
80
+ private _isConditionSetArray;
81
+ }
82
+
83
+ /**
84
+ * Array of all valid condition operators.
85
+ * @public
86
+ */
87
+ export declare const allConditionOperators: ConditionOperator[];
88
+
89
+ /**
90
+ * Array of all possible {@link ResourceValueMergeMethod | resource merge type} values.
91
+ * @public
92
+ */
93
+ export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
94
+
95
+ /**
96
+ * Converts an array of {@link Helpers.IConditionTokenParts | condition token parts} into an array of
97
+ * syntactically validated {@link ConditionToken | condition tokens}.
98
+ * @param parts - the parts to convert
99
+ * @public
100
+ */
101
+ declare function buildConditionSetToken(parts: ReadonlyArray<IConditionTokenParts>): Result<ConditionSetToken>;
102
+
103
+ /**
104
+ * Converts a {@link Helpers.IConditionTokenParts | the parts that make up a condition token} into
105
+ * a syntactically validated {@link ConditionToken | condition token}.
106
+ * @param parts - the parts to convert
107
+ * @public
108
+ */
109
+ declare function buildConditionToken({ qualifier, value }: IConditionTokenParts): Result<ConditionToken>;
110
+
111
+ /**
112
+ * Simple implementation of {@link Decisions.ICandidate | ICandidate} with
113
+ * helper methods for sorting and presentation.
114
+ * @public
115
+ */
116
+ declare class Candidate<TVALUE extends JsonValue = JsonValue> implements ICandidate<TVALUE> {
117
+ readonly conditionSet: ConditionSet;
118
+ readonly value: TVALUE;
119
+ readonly isPartial: boolean;
120
+ readonly mergeMethod: ResourceValueMergeMethod;
121
+ /**
122
+ * Key of the condition set for this candidate.
123
+ */
124
+ get key(): string;
125
+ /**
126
+ * Construct a new {@link Decisions.Candidate | Candidate}.
127
+ * @param params - The {@link Decisions.ICandidate | parameters} to use to create the
128
+ * new candidate.
129
+ */
130
+ protected constructor(params: ICandidate<TVALUE>);
131
+ /**
132
+ * Create a new {@link Decisions.Candidate | candidate}.
133
+ * @param params - The {@link Decisions.ICandidate | parameters} to use to create the
134
+ * new candidate.
135
+ * @returns `Success` with the new candidate if successful, or `Failure` if the
136
+ * candidate could not be created.
137
+ */
138
+ static createCandidate<TVALUE extends JsonValue>(params: ICandidate<TVALUE>): Result<Candidate<TVALUE>>;
139
+ /**
140
+ * Compare two {@link Decisions.ICandidate | candidates} for sorting purposes.
141
+ * @param c1 - The first candidate to compare.
142
+ * @param c2 - The second candidate to compare.
143
+ * @returns A negative number if c1 should come before c2, a positive number if c1 should
144
+ * come after c2, or zero if they are equivalent.
145
+ */
146
+ static compare(c1: ICandidate, c2: ICandidate): number;
147
+ /**
148
+ * Returns a string representation of the {@link Decisions.Candidate | candidate}.
149
+ * @returns A string representation of this candidate.
150
+ */
151
+ toString(): string;
152
+ }
153
+
154
+ /**
155
+ * `Converter` for a normalized {@link ResourceJson.Json.IChildConditionDecl | child condition declaration}.
156
+ * @public
157
+ */
158
+ declare const childConditionDecl: Converter<Json.IChildConditionDecl>;
159
+
160
+ /**
161
+ * `Converter` for a normalized {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}.
162
+ * @public
163
+ */
164
+ declare const childResourceCandidateDecl: Converter<Normalized.IChildResourceCandidateDecl>;
165
+
166
+ /**
167
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IChildResourceDecl | child resource declaration}.
168
+ * @public
169
+ */
170
+ declare const childResourceDecl: Converter<Normalized.IChildResourceDecl>;
171
+
172
+ /**
173
+ * {@link Import.Importers.IImporter | Importer} implementation which imports
174
+ * a {@link ResourceJson.ResourceDeclCollection | resource collection} or
175
+ * {@link ResourceJson.ResourceDeclTree | resource tree} from an importable item.
176
+ * @public
177
+ */
178
+ declare class CollectionImporter implements IImporter {
179
+ /**
180
+ * {@inheritdoc Import.Importers.IImporter.types}
181
+ */
182
+ readonly types: string[];
183
+ /**
184
+ * Protected {@link Import.Importers.CollectionImporter | CollectionImporter} constructor for derived classes
185
+ */
186
+ protected constructor();
187
+ /**
188
+ * Creates a new {@link Import.Importers.CollectionImporter | CollectionImporter} instance.
189
+ * @returns `Success` with the new {@link Import.Importers.CollectionImporter | CollectionImporter} if successful,
190
+ * `Failure` o4
191
+ *
192
+ * therwise.
193
+ */
194
+ static create(): Result<CollectionImporter>;
195
+ /**
196
+ * {@inheritdoc Import.Importers.IImporter.import}
197
+ */
198
+ import(item: IImportable, manager: ResourceManager): DetailedResult<IImportable[], ImporterResultDetail>;
199
+ /**
200
+ * Adds a {@link ResourceJson.Normalized.ILooseResourceDecl | declared resource} to
201
+ * the supplied {@link Resources.ResourceManager | resource manager}, merging an
202
+ * optional {@link Import.ImportContext | import context} if provided.
203
+ * @param manager - The {@link Resources.ResourceManager | resource manager} to which
204
+ * the resource will be added.
205
+ * @param resource - The {@link ResourceJson.Normalized.ILooseResourceDecl | resource}
206
+ * to add.
207
+ * @param context - Optional {@link Import.ImportContext | import context} to merge
208
+ * with the resource.
209
+ * @returns `Success` with the {@link Resources.ResourceBuilder | resource builder}
210
+ * for the resource if successful, `Failure` with an error message if not.
211
+ */
212
+ private _addResource;
213
+ /**
214
+ * Adds a {@link ResourceJson.Normalized.ILooseResourceCandidateDecl | declared resource candidate}
215
+ * to the supplied {@link Resources.ResourceManager | resource manager}, merging an optional
216
+ * {@link Import.ImportContext | import context} if provided.
217
+ * @param manager - The {@link Resources.ResourceManager | resource manager} to which the
218
+ * candidate will be added.
219
+ * @param candidate - The {@link ResourceJson.Normalized.ILooseResourceCandidateDecl | candidate}
220
+ * to add.
221
+ * @param context - Optional {@link Import.ImportContext | import context} to merge with the candidate.
222
+ * @returns `Success` with the {@link Resources.ResourceCandidate | resource candidate} if successful,
223
+ * `Failure` with an error message if not.
224
+ */
225
+ private _addCandidate;
226
+ }
227
+
228
+ /**
229
+ * A {@link Decisions.ConcreteDecision | concrete decision} is a {@link Decisions.IDecision | decision}
230
+ * implemented as a reference to a common {@link Decisions.AbstractDecision | abstract decision} and a list of
231
+ * values that correspond to the candidates in the abstract decision. This allows us to represent a large
232
+ * number of related decisions with a single abstract decision and a list of values.
233
+ * @public
234
+ */
235
+ declare class ConcreteDecision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {
236
+ readonly baseDecision: AbstractDecision;
237
+ readonly values: TVALUE[];
238
+ readonly candidates: ReadonlyArray<ICandidate<TVALUE>>;
239
+ /**
240
+ * Unique global key for this decision, derived from the condition set and
241
+ * candidate values.
242
+ */
243
+ get key(): DecisionKey;
244
+ /**
245
+ * Unique global index for this decision.
246
+ */
247
+ get index(): DecisionIndex | undefined;
248
+ private _collectible;
249
+ /**
250
+ * Constructor for a {@link Decisions.ConcreteDecision | ConcreteDecision} object.
251
+ * @param params - {@link Decisions.IConcreteDecisionConstructorParams | Parameters}
252
+ * used to create the decision.
253
+ * @public
254
+ */
255
+ protected constructor(params: IConcreteDecisionConstructorParams<TVALUE>);
256
+ /**
257
+ * Creates a new {@link Decisions.ConcreteDecision | ConcreteDecision} object.
258
+ * @param params - {@link Decisions.IConcreteDecisionCreateParams | Parameters}
259
+ * used to create the decision.
260
+ * @returns `Success` with the new decision if successful, or `Failure` with an
261
+ * error message if not.
262
+ * @public
263
+ */
264
+ static create<TVALUE extends JsonValue = JsonValue>(params: IConcreteDecisionCreateParams<TVALUE>): Result<ConcreteDecision<TVALUE>>;
265
+ /**
266
+ * Sets the index for this decision. Once set, index is immutable.
267
+ * @param index - The index to set.
268
+ * @returns `Success` with the new index if successful, or `Failure` with an error message if not.
269
+ */
270
+ setIndex(index: number): Result<DecisionIndex>;
271
+ }
272
+
273
+ /**
274
+ * Represents a single condition applied to some resource instance.
275
+ * @public
276
+ */
277
+ declare class Condition implements IValidatedConditionDecl {
278
+ /**
279
+ * The {@link Qualifiers.Qualifier | qualifier} used in this condition.
280
+ */
281
+ readonly qualifier: Qualifier;
282
+ /**
283
+ * The value to be matched in this condition.
284
+ */
285
+ readonly value: QualifierConditionValue;
286
+ /**
287
+ * The {@link ConditionOperator | operator} used when matching context value to condition value.
288
+ */
289
+ readonly operator: ConditionOperator;
290
+ /**
291
+ * The {@link ConditionPriority | relative priority} of this condition.
292
+ */
293
+ readonly priority: ConditionPriority;
294
+ /**
295
+ * The {@link QualifierMatchScore | score} to be used when this condition is the default.
296
+ */
297
+ readonly scoreAsDefault?: QualifierMatchScore;
298
+ protected _collectible: Collections.Collectible<ConditionKey, ConditionIndex>;
299
+ /**
300
+ * Constructs a new {@link Conditions.Condition | Condition} object.
301
+ * @param qualifier - The {@link Qualifiers.Qualifier | qualifier} used in this condition.
302
+ * @param value - The value to be matched in this condition.
303
+ * @param operator - The {@link ConditionOperator | operator} used when matching context value to condition value.
304
+ * @param priority - The {@link ConditionPriority | relative priority} of this condition.
305
+ * @public
306
+ */
307
+ protected constructor({ qualifier, value, operator, priority, scoreAsDefault, index }: IValidatedConditionDecl);
308
+ get key(): ConditionKey;
309
+ get index(): ConditionIndex | undefined;
310
+ setIndex(index: ConditionIndex): Result<ConditionIndex>;
311
+ /**
312
+ * Creates a new {@link Conditions.Condition | Condition} object from the supplied
313
+ * {@link Conditions.IValidatedConditionDecl | validated condition declaration}.
314
+ * @param decl - The {@link Conditions.IValidatedConditionDecl | validated condition declaration}
315
+ * describing the condition to create.
316
+ * @returns `Success` with the new {@link Conditions.Condition | Condition} if successful,
317
+ * `Failure` otherwise.
318
+ * @public
319
+ */
320
+ static create(decl: IValidatedConditionDecl): Result<Condition>;
321
+ /**
322
+ * Compares two conditions for sorting purposes.
323
+ * @param c1 - The first {@link Conditions.Condition | condition} to compare.
324
+ * @param c2 - The second {@link Conditions.Condition | condition} to compare.
325
+ * @returns A negative number if c1 should come before c2, a positive number
326
+ * if c2 should come before c1, or zero if they are equivalent.
327
+ * @public
328
+ */
329
+ static compare(c1: Condition, c2: Condition): number;
330
+ /**
331
+ * Gets a {@link ConditionToken | condition token} for this condition, if possible.
332
+ * It is not possible to get a token for a condition with an operator other than `matches`,
333
+ * with other-than-default priority, or with a name or value that contains other than alphanumeric
334
+ * characters, underscore or non-leading hyphen.
335
+ * @param terse - if `true` and if the qualifier token is optional, the token will be omitted
336
+ * from the generated {@link ConditionToken | condition token}.
337
+ * @returns
338
+ */
339
+ toToken(terse?: boolean): Result<ConditionToken>;
340
+ /**
341
+ * Gets the {@link ConditionKey | key} for this condition.
342
+ * @returns -
343
+ */
344
+ toKey(): ConditionKey;
345
+ /**
346
+ * Get a human-readable string representation of the condition.
347
+ * @returns A string representation of the condition.
348
+ * @public
349
+ */
350
+ toString(): string;
351
+ /**
352
+ * Gets the {@link ConditionKey | condition key} for a supplied {@link Conditions.IValidatedConditionDecl | condition declaration}.
353
+ * @param decl - The {@link Conditions.IValidatedConditionDecl | condition declaration} for which to get the key.
354
+ * @returns `Success` with the condition key if successful, `Failure` otherwise.
355
+ * @public
356
+ */
357
+ static getKeyForDecl(decl: IValidatedConditionDecl): Result<ConditionKey>;
358
+ }
359
+
360
+ /**
361
+ * A `ValidatingCollector` for {@link Conditions.Condition | Conditions},
362
+ * which collects conditions supplied as either {@link Conditions.Condition | Condition} or
363
+ * {@link Conditions.IConditionDecl | IConditionDecl}.
364
+ * @public
365
+ */
366
+ declare class ConditionCollector extends ValidatingCollector<Condition> {
367
+ /**
368
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to create conditions
369
+ * in this collector.
370
+ * @public
371
+ */
372
+ qualifiers: IReadOnlyQualifierCollector;
373
+ /**
374
+ * Constructor for a {@link Conditions.ConditionCollector | ConditionCollector} object.
375
+ * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for
376
+ * creating the collector.
377
+ */
378
+ protected constructor(params: IConditionCollectorCreateParams);
379
+ /**
380
+ * Creates a new {@link Conditions.ConditionCollector | ConditionCollector} object.
381
+ * @param params - Required {@link Conditions.IConditionCollectorCreateParams | parameters} for
382
+ * creating the collector.
383
+ * @returns `Success` with the new collector if successful, or `Failure` with
384
+ * an error message if not.
385
+ */
386
+ static create(params: IConditionCollectorCreateParams): Result<ConditionCollector>;
387
+ private _toCondition;
388
+ }
389
+
390
+ /**
391
+ * Converter for a {@link Conditions.IConditionDecl | condition declaration}.
392
+ * @public
393
+ */
394
+ declare const conditionDecl: ObjectConverter<IConditionDecl, unknown>;
395
+
396
+ /**
397
+ * Branded number representing a validated condition index.
398
+ * @public
399
+ */
400
+ export declare type ConditionIndex = Brand<number, 'ConditionIndex'>;
401
+
402
+ /**
403
+ * `Converter` which validates an `unknown` value as a {@link ConditionIndex | ConditionIndex}.
404
+ * @public
405
+ */
406
+ declare const conditionIndex: Converter<ConditionIndex, unknown>;
407
+
408
+ /**
409
+ * A branded string representing a validated condition key. A condition key is a
410
+ * string value which fully describes the condition apart from index. The condition
411
+ * key can be used to quickly determine if two conditions are identical apart from
412
+ * index, or for inspection.
413
+ * @public
414
+ */
415
+ export declare type ConditionKey = Brand<string, 'ConditionKey'>;
416
+
417
+ /**
418
+ * `Converter` which validates an `unknown` value as a {@link ConditionKey | ConditionKey}.
419
+ * @public
420
+ */
421
+ declare const conditionKey: Converter<ConditionKey, unknown>;
422
+
423
+ /**
424
+ * The format of a {@link ConditionKey | condition key} is:
425
+ * <qualifierName>-[<value>][\@<priority>](<scoreAsDefault>) where operator is `matches`, or
426
+ * <qualifierName>-<operator>-[<value>][\@<priority>](<scoreAsDefault>)
427
+ * @internal
428
+ */
429
+ declare const conditionKey_2: RegExp;
430
+
431
+ /**
432
+ * Condition operators for use in conditions.
433
+ * @public
434
+ */
435
+ export declare type ConditionOperator = 'always' | 'never' | 'matches';
436
+
437
+ /**
438
+ * `Converter` which validates an `unknown` value as a {@link ConditionOperator | ConditionOperator}.
439
+ * @public
440
+ */
441
+ declare const conditionOperator: Converter<ConditionOperator, ConditionOperator[]>;
442
+
443
+ /**
444
+ * Branded number representing a validated condition priority.
445
+ * @public
446
+ */
447
+ export declare type ConditionPriority = Brand<number, 'ConditionPriority'>;
448
+
449
+ /**
450
+ * `Converter` which validates an `unknown` value as a {@link ConditionPriority | ConditionPriority}.
451
+ * @public
452
+ */
453
+ declare const conditionPriority: Converter<ConditionPriority, unknown>;
454
+
455
+ declare namespace Conditions {
456
+ export {
457
+ Convert_2 as Convert,
458
+ Condition,
459
+ IConditionCollectorCreateParams,
460
+ ConditionCollector,
461
+ ReadOnlyConditionCollector,
462
+ IConditionDecl,
463
+ IValidatedConditionDecl,
464
+ ConditionSet,
465
+ IConditionSetCollectorCreateParams,
466
+ ConditionSetCollector,
467
+ ReadOnlyConditionSetCollector,
468
+ IConditionSetDecl,
469
+ IValidatedConditionSetDecl,
470
+ ConditionTokens
471
+ }
472
+ }
473
+ export { Conditions }
474
+
475
+ /**
476
+ * Represents a set of {@link Conditions.Condition | conditions} that must all be met in some runtime
477
+ * context for a resource instance to be valid.
478
+ * @public
479
+ */
480
+ declare class ConditionSet implements IValidatedConditionSetDecl {
481
+ protected readonly _collectible: Collections.Collectible<ConditionSetKey, ConditionSetIndex>;
482
+ /**
483
+ * The {@link Conditions.Condition | conditions} that make up this condition
484
+ * set.
485
+ * @public
486
+ */
487
+ readonly conditions: ReadonlyArray<Condition>;
488
+ /**
489
+ * The key for this condition set.
490
+ */
491
+ get key(): ConditionSetKey;
492
+ /**
493
+ * The number of conditions in this condition set.
494
+ */
495
+ get size(): number;
496
+ /**
497
+ * The index for this condition set.
498
+ */
499
+ get index(): ConditionSetIndex | undefined;
500
+ /**
501
+ * The key for an unconditional condition set.
502
+ */
503
+ static UnconditionalKey: ConditionSetKey;
504
+ /**
505
+ * Constructor for a {@link Conditions.ConditionSet | ConditionSet} object.
506
+ * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}
507
+ * used to create the condition set.
508
+ */
509
+ protected constructor(params: IValidatedConditionSetDecl);
510
+ /**
511
+ * Creates a new {@link Conditions.ConditionSet | ConditionSet} object.
512
+ * @param params - {@link Conditions.IValidatedConditionSetDecl | Validated declaration}
513
+ * used to create the condition set.
514
+ * @returns `Success` with the new {@link Conditions.ConditionSet | ConditionSet} object if successful,
515
+ * or `Failure` with an error message if not.
516
+ * @public
517
+ */
518
+ static create(params: IValidatedConditionSetDecl): Result<ConditionSet>;
519
+ /**
520
+ * Compares two {@link Conditions.ConditionSet | ConditionSets} for sorting purposes.
521
+ * @param cs1 - The first {@link Conditions.ConditionSet | ConditionSet} to compare.
522
+ * @param cs2 - The second {@link Conditions.ConditionSet | ConditionSet} to compare.
523
+ * @returns A negative number if `cs1` should come before `cs2`, a positive
524
+ * number if `cs1` should come after `cs2`, or zero if they are equivalent.
525
+ * @public
526
+ */
527
+ static compare(cs1: ConditionSet, cs2: ConditionSet): number;
528
+ /**
529
+ * Sets the global index for this condition set. Once set, the index cannot be changed.
530
+ * @param index - The index to set for this condition set.
531
+ * @returns `Success` with the index if successful, `Failure` otherwise.
532
+ */
533
+ setIndex(index: number): Result<ConditionSetIndex>;
534
+ /**
535
+ * Gets the {@link ConditionSetKey | key} for a supplied {@link Conditions.IValidatedConditionSetDecl | condition set declaration}.
536
+ * @param decl - The {@link Conditions.IValidatedConditionSetDecl | condition set declaration} for which to get the key.
537
+ * @returns `Success` with the condition set key if successful, `Failure` otherwise.
538
+ * @public
539
+ */
540
+ static getKeyForDecl(decl: IValidatedConditionSetDecl): Result<ConditionSetKey>;
541
+ /**
542
+ * Gets a {@link ConditionSetToken | condition set token} for this condition set,
543
+ * if possible.
544
+ * @param terse - If true, the token will be terse, omitting qualifier names where
545
+ * possible.
546
+ * @returns `Success` with the {@link ConditionSetToken | condition set token} if successful,
547
+ * `Failure` with an error message otherwise.
548
+ * @public
549
+ */
550
+ toToken(terse?: boolean): Result<string>;
551
+ /**
552
+ * Gets the {@link ConditionSetKey | key} for this condition set.
553
+ * @returns The key for this condition set.
554
+ */
555
+ toKey(): ConditionSetKey;
556
+ /**
557
+ * Gets a hash of this condition set.
558
+ * @returns A hash of this condition
559
+ * set key.
560
+ * @public
561
+ */
562
+ toHash(): string;
563
+ /**
564
+ * Gets a human-readable string representation of this condition set.
565
+ * @returns A string representation of this condition set.
566
+ */
567
+ toString(): string;
568
+ }
569
+
570
+ /**
571
+ * A `ValidatingCollector` for {@link Conditions.ConditionSet | ConditionSets},
572
+ * which collects condition sets supplied as {@link Conditions.ConditionSet | ConditionSet} or
573
+ * as {@link Conditions.IConditionSetDecl | IConditionSetDecl} via the methods on the
574
+ * `validating` property.
575
+ * @public
576
+ */
577
+ declare class ConditionSetCollector extends ValidatingCollector<ConditionSet> {
578
+ /**
579
+ * Gets the {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions
580
+ * for conditions in this collector.
581
+ */
582
+ conditions: ConditionCollector;
583
+ /**
584
+ * Gets the {@link Conditions.ConditionSet | ConditionSet} at the unconditional
585
+ * condition set index.
586
+ */
587
+ get unconditionalConditionSet(): ConditionSet;
588
+ /**
589
+ * The index of the unconditional condition set.
590
+ */
591
+ static UnconditionalIndex: ConditionSetIndex;
592
+ /**
593
+ * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.
594
+ * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create
595
+ * the collector.
596
+ */
597
+ protected constructor(params: IConditionSetCollectorCreateParams);
598
+ /**
599
+ * Creates a new {@link Conditions.ConditionSetCollector | ConditionSetCollector}.
600
+ * @param params - {@link Conditions.IConditionSetCollectorCreateParams | Parameters} used to create
601
+ * the collector.
602
+ * @returns `Success` with the new collector if successful, or `Failure` with an error message
603
+ * if not.
604
+ */
605
+ static create(params: IConditionSetCollectorCreateParams): Result<ConditionSetCollector>;
606
+ private _toConditionSet;
607
+ }
608
+
609
+ /**
610
+ * Non-validated declaration of a {@link Conditions.Condition | condition}.
611
+ * @public
612
+ */
613
+ declare type ConditionSetDecl = ConditionSetDeclAsArray | ConditionSetDeclAsRecord;
614
+
615
+ /**
616
+ * Converter which converts to a {@link Conditions.IConditionSetDecl | condition set declaration}.
617
+ * @public
618
+ */
619
+ declare const conditionSetDecl: ObjectConverter<IConditionSetDecl, unknown>;
620
+
621
+ /**
622
+ * Normalized non-validated declaration of a {@link Conditions.Condition | condition}.
623
+ * @public
624
+ */
625
+ declare type ConditionSetDecl_2 = ReadonlyArray<ILooseConditionDecl>;
626
+
627
+ /**
628
+ * `Converter` for a normalized {@link ResourceJson.Normalized.ConditionSetDecl | condition set declaration}.
629
+ * @public
630
+ */
631
+ declare const conditionSetDecl_2: Converter<Normalized.ConditionSetDecl>;
632
+
633
+ /**
634
+ * Non-validated declaration of a {@link Conditions.Condition | condition}.
635
+ * @public
636
+ */
637
+ declare type ConditionSetDeclAsArray = ReadonlyArray<ILooseConditionDecl>;
638
+
639
+ /**
640
+ * Non-validated declaration of a {@link Conditions.Condition | condition}.
641
+ * @public
642
+ */
643
+ declare type ConditionSetDeclAsRecord = Record<string, string | IChildConditionDecl>;
644
+
645
+ /**
646
+ * Branded string representing a hash value for a condition set. The hash value
647
+ * is an 8-character string derived from the crc32 hash of the condition set key
648
+ * and is used to quickly and compactly identify a condition set or compare for
649
+ * equality.
650
+ * @public
651
+ */
652
+ export declare type ConditionSetHash = Brand<string, 'ConditionSetHash'>;
653
+
654
+ /**
655
+ * `Converter` which validates an `unknown` value as a {@link ConditionSetHash | ConditionSetHash}.
656
+ * @public
657
+ */
658
+ declare const conditionSetHash: Converter<ConditionSetHash, unknown>;
659
+
660
+ /**
661
+ * @internal
662
+ */
663
+ declare const conditionSetHash_2: RegExp;
664
+
665
+ /**
666
+ * Branded number representing a validated condition set index.
667
+ * @public
668
+ */
669
+ export declare type ConditionSetIndex = Brand<number, 'ConditionSetIndex'>;
670
+
671
+ /**
672
+ * `Converter` which validates an `unknown` value as a {@link ConditionSetIndex | ConditionSetIndex}.
673
+ * @public
674
+ */
675
+ declare const conditionSetIndex: Converter<ConditionSetIndex, unknown>;
676
+
677
+ /**
678
+ * Branded string representing a validated condition set key. A condition set key
679
+ * is a string value which fully describes the condition set apart from index. The
680
+ * condition set key can be used to quickly determine if two condition sets are
681
+ * identical apart from index, or for inspection.
682
+ * @public
683
+ */
684
+ export declare type ConditionSetKey = Brand<string, 'ConditionSetKey'>;
685
+
686
+ /**
687
+ * `Converter` which validates an `unknown` value as a {@link ConditionSetKey | ConditionSetKey}.
688
+ * @public
689
+ */
690
+ declare const conditionSetKey: Converter<ConditionSetKey, unknown>;
691
+
692
+ /**
693
+ * A string representing a validated condition set token. Condition set tokens are
694
+ * typically extracted from the name of some resource (e.g. file or folder) being
695
+ * imported. A condition set token is a comma-separated list of one or more
696
+ * {@link ConditionToken | condition tokens}, where a condition token has either
697
+ * the form `<qualifierName>=<value>` or `<value>`.
698
+ * @public
699
+ */
700
+ export declare type ConditionSetToken = Brand<string, 'ConditionSetToken'>;
701
+
702
+ /**
703
+ * `Converter` which validates an `unknown` value as a {@link ConditionSetToken | ConditionSetToken}.
704
+ * @public
705
+ */
706
+ declare const conditionSetToken: Converter<ConditionSetToken, unknown>;
707
+
708
+ /**
709
+ * A string representing a validated condition token. Condition tokens are
710
+ * typically extracted from the name of some resource (e.g. file or folder)
711
+ * being imported. A condition token has the form `<qualifierName>=<value>`
712
+ * or `<value>`.
713
+ * @public
714
+ */
715
+ export declare type ConditionToken = Brand<string, 'ConditionToken'>;
716
+
717
+ /**
718
+ * `Converter` which validates an `unknown` value as a {@link ConditionToken | ConditionToken}.
719
+ * @public
720
+ */
721
+ declare const conditionToken: Converter<ConditionToken, unknown>;
722
+
723
+ /**
724
+ * A {@link ConditionToken | condition token} is a comma-separated list of one or more
725
+ * condition specifiers, where a condition specifier has either the form
726
+ * `<qualifierName>=<value>` or `<value>`.
727
+ * @internal
728
+ */
729
+ declare const conditionToken_2: RegExp;
730
+
731
+ /**
732
+ * Helper class to parse and validate condition tokens.
733
+ * @public
734
+ */
735
+ declare class ConditionTokens {
736
+ /**
737
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to validate
738
+ * qualifier names and values.
739
+ */
740
+ readonly qualifiers: IReadOnlyQualifierCollector;
741
+ /**
742
+ * Constructs a new {@link Conditions.ConditionTokens | ConditionTokens } instance.
743
+ * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use
744
+ */
745
+ constructor(qualifiers: IReadOnlyQualifierCollector);
746
+ /**i
747
+ * Parses a {@link ConditionToken | condition token} string and validates the parts
748
+ * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.
749
+ * @param token - the token string to parse.
750
+ * @returns `Success` with the {@link Conditions.IValidatedConditionDecl | validated condition declaration}
751
+ * if successful, `Failure` with an error message if not.
752
+ */
753
+ parseConditionToken(token: string): Result<IValidatedConditionDecl>;
754
+ /**
755
+ * Parses a {@link ConditionSetToken | condition set token} string and validates the parts
756
+ * against the qualifiers present in the {@link Conditions.ConditionTokens.qualifiers | qualifier collector}.
757
+ * @param token - the token string to parse.
758
+ * @returns `Success` with the array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}
759
+ * if successful, `Failure` with an error message if not.
760
+ */
761
+ parseConditionSetToken(token: string): Result<IValidatedConditionDecl[]>;
762
+ /**
763
+ * Validates the {@link Helpers.IConditionTokenParts | parts} of a {@link ConditionToken | condition token}.
764
+ * @param parts - the parts to validate
765
+ * @returns `Success` with the validated declaration if successful, `Failure` with an error message if not.
766
+ */
767
+ validateConditionTokenParts(parts: Helpers.IConditionTokenParts): Result<IValidatedConditionDecl>;
768
+ /**
769
+ * Given a value, finds a single token-optional qualifier that matches the value.
770
+ * Fails if no qualifiers match, or if more than one qualifier matches.
771
+ * @param value - the value to match.
772
+ * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.
773
+ */
774
+ findQualifierForValue(value: string): Result<Qualifier>;
775
+ /**
776
+ * Parses a {@link ConditionToken | condition token} and validates it against the qualifiers
777
+ * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.
778
+ * @param token - the token string to parse.
779
+ * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use
780
+ * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,
781
+ * `Failure` with an error message if not.
782
+ */
783
+ static parseConditionToken(token: string, qualifiers: IReadOnlyQualifierCollector): Result<IValidatedConditionDecl>;
784
+ /**
785
+ * Parses a {@link ConditionSetToken | condition set token} and validates it against the qualifiers
786
+ * present in the supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.
787
+ * @param token - the token string to parse.
788
+ * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use
789
+ * @returns `Success` with an array of {@link Conditions.IValidatedConditionDecl | validated condition declarations}
790
+ * if successful, `Failure` with an error message if not
791
+ */
792
+ static parseConditionSetToken(token: string, qualifiers: IReadOnlyQualifierCollector): Result<IValidatedConditionDecl[]>;
793
+ /**
794
+ * Validates the parts of a condition token against the qualifiers present in the supplied
795
+ * {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector}.
796
+ * @param parts - the {@link Helpers.IConditionTokenParts | condition token parts} to validate.
797
+ * @param qualifiers - the {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} used to
798
+ * validate qualifier names and values.
799
+ * @returns `Success` with a {@link Conditions.IValidatedConditionDecl | validated condition declaration} if successful,
800
+ * `Failure` with an error message if not.
801
+ */
802
+ static validateConditionTokenParts(parts: Helpers.IConditionTokenParts, qualifiers: IReadOnlyQualifierCollector): Result<IValidatedConditionDecl>;
803
+ /**
804
+ * Given a value and a set of qualifiers, finds a single token-optional qualifier that matches the value.
805
+ * Fails if no qualifiers match, or if more than one qualifier matches.
806
+ * @param value - the value to match.
807
+ * @param qualifiers - the qualifiers to match against.
808
+ * @returns `Success` with the matching qualifier if successful, `Failure` with an error message if not.
809
+ */
810
+ static findQualifierForValue(value: string, qualifiers: IReadOnlyQualifierCollector): Result<Qualifier>;
811
+ }
812
+
813
+ declare namespace Convert {
814
+ export {
815
+ qualifierName,
816
+ qualifierIndex,
817
+ qualifierTypeName,
818
+ qualifierTypeIndex,
819
+ qualifierMatchScore,
820
+ conditionPriority,
821
+ conditionOperator,
822
+ conditionIndex,
823
+ conditionKey,
824
+ conditionToken,
825
+ conditionSetIndex,
826
+ conditionSetKey,
827
+ conditionSetToken,
828
+ conditionSetHash,
829
+ decisionIndex,
830
+ decisionKey,
831
+ resourceId,
832
+ resourceName,
833
+ resourceIndex,
834
+ resourceTypeName,
835
+ resourceTypeIndex,
836
+ resourceValueMergeMethod
837
+ }
838
+ }
839
+ export { Convert }
840
+
841
+ declare namespace Convert_2 {
842
+ export {
843
+ conditionDecl,
844
+ IConditionDeclConvertContext,
845
+ validatedConditionDecl,
846
+ conditionSetDecl,
847
+ IConditionSetDeclConvertContext,
848
+ validatedConditionSetDecl
849
+ }
850
+ }
851
+
852
+ declare namespace Convert_3 {
853
+ export {
854
+ looseConditionDecl,
855
+ childConditionDecl,
856
+ conditionSetDecl_2 as conditionSetDecl,
857
+ looseResourceCandidateDecl,
858
+ childResourceCandidateDecl,
859
+ looseResourceDecl,
860
+ childResourceDecl,
861
+ resourceTreeChildNodeDecl,
862
+ resourceTreeRootDecl,
863
+ resourceCollectionDecl
864
+ }
865
+ }
866
+
867
+ declare namespace Convert_4 {
868
+ export {
869
+ IQualifierTypeConvertContext,
870
+ qualifierType
871
+ }
872
+ }
873
+
874
+ declare namespace Convert_5 {
875
+ export {
876
+ qualifierDecl,
877
+ IQualifierDeclConvertContext,
878
+ validatedQualifierDecl,
879
+ IQualifierConvertContext,
880
+ qualifier
881
+ }
882
+ }
883
+
884
+ /**
885
+ * Simple collectible implementation of {@link Decisions.IDecision | IDecision}.
886
+ * @public
887
+ */
888
+ declare class Decision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {
889
+ /**
890
+ * The sorted {@link Conditions.ConditionSet | ConditionSets} that make up this decision.
891
+ * @public
892
+ */
893
+ readonly candidates: ReadonlyArray<Candidate<TVALUE>>;
894
+ /**
895
+ * Unique global key for this decision, derived from the contents
896
+ * of the decision.
897
+ */
898
+ get key(): DecisionKey;
899
+ /**
900
+ * Unique global index for this decision.
901
+ */
902
+ get index(): DecisionIndex | undefined;
903
+ /**
904
+ * Key for the empty decision (no condition sets).
905
+ */
906
+ static readonly EmptyDecisionKey: DecisionKey;
907
+ /**
908
+ * Key for the default-only decision (single condition set with no conditions).
909
+ */
910
+ static readonly DefaultOnlyDecisionKey: DecisionKey;
911
+ private _collectible;
912
+ /**
913
+ * Constructor for a {@link Decisions.Decision | Decision} object.
914
+ * @param params - {@link Decisions.IDecisionConstructorParams | Parameters} used to create the decision.
915
+ * @public
916
+ */
917
+ protected constructor(params: IDecisionConstructorParams<TVALUE>);
918
+ /**
919
+ * Creates a new {@link Decisions.Decision | Decision} object.
920
+ * @param params - {@link Decisions.IDecisionCreateParams | Parameters} used to create the decision.
921
+ * @returns `Success` with the new decision if successful, or `Failure` with an error message if not.
922
+ * @public
923
+ */
924
+ static createDecision(params: IDecisionCreateParams): Result<Decision>;
925
+ /**
926
+ * Sets the index for this decision. Once set, index is immutable.
927
+ * @param index - The index to set.
928
+ * @returns `Success` with the new index if successful, or `Failure` with an error message if not.
929
+ * @public
930
+ */
931
+ setIndex(index: number): Result<DecisionIndex>;
932
+ /**
933
+ * Helper function to return a stable key for a the condition sets that
934
+ * make up a {@link Decisions.Decision | decision}. The abstract
935
+ * key is a `+`-separated list of the hashes of the sorted condition sets
936
+ * that make up the decision.
937
+ * @param conditionSets - The condition sets to use to create the key.
938
+ * @returns A key derived from the condition set hashes.
939
+ * @public
940
+ */
941
+ static getAbstractKey(conditionSets: ReadonlyArray<ConditionSet>): DecisionKey;
942
+ /**
943
+ * Helper function to return a stable key for a set of condition sets.
944
+ * @param conditionSets - The condition sets to use to create the key.
945
+ * @returns A key derived from the condition set hashes.
946
+ * @public
947
+ */
948
+ static getKey<TVALUE extends JsonValue = JsonValue>(candidates: ReadonlyArray<ICandidate<TVALUE>>): DecisionKey;
949
+ }
950
+
951
+ /**
952
+ * Branded number representing a validated decision index.
953
+ * @public
954
+ */
955
+ export declare type DecisionIndex = Brand<number, 'DecisionIndex'>;
956
+
957
+ /**
958
+ * `Converter` which validates an `unknown` value as a {@link DecisionIndex | DecisionIndex}.
959
+ * @public
960
+ */
961
+ declare const decisionIndex: Converter<DecisionIndex, unknown>;
962
+
963
+ /**
964
+ * Branded string representing a validated decision key. A decision key is a string
965
+ * value which fully describes the decision apart from index. The decision key can
966
+ * be used to quickly determine if two decisions are identical apart from index.
967
+ * @public
968
+ */
969
+ export declare type DecisionKey = Brand<string, 'DecisionKey'>;
970
+
971
+ /**
972
+ * `Converter` which validates an `unknown` value as a {@link DecisionKey | DecisionKey}.
973
+ * @public
974
+ */
975
+ declare const decisionKey: Converter<DecisionKey, unknown>;
976
+
977
+ /**
978
+ * @internal
979
+ */
980
+ declare const decisionKey_2: RegExp;
981
+
982
+ declare namespace Decisions {
983
+ export {
984
+ IDecision,
985
+ ICandidate,
986
+ Candidate,
987
+ IDecisionCreateParams,
988
+ IDecisionConstructorParams,
989
+ Decision,
990
+ IAbstractDecisionCreateParams,
991
+ AbstractDecision,
992
+ IAbstractDecisionCollectorCreateParams,
993
+ AbstractDecisionCollector,
994
+ ReadOnlyAbstractDecisionCollector,
995
+ IConcreteDecisionCreateParams,
996
+ IConcreteDecisionConstructorParams,
997
+ ConcreteDecision
998
+ }
999
+ }
1000
+ export { Decisions }
1001
+
1002
+ /**
1003
+ * Class describing some file system item to be imported.
1004
+ * @public
1005
+ */
1006
+ declare class FsItem implements IFsItemProps {
1007
+ /**
1008
+ * {@inheritDoc Import.IFsItemProps.baseName}
1009
+ */
1010
+ readonly baseName: string;
1011
+ /**
1012
+ * {@inheritDoc Import.IFsItemProps.conditions}
1013
+ */
1014
+ readonly conditions: Conditions.IValidatedConditionDecl[];
1015
+ /**
1016
+ * {@inheritDoc Import.IFsItemProps.item}
1017
+ */
1018
+ readonly item: FileTree.FileTreeItem;
1019
+ /**
1020
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for this item.
1021
+ */
1022
+ readonly qualifiers: IReadOnlyQualifierCollector;
1023
+ /**
1024
+ * Protected constructor creates a new {@link Import.FsItem | FsItem}.
1025
+ * @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.
1026
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
1027
+ * embedded condition set tokens.
1028
+ * @param tree - file tree implementation to use for this item.
1029
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
1030
+ * containing an error message if not.
1031
+ */
1032
+ protected constructor(props: IFsItemProps, qualifiers: IReadOnlyQualifierCollector);
1033
+ /**
1034
+ * Creates a new {@link Import.FsItem | FsItem} from a `FileTreeItem`.
1035
+ * @param item - The `FileTreeItem` to import.
1036
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
1037
+ * embedded condition set tokens.
1038
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
1039
+ * containing an error message if not. Note that the result detail `skipped` indicates that the item
1040
+ * was not created because it is not relevant - this is a soft error that should be silently ignored.
1041
+ */
1042
+ static createForItem(item: FileTree.FileTreeItem, qualifiers: IReadOnlyQualifierCollector): DetailedResult<FsItem, FsItemResultDetail>;
1043
+ /**
1044
+ * Creates a new {@link Import.FsItem | FsItem} from a file system path.
1045
+ * @param importPath - The path to the file system item to import.
1046
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
1047
+ * embedded condition set tokens.
1048
+ * @param fs - An optional {@link Import.IImporterFilesystem | file system implementation} to use for this item.
1049
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created
1050
+ * successfully, or a `Failure` containing an error message if it is not. Note that the result detail
1051
+ * `skipped` indicates that the item was not created because it is not relevant - this is a soft error
1052
+ * that should be silently ignored.
1053
+ */
1054
+ static createForPath(importPath: string, qualifiers: IReadOnlyQualifierCollector, tree?: FileTree.FileTree): DetailedResult<FsItem, FsItemResultDetail>;
1055
+ /**
1056
+ * Tries to parse a base name into a base name and a set of conditions.
1057
+ * @param baseName - The base name to parse.
1058
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
1059
+ * embedded condition set tokens.
1060
+ * @returns `Success` containing the parsed base name and conditions on success, or `Failure` containing
1061
+ * an error message if it is not.
1062
+ */
1063
+ static tryParseBaseName(baseName: string, qualifiers: IReadOnlyQualifierCollector): Result<Omit<IFsItemProps, 'item'>>;
1064
+ /**
1065
+ * Gets the context for this file system item.
1066
+ * @returns `Success` containing the {@link Import.ImportContext | import context} for this item
1067
+ * if successful, or a `Failure` containing an error message if an error occurs.
1068
+ */
1069
+ getContext(): Result<ImportContext>;
1070
+ }
1071
+
1072
+ /**
1073
+ * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`.
1074
+ * @public
1075
+ */
1076
+ declare class FsItemImporter implements IImporter {
1077
+ /**
1078
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use for this importer.
1079
+ */
1080
+ readonly qualifiers: IReadOnlyQualifierCollector;
1081
+ /**
1082
+ * The types of {@link Import.IImportable | importables} that this importer can handle.
1083
+ */
1084
+ readonly types: ReadonlyArray<string>;
1085
+ /**
1086
+ * Protected constructor for the {@link Import.Importers.FsItemImporter | FsItemImporter}.
1087
+ * @param params - Parameters for creating the {@link Import.Importers.FsItemImporter | FsItemImporter}.
1088
+ */
1089
+ protected constructor(params: IFsItemImporterCreateParams);
1090
+ /**
1091
+ * Creates a new {@link Import.Importers.FsItemImporter | FsItemImporter}.
1092
+ * @param params - Parameters for creating the {@link Import.Importers.FsItemImporter | FsItemImporter}.
1093
+ * @returns `Success` with the new `FsItemImporter` if successful, `Failure` with an error message if not.
1094
+ */
1095
+ static create(params: IFsItemImporterCreateParams): Result<FsItemImporter>;
1096
+ /**
1097
+ * {@inheritdoc Import.Importers.IImporter.import}
1098
+ */
1099
+ import(item: IImportable, __manager: ResourceManager): DetailedResult<IImportable[], ImporterResultDetail>;
1100
+ /**
1101
+ * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
1102
+ * @param item - The importable to convert.
1103
+ * @returns `Success` containing the `FsItem` if successful, `Failure` with an error message if not.
1104
+ */
1105
+ protected _getFileTreeItemFromImportable(item: IImportable): DetailedResult<FsItem, FsItemResultDetail>;
1106
+ }
1107
+
1108
+ /**
1109
+ * Result details for {@link Import.FsItem | FsItem} operations.
1110
+ * @public
1111
+ */
1112
+ declare type FsItemResultDetail = 'failed' | 'skipped' | 'succeeded';
1113
+
1114
+ declare namespace Helpers {
1115
+ export {
1116
+ buildConditionToken,
1117
+ buildConditionSetToken,
1118
+ parseConditionTokenParts,
1119
+ parseConditionSetTokenParts,
1120
+ IConditionTokenParts,
1121
+ splitResourceId,
1122
+ joinResourceIds,
1123
+ joinOptionalResourceIds
1124
+ }
1125
+ }
1126
+ export { Helpers }
1127
+
1128
+ declare namespace Helpers_2 {
1129
+ export {
1130
+ mergeLooseCandidate,
1131
+ mergeChildCandidate,
1132
+ mergeLooseResource,
1133
+ mergeChildResource
1134
+ }
1135
+ }
1136
+
1137
+ /**
1138
+ * Parameters for creating a {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.
1139
+ * @public
1140
+ */
1141
+ declare interface IAbstractDecisionCollectorCreateParams {
1142
+ /**
1143
+ * {@link Conditions.ReadOnlyConditionSetCollector | ConditionSetCollector} used to create conditions
1144
+ * sets for decisions in this collector.
1145
+ */
1146
+ conditionSets: ReadOnlyConditionSetCollector;
1147
+ }
1148
+
1149
+ /**
1150
+ * Parameters to create an {@link Decisions.AbstractDecision | AbstractDecision}.
1151
+ * @public
1152
+ */
1153
+ declare interface IAbstractDecisionCreateParams {
1154
+ conditionSets: ConditionSet[];
1155
+ index?: number;
1156
+ }
1157
+
1158
+ /**
1159
+ * A {@link Decisions.ICandidate | resource candidate} represents a single
1160
+ * possible value for some resource, with the conditions under which it is valid.
1161
+ * @public
1162
+ */
1163
+ declare interface ICandidate<TVALUE extends JsonValue = JsonValue> {
1164
+ readonly conditionSet: ConditionSet;
1165
+ readonly value: TVALUE;
1166
+ readonly isPartial?: boolean;
1167
+ readonly mergeMethod?: ResourceValueMergeMethod;
1168
+ }
1169
+
1170
+ /**
1171
+ * Non-validated child declaration of a {@link Conditions.Condition | condition}.
1172
+ * @public
1173
+ */
1174
+ declare interface IChildConditionDecl {
1175
+ /**
1176
+ * The value to be compared.
1177
+ */
1178
+ value: string;
1179
+ /**
1180
+ * The operator to be used in the comparison.
1181
+ * Default is 'matches'.
1182
+ */
1183
+ operator?: ConditionOperator;
1184
+ /**
1185
+ * The priority of the condition. Default is the default priority for the qualifier.
1186
+ */
1187
+ priority?: number;
1188
+ /**
1189
+ * The score to be used if the condition is used as a default.
1190
+ */
1191
+ scoreAsDefault?: number;
1192
+ }
1193
+
1194
+ /**
1195
+ * Non-validated child declaration of a {@link Resources.ResourceCandidate | resource candidate}.
1196
+ * @public
1197
+ */
1198
+ declare interface IChildResourceCandidateDecl {
1199
+ /**
1200
+ * The JSON value of the resource.
1201
+ */
1202
+ readonly json: JsonObject;
1203
+ /**
1204
+ * The conditions that must be met for the resource to be selected.
1205
+ */
1206
+ readonly conditions?: ConditionSetDecl;
1207
+ /**
1208
+ * If true, the resource is only a partial representation of the full resource.
1209
+ */
1210
+ readonly isPartial?: boolean;
1211
+ /**
1212
+ * The merge method to be used when merging the resource into the existing resource.
1213
+ * default is 'augment'.
1214
+ */
1215
+ readonly mergeMethod?: ResourceValueMergeMethod;
1216
+ }
1217
+
1218
+ /**
1219
+ * Normalized non-validated child declaration of a {@link Resources.ResourceCandidate | resource candidate}.
1220
+ * @public
1221
+ */
1222
+ declare interface IChildResourceCandidateDecl_2 {
1223
+ /**
1224
+ * The JSON value of the resource.
1225
+ */
1226
+ readonly json: JsonObject;
1227
+ /**
1228
+ * The conditions that must be met for the resource to be selected.
1229
+ */
1230
+ readonly conditions?: ConditionSetDecl_2;
1231
+ /**
1232
+ * If true, the resource is only a partial representation of the full resource.
1233
+ */
1234
+ readonly isPartial?: boolean;
1235
+ /**
1236
+ * The merge method to be used when merging the resource into the existing resource.
1237
+ * default is 'augment'.
1238
+ */
1239
+ readonly mergeMethod?: ResourceValueMergeMethod;
1240
+ }
1241
+
1242
+ /**
1243
+ * Non-validated child declaration of a {@link Resources.Resource | resource}.
1244
+ * @public
1245
+ */
1246
+ declare interface IChildResourceDecl {
1247
+ /**
1248
+ * The name of the type of this resource.
1249
+ */
1250
+ readonly resourceTypeName: string;
1251
+ /**
1252
+ * Possible candidates for this value.
1253
+ */
1254
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl>;
1255
+ }
1256
+
1257
+ /**
1258
+ * Normalized non-validated child declaration of a {@link Resources.Resource | resource}.
1259
+ * @public
1260
+ */
1261
+ declare interface IChildResourceDecl_2 {
1262
+ /**
1263
+ * The name of the type of this resource.
1264
+ */
1265
+ readonly resourceTypeName: string;
1266
+ /**
1267
+ * Possible candidates for this value.
1268
+ */
1269
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl_2>;
1270
+ }
1271
+
1272
+ /**
1273
+ * Protected constructor parameters for {@link Decisions.ConcreteDecision | ConcreteDecision},
1274
+ * used to create a new concrete decision from an existing {@link Decisions.AbstractDecision | AbstractDecision}
1275
+ * and a list of values.
1276
+ * @public
1277
+ */
1278
+ declare interface IConcreteDecisionConstructorParams<TVALUE extends JsonValue = JsonValue> {
1279
+ baseDecision: AbstractDecision;
1280
+ values: TVALUE[];
1281
+ index?: DecisionIndex;
1282
+ }
1283
+
1284
+ /**
1285
+ * Parameters used to create a new {@link Decisions.ConcreteDecision | ConcreteDecision},
1286
+ * given an {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector} and a
1287
+ * list of {@link Decisions.ICandidate | candidates}.
1288
+ * @public
1289
+ */
1290
+ declare interface IConcreteDecisionCreateParams<TVALUE extends JsonValue = JsonValue> {
1291
+ decisions: AbstractDecisionCollector;
1292
+ candidates: ReadonlyArray<ICandidate<TVALUE>>;
1293
+ index?: number;
1294
+ }
1295
+
1296
+ /**
1297
+ * Parameters for creating a {@link Conditions.ConditionCollector | ConditionCollector}.
1298
+ * @public
1299
+ */
1300
+ declare interface IConditionCollectorCreateParams {
1301
+ /**
1302
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} used to
1303
+ * create conditions in this collector.
1304
+ */
1305
+ qualifiers: IReadOnlyQualifierCollector;
1306
+ /**
1307
+ * Optional array of condition declarations to add to the collector.
1308
+ */
1309
+ conditions?: IConditionDecl[];
1310
+ }
1311
+
1312
+ /**
1313
+ * Non-validated declaration of a {@link Conditions.Condition | condition}.
1314
+ * @public
1315
+ */
1316
+ declare interface IConditionDecl {
1317
+ qualifierName: string;
1318
+ value: string;
1319
+ operator?: ConditionOperator;
1320
+ priority?: number;
1321
+ scoreAsDefault?: number;
1322
+ }
1323
+
1324
+ /**
1325
+ * Conversion context to uses when converting
1326
+ * a {@link Conditions.IValidatedConditionDecl | validated condition declaration}.
1327
+ * @public
1328
+ */
1329
+ declare interface IConditionDeclConvertContext {
1330
+ readonly qualifiers: IReadOnlyQualifierCollector;
1331
+ conditionIndex?: number;
1332
+ }
1333
+
1334
+ /**
1335
+ * Parameters for creating a {@link Conditions.ConditionSetCollector | ConditionSetCollector}.
1336
+ * @public
1337
+ */
1338
+ declare interface IConditionSetCollectorCreateParams {
1339
+ /**
1340
+ * The {@link Conditions.ConditionCollector | ConditionCollector} used to create conditions
1341
+ * for conditions in this collector.
1342
+ */
1343
+ conditions: ConditionCollector;
1344
+ /**
1345
+ * Optional array of {@link Conditions.IConditionSetDecl | condition set declarations} to add to
1346
+ * the collector.
1347
+ */
1348
+ conditionSets?: IConditionSetDecl[];
1349
+ }
1350
+
1351
+ /**
1352
+ * Non-validated declaration of a {@link Conditions.ConditionSet | set of conditions}.
1353
+ * @public
1354
+ */
1355
+ declare interface IConditionSetDecl {
1356
+ conditions: IConditionDecl[];
1357
+ }
1358
+
1359
+ /**
1360
+ * Context for converting a {@link Conditions.IConditionSetDecl | condition set declaration}
1361
+ * into an instantiated {@link Conditions.ConditionSet | condition set} object.
1362
+ * @public
1363
+ */
1364
+ declare interface IConditionSetDeclConvertContext {
1365
+ readonly conditions: ConditionCollector;
1366
+ conditionSetIndex?: number;
1367
+ }
1368
+
1369
+ /**
1370
+ * The values needed to create a {@link ConditionToken | condition token}.
1371
+ * @public
1372
+ */
1373
+ declare interface IConditionTokenParts {
1374
+ qualifier?: string;
1375
+ value: string;
1376
+ }
1377
+
1378
+ /**
1379
+ * Represents a decision, which is comprised of zero or more
1380
+ * {@link Decisions.Candidate | candidates}, each of which represents a possible
1381
+ * value for some resource, along with the conditions under which that value is valid.
1382
+ * @public
1383
+ */
1384
+ declare interface IDecision<TVALUE extends JsonValue = JsonValue> {
1385
+ key: DecisionKey;
1386
+ candidates: ReadonlyArray<ICandidate<TVALUE>>;
1387
+ index?: DecisionIndex;
1388
+ }
1389
+
1390
+ /**
1391
+ * Parameters used to construct a new {@link Decisions.Decision | Decision} with
1392
+ * the protected constructor.
1393
+ * @public
1394
+ */
1395
+ declare interface IDecisionConstructorParams<TVALUE extends JsonValue = JsonValue> extends IDecisionCreateParams<TVALUE> {
1396
+ isAbstract: boolean;
1397
+ }
1398
+
1399
+ /**
1400
+ * Parameters used to create a new {@link Decisions.Decision | Decision}
1401
+ * with the {@link Decisions.Decision.createDecision | createDecision}
1402
+ * static method.
1403
+ * @public
1404
+ */
1405
+ declare interface IDecisionCreateParams<TVALUE extends JsonValue = JsonValue> {
1406
+ candidates: ReadonlyArray<ICandidate<TVALUE>>;
1407
+ index?: number;
1408
+ }
1409
+
1410
+ /**
1411
+ * @internal
1412
+ */
1413
+ declare const identifier: RegExp;
1414
+
1415
+ /**
1416
+ * @internal
1417
+ */
1418
+ declare const identifierList: RegExp;
1419
+
1420
+ /**
1421
+ * Parameters for creating a {@link Import.Importers.FsItemImporter | FsItemImporter}.
1422
+ * @public
1423
+ */
1424
+ declare interface IFsItemImporterCreateParams {
1425
+ qualifiers: IReadOnlyQualifierCollector;
1426
+ }
1427
+
1428
+ /**
1429
+ * Interface describing some single file system item.
1430
+ * @public
1431
+ */
1432
+ declare interface IFsItemProps {
1433
+ /**
1434
+ * The underlying `FileTreeItem` for this item.
1435
+ */
1436
+ readonly item: FileTree.FileTreeItem;
1437
+ /**
1438
+ * The base name of the file system item, once
1439
+ * any conditions set tokens have been removed.
1440
+ */
1441
+ readonly baseName: string;
1442
+ /**
1443
+ * {@link Conditions.IValidatedConditionDecl | Conditions} extracted
1444
+ * from the base name of the {@link Import.FsItem | FsItem}.
1445
+ */
1446
+ readonly conditions: Conditions.IValidatedConditionDecl[];
1447
+ }
1448
+
1449
+ /**
1450
+ * Base interface for importable entities.
1451
+ * @public
1452
+ */
1453
+ declare interface IImportable {
1454
+ type: string;
1455
+ context?: ImportContext;
1456
+ }
1457
+
1458
+ /**
1459
+ * Represents a filesystem item to be imported.
1460
+ * @public
1461
+ */
1462
+ declare interface IImportableFsItem extends IImportable {
1463
+ type: 'fsItem';
1464
+ item: FsItem;
1465
+ context?: ImportContext;
1466
+ }
1467
+
1468
+ /**
1469
+ * Represents some JSON to be imported.
1470
+ * @public
1471
+ */
1472
+ declare interface IImportableJson extends IImportable {
1473
+ type: 'json';
1474
+ json: JsonValue;
1475
+ context?: ImportContext;
1476
+ }
1477
+
1478
+ /**
1479
+ * Represents a filesystem path to be imported.
1480
+ * @public
1481
+ */
1482
+ declare interface IImportablePath extends IImportable {
1483
+ type: 'path';
1484
+ path: string;
1485
+ context?: ImportContext;
1486
+ }
1487
+
1488
+ /**
1489
+ * Represents a resource collection to be imported.
1490
+ * @public
1491
+ */
1492
+ declare interface IImportableResourceCollection extends IImportable {
1493
+ type: 'resourceCollection';
1494
+ collection: ResourceJson.ResourceDeclCollection;
1495
+ context?: ImportContext;
1496
+ }
1497
+
1498
+ /**
1499
+ * Represents a resource tree to be imported.
1500
+ * @public
1501
+ */
1502
+ declare interface IImportableResourceTree extends IImportable {
1503
+ type: 'resourceTree';
1504
+ tree: ResourceJson.ResourceDeclTree;
1505
+ context?: ImportContext;
1506
+ }
1507
+
1508
+ /**
1509
+ * Accumulated context of a resource import operation.
1510
+ * @public
1511
+ */
1512
+ declare interface IImportContext {
1513
+ /**
1514
+ * Base ID for the import context for resources imported
1515
+ * in this context.
1516
+ */
1517
+ readonly baseId?: string;
1518
+ /**
1519
+ * Conditions to be applied to resources imported in this context.
1520
+ */
1521
+ readonly conditions?: ReadonlyArray<IConditionDecl>;
1522
+ }
1523
+
1524
+ /**
1525
+ * Generic interface for an importer than accepts a typed
1526
+ * {@link Import.IImportable | importable} item, extracts any resources
1527
+ * or candidates from it, and returns an optional list of
1528
+ * additional importable items derived from the original.
1529
+ * @public
1530
+ */
1531
+ declare interface IImporter {
1532
+ /**
1533
+ * The types of {@link Import.Importable | importable} items that this importer can process.
1534
+ */
1535
+ readonly types: ReadonlyArray<string>;
1536
+ /**
1537
+ * Imports an item, extracting any resources or candidates from it and returns an optional
1538
+ * list of additional importable items derived from it.
1539
+ * @param item - The {@link Import.IImportable | importable} item to import.
1540
+ * @param manager - The {@link Resources.ResourceManager | resource manager} to use for the import.
1541
+ * @returns `Success` with a list of additional importable items derived from the original, or
1542
+ * `Failure` with an error message and a {@link Import.Importers.ImporterResultDetail | result detail}.
1543
+ */
1544
+ import(item: IImportable, manager: ResourceManager): DetailedResult<IImportable[], ImporterResultDetail>;
1545
+ }
1546
+
1547
+ /**
1548
+ * Parameters for creating an {@link Import.ImportManager | ImportManager}.
1549
+ * @public
1550
+ */
1551
+ declare interface IImporterCreateParams {
1552
+ /**
1553
+ * The {@link Resources.ResourceManager | resource manager} into which resources
1554
+ * will be imported.
1555
+ */
1556
+ resources: ResourceManager;
1557
+ /**
1558
+ * An optional initial {@link Import.ImportContext | import context} for the import operation.
1559
+ */
1560
+ initialContext?: ImportContext;
1561
+ /**
1562
+ * An optional `FileTree` for importing path items.
1563
+ */
1564
+ fileTree?: FileTree.FileTree;
1565
+ /**
1566
+ * An optional list of {@link Import.Importers.IImporter | importers} to use for the import.
1567
+ */
1568
+ importers?: IImporter[];
1569
+ }
1570
+
1571
+ /**
1572
+ * Parameters to create a {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
1573
+ * @public
1574
+ */
1575
+ declare interface IJsonResourceTypeCreateParams {
1576
+ /**
1577
+ * Optional key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
1578
+ * Defaults to 'json'.
1579
+ */
1580
+ key?: string;
1581
+ /**
1582
+ * Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType}
1583
+ * instance.
1584
+ */
1585
+ index?: number;
1586
+ }
1587
+
1588
+ /**
1589
+ * Interface defining the parameters that can be used to create a new
1590
+ * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.
1591
+ * @public
1592
+ */
1593
+ declare interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTypeCreateParams> {
1594
+ /**
1595
+ * Optional name for the qualifier type. Defaults to 'language'.
1596
+ */
1597
+ name?: string;
1598
+ /**
1599
+ * Optional flag indicating whether the context can be a list of values.
1600
+ * Defaults to `true`.
1601
+ */
1602
+ allowContextList?: boolean;
1603
+ }
1604
+
1605
+ /**
1606
+ * Interface defining the parameters that can be used to create a new
1607
+ * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
1608
+ * @public
1609
+ */
1610
+ declare interface ILiteralQualifierTypeCreateParams {
1611
+ /**
1612
+ * Optional name for the qualifier type. Defaults to 'literal'.
1613
+ */
1614
+ name?: string;
1615
+ /**
1616
+ * Optional flag indicating whether the context can be a list of values.
1617
+ * Defaults to `true`.
1618
+ */
1619
+ allowContextList?: boolean;
1620
+ /**
1621
+ * Optional flag indicating whether the match should be case-sensitive. Defaults to false.
1622
+ */
1623
+ caseSensitive?: boolean;
1624
+ /**
1625
+ * Optional array of enumerated values to further constrain the type. Defaults to no
1626
+ * constraint.
1627
+ */
1628
+ enumeratedValues?: ReadonlyArray<string>;
1629
+ /**
1630
+ * Global index for this qualifier type.
1631
+ */
1632
+ index?: number;
1633
+ }
1634
+
1635
+ /**
1636
+ * Non-validated loose declaration of a {@link Conditions.Condition | condition}.
1637
+ * @public
1638
+ */
1639
+ declare interface ILooseConditionDecl {
1640
+ /**
1641
+ * The name of the {@link Qualifiers.Qualifier | qualifier} to be compared.
1642
+ */
1643
+ qualifierName: string;
1644
+ /**
1645
+ * The value to be compared.
1646
+ */
1647
+ value: string;
1648
+ /**
1649
+ * The operator to be used in the comparison.
1650
+ * Default is 'matches'.
1651
+ */
1652
+ operator?: ConditionOperator;
1653
+ /**
1654
+ * The priority of the condition. Default is the default priority for the qualifier.
1655
+ */
1656
+ priority?: number;
1657
+ /**
1658
+ * The score to be used if the condition is used as a default.
1659
+ */
1660
+ scoreAsDefault?: number;
1661
+ }
1662
+
1663
+ /**
1664
+ * Non-validated loose declaration of a {@link Resources.ResourceCandidate | resource candidate}.
1665
+ * @public
1666
+ */
1667
+ declare interface ILooseResourceCandidateDecl extends IChildResourceCandidateDecl {
1668
+ /**
1669
+ * The {@link ResourceId | id} of the resource.
1670
+ */
1671
+ readonly id: string;
1672
+ /**
1673
+ * The JSON value of the resource.
1674
+ */
1675
+ readonly json: JsonObject;
1676
+ /**
1677
+ * The conditions that must be met for the resource to be selected.
1678
+ */
1679
+ readonly conditions?: ConditionSetDecl;
1680
+ /**
1681
+ * If true, the resource is only a partial representation of the full resource.
1682
+ */
1683
+ readonly isPartial?: boolean;
1684
+ /**
1685
+ * The merge method to be used when merging the resource into the existing resource.
1686
+ * default is 'augment'.
1687
+ */
1688
+ readonly mergeMethod?: ResourceValueMergeMethod;
1689
+ /**
1690
+ * The type of the resource.
1691
+ */
1692
+ readonly resourceTypeName?: string;
1693
+ }
1694
+
1695
+ /**
1696
+ * Normalized non-validated loose declaration of a {@link Resources.ResourceCandidate | resource candidate}.
1697
+ * @public
1698
+ */
1699
+ declare interface ILooseResourceCandidateDecl_2 extends IChildResourceCandidateDecl_2 {
1700
+ /**
1701
+ * The {@link ResourceId | id} of the resource.
1702
+ */
1703
+ readonly id: string;
1704
+ /**
1705
+ * The JSON value of the resource.
1706
+ */
1707
+ readonly json: JsonObject;
1708
+ /**
1709
+ * The conditions that must be met for the resource to be selected.
1710
+ */
1711
+ readonly conditions?: ConditionSetDecl_2;
1712
+ /**
1713
+ * If true, the resource is only a partial representation of the full resource.
1714
+ */
1715
+ readonly isPartial?: boolean;
1716
+ /**
1717
+ * The merge method to be used when merging the resource into the existing resource.
1718
+ * default is 'augment'.
1719
+ */
1720
+ readonly mergeMethod?: ResourceValueMergeMethod;
1721
+ /**
1722
+ * The type of the resource.
1723
+ */
1724
+ readonly resourceTypeName?: string;
1725
+ }
1726
+
1727
+ /**
1728
+ * Non-validated loose declaration of a {@link Resources.Resource | resource}.
1729
+ * @public
1730
+ */
1731
+ declare interface ILooseResourceDecl extends IChildResourceDecl {
1732
+ /**
1733
+ * The id of the resource.
1734
+ */
1735
+ readonly id: string;
1736
+ /**
1737
+ * The name of the type of this resource.
1738
+ */
1739
+ readonly resourceTypeName: string;
1740
+ /**
1741
+ * Possible candidates for this value.
1742
+ */
1743
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl>;
1744
+ }
1745
+
1746
+ /**
1747
+ * Normalized non-validated loose declaration of a {@link Resources.Resource | resource}.
1748
+ * @public
1749
+ */
1750
+ declare interface ILooseResourceDecl_2 extends IChildResourceDecl_2 {
1751
+ /**
1752
+ * The id of the resource.
1753
+ */
1754
+ readonly id: string;
1755
+ /**
1756
+ * The name of the type of this resource.
1757
+ */
1758
+ readonly resourceTypeName: string;
1759
+ /**
1760
+ * Possible candidates for this value.
1761
+ */
1762
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl_2>;
1763
+ }
1764
+
1765
+ declare namespace Import {
1766
+ export {
1767
+ Importers,
1768
+ IImportContext,
1769
+ IValidatedImportContext,
1770
+ ImportContext,
1771
+ isImportable,
1772
+ IImportable,
1773
+ IImportablePath,
1774
+ IImportableFsItem,
1775
+ IImportableJson,
1776
+ IImportableResourceCollection,
1777
+ IImportableResourceTree,
1778
+ Importable,
1779
+ FsItemResultDetail,
1780
+ IFsItemProps,
1781
+ FsItem,
1782
+ IImporterCreateParams,
1783
+ ImportManager
1784
+ }
1785
+ }
1786
+ export { Import }
1787
+
1788
+ /**
1789
+ * Type of importable entities.
1790
+ * @public
1791
+ */
1792
+ declare type Importable = IImportablePath | IImportableFsItem | IImportableJson | IImportableResourceCollection | IImportableResourceTree;
1793
+
1794
+ /**
1795
+ * Class to accumulate context for a resource import operation.
1796
+ * @public
1797
+ */
1798
+ declare class ImportContext implements IValidatedImportContext {
1799
+ /**
1800
+ * {@inheritdoc Import.IImportContext.baseId}
1801
+ */
1802
+ readonly baseId: ResourceId | undefined;
1803
+ /**
1804
+ * {@inheritdoc Import.IImportContext.conditions}
1805
+ */
1806
+ readonly conditions: ReadonlyArray<IConditionDecl>;
1807
+ /**
1808
+ * Protected {@link Import.ImportContext | import context} for derived classes.
1809
+ * Public consumers use {@link Import.ImportContext.create | create} to create new instances.
1810
+ * @param baseId - The base ID for the import context.
1811
+ * @param conditions - Conditions to be applied to resources imported in this context.
1812
+ */
1813
+ protected constructor({ baseId, conditions }: IImportContext);
1814
+ /**
1815
+ * Factory method to create a new {@link Import.ImportContext | import context}.
1816
+ * @param context - The {@link Import.IImportContext | import context} to create
1817
+ * the new context from.
1818
+ * @returns `Success` with the new {@link Import.ImportContext | import context}
1819
+ * if successful, or `Failure` with an error message if creation fails.
1820
+ */
1821
+ static create(context?: IImportContext): Result<ImportContext>;
1822
+ /**
1823
+ * Adds conditions to the import context.
1824
+ * @param conditions - Conditions to be added to the import context.
1825
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the added conditions
1826
+ * if successful, or `Failure` with an error message if the operation fails.
1827
+ */
1828
+ withConditions(conditions: IConditionDecl[]): Result<ImportContext>;
1829
+ /**
1830
+ * Appends names to the base ID of the import context.
1831
+ * @param name - The base name to set.
1832
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID
1833
+ * if successful, or `Failure` with an error message if the operation fails.
1834
+ */
1835
+ withName(...names: string[]): Result<ImportContext>;
1836
+ /**
1837
+ * Extends the import context with additional name segments and conditions.
1838
+ * @param context - The {@link Import.IImportContext | import context} to extend this context with.
1839
+ * @returns `Success` with a new {@link Import.ImportContext | import context}
1840
+ * containing the extended context if successful, or `Failure` with an error
1841
+ * message if the operation fails.
1842
+ */
1843
+ extend(context?: IValidatedImportContext): Result<ImportContext>;
1844
+ }
1845
+
1846
+ /**
1847
+ * Possible results of an import operation.
1848
+ * @public
1849
+ */
1850
+ declare type ImporterResultDetail = 'consumed' | 'processed' | 'skipped' | 'failed';
1851
+
1852
+ declare namespace Importers {
1853
+ export {
1854
+ ImporterResultDetail,
1855
+ IImporter,
1856
+ CollectionImporter,
1857
+ IFsItemImporterCreateParams,
1858
+ FsItemImporter,
1859
+ JsonImporter,
1860
+ IPathImporterCreateParams,
1861
+ PathImporter
1862
+ }
1863
+ }
1864
+
1865
+ /**
1866
+ * Class to manage the import of resources from various sources.
1867
+ * @public
1868
+ */
1869
+ declare class ImportManager {
1870
+ /**
1871
+ * The {@link Resources.ResourceManager | resource manager} into which resources
1872
+ * will be imported.
1873
+ */
1874
+ readonly resources: ResourceManager;
1875
+ /**
1876
+ * The list of {@link Import.Importers.IImporter | importers} to use for the
1877
+ * import operations.
1878
+ */
1879
+ get importers(): ReadonlyArray<IImporter>;
1880
+ /**
1881
+ * The initial {@link Import.ImportContext | import context} for the import operation.
1882
+ */
1883
+ initialContext: ImportContext;
1884
+ protected _stack: IImportable[];
1885
+ protected _importers: IImporter[];
1886
+ /**
1887
+ * Protected constructor for the {@link Import.ImportManager | ImportManager}.
1888
+ * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.
1889
+ */
1890
+ protected constructor(params: IImporterCreateParams);
1891
+ /**
1892
+ * Factory method to create a new {@link Import.ImportManager | ImportManager}.
1893
+ * @param params - Parameters for creating the {@link Import.ImportManager | ImportManager}.
1894
+ * @returns `Success` with the new {@link Import.ImportManager | ImportManager}
1895
+ * if successful, or `Failure` with an error message if creation fails.
1896
+ */
1897
+ static create(params: IImporterCreateParams): Result<ImportManager>;
1898
+ /**
1899
+ * Imports resources from an {@link Import.IImportable | importable} object.
1900
+ * @param importable - The {@link Import.IImportable | importable} object to import.
1901
+ * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,
1902
+ * or `Failure` with an error message if the import fails.
1903
+ */
1904
+ import(importable: IImportable): Result<ImportManager>;
1905
+ /**
1906
+ * Imports resources from a file system path.
1907
+ * @param filePath - The path to import resources from.
1908
+ * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,
1909
+ * or `Failure` with an error message if the import fails.
1910
+ */
1911
+ importFromFileSystem(filePath: string): Result<ImportManager>;
1912
+ /**
1913
+ * Gets the default importers using supplied {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers}
1914
+ * and optional `FileTree`.
1915
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for the import.
1916
+ * @param tree - An optional `FileTree` for importing path items.
1917
+ * @returns A read-only array of {@link Import.Importers.IImporter | importers}.
1918
+ */
1919
+ static getDefaultImporters(qualifiers: IReadOnlyQualifierCollector, tree?: FileTree.FileTree): ReadonlyArray<IImporter>;
1920
+ /**
1921
+ * Imports any items on the import stack.
1922
+ * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,
1923
+ * or `Failure` with an error message if the import fails.
1924
+ * @public
1925
+ */
1926
+ protected _import(): Result<ImportManager>;
1927
+ }
1928
+
1929
+ /**
1930
+ * Parameters for creating a {@link Import.Importers.PathImporter | PathImporter}.
1931
+ * @public
1932
+ */
1933
+ declare interface IPathImporterCreateParams {
1934
+ qualifiers: IReadOnlyQualifierCollector;
1935
+ tree?: FileTree.FileTree;
1936
+ ignoreFileTypes?: string[];
1937
+ }
1938
+
1939
+ /**
1940
+ * Parameters for creating a new {@link Qualifiers.QualifierCollector}.
1941
+ * @public
1942
+ */
1943
+ declare interface IQualifierCollectorCreateParams {
1944
+ /**
1945
+ * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} used to
1946
+ * create {@link Qualifiers.Qualifier | qualifiers} from {@link Qualifiers.IQualifierDecl | declarations}.
1947
+ */
1948
+ qualifierTypes: ReadOnlyQualifierTypeCollector;
1949
+ /**
1950
+ * Optional list of {@link Qualifiers.IQualifierDecl | declarations} for the qualifiers to add to the collection
1951
+ * upon creation.
1952
+ */
1953
+ qualifiers?: IQualifierDecl[];
1954
+ }
1955
+
1956
+ /**
1957
+ * Context necessary to convert a string or number to a
1958
+ * {@link Qualifiers.Qualifier | Qualifier} object.
1959
+ * @public
1960
+ */
1961
+ declare interface IQualifierConvertContext {
1962
+ qualifiers: IReadOnlyQualifierCollector;
1963
+ }
1964
+
1965
+ /**
1966
+ * Simple declaration for a {@link Qualifiers.Qualifier | Qualifier}.
1967
+ * @public
1968
+ */
1969
+ declare interface IQualifierDecl {
1970
+ name: string;
1971
+ typeName: string;
1972
+ defaultPriority: number;
1973
+ token?: string;
1974
+ tokenIsOptional?: boolean;
1975
+ }
1976
+
1977
+ /**
1978
+ * Context necessary to convert a {@link Qualifiers.IValidatedQualifierDecl | validated qualifier declaration}.
1979
+ * @public
1980
+ */
1981
+ declare interface IQualifierDeclConvertContext {
1982
+ readonly qualifierTypes: ReadOnlyQualifierTypeCollector;
1983
+ qualifierIndex?: number;
1984
+ }
1985
+
1986
+ /**
1987
+ * Interface for a qualifier type. A qualifier type implements the build and
1988
+ * runtime semantics for some class of related qualifiers (e.g. language,
1989
+ * territories, etc).
1990
+ * @public
1991
+ */
1992
+ declare interface IQualifierType extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
1993
+ /**
1994
+ * The name of the qualifier type.
1995
+ */
1996
+ readonly name: QualifierTypeName;
1997
+ /**
1998
+ * Unique key for this qualifier.
1999
+ */
2000
+ readonly key: QualifierTypeName;
2001
+ /**
2002
+ * Global index for this qualifier type. Immutable once set, either at
2003
+ * construction or using {@link QualifierTypes.IQualifierType.setIndex | setIndex}.
2004
+ */
2005
+ readonly index: QualifierTypeIndex | undefined;
2006
+ /**
2007
+ * Validates a condition value for this qualifier type.
2008
+ * @param value - The string value to validate.
2009
+ * @returns `Success` with the {@link QualifierConditionValue | validated value} if the value
2010
+ * is valid for use in a condition, `Failure` with error details otherwise.
2011
+ */
2012
+ isValidConditionValue(value: string): value is QualifierConditionValue;
2013
+ /**
2014
+ * Validates a context value for this qualifier type.
2015
+ * @param value - The string value to validate.
2016
+ * @returns `Success` with the {@link QualifierContextValue | validated value} if the value
2017
+ * is valid for use in a runtime context, `Failure` with error details otherwise.
2018
+ */
2019
+ isValidContextValue(value: string): value is QualifierContextValue;
2020
+ /**
2021
+ * Validates that a value and optional operator are valid for use in a condition
2022
+ * for qualifiers of this type.
2023
+ * @param value - The string value to validate.
2024
+ * @param operator - An optional operator to validate. Defaults to 'matches'.
2025
+ */
2026
+ validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
2027
+ /**
2028
+ * Validates that a value is valid for use in a runtime context for qualifiers of this type.
2029
+ * @param value - The string value to validate.
2030
+ * @returns `Success` with the {@link QualifierContextValue | validated value} if the value
2031
+ * is valid for use in a runtime context, `Failure` with error details otherwise.
2032
+ */
2033
+ validateContextValue(value: string): Result<QualifierContextValue>;
2034
+ /**
2035
+ * Determines the extent to which a condition matches a context value for this qualifier type.
2036
+ * @param condition - The condition value to evaluate.
2037
+ * @param context - The context value to evaluate.
2038
+ * @param operator - The operator to use in evaluating the match.
2039
+ * @returns a {@link QualifierMatchScore | score} indicating the extent to which the condition
2040
+ * matches the context value.
2041
+ */
2042
+ matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
2043
+ /**
2044
+ * Sets the index for this qualifier type. Once set, index is
2045
+ * immutable.
2046
+ */
2047
+ setIndex(index: number): Result<QualifierTypeIndex>;
2048
+ }
2049
+
2050
+ /**
2051
+ * Parameters for creating a new {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector}.
2052
+ * @public
2053
+ */
2054
+ declare interface IQualifierTypeCollectorCreateParams {
2055
+ /**
2056
+ * Optional list of {@link QualifierTypes.QualifierType | QualifierTypes} to add to the collector
2057
+ * on creation.
2058
+ */
2059
+ qualifierTypes?: QualifierType[];
2060
+ }
2061
+
2062
+ /**
2063
+ * Context necessary to convert a qualifier name or number to an
2064
+ * instantiated {@link QualifierTypes.QualifierType}.
2065
+ * @public
2066
+ */
2067
+ declare interface IQualifierTypeConvertContext {
2068
+ qualifierTypes: ReadOnlyQualifierTypeCollector;
2069
+ }
2070
+
2071
+ /**
2072
+ * Parameters used to create a base {@link QualifierTypes.QualifierType | qualifier type}.
2073
+ * @public
2074
+ */
2075
+ declare interface IQualifierTypeCreateParams {
2076
+ /**
2077
+ * The name of the qualifier type. No default value.
2078
+ */
2079
+ name: string;
2080
+ /**
2081
+ * Global index for this qualifier type.
2082
+ */
2083
+ index?: number;
2084
+ /**
2085
+ * Flag indicating whether this qualifier type allows a list of values in a context.
2086
+ * Defaults to `false`.
2087
+ */
2088
+ allowContextList?: boolean;
2089
+ }
2090
+
2091
+ /**
2092
+ * Readonly version of {@link Qualifiers.QualifierCollector | QualifierCollector}.
2093
+ * @public
2094
+ */
2095
+ declare interface IReadOnlyQualifierCollector extends Collections.IReadOnlyValidatingCollector<Qualifier> {
2096
+ /**
2097
+ * {@inheritdoc Qualifiers.QualifierCollector.qualifierTypes}
2098
+ */
2099
+ readonly qualifierTypes: ReadOnlyQualifierTypeCollector;
2100
+ /**
2101
+ * Gets a {@link Qualifiers.Qualifier | qualifier} by name or token.
2102
+ * @param nameOrToken - The name or token of the qualifier to retrieve.
2103
+ * @returns `Success` with the qualifier if found, or `Failure` if not.
2104
+ */
2105
+ getByNameOrToken(nameOrToken: string): Result<Qualifier>;
2106
+ /**
2107
+ * Checks if a qualifier with a given name or token is in the collection.
2108
+ * @param nameOrToken - The name or token of the qualifier to check.
2109
+ * @returns `true` if the qualifier is in the collection, `false` if not.
2110
+ */
2111
+ hasNameOrToken(nameOrToken: string): boolean;
2112
+ }
2113
+
2114
+ /**
2115
+ * Parameters for creating a {@link Resources.ResourceBuilder}.
2116
+ * @public
2117
+ */
2118
+ declare interface IResourceBuilderCreateParams {
2119
+ id: string;
2120
+ typeName?: string;
2121
+ conditionSets: ConditionSetCollector;
2122
+ resourceTypes: ReadOnlyResourceTypeCollector;
2123
+ }
2124
+
2125
+ /**
2126
+ * Parameters to create a {@link Resources.ResourceCandidate | ResourceCandidate}.
2127
+ * @public
2128
+ */
2129
+ declare interface IResourceCandidateCreateParams {
2130
+ id: string;
2131
+ decl: ResourceJson.Json.IChildResourceCandidateDecl;
2132
+ resourceType?: ResourceType;
2133
+ parentConditions?: ReadonlyArray<Condition>;
2134
+ conditionSets: ConditionSetCollector;
2135
+ }
2136
+
2137
+ /**
2138
+ * Non-validated declaration of a collection of resources.
2139
+ * @public
2140
+ */
2141
+ declare interface IResourceCollectionDecl {
2142
+ readonly baseName?: string;
2143
+ readonly baseConditions?: ConditionSetDecl;
2144
+ readonly candidates?: ReadonlyArray<ILooseResourceCandidateDecl>;
2145
+ readonly resources?: ReadonlyArray<ILooseResourceDecl>;
2146
+ readonly collections?: ReadonlyArray<IResourceCollectionDecl>;
2147
+ }
2148
+
2149
+ /**
2150
+ * Normalized non-validated declaration of a collection of resources.
2151
+ * @public
2152
+ */
2153
+ declare interface IResourceCollectionDecl_2 {
2154
+ readonly baseName?: string;
2155
+ readonly baseConditions?: ConditionSetDecl_2;
2156
+ readonly candidates?: ReadonlyArray<ILooseResourceCandidateDecl_2>;
2157
+ readonly resources?: ReadonlyArray<ILooseResourceDecl_2>;
2158
+ readonly collections?: ReadonlyArray<IResourceCollectionDecl_2>;
2159
+ }
2160
+
2161
+ /**
2162
+ * Parameters for creating a {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.
2163
+ * @public
2164
+ */
2165
+ declare interface IResourceCollectorCreateParams {
2166
+ resourceTypes?: ResourceType[];
2167
+ }
2168
+
2169
+ /**
2170
+ * Parameters used to create a {@link Resources.Resource | Resource} object.
2171
+ * @public
2172
+ */
2173
+ declare interface IResourceCreateParams {
2174
+ /**
2175
+ * The id of the resource.
2176
+ */
2177
+ id?: string;
2178
+ /**
2179
+ * Optional {@link ResourceTypes.ResourceType | type} of the resource. If not specified, the type will be inferred
2180
+ * from the candidates.
2181
+ */
2182
+ resourceType?: ResourceType;
2183
+ /**
2184
+ * Array of {@link Resources.ResourceCandidate | candidates} for the resource.
2185
+ */
2186
+ candidates: ReadonlyArray<ResourceCandidate>;
2187
+ }
2188
+
2189
+ /**
2190
+ * Generic container for resource and resource candidate
2191
+ * declarations.
2192
+ * @public
2193
+ */
2194
+ declare interface IResourceDeclContainer {
2195
+ getLooseResources(): ReadonlyArray<Normalized.ILooseResourceDecl>;
2196
+ getLooseCandidates(): ReadonlyArray<Normalized.ILooseResourceCandidateDecl>;
2197
+ }
2198
+
2199
+ /**
2200
+ * Interface for parameters to the {@link Resources.ResourceManager.create | ResourceManager create method}.
2201
+ * @public
2202
+ */
2203
+ declare interface IResourceManagerCreateParams {
2204
+ qualifiers: IReadOnlyQualifierCollector;
2205
+ resourceTypes: ReadOnlyResourceTypeCollector;
2206
+ }
2207
+
2208
+ /**
2209
+ * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree node.
2210
+ * @public
2211
+ */
2212
+ declare interface IResourceTreeChildNodeDecl {
2213
+ readonly resources?: Record<string, IChildResourceDecl>;
2214
+ readonly children?: Record<string, IResourceTreeChildNodeDecl>;
2215
+ }
2216
+
2217
+ /**
2218
+ * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree node.
2219
+ * @public
2220
+ */
2221
+ declare interface IResourceTreeChildNodeDecl_2 {
2222
+ readonly resources?: Record<string, IChildResourceDecl_2>;
2223
+ readonly children?: Record<string, IResourceTreeChildNodeDecl_2>;
2224
+ }
2225
+
2226
+ /**
2227
+ * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree root.
2228
+ * @public
2229
+ */
2230
+ declare interface IResourceTreeRootDecl extends IResourceTreeChildNodeDecl {
2231
+ readonly baseName?: string;
2232
+ readonly resources?: Record<string, IChildResourceDecl>;
2233
+ readonly children?: Record<string, IResourceTreeChildNodeDecl>;
2234
+ }
2235
+
2236
+ /**
2237
+ * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree root.
2238
+ * @public
2239
+ */
2240
+ declare interface IResourceTreeRootDecl_2 extends IResourceTreeChildNodeDecl_2 {
2241
+ readonly baseName?: string;
2242
+ readonly resources?: Record<string, IChildResourceDecl_2>;
2243
+ readonly children?: Record<string, IResourceTreeChildNodeDecl_2>;
2244
+ }
2245
+
2246
+ /**
2247
+ * Type guard for {@link Import.Importable | importables}.
2248
+ * @param i - The entity to check.
2249
+ * @returns `true` if the supplied {@link Import.IImportable | IImportable} is a
2250
+ * {@link Import.Importable | known importable}, `false` otherwise.
2251
+ * @public
2252
+ */
2253
+ declare function isImportable(i: IImportable): i is Importable;
2254
+
2255
+ /**
2256
+ * Determines whether a number is a valid condition index.
2257
+ * @param index - the number to validate
2258
+ * @returns true if the number is a valid condition index, false otherwise.
2259
+ * @public
2260
+ */
2261
+ declare function isValidConditionIndex(index: number): index is ConditionIndex;
2262
+
2263
+ /**
2264
+ * Determines whether a string is a valid condition key. A condition key has
2265
+ * the format:
2266
+ * `<qualifierName>(-<operator>)?-[<value>]@<priority>`
2267
+ * where operator is omitted for the default 'matches' operator.
2268
+ * @param key - the string to validate
2269
+ * @returns `true` if the string is a valid condition key, `false` otherwise.
2270
+ * @public
2271
+ */
2272
+ declare function isValidConditionKey(key: string): key is ConditionKey;
2273
+
2274
+ /**
2275
+ * Determines whether a string is a valid condition operator.
2276
+ * @param operator - the string to validate
2277
+ * @returns true if the string is a valid condition operator, false otherwise.
2278
+ * @public
2279
+ */
2280
+ declare function isValidConditionOperator(operator: string): operator is ConditionOperator;
2281
+
2282
+ /**
2283
+ * Determines whether a number is a valid priority.
2284
+ * @param priority - the number to validate
2285
+ * @returns true if the number is a valid priority, false otherwise.
2286
+ * @public
2287
+ */
2288
+ declare function isValidConditionPriority(priority: number): priority is ConditionPriority;
2289
+
2290
+ /**
2291
+ * Determines whether a string is a valid condition set hash.
2292
+ * @param hash - the string to validate.
2293
+ * @returns `true` if the string is a valid condition set hash, `false` otherwise.
2294
+ * @public
2295
+ */
2296
+ declare function isValidConditionSetHash(hash: string): hash is ConditionSetHash;
2297
+
2298
+ /**
2299
+ * Determines whether a number is a valid condition set index.
2300
+ * @param index - the number to validate
2301
+ * @returns true if the number is a valid condition set index, false otherwise.
2302
+ * @public
2303
+ */
2304
+ declare function isValidConditionSetIndex(index: number): index is ConditionSetIndex;
2305
+
2306
+ /**
2307
+ * Determines whether a string is a valid condition set key.
2308
+ * @param key - the string to validate.
2309
+ * @returns `true` if the string is a valid condition set key, `false` otherwise.
2310
+ * @public
2311
+ */
2312
+ declare function isValidConditionSetKey(key: string): key is ConditionSetKey;
2313
+
2314
+ /**
2315
+ * Determines whether a string is a valid condition set token.
2316
+ * @param token - the string to validate.
2317
+ * @returns `true` if the string is a valid condition set token, `false` otherwise.
2318
+ * @public
2319
+ */
2320
+ declare function isValidConditionSetToken(token: string): token is ConditionSetToken;
2321
+
2322
+ /**
2323
+ * Determines whether a string is a valid {@link ConditionToken | condition token}.
2324
+ * A condition token has the format:
2325
+ * `<qualifierName>=<value>` or `<value>`
2326
+ * @param token -
2327
+ * @returns `true` if the string is a valid condition token, `false` otherwise.
2328
+ * @public
2329
+ */
2330
+ declare function isValidConditionToken(token: string): token is ConditionToken;
2331
+
2332
+ /**
2333
+ * Determines whether a number is a valid decision index.
2334
+ * @param index - the number to validate
2335
+ * @returns `true` if the number is a valid decision index, `false` otherwise.
2336
+ * @public
2337
+ */
2338
+ declare function isValidDecisionIndex(index: number): index is DecisionIndex;
2339
+
2340
+ /**
2341
+ * Determines whether a string is a valid decision key.
2342
+ * @param key - the string to validate
2343
+ * @returns `true` if the string is a valid decision key, `false` otherwise.
2344
+ * @public
2345
+ */
2346
+ declare function isValidDecisionKey(key: string): key is DecisionKey;
2347
+
2348
+ /**
2349
+ * Determines whether a number is a valid qualifier index.
2350
+ * @param index - the number to validate
2351
+ * @returns true if the number is a valid qualifier index, false otherwise.
2352
+ * @public
2353
+ */
2354
+ declare function isValidQualifierIndex(index: number): index is QualifierIndex;
2355
+
2356
+ /**
2357
+ * Determines whether a supplied value is a valid {@link QualifierMatchScore | match score}.
2358
+ * @param value - The value to validate.
2359
+ * @returns - `true` if the value is a valid match score, `false` otherwise.
2360
+ * @public
2361
+ */
2362
+ declare function isValidQualifierMatchScore(value: number): value is QualifierMatchScore;
2363
+
2364
+ /**
2365
+ * Determines whether a string is a valid qualifier name.
2366
+ * @param name - the string to validate
2367
+ * @returns true if the string is a valid qualifier name, false otherwise.
2368
+ * @public
2369
+ */
2370
+ declare function isValidQualifierName(name: string): name is QualifierName;
2371
+
2372
+ /**
2373
+ * Determines whether a number is a valid qualifier type index.
2374
+ * @param index - the number to validate
2375
+ * @returns true if the number is a valid qualifier type index, false otherwise.
2376
+ * @public
2377
+ */
2378
+ declare function isValidQualifierTypeIndex(index: number): index is QualifierTypeIndex;
2379
+
2380
+ /***
2381
+ * Determines whether a string is a valid qualifier type name.
2382
+ * @param name - the string to validate
2383
+ * @returns true if the string is a valid qualifier type name, false otherwise.
2384
+ * @public
2385
+ */
2386
+ declare function isValidQualifierTypeName(name: string): name is QualifierTypeName;
2387
+
2388
+ /**
2389
+ * Checks if the given ID is a valid resource ID.
2390
+ *
2391
+ * @param id - The ID to validate.
2392
+ * @returns `true` if the ID is a valid resource ID, otherwise `false`.
2393
+ * @public
2394
+ */
2395
+ declare function isValidResourceId(id: string): id is ResourceId;
2396
+
2397
+ /**
2398
+ * Checks if the given index is a valid resource index.
2399
+ *
2400
+ * @param index - The index to validate.
2401
+ * @returns `true` if the index is a valid resource index, otherwise `false`.
2402
+ * @public
2403
+ */
2404
+ declare function isValidResourceIndex(index: number): index is ResourceIndex;
2405
+
2406
+ /**
2407
+ * Checks if the given name is a valid resource name.
2408
+ *
2409
+ * @param name - The name to validate.
2410
+ * @returns `true` if the name is a valid resource name, otherwise `false`.
2411
+ * @public
2412
+ */
2413
+ declare function isValidResourceName(name: string): name is ResourceName;
2414
+
2415
+ /**
2416
+ * Checks if the given index is a valid resource type index.
2417
+ *
2418
+ * @param index - The index to validate.
2419
+ * @returns `true` if the index is a valid resource type index, otherwise `false`.
2420
+ * @public
2421
+ */
2422
+ declare function isValidResourceTypeIndex(index: number): index is ResourceTypeIndex;
2423
+
2424
+ /**
2425
+ * Checks if the given name is a valid resource type name.
2426
+ *
2427
+ * @param name - The name to validate.
2428
+ * @returns `true` if the name is a valid resource type name, otherwise `false`.
2429
+ * @public
2430
+ */
2431
+ declare function isValidResourceTypeName(name: string): name is ResourceTypeName;
2432
+
2433
+ /**
2434
+ * Parameters used to create a new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} instance.
2435
+ * @public
2436
+ */
2437
+ declare interface ITerritoryQualifierTypeCreateParams {
2438
+ /**
2439
+ * {@inheritdoc QualifierTypes.IQualifierTypeCreateParams.name}
2440
+ */
2441
+ name?: string;
2442
+ /**
2443
+ * {@inheritdoc QualifierTypes.IQualifierTypeCreateParams.allowContextList}
2444
+ */
2445
+ allowContextList?: boolean;
2446
+ /**
2447
+ * {@inheritdoc QualifierTypes.IQualifierTypeCreateParams.index}
2448
+ */
2449
+ index?: number;
2450
+ /**
2451
+ * Optional array enumerating allowed territories to further constrain the type.
2452
+ */
2453
+ allowedTerritories?: string[];
2454
+ }
2455
+
2456
+ /**
2457
+ * Validated declaration of a {@link Conditions.Condition | condition} with all defaults applied.
2458
+ * @public
2459
+ */
2460
+ declare interface IValidatedConditionDecl {
2461
+ qualifier: Qualifier;
2462
+ value: QualifierConditionValue;
2463
+ operator: ConditionOperator;
2464
+ priority: ConditionPriority;
2465
+ scoreAsDefault?: QualifierMatchScore;
2466
+ index?: ConditionIndex;
2467
+ }
2468
+
2469
+ /**
2470
+ * Validated declaration of a {@link Conditions.ConditionSet | set of conditions}.
2471
+ * @public
2472
+ */
2473
+ declare interface IValidatedConditionSetDecl {
2474
+ conditions: ReadonlyArray<Condition>;
2475
+ index?: number;
2476
+ }
2477
+
2478
+ /**
2479
+ * Accumulated context of a resource import operation.
2480
+ * @public
2481
+ */
2482
+ declare interface IValidatedImportContext {
2483
+ /**
2484
+ * Base ID for the import context for resources imported
2485
+ * in this context.
2486
+ */
2487
+ readonly baseId?: ResourceId;
2488
+ /**
2489
+ * Conditions to be applied to resources imported in this context.
2490
+ */
2491
+ readonly conditions: ReadonlyArray<IConditionDecl>;
2492
+ }
2493
+
2494
+ /**
2495
+ * Validated declaration for a {@link Qualifiers.Qualifier | Qualifier}.
2496
+ * @public
2497
+ */
2498
+ declare interface IValidatedQualifierDecl {
2499
+ /**
2500
+ * The name of the qualifier.
2501
+ */
2502
+ name: QualifierName;
2503
+ /**
2504
+ * The token used to identify the qualifier in the name or
2505
+ * path of a resource being imported.
2506
+ */
2507
+ token: QualifierName;
2508
+ /**
2509
+ * The {@link QualifierTypes.QualifierType | type} of the qualifier.
2510
+ */
2511
+ type: QualifierType;
2512
+ /**
2513
+ * The default {@link ConditionPriority | priority} of conditions
2514
+ * that depend on this qualifier.
2515
+ */
2516
+ defaultPriority: ConditionPriority;
2517
+ /**
2518
+ * Indicates whether the token is optional when parsing a resource token.
2519
+ */
2520
+ tokenIsOptional: boolean;
2521
+ /**
2522
+ * Index of the qualifier.
2523
+ */
2524
+ index: QualifierIndex | undefined;
2525
+ }
2526
+
2527
+ /**
2528
+ * Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
2529
+ * to create a new {@link ResourceId | resource ID}. Returns `undefined` if no names are defined.
2530
+ *
2531
+ * @param base - The base name or ID to join.
2532
+ * @param names - Additional names to join.
2533
+ * @returns `Success` with the new ID if the base and names are valid, `Success` with `undefined`
2534
+ * if names were present, or `Failure` with an error message if the resulting id is invalid.
2535
+ * @public
2536
+ */
2537
+ declare function joinOptionalResourceIds(...ids: (string | undefined)[]): Result<ResourceId | undefined>;
2538
+
2539
+ /**
2540
+ * Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
2541
+ * to create a new {@link ResourceId | resource ID}. Fails if resulting ID is invalid or empty.
2542
+ *
2543
+ * @param base - The base name or ID to join.
2544
+ * @param names - Additional names to join.
2545
+ * @returns `Success` with the new ID if the base and names are valid, or `Failure` with an error message
2546
+ * if not.
2547
+ * @public
2548
+ */
2549
+ declare function joinResourceIds(...ids: (string | undefined)[]): Result<ResourceId>;
2550
+
2551
+ declare namespace Json {
2552
+ export {
2553
+ ILooseConditionDecl,
2554
+ IChildConditionDecl,
2555
+ ConditionSetDeclAsArray,
2556
+ ConditionSetDeclAsRecord,
2557
+ ConditionSetDecl,
2558
+ IChildResourceCandidateDecl,
2559
+ ILooseResourceCandidateDecl,
2560
+ IChildResourceDecl,
2561
+ ILooseResourceDecl,
2562
+ IResourceTreeChildNodeDecl,
2563
+ IResourceTreeRootDecl,
2564
+ IResourceCollectionDecl
2565
+ }
2566
+ }
2567
+
2568
+ /**
2569
+ * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a JSON object.
2570
+ * @public
2571
+ */
2572
+ declare class JsonImporter implements IImporter {
2573
+ /**
2574
+ * {@inheritdoc Import.Importers.IImporter.types}
2575
+ */
2576
+ readonly types: ReadonlyArray<string>;
2577
+ /**
2578
+ * Protected {@link Import.Importers.JsonImporter | JsonImporter} constructor for derived classes.
2579
+ */
2580
+ protected constructor();
2581
+ /**
2582
+ * Creates a new {@link Import.Importers.JsonImporter | JsonImporter} instance.
2583
+ * @returns `Success` with the new {@link Import.Importers.JsonImporter | JsonImporter} if successful,
2584
+ * `Failure` otherwise.
2585
+ */
2586
+ static create(): Result<JsonImporter>;
2587
+ /**
2588
+ * {@inheritdoc Import.Importers.IImporter.import}
2589
+ */
2590
+ import(item: IImportable, manager: ResourceManager): DetailedResult<IImportable[], ImporterResultDetail>;
2591
+ private _tryImportResourceCollection;
2592
+ private _tryImportResourceTree;
2593
+ private _tryImportResource;
2594
+ }
2595
+
2596
+ /**
2597
+ * Implementation of a {@link ResourceTypes.ResourceType | ResourceType} for JSON values.
2598
+ * @public
2599
+ */
2600
+ declare class JsonResourceType extends ResourceType<JsonObject> {
2601
+ /**
2602
+ * Protected {@link ResourceTypes.JsonResourceType | JsonResourceType} constructor for use by subclasses.
2603
+ * Use {@link ResourceTypes.JsonResourceType.create | JsonResourceType.create} to create a new instance.
2604
+ * @param key - The key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
2605
+ * @param index - Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
2606
+ */
2607
+ protected constructor(key: ResourceTypeName, index?: number);
2608
+ /**
2609
+ * Factory method to create a new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
2610
+ * @param params - {@link ResourceTypes.IJsonResourceTypeCreateParams | Parameters} to create the new instance.
2611
+ * @returns `Success` with the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance if successful
2612
+ * or `Failure` with an error message if not.
2613
+ */
2614
+ static create(params?: IJsonResourceTypeCreateParams): Result<JsonResourceType>;
2615
+ /**
2616
+ * {@inheritdoc ResourceTypes.ResourceType.(validateDeclaration:1)}
2617
+ */
2618
+ validateDeclaration(json: JsonValue, isPartial: true, mergeMethod?: ResourceValueMergeMethod): Result<Partial<JsonObject>>;
2619
+ /**
2620
+ * {@inheritdoc ResourceTypes.ResourceType.(validateDeclaration:2)}
2621
+ */
2622
+ validateDeclaration(json: JsonValue, isPartial: false, mergeMethod?: ResourceValueMergeMethod): Result<JsonObject>;
2623
+ /**
2624
+ * {@inheritdoc ResourceTypes.ResourceType.(validateDeclaration:3)}
2625
+ */
2626
+ validateDeclaration(json: JsonValue, isPartial: boolean, mergeMethod?: ResourceValueMergeMethod): Result<JsonObject | Partial<JsonObject>>;
2627
+ /**
2628
+ * {@inheritdoc ResourceTypes.ResourceType.(validate:1)}
2629
+ */
2630
+ validate(json: JsonObject, isPartial: true): Result<JsonObject>;
2631
+ /**
2632
+ * {@inheritdoc ResourceTypes.ResourceType.(validate:2)}
2633
+ */
2634
+ validate(json: JsonObject, isPartial: false): Result<JsonObject>;
2635
+ /**
2636
+ * {@inheritdoc ResourceTypes.ResourceType.(validate:3)}
2637
+ */
2638
+ validate(json: JsonObject, isPartial: boolean): Result<JsonObject>;
2639
+ }
2640
+
2641
+ /**
2642
+ * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags applying
2643
+ * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
2644
+ * Accepts a list of language tags in the context by default.
2645
+ * @public
2646
+ */
2647
+ declare class LanguageQualifierType extends QualifierType {
2648
+ /**
2649
+ * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
2650
+ * @param name - Optional name for the qualifier type. Defaults to 'language'.
2651
+ * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to `true`.
2652
+ * @public
2653
+ */
2654
+ protected constructor({ name, allowContextList, index }: ILanguageQualifierTypeCreateParams);
2655
+ /**
2656
+ * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
2657
+ * @param params - Optional {@link QualifierTypes.ILanguageQualifierTypeCreateParams | parameters} to use when creating
2658
+ * the new instance.
2659
+ * @returns `Success` with the new {@link QualifierTypes.LanguageQualifierType | language qualifier type} if successful, `Failure`
2660
+ * otherwise.
2661
+ */
2662
+ static create(params?: ILanguageQualifierTypeCreateParams): Result<LanguageQualifierType>;
2663
+ /**
2664
+ * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
2665
+ */
2666
+ isValidConditionValue(value: string): value is QualifierConditionValue;
2667
+ /**
2668
+ * Matches a single language condition against a single language context value using
2669
+ * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
2670
+ * @param condition - The language condition value to match.
2671
+ * @param context - The language context value to match against.
2672
+ * @param operator - The operator to use for the match. Must be 'matches'.
2673
+ * @returns - The match score, or `noMatch` if the match fails.
2674
+ */
2675
+ protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
2676
+ }
2677
+
2678
+ /**
2679
+ * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value., optionally case-sensitive
2680
+ * or matching against an ordered list of values at runtime.
2681
+ * @public
2682
+ */
2683
+ declare class LiteralQualifierType extends QualifierType {
2684
+ /**
2685
+ * Indicates whether the qualifier match is case-sensitive.
2686
+ */
2687
+ readonly caseSensitive: boolean;
2688
+ /**
2689
+ * Optional array of enumerated values to further constrain the type.
2690
+ */
2691
+ readonly enumeratedValues?: ReadonlyArray<QualifierConditionValue>;
2692
+ /**
2693
+ * Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
2694
+ * @param name - Optional name for the qualifier type. Defaults to 'literal'.
2695
+ * @param caseSensitive - Optional flag indicating whether the match should be case-sensitive. Defaults to false.
2696
+ * @param allowContextList - Optional flag indicating whether the context can be a list of values. Defaults to false.
2697
+ * @public
2698
+ */
2699
+ protected constructor({ name, caseSensitive, allowContextList, enumeratedValues, index }: ILiteralQualifierTypeCreateParams);
2700
+ /**
2701
+ * Determines whether a value is a valid condition value for a literal qualifier. The
2702
+ * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} accepts
2703
+ * any identifier as a valid condition value.
2704
+ * @param value - The value to validate.
2705
+ * @returns `true` if the value is a valid condition value, `false` otherwise.
2706
+ */
2707
+ isValidConditionValue(value: string): value is QualifierConditionValue;
2708
+ /**
2709
+ * {@inheritdoc QualifierTypes.QualifierType._matchOne}
2710
+ */
2711
+ protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
2712
+ /**
2713
+ * Creates a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
2714
+ * @param params - Optional {@link QualifierTypes.ILiteralQualifierTypeCreateParams | parameters}
2715
+ * to use when creating the new instance.
2716
+ * @returns `Success` with the new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}
2717
+ * if successful, `Failure` with an error message otherwise.
2718
+ * @public
2719
+ */
2720
+ static create(params?: ILiteralQualifierTypeCreateParams): Result<LiteralQualifierType>;
2721
+ /**
2722
+ * Checks if the given value is a valid literal condition value.
2723
+ * @param from - The value to validate.
2724
+ * @returns `true` if the value is a valid literal condition value, otherwise `false`.
2725
+ * @public
2726
+ */
2727
+ static isValidLiteralConditionValue(from: string): from is QualifierConditionValue;
2728
+ /**
2729
+ * Converts a string to a {@link QualifierConditionValue | literal condition value}.
2730
+ * @param from - The string to convert.
2731
+ * @returns `Success` with the converted value if valid, or `Failure` with an error message
2732
+ * if not.
2733
+ * @public
2734
+ */
2735
+ static toLiteralConditionValue(from: string): Result<QualifierConditionValue>;
2736
+ }
2737
+
2738
+ /**
2739
+ * `Converter` for a normalized {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration}.
2740
+ * @public
2741
+ */
2742
+ declare const looseConditionDecl: Converter<Json.ILooseConditionDecl>;
2743
+
2744
+ /**
2745
+ * `Converter` for a normalized {@link ResourceJson.Json.ILooseResourceCandidateDecl | loose resource candidate declaration}.
2746
+ * @public
2747
+ */
2748
+ declare const looseResourceCandidateDecl: Converter<Normalized.ILooseResourceCandidateDecl>;
2749
+
2750
+ /**
2751
+ * `Converter` for a normalized {@link ResourceJson.Normalized.ILooseResourceDecl | loose resource declaration}.
2752
+ * @public
2753
+ */
2754
+ declare const looseResourceDecl: Converter<Normalized.ILooseResourceDecl>;
2755
+
2756
+ /**
2757
+ * Maximum valid priority for a condition.
2758
+ * @public
2759
+ */
2760
+ export declare const MaxConditionPriority: ConditionPriority;
2761
+
2762
+ /**
2763
+ * Helper method to merge a child candidate with base conditions.
2764
+ * @param candidate - The candidate to merge.
2765
+ * @param baseConditions - The base conditions to merge with the candidate.
2766
+ * @returns `Success` with the merged candidate if successful, otherwise `Failure`.
2767
+ * @public
2768
+ */
2769
+ declare function mergeChildCandidate(candidate: Normalized.IChildResourceCandidateDecl, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl | Conditions.IConditionDecl>): Result<Normalized.IChildResourceCandidateDecl>;
2770
+
2771
+ /**
2772
+ * Helper method to merge a child resource with a parent name and conditions.
2773
+ * @param resource - The resource to merge.
2774
+ * @param name - The name of the resource.
2775
+ * @param parentName - The name of the parent resource.
2776
+ * @param parentConditions - The conditions of the parent resource.
2777
+ * @returns `Success` with the merged resource if successful, otherwise `Failure`.
2778
+ * @public
2779
+ */
2780
+ declare function mergeChildResource(resource: Normalized.IChildResourceDecl, name: string, parentName?: string, parentConditions?: ReadonlyArray<Json.ILooseConditionDecl | Conditions.IConditionDecl>): Result<Normalized.ILooseResourceDecl>;
2781
+
2782
+ /**
2783
+ * Helper method to merge a loose candidate with a base name and conditions.
2784
+ * @param candidate - The candidate to merge.
2785
+ * @param baseName - The base name to merge with the candidate.
2786
+ * @param baseConditions - The base conditions to merge with the candidate.
2787
+ * @returns `Success` with the merged candidate if successful, otherwise `Failure`.
2788
+ * @public
2789
+ */
2790
+ declare function mergeLooseCandidate(candidate: Normalized.ILooseResourceCandidateDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl | Conditions.IConditionDecl>): Result<Normalized.ILooseResourceCandidateDecl>;
2791
+
2792
+ /**
2793
+ * Helper method to merge a loose resource with a base name and conditions.
2794
+ * @param resource - The resource to merge.
2795
+ * @param baseName - The base name to merge with the resource.
2796
+ * @param baseConditions - The base conditions to merge with the resource.
2797
+ * @returns `Success` with the merged resource if successful, otherwise `Failure`.
2798
+ * @public
2799
+ */
2800
+ declare function mergeLooseResource(resource: Normalized.ILooseResourceDecl, baseName?: string, baseConditions?: ReadonlyArray<Json.ILooseConditionDecl | Conditions.IConditionDecl>): Result<Normalized.ILooseResourceDecl>;
2801
+
2802
+ /**
2803
+ * Minimum valid priority for a condition.
2804
+ * @public
2805
+ */
2806
+ export declare const MinConditionPriority: ConditionPriority;
2807
+
2808
+ /**
2809
+ * {@link QualifierMatchScore | Match score} indicating no match.
2810
+ * @public
2811
+ */
2812
+ export declare const NoMatch: QualifierMatchScore;
2813
+
2814
+ declare namespace Normalized {
2815
+ export {
2816
+ ConditionSetDecl_2 as ConditionSetDecl,
2817
+ IChildResourceCandidateDecl_2 as IChildResourceCandidateDecl,
2818
+ ILooseResourceCandidateDecl_2 as ILooseResourceCandidateDecl,
2819
+ IChildResourceDecl_2 as IChildResourceDecl,
2820
+ ILooseResourceDecl_2 as ILooseResourceDecl,
2821
+ IResourceTreeChildNodeDecl_2 as IResourceTreeChildNodeDecl,
2822
+ IResourceTreeRootDecl_2 as IResourceTreeRootDecl,
2823
+ IResourceCollectionDecl_2 as IResourceCollectionDecl
2824
+ }
2825
+ }
2826
+
2827
+ /**
2828
+ * Parses a condition set token string into an array of {@link Helpers.IConditionTokenParts | condition token parts}.
2829
+ * @param token - the conditions set token string to parse.
2830
+ * @returns `Success` with the parts if successful, `Failure` with an error message if not.
2831
+ * @public
2832
+ */
2833
+ declare function parseConditionSetTokenParts(token: string): Result<IConditionTokenParts[]>;
2834
+
2835
+ /**
2836
+ * Parses a condition token string into its {@link Helpers.IConditionTokenParts | parts}.
2837
+ * @param token - the token string to parse.
2838
+ * @returns `Success` with the parts if successful, `Failure` with an error message if not.
2839
+ * @public
2840
+ */
2841
+ declare function parseConditionTokenParts(token: string): Result<IConditionTokenParts>;
2842
+
2843
+ /**
2844
+ * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`
2845
+ * given a path.
2846
+ * @public
2847
+ */
2848
+ declare class PathImporter implements IImporter {
2849
+ /**
2850
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use for this importer.
2851
+ */
2852
+ readonly qualifiers: IReadOnlyQualifierCollector;
2853
+ /**
2854
+ * The `FileTree` from which resources will be imported.
2855
+ */
2856
+ readonly tree: FileTree.FileTree;
2857
+ /**
2858
+ * The types of {@link Import.IImportable | importables} that this importer can handle.
2859
+ */
2860
+ readonly types: ReadonlyArray<string>;
2861
+ /**
2862
+ * The types of files to ignore when importing. Any file not ignored is converted
2863
+ * to an {@link Import.IImportableFsItem | IImportableFsItem}.
2864
+ */
2865
+ readonly ignoreFileTypes: string[];
2866
+ /**
2867
+ * Protected constructor for the {@link Import.Importers.PathImporter | PathImporter}.
2868
+ * @param params - Parameters for creating the {@link Import.Importers.PathImporter | PathImporter}.
2869
+ */
2870
+ protected constructor(params: IPathImporterCreateParams);
2871
+ /**
2872
+ * Creates a new {@link Import.Importers.PathImporter | PathImporter}.
2873
+ * @param params - Parameters for creating the {@link Import.Importers.PathImporter | dirPathImporter}.
2874
+ * @returns `Success` with the new `PathImporter` if successful, `Failure` with an error message if not.
2875
+ */
2876
+ static create(params: IPathImporterCreateParams): Result<PathImporter>;
2877
+ /**
2878
+ * {@inheritdoc Import.Importers.IImporter.import}
2879
+ */
2880
+ import(item: IImportable, __manager: ResourceManager): DetailedResult<IImportable[], ImporterResultDetail>;
2881
+ /**
2882
+ * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
2883
+ * @param item - The importable to convert.
2884
+ * @returns `Success` containing the `FsItem` if successful, `Failure` with an error message if not.
2885
+ */
2886
+ protected _getFileTreeItemFromImportable(item: IImportable): DetailedResult<FsItem, FsItemResultDetail>;
2887
+ }
2888
+
2889
+ /**
2890
+ * {@link QualifierMatchScore | Match score} indicating a perfect match.
2891
+ * @public
2892
+ */
2893
+ export declare const PerfectMatch: QualifierMatchScore;
2894
+
2895
+ /**
2896
+ * Represents a qualifier that can be used to identify the context in
2897
+ * which a resource is used.
2898
+ * @public
2899
+ */
2900
+ declare class Qualifier implements IValidatedQualifierDecl, ICollectible<QualifierName, QualifierIndex> {
2901
+ /**
2902
+ * The name of the qualifier.
2903
+ */
2904
+ readonly name: QualifierName;
2905
+ /**
2906
+ * The token used to identify the qualifier in the name or
2907
+ * path of a resource being imported.
2908
+ */
2909
+ readonly token: QualifierName;
2910
+ /**
2911
+ * The {@link QualifierTypes.QualifierType | type} of the qualifier.
2912
+ */
2913
+ readonly type: QualifierType;
2914
+ /**
2915
+ * Indicates whether the token is optional in the name or path of a resource being imported.
2916
+ */
2917
+ readonly tokenIsOptional: boolean;
2918
+ /**
2919
+ * The index of the qualifier.
2920
+ */
2921
+ get index(): QualifierIndex | undefined;
2922
+ /**
2923
+ * The collector key for this qualifier.
2924
+ */
2925
+ get key(): QualifierName;
2926
+ /**
2927
+ * The default {@link ConditionPriority | priority} of conditions
2928
+ * that depend on this qualifier.
2929
+ */
2930
+ readonly defaultPriority: ConditionPriority;
2931
+ protected readonly _collectible: Collections.Collectible<QualifierName, QualifierIndex>;
2932
+ /**
2933
+ * Constructs a new instance of a {@link Qualifiers.Qualifier | Qualifier} from the
2934
+ * supplied {@link Qualifiers.IValidatedQualifierDecl | validated declaration}.
2935
+ * @param name - The name of the qualifier.
2936
+ * @param type - The {@link QualifierTypes.QualifierType | type} of the qualifier.
2937
+ * @param defaultPriority - The default {@link ConditionPriority | priority} of conditions
2938
+ * @public
2939
+ */
2940
+ protected constructor({ name, token, type, defaultPriority, tokenIsOptional, index }: IValidatedQualifierDecl);
2941
+ /**
2942
+ * Creates a new instance of a {@link Qualifiers.Qualifier | Qualifier} from the
2943
+ * supplied {@link Qualifiers.IValidatedQualifierDecl | validated declaration}.
2944
+ * @param decl - The {@link Qualifiers.IValidatedQualifierDecl | validated declaration}
2945
+ * for the new instance.
2946
+ * @returns `Success` with the new {@link Qualifiers.Qualifier | Qualifier} if successful,
2947
+ * `Failure` with an error message otherwise.
2948
+ * @public
2949
+ */
2950
+ static create(decl: IValidatedQualifierDecl): Result<Qualifier>;
2951
+ /**
2952
+ * Sets the index of this qualifier. Once set, the index cannot be changed.
2953
+ * @param index - The index to set.
2954
+ * @returns `Success` with the index if successful, `Failure` with an error message otherwise.
2955
+ */
2956
+ setIndex(index: QualifierIndex): Result<QualifierIndex>;
2957
+ }
2958
+
2959
+ /**
2960
+ * Converter which choose a qualifier by name or number from a
2961
+ * supplied {@link Qualifiers.Convert.IQualifierConvertContext | conversion context}.
2962
+ * @public
2963
+ */
2964
+ declare const qualifier: Converter<Qualifier, IQualifierConvertContext>;
2965
+
2966
+ /**
2967
+ * Collects {@link Qualifiers.Qualifier | Qualifiers} from {@link Qualifiers.IQualifierDecl | declarations},
2968
+ * with strongly-typed ({@link QualifierName | QualifierName} and {@link QualifierIndex | QualifierIndex}) key
2969
+ * and index.
2970
+ * @public
2971
+ */
2972
+ declare class QualifierCollector extends ValidatingConvertingCollector<Qualifier, IQualifierDecl> implements IReadOnlyQualifierCollector {
2973
+ /**
2974
+ * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} that this collector uses.
2975
+ */
2976
+ qualifierTypes: ReadOnlyQualifierTypeCollector;
2977
+ /**
2978
+ * Constructor for a {@link Qualifiers.QualifierCollector | QualifierCollector} object.
2979
+ * @param params - Parameters for creating the collector.
2980
+ * @public
2981
+ */
2982
+ protected constructor(params: IQualifierCollectorCreateParams);
2983
+ /**
2984
+ * Creates a new {@link Qualifiers.QualifierCollector | QualifierCollector} object.
2985
+ * @param params - {@link Qualifiers.IQualifierCollectorCreateParams | Parameters} for creating a new {@link Qualifiers.QualifierCollector | QualifierCollector}.
2986
+ * @returns `Success` with the new collector if successful, or `Failure` if not.
2987
+ */
2988
+ static create(params: IQualifierCollectorCreateParams): Result<QualifierCollector>;
2989
+ /**
2990
+ * {@inheritdoc Qualifiers.IReadOnlyQualifierCollector.getByNameOrToken}
2991
+ */
2992
+ getByNameOrToken(nameOrToken: string): Result<Qualifier>;
2993
+ /**
2994
+ * {@inheritdoc Qualifiers.IReadOnlyQualifierCollector.hasNameOrToken}
2995
+ */
2996
+ hasNameOrToken(nameOrToken: string): boolean;
2997
+ /**
2998
+ * Gets a read-only view of this collector.
2999
+ * @returns A read-only view of this collector.
3000
+ */
3001
+ toReadOnly(): IReadOnlyQualifierCollector;
3002
+ /**
3003
+ * Factory method for creating a {@link Qualifiers.Qualifier | Qualifier} from a {@link Qualifiers.IQualifierDecl | declaration}.
3004
+ * @param __key - The key for the qualifier.
3005
+ * @param index - The index of the qualifier.
3006
+ * @param decl - The {@link Qualifiers.IQualifierDecl | declaration} for the qualifier.
3007
+ * @returns `Success` with the new {@link Qualifiers.Qualifier | Qualifier} if successful, or `Failure` if not.
3008
+ * @public
3009
+ */
3010
+ protected _qualifierFactory(__key: QualifierName, index: number, decl: IQualifierDecl): Result<Qualifier>;
3011
+ }
3012
+
3013
+ /**
3014
+ * Branded type for a validated qualifier condition value - i.e. a value
3015
+ * that has been determined to be valid for use in a condition attached
3016
+ * to some resource.
3017
+ *
3018
+ * @example
3019
+ * For a language qualifier type, it is likely that a single language
3020
+ * tag can be used for either a condition or a context value. However,
3021
+ * a list of languages would likely only be valid as a context value.
3022
+ * @public
3023
+ */
3024
+ export declare type QualifierConditionValue = Brand<string, 'QualifierConditionValue'>;
3025
+
3026
+ /**
3027
+ * Branded type for a validated qualifier context value - i.e. a value
3028
+ * that has been determined to be valid for use in some runtime context.
3029
+ * @example
3030
+ * For a language qualifier type, it is likely that a single language
3031
+ * tag can be used for either a condition or a context value. However,
3032
+ * a list of languages would likely only be valid as a context value.
3033
+ * @public
3034
+ */
3035
+ export declare type QualifierContextValue = Brand<string, 'QualifierContextValue'>;
3036
+
3037
+ /**
3038
+ * Converter for a {@link Qualifiers.IQualifierDecl | qualifier declaration}.
3039
+ * @public
3040
+ */
3041
+ declare const qualifierDecl: ObjectConverter<IQualifierDecl, unknown>;
3042
+
3043
+ /**
3044
+ * Branded number representing a validated qualifier index.
3045
+ * @public
3046
+ */
3047
+ export declare type QualifierIndex = Brand<number, 'QualifierIndex'>;
3048
+
3049
+ /**
3050
+ * `Converter` which validates an `unknown` value as a {@link QualifierIndex | QualifierIndex}.
3051
+ * @public
3052
+ */
3053
+ declare const qualifierIndex: Converter<QualifierIndex, unknown>;
3054
+
3055
+ /**
3056
+ * Branded number representing a score in the range 0.0 (no match) .. 1.0 (perfect match)
3057
+ * which results from evaluating some condition.
3058
+ * @public
3059
+ */
3060
+ export declare type QualifierMatchScore = Brand<number, 'QualifierMatchScore'>;
3061
+
3062
+ /**
3063
+ * `Converter` which validates an `unknown` value as a {@link QualifierConditionValue | QualifierConditionValue}.
3064
+ * @public
3065
+ */
3066
+ declare const qualifierMatchScore: Converter<QualifierMatchScore, unknown>;
3067
+
3068
+ /**
3069
+ * Branded string representing a validated qualifier name.
3070
+ * @public
3071
+ */
3072
+ export declare type QualifierName = Brand<string, 'QualifierName'>;
3073
+
3074
+ /**
3075
+ * `Converter` which validates an `unknown` value as a {@link QualifierName | QualifierName}.
3076
+ * @public
3077
+ */
3078
+ declare const qualifierName: Converter<QualifierName, unknown>;
3079
+
3080
+ declare namespace Qualifiers {
3081
+ export {
3082
+ Convert_5 as Convert,
3083
+ Qualifier,
3084
+ IQualifierDecl,
3085
+ IValidatedQualifierDecl,
3086
+ IReadOnlyQualifierCollector,
3087
+ IQualifierCollectorCreateParams,
3088
+ QualifierCollector
3089
+ }
3090
+ }
3091
+ export { Qualifiers }
3092
+
3093
+ /**
3094
+ * Abstract base class for qualifier types. Provides default implementations for
3095
+ * the {@link QualifierTypes.IQualifierType | IQualifierType} interface.
3096
+ * @public
3097
+ */
3098
+ declare abstract class QualifierType implements IQualifierType {
3099
+ /**
3100
+ * {@inheritdoc QualifierTypes.IQualifierType.name}
3101
+ */
3102
+ readonly name: QualifierTypeName;
3103
+ /**
3104
+ * {@inheritdoc QualifierTypes.IQualifierType.key}
3105
+ */
3106
+ get key(): QualifierTypeName;
3107
+ /**
3108
+ * {@inheritdoc QualifierTypes.IQualifierType.index}
3109
+ */
3110
+ get index(): QualifierTypeIndex | undefined;
3111
+ protected readonly _collectible: Collections.Collectible<QualifierTypeName, QualifierTypeIndex>;
3112
+ /**
3113
+ * Flag indicating whether this qualifier type allows a list of values in a context.
3114
+ * @public
3115
+ */
3116
+ readonly allowContextList: boolean;
3117
+ /**
3118
+ * Constructor for use by derived classes.
3119
+ * @param name - The name of the qualifier type.
3120
+ * @param allowContextList - Flag indicating whether this qualifier type allows a
3121
+ * comma-separated list of runtime values in the context. Defaults to `false`.
3122
+ */
3123
+ protected constructor({ name, index, allowContextList }: IQualifierTypeCreateParams);
3124
+ /**
3125
+ * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
3126
+ */
3127
+ abstract isValidConditionValue(value: string): value is QualifierConditionValue;
3128
+ /**
3129
+ * {@inheritdoc QualifierTypes.IQualifierType.isValidContextValue}
3130
+ */
3131
+ isValidContextValue(value: string): value is QualifierContextValue;
3132
+ /**
3133
+ * {@inheritdoc QualifierTypes.IQualifierType.validateCondition}
3134
+ */
3135
+ validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
3136
+ /**
3137
+ * {@inheritdoc QualifierTypes.IQualifierType.validateContextValue}
3138
+ */
3139
+ validateContextValue(value: string): Result<QualifierContextValue>;
3140
+ /**
3141
+ * {@inheritdoc QualifierTypes.IQualifierType.matches}
3142
+ */
3143
+ matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
3144
+ /**
3145
+ * {@inheritdoc QualifierTypes.IQualifierType.setIndex}
3146
+ */
3147
+ setIndex(index: number): Result<QualifierTypeIndex>;
3148
+ /**
3149
+ * {@inheritdoc Validate.isValidQualifierTypeName}
3150
+ */
3151
+ static isValidName(name: string): name is QualifierTypeName;
3152
+ /**
3153
+ * {@inheritdoc Validate.isValidQualifierTypeIndex}
3154
+ */
3155
+ static isValidIndex(index: number): index is QualifierTypeIndex;
3156
+ /**
3157
+ * Compares two qualifier types by index.
3158
+ * @param t1 - The first qualifier type to compare.
3159
+ * @param t2 - The second qualifier type to compare.
3160
+ * @returns a number indicating the relative order of the two qualifier types.
3161
+ */
3162
+ static compare(t1: QualifierType, t2: QualifierType): number;
3163
+ /**
3164
+ * Matches a single condition value against a single context value.
3165
+ * @param condition - The {@link QualifierConditionValue | condition value} to match.
3166
+ * @param context - The {@link QualifierContextValue | context value} to match.
3167
+ * @param operator - The {@link ConditionOperator | operator} to use in the match.
3168
+ * @returns a {@link QualifierMatchScore | score} indicating the extent to which the condition
3169
+ * matches the context value.
3170
+ * @public
3171
+ */
3172
+ protected abstract _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
3173
+ /**
3174
+ * Matches a single condition value against a list of context values.
3175
+ * @param condition - The {@link QualifierConditionValue | condition value} to match.
3176
+ * @param context - The comma-separated list of {@link QualifierContextValue | context values} to match.
3177
+ * @param operator - The {@link ConditionOperator | operator} to use in the match.
3178
+ * @returns a {@link QualifierMatchScore | score} indicating the extent to which the condition
3179
+ * matches the context value.
3180
+ * @public
3181
+ */
3182
+ protected _matchList(condition: QualifierConditionValue, context: QualifierContextValue[], operator: ConditionOperator): QualifierMatchScore;
3183
+ /**
3184
+ * Splits a comma-separated {@link QualifierContextValue | context value} into an array of
3185
+ * individual values.
3186
+ * @param value - The value to split.
3187
+ * @returns an array of individual context values.
3188
+ * @public
3189
+ */
3190
+ protected static _splitContext(value: QualifierContextValue): QualifierContextValue[];
3191
+ }
3192
+
3193
+ /**
3194
+ * Converter for {@link QualifierTypes.QualifierType | QualifierType} objects,
3195
+ * retrieves a {@link QualifierTypes.QualifierType | QualifierType} by name or
3196
+ * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.
3197
+ * @public
3198
+ */
3199
+ declare const qualifierType: Converter<QualifierType, IQualifierTypeConvertContext>;
3200
+
3201
+ /**
3202
+ * Collector for {@link QualifierTypes.QualifierType | QualifierType} objects.
3203
+ * @public
3204
+ */
3205
+ declare class QualifierTypeCollector extends ValidatingConvertingCollector<QualifierType, QualifierType> {
3206
+ /**
3207
+ * Constructor for a {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector} object.
3208
+ * @param params - Optional {@link QualifierTypes.IQualifierTypeCollectorCreateParams | parameters} used to construct the collector.
3209
+ */
3210
+ protected constructor({ qualifierTypes }: IQualifierTypeCollectorCreateParams);
3211
+ /**
3212
+ * Creates a new {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector} object.
3213
+ * @param params - Optional {@link QualifierTypes.IQualifierTypeCollectorCreateParams | parameters}
3214
+ * used to create the collector.
3215
+ * @returns `Success` with the new collector if successful, or `Failure` if not.
3216
+ */
3217
+ static create(params?: IQualifierTypeCollectorCreateParams): Result<QualifierTypeCollector>;
3218
+ protected static _qualifierTypeFactory(key: QualifierTypeName, index: number, value: QualifierType): Result<QualifierType>;
3219
+ protected static _toQualifierType(from: unknown): Result<QualifierType>;
3220
+ }
3221
+
3222
+ /**
3223
+ * Branded number representing a validated qualifier type index.
3224
+ * @public
3225
+ */
3226
+ export declare type QualifierTypeIndex = Brand<number, 'QualifierTypeIndex'>;
3227
+
3228
+ /**
3229
+ * `Converter` which validates an `unknown` value as a {@link QualifierTypeIndex | QualifierTypeIndex}.
3230
+ * @public
3231
+ */
3232
+ declare const qualifierTypeIndex: Converter<QualifierTypeIndex, unknown>;
3233
+
3234
+ /**
3235
+ * Branded string representing a validated qualifier type name.
3236
+ * @public
3237
+ */
3238
+ export declare type QualifierTypeName = Brand<string, 'QualifierTypeName'>;
3239
+
3240
+ /**
3241
+ * `Converter` which validates an `unknown` value as a {@link QualifierTypeName | QualifierTypeName}.
3242
+ * @public
3243
+ */
3244
+ declare const qualifierTypeName: Converter<QualifierTypeName, unknown>;
3245
+
3246
+ declare namespace QualifierTypes {
3247
+ export {
3248
+ Convert_4 as Convert,
3249
+ IQualifierType,
3250
+ IQualifierTypeCreateParams,
3251
+ QualifierType,
3252
+ ILanguageQualifierTypeCreateParams,
3253
+ LanguageQualifierType,
3254
+ ILiteralQualifierTypeCreateParams,
3255
+ LiteralQualifierType,
3256
+ ITerritoryQualifierTypeCreateParams,
3257
+ TerritoryQualifierType,
3258
+ IQualifierTypeCollectorCreateParams,
3259
+ QualifierTypeCollector,
3260
+ ReadOnlyQualifierTypeCollector
3261
+ }
3262
+ }
3263
+ export { QualifierTypes }
3264
+
3265
+ /**
3266
+ * A read-only {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector}.
3267
+ * @public
3268
+ */
3269
+ declare type ReadOnlyAbstractDecisionCollector = Collections.IReadOnlyValidatingCollector<AbstractDecision>;
3270
+
3271
+ /**
3272
+ * Type alias for a read-only {@link Conditions.ConditionCollector | ConditionCollector}.
3273
+ * @public
3274
+ */
3275
+ declare type ReadOnlyConditionCollector = Collections.IReadOnlyValidatingCollector<Condition>;
3276
+
3277
+ /**
3278
+ * A read-only {@link Conditions.ConditionSetCollector | ConditionSetCollector}.
3279
+ * @public
3280
+ */
3281
+ declare type ReadOnlyConditionSetCollector = Collections.IReadOnlyValidatingCollector<ConditionSet>;
3282
+
3283
+ /**
3284
+ * Interface exposing non-mutating members of a {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector}.
3285
+ * @public
3286
+ */
3287
+ declare type ReadOnlyQualifierTypeCollector = Collections.IReadOnlyValidatingCollector<QualifierType>;
3288
+
3289
+ /**
3290
+ * A read-only version of {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.
3291
+ * @public
3292
+ */
3293
+ declare type ReadOnlyResourceTypeCollector = Collections.IReadOnlyValidatingCollector<ResourceType>;
3294
+
3295
+ declare namespace RegularExpressions {
3296
+ export {
3297
+ identifier,
3298
+ segmentedIdentifier,
3299
+ identifierList,
3300
+ conditionKey_2 as conditionKey,
3301
+ conditionToken_2 as conditionToken,
3302
+ conditionSetHash_2 as conditionSetHash,
3303
+ decisionKey_2 as decisionKey,
3304
+ territoryCode
3305
+ }
3306
+ }
3307
+
3308
+ /**
3309
+ * Represents a single logical resource, with a unique id and a set of possible
3310
+ * candidate instances.
3311
+ * @public
3312
+ */
3313
+ declare class Resource {
3314
+ /**
3315
+ * The unique {@link ResourceId | id} of the resource.
3316
+ */
3317
+ readonly id: ResourceId;
3318
+ /**
3319
+ * The {@link ResourceTypes.ResourceType | type} of the resource.
3320
+ */
3321
+ readonly resourceType: ResourceType;
3322
+ /**
3323
+ * The array of {@link Resources.ResourceCandidate | candidates} for the resource.
3324
+ */
3325
+ readonly candidates: ReadonlyArray<ResourceCandidate>;
3326
+ /**
3327
+ * Constructor for a {@link Resources.Resource | Resource} object.
3328
+ * @param params - {@link Resources.IResourceCreateParams | Parameters} used to create the resource.
3329
+ * @public
3330
+ */
3331
+ protected constructor(params: IResourceCreateParams);
3332
+ /**
3333
+ * Creates a new {@link Resources.Resource | Resource} object.
3334
+ * @param params - {@link Resources.IResourceCreateParams | Parameters} used to create the resource.
3335
+ * @returns `Success` with the new {@link Resources.Resource | Resource} object if successful,
3336
+ * or `Failure` with an error message if not.
3337
+ * @public
3338
+ */
3339
+ static create(params: IResourceCreateParams): Result<Resource>;
3340
+ /**
3341
+ * Validates that all candidates have the same id as the resource.
3342
+ * @param resourceId - The expected id of the resource.
3343
+ * @param candidates - The array of candidates to validate.
3344
+ * @returns `Success` with the resource id if all candidates have the same id,
3345
+ * `Failure` with an error message otherwise.
3346
+ * @internal
3347
+ */
3348
+ private static _validateCandidateResourceIds;
3349
+ /**
3350
+ * Validates and normalizes an array of {@link Resources.ResourceCandidate | candidates}. Fails if there
3351
+ * are multiple candidates for the same set of conditions.
3352
+ * @param candidates - The array of candidates to validate.
3353
+ * @returns `Success` with the validated and sorted array of candidates if successful,
3354
+ * `Failure` with an error message otherwise.
3355
+ * @internal
3356
+ */
3357
+ private static _validateAndNormalizeCandidates;
3358
+ }
3359
+
3360
+ /**
3361
+ * Represents a builder for a single logical {@link Resources.Resource | resource}. Collects candidates
3362
+ * with a common resource ID, validates them against each other and builds a {@link Resources.Resource | resource}
3363
+ * object once all candidates are collected.
3364
+ * @public
3365
+ */
3366
+ declare class ResourceBuilder {
3367
+ /**
3368
+ * The unique {@link ResourceId | id} of the resource being built.
3369
+ */
3370
+ readonly id: ResourceId;
3371
+ /**
3372
+ * Supplied or inferred {@link ResourceTypes.ResourceType | type} of the resource being built.
3373
+ * If no type is supplied, the type will be inferred from the candidates - at least one candidate must
3374
+ * define resource type and all candidates must be of the same type.
3375
+ */
3376
+ get resourceType(): ResourceType | undefined;
3377
+ /**
3378
+ * Array of {@link Resources.ResourceCandidate | candidates} for the resource being built.
3379
+ */
3380
+ get candidates(): ReadonlyArray<ResourceCandidate>;
3381
+ /**
3382
+ * The supplied or inferred {@link ResourceTypes.ResourceType | type} of the resource
3383
+ * being built.
3384
+ */
3385
+ protected _resourceType: ResourceType | undefined;
3386
+ /**
3387
+ * Map of {@link Resources.ResourceCandidate | candidates} for the resource being built.
3388
+ */
3389
+ protected _candidates: ResultMap<string, ResourceCandidate>;
3390
+ /**
3391
+ * Map of all known {@link ResourceTypes.ResourceType | resource types}.
3392
+ */
3393
+ protected _resourceTypes: ReadOnlyResourceTypeCollector;
3394
+ /**
3395
+ * Common collector for {@link Conditions.ConditionSet | condition sets}.
3396
+ */
3397
+ protected _conditionSets: ConditionSetCollector;
3398
+ /**
3399
+ * Constructor for a {@link Resources.ResourceBuilder | ResourceBuilder} object.
3400
+ * @param params - Parameters to construct the new {@link Resources.ResourceBuilder | ResourceBuilder}.
3401
+ */
3402
+ protected constructor(params: IResourceBuilderCreateParams);
3403
+ /**
3404
+ * Creates a new {@link Resources.ResourceBuilder | ResourceBuilder} object.
3405
+ * @param params - Parameters to create a new {@link Resources.ResourceBuilder | ResourceBuilder}.
3406
+ * @returns `Success` with the new {@link Resources.ResourceBuilder | ResourceBuilder} object if successful,
3407
+ * or `Failure` with an error message if not.
3408
+ * @public
3409
+ */
3410
+ static create(params: IResourceBuilderCreateParams): Result<ResourceBuilder>;
3411
+ /**
3412
+ * Given a {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}, creates and adds a
3413
+ * {@link Resources.ResourceCandidate | candidate} to the resource being built.
3414
+ * @param candidate - The {@link ResourceJson.Json.IChildResourceCandidateDecl | IChildResourceCandidateDecl} to add to the
3415
+ * resource being built.
3416
+ * @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
3417
+ * or `Failure` with an error message if not.
3418
+ */
3419
+ addChildCandidate(childDecl: ResourceJson.Json.IChildResourceCandidateDecl): DetailedResult<ResourceCandidate, ResourceBuilderResultDetail>;
3420
+ /**
3421
+ * Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, creates and adds a
3422
+ * {@link Resources.ResourceCandidate | candidate} to the resource being built.
3423
+ * @param candidate - The {@link ResourceJson.Json.ILooseResourceCandidateDecl | IResourceCandidateDecl} to add to the
3424
+ * resource being built.
3425
+ * @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
3426
+ * or `Failure` with an error message if not. Fails with error detail 'type-mismatch' if the candidate
3427
+ * specifies a different resource type than previously added candidates, or with 'exists' if a candidate
3428
+ * already exists with the same conditions but different values. Succeeds with 'exists' and returns the
3429
+ * existing candidate if the candidate to be added is identical to an existing candidate.
3430
+ */
3431
+ addLooseCandidate(decl: ResourceJson.Json.ILooseResourceCandidateDecl): DetailedResult<ResourceCandidate, ResourceBuilderResultDetail>;
3432
+ /**
3433
+ * Sets the resource type for the resource being built. Fails if a resource type has already been set
3434
+ * and it does not match the new resource type.
3435
+ * @param resourceTypeName - The name of the resource type to set.
3436
+ * @returns `Success` with the updated {@link Resources.ResourceBuilder | ResourceBuilder} object if successful,
3437
+ * or `Failure` with an error message if not.
3438
+ */
3439
+ setResourceType(resourceTypeName: string): Result<ResourceBuilder>;
3440
+ /**
3441
+ * Builds the {@link Resources.Resource | resource} object from this builder.
3442
+ * @returns `Success` with the new {@link Resources.Resource | Resource} object if successful,
3443
+ * or `Failure` with an error message if not. Fails if no candidates have been added
3444
+ * or if the resource type is not defined.
3445
+ */
3446
+ build(): Result<Resource>;
3447
+ }
3448
+
3449
+ /**
3450
+ * Possible result details returned by the resource builder
3451
+ * {@link Resources.ResourceBuilder.addLooseCandidate | addLooseCandidate} method.
3452
+ * @public
3453
+ */
3454
+ declare type ResourceBuilderResultDetail = Collections.ResultMapResultDetail | 'id-mismatch' | 'type-mismatch';
3455
+
3456
+ /**
3457
+ * A {@link Resources.ResourceCandidate | resource candidate} represents a single possible
3458
+ * instance value for some resource, with the conditions under which it applies
3459
+ * and instructions on how to merge it with other instances.
3460
+ * @public
3461
+ */
3462
+ declare class ResourceCandidate {
3463
+ /**
3464
+ * The unique identifier of the resource for which this candidate
3465
+ * is a possible instance.
3466
+ */
3467
+ readonly id: ResourceId;
3468
+ /**
3469
+ * The JSON representation of the instance data to be applied.
3470
+ */
3471
+ readonly json: JsonValue;
3472
+ /**
3473
+ * The conditions under which this candidate applies.
3474
+ */
3475
+ readonly conditions: ConditionSet;
3476
+ /**
3477
+ * True if this candidate is a partial instance.
3478
+ */
3479
+ readonly isPartial: boolean;
3480
+ /**
3481
+ * The method to use when merging this candidate with other instances.
3482
+ */
3483
+ readonly mergeMethod: ResourceValueMergeMethod;
3484
+ /**
3485
+ * The {@link ResourceTypes.ResourceType | resource type} for the resource to which
3486
+ * this candidate belongs.
3487
+ */
3488
+ readonly resourceType: ResourceType | undefined;
3489
+ /**
3490
+ * Constructor for a {@link Resources.ResourceCandidate | ResourceCandidate} object.
3491
+ * @param params - Parameters to create a new {@link Resources.ResourceCandidate | ResourceCandidate}.
3492
+ * @public
3493
+ */
3494
+ protected constructor(params: IResourceCandidateCreateParams);
3495
+ /**
3496
+ * Creates a new {@link Resources.ResourceCandidate | ResourceCandidate} object.
3497
+ * @param params - Parameters to create a new {@link Resources.ResourceCandidate | ResourceCandidate}.
3498
+ * @returns `Success` with the new {@link Resources.ResourceCandidate | ResourceCandidate} object if successful,
3499
+ * or `Failure` with an error message if not.
3500
+ * @public
3501
+ */
3502
+ static create(params: IResourceCandidateCreateParams): Result<ResourceCandidate>;
3503
+ /**
3504
+ * Extracts the {@link ResourceTypes.ResourceType | resource type} from a list of {@link Resources.ResourceCandidate | resource candidates},
3505
+ * if present.
3506
+ * @param candidates - The list of candidates from which to extract the resource type.
3507
+ * @returns `Success` with the resource type if successful, `Success` with `undefined` if none of the candidates
3508
+ * specify a resource tap, and `Failure` with an error message if clients specify conflicting resource types.
3509
+ * @public
3510
+ */
3511
+ static validateResourceTypes(candidates: ReadonlyArray<ResourceCandidate>, expectedType?: ResourceType): Result<ResourceType | undefined>;
3512
+ /**
3513
+ * Compares two {@link Resources.ResourceCandidate | ResourceCandidates} for sorting purposes.
3514
+ * @param rc1 - The first candidate to compare.
3515
+ * @param rc2 - The second candidate to compare.
3516
+ * @returns A negative number if `rc1` should come before `rc2`, a positive number if `rc2` should come before `rc1`,
3517
+ * or zero if they are equivalent.
3518
+ * @public
3519
+ */
3520
+ static compare(rc1: ResourceCandidate, rc2: ResourceCandidate): number;
3521
+ /**
3522
+ * Compares two {@link Resources.ResourceCandidate | ResourceCandidates} for equality.
3523
+ * @param rc1 - The first candidate to compare.
3524
+ * @param rc2 - The second candidate to compare.
3525
+ * @returns `true` if the candidates are equal, `false` otherwise.
3526
+ * @public
3527
+ */
3528
+ static equal(rc1: ResourceCandidate, rc2: ResourceCandidate): boolean;
3529
+ /**
3530
+ * Validates declared conditions and merges them with parent conditions.
3531
+ * @param conditionSets - The {@link Conditions.ConditionSetCollector | condition set collector}
3532
+ * to use for this candidate.
3533
+ * @param declared - The declared conditions for the candidate.
3534
+ * @param parent - The parent conditions to merge with the declared conditions.
3535
+ * @returns `Success` with the merged conditions if successful, `Failure` otherwise.
3536
+ * @internal
3537
+ */
3538
+ private static _mergeConditions;
3539
+ }
3540
+
3541
+ /**
3542
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceCollectionDecl | resource collection declaration}.
3543
+ * @public
3544
+ */
3545
+ declare const resourceCollectionDecl: Converter<Normalized.IResourceCollectionDecl>;
3546
+
3547
+ /**
3548
+ * Class that extracts resources and candidates from a
3549
+ * {@link ResourceJson.Json.IResourceCollectionDecl | resource collection declaration}.
3550
+ * @public
3551
+ */
3552
+ declare class ResourceDeclCollection implements IResourceDeclContainer {
3553
+ /**
3554
+ * The {@link ResourceJson.Normalized.IResourceCollectionDecl | resource collection declaration}
3555
+ * being processed.
3556
+ */
3557
+ readonly collection: Normalized.IResourceCollectionDecl;
3558
+ protected _resources: Normalized.ILooseResourceDecl[];
3559
+ protected _candidates: Normalized.ILooseResourceCandidateDecl[];
3560
+ protected constructor(collection: Normalized.IResourceCollectionDecl);
3561
+ /**
3562
+ * Creates a new {@link ResourceJson.ResourceDeclCollection | ResourceDeclCollection} from an
3563
+ * untyped {@link ResourceJson.Json.IResourceCollectionDecl | resource collection declaration}.
3564
+ * @param from - The JSON object to convert.
3565
+ * @returns `Success` with the new collection if the JSON object is valid, otherwise `Failure`.
3566
+ */
3567
+ static create(from: unknown): Result<ResourceDeclCollection>;
3568
+ /**
3569
+ * Gets the loose resources extracted from the collection.
3570
+ * @returns The {@link ResourceJson.Normalized.ILooseResourceDecl | loose resource declarations}
3571
+ * extracted from the collection.
3572
+ */
3573
+ getLooseResources(): ReadonlyArray<Normalized.ILooseResourceDecl>;
3574
+ /**
3575
+ * Gets the loose candidates extracted from the collection.
3576
+ * @returns The {@link ResourceJson.Normalized.ILooseResourceCandidateDecl | loose resource candidate declarations}
3577
+ * extracted from the collection.
3578
+ */
3579
+ getLooseCandidates(): ReadonlyArray<Normalized.ILooseResourceCandidateDecl>;
3580
+ private _extract;
3581
+ }
3582
+
3583
+ /**
3584
+ * Class that extracts resources and candidates from a
3585
+ * {@link ResourceJson.Json.IResourceTreeRootDecl | resource tree root}.
3586
+ * @public
3587
+ */
3588
+ declare class ResourceDeclTree implements IResourceDeclContainer {
3589
+ /**
3590
+ * The {@link ResourceJson.Normalized.IResourceTreeRootDecl | resource tree root declaration}
3591
+ * being processed.
3592
+ */
3593
+ readonly tree: Normalized.IResourceTreeRootDecl;
3594
+ protected _resources: Normalized.ILooseResourceDecl[];
3595
+ protected _candidates: Normalized.ILooseResourceCandidateDecl[];
3596
+ protected constructor(tree: Normalized.IResourceTreeRootDecl);
3597
+ /**
3598
+ * Creates a new {@link ResourceJson.ResourceDeclTree | ResourceDeclTree} from an
3599
+ * untyped {@link ResourceJson.Json.IResourceTreeRootDecl | resource tree root declaration}.
3600
+ * @param from - The JSON object to convert.
3601
+ * @returns `Success` with the new tree if the JSON object is valid, otherwise `Failure`.
3602
+ */
3603
+ static create(from: unknown): Result<ResourceDeclTree>;
3604
+ /**
3605
+ * Gets the loose resources extracted from the collection.
3606
+ * @returns The {@link ResourceJson.Normalized.ILooseResourceDecl | loose resource declarations}
3607
+ * extracted from the collection.
3608
+ */
3609
+ getLooseResources(): ReadonlyArray<Normalized.ILooseResourceDecl>;
3610
+ /**
3611
+ * Gets the loose candidates extracted from the collection.
3612
+ * @returns The {@link ResourceJson.Normalized.ILooseResourceCandidateDecl | loose resource candidate declarations}
3613
+ * extracted from the collection.
3614
+ */
3615
+ getLooseCandidates(): ReadonlyArray<Normalized.ILooseResourceCandidateDecl>;
3616
+ private _extract;
3617
+ }
3618
+
3619
+ /**
3620
+ * Branded string representing a validated resource id. A resource ID
3621
+ * is a dot-separated sequence of resource names.
3622
+ * @public
3623
+ */
3624
+ export declare type ResourceId = Brand<string, 'ResourceId'>;
3625
+
3626
+ /**
3627
+ * `Converter` which validates an `unknown` value as a {@link ResourceId | ResourceId}.
3628
+ * @public
3629
+ */
3630
+ declare const resourceId: Converter<ResourceId, unknown>;
3631
+
3632
+ /**
3633
+ * Branded number representing a validated resource index.
3634
+ * @public
3635
+ */
3636
+ export declare type ResourceIndex = Brand<number, 'ResourceIndex'>;
3637
+
3638
+ /**
3639
+ * `Converter` which validates an `unknown` value as a {@link ResourceIndex | ResourceIndex}.
3640
+ * @public
3641
+ */
3642
+ declare const resourceIndex: Converter<ResourceIndex, unknown>;
3643
+
3644
+ declare namespace ResourceJson {
3645
+ export {
3646
+ Convert_3 as Convert,
3647
+ Helpers_2 as Helpers,
3648
+ Json,
3649
+ Normalized,
3650
+ IResourceDeclContainer,
3651
+ ResourceDeclCollection,
3652
+ ResourceDeclTree
3653
+ }
3654
+ }
3655
+ export { ResourceJson }
3656
+
3657
+ /**
3658
+ * Represents a manager for a collection of {@link Resources.Resource | resources}. Collects
3659
+ * {@link Resources.ResourceCandidate | candidates} for each resource into a
3660
+ * {@link Resources.ResourceBuilder | ResourceBuilder} per resource, validates them against each other,
3661
+ * and builds a collection of {@link Resources.Resource | resources} once all candidates are collected.
3662
+ * @public
3663
+ */
3664
+ declare class ResourceManager {
3665
+ readonly qualifiers: IReadOnlyQualifierCollector;
3666
+ readonly resourceTypes: ReadOnlyResourceTypeCollector;
3667
+ protected readonly _conditions: ConditionCollector;
3668
+ protected readonly _conditionSets: ConditionSetCollector;
3669
+ protected readonly _decisions: AbstractDecisionCollector;
3670
+ protected readonly _resources: ValidatingResultMap<ResourceId, ResourceBuilder>;
3671
+ protected readonly _builtResources: ValidatingResultMap<ResourceId, Resource>;
3672
+ protected _built: boolean;
3673
+ /**
3674
+ * A {@link Conditions.ConditionCollector | ConditionCollector} which
3675
+ * contains the {@link Conditions.Condition | conditions} used so far by
3676
+ * the {@link Resources.ResourceCandidate | resource candidates} in this manager.
3677
+ */
3678
+ get conditions(): ReadOnlyConditionCollector;
3679
+ /**
3680
+ * A {@link Conditions.ConditionSetCollector | ConditionSetCollector} which
3681
+ * contains the {@link Conditions.ConditionSet | condition sets} used so far by
3682
+ * the {@link Resources.ResourceCandidate | resource candidates} in this manager.
3683
+ */
3684
+ get conditionSets(): ReadOnlyConditionSetCollector;
3685
+ /**
3686
+ * A {@link Decisions.AbstractDecisionCollector | AbstractDecisionCollector} which
3687
+ * contains the {@link Decisions.Decision | abstract decisions} used so far by
3688
+ * the {@link Resources.ResourceCandidate | resource candidates} in this manager.
3689
+ */
3690
+ get decisions(): ReadOnlyAbstractDecisionCollector;
3691
+ /**
3692
+ * A read-only map of {@link Resources.ResourceBuilder | resource builders} used by the manager.
3693
+ */
3694
+ get resources(): Collections.IReadOnlyValidatingResultMap<ResourceId, ResourceBuilder>;
3695
+ /**
3696
+ * The number of {@link Resources.Resource | resources} contained by the manager.
3697
+ */
3698
+ get size(): number;
3699
+ /**
3700
+ * Constructor for a {@link Resources.ResourceManager | ResourceManager} object.
3701
+ * @param params - Parameters to create a new {@link Resources.ResourceManager | ResourceManager}.
3702
+ * @public
3703
+ */
3704
+ protected constructor(params: IResourceManagerCreateParams);
3705
+ /**
3706
+ * Creates a new {@link Resources.ResourceManager | ResourceManager} object.
3707
+ * @param params - Parameters to create a new {@link Resources.ResourceManager | ResourceManager}.
3708
+ * @returns `Success` with the new {@link Resources.ResourceManager | ResourceManager} object if successful,
3709
+ * or `Failure` with an error message if not.
3710
+ * @public
3711
+ */
3712
+ static create(params: IResourceManagerCreateParams): Result<ResourceManager>;
3713
+ /**
3714
+ * Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, builds and adds
3715
+ * a {@link Resources.ResourceCandidate | candidate} to the manager.
3716
+ * @param candidate - The {@link Resources.ResourceCandidate | candidate} to add.
3717
+ * @returns `Success` with the candidate if successful, or `Failure` with an error message if not.
3718
+ * @public
3719
+ */
3720
+ addLooseCandidate(decl: ResourceJson.Json.ILooseResourceCandidateDecl): DetailedResult<ResourceCandidate, ResourceManagerResultDetail>;
3721
+ addResource(decl: ResourceJson.Json.ILooseResourceDecl): DetailedResult<ResourceBuilder, ResourceManagerResultDetail>;
3722
+ /**
3723
+ * Gets an individual {@link Resources.Resource | built resource} from the manager.
3724
+ * @param id - The {@link ResourceId | id} of the resource to get.
3725
+ * @returns `Success` with the resource if successful, or `Failure` with an error message if not.
3726
+ * @public
3727
+ */
3728
+ getBuiltResource(id: string): Result<Resource>;
3729
+ /**
3730
+ * Builds the {@link Resources.Resource | resources} from the collected {@link Resources.ResourceCandidate | candidates}.
3731
+ * @returns `Success` with a read-only map of {@link Resources.Resource | resources} if successful,
3732
+ * or `Failure` with an error message if not.
3733
+ * @public
3734
+ */
3735
+ build(): Result<Collections.IReadOnlyValidatingResultMap<ResourceId, Resource>>;
3736
+ }
3737
+
3738
+ /**
3739
+ * Error details that can be returned by a {@link Resources.ResourceManager | ResourceManager}.
3740
+ * @public
3741
+ */
3742
+ declare type ResourceManagerResultDetail = Collections.ResultMapResultDetail | ResourceBuilderResultDetail;
3743
+
3744
+ /**
3745
+ * Branded string representing a validated resource name.
3746
+ * @public
3747
+ */
3748
+ export declare type ResourceName = Brand<string, 'ResourceName'>;
3749
+
3750
+ /**
3751
+ * `Converter` which validates an `unknown` value as a {@link ResourceName | ResourceName}.
3752
+ * @public
3753
+ */
3754
+ declare const resourceName: Converter<ResourceName, unknown>;
3755
+
3756
+ declare namespace Resources {
3757
+ export {
3758
+ IResourceCandidateCreateParams,
3759
+ ResourceCandidate,
3760
+ IResourceCreateParams,
3761
+ Resource,
3762
+ IResourceBuilderCreateParams,
3763
+ ResourceBuilderResultDetail,
3764
+ ResourceBuilder,
3765
+ IResourceManagerCreateParams,
3766
+ ResourceManagerResultDetail,
3767
+ ResourceManager
3768
+ }
3769
+ }
3770
+ export { Resources }
3771
+
3772
+ /**
3773
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeChildNodeDecl | resource tree child node declaration}.
3774
+ * @public
3775
+ */
3776
+ declare const resourceTreeChildNodeDecl: Converter<Normalized.IResourceTreeChildNodeDecl>;
3777
+
3778
+ /**
3779
+ * `Converter` for a normalized {@link ResourceJson.Normalized.IResourceTreeRootDecl | resource tree root declaration}.
3780
+ * @public
3781
+ */
3782
+ declare const resourceTreeRootDecl: Converter<Normalized.IResourceTreeRootDecl>;
3783
+
3784
+ /**
3785
+ * Abstract base class for resource types which are responsible for
3786
+ * validating and converting JSON values into the appropriate strongly-typed
3787
+ * resource value.
3788
+ * @public
3789
+ */
3790
+ declare abstract class ResourceType<T = unknown> implements ICollectible<ResourceTypeName, ResourceTypeIndex> {
3791
+ private _collectible;
3792
+ /**
3793
+ * The key for this resource type.
3794
+ */
3795
+ get key(): ResourceTypeName;
3796
+ /**
3797
+ * The index for this resource type.
3798
+ */
3799
+ get index(): ResourceTypeIndex | undefined;
3800
+ protected constructor(key: ResourceTypeName, index?: number);
3801
+ /**
3802
+ * Validates a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration} for
3803
+ * a partial resource instance value.
3804
+ * @param json - The JSON value to validate.
3805
+ * @param isPartial - `true` indicates that the value is expected to be incomplete.
3806
+ * @param mergeMethod - The method to use when merging with previously resolved values.
3807
+ * @returns `Success` with the strongly-typed resource value if the JSON and merge
3808
+ * method are valid, `Failure` with an error message otherwise.
3809
+ * @public
3810
+ */
3811
+ abstract validateDeclaration(json: JsonValue, isPartial: true, mergeMethod?: ResourceValueMergeMethod): Result<Partial<T>>;
3812
+ /**
3813
+ * Validates a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration} for
3814
+ * a complete resource instance value.
3815
+ * @param json - The JSON value to validate.
3816
+ * @param isPartial - `false` indicates that the value is expected to be complete.
3817
+ * @param mergeMethod - The method to use when merging with previously resolved values.
3818
+ * @returns `Success` with the strongly-typed resource value if the JSON and merge method
3819
+ * are valid, `Failure` with an error message otherwise.
3820
+ * @public
3821
+ */
3822
+ abstract validateDeclaration(json: JsonValue, isPartial: false, mergeMethod?: ResourceValueMergeMethod): Result<T>;
3823
+ /**
3824
+ * Validates a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration} for
3825
+ * a resource instance value.
3826
+ * @param json - The JSON value to validate.
3827
+ * @param isPartial - Indicates whether the value is expected to be incomplete.
3828
+ * @param mergeMethod - The method to use when merging with previously resolved values.
3829
+ * @returns `Success` with the strongly-typed resource value if the JSON and merge method
3830
+ * are valid, `Failure` with an error message otherwise.
3831
+ * @public
3832
+ */
3833
+ abstract validateDeclaration(json: JsonValue, isPartial: boolean, mergeMethod?: ResourceValueMergeMethod): Result<T | Partial<T>>;
3834
+ abstract validateDeclaration(json: JsonValue, isPartial: boolean, mergeMethod?: ResourceValueMergeMethod): Result<T | Partial<T>>;
3835
+ /**
3836
+ * Validates a JSON value for use as a partial resource instance value.
3837
+ * @param json - The JSON value to validate.
3838
+ * @param isPartial - `true` indicates that the value is expected to be partial.
3839
+ * @returns `Success` with the strongly-typed partial resource value if the JSON is valid,
3840
+ * `Failure` with an error message otherwise.
3841
+ * @public
3842
+ */
3843
+ abstract validate(json: JsonValue, isPartial: true): Result<T>;
3844
+ /**
3845
+ * Validates a JSON value for use as a complete resource instance value.
3846
+ * @param json - The JSON value to validate.
3847
+ * @param isPartial - `false` indicates that the value is expected to be complete.
3848
+ * @returns `Success` with the strongly-typed resource value if the JSON is valid,
3849
+ * `Failure` with an error message otherwise.
3850
+ * @public
3851
+ */
3852
+ abstract validate(json: JsonValue, isPartial: false): Result<Partial<T>>;
3853
+ /**
3854
+ * Validates a JSON value for use as a full or partial resource instance value.
3855
+ * @param json - The JSON value to validate.
3856
+ * @param isPartial - Indicates whether the value is expected to be partial.
3857
+ * @returns `Success` with the strongly-typed full or partial resource value if
3858
+ * the JSON is valid, `Failure` with an error message otherwise.
3859
+ * @public
3860
+ */
3861
+ abstract validate(json: JsonValue, isPartial: boolean): Result<T | Partial<T>>;
3862
+ /**
3863
+ * Sets the index for this resource type. Once set, the index cannot be changed.
3864
+ */
3865
+ setIndex(index: number): Result<ResourceTypeIndex>;
3866
+ }
3867
+
3868
+ /**
3869
+ * Map {@link ResourceTypeName | resource type names} to {@link ResourceTypes.ResourceType | resource types}.
3870
+ * @public
3871
+ */
3872
+ declare class ResourceTypeCollector extends ValidatingCollector<ResourceType> {
3873
+ protected constructor({ resourceTypes }: IResourceCollectorCreateParams);
3874
+ /**
3875
+ * Creates a new {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector}.
3876
+ * @param params - Optional for creating the new collector.
3877
+ * @returns `Success` with the new instance, or `Failure` with an error
3878
+ * message if the collector could not be created.
3879
+ */
3880
+ static create(params?: IResourceCollectorCreateParams): Result<ResourceTypeCollector>;
3881
+ protected _toResourceType(from: unknown): Result<ResourceType>;
3882
+ }
3883
+
3884
+ /**
3885
+ * Branded number representing a validated resource type index.
3886
+ * @public
3887
+ */
3888
+ export declare type ResourceTypeIndex = Brand<number, 'ResourceTypeIndex'>;
3889
+
3890
+ /**
3891
+ * `Converter` which validates an `unknown` value as a {@link ResourceTypeIndex | ResourceTypeIndex}.
3892
+ * @public
3893
+ */
3894
+ declare const resourceTypeIndex: Converter<ResourceTypeIndex, unknown>;
3895
+
3896
+ /**
3897
+ * Branded string representing a validated resource type name.
3898
+ * @public
3899
+ */
3900
+ export declare type ResourceTypeName = Brand<string, 'ResourceTypeName'>;
3901
+
3902
+ /**
3903
+ * `Converter` which validates an `unknown` value as a {@link ResourceTypeName | ResourceTypeName}.
3904
+ * @public
3905
+ */
3906
+ declare const resourceTypeName: Converter<ResourceTypeName, unknown>;
3907
+
3908
+ declare namespace ResourceTypes {
3909
+ export {
3910
+ ResourceType,
3911
+ IResourceCollectorCreateParams,
3912
+ ResourceTypeCollector,
3913
+ ReadOnlyResourceTypeCollector,
3914
+ IJsonResourceTypeCreateParams,
3915
+ JsonResourceType
3916
+ }
3917
+ }
3918
+ export { ResourceTypes }
3919
+
3920
+ /**
3921
+ * Type representing the possible ways that a resource value can be merged into an existing resource.
3922
+ * - 'augment' means that the new value should be merged into the existing value, with new properties added and existing properties updated.
3923
+ * - 'delete' means that the existing values should be deleted.
3924
+ * - 'replace' means that the new value should replace the existing value.
3925
+ * @public
3926
+ */
3927
+ export declare type ResourceValueMergeMethod = 'augment' | 'delete' | 'replace';
3928
+
3929
+ /**
3930
+ * `Converter` for a resource value merge method.
3931
+ * @public
3932
+ */
3933
+ declare const resourceValueMergeMethod: Converter<ResourceValueMergeMethod, ResourceValueMergeMethod[]>;
3934
+
3935
+ /**
3936
+ * @internal
3937
+ */
3938
+ declare const segmentedIdentifier: RegExp;
3939
+
3940
+ /**
3941
+ * Splits a {@link ResourceId | resource id} into its component {@link ResourceName | resource names}.
3942
+ *
3943
+ * @param id - The ID to split.
3944
+ * @returns `Success`with an array of {@link ResourceName | ResourceName} objects if the ID is valid, or
3945
+ * `Failure` with an error message if not.
3946
+ * @public
3947
+ */
3948
+ declare function splitResourceId(id: string | undefined): Result<ResourceName[]>;
3949
+
3950
+ /**
3951
+ * @internal
3952
+ */
3953
+ declare const territoryCode: RegExp;
3954
+
3955
+ /**
3956
+ * Qualifier type for territory values. Territories are two-letter ISO-3166-2
3957
+ * Alpha-2 country codes. Canonical territory codes are uppercase, but this
3958
+ * implementation handles incorrect casing.
3959
+ * @public
3960
+ */
3961
+ declare class TerritoryQualifierType extends QualifierType {
3962
+ /**
3963
+ * Optional array enumerating allowed territories to further constrain the type.
3964
+ */
3965
+ readonly allowedTerritories?: ReadonlyArray<QualifierConditionValue>;
3966
+ /**
3967
+ * Creates a new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} instance.
3968
+ * @public
3969
+ */
3970
+ protected constructor({ allowedTerritories, allowContextList, name, index }: ITerritoryQualifierTypeCreateParams);
3971
+ /**
3972
+ * {@inheritdoc QualifierTypes.QualifierType.isValidConditionValue}
3973
+ */
3974
+ isValidConditionValue(value: string): value is QualifierConditionValue;
3975
+ /**
3976
+ * Creates a new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} instance.
3977
+ * @param params - Optional {@link QualifierTypes.ITerritoryQualifierTypeCreateParams | parameters} to use
3978
+ * when creating the instance.
3979
+ * @returns `Success` with the new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} if successful,
3980
+ * `Failure` with an error message otherwise.
3981
+ * @public
3982
+ */
3983
+ static create(params?: ITerritoryQualifierTypeCreateParams): Result<TerritoryQualifierType>;
3984
+ /**
3985
+ * {@inheritdoc QualifierTypes.QualifierType._matchOne}
3986
+ */
3987
+ protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue): QualifierMatchScore;
3988
+ /**
3989
+ * Determines whether a value is a valid condition value for a territory qualifier.
3990
+ * @param value - The value to validate.
3991
+ * @returns `true` if the value is a valid condition value, `false` otherwise.
3992
+ * @public
3993
+ */
3994
+ static isValidTerritoryConditionValue(value: string): value is QualifierConditionValue;
3995
+ /**
3996
+ * Converts a string value to a territory condition value.
3997
+ * @param value - The value to convert.
3998
+ * @returns `Success` with the converted value if successful, `Failure` with an error message otherwise.
3999
+ * @public
4000
+ */
4001
+ static toTerritoryConditionValue(value: string): Result<QualifierConditionValue>;
4002
+ }
4003
+
4004
+ /**
4005
+ * Converts a number to a {@link ConditionIndex} if it is a valid condition index.
4006
+ * @param index - the number to convert
4007
+ * @returns `Success` with the converted {@link ConditionIndex} if successful, or `Failure` with an
4008
+ * error message if not.
4009
+ * @public
4010
+ */
4011
+ declare function toConditionIndex(index: number): Result<ConditionIndex>;
4012
+
4013
+ /**
4014
+ * Converts a string to a {@link ConditionKey} if it is a valid condition key.
4015
+ * @param key - the string to convert
4016
+ * @returns `Success` with the converted {@link ConditionKey} if successful, or `Failure` with an
4017
+ * error message if not.
4018
+ * @public
4019
+ */
4020
+ declare function toConditionKey(key: string): Result<ConditionKey>;
4021
+
4022
+ /**
4023
+ * Converts a string to a {@link ConditionOperator} if it is a valid condition operator.
4024
+ * @param operator - the string to convert
4025
+ * @returns `Success` with the converted {@link ConditionOperator} if successful, or `Failure` with an
4026
+ * error message if not.
4027
+ * @public
4028
+ */
4029
+ declare function toConditionOperator(operator: string): Result<ConditionOperator>;
4030
+
4031
+ /**
4032
+ * Converts a number to a {@link ConditionPriority} if it is a valid priority.
4033
+ * @param priority - the number to convert
4034
+ * @returns `Success` with the converted {@link ConditionPriority} if successful, or `Failure` with an
4035
+ * error message if not.
4036
+ * @public
4037
+ */
4038
+ declare function toConditionPriority(priority: number): Result<ConditionPriority>;
4039
+
4040
+ /**
4041
+ * Converts a string to a {@link ConditionSetHash} if it is a valid condition set hash.
4042
+ * @param key - the string to convert
4043
+ * @returns `Success` with the converted {@link ConditionSetHash} if successful, or `Failure` with an
4044
+ * error message if not.
4045
+ * @public
4046
+ */
4047
+ declare function toConditionSetHash(hash: string): Result<ConditionSetHash>;
4048
+
4049
+ /**
4050
+ * Converts a number to a {@link ConditionSetIndex} if it is a valid condition set index.
4051
+ * @param index - the number to convert
4052
+ * @returns `Success` with the converted {@link ConditionSetIndex} if successful, or `Failure` with an
4053
+ * error message if not.
4054
+ * @public
4055
+ */
4056
+ declare function toConditionSetIndex(index: number): Result<ConditionSetIndex>;
4057
+
4058
+ /**
4059
+ * Converts a string to a {@link ConditionSetKey} if it is a valid condition set key.
4060
+ * @param key - the string to convert
4061
+ * @returns `Success` with the converted {@link ConditionSetKey} if successful, or `Failure` with an
4062
+ * error message if not.
4063
+ * @public
4064
+ */
4065
+ declare function toConditionSetKey(key: string): Result<ConditionSetKey>;
4066
+
4067
+ /**
4068
+ * Converts a string to a {@link ConditionSetToken} if it is a valid condition set token.
4069
+ * @param token - the string to convert
4070
+ * @returns `Success` with the converted {@link ConditionSetToken} if successful, or `Failure` with an
4071
+ * error message if not.
4072
+ * @public
4073
+ */
4074
+ declare function toConditionSetToken(token: string): Result<ConditionSetToken>;
4075
+
4076
+ /**
4077
+ * Converts a string to a {@link ConditionToken} if it is a valid condition token.
4078
+ * @param token - the string to convert
4079
+ * @returns `Success` with the converted {@link ConditionToken} if successful, or `Failure` with an
4080
+ * error message if not.
4081
+ * @public
4082
+ */
4083
+ declare function toConditionToken(token: string): Result<ConditionToken>;
4084
+
4085
+ /**
4086
+ * Converts a number to a {@link DecisionIndex} if it is a valid decision index.
4087
+ * @param index - the number to convert
4088
+ * @returns `Success` with the converted {@link DecisionIndex} if successful, or `Failure` with an
4089
+ * error message if not.
4090
+ * @public
4091
+ */
4092
+ declare function toDecisionIndex(index: number): Result<DecisionIndex>;
4093
+
4094
+ /**
4095
+ * Converts a number to a {@link DecisionIndex} if it is a valid decision index.
4096
+ * @param index - the number to convert
4097
+ * @returns `Success` with the converted {@link DecisionIndex} if successful, or `Failure` with an
4098
+ * error message if not.
4099
+ * @public
4100
+ */
4101
+ declare function toDecisionKey(key: string): Result<DecisionKey>;
4102
+
4103
+ /**
4104
+ * Converts an optional string to an optional {@link ResourceId | resource ID}.
4105
+ *
4106
+ * @param id - The string to convert.
4107
+ * @returns `Success` with the converted ID if valid, or `Failure` with an error message
4108
+ * if not.
4109
+ * @public
4110
+ */
4111
+ declare function toOptionalResourceId(id?: string): Result<ResourceId | undefined>;
4112
+
4113
+ /**
4114
+ * Converts a number to a {@link QualifierIndex} if it is a valid qualifier index.
4115
+ * @param index - the number to convert
4116
+ * @returns `Success` with the converted {@link QualifierIndex} if successful, or `Failure` with an
4117
+ * error message if not.
4118
+ * @public
4119
+ */
4120
+ declare function toQualifierIndex(index: number): Result<QualifierIndex>;
4121
+
4122
+ /**
4123
+ * Converts a number to a {@link QualifierMatchScore | match score} if it is a valid score.
4124
+ * @param value - The number to convert.
4125
+ * @returns `Success` with the converted score if successful, or `Failure` with an error message
4126
+ * if not.
4127
+ * @public
4128
+ */
4129
+ declare function toQualifierMatchScore(value: number): Result<QualifierMatchScore>;
4130
+
4131
+ /**
4132
+ * Converts a string to a {@link QualifierName} if it is a valid qualifier name.
4133
+ * @param name - the string to convert
4134
+ * @returns `Success` with the converted {@link QualifierName} if successful, or `Failure` with an
4135
+ * error message if not.
4136
+ * @public
4137
+ */
4138
+ declare function toQualifierName(name: string): Result<QualifierName>;
4139
+
4140
+ /**
4141
+ * Converts a number to a {@link QualifierTypeIndex} if it is a valid qualifier type index.
4142
+ * @param index - the number to convert
4143
+ * @returns `Success` with the converted {@link QualifierTypeIndex} if successful, or `Failure` with an
4144
+ * error message if not.
4145
+ * @public
4146
+ */
4147
+ declare function toQualifierTypeIndex(index: number): Result<QualifierTypeIndex>;
4148
+
4149
+ /**
4150
+ * Converts a string to a {@link QualifierTypeName} if it is a valid qualifier type name.
4151
+ * @param name - the string to convert
4152
+ * @returns `Success` with the converted {@link QualifierTypeName} if successful, or `Failure` with an
4153
+ * error message if not.
4154
+ * @public
4155
+ */
4156
+ declare function toQualifierTypeName(name: string): Result<QualifierTypeName>;
4157
+
4158
+ /**
4159
+ * Converts a string to a {@link ResourceId | resource ID}.
4160
+ *
4161
+ * @param id - The string to convert.
4162
+ * @returns `Success` with the converted ID if valid, or `Failure` with an error message
4163
+ * if not.
4164
+ * @public
4165
+ */
4166
+ declare function toResourceId(id: string): Result<ResourceId>;
4167
+
4168
+ /**
4169
+ * Converts a number to a {@link ResourceIndex | resource index}.
4170
+ *
4171
+ * @param index - The number to convert.
4172
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
4173
+ * if not.
4174
+ * @public
4175
+ */
4176
+ declare function toResourceIndex(index: number): Result<ResourceIndex>;
4177
+
4178
+ /**
4179
+ * Converts a string to a {@link ResourceName | resource name}.
4180
+ *
4181
+ * @param id - The string to convert.
4182
+ * @returns `Success` with the converted name if valid, or `Failure` with an error message
4183
+ * if not.
4184
+ * @public
4185
+ */
4186
+ declare function toResourceName(name: string): Result<ResourceName>;
4187
+
4188
+ /**
4189
+ * Converts a number to a {@link ResourceTypeIndex | resource type index}.
4190
+ *
4191
+ * @param index - The number to convert.
4192
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
4193
+ * if not.
4194
+ * @public
4195
+ */
4196
+ declare function toResourceTypeIndex(index: number): Result<ResourceTypeIndex>;
4197
+
4198
+ /**
4199
+ * Converts a string to a {@link ResourceTypeName | resource type name}.
4200
+ *
4201
+ * @param name - The string to convert.
4202
+ * @returns `Success` with the converted name if valid, or `Failure` with an error message
4203
+ * if not.
4204
+ * @public
4205
+ */
4206
+ declare function toResourceTypeName(name: string): Result<ResourceTypeName>;
4207
+
4208
+ declare namespace Validate {
4209
+ export {
4210
+ RegularExpressions,
4211
+ isValidQualifierName,
4212
+ isValidQualifierTypeName,
4213
+ isValidConditionPriority,
4214
+ isValidQualifierIndex,
4215
+ isValidQualifierTypeIndex,
4216
+ isValidQualifierMatchScore,
4217
+ isValidConditionIndex,
4218
+ isValidConditionOperator,
4219
+ isValidConditionKey,
4220
+ isValidConditionToken,
4221
+ isValidConditionSetIndex,
4222
+ isValidConditionSetKey,
4223
+ isValidConditionSetToken,
4224
+ isValidConditionSetHash,
4225
+ isValidDecisionKey,
4226
+ isValidDecisionIndex,
4227
+ toQualifierName,
4228
+ toQualifierIndex,
4229
+ toQualifierTypeName,
4230
+ toQualifierTypeIndex,
4231
+ toQualifierMatchScore,
4232
+ toConditionPriority,
4233
+ toConditionIndex,
4234
+ toConditionOperator,
4235
+ toConditionKey,
4236
+ toConditionToken,
4237
+ toConditionSetIndex,
4238
+ toConditionSetKey,
4239
+ toConditionSetToken,
4240
+ toConditionSetHash,
4241
+ toDecisionKey,
4242
+ toDecisionIndex,
4243
+ isValidResourceName,
4244
+ isValidResourceId,
4245
+ isValidResourceIndex,
4246
+ isValidResourceTypeName,
4247
+ isValidResourceTypeIndex,
4248
+ toResourceName,
4249
+ toResourceId,
4250
+ toOptionalResourceId,
4251
+ toResourceIndex,
4252
+ toResourceTypeName,
4253
+ toResourceTypeIndex
4254
+ }
4255
+ }
4256
+ export { Validate }
4257
+
4258
+ /**
4259
+ * Converter which constructs a {@link Conditions.IValidatedConditionDecl | validated condition declaration}
4260
+ * from a {@link Conditions.IConditionDecl | condition declaration}, instantiating qualifiers by name
4261
+ * from a supplied {@link Conditions.Convert.IConditionDeclConvertContext | conversion context}.
4262
+ * @public
4263
+ */
4264
+ declare const validatedConditionDecl: Converter<IValidatedConditionDecl, IConditionDeclConvertContext>;
4265
+
4266
+ /**
4267
+ * Converter which constructs a {@link Conditions.IValidatedConditionSetDecl | validated condition set declaration}
4268
+ * from a {@link Conditions.IConditionSetDecl | condition set declaration}, instantiating qualifiers by name
4269
+ * from a supplied {@link Conditions.Convert.IConditionSetDeclConvertContext | conversion context}.
4270
+ * @public
4271
+ */
4272
+ declare const validatedConditionSetDecl: Converter<IValidatedConditionSetDecl, IConditionSetDeclConvertContext>;
4273
+
4274
+ /**
4275
+ * Converter which constructs a {@link Qualifiers.IValidatedQualifierDecl | validated qualifier declaration}
4276
+ * from a {@link Qualifiers.IQualifierDecl | qualifier declaration}, instantiating qualifier types by name
4277
+ * from a supplied {@link Qualifiers.Convert.IQualifierDeclConvertContext | conversion context}.
4278
+ * @public
4279
+ */
4280
+ declare const validatedQualifierDecl: Converter<IValidatedQualifierDecl, IQualifierDeclConvertContext>;
4281
+
4282
+ export { }