@prisma/orm-toolchain 0.17.0-dev.1 → 0.17.0-dev.3
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.
- package/dist/bin__prisma-next.mjs +21 -21
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli__commands__contract-emit.mjs +1 -1
- package/dist/cli__commands__contract-infer.mjs +1 -1
- package/dist/cli__commands__db-init.mjs +1 -1
- package/dist/cli__commands__db-schema.mjs +1 -1
- package/dist/cli__commands__db-sign.mjs +1 -1
- package/dist/cli__commands__db-update.mjs +1 -1
- package/dist/cli__commands__db-verify.mjs +1 -1
- package/dist/cli__commands__migrate.mjs +1 -1
- package/dist/cli__commands__migration-check.mjs +1 -1
- package/dist/cli__commands__migration-graph.mjs +1 -1
- package/dist/cli__commands__migration-list.mjs +1 -1
- package/dist/cli__commands__migration-log.mjs +1 -1
- package/dist/cli__commands__migration-new.mjs +1 -1
- package/dist/cli__commands__migration-plan.mjs +1 -1
- package/dist/cli__commands__migration-show.mjs +1 -1
- package/dist/cli__commands__migration-status.mjs +1 -1
- package/dist/cli__commands__ref.mjs +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__migration-cli.mjs +1 -1
- package/dist/{client-75qrAPqf-DZAVUxFa.mjs → client-75qrAPqf-DRg33_uJ.mjs} +2 -2
- package/dist/{client-75qrAPqf-DZAVUxFa.mjs.map → client-75qrAPqf-DRg33_uJ.mjs.map} +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-emit-0hSjbuxp-BBOKldTZ.mjs → contract-emit-0hSjbuxp-D2wIkKg5.mjs} +4 -4
- package/dist/{contract-emit-0hSjbuxp-BBOKldTZ.mjs.map → contract-emit-0hSjbuxp-D2wIkKg5.mjs.map} +1 -1
- package/dist/{contract-emit-B6odMoem-CK3diBPk.mjs → contract-emit-B6odMoem-BqLV218x.mjs} +3 -3
- package/dist/{contract-emit-B6odMoem-CK3diBPk.mjs.map → contract-emit-B6odMoem-BqLV218x.mjs.map} +1 -1
- package/dist/{contract-infer-BnkqpftN-DVM2eKJ3.mjs → contract-infer-BnkqpftN-CWEXM1_m.mjs} +2 -2
- package/dist/{contract-infer-BnkqpftN-DVM2eKJ3.mjs.map → contract-infer-BnkqpftN-CWEXM1_m.mjs.map} +1 -1
- package/dist/{db-init-Vbkb_TKZ.mjs → db-init-CNV8ATc2.mjs} +2 -2
- package/dist/{db-init-Vbkb_TKZ.mjs.map → db-init-CNV8ATc2.mjs.map} +1 -1
- package/dist/{db-schema-ClQCu3xY.mjs → db-schema-CJzVfw2K.mjs} +2 -2
- package/dist/{db-schema-ClQCu3xY.mjs.map → db-schema-CJzVfw2K.mjs.map} +1 -1
- package/dist/{db-sign-jjXDgQ1u.mjs → db-sign-gLmoexj3.mjs} +3 -3
- package/dist/{db-sign-jjXDgQ1u.mjs.map → db-sign-gLmoexj3.mjs.map} +1 -1
- package/dist/{db-update-BQlrqtDD.mjs → db-update-C24M1jin.mjs} +2 -2
- package/dist/{db-update-BQlrqtDD.mjs.map → db-update-C24M1jin.mjs.map} +1 -1
- package/dist/{db-verify-CKPsRFrj-3udprZQD.mjs → db-verify-CKPsRFrj-1sjfQjHX.mjs} +3 -3
- package/dist/{db-verify-CKPsRFrj-3udprZQD.mjs.map → db-verify-CKPsRFrj-1sjfQjHX.mjs.map} +1 -1
- package/dist/emitter.d.mts +5 -2
- package/dist/emitter.d.mts.map +1 -1
- package/dist/emitter.mjs +1 -1
- package/dist/{exports-D3-NwrMA-CadaBGQ3.mjs → exports-BGMKuMBH-C1_tsw6T.mjs} +8 -4
- package/dist/{exports-D3-NwrMA-CadaBGQ3.mjs.map → exports-BGMKuMBH-C1_tsw6T.mjs.map} +1 -1
- package/dist/{exports-Dl2aGAk7.mjs → exports-BTEdvV8H.mjs} +2 -2
- package/dist/{exports-Dl2aGAk7.mjs.map → exports-BTEdvV8H.mjs.map} +1 -1
- package/dist/{exports-B_xhKZmC.mjs → exports-DPBVzFXj.mjs} +2 -2
- package/dist/{exports-B_xhKZmC.mjs.map → exports-DPBVzFXj.mjs.map} +1 -1
- package/dist/{format-ByDm2goZ-DKLyhNHo.mjs → format-ByDm2goZ-CDNjRRyB.mjs} +2 -2
- package/dist/{format-ByDm2goZ-DKLyhNHo.mjs.map → format-ByDm2goZ-CDNjRRyB.mjs.map} +1 -1
- package/dist/{init-DHctXAI9-DSlaaYXN.mjs → init-DHctXAI9-DfuY-JG7.mjs} +2 -2
- package/dist/{init-DHctXAI9-DSlaaYXN.mjs.map → init-DHctXAI9-DfuY-JG7.mjs.map} +1 -1
- package/dist/{inspect-live-schema-CnwYTRZ0-BErPHMni.mjs → inspect-live-schema-CnwYTRZ0-Bdvwf7Dl.mjs} +3 -3
- package/dist/{inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map → inspect-live-schema-CnwYTRZ0-Bdvwf7Dl.mjs.map} +1 -1
- package/dist/{migrate-Cb_iv264.mjs → migrate-BnHRdrqX.mjs} +4 -4
- package/dist/{migrate-Cb_iv264.mjs.map → migrate-BnHRdrqX.mjs.map} +1 -1
- package/dist/{migration-check-CcG-fB8r-CDs5C9vt.mjs → migration-check-DcwUnadt-DfjO4JKT.mjs} +3 -3
- package/dist/migration-check-DcwUnadt-DfjO4JKT.mjs.map +1 -0
- package/dist/{migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs → migration-command-scaffold-BCuoeAki-BMi1GAv-.mjs} +3 -3
- package/dist/{migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map → migration-command-scaffold-BCuoeAki-BMi1GAv-.mjs.map} +1 -1
- package/dist/{migration-graph-DkoCC0Qy.mjs → migration-graph-Bjy-ZHY3.mjs} +3 -3
- package/dist/{migration-graph-DkoCC0Qy.mjs.map → migration-graph-Bjy-ZHY3.mjs.map} +1 -1
- package/dist/{migration-list-BFBeo1_X-c0kqYokL.mjs → migration-list-BFBeo1_X-DwyOI0w9.mjs} +2 -2
- package/dist/{migration-list-BFBeo1_X-c0kqYokL.mjs.map → migration-list-BFBeo1_X-DwyOI0w9.mjs.map} +1 -1
- package/dist/{migration-log-CS5IWcNq-BQ-32Low.mjs → migration-log-CS5IWcNq-CjmDyvwG.mjs} +3 -3
- package/dist/{migration-log-CS5IWcNq-BQ-32Low.mjs.map → migration-log-CS5IWcNq-CjmDyvwG.mjs.map} +1 -1
- package/dist/{migration-new-BurCjyaQ.mjs → migration-new-CCEfD9oh.mjs} +3 -3
- package/dist/{migration-new-BurCjyaQ.mjs.map → migration-new-CCEfD9oh.mjs.map} +1 -1
- package/dist/{migration-plan-q_L84PN1-BWE0LTH6.mjs → migration-plan-q_L84PN1-BFb6Si_L.mjs} +3 -3
- package/dist/{migration-plan-q_L84PN1-BWE0LTH6.mjs.map → migration-plan-q_L84PN1-BFb6Si_L.mjs.map} +1 -1
- package/dist/{migration-show-Bx5I5aW9.mjs → migration-show-PTC1gUjq.mjs} +3 -3
- package/dist/{migration-show-Bx5I5aW9.mjs.map → migration-show-PTC1gUjq.mjs.map} +1 -1
- package/dist/{migration-status-CFlzlRmu-DewBN8Ys.mjs → migration-status-CE7cQLDq-BNFyJssP.mjs} +5 -5
- package/dist/migration-status-CE7cQLDq-BNFyJssP.mjs.map +1 -0
- package/dist/{ref-B6cTthTi.mjs → ref-tjLWCeGO.mjs} +2 -2
- package/dist/{ref-B6cTthTi.mjs.map → ref-tjLWCeGO.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +0 -1
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-show-Bx5I5aW9.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-show.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, E as formatMigrationShowOutput, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { t as createControlClient } from \"../client-75qrAPqf.mjs\";\nimport { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"../migration-path-target-D3Sj55PI.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 { relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { castAs } from \"@internal/utils/casts\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-show.ts\nfunction pkgToPresent(spaceId, pkg, client) {\n\tconst ops = castAs(pkg.ops);\n\tconst rawPreview = client.toOperationPreview(ops) ?? { statements: [] };\n\treturn {\n\t\tspace: spaceId,\n\t\tname: pkg.dirName,\n\t\tfromContract: pkg.metadata.from,\n\t\ttoContract: pkg.metadata.to,\n\t\thash: pkg.metadata.migrationHash,\n\t\tcreatedAt: pkg.metadata.createdAt,\n\t\toperations: ops.map((op) => ({\n\t\t\tid: op.id,\n\t\t\tlabel: op.label,\n\t\t\toperationClass: op.operationClass\n\t\t})),\n\t\tpreview: { statements: [...rawPreview.statements] }\n\t};\n}\nasync function executeMigrationShowCommand(target, options, flags, ui) {\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 header = formatStyledHeader({\n\t\t\tcommand: \"migration show\",\n\t\t\tdescription: \"Display migration package contents\",\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: \"contract\",\n\t\t\t\t\tvalue: contractPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: appMigrationsRelative\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"target\",\n\t\t\t\t\tvalue: target\n\t\t\t\t}\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\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}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to read contract file\" }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet appContract;\n\ttry {\n\t\tappContract = familyInstance.deserializeContract(castAs(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 aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tappContract,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tconst refs = aggregate.app.refs;\n\tlet appPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\tif (!resolved.ok) return resolved;\n\t\tconst matched = findPackageByDirPath(packages, resolved.value);\n\t\tif (!matched) return notOk(errorRuntime(\"Migration package not found\", {\n\t\t\twhy: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n\t\t\tfix: \"Pass a directory name, hash prefix, or path to an on-disk app-space migration package.\"\n\t\t}));\n\t\tappPkg = matched;\n\t} else {\n\t\tif (packages.length === 0) return notOk(errorRuntime(\"No migrations found\", {\n\t\t\twhy: `No migration packages found in ${appMigrationsRelative}`,\n\t\t\tfix: \"Run `prisma-next migration plan` to create a migration first.\"\n\t\t}));\n\t\tconst migResult = parseMigrationRef(target, {\n\t\t\tgraph,\n\t\t\trefs\n\t\t});\n\t\tif (!migResult.ok) return notOk(mapRefResolutionError(migResult.failure));\n\t\tconst matchedPkg = packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\tif (!matchedPkg) return notOk(errorRuntime(\"Migration package not found\", {\n\t\t\twhy: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n\t\t\tfix: \"The migrations directory may be corrupted. Inspect the migration.json files.\"\n\t\t}));\n\t\tappPkg = matchedPkg;\n\t}\n\tconst migration = pkgToPresent(APP_SPACE_ID, appPkg, client);\n\treturn ok({\n\t\tok: true,\n\t\tsummary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,\n\t\tmigration\n\t});\n}\nfunction createMigrationShowCommand() {\n\tconst command = new Command(\"show\");\n\tsetCommandDescriptions(command, \"Display migration package contents\", \"Shows the operations, statement preview, and metadata for one app-space migration.\\nAccepts a directory path, directory name, or hash prefix.\\nOffline — does not consult the database.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration show 20260101_100000_add_user\",\n\t\t\"prisma-next migration show a1b2c3\",\n\t\t\"prisma-next migration show 20260101_100000_add_user --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 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]);\n\taddGlobalOptions(command).argument(\"<target>\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationShowCommand(target, options, flags, ui), flags, ui, (showResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationShowOutput(showResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationShowCommand };\n\n//# sourceMappingURL=migration-show.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,aAAa,SAAS,KAAK,QAAQ;CAC3C,MAAM,MAAM,OAAO,IAAI,GAAG;CAC1B,MAAM,aAAa,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,CAAC,EAAE;CACtE,OAAO;EACN,OAAO;EACP,MAAM,IAAI;EACV,cAAc,IAAI,SAAS;EAC3B,YAAY,IAAI,SAAS;EACzB,MAAM,IAAI,SAAS;EACnB,WAAW,IAAI,SAAS;EACxB,YAAY,IAAI,KAAK,QAAQ;GAC5B,IAAI,GAAG;GACP,OAAO,GAAG;GACV,gBAAgB,GAAG;EACp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I;EACJ,SAAS,aAAa,UAAU,KAAK,MAAM,UAAU,MAAM,IAAI,UAAU,WAAW,OAAO;EAC3F;CACD,CAAC;AACF;AACA,SAAS,6BAA6B;CACrC,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,uBAAuB,SAAS,sCAAsC,yLAAyL;CAC/P,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,kBAAkB,SAAS;EAC1B;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,SAAS,YAAY,gEAAgE,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY;EAC7M,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,4BAA4B,QAAQ,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,eAAe;GACvH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,OAAO,GAAG,IAAI,0BAA0B,YAAY,KAAK,CAAC;EAC3E,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"migration-show-PTC1gUjq.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-show.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, E as formatMigrationShowOutput, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { t as createControlClient } from \"../client-75qrAPqf.mjs\";\nimport { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"../migration-path-target-D3Sj55PI.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 { relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { castAs } from \"@internal/utils/casts\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-show.ts\nfunction pkgToPresent(spaceId, pkg, client) {\n\tconst ops = castAs(pkg.ops);\n\tconst rawPreview = client.toOperationPreview(ops) ?? { statements: [] };\n\treturn {\n\t\tspace: spaceId,\n\t\tname: pkg.dirName,\n\t\tfromContract: pkg.metadata.from,\n\t\ttoContract: pkg.metadata.to,\n\t\thash: pkg.metadata.migrationHash,\n\t\tcreatedAt: pkg.metadata.createdAt,\n\t\toperations: ops.map((op) => ({\n\t\t\tid: op.id,\n\t\t\tlabel: op.label,\n\t\t\toperationClass: op.operationClass\n\t\t})),\n\t\tpreview: { statements: [...rawPreview.statements] }\n\t};\n}\nasync function executeMigrationShowCommand(target, options, flags, ui) {\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 header = formatStyledHeader({\n\t\t\tcommand: \"migration show\",\n\t\t\tdescription: \"Display migration package contents\",\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: \"contract\",\n\t\t\t\t\tvalue: contractPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: appMigrationsRelative\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"target\",\n\t\t\t\t\tvalue: target\n\t\t\t\t}\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\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}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to read contract file\" }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet appContract;\n\ttry {\n\t\tappContract = familyInstance.deserializeContract(castAs(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 aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tappContract,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tconst refs = aggregate.app.refs;\n\tlet appPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\tif (!resolved.ok) return resolved;\n\t\tconst matched = findPackageByDirPath(packages, resolved.value);\n\t\tif (!matched) return notOk(errorRuntime(\"Migration package not found\", {\n\t\t\twhy: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n\t\t\tfix: \"Pass a directory name, hash prefix, or path to an on-disk app-space migration package.\"\n\t\t}));\n\t\tappPkg = matched;\n\t} else {\n\t\tif (packages.length === 0) return notOk(errorRuntime(\"No migrations found\", {\n\t\t\twhy: `No migration packages found in ${appMigrationsRelative}`,\n\t\t\tfix: \"Run `prisma-next migration plan` to create a migration first.\"\n\t\t}));\n\t\tconst migResult = parseMigrationRef(target, {\n\t\t\tgraph,\n\t\t\trefs\n\t\t});\n\t\tif (!migResult.ok) return notOk(mapRefResolutionError(migResult.failure));\n\t\tconst matchedPkg = packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\tif (!matchedPkg) return notOk(errorRuntime(\"Migration package not found\", {\n\t\t\twhy: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n\t\t\tfix: \"The migrations directory may be corrupted. Inspect the migration.json files.\"\n\t\t}));\n\t\tappPkg = matchedPkg;\n\t}\n\tconst migration = pkgToPresent(APP_SPACE_ID, appPkg, client);\n\treturn ok({\n\t\tok: true,\n\t\tsummary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,\n\t\tmigration\n\t});\n}\nfunction createMigrationShowCommand() {\n\tconst command = new Command(\"show\");\n\tsetCommandDescriptions(command, \"Display migration package contents\", \"Shows the operations, statement preview, and metadata for one app-space migration.\\nAccepts a directory path, directory name, or hash prefix.\\nOffline — does not consult the database.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration show 20260101_100000_add_user\",\n\t\t\"prisma-next migration show a1b2c3\",\n\t\t\"prisma-next migration show 20260101_100000_add_user --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 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]);\n\taddGlobalOptions(command).argument(\"<target>\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationShowCommand(target, options, flags, ui), flags, ui, (showResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationShowOutput(showResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationShowCommand };\n\n//# sourceMappingURL=migration-show.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,aAAa,SAAS,KAAK,QAAQ;CAC3C,MAAM,MAAM,OAAO,IAAI,GAAG;CAC1B,MAAM,aAAa,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,CAAC,EAAE;CACtE,OAAO;EACN,OAAO;EACP,MAAM,IAAI;EACV,cAAc,IAAI,SAAS;EAC3B,YAAY,IAAI,SAAS;EACzB,MAAM,IAAI,SAAS;EACnB,WAAW,IAAI,SAAS;EACxB,YAAY,IAAI,KAAK,QAAQ;GAC5B,IAAI,GAAG;GACP,OAAO,GAAG;GACV,gBAAgB,GAAG;EACpB,EAAE;EACF,SAAS,EAAE,YAAY,CAAC,GAAG,WAAW,UAAU,EAAE;CACnD;AACD;AACA,eAAe,4BAA4B,QAAQ,SAAS,OAAO,IAAI;CACtE,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MA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AAS,sCAAsC,yLAAyL;CAC/P,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,kBAAkB,SAAS;EAC1B;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,SAAS,YAAY,gEAAgE,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY;EAC7M,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,4BAA4B,QAAQ,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,eAAe;GACvH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,OAAO,GAAG,IAAI,0BAA0B,YAAY,KAAK,CAAC;EAC3E,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
package/dist/{migration-status-CFlzlRmu-DewBN8Ys.mjs → migration-status-CE7cQLDq-BNFyJssP.mjs}
RENAMED
|
@@ -2,18 +2,18 @@ import { O as errorNoInvariantPath, P as errorUnknownInvariant, t as MigrationTo
|
|
|
2
2
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
3
|
import { a as findPath, o as findPathWithDecision } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
|
|
4
4
|
import { $ as maskConnectionUrl, N as errorUnexpected, Q as mapRefResolutionError, W as formatStyledHeader, Z as mapMigrationToolsError, at as resolveMigrationPaths, ct as setCommandExamples, dt as toStructuralEdge, i as collectDeclaredInvariants, lt as setCommandSeeAlso, nt as readContractEnvelope, o as createTerminalUI, q as handleResult, r as addGlobalOptions, rt as requireLiveDatabase, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
5
|
-
import { r as loadConfig } from "./exports-
|
|
5
|
+
import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
|
|
6
6
|
import { i as readRefs } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
|
|
7
7
|
import { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
|
|
8
|
-
import { t as createControlClient } from "./client-75qrAPqf-
|
|
8
|
+
import { t as createControlClient } from "./client-75qrAPqf-DRg33_uJ.mjs";
|
|
9
9
|
import { n as parseContractRef } from "./ref-resolution-BjJBWPjX.mjs";
|
|
10
10
|
import { _ as renderMigrationGraphSpaceTree, a as computeGlobalMaxDirNameWidth, f as indentMigrationGraphTreeBlock, g as renderMigrationGraphLegend, o as computeGlobalMaxEdgeTreePrefixWidth } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
11
|
-
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "./migration-list-BFBeo1_X-
|
|
11
|
+
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "./migration-list-BFBeo1_X-DwyOI0w9.mjs";
|
|
12
12
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
13
13
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
14
14
|
import { dim, yellow } from "colorette";
|
|
15
15
|
import { Command } from "commander";
|
|
16
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-status-
|
|
16
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-status-CE7cQLDq.mjs
|
|
17
17
|
function deriveStatusEdgeAnnotations(input) {
|
|
18
18
|
const annotations = /* @__PURE__ */ new Map();
|
|
19
19
|
if (input.showAppliedOverlay) {
|
|
@@ -441,4 +441,4 @@ function createMigrationStatusCommand() {
|
|
|
441
441
|
//#endregion
|
|
442
442
|
export { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };
|
|
443
443
|
|
|
444
|
-
//# sourceMappingURL=migration-status-
|
|
444
|
+
//# sourceMappingURL=migration-status-CE7cQLDq-BNFyJssP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-status-CE7cQLDq-BNFyJssP.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-status-CE7cQLDq.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from \"./migration-list-BFBeo1_X.mjs\";\nimport \"./schemas-KhXMzNA_.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 { dim, yellow } from \"colorette\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findPath, findPathWithDecision } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-status-overlay.ts\nfunction deriveStatusEdgeAnnotations(input) {\n\tconst annotations = /* @__PURE__ */ new Map();\n\tif (input.showAppliedOverlay) {\n\t\tfor (const edge of input.graph.migrationByHash.values()) if (input.appliedMigrationHashes.has(edge.migrationHash)) annotations.set(edge.migrationHash, { status: \"applied\" });\n\t}\n\tif (!input.graph.nodes.has(input.originHash)) return annotations;\n\tconst pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n\tif (!pendingPath) return annotations;\n\tfor (const edge of pendingPath) {\n\t\tif (input.appliedMigrationHashes.has(edge.migrationHash)) continue;\n\t\tif (annotations.get(edge.migrationHash)?.status === \"applied\") continue;\n\t\tannotations.set(edge.migrationHash, { status: \"pending\" });\n\t}\n\treturn annotations;\n}\nfunction appliedHashesFromLedger(ledgerEntries) {\n\treturn new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\nfunction statusForMigrationHash(migrationHash, annotations) {\n\treturn annotations.get(migrationHash)?.status ?? null;\n}\n//#endregion\n//#region src/commands/migration-status.ts\nfunction shortDisplayHash(hash) {\n\treturn hash.slice(0, 12);\n}\nfunction resolveTarget(contractHash, activeRefHash) {\n\treturn activeRefHash ?? contractHash;\n}\nfunction buildStatusMigrations(listMigrations, annotations) {\n\treturn listMigrations.map((migration) => ({\n\t\t...migration,\n\t\tstatus: statusForMigrationHash(migration.hash, annotations)\n\t}));\n}\nfunction renderSpaceTree(args) {\n\tconst graph = args.space.graph();\n\tif (graph.nodes.size === 0) return \"\";\n\treturn renderMigrationGraphSpaceTree({\n\t\tgraph,\n\t\tmigrations: args.migrations,\n\t\tliveContractHash: args.liveContractHash,\n\t\trefsByHash: listRefsByContractHash(args.space),\n\t\tstatusOverlayByHash: args.statusOverlay,\n\t\tcolorize: args.colorize,\n\t\tglyphMode: args.glyphMode,\n\t\tisAppSpace: args.isAppSpace,\n\t\t...args.showDbMarker && args.markerHash !== void 0 ? { dbHash: args.markerHash } : {},\n\t\t...args.globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth: args.globalMaxEdgeTreePrefixWidth } : {},\n\t\t...args.globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth: args.globalMaxDirNameWidth } : {}\n\t});\n}\nfunction countPending(migrations) {\n\treturn migrations.filter((m) => m.status === \"pending\").length;\n}\nfunction buildNoPathSummary(args) {\n\tconst markerPart = args.markerHash !== void 0 ? `the database state (${shortDisplayHash(args.markerHash)})` : \"the database state\";\n\tconst targetShort = shortDisplayHash(args.targetHash);\n\tif (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \\`prisma-next migration plan --name <name>\\` to author one.`;\n\treturn `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \\`${args.refName}\\`)` : `the target (${targetShort})`}. Run \\`prisma-next migration plan --name <name>\\` to author one, or pass \\`--to <contract>\\` to pick a reachable target.`;\n}\nfunction buildStatusHeadline(args) {\n\tif (args.markerDiverged && args.markerHash !== void 0) return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;\n\tif (args.pendingCount === 0) return \"Up to date\";\n\treturn `${args.pendingCount} pending — run \\`prisma-next migrate --to ${shortDisplayHash(args.targetHash)}\\``;\n}\nfunction formatStatusSummary(result, colorize) {\n\tconst c = (fn, s) => colorize ? fn(s) : s;\n\tconst lines = [];\n\tconst pendingTotal = result.spaces.reduce((sum, space) => sum + countPending(space.migrations), 0);\n\tif (result.diagnostics.some((d) => d.code === \"MIGRATION.MARKER_NOT_IN_HISTORY\") || pendingTotal > 0) lines.push(c(yellow, result.summary));\n\telse lines.push(result.summary);\n\tconst missingInvariantsDiagnostic = result.diagnostics.find((d) => d.code === \"MIGRATION.MISSING_INVARIANTS\");\n\tif (missingInvariantsDiagnostic !== void 0) lines.push(c(dim, missingInvariantsDiagnostic.message));\n\treturn lines.join(\"\\n\");\n}\nfunction formatStatusHumanOutput(result, colorize) {\n\tconst sections = [];\n\tfor (const section of result.treeSections) {\n\t\tif (section.showHeading) sections.push(`${section.space}:`);\n\t\tif (section.tree.length > 0) sections.push(section.tree);\n\t\telse sections.push(\"(no migrations)\");\n\t\tsections.push(\"\");\n\t}\n\tsections.push(formatStatusSummary(result, colorize));\n\treturn sections.join(\"\\n\").trimEnd();\n}\nasync function readMarkersAndLedgers(args) {\n\tconst markersBySpace = /* @__PURE__ */ new Map();\n\tconst all = await args.client.readAllMarkers();\n\tfor (const [spaceId, marker] of all) markersBySpace.set(spaceId, marker);\n\tconst ledgersBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of args.spaceIds) ledgersBySpace.set(spaceId, await args.client.readLedger(spaceId));\n\treturn {\n\t\tmarkersBySpace,\n\t\tledgersBySpace\n\t};\n}\nasync function executeMigrationStatusCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst usingFromOverride = options.from !== void 0;\n\tif (!usingFromOverride) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migration status needs a database connection to read the marker and ledger (or pass --from for offline path preview)\",\n\t\t\tretryCommand: \"prisma-next migration status --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tthrow error;\n\t}\n\tconst diagnostics = [];\n\tlet contractHash = EMPTY_CONTRACT_HASH;\n\ttry {\n\t\tcontractHash = (await readContractEnvelope(config)).storageHash;\n\t} catch (error) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"CONTRACT.UNREADABLE\",\n\t\t\tseverity: \"warn\",\n\t\t\tmessage: `Could not read contract: ${error instanceof Error ? error.message : \"unknown error\"}`,\n\t\t\thints: [\"Run 'prisma-next contract emit' to generate a valid contract\"]\n\t\t});\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate } = loaded.value;\n\tif (await loadContractRawSafely(config) !== null) {\n\t\tconst corruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\t\tif (corruptionFailure) return notOk(corruptionFailure);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tlet activeRefHash;\n\tlet activeRefName;\n\tlet activeRefEntry;\n\tlet fromOverrideHash;\n\tif (options.to) {\n\t\tconst refResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tactiveRefHash = refResult.value.hash;\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\tactiveRefName = refResult.value.provenance.refName;\n\t\t\tactiveRefEntry = allRefs[activeRefName];\n\t\t}\n\t}\n\tif (options.from) {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tfromOverrideHash = fromResult.value.hash;\n\t}\n\tconst requiredInvariants = [...activeRefEntry?.invariants ?? []].sort();\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && hasDriver) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (activeRefName) details.push({\n\t\t\tlabel: \"ref\",\n\t\t\tvalue: activeRefName\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.space) details.push({\n\t\t\tlabel: \"space\",\n\t\t\tvalue: options.space\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration status\",\n\t\t\tdescription: \"Show migration history and applied status\",\n\t\t\tdetails,\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 listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst showSpaceHeadings = scopedSpaces.length > 1;\n\tlet markersBySpace = /* @__PURE__ */ new Map();\n\tlet ledgersBySpace = /* @__PURE__ */ new Map();\n\tlet connected = false;\n\tif (dbConnection && hasDriver && !usingFromOverride) {\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconnected = true;\n\t\t\tconst read = await readMarkersAndLedgers({\n\t\t\t\tclient,\n\t\t\t\tspaceIds: scopedSpaces.map((s) => s.space)\n\t\t\t});\n\t\t\tmarkersBySpace = new Map(read.markersBySpace);\n\t\t\tledgersBySpace = new Map(read.ledgersBySpace);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read database state: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tif (activeRefEntry && activeRefEntry.invariants.length > 0 && connected) {\n\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst known = new Set(declared);\n\t\tfor (const id of markerInvariants) known.add(id);\n\t\tconst unknown = activeRefEntry.invariants.filter((id) => !known.has(id));\n\t\tif (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({\n\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\tunknown,\n\t\t\tdeclared: [...declared].sort()\n\t\t})));\n\t}\n\tconst showAppliedOverlay = connected && !usingFromOverride;\n\tconst showDbMarker = connected && !usingFromOverride;\n\tconst glyphMode = ui.resolveGlyphMode(options.ascii === true);\n\tconst colorize = flags.color !== false;\n\tconst statusSpaces = [];\n\tconst treeSections = [];\n\tlet markerDiverged = false;\n\tlet markerCannotReachTarget = false;\n\tlet headlineTargetHash = activeRefHash ?? contractHash;\n\tlet totalPending = 0;\n\tconst globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({\n\t\tgraph: aggregate.space(spaceEntry.space).graph(),\n\t\tliveContractHash: contractHash\n\t})) : [];\n\tconst globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;\n\tconst globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;\n\tfor (const spaceEntry of scopedSpaces) {\n\t\tconst space = aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst spaceContractHash = space.contract().storage.storageHash;\n\t\tconst targetHash = resolveTarget(spaceContractHash, activeRefHash);\n\t\tif (spaceEntry.space === aggregate.app.spaceId) headlineTargetHash = targetHash;\n\t\tconst markerRecord = markersBySpace.get(spaceEntry.space);\n\t\tconst markerHash = usingFromOverride ? fromOverrideHash : markerRecord?.storageHash ?? void 0;\n\t\tconst originHash = markerHash ?? EMPTY_CONTRACT_HASH;\n\t\tconst markerInGraph = markerHash === void 0 || graph.nodes.has(markerHash) || markerHash === spaceContractHash;\n\t\tif (connected && !usingFromOverride && markerInGraph && originHash !== targetHash && findPath(graph, originHash, targetHash) === null) markerCannotReachTarget = true;\n\t\tif (connected && !usingFromOverride && markerHash !== void 0 && !markerInGraph) {\n\t\t\tmarkerDiverged = true;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MARKER_NOT_IN_HISTORY\",\n\t\t\t\tseverity: \"warn\",\n\t\t\t\tmessage: \"Database was updated outside the migration system (marker does not match any migration)\",\n\t\t\t\thints: [\"Run 'prisma-next db sign' to overwrite the marker if the database already matches the contract\", \"Run 'prisma-next db update' to push the current contract to the database\"]\n\t\t\t});\n\t\t}\n\t\tconst ledger = ledgersBySpace.get(spaceEntry.space) ?? [];\n\t\tconst annotations = deriveStatusEdgeAnnotations({\n\t\t\tgraph,\n\t\t\ttargetHash,\n\t\t\toriginHash,\n\t\t\tappliedMigrationHashes: showAppliedOverlay ? appliedHashesFromLedger(ledger) : /* @__PURE__ */ new Set(),\n\t\t\tshowAppliedOverlay\n\t\t});\n\t\tconst isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n\t\tconst tree = renderSpaceTree({\n\t\t\tspace,\n\t\t\tliveContractHash: contractHash,\n\t\t\tmigrations: spaceEntry.migrations,\n\t\t\tmarkerHash,\n\t\t\tshowDbMarker,\n\t\t\tstatusOverlay: annotations,\n\t\t\tcolorize,\n\t\t\tglyphMode,\n\t\t\tisAppSpace,\n\t\t\t...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},\n\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t});\n\t\tconst migrations = buildStatusMigrations(spaceEntry.migrations, annotations);\n\t\tconst pending = countPending(migrations);\n\t\ttotalPending += pending;\n\t\tstatusSpaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcurrentContract: markerHash ?? null,\n\t\t\ttargetContract: targetHash,\n\t\t\tmigrations: [...migrations]\n\t\t});\n\t\tconst displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, \" \") : tree;\n\t\ttreeSections.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\ttree: displayTree,\n\t\t\tshowHeading: showSpaceHeadings\n\t\t});\n\t}\n\tif (connected && requiredInvariants.length > 0) {\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst markerSet = new Set(markerInvariants);\n\t\tconst missing = requiredInvariants.filter((id) => !markerSet.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MISSING_INVARIANTS\",\n\t\t\t\t...ifDefined(\"ref\", activeRefName),\n\t\t\t\tinvariants: missing,\n\t\t\t\tmessage: `missing invariant(s): ${missing.join(\", \")}`\n\t\t\t});\n\t\t\tif (activeRefHash !== void 0) {\n\t\t\t\tconst outcome = findPathWithDecision(appGraph, markersBySpace.get(aggregate.app.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH, activeRefHash, {\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: new Set(missing)\n\t\t\t\t});\n\t\t\t\tif (outcome.kind === \"unsatisfiable\") return notOk(mapMigrationToolsError(errorNoInvariantPath({\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: [...missing].sort(),\n\t\t\t\t\tmissing: outcome.missing,\n\t\t\t\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t\t\t\t})));\n\t\t\t}\n\t\t}\n\t}\n\tconst appMarkerHash = markersBySpace.get(aggregate.app.spaceId)?.storageHash;\n\tconst summary = markerCannotReachTarget ? buildNoPathSummary({\n\t\tmarkerHash: appMarkerHash,\n\t\ttargetHash: headlineTargetHash,\n\t\texplicitTarget: options.to !== void 0,\n\t\trefName: activeRefName\n\t}) : buildStatusHeadline({\n\t\tpendingCount: totalPending,\n\t\ttargetHash: headlineTargetHash,\n\t\tmarkerDiverged,\n\t\tmarkerHash: appMarkerHash\n\t});\n\tif (scopedSpaces.every((s) => s.migrations.length === 0)) return ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary: \"No migrations found\",\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n\treturn ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary,\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n}\nfunction createMigrationStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show migration path and pending status\", \"Shows which migrations are pending between the database marker and\\nthe target contract. Requires a database connection.\\nPass --from for an offline path preview without a database.\\nUse `migration graph` for topology, `migration log` for history,\\nand `migration list` for on-disk enumeration.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration status --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --from abc123 --to production\",\n\t\t\"prisma-next migration status --from abc123 --to production --json\",\n\t\t\"prisma-next migration status --ascii --from abc123 --to production\",\n\t\t\"prisma-next migration status --legend --from abc123 --to production\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration 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(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--from <contract>\", \"Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").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 legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationStatusCommand(options, flags, ui), flags, ui, (statusResult) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...statusResult.spaces],\n\t\t\t\t\tsummary: statusResult.summary,\n\t\t\t\t\tdiagnostics: [...statusResult.diagnostics]\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatStatusHumanOutput(statusResult, flags.color !== false));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };\n\n//# sourceMappingURL=migration-status-CE7cQL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kB,SAAS;EAC1B;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,gBAAgB,0CAA0C,CAAC,CAAC,OAAO,mBAAmB,2FAA2F,CAAC,CAAC,OAAO,qBAAqB,yGAAyG,CAAC,CAAC,OAAO,YAAY,iDAAiD,CAAC,CAAC,OAAO,WAAW,kCAAkC,CAAC,CAAC,OAAO,OAAO,YAAY;EAC9lB,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IAAI,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAChF,MAAM,WAAW,aAAa,MAAM,8BAA8B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,iBAAiB;GACnH,IAAI,MAAM,MAAM;IACf,MAAM,aAAa;KAClB,IAAI;KACJ,QAAQ,CAAC,GAAG,aAAa,MAAM;KAC/B,SAAS,aAAa;KACtB,aAAa,CAAC,GAAG,aAAa,WAAW;IAC1C;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,wBAAwB,cAAc,MAAM,UAAU,KAAK,CAAC;EAChG,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -3,7 +3,7 @@ import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contr
|
|
|
3
3
|
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
4
4
|
import { r as findLatestMigration } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
|
|
5
5
|
import { E as errorRefSetHashNotInGraph, N as errorUnexpected, O as errorRuntime$1, P as formatCommandHelp, Q as mapRefResolutionError, T as errorRefSetEmptySentinel, Z as mapMigrationToolsError, at as resolveMigrationPaths, et as parseGlobalFlags, h as errorFileNotFound, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, w as errorRefSetBundleNotFound } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
6
|
-
import { r as loadConfig } from "./exports-
|
|
6
|
+
import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
|
|
7
7
|
import { n as isGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
|
|
8
8
|
import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, u as validateRefValue } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
|
|
9
9
|
import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
|
|
@@ -168,4 +168,4 @@ function createRefCommand() {
|
|
|
168
168
|
//#endregion
|
|
169
169
|
export { executeRefSetCommand as i, executeRefDeleteCommand as n, executeRefListCommand as r, createRefCommand as t };
|
|
170
170
|
|
|
171
|
-
//# sourceMappingURL=ref-
|
|
171
|
+
//# sourceMappingURL=ref-tjLWCeGO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-B6cTthTi.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/ref.mjs"],"sourcesContent":["import { $ as errorRefSetBundleNotFound, F as CliStructuredError, O as formatCommandHelp, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, et as errorRefSetEmptySentinel, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapMigrationToolsError, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorRefSetHashNotInGraph, ut as mapRefResolutionError, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate } from \"../contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join } from \"pathe\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { deleteRef, readRefs, validateRefName, validateRefValue, writeRef } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/ref.ts\nfunction mapError(error) {\n\tif (MigrationToolsError.is(error)) return mapMigrationToolsError(error);\n\treturn errorUnexpected(error instanceof Error ? error.message : String(error));\n}\nfunction cliErrorInvalidRefName(name) {\n\treturn errorRuntime(`Invalid ref name \"${name}\"`, {\n\t\twhy: `Ref name \"${name}\" does not match the required format`,\n\t\tfix: \"Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments\"\n\t});\n}\nasync function executeRefSetCommand(name, contractInput, options) {\n\tif (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\t\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tlet resolvedHash;\n\t\tif (validateRefValue(contractInput)) resolvedHash = contractInput;\n\t\telse {\n\t\t\tconst refResult = parseContractRef(contractInput, {\n\t\t\t\tgraph,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\t\tresolvedHash = refResult.value.hash;\n\t\t}\n\t\tif (resolvedHash === EMPTY_CONTRACT_HASH) return notOk(errorRefSetEmptySentinel(resolvedHash));\n\t\tif (!isGraphNode(resolvedHash, graph)) {\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\treturn notOk(errorRefSetHashNotInGraph(resolvedHash, [...graph.nodes].sort(), graphTip));\n\t\t}\n\t\tif (!bundles.find((bundle) => bundle.metadata.to === resolvedHash)) return notOk(errorRefSetBundleNotFound(resolvedHash));\n\t\tconst contractJsonPath = join(contractSnapshotDir(migrationsDir, resolvedHash), \"contract.json\");\n\t\ttry {\n\t\t\tawait readContractSnapshotJson(migrationsDir, resolvedHash);\n\t\t} catch (readError) {\n\t\t\tif (MigrationToolsError.is(readError) && readError.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return notOk(errorFileNotFound(contractJsonPath, {\n\t\t\t\twhy: `Migration bundle for hash ${resolvedHash} is missing its contract snapshot at ${contractJsonPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t\t}));\n\t\t\tthrow readError;\n\t\t}\n\t\tawait writeRef(refsDir, name, {\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefDeleteCommand(name, options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\tawait deleteRef(refsDir, name);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\tdeleted: true\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefListCommand(options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\trefs: await readRefs(refsDir)\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nfunction createRefSetCommand() {\n\tconst command = new Command(\"set\");\n\tsetCommandDescriptions(command, \"Set a ref to a contract reference\", \"Sets a named ref to point to a resolved contract reference (hash, alias, or path) in migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name (e.g., staging, production)\").argument(\"<contract>\", \"Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, hash, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefSetCommand(name, hash, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Set ref \"${value.ref}\" → ${value.hash}`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefDeleteCommand() {\n\tconst command = new Command(\"delete\");\n\tsetCommandDescriptions(command, \"Delete a ref\", \"Removes a named ref from migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name to delete\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefDeleteCommand(name, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Deleted ref \"${value.ref}\"`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List all refs\", \"Lists all named refs from migrations/refs/.\");\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefListCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tconst entries = Object.entries(value.refs);\n\t\t\t\tif (entries.length === 0) ui.output(\"No refs defined\");\n\t\t\t\telse for (const [refName, entry] of entries) {\n\t\t\t\t\tconst invariantsSuffix = entry.invariants.length > 0 ? ` [invariants: ${entry.invariants.join(\", \")}]` : \"\";\n\t\t\t\t\tui.output(`${refName} → ${entry.hash}${invariantsSuffix}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefCommand() {\n\tconst command = new Command(\"ref\");\n\tsetCommandDescriptions(command, \"Manage contract refs\", \"Manage named refs in migrations/refs/. Refs map logical environment\\nnames (e.g., staging, production) to contract hashes.\");\n\taddGlobalOptions(command).configureHelp({\n\t\tformatHelp: (cmd) => formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t}),\n\t\tsubcommandDescription: () => \"\"\n\t});\n\tcommand.addCommand(createRefSetCommand());\n\tcommand.addCommand(createRefDeleteCommand());\n\tcommand.addCommand(createRefListCommand());\n\treturn command;\n}\n//#endregion\nexport { createRefCommand, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand };\n\n//# sourceMappingURL=ref.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,SAAS,SAAS,OAAO;CACxB,IAAI,oBAAoB,GAAG,KAAK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M;CAClC,uBAAuB,SAAS,iBAAiB,6CAA6C;CAC9F,iBAAiB,OAAO,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EAC9G,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,sBAAsB,OAAO,GAAG,OAAO,KAAK,UAAU;GACzF,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,KAAK,CAAC;QAC1C,IAAI,CAAC,MAAM,OAAO;IACtB,MAAM,UAAU,OAAO,QAAQ,MAAM,IAAI;IACzC,IAAI,QAAQ,WAAW,GAAG,GAAG,OAAO,iBAAiB;SAChD,KAAK,MAAM,CAAC,SAAS,UAAU,SAAS;KAC5C,MAAM,mBAAmB,MAAM,WAAW,SAAS,IAAI,iBAAiB,MAAM,WAAW,KAAK,IAAI,EAAE,KAAK;KACzG,GAAG,OAAO,GAAG,QAAQ,KAAK,MAAM,OAAO,kBAAkB;IAC1D;GACD;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR;AACA,SAAS,mBAAmB;CAC3B,MAAM,UAAU,IAAI,QAAQ,KAAK;CACjC,uBAAuB,SAAS,wBAAwB,4HAA4H;CACpL,iBAAiB,OAAO,CAAC,CAAC,cAAc;EACvC,aAAa,QAAQ,kBAAkB;GACtC,SAAS;GACT,OAAO,iBAAiB,CAAC,CAAC;EAC3B,CAAC;EACD,6BAA6B;CAC9B,CAAC;CACD,QAAQ,WAAW,oBAAoB,CAAC;CACxC,QAAQ,WAAW,uBAAuB,CAAC;CAC3C,QAAQ,WAAW,qBAAqB,CAAC;CACzC,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"ref-tjLWCeGO.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/ref.mjs"],"sourcesContent":["import { $ as errorRefSetBundleNotFound, F as CliStructuredError, O as formatCommandHelp, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, et as errorRefSetEmptySentinel, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapMigrationToolsError, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorRefSetHashNotInGraph, ut as mapRefResolutionError, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate } from \"../contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join } from \"pathe\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { deleteRef, readRefs, validateRefName, validateRefValue, writeRef } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/ref.ts\nfunction mapError(error) {\n\tif (MigrationToolsError.is(error)) return mapMigrationToolsError(error);\n\treturn errorUnexpected(error instanceof Error ? error.message : String(error));\n}\nfunction cliErrorInvalidRefName(name) {\n\treturn errorRuntime(`Invalid ref name \"${name}\"`, {\n\t\twhy: `Ref name \"${name}\" does not match the required format`,\n\t\tfix: \"Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments\"\n\t});\n}\nasync function executeRefSetCommand(name, contractInput, options) {\n\tif (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\t\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tlet resolvedHash;\n\t\tif (validateRefValue(contractInput)) resolvedHash = contractInput;\n\t\telse {\n\t\t\tconst refResult = parseContractRef(contractInput, {\n\t\t\t\tgraph,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\t\tresolvedHash = refResult.value.hash;\n\t\t}\n\t\tif (resolvedHash === EMPTY_CONTRACT_HASH) return notOk(errorRefSetEmptySentinel(resolvedHash));\n\t\tif (!isGraphNode(resolvedHash, graph)) {\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\treturn notOk(errorRefSetHashNotInGraph(resolvedHash, [...graph.nodes].sort(), graphTip));\n\t\t}\n\t\tif (!bundles.find((bundle) => bundle.metadata.to === resolvedHash)) return notOk(errorRefSetBundleNotFound(resolvedHash));\n\t\tconst contractJsonPath = join(contractSnapshotDir(migrationsDir, resolvedHash), \"contract.json\");\n\t\ttry {\n\t\t\tawait readContractSnapshotJson(migrationsDir, resolvedHash);\n\t\t} catch (readError) {\n\t\t\tif (MigrationToolsError.is(readError) && readError.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return notOk(errorFileNotFound(contractJsonPath, {\n\t\t\t\twhy: `Migration bundle for hash ${resolvedHash} is missing its contract snapshot at ${contractJsonPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t\t}));\n\t\t\tthrow readError;\n\t\t}\n\t\tawait writeRef(refsDir, name, {\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefDeleteCommand(name, options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\tawait deleteRef(refsDir, name);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\tdeleted: true\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefListCommand(options) {\n\ttry {\n\t\tconst config = await loadConfig(options.config);\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, config);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\trefs: await readRefs(refsDir)\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nfunction createRefSetCommand() {\n\tconst command = new Command(\"set\");\n\tsetCommandDescriptions(command, \"Set a ref to a contract reference\", \"Sets a named ref to point to a resolved contract reference (hash, alias, or path) in migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name (e.g., staging, production)\").argument(\"<contract>\", \"Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, hash, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefSetCommand(name, hash, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Set ref \"${value.ref}\" → ${value.hash}`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefDeleteCommand() {\n\tconst command = new Command(\"delete\");\n\tsetCommandDescriptions(command, \"Delete a ref\", \"Removes a named ref from migrations/refs/.\");\n\taddGlobalOptions(command).argument(\"<name>\", \"Ref name to delete\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (name, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefDeleteCommand(name, options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) ui.output(`Deleted ref \"${value.ref}\"`);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List all refs\", \"Lists all named refs from migrations/refs/.\");\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeRefListCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tconst entries = Object.entries(value.refs);\n\t\t\t\tif (entries.length === 0) ui.output(\"No refs defined\");\n\t\t\t\telse for (const [refName, entry] of entries) {\n\t\t\t\t\tconst invariantsSuffix = entry.invariants.length > 0 ? ` [invariants: ${entry.invariants.join(\", \")}]` : \"\";\n\t\t\t\t\tui.output(`${refName} → ${entry.hash}${invariantsSuffix}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction createRefCommand() {\n\tconst command = new Command(\"ref\");\n\tsetCommandDescriptions(command, \"Manage contract refs\", \"Manage named refs in migrations/refs/. Refs map logical environment\\nnames (e.g., staging, production) to contract hashes.\");\n\taddGlobalOptions(command).configureHelp({\n\t\tformatHelp: (cmd) => formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t}),\n\t\tsubcommandDescription: () => \"\"\n\t});\n\tcommand.addCommand(createRefSetCommand());\n\tcommand.addCommand(createRefDeleteCommand());\n\tcommand.addCommand(createRefListCommand());\n\treturn command;\n}\n//#endregion\nexport { createRefCommand, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand };\n\n//# sourceMappingURL=ref.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,SAAS,SAAS,OAAO;CACxB,IAAI,oBAAoB,GAAG,KAAK,GAAG,OAAO,uBAAuB,KAAK;CACtE,OAAO,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAC9E;AACA,SAAS,uBAAuB,MAAM;CACrC,OAAOA,eAAa,qBAAqB,KAAK,IAAI;EACjD,KAAK,aAAa,KAAK;EACvB,KAAK;CACN,CAAC;AACF;AACA,eAAe,qBAAqB,MAAM,eAAe,SAAS;CACjE,IAAI,CAAC,gBAAgB,IAAI,GAAG,OAAO,MAAM,uBAAuB,IAAI,CAAC;CACrE,IAAI;EACH,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;EAC9C,MAAM,EAAE,eAAe,YAAY,sBAAsB,QAAQ,QAAQ,MAAM;EAC/E,MAAM,SAAS,MAAM,mBAAmB,QAAQ,EAAE,cAAc,CAAC;EACjE,IAAI,CAAC,OAAO,IAAI,OAAO,MAAM,OAAO,OAAO;EAC3C,MAAM,QAAQ,OAAO,MAAM,UAAU,IAAI,MAAM;EAC/C,MAAM,UAAU,OAAO,MAAM,UAAU,IAAI;EAC3C,MAAM,OAAO,OAAO,MAAM,UAAU,IAAI;EACxC,IAAI;EACJ,IAAI,iBAAiB,aAAa,GAAG,eAAe;OAC/C;GACJ,MAAM,YAAY,iBAAiB,eAAe;IACjD;IACA;GACD,CAAC;GACD,IAAI,CAAC,UAAU,IAAI,OAAO,MAAM,sBAAsB,UAAU,OAAO,CAAC;GACxE,eAAe,UAAU,MAAM;EAChC;EACA,IAAI,iBAAA,SAAsC,OAAO,MAAM,yBAAyB,YAAY,CAAC;EAC7F,IAAI,CAAC,YAAY,cAAc,KAAK,GAAG;GACtC,MAAM,WAAW,oBAAoB,KAA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C,QAAQ,WAAW,qBAAqB,CAAC;CACzC,OAAO;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as disposeEmitQueue, r as executeContractEmit } from "./contract-emit-B6odMoem-
|
|
2
|
-
import { r as getEmittedArtifactPaths } from "./exports-
|
|
3
|
-
import { r as loadConfig } from "./exports-
|
|
1
|
+
import { n as disposeEmitQueue, r as executeContractEmit } from "./contract-emit-B6odMoem-BqLV218x.mjs";
|
|
2
|
+
import { r as getEmittedArtifactPaths } from "./exports-BGMKuMBH-C1_tsw6T.mjs";
|
|
3
|
+
import { r as loadConfig } from "./exports-BTEdvV8H.mjs";
|
|
4
4
|
import { extname, resolve } from "pathe";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs
|
|
6
6
|
const PLUGIN_NAME = "prisma-vite-plugin-contract-emit";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-toolchain",
|
|
3
|
-
"version": "0.17.0-dev.
|
|
3
|
+
"version": "0.17.0-dev.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@clack/prompts": "^1.7.0",
|
|
16
|
-
"@prisma/orm-framework": "0.17.0-dev.
|
|
16
|
+
"@prisma/orm-framework": "0.17.0-dev.3",
|
|
17
17
|
"@vercel/detect-agent": "^1.2.3",
|
|
18
18
|
"arktype": "^2.2.2",
|
|
19
19
|
"c12": "^3.3.4",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"wrap-ansi": "^10.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@internal/cli": "0.17.0-dev.
|
|
38
|
-
"@internal/cli-telemetry": "0.17.0-dev.
|
|
39
|
-
"@internal/config-loader": "0.17.0-dev.
|
|
40
|
-
"@internal/emitter": "0.17.0-dev.
|
|
41
|
-
"@internal/language-server": "0.17.0-dev.
|
|
42
|
-
"@internal/migration-tools": "0.17.0-dev.
|
|
43
|
-
"@internal/publish-surface": "0.17.0-dev.
|
|
44
|
-
"@repo/tsconfig": "0.17.0-dev.
|
|
45
|
-
"@repo/tsdown": "0.17.0-dev.
|
|
46
|
-
"@internal/vite-plugin-contract-emit": "0.17.0-dev.
|
|
37
|
+
"@internal/cli": "0.17.0-dev.3",
|
|
38
|
+
"@internal/cli-telemetry": "0.17.0-dev.3",
|
|
39
|
+
"@internal/config-loader": "0.17.0-dev.3",
|
|
40
|
+
"@internal/emitter": "0.17.0-dev.3",
|
|
41
|
+
"@internal/language-server": "0.17.0-dev.3",
|
|
42
|
+
"@internal/migration-tools": "0.17.0-dev.3",
|
|
43
|
+
"@internal/publish-surface": "0.17.0-dev.3",
|
|
44
|
+
"@repo/tsconfig": "0.17.0-dev.3",
|
|
45
|
+
"@repo/tsdown": "0.17.0-dev.3",
|
|
46
|
+
"@internal/vite-plugin-contract-emit": "0.17.0-dev.3",
|
|
47
47
|
"tsdown": "0.22.14",
|
|
48
48
|
"typescript": "5.9.3"
|
|
49
49
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-check-CcG-fB8r-CDs5C9vt.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-CcG-fB8r.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, _ as createTerminalUI, at as errorSpaceNotFound, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, x as formatErrorOutput } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-D3Sj55PI.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 { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative$1(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative$1(dirPath, fileName) {\n\treturn join(migrationPathRelative$1(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative$1(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative$1(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative$1(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json and ops.json agree.\"\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tfix: \"Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op.\"\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tfix: \"Remove the orphan directory, or declare the extension in `extensions`.\"\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tfix: \"Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused.\"\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tfix: \"Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control.\"\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tfix: \"Re-emit the contract space migrations, or restore the missing migration package.\"\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Repair or remove the corrupt ref file.\"\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tfix: \"Update the extension to target the configured database, or change the project target.\"\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative$1(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tfix: \"Update the contracts so each storage element is owned by exactly one contract space.\"\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative$1(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract.\"\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tfix: \"Re-emit one of the conflicting packages so each migrationHash is unique.\"\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tui.log(` fix: ${f.fix}`);\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-CcG-fB8r.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,wBAAwB,SAAS;CACzC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,wBAAwB,SAAS,UAAU;CACnD,OAAO,KAAK,wBAAwB,OAAO,GAAG,QAAQ;AACvD;;;;;AAKA,SAAS,iCAAiC,WAAW,eAAe;CACnE,MAAM,iBAAiB,YAAY,wBAAwB,KAAK,eAAe,OAAO,CAAC;CACvF,MAAM,mBAAmB,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,OAAO,CAAC;CAC3G,MAAM,eAAe,SAAS,YAAY,wBAAwB,KAAK,eAAe,SAAS,QAAQ,GAAG,QAAQ,MAAM,CAAC;CACzH,QAAQ,UAAU,MAAlB;EACC,KAAK,gBAAgB,OAAO;GAC3B,OAAO,UAAU;GACjB,MAAM;GACN,OAAO,wBAAwB,KAAK,eAAe,UAAU,SAAS,UAAU,OAAO,GAAG,gBAAgB;GAC1G,KAAK,eAAe,UAA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GACrC,MAAM,cAAc,QAAQ,oBAAoB,KAAK,IAAI,aAAa,QAAQ,gBAAgB,KAAK;GACnG,GAAG,IAAI,KAAK,OAAO,UAAU,aAAa;EAC3C,OAAO;GACN,KAAK,MAAM,KAAK,OAAO,UAAU;IAChC,GAAG,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK;IAC3C,GAAG,IAAI,UAAU,EAAE,KAAK;GACzB;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-status-CFlzlRmu-DewBN8Ys.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-status-CFlzlRmu.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from \"./contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { t as createControlClient } from \"./client-75qrAPqf.mjs\";\nimport { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from \"./migration-list-BFBeo1_X.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 { dim, yellow } from \"colorette\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findPath, findPathWithDecision } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migration-status-overlay.ts\nfunction deriveStatusEdgeAnnotations(input) {\n\tconst annotations = /* @__PURE__ */ new Map();\n\tif (input.showAppliedOverlay) {\n\t\tfor (const edge of input.graph.migrationByHash.values()) if (input.appliedMigrationHashes.has(edge.migrationHash)) annotations.set(edge.migrationHash, { status: \"applied\" });\n\t}\n\tif (!input.graph.nodes.has(input.originHash)) return annotations;\n\tconst pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n\tif (!pendingPath) return annotations;\n\tfor (const edge of pendingPath) {\n\t\tif (input.appliedMigrationHashes.has(edge.migrationHash)) continue;\n\t\tif (annotations.get(edge.migrationHash)?.status === \"applied\") continue;\n\t\tannotations.set(edge.migrationHash, { status: \"pending\" });\n\t}\n\treturn annotations;\n}\nfunction appliedHashesFromLedger(ledgerEntries) {\n\treturn new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\nfunction statusForMigrationHash(migrationHash, annotations) {\n\treturn annotations.get(migrationHash)?.status ?? null;\n}\n//#endregion\n//#region src/commands/migration-status.ts\nfunction shortDisplayHash(hash) {\n\treturn hash.slice(0, 12);\n}\nfunction resolveTarget(contractHash, activeRefHash) {\n\treturn activeRefHash ?? contractHash;\n}\nfunction buildStatusMigrations(listMigrations, annotations) {\n\treturn listMigrations.map((migration) => ({\n\t\t...migration,\n\t\tstatus: statusForMigrationHash(migration.hash, annotations)\n\t}));\n}\nfunction renderSpaceTree(args) {\n\tconst graph = args.space.graph();\n\tif (graph.nodes.size === 0) return \"\";\n\treturn renderMigrationGraphSpaceTree({\n\t\tgraph,\n\t\tmigrations: args.migrations,\n\t\tliveContractHash: args.liveContractHash,\n\t\trefsByHash: listRefsByContractHash(args.space),\n\t\tstatusOverlayByHash: args.statusOverlay,\n\t\tcolorize: args.colorize,\n\t\tglyphMode: args.glyphMode,\n\t\tisAppSpace: args.isAppSpace,\n\t\t...args.showDbMarker && args.markerHash !== void 0 ? { dbHash: args.markerHash } : {},\n\t\t...args.globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth: args.globalMaxEdgeTreePrefixWidth } : {},\n\t\t...args.globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth: args.globalMaxDirNameWidth } : {}\n\t});\n}\nfunction countPending(migrations) {\n\treturn migrations.filter((m) => m.status === \"pending\").length;\n}\nfunction buildNoPathSummary(args) {\n\tconst markerPart = args.markerHash !== void 0 ? `the database state (${shortDisplayHash(args.markerHash)})` : \"the database state\";\n\tconst targetShort = shortDisplayHash(args.targetHash);\n\tif (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \\`prisma-next migration plan --name <name>\\` to author one.`;\n\treturn `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \\`${args.refName}\\`)` : `the target (${targetShort})`}. Run \\`prisma-next migration plan --name <name>\\` to author one, or pass \\`--to <contract>\\` to pick a reachable target.`;\n}\nfunction buildStatusHeadline(args) {\n\tif (args.markerDiverged && args.markerHash !== void 0) return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;\n\tif (args.pendingCount === 0) return \"Up to date\";\n\treturn `${args.pendingCount} pending — run \\`prisma-next migrate --to ${shortDisplayHash(args.targetHash)}\\``;\n}\nfunction formatStatusSummary(result, colorize) {\n\tconst c = (fn, s) => colorize ? fn(s) : s;\n\tconst lines = [];\n\tconst pendingTotal = result.spaces.reduce((sum, space) => sum + countPending(space.migrations), 0);\n\tif (result.diagnostics.some((d) => d.code === \"MIGRATION.MARKER_NOT_IN_HISTORY\") || pendingTotal > 0) lines.push(c(yellow, result.summary));\n\telse lines.push(result.summary);\n\tconst missingInvariantsDiagnostic = result.diagnostics.find((d) => d.code === \"MIGRATION.MISSING_INVARIANTS\");\n\tif (missingInvariantsDiagnostic !== void 0) lines.push(c(dim, missingInvariantsDiagnostic.message));\n\treturn lines.join(\"\\n\");\n}\nfunction formatStatusHumanOutput(result, colorize) {\n\tconst sections = [];\n\tfor (const section of result.treeSections) {\n\t\tif (section.showHeading) sections.push(`${section.space}:`);\n\t\tif (section.tree.length > 0) sections.push(section.tree);\n\t\telse sections.push(\"(no migrations)\");\n\t\tsections.push(\"\");\n\t}\n\tsections.push(formatStatusSummary(result, colorize));\n\treturn sections.join(\"\\n\").trimEnd();\n}\nasync function readMarkersAndLedgers(args) {\n\tconst markersBySpace = /* @__PURE__ */ new Map();\n\tconst all = await args.client.readAllMarkers();\n\tfor (const [spaceId, marker] of all) markersBySpace.set(spaceId, marker);\n\tconst ledgersBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of args.spaceIds) ledgersBySpace.set(spaceId, await args.client.readLedger(spaceId));\n\treturn {\n\t\tmarkersBySpace,\n\t\tledgersBySpace\n\t};\n}\nasync function executeMigrationStatusCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst usingFromOverride = options.from !== void 0;\n\tif (!usingFromOverride) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migration status needs a database connection to read the marker and ledger (or pass --from for offline path preview)\",\n\t\t\tretryCommand: \"prisma-next migration status --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tthrow error;\n\t}\n\tconst diagnostics = [];\n\tlet contractHash = EMPTY_CONTRACT_HASH;\n\ttry {\n\t\tcontractHash = (await readContractEnvelope(config)).storageHash;\n\t} catch (error) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"CONTRACT.UNREADABLE\",\n\t\t\tseverity: \"warn\",\n\t\t\tmessage: `Could not read contract: ${error instanceof Error ? error.message : \"unknown error\"}`,\n\t\t\thints: [\"Run 'prisma-next contract emit' to generate a valid contract\"]\n\t\t});\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate } = loaded.value;\n\tif (await loadContractRawSafely(config) !== null) {\n\t\tconst corruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\t\tif (corruptionFailure) return notOk(corruptionFailure);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tlet activeRefHash;\n\tlet activeRefName;\n\tlet activeRefEntry;\n\tlet fromOverrideHash;\n\tif (options.to) {\n\t\tconst refResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tactiveRefHash = refResult.value.hash;\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\tactiveRefName = refResult.value.provenance.refName;\n\t\t\tactiveRefEntry = allRefs[activeRefName];\n\t\t}\n\t}\n\tif (options.from) {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tfromOverrideHash = fromResult.value.hash;\n\t}\n\tconst requiredInvariants = [...activeRefEntry?.invariants ?? []].sort();\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && hasDriver) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (activeRefName) details.push({\n\t\t\tlabel: \"ref\",\n\t\t\tvalue: activeRefName\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.space) details.push({\n\t\t\tlabel: \"space\",\n\t\t\tvalue: options.space\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration status\",\n\t\t\tdescription: \"Show migration history and applied status\",\n\t\t\tdetails,\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 listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst showSpaceHeadings = scopedSpaces.length > 1;\n\tlet markersBySpace = /* @__PURE__ */ new Map();\n\tlet ledgersBySpace = /* @__PURE__ */ new Map();\n\tlet connected = false;\n\tif (dbConnection && hasDriver && !usingFromOverride) {\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconnected = true;\n\t\t\tconst read = await readMarkersAndLedgers({\n\t\t\t\tclient,\n\t\t\t\tspaceIds: scopedSpaces.map((s) => s.space)\n\t\t\t});\n\t\t\tmarkersBySpace = new Map(read.markersBySpace);\n\t\t\tledgersBySpace = new Map(read.ledgersBySpace);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read database state: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tif (activeRefEntry && activeRefEntry.invariants.length > 0 && connected) {\n\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst known = new Set(declared);\n\t\tfor (const id of markerInvariants) known.add(id);\n\t\tconst unknown = activeRefEntry.invariants.filter((id) => !known.has(id));\n\t\tif (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({\n\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\tunknown,\n\t\t\tdeclared: [...declared].sort()\n\t\t})));\n\t}\n\tconst showAppliedOverlay = connected && !usingFromOverride;\n\tconst showDbMarker = connected && !usingFromOverride;\n\tconst glyphMode = ui.resolveGlyphMode(options.ascii === true);\n\tconst colorize = flags.color !== false;\n\tconst statusSpaces = [];\n\tconst treeSections = [];\n\tlet markerDiverged = false;\n\tlet markerCannotReachTarget = false;\n\tlet headlineTargetHash = activeRefHash ?? contractHash;\n\tlet totalPending = 0;\n\tconst globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({\n\t\tgraph: aggregate.space(spaceEntry.space).graph(),\n\t\tliveContractHash: contractHash\n\t})) : [];\n\tconst globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;\n\tconst globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;\n\tfor (const spaceEntry of scopedSpaces) {\n\t\tconst space = aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst spaceContractHash = space.contract().storage.storageHash;\n\t\tconst targetHash = resolveTarget(spaceContractHash, activeRefHash);\n\t\tif (spaceEntry.space === aggregate.app.spaceId) headlineTargetHash = targetHash;\n\t\tconst markerRecord = markersBySpace.get(spaceEntry.space);\n\t\tconst markerHash = usingFromOverride ? fromOverrideHash : markerRecord?.storageHash ?? void 0;\n\t\tconst originHash = markerHash ?? EMPTY_CONTRACT_HASH;\n\t\tconst markerInGraph = markerHash === void 0 || graph.nodes.has(markerHash) || markerHash === spaceContractHash;\n\t\tif (connected && !usingFromOverride && markerInGraph && originHash !== targetHash && findPath(graph, originHash, targetHash) === null) markerCannotReachTarget = true;\n\t\tif (connected && !usingFromOverride && markerHash !== void 0 && !markerInGraph) {\n\t\t\tmarkerDiverged = true;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MARKER_NOT_IN_HISTORY\",\n\t\t\t\tseverity: \"warn\",\n\t\t\t\tmessage: \"Database was updated outside the migration system (marker does not match any migration)\",\n\t\t\t\thints: [\"Run 'prisma-next db sign' to overwrite the marker if the database already matches the contract\", \"Run 'prisma-next db update' to push the current contract to the database\"]\n\t\t\t});\n\t\t}\n\t\tconst ledger = ledgersBySpace.get(spaceEntry.space) ?? [];\n\t\tconst annotations = deriveStatusEdgeAnnotations({\n\t\t\tgraph,\n\t\t\ttargetHash,\n\t\t\toriginHash,\n\t\t\tappliedMigrationHashes: showAppliedOverlay ? appliedHashesFromLedger(ledger) : /* @__PURE__ */ new Set(),\n\t\t\tshowAppliedOverlay\n\t\t});\n\t\tconst isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n\t\tconst tree = renderSpaceTree({\n\t\t\tspace,\n\t\t\tliveContractHash: contractHash,\n\t\t\tmigrations: spaceEntry.migrations,\n\t\t\tmarkerHash,\n\t\t\tshowDbMarker,\n\t\t\tstatusOverlay: annotations,\n\t\t\tcolorize,\n\t\t\tglyphMode,\n\t\t\tisAppSpace,\n\t\t\t...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},\n\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t});\n\t\tconst migrations = buildStatusMigrations(spaceEntry.migrations, annotations);\n\t\tconst pending = countPending(migrations);\n\t\ttotalPending += pending;\n\t\tstatusSpaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcurrentContract: markerHash ?? null,\n\t\t\ttargetContract: targetHash,\n\t\t\tmigrations: [...migrations]\n\t\t});\n\t\tconst displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, \" \") : tree;\n\t\ttreeSections.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\ttree: displayTree,\n\t\t\tshowHeading: showSpaceHeadings\n\t\t});\n\t}\n\tif (connected && requiredInvariants.length > 0) {\n\t\tconst markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n\t\tconst markerSet = new Set(markerInvariants);\n\t\tconst missing = requiredInvariants.filter((id) => !markerSet.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"MIGRATION.MISSING_INVARIANTS\",\n\t\t\t\t...ifDefined(\"ref\", activeRefName),\n\t\t\t\tinvariants: missing,\n\t\t\t\tmessage: `missing invariant(s): ${missing.join(\", \")}`\n\t\t\t});\n\t\t\tif (activeRefHash !== void 0) {\n\t\t\t\tconst outcome = findPathWithDecision(appGraph, markersBySpace.get(aggregate.app.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH, activeRefHash, {\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: new Set(missing)\n\t\t\t\t});\n\t\t\t\tif (outcome.kind === \"unsatisfiable\") return notOk(mapMigrationToolsError(errorNoInvariantPath({\n\t\t\t\t\t...ifDefined(\"refName\", activeRefName),\n\t\t\t\t\trequired: [...missing].sort(),\n\t\t\t\t\tmissing: outcome.missing,\n\t\t\t\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t\t\t\t})));\n\t\t\t}\n\t\t}\n\t}\n\tconst appMarkerHash = markersBySpace.get(aggregate.app.spaceId)?.storageHash;\n\tconst summary = markerCannotReachTarget ? buildNoPathSummary({\n\t\tmarkerHash: appMarkerHash,\n\t\ttargetHash: headlineTargetHash,\n\t\texplicitTarget: options.to !== void 0,\n\t\trefName: activeRefName\n\t}) : buildStatusHeadline({\n\t\tpendingCount: totalPending,\n\t\ttargetHash: headlineTargetHash,\n\t\tmarkerDiverged,\n\t\tmarkerHash: appMarkerHash\n\t});\n\tif (scopedSpaces.every((s) => s.migrations.length === 0)) return ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary: \"No migrations found\",\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n\treturn ok({\n\t\tok: true,\n\t\tspaces: statusSpaces,\n\t\tsummary,\n\t\tdiagnostics,\n\t\ttreeSections\n\t});\n}\nfunction createMigrationStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show migration path and pending status\", \"Shows which migrations are pending between the database marker and\\nthe target contract. Requires a database connection.\\nPass --from for an offline path preview without a database.\\nUse `migration graph` for topology, `migration log` for history,\\nand `migration list` for on-disk enumeration.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration status --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migration status --from abc123 --to production\",\n\t\t\"prisma-next migration status --from abc123 --to production --json\",\n\t\t\"prisma-next migration status --ascii --from abc123 --to production\",\n\t\t\"prisma-next migration status --legend --from abc123 --to production\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration 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(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--from <contract>\", \"Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").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 legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationStatusCommand(options, flags, ui), flags, ui, (statusResult) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...statusResult.spaces],\n\t\t\t\t\tsummary: statusResult.summary,\n\t\t\t\t\tdiagnostics: [...statusResult.diagnostics]\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatStatusHumanOutput(statusResult, flags.color !== false));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };\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