@prisma-next/migration-tools 0.11.0-dev.5 → 0.11.0-dev.50

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 (133) hide show
  1. package/README.md +4 -4
  2. package/dist/{errors-DGYwcwXs.mjs → errors-4YabujxZ.mjs} +15 -21
  3. package/dist/errors-4YabujxZ.mjs.map +1 -0
  4. package/dist/exports/aggregate.d.mts +275 -179
  5. package/dist/exports/aggregate.d.mts.map +1 -1
  6. package/dist/exports/aggregate.mjs +363 -184
  7. package/dist/exports/aggregate.mjs.map +1 -1
  8. package/dist/exports/enumerate-migration-spaces.d.mts +53 -0
  9. package/dist/exports/enumerate-migration-spaces.d.mts.map +1 -0
  10. package/dist/exports/enumerate-migration-spaces.mjs +107 -0
  11. package/dist/exports/enumerate-migration-spaces.mjs.map +1 -0
  12. package/dist/exports/errors.d.mts +2 -2
  13. package/dist/exports/errors.d.mts.map +1 -1
  14. package/dist/exports/errors.mjs +1 -1
  15. package/dist/exports/graph.d.mts +1 -1
  16. package/dist/exports/hash.d.mts +8 -9
  17. package/dist/exports/hash.d.mts.map +1 -1
  18. package/dist/exports/hash.mjs +1 -1
  19. package/dist/exports/invariants.d.mts +1 -1
  20. package/dist/exports/invariants.d.mts.map +1 -1
  21. package/dist/exports/invariants.mjs +1 -1
  22. package/dist/exports/io.d.mts +2 -83
  23. package/dist/exports/io.mjs +1 -1
  24. package/dist/exports/metadata.d.mts +2 -2
  25. package/dist/exports/migration-graph.d.mts +9 -2
  26. package/dist/exports/migration-graph.d.mts.map +1 -0
  27. package/dist/exports/migration-graph.mjs +16 -2
  28. package/dist/exports/migration-graph.mjs.map +1 -0
  29. package/dist/exports/migration-list-graph-topology.d.mts +13 -0
  30. package/dist/exports/migration-list-graph-topology.d.mts.map +1 -0
  31. package/dist/exports/migration-list-graph-topology.mjs +105 -0
  32. package/dist/exports/migration-list-graph-topology.mjs.map +1 -0
  33. package/dist/exports/migration-list-types.d.mts +2 -0
  34. package/dist/exports/migration-list-types.mjs +1 -0
  35. package/dist/exports/migration-ts.d.mts.map +1 -1
  36. package/dist/exports/migration-ts.mjs.map +1 -1
  37. package/dist/exports/migration.d.mts +5 -6
  38. package/dist/exports/migration.d.mts.map +1 -1
  39. package/dist/exports/migration.mjs +14 -32
  40. package/dist/exports/migration.mjs.map +1 -1
  41. package/dist/exports/package.d.mts +1 -1
  42. package/dist/exports/ref-resolution.d.mts +2 -2
  43. package/dist/exports/ref-resolution.d.mts.map +1 -1
  44. package/dist/exports/ref-resolution.mjs +1 -1
  45. package/dist/exports/ref-resolution.mjs.map +1 -1
  46. package/dist/exports/refs.d.mts +15 -2
  47. package/dist/exports/refs.d.mts.map +1 -0
  48. package/dist/exports/refs.mjs +137 -2
  49. package/dist/exports/refs.mjs.map +1 -0
  50. package/dist/exports/spaces.d.mts +31 -132
  51. package/dist/exports/spaces.d.mts.map +1 -1
  52. package/dist/exports/spaces.mjs +14 -9
  53. package/dist/exports/spaces.mjs.map +1 -1
  54. package/dist/{graph-BrLXqoUc.d.mts → graph-BUZuUeBC.d.mts} +1 -2
  55. package/dist/graph-BUZuUeBC.d.mts.map +1 -0
  56. package/dist/{hash-Cr4WIr4Z.mjs → hash--Y7vCpN3.mjs} +8 -9
  57. package/dist/hash--Y7vCpN3.mjs.map +1 -0
  58. package/dist/{invariants-0daYEzyo.mjs → invariants-CCOAyg6c.mjs} +2 -2
  59. package/dist/{invariants-0daYEzyo.mjs.map → invariants-CCOAyg6c.mjs.map} +1 -1
  60. package/dist/{io-BPLfzvZe.mjs → io-BHl0amF0.mjs} +100 -13
  61. package/dist/io-BHl0amF0.mjs.map +1 -0
  62. package/dist/io-nqFXSSTN.d.mts +124 -0
  63. package/dist/io-nqFXSSTN.d.mts.map +1 -0
  64. package/dist/metadata-Bp9X04gM.d.mts +2 -0
  65. package/dist/{migration-graph-De0dUZoC.d.mts → migration-graph-DtNT-cqc.d.mts} +6 -6
  66. package/dist/migration-graph-DtNT-cqc.d.mts.map +1 -0
  67. package/dist/{migration-graph-nlS4TRpn.mjs → migration-graph-kGBkIZDa.mjs} +6 -26
  68. package/dist/migration-graph-kGBkIZDa.mjs.map +1 -0
  69. package/dist/migration-list-types-BRTuXR8i.d.mts +23 -0
  70. package/dist/migration-list-types-BRTuXR8i.d.mts.map +1 -0
  71. package/dist/op-schema-D5qkXfEf.mjs.map +1 -1
  72. package/dist/{package-DZj8YvD0.d.mts → package-DIttKL7X.d.mts} +1 -1
  73. package/dist/package-DIttKL7X.d.mts.map +1 -0
  74. package/dist/read-contract-space-contract-BS5Oxbgw.mjs +82 -0
  75. package/dist/read-contract-space-contract-BS5Oxbgw.mjs.map +1 -0
  76. package/dist/{refs-BDHo5l_g.mjs → refs-BBKNL45K.mjs} +76 -4
  77. package/dist/refs-BBKNL45K.mjs.map +1 -0
  78. package/dist/{refs-CDaNerhT.d.mts → refs-C8f2IGM8.d.mts} +12 -2
  79. package/dist/refs-C8f2IGM8.d.mts.map +1 -0
  80. package/dist/{read-contract-space-contract-DRueB4Aa.mjs → verify-contract-spaces-BJX5gqtD.mjs} +32 -80
  81. package/dist/verify-contract-spaces-BJX5gqtD.mjs.map +1 -0
  82. package/dist/verify-contract-spaces-T0aiJlBS.d.mts +132 -0
  83. package/dist/verify-contract-spaces-T0aiJlBS.d.mts.map +1 -0
  84. package/package.json +18 -6
  85. package/src/aggregate/aggregate.ts +90 -0
  86. package/src/aggregate/check-integrity.ts +243 -0
  87. package/src/aggregate/loader.ts +156 -334
  88. package/src/aggregate/planner.ts +8 -6
  89. package/src/aggregate/project-schema-to-space.ts +1 -1
  90. package/src/aggregate/strategies/graph-walk.ts +12 -7
  91. package/src/aggregate/strategies/synth.ts +2 -2
  92. package/src/aggregate/types.ts +56 -64
  93. package/src/aggregate/verifier.ts +6 -4
  94. package/src/assert-descriptor-self-consistency.ts +6 -0
  95. package/src/compute-extension-space-apply-path.ts +1 -1
  96. package/src/emit-contract-space-artefacts.ts +4 -3
  97. package/src/enumerate-migration-spaces.ts +127 -0
  98. package/src/errors.ts +17 -2
  99. package/src/exports/aggregate.ts +17 -12
  100. package/src/exports/enumerate-migration-spaces.ts +4 -0
  101. package/src/exports/io.ts +2 -0
  102. package/src/exports/metadata.ts +1 -1
  103. package/src/exports/migration-graph.ts +1 -0
  104. package/src/exports/migration-list-graph-topology.ts +5 -0
  105. package/src/exports/migration-list-types.ts +5 -0
  106. package/src/exports/refs.ts +8 -0
  107. package/src/exports/spaces.ts +3 -0
  108. package/src/graph-membership.ts +17 -0
  109. package/src/graph.ts +0 -1
  110. package/src/hash.ts +7 -8
  111. package/src/integrity-violation.ts +114 -0
  112. package/src/io.ts +139 -14
  113. package/src/metadata.ts +1 -1
  114. package/src/migration-base.ts +10 -30
  115. package/src/migration-graph.ts +7 -35
  116. package/src/migration-list-graph-topology.ts +158 -0
  117. package/src/migration-list-types.ts +21 -0
  118. package/src/read-contract-space-head-ref.ts +5 -2
  119. package/src/refs/snapshot.ts +197 -0
  120. package/src/refs.ts +97 -1
  121. package/src/space-layout.ts +30 -0
  122. package/dist/errors-DGYwcwXs.mjs.map +0 -1
  123. package/dist/exports/io.d.mts.map +0 -1
  124. package/dist/graph-BrLXqoUc.d.mts.map +0 -1
  125. package/dist/hash-Cr4WIr4Z.mjs.map +0 -1
  126. package/dist/io-BPLfzvZe.mjs.map +0 -1
  127. package/dist/metadata-BFX0xdz8.d.mts +0 -2
  128. package/dist/migration-graph-De0dUZoC.d.mts.map +0 -1
  129. package/dist/migration-graph-nlS4TRpn.mjs.map +0 -1
  130. package/dist/package-DZj8YvD0.d.mts.map +0 -1
  131. package/dist/read-contract-space-contract-DRueB4Aa.mjs.map +0 -1
  132. package/dist/refs-BDHo5l_g.mjs.map +0 -1
  133. package/dist/refs-CDaNerhT.d.mts.map +0 -1
