@prisma/orm-toolchain 8.0.0-rc.1-dev.4 → 8.0.0-rc.1-dev.6

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 (170) hide show
  1. package/dist/{aggregate-B4mhR4Sk.mjs → aggregate-i-rfetSO.mjs} +8 -8
  2. package/dist/{aggregate-B4mhR4Sk.mjs.map → aggregate-i-rfetSO.mjs.map} +1 -1
  3. package/dist/bin__prisma-next.mjs +22 -22
  4. package/dist/bin__prisma-next.mjs.map +1 -1
  5. package/dist/cli.mjs +2 -2
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/cli__commands__contract-emit.mjs +1 -1
  8. package/dist/cli__commands__contract-infer.mjs +1 -1
  9. package/dist/cli__commands__db-init.mjs +1 -1
  10. package/dist/cli__commands__db-schema.mjs +1 -1
  11. package/dist/cli__commands__db-sign.mjs +1 -1
  12. package/dist/cli__commands__db-update.mjs +1 -1
  13. package/dist/cli__commands__db-verify.mjs +1 -1
  14. package/dist/cli__commands__migrate.d.mts +1 -1
  15. package/dist/cli__commands__migrate.mjs +1 -1
  16. package/dist/cli__commands__migration-check.d.mts +1 -1
  17. package/dist/cli__commands__migration-check.mjs +1 -1
  18. package/dist/cli__commands__migration-graph.d.mts +1 -1
  19. package/dist/cli__commands__migration-graph.mjs +1 -1
  20. package/dist/cli__commands__migration-list.d.mts +1 -1
  21. package/dist/cli__commands__migration-list.mjs +1 -1
  22. package/dist/cli__commands__migration-log.d.mts +1 -1
  23. package/dist/cli__commands__migration-log.mjs +1 -1
  24. package/dist/cli__commands__migration-new.mjs +1 -1
  25. package/dist/cli__commands__migration-plan.mjs +1 -1
  26. package/dist/cli__commands__migration-show.mjs +1 -1
  27. package/dist/cli__commands__migration-status.d.mts +1 -1
  28. package/dist/cli__commands__migration-status.mjs +1 -1
  29. package/dist/cli__commands__ref.d.mts +1 -1
  30. package/dist/cli__commands__ref.mjs +1 -1
  31. package/dist/cli__commands__telemetry.mjs +1 -1
  32. package/dist/cli__control-api.d.mts +1 -1
  33. package/dist/cli__control-api.mjs +2 -2
  34. package/dist/cli__migration-cli.mjs +3 -6
  35. package/dist/cli__migration-cli.mjs.map +1 -1
  36. package/dist/{client-75qrAPqf-7l0C0H_b.mjs → client-7aUYC7ci-Bh9mLxkl.mjs} +16 -12
  37. package/dist/client-7aUYC7ci-Bh9mLxkl.mjs.map +1 -0
  38. package/dist/{command-helpers-CAoXqAY9-DWUBcTXM.mjs → command-helpers-C4WpR-QE-CK2gkj6l.mjs} +30 -74
  39. package/dist/command-helpers-C4WpR-QE-CK2gkj6l.mjs.map +1 -0
  40. package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs +44 -0
  41. package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +1 -0
  42. package/dist/{contract-emit-B6odMoem-C87PBvmo.mjs → contract-emit-CTm2zfuG-8mtkxW8M.mjs} +12 -11
  43. package/dist/contract-emit-CTm2zfuG-8mtkxW8M.mjs.map +1 -0
  44. package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs → contract-emit-D8IXP9Qp-CecAQio1.mjs} +4 -4
  45. package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs.map → contract-emit-D8IXP9Qp-CecAQio1.mjs.map} +1 -1
  46. package/dist/{contract-infer-BnkqpftN-DwBzasOu.mjs → contract-infer-C8-RqHeK-D_dm3onP.mjs} +5 -5
  47. package/dist/contract-infer-C8-RqHeK-D_dm3onP.mjs.map +1 -0
  48. package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs} +3 -3
  49. package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map} +1 -1
  50. package/dist/{contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs → contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs} +6 -6
  51. package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +1 -0
  52. package/dist/{db-init-bd0_x2Q8.mjs → db-init-CXMcvoIA.mjs} +9 -12
  53. package/dist/db-init-CXMcvoIA.mjs.map +1 -0
  54. package/dist/{db-schema-CwgAWTqG.mjs → db-schema-j8DERh4t.mjs} +4 -4
  55. package/dist/{db-schema-CwgAWTqG.mjs.map → db-schema-j8DERh4t.mjs.map} +1 -1
  56. package/dist/{db-sign-vqiYfpjI.mjs → db-sign-xV_rpoIc.mjs} +10 -10
  57. package/dist/db-sign-xV_rpoIc.mjs.map +1 -0
  58. package/dist/{db-update-Br0diOCo.mjs → db-update-DXa2DIvu.mjs} +11 -11
  59. package/dist/db-update-DXa2DIvu.mjs.map +1 -0
  60. package/dist/{db-verify-CKPsRFrj-T7nSt7yT.mjs → db-verify-YWHjuKC7-DidK1gx1.mjs} +9 -6
  61. package/dist/db-verify-YWHjuKC7-DidK1gx1.mjs.map +1 -0
  62. package/dist/{errors--qsXZUtL.d.mts → errors-AkMBj-YP.d.mts} +8 -8
  63. package/dist/errors-AkMBj-YP.d.mts.map +1 -0
  64. package/dist/{errors-IpZm1Skp-BH495dRd.mjs → errors-BwusfLIN-BXM7K-ww.mjs} +42 -51
  65. package/dist/errors-BwusfLIN-BXM7K-ww.mjs.map +1 -0
  66. package/dist/{format-ByDm2goZ-BIRlFoo6.mjs → format-Bw3LVJ1v-D10inUT9.mjs} +12 -9
  67. package/dist/format-Bw3LVJ1v-D10inUT9.mjs.map +1 -0
  68. package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs → framework-components-3DdB31mk-BPGSuOyZ.mjs} +3 -3
  69. package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs.map → framework-components-3DdB31mk-BPGSuOyZ.mjs.map} +1 -1
  70. package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs → graph-membership-h9ejuZla-ewjYM5wz.mjs} +3 -3
  71. package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map → graph-membership-h9ejuZla-ewjYM5wz.mjs.map} +1 -1
  72. package/dist/{init-BGm77aWc-jHVUn63W.mjs → init-CPB89WK2-Di4kgP6B.mjs} +4 -4
  73. package/dist/{init-BGm77aWc-jHVUn63W.mjs.map → init-CPB89WK2-Di4kgP6B.mjs.map} +1 -1
  74. package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs} +4 -4
  75. package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs.map → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map} +1 -1
  76. package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs → invariants-CMcQxRas-CXX9uhQW.mjs} +3 -3
  77. package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs.map → invariants-CMcQxRas-CXX9uhQW.mjs.map} +1 -1
  78. package/dist/{io-C8TdyBKt-DloEBi70.mjs → io-CL3hSv42-DGZtTs89.mjs} +8 -8
  79. package/dist/{io-C8TdyBKt-DloEBi70.mjs.map → io-CL3hSv42-DGZtTs89.mjs.map} +1 -1
  80. package/dist/{migrate-BdVFDKF2.mjs → migrate-COusRrm7.mjs} +28 -22
  81. package/dist/migrate-COusRrm7.mjs.map +1 -0
  82. package/dist/{migration-check-CcG-fB8r-qpu6xdbA.mjs → migration-check-CueEJelQ-J81XR_ns.mjs} +10 -10
  83. package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +1 -0
  84. package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs} +4 -4
  85. package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs.map → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map} +1 -1
  86. package/dist/{migration-BuUmO7It.mjs → migration-diUAhNaa.mjs} +3 -3
  87. package/dist/{migration-BuUmO7It.mjs.map → migration-diUAhNaa.mjs.map} +1 -1
  88. package/dist/{migration-graph-vmgkL3k4.mjs → migration-graph-BL6vfLcE.mjs} +4 -4
  89. package/dist/{migration-graph-vmgkL3k4.mjs.map → migration-graph-BL6vfLcE.mjs.map} +1 -1
  90. package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs → migration-graph-D6bN-mX0-DwMWY8DA.mjs} +3 -3
  91. package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs.map → migration-graph-D6bN-mX0-DwMWY8DA.mjs.map} +1 -1
  92. package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs → migration-list-D2_JdzWC-MRHYYVQE.mjs} +6 -6
  93. package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs.map → migration-list-D2_JdzWC-MRHYYVQE.mjs.map} +1 -1
  94. package/dist/{migration-log-CS5IWcNq-DI7FTHCA.mjs → migration-log-BXbz6-Lj-CKHbat5f.mjs} +4 -6
  95. package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +1 -0
  96. package/dist/{migration-new-GmW2anVb.mjs → migration-new-szZFsA3C.mjs} +16 -15
  97. package/dist/migration-new-szZFsA3C.mjs.map +1 -0
  98. package/dist/{migration-path-target-D3Sj55PI-BICblCuk.mjs → migration-path-target-BPYp3LNc-qRQlG_Yn.mjs} +4 -4
  99. package/dist/migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map +1 -0
  100. package/dist/{migration-plan-q_L84PN1-ClkGgtVz.mjs → migration-plan-CxXAXYc8-Dnp-v8Nl.mjs} +17 -18
  101. package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +1 -0
  102. package/dist/{migration-show--pW4XhKs.mjs → migration-show-BKsIh7Uz.mjs} +9 -9
  103. package/dist/migration-show-BKsIh7Uz.mjs.map +1 -0
  104. package/dist/{migration-status-CFlzlRmu-QHUxHm_l.mjs → migration-status-CNnRInne--cvmx56T.mjs} +15 -15
  105. package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +1 -0
  106. package/dist/migration-tools.d.mts +2 -2
  107. package/dist/migration-tools.mjs +12 -12
  108. package/dist/migration-tools__aggregate.mjs +1 -1
  109. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  110. package/dist/migration-tools__errors.d.mts +1 -1
  111. package/dist/migration-tools__errors.mjs +1 -1
  112. package/dist/migration-tools__invariants.mjs +1 -1
  113. package/dist/migration-tools__io.mjs +1 -1
  114. package/dist/migration-tools__migration-graph.mjs +2 -2
  115. package/dist/migration-tools__migration.mjs +1 -1
  116. package/dist/migration-tools__ref-resolution.mjs +1 -1
  117. package/dist/migration-tools__refs.mjs +1 -1
  118. package/dist/migration-tools__spaces.d.mts +1 -1
  119. package/dist/migration-tools__spaces.mjs +2 -2
  120. package/dist/{project-import-root-CpwLCDLY-DkVwAnWj.mjs → project-import-root-C_bd0ooL-CLXW-gp6.mjs} +10 -8
  121. package/dist/project-import-root-C_bd0ooL-CLXW-gp6.mjs.map +1 -0
  122. package/dist/{ref-sHE8zOcm.mjs → ref-DjZ5Y8ju.mjs} +11 -11
  123. package/dist/ref-DjZ5Y8ju.mjs.map +1 -0
  124. package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs → ref-advancement-CSPMoQs3-CPkL3IFF.mjs} +4 -4
  125. package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs.map → ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map} +1 -1
  126. package/dist/{ref-resolution-BjJBWPjX.mjs → ref-resolution-BsdziDFA.mjs} +2 -2
  127. package/dist/{ref-resolution-BjJBWPjX.mjs.map → ref-resolution-BsdziDFA.mjs.map} +1 -1
  128. package/dist/{refs-BDbB9BRB-D6Za3Q49.mjs → refs-DtoeUivZ-qay0UMSP.mjs} +6 -6
  129. package/dist/refs-DtoeUivZ-qay0UMSP.mjs.map +1 -0
  130. package/dist/{spaces-C27bA-xc.mjs → spaces-BNd2Tlk0.mjs} +7 -7
  131. package/dist/spaces-BNd2Tlk0.mjs.map +1 -0
  132. package/dist/{spaces-DxFj5y8l.d.mts → spaces-D5qtTlhj.d.mts} +2 -2
  133. package/dist/{spaces-DxFj5y8l.d.mts.map → spaces-D5qtTlhj.d.mts.map} +1 -1
  134. package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs → telemetry-DVBHDQd6-BEdoMii0.mjs} +3 -3
  135. package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs.map → telemetry-DVBHDQd6-BEdoMii0.mjs.map} +1 -1
  136. package/dist/{types-DZWEs4si-D8UlyJI0.d.mts → types-2n_H3DQ9-Bks8UPEO.d.mts} +8 -2
  137. package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +1 -0
  138. package/dist/{verify-DnVNjc5C-BGdsblBK.mjs → verify-C6L_hiJU-CN3eEe3Y.mjs} +3 -3
  139. package/dist/{verify-DnVNjc5C-BGdsblBK.mjs.map → verify-C6L_hiJU-CN3eEe3Y.mjs.map} +1 -1
  140. package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs} +4 -4
  141. package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map} +1 -1
  142. package/dist/vite-plugin-contract-emit.mjs +1 -1
  143. package/package.json +12 -12
  144. package/dist/client-75qrAPqf-7l0C0H_b.mjs.map +0 -1
  145. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +0 -1
  146. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +0 -36
  147. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +0 -1
  148. package/dist/contract-emit-B6odMoem-C87PBvmo.mjs.map +0 -1
  149. package/dist/contract-infer-BnkqpftN-DwBzasOu.mjs.map +0 -1
  150. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +0 -1
  151. package/dist/db-init-bd0_x2Q8.mjs.map +0 -1
  152. package/dist/db-sign-vqiYfpjI.mjs.map +0 -1
  153. package/dist/db-update-Br0diOCo.mjs.map +0 -1
  154. package/dist/db-verify-CKPsRFrj-T7nSt7yT.mjs.map +0 -1
  155. package/dist/errors--qsXZUtL.d.mts.map +0 -1
  156. package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +0 -1
  157. package/dist/format-ByDm2goZ-BIRlFoo6.mjs.map +0 -1
  158. package/dist/migrate-BdVFDKF2.mjs.map +0 -1
  159. package/dist/migration-check-CcG-fB8r-qpu6xdbA.mjs.map +0 -1
  160. package/dist/migration-log-CS5IWcNq-DI7FTHCA.mjs.map +0 -1
  161. package/dist/migration-new-GmW2anVb.mjs.map +0 -1
  162. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +0 -1
  163. package/dist/migration-plan-q_L84PN1-ClkGgtVz.mjs.map +0 -1
  164. package/dist/migration-show--pW4XhKs.mjs.map +0 -1
  165. package/dist/migration-status-CFlzlRmu-QHUxHm_l.mjs.map +0 -1
  166. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +0 -1
  167. package/dist/ref-sHE8zOcm.mjs.map +0 -1
  168. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +0 -1
  169. package/dist/spaces-C27bA-xc.mjs.map +0 -1
  170. package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +0 -1
