@prisma/orm-toolchain 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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 (196) hide show
  1. package/README.md +1 -5
  2. package/dist/{aggregate-DLUJLq5Y.d.mts → aggregate-BpcQdygS.d.mts} +83 -36
  3. package/dist/aggregate-BpcQdygS.d.mts.map +1 -0
  4. package/dist/{aggregate-CPZB020V.mjs → aggregate-T_HG6gq6.mjs} +118 -57
  5. package/dist/aggregate-T_HG6gq6.mjs.map +1 -0
  6. package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs +1026 -0
  7. package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs.map +1 -0
  8. package/dist/cli-telemetry.d.mts +9 -8
  9. package/dist/cli-telemetry.d.mts.map +1 -1
  10. package/dist/cli-telemetry.mjs +30 -27
  11. package/dist/cli-telemetry.mjs.map +1 -1
  12. package/dist/cli.d.mts +7 -14
  13. package/dist/cli.d.mts.map +1 -1
  14. package/dist/cli.mjs +3832 -1562
  15. package/dist/cli.mjs.map +1 -1
  16. package/dist/cli__control-api.d.mts +233 -93
  17. package/dist/cli__control-api.d.mts.map +1 -1
  18. package/dist/cli__control-api.mjs +3 -2
  19. package/dist/cli__control-api__testing.d.mts +5 -4
  20. package/dist/cli__control-api__testing.d.mts.map +1 -1
  21. package/dist/cli__control-api__testing.mjs +21 -16
  22. package/dist/cli__control-api__testing.mjs.map +1 -1
  23. package/dist/cli__init-output.d.mts +11 -1
  24. package/dist/cli__init-output.d.mts.map +1 -1
  25. package/dist/cli__init-output.mjs +1 -1
  26. package/dist/cli__migration-cli.d.mts +1 -1
  27. package/dist/cli__migration-cli.mjs +65 -19
  28. package/dist/cli__migration-cli.mjs.map +1 -1
  29. package/dist/config-loader.d.mts +2 -2
  30. package/dist/config-loader.mjs +2 -2
  31. package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs → contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs} +44 -16
  32. package/dist/contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs.map +1 -0
  33. package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts +59 -0
  34. package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts.map +1 -0
  35. package/dist/contract-snapshot-store-DrIwu5pn.d.mts +2 -0
  36. package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts → db-sign-gvrl0kFE-D-nTGx88.d.mts} +330 -230
  37. package/dist/db-sign-gvrl0kFE-D-nTGx88.d.mts.map +1 -0
  38. package/dist/{domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs → domain-type-generation-B4m774CV-WAjyhZHw.mjs} +144 -154
  39. package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +1 -0
  40. package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts +78 -0
  41. package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map +1 -0
  42. package/dist/emitter.d.mts +3 -3
  43. package/dist/emitter.mjs +3 -3
  44. package/dist/emitter__domain-type-generation.d.mts +2 -2
  45. package/dist/emitter__domain-type-generation.mjs +2 -2
  46. package/dist/{errors-D59OCpoI.d.mts → errors-CLwhWJiz.d.mts} +14 -3
  47. package/dist/errors-CLwhWJiz.d.mts.map +1 -0
  48. package/dist/{errors-CXbGUWGu-CstQHPh6.mjs → errors-DXha_4l--relAaiI4.mjs} +37 -42
  49. package/dist/errors-DXha_4l--relAaiI4.mjs.map +1 -0
  50. package/dist/exports-BCIlMjIW-DkUBVDzl.mjs +421 -0
  51. package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +1 -0
  52. package/dist/exports-BlYTE3-J.mjs +539 -0
  53. package/dist/exports-BlYTE3-J.mjs.map +1 -0
  54. package/dist/exports-CKgwcXbp.mjs +3973 -0
  55. package/dist/exports-CKgwcXbp.mjs.map +1 -0
  56. package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs +19 -0
  57. package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map +1 -0
  58. package/dist/{hash-DH8hl5Rq-BpM2t3Nu.mjs → hash-BAZVWU4a-BQovI7hF.mjs} +24 -3
  59. package/dist/hash-BAZVWU4a-BQovI7hF.mjs.map +1 -0
  60. package/dist/hash-CwWGlFWV.d.mts +1 -0
  61. package/dist/{hash-XZYYKJ-i.d.mts → hash-DclMqd7S-WBvXJ_4C.d.mts} +17 -4
  62. package/dist/hash-DclMqd7S-WBvXJ_4C.d.mts.map +1 -0
  63. package/dist/{import-roots-CfoYgejL.d.mts → import-roots-ARK1wjzc.d.mts} +3 -3
  64. package/dist/{import-roots-CfoYgejL.d.mts.map → import-roots-ARK1wjzc.d.mts.map} +1 -1
  65. package/dist/{import-roots-CNFBPAT1.mjs → import-roots-BPn2s_fq.mjs} +6 -6
  66. package/dist/import-roots-BPn2s_fq.mjs.map +1 -0
  67. package/dist/index-CWPFeYyi.d.mts +204 -0
  68. package/dist/index-CWPFeYyi.d.mts.map +1 -0
  69. package/dist/{index-Dgwl8Tzs.d.mts → index-tAySVPvZ.d.mts} +16 -4
  70. package/dist/index-tAySVPvZ.d.mts.map +1 -0
  71. package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs → invariants-DrF9p5Gd-BF70vGl1.mjs} +3 -3
  72. package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs.map → invariants-DrF9p5Gd-BF70vGl1.mjs.map} +1 -1
  73. package/dist/{io-635GlNx1-D3zrw2qu.mjs → io-BNxFm3eg-DYD82QeZ.mjs} +8 -8
  74. package/dist/io-BNxFm3eg-DYD82QeZ.mjs.map +1 -0
  75. package/dist/io-D8Epu7iY.d.mts +1 -0
  76. package/dist/{io-sr4CO9_t-C3eV_kn-.d.mts → io-DZfMV51z-BKlH5Dhb.d.mts} +9 -2
  77. package/dist/io-DZfMV51z-BKlH5Dhb.d.mts.map +1 -0
  78. package/dist/{migration-B2ljMJim.d.mts → migration-Bjz05034.d.mts} +12 -5
  79. package/dist/migration-Bjz05034.d.mts.map +1 -0
  80. package/dist/{migration-hspPIEeV.mjs → migration-CWyjX9vz.mjs} +18 -6
  81. package/dist/migration-CWyjX9vz.mjs.map +1 -0
  82. package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs → migration-graph-BoiiZAaU-DLht12k7.mjs} +6 -89
  83. package/dist/migration-graph-BoiiZAaU-DLht12k7.mjs.map +1 -0
  84. package/dist/{migration-graph-tarTxJ99-BrGBANeE.d.mts → migration-graph-D8IuOkZb-pSI7-k4_.d.mts} +7 -29
  85. package/dist/migration-graph-D8IuOkZb-pSI7-k4_.d.mts.map +1 -0
  86. package/dist/migration-graph-Dra4CcyN.d.mts +14 -0
  87. package/dist/migration-graph-Dra4CcyN.d.mts.map +1 -0
  88. package/dist/migration-tools.d.mts +17 -15
  89. package/dist/migration-tools.mjs +15 -15
  90. package/dist/migration-tools__aggregate.d.mts +2 -2
  91. package/dist/migration-tools__aggregate.mjs +2 -2
  92. package/dist/migration-tools__contract-snapshot-store.d.mts +4 -2
  93. package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
  94. package/dist/migration-tools__errors.d.mts +2 -2
  95. package/dist/migration-tools__errors.mjs +1 -1
  96. package/dist/migration-tools__hash.d.mts +2 -1
  97. package/dist/migration-tools__hash.mjs +1 -1
  98. package/dist/migration-tools__invariants.mjs +1 -1
  99. package/dist/migration-tools__io.d.mts +2 -2
  100. package/dist/migration-tools__io.mjs +1 -1
  101. package/dist/migration-tools__migration-graph.d.mts +3 -3
  102. package/dist/migration-tools__migration-graph.mjs +3 -3
  103. package/dist/migration-tools__migration-ts.d.mts +2 -2
  104. package/dist/migration-tools__migration-ts.mjs +2 -2
  105. package/dist/migration-tools__migration.d.mts +1 -1
  106. package/dist/migration-tools__migration.mjs +1 -1
  107. package/dist/migration-tools__ref-resolution.d.mts +2 -2
  108. package/dist/migration-tools__ref-resolution.mjs +2 -2
  109. package/dist/migration-tools__refs.mjs +1 -1
  110. package/dist/migration-tools__spaces.d.mts +1 -1
  111. package/dist/migration-tools__spaces.mjs +2 -2
  112. package/dist/{migration-ts-DdVm0rws.mjs → migration-ts-DDgjsR1O.mjs} +6 -5
  113. package/dist/migration-ts-DDgjsR1O.mjs.map +1 -0
  114. package/dist/{migration-ts-CNaAtK8C.d.mts → migration-ts-SGer0PXq.d.mts} +4 -2
  115. package/dist/migration-ts-SGer0PXq.d.mts.map +1 -0
  116. package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs +23 -0
  117. package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs.map +1 -0
  118. package/dist/output-BcC8eB0h-C5bRd-aC.mjs +129 -0
  119. package/dist/output-BcC8eB0h-C5bRd-aC.mjs.map +1 -0
  120. package/dist/publish-surface.d.mts +1 -1
  121. package/dist/publish-surface.mjs +2 -2
  122. package/dist/publish-surface__import-roots.d.mts +1 -1
  123. package/dist/publish-surface__import-roots.mjs +1 -1
  124. package/dist/publish-surface__shells.mjs +1 -1
  125. package/dist/quick-reference-mongo.md +12 -12
  126. package/dist/quick-reference-postgres.md +10 -10
  127. package/dist/quick-reference-prisma7.md +80 -0
  128. package/dist/readme-mongo.md +6 -6
  129. package/dist/readme-postgres.md +6 -6
  130. package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs +6663 -0
  131. package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs.map +1 -0
  132. package/dist/{ref-resolution-COGOSL57.d.mts → ref-resolution-BPhR-kta.d.mts} +29 -11
  133. package/dist/ref-resolution-BPhR-kta.d.mts.map +1 -0
  134. package/dist/{ref-resolution-HeNBXW53.mjs → ref-resolution-Eo0QHp4f.mjs} +30 -6
  135. package/dist/ref-resolution-Eo0QHp4f.mjs.map +1 -0
  136. package/dist/{refs-WK86uYYp-gM8tvWQP.mjs → refs-DM3q3IZC-BC6H6P0X.mjs} +9 -9
  137. package/dist/refs-DM3q3IZC-BC6H6P0X.mjs.map +1 -0
  138. package/dist/{shells-C4HbRAr5.mjs → shells-w_yEDhe8.mjs} +98 -31
  139. package/dist/shells-w_yEDhe8.mjs.map +1 -0
  140. package/dist/{spaces-Dj65JrwZ.d.mts → spaces-BWULKO54.d.mts} +3 -3
  141. package/dist/{spaces-Dj65JrwZ.d.mts.map → spaces-BWULKO54.d.mts.map} +1 -1
  142. package/dist/{spaces-4qMOAYE9.mjs → spaces-c9xdiXW8.mjs} +14 -13
  143. package/dist/spaces-c9xdiXW8.mjs.map +1 -0
  144. package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs} +7 -7
  145. package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs.map} +1 -1
  146. package/dist/vite-plugin-contract-emit.d.mts +1 -1
  147. package/dist/vite-plugin-contract-emit.mjs +10 -10
  148. package/dist/vite-plugin-contract-emit.mjs.map +1 -1
  149. package/package.json +16 -15
  150. package/dist/aggregate-CPZB020V.mjs.map +0 -1
  151. package/dist/aggregate-DLUJLq5Y.d.mts.map +0 -1
  152. package/dist/contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map +0 -1
  153. package/dist/contract-snapshot-store-CbqynbtE.d.mts +0 -28
  154. package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +0 -1
  155. package/dist/db-verify-BwgNK50T-DGvKgFCK.d.mts.map +0 -1
  156. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +0 -63
  157. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +0 -1
  158. package/dist/domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs.map +0 -1
  159. package/dist/errors-CXbGUWGu-CstQHPh6.mjs.map +0 -1
  160. package/dist/errors-D59OCpoI.d.mts.map +0 -1
  161. package/dist/exports-8ZUN43ve.mjs +0 -1734
  162. package/dist/exports-8ZUN43ve.mjs.map +0 -1
  163. package/dist/exports-BCLg4CiV-05kuwcb0.mjs +0 -160
  164. package/dist/exports-BCLg4CiV-05kuwcb0.mjs.map +0 -1
  165. package/dist/exports-BZaG8_w_.mjs +0 -243
  166. package/dist/exports-BZaG8_w_.mjs.map +0 -1
  167. package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs +0 -14
  168. package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs.map +0 -1
  169. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +0 -1
  170. package/dist/hash-XZYYKJ-i.d.mts.map +0 -1
  171. package/dist/import-roots-CNFBPAT1.mjs.map +0 -1
  172. package/dist/index-DRs7L6N0.d.mts +0 -57
  173. package/dist/index-DRs7L6N0.d.mts.map +0 -1
  174. package/dist/index-Dgwl8Tzs.d.mts.map +0 -1
  175. package/dist/io-635GlNx1-D3zrw2qu.mjs.map +0 -1
  176. package/dist/io-DYfeLJxR.d.mts +0 -1
  177. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +0 -1
  178. package/dist/migration-B2ljMJim.d.mts.map +0 -1
  179. package/dist/migration-graph-Dqndu0i5.d.mts +0 -9
  180. package/dist/migration-graph-Dqndu0i5.d.mts.map +0 -1
  181. package/dist/migration-graph-_SJImD5V-BURyY1KM.mjs.map +0 -1
  182. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +0 -1
  183. package/dist/migration-hspPIEeV.mjs.map +0 -1
  184. package/dist/migration-ts-CNaAtK8C.d.mts.map +0 -1
  185. package/dist/migration-ts-DdVm0rws.mjs.map +0 -1
  186. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +0 -13
  187. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +0 -1
  188. package/dist/output-CovTDY14-CUoAqLML.mjs +0 -77
  189. package/dist/output-CovTDY14-CUoAqLML.mjs.map +0 -1
  190. package/dist/ref-h6InR6dO-rGfl18Jv.mjs +0 -4686
  191. package/dist/ref-h6InR6dO-rGfl18Jv.mjs.map +0 -1
  192. package/dist/ref-resolution-COGOSL57.d.mts.map +0 -1
  193. package/dist/ref-resolution-HeNBXW53.mjs.map +0 -1
  194. package/dist/refs-WK86uYYp-gM8tvWQP.mjs.map +0 -1
  195. package/dist/shells-C4HbRAr5.mjs.map +0 -1
  196. package/dist/spaces-4qMOAYE9.mjs.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @prisma/orm-toolchain