@@ -1,220 +1,316 @@
1
- import { n as OnDiskMigrationPackage } from "../package-DZj8YvD0.mjs";
2
- import { n as MigrationGraph } from "../graph-BrLXqoUc.mjs";
3
- import { t as PathDecision } from "../migration-graph-De0dUZoC.mjs";
4
- import { Result } from "@prisma-next/utils/result";
1
+ import { n as OnDiskMigrationPackage } from "../package-DIttKL7X.mjs";
2
+ import { n as RefLoadProblem, r as Refs } from "../refs-C8f2IGM8.mjs";
3
+ import { t as ContractSpaceHeadRecord } from "../verify-contract-spaces-T0aiJlBS.mjs";
4
+ import { n as MigrationGraph } from "../graph-BUZuUeBC.mjs";
5
+ import { t as PackageLoadProblem } from "../io-nqFXSSTN.mjs";
6
+ import { t as PathDecision } from "../migration-graph-DtNT-cqc.mjs";
5
7
  import { ControlFamilyInstance, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, TargetMigrationsCapability } from "@prisma-next/framework-components/control";
8
+ import { Result } from "@prisma-next/utils/result";
6
9
  import { Contract } from "@prisma-next/contract/types";
7
10
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
8
11
 
9
- //#region src/aggregate/types.d.ts
12
+ //#region src/integrity-violation.d.ts
13
+ /**
14
+ * Every structural problem the migration model can carry.
15
+ *
16
+ * Violations come in three groups:
17
+ *
18
+ * - **Recoverable**: the package or space is retained in the model;
19
+ * the violation is surfaced for policy (report, refuse, or ignore
20
+ * depending on the command).
21
+ * - **Config/contract-dependent**: produced only when the matching
22
+ * `IntegrityQueryOptions` opt is set (declaredExtensions /
23
+ * checkContracts). The model is built without them; they surface
24
+ * when the caller explicitly asks for the broader integrity view.
25
+ * - **Unloadable**: the package is omitted from the model entirely
26
+ * (its on-disk content cannot be parsed into an `OnDiskMigrationPackage`).
27
+ *
28
+ * `checkIntegrity()` on `ContractSpaceAggregate` returns the full set —
29
+ * all violations across all spaces — never bailing at the first hit.
30
+ */
31
+ type IntegrityViolation = {
32
+ readonly kind: 'sameSourceAndTarget';
33
+ readonly spaceId: string;
34
+ readonly dirName: string;
35
+ readonly hash: string;
36
+ } | {
37
+ readonly kind: 'hashMismatch';
38
+ readonly spaceId: string;
39
+ readonly dirName: string;
40
+ readonly stored: string;
41
+ readonly computed: string;
42
+ } | {
43
+ readonly kind: 'providedInvariantsMismatch';
44
+ readonly spaceId: string;
45
+ readonly dirName: string;
46
+ } | {
47
+ readonly kind: 'headRefMissing';
48
+ readonly spaceId: string;
49
+ } | {
50
+ readonly kind: 'headRefNotInGraph';
51
+ readonly spaceId: string;
52
+ readonly hash: string;
53
+ } | {
54
+ readonly kind: 'duplicateMigrationHash';
55
+ readonly spaceId: string;
56
+ readonly migrationHash: string;
57
+ readonly dirNames: readonly string[];
58
+ } | {
59
+ readonly kind: 'refUnreadable';
60
+ readonly spaceId: string;
61
+ readonly refName: string;
62
+ readonly detail: string;
63
+ } | {
64
+ readonly kind: 'orphanSpaceDir';
65
+ readonly spaceId: string;
66
+ } | {
67
+ readonly kind: 'declaredButUnmigrated';
68
+ readonly spaceId: string;
69
+ } | {
70
+ readonly kind: 'targetMismatch';
71
+ readonly spaceId: string;
72
+ readonly expected: string;
73
+ readonly actual: string;
74
+ } | {
75
+ readonly kind: 'disjointness';
76
+ readonly element: string;
77
+ readonly claimedBy: readonly string[];
78
+ } | {
79
+ readonly kind: 'contractUnreadable';
80
+ readonly spaceId: string;
81
+ readonly detail: string;
82
+ } | {
83
+ readonly kind: 'packageUnloadable';
84
+ readonly spaceId: string;
85
+ readonly dirName: string;
86
+ readonly detail: string;
87
+ };
10
88
  /**
11
- * Hydrated migration graph for a single contract space.
12
- *
13
- * `graph` is the structural shortest-path graph (forward / reverse chain,
14
- * deterministic tie-break order) reconstructed from a set of on-disk
15
- * migration packages. `packagesByMigrationHash` is the lookup table the
16
- * graph-walk strategy uses to resolve a path's edge sequence back to the
17
- * concrete `OnDiskMigrationPackage` (and therefore the operation list) for
18
- * apply.
19
- *
20
- * Eagerly hydrated by the loader. Once a `ContractSpaceAggregate` exists,
21
- * downstream consumers do **not** touch the filesystem to walk graphs or
22
- * resolve packages — the aggregate is the boundary.
89
+ * One declared extension entry, drawn from `Config.extensionPacks`.
90
+ *
91
+ * The integrity layer needs only:
92
+ *
93
+ * - `id` the space id (also the directory name under `migrations/`),
94
+ * used for the layout-drift checks (`orphanSpaceDir` /
95
+ * `declaredButUnmigrated`).
96
+ * - `targetId` — the target the declaring extension was configured for.
97
+ *
98
+ * Typed structurally so the migration-tools layer stays framework-neutral.
23
99
  */
