@prisma/orm-toolchain 8.0.0-rc.1-dev.29 → 8.0.0-rc.1-dev.30

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 (150) hide show
  1. package/dist/{aggregate-BKbHUHLA.mjs → aggregate-BBsCbXgJ.mjs} +8 -8
  2. package/dist/{aggregate-BKbHUHLA.mjs.map → aggregate-BBsCbXgJ.mjs.map} +1 -1
  3. package/dist/bin__prisma-next.mjs +25 -25
  4. package/dist/bin__prisma-next.mjs.map +1 -1
  5. package/dist/cli.mjs +12 -12
  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.mjs +1 -1
  15. package/dist/cli__commands__migration-check.mjs +1 -1
  16. package/dist/cli__commands__migration-graph.mjs +1 -1
  17. package/dist/cli__commands__migration-list.mjs +1 -1
  18. package/dist/cli__commands__migration-log.mjs +1 -1
  19. package/dist/cli__commands__migration-new.mjs +1 -1
  20. package/dist/cli__commands__migration-plan.mjs +1 -1
  21. package/dist/cli__commands__migration-show.mjs +1 -1
  22. package/dist/cli__commands__migration-status.mjs +1 -1
  23. package/dist/cli__commands__ref.mjs +1 -1
  24. package/dist/cli__commands__telemetry.mjs +1 -1
  25. package/dist/cli__control-api.mjs +15 -15
  26. package/dist/cli__migration-cli.mjs +2 -2
  27. package/dist/{client-DLPcSdv7-Cukdon0q.mjs → client-C4Gh4PBz-BMUlBcuE.mjs} +6 -6
  28. package/dist/{client-DLPcSdv7-Cukdon0q.mjs.map → client-C4Gh4PBz-BMUlBcuE.mjs.map} +1 -1
  29. package/dist/{command-helpers-uzQbbM97-EaL4zWf5.mjs → command-helpers-Dw3LDEu_-B4AETH4D.mjs} +4 -4
  30. package/dist/{command-helpers-uzQbbM97-EaL4zWf5.mjs.map → command-helpers-Dw3LDEu_-B4AETH4D.mjs.map} +1 -1
  31. package/dist/{contract-at-errors-BsQiGdZC-BY8u2is4.mjs → contract-at-errors-BsQiGdZC-D8l9-WWt.mjs} +2 -2
  32. package/dist/{contract-at-errors-BsQiGdZC-BY8u2is4.mjs.map → contract-at-errors-BsQiGdZC-D8l9-WWt.mjs.map} +1 -1
  33. package/dist/{contract-emit-D-vxAjLQ-DjSGIBvi.mjs → contract-emit-CIdgw3Kq-BcfYaUfn.mjs} +4 -4
  34. package/dist/{contract-emit-D-vxAjLQ-DjSGIBvi.mjs.map → contract-emit-CIdgw3Kq-BcfYaUfn.mjs.map} +1 -1
  35. package/dist/{contract-infer-ButdiRXM-9KdWYvza.mjs → contract-infer-xOEwVWds-CE5gw1PF.mjs} +5 -5
  36. package/dist/{contract-infer-ButdiRXM-9KdWYvza.mjs.map → contract-infer-xOEwVWds-CE5gw1PF.mjs.map} +1 -1
  37. package/dist/{contract-snapshot-resolution-RIn-ByLW-BRTjU_01.mjs → contract-snapshot-resolution-BnH6_mw7-BrzAsS93.mjs} +6 -6
  38. package/dist/{contract-snapshot-resolution-RIn-ByLW-BRTjU_01.mjs.map → contract-snapshot-resolution-BnH6_mw7-BrzAsS93.mjs.map} +1 -1
  39. package/dist/{contract-snapshot-store-C9-J6OBn-kpuB2oCK.mjs → contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs} +3 -3
  40. package/dist/{contract-snapshot-store-C9-J6OBn-kpuB2oCK.mjs.map → contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs.map} +1 -1
  41. package/dist/{contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs → contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs} +5 -5
  42. package/dist/{contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs.map → contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs.map} +1 -1
  43. package/dist/{db-init-BO7P4kCG-CftJygKc.mjs → db-init-CEk9Utl4-vGmJajwZ.mjs} +6 -6
  44. package/dist/{db-init-BO7P4kCG-CftJygKc.mjs.map → db-init-CEk9Utl4-vGmJajwZ.mjs.map} +1 -1
  45. package/dist/{db-schema-6CB4Rljf-VFKrJ3VO.mjs → db-schema-D_PJvBI3-BTnfCqbX.mjs} +6 -6
  46. package/dist/{db-schema-6CB4Rljf-VFKrJ3VO.mjs.map → db-schema-D_PJvBI3-BTnfCqbX.mjs.map} +1 -1
  47. package/dist/{db-sign-CkX4HXCx-B0mTmQ5a.mjs → db-sign-Bparnnii-Yd5pb4VF.mjs} +7 -7
  48. package/dist/{db-sign-CkX4HXCx-B0mTmQ5a.mjs.map → db-sign-Bparnnii-Yd5pb4VF.mjs.map} +1 -1
  49. package/dist/{db-update-fAeM1XbT-B5XoGE92.mjs → db-update-CsKZyDYp-B8Zl7W4k.mjs} +7 -7
  50. package/dist/{db-update-fAeM1XbT-B5XoGE92.mjs.map → db-update-CsKZyDYp-B8Zl7W4k.mjs.map} +1 -1
  51. package/dist/{db-verify-_flf8M9q-BD-mhGC1.mjs → db-verify-B33E7HXH-D87fiNt3.mjs} +6 -6
  52. package/dist/{db-verify-_flf8M9q-BD-mhGC1.mjs.map → db-verify-B33E7HXH-D87fiNt3.mjs.map} +1 -1
  53. package/dist/{errors-Co-8oaiB-CB-6Uqki.mjs → errors-CXbGUWGu-BQi6YS-H.mjs} +51 -2
  54. package/dist/errors-CXbGUWGu-BQi6YS-H.mjs.map +1 -0
  55. package/dist/{errors-NRmFpwR1.d.mts → errors-KWM8yBAL.d.mts} +3 -1
  56. package/dist/errors-KWM8yBAL.d.mts.map +1 -0
  57. package/dist/{format-DZ7Vowat-CXVeLGp_.mjs → format-CYdgHub4-Cs6VcFje.mjs} +4 -4
  58. package/dist/{format-DZ7Vowat-CXVeLGp_.mjs.map → format-CYdgHub4-Cs6VcFje.mjs.map} +1 -1
  59. package/dist/{graph-membership-BEmNEMtP-rz61CLM5.mjs → graph-membership-BViWUMpP-Cgu4Z2ox.mjs} +3 -3
  60. package/dist/{graph-membership-BEmNEMtP-rz61CLM5.mjs.map → graph-membership-BViWUMpP-Cgu4Z2ox.mjs.map} +1 -1
  61. package/dist/{init-Cej3fMLO-BCRVDzA4.mjs → init-CrypFQwk-XiyERkdi.mjs} +3 -3
  62. package/dist/{init-Cej3fMLO-BCRVDzA4.mjs.map → init-CrypFQwk-XiyERkdi.mjs.map} +1 -1
  63. package/dist/{inspect-live-schema-Do1dDQxw-DBSSeLrX.mjs → inspect-live-schema-BAiaX0n9-DBQFEsMC.mjs} +4 -4
  64. package/dist/{inspect-live-schema-Do1dDQxw-DBSSeLrX.mjs.map → inspect-live-schema-BAiaX0n9-DBQFEsMC.mjs.map} +1 -1
  65. package/dist/{invariants-C1WVUAH7-DlOBTTkM.mjs → invariants-CTHy88OP-DJ-i5yTz.mjs} +3 -3
  66. package/dist/{invariants-C1WVUAH7-DlOBTTkM.mjs.map → invariants-CTHy88OP-DJ-i5yTz.mjs.map} +1 -1
  67. package/dist/{invariants-4d2LkjQL-Ch5J3Rd7.mjs → invariants-CsxL0lbZ-B9Hfpj2R.mjs} +6 -6
  68. package/dist/{invariants-4d2LkjQL-Ch5J3Rd7.mjs.map → invariants-CsxL0lbZ-B9Hfpj2R.mjs.map} +1 -1
  69. package/dist/{io-CHUUeHh0-CbyTkKP6.mjs → io-635GlNx1-D94PxRc-.mjs} +5 -5
  70. package/dist/{io-CHUUeHh0-CbyTkKP6.mjs.map → io-635GlNx1-D94PxRc-.mjs.map} +1 -1
  71. package/dist/{migrate-Bs4Mi3N0-BdbjoiNr.mjs → migrate-DYx_CSbN-BuQ0lk-0.mjs} +12 -12
  72. package/dist/{migrate-Bs4Mi3N0-BdbjoiNr.mjs.map → migrate-DYx_CSbN-BuQ0lk-0.mjs.map} +1 -1
  73. package/dist/{migrate-show-BYZ_NAoY-DCyUeA4P.mjs → migrate-show-CPZEq35I-DeL3WVjs.mjs} +9 -9
  74. package/dist/{migrate-show-BYZ_NAoY-DCyUeA4P.mjs.map → migrate-show-CPZEq35I-DeL3WVjs.mjs.map} +1 -1
  75. package/dist/{migration-check-RlegqnJv-ZUcop5v4.mjs → migration-check-BUAcSrvA-DSS5Yvco.mjs} +9 -9
  76. package/dist/{migration-check-RlegqnJv-ZUcop5v4.mjs.map → migration-check-BUAcSrvA-DSS5Yvco.mjs.map} +1 -1
  77. package/dist/{migration-check-ASAenQ02-B9a5jI8S.mjs → migration-check-D0ABv6pO-BCJRf3lE.mjs} +6 -6
  78. package/dist/{migration-check-ASAenQ02-B9a5jI8S.mjs.map → migration-check-D0ABv6pO-BCJRf3lE.mjs.map} +1 -1
  79. package/dist/{migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs → migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs} +4 -4
  80. package/dist/{migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs.map → migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs.map} +1 -1
  81. package/dist/{migration-graph-BYRfJ6pm-WucWOxZ8.mjs → migration-graph-BsGstA5L-BQiNbrkP.mjs} +8 -8
  82. package/dist/{migration-graph-BYRfJ6pm-WucWOxZ8.mjs.map → migration-graph-BsGstA5L-BQiNbrkP.mjs.map} +1 -1
  83. package/dist/{migration-graph-BtP1Va3T-CMOZgqVW.mjs → migration-graph-BtP1Va3T-C8PpuaYw.mjs} +2 -2
  84. package/dist/{migration-graph-BtP1Va3T-CMOZgqVW.mjs.map → migration-graph-BtP1Va3T-C8PpuaYw.mjs.map} +1 -1
  85. package/dist/{migration-graph-DDaOHo10-yJFAbKCu.mjs → migration-graph-_SJImD5V-D5RCc651.mjs} +3 -3
  86. package/dist/{migration-graph-DDaOHo10-yJFAbKCu.mjs.map → migration-graph-_SJImD5V-D5RCc651.mjs.map} +1 -1
  87. package/dist/{migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs → migration-graph-sections-CceYWPCP-LqImOaK1.mjs} +2 -2
  88. package/dist/{migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs.map → migration-graph-sections-CceYWPCP-LqImOaK1.mjs.map} +1 -1
  89. package/dist/{migration-_C5W2uXF.mjs → migration-gubSSeMk.mjs} +3 -3
  90. package/dist/{migration-_C5W2uXF.mjs.map → migration-gubSSeMk.mjs.map} +1 -1
  91. package/dist/{migration-list-AKRIIovW-Cr39jOaI.mjs → migration-list-AKRIIovW-BN-Zrwk0.mjs} +3 -3
  92. package/dist/{migration-list-AKRIIovW-Cr39jOaI.mjs.map → migration-list-AKRIIovW-BN-Zrwk0.mjs.map} +1 -1
  93. package/dist/{migration-list-ChJ4YC1Y-De7g_D3K.mjs → migration-list-BiVyonwG-CdMbBV5Z.mjs} +6 -6
  94. package/dist/{migration-list-ChJ4YC1Y-De7g_D3K.mjs.map → migration-list-BiVyonwG-CdMbBV5Z.mjs.map} +1 -1
  95. package/dist/{migration-log-W8xgEvD8-sVkmO78U.mjs → migration-log-Z3-L172x-CvQTNJvI.mjs} +5 -5
  96. package/dist/{migration-log-W8xgEvD8-sVkmO78U.mjs.map → migration-log-Z3-L172x-CvQTNJvI.mjs.map} +1 -1
  97. package/dist/{migration-new-BHv-aJzG-Bj7aJDNX.mjs → migration-new-DDnQd7Ql-1WT_J_zf.mjs} +5 -5
  98. package/dist/{migration-new-BHv-aJzG-Bj7aJDNX.mjs.map → migration-new-DDnQd7Ql-1WT_J_zf.mjs.map} +1 -1
  99. package/dist/{migration-new-BGI2g0SC-SUBmaeRN.mjs → migration-new-ZlgxFcbH-CxlZs2hr.mjs} +8 -8
  100. package/dist/{migration-new-BGI2g0SC-SUBmaeRN.mjs.map → migration-new-ZlgxFcbH-CxlZs2hr.mjs.map} +1 -1
  101. package/dist/{migration-plan-31dDf3Wj-_kWI5F9v.mjs → migration-plan-CROSunPS-B66Rh_6T.mjs} +5 -5
  102. package/dist/{migration-plan-31dDf3Wj-_kWI5F9v.mjs.map → migration-plan-CROSunPS-B66Rh_6T.mjs.map} +1 -1
  103. package/dist/{migration-plan-B4ND_Xr3-CXfh2r_I.mjs → migration-plan-DiLJTAep-2B463CwW.mjs} +14 -14
  104. package/dist/{migration-plan-B4ND_Xr3-CXfh2r_I.mjs.map → migration-plan-DiLJTAep-2B463CwW.mjs.map} +1 -1
  105. package/dist/{migration-show-CxT14RTs-Bpfd4_FB.mjs → migration-show-mJD52S2d-DiD-rCBB.mjs} +7 -7
  106. package/dist/{migration-show-CxT14RTs-Bpfd4_FB.mjs.map → migration-show-mJD52S2d-DiD-rCBB.mjs.map} +1 -1
  107. package/dist/{migration-status-gC9RLpz5-3uPzlkh_.mjs → migration-status-Df6EwEun-CbrQHa3S.mjs} +10 -10
  108. package/dist/{migration-status-gC9RLpz5-3uPzlkh_.mjs.map → migration-status-Df6EwEun-CbrQHa3S.mjs.map} +1 -1
  109. package/dist/migration-tools.d.mts +1 -1
  110. package/dist/migration-tools.mjs +12 -12
  111. package/dist/migration-tools__aggregate.mjs +1 -1
  112. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  113. package/dist/migration-tools__errors.d.mts +1 -1
  114. package/dist/migration-tools__errors.mjs +1 -1
  115. package/dist/migration-tools__invariants.mjs +1 -1
  116. package/dist/migration-tools__io.mjs +1 -1
  117. package/dist/migration-tools__migration-graph.mjs +2 -2
  118. package/dist/migration-tools__migration.mjs +1 -1
  119. package/dist/migration-tools__ref-resolution.mjs +1 -1
  120. package/dist/migration-tools__refs.mjs +1 -1
  121. package/dist/migration-tools__spaces.mjs +2 -2
  122. package/dist/{ref-Dmj_cDrl-Cax2R649.mjs → ref-Cycefq_T-DQE5AM66.mjs} +5 -5
  123. package/dist/{ref-Dmj_cDrl-Cax2R649.mjs.map → ref-Cycefq_T-DQE5AM66.mjs.map} +1 -1
  124. package/dist/{ref-CbeIycGH-Da61MuYq.mjs → ref-DftuSibc-CasZ6LgA.mjs} +10 -10
  125. package/dist/{ref-CbeIycGH-Da61MuYq.mjs.map → ref-DftuSibc-CasZ6LgA.mjs.map} +1 -1
  126. package/dist/{ref-advancement-DaZBzm7m-Deq5Cs7O.mjs → ref-advancement-DaZBzm7m-WoqnFAyr.mjs} +4 -4
  127. package/dist/{ref-advancement-DaZBzm7m-Deq5Cs7O.mjs.map → ref-advancement-DaZBzm7m-WoqnFAyr.mjs.map} +1 -1
  128. package/dist/{ref-resolution-Bi4lpxM8-BX-7sl0f.mjs → ref-resolution-Bi4lpxM8-BbfL_yv8.mjs} +2 -2
  129. package/dist/{ref-resolution-Bi4lpxM8-BX-7sl0f.mjs.map → ref-resolution-Bi4lpxM8-BbfL_yv8.mjs.map} +1 -1
  130. package/dist/{ref-resolution-Ct2GMcNB.mjs → ref-resolution-sGcINe7o.mjs} +2 -2
  131. package/dist/{ref-resolution-Ct2GMcNB.mjs.map → ref-resolution-sGcINe7o.mjs.map} +1 -1
  132. package/dist/{refs-B2BL8z3i-DGGFB7Mj.mjs → refs-WK86uYYp-B6EZkmmT.mjs} +19 -3
  133. package/dist/refs-WK86uYYp-B6EZkmmT.mjs.map +1 -0
  134. package/dist/{refs-fQLFcMoq-UTlvnijY.mjs → refs-fQLFcMoq-aTBeUU9H.mjs} +4 -4
  135. package/dist/{refs-fQLFcMoq-UTlvnijY.mjs.map → refs-fQLFcMoq-aTBeUU9H.mjs.map} +1 -1
  136. package/dist/{spaces-DBTCE3Js.mjs → spaces-BG2w0P8d.mjs} +6 -6
  137. package/dist/{spaces-DBTCE3Js.mjs.map → spaces-BG2w0P8d.mjs.map} +1 -1
  138. package/dist/{telemetry-D4LZGV1f-C5BrCb0w.mjs → telemetry-LP1Suxsf-CY1l7lD0.mjs} +4 -4
  139. package/dist/{telemetry-D4LZGV1f-C5BrCb0w.mjs.map → telemetry-LP1Suxsf-CY1l7lD0.mjs.map} +1 -1
  140. package/dist/{terminal-ui-CUZTa2vH-WvAtuIOS.mjs → terminal-ui-JJKxvT0q-CPDEJqqU.mjs} +35 -4
  141. package/dist/terminal-ui-JJKxvT0q-CPDEJqqU.mjs.map +1 -0
  142. package/dist/{verify-contract-spaces-WvjSiWcB-DZPPCwWO.mjs → verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs} +4 -4
  143. package/dist/{verify-contract-spaces-WvjSiWcB-DZPPCwWO.mjs.map → verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs.map} +1 -1
  144. package/dist/{verify-DGFra-rl-B5lkrUrV.mjs → verify-wUSBDQwh-Bv3NV9WG.mjs} +3 -3
  145. package/dist/{verify-DGFra-rl-B5lkrUrV.mjs.map → verify-wUSBDQwh-Bv3NV9WG.mjs.map} +1 -1
  146. package/package.json +12 -12
  147. package/dist/errors-Co-8oaiB-CB-6Uqki.mjs.map +0 -1
  148. package/dist/errors-NRmFpwR1.d.mts.map +0 -1
  149. package/dist/refs-B2BL8z3i-DGGFB7Mj.mjs.map +0 -1
  150. package/dist/terminal-ui-CUZTa2vH-WvAtuIOS.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migration-check-RlegqnJv-ZUcop5v4.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-RlegqnJv.mjs"],"sourcesContent":["import { F as chooseAction, I as runCommandAction, N as mapRefResolutionError, k as errorSpaceNotFound, p as errorInvalidSpaceId, r as errorAmbiguousMigrationRef } from \"./cli-errors-CihMAEVj.mjs\";\nimport { s as resolveContractPath } from \"./command-helpers-uzQbbM97.mjs\";\nimport { u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-Cd0X2M_C.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-yA4h5Zc6.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(cwd, dirPath) {\n\treturn relative(cwd, dirPath);\n}\nfunction migrationFileRelative(cwd, dirPath, fileName) {\n\treturn join(migrationPathRelative(cwd, dirPath), fileName);\n}\nfunction checkFileExists(space, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(space.cwd, dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(space, pkg, migrationsDir) {\n\tconst spaceId = space.spaceId;\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json declares a valid 64-hex to-hash\")]\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or re-run the command that produced this migration to regenerate its snapshot\")]\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and its contract snapshot agree\")]\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir, cwd) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir,\n\t\t\tcwd\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tnextActions: [chooseAction(\"Delete the unreachable migration\"), chooseAction(\"Or re-emit a migration that connects it to the graph\")]\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(space.cwd, join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tnextActions: [runCommandAction(\"Point the ref at a graph node\", `prisma-next ref set ${name} <valid-hash>`), chooseAction(\"Or delete the ref\")]\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative, cwd } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(cwd, target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedSpace.cwd, matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\nexport { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };\n\n//# sourceMappingURL=migration-check-RlegqnJv.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,sBAAsB,KAAK,SAAS;CAC5C,OAAO,SAAS,KAAK,OAAO;AAC7B;AACA,SAAS,sBAAsB,KAAK,SAAS,UAAU;CACtD,OAAO,KAAK,sBAAsB,KAAK,OAAO,GAAG,QAAQ;AAC1D;AACA,SAAS,gBAAgB,OAAO,SAAS,SAAS,UAAU;CAC3D,IAAI,CAAC,WAAW,KAAK,SAAS,QAAQ,CAAC,GAAG,OAAO;EAChD,OAAO,MAAM;EACb,MAAM;EACN,OAAO,sBAAsB,MAAM,KAAK,SAAS,QAAQ;EACzD,KAAK,GAAG,SAAS,mBAAmB;EACpC,aAAa,CAAC,aA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S;EACV;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;CACA,OAAO;EACN,QAAQ;GACP,IAAI;GACJ;GACA,SAAS,GAAG,SAAS,OAAO;EAC7B;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;AACD"}
