@hyperfrontend/versioning 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/ARCHITECTURE.md +593 -0
  2. package/CHANGELOG.md +35 -0
  3. package/FUNDING.md +141 -0
  4. package/LICENSE.md +21 -0
  5. package/README.md +195 -0
  6. package/SECURITY.md +82 -0
  7. package/changelog/compare/diff.d.ts +128 -0
  8. package/changelog/compare/diff.d.ts.map +1 -0
  9. package/changelog/compare/index.cjs.js +628 -0
  10. package/changelog/compare/index.cjs.js.map +1 -0
  11. package/changelog/compare/index.d.ts +4 -0
  12. package/changelog/compare/index.d.ts.map +1 -0
  13. package/changelog/compare/index.esm.js +612 -0
  14. package/changelog/compare/index.esm.js.map +1 -0
  15. package/changelog/compare/is-equal.d.ts +114 -0
  16. package/changelog/compare/is-equal.d.ts.map +1 -0
  17. package/changelog/index.cjs.js +6448 -0
  18. package/changelog/index.cjs.js.map +1 -0
  19. package/changelog/index.d.ts +6 -0
  20. package/changelog/index.d.ts.map +1 -0
  21. package/changelog/index.esm.js +6358 -0
  22. package/changelog/index.esm.js.map +1 -0
  23. package/changelog/models/changelog.d.ts +86 -0
  24. package/changelog/models/changelog.d.ts.map +1 -0
  25. package/changelog/models/commit-ref.d.ts +51 -0
  26. package/changelog/models/commit-ref.d.ts.map +1 -0
  27. package/changelog/models/entry.d.ts +84 -0
  28. package/changelog/models/entry.d.ts.map +1 -0
  29. package/changelog/models/index.cjs.js +2043 -0
  30. package/changelog/models/index.cjs.js.map +1 -0
  31. package/changelog/models/index.d.ts +11 -0
  32. package/changelog/models/index.d.ts.map +1 -0
  33. package/changelog/models/index.esm.js +2026 -0
  34. package/changelog/models/index.esm.js.map +1 -0
  35. package/changelog/models/schema.d.ts +68 -0
  36. package/changelog/models/schema.d.ts.map +1 -0
  37. package/changelog/models/section.d.ts +25 -0
  38. package/changelog/models/section.d.ts.map +1 -0
  39. package/changelog/operations/add-entry.d.ts +56 -0
  40. package/changelog/operations/add-entry.d.ts.map +1 -0
  41. package/changelog/operations/add-item.d.ts +18 -0
  42. package/changelog/operations/add-item.d.ts.map +1 -0
  43. package/changelog/operations/filter-by-predicate.d.ts +81 -0
  44. package/changelog/operations/filter-by-predicate.d.ts.map +1 -0
  45. package/changelog/operations/filter-by-range.d.ts +63 -0
  46. package/changelog/operations/filter-by-range.d.ts.map +1 -0
  47. package/changelog/operations/filter-entries.d.ts +9 -0
  48. package/changelog/operations/filter-entries.d.ts.map +1 -0
  49. package/changelog/operations/index.cjs.js +2455 -0
  50. package/changelog/operations/index.cjs.js.map +1 -0
  51. package/changelog/operations/index.d.ts +15 -0
  52. package/changelog/operations/index.d.ts.map +1 -0
  53. package/changelog/operations/index.esm.js +2411 -0
  54. package/changelog/operations/index.esm.js.map +1 -0
  55. package/changelog/operations/merge.d.ts +88 -0
  56. package/changelog/operations/merge.d.ts.map +1 -0
  57. package/changelog/operations/remove-entry.d.ts +45 -0
  58. package/changelog/operations/remove-entry.d.ts.map +1 -0
  59. package/changelog/operations/remove-section.d.ts +50 -0
  60. package/changelog/operations/remove-section.d.ts.map +1 -0
  61. package/changelog/operations/transform.d.ts +143 -0
  62. package/changelog/operations/transform.d.ts.map +1 -0
  63. package/changelog/parse/index.cjs.js +1282 -0
  64. package/changelog/parse/index.cjs.js.map +1 -0
  65. package/changelog/parse/index.d.ts +5 -0
  66. package/changelog/parse/index.d.ts.map +1 -0
  67. package/changelog/parse/index.esm.js +1275 -0
  68. package/changelog/parse/index.esm.js.map +1 -0
  69. package/changelog/parse/line.d.ts +48 -0
  70. package/changelog/parse/line.d.ts.map +1 -0
  71. package/changelog/parse/parser.d.ts +16 -0
  72. package/changelog/parse/parser.d.ts.map +1 -0
  73. package/changelog/parse/tokenizer.d.ts +49 -0
  74. package/changelog/parse/tokenizer.d.ts.map +1 -0
  75. package/changelog/serialize/index.cjs.js +574 -0
  76. package/changelog/serialize/index.cjs.js.map +1 -0
  77. package/changelog/serialize/index.d.ts +6 -0
  78. package/changelog/serialize/index.d.ts.map +1 -0
  79. package/changelog/serialize/index.esm.js +564 -0
  80. package/changelog/serialize/index.esm.js.map +1 -0
  81. package/changelog/serialize/templates.d.ts +81 -0
  82. package/changelog/serialize/templates.d.ts.map +1 -0
  83. package/changelog/serialize/to-json.d.ts +57 -0
  84. package/changelog/serialize/to-json.d.ts.map +1 -0
  85. package/changelog/serialize/to-string.d.ts +30 -0
  86. package/changelog/serialize/to-string.d.ts.map +1 -0
  87. package/commits/index.cjs.js +648 -0
  88. package/commits/index.cjs.js.map +1 -0
  89. package/commits/index.d.ts +3 -0
  90. package/commits/index.d.ts.map +1 -0
  91. package/commits/index.esm.js +629 -0
  92. package/commits/index.esm.js.map +1 -0
  93. package/commits/models/breaking.d.ts +39 -0
  94. package/commits/models/breaking.d.ts.map +1 -0
  95. package/commits/models/commit-type.d.ts +32 -0
  96. package/commits/models/commit-type.d.ts.map +1 -0
  97. package/commits/models/conventional.d.ts +49 -0
  98. package/commits/models/conventional.d.ts.map +1 -0
  99. package/commits/models/index.cjs.js +207 -0
  100. package/commits/models/index.cjs.js.map +1 -0
  101. package/commits/models/index.d.ts +7 -0
  102. package/commits/models/index.d.ts.map +1 -0
  103. package/commits/models/index.esm.js +193 -0
  104. package/commits/models/index.esm.js.map +1 -0
  105. package/commits/parse/body.d.ts +18 -0
  106. package/commits/parse/body.d.ts.map +1 -0
  107. package/commits/parse/footer.d.ts +16 -0
  108. package/commits/parse/footer.d.ts.map +1 -0
  109. package/commits/parse/header.d.ts +15 -0
  110. package/commits/parse/header.d.ts.map +1 -0
  111. package/commits/parse/index.cjs.js +505 -0
  112. package/commits/parse/index.cjs.js.map +1 -0
  113. package/commits/parse/index.d.ts +5 -0
  114. package/commits/parse/index.d.ts.map +1 -0
  115. package/commits/parse/index.esm.js +499 -0
  116. package/commits/parse/index.esm.js.map +1 -0
  117. package/commits/parse/message.d.ts +17 -0
  118. package/commits/parse/message.d.ts.map +1 -0
  119. package/commits/utils/replace-char.d.ts +19 -0
  120. package/commits/utils/replace-char.d.ts.map +1 -0
  121. package/flow/executor/execute.d.ts +72 -0
  122. package/flow/executor/execute.d.ts.map +1 -0
  123. package/flow/executor/index.cjs.js +4402 -0
  124. package/flow/executor/index.cjs.js.map +1 -0
  125. package/flow/executor/index.d.ts +3 -0
  126. package/flow/executor/index.d.ts.map +1 -0
  127. package/flow/executor/index.esm.js +4398 -0
  128. package/flow/executor/index.esm.js.map +1 -0
  129. package/flow/factory.d.ts +58 -0
  130. package/flow/factory.d.ts.map +1 -0
  131. package/flow/index.cjs.js +8506 -0
  132. package/flow/index.cjs.js.map +1 -0
  133. package/flow/index.d.ts +7 -0
  134. package/flow/index.d.ts.map +1 -0
  135. package/flow/index.esm.js +8451 -0
  136. package/flow/index.esm.js.map +1 -0
  137. package/flow/models/flow.d.ts +130 -0
  138. package/flow/models/flow.d.ts.map +1 -0
  139. package/flow/models/index.cjs.js +285 -0
  140. package/flow/models/index.cjs.js.map +1 -0
  141. package/flow/models/index.d.ts +7 -0
  142. package/flow/models/index.d.ts.map +1 -0
  143. package/flow/models/index.esm.js +268 -0
  144. package/flow/models/index.esm.js.map +1 -0
  145. package/flow/models/step.d.ts +108 -0
  146. package/flow/models/step.d.ts.map +1 -0
  147. package/flow/models/types.d.ts +150 -0
  148. package/flow/models/types.d.ts.map +1 -0
  149. package/flow/presets/conventional.d.ts +59 -0
  150. package/flow/presets/conventional.d.ts.map +1 -0
  151. package/flow/presets/independent.d.ts +61 -0
  152. package/flow/presets/independent.d.ts.map +1 -0
  153. package/flow/presets/index.cjs.js +3903 -0
  154. package/flow/presets/index.cjs.js.map +1 -0
  155. package/flow/presets/index.d.ts +4 -0
  156. package/flow/presets/index.d.ts.map +1 -0
  157. package/flow/presets/index.esm.js +3889 -0
  158. package/flow/presets/index.esm.js.map +1 -0
  159. package/flow/presets/synced.d.ts +65 -0
  160. package/flow/presets/synced.d.ts.map +1 -0
  161. package/flow/steps/analyze-commits.d.ts +19 -0
  162. package/flow/steps/analyze-commits.d.ts.map +1 -0
  163. package/flow/steps/calculate-bump.d.ts +27 -0
  164. package/flow/steps/calculate-bump.d.ts.map +1 -0
  165. package/flow/steps/create-commit.d.ts +16 -0
  166. package/flow/steps/create-commit.d.ts.map +1 -0
  167. package/flow/steps/create-tag.d.ts +22 -0
  168. package/flow/steps/create-tag.d.ts.map +1 -0
  169. package/flow/steps/fetch-registry.d.ts +19 -0
  170. package/flow/steps/fetch-registry.d.ts.map +1 -0
  171. package/flow/steps/generate-changelog.d.ts +25 -0
  172. package/flow/steps/generate-changelog.d.ts.map +1 -0
  173. package/flow/steps/index.cjs.js +3523 -0
  174. package/flow/steps/index.cjs.js.map +1 -0
  175. package/flow/steps/index.d.ts +8 -0
  176. package/flow/steps/index.d.ts.map +1 -0
  177. package/flow/steps/index.esm.js +3504 -0
  178. package/flow/steps/index.esm.js.map +1 -0
  179. package/flow/steps/update-packages.d.ts +25 -0
  180. package/flow/steps/update-packages.d.ts.map +1 -0
  181. package/flow/utils/interpolate.d.ts +11 -0
  182. package/flow/utils/interpolate.d.ts.map +1 -0
  183. package/git/factory.d.ts +233 -0
  184. package/git/factory.d.ts.map +1 -0
  185. package/git/index.cjs.js +2863 -0
  186. package/git/index.cjs.js.map +1 -0
  187. package/git/index.d.ts +5 -0
  188. package/git/index.d.ts.map +1 -0
  189. package/git/index.esm.js +2785 -0
  190. package/git/index.esm.js.map +1 -0
  191. package/git/models/commit.d.ts +129 -0
  192. package/git/models/commit.d.ts.map +1 -0
  193. package/git/models/index.cjs.js +755 -0
  194. package/git/models/index.cjs.js.map +1 -0
  195. package/git/models/index.d.ts +7 -0
  196. package/git/models/index.d.ts.map +1 -0
  197. package/git/models/index.esm.js +729 -0
  198. package/git/models/index.esm.js.map +1 -0
  199. package/git/models/ref.d.ts +120 -0
  200. package/git/models/ref.d.ts.map +1 -0
  201. package/git/models/tag.d.ts +141 -0
  202. package/git/models/tag.d.ts.map +1 -0
  203. package/git/operations/commit.d.ts +97 -0
  204. package/git/operations/commit.d.ts.map +1 -0
  205. package/git/operations/head-info.d.ts +29 -0
  206. package/git/operations/head-info.d.ts.map +1 -0
  207. package/git/operations/index.cjs.js +1954 -0
  208. package/git/operations/index.cjs.js.map +1 -0
  209. package/git/operations/index.d.ts +14 -0
  210. package/git/operations/index.d.ts.map +1 -0
  211. package/git/operations/index.esm.js +1903 -0
  212. package/git/operations/index.esm.js.map +1 -0
  213. package/git/operations/log.d.ts +104 -0
  214. package/git/operations/log.d.ts.map +1 -0
  215. package/git/operations/manage-tags.d.ts +60 -0
  216. package/git/operations/manage-tags.d.ts.map +1 -0
  217. package/git/operations/query-tags.d.ts +88 -0
  218. package/git/operations/query-tags.d.ts.map +1 -0
  219. package/git/operations/stage.d.ts +66 -0
  220. package/git/operations/stage.d.ts.map +1 -0
  221. package/git/operations/status.d.ts +173 -0
  222. package/git/operations/status.d.ts.map +1 -0
  223. package/index.cjs.js +16761 -0
  224. package/index.cjs.js.map +1 -0
  225. package/index.d.ts +102 -0
  226. package/index.d.ts.map +1 -0
  227. package/index.esm.js +16427 -0
  228. package/index.esm.js.map +1 -0
  229. package/package.json +200 -0
  230. package/registry/factory.d.ts +18 -0
  231. package/registry/factory.d.ts.map +1 -0
  232. package/registry/index.cjs.js +543 -0
  233. package/registry/index.cjs.js.map +1 -0
  234. package/registry/index.d.ts +5 -0
  235. package/registry/index.d.ts.map +1 -0
  236. package/registry/index.esm.js +535 -0
  237. package/registry/index.esm.js.map +1 -0
  238. package/registry/models/index.cjs.js +69 -0
  239. package/registry/models/index.cjs.js.map +1 -0
  240. package/registry/models/index.d.ts +6 -0
  241. package/registry/models/index.d.ts.map +1 -0
  242. package/registry/models/index.esm.js +66 -0
  243. package/registry/models/index.esm.js.map +1 -0
  244. package/registry/models/package-info.d.ts +55 -0
  245. package/registry/models/package-info.d.ts.map +1 -0
  246. package/registry/models/registry.d.ts +62 -0
  247. package/registry/models/registry.d.ts.map +1 -0
  248. package/registry/models/version-info.d.ts +67 -0
  249. package/registry/models/version-info.d.ts.map +1 -0
  250. package/registry/npm/cache.d.ts +50 -0
  251. package/registry/npm/cache.d.ts.map +1 -0
  252. package/registry/npm/client.d.ts +30 -0
  253. package/registry/npm/client.d.ts.map +1 -0
  254. package/registry/npm/index.cjs.js +456 -0
  255. package/registry/npm/index.cjs.js.map +1 -0
  256. package/registry/npm/index.d.ts +4 -0
  257. package/registry/npm/index.d.ts.map +1 -0
  258. package/registry/npm/index.esm.js +451 -0
  259. package/registry/npm/index.esm.js.map +1 -0
  260. package/semver/compare/compare.d.ts +100 -0
  261. package/semver/compare/compare.d.ts.map +1 -0
  262. package/semver/compare/index.cjs.js +386 -0
  263. package/semver/compare/index.cjs.js.map +1 -0
  264. package/semver/compare/index.d.ts +3 -0
  265. package/semver/compare/index.d.ts.map +1 -0
  266. package/semver/compare/index.esm.js +370 -0
  267. package/semver/compare/index.esm.js.map +1 -0
  268. package/semver/compare/sort.d.ts +36 -0
  269. package/semver/compare/sort.d.ts.map +1 -0
  270. package/semver/format/index.cjs.js +58 -0
  271. package/semver/format/index.cjs.js.map +1 -0
  272. package/semver/format/index.d.ts +2 -0
  273. package/semver/format/index.d.ts.map +1 -0
  274. package/semver/format/index.esm.js +53 -0
  275. package/semver/format/index.esm.js.map +1 -0
  276. package/semver/format/to-string.d.ts +31 -0
  277. package/semver/format/to-string.d.ts.map +1 -0
  278. package/semver/increment/bump.d.ts +37 -0
  279. package/semver/increment/bump.d.ts.map +1 -0
  280. package/semver/increment/index.cjs.js +223 -0
  281. package/semver/increment/index.cjs.js.map +1 -0
  282. package/semver/increment/index.d.ts +2 -0
  283. package/semver/increment/index.d.ts.map +1 -0
  284. package/semver/increment/index.esm.js +219 -0
  285. package/semver/increment/index.esm.js.map +1 -0
  286. package/semver/index.cjs.js +1499 -0
  287. package/semver/index.cjs.js.map +1 -0
  288. package/semver/index.d.ts +6 -0
  289. package/semver/index.d.ts.map +1 -0
  290. package/semver/index.esm.js +1458 -0
  291. package/semver/index.esm.js.map +1 -0
  292. package/semver/models/index.cjs.js +153 -0
  293. package/semver/models/index.cjs.js.map +1 -0
  294. package/semver/models/index.d.ts +5 -0
  295. package/semver/models/index.d.ts.map +1 -0
  296. package/semver/models/index.esm.js +139 -0
  297. package/semver/models/index.esm.js.map +1 -0
  298. package/semver/models/range.d.ts +83 -0
  299. package/semver/models/range.d.ts.map +1 -0
  300. package/semver/models/version.d.ts +78 -0
  301. package/semver/models/version.d.ts.map +1 -0
  302. package/semver/parse/index.cjs.js +799 -0
  303. package/semver/parse/index.cjs.js.map +1 -0
  304. package/semver/parse/index.d.ts +5 -0
  305. package/semver/parse/index.d.ts.map +1 -0
  306. package/semver/parse/index.esm.js +793 -0
  307. package/semver/parse/index.esm.js.map +1 -0
  308. package/semver/parse/range.d.ts +38 -0
  309. package/semver/parse/range.d.ts.map +1 -0
  310. package/semver/parse/version.d.ts +49 -0
  311. package/semver/parse/version.d.ts.map +1 -0
  312. package/workspace/discovery/changelog-path.d.ts +21 -0
  313. package/workspace/discovery/changelog-path.d.ts.map +1 -0
  314. package/workspace/discovery/dependencies.d.ts +145 -0
  315. package/workspace/discovery/dependencies.d.ts.map +1 -0
  316. package/workspace/discovery/discover-changelogs.d.ts +76 -0
  317. package/workspace/discovery/discover-changelogs.d.ts.map +1 -0
  318. package/workspace/discovery/index.cjs.js +2300 -0
  319. package/workspace/discovery/index.cjs.js.map +1 -0
  320. package/workspace/discovery/index.d.ts +13 -0
  321. package/workspace/discovery/index.d.ts.map +1 -0
  322. package/workspace/discovery/index.esm.js +2283 -0
  323. package/workspace/discovery/index.esm.js.map +1 -0
  324. package/workspace/discovery/packages.d.ts +83 -0
  325. package/workspace/discovery/packages.d.ts.map +1 -0
  326. package/workspace/index.cjs.js +4445 -0
  327. package/workspace/index.cjs.js.map +1 -0
  328. package/workspace/index.d.ts +52 -0
  329. package/workspace/index.d.ts.map +1 -0
  330. package/workspace/index.esm.js +4394 -0
  331. package/workspace/index.esm.js.map +1 -0
  332. package/workspace/models/index.cjs.js +284 -0
  333. package/workspace/models/index.cjs.js.map +1 -0
  334. package/workspace/models/index.d.ts +10 -0
  335. package/workspace/models/index.d.ts.map +1 -0
  336. package/workspace/models/index.esm.js +261 -0
  337. package/workspace/models/index.esm.js.map +1 -0
  338. package/workspace/models/project.d.ts +118 -0
  339. package/workspace/models/project.d.ts.map +1 -0
  340. package/workspace/models/workspace.d.ts +139 -0
  341. package/workspace/models/workspace.d.ts.map +1 -0
  342. package/workspace/operations/batch-update.d.ts +99 -0
  343. package/workspace/operations/batch-update.d.ts.map +1 -0
  344. package/workspace/operations/cascade-bump.d.ts +125 -0
  345. package/workspace/operations/cascade-bump.d.ts.map +1 -0
  346. package/workspace/operations/index.cjs.js +2675 -0
  347. package/workspace/operations/index.cjs.js.map +1 -0
  348. package/workspace/operations/index.d.ts +12 -0
  349. package/workspace/operations/index.d.ts.map +1 -0
  350. package/workspace/operations/index.esm.js +2663 -0
  351. package/workspace/operations/index.esm.js.map +1 -0
  352. package/workspace/operations/validate.d.ts +85 -0
  353. package/workspace/operations/validate.d.ts.map +1 -0