24
- interface HydratedMigrationGraph {
25
- readonly graph: MigrationGraph;
26
- readonly packagesByMigrationHash: ReadonlyMap<string, OnDiskMigrationPackage>;
100
+ interface DeclaredExtensionEntry {
101
+ readonly id: string;
102
+ readonly targetId: string;
27
103
  }
104
+ /**
105
+ * Options controlling which config/contract-dependent violation checks
106
+ * `checkIntegrity()` runs.
107
+ *
108
+ * Both opts default to disabled: a caller without the app contract or
109
+ * declared extensions still gets the structurally-derivable violations
110
+ * (hashMismatch, providedInvariantsMismatch, headRefMissing,
111
+ * headRefNotInGraph, refUnreadable, sameSourceAndTarget, packageUnloadable).
112
+ */
113
+ interface IntegrityQueryOptions {
114
+ /**
115
+ * When provided, enables layout-drift checks: `orphanSpaceDir`
116
+ * (a directory exists on disk for an extension not in the list) and
117
+ * `declaredButUnmigrated` (an extension in the list has no on-disk dir).
118
+ */
119
+ readonly declaredExtensions?: readonly DeclaredExtensionEntry[];
120
+ /**
121
+ * When true, enables contract/disjointness/target checks:
122
+ * `contractUnreadable`, `targetMismatch`, `disjointness`.
123
+ */
124
+ readonly checkContracts?: boolean;
125
+ }
126
+ //#endregion
127
+ //#region src/aggregate/types.d.ts
28
128
  /**
29
129
  * One contract space — app or extension — as a member of a
30
130
  * {@link ContractSpaceAggregate}. Every member has the same shape.
31
131
  *
132
+ * A member is a tolerant snapshot of one space's on-disk state, not a
133
+ * validated value: `packages` is the raw migration-package list as read
134
+ * from disk (a hash- or invariants-mismatched package is retained here;
135
+ * a genuinely unparseable one is omitted), and integrity is judged
136
+ * separately by {@link ContractSpaceAggregate.checkIntegrity}.
137
+ *
32
138
  * - `spaceId`: `'app'` for the application, otherwise the extension's
33
139
  * id (validated against `[a-z][a-z0-9_-]{0,63}`).
34
- * - `contract`: the validated contract value for this member. For the
35
- * app, the user's authored contract; for an extension, the on-disk
36
- * `migrations/<spaceId>/contract.json`. Both have already passed the
37
- * family's `deserializeContract` at the loader boundary.
38
- * - `headRef.hash`: the storage hash this member is targeting. For the
39
- * app, equals `contract.storage.storageHash`. For extensions, the
40
- * on-disk `refs/head.json.hash`.
41
- * - `headRef.invariants`: alphabetically sorted, deduplicated invariant
42
- * ids declared on the head ref. Empty for the app member (the app's
43
- * plan is synthesised from the contract IR, no invariants required).
44
- * - `migrations`: the hydrated migration graph for this space. Possibly
45
- * empty (an extension whose on-disk head ref points at the
46
- * empty-contract sentinel and ships no migrations yet, or the app
47
- * when the user hasn't authored any).
140
+ * - `packages`: raw on-disk migration packages, as read; never
141
+ * integrity-validated at load.
142
+ * - `refs`: the user-authored refs under `migrations/<spaceId>/refs/*.json`.
143
+ * - `headRef`: the system head ref read from
144
+ * `migrations/<spaceId>/refs/head.json`, or `null` when absent
145
+ * (represented as a `headRefMissing` violation, never fatal). The app
146
+ * member's head ref is always synthesised from its live contract's
147
+ * storage hash, so it is never `null`.
148
+ * - `graph()`: the migration graph this space's packages induce
149
+ * lazily reconstructed on first call and memoised. Pure structure: a
150
+ * `from === to` self-edge is represented, not rejected.
151
+ * - `contract()`: the deserialized contract for this member lazily
152
+ * produced on first call and memoised. For the app it is the live
153
+ * contract the caller supplied; for an extension it is the on-disk
154
+ * `migrations/<spaceId>/contract.json` run through the family's
155
+ * `deserializeContract`. Throws if the on-disk contract is missing or
156
+ * undeserializable (surfaced as `contractUnreadable` by `checkIntegrity`
157
+ * under `checkContracts`); callers gate before querying it.
48
158
  */
49
159
  interface ContractSpaceMember {
50
160
  readonly spaceId: string;
51
- readonly contract: Contract;
52
- readonly headRef: {
53
- readonly hash: string;
54
- readonly invariants: readonly string[];
55
- };
56
- readonly migrations: HydratedMigrationGraph;
161
+ readonly packages: readonly OnDiskMigrationPackage[];
162
+ readonly refs: Refs;
163
+ readonly headRef: ContractSpaceHeadRecord | null;
164
+ graph(): MigrationGraph;
165
+ contract(): Contract;
57
166
  }
58
167
  /**
59
- * Typed value carrying the user's app contract plus every loaded
60
- * extension contract space, fully hydrated and internally consistent.
168
+ * Tolerant, queryable snapshot of a project's on-disk migration state:
169
+ * the app contract space plus every extension contract space, each a
170
+ * {@link ContractSpaceMember}.
61
171
  *
62
172
  * Produced once per CLI invocation by `loadContractSpaceAggregate`.
63
- * Every downstream component (planner, verifier, runner adapter)
64
- * consumes this value rather than rebuilding state from disk.
65
- *
66
- * Invariants the loader enforces at construction:
67
- *
68
- * 1. `targetId` is consistent across every member (`contract.target`
69
- * matches `aggregate.targetId`). The aggregate's `targetId` is the
70
- * `Config.adapter.targetId` value the loader was told to use.
71
- * 2. `aggregate.extensions` is sorted alphabetically by `spaceId`.
72
- * Mirrors {@link import('../concatenate-space-apply-inputs').concatenateSpaceApplyInputs}'s
73
- * extension ordering convention so downstream apply order matches
74
- * today's behaviour byte-for-byte.
75
- * 3. No two members claim the same storage element (table / type / etc.).
76
- * 4. For each extension member: `member.headRef.hash` is reachable from
77
- * the empty-contract sentinel in `member.migrations.graph` (or the
78
- * graph is empty and `member.headRef.hash === EMPTY_CONTRACT_HASH`).
79
- * 5. For the app member: `member.headRef.hash` equals
80
- * `member.contract.storage.storageHash`. The app's `migrations`
81
- * is hydrated from the user's authored `migrations/` (or empty if
82
- * none).
83
- *
84
- * The aggregate is **type-uniform** post-construction: app/extension
85
- * distinguishability survives only at the caller-policy layer
86
- * (`ignoreGraphFor: new Set([appSpaceId])`), not on member shape.
173
+ * Building the aggregate never throws on disk content; every consumer
174
+ * obtains spaces / packages / refs / graphs from this one value rather
175
+ * than re-deriving them from disk.
176
+ *
177
+ * - `targetId`: the app contract's target; every member is expected to
178
+ * share it (a mismatch surfaces as a `targetMismatch` violation under
179
+ * `checkContracts`).
180
+ * - `app` / `extensions`: retained as fields for the existing planner /
181
+ * verifier / runner consumers. `extensions` is sorted alphabetically
182
+ * by `spaceId` (the apply-ordering convention).
183
+ * - `listSpaces()` / `hasSpace()` / `space()` / `spaces()`: the query
184
+ * surface the read commands consume — `app` first, then extension ids
185
+ * lex-ascending.
186
+ * - `checkIntegrity()`: judges the loaded model and returns every
187
+ * violation (never bailing at the first). Config/contract-dependent
188
+ * checks run only when the matching {@link IntegrityQueryOptions} opt
189
+ * is set.
87
190
  */
88
191
  interface ContractSpaceAggregate {
89
192
  readonly targetId: string;
90
193
  readonly app: ContractSpaceMember;
91
194
  readonly extensions: readonly ContractSpaceMember[];
195
+ listSpaces(): readonly string[];
196
+ hasSpace(id: string): boolean;
197
+ space(id: string): ContractSpaceMember | undefined;
198
+ spaces(): readonly ContractSpaceMember[];
199
+ checkIntegrity(opts?: IntegrityQueryOptions): readonly IntegrityViolation[];
92
200
  }
93
201
  //#endregion
94
- //#region src/aggregate/loader.d.ts
202
+ //#region src/aggregate/aggregate.d.ts
95
203
  /**
96
- * Single declared extension entry the loader needs from `Config.extensionPacks`.
97
- *
98
- * Only the subset of fields the loader operates on:
99
- *
100
- * - `id` the space id (also the directory name under `migrations/`).
101
- * - `targetId` the configured `Config.adapter.targetId` value the
102
- * declaring extension declared. The loader rejects mismatches against
103
- * the aggregate's `targetId` with `targetMismatch`.
104
- *
105
- * Whether the descriptor declares a contract space is decided by whether
106
- * its corresponding `migrations/<id>/` directory exists on disk
107
- * (materialised by the seed phase before the loader runs); the loader
108
- * never reads the descriptor's `contractJson` itself. That makes the
109
- * aggregate's apply / verify paths byte-for-byte independent of the
110
- * descriptor module — `db verify` succeeds even if the descriptor's
111
- * `contractJson` is a throwing getter.
112
- *
113
- * Typed structurally so the migration-tools layer stays framework-neutral.
204
+ * Resolve a member's head ref, asserting it is present. The apply/verify
205
+ * engine only runs after `checkIntegrity` has refused on `headRefMissing`,
206
+ * so a member reaching the planner / verifier without a head ref is a
207
+ * programming error (the integrity gate was skipped), not a user-facing
208
+ * state. The app member's head ref is always synthesised, so this only
209
+ * ever guards an ungated extension space.
114
210
  */
115
- interface DeclaredExtensionEntry {
116
- readonly id: string;
117
- readonly targetId: string;
118
- }
211
+ declare function requireHeadRef(member: ContractSpaceMember): ContractSpaceHeadRecord;
119
212
  /**
120
- * Inputs for {@link loadContractSpaceAggregate}.
121
- *
122
- * The loader is the **sole** descriptor-import boundary in the M2.5
123
- * pipeline: callers gather the descriptor data (already-validated app
124
- * contract, declared extension entries) and pass it through. Once the
125
- * loader returns, no descriptor module is imported again for this
126
- * aggregate's lifetime.
213
+ * Build a {@link ContractSpaceMember} with lazily-memoised `graph()` and
214
+ * `contract()` facets.
215
+ *
216
+ * `graph()` reconstructs the migration graph from `packages` on first
217
+ * call and caches it. `contract()` calls `resolveContract` on first call
218
+ * and caches the result; a throwing `resolveContract` (e.g. a missing or
219
+ * undeserializable on-disk contract) re-throws on each call rather than
220
+ * caching a value — `checkIntegrity` surfaces that as `contractUnreadable`.
127
221
  */
128
- interface LoadAggregateInput {
222
+ declare function createContractSpaceMember(args: {
223
+ readonly spaceId: string;
224
+ readonly packages: readonly OnDiskMigrationPackage[];
225
+ readonly refs: Refs;
226
+ readonly headRef: ContractSpaceHeadRecord | null;
227
+ readonly resolveContract: () => Contract;
228
+ }): ContractSpaceMember;
229
+ /**
230
+ * Assemble a {@link ContractSpaceAggregate} value from its members and a
231
+ * `checkIntegrity` implementation. The query methods (`listSpaces` /
232
+ * `hasSpace` / `space` / `spaces`) are derived here so every aggregate —
233
+ * loader-built or test-built — shares one query surface: `app` first,
234
+ * then `extensions` in the order supplied (the loader sorts them
235
+ * lex-ascending by `spaceId`).
236
+ */
237
+ declare function createContractSpaceAggregate(args: {
129
238
  readonly targetId: string;
130
- readonly migrationsDir: string;
131
- readonly appContract: Contract;
132
- readonly declaredExtensions: ReadonlyArray<DeclaredExtensionEntry>;
133
- readonly deserializeContract: (contractJson: unknown) => Contract;
239
+ readonly app: ContractSpaceMember;
240
+ readonly extensions: readonly ContractSpaceMember[];
241
+ readonly checkIntegrity: (opts?: IntegrityQueryOptions) => readonly IntegrityViolation[];
242
+ }): ContractSpaceAggregate;
243
+ //#endregion
244
+ //#region src/aggregate/check-integrity.d.ts
245
+ /**
246
+ * One space's load-time facts that `checkIntegrity` judges: the loaded
247
+ * member, the load-time problems `readMigrationsDir` surfaced for it, and
248
+ * whether it is the app space (the app head ref is synthesised, so the
249
+ * head-ref checks are skipped for it).
250
+ */
251
+ interface IntegritySpaceState {
252
+ readonly member: ContractSpaceMember;
253
+ readonly problems: readonly PackageLoadProblem[];
254
+ /** Per-ref problems: a user ref `*.json` that exists but is unparseable. */
255
+ readonly refProblems: readonly RefLoadProblem[];
134
256
  /**
135
- * Hydrated migration graph for the **app member**.
136
- *
137
- * The framework-neutral migration-tools layer doesn't know how to read
138
- * the user's authored `migrations/` directory (the app member's
139
- * migration-package layout is family-aware: ops.json shape, manifest
140
- * keys, etc.). Callers — the SQL family today — read the user's
141
- * `migrations/` and hand the resulting `OnDiskMigrationPackage[]` through.
142
- *
143
- * Passing `[]` is valid (greenfield project, no authored migrations).
144
- * Equivalent to `migrations/` not existing or being empty.
257
+ * The space's `refs/head.json` problem when it exists but is unparseable.
258
+ * `null` means the head ref was read cleanly or is genuinely absent —
259
+ * the absent case is judged `headRefMissing`, the corrupt case here is
260
+ * judged `refUnreadable` (and suppresses `headRefMissing`).
145
261
  */
146
- readonly appMigrationPackages: ReadonlyArray<OnDiskMigrationPackage>;
262
+ readonly headRefProblem: RefLoadProblem | null;
263
+ readonly isApp: boolean;
264
+ }
265
+ interface IntegrityComputationInput {
266
+ readonly targetId: string;
267
+ readonly spaces: readonly IntegritySpaceState[];
147
268
  }
148
269
  /**
149
- * Discriminated failure variants the loader emits.
150
- *
151
- * Every variant short-circuits at first hit; the loader does not keep
152
- * collecting after the first violation in any phase except for layout
153
- * (where every layout offence is bundled into one `layoutViolation`).
270
+ * Walk the loaded model and return **every** integrity violation — never
271
+ * bailing at the first. Structurally-derivable violations (load-time
272
+ * problems, self-edges, missing / unreachable head refs) are always
273
+ * produced; layout-drift checks require `declaredExtensions`, and
274
+ * contract / target / disjointness checks require `checkContracts`.
154
275
  */
155
- type LoadAggregateError = {
156
- readonly kind: 'layoutViolation';
157
- readonly violations: readonly LayoutViolation[];
158
- } | {
159
- readonly kind: 'integrityFailure';
160
- readonly spaceId: string;
161
- readonly detail: string;
162
- } | {
163
- readonly kind: 'validationFailure';
164
- readonly spaceId: string;
165
- readonly detail: string;
166
- } | {
167
- readonly kind: 'disjointnessViolation';
168
- readonly element: string;
169
- readonly claimedBy: readonly string[];
170
- } | {
171
- readonly kind: 'targetMismatch';
172
- readonly spaceId: string;
173
- readonly expected: string;
174
- readonly actual: string;
175
- };
276
+ declare function computeIntegrityViolations(input: IntegrityComputationInput, opts?: IntegrityQueryOptions): readonly IntegrityViolation[];
277
+ declare function loadProblemToViolation(spaceId: string, problem: PackageLoadProblem): IntegrityViolation;
278
+ //#endregion
279
+ //#region src/aggregate/loader.d.ts
176
280
  /**
177
- * Single layout violation; bundled into a `layoutViolation` error so
178
- * users see every layout offence at once rather than fixing them one
179
- * at a time across re-runs.
180
- *
181
- * - `declaredButUnmigrated`: extension declared in `extensionPacks` with
182
- * a `contractSpace` but no contract-space dir on disk. Remediation:
183
- * `prisma-next migrate`.
184
- * - `orphanSpaceDir`: contract-space dir under `migrations/` for an extension
185
- * not in `extensionPacks`. Remediation: remove the directory, or
186
- * re-add the extension to `extensionPacks`.
281
+ * Inputs for {@link loadContractSpaceAggregate}.
282
+ *
283
+ * Construction reads migration **state** from disk (`migrations/<space>/`
284
+ * packages + refs + head refs). The app's *live* contract is not a disk
285
+ * artefact in Prisma Next it is always compiled from the project's
286
+ * central contract, so the caller always has it and threads it in as
287
+ * `appContract`. `deserializeContract` is held and called lazily only for
288
+ * the on-disk extension contracts (`migrations/<ext>/contract.json`).
187
289
  */
188
- type LayoutViolation = {
189
- readonly kind: 'declaredButUnmigrated';
190
- readonly spaceId: string;
191
- } | {
192
- readonly kind: 'orphanSpaceDir';
193
- readonly spaceId: string;
194
- };
195
- type LoadAggregateOutput = Result<{
196
- readonly aggregate: ContractSpaceAggregate;
197
- }, LoadAggregateError>;
290
+ interface LoadAggregateInput {
291
+ readonly migrationsDir: string;
292
+ readonly deserializeContract: (raw: unknown) => Contract;
293
+ readonly appContract: Contract;
294
+ }
198
295
  /**
199
- * Hydrate a {@link ContractSpaceAggregate} from on-disk state and
200
- * the app contract value the caller supplies.
201
- *
202
- * The loader is the **only** descriptor-import boundary at apply /
203
- * verify time, but it intentionally does **not** read the extension
204
- * descriptor's `contractJson` value. Each extension space's contract
205
- * is read from its on-disk `migrations/<id>/contract.json` mirror; the
206
- * descriptor's role is exhausted by the seed phase that wrote that
207
- * mirror in the first place. The loader composes existing
208
- * migration-tools primitives layout precheck (via
209
- * {@link listContractSpaceDirectories}), integrity checks (via
210
- * {@link readMigrationsDir} / {@link readContractSpaceHeadRef} /
211
- * {@link readContractSpaceContract} / `deserializeContract`), and
212
- * disjointness into a single typed value.
213
- *
214
- * Failure semantics: every failure variant in {@link LoadAggregateError}
215
- * short-circuits the load.
296
+ * Build a tolerant, queryable {@link ContractSpaceAggregate} from on-disk
297
+ * migration state plus the caller's live app contract.
298
+ *
299
+ * Building **never throws on disk content**: a hash- or
300
+ * invariants-mismatched package is retained, an unparseable package is
301
+ * omitted, a missing extension head ref leaves `headRef: null`, and an
302
+ * unreadable on-disk contract defers its failure to `member.contract()`.
303
+ * Every such problem is judged by {@link ContractSpaceAggregate.checkIntegrity}
304
+ * rather than aborting the load. The only rejections are catastrophic I/O
305
+ * (a `migrations/` that exists but is unreadable for reasons other than
306
+ * absence).
307
+ *
308
+ * The app space's head ref is synthesised from the live contract's
309
+ * storage hash (the app contract is authored independently of the
310
+ * migration graph), and `app.contract()` returns the supplied contract.
311
+ * Extension spaces read their contract, refs, and head ref from disk.
216
312
  */
217
- declare function loadContractSpaceAggregate(input: LoadAggregateInput): Promise<LoadAggregateOutput>;
313
+ declare function loadContractSpaceAggregate(input: LoadAggregateInput): Promise<ContractSpaceAggregate>;
218
314
  //#endregion
219
315
  //#region src/aggregate/marker-types.d.ts
220
316
  /**
@@ -394,7 +490,7 @@ type AggregatePlannerOutput = Result<AggregatePlannerSuccess, AggregatePlannerEr
394
490
  * 1. If `callerPolicy.ignoreGraphFor.has(member.spaceId)`:
395
491
  * - If `member.headRef.invariants` is empty → synth.
396
492
  * - Else → `policyConflict` (synth cannot satisfy authored invariants).
397
- * 2. Else if `member.migrations.graph` is non-empty AND graph-walk
493
+ * 2. Else if `member.graph()` is non-empty AND graph-walk
398
494
  * succeeds → graph-walk.
399
495
  * 3. Else if `member.headRef.invariants` is empty → synth.
400
496
  * 4. Else → graph-walk failure → `extensionPathUnreachable` /
@@ -471,7 +567,7 @@ declare function projectSchemaToSpace(schema: unknown, member: ContractSpaceMemb
471
567
  /**
472
568
  * Outcome variants for the graph-walk strategy. Mirrors
473
569
  * {@link import('../../compute-extension-space-apply-path').ExtensionSpaceApplyPathOutcome}
474
- * but operates against the **already-hydrated** `member.migrations.graph`
570
+ * but operates against the member's lazily-reconstructed `graph()`
475
571
  * instead of re-reading from disk. The aggregate planner converts
476
572
  * these into {@link import('../planner-types').AggregatePlannerError}
477
573
  * variants.
@@ -620,5 +716,5 @@ type AggregateVerifierOutput<TSchemaResult> = Result<AggregateVerifierSuccess<TS
620
716
  */
621
717
  declare function verifyAggregate<TSchemaResult>(input: AggregateVerifierInput<TSchemaResult>): AggregateVerifierOutput<TSchemaResult>;
622
718
  //#endregion
623
- export { type AggregateCurrentDBState, type AggregateMigrationEdgeRef, type AggregatePerSpacePlan, type AggregatePlannerError, type AggregatePlannerInput, type AggregatePlannerOutput, type AggregatePlannerSuccess, type AggregateVerifierError, type AggregateVerifierInput, type AggregateVerifierOutput, type AggregateVerifierSuccess, type CallerPolicy, type ContractMarkerRecordLike, type ContractSpaceAggregate, type ContractSpaceMember, type DeclaredExtensionEntry, type GraphWalkOutcome, type GraphWalkStrategyInputs, type HydratedMigrationGraph, type LayoutViolation, type LoadAggregateError, type LoadAggregateInput, type LoadAggregateOutput, type MarkerCheckResult, type MarkerCheckSection, type OrphanElement, type SchemaCheckSection, graphWalkStrategy, loadContractSpaceAggregate, planAggregate, projectSchemaToSpace, verifyAggregate };
719
+ export { type AggregateCurrentDBState, type AggregateMigrationEdgeRef, type AggregatePerSpacePlan, type AggregatePlannerError, type AggregatePlannerInput, type AggregatePlannerOutput, type AggregatePlannerSuccess, type AggregateVerifierError, type AggregateVerifierInput, type AggregateVerifierOutput, type AggregateVerifierSuccess, type CallerPolicy, type ContractMarkerRecordLike, type ContractSpaceAggregate, type ContractSpaceMember, type DeclaredExtensionEntry, type GraphWalkOutcome, type GraphWalkStrategyInputs, type IntegrityComputationInput, type IntegrityQueryOptions, type IntegritySpaceState, type IntegrityViolation, type LoadAggregateInput, type MarkerCheckResult, type MarkerCheckSection, type OrphanElement, type SchemaCheckSection, computeIntegrityViolations, createContractSpaceAggregate, createContractSpaceMember, graphWalkStrategy, loadContractSpaceAggregate, loadProblemToViolation, planAggregate, projectSchemaToSpace, requireHeadRef, verifyAggregate };
624
720
  //# sourceMappingURL=aggregate.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate.d.mts","names":[],"sources":["../../src/aggregate/types.ts","../../src/aggregate/loader.ts","../../src/aggregate/marker-types.ts","../../src/aggregate/planner-types.ts","../../src/aggregate/planner.ts","../../src/aggregate/project-schema-to-space.ts","../../src/aggregate/strategies/graph-walk.ts","../../src/aggregate/verifier.ts"],"mappings":";;;;;;;;;;;;;;;AAkBA;;;;;;;;UAAiB,sBAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,SACP,uBAAA,EAAyB,WAAA,SAAoB,sBAAA;AAAA;;;;AAwBxD;;;;;;;;;;;;;;AAwCA;;;;UAxCiB,mBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA,EAAU,QAAA;EAAA,SACV,OAAA;IAAA,SACE,IAAA;IAAA,SACA,UAAA;EAAA;EAAA,SAEF,UAAA,EAAY,sBAAA;A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SAEA,IAAA;EAAA,SAAoC,OAAA;AAAA;AAAA,UAElC,kBAAA;EAAA,SACN,QAAA,EAAU,WAAA,SAAoB,iBAAA;EAAA,SAC9B,aAAA;IAAA,SACE,OAAA;IAAA,SACA,GAAA,EAAK,wBAAA;EAAA;AAAA;;;;;ANClB;;;;;;KMaY,aAAA;EAAA,SAA2B,IAAA;EAAA,SAAwB,IAAA;AAAA;AAAA,UAE9C,kBAAA;EAAA,SACN,QAAA,EAAU,WAAA,SAAoB,aAAA;ENd9B;;;;EAAA,SMmBA,cAAA,WAAyB,aAAA;AAAA;AAAA,UAGnB,wBAAA;EAAA,SACN,WAAA,EAAa,kBAAA;EAAA,SACb,WAAA,EAAa,kBAAA,CAAmB,aAAA;AAAA;AAAA,KAG/B,sBAAA;EAAA,SACD,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,KAGC,uBAAA,kBAAyC,MAAA,CACnD,wBAAA,CAAyB,aAAA,GACzB,sBAAA;;;;;;;;;;;;;;;;;;;;;;ANoBF;iBMKgB,eAAA,eAAA,CACd,KAAA,EAAO,sBAAA,CAAuB,aAAA,IAC7B,uBAAA,CAAwB,aAAA"}
1
+ {"version":3,"file":"aggregate.d.mts","names":[],"sources":["../../src/integrity-violation.ts","../../src/aggregate/types.ts","../../src/aggregate/aggregate.ts","../../src/aggregate/check-integrity.ts","../../src/aggregate/loader.ts","../../src/aggregate/marker-types.ts","../../src/aggregate/planner-types.ts","../../src/aggregate/planner.ts","../../src/aggregate/project-schema-to-space.ts","../../src/aggregate/strategies/graph-walk.ts","../../src/aggregate/verifier.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;KAAY,kBAAA;EAAA,SAGG,IAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,IAAA;AAAA;EAAA,SAGA,IAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,MAAA;EAAA,SACA,QAAA;AAAA;EAAA,SAGA,IAAA;EAAA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