@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 @@
1
+ {"version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AAO,CAAC,UAAU,CAAC;KACnB,OAAO,EAAE,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Collections, Hash, Result } from '@fgv/ts-utils';\nimport { Convert as CommonConvert, DecisionIndex, DecisionKey } from '../common';\nimport { JsonValue } from '@fgv/ts-json-base';\nimport { Candidate, ICandidate } from './candidate';\nimport { IDecision } from './common';\nimport { ConditionSet } from '../conditions';\n\n/**\n * Parameters used to create a new {@link Decisions.Decision | Decision}\n * with the {@link Decisions.Decision.createDecision | createDecision}\n * static method.\n * @public\n */\nexport interface IDecisionCreateParams<TVALUE extends JsonValue = JsonValue> {\n candidates: ReadonlyArray<ICandidate<TVALUE>>;\n index?: number;\n}\n\n/**\n * Parameters used to construct a new {@link Decisions.Decision | Decision} with\n * the protected constructor.\n * @public\n */\nexport interface IDecisionConstructorParams<TVALUE extends JsonValue = JsonValue>\n extends IDecisionCreateParams<TVALUE> {\n isAbstract: boolean;\n}\n\n/**\n * Simple collectible implementation of {@link Decisions.IDecision | IDecision}.\n * @public\n */\nexport class Decision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {\n /**\n * The sorted {@link Conditions.ConditionSet | ConditionSets} that make up this decision.\n * @public\n */\n public readonly candidates: ReadonlyArray<Candidate<TVALUE>>;\n\n /**\n * Unique global key for this decision, derived from the contents\n * of the decision.\n */\n public get key(): DecisionKey {\n return this._collectible.key;\n }\n\n /**\n * Unique global index for this decision.\n */\n public get index(): DecisionIndex | undefined {\n return this._collectible.index;\n }\n\n /**\n * Key for the empty decision (no condition sets).\n */\n public static readonly EmptyDecisionKey: DecisionKey = CommonConvert.decisionKey.convert('').orThrow();\n\n /**\n * Key for the default-only decision (single condition set with no conditions).\n */\n public static readonly DefaultOnlyDecisionKey: DecisionKey = CommonConvert.decisionKey\n .convert('00000000')\n .orThrow();\n\n private _collectible: Collections.Collectible<DecisionKey, DecisionIndex>;\n\n /**\n * Constructor for a {@link Decisions.Decision | Decision} object.\n * @param params - {@link Decisions.IDecisionConstructorParams | Parameters} used to create the decision.\n * @public\n */\n protected constructor(params: IDecisionConstructorParams<TVALUE>) {\n this.candidates = Array.from(params.candidates)\n .map((c) => Candidate.createCandidate(c).orThrow())\n .sort(Candidate.compare)\n .reverse();\n\n /* c8 ignore next 3 - coverage having a rough time */\n const key = params.isAbstract\n ? Decision.getAbstractKey(this.candidates.map((c) => c.conditionSet))\n : Decision.getKey(this.candidates);\n\n this._collectible = new Collections.Collectible<DecisionKey, DecisionIndex>({\n key,\n index: params.index,\n indexConverter: CommonConvert.decisionIndex\n });\n }\n\n /**\n * Creates a new {@link Decisions.Decision | Decision} object.\n * @param params - {@link Decisions.IDecisionCreateParams | Parameters} used to create the decision.\n * @returns `Success` with the new decision if successful, or `Failure` with an error message if not.\n * @public\n */\n public static createDecision(params: IDecisionCreateParams): Result<Decision> {\n return captureResult(() => new Decision({ ...params, isAbstract: false }));\n }\n\n /**\n * Sets the index for this decision. Once set, index is immutable.\n * @param index - The index to set.\n * @returns `Success` with the new index if successful, or `Failure` with an error message if not.\n * @public\n */\n public setIndex(index: number): Result<DecisionIndex> {\n return this._collectible.setIndex(index);\n }\n\n /**\n * Helper function to return a stable key for a the condition sets that\n * make up a {@link Decisions.Decision | decision}. The abstract\n * key is a `+`-separated list of the hashes of the sorted condition sets\n * that make up the decision.\n * @param conditionSets - The condition sets to use to create the key.\n * @returns A key derived from the condition set hashes.\n * @public\n */\n public static getAbstractKey(conditionSets: ReadonlyArray<ConditionSet>): DecisionKey {\n return CommonConvert.decisionKey\n .convert(\n Array.from(conditionSets)\n .sort(ConditionSet.compare)\n .reverse()\n .map((c) => c.toHash())\n .join('+')\n )\n .orThrow();\n }\n\n /**\n * Helper function to return a stable key for a set of condition sets.\n * @param conditionSets - The condition sets to use to create the key.\n * @returns A key derived from the condition set hashes.\n * @public\n */\n public static getKey<TVALUE extends JsonValue = JsonValue>(\n candidates: ReadonlyArray<ICandidate<TVALUE>>\n ): DecisionKey {\n const abstractKey = Decision.getAbstractKey(candidates.map((c) => c.conditionSet));\n const valueKey = Hash.Crc32Normalizer.crc32Hash(candidates.map((c) => JSON.stringify(c.value)));\n return CommonConvert.decisionKey.convert(`${abstractKey}|${valueKey}`).orThrow();\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export * from './common';
2
+ export * from './candidate';
3
+ export * from './decision';
4
+ export * from './abstractDecision';
5
+ export * from './abstractDecisionCollector';
6
+ export * from './concreteDecision';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/decisions/index.ts"],"names":[],"mappings":"AAsBA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ __exportStar(require("./common"), exports);
39
+ __exportStar(require("./candidate"), exports);
40
+ __exportStar(require("./decision"), exports);
41
+ __exportStar(require("./abstractDecision"), exports);
42
+ __exportStar(require("./abstractDecisionCollector"), exports);
43
+ __exportStar(require("./concreteDecision"), exports);
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/decisions/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,8CAA4B;AAC5B,6CAA2B;AAC3B,qDAAmC;AACnC,8DAA4C;AAC5C,qDAAmC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './common';\nexport * from './candidate';\nexport * from './decision';\nexport * from './abstractDecision';\nexport * from './abstractDecisionCollector';\nexport * from './concreteDecision';\n"]}
@@ -0,0 +1,99 @@
1
+ import { DetailedResult, FileTree, Result } from '@fgv/ts-utils';
2
+ import * as Conditions from '../conditions';
3
+ import { IReadOnlyQualifierCollector } from '../qualifiers';
4
+ import { ImportContext } from './importContext';
5
+ /**
6
+ * Result details for {@link Import.FsItem | FsItem} operations.
7
+ * @public
8
+ */
9
+ export type FsItemResultDetail = 'failed' | 'skipped' | 'succeeded';
10
+ /**
11
+ * Interface describing some single file system item.
12
+ * @public
13
+ */
14
+ export interface IFsItemProps {
15
+ /**
16
+ * The underlying `FileTreeItem` for this item.
17
+ */
18
+ readonly item: FileTree.FileTreeItem;
19
+ /**
20
+ * The base name of the file system item, once
21
+ * any conditions set tokens have been removed.
22
+ */
23
+ readonly baseName: string;
24
+ /**
25
+ * {@link Conditions.IValidatedConditionDecl | Conditions} extracted
26
+ * from the base name of the {@link Import.FsItem | FsItem}.
27
+ */
28
+ readonly conditions: Conditions.IValidatedConditionDecl[];
29
+ }
30
+ /**
31
+ * Class describing some file system item to be imported.
32
+ * @public
33
+ */
34
+ export declare class FsItem implements IFsItemProps {
35
+ /**
36
+ * {@inheritDoc Import.IFsItemProps.baseName}
37
+ */
38
+ readonly baseName: string;
39
+ /**
40
+ * {@inheritDoc Import.IFsItemProps.conditions}
41
+ */
42
+ readonly conditions: Conditions.IValidatedConditionDecl[];
43
+ /**
44
+ * {@inheritDoc Import.IFsItemProps.item}
45
+ */
46
+ readonly item: FileTree.FileTreeItem;
47
+ /**
48
+ * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for this item.
49
+ */
50
+ readonly qualifiers: IReadOnlyQualifierCollector;
51
+ /**
52
+ * Protected constructor creates a new {@link Import.FsItem | FsItem}.
53
+ * @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.
54
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
55
+ * embedded condition set tokens.
56
+ * @param tree - file tree implementation to use for this item.
57
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
58
+ * containing an error message if not.
59
+ */
60
+ protected constructor(props: IFsItemProps, qualifiers: IReadOnlyQualifierCollector);
61
+ /**
62
+ * Creates a new {@link Import.FsItem | FsItem} from a `FileTreeItem`.
63
+ * @param item - The `FileTreeItem` to import.
64
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
65
+ * embedded condition set tokens.
66
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
67
+ * containing an error message if not. Note that the result detail `skipped` indicates that the item
68
+ * was not created because it is not relevant - this is a soft error that should be silently ignored.
69
+ */
70
+ static createForItem(item: FileTree.FileTreeItem, qualifiers: IReadOnlyQualifierCollector): DetailedResult<FsItem, FsItemResultDetail>;
71
+ /**
72
+ * Creates a new {@link Import.FsItem | FsItem} from a file system path.
73
+ * @param importPath - The path to the file system item to import.
74
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
75
+ * embedded condition set tokens.
76
+ * @param fs - An optional {@link Import.IImporterFilesystem | file system implementation} to use for this item.
77
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created
78
+ * successfully, or a `Failure` containing an error message if it is not. Note that the result detail
79
+ * `skipped` indicates that the item was not created because it is not relevant - this is a soft error
80
+ * that should be silently ignored.
81
+ */
82
+ static createForPath(importPath: string, qualifiers: IReadOnlyQualifierCollector, tree?: FileTree.FileTree): DetailedResult<FsItem, FsItemResultDetail>;
83
+ /**
84
+ * Tries to parse a base name into a base name and a set of conditions.
85
+ * @param baseName - The base name to parse.
86
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
87
+ * embedded condition set tokens.
88
+ * @returns `Success` containing the parsed base name and conditions on success, or `Failure` containing
89
+ * an error message if it is not.
90
+ */
91
+ static tryParseBaseName(baseName: string, qualifiers: IReadOnlyQualifierCollector): Result<Omit<IFsItemProps, 'item'>>;
92
+ /**
93
+ * Gets the context for this file system item.
94
+ * @returns `Success` containing the {@link Import.ImportContext | import context} for this item
95
+ * if successful, or a `Failure` containing an error message if an error occurs.
96
+ */
97
+ getContext(): Result<ImportContext>;
98
+ }
99
+ //# sourceMappingURL=fsItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsItem.d.ts","sourceRoot":"","sources":["../../../src/packlets/import/fsItem.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EACd,QAAQ,EAER,MAAM,EAIP,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,uBAAuB,EAAE,CAAC;CAC3D;AAED;;;GAGG;AACH,qBAAa,MAAO,YAAW,YAAY;IACzC;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,SAAgB,UAAU,EAAE,UAAU,CAAC,uBAAuB,EAAE,CAAC;IAEjE;;OAEG;IACH,SAAgB,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC;IAE5C;;OAEG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD;;;;;;;;OAQG;IACH,SAAS,aAAa,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,2BAA2B;IAQlF;;;;;;;;OAQG;WACW,aAAa,CACzB,IAAI,EAAE,QAAQ,CAAC,YAAY,EAC3B,UAAU,EAAE,2BAA2B,GACtC,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAW7C;;;;;;;;;;OAUG;WACW,aAAa,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,2BAA2B,EACvC,IAAI,CAAC,EAAE,QAAQ,CAAC,QAAQ,GACvB,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAgB7C;;;;;;;OAOG;WACW,gBAAgB,CAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAyBrC;;;;OAIG;IACI,UAAU,IAAI,MAAM,CAAC,aAAa,CAAC;CAa3C"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.FsItem = void 0;
58
+ const ts_utils_1 = require("@fgv/ts-utils");
59
+ const common_1 = require("../common");
60
+ const Conditions = __importStar(require("../conditions"));
61
+ const importContext_1 = require("./importContext");
62
+ /**
63
+ * Class describing some file system item to be imported.
64
+ * @public
65
+ */
66
+ class FsItem {
67
+ /**
68
+ * Protected constructor creates a new {@link Import.FsItem | FsItem}.
69
+ * @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.
70
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
71
+ * embedded condition set tokens.
72
+ * @param tree - file tree implementation to use for this item.
73
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
74
+ * containing an error message if not.
75
+ */
76
+ constructor(props, qualifiers) {
77
+ const { baseName, conditions, item } = props;
78
+ this.baseName = baseName;
79
+ this.conditions = conditions;
80
+ this.item = item;
81
+ this.qualifiers = qualifiers;
82
+ }
83
+ /**
84
+ * Creates a new {@link Import.FsItem | FsItem} from a `FileTreeItem`.
85
+ * @param item - The `FileTreeItem` to import.
86
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
87
+ * embedded condition set tokens.
88
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
89
+ * containing an error message if not. Note that the result detail `skipped` indicates that the item
90
+ * was not created because it is not relevant - this is a soft error that should be silently ignored.
91
+ */
92
+ static createForItem(item, qualifiers) {
93
+ const baseName = item.type === 'file' ? item.baseName : item.name;
94
+ return FsItem.tryParseBaseName(baseName, qualifiers)
95
+ .withErrorFormat((msg) => `${baseName}: error extracting conditions - ${msg}`)
96
+ .onSuccess(({ baseName: newBaseName, conditions }) => {
97
+ return (0, ts_utils_1.captureResult)(() => new FsItem({ baseName: newBaseName, conditions, item }, qualifiers));
98
+ })
99
+ .withDetail('failed', 'succeeded');
100
+ }
101
+ /**
102
+ * Creates a new {@link Import.FsItem | FsItem} from a file system path.
103
+ * @param importPath - The path to the file system item to import.
104
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
105
+ * embedded condition set tokens.
106
+ * @param fs - An optional {@link Import.IImporterFilesystem | file system implementation} to use for this item.
107
+ * @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created
108
+ * successfully, or a `Failure` containing an error message if it is not. Note that the result detail
109
+ * `skipped` indicates that the item was not created because it is not relevant - this is a soft error
110
+ * that should be silently ignored.
111
+ */
112
+ static createForPath(importPath, qualifiers, tree) {
113
+ if (tree === undefined) {
114
+ const treeResult = ts_utils_1.FileTree.forFilesystem();
115
+ /* c8 ignore next 3 - defense in depth should never happen */
116
+ if (treeResult.isFailure()) {
117
+ return (0, ts_utils_1.failWithDetail)(treeResult.message, 'failed');
118
+ }
119
+ tree = treeResult.value;
120
+ }
121
+ return tree
122
+ .getItem(importPath)
123
+ .withDetail('failed')
124
+ .onSuccess((item) => FsItem.createForItem(item, qualifiers));
125
+ }
126
+ /**
127
+ * Tries to parse a base name into a base name and a set of conditions.
128
+ * @param baseName - The base name to parse.
129
+ * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
130
+ * embedded condition set tokens.
131
+ * @returns `Success` containing the parsed base name and conditions on success, or `Failure` containing
132
+ * an error message if it is not.
133
+ */
134
+ static tryParseBaseName(baseName, qualifiers) {
135
+ const nameParts = baseName.split('.');
136
+ const segmentToTest = nameParts.length > 1 ? nameParts[nameParts.length - 1] : nameParts[0];
137
+ const validatedConditions = common_1.Helpers.parseConditionSetTokenParts(segmentToTest).onSuccess((parts) => {
138
+ return (0, ts_utils_1.mapResults)(parts.map((part) => Conditions.ConditionTokens.validateConditionTokenParts(part, qualifiers))).onFailure((msg) => {
139
+ if (parts.length === 1 && parts[0].qualifier === undefined) {
140
+ return (0, ts_utils_1.succeed)([]);
141
+ }
142
+ return (0, ts_utils_1.fail)(msg);
143
+ });
144
+ });
145
+ if (validatedConditions.isFailure()) {
146
+ return (0, ts_utils_1.fail)(validatedConditions.message);
147
+ }
148
+ const conditions = validatedConditions.value;
149
+ if (conditions.length > 0) {
150
+ baseName = nameParts.filter((s) => s !== segmentToTest).join('.');
151
+ }
152
+ return (0, ts_utils_1.succeed)({ baseName, conditions });
153
+ }
154
+ /**
155
+ * Gets the context for this file system item.
156
+ * @returns `Success` containing the {@link Import.ImportContext | import context} for this item
157
+ * if successful, or a `Failure` containing an error message if an error occurs.
158
+ */
159
+ getContext() {
160
+ return common_1.Validate.toOptionalResourceId(this.baseName).onSuccess((baseId) => {
161
+ const conditions = this.conditions.map((c) => {
162
+ return {
163
+ qualifierName: c.qualifier.name,
164
+ value: c.value,
165
+ operator: c.operator,
166
+ priority: c.priority
167
+ };
168
+ });
169
+ return importContext_1.ImportContext.create({ baseId, conditions });
170
+ });
171
+ }
172
+ }
173
+ exports.FsItem = FsItem;
174
+ //# sourceMappingURL=fsItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsItem.js","sourceRoot":"","sources":["../../../src/packlets/import/fsItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CASuB;AACvB,sCAA+D;AAC/D,0DAA4C;AAE5C,mDAAgD;AA+BhD;;;GAGG;AACH,MAAa,MAAM;IAqBjB;;;;;;;;OAQG;IACH,YAAsB,KAAmB,EAAE,UAAuC;QAChF,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,aAAa,CACzB,IAA2B,EAC3B,UAAuC;QAEvC,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAE1E,OAAO,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC;aACjD,eAAe,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,QAAQ,mCAAmC,GAAG,EAAE,CAAC;aAC7E,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE;YACnD,OAAO,IAAA,wBAAa,EAAC,GAAG,EAA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AE,CAAC,CAAC,QAAQ;oBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;iBACrB,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,6BAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlJD,wBAkJC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n DetailedResult,\n FileTree,\n mapResults,\n Result,\n fail,\n succeed,\n failWithDetail\n} from '@fgv/ts-utils';\nimport { Helpers as CommonHelpers, Validate } from '../common';\nimport * as Conditions from '../conditions';\nimport { IReadOnlyQualifierCollector } from '../qualifiers';\nimport { ImportContext } from './importContext';\n\n/**\n * Result details for {@link Import.FsItem | FsItem} operations.\n * @public\n */\nexport type FsItemResultDetail = 'failed' | 'skipped' | 'succeeded';\n\n/**\n * Interface describing some single file system item.\n * @public\n */\nexport interface IFsItemProps {\n /**\n * The underlying `FileTreeItem` for this item.\n */\n readonly item: FileTree.FileTreeItem;\n\n /**\n * The base name of the file system item, once\n * any conditions set tokens have been removed.\n */\n readonly baseName: string;\n\n /**\n * {@link Conditions.IValidatedConditionDecl | Conditions} extracted\n * from the base name of the {@link Import.FsItem | FsItem}.\n */\n readonly conditions: Conditions.IValidatedConditionDecl[];\n}\n\n/**\n * Class describing some file system item to be imported.\n * @public\n */\nexport class FsItem implements IFsItemProps {\n /**\n * {@inheritDoc Import.IFsItemProps.baseName}\n */\n public readonly baseName: string;\n\n /**\n * {@inheritDoc Import.IFsItemProps.conditions}\n */\n public readonly conditions: Conditions.IValidatedConditionDecl[];\n\n /**\n * {@inheritDoc Import.IFsItemProps.item}\n */\n public readonly item: FileTree.FileTreeItem;\n\n /**\n * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for this item.\n */\n public readonly qualifiers: IReadOnlyQualifierCollector;\n\n /**\n * Protected constructor creates a new {@link Import.FsItem | FsItem}.\n * @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @param tree - file tree implementation to use for this item.\n * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`\n * containing an error message if not.\n */\n protected constructor(props: IFsItemProps, qualifiers: IReadOnlyQualifierCollector) {\n const { baseName, conditions, item } = props;\n this.baseName = baseName;\n this.conditions = conditions;\n this.item = item;\n this.qualifiers = qualifiers;\n }\n\n /**\n * Creates a new {@link Import.FsItem | FsItem} from a `FileTreeItem`.\n * @param item - The `FileTreeItem` to import.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`\n * containing an error message if not. Note that the result detail `skipped` indicates that the item\n * was not created because it is not relevant - this is a soft error that should be silently ignored.\n */\n public static createForItem(\n item: FileTree.FileTreeItem,\n qualifiers: IReadOnlyQualifierCollector\n ): DetailedResult<FsItem, FsItemResultDetail> {\n const baseName: string = item.type === 'file' ? item.baseName : item.name;\n\n return FsItem.tryParseBaseName(baseName, qualifiers)\n .withErrorFormat((msg) => `${baseName}: error extracting conditions - ${msg}`)\n .onSuccess(({ baseName: newBaseName, conditions }) => {\n return captureResult(() => new FsItem({ baseName: newBaseName, conditions, item }, qualifiers));\n })\n .withDetail('failed', 'succeeded');\n }\n\n /**\n * Creates a new {@link Import.FsItem | FsItem} from a file system path.\n * @param importPath - The path to the file system item to import.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @param fs - An optional {@link Import.IImporterFilesystem | file system implementation} to use for this item.\n * @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created\n * successfully, or a `Failure` containing an error message if it is not. Note that the result detail\n * `skipped` indicates that the item was not created because it is not relevant - this is a soft error\n * that should be silently ignored.\n */\n public static createForPath(\n importPath: string,\n qualifiers: IReadOnlyQualifierCollector,\n tree?: FileTree.FileTree\n ): DetailedResult<FsItem, FsItemResultDetail> {\n if (tree === undefined) {\n const treeResult = FileTree.forFilesystem();\n /* c8 ignore next 3 - defense in depth should never happen */\n if (treeResult.isFailure()) {\n return failWithDetail(treeResult.message, 'failed');\n }\n tree = treeResult.value;\n }\n\n return tree\n .getItem(importPath)\n .withDetail<FsItemResultDetail>('failed')\n .onSuccess((item) => FsItem.createForItem(item, qualifiers));\n }\n\n /**\n * Tries to parse a base name into a base name and a set of conditions.\n * @param baseName - The base name to parse.\n * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse\n * embedded condition set tokens.\n * @returns `Success` containing the parsed base name and conditions on success, or `Failure` containing\n * an error message if it is not.\n */\n public static tryParseBaseName(\n baseName: string,\n qualifiers: IReadOnlyQualifierCollector\n ): Result<Omit<IFsItemProps, 'item'>> {\n const nameParts = baseName.split('.');\n const segmentToTest = nameParts.length > 1 ? nameParts[nameParts.length - 1] : nameParts[0];\n const validatedConditions = CommonHelpers.parseConditionSetTokenParts(segmentToTest).onSuccess(\n (parts) => {\n return mapResults(\n parts.map((part) => Conditions.ConditionTokens.validateConditionTokenParts(part, qualifiers))\n ).onFailure((msg) => {\n if (parts.length === 1 && parts[0].qualifier === undefined) {\n return succeed([]);\n }\n return fail(msg);\n });\n }\n );\n if (validatedConditions.isFailure()) {\n return fail(validatedConditions.message);\n }\n const conditions = validatedConditions.value;\n if (conditions.length > 0) {\n baseName = nameParts.filter((s) => s !== segmentToTest).join('.');\n }\n return succeed({ baseName, conditions });\n }\n\n /**\n * Gets the context for this file system item.\n * @returns `Success` containing the {@link Import.ImportContext | import context} for this item\n * if successful, or a `Failure` containing an error message if an error occurs.\n */\n public getContext(): Result<ImportContext> {\n return Validate.toOptionalResourceId(this.baseName).onSuccess((baseId) => {\n const conditions = this.conditions.map((c) => {\n return {\n qualifierName: c.qualifier.name,\n value: c.value,\n operator: c.operator,\n priority: c.priority\n };\n });\n return ImportContext.create({ baseId, conditions });\n });\n }\n}\n"]}
@@ -0,0 +1,85 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { IConditionDecl } from '../conditions';
3
+ import { ResourceId } from '../common';
4
+ /**
5
+ * Accumulated context of a resource import operation.
6
+ * @public
7
+ */
8
+ export interface IImportContext {
9
+ /**
10
+ * Base ID for the import context for resources imported
11
+ * in this context.
12
+ */
13
+ readonly baseId?: string;
14
+ /**
15
+ * Conditions to be applied to resources imported in this context.
16
+ */
17
+ readonly conditions?: ReadonlyArray<IConditionDecl>;
18
+ }
19
+ /**
20
+ * Accumulated context of a resource import operation.
21
+ * @public
22
+ */
23
+ export interface IValidatedImportContext {
24
+ /**
25
+ * Base ID for the import context for resources imported
26
+ * in this context.
27
+ */
28
+ readonly baseId?: ResourceId;
29
+ /**
30
+ * Conditions to be applied to resources imported in this context.
31
+ */
32
+ readonly conditions: ReadonlyArray<IConditionDecl>;
33
+ }
34
+ /**
35
+ * Class to accumulate context for a resource import operation.
36
+ * @public
37
+ */
38
+ export declare class ImportContext implements IValidatedImportContext {
39
+ /**
40
+ * {@inheritdoc Import.IImportContext.baseId}
41
+ */
42
+ readonly baseId: ResourceId | undefined;
43
+ /**
44
+ * {@inheritdoc Import.IImportContext.conditions}
45
+ */
46
+ readonly conditions: ReadonlyArray<IConditionDecl>;
47
+ /**
48
+ * Protected {@link Import.ImportContext | import context} for derived classes.
49
+ * Public consumers use {@link Import.ImportContext.create | create} to create new instances.
50
+ * @param baseId - The base ID for the import context.
51
+ * @param conditions - Conditions to be applied to resources imported in this context.
52
+ */
53
+ protected constructor({ baseId, conditions }: IImportContext);
54
+ /**
55
+ * Factory method to create a new {@link Import.ImportContext | import context}.
56
+ * @param context - The {@link Import.IImportContext | import context} to create
57
+ * the new context from.
58
+ * @returns `Success` with the new {@link Import.ImportContext | import context}
59
+ * if successful, or `Failure` with an error message if creation fails.
60
+ */
61
+ static create(context?: IImportContext): Result<ImportContext>;
62
+ /**
63
+ * Adds conditions to the import context.
64
+ * @param conditions - Conditions to be added to the import context.
65
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the added conditions
66
+ * if successful, or `Failure` with an error message if the operation fails.
67
+ */
68
+ withConditions(conditions: IConditionDecl[]): Result<ImportContext>;
69
+ /**
70
+ * Appends names to the base ID of the import context.
71
+ * @param name - The base name to set.
72
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID
73
+ * if successful, or `Failure` with an error message if the operation fails.
74
+ */
75
+ withName(...names: string[]): Result<ImportContext>;
76
+ /**
77
+ * Extends the import context with additional name segments and conditions.
78
+ * @param context - The {@link Import.IImportContext | import context} to extend this context with.
79
+ * @returns `Success` with a new {@link Import.ImportContext | import context}
80
+ * containing the extended context if successful, or `Failure` with an error
81
+ * message if the operation fails.
82
+ */
83
+ extend(context?: IValidatedImportContext): Result<ImportContext>;
84
+ }
85
+ //# sourceMappingURL=importContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importContext.d.ts","sourceRoot":"","sources":["../../../src/packlets/import/importContext.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACpD;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,uBAAuB;IAC3D;;OAEG;IACH,SAAgB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAE/C;;OAEG;IACH,SAAgB,UAAU,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,SAAS,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,cAAc;IAK5D;;;;;;OAMG;WACW,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC;IAMrE;;;;;OAKG;IACI,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC;IAO1E;;;;;OAKG;IACI,QAAQ,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC;IAM1D;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAAC,aAAa,CAAC;CAQxE"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.ImportContext = void 0;
25
+ const common_1 = require("../common");
26
+ const ts_utils_1 = require("@fgv/ts-utils");
27
+ /**
28
+ * Class to accumulate context for a resource import operation.
29
+ * @public
30
+ */
31
+ class ImportContext {
32
+ /**
33
+ * Protected {@link Import.ImportContext | import context} for derived classes.
34
+ * Public consumers use {@link Import.ImportContext.create | create} to create new instances.
35
+ * @param baseId - The base ID for the import context.
36
+ * @param conditions - Conditions to be applied to resources imported in this context.
37
+ */
38
+ constructor({ baseId, conditions }) {
39
+ this.baseId = common_1.Helpers.joinOptionalResourceIds(baseId).orThrow();
40
+ this.conditions = Array.from(conditions !== null && conditions !== void 0 ? conditions : []);
41
+ }
42
+ /**
43
+ * Factory method to create a new {@link Import.ImportContext | import context}.
44
+ * @param context - The {@link Import.IImportContext | import context} to create
45
+ * the new context from.
46
+ * @returns `Success` with the new {@link Import.ImportContext | import context}
47
+ * if successful, or `Failure` with an error message if creation fails.
48
+ */
49
+ static create(context) {
50
+ /* c8 ignore next */
51
+ context = context !== null && context !== void 0 ? context : { conditions: [] };
52
+ return (0, ts_utils_1.captureResult)(() => new ImportContext(context));
53
+ }
54
+ /**
55
+ * Adds conditions to the import context.
56
+ * @param conditions - Conditions to be added to the import context.
57
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the added conditions
58
+ * if successful, or `Failure` with an error message if the operation fails.
59
+ */
60
+ withConditions(conditions) {
61
+ return ImportContext.create({
62
+ baseId: this.baseId,
63
+ conditions: [...this.conditions, ...conditions]
64
+ });
65
+ }
66
+ /**
67
+ * Appends names to the base ID of the import context.
68
+ * @param name - The base name to set.
69
+ * @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID
70
+ * if successful, or `Failure` with an error message if the operation fails.
71
+ */
72
+ withName(...names) {
73
+ return common_1.Helpers.joinResourceIds(this.baseId, ...names).onSuccess((baseId) => {
74
+ return ImportContext.create({ baseId, conditions: this.conditions });
75
+ });
76
+ }
77
+ /**
78
+ * Extends the import context with additional name segments and conditions.
79
+ * @param context - The {@link Import.IImportContext | import context} to extend this context with.
80
+ * @returns `Success` with a new {@link Import.ImportContext | import context}
81
+ * containing the extended context if successful, or `Failure` with an error
82
+ * message if the operation fails.
83
+ */
84
+ extend(context) {
85
+ /* c8 ignore next 1 */
86
+ context = context !== null && context !== void 0 ? context : { conditions: [] };
87
+ const conditions = [...this.conditions, ...context.conditions];
88
+ return common_1.Helpers.joinOptionalResourceIds(this.baseId, context.baseId).onSuccess((baseId) => {
89
+ return ImportContext.create({ baseId, conditions });
90
+ });
91
+ }
92
+ }
93
+ exports.ImportContext = ImportContext;
94
+ //# sourceMappingURL=importContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importContext.js","sourceRoot":"","sources":["../../../src/packlets/import/importContext.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,sCAAoC;AACpC,4CAAsD;AAoCtD;;;GAGG;AACH,MAAa,aAAa;IAWxB;;;;;OAKG;IACH,YAAsB,EAAE,MAAM,EAAE,UAAU,EAAkB;QAC1D,IAAI,CAAC,MAAM,GAAG,gBAAO,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAChE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAAwB;QAC3C,oBAAoB;QACpB,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QACxC,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,UAA4B;QAChD,OAAO,aAAa,CAAC,MAAM,CAAC;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,GAAG,KAAe;QAChC,OAAO,gBAAO,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACzE,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAAiC;QAC7C,sBAAsB;QACtB,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QACxC,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,gBAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACvF,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA3ED,sCA2EC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Helpers } from '../common';\nimport { captureResult, Result } from '@fgv/ts-utils';\nimport { IConditionDecl } from '../conditions';\nimport { ResourceId } from '../common';\n\n/**\n * Accumulated context of a resource import operation.\n * @public\n */\nexport interface IImportContext {\n /**\n * Base ID for the import context for resources imported\n * in this context.\n */\n readonly baseId?: string;\n /**\n * Conditions to be applied to resources imported in this context.\n */\n readonly conditions?: ReadonlyArray<IConditionDecl>;\n}\n\n/**\n * Accumulated context of a resource import operation.\n * @public\n */\nexport interface IValidatedImportContext {\n /**\n * Base ID for the import context for resources imported\n * in this context.\n */\n readonly baseId?: ResourceId;\n /**\n * Conditions to be applied to resources imported in this context.\n */\n readonly conditions: ReadonlyArray<IConditionDecl>;\n}\n\n/**\n * Class to accumulate context for a resource import operation.\n * @public\n */\nexport class ImportContext implements IValidatedImportContext {\n /**\n * {@inheritdoc Import.IImportContext.baseId}\n */\n public readonly baseId: ResourceId | undefined;\n\n /**\n * {@inheritdoc Import.IImportContext.conditions}\n */\n public readonly conditions: ReadonlyArray<IConditionDecl>;\n\n /**\n * Protected {@link Import.ImportContext | import context} for derived classes.\n * Public consumers use {@link Import.ImportContext.create | create} to create new instances.\n * @param baseId - The base ID for the import context.\n * @param conditions - Conditions to be applied to resources imported in this context.\n */\n protected constructor({ baseId, conditions }: IImportContext) {\n this.baseId = Helpers.joinOptionalResourceIds(baseId).orThrow();\n this.conditions = Array.from(conditions ?? []);\n }\n\n /**\n * Factory method to create a new {@link Import.ImportContext | import context}.\n * @param context - The {@link Import.IImportContext | import context} to create\n * the new context from.\n * @returns `Success` with the new {@link Import.ImportContext | import context}\n * if successful, or `Failure` with an error message if creation fails.\n */\n public static create(context?: IImportContext): Result<ImportContext> {\n /* c8 ignore next */\n context = context ?? { conditions: [] };\n return captureResult(() => new ImportContext(context));\n }\n\n /**\n * Adds conditions to the import context.\n * @param conditions - Conditions to be added to the import context.\n * @returns `Success` with a new {@link Import.ImportContext | import context} containing the added conditions\n * if successful, or `Failure` with an error message if the operation fails.\n */\n public withConditions(conditions: IConditionDecl[]): Result<ImportContext> {\n return ImportContext.create({\n baseId: this.baseId,\n conditions: [...this.conditions, ...conditions]\n });\n }\n\n /**\n * Appends names to the base ID of the import context.\n * @param name - The base name to set.\n * @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID\n * if successful, or `Failure` with an error message if the operation fails.\n */\n public withName(...names: string[]): Result<ImportContext> {\n return Helpers.joinResourceIds(this.baseId, ...names).onSuccess((baseId) => {\n return ImportContext.create({ baseId, conditions: this.conditions });\n });\n }\n\n /**\n * Extends the import context with additional name segments and conditions.\n * @param context - The {@link Import.IImportContext | import context} to extend this context with.\n * @returns `Success` with a new {@link Import.ImportContext | import context}\n * containing the extended context if successful, or `Failure` with an error\n * message if the operation fails.\n */\n public extend(context?: IValidatedImportContext): Result<ImportContext> {\n /* c8 ignore next 1 */\n context = context ?? { conditions: [] };\n const conditions = [...this.conditions, ...context.conditions];\n return Helpers.joinOptionalResourceIds(this.baseId, context.baseId).onSuccess((baseId) => {\n return ImportContext.create({ baseId, conditions });\n });\n }\n}\n"]}