@prisma/orm-toolchain 0.17.0-dev.1 → 0.17.0-dev.2

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 (82) hide show
  1. package/dist/bin__prisma-next.mjs +21 -21
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/cli.mjs +2 -2
  4. package/dist/cli__commands__contract-emit.mjs +1 -1
  5. package/dist/cli__commands__contract-infer.mjs +1 -1
  6. package/dist/cli__commands__db-init.mjs +1 -1
  7. package/dist/cli__commands__db-schema.mjs +1 -1
  8. package/dist/cli__commands__db-sign.mjs +1 -1
  9. package/dist/cli__commands__db-update.mjs +1 -1
  10. package/dist/cli__commands__db-verify.mjs +1 -1
  11. package/dist/cli__commands__migrate.mjs +1 -1
  12. package/dist/cli__commands__migration-check.mjs +1 -1
  13. package/dist/cli__commands__migration-graph.mjs +1 -1
  14. package/dist/cli__commands__migration-list.mjs +1 -1
  15. package/dist/cli__commands__migration-log.mjs +1 -1
  16. package/dist/cli__commands__migration-new.mjs +1 -1
  17. package/dist/cli__commands__migration-plan.mjs +1 -1
  18. package/dist/cli__commands__migration-show.mjs +1 -1
  19. package/dist/cli__commands__migration-status.mjs +1 -1
  20. package/dist/cli__commands__ref.mjs +1 -1
  21. package/dist/cli__control-api.mjs +2 -2
  22. package/dist/cli__migration-cli.mjs +1 -1
  23. package/dist/{client-75qrAPqf-DZAVUxFa.mjs → client-75qrAPqf-DRg33_uJ.mjs} +2 -2
  24. package/dist/{client-75qrAPqf-DZAVUxFa.mjs.map → client-75qrAPqf-DRg33_uJ.mjs.map} +1 -1
  25. package/dist/config-loader.mjs +1 -1
  26. package/dist/{contract-emit-0hSjbuxp-BBOKldTZ.mjs → contract-emit-0hSjbuxp-D2wIkKg5.mjs} +4 -4
  27. package/dist/{contract-emit-0hSjbuxp-BBOKldTZ.mjs.map → contract-emit-0hSjbuxp-D2wIkKg5.mjs.map} +1 -1
  28. package/dist/{contract-emit-B6odMoem-CK3diBPk.mjs → contract-emit-B6odMoem-BqLV218x.mjs} +3 -3
  29. package/dist/{contract-emit-B6odMoem-CK3diBPk.mjs.map → contract-emit-B6odMoem-BqLV218x.mjs.map} +1 -1
  30. package/dist/{contract-infer-BnkqpftN-DVM2eKJ3.mjs → contract-infer-BnkqpftN-CWEXM1_m.mjs} +2 -2
  31. package/dist/{contract-infer-BnkqpftN-DVM2eKJ3.mjs.map → contract-infer-BnkqpftN-CWEXM1_m.mjs.map} +1 -1
  32. package/dist/{db-init-Vbkb_TKZ.mjs → db-init-CNV8ATc2.mjs} +2 -2
  33. package/dist/{db-init-Vbkb_TKZ.mjs.map → db-init-CNV8ATc2.mjs.map} +1 -1
  34. package/dist/{db-schema-ClQCu3xY.mjs → db-schema-CJzVfw2K.mjs} +2 -2
  35. package/dist/{db-schema-ClQCu3xY.mjs.map → db-schema-CJzVfw2K.mjs.map} +1 -1
  36. package/dist/{db-sign-jjXDgQ1u.mjs → db-sign-gLmoexj3.mjs} +3 -3
  37. package/dist/{db-sign-jjXDgQ1u.mjs.map → db-sign-gLmoexj3.mjs.map} +1 -1
  38. package/dist/{db-update-BQlrqtDD.mjs → db-update-C24M1jin.mjs} +2 -2
  39. package/dist/{db-update-BQlrqtDD.mjs.map → db-update-C24M1jin.mjs.map} +1 -1
  40. package/dist/{db-verify-CKPsRFrj-3udprZQD.mjs → db-verify-CKPsRFrj-1sjfQjHX.mjs} +3 -3
  41. package/dist/{db-verify-CKPsRFrj-3udprZQD.mjs.map → db-verify-CKPsRFrj-1sjfQjHX.mjs.map} +1 -1
  42. package/dist/emitter.d.mts +5 -2
  43. package/dist/emitter.d.mts.map +1 -1
  44. package/dist/emitter.mjs +1 -1
  45. package/dist/{exports-D3-NwrMA-CadaBGQ3.mjs → exports-BGMKuMBH-C1_tsw6T.mjs} +8 -4
  46. package/dist/{exports-D3-NwrMA-CadaBGQ3.mjs.map → exports-BGMKuMBH-C1_tsw6T.mjs.map} +1 -1
  47. package/dist/{exports-Dl2aGAk7.mjs → exports-BTEdvV8H.mjs} +2 -2
  48. package/dist/{exports-Dl2aGAk7.mjs.map → exports-BTEdvV8H.mjs.map} +1 -1
  49. package/dist/{exports-B_xhKZmC.mjs → exports-DPBVzFXj.mjs} +2 -2
  50. package/dist/{exports-B_xhKZmC.mjs.map → exports-DPBVzFXj.mjs.map} +1 -1
  51. package/dist/{format-ByDm2goZ-DKLyhNHo.mjs → format-ByDm2goZ-CDNjRRyB.mjs} +2 -2
  52. package/dist/{format-ByDm2goZ-DKLyhNHo.mjs.map → format-ByDm2goZ-CDNjRRyB.mjs.map} +1 -1
  53. package/dist/{init-DHctXAI9-DSlaaYXN.mjs → init-DHctXAI9-DfuY-JG7.mjs} +2 -2
  54. package/dist/{init-DHctXAI9-DSlaaYXN.mjs.map → init-DHctXAI9-DfuY-JG7.mjs.map} +1 -1
  55. package/dist/{inspect-live-schema-CnwYTRZ0-BErPHMni.mjs → inspect-live-schema-CnwYTRZ0-Bdvwf7Dl.mjs} +3 -3
  56. package/dist/{inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map → inspect-live-schema-CnwYTRZ0-Bdvwf7Dl.mjs.map} +1 -1
  57. package/dist/{migrate-Cb_iv264.mjs → migrate-BnHRdrqX.mjs} +4 -4
  58. package/dist/{migrate-Cb_iv264.mjs.map → migrate-BnHRdrqX.mjs.map} +1 -1
  59. package/dist/{migration-check-CcG-fB8r-CDs5C9vt.mjs → migration-check-DcwUnadt-DfjO4JKT.mjs} +3 -3
  60. package/dist/migration-check-DcwUnadt-DfjO4JKT.mjs.map +1 -0
  61. package/dist/{migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs → migration-command-scaffold-BCuoeAki-BMi1GAv-.mjs} +3 -3
  62. package/dist/{migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map → migration-command-scaffold-BCuoeAki-BMi1GAv-.mjs.map} +1 -1
  63. package/dist/{migration-graph-DkoCC0Qy.mjs → migration-graph-Bjy-ZHY3.mjs} +3 -3
  64. package/dist/{migration-graph-DkoCC0Qy.mjs.map → migration-graph-Bjy-ZHY3.mjs.map} +1 -1
  65. package/dist/{migration-list-BFBeo1_X-c0kqYokL.mjs → migration-list-BFBeo1_X-DwyOI0w9.mjs} +2 -2
  66. package/dist/{migration-list-BFBeo1_X-c0kqYokL.mjs.map → migration-list-BFBeo1_X-DwyOI0w9.mjs.map} +1 -1
  67. package/dist/{migration-log-CS5IWcNq-BQ-32Low.mjs → migration-log-CS5IWcNq-CjmDyvwG.mjs} +3 -3
  68. package/dist/{migration-log-CS5IWcNq-BQ-32Low.mjs.map → migration-log-CS5IWcNq-CjmDyvwG.mjs.map} +1 -1
  69. package/dist/{migration-new-BurCjyaQ.mjs → migration-new-CCEfD9oh.mjs} +3 -3
  70. package/dist/{migration-new-BurCjyaQ.mjs.map → migration-new-CCEfD9oh.mjs.map} +1 -1
  71. package/dist/{migration-plan-q_L84PN1-BWE0LTH6.mjs → migration-plan-q_L84PN1-BFb6Si_L.mjs} +3 -3
  72. package/dist/{migration-plan-q_L84PN1-BWE0LTH6.mjs.map → migration-plan-q_L84PN1-BFb6Si_L.mjs.map} +1 -1
  73. package/dist/{migration-show-Bx5I5aW9.mjs → migration-show-PTC1gUjq.mjs} +3 -3
  74. package/dist/{migration-show-Bx5I5aW9.mjs.map → migration-show-PTC1gUjq.mjs.map} +1 -1
  75. package/dist/{migration-status-CFlzlRmu-DewBN8Ys.mjs → migration-status-CE7cQLDq-BNFyJssP.mjs} +5 -5
  76. package/dist/migration-status-CE7cQLDq-BNFyJssP.mjs.map +1 -0
  77. package/dist/{ref-B6cTthTi.mjs → ref-tjLWCeGO.mjs} +2 -2
  78. package/dist/{ref-B6cTthTi.mjs.map → ref-tjLWCeGO.mjs.map} +1 -1
  79. package/dist/vite-plugin-contract-emit.mjs +3 -3
  80. package/package.json +12 -12
  81. package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +0 -1
  82. package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migration-list-BFBeo1_X-c0kqYokL.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-list-BFBeo1_X.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, _ as createTerminalUI, at as errorSpaceNotFound, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, q as errorLegendHumanOnly, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { a as renderMigrationGraphLegend, c as renderMigrationListWithStyle, o as createAnsiMigrationListStyler } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { APP_SPACE_ID, isValidSpaceId, listContractSpaceDirectories } from \"@internal/migration-tools/spaces\";\nimport { HEAD_REF_NAME, refsByContractHash } from \"@internal/migration-tools/refs\";\n//#region src/utils/legend.ts\n/**\n* The legend is decoration printed alongside the command header on stderr, so\n* it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n* `--quiet`) exactly as the header is.\n*/\nfunction shouldShowLegend(options, flags) {\n\treturn options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;\n}\nfunction validateLegendOptions(options, flags) {\n\tif (options.legend !== true) return ok(void 0);\n\tif (flags.json === true) return notOk(errorLegendHumanOnly(\"--json\"));\n\tif (flags.quiet === true) return notOk(errorLegendHumanOnly(\"--quiet\"));\n\tif (options.dot === true) return notOk(errorLegendHumanOnly(\"--dot\"));\n\treturn ok(void 0);\n}\n//#endregion\n//#region src/commands/migration-list.ts\nfunction compareSpaceIds(a, b) {\n\tif (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n\tif (b === APP_SPACE_ID) return 1;\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\nfunction compareDirNamesDescending(a, b) {\n\tif (a.name < b.name) return 1;\n\tif (a.name > b.name) return -1;\n\treturn 0;\n}\n/**\n* Ref names decorating a space's destination contract hashes. The\n* tolerant `space.refs` deliberately omits the structural `head.json`;\n* for extension spaces the old enumerator surfaced it as a `head`\n* decoration on the tip migration, so fold `space.headRef` back in to\n* keep that output. The app space synthesises its head, so it carries\n* no on-disk `head` ref to restore.\n*/\nfunction listRefsByContractHash(space) {\n\tconst byHash = new Map(refsByContractHash(space.refs));\n\tif (space.spaceId !== APP_SPACE_ID && space.headRef !== null) {\n\t\tconst hash = space.headRef.hash;\n\t\tconst bucket = byHash.get(hash) ?? [];\n\t\tif (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n\t}\n\treturn byHash;\n}\nasync function orderedOnDiskSpaceIds(projectMigrationsDir) {\n\treturn (await listContractSpaceDirectories(projectMigrationsDir)).filter(isValidSpaceId).sort(compareSpaceIds);\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the render-ready\n* {@link MigrationSpaceListEntry} rows `migration list` displays.\n*\n* Space membership matches the on-disk contract-space directories (not the\n* aggregate's always-present synthesized app space when `migrations/app/`\n* is absent); package and ref data come from `aggregate.space(id)`.\n*/\nasync function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {\n\tconst spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n\tconst spaces = [];\n\tfor (const spaceId of spaceIds) {\n\t\tconst space = aggregate.space(spaceId);\n\t\tif (space === void 0) continue;\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tconst migrations = space.packages.map((pkg) => ({\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\trefs: [...refsByHash.get(pkg.metadata.to) ?? []],\n\t\t\tprovidedInvariants: [...pkg.metadata.providedInvariants]\n\t\t})).sort(compareDirNamesDescending);\n\t\tspaces.push({\n\t\t\tspace: spaceId,\n\t\t\tmigrations\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction renderMigrationListHumanOutput(result, options) {\n\treturn renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, {\n\t\tcolorize: options.useColor,\n\t\tliveContractHash: options.liveContractHash,\n\t\tgraphForSpace: options.graphForSpace,\n\t\t...options.appSpaceId !== void 0 ? { appSpaceId: options.appSpaceId } : {}\n\t});\n}\nfunction computeSummary(spaces) {\n\tconst totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\tif (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;\n\treturn `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n/**\n* Policy core of `migration list`: validates `--space`, narrows the\n* pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n*\n* - `migrations/` missing or contains no valid space directories →\n* caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n* - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n* - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n*/\nfunction runMigrationList(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.space === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.space === spaceFilter) : spaces;\n\tconst resultSpaces = scopedSpaces.length === 0 ? [{\n\t\tspace: APP_SPACE_ID,\n\t\tmigrations: []\n\t}] : scopedSpaces;\n\treturn ok({\n\t\tok: true,\n\t\tspaces: [...resultSpaces],\n\t\tsummary: computeSummary(resultSpaces)\n\t});\n}\n/**\n* CLI shell: loads config, resolves paths, prints the styled header on\n* stderr (interactive mode only), and delegates to {@link runMigrationList}.\n* Kept intentionally thin so the unit-testable surface lives in the core.\n*/\nasync function executeMigrationListCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration list\",\n\t\t\tdescription: \"List on-disk migrations per contract space\",\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 notOk(loaded.failure);\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\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\treturn ok({\n\t\tlist: listResult.value,\n\t\tliveContractHash,\n\t\taggregate\n\t});\n}\nfunction createMigrationListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List on-disk migrations per contract space\", \"Enumerates every on-disk migration under migrations/<space>/ for every\\ncontract space found on disk. Offline — does not consult the database.\\nHuman output draws the shared migration graph tree with operation counts,\\ninvariants on each migration row, and refs on destination contract nodes.\\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\\ntree glyphs (orthogonal to --no-color).\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration list\",\n\t\t\"prisma-next migration list --space app\",\n\t\t\"prisma-next migration list --ascii\",\n\t\t\"prisma-next migration list --legend\",\n\t\t\"prisma-next migration list --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 log\",\n\t\t\toneLiner: \"Show executed migration history\"\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\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--ascii\", \"Use ASCII kind 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 executeMigrationListCommand(options, flags, ui), flags, ui, ({ list, liveContractHash, aggregate }) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(list, null, 2));\n\t\t\telse if (!flags.quiet) ui.output(renderMigrationListHumanOutput(list, {\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\t\t\tuseColor: ui.useColor,\n\t\t\t\tliveContractHash,\n\t\t\t\tgraphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n\t\t\t\tappSpaceId: aggregate.app.spaceId\n\t\t\t}));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { renderMigrationListHumanOutput as a, validateLegendOptions as c, migrationSpaceListEntriesFromAggregate as i, executeMigrationListCommand as n, runMigrationList as o, listRefsByContractHash as r, shouldShowLegend as s, createMigrationListCommand as t };\n\n//# sourceMappingURL=migration-list-BFBeo1_X.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iBAAiB,SAAS,OAAO;CACzC,OAAO,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAClG;AACA,SAAS,sBAAsB,SAAS,OAAO;CAC9C,IAAI,QAAQ,WAAW,MAAM,OAAO,GAAG,KAAK,CAAC;CAC7C,IAAI,MAAM,SAAS,MAAM,OAAO,MAAM,qBAAqB,QAAQ,CAAC;CACpE,IAAI,MAAM,UAAU,MAAM,OAAO,MAAM,qBAAqB,SAAS,CAAC;CACtE,IAAI,QAAQ,QAAQ,MAAM,OAAO,MAAM,qBAAqB,OAAO,CAAC;CACpE,OAAO,GAAG,KAAK,CAAC;AACjB;AAGA,SAAS,gBAAgB,GAAG,GAAG;CAC9B,IAAI,MAAM,cAAc,OAAO,MAAM,eAAe,IAAI;CACxD,IAAI,MAAM,cAAc,OAAO;CAC/B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,IAAI,GAAG,OAAO;CAClB,OAAO;AACR;AACA,SAAS,0BAA0B,GAAG,GAAG;CACxC,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO;CAC5B,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO;CAC5B,OAAO;AACR;;;;;;;;;AASA,SAAS,uBAAuB,OAAO;CACtC,MAAM,SAAS,IAAI,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uB,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,4BAA4B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,EAAE,MAAM,kBAAkB,gBAAgB;GAC1I,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,+BAA+B,MAAM;IACrE,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACrD,UAAU,GAAG;IACb;IACA,gBAAgB,YAAY,UAAU,MAAM,OAAO,CAAC,EAAE,MAAM;IAC5D,YAAY,UAAU,IAAI;GAC3B,CAAC,CAAC;EACH,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"migration-list-BFBeo1_X-DwyOI0w9.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-list-BFBeo1_X.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, _ as createTerminalUI, at as errorSpaceNotFound, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, q as errorLegendHumanOnly, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { a as renderMigrationGraphLegend, c as renderMigrationListWithStyle, o as createAnsiMigrationListStyler } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { APP_SPACE_ID, isValidSpaceId, listContractSpaceDirectories } from \"@internal/migration-tools/spaces\";\nimport { HEAD_REF_NAME, refsByContractHash } from \"@internal/migration-tools/refs\";\n//#region src/utils/legend.ts\n/**\n* The legend is decoration printed alongside the command header on stderr, so\n* it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n* `--quiet`) exactly as the header is.\n*/\nfunction shouldShowLegend(options, flags) {\n\treturn options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;\n}\nfunction validateLegendOptions(options, flags) {\n\tif (options.legend !== true) return ok(void 0);\n\tif (flags.json === true) return notOk(errorLegendHumanOnly(\"--json\"));\n\tif (flags.quiet === true) return notOk(errorLegendHumanOnly(\"--quiet\"));\n\tif (options.dot === true) return notOk(errorLegendHumanOnly(\"--dot\"));\n\treturn ok(void 0);\n}\n//#endregion\n//#region src/commands/migration-list.ts\nfunction compareSpaceIds(a, b) {\n\tif (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n\tif (b === APP_SPACE_ID) return 1;\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\nfunction compareDirNamesDescending(a, b) {\n\tif (a.name < b.name) return 1;\n\tif (a.name > b.name) return -1;\n\treturn 0;\n}\n/**\n* Ref names decorating a space's destination contract hashes. The\n* tolerant `space.refs` deliberately omits the structural `head.json`;\n* for extension spaces the old enumerator surfaced it as a `head`\n* decoration on the tip migration, so fold `space.headRef` back in to\n* keep that output. The app space synthesises its head, so it carries\n* no on-disk `head` ref to restore.\n*/\nfunction listRefsByContractHash(space) {\n\tconst byHash = new Map(refsByContractHash(space.refs));\n\tif (space.spaceId !== APP_SPACE_ID && space.headRef !== null) {\n\t\tconst hash = space.headRef.hash;\n\t\tconst bucket = byHash.get(hash) ?? [];\n\t\tif (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n\t}\n\treturn byHash;\n}\nasync function orderedOnDiskSpaceIds(projectMigrationsDir) {\n\treturn (await listContractSpaceDirectories(projectMigrationsDir)).filter(isValidSpaceId).sort(compareSpaceIds);\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the render-ready\n* {@link MigrationSpaceListEntry} rows `migration list` displays.\n*\n* Space membership matches the on-disk contract-space directories (not the\n* aggregate's always-present synthesized app space when `migrations/app/`\n* is absent); package and ref data come from `aggregate.space(id)`.\n*/\nasync function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {\n\tconst spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n\tconst spaces = [];\n\tfor (const spaceId of spaceIds) {\n\t\tconst space = aggregate.space(spaceId);\n\t\tif (space === void 0) continue;\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tconst migrations = space.packages.map((pkg) => ({\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\trefs: [...refsByHash.get(pkg.metadata.to) ?? []],\n\t\t\tprovidedInvariants: [...pkg.metadata.providedInvariants]\n\t\t})).sort(compareDirNamesDescending);\n\t\tspaces.push({\n\t\t\tspace: spaceId,\n\t\t\tmigrations\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction renderMigrationListHumanOutput(result, options) {\n\treturn renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, {\n\t\tcolorize: options.useColor,\n\t\tliveContractHash: options.liveContractHash,\n\t\tgraphForSpace: options.graphForSpace,\n\t\t...options.appSpaceId !== void 0 ? { appSpaceId: options.appSpaceId } : {}\n\t});\n}\nfunction computeSummary(spaces) {\n\tconst totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\tif (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;\n\treturn `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n/**\n* Policy core of `migration list`: validates `--space`, narrows the\n* pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n*\n* - `migrations/` missing or contains no valid space directories →\n* caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n* - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n* - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n*/\nfunction runMigrationList(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.space === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.space === spaceFilter) : spaces;\n\tconst resultSpaces = scopedSpaces.length === 0 ? [{\n\t\tspace: APP_SPACE_ID,\n\t\tmigrations: []\n\t}] : scopedSpaces;\n\treturn ok({\n\t\tok: true,\n\t\tspaces: [...resultSpaces],\n\t\tsummary: computeSummary(resultSpaces)\n\t});\n}\n/**\n* CLI shell: loads config, resolves paths, prints the styled header on\n* stderr (interactive mode only), and delegates to {@link runMigrationList}.\n* Kept intentionally thin so the unit-testable surface lives in the core.\n*/\nasync function executeMigrationListCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration list\",\n\t\t\tdescription: \"List on-disk migrations per contract space\",\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 notOk(loaded.failure);\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\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\treturn ok({\n\t\tlist: listResult.value,\n\t\tliveContractHash,\n\t\taggregate\n\t});\n}\nfunction createMigrationListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List on-disk migrations per contract space\", \"Enumerates every on-disk migration under migrations/<space>/ for every\\ncontract space found on disk. Offline — does not consult the database.\\nHuman output draws the shared migration graph tree with operation counts,\\ninvariants on each migration row, and refs on destination contract nodes.\\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\\ntree glyphs (orthogonal to --no-color).\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration list\",\n\t\t\"prisma-next migration list --space app\",\n\t\t\"prisma-next migration list --ascii\",\n\t\t\"prisma-next migration list --legend\",\n\t\t\"prisma-next migration list --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 log\",\n\t\t\toneLiner: \"Show executed migration history\"\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\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--ascii\", \"Use ASCII kind 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 executeMigrationListCommand(options, flags, ui), flags, ui, ({ list, liveContractHash, aggregate }) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(list, null, 2));\n\t\t\telse if (!flags.quiet) ui.output(renderMigrationListHumanOutput(list, {\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\t\t\tuseColor: ui.useColor,\n\t\t\t\tliveContractHash,\n\t\t\t\tgraphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n\t\t\t\tappSpaceId: aggregate.app.spaceId\n\t\t\t}));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { renderMigrationListHumanOutput as a, validateLegendOptions as c, migrationSpaceListEntriesFromAggregate as i, executeMigrationListCommand as n, runMigrationList as o, listRefsByContractHash as r, shouldShowLegend as s, createMigrationListCommand as t };\n\n//# sourceMappingURL=migration-list-BFBeo1_X.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iBAAiB,SAAS,OAAO;CACzC,OAAO,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAClG;AACA,SAAS,sBAAsB,SAAS,OAAO;CAC9C,IAAI,QAAQ,WAAW,MAAM,OAAO,GAAG,KAAK,CAAC;CAC7C,I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"}