1
+ {"version":3,"file":"migration-check-BUAcSrvA-DSS5Yvco.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-BUAcSrvA.mjs"],"sourcesContent":["import { F as chooseAction, I as runCommandAction, N as mapRefResolutionError, k as errorSpaceNotFound, p as errorInvalidSpaceId, r as errorAmbiguousMigrationRef } from \"./cli-errors-CihMAEVj.mjs\";\nimport { s as resolveContractPath } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-1wG1OiDk.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-yA4h5Zc6.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(cwd, dirPath) {\n\treturn relative(cwd, dirPath);\n}\nfunction migrationFileRelative(cwd, dirPath, fileName) {\n\treturn join(migrationPathRelative(cwd, dirPath), fileName);\n}\nfunction checkFileExists(space, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(space.cwd, dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(space, pkg, migrationsDir) {\n\tconst spaceId = space.spaceId;\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json declares a valid 64-hex to-hash\")]\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or re-run the command that produced this migration to regenerate its snapshot\")]\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and its contract snapshot agree\")]\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir, cwd) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir,\n\t\t\tcwd\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tnextActions: [chooseAction(\"Delete the unreachable migration\"), chooseAction(\"Or re-emit a migration that connects it to the graph\")]\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(space.cwd, join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tnextActions: [runCommandAction(\"Point the ref at a graph node\", `prisma-next ref set ${name} <valid-hash>`), chooseAction(\"Or delete the ref\")]\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative, cwd } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(cwd, target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedSpace.cwd, matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\nexport { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };\n\n//# sourceMappingURL=migration-check-BUAcSrvA.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,sBAAsB,KAAK,SAAS;CAC5C,OAAO,SAAS,KAAK,OAAO;AAC7B;AACA,SAAS,sBAAsB,KAAK,SAAS,UAAU;CACtD,OAAO,KAAK,sBAAsB,KAAK,OAAO,GAAG,QAAQ;AAC1D;AACA,SAAS,gBAAgB,OAAO,SAAS,SAAS,UAAU;CAC3D,IAAI,CAAC,WAAW,KAAK,SAAS,QAAQ,CAAC,GAAG,OAAO;EAChD,OAAO,MAAM;EACb,MAAM;EACN,OAAO,sBAAsB,MAAM,KAAK,SAAS,QAAQ;EACzD,KAAK,GAAG,SAAS,mBAAmB;EACpC,aAAa,CAAC,aAAa,mEAAmE,CAAC;CAChG;CACA,OAAO;AACR;;;;;;;;;AASA,eAAe,yBAAyB,OAAO,KAAK,eAAe;CAClE,MAAM,UAAU,MAAM;CACtB,IAAI;CACJ,IAAI;EACH,cAAc,oBAAoB,eAAe,IAAI,SAAS,EAAE;CACjE,QAAQ;EACP,OAAO;GACN,OAAO;GACP,MAAM;GACN,OAAO,sBAAsB,MAAM,KAAK,IAAI,OAAO;GACnD,KAAK,cAAc,IAAI,QAAQ,iBAAiB,IAAI,SAAS,GAAG;GAChE,aAAa,CAAC,aAAa,iFAAiF,CAAC;EAC9G;CACD;CACA,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,yBAAyB,eAAe,IAAI,SAAS,EAAE;CACpE,SAAS,OAAO;EAC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,UAAU,CAAC;GACX,SAAS,0BAA0B,OAAO;EAC3C;EACA,UAAU;CACX;CACA,MAAM,WAAW,CAAC,GAAG,0BAA0B,YAAY,CAAC;CAC5D,KAAK,MAAM,KAAK,CAAC,kBAAkB,UAAU,GAAG;EAC/C,MAAM,OAAO,gBAAgB,cAAc,WAAW,SAAS,WAAW,SAAS,CAAC;EACpF,IAAI,MAAM,SAAS,KAAK,IAAI;CAC7B;CACA,MAAM,eAAe,oBAAoB,UAAU;CACnD,IAAI,CAAC,aAAa,IAAI,SAAS,KAAK;EACnC,OAAO,aAAa;EACpB,MAAM;EACN,OAAO,sBAAsB,aAAa,KAAK,WAAW,SAAS,gBAAgB;EACnF,KAAK,eAAe,aAAa,WAAW,kCAAkC,aAAa;EAC3F,aAAa,CAAC,aAAa,mEAAmE,CAAC;CAChG,CAAC;CACD,MAAM,kBAAkB,MAAM,yBAAyB,cAAc,YAAY,aAAa,oBAAoB;CAClH,IAAI,iBAAiB,SAAS,KAAK,eAAe;CAClD,MAAM,kBAAkB,aAAa,YAAY,QAAQ,aAAa,UAAU,KAAK;CACrF,IAAI,SAAS,WAAW,GAAG,OAAO;EACjC,QAAQ;GACP,IAAI;GACJ,UAAU,CAAC;GACX,SAAS;EACV;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;CACA,OAAO;EACN,QAAQ;GACP,IAAI;GACJ;GACA,SAAS,GAAG,SAAS,OAAO;EAC7B;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;AACD"}
@@ -1,12 +1,12 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
2
  import { I as runCommandAction, r as chooseAction } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