@@ -0,0 +1,285 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Default flow configuration values.
5
+ */
6
+ const DEFAULT_FLOW_CONFIG = {
7
+ preset: 'conventional',
8
+ releaseTypes: ['feat', 'fix', 'perf', 'revert'],
9
+ minorTypes: ['feat'],
10
+ patchTypes: ['fix', 'perf', 'revert'],
11
+ skipGit: false,
12
+ skipTag: false,
13
+ skipChangelog: false,
14
+ dryRun: false,
15
+ commitMessage: 'chore(${projectName}): release version ${version}',
16
+ tagFormat: '${projectName}@${version}',
17
+ trackDeps: false,
18
+ releaseBranch: 'main',
19
+ firstReleaseVersion: '0.1.0',
20
+ allowPrerelease: false,
21
+ prereleaseId: 'alpha',
22
+ releaseAs: undefined,
23
+ };
24
+
25
+ /**
26
+ * Creates a flow step.
27
+ *
28
+ * @param id - Unique step identifier
29
+ * @param name - Human-readable step name
30
+ * @param execute - Step executor function
31
+ * @param options - Optional step configuration
32
+ * @returns A FlowStep object
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const fetchStep = createStep(
37
+ * 'fetch-registry',
38
+ * 'Fetch Registry Version',
39
+ * async (ctx) => {
40
+ * const version = await ctx.registry.getLatestVersion(ctx.packageName)
41
+ * return {
42
+ * status: 'success',
43
+ * stateUpdates: { publishedVersion: version },
44
+ * message: `Found published version: ${version}`
45
+ * }
46
+ * }
47
+ * )
48
+ * ```
49
+ */
50
+ function createStep(id, name, execute, options = {}) {
51
+ return {
52
+ id,
53
+ name,
54
+ execute,
55
+ description: options.description,
56
+ skipIf: options.skipIf,
57
+ continueOnError: options.continueOnError,
58
+ dependsOn: options.dependsOn,
59
+ };
60
+ }
61
+ /**
62
+ * Creates a step that succeeds immediately.
63
+ * Useful for placeholder or conditional steps.
64
+ *
65
+ * @param id - Unique identifier within the flow
66
+ * @param name - Display label shown during execution
67
+ * @param message - Success message
68
+ * @returns A FlowStep that always succeeds
69
+ */
70
+ function createNoopStep(id, name, message = 'Step completed (no-op)') {
71
+ return createStep(id, name, async () => ({
72
+ status: 'success',
73
+ message,
74
+ }));
75
+ }
76
+ /**
77
+ * Creates a skipped step result.
78
+ *
79
+ * @param message - Explanation for why the step was skipped
80
+ * @returns A FlowStepResult with 'skipped' status
81
+ */
82
+ function createSkippedResult(message) {
83
+ return {
84
+ status: 'skipped',
85
+ message,
86
+ };
87
+ }
88
+ /**
89
+ * Creates a success step result.
90
+ *
91
+ * @param message - Output text describing what the step accomplished
92
+ * @param stateUpdates - Optional state updates to apply after step completion
93
+ * @returns A FlowStepResult with 'success' status
94
+ */
95
+ function createSuccessResult(message, stateUpdates) {
96
+ return {
97
+ status: 'success',
98
+ message,
99
+ stateUpdates,
100
+ };
101
+ }
102
+ /**
103
+ * Creates a failed step result.
104
+ *
105
+ * @param error - Error that caused the failure
106
+ * @param message - Optional message (defaults to error.message)
107
+ * @returns A FlowStepResult with 'failed' status
108
+ */
109
+ function createFailedResult(error, message) {
110
+ return {
111
+ status: 'failed',
112
+ error,
113
+ message: message ?? error.message,
114
+ };
115
+ }
116
+
117
+ /**
118
+ * Creates a version flow.
119
+ *
120
+ * @param id - Flow identifier
121
+ * @param name - Human-readable flow name
122
+ * @param steps - Ordered steps to execute
123
+ * @param options - Optional flow configuration
124
+ * @returns A VersionFlow object
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const myFlow = createFlow(
129
+ * 'custom',
130
+ * 'Custom Release Flow',
131
+ * [fetchStep, analyzeStep, bumpStep],
132
+ * { description: 'My custom versioning workflow' }
133
+ * )
134
+ * ```
135
+ */
136
+ function createFlow(id, name, steps, options = {}) {
137
+ return {
138
+ id,
139
+ name,
140
+ steps,
141
+ description: options.description,
142
+ config: options.config ?? {},
143
+ };
144
+ }
145
+ /**
146
+ * Adds a step to a flow.
147
+ * Returns a new flow with the step appended.
148
+ *
149
+ * @param flow - The flow to extend
150
+ * @param step - The step to add
151
+ * @returns A new VersionFlow with the step added
152
+ */
153
+ function addStep(flow, step) {
154
+ return {
155
+ ...flow,
156
+ steps: [...flow.steps, step],
157
+ };
158
+ }
159
+ /**
160
+ * Removes a step from a flow by ID.
161
+ * Returns a new flow without the specified step.
162
+ *
163
+ * @param flow - The flow to modify
164
+ * @param stepId - The ID of the step to remove
165
+ * @returns A new VersionFlow without the step
166
+ */
167
+ function removeStep(flow, stepId) {
168
+ return {
169
+ ...flow,
170
+ steps: flow.steps.filter((s) => s.id !== stepId),
171
+ };
172
+ }
173
+ /**
174
+ * Inserts a step at a specific position.
175
+ *
176
+ * @param flow - The flow to modify
177
+ * @param step - The step to insert
178
+ * @param index - Position to insert at (0-based)
179
+ * @returns A new VersionFlow with the step inserted
180
+ */
181
+ function insertStep(flow, step, index) {
182
+ const steps = [...flow.steps];
183
+ steps.splice(index, 0, step);
184
+ return {
185
+ ...flow,
186
+ steps,
187
+ };
188
+ }
189
+ /**
190
+ * Inserts a step after another step.
191
+ *
192
+ * @param flow - The flow to modify
193
+ * @param step - The step to insert
194
+ * @param afterStepId - ID of the step to insert after
195
+ * @returns A new VersionFlow with the step inserted
196
+ */
197
+ function insertStepAfter(flow, step, afterStepId) {
198
+ const index = flow.steps.findIndex((s) => s.id === afterStepId);
199
+ if (index === -1) {
200
+ // If not found, append to end
201
+ return addStep(flow, step);
202
+ }
203
+ return insertStep(flow, step, index + 1);
204
+ }
205
+ /**
206
+ * Inserts a step before another step.
207
+ *
208
+ * @param flow - The flow to modify
209
+ * @param step - The step to insert
210
+ * @param beforeStepId - ID of the step to insert before
211
+ * @returns A new VersionFlow with the step inserted
212
+ */
213
+ function insertStepBefore(flow, step, beforeStepId) {
214
+ const index = flow.steps.findIndex((s) => s.id === beforeStepId);
215
+ if (index === -1) {
216
+ // If not found, prepend to beginning
217
+ return insertStep(flow, step, 0);
218
+ }
219
+ return insertStep(flow, step, index);
220
+ }
221
+ /**
222
+ * Replaces a step in the flow.
223
+ *
224
+ * @param flow - The flow to modify
225
+ * @param stepId - ID of the step to replace
226
+ * @param newStep - The replacement step
227
+ * @returns A new VersionFlow with the step replaced
228
+ */
229
+ function replaceStep(flow, stepId, newStep) {
230
+ return {
231
+ ...flow,
232
+ steps: flow.steps.map((s) => (s.id === stepId ? newStep : s)),
233
+ };
234
+ }
235
+ /**
236
+ * Updates the flow configuration.
237
+ *
238
+ * @param flow - The flow to configure
239
+ * @param config - Configuration updates to merge
240
+ * @returns A new VersionFlow with updated config
241
+ */
242
+ function withConfig(flow, config) {
243
+ return {
244
+ ...flow,
245
+ config: { ...flow.config, ...config },
246
+ };
247
+ }
248
+ /**
249
+ * Gets a step from a flow by ID.
250
+ *
251
+ * @param flow - The flow to search
252
+ * @param stepId - The step ID to find
253
+ * @returns The step if found, undefined otherwise
254
+ */
255
+ function getStep(flow, stepId) {
256
+ return flow.steps.find((s) => s.id === stepId);
257
+ }
258
+ /**
259
+ * Checks if a flow has a specific step.
260
+ *
261
+ * @param flow - The flow to check
262
+ * @param stepId - The step ID to look for
263
+ * @returns True if the flow contains the step
264
+ */
265
+ function hasStep(flow, stepId) {
266
+ return flow.steps.some((s) => s.id === stepId);
267
+ }
268
+
269
+ exports.DEFAULT_FLOW_CONFIG = DEFAULT_FLOW_CONFIG;
270
+ exports.addStep = addStep;
271
+ exports.createFailedResult = createFailedResult;
272
+ exports.createFlow = createFlow;
273
+ exports.createNoopStep = createNoopStep;
274
+ exports.createSkippedResult = createSkippedResult;
275
+ exports.createStep = createStep;
276
+ exports.createSuccessResult = createSuccessResult;
277
+ exports.getStep = getStep;
278
+ exports.hasStep = hasStep;
279
+ exports.insertStep = insertStep;
280
+ exports.insertStepAfter = insertStepAfter;
281
+ exports.insertStepBefore = insertStepBefore;
282
+ exports.removeStep = removeStep;
283
+ exports.replaceStep = replaceStep;
284
+ exports.withConfig = withConfig;
285
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/versioning/src/flow/models/types.ts","../../../../../../../../../../libs/versioning/src/flow/models/step.ts","../../../../../../../../../../libs/versioning/src/flow/models/flow.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;AAmHA;;AAEG;AACI,MAAM,mBAAmB,GAAyB;AACvD,IAAA,MAAM,EAAE,cAAc;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC/C,UAAU,EAAE,CAAC,MAAM,CAAC;AACpB,IAAA,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AACrC,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,aAAa,EAAE,mDAAmD;AAClE,IAAA,SAAS,EAAE,2BAA2B;AACtC,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,mBAA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lowStepResultWithId, Logger } from './types';
2
+ export type { FlowStep, StepCondition, StepExecutor, CreateStepOptions } from './step';
3
+ export { DEFAULT_FLOW_CONFIG } from './types';
4
+ export type { VersionFlow, CreateFlowOptions } from './flow';
5
+ export { createStep, createNoopStep, createSkippedResult, createSuccessResult, createFailedResult } from './step';
6
+ export { createFlow, addStep, removeStep, insertStep, insertStepAfter, insertStepBefore, replaceStep, withConfig, getStep, hasStep, } from './flow';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/flow/models/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACvI,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AACjH,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,OAAO,EACP,OAAO,GACR,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Default flow configuration values.
3
+ */
4
+ const DEFAULT_FLOW_CONFIG = {
5
+ preset: 'conventional',
6
+ releaseTypes: ['feat', 'fix', 'perf', 'revert'],
7
+ minorTypes: ['feat'],
8
+ patchTypes: ['fix', 'perf', 'revert'],
9
+ skipGit: false,
10
+ skipTag: false,
11
+ skipChangelog: false,
12
+ dryRun: false,
13
+ commitMessage: 'chore(${projectName}): release version ${version}',
14
+ tagFormat: '${projectName}@${version}',
15
+ trackDeps: false,
16
+ releaseBranch: 'main',
17
+ firstReleaseVersion: '0.1.0',
18
+ allowPrerelease: false,
19
+ prereleaseId: 'alpha',
20
+ releaseAs: undefined,
21
+ };
22
+
23
+ /**
24
+ * Creates a flow step.
25
+ *
26
+ * @param id - Unique step identifier
27
+ * @param name - Human-readable step name
28
+ * @param execute - Step executor function
29
+ * @param options - Optional step configuration
30
+ * @returns A FlowStep object
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const fetchStep = createStep(
35
+ * 'fetch-registry',
36
+ * 'Fetch Registry Version',
37
+ * async (ctx) => {
38
+ * const version = await ctx.registry.getLatestVersion(ctx.packageName)
39
+ * return {
40
+ * status: 'success',
41
+ * stateUpdates: { publishedVersion: version },
42
+ * message: `Found published version: ${version}`
43
+ * }
44
+ * }
45
+ * )
46
+ * ```
47
+ */
48
+ function createStep(id, name, execute, options = {}) {
49
+ return {
50
+ id,
51
+ name,
52
+ execute,
53
+ description: options.description,
54
+ skipIf: options.skipIf,
55
+ continueOnError: options.continueOnError,
56
+ dependsOn: options.dependsOn,
57
+ };
58
+ }
59
+ /**
60
+ * Creates a step that succeeds immediately.
61
+ * Useful for placeholder or conditional steps.
62
+ *
63
+ * @param id - Unique identifier within the flow
64
+ * @param name - Display label shown during execution
65
+ * @param message - Success message
66
+ * @returns A FlowStep that always succeeds
67
+ */
68
+ function createNoopStep(id, name, message = 'Step completed (no-op)') {
69
+ return createStep(id, name, async () => ({
70
+ status: 'success',
71
+ message,
72
+ }));
73
+ }
74
+ /**
75
+ * Creates a skipped step result.
76
+ *
77
+ * @param message - Explanation for why the step was skipped
78
+ * @returns A FlowStepResult with 'skipped' status
79
+ */
80
+ function createSkippedResult(message) {
81
+ return {
82
+ status: 'skipped',
83
+ message,
84
+ };
85
+ }
86
+ /**
87
+ * Creates a success step result.
88
+ *
89
+ * @param message - Output text describing what the step accomplished
90
+ * @param stateUpdates - Optional state updates to apply after step completion
91
+ * @returns A FlowStepResult with 'success' status
92
+ */
93
+ function createSuccessResult(message, stateUpdates) {
94
+ return {
95
+ status: 'success',
96
+ message,
97
+ stateUpdates,
98
+ };
99
+ }
100
+ /**
101
+ * Creates a failed step result.
102
+ *
103
+ * @param error - Error that caused the failure
104
+ * @param message - Optional message (defaults to error.message)
105
+ * @returns A FlowStepResult with 'failed' status
106
+ */
107
+ function createFailedResult(error, message) {
108
+ return {
109
+ status: 'failed',
110
+ error,
111
+ message: message ?? error.message,
112
+ };
113
+ }
114
+
115
+ /**
116
+ * Creates a version flow.
117
+ *
118
+ * @param id - Flow identifier
119
+ * @param name - Human-readable flow name
120
+ * @param steps - Ordered steps to execute
121
+ * @param options - Optional flow configuration
122
+ * @returns A VersionFlow object
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * const myFlow = createFlow(
127
+ * 'custom',
128
+ * 'Custom Release Flow',
129
+ * [fetchStep, analyzeStep, bumpStep],
130
+ * { description: 'My custom versioning workflow' }
131
+ * )
132
+ * ```
133
+ */
134
+ function createFlow(id, name, steps, options = {}) {
135
+ return {
136
+ id,
137
+ name,
138
+ steps,
139
+ description: options.description,
140
+ config: options.config ?? {},
141
+ };
142
+ }
143
+ /**
144
+ * Adds a step to a flow.
145
+ * Returns a new flow with the step appended.
146
+ *
147
+ * @param flow - The flow to extend
148
+ * @param step - The step to add
149
+ * @returns A new VersionFlow with the step added
150
+ */
151
+ function addStep(flow, step) {
152
+ return {
153
+ ...flow,
154
+ steps: [...flow.steps, step],
155
+ };
156
+ }
157
+ /**
158
+ * Removes a step from a flow by ID.
159
+ * Returns a new flow without the specified step.
160
+ *
161
+ * @param flow - The flow to modify
162
+ * @param stepId - The ID of the step to remove
163
+ * @returns A new VersionFlow without the step
164
+ */
165
+ function removeStep(flow, stepId) {
166
+ return {
167
+ ...flow,
168
+ steps: flow.steps.filter((s) => s.id !== stepId),
169
+ };
170
+ }
171
+ /**
172
+ * Inserts a step at a specific position.
173
+ *
174
+ * @param flow - The flow to modify
175
+ * @param step - The step to insert
176
+ * @param index - Position to insert at (0-based)
177
+ * @returns A new VersionFlow with the step inserted
178
+ */
179
+ function insertStep(flow, step, index) {
180
+ const steps = [...flow.steps];
181
+ steps.splice(index, 0, step);
182
+ return {
183
+ ...flow,
184
+ steps,
185
+ };
186
+ }
187
+ /**
188
+ * Inserts a step after another step.
189
+ *
190
+ * @param flow - The flow to modify
191
+ * @param step - The step to insert
192
+ * @param afterStepId - ID of the step to insert after
193
+ * @returns A new VersionFlow with the step inserted
194
+ */
195
+ function insertStepAfter(flow, step, afterStepId) {
196
+ const index = flow.steps.findIndex((s) => s.id === afterStepId);
197
+ if (index === -1) {
198
+ // If not found, append to end
199
+ return addStep(flow, step);
200
+ }
201
+ return insertStep(flow, step, index + 1);
202
+ }
203
+ /**
204
+ * Inserts a step before another step.
205
+ *
206
+ * @param flow - The flow to modify
207
+ * @param step - The step to insert
208
+ * @param beforeStepId - ID of the step to insert before
209
+ * @returns A new VersionFlow with the step inserted
210
+ */
211
+ function insertStepBefore(flow, step, beforeStepId) {
212
+ const index = flow.steps.findIndex((s) => s.id === beforeStepId);
213
+ if (index === -1) {
214
+ // If not found, prepend to beginning
215
+ return insertStep(flow, step, 0);
216
+ }
217
+ return insertStep(flow, step, index);
218
+ }
219
+ /**
220
+ * Replaces a step in the flow.
221
+ *
222
+ * @param flow - The flow to modify
223
+ * @param stepId - ID of the step to replace
224
+ * @param newStep - The replacement step
225
+ * @returns A new VersionFlow with the step replaced
226
+ */
227
+ function replaceStep(flow, stepId, newStep) {
228
+ return {
229
+ ...flow,
230
+ steps: flow.steps.map((s) => (s.id === stepId ? newStep : s)),
231
+ };
232
+ }
233
+ /**
234
+ * Updates the flow configuration.
235
+ *
236
+ * @param flow - The flow to configure
237
+ * @param config - Configuration updates to merge
238
+ * @returns A new VersionFlow with updated config
239
+ */
240
+ function withConfig(flow, config) {
241
+ return {
242
+ ...flow,
243
+ config: { ...flow.config, ...config },
244
+ };
245
+ }
246
+ /**
247
+ * Gets a step from a flow by ID.
248
+ *
249
+ * @param flow - The flow to search
250
+ * @param stepId - The step ID to find
251
+ * @returns The step if found, undefined otherwise
252
+ */
253
+ function getStep(flow, stepId) {
254
+ return flow.steps.find((s) => s.id === stepId);
255
+ }
256
+ /**
257
+ * Checks if a flow has a specific step.
258
+ *
259
+ * @param flow - The flow to check
260
+ * @param stepId - The step ID to look for
261
+ * @returns True if the flow contains the step
262
+ */
263
+ function hasStep(flow, stepId) {
264
+ return flow.steps.some((s) => s.id === stepId);
265
+ }
266
+
267
+ export { DEFAULT_FLOW_CONFIG, addStep, createFailedResult, createFlow, createNoopStep, createSkippedResult, createStep, createSuccessResult, getStep, hasStep, insertStep, insertStepAfter, insertStepBefore, removeStep, replaceStep, withConfig };
268
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/versioning/src/flow/models/types.ts","../../../../../../../../../../libs/versioning/src/flow/models/step.ts","../../../../../../../../../../libs/versioning/src/flow/models/flow.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":"AAmHA;;AAEG;AACI,MAAM,mBAAmB,GAAyB;AACvD,IAAA,MAAM,EAAE,cAAc;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC/C,UAAU,EAAE,CAAC,MAAM,CAAC;AACpB,IAAA,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;AACrC,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,aAAa,EAAE,mDAAmD;AAClE,IAAA,SAAS,EAAE,2BAA2B;AACtC,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,aAAa,EAAE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function type.
4
+ * Takes flow context and returns a step result promise.
5
+ */
6
+ export type StepExecutor = (context: FlowContext) => Promise<FlowStepResult>;
7
+ /**
8
+ * Step skip condition function type.
9
+ * Returns true if the step should be skipped.
10
+ */
11
+ export type StepCondition = (context: FlowContext) => boolean;
12
+ /**
13
+ * A single step in a version flow.
14
+ *
15
+ * Steps are pure functions that:
16
+ * 1. Read from context (state, config, services)
17
+ * 2. Perform work (possibly with side effects via services)
18
+ * 3. Return state updates
19
+ */
20
+ export interface FlowStep {
21
+ /** Step identifier (unique within flow) */
22
+ readonly id: string;
23
+ /** Human-readable step name */
24
+ readonly name: string;
25
+ /** Optional step description */
26
+ readonly description?: string;
27
+ /** Step function to execute */
28
+ readonly execute: StepExecutor;
29
+ /** Condition for skipping step */
30
+ readonly skipIf?: StepCondition;
31
+ /** Whether step failure should fail the flow */
32
+ readonly continueOnError?: boolean;
33
+ /** Steps that must complete before this one */
34
+ readonly dependsOn?: readonly string[];
35
+ }
36
+ /**
37
+ * Options for creating a flow step.
38
+ */
39
+ export interface CreateStepOptions {
40
+ /** Step description */
41
+ description?: string;
42
+ /** Condition for skipping step */
43
+ skipIf?: StepCondition;
44
+ /** Whether step failure should fail the flow */
45
+ continueOnError?: boolean;
46
+ /** Steps that must complete before this one */
47
+ dependsOn?: readonly string[];
48
+ }
49
+ /**
50
+ * Creates a flow step.
51
+ *
52
+ * @param id - Unique step identifier
53
+ * @param name - Human-readable step name
54
+ * @param execute - Step executor function
55
+ * @param options - Optional step configuration
56
+ * @returns A FlowStep object
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const fetchStep = createStep(
61
+ * 'fetch-registry',
62
+ * 'Fetch Registry Version',
63
+ * async (ctx) => {
64
+ * const version = await ctx.registry.getLatestVersion(ctx.packageName)
65
+ * return {
66
+ * status: 'success',
67
+ * stateUpdates: { publishedVersion: version },
68
+ * message: `Found published version: ${version}`
69
+ * }
70
+ * }
71
+ * )
72
+ * ```
73
+ */
74
+ export declare function createStep(id: string, name: string, execute: StepExecutor, options?: CreateStepOptions): FlowStep;
75
+ /**
76
+ * Creates a step that succeeds immediately.
77
+ * Useful for placeholder or conditional steps.
78
+ *
79
+ * @param id - Unique identifier within the flow
80
+ * @param name - Display label shown during execution
81
+ * @param message - Success message
82
+ * @returns A FlowStep that always succeeds
83
+ */
84
+ export declare function createNoopStep(id: string, name: string, message?: string): FlowStep;
85
+ /**
86
+ * Creates a skipped step result.
87
+ *
88
+ * @param message - Explanation for why the step was skipped
89
+ * @returns A FlowStepResult with 'skipped' status
90
+ */
91
+ export declare function createSkippedResult(message: string): FlowStepResult;
92
+ /**
93
+ * Creates a success step result.
94
+ *
95
+ * @param message - Output text describing what the step accomplished
96
+ * @param stateUpdates - Optional state updates to apply after step completion
97
+ * @returns A FlowStepResult with 'success' status
98
+ */
99
+ export declare function createSuccessResult(message: string, stateUpdates?: FlowStepResult['stateUpdates']): FlowStepResult;
100
+ /**
101
+ * Creates a failed step result.
102
+ *
103
+ * @param error - Error that caused the failure
104
+ * @param message - Optional message (defaults to error.message)
105
+ * @returns A FlowStepResult with 'failed' status
106
+ */
107
+ export declare function createFailedResult(error: Error, message?: string): FlowStepResult;
108
+ //# sourceMappingURL=step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/flow/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;AAE5E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB,+BAA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