2
2
 
3
- Prisma Next's development and build tooling: the ORM command family the unified `prisma` CLI mounts, the contract emitter, the config loader, the language server, CLI telemetry, and the Vite plugin. This package ships no bin.
3
+ Prisma 8's development and build tooling: the ORM command family the unified `prisma` CLI mounts, the contract emitter, the config loader, the language server, CLI telemetry, and the Vite plugin. This package ships no bin.
4
4
 
5
5
  Applications get it as an exact-pinned dependency of their database facade (`@prisma/orm-postgres`, `@prisma/orm-sqlite`, `@prisma/orm-mongo`); app developers install the facade, not this package. It is separate from `@prisma/orm-framework` so deployed applications never trace a compiler, formatter, or language server into their runtime bundle.
6
6
 
@@ -22,7 +22,3 @@ Applications get it as an exact-pinned dependency of their database facade (`@pr
22
22
  ## Responsibilities
23
23
 
24
24
  Everything that runs at development or build time: emitting contracts, loading config, planning and packaging migrations, editor support, and the CLI itself. Nothing here is needed by a deployed application at runtime.
25
-
26
- ## Dependencies
27
-
28
- `@prisma/orm-framework` (exact lockstep pin) plus the tooling's third-party dependencies (esbuild, prettier, clipanion, vscode-languageserver, and friends) — the deliberate reason this package is not part of `orm-framework`.
@@ -1,10 +1,11 @@
1
+ import { n as OnDiskMigrationPackage } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
2
+ import { n as SnapshotContentVerifier } from "./contract-snapshot-store-Bok5nQYi-D3g_P7im.mjs";
1
3
  import { i as Refs, r as RefLoadProblem } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
2
4
  import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
3
- import { n as OnDiskMigrationPackage } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
4
5
  import { t as ContractSpaceHeadRecord } from "./verify-contract-spaces-C3PiFBk3-DfomYyOE.mjs";
5
- import { t as PackageLoadProblem } from "./io-sr4CO9_t-C3eV_kn-.mjs";
6
- import { t as PathDecision } from "./migration-graph-tarTxJ99-BrGBANeE.mjs";
7
- import { ControlAdapterInstance, ControlFamilyInstance, DiffSubjectGranularity, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, SchemaDiffIssue, SchemaEntityCoordinate, SchemaOwnership, TargetMigrationsCapability, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
6
+ import { t as PackageLoadProblem } from "./io-DZfMV51z-BKlH5Dhb.mjs";
7
+ import { t as PathDecision } from "./migration-graph-D8IuOkZb-pSI7-k4_.mjs";
8
+ import { AppliedMigrationStatement, ControlAdapterInstance, ControlFamilyInstance, DiffSubjectGranularity, MigrationOperationPolicy, MigrationPlan, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, ResolvedMigrationStatement, SchemaDiffIssue, SchemaEntityCoordinate, SchemaOwnership, TargetMigrationsCapability, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
8
9
  import { Result } from "@prisma/orm-framework/utils/result";
9
10
  import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
10
11
  import { Contract, StorageNamespace } from "@prisma/orm-framework/contract/types";
@@ -132,13 +133,11 @@ type ContractAtResult = {
132
133
  readonly provenance: 'ref';
133
134
  readonly hash: string;
134
135
  readonly contractJson: unknown;
135
- readonly contractDts: string;
136
136
  readonly contract: Contract;
137
137
  } | {
138
138
  readonly provenance: 'graph-node';
139
139
  readonly hash: string;
140
140
  readonly contractJson: unknown;
141
- readonly contractDts: string;
142
141
  readonly contract: Contract;
143
142
  };
144
143
  /**
@@ -268,22 +267,31 @@ declare function createAggregateContractSpace(args: {
268
267
  readonly migrationsDir: string;
269
268
  readonly resolveContract: () => Contract;
270
269
  readonly deserializeContract: (raw: unknown) => Contract;
270
+ readonly verifySnapshotContent?: SnapshotContentVerifier;
271
271
  }): AggregateContractSpace;
272
272
  /**
273
273
  * Collect the union of every namespace declared across all contract spaces of an
274
- * aggregate (app + extensions) and return a minimal object with the shape
275
- * `{ storage: { namespaces } }` suitable for passing to
276
- * `familyInstance.introspect`.
274
+ * aggregate (app + extensions), and of the application space's origin contract when given, so a
275
+ * namespace the origin declares and the destination removed is read too, and return a minimal
276
+ * object with the shape
277
+ * `{ storage: { namespaces }, contracts }` suitable for passing to
278
+ * `familyInstance.introspect`. `contracts` holds each space's contract, app first, so
279
+ * introspection reads a table with the contract of the space that declares it.
277
280
  *
278
281
  * Callers invoke this after the integrity gate (`buildContractSpaceAggregate`
279
282
  * with `checkContracts: true`), so every `space.contract()` call is safe —
280
283
  * no try/catch is needed here.
281
284
  */
282
- declare function collectAggregateNamespaces(aggregate: ContractSpaceAggregate): {
285
+ declare function collectAggregateNamespaces(aggregate: ContractSpaceAggregate, originContract?: Contract | null): {
283
286
  readonly storage: {
284
287
  readonly namespaces: Readonly<Record<string, StorageNamespace>>;
285
288
  };
289
+ readonly contracts: readonly Contract[];
286
290
  };
291
+ /**
292
+ * The order in which `migrate` applies an aggregate's contract spaces and `db sign` signs them: the extension spaces in the aggregate's order, then the app space, so an extension's tables exist before the app's tables refer to them.
293
+ */
294
+ declare function spacesInApplyOrder(aggregate: ContractSpaceAggregate): readonly AggregateContractSpace[];
287
295
  /**
288
296
  * Assemble a {@link ContractSpaceAggregate} value from its contract spaces and a
289
297
  * `checkIntegrity` implementation. The query methods (`listSpaces` /
@@ -309,7 +317,7 @@ declare function createContractSpaceAggregate(args: {
309
317
  * This is the precondition for advancing a contract space's marker without
310
318
  * any migrations (the declared-state resolution the db-init aggregate
311
319
  * planner and `migrate` share): only when nothing in the space is
312
- * Prisma-Next-managed can the storage structure be correct without a
320
+ * Prisma 8-managed can the storage structure be correct without a
313
321
  * migration having produced it. Any space that declares a managed element
314
322
  * but ships no migration graph is an authoring bug and must fail loudly.
315
323
  */
@@ -370,6 +378,8 @@ interface ContractMarkerRecordLike {
370
378
  readonly invariants: readonly string[];
371
379
  readonly profileHash?: string;
372
380
  }
381
+ /** The contract hash a database is at: its marker's storage hash, or the empty contract when it has no marker. */
382
+ declare function contractHashAtMarker(marker: Pick<ContractMarkerRecordLike, 'storageHash'> | null | undefined): string;
373
383
  //#endregion
374
384
  //#region src/aggregate/planner-types.d.ts
375
385
  /**
@@ -436,25 +446,21 @@ interface PlannerInput<TFamilyId extends string, TTargetId extends string> {
436
446
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
437
447
  readonly callerPolicy: CallerPolicy;
438
448
  readonly operationPolicy: MigrationOperationPolicy;
449
+ /**
450
+ * What the application space's diff plan starts from: the contract the
451
+ * database is at, when the caller knows it, and the statements the user gave.
452
+ * Other spaces plan with no origin contract and no statements. Statements need the app space
453
+ * in `callerPolicy.ignoreGraphFor`; otherwise the planner refuses them with `policyConflict`.
454
+ */
455
+ readonly appSpace: AppSpacePlanningInputs;
456
+ /** The name the database knows the object an operation acts on by; names what a recorded drop loses. */
457
+ readonly storageNameOf: (operation: MigrationPlanOperation) => string;
458
+ }
459
+ /** See {@link PlannerInput.appSpace}. */
460
+ interface AppSpacePlanningInputs {
461
+ readonly fromContract: Contract | null;
462
+ readonly statements: readonly ResolvedMigrationStatement[];
439
463
  }
440
- /**
441
- * Per-space output of the planner. The runner ingests this
442
- * shape directly via a thin `toRunnerInput` adapter at the CLI.
443
- *
444
- * - `plan`: ready-to-execute `MigrationPlan` with `targetId` already
445
- * set from `aggregate.targetId`.
446
- * - `displayOps`: same operation list, surfaced separately so plan-mode
447
- * output can render without touching the runner-bound `plan`.
448
- * - `destinationContract`: the typed contract value the runner uses
449
- * for post-apply verification. For the app space, the user's
450
- * contract; for extension spaces, the on-disk `contract.json`.
451
- * - `strategy`: which operation produced this plan — `'resolve-recorded-path'`
452
- * (walked a recorded migration path), `'plan-from-diff'` (fabricated a
453
- * plan from a state diff), or `'declared-state'` (the space ships no
454
- * migration packages at all; the aggregate declares the no-op directly
455
- * without invoking either). Surfaced for diagnostics; not consumed by
456
- * the runner.
457
- */
458
464
  /**
459
465
  * Per-edge metadata for the chain assembled by resolving a contract
460
466
  * space's recorded migration path. Lets `migrate` surface a per-migration
@@ -482,12 +488,42 @@ interface AggregateMigrationEdgeRef {
482
488
  */
483
489
  readonly destinationContractJson?: unknown;
484
490
  }
485
- interface PerSpacePlan {
491
+ /**
492
+ * Per-space output of the planner. The runner ingests this
493
+ * shape directly via a thin `toRunnerInput` adapter at the CLI.
494
+ *
495
+ * - `plan`: ready-to-execute `MigrationPlan` with `targetId` already
496
+ * set from `aggregate.targetId`.
497
+ * - `displayOps`: same operation list, surfaced separately so plan-mode
498
+ * output can render without touching the runner-bound `plan`.
499
+ * - `destinationContract`: the typed contract value the runner uses
500
+ * for post-apply verification. For the app space, the user's
501
+ * contract; for extension spaces, the on-disk `contract.json`.
502
+ * - `strategy`: which operation produced this plan — `'resolve-recorded-path'`
503
+ * (walked a recorded migration path), `'plan-from-diff'` (fabricated a
504
+ * plan from a state diff), or `'declared-state'` (the space ships no
505
+ * migration packages at all; the aggregate declares the no-op directly
506
+ * without invoking either). Surfaced for diagnostics; not consumed by
507
+ * the runner.
508
+ * - `dataLoss` and `accessChanges`: what the operations of `plan` lose
509
+ * and whose access they change. A recorded path names each destructive
510
+ * operation by its storage name, since no planner mapped it to a model,
511
+ * lists each as a `drop`, since a recorded operation does not say whether
512
+ * it drops or changes a type, and lists no access change: a written migration is
513
+ * reviewed before it runs.
514
+ * - `temporaryValues`: the new required fields whose existing rows the plan
515
+ * gives a temporary value. A recorded path lists none.
516
+ */
517
+ interface PerSpacePlan extends MigrationPlanSubjects {
486
518
  readonly plan: MigrationPlan;
487
519
  readonly displayOps: readonly MigrationPlanOperation[];
488
520
  readonly destinationContract: Contract;
489
521
  readonly strategy: 'resolve-recorded-path' | 'plan-from-diff' | 'declared-state';
490
522
  readonly warnings?: readonly MigrationPlannerConflict[];
523
+ /** The statements the plan applied; empty for a space planned without statements. */
524
+ readonly appliedStatements: readonly AppliedMigrationStatement[];
525
+ /** The namespaces a `plan-from-diff` plan removes and adds, when its planner reports them. */
526
+ readonly namespaces?: MigrationPlanNamespaces;
491
527
  /**
492
528
  * Per-edge breakdown of the chain. `resolve-recorded-path` plans carry
493
529
  * one entry per authored edge; `plan-from-diff` and `declared-state`
@@ -556,7 +592,7 @@ declare function buildFabricatedMigrationEdge(args: {
556
592
  *
557
593
  * Construction reads migration **state** from disk (`migrations/<space>/`
558
594
  * packages + refs + head refs). The app's *live* contract is not a disk
559
- * artifact — in Prisma Next it is always compiled from the project's
595
+ * artifact — in Prisma 8 it is always compiled from the project's
560
596
  * central contract, so the caller always has it and threads it in as
561
597
  * `appContract`. `deserializeContract` is held and called lazily only for
562
598
  * the extension contracts resolved from the contract snapshot store,
@@ -566,6 +602,14 @@ interface LoadAggregateInput {
566
602
  readonly migrationsDir: string;
567
603
  readonly deserializeContract: (raw: unknown) => Contract;
568
604
  readonly appContract: Contract;
605
+ /**
606
+ * Content check for contract snapshots resolved from the store: every
607
+ * snapshot read through this aggregate is recomputed against the hash it
608
+ * was addressed by. Construction stays tolerant — a mismatched extension
609
+ * head snapshot surfaces at `contract()` time as `contractUnreadable`,
610
+ * and `contractAt()` throws `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH`.
611
+ */
612
+ readonly verifySnapshotContent?: SnapshotContentVerifier;
569
613
  }
570
614
  /**
571
615
  * Build a tolerant, queryable {@link ContractSpaceAggregate} from on-disk
@@ -591,6 +635,9 @@ declare function loadContractSpaceAggregate(input: LoadAggregateInput): Promise<
591
635
  /**
592
636
  * Plan a migration across every contract space of a {@link ContractSpaceAggregate}.
593
637
  *
638
+ * Statements in `input.appSpace` apply only to a diff plan, so the planner refuses them with
639
+ * `policyConflict` unless `callerPolicy.ignoreGraphFor` includes the app space.
640
+ *
594
641
  * Per-space operation selection, in order; first match wins:
595
642
  *
596
643
  * 1. If `callerPolicy.ignoreGraphFor.has(space.spaceId)`:
@@ -609,9 +656,7 @@ declare function loadContractSpaceAggregate(input: LoadAggregateInput): Promise<
609
656
  * 5. Else → `extensionPathUnsatisfiable` (an empty graph cannot satisfy
610
657
  * non-empty invariants).
611
658
  *
612
- * Output `applyOrder` is `[...aggregate.extensions.map(spaceId), aggregate.app.spaceId]`
613
- * — extensions alphabetical, then app — matching today's
614
- * `concatenateSpaceApplyInputs` ordering. This preserves
659
+ * Output `applyOrder` is {@link spacesInApplyOrder}: extensions alphabetical, then app. This preserves
615
660
  * `MigrationRunnerFailure.failingSpace` attribution byte-for-byte.
616
661
  *
617
662
  * Every emitted `MigrationPlan` has `targetId = aggregate.targetId`.
@@ -649,6 +694,8 @@ interface ResolveRecordedPathInputs {
649
694
  * strategy itself does not interpret it.
650
695
  */
651
696
  readonly refName?: string;
697
+ /** The name the database knows the object an operation acts on by; names what a drop loses. */
698
+ readonly storageNameOf: (operation: MigrationPlanOperation) => string;
652
699
  }
653
700
  /**
654
701
  * Resolve a contract space's hydrated migration graph to the path from the
@@ -799,5 +846,5 @@ type VerifierOutput = Result<VerifierSuccess, VerifierError>;
799
846
  */
800
847
  declare function verifyMigration(input: VerifierInput): VerifierOutput;
801
848
  //#endregion
802
- export { buildFabricatedMigrationEdge as A, verifyMigration as B, ResolveRecordedPathOutcome as C, VerifierOutput as D, VerifierInput as E, loadContractSpaceAggregate as F, loadProblemToViolation as I, planMigration as L, computeIntegrityViolations as M, createAggregateContractSpace as N, VerifierSuccess as O, createContractSpaceAggregate as P, requireHeadRef as R, ResolveRecordedPathInputs as S, VerifierError as T, PerSpacePlan as _, ContractAtOptions as a, PlannerOutput as b, ContractSpaceAggregate as c, IntegrityQueryOptions as d, IntegritySpaceState as f, MarkerCheckSection as g, MarkerCheckResult as h, CallerPolicy as i, collectAggregateNamespaces as j, allStorageElementsExternal as k, DeclaredExtensionEntry as l, LoadAggregateInput as m, AggregateCurrentDBState as n, ContractAtResult as o, IntegrityViolation as p, AggregateMigrationEdgeRef as r, ContractMarkerRecordLike as s, AggregateContractSpace as t, IntegrityComputationInput as u, PlannerError as v, SchemaCheckSection as w, PlannerSuccess as x, PlannerInput as y, resolveRecordedPath as z };
803
- //# sourceMappingURL=aggregate-DLUJLq5Y.d.mts.map
849
+ export { allStorageElementsExternal as A, requireHeadRef as B, ResolveRecordedPathInputs as C, VerifierInput as D, VerifierError as E, createAggregateContractSpace as F, spacesInApplyOrder as H, createContractSpaceAggregate as I, loadContractSpaceAggregate as L, collectAggregateNamespaces as M, computeIntegrityViolations as N, VerifierOutput as O, contractHashAtMarker as P, loadProblemToViolation as R, PlannerSuccess as S, SchemaCheckSection as T, verifyMigration as U, resolveRecordedPath as V, MarkerCheckSection as _, CallerPolicy as a, PlannerInput as b, ContractMarkerRecordLike as c, IntegrityComputationInput as d, IntegrityQueryOptions as f, MarkerCheckResult as g, LoadAggregateInput as h, AppSpacePlanningInputs as i, buildFabricatedMigrationEdge as j, VerifierSuccess as k, ContractSpaceAggregate as l, IntegrityViolation as m, AggregateCurrentDBState as n, ContractAtOptions as o, IntegritySpaceState as p, AggregateMigrationEdgeRef as r, ContractAtResult as s, AggregateContractSpace as t, DeclaredExtensionEntry as u, PerSpacePlan as v, ResolveRecordedPathOutcome as w, PlannerOutput as x, PlannerError as y, planMigration as z };
850
+ //# sourceMappingURL=aggregate-BpcQdygS.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-BpcQdygS.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BK;WACM;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;WAC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