3
- import { a as formatErrorOutput, i as formatErrorJson, n as createTerminalUI } from "./terminal-ui-CUZTa2vH-WvAtuIOS.mjs";
4
- import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, x as setCommandSeeAlso, y as setCommandDescriptions } from "./command-helpers-uzQbbM97-EaL4zWf5.mjs";
5
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs";
6
- import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-RlegqnJv-ZUcop5v4.mjs";
3
+ import { a as formatErrorJson, o as formatErrorOutput, r as createTerminalUI } from "./terminal-ui-JJKxvT0q-CPDEJqqU.mjs";
4
+ import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, x as setCommandSeeAlso, y as setCommandDescriptions } from "./command-helpers-Dw3LDEu_-B4AETH4D.mjs";
5
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs";
6
+ import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-BUAcSrvA-DSS5Yvco.mjs";
7
7
  import { join, relative } from "pathe";
8
8
  import { Command } from "commander";
9
- //#region ../../../1-framework/3-tooling/cli/dist/migration-check-ASAenQ02.mjs
9
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-check-D0ABv6pO.mjs
10
10
  function migrationPathRelative(dirPath) {
11
11
  return relative(process.cwd(), dirPath);
12
12
  }
@@ -269,4 +269,4 @@ function createMigrationCheckCommand() {
269
269
  //#endregion
270
270
  export { createMigrationCheckCommand as t };
271
271
 
272
- //# sourceMappingURL=migration-check-ASAenQ02-B9a5jI8S.mjs.map
272
+ //# sourceMappingURL=migration-check-D0ABv6pO-BCJRf3lE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-check-ASAenQ02-B9a5jI8S.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-ASAenQ02.mjs"],"sourcesContent":["import { F as chooseAction, I as runCommandAction } from \"./cli-errors-CihMAEVj.mjs\";\nimport { i as formatErrorOutput, r as formatErrorJson, t as createTerminalUI } from \"./terminal-ui-CUZTa2vH.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, f as setCommandSeeAlso, t as addGlobalOptions, u as setCommandDescriptions } from \"./command-helpers-uzQbbM97.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-Cd0X2M_C.mjs\";\nimport { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from \"./migration-check-RlegqnJv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { join, relative } from \"pathe\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and ops.json agree\")]\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tnextActions: [chooseAction(\"Add a data operation if this self-edge was meant to carry a data invariant\"), chooseAction(\"Or delete the migration if it is a true no-op\")]\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tnextActions: [chooseAction(\"Remove the orphan directory\"), chooseAction(\"Or declare the extension in `extensions`\")]\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tnextActions: [runCommandAction(\"Re-emit the extension contract-space artefacts, then plan its migrations\", \"prisma-next contract emit\"), chooseAction(\"Or remove the extension from `extensions` if it is unused\")]\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the contract-space migrations and head ref artefacts\"), chooseAction(\"Or restore `refs/head.json` from version control\")]\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the contract-space migrations\"), chooseAction(\"Or restore the missing migration package\")]\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tnextActions: [chooseAction(\"Repair or remove the corrupt ref file\")]\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tnextActions: [chooseAction(\"Update the extension to target the configured database\"), chooseAction(\"Or change the project target\")]\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tnextActions: [chooseAction(\"Update the contracts so each storage element is owned by exactly one contract space\")]\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tnextActions: [runCommandAction(\"Re-emit the extension contract artefacts\", \"prisma-next contract emit\"), chooseAction(\"Or fix the descriptor producing the invalid contract\")]\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tnextActions: [chooseAction(\"Re-emit one of the conflicting packages so each migrationHash is unique\")]\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return {\n\t\terror: configResult.failure,\n\t\texitCode: 2\n\t};\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir, process.cwd());\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative,\n\t\tcwd: process.cwd()\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tfor (const action of f.nextActions) {\n\t\t\t\t\tconst command = action.command === void 0 ? \"\" : `: ${action.command}`;\n\t\t\t\t\tui.log(` next: ${action.label}${command}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-ASAenQ02.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,sBAAsB,SAAS,UAAU;CACjD,OAAO,KAAK,sBAAsB,OAAO,GAAG,QAAQ;AACrD;;;;;AAKA,SAAS,iCAAiC,WAAW,eAAe;CACnE,MAAM,iBAAiB,YAAY,sBAAsB,KAAK,eAAe,OAAO,CAAC;CACrF,MAAM,mBAAmB,SAAS,YAAY,sBAAsB,KAAK,eAAe,S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7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"migration-check-D0ABv6pO-BCJRf3lE.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-D0ABv6pO.mjs"],"sourcesContent":["import { F as chooseAction, I as runCommandAction } from \"./cli-errors-CihMAEVj.mjs\";\nimport { i as formatErrorOutput, r as formatErrorJson, t as createTerminalUI } from \"./terminal-ui-JJKxvT0q.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, f as setCommandSeeAlso, t as addGlobalOptions, u as setCommandDescriptions } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-1wG1OiDk.mjs\";\nimport { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from \"./migration-check-BUAcSrvA.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { join, relative } from \"pathe\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and ops.json agree\")]\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tnextActions: [chooseAction(\"Add a data operation if this self-edge was meant to carry a data invariant\"), chooseAction(\"Or delete the migration if it is a true no-op\")]\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tnextActions: [chooseAction(\"Remove the orphan directory\"), chooseAction(\"Or declare the extension in `extensions`\")]\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tnextActions: [runCommandAction(\"Re-emit the extension contract-space artefacts, then plan its migrations\", \"prisma-next contract emit\"), chooseAction(\"Or remove the extension from `extensions` if it is unused\")]\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the contract-space migrations and head ref artefacts\"), chooseAction(\"Or restore `refs/head.json` from version control\")]\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the contract-space migrations\"), chooseAction(\"Or restore the missing migration package\")]\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tnextActions: [chooseAction(\"Repair or remove the corrupt ref file\")]\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tnextActions: [chooseAction(\"Update the extension to target the configured database\"), chooseAction(\"Or change the project target\")]\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tnextActions: [chooseAction(\"Update the contracts so each storage element is owned by exactly one contract space\")]\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tnextActions: [runCommandAction(\"Re-emit the extension contract artefacts\", \"prisma-next contract emit\"), chooseAction(\"Or fix the descriptor producing the invalid contract\")]\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tnextActions: [chooseAction(\"Re-emit one of the conflicting packages so each migrationHash is unique\")]\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return {\n\t\terror: configResult.failure,\n\t\texitCode: 2\n\t};\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir, process.cwd());\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative,\n\t\tcwd: process.cwd()\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tfor (const action of f.nextActions) {\n\t\t\t\t\tconst command = action.command === void 0 ? \"\" : `: ${action.command}`;\n\t\t\t\t\tui.log(` next: ${action.label}${command}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-D0ABv6pO.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;A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AK,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK;IAC3C,KAAK,MAAM,UAAU,EAAE,aAAa;KACnC,MAAM,UAAU,OAAO,YAAY,KAAK,IAAI,KAAK,KAAK,OAAO;KAC7D,GAAG,IAAI,WAAW,OAAO,QAAQ,SAAS;IAC3C;GACD;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
@@ -1,13 +1,13 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
2
  import { N as errorUnexpected, c as errorDatabaseConnectionRequired, d as errorFileNotFound, j as errorTargetMigrationNotSupported, s as errorContractValidationFailed, t as CliStructuredError$1, u as errorDriverRequired } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
3
- import { f as maskConnectionUrl, g as resolveContractPath, s as formatStyledHeader, t as addGlobalOptions } from "./command-helpers-uzQbbM97-EaL4zWf5.mjs";
3
+ import { f as maskConnectionUrl, g as resolveContractPath, s as formatStyledHeader, t as addGlobalOptions } from "./command-helpers-Dw3LDEu_-B4AETH4D.mjs";
4
4
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
5
- import { t as createControlClient } from "./client-DLPcSdv7-Cukdon0q.mjs";
5
+ import { t as createControlClient } from "./client-C4Gh4PBz-BMUlBcuE.mjs";
6
6
  import { readFile } from "node:fs/promises";
7
7
  import { hasMigrations } from "@prisma/orm-framework/components/control";
8
8
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
9
9
  import { relative, resolve } from "node:path";
10
- //#region ../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-Bc5j_ehJ.mjs
10
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-CIMPoR6f.mjs
11
11
  /**
12
12
  * Prepares the shared context for migration commands (db init, db update).
13
13
  *
@@ -118,4 +118,4 @@ function addMigrationCommandOptions(command) {
118
118
  //#endregion
119
119
  export { prepareMigrationContext as n, addMigrationCommandOptions as t };
120
120
 
121
- //# sourceMappingURL=migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs.map
121
+ //# sourceMappingURL=migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-Bc5j_ehJ.mjs"],"sourcesContent":["import { A as errorTargetMigrationNotSupported, M as errorUnexpected, l as errorDriverRequired, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-CihMAEVj.mjs\";\nimport { S as formatStyledHeader, a as maskConnectionUrl, s as resolveContractPath, t as addGlobalOptions } from \"./command-helpers-uzQbbM97.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-DLPcSdv7.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { hasMigrations } from \"@internal/framework-components/control\";\nimport { relative, resolve } from \"node:path\";\n//#region src/utils/migration-command-scaffold.ts\n/**\n* Prepares the shared context for migration commands (db init, db update).\n*\n* Handles: config loading, contract file reading, JSON parsing, connection resolution,\n* driver/migration-support validation, client creation, and header output.\n*\n* Returns a Result with either the resolved context or a structured error.\n*/\nasync function prepareMigrationContext(options, flags, ui, descriptor) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tlet contractPathAbsolute;\n\ttry {\n\t\tcontractPathAbsolute = resolveContractPath(config);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: contractPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\tif (options.dryRun) details.push({\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: \"dry run\"\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: descriptor.commandName,\n\t\t\tdescription: descriptor.description,\n\t\t\turl: descriptor.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = JSON.parse(contractJsonContent);\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${descriptor.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: descriptor.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${descriptor.commandName}` }));\n\tif (!hasMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\treturn ok({\n\t\tclient,\n\t\tcontractJson,\n\t\tdbConnection,\n\t\tonProgress,\n\t\tconfigPath,\n\t\tcontractPath,\n\t\tcontractPathAbsolute,\n\t\tconfig\n\t});\n}\n/**\n* Registers the shared CLI options for migration commands (db init, db update).\n*/\nfunction addMigrationCommandOptions(command) {\n\taddGlobalOptions(command);\n\treturn command.option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--dry-run\", \"Preview planned operations without applying\", false);\n}\n//#endregion\nexport { prepareMigrationContext as n, addMigrationCommandOptions as t };\n\n//# sourceMappingURL=migration-command-scaffold-Bc5j_ehJ.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,eAAe,wBAAwB,SAAS,OAAO,IAAI,YAAY;CACtE,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,aAAa,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;CACvF,IAAI;CACJ,IAAI;EACH,uBAAuB,oBAAoB,MAAM;CAClD,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,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,WAAW;EACvG,aAAa,WAAW;CACzB,CAAC,CAAC;CACF,IAAI,CAAC,OAAO,QAAQ,OAAO,MAAM,oBAAoB,EAAE,KAAK,iCAAiC,WAAW,cAAc,CAAC,CAAC;CACxH,IAAI,CAAC,cAAc,OAAO,MAAM,GAAG,OAAO,MAAM,iCAAiC,EAAE,KAAK,WAAW,OAAO,OAAO,GAAG,+BAA+B,CAAC,CAAC;CACrJ,MAAM,SAAS,oBAAoB;EAClC,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,YAAY,OAAO,cAAc,CAAC;CACnC,CAAC;CACD,MAAM,aAAa,sBAAsB;EACxC;EACA;CACD,CAAC;CACD,OAAO,GAAG;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;AACF;;;;AAIA,SAAS,2BAA2B,SAAS;CAC5C,iBAAiB,OAAO;CACxB,OAAO,QAAQ,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,aAAa,+CAA+C,KAAK;AACtM"}
1
+ {"version":3,"file":"migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-CIMPoR6f.mjs"],"sourcesContent":["import { A as errorTargetMigrationNotSupported, M as errorUnexpected, l as errorDriverRequired, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-CihMAEVj.mjs\";\nimport { S as formatStyledHeader, a as maskConnectionUrl, s as resolveContractPath, t as addGlobalOptions } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-C4Gh4PBz.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { hasMigrations } from \"@internal/framework-components/control\";\nimport { relative, resolve } from \"node:path\";\n//#region src/utils/migration-command-scaffold.ts\n/**\n* Prepares the shared context for migration commands (db init, db update).\n*\n* Handles: config loading, contract file reading, JSON parsing, connection resolution,\n* driver/migration-support validation, client creation, and header output.\n*\n* Returns a Result with either the resolved context or a structured error.\n*/\nasync function prepareMigrationContext(options, flags, ui, descriptor) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tlet contractPathAbsolute;\n\ttry {\n\t\tcontractPathAbsolute = resolveContractPath(config);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: contractPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\tif (options.dryRun) details.push({\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: \"dry run\"\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: descriptor.commandName,\n\t\t\tdescription: descriptor.description,\n\t\t\turl: descriptor.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = JSON.parse(contractJsonContent);\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${descriptor.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: descriptor.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${descriptor.commandName}` }));\n\tif (!hasMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\treturn ok({\n\t\tclient,\n\t\tcontractJson,\n\t\tdbConnection,\n\t\tonProgress,\n\t\tconfigPath,\n\t\tcontractPath,\n\t\tcontractPathAbsolute,\n\t\tconfig\n\t});\n}\n/**\n* Registers the shared CLI options for migration commands (db init, db update).\n*/\nfunction addMigrationCommandOptions(command) {\n\taddGlobalOptions(command);\n\treturn command.option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--dry-run\", \"Preview planned operations without applying\", false);\n}\n//#endregion\nexport { prepareMigrationContext as n, add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igForSections } from "./exports-BZLNbtkY.mjs";
2
- import { n as createTerminalUI } from "./terminal-ui-CUZTa2vH-WvAtuIOS.mjs";
3
- import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, x as setCommandSeeAlso, y as setCommandDescriptions } from "./command-helpers-uzQbbM97-EaL4zWf5.mjs";
4
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs";
5
- import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-AKRIIovW-Cr39jOaI.mjs";
2
+ import { r as createTerminalUI } from "./terminal-ui-JJKxvT0q-CPDEJqqU.mjs";
3
+ import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, x as setCommandSeeAlso, y as setCommandDescriptions } from "./command-helpers-Dw3LDEu_-B4AETH4D.mjs";
4
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs";
5
+ import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-AKRIIovW-BN-Zrwk0.mjs";
6
6
  import { v as renderMigrationGraphLegend } from "./migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs";
7
- import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-BtP1Va3T-CMOZgqVW.mjs";
8
- import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs";
7
+ import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-BtP1Va3T-C8PpuaYw.mjs";
8
+ import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-CceYWPCP-LqImOaK1.mjs";
9
9
  import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-QYDKKevn-DCIlAPn4.mjs";
10
10
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
11
11
  import { ok } from "@prisma/orm-framework/utils/result";
12
12
  import { Command } from "commander";
13
- //#region ../../../1-framework/3-tooling/cli/dist/migration-graph-BYRfJ6pm.mjs
13
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-graph-BsGstA5L.mjs
14
14
  function computeGraphSummary(spaces) {
15
15
  const contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);
16
16
  const migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);
@@ -141,4 +141,4 @@ function createMigrationGraphCommand() {
141
141
  //#endregion
142
142
  export { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };
143
143
 
144
- //# sourceMappingURL=migration-graph-BYRfJ6pm-WucWOxZ8.mjs.map
144
+ //# sourceMappingURL=migration-graph-BsGstA5L-BQiNbrkP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph-BYRfJ6pm-WucWOxZ8.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-BYRfJ6pm.mjs"],"sourcesContent":["import { t as createTerminalUI } from \"./terminal-ui-CUZTa2vH.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, f as setCommandSeeAlso, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-uzQbbM97.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-Cd0X2M_C.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"./migration-list-AKRIIovW.mjs\";\nimport { a as renderMigrationGraphLegend } from \"./migration-graph-command-render-CgdHruiZ.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"./migration-graph-BtP1Va3T.mjs\";\nimport { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from \"./migration-graph-sections-CceYWPCP.mjs\";\nimport { n as validateLegendOptions, t as shouldShowLegend } from \"./legend-QYDKKevn.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/commands/migration-graph.ts\nfunction computeGraphSummary(spaces) {\n\tconst contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contractCount} contract(s), ${migrationCount} migration(s)`;\n}\nfunction formatMigrationGraphHumanOutput(result) {\n\treturn renderMigrationGraphSections(result.treeSections, result.summary);\n}\nasync function executeMigrationGraphCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration graph\",\n\t\t\tdescription: \"Show the migration graph topology\",\n\t\t\tdetails: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t},\n\t\t\t\t...options.space !== void 0 ? [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: options.space\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return loaded;\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst treeSections = buildMigrationGraphTreeSections({\n\t\taggregate,\n\t\tscopedSpaces,\n\t\tliveContractHash,\n\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\tcolorize: flags.color !== false\n\t});\n\tconst spaces = [...buildMigrationSpaceGraphEntries({\n\t\taggregate,\n\t\tscopedSpaces\n\t})];\n\treturn ok({\n\t\tok: true,\n\t\tgraph: appGraph,\n\t\tspaces,\n\t\ttreeSections,\n\t\tsummary: computeGraphSummary(spaces)\n\t});\n}\nfunction createMigrationGraphCommand() {\n\tconst command = new Command(\"graph\");\n\tsetCommandDescriptions(command, \"Show the migration graph topology\", \"Renders the migration graph topology.\\nOffline — does not consult the database.\\n--ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\nUse --json for machine-readable output, or --dot for Graphviz DOT\\nformat.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration graph\",\n\t\t\"prisma-next migration graph --json\",\n\t\t\"prisma-next migration graph --dot\",\n\t\t\"prisma-next migration graph --ascii\",\n\t\t\"prisma-next migration graph --legend\",\n\t\t\"prisma-next migration graph --space app\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--dot\", \"Output in Graphviz DOT format\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {\n\t\t\tif (options.dot) ui.output(renderMigrationGraphDot(graphResult.graph));\n\t\t\telse if (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...graphResult.spaces],\n\t\t\t\t\tsummary: graphResult.summary\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };\n\n//# sourceMappingURL=migration-graph-BYRfJ6pm.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,oBAAoB,QAAQ;CACpC,MAAM,gBAAgB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,UAAU,QAAQ,CAAC;CACvF,MAAM,iBAAiB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,WAAW,QAAQ,CAAC;CACzF,OAAO,GAAG,OAAO,OAAO,aAAa,cAAc,gBAAgB,eAAe;AACnF;AACA,SAAS,gCAAgC,QAAQ;CAChD,O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K,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAChF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"migration-graph-BsGstA5L-BQiNbrkP.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-BsGstA5L.mjs"],"sourcesContent":["import { t as createTerminalUI } from \"./terminal-ui-JJKxvT0q.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, f as setCommandSeeAlso, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-1wG1OiDk.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"./migration-list-AKRIIovW.mjs\";\nimport { a as renderMigrationGraphLegend } from \"./migration-graph-command-render-CgdHruiZ.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"./migration-graph-BtP1Va3T.mjs\";\nimport { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from \"./migration-graph-sections-CceYWPCP.mjs\";\nimport { n as validateLegendOptions, t as shouldShowLegend } from \"./legend-QYDKKevn.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/commands/migration-graph.ts\nfunction computeGraphSummary(spaces) {\n\tconst contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contractCount} contract(s), ${migrationCount} migration(s)`;\n}\nfunction formatMigrationGraphHumanOutput(result) {\n\treturn renderMigrationGraphSections(result.treeSections, result.summary);\n}\nasync function executeMigrationGraphCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration graph\",\n\t\t\tdescription: \"Show the migration graph topology\",\n\t\t\tdetails: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t},\n\t\t\t\t...options.space !== void 0 ? [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: options.space\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return loaded;\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst treeSections = buildMigrationGraphTreeSections({\n\t\taggregate,\n\t\tscopedSpaces,\n\t\tliveContractHash,\n\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\tcolorize: flags.color !== false\n\t});\n\tconst spaces = [...buildMigrationSpaceGraphEntries({\n\t\taggregate,\n\t\tscopedSpaces\n\t})];\n\treturn ok({\n\t\tok: true,\n\t\tgraph: appGraph,\n\t\tspaces,\n\t\ttreeSections,\n\t\tsummary: computeGraphSummary(spaces)\n\t});\n}\nfunction createMigrationGraphCommand() {\n\tconst command = new Command(\"graph\");\n\tsetCommandDescriptions(command, \"Show the migration graph topology\", \"Renders the migration graph topology.\\nOffline — does not consult the database.\\n--ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\nUse --json for machine-readable output, or --dot for Graphviz DOT\\nformat.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration graph\",\n\t\t\"prisma-next migration graph --json\",\n\t\t\"prisma-next migration graph --dot\",\n\t\t\"prisma-next migration graph --ascii\",\n\t\t\"prisma-next migration graph --legend\",\n\t\t\"prisma-next migration graph --space app\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--dot\", \"Output in Graphviz DOT format\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {\n\t\t\tif (options.dot) ui.output(renderMigrationGraphDot(graphResult.graph));\n\t\t\telse if (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...graphResult.spaces],\n\t\t\t\t\tsummary: graphResult.summary\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };\n\n//# sourceMappingURL=migration-graph-BsGstA5L.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,oBAAoB,QAAQ;CACpC,MAAM,gBAAgB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,UAAU,QAAQ,CAAC;CACvF,MAAM,iBAAiB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,WAAW,QAAQ,CAAC;CACzF,OAAO,GAAG,OAAO,OAAO,aAAa,cAAc,gBAAgB,eAAe;AACnF;AACA,SAAS,gCAAgC,QAAQ;CAChD,OAAO,6BAA6B,OAAO,cAAc,OAAO,OAAO;AACxE;AACA,eAAe,6BAA6B,SAAS,OAAO,IAAI;CAC/D,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,EAAE,YAAY,oBAAoB,kBAAkB,sBAAsB,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CACrH,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAChC,MAAM,SAAS,mBAAmB;GACjC,S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EAC1B;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,gBAAgB,0CAA0C,CAAC,CAAC,OAAO,SAAS,+BAA+B,CAAC,CAAC,OAAO,WAAW,kCAAkC,CAAC,CAAC,OAAO,YAAY,iDAAiD,CAAC,CAAC,OAAO,OAAO,YAAY;EAC9V,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IAAI,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAChF,MAAM,WAAW,aAAa,MAAM,6BAA6B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,gBAAgB;GACjH,IAAI,QAAQ,KAAK,GAAG,OAAO,wBAAwB,YAAY,KAAK,CAAC;QAChE,IAAI,MAAM,MAAM;IACpB,MAAM,aAAa;KAClB,IAAI;KACJ,QAAQ,CAAC,GAAG,YAAY,MAAM;KAC9B,SAAS,YAAY;IACtB;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAChF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,5 +1,5 @@
1
1
  import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
2
- import { t as listRefsByContractHash } from "./migration-list-AKRIIovW-Cr39jOaI.mjs";
2
+ import { t as listRefsByContractHash } from "./migration-list-AKRIIovW-BN-Zrwk0.mjs";
3
3
  //#region ../../../1-framework/3-tooling/cli/dist/migration-graph-BtP1Va3T.mjs
4
4
  /**
5
5
  * Project scoped list entries into the per-space contracts+migrations rows the migration
@@ -32,4 +32,4 @@ function buildMigrationSpaceGraphEntries(args) {
32
32
  //#endregion
33
33
  export { buildMigrationSpaceGraphEntries as t };
34
34
 
35
- //# sourceMappingURL=migration-graph-BtP1Va3T-CMOZgqVW.mjs.map
35
+ //# sourceMappingURL=migration-graph-BtP1Va3T-C8PpuaYw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph-BtP1Va3T-CMOZgqVW.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-BtP1Va3T.mjs"],"sourcesContent":["import { t as listRefsByContractHash } from \"./migration-list-AKRIIovW.mjs\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\n//#region src/control-api/operations/migration-graph.ts\n/**\n* Project scoped list entries into the per-space contracts+migrations rows the migration\n* graph --json output serializes (EMPTY_CONTRACT_HASH from-hash → null). Skips space ids\n* the aggregate no longer resolves, mirroring the command loop.\n*/\nfunction buildMigrationSpaceGraphEntries(args) {\n\tconst spaces = [];\n\tfor (const spaceEntry of args.scopedSpaces) {\n\t\tconst space = args.aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tspaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcontracts: [...graph.nodes].map((hash) => ({\n\t\t\t\thash,\n\t\t\t\trefs: [...refsByHash.get(hash) ?? []]\n\t\t\t})),\n\t\t\tmigrations: [...graph.migrationByHash.values()].map((edge) => ({\n\t\t\t\tname: edge.dirName,\n\t\t\t\thash: edge.migrationHash,\n\t\t\t\tfromContract: edge.from === EMPTY_CONTRACT_HASH ? null : edge.from,\n\t\t\t\ttoContract: edge.to\n\t\t\t}))\n\t\t});\n\t}\n\treturn spaces;\n}\n//#endregion\nexport { buildMigrationSpaceGraphEntries as t };\n\n//# sourceMappingURL=migration-graph-BtP1Va3T.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,gCAAgC,MAAM;CAC9C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,cAAc,KAAK,cAAc;EAC3C,MAAM,QAAQ,KAAK,UAAU,MAAM,WAAW,KAAK;EACnD,IAAI,UAAU,KAAK,GAAG;EACtB,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,aAAa,uBAAuB,KAAK;EAC/C,OAAO,KAAK;GACX,OAAO,WAAW;GAClB,WAAW,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,KAAK,UAAU;IAC1C;IACA,MAAM,CAAC,GAAG,WAAW,IAAI,IAAI,KAAK,CAAC,CAAC;GACrC,EAAE;GACF,YAAY,CAAC,GAAG,MAAM,gBAAgB,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU;IAC9D,MAAM,KAAK;IACX,MAAM,KAAK;IACX,cAAc,KAAK,SAAA,UAA+B,OAAO,KAAK;IAC9D,YAAY,KAAK;GAClB,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR"}
1
+ {"version":3,"file":"migration-graph-BtP1Va3T-C8PpuaYw.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-BtP1Va3T.mjs"],"sourcesContent":["import { t as listRefsByContractHash } from \"./migration-list-AKRIIovW.mjs\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\n//#region src/control-api/operations/migration-graph.ts\n/**\n* Project scoped list entries into the per-space contracts+migrations rows the migration\n* graph --json output serializes (EMPTY_CONTRACT_HASH from-hash → null). Skips space ids\n* the aggregate no longer resolves, mirroring the command loop.\n*/\nfunction buildMigrationSpaceGraphEntries(args) {\n\tconst spaces = [];\n\tfor (const spaceEntry of args.scopedSpaces) {\n\t\tconst space = args.aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tspaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcontracts: [...graph.nodes].map((hash) => ({\n\t\t\t\thash,\n\t\t\t\trefs: [...refsByHash.get(hash) ?? []]\n\t\t\t})),\n\t\t\tmigrations: [...graph.migrationByHash.values()].map((edge) => ({\n\t\t\t\tname: edge.dirName,\n\t\t\t\thash: edge.migrationHash,\n\t\t\t\tfromContract: edge.from === EMPTY_CONTRACT_HASH ? null : edge.from,\n\t\t\t\ttoContract: edge.to\n\t\t\t}))\n\t\t});\n\t}\n\treturn spaces;\n}\n//#endregion\nexport { buildMigrationSpaceGraphEntries as t };\n\n//# sourceMappingURL=migration-graph-BtP1Va3T.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,gCAAgC,MAAM;CAC9C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,cAAc,KAAK,cAAc;EAC3C,MAAM,QAAQ,KAAK,UAAU,MAAM,WAAW,KAAK;EACnD,IAAI,UAAU,KAAK,GAAG;EACtB,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,aAAa,uBAAuB,KAAK;EAC/C,OAAO,KAAK;GACX,OAAO,WAAW;GAClB,WAAW,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,KAAK,UAAU;IAC1C;IACA,MAAM,CAAC,GAAG,WAAW,IAAI,IAAI,KAAK,CAAC,CAAC;GACrC,EAAE;GACF,YAAY,CAAC,GAAG,MAAM,gBAAgB,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU;IAC9D,MAAM,KAAK;IACX,MAAM,KAAK;IACX,cAAc,KAAK,SAAA,UAA+B,OAAO,KAAK;IAC9D,YAAY,KAAK;GAClB,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR"}
@@ -1,8 +1,8 @@
1
- import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
1
+ import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from "./errors-CXbGUWGu-BQi6YS-H.mjs";
2
2
  import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