@@ -1,7 +1,7 @@
1
1
  import { t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
2
  import { $ as maskConnectionUrl, N as errorUnexpected, W as formatStyledHeader, Z as mapMigrationToolsError, at as resolveMigrationPaths, ct as setCommandExamples, lt as setCommandSeeAlso, o as createTerminalUI, q as handleResult, r as addGlobalOptions, rt as requireLiveDatabase, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, ut as targetSupportsMigrations } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
3
- import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
4
- import { t as createControlClient } from "./client-75qrAPqf-DZAVUxFa.mjs";
3
+ import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
4
+ import { t as createControlClient } from "./client-75qrAPqf-DRg33_uJ.mjs";
5
5
  import { l as createAnsiMigrationListStyler, m as migrationListForwardArrow, n as abbreviateContractHash, p as migrationListEmptySource, t as IDENTITY_MIGRATION_LIST_STYLER } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
@@ -217,4 +217,4 @@ function createMigrationLogCommand() {
217
217
  //#endregion
218
218
  export { executeMigrationLogCommand as n, createMigrationLogCommand as t };
219
219
 
220
- //# sourceMappingURL=migration-log-CS5IWcNq-BQ-32Low.mjs.map
220
+ //# sourceMappingURL=migration-log-CS5IWcNq-CjmDyvwG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-log-CS5IWcNq-BQ-32Low.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-log-CS5IWcNq.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { _ as migrationListEmptySource, g as abbreviateContractHash, o as createAnsiMigrationListStyler, s as IDENTITY_MIGRATION_LIST_STYLER, v as migrationListForwardArrow } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport stringWidth from \"string-width\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\n//#region src/utils/formatters/migration-log-table.ts\nconst HEADING_APPLIED_AT = \"Applied at\";\nconst HEADING_SPACE = \"Space\";\nconst HEADING_MIGRATION = \"Migration\";\nconst HEADING_CHANGE = \"Change\";\nconst HEADING_OPS = \"Ops\";\nconst COLUMN_SEPARATOR = \" \";\nconst DIVIDER_CHAR = \"─\";\nconst ASCII_DIVIDER_CHAR = \"-\";\nfunction sortLedgerEntries(entries) {\n\treturn [...entries].sort((left, right) => {\n\t\tconst timeDiff = left.appliedAt.getTime() - right.appliedAt.getTime();\n\t\tif (timeDiff !== 0) return timeDiff;\n\t\tconst spaceDiff = left.space.localeCompare(right.space);\n\t\tif (spaceDiff !== 0) return spaceDiff;\n\t\treturn left.migrationName.localeCompare(right.migrationName);\n\t});\n}\nfunction pad2(value) {\n\treturn String(value).padStart(2, \"0\");\n}\nfunction formatLedgerAppliedAt(date, mode) {\n\tif (mode === \"iso\") return date.toISOString();\n\tif (mode === \"utc\") return `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}:${pad2(date.getUTCSeconds())}Z`;\n\tconst offsetMinutes = -date.getTimezoneOffset();\n\tconst sign = offsetMinutes >= 0 ? \"+\" : \"-\";\n\tconst absoluteOffset = Math.abs(offsetMinutes);\n\tconst offsetHours = pad2(Math.floor(absoluteOffset / 60));\n\tconst offsetMins = pad2(absoluteOffset % 60);\n\treturn `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())} ${sign}${offsetHours}:${offsetMins}`;\n}\nfunction formatHashEndpoint(hash, glyphMode = \"unicode\") {\n\tif (hash === null) return migrationListEmptySource(glyphMode);\n\treturn abbreviateContractHash(hash);\n}\nfunction formatHashTransition(from, to, glyphMode = \"unicode\") {\n\treturn `${formatHashEndpoint(from, glyphMode)} ${migrationListForwardArrow(glyphMode)} ${abbreviateContractHash(to)}`;\n}\nfunction styleHashTransition(from, to, styler, glyphMode = \"unicode\") {\n\treturn `${from === null ? styler.glyph(migrationListEmptySource(glyphMode)) : styler.sourceHash(abbreviateContractHash(from))} ${styler.glyph(migrationListForwardArrow(glyphMode))} ${styler.destHash(abbreviateContractHash(to))}`;\n}\nfunction padVisible(text, targetWidth) {\n\tconst padding = Math.max(0, targetWidth - stringWidth(text));\n\treturn text + \" \".repeat(padding);\n}\nfunction columnWidth(values) {\n\treturn values.reduce((max, value) => Math.max(max, stringWidth(value)), 0);\n}\nfunction padDividerCell(valueWidth, dividerChar) {\n\treturn dividerChar.repeat(valueWidth + 2);\n}\nfunction padTextCell(value, valueWidth) {\n\treturn ` ${padVisible(value, valueWidth)} `;\n}\nfunction padOpsCell(value, valueWidth) {\n\tconst padding = Math.max(0, valueWidth - stringWidth(value));\n\treturn ` ${\" \".repeat(padding)}${value} `;\n}\nfunction renderMigrationLogTable(entries, options = {}) {\n\tconst sorted = sortLedgerEntries(entries);\n\tif (sorted.length === 0) return \"\";\n\tconst styler = options.styler ?? IDENTITY_MIGRATION_LIST_STYLER;\n\tconst glyphMode = options.glyphMode ?? \"unicode\";\n\tconst dividerChar = glyphMode === \"ascii\" ? ASCII_DIVIDER_CHAR : DIVIDER_CHAR;\n\tconst showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n\tconst timestampMode = options.utc ? \"utc\" : \"local\";\n\tconst rows = sorted.map((entry) => ({\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, timestampMode),\n\t\tspace: entry.space,\n\t\tmigrationName: entry.migrationName,\n\t\ttransition: formatHashTransition(entry.from, entry.to, glyphMode),\n\t\tops: `${entry.operationCount} ops`,\n\t\tfrom: entry.from,\n\t\tto: entry.to\n\t}));\n\tconst appliedAtWidth = columnWidth([HEADING_APPLIED_AT, ...rows.map((row) => row.appliedAt)]);\n\tconst spaceWidth = showSpace ? columnWidth([HEADING_SPACE, ...rows.map((row) => row.space)]) : 0;\n\tconst nameWidth = columnWidth([HEADING_MIGRATION, ...rows.map((row) => row.migrationName)]);\n\tconst transitionWidth = columnWidth([HEADING_CHANGE, ...rows.map((row) => row.transition)]);\n\tconst opsWidth = columnWidth([HEADING_OPS, ...rows.map((row) => row.ops)]);\n\tconst headingParts = [padTextCell(HEADING_APPLIED_AT, appliedAtWidth)];\n\tif (showSpace) headingParts.push(padTextCell(HEADING_SPACE, spaceWidth));\n\theadingParts.push(padTextCell(HEADING_MIGRATION, nameWidth), padTextCell(HEADING_CHANGE, transitionWidth), padOpsCell(HEADING_OPS, opsWidth));\n\tconst heading = headingParts.join(COLUMN_SEPARATOR);\n\tconst dividerParts = [padDividerCell(appliedAtWidth, dividerChar)];\n\tif (showSpace) dividerParts.push(padDividerCell(spaceWidth, dividerChar));\n\tdividerParts.push(padDividerCell(nameWidth, dividerChar), padDividerCell(transitionWidth, dividerChar), padDividerCell(opsWidth, dividerChar));\n\treturn [\n\t\theading,\n\t\tdividerParts.map((cell) => styler.summary(cell)).join(COLUMN_SEPARATOR),\n\t\t...rows.map((row) => {\n\t\t\tconst parts = [padTextCell(row.appliedAt, appliedAtWidth)];\n\t\t\tif (showSpace) parts.push(padTextCell(row.space, spaceWidth));\n\t\t\tparts.push(padTextCell(styler.dirName(row.migrationName), nameWidth), padTextCell(styleHashTransition(row.from, row.to, styler, glyphMode), transitionWidth), padOpsCell(row.ops, opsWidth));\n\t\t\treturn parts.join(COLUMN_SEPARATOR);\n\t\t})\n\t].join(\"\\n\");\n}\nfunction serializeLedgerEntriesForJson(entries) {\n\treturn sortLedgerEntries(entries).map((entry) => ({\n\t\tspace: entry.space,\n\t\tname: entry.migrationName,\n\t\thash: entry.migrationHash,\n\t\tfromContract: entry.from,\n\t\ttoContract: entry.to,\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, \"iso\"),\n\t\toperationCount: entry.operationCount\n\t}));\n}\nconst MIGRATION_LOG_EMPTY_MESSAGE = \"No migrations have been applied to this database.\";\n//#endregion\n//#region src/commands/migration-log.ts\nasync function executeMigrationLogCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst missingDb = requireLiveDatabase({\n\t\tdbConnection,\n\t\thasDriver: !!config.driver,\n\t\twhy: `migration log needs a database connection and driver to read the ledger (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migration log\"\n\t});\n\tif (missingDb) return notOk(missingDb);\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorUnexpected(\"Target does not support migrations\"));\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration log\",\n\t\t\tdescription: \"Show executed migration history from the database ledger\",\n\t\t\tdetails: [{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: configPath\n\t\t\t}, ...typeof dbConnection === \"string\" ? [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t\t}] : []],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\t...ifDefined(\"driver\", config.driver),\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\treturn ok(await client.readLedger());\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrationLogCommand() {\n\tconst command = new Command(\"log\");\n\tsetCommandDescriptions(command, \"Show executed migration history\", \"Reads the database ledger and displays every applied migration edge\\nin chronological order, including rollbacks and re-applies, merged\\nacross all contract spaces. Requires a database connection.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration log --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --utc --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --json --db $DATABASE_URL\"\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\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--utc\", \"Render human timestamps in UTC instead of local time\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationLogCommand(options, flags, ui), flags, ui, (entries) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst records = serializeLedgerEntriesForJson(entries);\n\t\t\t\tconst result = {\n\t\t\t\t\tok: true,\n\t\t\t\t\trecords,\n\t\t\t\t\tsummary: `${records.length} migration(s) applied`\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(result, null, 2));\n\t\t\t} else if (!flags.quiet) if (entries.length === 0) ui.output(MIGRATION_LOG_EMPTY_MESSAGE);\n\t\t\telse {\n\t\t\t\tconst styler = createAnsiMigrationListStyler({ useColor: ui.useColor });\n\t\t\t\tui.output(renderMigrationLogTable(entries, {\n\t\t\t\t\tutc: options.utc === true,\n\t\t\t\t\tstyler,\n\t\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t\t}));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeMigrationLogCommand as n, createMigrationLogCommand as t };\n\n//# sourceMappingURL=migration-log-CS5IWcNq.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB;AACvB,MAAM,cAAc;AACpB,MAAM,mBAAmB;AACzB,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,SAAS,kBAAkB,SAAS;CACnC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,MAAM,UAAU;EACzC,MAAM,WAAW,KAAK,UAAU,QAAQ,IAAI,MAAM,UAAU,QAAQ;EACpE,IAAI,aAAa,GAAG,OAAO;EAC3B,MAAM,YAAY,KAAK,MAAM,cAAc,MAAM,KAAK;EACtD,IAAI,cAAc,GAAG,OAAO;EAC5B,OAAO,KAAK,cAAc,cAAc,MAAM,aAAa;CAC5D,CAAC;AACF;AACA,SAAS,KAAK,OAAO;CACpB,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;AACrC;AACA,SAAS,sBAAsB,MAAM,MAAM;CAC1C,IAAI,SAAS,OAAO,OAAO,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G,OAAO,2BAA2B;QACnF;IACJ,MAAM,SAAS,8BAA8B,EAAE,UAAU,GAAG,SAAS,CAAC;IACtE,GAAG,OAAO,wBAAwB,SAAS;KAC1C,KAAK,QAAQ,QAAQ;KACrB;KACA,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACtD,CAAC,CAAC;GACH;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"migration-log-CS5IWcNq-CjmDyvwG.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-log-CS5IWcNq.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { _ as migrationListEmptySource, g as abbreviateContractHash, o as createAnsiMigrationListStyler, s as IDENTITY_MIGRATION_LIST_STYLER, v as migrationListForwardArrow } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport stringWidth from \"string-width\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\n//#region src/utils/formatters/migration-log-table.ts\nconst HEADING_APPLIED_AT = \"Applied at\";\nconst HEADING_SPACE = \"Space\";\nconst HEADING_MIGRATION = \"Migration\";\nconst HEADING_CHANGE = \"Change\";\nconst HEADING_OPS = \"Ops\";\nconst COLUMN_SEPARATOR = \" \";\nconst DIVIDER_CHAR = \"─\";\nconst ASCII_DIVIDER_CHAR = \"-\";\nfunction sortLedgerEntries(entries) {\n\treturn [...entries].sort((left, right) => {\n\t\tconst timeDiff = left.appliedAt.getTime() - right.appliedAt.getTime();\n\t\tif (timeDiff !== 0) return timeDiff;\n\t\tconst spaceDiff = left.space.localeCompare(right.space);\n\t\tif (spaceDiff !== 0) return spaceDiff;\n\t\treturn left.migrationName.localeCompare(right.migrationName);\n\t});\n}\nfunction pad2(value) {\n\treturn String(value).padStart(2, \"0\");\n}\nfunction formatLedgerAppliedAt(date, mode) {\n\tif (mode === \"iso\") return date.toISOString();\n\tif (mode === \"utc\") return `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}:${pad2(date.getUTCSeconds())}Z`;\n\tconst offsetMinutes = -date.getTimezoneOffset();\n\tconst sign = offsetMinutes >= 0 ? \"+\" : \"-\";\n\tconst absoluteOffset = Math.abs(offsetMinutes);\n\tconst offsetHours = pad2(Math.floor(absoluteOffset / 60));\n\tconst offsetMins = pad2(absoluteOffset % 60);\n\treturn `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())} ${sign}${offsetHours}:${offsetMins}`;\n}\nfunction formatHashEndpoint(hash, glyphMode = \"unicode\") {\n\tif (hash === null) return migrationListEmptySource(glyphMode);\n\treturn abbreviateContractHash(hash);\n}\nfunction formatHashTransition(from, to, glyphMode = \"unicode\") {\n\treturn `${formatHashEndpoint(from, glyphMode)} ${migrationListForwardArrow(glyphMode)} ${abbreviateContractHash(to)}`;\n}\nfunction styleHashTransition(from, to, styler, glyphMode = \"unicode\") {\n\treturn `${from === null ? styler.glyph(migrationListEmptySource(glyphMode)) : styler.sourceHash(abbreviateContractHash(from))} ${styler.glyph(migrationListForwardArrow(glyphMode))} ${styler.destHash(abbreviateContractHash(to))}`;\n}\nfunction padVisible(text, targetWidth) {\n\tconst padding = Math.max(0, targetWidth - stringWidth(text));\n\treturn text + \" \".repeat(padding);\n}\nfunction columnWidth(values) {\n\treturn values.reduce((max, value) => Math.max(max, stringWidth(value)), 0);\n}\nfunction padDividerCell(valueWidth, dividerChar) {\n\treturn dividerChar.repeat(valueWidth + 2);\n}\nfunction padTextCell(value, valueWidth) {\n\treturn ` ${padVisible(value, valueWidth)} `;\n}\nfunction padOpsCell(value, valueWidth) {\n\tconst padding = Math.max(0, valueWidth - stringWidth(value));\n\treturn ` ${\" \".repeat(padding)}${value} `;\n}\nfunction renderMigrationLogTable(entries, options = {}) {\n\tconst sorted = sortLedgerEntries(entries);\n\tif (sorted.length === 0) return \"\";\n\tconst styler = options.styler ?? IDENTITY_MIGRATION_LIST_STYLER;\n\tconst glyphMode = options.glyphMode ?? \"unicode\";\n\tconst dividerChar = glyphMode === \"ascii\" ? ASCII_DIVIDER_CHAR : DIVIDER_CHAR;\n\tconst showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n\tconst timestampMode = options.utc ? \"utc\" : \"local\";\n\tconst rows = sorted.map((entry) => ({\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, timestampMode),\n\t\tspace: entry.space,\n\t\tmigrationName: entry.migrationName,\n\t\ttransition: formatHashTransition(entry.from, entry.to, glyphMode),\n\t\tops: `${entry.operationCount} ops`,\n\t\tfrom: entry.from,\n\t\tto: entry.to\n\t}));\n\tconst appliedAtWidth = columnWidth([HEADING_APPLIED_AT, ...rows.map((row) => row.appliedAt)]);\n\tconst spaceWidth = showSpace ? columnWidth([HEADING_SPACE, ...rows.map((row) => row.space)]) : 0;\n\tconst nameWidth = columnWidth([HEADING_MIGRATION, ...rows.map((row) => row.migrationName)]);\n\tconst transitionWidth = columnWidth([HEADING_CHANGE, ...rows.map((row) => row.transition)]);\n\tconst opsWidth = columnWidth([HEADING_OPS, ...rows.map((row) => row.ops)]);\n\tconst headingParts = [padTextCell(HEADING_APPLIED_AT, appliedAtWidth)];\n\tif (showSpace) headingParts.push(padTextCell(HEADING_SPACE, spaceWidth));\n\theadingParts.push(padTextCell(HEADING_MIGRATION, nameWidth), padTextCell(HEADING_CHANGE, transitionWidth), padOpsCell(HEADING_OPS, opsWidth));\n\tconst heading = headingParts.join(COLUMN_SEPARATOR);\n\tconst dividerParts = [padDividerCell(appliedAtWidth, dividerChar)];\n\tif (showSpace) dividerParts.push(padDividerCell(spaceWidth, dividerChar));\n\tdividerParts.push(padDividerCell(nameWidth, dividerChar), padDividerCell(transitionWidth, dividerChar), padDividerCell(opsWidth, dividerChar));\n\treturn [\n\t\theading,\n\t\tdividerParts.map((cell) => styler.summary(cell)).join(COLUMN_SEPARATOR),\n\t\t...rows.map((row) => {\n\t\t\tconst parts = [padTextCell(row.appliedAt, appliedAtWidth)];\n\t\t\tif (showSpace) parts.push(padTextCell(row.space, spaceWidth));\n\t\t\tparts.push(padTextCell(styler.dirName(row.migrationName), nameWidth), padTextCell(styleHashTransition(row.from, row.to, styler, glyphMode), transitionWidth), padOpsCell(row.ops, opsWidth));\n\t\t\treturn parts.join(COLUMN_SEPARATOR);\n\t\t})\n\t].join(\"\\n\");\n}\nfunction serializeLedgerEntriesForJson(entries) {\n\treturn sortLedgerEntries(entries).map((entry) => ({\n\t\tspace: entry.space,\n\t\tname: entry.migrationName,\n\t\thash: entry.migrationHash,\n\t\tfromContract: entry.from,\n\t\ttoContract: entry.to,\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, \"iso\"),\n\t\toperationCount: entry.operationCount\n\t}));\n}\nconst MIGRATION_LOG_EMPTY_MESSAGE = \"No migrations have been applied to this database.\";\n//#endregion\n//#region src/commands/migration-log.ts\nasync function executeMigrationLogCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst missingDb = requireLiveDatabase({\n\t\tdbConnection,\n\t\thasDriver: !!config.driver,\n\t\twhy: `migration log needs a database connection and driver to read the ledger (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migration log\"\n\t});\n\tif (missingDb) return notOk(missingDb);\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorUnexpected(\"Target does not support migrations\"));\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration log\",\n\t\t\tdescription: \"Show executed migration history from the database ledger\",\n\t\t\tdetails: [{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: configPath\n\t\t\t}, ...typeof dbConnection === \"string\" ? [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t\t}] : []],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\t...ifDefined(\"driver\", config.driver),\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\treturn ok(await client.readLedger());\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrationLogCommand() {\n\tconst command = new Command(\"log\");\n\tsetCommandDescriptions(command, \"Show executed migration history\", \"Reads the database ledger and displays every applied migration edge\\nin chronological order, including rollbacks and re-applies, merged\\nacross all contract spaces. Requires a database connection.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration log --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --utc --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --json --db $DATABASE_URL\"\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\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--utc\", \"Render human timestamps in UTC instead of local time\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationLogCommand(options, flags, ui), flags, ui, (entries) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst records = serializeLedgerEntriesForJson(entries);\n\t\t\t\tconst result = {\n\t\t\t\t\tok: true,\n\t\t\t\t\trecords,\n\t\t\t\t\tsummary: `${records.length} migration(s) applied`\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(result, null, 2));\n\t\t\t} else if (!flags.quiet) if (entries.length === 0) ui.output(MIGRATION_LOG_EMPTY_MESSAGE);\n\t\t\telse {\n\t\t\t\tconst styler = createAnsiMigrationListStyler({ useColor: ui.useColor });\n\t\t\t\tui.output(renderMigrationLogTable(entries, {\n\t\t\t\t\tutc: options.utc === true,\n\t\t\t\t\tstyler,\n\t\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t\t}));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeMigrationLogCommand as n, createMigrationLogCommand as t };\n\n//# sourceMappingURL=migration-log-CS5IWcNq.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAC1B,MAAM,iBAA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AAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,SAAS,sDAAsD,CAAC,CAAC,OAAO,WAAW,kCAAkC,CAAC,CAAC,OAAO,OAAO,YAAY;EAC/R,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,2BAA2B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,YAAY;GAC3G,IAAI,MAAM,MAAM;IACf,MAAM,UAAU,8BAA8B,OAAO;IACrD,MAAM,SAAS;KACd,IAAI;KACJ;KACA,SAAS,GAAG,QAAQ,OAAO;IAC5B;IACA,GAAG,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;GAC1C,OAAO,IAAI,CAAC,MAAM,OAAO,IAAI,QAAQ,WAAW,GAAG,GAAG,OAAO,2BAA2B;QACnF;IACJ,MAAM,SAAS,8BAA8B,EAAE,UAAU,GAAG,SAAS,CAAC;IACtE,GAAG,OAAO,wBAAwB,SAAS;KAC1C,KAAK,QAAQ,QAAQ;KACrB;KACA,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACtD,CAAC,CAAC;GACH;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -5,8 +5,8 @@ import { r as findLatestMigration } from "./migration-graph-CBf9ORe7-B4xAF8GN.mj
5
5
  import { K as getTargetMigrations, N as errorUnexpected, O as errorRuntime$1, W as formatStyledHeader, at as resolveMigrationPaths, ct as setCommandExamples, it as resolveContractPath, j as errorTargetMigrationNotSupported, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
6
6
  import { t as assertFrameworkComponentsCompatible } from "./framework-components-CjshQKHA-Dlp6Leo5.mjs";
7
7
  import { t as createProjectSpecifierResolver } from "./project-import-root-CpwLCDLY-DkVwAnWj.mjs";
8
- import { r as getEmittedArtifactPaths } from "./exports-D3-NwrMA-CadaBGQ3.mjs";
9
- import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
8
+ import { r as getEmittedArtifactPaths } from "./exports-BGMKuMBH-C1_tsw6T.mjs";
9
+ import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
10
10
  import { s as loadContractSpaceAggregate } from "./aggregate-B4mhR4Sk.mjs";
11
11
  import { o as refusePackageCorruptionOnAggregate } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
12
12
  import { i as writeMigrationTs } from "./migration-ts-FyF55c4M.mjs";
@@ -165,4 +165,4 @@ function createMigrationNewCommand() {
165
165
  //#endregion
166
166
  export { createMigrationNewCommand as t };
167
167
 
168
- //# sourceMappingURL=migration-new-BurCjyaQ.mjs.map
168
+ //# sourceMappingURL=migration-new-CCEfD9oh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-new-BurCjyaQ.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-new.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"../framework-components-CjshQKHA.mjs\";\nimport { t as createProjectSpecifierResolver } from \"../project-import-root-CpwLCDLY.mjs\";\nimport { o as refusePackageCorruptionOnAggregate } from \"../contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { findLatestMigration } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { computeMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\n//#region src/commands/migration-new.ts\n/**\n* `migration new` — scaffolds a migration package with a `migration.ts` file\n* for manual authoring.\n*\n* The planner's `emptyMigration(context)` returns a\n* `MigrationPlanWithAuthoringSurface`, whose `renderTypeScript(resolver)`\n* produces the target-appropriate empty stub. The CLI writes the returned\n* source verbatim.\n*\n* The resolver is the one this project's own manifest implies, so the\n* scaffold names packages the project can resolve — the same resolver\n* `contract emit` hands to the emitter (ADR 242).\n*/\nasync function executeMigrationNewCommand(options) {\n\tconst config = await loadConfig(options.config);\n\tconst { migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\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(errorRuntime(`Contract file not found at ${contractPathAbsolute}`, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` first to generate the contract\"\n\t\t}));\n\t\tthrow error;\n\t}\n\tlet toContract;\n\ttry {\n\t\tconst parsedContract = JSON.parse(contractJsonContent);\n\t\ttoContract = familyInstance.deserializeContract(parsedContract);\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"Contract JSON is invalid\", {\n\t\t\twhy: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\"\n\t\t}));\n\t}\n\tconst toStorageHash = toContract.storage?.storageHash;\n\tif (typeof toStorageHash !== \"string\") return notOk(errorRuntime(\"Contract is missing storageHash\", {\n\t\twhy: `Contract at ${contractPathAbsolute} has no storageHash`,\n\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\"\n\t}));\n\tconst aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\tappContract: toContract\n\t});\n\tconst packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\tif (packageCorruptionFailure) return notOk(packageCorruptionFailure);\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tlet fromHash = null;\n\tif (packages.length > 0) if (options.from) {\n\t\tconst match = packages.find((p) => p.metadata.to.startsWith(options.from));\n\t\tif (!match) return notOk(errorRuntime(\"Starting contract not found\", {\n\t\t\twhy: `No migration with to hash matching \"${options.from}\" exists in ${appMigrationsRelative}`,\n\t\t\tfix: \"Check that the --from hash matches a known migration target hash.\"\n\t\t}));\n\t\tfromHash = match.metadata.to;\n\t} else {\n\t\tconst latestMigration = findLatestMigration(graph);\n\t\tif (latestMigration) fromHash = latestMigration.to;\n\t}\n\tif (fromHash === toStorageHash && !options.from) return notOk(errorRuntime(\"No changes detected\", {\n\t\twhy: \"The from and to contract hashes are identical — there is nothing to migrate.\",\n\t\tfix: \"Change the contract and run `prisma-next contract emit` before creating a new migration. To author a data-only migration on the current contract hash, pass `--from <hash>` explicitly.\"\n\t}));\n\tconst timestamp = /* @__PURE__ */ new Date();\n\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\tconst baseMetadata = {\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\tprovidedInvariants: [],\n\t\tcreatedAt: timestamp.toISOString()\n\t};\n\tconst metadata = {\n\t\t...baseMetadata,\n\t\tmigrationHash: computeMigrationHash(baseMetadata, [])\n\t};\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.targetId}\" does not support migrations` }));\n\ttry {\n\t\tassertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\t\tconfig.target,\n\t\t\tconfig.adapter,\n\t\t\t...config.extensions ?? []\n\t\t]);\n\t\tconst resolveSpecifier = createProjectSpecifierResolver(options.config);\n\t\tawait writeMigrationPackage(packageDir, metadata, []);\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, toStorageHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t\tawait writeMigrationTs(packageDir, migrations.createPlanner(controlAdapter).emptyMigration({\n\t\t\tpackageDir,\n\t\t\tcontractJsonPath: join(contractSnapshotDir(migrationsDir, toStorageHash), \"contract.json\"),\n\t\t\tfromHash,\n\t\t\ttoHash: toStorageHash,\n\t\t\tsnapshotsImportPath: snapshotsImportPathFrom(packageDir, migrationsDir)\n\t\t}, APP_SPACE_ID).renderTypeScript(resolveSpecifier));\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tsummary: `Scaffolded migration at ${relative(process.cwd(), packageDir)}`\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to scaffold migration: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n}\nfunction createMigrationNewCommand() {\n\tconst command = new Command(\"new\");\n\tsetCommandDescriptions(command, \"Scaffold a new migration for manual authoring\", \"Creates a migration package with a migration.ts file for manual authoring.\\nWrite the migration body in migration.ts, then run the file with Node\\n(`node migration.ts`) to self-emit ops.json and attest the package.\");\n\tsetCommandExamples(command, [\"prisma-next migration new --name split-name\", \"prisma-next migration new --name custom-fk --from abc123...\"]);\n\taddGlobalOptions(command).option(\"--name <slug>\", \"Migration name (used in directory name)\").option(\"--from <hash>\", \"Starting contract hash (default: latest migration target)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst header = formatStyledHeader({\n\t\t\t\tcommand: \"migration new\",\n\t\t\t\tdescription: \"Scaffold a new migration\",\n\t\t\t\tdetails: [],\n\t\t\t\tflags\n\t\t\t});\n\t\t\tui.stderr(header);\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrationNewCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tui.output(`\\nScaffolded migration at ${value.dir}`);\n\t\t\t\tui.output(` from: ${value.from}`);\n\t\t\t\tui.output(` to: ${value.to}`);\n\t\t\t\tui.output(`\\nEdit migration.ts, then run it directly (\\`node \"${value.dir}/migration.ts\"\\`) to self-emit and attest.`);\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationNewCommand };\n\n//# sourceMappingURL=migration-new.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAe,2BAA2B,SAAS;CAClD,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,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AAK,UAAU,OAAO,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,OAAO;IACtB,GAAG,OAAO,6BAA6B,MAAM,KAAK;IAClD,GAAG,OAAO,WAAW,MAAM,MAAM;IACjC,GAAG,OAAO,WAAW,MAAM,IAAI;IAC/B,GAAG,OAAO,sDAAsD,MAAM,IAAI,2CAA2C;GACtH;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"migration-new-CCEfD9oh.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-new.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"../framework-components-CjshQKHA.mjs\";\nimport { t as createProjectSpecifierResolver } from \"../project-import-root-CpwLCDLY.mjs\";\nimport { o as refusePackageCorruptionOnAggregate } from \"../contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { findLatestMigration } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { computeMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\n//#region src/commands/migration-new.ts\n/**\n* `migration new` — scaffolds a migration package with a `migration.ts` file\n* for manual authoring.\n*\n* The planner's `emptyMigration(context)` returns a\n* `MigrationPlanWithAuthoringSurface`, whose `renderTypeScript(resolver)`\n* produces the target-appropriate empty stub. The CLI writes the returned\n* source verbatim.\n*\n* The resolver is the one this project's own manifest implies, so the\n* scaffold names packages the project can resolve — the same resolver\n* `contract emit` hands to the emitter (ADR 242).\n*/\nasync function executeMigrationNewCommand(options) {\n\tconst config = await loadConfig(options.config);\n\tconst { migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\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(errorRuntime(`Contract file not found at ${contractPathAbsolute}`, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` first to generate the contract\"\n\t\t}));\n\t\tthrow error;\n\t}\n\tlet toContract;\n\ttry {\n\t\tconst parsedContract = JSON.parse(contractJsonContent);\n\t\ttoContract = familyInstance.deserializeContract(parsedContract);\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"Contract JSON is invalid\", {\n\t\t\twhy: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\"\n\t\t}));\n\t}\n\tconst toStorageHash = toContract.storage?.storageHash;\n\tif (typeof toStorageHash !== \"string\") return notOk(errorRuntime(\"Contract is missing storageHash\", {\n\t\twhy: `Contract at ${contractPathAbsolute} has no storageHash`,\n\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\"\n\t}));\n\tconst aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\tappContract: toContract\n\t});\n\tconst packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\tif (packageCorruptionFailure) return notOk(packageCorruptionFailure);\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tlet fromHash = null;\n\tif (packages.length > 0) if (options.from) {\n\t\tconst match = packages.find((p) => p.metadata.to.startsWith(options.from));\n\t\tif (!match) return notOk(errorRuntime(\"Starting contract not found\", {\n\t\t\twhy: `No migration with to hash matching \"${options.from}\" exists in ${appMigrationsRelative}`,\n\t\t\tfix: \"Check that the --from hash matches a known migration target hash.\"\n\t\t}));\n\t\tfromHash = match.metadata.to;\n\t} else {\n\t\tconst latestMigration = findLatestMigration(graph);\n\t\tif (latestMigration) fromHash = latestMigration.to;\n\t}\n\tif (fromHash === toStorageHash && !options.from) return notOk(errorRuntime(\"No changes detected\", {\n\t\twhy: \"The from and to contract hashes are identical — there is nothing to migrate.\",\n\t\tfix: \"Change the contract and run `prisma-next contract emit` before creating a new migration. To author a data-only migration on the current contract hash, pass `--from <hash>` explicitly.\"\n\t}));\n\tconst timestamp = /* @__PURE__ */ new Date();\n\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\tconst baseMetadata = {\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\tprovidedInvariants: [],\n\t\tcreatedAt: timestamp.toISOString()\n\t};\n\tconst metadata = {\n\t\t...baseMetadata,\n\t\tmigrationHash: computeMigrationHash(baseMetadata, [])\n\t};\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.targetId}\" does not support migrations` }));\n\ttry {\n\t\tassertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\t\tconfig.target,\n\t\t\tconfig.adapter,\n\t\t\t...config.extensions ?? []\n\t\t]);\n\t\tconst resolveSpecifier = createProjectSpecifierResolver(options.config);\n\t\tawait writeMigrationPackage(packageDir, metadata, []);\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, toStorageHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t\tawait writeMigrationTs(packageDir, migrations.createPlanner(controlAdapter).emptyMigration({\n\t\t\tpackageDir,\n\t\t\tcontractJsonPath: join(contractSnapshotDir(migrationsDir, toStorageHash), \"contract.json\"),\n\t\t\tfromHash,\n\t\t\ttoHash: toStorageHash,\n\t\t\tsnapshotsImportPath: snapshotsImportPathFrom(packageDir, migrationsDir)\n\t\t}, APP_SPACE_ID).renderTypeScript(resolveSpecifier));\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tsummary: `Scaffolded migration at ${relative(process.cwd(), packageDir)}`\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to scaffold migration: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n}\nfunction createMigrationNewCommand() {\n\tconst command = new Command(\"new\");\n\tsetCommandDescriptions(command, \"Scaffold a new migration for manual authoring\", \"Creates a migration package with a migration.ts file for manual authoring.\\nWrite the migration body in migration.ts, then run the file with Node\\n(`node migration.ts`) to self-emit ops.json and attest the package.\");\n\tsetCommandExamples(command, [\"prisma-next migration new --name split-name\", \"prisma-next migration new --name custom-fk --from abc123...\"]);\n\taddGlobalOptions(command).option(\"--name <slug>\", \"Migration name (used in directory name)\").option(\"--from <hash>\", \"Starting contract hash (default: latest migration target)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst header = formatStyledHeader({\n\t\t\t\tcommand: \"migration new\",\n\t\t\t\tdescription: \"Scaffold a new migration\",\n\t\t\t\tdetails: [],\n\t\t\t\tflags\n\t\t\t});\n\t\t\tui.stderr(header);\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrationNewCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tui.output(`\\nScaffolded migration at ${value.dir}`);\n\t\t\t\tui.output(` from: ${value.from}`);\n\t\t\t\tui.output(` to: ${value.to}`);\n\t\t\t\tui.output(`\\nEdit migration.ts, then run it directly (\\`node \"${value.dir}/migration.ts\"\\`) to self-emit and attest.`);\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationNewCommand };\n\n//# sourceMappingURL=migration-new.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAe,2BAA2B,SAAS;CAClD,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,eAAe,kBAAkB,0BAA0B,sBAAsB,QAAQ,QAAQ,MAAM;CAC/G,MAAM,QAAQ,mBAAmB,MAAM;CACvC,MAAM,iBAAiB,OAAO,OAAO,OAAO,KAAK;CACjD,MAAM,iBAAiB,OAAO,QAAQ,OAAO,KAAK;CAClD,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,IAAI;CACJ,IAAI;EACH,sBAAsB,MAAM,SAAS,sBAAsB,OAAO;CACnE,SAAS,OAAO;EACf,IAA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,8 +9,8 @@ import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-C2
9
9
  import { C as errorPlanForgotTheFlag, K as getTargetMigrations, N as errorUnexpected, Q as mapRefResolutionError, W as formatStyledHeader, Z as mapMigrationToolsError, at as resolveMigrationPaths, ct as setCommandExamples, d as errorContractValidationFailed, h as errorFileNotFound, it as resolveContractPath, j as errorTargetMigrationNotSupported, k as errorSnapshotMissing, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, x as errorMigrationPlanningFailed } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
10
10
  import { t as assertFrameworkComponentsCompatible } from "./framework-components-CjshQKHA-Dlp6Leo5.mjs";
11
11
  import { t as createProjectSpecifierResolver } from "./project-import-root-CpwLCDLY-DkVwAnWj.mjs";
12
- import { r as getEmittedArtifactPaths } from "./exports-D3-NwrMA-CadaBGQ3.mjs";
13
- import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
12
+ import { r as getEmittedArtifactPaths } from "./exports-BGMKuMBH-C1_tsw6T.mjs";
13
+ import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
14
14
  import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
15
15
  import { c as toExtensionInputs, i as loadContractSpaceAggregateForCli, t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
16
16
  import { n as parseContractRef } from "./ref-resolution-BjJBWPjX.mjs";
@@ -756,4 +756,4 @@ function resolveBundleByPrefix(bundles, needle) {
756
756
  //#endregion
757
757
  export { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };
758
758
 
759
- //# sourceMappingURL=migration-plan-q_L84PN1-BWE0LTH6.mjs.map
759
+ //# sourceMappingURL=migration-plan-q_L84PN1-BFb6Si_L.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-plan-q_L84PN1-BWE0LTH6.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-plan-q_L84PN1.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, Q as errorPlanForgotTheFlag, W as errorFileNotFound, X as errorMigrationPlanningFailed, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, it as errorSnapshotMissing, l as setCommandDescriptions, lt as mapMigrationToolsError, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-CjshQKHA.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-CpwLCDLY.mjs\";\nimport { c as toExtensionInputs, i as loadContractSpaceAggregateForCli, t as buildContractSpaceAggregate } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-BX7w-p19.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack, hasOperationPreview } from \"@internal/framework-components/control\";\nimport { emitContractSpaceArtifacts, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { assertHashIsGraphNode, findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\nimport { computeMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\nimport { deriveProvidedInvariants } from \"@internal/migration-tools/invariants\";\n//#region src/utils/contract-space-seed-phase.ts\n/**\n* Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4).\n*\n* For every extension that exposes a `contractSpace`:\n*\n* 1. Read the on-disk head ref (returns `null` on first emit).\n* 2. Write the head contract into the migrations-root snapshot store\n* (write-if-absent, keyed by hash) and unconditionally re-emit\n* `refs/head.json`, via {@link emitContractSpaceArtifacts}. The\n* framework owns `refs/head.json`; re-emit is the contract for that\n* file. The snapshot itself is only written once per distinct hash.\n* 3. Materialise any descriptor-shipped migration packages not yet on\n* disk via {@link materialiseExtensionMigrationPackageIfMissing}.\n* Existing packages are left untouched (by-existence skip).\n*\n* The return value lets the caller render a per-space status line and\n* lets the phase-2 aggregate loader run on a now-consistent disk state\n* (every loaded extension is guaranteed to have its head ref pinned\n* to the descriptor's hash and to ship every package the descriptor\n* declares).\n*\n* Output ordering is deterministic and alphabetical by spaceId (via\n* {@link planAllSpaces}, which also detects duplicate spaceIds). This\n* matches the canonical sort order used by every other aggregate\n* surface (`migrate`, `migration status`, the runner).\n*/\nasync function runContractSpaceSeedPhase(inputs) {\n\tconst planned = planAllSpaces(inputs.extensions.filter((pack) => pack.contractSpace !== void 0).map((pack) => ({\n\t\tspaceId: pack.id,\n\t\tpriorContract: null,\n\t\tnewContract: pack.contractSpace.contractJson,\n\t\t__pack: pack.contractSpace\n\t})), (input) => input.__pack.migrations);\n\tconst descriptorBySpace = /* @__PURE__ */ new Map();\n\tfor (const pack of inputs.extensions) if (pack.contractSpace !== void 0) descriptorBySpace.set(pack.id, pack.contractSpace);\n\tconst seeded = [];\n\tfor (const space of planned) {\n\t\tconst descriptor = descriptorBySpace.get(space.spaceId);\n\t\tif (descriptor === void 0) continue;\n\t\tconst priorHash = (await readContractSpaceHeadRef(inputs.migrationsDir, space.spaceId))?.hash ?? null;\n\t\tawait emitContractSpaceArtifacts(inputs.migrationsDir, space.spaceId, {\n\t\t\tcontract: descriptor.contractJson,\n\t\t\tcontractDts: buildPlaceholderContractDts(space.spaceId),\n\t\t\theadRef: {\n\t\t\t\thash: descriptor.headRef.hash,\n\t\t\t\tinvariants: descriptor.headRef.invariants\n\t\t\t}\n\t\t});\n\t\tconst spaceDir = spaceMigrationDirectory(inputs.migrationsDir, space.spaceId);\n\t\tconst newMigrationDirs = [];\n\t\tfor (const pkg of space.migrationPackages) {\n\t\t\tconst { written } = await materialiseExtensionMigrationPackageIfMissing(spaceDir, pkg);\n\t\t\tif (written) newMigrationDirs.push(pkg.dirName);\n\t\t}\n\t\tconst action = priorHash !== descriptor.headRef.hash || newMigrationDirs.length > 0 ? \"updated\" : \"unchanged\";\n\t\tseeded.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\taction,\n\t\t\tpriorHash,\n\t\t\tnewHash: descriptor.headRef.hash,\n\t\t\tnewMigrationDirs\n\t\t});\n\t}\n\treturn { seeded };\n}\n/**\n* Placeholder `.d.ts` content for an extension space's on-disk mirror.\n*\n* Rendering a fully-typed `.d.ts` for an extension contract requires\n* the SQL-family renderer with the codec / typemap registry threaded\n* through; until that integration ships, the on-disk `.d.ts` is a\n* stub `export {};` module that documents how consumers should\n* validate the sibling `contract.json`. The stub typechecks on its\n* own and does not need any TypeScript suppressions.\n*/\nfunction buildPlaceholderContractDts(spaceId) {\n\treturn [\n\t\t\"/**\",\n\t\t` * Placeholder \\`.d.ts\\` for extension space \"${spaceId}\".`,\n\t\t\" *\",\n\t\t\" * The framework re-emits this file on every `migration plan` run\",\n\t\t\" * alongside `contract.json` and `refs/head.json`. A typed `.d.ts`\",\n\t\t\" * rendering pass for extension contracts is tracked separately;\",\n\t\t\" * until that ships, consumers should import `contract.json`\",\n\t\t\" * and pass it through the target descriptor’s `contractSerializer`.\",\n\t\t\" */\",\n\t\t\"export {};\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/utils/plan-resolution.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nfunction looksLikeFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction graphIsEmpty(space) {\n\treturn space.packages.length === 0;\n}\nfunction getReachableRefs(refs, graph) {\n\treturn Object.entries(refs).flatMap(([name, entry]) => entry && isGraphNode(entry.hash, graph) ? [{\n\t\tname,\n\t\thash: entry.hash\n\t}] : []).sort((a, b) => a.name.localeCompare(b.name));\n}\nfunction assertFromIsGraphNode(fromHash, graph, refs, graphTipHash) {\n\ttry {\n\t\tassertHashIsGraphNode(fromHash, graph);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.HASH_NOT_IN_GRAPH\") throw errorPlanForgotTheFlag(fromHash, getReachableRefs(refs, graph), graphTipHash);\n\t\tthrow error;\n\t}\n}\nasync function resolveContractRef(parsed, space, options) {\n\tconst { hash, provenance } = parsed;\n\tconst refName = provenance.kind === \"ref\" ? provenance.refName : void 0;\n\ttry {\n\t\tconst at = await space.contractAt(hash, refName !== void 0 ? { refName } : void 0);\n\t\tif (at.provenance === \"ref\") return ok({\n\t\t\tkind: \"ref\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t\treturn ok({\n\t\t\tkind: \"graph-node\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t} catch (error) {\n\t\treturn mapContractAtError(error, options?.artifactRole !== void 0 ? { artifactRole: options.artifactRole } : void 0);\n\t}\n}\nasync function resolveFromPolicy(parsed, input, refs, explicitFromLabel) {\n\tconst resolution = await resolveContractRef(parsed, input.space, {\n\t\t...explicitFromLabel !== void 0 ? { explicitLabel: explicitFromLabel } : {},\n\t\tartifactRole: \"from\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tif (resolution.value.kind === \"graph-node\") return ok({\n\t\tkind: \"graph-node\",\n\t\tfromHash: resolution.value.hash,\n\t\tfromContract: resolution.value.contract\n\t});\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\tif (graphIsEmpty(input.space)) return ok({\n\t\tkind: \"auto-baseline\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n\tconst graph = input.space.graph();\n\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\ttry {\n\t\tassertFromIsGraphNode(hash, graph, refs, graphTip);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\treturn ok({\n\t\tkind: \"ref\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n}\nasync function resolveFromForPlan(input) {\n\tconst { optionsFrom, space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tif (optionsFrom === void 0) {\n\t\tconst dbRef = refs[\"db\"];\n\t\tif (!dbRef) return ok({\n\t\t\tkind: \"greenfield\",\n\t\t\tfromHash: null,\n\t\t\tfromContract: null\n\t\t});\n\t\treturn resolveFromPolicy({\n\t\t\thash: dbRef.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: \"db\"\n\t\t\t}\n\t\t}, input, refs);\n\t}\n\tconst refResult = parseContractRef(optionsFrom, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) {\n\t\tif (looksLikeFullHash(optionsFrom)) {\n\t\t\tconst empty = graphIsEmpty(space);\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\tif (empty) return notOk(errorSnapshotMissing(optionsFrom, { viaRef: false }));\n\t\t\treturn notOk(errorPlanForgotTheFlag(optionsFrom, getReachableRefs(refs, graph), graphTip));\n\t\t}\n\t\treturn notOk(mapRefResolutionError(refResult.failure));\n\t}\n\treturn resolveFromPolicy(refResult.value, input, refs, optionsFrom);\n}\nasync function resolveToForPlan(optionsTo, input) {\n\tconst { space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tconst refResult = parseContractRef(optionsTo, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\tconst resolution = await resolveContractRef(refResult.value, space, {\n\t\texplicitLabel: optionsTo,\n\t\tartifactRole: \"to\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\treturn ok({\n\t\thash,\n\t\tcontract,\n\t\tcontractJson,\n\t\tcontractDts\n\t});\n}\n//#endregion\n//#region src/commands/migration-plan.ts\nasync function runPlannerLeg(planner, migrations, frameworkComponents, contract, fromContract, spaceId, ownership, snapshotsImportPath, resolveImportSpecifier) {\n\tconst fromSchema = migrations.contractToSchema(fromContract, frameworkComponents);\n\tconst plannerResult = planner.plan({\n\t\tcontract,\n\t\tschema: fromSchema,\n\t\tpolicy: { allowedOperationClasses: [\n\t\t\t\"additive\",\n\t\t\t\"widening\",\n\t\t\t\"destructive\",\n\t\t\t\"data\"\n\t\t] },\n\t\tfromContract,\n\t\tframeworkComponents,\n\t\tspaceId,\n\t\townership,\n\t\tsnapshotsImportPath\n\t});\n\tif (plannerResult.kind === \"failure\") return notOk(errorMigrationPlanningFailed({ conflicts: plannerResult.conflicts }));\n\tlet plannedOps = [];\n\tlet hasPlaceholders = false;\n\ttry {\n\t\tplannedOps = await Promise.all(plannerResult.plan.operations);\n\t\tif (plannedOps.length === 0) return notOk(errorMigrationPlanningFailed({ conflicts: [{\n\t\t\tkind: \"unsupportedChange\",\n\t\t\tsummary: \"Contract changed but planner produced no operations. This indicates unsupported or ignored changes.\"\n\t\t}] }));\n\t} catch (e) {\n\t\tif (CliStructuredError.is(e) && e.code === \"MIGRATION.UNFILLED_PLACEHOLDER\") hasPlaceholders = true;\n\t\telse throw e;\n\t}\n\treturn ok({\n\t\tplannedOps,\n\t\tmigrationTsContent: plannerResult.plan.renderTypeScript(resolveImportSpecifier),\n\t\thasPlaceholders\n\t});\n}\nasync function writePlannedMigrationPackage(packageDir, fromHash, toHash, createdAt, leg) {\n\tconst opsForWrite = leg.hasPlaceholders ? [] : leg.plannedOps;\n\tconst metadataWithInvariants = {\n\t\tfrom: fromHash,\n\t\tto: toHash,\n\t\tprovidedInvariants: deriveProvidedInvariants(opsForWrite),\n\t\tcreatedAt: createdAt.toISOString()\n\t};\n\tawait writeMigrationPackage(packageDir, {\n\t\t...metadataWithInvariants,\n\t\tmigrationHash: computeMigrationHash(metadataWithInvariants, opsForWrite)\n\t}, opsForWrite);\n\tawait writeMigrationTs(packageDir, leg.migrationTsContent);\n}\nasync function executeMigrationPlanCommand(options, flags, ui, startTime) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [\n\t\t\t{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: configPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"contract\",\n\t\t\t\tvalue: contractPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"migrations\",\n\t\t\t\tvalue: appMigrationsRelative\n\t\t\t}\n\t\t];\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.to) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: options.to\n\t\t});\n\t\tif (options.name) details.push({\n\t\t\tlabel: \"name\",\n\t\t\tvalue: options.name\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration plan\",\n\t\t\tdescription: \"Plan a migration from contract changes\",\n\t\t\turl: \"https://pris.ly/migration-plan\",\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\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tlet toContract;\n\ttry {\n\t\ttoContract = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst rawStorageHash = toContract.storage?.storageHash;\n\tif (typeof rawStorageHash !== \"string\") return notOk(errorContractValidationFailed(\"Contract is missing storageHash\", { where: { path: contractPathAbsolute } }));\n\tlet toStorageHash = rawStorageHash;\n\tlet toArtifacts = null;\n\tlet fromContract = null;\n\tlet fromHash = null;\n\tlet snapshotStartContract = null;\n\tlet isAutoBaseline = false;\n\tconst tolerantAggregateResult = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!tolerantAggregateResult.ok) return notOk(tolerantAggregateResult.failure);\n\tconst resolutionSpace = tolerantAggregateResult.value.app;\n\tconst resolutionResult = await resolveFromForPlan({\n\t\toptionsFrom: options.from,\n\t\tspace: resolutionSpace\n\t});\n\tif (!resolutionResult.ok) return notOk(resolutionResult.failure);\n\tswitch (resolutionResult.value.kind) {\n\t\tcase \"greenfield\": break;\n\t\tcase \"graph-node\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tbreak;\n\t\tcase \"ref\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tbreak;\n\t\tcase \"auto-baseline\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tisAutoBaseline = true;\n\t\t\tbreak;\n\t}\n\tif (options.to !== void 0) {\n\t\tconst toResolution = await resolveToForPlan(options.to, { space: resolutionSpace });\n\t\tif (!toResolution.ok) return notOk(toResolution.failure);\n\t\ttoContract = toResolution.value.contract;\n\t\ttoStorageHash = toResolution.value.hash;\n\t\ttoArtifacts = {\n\t\t\tcontractJson: toResolution.value.contractJson,\n\t\t\tcontractDts: toResolution.value.contractDts\n\t\t};\n\t}\n\tconst resolveImportSpecifier = createProjectSpecifierResolver(options.config);\n\tconst seedResult = await runContractSpaceSeedPhase({\n\t\tmigrationsDir,\n\t\textensions: toExtensionInputs(config.extensions ?? [])\n\t});\n\tif (!flags.json && !flags.quiet) {\n\t\tfor (const record of seedResult.seeded) if (record.action === \"updated\") {\n\t\t\tconst pkgSuffix = record.newMigrationDirs.length > 0 ? `; ${record.newMigrationDirs.length} new migration package(s) materialised` : \"\";\n\t\t\tui.step(`Updated ${record.spaceId} to ${record.newHash}${pkgSuffix}`);\n\t\t}\n\t}\n\tconst emittedExtensionDirs = seedResult.seeded.flatMap((r) => r.newMigrationDirs.map((dirName) => ({\n\t\tspaceId: r.spaceId,\n\t\tdirName\n\t})));\n\tif (fromHash === toStorageHash && !isAutoBaseline) return ok({\n\t\tok: true,\n\t\tnoOp: true,\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\toperations: [],\n\t\temittedExtensionDirs,\n\t\tsummary: \"No changes detected between contracts\",\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst aggregateResult = await buildContractSpaceAggregate({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\tconst aggregate = aggregateResult.value;\n\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\tconfig.target,\n\t\tconfig.adapter,\n\t\t...config.extensions ?? []\n\t]);\n\tasync function writeDestinationSnapshot(destHash) {\n\t\tif (toArtifacts !== null) {\n\t\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\t\tcontractJson: toArtifacts.contractJson,\n\t\t\t\tcontractDts: toArtifacts.contractDts\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t}\n\ttry {\n\t\tconst planner = migrations.createPlanner(controlAdapter);\n\t\tif (isAutoBaseline && fromHash !== null && fromContract !== null && snapshotStartContract !== null) {\n\t\t\tconst baselineTimestamp = /* @__PURE__ */ new Date();\n\t\t\tconst deltaTimestamp = new Date(baselineTimestamp.getTime() + 6e4);\n\t\t\tconst baselineDirName = formatMigrationDirName(baselineTimestamp, \"baseline\");\n\t\t\tconst deltaDirName = formatMigrationDirName(deltaTimestamp, options.name ?? \"migration\");\n\t\t\tconst baselinePackageDir = join(appMigrationsDir, baselineDirName);\n\t\t\tconst deltaPackageDir = join(appMigrationsDir, deltaDirName);\n\t\t\tconst baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, null, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(baselinePackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!baselineLeg.ok) return notOk(baselineLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(baselinePackageDir, null, fromHash, baselineTimestamp, baselineLeg.value);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tif (fromHash === toStorageHash) {\n\t\t\t\tconst baselineOps = baselineLeg.value.hasPlaceholders ? [] : baselineLeg.value.plannedOps;\n\t\t\t\tif (baselineLeg.value.hasPlaceholders) {\n\t\t\t\t\tconst baselineDir = relative(process.cwd(), baselinePackageDir);\n\t\t\t\t\treturn ok({\n\t\t\t\t\t\tok: true,\n\t\t\t\t\t\tnoOp: false,\n\t\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\t\tdir: baselineDir,\n\t\t\t\t\t\tbaselineDir,\n\t\t\t\t\t\toperations: [],\n\t\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t\tpendingPlaceholders: true,\n\t\t\t\t\t\tsummary: \"Planned baseline with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(baselineOps) : void 0;\n\t\t\t\treturn ok({\n\t\t\t\t\tok: true,\n\t\t\t\t\tnoOp: false,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\t\toperations: baselineOps.map((op) => ({\n\t\t\t\t\t\tid: op.id,\n\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t\t})),\n\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\t\tsummary: buildAutoBaselinePlanSummary(0, emittedExtensionDirs.length),\n\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(deltaPackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg.value);\n\t\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tconst deltaOps = deltaLeg.value.hasPlaceholders ? [] : deltaLeg.value.plannedOps;\n\t\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(process.cwd(), deltaPackageDir),\n\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\toperations: [],\n\t\t\t\temittedExtensionDirs,\n\t\t\t\tpendingPlaceholders: true,\n\t\t\t\tsummary: \"Planned baseline + migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(deltaOps) : void 0;\n\t\t\treturn ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(process.cwd(), deltaPackageDir),\n\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\toperations: deltaOps.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\temittedExtensionDirs,\n\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\tsummary: buildAutoBaselinePlanSummary(deltaOps.length, emittedExtensionDirs.length),\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t}\n\t\tconst timestamp = /* @__PURE__ */ new Date();\n\t\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(packageDir, migrationsDir), resolveImportSpecifier);\n\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\tawait writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg.value);\n\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\tif (snapshotStartContract !== null) await writeContractSnapshot(migrationsDir, snapshotStartContract.fromHash, {\n\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t});\n\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\toperations: [],\n\t\t\temittedExtensionDirs,\n\t\t\tpendingPlaceholders: true,\n\t\t\tsummary: \"Planned migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst plannedOps = deltaLeg.value.plannedOps;\n\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(plannedOps) : void 0;\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\toperations: plannedOps.map((op) => ({\n\t\t\t\tid: op.id,\n\t\t\t\tlabel: op.label,\n\t\t\t\toperationClass: op.operationClass\n\t\t\t})),\n\t\t\temittedExtensionDirs,\n\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\tsummary: buildPlanSummary(plannedOps.length, emittedExtensionDirs.length),\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn notOk(errorUnexpected(message, { why: `Unexpected error during migration plan: ${message}` }));\n\t}\n}\nfunction createMigrationPlanCommand() {\n\tconst command = new Command(\"plan\");\n\tsetCommandDescriptions(command, \"Plan a migration from contract changes\", \"Compares the emitted contract against the latest on-disk migration state and\\nproduces a new migration package with the required operations. No database\\nconnection is needed — this is a fully offline operation.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration plan\",\n\t\t\"prisma-next migration plan --name add-users-table\",\n\t\t\"prisma-next migration plan --to <migration-dir>^ --name rollback\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--name <slug>\", \"Name slug for the migration directory\", \"migration\").option(\"--from <contract>\", \"Starting contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--to <contract>\", \"Destination contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path); defaults to the emitted contract\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationPlanCommand(options, flags, ui, startTime), flags, ui, (planResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(planResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationPlanOutput(planResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n/**\n* Compose the success-line summary so the cross-space side effect\n* (extension-space migration packages materialised on disk during\n* this `plan` run) is visible in the top line — not just in the\n* step log above it.\n*\n* Example outputs:\n* - `Planned 3 operation(s)` (app-space-only project)\n* - `Planned 3 operation(s); materialised 1 extension-space migration` (one extension)\n* - `Planned 3 operation(s); materialised 2 extension-space migrations` (two extensions)\n*\n* Locks AC3 at the summary-line level: a reader of the success line\n* can tell that something happened beyond the app space.\n*/\nfunction buildPlanSummary(plannedOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned ${plannedOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\nfunction buildAutoBaselinePlanSummary(deltaOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned baseline + ${deltaOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\nfunction formatMigrationPlanOutput(result, flags) {\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst green_ = useColor ? (s) => `\\x1b[32m${s}\\x1b[0m` : (s) => s;\n\tconst yellow_ = useColor ? (s) => `\\x1b[33m${s}\\x1b[0m` : (s) => s;\n\tconst dim_ = useColor ? (s) => `\\x1b[2m${s}\\x1b[0m` : (s) => s;\n\tfunction appendEmittedExtensions() {\n\t\tif (result.emittedExtensionDirs.length === 0) return;\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(\"Emitted extension migrations:\"));\n\t\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(` ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\t\tlines.push(\"\");\n\t\tlines.push(`Next: review the extension migrations above, then run ${green_(\"prisma-next migrate\")}.`);\n\t}\n\tif (result.noOp) {\n\t\tlines.push(`${green_(\"✔\")} No changes detected`);\n\t\tlines.push(dim_(` from: ${result.from}`));\n\t\tlines.push(dim_(` to: ${result.to}`));\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tif (result.pendingPlaceholders) {\n\t\tlines.push(`${yellow_(\"⚠\")} ${result.summary}`);\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`from: ${result.from}`));\n\t\tlines.push(dim_(`to: ${result.to}`));\n\t\tif (result.dir) lines.push(dim_(`dir: ${result.dir}`));\n\t\tlines.push(\"\");\n\t\tlines.push(\"Open migration.ts and replace each `placeholder(...)` call with your actual query.\");\n\t\tlines.push(`Then run: ${green_(`node ${result.dir ?? \"<dir>\"}/migration.ts`)}`);\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tlines.push(`${green_(\"✔\")} ${result.summary}`);\n\tlines.push(\"\");\n\tif (result.operations.length > 0) {\n\t\tlines.push(dim_(\"│\"));\n\t\tfor (let i = 0; i < result.operations.length; i++) {\n\t\t\tconst op = result.operations[i];\n\t\t\tconst treeChar = i === result.operations.length - 1 ? \"└\" : \"├\";\n\t\t\tconst destructiveMarker = op.operationClass === \"destructive\" ? ` ${yellow_(\"(destructive)\")}` : \"\";\n\t\t\tlines.push(`${dim_(treeChar)}─ ${op.label}${destructiveMarker}`);\n\t\t}\n\t\tif (result.operations.some((op) => op.operationClass === \"destructive\")) {\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(`${yellow_(\"⚠\")} This migration contains destructive operations that may cause data loss.`);\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\tlines.push(dim_(`from: ${result.from}`));\n\tlines.push(dim_(`to: ${result.to}`));\n\tif (result.baselineDir) lines.push(dim_(`Baseline → ${result.baselineDir}`));\n\tif (result.dir) lines.push(dim_(`App space → ${result.dir}`));\n\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(`Extension space ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\tlines.push(\"\");\n\tconst reviewTarget = result.baselineDir !== void 0 && result.dir !== void 0 ? `${result.baselineDir} and ${result.dir}` : result.baselineDir ?? result.dir ?? \"<dir>\";\n\tlines.push(`Next: review ${green_(reviewTarget)} if needed, then run ${green_(\"prisma-next migrate\")}.`);\n\tif (result.preview && result.preview.statements.length > 0) {\n\t\tconst allSql = result.preview.statements.every((s) => s.language === \"sql\");\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(allSql ? \"DDL preview\" : \"Operation preview\"));\n\t\tlines.push(\"\");\n\t\tfor (const statement of result.preview.statements) {\n\t\t\tconst trimmed = statement.text.trim();\n\t\t\tif (!trimmed) continue;\n\t\t\tconst line = statement.language === \"sql\" && !trimmed.endsWith(\";\") ? `${trimmed};` : trimmed;\n\t\t\tlines.push(line);\n\t\t}\n\t}\n\tif (flags.verbose && result.timings) {\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`Total time: ${result.timings.total}ms`));\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Resolve a migration package by **target contract hash** (`metadata.to`)\n* using exact match or prefix match.\n*\n* Note: matches `metadata.to` (the contract hash this migration produces),\n* not `metadata.migrationHash` (the package's content-addressed identity).\n* Tries exact match first, then prefix match. Returns the matched package on\n* success, or a discriminated failure indicating whether the prefix was\n* ambiguous or simply not found.\n*\n* @internal Exported for testing only.\n*/\nfunction resolveBundleByPrefix(bundles, needle) {\n\tconst exact = bundles.find((p) => p.metadata.to === needle);\n\tif (exact) return ok(exact);\n\tconst candidates = bundles.filter((p) => p.metadata.to.startsWith(needle));\n\tif (candidates.length === 1) return ok(candidates[0]);\n\tif (candidates.length > 1) return notOk({\n\t\treason: \"ambiguous\",\n\t\tcount: candidates.length\n\t});\n\treturn notOk({ reason: \"not-found\" });\n}\n//#endregion\nexport { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };\n\n//# sourceMappingURL=migration-plan-q_L84PN1.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAe,0BAA0B,QAAQ;CAChD,MAAM,UAAU,cAAc,OAAO,WAAW,QAAQ,SAAS,KAAK,kBAAkB,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU;EAC9G,SAAS,KAAK;EACd,eAAe;EACf,aAAa,KAAK,cAAc;EAChC,QAAQ,KAAK;CACd,EAAE,IAAI,UAAU,MAAM,OAAO,UAAU;CACvC,MAAM,oCAAoC,IAAI,IAAI;CAClD,KAAK,MAAM,QAAQ,OAAO,YAAY,IAAI,KAAK,kBAAkB,KAAK,GAAG,kBAAkB,IAAI,KAAK,IAAI,KAAK,aAAa;CAC1H,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,SAAS,SAAS;EAC5B,MAAM,aAAa,kBAAkB,IAAI,MAAM,OAAO;EACtD,IAAI,eAAe,KAAK,GAAG;EAC3B,MAAM,aAAa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;EACR,OAAO,WAAW;CACnB,CAAC;CACD,OAAO,MAAM,EAAE,QAAQ,YAAY,CAAC;AACrC"}
1
+ {"version":3,"file":"migration-plan-q_L84PN1-BFb6Si_L.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-plan-q_L84PN1.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, Q as errorPlanForgotTheFlag, W as errorFileNotFound, X as errorMigrationPlanningFailed, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, it as errorSnapshotMissing, l as setCommandDescriptions, lt as mapMigrationToolsError, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-CjshQKHA.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-CpwLCDLY.mjs\";\nimport { c as toExtensionInputs, i as loadContractSpaceAggregateForCli, t as buildContractSpaceAggregate } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-BX7w-p19.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack, hasOperationPreview } from \"@internal/framework-components/control\";\nimport { emitContractSpaceArtifacts, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { assertHashIsGraphNode, findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\nimport { computeMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\nimport { deriveProvidedInvariants } from \"@internal/migration-tools/invariants\";\n//#region src/utils/contract-space-seed-phase.ts\n/**\n* Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4).\n*\n* For every extension that exposes a `contractSpace`:\n*\n* 1. Read the on-disk head ref (returns `null` on first emit).\n* 2. Write the head contract into the migrations-root snapshot store\n* (write-if-absent, keyed by hash) and unconditionally re-emit\n* `refs/head.json`, via {@link emitContractSpaceArtifacts}. The\n* framework owns `refs/head.json`; re-emit is the contract for that\n* file. The snapshot itself is only written once per distinct hash.\n* 3. Materialise any descriptor-shipped migration packages not yet on\n* disk via {@link materialiseExtensionMigrationPackageIfMissing}.\n* Existing packages are left untouched (by-existence skip).\n*\n* The return value lets the caller render a per-space status line and\n* lets the phase-2 aggregate loader run on a now-consistent disk state\n* (every loaded extension is guaranteed to have its head ref pinned\n* to the descriptor's hash and to ship every package the descriptor\n* declares).\n*\n* Output ordering is deterministic and alphabetical by spaceId (via\n* {@link planAllSpaces}, which also detects duplicate spaceIds). This\n* matches the canonical sort order used by every other aggregate\n* surface (`migrate`, `migration status`, the runner).\n*/\nasync function runContractSpaceSeedPhase(inputs) {\n\tconst planned = planAllSpaces(inputs.extensions.filter((pack) => pack.contractSpace !== void 0).map((pack) => ({\n\t\tspaceId: pack.id,\n\t\tpriorContract: null,\n\t\tnewContract: pack.contractSpace.contractJson,\n\t\t__pack: pack.contractSpace\n\t})), (input) => input.__pack.migrations);\n\tconst descriptorBySpace = /* @__PURE__ */ new Map();\n\tfor (const pack of inputs.extensions) if (pack.contractSpace !== void 0) descriptorBySpace.set(pack.id, pack.contractSpace);\n\tconst seeded = [];\n\tfor (const space of planned) {\n\t\tconst descriptor = descriptorBySpace.get(space.spaceId);\n\t\tif (descriptor === void 0) continue;\n\t\tconst priorHash = (await readContractSpaceHeadRef(inputs.migrationsDir, space.spaceId))?.hash ?? null;\n\t\tawait emitContractSpaceArtifacts(inputs.migrationsDir, space.spaceId, {\n\t\t\tcontract: descriptor.contractJson,\n\t\t\tcontractDts: buildPlaceholderContractDts(space.spaceId),\n\t\t\theadRef: {\n\t\t\t\thash: descriptor.headRef.hash,\n\t\t\t\tinvariants: descriptor.headRef.invariants\n\t\t\t}\n\t\t});\n\t\tconst spaceDir = spaceMigrationDirectory(inputs.migrationsDir, space.spaceId);\n\t\tconst newMigrationDirs = [];\n\t\tfor (const pkg of space.migrationPackages) {\n\t\t\tconst { written } = await materialiseExtensionMigrationPackageIfMissing(spaceDir, pkg);\n\t\t\tif (written) newMigrationDirs.push(pkg.dirName);\n\t\t}\n\t\tconst action = priorHash !== descriptor.headRef.hash || newMigrationDirs.length > 0 ? \"updated\" : \"unchanged\";\n\t\tseeded.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\taction,\n\t\t\tpriorHash,\n\t\t\tnewHash: descriptor.headRef.hash,\n\t\t\tnewMigrationDirs\n\t\t});\n\t}\n\treturn { seeded };\n}\n/**\n* Placeholder `.d.ts` content for an extension space's on-disk mirror.\n*\n* Rendering a fully-typed `.d.ts` for an extension contract requires\n* the SQL-family renderer with the codec / typemap registry threaded\n* through; until that integration ships, the on-disk `.d.ts` is a\n* stub `export {};` module that documents how consumers should\n* validate the sibling `contract.json`. The stub typechecks on its\n* own and does not need any TypeScript suppressions.\n*/\nfunction buildPlaceholderContractDts(spaceId) {\n\treturn [\n\t\t\"/**\",\n\t\t` * Placeholder \\`.d.ts\\` for extension space \"${spaceId}\".`,\n\t\t\" *\",\n\t\t\" * The framework re-emits this file on every `migration plan` run\",\n\t\t\" * alongside `contract.json` and `refs/head.json`. A typed `.d.ts`\",\n\t\t\" * rendering pass for extension contracts is tracked separately;\",\n\t\t\" * until that ships, consumers should import `contract.json`\",\n\t\t\" * and pass it through the target descriptor’s `contractSerializer`.\",\n\t\t\" */\",\n\t\t\"export {};\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/utils/plan-resolution.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nfunction looksLikeFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction graphIsEmpty(space) {\n\treturn space.packages.length === 0;\n}\nfunction getReachableRefs(refs, graph) {\n\treturn Object.entries(refs).flatMap(([name, entry]) => entry && isGraphNode(entry.hash, graph) ? [{\n\t\tname,\n\t\thash: entry.hash\n\t}] : []).sort((a, b) => a.name.localeCompare(b.name));\n}\nfunction assertFromIsGraphNode(fromHash, graph, refs, graphTipHash) {\n\ttry {\n\t\tassertHashIsGraphNode(fromHash, graph);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.HASH_NOT_IN_GRAPH\") throw errorPlanForgotTheFlag(fromHash, getReachableRefs(refs, graph), graphTipHash);\n\t\tthrow error;\n\t}\n}\nasync function resolveContractRef(parsed, space, options) {\n\tconst { hash, provenance } = parsed;\n\tconst refName = provenance.kind === \"ref\" ? provenance.refName : void 0;\n\ttry {\n\t\tconst at = await space.contractAt(hash, refName !== void 0 ? { refName } : void 0);\n\t\tif (at.provenance === \"ref\") return ok({\n\t\t\tkind: \"ref\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t\treturn ok({\n\t\t\tkind: \"graph-node\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t} catch (error) {\n\t\treturn mapContractAtError(error, options?.artifactRole !== void 0 ? { artifactRole: options.artifactRole } : void 0);\n\t}\n}\nasync function resolveFromPolicy(parsed, input, refs, explicitFromLabel) {\n\tconst resolution = await resolveContractRef(parsed, input.space, {\n\t\t...explicitFromLabel !== void 0 ? { explicitLabel: explicitFromLabel } : {},\n\t\tartifactRole: \"from\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tif (resolution.value.kind === \"graph-node\") return ok({\n\t\tkind: \"graph-node\",\n\t\tfromHash: resolution.value.hash,\n\t\tfromContract: resolution.value.contract\n\t});\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\tif (graphIsEmpty(input.space)) return ok({\n\t\tkind: \"auto-baseline\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n\tconst graph = input.space.graph();\n\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\ttry {\n\t\tassertFromIsGraphNode(hash, graph, refs, graphTip);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\treturn ok({\n\t\tkind: \"ref\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n}\nasync function resolveFromForPlan(input) {\n\tconst { optionsFrom, space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tif (optionsFrom === void 0) {\n\t\tconst dbRef = refs[\"db\"];\n\t\tif (!dbRef) return ok({\n\t\t\tkind: \"greenfield\",\n\t\t\tfromHash: null,\n\t\t\tfromContract: null\n\t\t});\n\t\treturn resolveFromPolicy({\n\t\t\thash: dbRef.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: \"db\"\n\t\t\t}\n\t\t}, input, refs);\n\t}\n\tconst refResult = parseContractRef(optionsFrom, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) {\n\t\tif (looksLikeFullHash(optionsFrom)) {\n\t\t\tconst empty = graphIsEmpty(space);\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\tif (empty) return notOk(errorSnapshotMissing(optionsFrom, { viaRef: false }));\n\t\t\treturn notOk(errorPlanForgotTheFlag(optionsFrom, getReachableRefs(refs, graph), graphTip));\n\t\t}\n\t\treturn notOk(mapRefResolutionError(refResult.failure));\n\t}\n\treturn resolveFromPolicy(refResult.value, input, refs, optionsFrom);\n}\nasync function resolveToForPlan(optionsTo, input) {\n\tconst { space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tconst refResult = parseContractRef(optionsTo, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\tconst resolution = await resolveContractRef(refResult.value, space, {\n\t\texplicitLabel: optionsTo,\n\t\tartifactRole: \"to\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\treturn ok({\n\t\thash,\n\t\tcontract,\n\t\tcontractJson,\n\t\tcontractDts\n\t});\n}\n//#endregion\n//#region src/commands/migration-plan.ts\nasync function runPlannerLeg(planner, migrations, frameworkComponents, contract, fromContract, spaceId, ownership, snapshotsImportPath, resolveImportSpecifier) {\n\tconst fromSchema = migrations.contractToSchema(fromContract, frameworkComponents);\n\tconst plannerResult = planner.plan({\n\t\tcontract,\n\t\tschema: fromSchema,\n\t\tpolicy: { allowedOperationClasses: [\n\t\t\t\"additive\",\n\t\t\t\"widening\",\n\t\t\t\"destructive\",\n\t\t\t\"data\"\n\t\t] },\n\t\tfromContract,\n\t\tframeworkComponents,\n\t\tspaceId,\n\t\townership,\n\t\tsnapshotsImportPath\n\t});\n\tif (plannerResult.kind === \"failure\") return notOk(errorMigrationPlanningFailed({ conflicts: plannerResult.conflicts }));\n\tlet plannedOps = [];\n\tlet hasPlaceholders = false;\n\ttry {\n\t\tplannedOps = await Promise.all(plannerResult.plan.operations);\n\t\tif (plannedOps.length === 0) return notOk(errorMigrationPlanningFailed({ conflicts: [{\n\t\t\tkind: \"unsupportedChange\",\n\t\t\tsummary: \"Contract changed but planner produced no operations. This indicates unsupported or ignored changes.\"\n\t\t}] }));\n\t} catch (e) {\n\t\tif (CliStructuredError.is(e) && e.code === \"MIGRATION.UNFILLED_PLACEHOLDER\") hasPlaceholders = true;\n\t\telse throw e;\n\t}\n\treturn ok({\n\t\tplannedOps,\n\t\tmigrationTsContent: plannerResult.plan.renderTypeScript(resolveImportSpecifier),\n\t\thasPlaceholders\n\t});\n}\nasync function writePlannedMigrationPackage(packageDir, fromHash, toHash, createdAt, leg) {\n\tconst opsForWrite = leg.hasPlaceholders ? [] : leg.plannedOps;\n\tconst metadataWithInvariants = {\n\t\tfrom: fromHash,\n\t\tto: toHash,\n\t\tprovidedInvariants: deriveProvidedInvariants(opsForWrite),\n\t\tcreatedAt: createdAt.toISOString()\n\t};\n\tawait writeMigrationPackage(packageDir, {\n\t\t...metadataWithInvariants,\n\t\tmigrationHash: computeMigrationHash(metadataWithInvariants, opsForWrite)\n\t}, opsForWrite);\n\tawait writeMigrationTs(packageDir, leg.migrationTsContent);\n}\nasync function executeMigrationPlanCommand(options, flags, ui, startTime) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [\n\t\t\t{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: configPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"contract\",\n\t\t\t\tvalue: contractPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"migrations\",\n\t\t\t\tvalue: appMigrationsRelative\n\t\t\t}\n\t\t];\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.to) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: options.to\n\t\t});\n\t\tif (options.name) details.push({\n\t\t\tlabel: \"name\",\n\t\t\tvalue: options.name\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration plan\",\n\t\t\tdescription: \"Plan a migration from contract changes\",\n\t\t\turl: \"https://pris.ly/migration-plan\",\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\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tlet toContract;\n\ttry {\n\t\ttoContract = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst rawStorageHash = toContract.storage?.storageHash;\n\tif (typeof rawStorageHash !== \"string\") return notOk(errorContractValidationFailed(\"Contract is missing storageHash\", { where: { path: contractPathAbsolute } }));\n\tlet toStorageHash = rawStorageHash;\n\tlet toArtifacts = null;\n\tlet fromContract = null;\n\tlet fromHash = null;\n\tlet snapshotStartContract = null;\n\tlet isAutoBaseline = false;\n\tconst tolerantAggregateResult = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!tolerantAggregateResult.ok) return notOk(tolerantAggregateResult.failure);\n\tconst resolutionSpace = tolerantAggregateResult.value.app;\n\tconst resolutionResult = await resolveFromForPlan({\n\t\toptionsFrom: options.from,\n\t\tspace: resolutionSpace\n\t});\n\tif (!resolutionResult.ok) return notOk(resolutionResult.failure);\n\tswitch (resolutionResult.value.kind) {\n\t\tcase \"greenfield\": break;\n\t\tcase \"graph-node\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tbreak;\n\t\tcase \"ref\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tbreak;\n\t\tcase \"auto-baseline\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tisAutoBaseline = true;\n\t\t\tbreak;\n\t}\n\tif (options.to !== void 0) {\n\t\tconst toResolution = await resolveToForPlan(options.to, { space: resolutionSpace });\n\t\tif (!toResolution.ok) return notOk(toResolution.failure);\n\t\ttoContract = toResolution.value.contract;\n\t\ttoStorageHash = toResolution.value.hash;\n\t\ttoArtifacts = {\n\t\t\tcontractJson: toResolution.value.contractJson,\n\t\t\tcontractDts: toResolution.value.contractDts\n\t\t};\n\t}\n\tconst resolveImportSpecifier = createProjectSpecifierResolver(options.config);\n\tconst seedResult = await runContractSpaceSeedPhase({\n\t\tmigrationsDir,\n\t\textensions: toExtensionInputs(config.extensions ?? [])\n\t});\n\tif (!flags.json && !flags.quiet) {\n\t\tfor (const record of seedResult.seeded) if (record.action === \"updated\") {\n\t\t\tconst pkgSuffix = record.newMigrationDirs.length > 0 ? `; ${record.newMigrationDirs.length} new migration package(s) materialised` : \"\";\n\t\t\tui.step(`Updated ${record.spaceId} to ${record.newHash}${pkgSuffix}`);\n\t\t}\n\t}\n\tconst emittedExtensionDirs = seedResult.seeded.flatMap((r) => r.newMigrationDirs.map((dirName) => ({\n\t\tspaceId: r.spaceId,\n\t\tdirName\n\t})));\n\tif (fromHash === toStorageHash && !isAutoBaseline) return ok({\n\t\tok: true,\n\t\tnoOp: true,\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\toperations: [],\n\t\temittedExtensionDirs,\n\t\tsummary: \"No changes detected between contracts\",\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst aggregateResult = await buildContractSpaceAggregate({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\tconst aggregate = aggregateResult.value;\n\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\tconfig.target,\n\t\tconfig.adapter,\n\t\t...config.extensions ?? []\n\t]);\n\tasync function writeDestinationSnapshot(destHash) {\n\t\tif (toArtifacts !== null) {\n\t\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\t\tcontractJson: toArtifacts.contractJson,\n\t\t\t\tcontractDts: toArtifacts.contractDts\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t}\n\ttry {\n\t\tconst planner = migrations.createPlanner(controlAdapter);\n\t\tif (isAutoBaseline && fromHash !== null && fromContract !== null && snapshotStartContract !== null) {\n\t\t\tconst baselineTimestamp = /* @__PURE__ */ new Date();\n\t\t\tconst deltaTimestamp = new Date(baselineTimestamp.getTime() + 6e4);\n\t\t\tconst baselineDirName = formatMigrationDirName(baselineTimestamp, \"baseline\");\n\t\t\tconst deltaDirName = formatMigrationDirName(deltaTimestamp, options.name ?? \"migration\");\n\t\t\tconst baselinePackageDir = join(appMigrationsDir, baselineDirName);\n\t\t\tconst deltaPackageDir = join(appMigrationsDir, deltaDirName);\n\t\t\tconst baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, null, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(baselinePackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!baselineLeg.ok) return notOk(baselineLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(baselinePackageDir, null, fromHash, baselineTimestamp, baselineLeg.value);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tif (fromHash === toStorageHash) {\n\t\t\t\tconst baselineOps = baselineLeg.value.hasPlaceholders ? [] : baselineLeg.value.plannedOps;\n\t\t\t\tif (baselineLeg.value.hasPlaceholders) {\n\t\t\t\t\tconst baselineDir = relative(process.cwd(), baselinePackageDir);\n\t\t\t\t\treturn ok({\n\t\t\t\t\t\tok: true,\n\t\t\t\t\t\tnoOp: false,\n\t\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\t\tdir: baselineDir,\n\t\t\t\t\t\tbaselineDir,\n\t\t\t\t\t\toperations: [],\n\t\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t\tpendingPlaceholders: true,\n\t\t\t\t\t\tsummary: \"Planned baseline with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(baselineOps) : void 0;\n\t\t\t\treturn ok({\n\t\t\t\t\tok: true,\n\t\t\t\t\tnoOp: false,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\t\toperations: baselineOps.map((op) => ({\n\t\t\t\t\t\tid: op.id,\n\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t\t})),\n\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\t\tsummary: buildAutoBaselinePlanSummary(0, emittedExtensionDirs.length),\n\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(deltaPackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg.value);\n\t\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tconst deltaOps = deltaLeg.value.hasPlaceholders ? [] : deltaLeg.value.plannedOps;\n\t\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(process.cwd(), deltaPackageDir),\n\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\toperations: [],\n\t\t\t\temittedExtensionDirs,\n\t\t\t\tpendingPlaceholders: true,\n\t\t\t\tsummary: \"Planned baseline + migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(deltaOps) : void 0;\n\t\t\treturn ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(process.cwd(), deltaPackageDir),\n\t\t\t\tbaselineDir: relative(process.cwd(), baselinePackageDir),\n\t\t\t\toperations: deltaOps.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\temittedExtensionDirs,\n\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\tsummary: buildAutoBaselinePlanSummary(deltaOps.length, emittedExtensionDirs.length),\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t}\n\t\tconst timestamp = /* @__PURE__ */ new Date();\n\t\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(packageDir, migrationsDir), resolveImportSpecifier);\n\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\tawait writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg.value);\n\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\tif (snapshotStartContract !== null) await writeContractSnapshot(migrationsDir, snapshotStartContract.fromHash, {\n\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t});\n\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\toperations: [],\n\t\t\temittedExtensionDirs,\n\t\t\tpendingPlaceholders: true,\n\t\t\tsummary: \"Planned migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst plannedOps = deltaLeg.value.plannedOps;\n\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(plannedOps) : void 0;\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\toperations: plannedOps.map((op) => ({\n\t\t\t\tid: op.id,\n\t\t\t\tlabel: op.label,\n\t\t\t\toperationClass: op.operationClass\n\t\t\t})),\n\t\t\temittedExtensionDirs,\n\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\tsummary: buildPlanSummary(plannedOps.length, emittedExtensionDirs.length),\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn notOk(errorUnexpected(message, { why: `Unexpected error during migration plan: ${message}` }));\n\t}\n}\nfunction createMigrationPlanCommand() {\n\tconst command = new Command(\"plan\");\n\tsetCommandDescriptions(command, \"Plan a migration from contract changes\", \"Compares the emitted contract against the latest on-disk migration state and\\nproduces a new migration package with the required operations. No database\\nconnection is needed — this is a fully offline operation.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration plan\",\n\t\t\"prisma-next migration plan --name add-users-table\",\n\t\t\"prisma-next migration plan --to <migration-dir>^ --name rollback\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--name <slug>\", \"Name slug for the migration directory\", \"migration\").option(\"--from <contract>\", \"Starting contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--to <contract>\", \"Destination contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path); defaults to the emitted contract\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationPlanCommand(options, flags, ui, startTime), flags, ui, (planResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(planResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationPlanOutput(planResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n/**\n* Compose the success-line summary so the cross-space side effect\n* (extension-space migration packages materialised on disk during\n* this `plan` run) is visible in the top line — not just in the\n* step log above it.\n*\n* Example outputs:\n* - `Planned 3 operation(s)` (app-space-only project)\n* - `Planned 3 operation(s); materialised 1 extension-space migration` (one extension)\n* - `Planned 3 operation(s); materialised 2 extension-space migrations` (two extensions)\n*\n* Locks AC3 at the summary-line level: a reader of the success line\n* can tell that something happened beyond the app space.\n*/\nfunction buildPlanSummary(plannedOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned ${plannedOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\nfunction buildAutoBaselinePlanSummary(deltaOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned baseline + ${deltaOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\nfunction formatMigrationPlanOutput(result, flags) {\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst green_ = useColor ? (s) => `\\x1b[32m${s}\\x1b[0m` : (s) => s;\n\tconst yellow_ = useColor ? (s) => `\\x1b[33m${s}\\x1b[0m` : (s) => s;\n\tconst dim_ = useColor ? (s) => `\\x1b[2m${s}\\x1b[0m` : (s) => s;\n\tfunction appendEmittedExtensions() {\n\t\tif (result.emittedExtensionDirs.length === 0) return;\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(\"Emitted extension migrations:\"));\n\t\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(` ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\t\tlines.push(\"\");\n\t\tlines.push(`Next: review the extension migrations above, then run ${green_(\"prisma-next migrate\")}.`);\n\t}\n\tif (result.noOp) {\n\t\tlines.push(`${green_(\"✔\")} No changes detected`);\n\t\tlines.push(dim_(` from: ${result.from}`));\n\t\tlines.push(dim_(` to: ${result.to}`));\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tif (result.pendingPlaceholders) {\n\t\tlines.push(`${yellow_(\"⚠\")} ${result.summary}`);\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`from: ${result.from}`));\n\t\tlines.push(dim_(`to: ${result.to}`));\n\t\tif (result.dir) lines.push(dim_(`dir: ${result.dir}`));\n\t\tlines.push(\"\");\n\t\tlines.push(\"Open migration.ts and replace each `placeholder(...)` call with your actual query.\");\n\t\tlines.push(`Then run: ${green_(`node ${result.dir ?? \"<dir>\"}/migration.ts`)}`);\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tlines.push(`${green_(\"✔\")} ${result.summary}`);\n\tlines.push(\"\");\n\tif (result.operations.length > 0) {\n\t\tlines.push(dim_(\"│\"));\n\t\tfor (let i = 0; i < result.operations.length; i++) {\n\t\t\tconst op = result.operations[i];\n\t\t\tconst treeChar = i === result.operations.length - 1 ? \"└\" : \"├\";\n\t\t\tconst destructiveMarker = op.operationClass === \"destructive\" ? ` ${yellow_(\"(destructive)\")}` : \"\";\n\t\t\tlines.push(`${dim_(treeChar)}─ ${op.label}${destructiveMarker}`);\n\t\t}\n\t\tif (result.operations.some((op) => op.operationClass === \"destructive\")) {\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(`${yellow_(\"⚠\")} This migration contains destructive operations that may cause data loss.`);\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\tlines.push(dim_(`from: ${result.from}`));\n\tlines.push(dim_(`to: ${result.to}`));\n\tif (result.baselineDir) lines.push(dim_(`Baseline → ${result.baselineDir}`));\n\tif (result.dir) lines.push(dim_(`App space → ${result.dir}`));\n\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(`Extension space ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\tlines.push(\"\");\n\tconst reviewTarget = result.baselineDir !== void 0 && result.dir !== void 0 ? `${result.baselineDir} and ${result.dir}` : result.baselineDir ?? result.dir ?? \"<dir>\";\n\tlines.push(`Next: review ${green_(reviewTarget)} if needed, then run ${green_(\"prisma-next migrate\")}.`);\n\tif (result.preview && result.preview.statements.length > 0) {\n\t\tconst allSql = result.preview.statements.every((s) => s.language === \"sql\");\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(allSql ? \"DDL preview\" : \"Operation preview\"));\n\t\tlines.push(\"\");\n\t\tfor (const statement of result.preview.statements) {\n\t\t\tconst trimmed = statement.text.trim();\n\t\t\tif (!trimmed) continue;\n\t\t\tconst line = statement.language === \"sql\" && !trimmed.endsWith(\";\") ? `${trimmed};` : trimmed;\n\t\t\tlines.push(line);\n\t\t}\n\t}\n\tif (flags.verbose && result.timings) {\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`Total time: ${result.timings.total}ms`));\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Resolve a migration package by **target contract hash** (`metadata.to`)\n* using exact match or prefix match.\n*\n* Note: matches `metadata.to` (the contract hash this migration produces),\n* not `metadata.migrationHash` (the package's content-addressed identity).\n* Tries exact match first, then prefix match. Returns the matched package on\n* success, or a discriminated failure indicating whether the prefix was\n* ambiguous or simply not found.\n*\n* @internal Exported for testing only.\n*/\nfunction resolveBundleByPrefix(bundles, needle) {\n\tconst exact = bundles.find((p) => p.metadata.to === needle);\n\tif (exact) return ok(exact);\n\tconst candidates = bundles.filter((p) => p.metadata.to.startsWith(needle));\n\tif (candidates.length === 1) return ok(candidates[0]);\n\tif (candidates.length > 1) return notOk({\n\t\treason: \"ambiguous\",\n\t\tcount: candidates.length\n\t});\n\treturn notOk({ reason: \"not-found\" });\n}\n//#endregion\nexport { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };\n\n//# sourceMappingURL=migration-plan-q_L84PN1.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAe,0BAA0B,QAAQ;CAChD,MAAM,UAAU,cAAc,OAAO,WAAW,QAAQ,SAAS,KAAK,kBAAkB,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU;EAC9G,SAAS,KAAK;EACd,eAAe;EACf,aAAa,KAAK,cAAc;EAChC,QAAQ,KAAK;CACd,EAAE,IAAI,UAAU,MAAM,OAAO,UAAU;CACvC,MAAM,oCAAoC,IAAI,IAAI;CAClD,KAAK,MAAM,QAAQ,OAAO,YAAY,IAAI,KAAK,kBAAkB,KAAK,GAAG,kBAAkB,IAAI,KAAK,IAAI,KAAK,aAAa;CAC1H,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,SAAS,S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AI,WAAW,WAAW,GAAG,OAAO,GAAG,WAAW,EAAE;CACpD,IAAI,WAAW,SAAS,GAAG,OAAO,MAAM;EACvC,QAAQ;EACR,OAAO,WAAW;CACnB,CAAC;CACD,OAAO,MAAM,EAAE,QAAQ,YAAY,CAAC;AACrC"}
@@ -1,7 +1,7 @@
1
1
  import { H as formatMigrationShowOutput, N as errorUnexpected, O as errorRuntime$1, Q as mapRefResolutionError, W as formatStyledHeader, at as resolveMigrationPaths, ct as setCommandExamples, d as errorContractValidationFailed, h as errorFileNotFound, it as resolveContractPath, lt as setCommandSeeAlso, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
2
- import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
2
+ import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
3
3
  import { s as loadContractSpaceAggregate } from "./aggregate-B4mhR4Sk.mjs";
4
- import { t as createControlClient } from "./client-75qrAPqf-DZAVUxFa.mjs";
4
+ import { t as createControlClient } from "./client-75qrAPqf-DRg33_uJ.mjs";
5
5
  import { r as parseMigrationRef } from "./ref-resolution-BjJBWPjX.mjs";
6
6
  import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-D3Sj55PI-BICblCuk.mjs";
7
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -168,4 +168,4 @@ function createMigrationShowCommand() {
168
168
  //#endregion
169
169
  export { createMigrationShowCommand as t };
170
170
 
171
- //# sourceMappingURL=migration-show-Bx5I5aW9.mjs.map
171
+ //# sourceMappingURL=migration-show-PTC1gUjq.mjs.map