@@ -10,7 +10,7 @@ import { t as MigrationPackage } from "./package-N9PPdFV_.mjs";
10
10
  import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
11
11
  import { a as buildMigrationArtifacts, i as MigrationMeta, n as MigrationArtifacts, o as isDirectEntrypoint, r as MigrationContractViews, t as Migration } from "./migration-B2ljMJim.mjs";
12
12
  import "./metadata-BtscDay2.mjs";
13
- import { a as errorDescriptorHeadHashMismatch, c as errorNoInvariantPath, i as errorContractSnapshotMissing, l as errorUnknownInvariant, n as NoInvariantPathStructuralEdge, o as errorInvalidJson, r as errorContractSnapshotHashMismatch, s as errorInvalidRefName, t as MigrationToolsError } from "./errors--qsXZUtL.mjs";
13
+ import { a as errorDescriptorHeadHashMismatch, c as errorNoInvariantPath, i as errorContractSnapshotMissing, l as errorUnknownInvariant, n as NoInvariantPathStructuralEdge, o as errorInvalidJson, r as errorContractSnapshotHashMismatch, s as errorInvalidRefName, t as MigrationToolsError } from "./errors-AkMBj-YP.mjs";
14
14
  import "./io-DYfeLJxR.mjs";
15
15
  import { a as readContractSnapshotJsonTolerant, i as readContractSnapshotJson, n as contractSnapshotDir, o as snapshotsImportPathFrom, r as readContractSnapshotDts, s as writeContractSnapshot, t as ContractSnapshotInput } from "./contract-snapshot-store-CbqynbtE.mjs";
16
16
  import { n as computeMigrationHash, r as verifyMigrationHash, t as VerifyResult } from "./hash-XZYYKJ-i.mjs";
@@ -19,5 +19,5 @@ import { n as isGraphNode, t as assertHashIsGraphNode } from "./migration-graph-
19
19
  import { t as EMPTY_CONTRACT_HASH } from "./constants-Dkcn8Qu4.mjs";
20
20
  import { t as ledgerOriginFromStored } from "./ledger-origin-BGRN77Oy.mjs";
21
21
  import { a as writeMigrationTs, i as shebangLineFor, n as detectScaffoldRuntime, r as hasMigrationTs, t as ScaffoldRuntime } from "./migration-ts-CNaAtK8C.mjs";