5
- //#region ../../../1-framework/3-tooling/migration/dist/migration-graph-DDaOHo10.mjs
5
+ //#region ../../../1-framework/3-tooling/migration/dist/migration-graph-_SJImD5V.mjs
6
6
  /**
7
7
  * FIFO queue with amortised O(1) push and shift.
8
8
  *
@@ -497,4 +497,4 @@ function detectOrphans(graph) {
497
497
  //#endregion
498
498
  export { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };
499
499
 
500
- //# sourceMappingURL=migration-graph-DDaOHo10-yJFAbKCu.mjs.map
500
+ //# sourceMappingURL=migration-graph-_SJImD5V-D5RCc651.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph-DDaOHo10-yJFAbKCu.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-DDaOHo10.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-Co-8oaiB.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-DDaOHo10.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,GAAG;EACzB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzB;CACA,KAAK,MAAM;EACV,KAAK,MAAM,KAAK,IAAI;CACrB;;;;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ACA,KAAK,MAAM,QAAQ,IAAI,aAAa,MAAM,kBAAkB,OAAO,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,KAAK;CAChG,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,MAAM,eAAe,MAAM,cAAc,IAAI,CAAC,UAAU,IAAI,IAAI,GAAG,QAAQ,KAAK,GAAG,UAAU;CACzG,OAAO;AACR"}
1
+ {"version":3,"file":"migration-graph-_SJImD5V-D5RCc651.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-_SJImD5V.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-CXbGUWGu.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-_SJImD5V.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,GAAG;EACzB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzB;CACA,KAAK,MAAM;EACV,KAAK,MAAM,KAAK,IAAI;CACrB;;;;;CAKA,QAAQ;EACP,IAAI,KAAK,QAAQ,KAAK,MAAM,QAAQ,MAAM,IAAI,cAAc,mCAAmC;EAC/F,OAAO,KAAK,MAAM,KAAK;CACxB;CACA,IAAI,UAAU;EACb,OAAO,KAAK,QAAQ,KAAK,MAAM;CAChC;AACD;AAGA,UAAU,IAAI,QAAQ,YAAY,OAAO,UAAU,OAAO;CACzD,MAAM,0BAA0B,IAAI,IAAI;CACxC,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,QAAQ,IAAI,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1
+ import { t as listRefsByContractHash } from "./migration-list-AKRIIovW-BN-Zrwk0.mjs";
2
2
  import { m as indentMigrationGraphTreeBlock, o as computeGlobalMaxDirNameWidth, s as computeGlobalMaxEdgeTreePrefixWidth, y as renderMigrationGraphSpaceTree } from "./migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs";
3
3
  //#region ../../../1-framework/3-tooling/cli/dist/migration-graph-sections-CceYWPCP.mjs
4
4
  /**
@@ -66,4 +66,4 @@ function renderMigrationGraphDot(graph) {
66
66
  //#endregion
67
67
  export { renderMigrationGraphDot as n, renderMigrationGraphSections as r, buildMigrationGraphTreeSections as t };
68
68
 
69
- //# sourceMappingURL=migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs.map
69
+ //# sourceMappingURL=migration-graph-sections-CceYWPCP-LqImOaK1.mjs.map