@nekostack/schema 1.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 (214) hide show
  1. package/CHANGELOG.md +422 -0
  2. package/LICENSE +202 -0
  3. package/README.md +656 -0
  4. package/dist/src/builders/array.d.ts +12 -0
  5. package/dist/src/builders/array.d.ts.map +1 -0
  6. package/dist/src/builders/array.js +29 -0
  7. package/dist/src/builders/array.js.map +1 -0
  8. package/dist/src/builders/object.d.ts +62 -0
  9. package/dist/src/builders/object.d.ts.map +1 -0
  10. package/dist/src/builders/object.js +263 -0
  11. package/dist/src/builders/object.js.map +1 -0
  12. package/dist/src/builders/primitives.d.ts +37 -0
  13. package/dist/src/builders/primitives.d.ts.map +1 -0
  14. package/dist/src/builders/primitives.js +125 -0
  15. package/dist/src/builders/primitives.js.map +1 -0
  16. package/dist/src/builders/s.d.ts +27 -0
  17. package/dist/src/builders/s.d.ts.map +1 -0
  18. package/dist/src/builders/s.js +39 -0
  19. package/dist/src/builders/s.js.map +1 -0
  20. package/dist/src/builders/schema.d.ts +70 -0
  21. package/dist/src/builders/schema.d.ts.map +1 -0
  22. package/dist/src/builders/schema.js +98 -0
  23. package/dist/src/builders/schema.js.map +1 -0
  24. package/dist/src/cli-integration.d.ts +43 -0
  25. package/dist/src/cli-integration.d.ts.map +1 -0
  26. package/dist/src/cli-integration.js +48 -0
  27. package/dist/src/cli-integration.js.map +1 -0
  28. package/dist/src/errors/issue.d.ts +34 -0
  29. package/dist/src/errors/issue.d.ts.map +1 -0
  30. package/dist/src/errors/issue.js +89 -0
  31. package/dist/src/errors/issue.js.map +1 -0
  32. package/dist/src/generators/errors.d.ts +31 -0
  33. package/dist/src/generators/errors.d.ts.map +1 -0
  34. package/dist/src/generators/errors.js +34 -0
  35. package/dist/src/generators/errors.js.map +1 -0
  36. package/dist/src/generators/header.d.ts +42 -0
  37. package/dist/src/generators/header.d.ts.map +1 -0
  38. package/dist/src/generators/header.js +43 -0
  39. package/dist/src/generators/header.js.map +1 -0
  40. package/dist/src/generators/json-schema-meta.d.ts +36 -0
  41. package/dist/src/generators/json-schema-meta.d.ts.map +1 -0
  42. package/dist/src/generators/json-schema-meta.js +35 -0
  43. package/dist/src/generators/json-schema-meta.js.map +1 -0
  44. package/dist/src/generators/json-schema.d.ts +26 -0
  45. package/dist/src/generators/json-schema.d.ts.map +1 -0
  46. package/dist/src/generators/json-schema.js +88 -0
  47. package/dist/src/generators/json-schema.js.map +1 -0
  48. package/dist/src/generators/openapi.d.ts +33 -0
  49. package/dist/src/generators/openapi.d.ts.map +1 -0
  50. package/dist/src/generators/openapi.js +61 -0
  51. package/dist/src/generators/openapi.js.map +1 -0
  52. package/dist/src/generators/schema-fragment.d.ts +55 -0
  53. package/dist/src/generators/schema-fragment.d.ts.map +1 -0
  54. package/dist/src/generators/schema-fragment.js +253 -0
  55. package/dist/src/generators/schema-fragment.js.map +1 -0
  56. package/dist/src/generators/ts.d.ts +19 -0
  57. package/dist/src/generators/ts.d.ts.map +1 -0
  58. package/dist/src/generators/ts.js +252 -0
  59. package/dist/src/generators/ts.js.map +1 -0
  60. package/dist/src/generators/types.d.ts +96 -0
  61. package/dist/src/generators/types.d.ts.map +1 -0
  62. package/dist/src/generators/types.js +10 -0
  63. package/dist/src/generators/types.js.map +1 -0
  64. package/dist/src/generators/version.d.ts +11 -0
  65. package/dist/src/generators/version.d.ts.map +1 -0
  66. package/dist/src/generators/version.js +11 -0
  67. package/dist/src/generators/version.js.map +1 -0
  68. package/dist/src/generators/zod-mapping.d.ts +90 -0
  69. package/dist/src/generators/zod-mapping.d.ts.map +1 -0
  70. package/dist/src/generators/zod-mapping.js +174 -0
  71. package/dist/src/generators/zod-mapping.js.map +1 -0
  72. package/dist/src/generators/zod.d.ts +17 -0
  73. package/dist/src/generators/zod.d.ts.map +1 -0
  74. package/dist/src/generators/zod.js +118 -0
  75. package/dist/src/generators/zod.js.map +1 -0
  76. package/dist/src/index.d.ts +21 -0
  77. package/dist/src/index.d.ts.map +1 -0
  78. package/dist/src/index.js +43 -0
  79. package/dist/src/index.js.map +1 -0
  80. package/dist/src/ir/hash.d.ts +19 -0
  81. package/dist/src/ir/hash.d.ts.map +1 -0
  82. package/dist/src/ir/hash.js +22 -0
  83. package/dist/src/ir/hash.js.map +1 -0
  84. package/dist/src/ir/nodes.d.ts +121 -0
  85. package/dist/src/ir/nodes.d.ts.map +1 -0
  86. package/dist/src/ir/nodes.js +14 -0
  87. package/dist/src/ir/nodes.js.map +1 -0
  88. package/dist/src/ir/serialize.d.ts +8 -0
  89. package/dist/src/ir/serialize.d.ts.map +1 -0
  90. package/dist/src/ir/serialize.js +23 -0
  91. package/dist/src/ir/serialize.js.map +1 -0
  92. package/dist/src/migrations/build-migration-registry.d.ts +46 -0
  93. package/dist/src/migrations/build-migration-registry.d.ts.map +1 -0
  94. package/dist/src/migrations/build-migration-registry.js +134 -0
  95. package/dist/src/migrations/build-migration-registry.js.map +1 -0
  96. package/dist/src/migrations/handlers/list.d.ts +35 -0
  97. package/dist/src/migrations/handlers/list.d.ts.map +1 -0
  98. package/dist/src/migrations/handlers/list.js +55 -0
  99. package/dist/src/migrations/handlers/list.js.map +1 -0
  100. package/dist/src/migrations/handlers/plan.d.ts +26 -0
  101. package/dist/src/migrations/handlers/plan.d.ts.map +1 -0
  102. package/dist/src/migrations/handlers/plan.js +28 -0
  103. package/dist/src/migrations/handlers/plan.js.map +1 -0
  104. package/dist/src/migrations/handlers/stub.d.ts +22 -0
  105. package/dist/src/migrations/handlers/stub.d.ts.map +1 -0
  106. package/dist/src/migrations/handlers/stub.js +24 -0
  107. package/dist/src/migrations/handlers/stub.js.map +1 -0
  108. package/dist/src/migrations/handlers/verify.d.ts +25 -0
  109. package/dist/src/migrations/handlers/verify.d.ts.map +1 -0
  110. package/dist/src/migrations/handlers/verify.js +27 -0
  111. package/dist/src/migrations/handlers/verify.js.map +1 -0
  112. package/dist/src/migrations/parse-provenance.d.ts +78 -0
  113. package/dist/src/migrations/parse-provenance.d.ts.map +1 -0
  114. package/dist/src/migrations/parse-provenance.js +157 -0
  115. package/dist/src/migrations/parse-provenance.js.map +1 -0
  116. package/dist/src/migrations/plan-migration.d.ts +50 -0
  117. package/dist/src/migrations/plan-migration.d.ts.map +1 -0
  118. package/dist/src/migrations/plan-migration.js +256 -0
  119. package/dist/src/migrations/plan-migration.js.map +1 -0
  120. package/dist/src/migrations/stub.d.ts +55 -0
  121. package/dist/src/migrations/stub.d.ts.map +1 -0
  122. package/dist/src/migrations/stub.js +201 -0
  123. package/dist/src/migrations/stub.js.map +1 -0
  124. package/dist/src/migrations/types.d.ts +297 -0
  125. package/dist/src/migrations/types.d.ts.map +1 -0
  126. package/dist/src/migrations/types.js +28 -0
  127. package/dist/src/migrations/types.js.map +1 -0
  128. package/dist/src/migrations/verify-provenance.d.ts +46 -0
  129. package/dist/src/migrations/verify-provenance.d.ts.map +1 -0
  130. package/dist/src/migrations/verify-provenance.js +158 -0
  131. package/dist/src/migrations/verify-provenance.js.map +1 -0
  132. package/dist/src/registry/build-registry.d.ts +65 -0
  133. package/dist/src/registry/build-registry.d.ts.map +1 -0
  134. package/dist/src/registry/build-registry.js +172 -0
  135. package/dist/src/registry/build-registry.js.map +1 -0
  136. package/dist/src/registry/diff.d.ts +25 -0
  137. package/dist/src/registry/diff.d.ts.map +1 -0
  138. package/dist/src/registry/diff.js +497 -0
  139. package/dist/src/registry/diff.js.map +1 -0
  140. package/dist/src/registry/handlers/check.d.ts +57 -0
  141. package/dist/src/registry/handlers/check.d.ts.map +1 -0
  142. package/dist/src/registry/handlers/check.js +181 -0
  143. package/dist/src/registry/handlers/check.js.map +1 -0
  144. package/dist/src/registry/handlers/diff.d.ts +33 -0
  145. package/dist/src/registry/handlers/diff.d.ts.map +1 -0
  146. package/dist/src/registry/handlers/diff.js +61 -0
  147. package/dist/src/registry/handlers/diff.js.map +1 -0
  148. package/dist/src/registry/handlers/generate.d.ts +87 -0
  149. package/dist/src/registry/handlers/generate.d.ts.map +1 -0
  150. package/dist/src/registry/handlers/generate.js +223 -0
  151. package/dist/src/registry/handlers/generate.js.map +1 -0
  152. package/dist/src/registry/handlers/list.d.ts +36 -0
  153. package/dist/src/registry/handlers/list.d.ts.map +1 -0
  154. package/dist/src/registry/handlers/list.js +84 -0
  155. package/dist/src/registry/handlers/list.js.map +1 -0
  156. package/dist/src/registry/parse-provenance.d.ts +63 -0
  157. package/dist/src/registry/parse-provenance.d.ts.map +1 -0
  158. package/dist/src/registry/parse-provenance.js +182 -0
  159. package/dist/src/registry/parse-provenance.js.map +1 -0
  160. package/dist/src/registry/source-hash.d.ts +28 -0
  161. package/dist/src/registry/source-hash.d.ts.map +1 -0
  162. package/dist/src/registry/source-hash.js +32 -0
  163. package/dist/src/registry/source-hash.js.map +1 -0
  164. package/dist/src/registry/types.d.ts +185 -0
  165. package/dist/src/registry/types.d.ts.map +1 -0
  166. package/dist/src/registry/types.js +22 -0
  167. package/dist/src/registry/types.js.map +1 -0
  168. package/dist/src/runtime/compile.d.ts +38 -0
  169. package/dist/src/runtime/compile.d.ts.map +1 -0
  170. package/dist/src/runtime/compile.js +45 -0
  171. package/dist/src/runtime/compile.js.map +1 -0
  172. package/dist/src/runtime/errors.d.ts +25 -0
  173. package/dist/src/runtime/errors.d.ts.map +1 -0
  174. package/dist/src/runtime/errors.js +43 -0
  175. package/dist/src/runtime/errors.js.map +1 -0
  176. package/dist/src/runtime/normalize-issues.d.ts +65 -0
  177. package/dist/src/runtime/normalize-issues.d.ts.map +1 -0
  178. package/dist/src/runtime/normalize-issues.js +208 -0
  179. package/dist/src/runtime/normalize-issues.js.map +1 -0
  180. package/dist/src/runtime/parse.d.ts +62 -0
  181. package/dist/src/runtime/parse.d.ts.map +1 -0
  182. package/dist/src/runtime/parse.js +107 -0
  183. package/dist/src/runtime/parse.js.map +1 -0
  184. package/dist/src/runtime/strip-defaults.d.ts +51 -0
  185. package/dist/src/runtime/strip-defaults.d.ts.map +1 -0
  186. package/dist/src/runtime/strip-defaults.js +81 -0
  187. package/dist/src/runtime/strip-defaults.js.map +1 -0
  188. package/dist/src/runtime/zod-compile.d.ts +27 -0
  189. package/dist/src/runtime/zod-compile.d.ts.map +1 -0
  190. package/dist/src/runtime/zod-compile.js +92 -0
  191. package/dist/src/runtime/zod-compile.js.map +1 -0
  192. package/dist/src/types.d.ts +116 -0
  193. package/dist/src/types.d.ts.map +1 -0
  194. package/dist/src/types.js +2 -0
  195. package/dist/src/types.js.map +1 -0
  196. package/docs/ABSENCE_SEMANTICS.md +37 -0
  197. package/docs/BENCHMARKS.md +64 -0
  198. package/docs/COMPOSITION.md +206 -0
  199. package/docs/DIFF_CLASSIFICATION.md +137 -0
  200. package/docs/EXAMPLES.md +221 -0
  201. package/docs/HEADER_FORMAT.md +66 -0
  202. package/docs/INVARIANTS.md +58 -0
  203. package/docs/IR_CONTRACT.md +67 -0
  204. package/docs/ISSUE_CODES.md +99 -0
  205. package/docs/JSON_SCHEMA_MAPPING.md +149 -0
  206. package/docs/MIGRATIONS.md +406 -0
  207. package/docs/MIGRATION_GUIDE.md +150 -0
  208. package/docs/OPENAPI_MAPPING.md +66 -0
  209. package/docs/REGISTRY.md +336 -0
  210. package/docs/RUNTIME.md +279 -0
  211. package/docs/SCOPE.md +119 -0
  212. package/docs/USAGE.md +376 -0
  213. package/docs/ZOD_MODIFIER_ORDERING.md +77 -0
  214. package/package.json +45 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/ir/serialize.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACtD,MAAM,CAAC,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC9B,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `buildMigrationRegistry(entries)` — pure migration-registry