22
- import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-DxFj5y8l.mjs";
22
+ import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-D5qtTlhj.mjs";
23
23
  export { APP_SPACE_ID, type AggregateContractSpace, type AggregateCurrentDBState, type AggregateMigrationEdgeRef, type CallerPolicy, type ComputeExtensionSpaceApplyPathInputs, type ContractAtOptions, type ContractAtResult, type ContractMarkerRecordLike, type ContractRef, type ContractRefProvenance, type ContractSnapshotInput, type ContractSpaceAggregate, type ContractSpaceArtifactInputs, type ContractSpaceHeadRecord, type ContractSpaceHeadRef, type DeclaredExtensionEntry, type DescriptorSelfConsistencyInputs, type DiskContractSpaceState, EMPTY_CONTRACT_HASH, type ExtensionSpaceApplyPathOutcome, HEAD_REF_NAME, type IntegrityComputationInput, type IntegrityQueryOptions, type IntegritySpaceState, type IntegrityViolation, type LoadAggregateInput, type MarkerCheckResult, type MarkerCheckSection, Migration, type MigrationArtifacts, MigrationContractViews, type MigrationEdge, type MigrationGraph, type MigrationMeta, type MigrationMetadata$1 as MigrationMetadata, type MigrationOps, type MigrationPackage, type MigrationRef, type MigrationRefProvenance, MigrationToolsError, type NoInvariantPathStructuralEdge, type OnDiskMigrationPackage, type PackageLoadProblem, type PathDecision, type PerSpacePlan, type PlannerError, type PlannerInput, type PlannerOutput, type PlannerSuccess, RESERVED_SPACE_SUBDIR_NAMES, type ReadMigrationsDirResult, type RefEntry, type RefResolutionAmbiguous, type RefResolutionContext, type RefResolutionError, type RefResolutionInvalidFormat, type RefResolutionNotFound, type RefResolutionWrongGrammar, type Refs, type ResolveRecordedPathInputs, type ResolveRecordedPathOutcome, SPACE_REFS_DIRNAME, type ScaffoldRuntime, type SchemaCheckSection, type SpaceApplyInput, type SpaceMarkerRecord, type SpacePlanInput, type SpacePlanOutput, type SpaceVerifierViolation, type ValidSpaceId, type VerifierError, type VerifierInput, type VerifierOutput, type VerifierSuccess, type VerifyContractSpacesInputs, type VerifyContractSpacesResult, type VerifyResult, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, formatMigrationDirName, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
@@ -1,17 +1,17 @@
1
- import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
- import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
1
+ import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
+ import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
3
3
  import { n as verifyMigrationHash, t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
4
- import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-lXzy6txi-DAoP4nTE.mjs";
5
- import { a as materialiseMigrationPackage, c as writeMigrationMetadata, i as materialiseExtensionMigrationPackageIfMissing, l as writeMigrationOps, n as copyFilesWithRename, o as readMigrationPackage, r as formatMigrationDirName, s as readMigrationsDir, u as writeMigrationPackage } from "./io-C8TdyBKt-DloEBi70.mjs";
4
+ import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-CMcQxRas-CXX9uhQW.mjs";
5
+ import { a as materialiseMigrationPackage, c as writeMigrationMetadata, i as materialiseExtensionMigrationPackageIfMissing, l as writeMigrationOps, n as copyFilesWithRename, o as readMigrationPackage, r as formatMigrationDirName, s as readMigrationsDir, u as writeMigrationPackage } from "./io-CL3hSv42-DGZtTs89.mjs";
6
6
  import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
7
- import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
8
- import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs";
9
- import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-C27bA-xc.mjs";
10
- import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
11
- import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
12
- import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-B4mhR4Sk.mjs";
13
- import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-BjJBWPjX.mjs";
7
+ import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-D6bN-mX0-DwMWY8DA.mjs";
8
+ import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs";
9
+ import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-BNd2Tlk0.mjs";
10
+ import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-h9ejuZla-ewjYM5wz.mjs";
11
+ import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-DtoeUivZ-qay0UMSP.mjs";
12
+ import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-i-rfetSO.mjs";
13
+ import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-BsdziDFA.mjs";
14
14
  import { i as writeMigrationTs, n as hasMigrationTs, r as shebangLineFor, t as detectScaffoldRuntime } from "./migration-ts-FyF55c4M.mjs";
15
- import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-BuUmO7It.mjs";
15
+ import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-diUAhNaa.mjs";
16
16
  import { t as ledgerOriginFromStored } from "./ledger-origin-D7PN4Fon.mjs";
17
17
  export { APP_SPACE_ID, EMPTY_CONTRACT_HASH, HEAD_REF_NAME, Migration, MigrationContractViews, MigrationToolsError, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, formatMigrationDirName, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
@@ -1,2 +1,2 @@
1
- import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-B4mhR4Sk.mjs";
1
+ import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-i-rfetSO.mjs";
2
2
  export { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration };
@@ -1,2 +1,2 @@
1
- import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
1
+ import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
2
2
  export { contractSnapshotDir, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, snapshotsImportPathFrom, writeContractSnapshot };
@@ -1,2 +1,2 @@
1
- import { a as errorDescriptorHeadHashMismatch, c as errorNoInvariantPath, i as errorContractSnapshotMissing, l as errorUnknownInvariant, n as NoInvariantPathStructuralEdge, o as errorInvalidJson, r as errorContractSnapshotHashMismatch, s as errorInvalidRefName, t as MigrationToolsError } from "./errors--qsXZUtL.mjs";
1
+ import { a as errorDescriptorHeadHashMismatch, c as errorNoInvariantPath, i as errorContractSnapshotMissing, l as errorUnknownInvariant, n as NoInvariantPathStructuralEdge, o as errorInvalidJson, r as errorContractSnapshotHashMismatch, s as errorInvalidRefName, t as MigrationToolsError } from "./errors-AkMBj-YP.mjs";
2
2
  export { MigrationToolsError, type NoInvariantPathStructuralEdge, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant };
@@ -1,2 +1,2 @@
1
- import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
1
+ import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
2
  export { MigrationToolsError, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant };
@@ -1,2 +1,2 @@
1
- import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-lXzy6txi-DAoP4nTE.mjs";
1
+ import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-CMcQxRas-CXX9uhQW.mjs";
2
2
  export { deriveProvidedInvariants, validateInvariantId };
@@ -1,2 +1,2 @@
1
- import { a as materialiseMigrationPackage, c as writeMigrationMetadata, i as materialiseExtensionMigrationPackageIfMissing, l as writeMigrationOps, n as copyFilesWithRename, o as readMigrationPackage, r as formatMigrationDirName, s as readMigrationsDir, u as writeMigrationPackage } from "./io-C8TdyBKt-DloEBi70.mjs";
1
+ import { a as materialiseMigrationPackage, c as writeMigrationMetadata, i as materialiseExtensionMigrationPackageIfMissing, l as writeMigrationOps, n as copyFilesWithRename, o as readMigrationPackage, r as formatMigrationDirName, s as readMigrationsDir, u as writeMigrationPackage } from "./io-CL3hSv42-DGZtTs89.mjs";
2
2
  export { copyFilesWithRename, formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, readMigrationPackage, readMigrationsDir, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage };
@@ -1,3 +1,3 @@
1
- import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
2
- import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
1
+ import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-D6bN-mX0-DwMWY8DA.mjs";
2
+ import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-h9ejuZla-ewjYM5wz.mjs";
3
3
  export { assertHashIsGraphNode, detectCycles, detectOrphans, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, isGraphNode, reconstructGraph };
@@ -1,2 +1,2 @@
1
- import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-BuUmO7It.mjs";
1
+ import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-diUAhNaa.mjs";
2
2
  export { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };
@@ -1,2 +1,2 @@
1
- import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-BjJBWPjX.mjs";
1
+ import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-BsdziDFA.mjs";
2
2
  export { findEdgeByDirName, parseContractRef, parseMigrationRef };
@@ -1,2 +1,2 @@
1
- import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
1
+ import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-DtoeUivZ-qay0UMSP.mjs";
2
2
  export { HEAD_REF_NAME, deleteRef, readRef, readRefs, refsByContractHash, resolveRef, resolveRefsByContractHash, validateRefName, validateRefValue, writeRef };
@@ -1,3 +1,3 @@
1
1
  import { a as VerifyContractSpacesResult, i as VerifyContractSpacesInputs, n as SpaceMarkerRecord, o as listContractSpaceDirectories, r as SpaceVerifierViolation, s as verifyContractSpaces, t as ContractSpaceHeadRecord } from "./verify-contract-spaces-Cc1u_wJo-BilPJS2S.mjs";
2
- import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-DxFj5y8l.mjs";
2
+ import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-D5qtTlhj.mjs";
3
3
  export { APP_SPACE_ID, type ComputeExtensionSpaceApplyPathInputs, type ContractSpaceArtifactInputs, type ContractSpaceHeadRecord, type ContractSpaceHeadRef, type DescriptorSelfConsistencyInputs, type DiskContractSpaceState, type ExtensionSpaceApplyPathOutcome, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, type SpaceApplyInput, type SpaceMarkerRecord, type SpacePlanInput, type SpacePlanOutput, type SpaceVerifierViolation, type ValidSpaceId, type VerifyContractSpacesInputs, type VerifyContractSpacesResult, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };
@@ -1,3 +1,3 @@
1
- import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs";
2
- import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-C27bA-xc.mjs";
1
+ import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs";
2
+ import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-BNd2Tlk0.mjs";
3
3
  export { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };
@@ -1,8 +1,8 @@
1
- import { O as errorRuntime$1 } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
1
+ import { O as errorRuntime$1 } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
2
2
  import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver } from "./import-roots-NDOIEDVj.mjs";
3
3
  import { dirname, join, resolve } from "pathe";
4
4
  import { readFileSync } from "node:fs";
5
- //#region ../../../1-framework/3-tooling/cli/dist/project-import-root-CpwLCDLY.mjs
5
+ //#region ../../../1-framework/3-tooling/cli/dist/project-import-root-C_bd0ooL.mjs
6
6
  /**
7
7
  * The import root of the project being emitted for, read from its own
8
8
  * manifest.
@@ -42,10 +42,11 @@ function nearestManifest(from) {
42
42
  try {
43
43
  raw = readFileSync(path, "utf8");
44
44
  } catch (cause) {
45
- if (!MANIFEST_ABSENT_CODES.has(errorCode(cause) ?? "")) throw errorRuntime$1(`Failed to read ${path}`, {
45
+ if (!MANIFEST_ABSENT_CODES.has(errorCode(cause) ?? "")) throw errorRuntime$1("CLI.PROJECT_MANIFEST_UNREADABLE", `Failed to read ${path}`, {
46
46
  why: `\`${path}\` exists but could not be read: ${cause instanceof Error ? cause.message : String(cause)}`,
47
47
  fix: `Make \`${path}\` readable, then re-run the command. Emission reads it to decide which package names generated files should import.`,
48
- meta: { path }
48
+ meta: { path },
49
+ cause
49
50
  });
50
51
  const parent = dirname(dir);
51
52
  if (parent === dir) return void 0;
@@ -56,13 +57,14 @@ function nearestManifest(from) {
56
57
  try {
57
58
  parsed = JSON.parse(raw);
58
59
  } catch (cause) {
59
- throw errorRuntime$1(`Failed to parse ${path}`, {
60
+ throw errorRuntime$1("CLI.PROJECT_MANIFEST_INVALID", `Failed to parse ${path}`, {
60
61
  why: `\`${path}\` is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`,
61
62
  fix: `Fix the JSON syntax in \`${path}\` (a missing comma or unbalanced brace is the most common cause), then re-run the command. Emission reads it to decide which package names generated files should import.`,
62
- meta: { path }
63
+ meta: { path },
64
+ cause
63
65
  });
64
66
  }
65
- if (!isRecord(parsed)) throw errorRuntime$1(`Failed to read ${path}`, {
67
+ if (!isRecord(parsed)) throw errorRuntime$1("CLI.PROJECT_MANIFEST_INVALID", `Failed to read ${path}`, {
66
68
  why: `\`${path}\` is valid JSON but not a JSON object, so it states no dependencies.`,
67
69
  fix: `Make \`${path}\` a JSON object with the usual manifest fields, then re-run the command. Emission reads it to decide which package names generated files should import.`,
68
70
  meta: { path }
@@ -96,4 +98,4 @@ function createProjectSpecifierResolver(configPath) {
96
98
  //#endregion
97
99
  export { createProjectSpecifierResolver as t };
98
100
 
99
- //# sourceMappingURL=project-import-root-CpwLCDLY-DkVwAnWj.mjs.map
101
+ //# sourceMappingURL=project-import-root-C_bd0ooL-CLXW-gp6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-import-root-C_bd0ooL-CLXW-gp6.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/project-import-root-C_bd0ooL.mjs"],"sourcesContent":["import { rt as errorRuntime } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { dirname, join, resolve } from \"pathe\";\nimport { readFileSync } from \"node:fs\";\nimport { createImportSpecifierResolver, importRootForDependencies, internalImportRoot } from \"@internal/publish-surface/import-roots\";\n//#region src/utils/project-import-root.ts\n/**\n* The import root of the project being emitted for, read from its own\n* manifest.\n*\n* Generated files are kept by the application, so every package name in them\n* has to be one the application can resolve — which means one of its direct\n* dependencies (ADR 242). The application already states those in\n* `package.json`, so emission reads them instead of taking a mode from\n* configuration that could disagree with what is installed.\n*/\nconst DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\"];\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** The error codes that mean \"no manifest here\", as opposed to \"cannot read it\". */\nconst MANIFEST_ABSENT_CODES = /* @__PURE__ */ new Set([\"ENOENT\", \"ENOTDIR\"]);\nfunction errorCode(error) {\n\tif (!isRecord(error)) return void 0;\n\tconst code = error[\"code\"];\n\treturn typeof code === \"string\" ? code : void 0;\n}\n/**\n* The nearest `package.json` at or above `from`, or `undefined` if there is\n* none. The nearest one wins: a package inside a workspace states its own\n* dependencies, and the workspace root's are somebody else's.\n*\n* @throws {CliStructuredError} when a manifest is there but cannot be used —\n* unreadable, not valid JSON, or not a JSON object. Only \"there is no manifest\n* at this level\" continues the walk up; treating a permissions failure that\n* way would silently emit against the wrong project's dependencies.\n*/\nfunction nearestManifest(from) {\n\tlet dir = from;\n\twhile (true) {\n\t\tconst path = join(dir, \"package.json\");\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = readFileSync(path, \"utf8\");\n\t\t} catch (cause) {\n\t\t\tif (!MANIFEST_ABSENT_CODES.has(errorCode(cause) ?? \"\")) throw errorRuntime(\"CLI.PROJECT_MANIFEST_UNREADABLE\", `Failed to read ${path}`, {\n\t\t\t\twhy: `\\`${path}\\` exists but could not be read: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: `Make \\`${path}\\` readable, then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\t\tmeta: { path },\n\t\t\t\tcause\n\t\t\t});\n\t\t\tconst parent = dirname(dir);\n\t\t\tif (parent === dir) return void 0;\n\t\t\tdir = parent;\n\t\t\tcontinue;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch (cause) {\n\t\t\tthrow errorRuntime(\"CLI.PROJECT_MANIFEST_INVALID\", `Failed to parse ${path}`, {\n\t\t\t\twhy: `\\`${path}\\` is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: `Fix the JSON syntax in \\`${path}\\` (a missing comma or unbalanced brace is the most common cause), then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\t\tmeta: { path },\n\t\t\t\tcause\n\t\t\t});\n\t\t}\n\t\tif (!isRecord(parsed)) throw errorRuntime(\"CLI.PROJECT_MANIFEST_INVALID\", `Failed to read ${path}`, {\n\t\t\twhy: `\\`${path}\\` is valid JSON but not a JSON object, so it states no dependencies.`,\n\t\t\tfix: `Make \\`${path}\\` a JSON object with the usual manifest fields, then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\tmeta: { path }\n\t\t});\n\t\treturn parsed;\n\t}\n}\nfunction declaredDependencies(manifest) {\n\treturn DEPENDENCY_FIELDS.flatMap((field) => {\n\t\tconst value = manifest[field];\n\t\treturn isRecord(value) ? Object.keys(value) : [];\n\t});\n}\n/**\n* The import root for the project that owns `configPath`, or for the working\n* directory when the config was discovered rather than named.\n*\n* A project with no manifest, or one that names no published package, is on\n* the internal root — which emits every specifier exactly as authored, so a\n* project that has not moved to published names is unaffected.\n*/\nfunction projectImportRoot(configPath) {\n\tconst manifest = nearestManifest(configPath === void 0 ? resolve(\".\") : dirname(resolve(configPath)));\n\tif (manifest === void 0) return internalImportRoot;\n\treturn importRootForDependencies(declaredDependencies(manifest));\n}\n/** The specifier resolver emission should use for the project owning `configPath`. */\nfunction createProjectSpecifierResolver(configPath) {\n\treturn createImportSpecifierResolver(projectImportRoot(configPath));\n}\n//#endregion\nexport { createProjectSpecifierResolver as t };\n\n//# sourceMappingURL=project-import-root-C_bd0ooL.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,oBAAoB,CAAC,gBAAgB,iBAAiB;AAC5D,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC3E;;AAEA,MAAM,wCAAwC,IAAI,IAAI,CAAC,UAAU,SAAS,CAAC;AAC3E,SAAS,UAAU,OAAO;CACzB,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO,KAAK;CAClC,MAAM,OAAO,MAAM;CACnB,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK;AAC/C;;;;;;;;;;;AAWA,SAAS,gBAAgB,MAAM;CAC9B,IAAI,MAAM;CACV,OAAO,MAAM;EACZ,MAAM,OAAO,KAAK,KAAK,cAAc;EACrC,IAAI;EACJ,IAAI;GACH,MAAM,aAAa,MAAM,MAAM;EAChC,SAAS,OAAO;GACf,IAAI,CAAC,sBAAsB,IAAI,UAAU,KAAK,KAAK,EAAE,GAAG,MAAMA,eAAa,mCAAmC,kBAAkB,QAAQ;IACvI,KAAK,KAAK,KAAK,mCAAmC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IACvG,KAAK,UAAU,KAAK;IACpB,MAAM,EAAE,KAAK;IACb;GACD,CAAC;GACD,MAAM,SAAS,QAAQ,GAAG;GAC1B,IAAI,WAAW,KAAK,OAAO,KAAK;GAChC,MAAM;GACN;EACD;EACA,IAAI;EACJ,IAAI;GACH,SAAS,KAAK,MAAM,GAAG;EACxB,SAAS,OAAO;GACf,MAAMA,eAAa,gCAAgC,mBAAmB,QAAQ;IAC7E,KAAK,KAAK,KAAK,wBAAwB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC5F,KAAK,4BAA4B,KAAK;IACtC,MAAM,EAAE,KAAK;IACb;GACD,CAAC;EACF;EACA,IAAI,CAAC,SAAS,MAAM,GAAG,MAAMA,eAAa,gCAAgC,kBAAkB,QAAQ;GACnG,KAAK,KAAK,KAAK;GACf,KAAK,UAAU,KAAK;GACpB,MAAM,EAAE,KAAK;EACd,CAAC;EACD,OAAO;CACR;AACD;AACA,SAAS,qBAAqB,UAAU;CACvC,OAAO,kBAAkB,SAAS,UAAU;EAC3C,MAAM,QAAQ,SAAS;EACvB,OAAO,SAAS,KAAK,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC;CAChD,CAAC;AACF;;;;;;;;;AASA,SAAS,kBAAkB,YAAY;CACtC,MAAM,WAAW,gBAAgB,eAAe,KAAK,IAAI,QAAQ,GAAG,IAAI,QAAQ,QAAQ,UAAU,CAAC,CAAC;CACpG,IAAI,aAAa,KAAK,GAAG,OAAO;CAChC,OAAO,0BAA0B,qBAAqB,QAAQ,CAAC;AAChE;;AAEA,SAAS,+BAA+B,YAAY;CACnD,OAAO,8BAA8B,kBAAkB,UAAU,CAAC;AACnE"}
@@ -1,23 +1,23 @@
1
- import { t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
- import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
1
+ import { t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
+ import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
3
3
  import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
4
- import { r as findLatestMigration } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
5
- import { E as errorRefSetHashNotInGraph, N as errorUnexpected, O as errorRuntime$1, P as formatCommandHelp, Q as mapRefResolutionError, T as errorRefSetEmptySentinel, Z as mapMigrationToolsError, at as resolveMigrationPaths, et as parseGlobalFlags, h as errorFileNotFound, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, w as errorRefSetBundleNotFound } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
4
+ import { r as findLatestMigration } from "./migration-graph-D6bN-mX0-DwMWY8DA.mjs";
5
+ import { $ as parseGlobalFlags, E as errorRefSetHashNotInGraph, N as errorUnexpected, O as errorRuntime$1, P as formatCommandHelp, T as errorRefSetEmptySentinel, Z as mapRefResolutionError, et as parseGlobalFlagsOrExit, h as errorFileNotFound, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, t as CliStructuredError$1, w as errorRefSetBundleNotFound } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
6
6
  import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
7
- import { n as isGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
8
- import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, u as validateRefValue } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
9
- import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
10
- import { n as parseContractRef } from "./ref-resolution-BjJBWPjX.mjs";
7
+ import { n as isGraphNode } from "./graph-membership-h9ejuZla-ewjYM5wz.mjs";
8
+ import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, u as validateRefValue } from "./refs-DtoeUivZ-qay0UMSP.mjs";
9
+ import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs";
10
+ import { n as parseContractRef } from "./ref-resolution-BsdziDFA.mjs";
11
11
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
12
12
  import { join } from "pathe";
13
13
  import { Command } from "commander";
14
14
  //#region ../../../1-framework/3-tooling/cli/dist/commands/ref.mjs
15
15
  function mapError(error) {
16
- if (MigrationToolsError.is(error)) return mapMigrationToolsError(error);
16
+ if (MigrationToolsError.is(error)) return error;
17
17
  return errorUnexpected(error instanceof Error ? error.message : String(error));
18
18
  }
19
19
  function cliErrorInvalidRefName(name) {
20
- return errorRuntime$1(`Invalid ref name "${name}"`, {
20
+ return errorRuntime$1("MIGRATION.INVALID_REF_NAME", `Invalid ref name "${name}"`, {
21
21
  why: `Ref name "${name}" does not match the required format`,
22
22
  fix: "Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments"
23
23
  });
@@ -168,4 +168,4 @@ function createRefCommand() {
168
168
  //#endregion
169
169
  export { executeRefSetCommand as i, executeRefDeleteCommand as n, executeRefListCommand as r, createRefCommand as t };
170
170
 
171
- //# sourceMappingURL=ref-sHE8zOcm.mjs.map
171
+ //# sourceMappingURL=ref-DjZ5Y8ju.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-DjZ5Y8ju.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/ref.mjs"],"sourcesContent":["import { $ as errorRefSetBundleNotFound, F as CliStructuredError, O as formatCommandHelp, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, et as errorRefSetEmptySentinel, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapRefResolutionError, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorRefSetHashNotInGraph, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { n as buildReadAggregate } from \"../contract-space-aggregate-loader-CziO_ZRW.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join } from \"pathe\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { deleteRef, readRefs, validateRefName, validateRefValue, writeRef } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/ref.ts\nfunction mapError(error) {\n\tif (MigrationToolsError.is(error)) return error;\n\treturn errorUnexpected(error instanceof Error ? error.message : String(error));\n}\nfunction cliErrorInvalidRefName(name) {\n\treturn errorRuntime(\"MIGRATION.INVALID_REF_NAME\", `Invalid ref name \"${name}\"`, {\n\t\twhy: `Ref name \"${name}\" does not match the required format`,\n\t\tfix: \"Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments\"\n\t});\n}\nasync function executeRefSetCommand(name, contractInput, options) {\n\tif (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\t\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tlet resolvedHash;\n\t\tif (validateRefValue(contractInput)) resolvedHash = contractInput;\n\t\telse {\n\t\t\tconst refResult = parseContractRef(contractInput, {\n\t\t\t\tgraph,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\t\tresolvedHash = refResult.value.hash;\n\t\t}\n\t\tif (resolvedHash === EMPTY_CONTRACT_HASH) return notOk(errorRefSetEmptySentinel(resolvedHash));\n\t\tif (!isGraphNode(resolvedHash, graph)) {\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\treturn notOk(errorRefSetHashNotInGraph(resolvedHash, [...graph.nodes].sort(), graphTip));\n\t\t}\n\t\tif (!bundles.find((bundle) => bundle.metadata.to === resolvedHash)) return notOk(errorRefSetBundleNotFound(resolvedHash));\n\t\tconst contractJsonPath = join(contractSnapshotDir(migrationsDir, resolvedHash), \"contract.json\");\n\t\ttry {\n\t\t\tawait readContractSnapshotJson(migrationsDir, resolvedHash);\n\t\t} catch (readError) {\n\t\t\tif (MigrationToolsError.is(readError) && readError.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return notOk(errorFileNotFound(contractJsonPath, {\n\t\t\t\twhy: `Migration bundle for hash ${resolvedHash} is missing its contract snapshot at ${contractJsonPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t\t}));\n\t\t\tthrow readError;\n\t\t}\n\t\tawait writeRef(refsDir, name, {\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefDeleteCommand(name, options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\tawait deleteRef(refsDir, name);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\tdeleted: true\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefListCommand(options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\trefs: await readRefs(refsDir)\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nfunction createRefSetCommand() {\n\tconst command = new Command(\"set\");\n\tsetCommandDescriptions(command, \"Set a ref to a contract reference\", \"Sets a named ref to point to a resolved contract reference (hash, alias, or path) in migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name (e.g., staging, production)\").argument(\"<contract>\", \"Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, hash, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefSetCommand(name, hash, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Set ref \"${value.ref}\" → ${value.hash}`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefDeleteCommand() {\n\tconst command = new Command(\"delete\");\n\tsetCommandDescriptions(command, \"Delete a ref\", \"Removes a named ref from migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name to delete\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefDeleteCommand(name, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Deleted ref \"${value.ref}\"`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List all refs\", \"Lists all named refs from migrations/refs/.\");\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefListCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tconst entries = Object.entries(value.refs);\n\t\t\t\tif (entries.length === 0) ui.output(\"No refs defined\");\n\t\t\t\telse for (const [refName, entry] of entries) {\n\t\t\t\t\tconst invariantsSuffix = entry.invariants.length > 0 ? ` [invariants: ${entry.invariants.join(\", \")}]` : \"\";\n\t\t\t\t\tui.output(`${refName} → ${entry.hash}${invariantsSuffix}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefCommand() {\n\tconst command = new Command(\"ref\");\n\tsetCommandDescriptions(command, \"Manage contract refs\", \"Manage named refs in migrations/refs/. Refs map logical environment\\nnames (e.g., staging, production) to contract hashes.\");\n\taddGlobalOptions(command).configureHelp({\n\t\tformatHelp: (cmd) => formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t}),\n\t\tsubcommandDescription: () => \"\"\n\t});\n\tcommand.addCommand(createRefSetCommand());\n\tcommand.addCommand(createRefDeleteCommand());\n\tcommand.addCommand(createRefListCommand());\n\treturn command;\n}\n//#endregion\nexport { createRefCommand, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand };\n\n//# sourceMappingURL=ref.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,SAAS,SAAS,OAAO;CACxB,IAAI,oBAAoB,GAAG,KAAK,GAAG,OAAO;CAC1C,OAAO,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAC9E;AACA,SAAS,uBAAuB,MAAM;CACrC,OAAOA,eAAa,8BAA8B,qBAAqB,KAAK,IAAI;EAC/E,KAAK,aAAa,KAAK;EACvB,KAAK;CACN,CAAC;AACF;AACA,eAAe,qBAAqB,MAAM,eAAe,SAAS;CACjE,IAAI,CAAC,gBAAg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M,MAAM,GAAG,OAAO,KAAK,UAAU,KAAK,CAAC;QAC1C,IAAI,CAAC,MAAM,OAAO;IACtB,MAAM,UAAU,OAAO,QAAQ,MAAM,IAAI;IACzC,IAAI,QAAQ,WAAW,GAAG,GAAG,OAAO,iBAAiB;SAChD,KAAK,MAAM,CAAC,SAAS,UAAU,SAAS;KAC5C,MAAM,mBAAmB,MAAM,WAAW,SAAS,IAAI,iBAAiB,MAAM,WAAW,KAAK,IAAI,EAAE,KAAK;KACzG,GAAG,OAAO,GAAG,QAAQ,KAAK,MAAM,OAAO,kBAAkB;IAC1D;GACD;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR;AACA,SAAS,mBAAmB;CAC3B,MAAM,UAAU,IAAI,QAAQ,KAAK;CACjC,uBAAuB,SAAS,wBAAwB,4HAA4H;CACpL,iBAAiB,OAAO,CAAC,CAAC,cAAc;EACvC,aAAa,QAAQ,kBAAkB;GACtC,SAAS;GACT,OAAO,iBAAiB,CAAC,CAAC;EAC3B,CAAC;EACD,6BAA6B;CAC9B,CAAC;CACD,QAAQ,WAAW,oBAAoB,CAAC;CACxC,QAAQ,WAAW,uBAAuB,CAAC;CAC3C,QAAQ,WAAW,qBAAqB,CAAC;CACzC,OAAO;AACR"}
@@ -1,6 +1,6 @@
1
- import { b as errorInvalidRefName } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
- import { o as writeContractSnapshot } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
3
- import { d as writeRef, l as validateRefName } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
1
+ import { b as errorInvalidRefName } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
+ import { o as writeContractSnapshot } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
3
+ import { d as writeRef, l as validateRefName } from "./refs-DtoeUivZ-qay0UMSP.mjs";
4
4
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
5
5
  import { readFile } from "node:fs/promises";
6
6
  //#region ../../../1-framework/3-tooling/cli/dist/ref-advancement-CSPMoQs3.mjs
@@ -54,4 +54,4 @@ async function buildRefAdvancementFields(options) {
54
54
  //#endregion
55
55
  export { readContractIR as i, computeRefAdvancementName as n, executeRefAdvancement as r, buildRefAdvancementFields as t };
56
56
 
57
- //# sourceMappingURL=ref-advancement-CSPMoQs3-fEipZrdu.mjs.map
57
+ //# sourceMappingURL=ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-advancement-CSPMoQs3-fEipZrdu.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-advancement-CSPMoQs3.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { readFile } from \"node:fs/promises\";\nimport { errorInvalidRefName } from \"@internal/migration-tools/errors\";\nimport { writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { validateRefName, writeRef } from \"@internal/migration-tools/refs\";\n//#region src/utils/ref-advancement.ts\nfunction computeRefAdvancementName(options) {\n\tif (options.advanceRef !== void 0) return options.advanceRef;\n\tif (options.db === void 0) return \"db\";\n\treturn null;\n}\nasync function readContractIR(contractJson, contractJsonPath) {\n\treturn {\n\t\tcontract: contractJson,\n\t\tcontractDts: await readFile(contractJsonPath.replace(/\\.json$/i, \".d.ts\"), \"utf-8\")\n\t};\n}\nasync function executeRefAdvancement(refsDir, migrationsDir, name, hash, contractIR) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tawait writeContractSnapshot(migrationsDir, hash, {\n\t\tcontractJson: contractIR.contract,\n\t\tcontractDts: contractIR.contractDts\n\t});\n\tawait writeRef(refsDir, name, {\n\t\thash,\n\t\tinvariants: []\n\t});\n\treturn {\n\t\tname,\n\t\thash\n\t};\n}\nasync function buildRefAdvancementFields(options) {\n\tconst name = computeRefAdvancementName({\n\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t...ifDefined(\"db\", options.db)\n\t});\n\tif (name === null) return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: null\n\t};\n\tif (options.mode === \"plan\") return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: {\n\t\t\tname,\n\t\t\thash: options.hash\n\t\t}\n\t};\n\treturn {\n\t\tadvancedRef: await executeRefAdvancement(options.refsDir, options.migrationsDir, name, options.hash, options.contractIR),\n\t\tplannedAdvanceRef: null\n\t};\n}\n//#endregion\nexport { readContractIR as i, computeRefAdvancementName as n, executeRefAdvancement as r, buildRefAdvancementFields as t };\n\n//# sourceMappingURL=ref-advancement-CSPMoQs3.mjs.map"],"mappings":";;;;;;AAMA,SAAS,0BAA0B,SAAS;CAC3C,IAAI,QAAQ,eAAe,KAAK,GAAG,OAAO,QAAQ;CAClD,IAAI,QAAQ,OAAO,KAAK,GAAG,OAAO;CAClC,OAAO;AACR;AACA,eAAe,eAAe,cAAc,kBAAkB;CAC7D,OAAO;EACN,UAAU;EACV,aAAa,MAAM,SAAS,iBAAiB,QAAQ,YAAY,OAAO,GAAG,OAAO;CACnF;AACD;AACA,eAAe,sBAAsB,SAAS,eAAe,MAAM,MAAM,YAAY;CACpF,IAAI,CAAC,gBAAgB,IAAI,GAAG,MAAM,oBAAoB,IAAI;CAC1D,MAAM,sBAAsB,eAAe,MAAM;EAChD,cAAc,WAAW;EACzB,aAAa,WAAW;CACzB,CAAC;CACD,MAAM,SAAS,SAAS,MAAM;EAC7B;EACA,YAAY,CAAC;CACd,CAAC;CACD,OAAO;EACN;EACA;CACD;AACD;AACA,eAAe,0BAA0B,SAAS;CACjD,MAAM,OAAO,0BAA0B;EACtC,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,MAAM,QAAQ,EAAE;CAC9B,CAAC;CACD,IAAI,SAAS,MAAM,OAAO;EACzB,aAAa;EACb,mBAAmB;CACpB;CACA,IAAI,QAAQ,SAAS,QAAQ,OAAO;EACnC,aAAa;EACb,mBAAmB;GAClB;GACA,MAAM,QAAQ;EACf;CACD;CACA,OAAO;EACN,aAAa,MAAM,sBAAsB,QAAQ,SAAS,QAAQ,eAAe,MAAM,QAAQ,MAAM,QAAQ,UAAU;EACvH,mBAAmB;CACpB;AACD"}
1
+ {"version":3,"file":"ref-advancement-CSPMoQs3-CPkL3IFF.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-advancement-CSPMoQs3.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { readFile } from \"node:fs/promises\";\nimport { errorInvalidRefName } from \"@internal/migration-tools/errors\";\nimport { writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { validateRefName, writeRef } from \"@internal/migration-tools/refs\";\n//#region src/utils/ref-advancement.ts\nfunction computeRefAdvancementName(options) {\n\tif (options.advanceRef !== void 0) return options.advanceRef;\n\tif (options.db === void 0) return \"db\";\n\treturn null;\n}\nasync function readContractIR(contractJson, contractJsonPath) {\n\treturn {\n\t\tcontract: contractJson,\n\t\tcontractDts: await readFile(contractJsonPath.replace(/\\.json$/i, \".d.ts\"), \"utf-8\")\n\t};\n}\nasync function executeRefAdvancement(refsDir, migrationsDir, name, hash, contractIR) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tawait writeContractSnapshot(migrationsDir, hash, {\n\t\tcontractJson: contractIR.contract,\n\t\tcontractDts: contractIR.contractDts\n\t});\n\tawait writeRef(refsDir, name, {\n\t\thash,\n\t\tinvariants: []\n\t});\n\treturn {\n\t\tname,\n\t\thash\n\t};\n}\nasync function buildRefAdvancementFields(options) {\n\tconst name = computeRefAdvancementName({\n\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t...ifDefined(\"db\", options.db)\n\t});\n\tif (name === null) return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: null\n\t};\n\tif (options.mode === \"plan\") return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: {\n\t\t\tname,\n\t\t\thash: options.hash\n\t\t}\n\t};\n\treturn {\n\t\tadvancedRef: await executeRefAdvancement(options.refsDir, options.migrationsDir, name, options.hash, options.contractIR),\n\t\tplannedAdvanceRef: null\n\t};\n}\n//#endregion\nexport { readContractIR as i, computeRefAdvancementName as n, executeRefAdvancement as r, buildRefAdvancementFields as t };\n\n//# sourceMappingURL=ref-advancement-CSPMoQs3.mjs.map"],"mappings":";;;;;;AAMA,SAAS,0BAA0B,SAAS;CAC3C,IAAI,QAAQ,eAAe,KAAK,GAAG,OAAO,QAAQ;CAClD,IAAI,QAAQ,OAAO,KAAK,GAAG,OAAO;CAClC,OAAO;AACR;AACA,eAAe,eAAe,cAAc,kBAAkB;CAC7D,OAAO;EACN,UAAU;EACV,aAAa,MAAM,SAAS,iBAAiB,QAAQ,YAAY,OAAO,GAAG,OAAO;CACnF;AACD;AACA,eAAe,sBAAsB,SAAS,eAAe,MAAM,MAAM,YAAY;CACpF,IAAI,CAAC,gBAAgB,IAAI,GAAG,MAAM,oBAAoB,IAAI;CAC1D,MAAM,sBAAsB,eAAe,MAAM;EAChD,cAAc,WAAW;EACzB,aAAa,WAAW;CACzB,CAAC;CACD,MAAM,SAAS,SAAS,MAAM;EAC7B;EACA,YAAY,CAAC;CACd,CAAC;CACD,OAAO;EACN;EACA;CACD;AACD;AACA,eAAe,0BAA0B,SAAS;CACjD,MAAM,OAAO,0BAA0B;EACtC,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,MAAM,QAAQ,EAAE;CAC9B,CAAC;CACD,IAAI,SAAS,MAAM,OAAO;EACzB,aAAa;EACb,mBAAmB;CACpB;CACA,IAAI,QAAQ,SAAS,QAAQ,OAAO;EACnC,aAAa;EACb,mBAAmB;GAClB;GACA,MAAM,QAAQ;EACf;CACD;CACA,OAAO;EACN,aAAa,MAAM,sBAAsB,QAAQ,SAAS,QAAQ,eAAe,MAAM,QAAQ,MAAM,QAAQ,UAAU;EACvH,mBAAmB;CACpB;AACD"}
@@ -1,4 +1,4 @@
1
- import { l as validateRefName } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
1
+ import { l as validateRefName } from "./refs-DtoeUivZ-qay0UMSP.mjs";
2
2
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
3
3
  //#region ../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.mjs
4
4
  const FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;
@@ -247,4 +247,4 @@ function parseMigrationRef(input, ctx) {
247
247
  //#endregion
248
248
  export { parseContractRef as n, parseMigrationRef as r, findEdgeByDirName as t };
249
249
 
250
- //# sourceMappingURL=ref-resolution-BjJBWPjX.mjs.map
250
+ //# sourceMappingURL=ref-resolution-BsdziDFA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-resolution-BjJBWPjX.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.mjs"],"sourcesContent":["import { l as validateRefName } from \"../refs-BDbB9BRB.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/refs/types.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nconst HEX_PREFIX_PATTERN = /^[0-9a-f]{6,}$/;\nfunction isFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction isHexPrefix(input) {\n\treturn HEX_PREFIX_PATTERN.test(input);\n}\nfunction findEdgeByDirName(graph, dirName) {\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) if (edge.dirName === dirName) return edge;\n}\n//#endregion\n//#region src/refs/contract-ref.ts\n/**\n* Resolve a user-supplied string to a contract hash using the unified\n* contract-reference grammar.\n*\n* Accepted forms:\n* - `@contract` — the on-disk working contract hash (offline; requires\n* `ctx.contractHash` to be set)\n* - `@db` — the live database marker (connection-required); callers MUST\n* check `result.value.provenance.kind === 'reserved-db'` and resolve the\n* actual hash via `readAllMarkers()` before using `result.value.hash`\n* - Full storage hash (64 hex chars or `empty`)\n* - Hex prefix (6+ hex chars, must uniquely identify one contract)\n* - Ref name (looked up in the refs index)\n* - Migration directory name (resolves to the migration's `to`-contract)\n* - `<dir>^` (resolves to the migration's `from`-contract)\n*/\nfunction parseContractRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input === \"@contract\") {\n\t\tif (ctx.contractHash === void 0) return notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t\treturn ok({\n\t\t\thash: ctx.contractHash,\n\t\t\tprovenance: { kind: \"reserved-contract\" }\n\t\t});\n\t}\n\tif (input === \"@db\") return ok({\n\t\thash: \"\",\n\t\tprovenance: { kind: \"reserved-db\" }\n\t});\n\tif (isFullHash(input)) {\n\t\tif (ctx.graph.nodes.has(input)) return ok({\n\t\t\thash: input,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tif (input.endsWith(\"^\")) {\n\t\tconst dirName = input.slice(0, -1);\n\t\tif (!dirName) return notOk({\n\t\t\tkind: \"invalid-format\",\n\t\t\tinput,\n\t\t\treason: \"Missing directory name before ^\"\n\t\t});\n\t\tconst edge = findEdgeByDirName(ctx.graph, dirName);\n\t\tif (edge) return ok({\n\t\t\thash: edge.from,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"migration-from\",\n\t\t\t\tdirName\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst candidates = [];\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) {\n\t\tconst ref = ctx.refs[input];\n\t\tif (ref) candidates.push({\n\t\t\thash: ref.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: input\n\t\t\t},\n\t\t\tlabel: `ref \"${input}\"`\n\t\t});\n\t}\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) candidates.push({\n\t\thash: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"migration-to\",\n\t\t\tdirName: input\n\t\t},\n\t\tlabel: `migration directory \"${input}\"`\n\t});\n\tif (isHexPrefix(input)) {\n\t\tconst matches = [...ctx.graph.nodes].filter((n) => n.startsWith(input));\n\t\tconst [firstMatch] = matches;\n\t\tif (matches.length === 1 && firstMatch !== void 0) candidates.push({\n\t\t\thash: firstMatch,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t},\n\t\t\tlabel: `hash prefix \"${input}\"`\n\t\t});\n\t\telse if (matches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: matches,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst [firstCandidate] = candidates;\n\tif (candidates.length === 1 && firstCandidate !== void 0) return ok({\n\t\thash: firstCandidate.hash,\n\t\tprovenance: firstCandidate.provenance\n\t});\n\tif (candidates.length > 1) return notOk({\n\t\tkind: \"ambiguous\",\n\t\tinput,\n\t\tcandidates: candidates.map((c) => c.label),\n\t\tgrammar: \"contract\"\n\t});\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"contract\"\n\t});\n}\n//#endregion\n//#region src/refs/migration-ref.ts\n/**\n* Resolve a user-supplied string to a migration using the migration-reference\n* grammar.\n*\n* Accepted forms:\n* - Migration directory name (e.g. `20260101-add-users`)\n* - Migration hash (full or 6+ hex prefix)\n*\n* Wrong-grammar diagnostics are produced when the input matches a\n* contract-grammar form (ref name, `<dir>^`, contract-only hash) so the\n* user gets a targeted hint rather than a generic \"not found\".\n*/\nfunction parseMigrationRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input.endsWith(\"^\")) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: \"`^` syntax addresses contracts, not migrations\",\n\t\tfix: \"Pass the migration directory name without `^`, or use a contract-accepting flag like `--to` or `--from`.\"\n\t});\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: `\"${input}\" is a ref name, not a migration`,\n\t\tfix: \"Refs point at contracts, not migrations. Use a migration directory name or migration hash.\"\n\t});\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) return ok({\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"dir-name\",\n\t\t\tdirName: input\n\t\t}\n\t});\n\tif (isFullHash(input)) {\n\t\tconst migEdge = ctx.graph.migrationByHash.get(input);\n\t\tif (migEdge) return ok({\n\t\t\tdirName: migEdge.dirName,\n\t\t\tmigrationHash: migEdge.migrationHash,\n\t\t\tfrom: migEdge.from,\n\t\t\tto: migEdge.to,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\tif (ctx.graph.nodes.has(input)) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t}\n\tif (isHexPrefix(input)) {\n\t\tconst migMatches = [...ctx.graph.migrationByHash.entries()].filter(([hash]) => hash.startsWith(input));\n\t\tconst [firstMigMatch] = migMatches;\n\t\tif (migMatches.length === 1 && firstMigMatch !== void 0) {\n\t\t\tconst [, matchedEdge] = firstMigMatch;\n\t\t\treturn ok({\n\t\t\t\tdirName: matchedEdge.dirName,\n\t\t\t\tmigrationHash: matchedEdge.migrationHash,\n\t\t\t\tfrom: matchedEdge.from,\n\t\t\t\tto: matchedEdge.to,\n\t\t\t\tprovenance: {\n\t\t\t\t\tkind: \"hash\",\n\t\t\t\t\tinput\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (migMatches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: migMatches.map(([hash]) => hash),\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t\tif ([...ctx.graph.nodes].filter((n) => n.startsWith(input)).length > 0) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t}\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"migration\"\n\t});\n}\n//#endregion\nexport { findEdgeByDirName, parseContractRef, parseMigrationRef };\n\n//# sourceMappingURL=ref-resolution.mjs.map"],"mappings":";;;AAGA,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,SAAS,WAAW,OAAO;CAC1B,OAAO,kBAAkB,KAAK,KAAK;AACpC;AACA,SAAS,YAAY,OAAO;CAC3B,OAAO,mBAAmB,KAAK,KAAK;AACrC;AACA,SAAS,kBAAkB,OAAO,SAAS;CAC1C,KAAK,MAAM,SAAS,MAAM,aAAa,OAAO,GAAG,KAAK,MAAM,QAAQ,OAAO,IAAI,KAAK,YAAY,SAAS,OAAO;AACjH;;;;;;;;;;;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AG,OAAO,MAAM;GACpF,MAAM;GACN;GACA,iBAAiB;GACjB,SAAS;GACT,KAAK;EACN,CAAC;CACF;CACA,OAAO,MAAM;EACZ,MAAM;EACN;EACA,SAAS;CACV,CAAC;AACF"}
1
+ {"version":3,"file":"ref-resolution-BsdziDFA.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.mjs"],"sourcesContent":["import { l as validateRefName } from \"../refs-DtoeUivZ.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/refs/types.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nconst HEX_PREFIX_PATTERN = /^[0-9a-f]{6,}$/;\nfunction isFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction isHexPrefix(input) {\n\treturn HEX_PREFIX_PATTERN.test(input);\n}\nfunction findEdgeByDirName(graph, dirName) {\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) if (edge.dirName === dirName) return edge;\n}\n//#endregion\n//#region src/refs/contract-ref.ts\n/**\n* Resolve a user-supplied string to a contract hash using the unified\n* contract-reference grammar.\n*\n* Accepted forms:\n* - `@contract` — the on-disk working contract hash (offline; requires\n* `ctx.contractHash` to be set)\n* - `@db` — the live database marker (connection-required); callers MUST\n* check `result.value.provenance.kind === 'reserved-db'` and resolve the\n* actual hash via `readAllMarkers()` before using `result.value.hash`\n* - Full storage hash (64 hex chars or `empty`)\n* - Hex prefix (6+ hex chars, must uniquely identify one contract)\n* - Ref name (looked up in the refs index)\n* - Migration directory name (resolves to the migration's `to`-contract)\n* - `<dir>^` (resolves to the migration's `from`-contract)\n*/\nfunction parseContractRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input === \"@contract\") {\n\t\tif (ctx.contractHash === void 0) return notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t\treturn ok({\n\t\t\thash: ctx.contractHash,\n\t\t\tprovenance: { kind: \"reserved-contract\" }\n\t\t});\n\t}\n\tif (input === \"@db\") return ok({\n\t\thash: \"\",\n\t\tprovenance: { kind: \"reserved-db\" }\n\t});\n\tif (isFullHash(input)) {\n\t\tif (ctx.graph.nodes.has(input)) return ok({\n\t\t\thash: input,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tif (input.endsWith(\"^\")) {\n\t\tconst dirName = input.slice(0, -1);\n\t\tif (!dirName) return notOk({\n\t\t\tkind: \"invalid-format\",\n\t\t\tinput,\n\t\t\treason: \"Missing directory name before ^\"\n\t\t});\n\t\tconst edge = findEdgeByDirName(ctx.graph, dirName);\n\t\tif (edge) return ok({\n\t\t\thash: edge.from,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"migration-from\",\n\t\t\t\tdirName\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst candidates = [];\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) {\n\t\tconst ref = ctx.refs[input];\n\t\tif (ref) candidates.push({\n\t\t\thash: ref.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: input\n\t\t\t},\n\t\t\tlabel: `ref \"${input}\"`\n\t\t});\n\t}\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) candidates.push({\n\t\thash: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"migration-to\",\n\t\t\tdirName: input\n\t\t},\n\t\tlabel: `migration directory \"${input}\"`\n\t});\n\tif (isHexPrefix(input)) {\n\t\tconst matches = [...ctx.graph.nodes].filter((n) => n.startsWith(input));\n\t\tconst [firstMatch] = matches;\n\t\tif (matches.length === 1 && firstMatch !== void 0) candidates.push({\n\t\t\thash: firstMatch,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t},\n\t\t\tlabel: `hash prefix \"${input}\"`\n\t\t});\n\t\telse if (matches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: matches,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst [firstCandidate] = candidates;\n\tif (candidates.length === 1 && firstCandidate !== void 0) return ok({\n\t\thash: firstCandidate.hash,\n\t\tprovenance: firstCandidate.provenance\n\t});\n\tif (candidates.length > 1) return notOk({\n\t\tkind: \"ambiguous\",\n\t\tinput,\n\t\tcandidates: candidates.map((c) => c.label),\n\t\tgrammar: \"contract\"\n\t});\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"contract\"\n\t});\n}\n//#endregion\n//#region src/refs/migration-ref.ts\n/**\n* Resolve a user-supplied string to a migration using the migration-reference\n* grammar.\n*\n* Accepted forms:\n* - Migration directory name (e.g. `20260101-add-users`)\n* - Migration hash (full or 6+ hex prefix)\n*\n* Wrong-grammar diagnostics are produced when the input matches a\n* contract-grammar form (ref name, `<dir>^`, contract-only hash) so the\n* user gets a targeted hint rather than a generic \"not found\".\n*/\nfunction parseMigrationRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input.endsWith(\"^\")) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: \"`^` syntax addresses contracts, not migrations\",\n\t\tfix: \"Pass the migration directory name without `^`, or use a contract-accepting flag like `--to` or `--from`.\"\n\t});\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: `\"${input}\" is a ref name, not a migration`,\n\t\tfix: \"Refs point at contracts, not migrations. Use a migration directory name or migration hash.\"\n\t});\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) return ok({\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"dir-name\",\n\t\t\tdirName: input\n\t\t}\n\t});\n\tif (isFullHash(input)) {\n\t\tconst migEdge = ctx.graph.migrationByHash.get(input);\n\t\tif (migEdge) return ok({\n\t\t\tdirName: migEdge.dirName,\n\t\t\tmigrationHash: migEdge.migrationHash,\n\t\t\tfrom: migEdge.from,\n\t\t\tto: migEdge.to,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\tif (ctx.graph.nodes.has(input)) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t}\n\tif (isHexPrefix(input)) {\n\t\tconst migMatches = [...ctx.graph.migrationByHash.entries()].filter(([hash]) => hash.startsWith(input));\n\t\tconst [firstMigMatch] = migMatches;\n\t\tif (migMatches.length === 1 && firstMigMatch !== void 0) {\n\t\t\tconst [, matchedEdge] = firstMigMatch;\n\t\t\treturn ok({\n\t\t\t\tdirName: matchedEdge.dirName,\n\t\t\t\tmigrationHash: matchedEdge.migrationHash,\n\t\t\t\tfrom: matchedEdge.from,\n\t\t\t\tto: matchedEdge.to,\n\t\t\t\tprovenance: {\n\t\t\t\t\tkind: \"hash\",\n\t\t\t\t\tinput\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (migMatches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: migMatches.map(([hash]) => hash),\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t\tif ([...ctx.graph.nodes].filter((n) => n.startsWith(input)).length > 0) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t}\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"migration\"\n\t});\n}\n//#endregion\nexport { findEdgeByDirName, parseContractRef, parseMigrationRef };\n\n//# sourceMappingURL=ref-resolution.mjs.map"],"mappings":";;;AAGA,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,SAAS,WAAW,OAAO;CAC1B,OAAO,kBAAkB,KAAK,KAAK;AACpC;AACA,SAAS,YAAY,OAAO;CAC3B,OAAO,mBAAmB,KAAK,KAAK;AACrC;AACA,SAAS,kBAAkB,OAAO,SAAS;CAC1C,KAAK,MAAM,SAAS,MAAM,aAAa,OAAO,GAAG,KAAK,MAAM,QAAQ,OAAO,IAAI,KAAK,YAAY,SAAS,OAAO;AACjH;;;;;;;;;;;;;;;;;AAmBA,SAAS,iBAAiB,OAAO,KAAK;CACrC,IAAI,CAAC,OAAO,OAAO,MAAM;EACxB,MAAM;EACN;EACA,QAAQ;CACT,CAAC;CACD,IAAI,UAAU,aAAa;EAC1B,IAAI,IAAI,iBAAiB,KAAK,GAAG,OAAO,MAAM;GAC7C,MAAM;GACN;GACA,SAAS;EACV,CAAC;EACD,OAAO,GAAG;GACT,MAAM,IAAI;GACV,YAAY,EAAE,MAAM,oBAAoB;EACzC,C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AAG;GACtB,SAAS,QAAQ;GACjB,eAAe,QAAQ;GACvB,MAAM,QAAQ;GACd,IAAI,QAAQ;GACZ,YAAY;IACX,MAAM;IACN;GACD;EACD,CAAC;EACD,IAAI,IAAI,MAAM,MAAM,IAAI,KAAK,GAAG,OAAO,MAAM;GAC5C,MAAM;GACN;GACA,iBAAiB;GACjB,SAAS;GACT,KAAK;EACN,CAAC;EACD,OAAO,MAAM;GACZ,MAAM;GACN;GACA,SAAS;EACV,CAAC;CACF;CACA,IAAI,YAAY,KAAK,GAAG;EACvB,MAAM,aAAa,CAAC,GAAG,IAAI,MAAM,gBAAgB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,KAAK,WAAW,KAAK,CAAC;EACrG,MAAM,CAAC,iBAAiB;EACxB,IAAI,WAAW,WAAW,KAAK,kBAAkB,KAAK,GAAG;GACxD,MAAM,GAAG,eAAe;GACxB,OAAO,GAAG;IACT,SAAS,YAAY;IACrB,eAAe,YAAY;IAC3B,MAAM,YAAY;IAClB,IAAI,YAAY;IAChB,YAAY;KACX,MAAM;KACN;IACD;GACD,CAAC;EACF;EACA,IAAI,WAAW,SAAS,GAAG,OAAO,MAAM;GACvC,MAAM;GACN;GACA,YAAY,WAAW,KAAK,CAAC,UAAU,IAAI;GAC3C,SAAS;EACV,CAAC;EACD,IAAI,CAAC,GAAG,IAAI,MAAM,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,SAAS,GAAG,OAAO,MAAM;GACpF,MAAM;GACN;GACA,iBAAiB;GACjB,SAAS;GACT,KAAK;EACN,CAAC;CACF;CACA,OAAO,MAAM;EACZ,MAAM;EACN;EACA,SAAS;CACV,CAAC;AACF"}
@@ -1,8 +1,8 @@
1
- import { b as errorInvalidRefName, t as MigrationToolsError, x as errorInvalidRefValue, y as errorInvalidRefFile } from "./errors-IpZm1Skp-BH495dRd.mjs";
1
+ import { b as errorInvalidRefName, t as MigrationToolsError, x as errorInvalidRefValue, y as errorInvalidRefFile } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
2
  import { dirname, join, relative } from "pathe";
3
3
  import { mkdir, readFile, readdir, rename, rmdir, unlink, writeFile } from "node:fs/promises";
4
4
  import { type } from "arktype";
5
- //#region ../../../1-framework/3-tooling/migration/dist/refs-BDbB9BRB.mjs
5
+ //#region ../../../1-framework/3-tooling/migration/dist/refs-DtoeUivZ.mjs
6
6
  /**
7
7
  * The system head ref lives at `refs/head.json`. It is read (and its
8
8
  * corruption judged) through `readContractSpaceHeadRef`, not as a
@@ -44,7 +44,7 @@ async function readRef(refsDir, name) {
44
44
  if (error instanceof Error && error.code === "ENOENT") throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
45
45
  why: `No ref file found at "${filePath}".`,
46
46
  fix: `Create the ref with: prisma-next ref set ${name} <hash>`,
47
- details: {
47
+ meta: {
48
48
  refName: name,
49
49
  filePath
50
50
  }
@@ -185,7 +185,7 @@ async function deleteRef(refsDir, name) {
185
185
  if (error instanceof Error && error.code === "ENOENT") throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
186
186
  why: `No ref file found at "${filePath}".`,
187
187
  fix: "Run `prisma-next ref list` to see available refs.",
188
- details: {
188
+ meta: {
189
189
  refName: name,
190
190
  filePath
191
191
  }
@@ -228,7 +228,7 @@ function resolveRef(refs, name) {
228
228
  if (!Object.hasOwn(refs, name)) throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
229
229
  why: `No ref named "${name}" exists.`,
230
230
  fix: `Available refs: ${Object.keys(refs).join(", ") || "(none)"}. Create a ref with: prisma-next ref set ${name} <hash>`,
231
- details: {
231
+ meta: {
232
232
  refName: name,
233
233
  availableRefs: Object.keys(refs)
234
234
  }
@@ -238,4 +238,4 @@ function resolveRef(refs, name) {
238
238
  //#endregion
239
239
  export { readRefsTolerant as a, resolveRefsByContractHash as c, writeRef as d, readRefs as i, validateRefName as l, deleteRef as n, refsByContractHash as o, readRef as r, resolveRef as s, HEAD_REF_NAME as t, validateRefValue as u };
240
240
 
241
- //# sourceMappingURL=refs-BDbB9BRB-D6Za3Q49.mjs.map
241
+ //# sourceMappingURL=refs-DtoeUivZ-qay0UMSP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs-DtoeUivZ-qay0UMSP.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/refs-DtoeUivZ.mjs"],"sourcesContent":["import { b as errorInvalidRefName, t as MigrationToolsError, x as errorInvalidRefValue, y as errorInvalidRefFile } from \"./errors-BwusfLIN.mjs\";\nimport { dirname, join, relative } from \"pathe\";\nimport { mkdir, readFile, readdir, rename, rmdir, unlink, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/refs.ts\n/**\n* The system head ref lives at `refs/head.json`. It is read (and its\n* corruption judged) through `readContractSpaceHeadRef`, not as a\n* user-authored ref, so {@link readRefsTolerant} excludes it.\n*/\nconst HEAD_REF_NAME = \"head\";\nconst REF_NAME_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\/[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;\nconst REF_VALUE_PATTERN = /^(empty|[0-9a-f]{64})$/;\nfunction validateRefName(name) {\n\tif (name.length === 0) return false;\n\tif (name.includes(\"..\")) return false;\n\tif (name.includes(\"//\")) return false;\n\tif (name.startsWith(\".\")) return false;\n\treturn REF_NAME_PATTERN.test(name);\n}\nfunction validateRefValue(value) {\n\treturn REF_VALUE_PATTERN.test(value);\n}\nconst RefEntrySchema = type({\n\thash: \"string\",\n\tinvariants: \"string[]\"\n}).narrow((entry, ctx) => {\n\tif (!validateRefValue(entry.hash)) return ctx.mustBe(`a valid contract hash (got \"${entry.hash}\")`);\n\treturn true;\n});\nfunction refFilePath(refsDir, name) {\n\treturn join(refsDir, `${name}.json`);\n}\nfunction refNameFromPath(refsDir, filePath) {\n\treturn relative(refsDir, filePath).replace(/\\.json$/, \"\");\n}\nasync function readRef(refsDir, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tconst filePath = refFilePath(refsDir, name);\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\t\twhy: `No ref file found at \"${filePath}\".`,\n\t\t\tfix: `Create the ref with: prisma-next ref set ${name} <hash>`,\n\t\t\tmeta: {\n\t\t\t\trefName: name,\n\t\t\t\tfilePath\n\t\t\t}\n\t\t});\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\tthrow errorInvalidRefFile(filePath, \"Failed to parse as JSON\");\n\t}\n\tconst result = RefEntrySchema(parsed);\n\tif (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);\n\treturn result;\n}\nasync function readRefs(refsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(refsDir, {\n\t\t\trecursive: true,\n\t\t\tencoding: \"utf-8\"\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return {};\n\t\tthrow error;\n\t}\n\tconst jsonFiles = entries.filter((entry) => entry.endsWith(\".json\") && !entry.endsWith(\".contract.json\"));\n\tconst refs = {};\n\tfor (const jsonFile of jsonFiles) {\n\t\tconst filePath = join(refsDir, jsonFile);\n\t\tconst name = refNameFromPath(refsDir, filePath);\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = await readFile(filePath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\t\tif (code === \"ENOENT\" || code === \"EISDIR\") continue;\n\t\t\tthrow error;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch {\n\t\t\tthrow errorInvalidRefFile(filePath, \"Failed to parse as JSON\");\n\t\t}\n\t\tconst result = RefEntrySchema(parsed);\n\t\tif (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);\n\t\trefs[name] = result;\n\t}\n\treturn refs;\n}\n/**\n* Read a space's user-authored refs without ever throwing on disk\n* content. A ref whose JSON is unparseable or whose shape fails\n* {@link RefEntrySchema} is omitted from `refs` and reported as a\n* {@link RefLoadProblem}; the remaining well-formed refs are still\n* returned. A missing `refs/` directory yields no refs and no problems.\n*\n* `refs/head.json` is deliberately skipped here: the system head ref is\n* read through `readContractSpaceHeadRef` (which validates head-ref\n* shape, distinct from the strict user-ref hash grammar), so it is judged\n* there and never doubles as a user ref. Genuine I/O faults (EACCES, EIO,\n* …) still propagate — only parse / schema problems are made tolerant.\n*/\nasync function readRefsTolerant(refsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(refsDir, {\n\t\t\trecursive: true,\n\t\t\tencoding: \"utf-8\"\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return {\n\t\t\trefs: {},\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst jsonFiles = entries.filter((entry) => entry.endsWith(\".json\") && !entry.endsWith(\".contract.json\") && entry !== `head.json`);\n\tconst refs = {};\n\tconst problems = [];\n\tfor (const jsonFile of jsonFiles) {\n\t\tconst filePath = join(refsDir, jsonFile);\n\t\tconst name = refNameFromPath(refsDir, filePath);\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = await readFile(filePath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\t\tif (code === \"ENOENT\" || code === \"EISDIR\") continue;\n\t\t\tthrow error;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch (e) {\n\t\t\tproblems.push({\n\t\t\t\trefName: name,\n\t\t\t\tdetail: e instanceof Error ? e.message : String(e)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst result = RefEntrySchema(parsed);\n\t\tif (result instanceof type.errors) {\n\t\t\tproblems.push({\n\t\t\t\trefName: name,\n\t\t\t\tdetail: result.summary\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\trefs[name] = result;\n\t}\n\treturn {\n\t\trefs,\n\t\tproblems\n\t};\n}\nasync function writeRef(refsDir, name, entry) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tif (!validateRefValue(entry.hash)) throw errorInvalidRefValue(entry.hash);\n\tconst filePath = refFilePath(refsDir, name);\n\tconst dir = dirname(filePath);\n\tawait mkdir(dir, { recursive: true });\n\tconst tmpPath = join(dir, `.${name.split(\"/\").pop()}.json.${Date.now()}.tmp`);\n\tawait writeFile(tmpPath, `${JSON.stringify({\n\t\thash: entry.hash,\n\t\tinvariants: [...entry.invariants]\n\t}, null, 2)}\\n`);\n\tawait rename(tmpPath, filePath);\n}\nasync function deleteRef(refsDir, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tconst filePath = refFilePath(refsDir, name);\n\ttry {\n\t\tawait unlink(filePath);\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\t\twhy: `No ref file found at \"${filePath}\".`,\n\t\t\tfix: \"Run `prisma-next ref list` to see available refs.\",\n\t\t\tmeta: {\n\t\t\t\trefName: name,\n\t\t\t\tfilePath\n\t\t\t}\n\t\t});\n\t\tthrow error;\n\t}\n\tlet dir = dirname(filePath);\n\twhile (dir !== refsDir && dir.startsWith(refsDir)) try {\n\t\tawait rmdir(dir);\n\t\tdir = dirname(dir);\n\t} catch (error) {\n\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\tif (code === \"ENOTEMPTY\" || code === \"EEXIST\" || code === \"ENOENT\") break;\n\t\tthrow error;\n\t}\n}\n/**\n* Index user-authored refs by the contract hash each ref points at.\n* Each bucket is sorted lex-asc for deterministic output.\n*/\nfunction refsByContractHash(refs) {\n\tconst byHash = /* @__PURE__ */ new Map();\n\tfor (const [name, entry] of Object.entries(refs)) {\n\t\tconst bucket = byHash.get(entry.hash);\n\t\tif (bucket) bucket.push(name);\n\t\telse byHash.set(entry.hash, [name]);\n\t}\n\tfor (const bucket of byHash.values()) bucket.sort();\n\treturn byHash;\n}\n/**\n* Read `migrations/<space>/refs/*.json` and index by destination hash.\n* Returns an empty map when the refs directory does not exist.\n*/\nasync function resolveRefsByContractHash(refsDir) {\n\treturn refsByContractHash(await readRefs(refsDir));\n}\nfunction resolveRef(refs, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tif (!Object.hasOwn(refs, name)) throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\twhy: `No ref named \"${name}\" exists.`,\n\t\tfix: `Available refs: ${Object.keys(refs).join(\", \") || \"(none)\"}. Create a ref with: prisma-next ref set ${name} <hash>`,\n\t\tmeta: {\n\t\t\trefName: name,\n\t\t\tavailableRefs: Object.keys(refs)\n\t\t}\n\t});\n\treturn refs[name];\n}\n//#endregion\nexport { readRefsTolerant as a, resolveRefsByContractHash as c, writeRef as d, readRefs as i, validateRefName as l, deleteRef as n, refsByContractHash as o, readRef as r, resolveRef as s, HEAD_REF_NAME as t, validateRefValue as u };\n\n//# sourceMappingURL=refs-DtoeUivZ.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,SAAS,gBAAgB,MAAM;CAC9B,IAAI,KAAK,WAAW,GAAG,OAAO;CAC9B,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;CAChC,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;CAChC,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO;CACjC,OAAO,iBAAiB,KAAK,IAAI;AAClC;AACA,SAA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,KAAK,IAAI;EAChC;CACD,CAAC;CACD,OAAO,KAAK;AACb"}
@@ -1,8 +1,8 @@
1
- import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
- import { o as writeContractSnapshot } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
3
- import { s as readMigrationsDir } from "./io-C8TdyBKt-DloEBi70.mjs";
4
- import { l as reconstructGraph, o as findPathWithDecision } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
5
- import { c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID } from "./verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs";
1
+ import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
+ import { o as writeContractSnapshot } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
3
+ import { s as readMigrationsDir } from "./io-CL3hSv42-DGZtTs89.mjs";
4
+ import { l as reconstructGraph, o as findPathWithDecision } from "./migration-graph-D6bN-mX0-DwMWY8DA.mjs";
5
+ import { c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID } from "./verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { join } from "pathe";
8
8
  import { mkdir, writeFile } from "node:fs/promises";
@@ -26,7 +26,7 @@ import { computeStorageHash } from "@prisma/orm-framework/contract/hashing";
26
26
  *
27
27
  * Synchronous, pure, no I/O. Throws
28
28
  * `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH` on failure with both the
29
- * recomputed and published hashes in `details` so callers can surface a
29
+ * recomputed and published hashes in `meta` so callers can surface a
30
30
  * clear remediation hint without re-deriving them.
31
31
  */
32
32
  function assertDescriptorSelfConsistency(inputs) {
@@ -264,4 +264,4 @@ function planAllSpaces(inputs, planSpace) {
264
264
  //#endregion
265
265
  export { gatherDiskContractSpaceState as a, emitContractSpaceArtifacts as i, computeExtensionSpaceApplyPath as n, planAllSpaces as o, contractSpaceFromJson as r, assertDescriptorSelfConsistency as t };
266
266
 
267
- //# sourceMappingURL=spaces-C27bA-xc.mjs.map
267
+ //# sourceMappingURL=spaces-BNd2Tlk0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaces-BNd2Tlk0.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/spaces.mjs"],"sourcesContent":["import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from \"../errors-BwusfLIN.mjs\";\nimport { o as writeContractSnapshot } from \"../contract-snapshot-store-DNTOE6fB.mjs\";\nimport { s as readMigrationsDir } from \"../io-CL3hSv42.mjs\";\nimport \"../constants-CM-w38DQ.mjs\";\nimport { l as reconstructGraph, o as findPathWithDecision } from \"../migration-graph-D6bN-mX0.mjs\";\nimport { a as RESERVED_SPACE_SUBDIR_NAMES, c as isValidSpaceId, i as APP_SPACE_ID, l as spaceMigrationDirectory, n as verifyContractSpaces, o as SPACE_REFS_DIRNAME, r as readContractSpaceHeadRef, s as assertValidSpaceId, t as listContractSpaceDirectories, u as spaceRefsDirectory } from \"../verify-contract-spaces-Ak73-zQK.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { join } from \"pathe\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\n//#region src/assert-descriptor-self-consistency.ts\n/**\n* Assert that an extension descriptor is self-consistent: the\n* `headRef.hash` it publishes must match the canonical hash recomputed\n* from its `contractSpace.contractJson`.\n*\n* Recomputes via {@link computeStorageHash} — the same canonical-JSON\n* pipeline the descriptor's own emit pipeline produced the hash with —\n* over `(target, targetFamily, storage)`. Mismatch indicates the\n* extension author bumped `contractJson` without rerunning emit, leaving\n* the descriptor's `headRef.hash` stale; the consumer-side helpers\n* (drift detection, on-disk artefact emission, runner marker writes) all\n* trust `headRef.hash` as the canonical identity, so a stale value would\n* silently corrupt every downstream boundary.\n*\n* Synchronous, pure, no I/O. Throws\n* `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH` on failure with both the\n* recomputed and published hashes in `meta` so callers can surface a\n* clear remediation hint without re-deriving them.\n*/\nfunction assertDescriptorSelfConsistency(inputs) {\n\tconst { storageHash: _stripped, ...storageWithoutHash } = inputs.storage;\n\tconst recomputed = computeStorageHash({\n\t\ttarget: inputs.target,\n\t\ttargetFamily: inputs.targetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...ifDefined(\"shouldPreserveEmpty\", inputs.shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", inputs.sortStorage)\n\t});\n\tif (recomputed !== inputs.headRefHash) throw errorDescriptorHeadHashMismatch({\n\t\textensionId: inputs.extensionId,\n\t\trecomputedHash: recomputed,\n\t\theadRefHash: inputs.headRefHash\n\t});\n}\n//#endregion\n//#region src/compute-extension-space-apply-path.ts\n/**\n* Compute the apply path for an extension contract space — the shortest\n* sequence of on-disk migration packages that walks the live marker\n* forward to the on-disk head ref hash, covering every required\n* invariant.\n*\n* Reads only on-disk artifacts (`migrations/<spaceId>/refs/head.json`\n* and the per-space migration packages). **Does not import any\n* extension descriptor module** — `db init` / `db update` must remain\n* runnable without the descriptor source on disk.\n*\n* Behaviour:\n* - Returns `{ kind: 'ok', pathOps: [], … }` when the marker is already\n* at the recorded head and no required invariants are missing.\n* - Returns `{ kind: 'unreachable' }` when the marker hash is not\n* structurally connected to the recorded head in the graph.\n* - Returns `{ kind: 'unsatisfiable', missing, … }` when the marker is\n* reachable but no path covers the required invariants.\n* - Returns `{ kind: 'contractSpaceHeadRefMissing' }` when the per-space\n* `refs/head.json` is absent — the precheck verifier should already\n* have rejected this case, but the helper is defensive so callers can\n* surface a coherent error rather than throw.\n*/\nasync function computeExtensionSpaceApplyPath(inputs) {\n\tconst { projectMigrationsDir, spaceId, currentMarkerHash, currentMarkerInvariants } = inputs;\n\tconst contractSpaceHeadRef = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\tif (contractSpaceHeadRef === null) return { kind: \"contractSpaceHeadRefMissing\" };\n\tconst { packages } = await readMigrationsDir(spaceMigrationDirectory(projectMigrationsDir, spaceId), { migrationsDir: projectMigrationsDir });\n\tconst graph = reconstructGraph(packages);\n\tconst fromHash = currentMarkerHash ?? \"empty\";\n\tconst required = new Set(contractSpaceHeadRef.invariants.filter((id) => !currentMarkerInvariants.includes(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, contractSpaceHeadRef.hash, { required });\n\tif (outcome.kind === \"unreachable\") return {\n\t\tkind: \"unreachable\",\n\t\tcontractSpaceHeadRef\n\t};\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tcontractSpaceHeadRef,\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(({ dirName, to }) => ({\n\t\t\tdirName,\n\t\t\tto\n\t\t}))\n\t};\n\tconst packagesByHash = new Map(packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst pathOps = [];\n\tconst walkedMigrationDirs = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${spaceId}\"`);\n\t\twalkedMigrationDirs.push(pkg.dirName);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tcontractSpaceHeadRef,\n\t\tprovidedInvariants: [...providedInvariantsSet].sort(),\n\t\tpathOps,\n\t\twalkedMigrationDirs\n\t};\n}\n//#endregion\n//#region src/contract-space-from-json.ts\n/**\n* Materialise a typed {@link ContractSpace} from the JSON artefacts a\n* contract-space extension package emits to disk.\n*\n* Extension descriptors wire `contract.json`, per-migration\n* `migration.json` / `ops.json`, and `refs/head.json` to the framework's\n* typed surfaces. TypeScript widens JSON imports to a structural record\n* that does not preserve readonly modifiers or branded scalars (e.g.\n* `StorageHashBase<'abc123...'>`), so authoring the descriptor inline\n* forces every wiring site to cast through `unknown`. This helper\n* encapsulates the single narrowing point: descriptor sources stay\n* cast-free, and the (necessary) coercion is colocated with the\n* documentation explaining why it is safe.\n*\n* Safety: the JSON files passed here are produced by the framework's own\n* emit pipeline (`prisma-next contract emit` and `MigrationCLI.run`)\n* and re-validated downstream by the runner / verifier. The descriptor\n* is a pass-through wiring layer — no descriptor consumer treats the\n* narrowed types as a stronger guarantee than \"these came from the\n* canonical emit pipeline\".\n*\n* The helper does not introspect or schema-validate the inputs; runtime\n* validation is the responsibility of `family.deserializeContract`\n* (codec-aware, invoked at control-stack construction) and the\n* per-migration `readMigrationPackage` reader used when loading\n* from disk. JSON-imported packages flow through the descriptor without\n* a disk read, so the equivalent runtime guarantee comes from the emit\n* pipeline that produced the JSON in the first place.\n*/\nfunction contractSpaceFromJson(inputs) {\n\tconst migrations = inputs.migrations.map((m) => ({\n\t\tdirName: m.dirName,\n\t\tmetadata: m.metadata,\n\t\tops: m.ops\n\t}));\n\treturn {\n\t\tcontractJson: inputs.contractJson,\n\t\tmigrations,\n\t\theadRef: inputs.headRef\n\t};\n}\n//#endregion\n//#region src/emit-contract-space-artifacts.ts\n/**\n* Emit the per-space artifacts — the head contract snapshot (written into\n* the migrations-root-wide `snapshots/` store, keyed by `headRef.hash`) and\n* `refs/head.json` — under `<projectMigrationsDir>/<spaceId>/`.\n*\n* The head contract snapshot is write-if-absent (see\n* {@link writeContractSnapshot}): a changed extension contract has a new\n* hash, so it lands as a new store entry; an unchanged hash means identical\n* canonical content already sits there. `refs/head.json` stays\n* always-overwrite: the framework owns it, so running `migrate` twice with\n* the same inputs is a no-op observably (idempotent), but the helper does\n* not check pre-existing contents — re-emit always wins.\n*\n* Path layout matches the convention in\n* [`spaceMigrationDirectory`](./space-layout.ts). The space id is\n* validated against `[a-z][a-z0-9_-]{0,63}` via\n* {@link assertValidSpaceId} for filesystem-safety reasons; the helper\n* accepts every space uniformly (including the app space, default\n* `'app'`).\n*\n* The migrations directory and space subdirectory are created if they\n* do not yet exist (`mkdir { recursive: true }`).\n*/\nasync function emitContractSpaceArtifacts(projectMigrationsDir, spaceId, inputs) {\n\tassertValidSpaceId(spaceId);\n\tconst refsDir = spaceRefsDirectory(join(projectMigrationsDir, spaceId));\n\tawait mkdir(refsDir, { recursive: true });\n\tawait writeContractSnapshot(projectMigrationsDir, inputs.headRef.hash, {\n\t\tcontractJson: inputs.contract,\n\t\tcontractDts: inputs.contractDts\n\t});\n\tconst sortedInvariants = [...inputs.headRef.invariants].sort();\n\tconst headJson = canonicalizeJson({\n\t\thash: inputs.headRef.hash,\n\t\tinvariants: sortedInvariants\n\t});\n\tawait writeFile(join(refsDir, \"head.json\"), `${headJson}\\n`);\n}\n//#endregion\n//#region src/gather-disk-contract-space-state.ts\n/**\n* Read the on-disk state the per-space verifier needs:\n*\n* - The list of contract-space directories under\n* `<projectMigrationsDir>/` (via\n* {@link import('./verify-contract-spaces').listContractSpaceDirectories}).\n* - The on-disk head ref `(hash, invariants)` for each declared extension space\n* (via {@link readContractSpaceHeadRef}; missing on-disk artefacts are simply\n* omitted — the verifier reports them as `declaredButUnmigrated`).\n*\n* Synchronous in spirit but async due to filesystem reads. Reads only\n* the user's repo. **Does not import any extension descriptor module.**\n*\n* Composition convention: pure target-agnostic primitive in\n* `1-framework`; the SQL family (and any future target family) wires\n* it into its `dbInit` / `verify` flows alongside its own marker-row\n* read before invoking `verifyContractSpaces`.\n*/\nasync function gatherDiskContractSpaceState(args) {\n\tconst { projectMigrationsDir, loadedSpaceIds } = args;\n\tconst spaceDirsOnDisk = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst headRefsBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of loadedSpaceIds) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tconst head = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\t\tif (head !== null) headRefsBySpace.set(spaceId, head);\n\t}\n\treturn {\n\t\tspaceDirsOnDisk,\n\t\theadRefsBySpace\n\t};\n}\n//#endregion\n//#region src/plan-all-spaces.ts\n/**\n* Iterate the per-space planner across a set of loaded contract spaces\n* and return a deterministic shape regardless of declaration order.\n*\n* Behaviour:\n*\n* - The output is sorted alphabetically by `spaceId`. Two callers\n* passing the same set of inputs in different orders observe\n* byte-identical outputs.\n* - The per-space planner (`planSpace`) is called exactly once per\n* input, in alphabetical-by-spaceId order. Its return value is\n* attached to the corresponding output entry verbatim.\n* - Duplicate `spaceId`s in the input array throw\n* `MIGRATION.DUPLICATE_SPACE_ID` before any `planSpace` call runs,\n* keeping the planner pure when the input is malformed.\n*\n* The signature is generic over `TContract` and `TPackage` because the\n* shape is framework-neutral (SQL family today, Mongo family\n* eventually). Callers wire in whatever contract value and migration\n* package shape their family already speaks.\n*\n* Synchronous: the underlying per-space planner (target's\n* `MigrationPlanner.plan(...)`) is synchronous; callers that need to\n* resolve async I/O (e.g. reading on-disk `contract.json` from disk)\n* resolve it before calling `planAllSpaces` and pass the materialised\n* inputs through.\n*/\nfunction planAllSpaces(inputs, planSpace) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const input of inputs) {\n\t\tif (seen.has(input.spaceId)) throw errorDuplicateSpaceId(input.spaceId);\n\t\tseen.add(input.spaceId);\n\t}\n\treturn [...inputs].sort((a, b) => {\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t}).map((input) => ({\n\t\tspaceId: input.spaceId,\n\t\tmigrationPackages: planSpace(input)\n\t}));\n}\n//#endregion\nexport { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };\n\n//# sourceMappingURL=spaces.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,gCAAgC,QAAQ;CAChD,MAAM,EAAE,aAAa,WAAW,GAAG,uBAAuB,OAAO;CACjE,MAAM,aAAa,mBAAmB;EACrC,QAAQ,OAAO;EACf,cAAc,OAAO;EACrB,SAAS;EACT,GAAG,UAAU,uBAAuB,OAAO,mBAAmB;EAC9D,GAAG,UAAU,eAAe,OAAO,WAAW;CAC/C,CAAC;CACD,IAAI,eAAe,OAAO,aAAa,MAAM,gCAAgC;EAC5E,aAAa,OAAO;EACpB,gBAAgB;EAChB,aAAa,OAAO;CACrB,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,eAAe,+BAA+B,QAAQ;CACrD,MAAM,EAAE,sBAAsB,SAAS,mBAAmB,4BAA4B;CACtF,MAAM,uBAAuB,MAAM,yBAAyB,sBAAsB,OAAO;CACzF,IAAI,yBAAyB,MAAM,OAAO,EAAE,MAAM,8BAA8B;CAChF,MAAM,EAAE,aAAa,MAAM,kBAAkB,wBAAwB,sBAAsB,OAAO,GAAG,EAAE,eAAe,qBAAqB,CAAC;CAC5I,MAAM,QAAQ,iBAAiB,QAAQ;CACvC,MAAM,WAAW,qBAAqB;CACtC,MAAM,WAAW,IAAI,IAAI,qBAAqB,WAAW,QAAQ,OAAO,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;CAC9G,MAAM,UAAU,qBAAqB,OAAO,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yInputs {
43
43
  *
44
44
  * Synchronous, pure, no I/O. Throws
45
45
  * `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH` on failure with both the
46
- * recomputed and published hashes in `details` so callers can surface a
46
+ * recomputed and published hashes in `meta` so callers can surface a
47
47
  * clear remediation hint without re-deriving them.
48
48
  */
49
49
  declare function assertDescriptorSelfConsistency(inputs: DescriptorSelfConsistencyInputs): void;
@@ -412,4 +412,4 @@ declare const RESERVED_SPACE_SUBDIR_NAMES: ReadonlySet<string>;
412
412
  declare function spaceRefsDirectory(spaceMigrationsDir: string): string;
413
413
  //#endregion
414
414
  export { spaceMigrationDirectory as C, readContractSpaceHeadRef as S, contractSpaceFromJson as _, DescriptorSelfConsistencyInputs as a, isValidSpaceId as b, RESERVED_SPACE_SUBDIR_NAMES as c, SpacePlanInput as d, SpacePlanOutput as f, computeExtensionSpaceApplyPath as g, assertValidSpaceId as h, ContractSpaceHeadRef$1 as i, SPACE_REFS_DIRNAME as l, assertDescriptorSelfConsistency as m, ComputeExtensionSpaceApplyPathInputs as n, DiskContractSpaceState as o, ValidSpaceId as p, ContractSpaceArtifactInputs as r, ExtensionSpaceApplyPathOutcome as s, APP_SPACE_ID$1 as t, SpaceApplyInput as u, emitContractSpaceArtifacts as v, spaceRefsDirectory as w, planAllSpaces as x, gatherDiskContractSpaceState as y };
415
- //# sourceMappingURL=spaces-DxFj5y8l.d.mts.map
415
+ //# sourceMappingURL=spaces-D5qtTlhj.d.mts.map