3
+ * constructor (v0.8 Step 3).
4
+ *
5
+ * Walks the CLI-supplied `MigrationSourceEntry[]` (one per loaded
6
+ * `*.migration.ts` file) and builds the three-level lookup map
7
+ * `MigrationRegistry = ReadonlyMap<schemaId, ReadonlyMap<fromVersion,
8
+ * ReadonlyMap<toVersion, MigrationEntry>>>`. Returns
9
+ * `Result<MigrationRegistry>` — never throws.
10
+ *
11
+ * **Pure.** No `fs.*`, no `import()`, no `path.*`. The CLI is
12
+ * responsible for reading the source text and dynamic-importing the
13
+ * migration files; this function takes the loaded data and indexes
14
+ * it. Master plan Decision #1 boundary applies.
15
+ *
16
+ * Failure-mode contract (v0.8 Round-2 lock — intentional departure
17
+ * from v0.7 Decision #5):
18
+ *
19
+ * - **Malformed / missing provenance is fail-loud.** Every entry's
20
+ * `sourceText` runs through `parseMigrationProvenanceFromText`.
21
+ * Failures from the parser surface as `Result.failure` Issues
22
+ * with the migration's `sourcePath` attached via the issue's
23
+ * `path` so the CLI can pinpoint which file is bad.
24
+ * - **Duplicate `(schemaId, fromVersion, toVersion)` triples** are
25
+ * collected as `duplicate_migration` Issues. The first-seen entry
26
+ * stays in the partial map so a single call doesn't return a
27
+ * torn lookup state.
28
+ *
29
+ * Both failure classes are **collected** across the full entry list
30
+ * — `buildMigrationRegistry` never short-circuits on the first
31
+ * problem. The returned `Result.failure` carries every Issue in one
32
+ * payload so the CLI can render a single human-readable report.
33
+ *
34
+ * **Provenance ↔ source-entry binding is a soft check.** The
35
+ * provenance header carries its own `schemaId / fromVersion /
36
+ * toVersion`; the `MigrationSourceEntry.migration` value also has
37
+ * `schemaId / from / to` fields. v0.8 indexes by the *provenance*
38
+ * triple. If the loaded `migration` default-export disagrees with
39
+ * its header, that's a separate verification concern (the runtime
40
+ * vs. recorded provenance) and is not a registry-construction
41
+ * failure. Step 5's verifier picks it up later if it matters.
42
+ */
43
+ import type { Result } from "../errors/issue.js";
44
+ import type { MigrationRegistry, MigrationSourceEntry } from "./types.js";
45
+ export declare function buildMigrationRegistry(entries: readonly MigrationSourceEntry[]): Result<MigrationRegistry>;
46
+ //# sourceMappingURL=build-migration-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-migration-registry.d.ts","sourceRoot":"","sources":["../../../src/migrations/build-migration-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAoB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAKnE,OAAO,KAAK,EAEV,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAMpB,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GACvC,MAAM,CAAC,iBAAiB,CAAC,CAuD3B"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * `buildMigrationRegistry(entries)` — pure migration-registry
3
+ * constructor (v0.8 Step 3).
4
+ *
5
+ * Walks the CLI-supplied `MigrationSourceEntry[]` (one per loaded
6
+ * `*.migration.ts` file) and builds the three-level lookup map
7
+ * `MigrationRegistry = ReadonlyMap<schemaId, ReadonlyMap<fromVersion,
8
+ * ReadonlyMap<toVersion, MigrationEntry>>>`. Returns
9
+ * `Result<MigrationRegistry>` — never throws.
10
+ *
11
+ * **Pure.** No `fs.*`, no `import()`, no `path.*`. The CLI is
12
+ * responsible for reading the source text and dynamic-importing the
13
+ * migration files; this function takes the loaded data and indexes
14
+ * it. Master plan Decision #1 boundary applies.
15
+ *
16
+ * Failure-mode contract (v0.8 Round-2 lock — intentional departure
17
+ * from v0.7 Decision #5):
18
+ *
19
+ * - **Malformed / missing provenance is fail-loud.** Every entry's
20
+ * `sourceText` runs through `parseMigrationProvenanceFromText`.
21
+ * Failures from the parser surface as `Result.failure` Issues
22
+ * with the migration's `sourcePath` attached via the issue's
23
+ * `path` so the CLI can pinpoint which file is bad.
24
+ * - **Duplicate `(schemaId, fromVersion, toVersion)` triples** are
25
+ * collected as `duplicate_migration` Issues. The first-seen entry
26
+ * stays in the partial map so a single call doesn't return a
27
+ * torn lookup state.
28
+ *
29
+ * Both failure classes are **collected** across the full entry list
30
+ * — `buildMigrationRegistry` never short-circuits on the first
31
+ * problem. The returned `Result.failure` carries every Issue in one
32
+ * payload so the CLI can render a single human-readable report.
33
+ *
34
+ * **Provenance ↔ source-entry binding is a soft check.** The
35
+ * provenance header carries its own `schemaId / fromVersion /
36
+ * toVersion`; the `MigrationSourceEntry.migration` value also has
37
+ * `schemaId / from / to` fields. v0.8 indexes by the *provenance*
38
+ * triple. If the loaded `migration` default-export disagrees with
39
+ * its header, that's a separate verification concern (the runtime
40
+ * vs. recorded provenance) and is not a registry-construction
41
+ * failure. Step 5's verifier picks it up later if it matters.
42
+ */
43
+ import { parseMigrationProvenanceFromText, } from "./parse-provenance.js";
44
+ // =============================================================================
45
+ // Public surface
46
+ // =============================================================================
47
+ export function buildMigrationRegistry(entries) {
48
+ const out = new Map();
49
+ const issues = [];
50
+ for (const entry of entries) {
51
+ const parsed = parseMigrationProvenanceFromText(entry.sourceText);
52
+ if (!parsed.success) {
53
+ // Re-key each parser failure to the offending file's
54
+ // sourcePath so the CLI can pinpoint the bad file without
55
+ // grepping the message text.
56
+ for (const issue of parsed.issues) {
57
+ issues.push(attachSourcePath(issue, entry.sourcePath));
58
+ }
59
+ continue;
60
+ }
61
+ const migrationEntry = buildEntry(entry, parsed.data);
62
+ const { schemaId, fromVersion, toVersion } = migrationEntry;
63
+ let byFrom = out.get(schemaId);
64
+ if (byFrom === undefined) {
65
+ byFrom = new Map();
66
+ out.set(schemaId, byFrom);
67
+ }
68
+ let byTo = byFrom.get(fromVersion);
69
+ if (byTo === undefined) {
70
+ byTo = new Map();
71
+ byFrom.set(fromVersion, byTo);
72
+ }
73
+ const existing = byTo.get(toVersion);
74
+ if (existing !== undefined) {
75
+ issues.push(duplicateMigrationIssue(schemaId, fromVersion, toVersion, [existing.sourcePath, entry.sourcePath]));
76
+ // Keep the first-seen entry. Same rule as `buildRegistry`'s
77
+ // duplicate handling (v0.7): re-indexing would let the
78
+ // duplicate replace the original silently — the exact failure
79
+ // mode this Result is meant to surface.
80
+ continue;
81
+ }
82
+ byTo.set(toVersion, migrationEntry);
83
+ }
84
+ if (issues.length > 0) {
85
+ return { success: false, issues };
86
+ }
87
+ return { success: true, data: out };
88
+ }
89
+ // =============================================================================
90
+ // Entry construction
91
+ // =============================================================================
92
+ function buildEntry(entry, prov) {
93
+ return {
94
+ schemaId: prov.schemaId,
95
+ fromVersion: prov.fromVersion,
96
+ toVersion: prov.toVersion,
97
+ fromIrHash: prov.fromIrHash,
98
+ toIrHash: prov.toIrHash,
99
+ fromSourceHash: prov.fromSourceHash,
100
+ toSourceHash: prov.toSourceHash,
101
+ sourcePath: entry.sourcePath,
102
+ // Preserves object identity — the same `AnyMigration` reference
103
+ // the CLI handed in shows up on the indexed entry. Downstream
104
+ // code can `===` it against the original.
105
+ migration: entry.migration,
106
+ };
107
+ }
108
+ // =============================================================================
109
+ // Issue helpers
110
+ // =============================================================================
111
+ function attachSourcePath(issue, sourcePath) {
112
+ const path = [sourcePath];
113
+ return {
114
+ ...issue,
115
+ path,
116
+ metadata: { ...(issue.metadata ?? {}), sourcePath },
117
+ };
118
+ }
119
+ function duplicateMigrationIssue(schemaId, fromVersion, toVersion, sourcePaths) {
120
+ return {
121
+ code: "duplicate_migration",
122
+ path: [],
123
+ message: `Duplicate migration for \`${schemaId}\` ${fromVersion} → ${toVersion} ` +
124
+ `found in: ${sourcePaths.join(", ")}`,
125
+ severity: "error",
126
+ metadata: {
127
+ schemaId,
128
+ fromVersion,
129
+ toVersion,
130
+ sourcePaths: [...sourcePaths],
131
+ },
132
+ };
133
+ }
134
+ //# sourceMappingURL=build-migration-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-migration-registry.js","sourceRoot":"","sources":["../../../src/migrations/build-migration-registry.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `listMigrationsHandler({ migrationRegistry })` — enumerate every
3
+ * `MigrationEntry` in a `MigrationRegistry`, in a stable order, as a
4
+ * `Result<{ entries }>` (v0.8 Step 7).
5
+ *
6
+ * The simplest of the four v0.8 handlers; landing this commit first
7
+ * pins the handler shape and the `Result<T>` discriminated-union
8
+ * contract before `plan` / `verify` / `stub` add per-handler
9
+ * complexity (Master plan sequencing step 7). Mirrors v0.7's
10
+ * `listHandler` shape exactly.
11
+ *
12
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
13
+ * `console.*`. Takes an already-built `MigrationRegistry` (Step 3's
14
+ * `buildMigrationRegistry` output) and returns a `Result` over a flat
15
+ * array. Master plan Decision #1 boundary.
16
+ *
17
+ * Ordering (deterministic; documented in tests):
18
+ *
19
+ * 1. **Across `schemaId`** — alphabetical ascending.
20
+ * 2. **Within one `schemaId`, by `fromVersion`** — alphabetical
21
+ * ascending.
22
+ * 3. **Within one `(schemaId, fromVersion)`, by `toVersion`** —
23
+ * alphabetical ascending.
24
+ *
25
+ * The lexicographic compare matches `verify-provenance.ts` (Step 5).
26
+ * That means the list-handler's `entries` come out in the same order
27
+ * the verifier visits them for the same data — useful for consumers
28
+ * that join the two outputs by index.
29
+ *
30
+ * Never returns failure: enumeration has no failure mode. Empty
31
+ * registry → `{ success: true, data: { entries: [] } }`.
32
+ */
33
+ import type { MigrationListOpts, MigrationListResult } from "../types.js";
34
+ export declare function listMigrationsHandler(opts: MigrationListOpts): MigrationListResult;
35
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/migrations/handlers/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAEV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,CAkBrB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * `listMigrationsHandler({ migrationRegistry })` — enumerate every
3
+ * `MigrationEntry` in a `MigrationRegistry`, in a stable order, as a
4
+ * `Result<{ entries }>` (v0.8 Step 7).
5
+ *
6
+ * The simplest of the four v0.8 handlers; landing this commit first
7
+ * pins the handler shape and the `Result<T>` discriminated-union
8
+ * contract before `plan` / `verify` / `stub` add per-handler
9
+ * complexity (Master plan sequencing step 7). Mirrors v0.7's
10
+ * `listHandler` shape exactly.
11
+ *
12
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
13
+ * `console.*`. Takes an already-built `MigrationRegistry` (Step 3's
14
+ * `buildMigrationRegistry` output) and returns a `Result` over a flat
15
+ * array. Master plan Decision #1 boundary.
16
+ *
17
+ * Ordering (deterministic; documented in tests):
18
+ *
19
+ * 1. **Across `schemaId`** — alphabetical ascending.
20
+ * 2. **Within one `schemaId`, by `fromVersion`** — alphabetical
21
+ * ascending.
22
+ * 3. **Within one `(schemaId, fromVersion)`, by `toVersion`** —
23
+ * alphabetical ascending.
24
+ *
25
+ * The lexicographic compare matches `verify-provenance.ts` (Step 5).
26
+ * That means the list-handler's `entries` come out in the same order
27
+ * the verifier visits them for the same data — useful for consumers
28
+ * that join the two outputs by index.
29
+ *
30
+ * Never returns failure: enumeration has no failure mode. Empty
31
+ * registry → `{ success: true, data: { entries: [] } }`.
32
+ */
33
+ export function listMigrationsHandler(opts) {
34
+ const entries = [];
35
+ const schemaIds = [...opts.migrationRegistry.keys()].sort();
36
+ for (const schemaId of schemaIds) {
37
+ const byFrom = opts.migrationRegistry.get(schemaId);
38
+ if (byFrom === undefined)
39
+ continue; // unreachable given iteration source
40
+ const fromVersions = [...byFrom.keys()].sort();
41
+ for (const fromVersion of fromVersions) {
42
+ const byTo = byFrom.get(fromVersion);
43
+ if (byTo === undefined)
44
+ continue;
45
+ const toVersions = [...byTo.keys()].sort();
46
+ for (const toVersion of toVersions) {
47
+ const entry = byTo.get(toVersion);
48
+ if (entry !== undefined)
49
+ entries.push(entry);
50
+ }
51
+ }
52
+ }
53
+ return { success: true, data: { entries } };
54
+ }
55
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/migrations/handlers/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAQH,MAAM,UAAU,qBAAqB,CACnC,IAAuB;IAEvB,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS,CAAC,qCAAqC;QACzE,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACrC,IAAI,IAAI,KAAK,SAAS;gBAAE,SAAS;YACjC,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAClC,IAAI,KAAK,KAAK,SAAS;oBAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `planMigrationHandler(opts)` — handler wrapper around the
3
+ * diff-aware planner (v0.8 Step 8).
4
+ *
5
+ * Forwards directly to `planMigration` from `../plan-migration.js`.
6
+ * The wrapper exists so the four-handler surface
7
+ * (`list / plan / verify / stub`) reads uniformly to the CLI — and
8
+ * so future cross-cutting concerns (telemetry tagging, opts
9
+ * defaulting, etc.) have a single seam — but in v0.8 it is a thin
10
+ * pass-through.
11
+ *
12
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
13
+ * `console.*`. **Never invokes `migration.transform`** —
14
+ * verification of the no-execute boundary lives in the planner
15
+ * implementation; the wrapper inherits it.
16
+ *
17
+ * **Throws** propagate. If `planMigration` raises
18
+ * `UnsupportedNodeKindError` (because `diffNodes` hit a `date` /
19
+ * `union` / `recursiveRef` / `transform` IR kind), this handler
20
+ * does NOT catch — the CLI dispatcher (Step 21) maps the throw to
21
+ * a non-zero exit code at the CLI boundary, matching the v0.6 /
22
+ * v0.7 fail-loud discipline.
23
+ */
24
+ import type { MigrationPlanOpts, MigrationPlanResult } from "../types.js";
25
+ export declare function planMigrationHandler(opts: MigrationPlanOpts): MigrationPlanResult;
26
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/migrations/handlers/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,CAErB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `planMigrationHandler(opts)` — handler wrapper around the
3
+ * diff-aware planner (v0.8 Step 8).
4
+ *
5
+ * Forwards directly to `planMigration` from `../plan-migration.js`.
6
+ * The wrapper exists so the four-handler surface
7
+ * (`list / plan / verify / stub`) reads uniformly to the CLI — and
8
+ * so future cross-cutting concerns (telemetry tagging, opts
9
+ * defaulting, etc.) have a single seam — but in v0.8 it is a thin
10
+ * pass-through.
11
+ *
12
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
13
+ * `console.*`. **Never invokes `migration.transform`** —
14
+ * verification of the no-execute boundary lives in the planner
15
+ * implementation; the wrapper inherits it.
16
+ *
17
+ * **Throws** propagate. If `planMigration` raises
18
+ * `UnsupportedNodeKindError` (because `diffNodes` hit a `date` /
19
+ * `union` / `recursiveRef` / `transform` IR kind), this handler
20
+ * does NOT catch — the CLI dispatcher (Step 21) maps the throw to
21
+ * a non-zero exit code at the CLI boundary, matching the v0.6 /
22
+ * v0.7 fail-loud discipline.
23
+ */
24
+ import { planMigration } from "../plan-migration.js";
25
+ export function planMigrationHandler(opts) {
26
+ return planMigration(opts);
27
+ }
28
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/migrations/handlers/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,MAAM,UAAU,oBAAoB,CAClC,IAAuB;IAEvB,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * `stubMigrationHandler(opts)` — handler wrapper around the
3
+ * stub-content generator (v0.8 Step 10).
4
+ *
5
+ * Forwards directly to `stubMigration` from `../stub.js`. Same role
6
+ * as `planMigrationHandler` and `verifyMigrationsHandler` — a
7
+ * uniform four-handler surface for the CLI plus a future seam for
8
+ * cross-cutting concerns. In v0.8 it is a thin pass-through.
9
+ *
10
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
11
+ * `console.*`. The stub is *generated*, not *written* — file I/O
12
+ * is the CLI's responsibility (Step 23 will `mkdir -p` +
13
+ * `writeFile` against the returned `suggestedPath`, refusing to
14
+ * overwrite an existing file at that path).
15
+ *
16
+ * **Never invokes `migration.transform`** — the stub generator
17
+ * emits a transform-body skeleton in the file content string but
18
+ * does not execute anything.
19
+ */
20
+ import type { MigrationStubOpts, MigrationStubResult } from "../types.js";
21
+ export declare function stubMigrationHandler(opts: MigrationStubOpts): MigrationStubResult;
22
+ //# sourceMappingURL=stub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../../../src/migrations/handlers/stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,CAErB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `stubMigrationHandler(opts)` — handler wrapper around the
3
+ * stub-content generator (v0.8 Step 10).
4
+ *
5
+ * Forwards directly to `stubMigration` from `../stub.js`. Same role
6
+ * as `planMigrationHandler` and `verifyMigrationsHandler` — a
7
+ * uniform four-handler surface for the CLI plus a future seam for
8
+ * cross-cutting concerns. In v0.8 it is a thin pass-through.
9
+ *
10
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
11
+ * `console.*`. The stub is *generated*, not *written* — file I/O
12
+ * is the CLI's responsibility (Step 23 will `mkdir -p` +
13
+ * `writeFile` against the returned `suggestedPath`, refusing to
14
+ * overwrite an existing file at that path).
15
+ *
16
+ * **Never invokes `migration.transform`** — the stub generator
17
+ * emits a transform-body skeleton in the file content string but
18
+ * does not execute anything.
19
+ */
20
+ import { stubMigration } from "../stub.js";
21
+ export function stubMigrationHandler(opts) {
22
+ return stubMigration(opts);
23
+ }
24
+ //# sourceMappingURL=stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../../../src/migrations/handlers/stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAM3C,MAAM,UAAU,oBAAoB,CAClC,IAAuB;IAEvB,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `verifyMigrationsHandler(opts)` — handler wrapper around the
3
+ * provenance verifier (v0.8 Step 9).
4
+ *
5
+ * Forwards directly to `verifyMigrationProvenance` from
6
+ * `../verify-provenance.js`. Same role as
7
+ * `planMigrationHandler` — a uniform four-handler surface for the
8
+ * CLI plus a future seam for cross-cutting concerns. In v0.8 it is
9
+ * a thin pass-through.
10
+ *
11
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
12
+ * `console.*`. **Never invokes `migration.transform`** —
13
+ * verification is a `provenance-says-what-it-says` check, not a
14
+ * behavior check. Transform execution is deferred to v0.9+.
15
+ *
16
+ * The verifier never throws (provenance verification is
17
+ * structural; mismatches surface as `drift` /
18
+ * `missing_endpoint` verdicts on the failure branch). Even so the
19
+ * wrapper does not catch — any future throw from upstream code
20
+ * propagates to the CLI dispatcher (Step 22) and the locked
21
+ * fail-loud discipline.
22
+ */
23
+ import type { MigrationVerifyOpts, MigrationVerifyResult } from "../types.js";
24
+ export declare function verifyMigrationsHandler(opts: MigrationVerifyOpts): MigrationVerifyResult;
25
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../src/migrations/handlers/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,mBAAmB,GACxB,qBAAqB,CAEvB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `verifyMigrationsHandler(opts)` — handler wrapper around the
3
+ * provenance verifier (v0.8 Step 9).
4
+ *
5
+ * Forwards directly to `verifyMigrationProvenance` from
6
+ * `../verify-provenance.js`. Same role as
7
+ * `planMigrationHandler` — a uniform four-handler surface for the
8
+ * CLI plus a future seam for cross-cutting concerns. In v0.8 it is
9
+ * a thin pass-through.
10
+ *
11
+ * **Pure.** No filesystem, no `import()`, no `process.*`, no
12
+ * `console.*`. **Never invokes `migration.transform`** —
13
+ * verification is a `provenance-says-what-it-says` check, not a
14
+ * behavior check. Transform execution is deferred to v0.9+.
15
+ *
16
+ * The verifier never throws (provenance verification is
17
+ * structural; mismatches surface as `drift` /
18
+ * `missing_endpoint` verdicts on the failure branch). Even so the
19
+ * wrapper does not catch — any future throw from upstream code
20
+ * propagates to the CLI dispatcher (Step 22) and the locked
21
+ * fail-loud discipline.
22
+ */
23
+ import { verifyMigrationProvenance } from "../verify-provenance.js";
24
+ export function verifyMigrationsHandler(opts) {
25
+ return verifyMigrationProvenance(opts);
26
+ }
27
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../../src/migrations/handlers/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAMpE,MAAM,UAAU,uBAAuB,CACrC,IAAyB;IAEzB,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Provenance parser for `*.migration.ts` files (v0.8 Step 2).
3
+ *
4
+ * Reads the migration-header metadata out of an authored migration
5
+ * file so `buildMigrationRegistry` can index by
6
+ * `(schemaId, fromVersion, toVersion)` and `verifyMigrationProvenance`
7
+ * can compare the recorded hashes against the current schema
8
+ * registry. Migration files use **JSDoc-only** carriers — there is
9
+ * no JSON variant because migrations are TypeScript modules, not
10
+ * data documents.
11
+ *
12
+ * Expected header shape (generated by the v0.8 stub generator;
13
+ * humans edit the body, not the header):
14
+ *
15
+ * /**
16
+ * * @migration by @nekostack/schema
17
+ * * schemaId: com.x.User
18
+ * * fromVersion: 1.0.0
19
+ * * toVersion: 2.0.0
20
+ * * fromIrHash: sha256:<64-hex>
21
+ * * toIrHash: sha256:<64-hex>
22
+ * * fromSourceHash: sha256:<64-hex>
23
+ * * toSourceHash: sha256:<64-hex>
24
+ * * generator: neko-schema-migrate-stub
25
+ * * generatorVersion: @nekostack/schema@0.8.0
26
+ * *
27
+ * * DO NOT REMOVE THE HEADER. Authors EDIT THE BODY.
28
+ * * /
29
+ *
30
+ * The function is **pure**: no `fs.*`, no `import()`, no path
31
+ * argument, no module evaluation. The CLI reads the migration file
32
+ * text from disk and hands it in; this module parses and returns.
33
+ * Master plan Decision #1 boundary applies.
34
+ *
35
+ * **Fail-loud, never silent** (v0.8 Round-2 lock — intentional
36
+ * departure from v0.7 Decision #5). A `.migration.ts` file exists
37
+ * specifically to declare a `(schemaId, fromVersion, toVersion)`
38
+ * transition. Missing or malformed provenance is treated as an
39
+ * invalid declaration, not a "skip and continue" condition.
40
+ * Malformed input surfaces as `Result<...>` failure with one
41
+ * `integrity_error` `Issue` whose `metadata.reason` records the
42
+ * sub-mode (`missing_migration_provenance`, `missing_field`,
43
+ * `malformed_hash`, `malformed_field`, `unknown_format`).
44
+ *
45
+ * The shape of `reason` deliberately overlaps with the v0.7
46
+ * provenance-parser reasons where the failure mode is the same —
47
+ * a missing JSDoc block reads identically in both worlds, so
48
+ * `missing_provenance` would have worked, but the migration-specific
49
+ * `missing_migration_provenance` name lets downstream consumers
50
+ * disambiguate without parsing `message`.
51
+ */
52
+ import type { Result } from "../errors/issue.js";
53
+ /**
54
+ * Parsed migration provenance fields. All fields are required —
55
+ * unlike v0.7's `ParsedProvenance` which tolerates v0.6-era artifacts
56
+ * missing `sourceHash`, the migration carrier has no backward-
57
+ * compatibility window. v0.8 is the first phase that emits migration
58
+ * files; every header it emits carries all four hashes.
59
+ */
60
+ export interface ParsedMigrationProvenance {
61
+ readonly generator: string;
62
+ readonly generatorVersion: string;
63
+ readonly schemaId: string;
64
+ readonly fromVersion: string;
65
+ readonly toVersion: string;
66
+ readonly fromIrHash: `sha256:${string}`;
67
+ readonly toIrHash: `sha256:${string}`;
68
+ readonly fromSourceHash: `sha256:${string}`;
69
+ readonly toSourceHash: `sha256:${string}`;
70
+ }
71
+ /**
72
+ * Parse the migration JSDoc header out of a migration file's text
73
+ * content. Returns `Result.success` with the parsed fields on a
74
+ * valid header, `Result.failure` with an `integrity_error` `Issue`
75
+ * on every failure mode.
76
+ */
77
+ export declare function parseMigrationProvenanceFromText(content: string): Result<ParsedMigrationProvenance>;
78
+ //# sourceMappingURL=parse-provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-provenance.d.ts","sourceRoot":"","sources":["../../../src/migrations/parse-provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAS,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,UAAU,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,UAAU,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,UAAU,MAAM,EAAE,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,yBAAyB,CAAC,CASnC"}