@prisma/orm-toolchain 8.0.0-rc.1-dev.34 → 8.0.0-rc.1-dev.36
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 +6 -6
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/cli.mjs +202 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__commands__migration-check.mjs +1 -1
- package/dist/cli__commands__migration-status.mjs +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/{format-D5x0jz7q-xalz6Fkn.mjs → format-DceifGAK-BJhTdkcO.mjs} +8 -5
- package/dist/format-DceifGAK-BJhTdkcO.mjs.map +1 -0
- package/dist/{init-BvLCfVjC-DOPO-TLF.mjs → init-SY01IBU--CQFYh2As.mjs} +2 -2
- package/dist/{init-BvLCfVjC-DOPO-TLF.mjs.map → init-SY01IBU--CQFYh2As.mjs.map} +1 -1
- package/dist/{migration-check-aoZ8kXNA-DX2J84Cv.mjs → migration-check-BHiINj74-CVazN1LV.mjs} +2 -2
- package/dist/migration-check-BHiINj74-CVazN1LV.mjs.map +1 -0
- package/dist/{migration-status-DCAQ3_C1-ofDvCvUk.mjs → migration-status-BZ6gOxyJ-sbhPgABr.mjs} +2 -2
- package/dist/migration-status-BZ6gOxyJ-sbhPgABr.mjs.map +1 -0
- package/package.json +12 -12
- package/dist/format-D5x0jz7q-xalz6Fkn.mjs.map +0 -1
- package/dist/migration-check-aoZ8kXNA-DX2J84Cv.mjs.map +0 -1
- package/dist/migration-status-DCAQ3_C1-ofDvCvUk.mjs.map +0 -1
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["CliStructuredError","errorConfigValidation","CliStructuredError$1"],"sources":["../../../../1-framework/3-tooling/cli/dist/load-config-BQgwPvgu.mjs","../../../../1-framework/3-tooling/cli/dist/exports/index.mjs"],"sourcesContent":["import { A as errorTargetMigrationNotSupported, I as runCommandAction, M as errorUnexpected, P as requireLiveDatabase, _ as errorMigrationPackageNotFound, i as errorConfigValidation, l as errorDriverRequired, m as errorLegendHumanOnly, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError$1, u as errorFileNotFound, y as errorNoMigrations } from \"./cli-errors-C6_pH59O.mjs\";\nimport { d as renderPreviewStatement, u as previewBlockHeader } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { a as maskConnectionUrl, l as sanitizeErrorMessage, n as closeQuietly, p as targetSupportsMigrations } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { a as loadContractSpaceAggregateForCli, r as buildReadAggregate, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-BpdB-mHG.mjs\";\nimport { t as createControlClient } from \"./client-BqhVohc5.mjs\";\nimport { a as readContractIR, o as resolveRefAdvancementFields, t as advanceRefSafely } from \"./ref-advancement-DaZBzm7m.mjs\";\nimport { t as mapDbInitFailure } from \"./db-init-failure-XYOVL4o7.mjs\";\nimport { t as mapCaughtMigrationError } from \"./caught-errors-BZ-9WASe.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-CLFX1-Gc.mjs\";\nimport { i as refuseMarkerOutsideGraph, n as refuseUnknownInvariants } from \"./invariants-1L2zfc6-.mjs\";\nimport { t as executeMigrateShowPlan } from \"./migrate-show-bdXjSFgh.mjs\";\nimport { n as resolveMigrationRef, t as resolveContractRef } from \"./ref-resolution-D4fAdXo8.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"./migration-list-W0dqabIj.mjs\";\nimport { S as toneSpans, a as renderMigrationGraphLegend, b as TONE_MIGRATION_GRAPH_PALETTE, l as renderMigrationListWithStyle, s as createToneMigrationListStyler, x as toneDrawing } from \"./migration-graph-command-render-BeuEyf2B.mjs\";\nimport { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from \"./migrate-failure-Bdr3AJee.mjs\";\nimport { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-5r1leSW5.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"./migration-graph-DmdVVJoZ.mjs\";\nimport { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from \"./migration-graph-sections-BWcFCOL6.mjs\";\nimport { a as sortLedgerEntries, i as serializeLedgerEntriesForJson, n as formatLedgerAppliedAt, o as styleHashTransition, t as MIGRATION_LOG_EMPTY_MESSAGE } from \"./migration-log-table-DRiOnvzf.mjs\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { normalize, relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { DOCS_BASE, isStructuredError } from \"@internal/utils/structured-error\";\nimport { defineCommand, defineCommandFamily, defineConfigSection, flag, positional } from \"@prisma/cli-engine\";\nimport { CliStructuredError, notOk, ok } from \"@prisma/cli-engine/protocol\";\nimport { collectConfigIssues } from \"@internal/config/config-validation\";\nconst MISSING_CONFIG_ACTION = {\n\tkind: \"run-command\",\n\tlabel: \"Create a configuration file\",\n\tcommand: \"prisma-next init\"\n};\nfunction editConfigAction(field) {\n\treturn {\n\t\tkind: \"edit-file\",\n\t\tlabel: `Correct ${field} in prisma-next.config.ts`\n\t};\n}\nfunction issueDiagnostic(issue) {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: issue.message,\n\t\twhy: issue.message,\n\t\tnextActions: [editConfigAction(issue.field)],\n\t\tmeta: {\n\t\t\tfield: issue.field,\n\t\t\tsection: issue.section\n\t\t}\n\t};\n}\nfunction sectionAbsentDiagnostic() {\n\treturn {\n\t\tcode: \"CONFIG.FILE_NOT_FOUND\",\n\t\tseverity: \"error\",\n\t\tsummary: \"No Prisma Next configuration was loaded\",\n\t\twhy: `The orm config section is absent, so prisma-next.config.ts was never evaluated.`,\n\t\tnextActions: [MISSING_CONFIG_ACTION]\n\t};\n}\nfunction notAnObjectDiagnostic() {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: \"Prisma Next configuration must be an object\",\n\t\twhy: `The orm config section is not an object, so no section can be read from it.`,\n\t\tnextActions: [{\n\t\t\tkind: \"edit-file\",\n\t\t\tlabel: \"Export a configuration object from prisma-next.config.ts\"\n\t\t}]\n\t};\n}\nfunction unreadableDiagnostic(error) {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: \"Prisma Next configuration could not be inspected\",\n\t\twhy: error instanceof Error ? error.message : String(error),\n\t\tnextActions: [{\n\t\t\tkind: \"edit-file\",\n\t\t\tlabel: \"Export a plain configuration object from prisma-next.config.ts\"\n\t\t}]\n\t};\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/**\n* An emitted artifact listed as its own contract input makes every emit\n* consume its previous output. Structural, filesystem-free, and therefore the\n* section validator's business rather than the loader's.\n*/\nfunction collectArtifactCollisionIssues(raw) {\n\tconst contract = raw[\"contract\"];\n\tif (!isRecord(contract)) return [];\n\tconst source = contract[\"source\"];\n\tconst output = contract[\"output\"];\n\tif (!isRecord(source) || typeof output !== \"string\") return [];\n\tconst inputs = source[\"inputs\"];\n\tif (!Array.isArray(inputs)) return [];\n\tlet emitted;\n\ttry {\n\t\temitted = getEmittedArtifactPaths(output);\n\t} catch (error) {\n\t\treturn [{\n\t\t\tsection: \"contract\",\n\t\t\tfield: \"contract.output\",\n\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t}];\n\t}\n\tconst emittedPaths = /* @__PURE__ */ new Set([normalize(emitted.jsonPath), normalize(emitted.dtsPath)]);\n\tif (!inputs.some((input) => typeof input === \"string\" && emittedPaths.has(normalize(input)))) return [];\n\treturn [{\n\t\tsection: \"contract\",\n\t\tfield: \"contract.source.inputs[]\",\n\t\tmessage: \"Config.contract.source.inputs must not include emitted artifact paths derived from contract.output\"\n\t}];\n}\nfunction validate(raw) {\n\tif (raw === void 0) return {\n\t\tok: false,\n\t\tdiagnostics: [sectionAbsentDiagnostic()]\n\t};\n\tif (!isRecord(raw)) return {\n\t\tok: false,\n\t\tdiagnostics: [notAnObjectDiagnostic()]\n\t};\n\tlet issues;\n\ttry {\n\t\tissues = [...collectConfigIssues(raw), ...collectArtifactCollisionIssues(raw)];\n\t} catch (error) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdiagnostics: [unreadableDiagnostic(error)]\n\t\t};\n\t}\n\tif (issues.length > 0) return {\n\t\tok: false,\n\t\tdiagnostics: issues.map(issueDiagnostic)\n\t};\n\treturn {\n\t\tok: true,\n\t\tvalue: blindCast(raw),\n\t\tdiagnostics: []\n\t};\n}\nconst ormConfigSection = defineConfigSection({\n\tname: \"orm\",\n\tvalidate\n});\n//#endregion\n//#region src/orm/normalize-error.ts\n/**\n* `isStructuredError` is the repo's own check, and it is the one that matters here: it holds the\n* regular expression for a dotted `NAMESPACE.SUBCODE`, so only a code the protocol accepts\n* reaches `Diagnostic['code']`.\n*/\nfunction isRaisedError(error) {\n\treturn error instanceof Error && isStructuredError(error);\n}\n/**\n* The fallback for anything that is not a structured error: a bare throw, and also an error whose\n* `code` is not a dotted one — a Node `ENOENT`, say. The rejected code survives in `meta` rather\n* than in `code`, where it would produce a docs link to a page that does not exist.\n*/\nfunction toUnexpected(error) {\n\tconst summary = error instanceof Error ? error.message : String(error);\n\tconst rejectedCode = error instanceof Error ? Reflect.get(error, \"code\") : void 0;\n\treturn new CliStructuredError(\"CLI.UNEXPECTED\", summary, {\n\t\t...ifDefined(\"meta\", typeof rejectedCode === \"string\" ? { code: rejectedCode } : void 0),\n\t\tcause: error\n\t});\n}\n/**\n* Both classes name themselves `CliStructuredError`, so the engine's duck test\n* accepts prisma/prisma's too, and a CLI factory carrying typed actions looks\n* conformant without being one — its `toEnvelope` still writes `fix` and no\n* `nextActions`. Only an error the engine itself built is already in protocol\n* shape, and `@prisma/cli-engine` is an exact-pinned, unbundled dependency, so\n* there is one module instance and identity holds.\n*/\nfunction conformsToProtocol(error) {\n\treturn error instanceof CliStructuredError;\n}\n/**\n* Turns the transitional `fix` prose into typed actions. A multi-line fix is\n* several pieces of advice, so it becomes one action per line.\n*/\nfunction actionsFromFix(fix) {\n\tif (fix === void 0) return [];\n\treturn fix.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0).map((label) => ({\n\t\tkind: \"user-choice\",\n\t\tlabel\n\t}));\n}\n/**\n* Projects a prisma/prisma-raised error onto the engine's diagnostic shape.\n*/\nfunction toEngineDiagnostic(error) {\n\treturn {\n\t\tcode: error.code,\n\t\tseverity: error.severity ?? \"error\",\n\t\tsummary: error.message,\n\t\t...ifDefined(\"why\", error.why),\n\t\tnextActions: error.nextActions ?? actionsFromFix(error.fix),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl)\n\t};\n}\n/**\n* The handler boundary's single conversion. Handlers pass every error they\n* return through `notOk` — and every error a top-of-handler catch sees —\n* through this, so a settled envelope always carries `nextActions` and never\n* the non-protocol `fix` field.\n*/\nfunction normalizeError(error) {\n\tif (conformsToProtocol(error)) return error;\n\tif (!isRaisedError(error)) return toUnexpected(error);\n\tconst diagnostic = toEngineDiagnostic(error);\n\treturn new CliStructuredError(diagnostic.code, diagnostic.summary, {\n\t\tseverity: diagnostic.severity,\n\t\tnextActions: diagnostic.nextActions,\n\t\t...ifDefined(\"why\", diagnostic.why),\n\t\t...ifDefined(\"where\", diagnostic.where),\n\t\t...ifDefined(\"meta\", diagnostic.meta),\n\t\t...ifDefined(\"docsUrl\", diagnostic.docsUrl),\n\t\tcause: error\n\t});\n}\n//#endregion\n//#region src/orm/define-command.ts\n/**\n* `defineCommand` with the ORM's error boundary already attached. Every ORM command is defined\n* through this rather than through `defineCommand` directly.\n*\n* Without it, an error a handler throws reaches the engine, whose duck test accepts\n* prisma/prisma's `CliStructuredError` — both classes carry that name — and then settles it\n* through fields the engine's own class has and this one does not. The envelope that results is\n* off-protocol. Catching here means every handler settles through the single conversion instead.\n*/\nfunction defineOrmCommand(def) {\n\treturn defineCommand({\n\t\t...def,\n\t\thandler: async (args, ctx) => {\n\t\t\ttry {\n\t\t\t\treturn await def.handler(args, ctx);\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(error));\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/orm/flags.ts\n/**\n* The database connection override, declared from here by every command that\n* accepts one so its brief and placeholder cannot drift apart. Resolution\n* order is the flag, then `config.db.connection`, then\n* `CONFIG.DB_CONNECTION_REQUIRED`.\n*/\nconst dbFlag = flag.string({\n\tbrief: \"Database connection string\",\n\tplaceholder: \"url\"\n});\n//#endregion\n//#region src/orm/progress.ts\nconst OUTCOMES = {\n\tok: \"ok\",\n\tskipped: \"skipped\",\n\terror: \"failed\"\n};\n/**\n* The control API's spans as engine events. A span's label is remembered when\n* it starts so the finishing event names the step with the same words.\n*/\nfunction controlProgressReporter(report) {\n\tconst labels = /* @__PURE__ */ new Map();\n\treturn (event) => {\n\t\tif (event.kind === \"spanStart\") {\n\t\t\tlabels.set(event.spanId, event.label);\n\t\t\treport({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep: event.label,\n\t\t\t\tid: event.spanId,\n\t\t\t\t...ifDefined(\"parentId\", event.parentSpanId)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst step = labels.get(event.spanId) ?? event.spanId;\n\t\tlabels.delete(event.spanId);\n\t\treport({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\tid: event.spanId,\n\t\t\toutcome: OUTCOMES[event.outcome]\n\t\t});\n\t};\n}\n//#endregion\n//#region src/orm/db/migration-blocks.ts\nfunction operationNode(operation) {\n\treturn operation.operationClass === \"destructive\" ? {\n\t\tlabel: operation.label,\n\t\tstatus: \"warn\"\n\t} : { label: operation.label };\n}\nfunction spaceLabel(space) {\n\treturn space.kind === \"app\" ? \"App space\" : `Extension space: ${space.spaceId}`;\n}\n/**\n* One root per contract space, in the schedule order the runner used. A\n* space's post-apply marker is the last child of its own space, so the engine\n* draws it under the operations it signs.\n*/\nfunction spaceNodes(perSpace, mode) {\n\treturn perSpace.map((space) => ({\n\t\tlabel: [{\n\t\t\ttext: spaceLabel(space),\n\t\t\ttone: \"identifier\"\n\t\t}],\n\t\tchildren: [...space.operations.length === 0 ? [{ label: [{\n\t\t\ttext: \"(no operations)\",\n\t\t\ttone: \"muted\"\n\t\t}] }] : space.operations.map(operationNode), ...mode === \"apply\" && space.marker !== void 0 ? [{ label: [{\n\t\t\ttext: \"marker \",\n\t\t\ttone: \"muted\"\n\t\t}, {\n\t\t\ttext: space.marker.storageHash,\n\t\t\ttone: \"identifier\"\n\t\t}] }] : []]\n\t}));\n}\nfunction destructiveWarningBlocks(hasDestructive) {\n\treturn hasDestructive ? [{\n\t\tkind: \"summary\",\n\t\tstatus: \"warn\",\n\t\ttext: \"This migration contains destructive operations that may cause data loss.\"\n\t}] : [];\n}\n/**\n* The planned or executed operations. The per-space breakdown is the shape the\n* aggregate flow produces; the flat tree is the fallback for a result that\n* carries no breakdown.\n*/\nfunction perSpaceBlocks(perSpace, mode) {\n\tconst hasDestructive = perSpace.some((space) => space.operations.some((operation) => operation.operationClass === \"destructive\"));\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: spaceNodes(perSpace, mode)\n\t}, ...destructiveWarningBlocks(hasDestructive)];\n}\nfunction operationBlocks$1(result) {\n\tconst perSpace = result.perSpace;\n\tif (perSpace !== void 0 && perSpace.length > 0) return perSpaceBlocks(perSpace, result.mode);\n\tif (result.plan.operations.length === 0) return [];\n\tconst hasDestructive = result.plan.operations.some((operation) => operation.operationClass === \"destructive\");\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: result.plan.operations.map(operationNode)\n\t}, ...destructiveWarningBlocks(hasDestructive)];\n}\n/** The statements a database would run, printed verbatim rather than laid out. */\nfunction previewBlocks$1(preview) {\n\tif (preview === void 0) return [];\n\tconst header = {\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: previewBlockHeader(preview)\n\t};\n\tconst statements = preview.statements.map((statement) => renderPreviewStatement(statement.text, statement.language)).filter((text) => text !== void 0);\n\treturn statements.length === 0 ? [header, {\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: \"No operations.\"\n\t}] : [header, {\n\t\tkind: \"drawing\",\n\t\tlines: statements\n\t}];\n}\nfunction planSummaryText(result) {\n\tconst operations = result.plan.operations.length;\n\tconst spaces = result.perSpace?.length ?? 0;\n\treturn spaces > 0 ? `Planned ${operations} operation(s) across ${spaces} contract space${spaces === 1 ? \"\" : \"s\"}` : `Planned ${operations} operation(s)`;\n}\nfunction applySummaryText(result) {\n\tconst executed = result.execution?.operationsExecuted ?? 0;\n\tconst spaces = result.perSpace?.length ?? 0;\n\tconst across = spaces > 0 ? ` across ${spaces} contract space${spaces === 1 ? \"\" : \"s\"}` : \"\";\n\tif (executed === 0) return `Database already matches contract${across}`;\n\treturn `Applied ${executed} operation(s)${across}`;\n}\nfunction planBlocks(result) {\n\tconst planned = result.plannedAdvanceRef;\n\treturn [\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: planSummaryText(result)\n\t\t},\n\t\t...operationBlocks$1(result),\n\t\t{\n\t\t\tkind: \"fields\",\n\t\t\trows: [{\n\t\t\t\tlabel: \"destination\",\n\t\t\t\tvalue: [{\n\t\t\t\t\ttext: result.plan.destination.storageHash,\n\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t},\n\t\t...planned === null || planned === void 0 ? [] : [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: [{ text: `Would advance ref \"${planned.name}\" → ` }, {\n\t\t\t\ttext: planned.hash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}],\n\t\t...previewBlocks$1(result.plan.preview),\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttone: \"muted\",\n\t\t\ttext: \"This is a dry run. No changes were applied.\"\n\t\t}\n\t];\n}\n/**\n* The app-space marker, for a result that carried no per-space breakdown. The\n* label names what the marker covers rather than calling it \"the\" signature.\n*/\nfunction fallbackMarkerBlocks(result) {\n\tconst marker = result.marker;\n\tif (marker === void 0 || result.perSpace !== void 0 && result.perSpace.length > 0) return [];\n\treturn [{\n\t\tkind: \"fields\",\n\t\trows: [{\n\t\t\tlabel: \"App-space marker\",\n\t\t\tvalue: [{\n\t\t\t\ttext: marker.storageHash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}, ...marker.profileHash === void 0 ? [] : [{\n\t\t\tlabel: \"Profile hash\",\n\t\t\tvalue: [{\n\t\t\t\ttext: marker.profileHash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}]]\n\t}];\n}\nfunction applyBlocks(result) {\n\tconst advanced = result.advancedRef;\n\treturn [\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: applySummaryText(result)\n\t\t},\n\t\t...operationBlocks$1(result),\n\t\t...fallbackMarkerBlocks(result),\n\t\t...advanced === null || advanced === void 0 ? [] : [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: [{ text: `Advanced ref \"${advanced.name}\" → ` }, {\n\t\t\t\ttext: advanced.hash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}]\n\t];\n}\n/** What a `db init` / `db update` result looks like in human mode. */\nfunction migrationResultBlocks(result) {\n\treturn result.mode === \"plan\" ? planBlocks(result) : applyBlocks(result);\n}\n/** Where the user goes next, as typed actions rather than trailing prose. */\nfunction migrationResultNextActions(result, applyCommand) {\n\treturn result.mode === \"plan\" ? [runCommandAction(\"Apply the planned operations\", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? \"Confirm the space is up to date\" : \"Confirm every space is up to date\", \"prisma-next migration status\")];\n}\n//#endregion\n//#region src/orm/migration/paths.ts\n/**\n* Where migrations live for this project. Resolved against the invocation\n* directory, which is also the config file's directory for every default\n* invocation.\n*/\nfunction migrationsDirFor(config, cwd) {\n\treturn resolve(cwd, config.migrations?.dir ?? \"migrations\");\n}\n/** The app subspace under {@link migrationsDirFor}. */\nfunction appMigrationsDirFor(config, cwd) {\n\treturn spaceMigrationDirectory(migrationsDirFor(config, cwd), APP_SPACE_ID);\n}\n/**\n* Where refs live. The framework keeps them under the app subspace rather than\n* at the migrations root.\n*/\nfunction appRefsDirFor(config, cwd) {\n\treturn resolve(appMigrationsDirFor(config, cwd), \"refs\");\n}\n/**\n* The emitted contract. The config loader has already resolved\n* `contract.output` against the config file's directory, so this only has an\n* effect for a config handed in raw, as tests do.\n*/\nfunction contractPathFor(config, cwd) {\n\tconst output = config.contract?.output;\n\treturn output === void 0 ? void 0 : resolve(cwd, output);\n}\n/**\n* The header's rendering of a path: relative to where the user invoked the\n* CLI, as the commander shell rendered it against the config file.\n*/\nfunction displayPath(path, cwd) {\n\treturn relative(cwd, path);\n}\n//#endregion\n//#region src/orm/db/prepare.ts\n/** Reads the emitted contract as the raw document the control API validates. */\nasync function readContractDocument(contractPath) {\n\tlet content;\n\ttry {\n\t\tcontent = await readFile(contractPath, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(normalizeError(Reflect.get(Object(error), \"code\") === \"ENOENT\" ? errorFileNotFound(contractPath, {\n\t\t\twhy: `Contract file not found at ${contractPath}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate contract.json, or update `contract.output` in prisma-next.config.ts\"\n\t\t}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` })));\n\t}\n\ttry {\n\t\treturn ok(castAs(JSON.parse(content)));\n\t} catch (error) {\n\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t}\n}\nasync function prepareMigrationRun(inputs) {\n\tconst { config, cwd, commandName } = inputs;\n\tconst contractPath = contractPathFor(config, cwd);\n\tif (contractPath === void 0) return notOk(normalizeError(errorConfigValidation(\"contract.output\", {\n\t\twhy: `${commandName} reads the emitted contract from config.contract.output; the config has no value to read.`,\n\t\tsection: \"contract\"\n\t})));\n\tconst contract = await readContractDocument(contractPath);\n\tif (!contract.ok) return notOk(contract.failure);\n\tconst dbConnection = inputs.db ?? config.db?.connection;\n\tif (dbConnection === void 0) return notOk(normalizeError(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${commandName} (set db.connection in prisma-next.config.ts, or pass --db <url>)`,\n\t\tcommandName,\n\t\tmissingFlags: [\"--db\"]\n\t})));\n\tif (config.driver === void 0) return notOk(normalizeError(errorDriverRequired({ why: `Config.driver is required for ${commandName}` })));\n\tif (!targetSupportsMigrations(config.target)) return notOk(normalizeError(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` })));\n\treturn ok({\n\t\tclient: inputs.createClient({\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\tcontractJson: contract.value,\n\t\tcontractPath,\n\t\tcontractDisplayPath: displayPath(contractPath, cwd),\n\t\tdbConnection,\n\t\tdatabase: typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0,\n\t\tmigrationsDir: migrationsDirFor(config, cwd),\n\t\trefsDir: appRefsDirFor(config, cwd)\n\t});\n}\n//#endregion\n//#region src/orm/db/init.ts\nfunction initPresentations(inputs) {\n\tconst { document, database, dryRun } = inputs;\n\treturn {\n\t\thuman: () => [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"contract\",\n\t\t\t\t\tvalue: inputs.contractPath\n\t\t\t\t},\n\t\t\t\t...database === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\tvalue: database\n\t\t\t\t}],\n\t\t\t\t...dryRun ? [{\n\t\t\t\t\tlabel: \"mode\",\n\t\t\t\t\tvalue: \"dry run\"\n\t\t\t\t}] : []\n\t\t\t]\n\t\t}, ...migrationResultBlocks(document)],\n\t\tjson: () => document,\n\t\tnext: () => migrationResultNextActions(document, \"prisma-next db init\")\n\t};\n}\nfunction initDocument(inputs) {\n\tconst { value } = inputs;\n\treturn {\n\t\tok: true,\n\t\tmode: value.mode,\n\t\tplan: {\n\t\t\ttargetId: inputs.targetId,\n\t\t\tdestination: {\n\t\t\t\tstorageHash: value.destination.storageHash,\n\t\t\t\t...ifDefined(\"profileHash\", value.destination.profileHash)\n\t\t\t},\n\t\t\toperations: value.plan.operations.map((operation) => ({\n\t\t\t\tid: operation.id,\n\t\t\t\tlabel: operation.label,\n\t\t\t\toperationClass: operation.operationClass\n\t\t\t})),\n\t\t\t...ifDefined(\"preview\", value.plan.preview)\n\t\t},\n\t\t...value.execution === void 0 ? {} : { execution: {\n\t\t\toperationsPlanned: value.execution.operationsPlanned,\n\t\t\toperationsExecuted: value.execution.operationsExecuted\n\t\t} },\n\t\t...value.marker === void 0 ? {} : { marker: {\n\t\t\tstorageHash: value.marker.storageHash,\n\t\t\t...ifDefined(\"profileHash\", value.marker.profileHash)\n\t\t} },\n\t\t...ifDefined(\"perSpace\", value.perSpace),\n\t\tadvancedRef: inputs.advancedRef,\n\t\tplannedAdvanceRef: inputs.plannedAdvanceRef,\n\t\tsummary: value.summary,\n\t\ttimings: { total: Date.now() - inputs.startedAt }\n\t};\n}\nfunction createDbInitCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Bootstrap a database to match the current contract and sign it\",\n\t\t\tdescription: \"Creates everything the emitted contract declares and the database does not\\nhave yet, using additive operations only. Structures already in place and\\ncompatible are left alone, a conflict that would need a destructive change\\nstops the run, and the database is signed with the contract it now matches.\\nUse --dry-run to see the operations without applying them.\",\n\t\t\texamples: [\n\t\t\t\t\"db init\",\n\t\t\t\t\"db init --db $DATABASE_URL\",\n\t\t\t\t\"db init --dry-run\",\n\t\t\t\t\"db init --advance-ref production\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: {\n\t\t\tdb: dbFlag,\n\t\t\tdryRun: flag.boolean({ brief: \"Preview the planned operations without applying them\" }),\n\t\t\tadvanceRef: flag.string({\n\t\t\t\tbrief: \"Advance the named ref to the post-command contract hash\",\n\t\t\t\tplaceholder: \"name\"\n\t\t\t})\n\t\t} },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst prepared = await prepareMigrationRun({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd,\n\t\t\t\tdb: args.flags.db,\n\t\t\t\tcommandName: \"db init\",\n\t\t\t\tcreateClient\n\t\t\t});\n\t\t\tif (!prepared.ok) return notOk(prepared.failure);\n\t\t\tconst { client, contractJson, contractPath, dbConnection, migrationsDir, refsDir } = prepared.value;\n\t\t\tlet document;\n\t\t\ttry {\n\t\t\t\tawait client.connect(dbConnection);\n\t\t\t\tconst result = await client.dbInit({\n\t\t\t\t\tcontract: contractJson,\n\t\t\t\t\tmode: args.flags.dryRun ? \"plan\" : \"apply\",\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report)\n\t\t\t\t});\n\t\t\t\tif (!result.ok) return notOk(normalizeError(mapDbInitFailure(result.failure)));\n\t\t\t\tconst advancementHash = result.value.mode === \"apply\" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;\n\t\t\t\tconst advancement = await resolveRefAdvancementFields({\n\t\t\t\t\t...ifDefined(\"advanceRef\", args.flags.advanceRef),\n\t\t\t\t\t...ifDefined(\"db\", args.flags.db),\n\t\t\t\t\trefsDir,\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tcontractJson,\n\t\t\t\t\tcontractJsonPath: contractPath,\n\t\t\t\t\tmode: result.value.mode,\n\t\t\t\t\thash: advancementHash\n\t\t\t\t});\n\t\t\t\tif (!advancement.ok) return notOk(normalizeError(advancement.failure));\n\t\t\t\tdocument = initDocument({\n\t\t\t\t\tvalue: result.value,\n\t\t\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\t\t\tadvancedRef: advancement.value.advancedRef,\n\t\t\t\t\tplannedAdvanceRef: advancement.value.plannedAdvanceRef,\n\t\t\t\t\tstartedAt\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tif (CliStructuredError$1.is(error)) return notOk(normalizeError(error));\n\t\t\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(normalizeError(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPath } })));\n\t\t\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\t\t\treturn notOk(normalizeError(errorUnexpected(safeMessage, { why: `Unexpected error during db init: ${safeMessage}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tctx.report({\n\t\t\t\tkind: \"message\",\n\t\t\t\tseverity: \"verbose\",\n\t\t\t\ttext: `Total time: ${document.timings.total}ms`\n\t\t\t});\n\t\t\treturn ok(ctx.present({ data: document }, initPresentations({\n\t\t\t\tdocument,\n\t\t\t\tcontractPath: prepared.value.contractDisplayPath,\n\t\t\t\tdatabase: prepared.value.database,\n\t\t\t\tdryRun: args.flags.dryRun\n\t\t\t})));\n\t\t}\n\t});\n}\nconst dbInitCommand = createDbInitCommand(createControlClient);\n//#endregion\n//#region src/orm/db/schema.ts\nconst SUMMARY = \"Schema read successfully\";\n/**\n* A leading keyword and the name it introduces: `<keyword> <name>`, or\n* `<keyword>: <name>`. The keyword recedes and the name is the identifier.\n*/\nfunction keywordThenName(label) {\n\tconst colon = label.match(/^(.+?):\\s*(\\S.*)$/);\n\tif (colon?.[1] !== void 0 && colon[2] !== void 0) return [\n\t\t{\n\t\t\ttext: colon[1],\n\t\t\ttone: \"muted\"\n\t\t},\n\t\t{ text: \": \" },\n\t\t{\n\t\t\ttext: colon[2],\n\t\t\ttone: \"identifier\"\n\t\t}\n\t];\n\tconst spaced = label.match(/^(\\S.*\\S|\\S+)\\s+(\\S+)$/);\n\tif (spaced?.[1] !== void 0 && spaced[2] !== void 0) return [\n\t\t{\n\t\t\ttext: spaced[1],\n\t\t\ttone: \"muted\"\n\t\t},\n\t\t{ text: \" \" },\n\t\t{\n\t\t\ttext: spaced[2],\n\t\t\ttone: \"identifier\"\n\t\t}\n\t];\n}\n/** `<name>: <detail> (<qualifier>)` — the name leads and the qualifier recedes. */\nfunction namedDetail(label) {\n\tconst parts = label.match(/^([^:]+):\\s*(.+)$/);\n\tif (parts?.[1] === void 0 || parts[2] === void 0) return;\n\tconst [, name, rest] = parts;\n\tconst qualified = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n\tif (qualified?.[1] !== void 0 && qualified[2] !== void 0) return [\n\t\t{\n\t\t\ttext: name,\n\t\t\ttone: \"identifier\"\n\t\t},\n\t\t{ text: `: ${qualified[1]} ` },\n\t\t{\n\t\t\ttext: qualified[2],\n\t\t\ttone: \"muted\"\n\t\t}\n\t];\n\treturn [{\n\t\ttext: name,\n\t\ttone: \"identifier\"\n\t}, { text: `: ${rest}` }];\n}\n/** `<name> <rest>` — the name leads and the prose behind it recedes. */\nfunction nameThenProse(label) {\n\tconst parts = label.match(/^(\\S+)\\s+(\\S.*)$/);\n\tif (parts?.[1] === void 0 || parts[2] === void 0) return;\n\treturn [\n\t\t{\n\t\t\ttext: parts[1],\n\t\t\ttone: \"identifier\"\n\t\t},\n\t\t{ text: \" \" },\n\t\t{\n\t\t\ttext: parts[2],\n\t\t\ttone: \"muted\"\n\t\t}\n\t];\n}\n/**\n* What a schema node's label means, said in tones.\n*\n* The families phrase these labels themselves, so the shapes recognised here\n* are positional (`<keyword> <name>`, `<name>: <detail>`) rather than a list of\n* words: a family that renames a keyword keeps its colouring, and no family's\n* vocabulary is written down in the framework layer.\n*/\nfunction labelSpans(node) {\n\tswitch (node.kind) {\n\t\tcase \"root\": return [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"emphasis\"\n\t\t}];\n\t\tcase \"collection\": return [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"muted\"\n\t\t}];\n\t\tcase \"entity\":\n\t\tcase \"index\": return keywordThenName(node.label) ?? [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"identifier\"\n\t\t}];\n\t\tcase \"field\": return namedDetail(node.label) ?? [{ text: node.label }];\n\t\tcase \"dependency\": return nameThenProse(node.label) ?? [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"identifier\"\n\t\t}];\n\t\tdefault: return [{ text: node.label }];\n\t}\n}\nfunction treeNode(node) {\n\treturn {\n\t\tlabel: labelSpans(node),\n\t\t...ifDefined(\"children\", node.children === void 0 || node.children.length === 0 ? void 0 : node.children.map(treeNode))\n\t};\n}\nfunction schemaPresentations(inputs) {\n\tconst { document, schemaView, database } = inputs;\n\treturn {\n\t\thuman: () => [...database === void 0 ? [] : [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: database\n\t\t\t}]\n\t\t}], schemaView === void 0 ? {\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: document.summary\n\t\t} : {\n\t\t\tkind: \"tree\",\n\t\t\troots: [treeNode(schemaView.root)]\n\t\t}],\n\t\tjson: () => document\n\t};\n}\nfunction createDbSchemaCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Inspect the live database schema\",\n\t\t\tdescription: \"Reads the live database schema and prints it as a tree, or as the result\\ndocument with --json. Always read-only: it never writes a file and never\\nchanges the database.\",\n\t\t\texamples: [\n\t\t\t\t\"db schema\",\n\t\t\t\t\"db schema --db $DATABASE_URL\",\n\t\t\t\t\"db schema --json\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: { db: dbFlag } },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\t\tif (dbConnection === void 0) return notOk(normalizeError(errorDatabaseConnectionRequired({\n\t\t\t\twhy: \"Database connection is required for db schema (set db.connection in prisma-next.config.ts, or pass --db <url>)\",\n\t\t\t\tcommandName: \"db schema\",\n\t\t\t\tmissingFlags: [\"--db\"]\n\t\t\t})));\n\t\t\tif (ctx.config.driver === void 0) return notOk(normalizeError(errorDriverRequired({ why: \"Config.driver is required for db schema\" })));\n\t\t\tconst client = createClient({\n\t\t\t\tfamily: ctx.config.family,\n\t\t\t\ttarget: ctx.config.target,\n\t\t\t\tadapter: ctx.config.adapter,\n\t\t\t\tdriver: ctx.config.driver,\n\t\t\t\textensions: ctx.config.extensions ?? []\n\t\t\t});\n\t\t\tlet schema;\n\t\t\tlet schemaView;\n\t\t\ttry {\n\t\t\t\tschema = await client.introspect({\n\t\t\t\t\tconnection: dbConnection,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report)\n\t\t\t\t});\n\t\t\t\tschemaView = client.toSchemaView(schema);\n\t\t\t} catch (error) {\n\t\t\t\tif (CliStructuredError$1.is(error)) return notOk(normalizeError(error));\n\t\t\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\t\t\treturn notOk(normalizeError(errorUnexpected(safeMessage, { why: `Unexpected error during db schema: ${safeMessage}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tconst database = typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0;\n\t\t\tconst document = {\n\t\t\t\tok: true,\n\t\t\t\tsummary: SUMMARY,\n\t\t\t\ttarget: {\n\t\t\t\t\tfamilyId: ctx.config.family.familyId,\n\t\t\t\t\tid: ctx.config.target.targetId\n\t\t\t\t},\n\t\t\t\tschema,\n\t\t\t\tmeta: { ...ifDefined(\"dbUrl\", database) },\n\t\t\t\ttimings: { total: Date.now() - startedAt }\n\t\t\t};\n\t\t\treturn ok(ctx.present({ data: document }, schemaPresentations({\n\t\t\t\tdocument,\n\t\t\t\tschemaView,\n\t\t\t\tdatabase\n\t\t\t})));\n\t\t}\n\t});\n}\nconst dbSchemaCommand = createDbSchemaCommand(createControlClient);\n//#endregion\n//#region src/orm/migrate.ts\nconst STATUS_ACTION = runCommandAction(\"Check every space against the database\", \"prisma-next migration status\");\n/**\n* The route the migration will take. The graph is a drawing — the engine cannot\n* derive a lane gutter — and the ordered list under it is drawn with the same\n* widths so every arrow lands in one column.\n*/\nfunction showPresentations$1(inputs) {\n\tconst { document, graph, runList } = inputs;\n\tconst count = document.migrations.length;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t\t},\n\t\t\t\t\t...inputs.database === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\t\tvalue: inputs.database\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.from === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\t\tvalue: inputs.from\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.to === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: inputs.to\n\t\t\t\t\t}]\n\t\t\t\t]\n\t\t\t},\n\t\t\t...graph.length === 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(graph)\n\t\t\t}],\n\t\t\t...count === 0 ? [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"info\",\n\t\t\t\ttext: document.summary\n\t\t\t}] : [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"info\",\n\t\t\t\ttext: `The following ${count} migration${count === 1 ? \"\" : \"s\"} will run:`\n\t\t\t}, {\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(runList.join(\"\\n\"))\n\t\t\t}]\n\t\t],\n\t\tjson: () => document\n\t};\n}\nfunction applyPresentations(inputs) {\n\tconst { document } = inputs;\n\tconst advanced = document.advancedRef;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t\t},\n\t\t\t\t\t...inputs.database === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\t\tvalue: inputs.database\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.to === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: inputs.to\n\t\t\t\t\t}]\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: document.summary\n\t\t\t},\n\t\t\t...document.perSpace.length === 0 ? [] : perSpaceBlocks(document.perSpace, \"apply\"),\n\t\t\t...advanced === null || advanced === void 0 ? [] : [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: [{ text: `Advanced ref \"${advanced.name}\" → ` }, {\n\t\t\t\t\ttext: advanced.hash,\n\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t],\n\t\tjson: () => document,\n\t\tnext: () => [STATUS_ACTION]\n\t};\n}\n/**\n* `--to` as a contract the app graph knows. A ref target keeps the invariants\n* the ref declares; a bare hash carries none. Omitting `--to` targets the\n* emitted contract, which needs no resolution at all.\n*/\nfunction resolveRequestedTarget(to, refs, graph) {\n\tif (to === void 0) return ok({\n\t\tentry: void 0,\n\t\trefName: void 0\n\t});\n\tconst resolved = resolveContractRef(to, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!resolved.ok) return notOk(normalizeError(resolved.failure));\n\tif (resolved.value.provenance.kind !== \"ref\") return ok({\n\t\tentry: {\n\t\t\thash: resolved.value.hash,\n\t\t\tinvariants: []\n\t\t},\n\t\trefName: void 0\n\t});\n\tconst refName = resolved.value.provenance.refName;\n\treturn ok({\n\t\tentry: refs[refName],\n\t\trefName\n\t});\n}\nfunction createMigrateCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Apply planned migrations to advance the database\",\n\t\t\tdescription: \"Walks every contract space (app + extensions) and applies pending on-disk\\nmigrations in canonical order (extensions alphabetically, then app). It\\nreplays the on-disk migration graph and never invents an edge. Use --to to\\ntarget a specific contract (hash, ref name, or migration directory) and\\n--show for a read-only preview of the route it would take.\",\n\t\t\texamples: [\n\t\t\t\t\"migrate\",\n\t\t\t\t\"migrate --db $DATABASE_URL\",\n\t\t\t\t\"migrate --to production\",\n\t\t\t\t\"migrate --show\",\n\t\t\t\t\"migrate --show --from @contract --to production\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: {\n\t\t\tdb: dbFlag,\n\t\t\tto: flag.string({\n\t\t\t\tbrief: \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\",\n\t\t\t\tplaceholder: \"contract\"\n\t\t\t}),\n\t\t\tadvanceRef: flag.string({\n\t\t\t\tbrief: \"Advance the named ref to the post-apply marker after success\",\n\t\t\t\tplaceholder: \"name\"\n\t\t\t}),\n\t\t\tshow: flag.boolean({ brief: \"Preview the migration route without applying (read-only)\" }),\n\t\t\tfrom: flag.string({\n\t\t\t\tbrief: \"From-state for the --show preview (@contract, @db, hash, ref name, or dir)\",\n\t\t\t\tplaceholder: \"contract\"\n\t\t\t})\n\t\t} },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst migrationsRelative = displayPath(migrationsDirFor(ctx.config, ctx.cwd), ctx.cwd);\n\t\t\tif (args.flags.show) {\n\t\t\t\tconst planned = await executeMigrateShowPlan({\n\t\t\t\t\tconfig: ctx.config,\n\t\t\t\t\tcwd: ctx.cwd,\n\t\t\t\t\tcreateClient,\n\t\t\t\t\t...ifDefined(\"db\", args.flags.db),\n\t\t\t\t\t...ifDefined(\"to\", args.flags.to),\n\t\t\t\t\t...ifDefined(\"from\", args.flags.from)\n\t\t\t\t});\n\t\t\t\tif (!planned.ok) return notOk(normalizeError(planned.failure));\n\t\t\t\tconst plan = planned.value;\n\t\t\t\tconst paint = {\n\t\t\t\t\tcolorize: true,\n\t\t\t\t\tglyphMode: \"unicode\",\n\t\t\t\t\tstyler: createToneMigrationListStyler(),\n\t\t\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t\t\t};\n\t\t\t\tconst rendering = renderMigrateShowGraph(plan, paint);\n\t\t\t\tconst document = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tmigrations: plan.migrations,\n\t\t\t\t\tsummary: plan.summary\n\t\t\t\t};\n\t\t\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\t\t\treturn ok(ctx.present({ data: document }, showPresentations$1({\n\t\t\t\t\tdocument,\n\t\t\t\t\tgraph: rendering.graphOutput,\n\t\t\t\t\trunList: migrateShowRunListRows(plan.migrations, rendering, paint),\n\t\t\t\t\tmigrationsDir: migrationsRelative,\n\t\t\t\t\tdatabase: args.flags.from === void 0 && typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0,\n\t\t\t\t\tfrom: args.flags.from,\n\t\t\t\t\tto: args.flags.to\n\t\t\t\t})));\n\t\t\t}\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst prepared = await prepareMigrationRun({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd,\n\t\t\t\tdb: args.flags.db,\n\t\t\t\tcommandName: \"migrate\",\n\t\t\t\tcreateClient\n\t\t\t});\n\t\t\tif (!prepared.ok) return notOk(prepared.failure);\n\t\t\tconst { client, contractJson, contractPath, dbConnection, migrationsDir, refsDir } = prepared.value;\n\t\t\tconst familyInstance = ctx.config.family.create(createControlStack(ctx.config));\n\t\t\tlet appContract;\n\t\t\ttry {\n\t\t\t\tappContract = familyInstance.deserializeContract(contractJson);\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t\t\t}\n\t\t\tconst loaded = await loadContractSpaceAggregateForCli({\n\t\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\t\tmigrationsDir,\n\t\t\t\tappContract,\n\t\t\t\textensions: ctx.config.extensions ?? [],\n\t\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t\t\t});\n\t\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\t\tconst aggregate = loaded.value;\n\t\t\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\t\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(castAs(ctx.config.extensions ?? [])),\n\t\t\t\tcheckContracts: true\n\t\t\t});\n\t\t\tif (integrityFailure) return notOk(normalizeError(integrityFailure));\n\t\t\tconst target = resolveRequestedTarget(args.flags.to, aggregate.app.refs, aggregate.app.graph());\n\t\t\tif (!target.ok) return notOk(target.failure);\n\t\t\tlet document;\n\t\t\ttry {\n\t\t\t\tawait client.connect(dbConnection);\n\t\t\t\tconst appGraph = aggregate.app.graph();\n\t\t\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\t\t\tif (appMarker !== null) {\n\t\t\t\t\tconst markerRefusal = refuseMarkerOutsideGraph({\n\t\t\t\t\t\tmarkerHash: appMarker.storageHash,\n\t\t\t\t\t\tgraph: appGraph\n\t\t\t\t\t});\n\t\t\t\t\tif (markerRefusal) return notOk(normalizeError(markerRefusal));\n\t\t\t\t}\n\t\t\t\tconst refEntry = target.value.entry;\n\t\t\t\tif (refEntry !== void 0 && refEntry.invariants.length > 0) {\n\t\t\t\t\tconst invariantRefusal = refuseUnknownInvariants({\n\t\t\t\t\t\tgraph: appGraph,\n\t\t\t\t\t\tmarkerInvariants: appMarker?.invariants ?? [],\n\t\t\t\t\t\trefInvariants: refEntry.invariants,\n\t\t\t\t\t\t...ifDefined(\"refName\", args.flags.to)\n\t\t\t\t\t});\n\t\t\t\t\tif (invariantRefusal) return notOk(normalizeError(invariantRefusal));\n\t\t\t\t}\n\t\t\t\tlet applyContract = appContract;\n\t\t\t\tlet snapshotContractJson = contractJson;\n\t\t\t\tlet snapshotContractDts;\n\t\t\t\tif (args.flags.to !== void 0 && refEntry !== void 0) {\n\t\t\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === refEntry.hash) !== void 0) try {\n\t\t\t\t\t\tconst at = await aggregate.app.contractAt(refEntry.hash, target.value.refName === void 0 ? void 0 : { refName: target.value.refName });\n\t\t\t\t\t\tapplyContract = at.contract;\n\t\t\t\t\t\tsnapshotContractJson = blindCast(at.contractJson);\n\t\t\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst mapped = mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t\t\t\tif (!mapped.ok) return notOk(normalizeError(mapped.failure));\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst applied = await client.migrate({\n\t\t\t\t\tcontract: applyContract,\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report),\n\t\t\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t\t\t...refEntry?.invariants === void 0 ? {} : { refInvariants: refEntry.invariants },\n\t\t\t\t\t...refEntry === void 0 ? {} : ifDefined(\"refName\", args.flags.to)\n\t\t\t\t});\n\t\t\t\tif (!applied.ok) return notOk(normalizeError(mapMigrateFailure(applied.failure)));\n\t\t\t\tconst { value } = applied;\n\t\t\t\tlet advancedRef = null;\n\t\t\t\tif (args.flags.advanceRef !== void 0) {\n\t\t\t\t\tconst contractIR = snapshotContractDts === void 0 ? await readContractIR(snapshotContractJson, contractPath) : {\n\t\t\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t\t\t};\n\t\t\t\t\tconst advanced = await advanceRefSafely({\n\t\t\t\t\t\trefsDir,\n\t\t\t\t\t\tmigrationsDir,\n\t\t\t\t\t\tname: args.flags.advanceRef,\n\t\t\t\t\t\thash: value.markerHash,\n\t\t\t\t\t\tcontractIR\n\t\t\t\t\t});\n\t\t\t\t\tif (!advanced.ok) return notOk(normalizeError(advanced.failure));\n\t\t\t\t\tadvancedRef = {\n\t\t\t\t\t\tname: advanced.value.name,\n\t\t\t\t\t\thash: advanced.value.hash\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdocument = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\t\t\tmigrationsTotal: value.applied.length,\n\t\t\t\t\tmarkerHash: value.markerHash,\n\t\t\t\t\tapplied: value.applied,\n\t\t\t\t\tsummary: value.summary,\n\t\t\t\t\tperSpace: value.perSpace,\n\t\t\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\t\t\ttimings: { total: Date.now() - startedAt },\n\t\t\t\t\tadvancedRef\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(mapCaughtMigrationError(error) ?? errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tctx.report({\n\t\t\t\tkind: \"message\",\n\t\t\t\tseverity: \"verbose\",\n\t\t\t\ttext: `Total time: ${document.timings.total}ms`\n\t\t\t});\n\t\t\treturn ok(ctx.present({ data: document }, applyPresentations({\n\t\t\t\tdocument,\n\t\t\t\tmigrationsDir: migrationsRelative,\n\t\t\t\tdatabase: prepared.value.database,\n\t\t\t\tto: args.flags.to\n\t\t\t})));\n\t\t}\n\t});\n}\nconst migrateCommand = createMigrateCommand(createControlClient);\n//#endregion\n//#region src/orm/migration/graph.ts\n/**\n* The tree is a drawing for a reader; the DOT document is a graph description\n* for another program, so it is the one thing here that belongs on stdout.\n*/\nfunction graphPresentations(inputs) {\n\tconst { tree, dot, legend } = inputs;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t}, ...inputs.space === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: inputs.space\n\t\t\t\t}]]\n\t\t\t},\n\t\t\t...tree === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(tree)\n\t\t\t}],\n\t\t\t...legend === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(legend)\n\t\t\t}]\n\t\t],\n\t\t...dot === void 0 ? {} : { stdout: () => dot.split(\"\\n\") },\n\t\tjson: () => inputs.document\n\t};\n}\nfunction graphSummary(spaces) {\n\tconst contracts = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contracts} contract(s), ${migrations} migration(s)`;\n}\nconst migrationGraphCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Show the migration graph topology\",\n\t\tdescription: \"Renders the migration graph topology. Offline — does not consult the\\ndatabase. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\n--dot emits Graphviz DOT for the app graph instead of the tree, and\\nignores --space; in json mode the result carries the DOT text alongside\\nthe graph document.\",\n\t\texamples: [\n\t\t\t\"migration graph\",\n\t\t\t\"migration graph --json\",\n\t\t\t\"migration graph --dot\",\n\t\t\t\"migration graph --ascii\",\n\t\t\t\"migration graph --legend\",\n\t\t\t\"migration graph --space app\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tspace: flag.string({\n\t\t\tbrief: \"Narrow output to a single contract space\",\n\t\t\tplaceholder: \"id\"\n\t\t}),\n\t\tdot: flag.boolean({ brief: \"Emit Graphviz DOT for the app graph\" }),\n\t\tascii: flag.boolean({ brief: \"Use ASCII glyphs (pipe-friendly)\" }),\n\t\tlegend: flag.boolean({ brief: \"Print a key for the tree glyphs and lane colors\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tif (args.flags.legend && args.flags.dot) return notOk(normalizeError(errorLegendHumanOnly(\"--dot\")));\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst loaded = await buildReadAggregate(ctx.config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\t\tconst listed = runMigrationList({\n\t\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t\t...ifDefined(\"spaceFilter\", args.flags.space)\n\t\t});\n\t\tif (!listed.ok) return notOk(normalizeError(listed.failure));\n\t\tconst scopedSpaces = listed.value.spaces;\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\tconst graphSpaces = [...buildMigrationSpaceGraphEntries({\n\t\t\taggregate,\n\t\t\tscopedSpaces\n\t\t})];\n\t\tconst summary = graphSummary(graphSpaces);\n\t\tconst graphDocument = {\n\t\t\tok: true,\n\t\t\tspaces: graphSpaces,\n\t\t\tsummary\n\t\t};\n\t\tconst dot = args.flags.dot ? renderMigrationGraphDot(aggregate.app.graph()) : void 0;\n\t\tconst document = dot === void 0 ? graphDocument : {\n\t\t\t...graphDocument,\n\t\t\tdot\n\t\t};\n\t\tconst styler = createToneMigrationListStyler();\n\t\tconst tree = dot === void 0 ? renderMigrationGraphSections(buildMigrationGraphTreeSections({\n\t\t\taggregate,\n\t\t\tscopedSpaces,\n\t\t\tliveContractHash,\n\t\t\tglyphMode,\n\t\t\tcolorize: true,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}), styler.summary(summary)) : void 0;\n\t\tconst legend = args.flags.legend ? renderMigrationGraphLegend({\n\t\t\tcolorize: true,\n\t\t\tglyphMode,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}) : void 0;\n\t\treturn ok(ctx.present({ data: document }, graphPresentations({\n\t\t\tdocument,\n\t\t\ttree,\n\t\t\tdot,\n\t\t\tmigrationsDir: displayPath(migrationsDir, ctx.cwd),\n\t\t\tspace: args.flags.space,\n\t\t\tlegend\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/list.ts\nfunction listPresentations(inputs) {\n\tconst legend = inputs.legend;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t}, ...inputs.space === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: inputs.space\n\t\t\t\t}]]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(inputs.tree)\n\t\t\t},\n\t\t\t...legend === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(legend)\n\t\t\t}]\n\t\t],\n\t\tjson: () => inputs.list\n\t};\n}\nconst migrationListCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"List on-disk migrations per contract space\",\n\t\tdescription: \"Enumerates every on-disk migration under migrations/<space>/ for every\\ncontract space found on disk. Offline — does not consult the database.\\nHuman output draws the shared migration graph tree with operation counts,\\ninvariants on each migration row, and refs on destination contract nodes.\\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\\ntree glyphs.\",\n\t\texamples: [\n\t\t\t\"migration list\",\n\t\t\t\"migration list --space app\",\n\t\t\t\"migration list --ascii\",\n\t\t\t\"migration list --legend\",\n\t\t\t\"migration list --json\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tspace: flag.string({\n\t\t\tbrief: \"Narrow output to a single contract space\",\n\t\t\tplaceholder: \"id\"\n\t\t}),\n\t\tascii: flag.boolean({ brief: \"Use ASCII kind glyphs (pipe-friendly)\" }),\n\t\tlegend: flag.boolean({ brief: \"Print a key for the tree glyphs and lane colors\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst loaded = await buildReadAggregate(ctx.config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\t\tconst listed = runMigrationList({\n\t\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t\t...ifDefined(\"spaceFilter\", args.flags.space)\n\t\t});\n\t\tif (!listed.ok) return notOk(normalizeError(listed.failure));\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\tconst styler = createToneMigrationListStyler();\n\t\tconst tree = renderMigrationListWithStyle(listed.value, styler, glyphMode, {\n\t\t\tcolorize: true,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE,\n\t\t\tliveContractHash,\n\t\t\tgraphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n\t\t\tappSpaceId: aggregate.app.spaceId\n\t\t});\n\t\tconst legend = args.flags.legend ? renderMigrationGraphLegend({\n\t\t\tcolorize: true,\n\t\t\tglyphMode,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}) : void 0;\n\t\treturn ok(ctx.present({ data: listed.value }, listPresentations({\n\t\t\tlist: listed.value,\n\t\t\ttree,\n\t\t\tmigrationsDir: displayPath(migrationsDir, ctx.cwd),\n\t\t\tspace: args.flags.space,\n\t\t\tlegend\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/log.ts\nconst HEADING_APPLIED_AT = \"Applied at\";\nconst HEADING_SPACE = \"Space\";\nconst HEADING_MIGRATION = \"Migration\";\nconst HEADING_CHANGE = \"Change\";\nconst HEADING_OPS = \"Ops\";\n/**\n* The ledger laid out for the engine to size. The Space heading appears only\n* when more than one contract space has run, as it does in the commander shell.\n*/\nfunction ledgerGrid(entries, options) {\n\tconst styler = createToneMigrationListStyler();\n\tconst sorted = sortLedgerEntries(entries);\n\tconst showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n\tconst headings = [HEADING_APPLIED_AT];\n\tif (showSpace) headings.push(HEADING_SPACE);\n\theadings.push(HEADING_MIGRATION, HEADING_CHANGE, HEADING_OPS);\n\treturn {\n\t\theadings,\n\t\trows: sorted.map((entry) => {\n\t\t\tconst cells = [formatLedgerAppliedAt(entry.appliedAt, options.utc ? \"utc\" : \"local\")];\n\t\t\tif (showSpace) cells.push(entry.space);\n\t\t\tcells.push(toneSpans(styler.dirName(entry.migrationName)), toneSpans(styleHashTransition(entry.from, entry.to, styler, options.glyphMode)), `${entry.operationCount} ops`);\n\t\t\treturn cells;\n\t\t})\n\t};\n}\nfunction logPresentations(inputs) {\n\tconst grid = inputs.grid;\n\treturn {\n\t\thuman: () => [...inputs.database === void 0 ? [] : [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: inputs.database\n\t\t\t}]\n\t\t}], ...grid === void 0 ? [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: MIGRATION_LOG_EMPTY_MESSAGE\n\t\t}] : [{\n\t\t\tkind: \"table\",\n\t\t\tcolumns: grid.headings,\n\t\t\trows: grid.rows\n\t\t}]],\n\t\tjson: () => inputs.document\n\t};\n}\nconst migrationLogCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Show executed migration history\",\n\t\tdescription: \"Reads the database ledger and displays every applied migration edge in\\nchronological order, including rollbacks and re-applies, merged across\\nall contract spaces. Requires a database connection.\",\n\t\texamples: [\n\t\t\t\"migration log\",\n\t\t\t\"migration log --db $DATABASE_URL\",\n\t\t\t\"migration log --utc\",\n\t\t\t\"migration log --json\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tdb: dbFlag,\n\t\tutc: flag.boolean({ brief: \"Render human timestamps in UTC instead of local time\" }),\n\t\tascii: flag.boolean({ brief: \"Use ASCII glyphs (pipe-friendly)\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver: ctx.config.driver !== void 0,\n\t\t\twhy: \"migration log needs a database connection and driver to read the ledger (set db.connection in prisma-next.config.ts, or pass --db <url>)\",\n\t\t\tcommandName: \"migration log\"\n\t\t});\n\t\tif (missingDb !== null) return notOk(normalizeError(missingDb));\n\t\tif (!targetSupportsMigrations(ctx.config.target)) return notOk(normalizeError(errorTargetMigrationNotSupported({ why: \"migration log reads the ledger a migration runner writes, and the configured target provides no runner.\" })));\n\t\tconst client = createControlClient({\n\t\t\tfamily: ctx.config.family,\n\t\t\ttarget: ctx.config.target,\n\t\t\tadapter: ctx.config.adapter,\n\t\t\t...ifDefined(\"driver\", ctx.config.driver),\n\t\t\textensions: ctx.config.extensions ?? []\n\t\t});\n\t\tlet entries;\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tentries = await client.readLedger();\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(mapCaughtMigrationError(error) ?? errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` })));\n\t\t} finally {\n\t\t\tawait closeQuietly(client);\n\t\t}\n\t\tconst records = serializeLedgerEntriesForJson(entries);\n\t\tconst document = {\n\t\t\tok: true,\n\t\t\trecords,\n\t\t\tsummary: `${records.length} migration(s) applied`\n\t\t};\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\treturn ok(ctx.present({ data: document }, logPresentations({\n\t\t\tdocument,\n\t\t\tgrid: entries.length === 0 ? void 0 : ledgerGrid(entries, {\n\t\t\t\tutc: args.flags.utc,\n\t\t\t\tglyphMode\n\t\t\t}),\n\t\t\tdatabase: typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/show.ts\n/** One node per operation, the destructive ones carrying the warning glyph. */\nfunction operationNodes(migration) {\n\treturn migration.operations.map((operation) => operation.operationClass === \"destructive\" ? {\n\t\tlabel: operation.label,\n\t\tstatus: \"warn\"\n\t} : { label: operation.label });\n}\nfunction operationBlocks(migration) {\n\tif (migration.operations.length === 0) return [{\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttext: \"No operations.\"\n\t}];\n\tconst destructive = migration.operations.some((operation) => operation.operationClass === \"destructive\");\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: [{\n\t\t\tlabel: `${migration.operations.length} operation(s)`,\n\t\t\tchildren: operationNodes(migration)\n\t\t}]\n\t}, ...destructive ? [{\n\t\tkind: \"summary\",\n\t\tstatus: \"warn\",\n\t\ttext: \"This migration contains destructive operations that may cause data loss.\"\n\t}] : []];\n}\n/**\n* The statement preview: text a database would run, printed verbatim rather\n* than laid out, so nothing is re-wrapped between here and the reader.\n*/\nfunction previewBlocks(migration) {\n\tconst statements = migration.preview.statements.map((statement) => renderPreviewStatement(statement.text, statement.language)).filter((text) => text !== void 0);\n\tif (statements.length === 0) return [];\n\treturn [{\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: previewBlockHeader(migration.preview)\n\t}, {\n\t\tkind: \"drawing\",\n\t\tlines: statements\n\t}];\n}\nfunction showPresentations(inputs) {\n\tconst migration = inputs.document.migration;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"contract\",\n\t\t\t\t\t\tvalue: inputs.contractPath\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.appMigrationsRelative\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"target\",\n\t\t\t\t\t\tvalue: inputs.target\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: [{\n\t\t\t\t\ttext: migration.name,\n\t\t\t\t\ttone: \"emphasis\"\n\t\t\t\t}]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\t\tvalue: migration.fromContract === null ? [{\n\t\t\t\t\t\t\ttext: \"(baseline)\",\n\t\t\t\t\t\t\ttone: \"muted\"\n\t\t\t\t\t\t}] : [{\n\t\t\t\t\t\t\ttext: migration.fromContract,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.toContract,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"hash\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.hash,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"created\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.createdAt,\n\t\t\t\t\t\t\ttone: \"muted\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t...operationBlocks(migration),\n\t\t\t...previewBlocks(migration)\n\t\t],\n\t\tjson: () => inputs.document\n\t};\n}\n/**\n* A path-looking target must land inside `migrations/app/`; anything else is a\n* migration reference resolved against the app graph and refs. Both routes are\n* app-space only, as they are today.\n*/\nfunction resolvePackage(inputs) {\n\tif (looksLikePath(inputs.target)) {\n\t\tconst path = resolveAppTargetPath(inputs.cwd, inputs.target, inputs.appMigrationsDir, inputs.appMigrationsRelative);\n\t\tif (!path.ok) return notOk(normalizeError(path.failure));\n\t\tconst matched = findPackageByDirPath(inputs.packages, path.value);\n\t\treturn matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`No loaded migration package at ${relative(inputs.cwd, path.value)}`))) : ok(matched);\n\t}\n\tif (inputs.packages.length === 0) return notOk(normalizeError(errorNoMigrations(inputs.appMigrationsRelative)));\n\tconst ref = resolveMigrationRef(inputs.target, {\n\t\tgraph: inputs.graph,\n\t\trefs: inputs.refs\n\t});\n\tif (!ref.ok) return notOk(normalizeError(ref.failure));\n\tconst matched = inputs.packages.find((candidate) => candidate.metadata.migrationHash === ref.value.migrationHash);\n\treturn matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`Resolved migration \"${ref.value.dirName}\" but the package was not loaded`))) : ok(matched);\n}\nconst migrationShowCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Display migration package contents\",\n\t\tdescription: \"Shows the operations, statement preview, and metadata for one app-space\\nmigration. Accepts a directory path, directory name, or hash prefix.\\nOffline — does not consult the database.\",\n\t\texamples: [\n\t\t\t\"migration show 20260101_100000_add_user\",\n\t\t\t\"migration show a1b2c3\",\n\t\t\t\"migration show migrations/app/20260101_100000_add_user\",\n\t\t\t\"migration show 20260101_100000_add_user --json\"\n\t\t]\n\t},\n\targs: { positionals: { target: positional.string({\n\t\tbrief: \"Migration reference: directory name, hash/prefix, ref, or path\",\n\t\tplaceholder: \"target\"\n\t}) } },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst { target } = args.positionals;\n\t\tconst contractPath = contractPathFor(ctx.config, ctx.cwd);\n\t\tif (contractPath === void 0) return notOk(normalizeError(errorConfigValidation(\"contract.output\", {\n\t\t\twhy: \"migration show reads the emitted contract from config.contract.output; the config has no value to read.\",\n\t\t\tsection: \"contract\"\n\t\t})));\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst appMigrationsDir = appMigrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst appMigrationsRelative = displayPath(appMigrationsDir, ctx.cwd);\n\t\tlet contractJson;\n\t\ttry {\n\t\t\tcontractJson = await readFile(contractPath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(Reflect.get(Object(error), \"code\") === \"ENOENT\" ? errorFileNotFound(contractPath, {\n\t\t\t\twhy: `Contract file not found at ${contractPath}`,\n\t\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${relative(ctx.cwd, contractPath)}`\n\t\t\t}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to read contract file\" })));\n\t\t}\n\t\tconst familyInstance = ctx.config.family.create(createControlStack(ctx.config));\n\t\tlet appContract;\n\t\ttry {\n\t\t\tappContract = familyInstance.deserializeContract(castAs(JSON.parse(contractJson)));\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t\t}\n\t\tconst loaded = await loadContractSpaceAggregateForCli({\n\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\tmigrationsDir,\n\t\t\tappContract,\n\t\t\textensions: [],\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t\t});\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst aggregate = loaded.value;\n\t\tconst resolved = resolvePackage({\n\t\t\ttarget,\n\t\t\tcwd: ctx.cwd,\n\t\t\tappMigrationsDir,\n\t\t\tappMigrationsRelative,\n\t\t\tpackages: aggregate.app.packages,\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs: aggregate.app.refs\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tconst pkg = resolved.value;\n\t\tconst client = createControlClient({\n\t\t\tfamily: ctx.config.family,\n\t\t\ttarget: ctx.config.target,\n\t\t\tadapter: ctx.config.adapter,\n\t\t\t...ifDefined(\"driver\", ctx.config.driver),\n\t\t\textensions: ctx.config.extensions ?? []\n\t\t});\n\t\tconst ops = castAs(pkg.ops);\n\t\tconst preview = client.toOperationPreview(ops) ?? { statements: [] };\n\t\tconst migration = {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\toperations: ops.map((op) => ({\n\t\t\t\tid: op.id,\n\t\t\t\tlabel: op.label,\n\t\t\t\toperationClass: op.operationClass\n\t\t\t})),\n\t\t\tpreview: { statements: [...preview.statements] }\n\t\t};\n\t\tconst document = {\n\t\t\tok: true,\n\t\t\tsummary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,\n\t\t\tmigration\n\t\t};\n\t\treturn ok(ctx.present({ data: document }, showPresentations({\n\t\t\tdocument,\n\t\t\tcontractPath: displayPath(contractPath, ctx.cwd),\n\t\t\tappMigrationsRelative,\n\t\t\ttarget\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/family.ts\n/**\n* The engine derives each diagnostic's docs link from this base plus the\n* dotted code.\n*/\nconst DOCS_BASE_URL = `${DOCS_BASE}/`;\n/**\n* The unit the ORM contributes to a CLI: its config section, its commands by\n* name, where its diagnostics are documented, and the invocations it retired.\n* The shell owns the command tree, so nothing here says where a command mounts.\n*/\nconst ormCommandFamily = defineCommandFamily({\n\tconfigSection: ormConfigSection,\n\tcommands: {\n\t\t\"db init\": dbInitCommand,\n\t\t\"db schema\": dbSchemaCommand,\n\t\tmigrate: migrateCommand,\n\t\t\"migration graph\": migrationGraphCommand,\n\t\t\"migration list\": migrationListCommand,\n\t\t\"migration log\": migrationLogCommand,\n\t\t\"migration show\": migrationShowCommand\n\t},\n\tdocsBaseUrl: DOCS_BASE_URL,\n\tredirects: [{\n\t\tfrom: \"migration apply\",\n\t\treplacement: \"{bin} migrate --to <contract>\",\n\t\treason: \"Applying a migration is a move to a target contract, not a verb of its own.\"\n\t}, {\n\t\tfrom: \"migration ref\",\n\t\treplacement: \"{bin} ref set|list|delete\",\n\t\treason: \"Refs are managed by their own command, for every space rather than migrations alone.\"\n\t}]\n});\n//#endregion\n//#region src/orm/load-config.ts\n/** The file the ORM's loader reads when `--config` names none. */\nconst ORM_CONFIG_FILENAME = \"prisma-next.config.ts\";\n/**\n* Builds the engine's `Runtime.config` from `prisma-next.config.ts`.\n*\n* The engine's own loader reads `prisma.config.ts` and the `$prismaConfig`\n* marker, which is not the file this bin reads, so the bin owns the load: the\n* ORM's c12 loader evaluates the module asynchronously and finalizes paths\n* against the config file's own directory. The whole result nests as the\n* single `orm` section — the engine models one section per family, and\n* `contract`, `db`, `migrations` and the rest are subsections of it.\n*\n* Only failures that prevent evaluation entirely are diagnostics here, and\n* they carry `section: null` so they fail exactly the commands that read\n* config. Structural verdicts belong to the section validator.\n*/\nasync function loadOrmConfig(options) {\n\tconst path = resolve(options.cwd, options.configPath ?? ORM_CONFIG_FILENAME);\n\tconst loaded = await loadConfig(options.configPath, { cwd: options.cwd });\n\tif (!loaded.ok) return {\n\t\tpath,\n\t\tsections: {},\n\t\tdiagnostics: [{\n\t\t\tsection: null,\n\t\t\tdiagnostic: toEngineDiagnostic(loaded.failure)\n\t\t}]\n\t};\n\treturn {\n\t\tpath,\n\t\tsections: { [\"orm\"]: loaded.value.config },\n\t\tdiagnostics: []\n\t};\n}\n//#endregion\nexport { migrationListCommand as a, createDbSchemaCommand as c, ormConfigSection as d, migrationLogCommand as i, createDbInitCommand as l, ormCommandFamily as n, migrationGraphCommand as o, migrationShowCommand as r, createMigrateCommand as s, loadOrmConfig as t, normalizeError as u };\n\n//# sourceMappingURL=load-config-BQgwPvgu.mjs.map","import { t as createContractEmitCommand } from \"../contract-emit-BlvUNMHM.mjs\";\nimport { t as createFormatCommand } from \"../format-D5x0jz7q.mjs\";\nimport { d as ormConfigSection, n as ormCommandFamily, t as loadOrmConfig } from \"../load-config-BQgwPvgu.mjs\";\nimport { CliStructuredError } from \"@internal/errors/control\";\nimport { join, resolve } from \"pathe\";\nimport { existsSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { tmpdir } from \"node:os\";\nimport { pathToFileURL } from \"node:url\";\nimport { build } from \"esbuild\";\n//#region src/load-ts-contract.ts\nfunction contractSourceError(code, message, options) {\n\tconst error = new CliStructuredError(code, message, options?.meta !== void 0 ? { meta: options.meta } : void 0);\n\tif (options?.cause !== void 0) error.cause = options.cause;\n\treturn error;\n}\nconst DEFAULT_ALLOWLIST = [\n\t\"@internal/*\",\n\t\"@prisma/orm-*\",\n\t\"node:crypto\"\n];\nfunction isAllowedImport(importPath, allowlist) {\n\tfor (const pattern of allowlist) if (pattern.endsWith(\"/*\")) {\n\t\tconst prefix = pattern.slice(0, -2);\n\t\tif (importPath === prefix || importPath.startsWith(`${prefix}/`)) return true;\n\t} else if (pattern.endsWith(\"*\")) {\n\t\tconst prefix = pattern.slice(0, -1);\n\t\tif (importPath.startsWith(prefix)) return true;\n\t} else if (importPath === pattern) return true;\n\treturn false;\n}\nfunction validatePurity(value, entryPath) {\n\tif (typeof value !== \"object\" || value === null) return;\n\tconst path = /* @__PURE__ */ new WeakSet();\n\tfunction check(value) {\n\t\tif (value === null || typeof value !== \"object\") return;\n\t\tif (path.has(value)) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", \"Contract export contains circular references\", { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"circular\"\n\t\t} });\n\t\tpath.add(value);\n\t\ttry {\n\t\t\tfor (const key in value) {\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\t\t\tif (descriptor && (descriptor.get || descriptor.set)) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export contains getter/setter at key \"${key}\"`, { meta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"getter\",\n\t\t\t\t\tkey\n\t\t\t\t} });\n\t\t\t\tif (descriptor && typeof descriptor.value === \"function\") throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export contains function at key \"${key}\"`, { meta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"function\",\n\t\t\t\t\tkey\n\t\t\t\t} });\n\t\t\t\tcheck(value[key]);\n\t\t\t}\n\t\t} finally {\n\t\t\tpath.delete(value);\n\t\t}\n\t}\n\ttry {\n\t\tcheck(value);\n\t\tJSON.stringify(value);\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tif (error.message.includes(\"getter\") || error.message.includes(\"circular\")) throw error;\n\t\t\tthrow contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export is not JSON-serializable: ${error.message}`, {\n\t\t\t\tmeta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"not-json-serializable\"\n\t\t\t\t},\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t\tthrow contractSourceError(\"CONTRACT.EXPORT_INVALID\", \"Contract export is not JSON-serializable\", { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"not-json-serializable\"\n\t\t} });\n\t}\n}\nfunction createImportAllowlistPlugin(allowlist, entryPath, collected) {\n\tconst entryAbs = resolve(entryPath);\n\tfunction isFromEntry(importer) {\n\t\treturn importer === entryAbs || importer === entryPath || importer === \"<stdin>\";\n\t}\n\treturn {\n\t\tname: \"import-allowlist\",\n\t\tsetup(build) {\n\t\t\tbuild.onResolve({ filter: /.*/ }, (args) => {\n\t\t\t\tif (args.kind === \"entry-point\") return;\n\t\t\t\tif (args.path.startsWith(\".\") || args.path.startsWith(\"/\")) return;\n\t\t\t\tif (isFromEntry(args.importer) && !isAllowedImport(args.path, allowlist)) {\n\t\t\t\t\tcollected.add(args.path);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpath: args.path,\n\t\t\t\t\t\texternal: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}\n/**\n* Loads a contract from a TypeScript file and returns it as Contract.\n*\n* **Responsibility: Parsing Only**\n* This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n* The contract should already be normalized if it was built using the contract builder.\n*\n* Normalization must happen in the contract builder when the contract is created.\n* This function only validates that the contract is JSON-serializable and returns it as-is.\n*\n* @param entryPath - Path to the TypeScript contract file\n* @param options - Optional configuration (import allowlist)\n* @returns The contract as Contract (should already be normalized)\n* @throws structured errors: `CLI.FILE_NOT_FOUND`, `CONTRACT.SOURCE_LOAD_FAILED`,\n* `CONTRACT.SOURCE_IMPORT_DISALLOWED`, `CONTRACT.MODULE_EXPORT_MISSING`, `CONTRACT.EXPORT_INVALID`\n*/\nasync function loadContractFromTs(entryPath, options) {\n\tconst allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\tif (!existsSync(entryPath)) throw new CliStructuredError(\"CLI.FILE_NOT_FOUND\", `Contract file not found: ${entryPath}`, { where: { path: entryPath } });\n\tconst tempFile = join(tmpdir(), `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`);\n\tconst disallowedFromEntry = /* @__PURE__ */ new Set();\n\ttry {\n\t\tconst result = await build({\n\t\t\tentryPoints: [entryPath],\n\t\t\tbundle: true,\n\t\t\tformat: \"esm\",\n\t\t\tplatform: \"node\",\n\t\t\ttarget: \"es2022\",\n\t\t\toutfile: tempFile,\n\t\t\twrite: false,\n\t\t\tmetafile: true,\n\t\t\tplugins: [createImportAllowlistPlugin(allowlist, entryPath, disallowedFromEntry)],\n\t\t\tlogLevel: \"error\"\n\t\t});\n\t\tif (result.errors.length > 0) throw contractSourceError(\"CONTRACT.SOURCE_LOAD_FAILED\", `Failed to bundle contract file: ${result.errors.map((e) => e.text).join(\"\\n\")}`, { meta: {\n\t\t\tpath: entryPath,\n\t\t\tstage: \"bundle\"\n\t\t} });\n\t\tif (!result.outputFiles || result.outputFiles.length === 0) throw new InternalError(\"No output files generated from bundling\");\n\t\tif (disallowedFromEntry.size > 0) throw contractSourceError(\"CONTRACT.SOURCE_IMPORT_DISALLOWED\", `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(\", \")}\\n Disallowed imports: ${[...disallowedFromEntry].join(\", \")}`, { meta: {\n\t\t\tallowlist: [...allowlist],\n\t\t\tdisallowed: [...disallowedFromEntry]\n\t\t} });\n\t\tconst bundleContent = result.outputFiles[0]?.text;\n\t\tif (bundleContent === void 0) throw new InternalError(\"Bundle content is undefined\");\n\t\twriteFileSync(tempFile, bundleContent, \"utf-8\");\n\t\tconst module = await import(\n\t\t\t/* @vite-ignore */\n\t\t\tpathToFileURL(tempFile).href\n);\n\t\tunlinkSync(tempFile);\n\t\tlet contract;\n\t\tif (module.default !== void 0) contract = module.default;\n\t\telse if (module.contract !== void 0) contract = module.contract;\n\t\telse throw new CliStructuredError(\"CONTRACT.MODULE_EXPORT_MISSING\", `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module).join(\", \") || \"none\"}`, { where: { path: entryPath } });\n\t\tif (typeof contract !== \"object\" || contract === null) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export must be an object, got ${typeof contract}`, { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"not-object\"\n\t\t} });\n\t\tvalidatePurity(contract, entryPath);\n\t\treturn contract;\n\t} catch (error) {\n\t\ttry {\n\t\t\tif (tempFile) unlinkSync(tempFile);\n\t\t} catch {}\n\t\tif (error instanceof Error) throw error;\n\t\tthrow contractSourceError(\"CONTRACT.SOURCE_LOAD_FAILED\", `Failed to load contract from ${entryPath}: ${String(error)}`, {\n\t\t\tmeta: {\n\t\t\t\tpath: entryPath,\n\t\t\t\tstage: \"import\"\n\t\t\t},\n\t\t\tcause: error\n\t\t});\n\t}\n}\n//#endregion\nexport { createContractEmitCommand, createFormatCommand, loadContractFromTs, loadOrmConfig, ormCommandFamily, ormConfigSection };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;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,EAAE,CAAC;EACH,MAAM,gBAAgB,OAAO,YAAY,EAAE,EAAE;EAC7C,IAAI,kBAAkB,KAAK,GAAG,MAAM,IAAI,cAAc,6BAA6B;EACnF,cAAc,UAAU,eAAe,OAAO;EAC9C,MAAM,SAAS,MAAM;;GAEpB,cAAc,QAAQ,CAAC,CAAC;;EAEzB,WAAW,QAAQ;EACnB,IAAI;EACJ,IAAI,OAAO,YAAY,KAAK,GAAG,WAAW,OAAO;OAC5C,IAAI,OAAO,aAAa,KAAK,GAAG,WAAW,OAAO;OAClD,MAAM,IAAI,mBAAmB,kCAAkC,qGAAqG,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,IAAI,KAAK,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,EAAE,CAAC;EACnP,IAAI,OAAO,aAAa,YAAY,aAAa,MAAM,MAAM,oBAAoB,2BAA2B,0CAA0C,OAAO,YAAY,EAAE,MAAM;GAChL,MAAM;GACN,QAAQ;EACT,EAAE,CAAC;EACH,eAAe,UAAU,SAAS;EAClC,OAAO;CACR,SAAS,OAAO;EACf,IAAI;GACH,IAAI,UAAU,WAAW,QAAQ;EAClC,QAAQ,CAAC;EACT,IAAI,iBAAiB,OAAO,MAAM;EAClC,MAAM,oBAAoB,+BAA+B,gCAAgC,UAAU,IAAI,OAAO,KAAK,KAAK;GACvH,MAAM;IACL,MAAM;IACN,OAAO;GACR;GACA,OAAO;EACR,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["CliStructuredError","errorConfigValidation","CliStructuredError$1","createFormatCommand"],"sources":["../../../../1-framework/3-tooling/cli/dist/load-config-h2VTJG-X.mjs","../../../../1-framework/3-tooling/cli/dist/exports/index.mjs"],"sourcesContent":["import { A as errorTargetMigrationNotSupported, I as runCommandAction, M as errorUnexpected, P as requireLiveDatabase, _ as errorMigrationPackageNotFound, i as errorConfigValidation, l as errorDriverRequired, m as errorLegendHumanOnly, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError$1, u as errorFileNotFound, y as errorNoMigrations } from \"./cli-errors-C6_pH59O.mjs\";\nimport { d as renderPreviewStatement, u as previewBlockHeader } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { a as maskConnectionUrl, l as sanitizeErrorMessage, n as closeQuietly, p as targetSupportsMigrations } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { a as loadContractSpaceAggregateForCli, r as buildReadAggregate, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-BpdB-mHG.mjs\";\nimport { t as createControlClient } from \"./client-BqhVohc5.mjs\";\nimport { a as readContractIR, o as resolveRefAdvancementFields, t as advanceRefSafely } from \"./ref-advancement-DaZBzm7m.mjs\";\nimport { t as mapDbInitFailure } from \"./db-init-failure-XYOVL4o7.mjs\";\nimport { t as executeFormat } from \"./format-B-3QEUOd.mjs\";\nimport { t as mapCaughtMigrationError } from \"./caught-errors-BZ-9WASe.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-CLFX1-Gc.mjs\";\nimport { i as refuseMarkerOutsideGraph, n as refuseUnknownInvariants } from \"./invariants-1L2zfc6-.mjs\";\nimport { t as executeMigrateShowPlan } from \"./migrate-show-bdXjSFgh.mjs\";\nimport { n as resolveMigrationRef, t as resolveContractRef } from \"./ref-resolution-D4fAdXo8.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"./migration-list-W0dqabIj.mjs\";\nimport { S as toneSpans, a as renderMigrationGraphLegend, b as TONE_MIGRATION_GRAPH_PALETTE, l as renderMigrationListWithStyle, s as createToneMigrationListStyler, x as toneDrawing } from \"./migration-graph-command-render-BeuEyf2B.mjs\";\nimport { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from \"./migrate-failure-Bdr3AJee.mjs\";\nimport { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-5r1leSW5.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"./migration-graph-DmdVVJoZ.mjs\";\nimport { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from \"./migration-graph-sections-BWcFCOL6.mjs\";\nimport { a as sortLedgerEntries, i as serializeLedgerEntriesForJson, n as formatLedgerAppliedAt, o as styleHashTransition, t as MIGRATION_LOG_EMPTY_MESSAGE } from \"./migration-log-table-DRiOnvzf.mjs\";\nimport { n as executeRefListCommand, r as executeRefSetCommand, t as executeRefDeleteCommand } from \"./ref-CVD6j3jA.mjs\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { normalize, relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { DOCS_BASE, isStructuredError } from \"@internal/utils/structured-error\";\nimport { defineCommand, defineCommandFamily, defineConfigSection, flag, positional } from \"@prisma/cli-engine\";\nimport { CliStructuredError, notOk, ok } from \"@prisma/cli-engine/protocol\";\nimport { collectConfigIssues } from \"@internal/config/config-validation\";\nconst MISSING_CONFIG_ACTION = {\n\tkind: \"run-command\",\n\tlabel: \"Create a configuration file\",\n\tcommand: \"prisma-next init\"\n};\nfunction editConfigAction(field) {\n\treturn {\n\t\tkind: \"edit-file\",\n\t\tlabel: `Correct ${field} in prisma-next.config.ts`\n\t};\n}\nfunction issueDiagnostic(issue) {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: issue.message,\n\t\twhy: issue.message,\n\t\tnextActions: [editConfigAction(issue.field)],\n\t\tmeta: {\n\t\t\tfield: issue.field,\n\t\t\tsection: issue.section\n\t\t}\n\t};\n}\nfunction sectionAbsentDiagnostic() {\n\treturn {\n\t\tcode: \"CONFIG.FILE_NOT_FOUND\",\n\t\tseverity: \"error\",\n\t\tsummary: \"No Prisma Next configuration was loaded\",\n\t\twhy: `The orm config section is absent, so prisma-next.config.ts was never evaluated.`,\n\t\tnextActions: [MISSING_CONFIG_ACTION]\n\t};\n}\nfunction notAnObjectDiagnostic() {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: \"Prisma Next configuration must be an object\",\n\t\twhy: `The orm config section is not an object, so no section can be read from it.`,\n\t\tnextActions: [{\n\t\t\tkind: \"edit-file\",\n\t\t\tlabel: \"Export a configuration object from prisma-next.config.ts\"\n\t\t}]\n\t};\n}\nfunction unreadableDiagnostic(error) {\n\treturn {\n\t\tcode: \"CONFIG.VALIDATION_FAILED\",\n\t\tseverity: \"error\",\n\t\tsummary: \"Prisma Next configuration could not be inspected\",\n\t\twhy: error instanceof Error ? error.message : String(error),\n\t\tnextActions: [{\n\t\t\tkind: \"edit-file\",\n\t\t\tlabel: \"Export a plain configuration object from prisma-next.config.ts\"\n\t\t}]\n\t};\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/**\n* An emitted artifact listed as its own contract input makes every emit\n* consume its previous output. Structural, filesystem-free, and therefore the\n* section validator's business rather than the loader's.\n*/\nfunction collectArtifactCollisionIssues(raw) {\n\tconst contract = raw[\"contract\"];\n\tif (!isRecord(contract)) return [];\n\tconst source = contract[\"source\"];\n\tconst output = contract[\"output\"];\n\tif (!isRecord(source) || typeof output !== \"string\") return [];\n\tconst inputs = source[\"inputs\"];\n\tif (!Array.isArray(inputs)) return [];\n\tlet emitted;\n\ttry {\n\t\temitted = getEmittedArtifactPaths(output);\n\t} catch (error) {\n\t\treturn [{\n\t\t\tsection: \"contract\",\n\t\t\tfield: \"contract.output\",\n\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t}];\n\t}\n\tconst emittedPaths = /* @__PURE__ */ new Set([normalize(emitted.jsonPath), normalize(emitted.dtsPath)]);\n\tif (!inputs.some((input) => typeof input === \"string\" && emittedPaths.has(normalize(input)))) return [];\n\treturn [{\n\t\tsection: \"contract\",\n\t\tfield: \"contract.source.inputs[]\",\n\t\tmessage: \"Config.contract.source.inputs must not include emitted artifact paths derived from contract.output\"\n\t}];\n}\nfunction validate(raw) {\n\tif (raw === void 0) return {\n\t\tok: false,\n\t\tdiagnostics: [sectionAbsentDiagnostic()]\n\t};\n\tif (!isRecord(raw)) return {\n\t\tok: false,\n\t\tdiagnostics: [notAnObjectDiagnostic()]\n\t};\n\tlet issues;\n\ttry {\n\t\tissues = [...collectConfigIssues(raw), ...collectArtifactCollisionIssues(raw)];\n\t} catch (error) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdiagnostics: [unreadableDiagnostic(error)]\n\t\t};\n\t}\n\tif (issues.length > 0) return {\n\t\tok: false,\n\t\tdiagnostics: issues.map(issueDiagnostic)\n\t};\n\treturn {\n\t\tok: true,\n\t\tvalue: blindCast(raw),\n\t\tdiagnostics: []\n\t};\n}\nconst ormConfigSection = defineConfigSection({\n\tname: \"orm\",\n\tvalidate\n});\n//#endregion\n//#region src/orm/normalize-error.ts\n/**\n* `isStructuredError` is the repo's own check, and it is the one that matters here: it holds the\n* regular expression for a dotted `NAMESPACE.SUBCODE`, so only a code the protocol accepts\n* reaches `Diagnostic['code']`.\n*/\nfunction isRaisedError(error) {\n\treturn error instanceof Error && isStructuredError(error);\n}\n/**\n* The fallback for anything that is not a structured error: a bare throw, and also an error whose\n* `code` is not a dotted one — a Node `ENOENT`, say. The rejected code survives in `meta` rather\n* than in `code`, where it would produce a docs link to a page that does not exist.\n*/\nfunction toUnexpected(error) {\n\tconst summary = error instanceof Error ? error.message : String(error);\n\tconst rejectedCode = error instanceof Error ? Reflect.get(error, \"code\") : void 0;\n\treturn new CliStructuredError(\"CLI.UNEXPECTED\", summary, {\n\t\t...ifDefined(\"meta\", typeof rejectedCode === \"string\" ? { code: rejectedCode } : void 0),\n\t\tcause: error\n\t});\n}\n/**\n* Both classes name themselves `CliStructuredError`, so the engine's duck test\n* accepts prisma/prisma's too, and a CLI factory carrying typed actions looks\n* conformant without being one — its `toEnvelope` still writes `fix` and no\n* `nextActions`. Only an error the engine itself built is already in protocol\n* shape, and `@prisma/cli-engine` is an exact-pinned, unbundled dependency, so\n* there is one module instance and identity holds.\n*/\nfunction conformsToProtocol(error) {\n\treturn error instanceof CliStructuredError;\n}\n/**\n* Turns the transitional `fix` prose into typed actions. A multi-line fix is\n* several pieces of advice, so it becomes one action per line.\n*/\nfunction actionsFromFix(fix) {\n\tif (fix === void 0) return [];\n\treturn fix.split(\"\\n\").map((line) => line.trim()).filter((line) => line.length > 0).map((label) => ({\n\t\tkind: \"user-choice\",\n\t\tlabel\n\t}));\n}\n/**\n* Projects a prisma/prisma-raised error onto the engine's diagnostic shape.\n*/\nfunction toEngineDiagnostic(error) {\n\treturn {\n\t\tcode: error.code,\n\t\tseverity: error.severity ?? \"error\",\n\t\tsummary: error.message,\n\t\t...ifDefined(\"why\", error.why),\n\t\tnextActions: error.nextActions ?? actionsFromFix(error.fix),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl)\n\t};\n}\n/**\n* The handler boundary's single conversion. Handlers pass every error they\n* return through `notOk` — and every error a top-of-handler catch sees —\n* through this, so a settled envelope always carries `nextActions` and never\n* the non-protocol `fix` field.\n*/\nfunction normalizeError(error) {\n\tif (conformsToProtocol(error)) return error;\n\tif (!isRaisedError(error)) return toUnexpected(error);\n\tconst diagnostic = toEngineDiagnostic(error);\n\treturn new CliStructuredError(diagnostic.code, diagnostic.summary, {\n\t\tseverity: diagnostic.severity,\n\t\tnextActions: diagnostic.nextActions,\n\t\t...ifDefined(\"why\", diagnostic.why),\n\t\t...ifDefined(\"where\", diagnostic.where),\n\t\t...ifDefined(\"meta\", diagnostic.meta),\n\t\t...ifDefined(\"docsUrl\", diagnostic.docsUrl),\n\t\tcause: error\n\t});\n}\n//#endregion\n//#region src/orm/define-command.ts\n/**\n* `defineCommand` with the ORM's error boundary already attached. Every ORM command is defined\n* through this rather than through `defineCommand` directly.\n*\n* Without it, an error a handler throws reaches the engine, whose duck test accepts\n* prisma/prisma's `CliStructuredError` — both classes carry that name — and then settles it\n* through fields the engine's own class has and this one does not. The envelope that results is\n* off-protocol. Catching here means every handler settles through the single conversion instead.\n*/\nfunction defineOrmCommand(def) {\n\treturn defineCommand({\n\t\t...def,\n\t\thandler: async (args, ctx) => {\n\t\t\ttry {\n\t\t\t\treturn await def.handler(args, ctx);\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(error));\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/orm/flags.ts\n/**\n* The database connection override, declared from here by every command that\n* accepts one so its brief and placeholder cannot drift apart. Resolution\n* order is the flag, then `config.db.connection`, then\n* `CONFIG.DB_CONNECTION_REQUIRED`.\n*/\nconst dbFlag = flag.string({\n\tbrief: \"Database connection string\",\n\tplaceholder: \"url\"\n});\n//#endregion\n//#region src/orm/progress.ts\nconst OUTCOMES = {\n\tok: \"ok\",\n\tskipped: \"skipped\",\n\terror: \"failed\"\n};\n/**\n* The control API's spans as engine events. A span's label is remembered when\n* it starts so the finishing event names the step with the same words.\n*/\nfunction controlProgressReporter(report) {\n\tconst labels = /* @__PURE__ */ new Map();\n\treturn (event) => {\n\t\tif (event.kind === \"spanStart\") {\n\t\t\tlabels.set(event.spanId, event.label);\n\t\t\treport({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep: event.label,\n\t\t\t\tid: event.spanId,\n\t\t\t\t...ifDefined(\"parentId\", event.parentSpanId)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst step = labels.get(event.spanId) ?? event.spanId;\n\t\tlabels.delete(event.spanId);\n\t\treport({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\tid: event.spanId,\n\t\t\toutcome: OUTCOMES[event.outcome]\n\t\t});\n\t};\n}\n//#endregion\n//#region src/orm/db/migration-blocks.ts\nfunction operationNode(operation) {\n\treturn operation.operationClass === \"destructive\" ? {\n\t\tlabel: operation.label,\n\t\tstatus: \"warn\"\n\t} : { label: operation.label };\n}\nfunction spaceLabel(space) {\n\treturn space.kind === \"app\" ? \"App space\" : `Extension space: ${space.spaceId}`;\n}\n/**\n* One root per contract space, in the schedule order the runner used. A\n* space's post-apply marker is the last child of its own space, so the engine\n* draws it under the operations it signs.\n*/\nfunction spaceNodes(perSpace, mode) {\n\treturn perSpace.map((space) => ({\n\t\tlabel: [{\n\t\t\ttext: spaceLabel(space),\n\t\t\ttone: \"identifier\"\n\t\t}],\n\t\tchildren: [...space.operations.length === 0 ? [{ label: [{\n\t\t\ttext: \"(no operations)\",\n\t\t\ttone: \"muted\"\n\t\t}] }] : space.operations.map(operationNode), ...mode === \"apply\" && space.marker !== void 0 ? [{ label: [{\n\t\t\ttext: \"marker \",\n\t\t\ttone: \"muted\"\n\t\t}, {\n\t\t\ttext: space.marker.storageHash,\n\t\t\ttone: \"identifier\"\n\t\t}] }] : []]\n\t}));\n}\nfunction destructiveWarningBlocks(hasDestructive) {\n\treturn hasDestructive ? [{\n\t\tkind: \"summary\",\n\t\tstatus: \"warn\",\n\t\ttext: \"This migration contains destructive operations that may cause data loss.\"\n\t}] : [];\n}\n/**\n* The planned or executed operations. The per-space breakdown is the shape the\n* aggregate flow produces; the flat tree is the fallback for a result that\n* carries no breakdown.\n*/\nfunction perSpaceBlocks(perSpace, mode) {\n\tconst hasDestructive = perSpace.some((space) => space.operations.some((operation) => operation.operationClass === \"destructive\"));\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: spaceNodes(perSpace, mode)\n\t}, ...destructiveWarningBlocks(hasDestructive)];\n}\nfunction operationBlocks$1(result) {\n\tconst perSpace = result.perSpace;\n\tif (perSpace !== void 0 && perSpace.length > 0) return perSpaceBlocks(perSpace, result.mode);\n\tif (result.plan.operations.length === 0) return [];\n\tconst hasDestructive = result.plan.operations.some((operation) => operation.operationClass === \"destructive\");\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: result.plan.operations.map(operationNode)\n\t}, ...destructiveWarningBlocks(hasDestructive)];\n}\n/** The statements a database would run, printed verbatim rather than laid out. */\nfunction previewBlocks$1(preview) {\n\tif (preview === void 0) return [];\n\tconst header = {\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: previewBlockHeader(preview)\n\t};\n\tconst statements = preview.statements.map((statement) => renderPreviewStatement(statement.text, statement.language)).filter((text) => text !== void 0);\n\treturn statements.length === 0 ? [header, {\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: \"No operations.\"\n\t}] : [header, {\n\t\tkind: \"drawing\",\n\t\tlines: statements\n\t}];\n}\nfunction planSummaryText(result) {\n\tconst operations = result.plan.operations.length;\n\tconst spaces = result.perSpace?.length ?? 0;\n\treturn spaces > 0 ? `Planned ${operations} operation(s) across ${spaces} contract space${spaces === 1 ? \"\" : \"s\"}` : `Planned ${operations} operation(s)`;\n}\nfunction applySummaryText(result) {\n\tconst executed = result.execution?.operationsExecuted ?? 0;\n\tconst spaces = result.perSpace?.length ?? 0;\n\tconst across = spaces > 0 ? ` across ${spaces} contract space${spaces === 1 ? \"\" : \"s\"}` : \"\";\n\tif (executed === 0) return `Database already matches contract${across}`;\n\treturn `Applied ${executed} operation(s)${across}`;\n}\nfunction planBlocks(result) {\n\tconst planned = result.plannedAdvanceRef;\n\treturn [\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: planSummaryText(result)\n\t\t},\n\t\t...operationBlocks$1(result),\n\t\t{\n\t\t\tkind: \"fields\",\n\t\t\trows: [{\n\t\t\t\tlabel: \"destination\",\n\t\t\t\tvalue: [{\n\t\t\t\t\ttext: result.plan.destination.storageHash,\n\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t},\n\t\t...planned === null || planned === void 0 ? [] : [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: [{ text: `Would advance ref \"${planned.name}\" → ` }, {\n\t\t\t\ttext: planned.hash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}],\n\t\t...previewBlocks$1(result.plan.preview),\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttone: \"muted\",\n\t\t\ttext: \"This is a dry run. No changes were applied.\"\n\t\t}\n\t];\n}\n/**\n* The app-space marker, for a result that carried no per-space breakdown. The\n* label names what the marker covers rather than calling it \"the\" signature.\n*/\nfunction fallbackMarkerBlocks(result) {\n\tconst marker = result.marker;\n\tif (marker === void 0 || result.perSpace !== void 0 && result.perSpace.length > 0) return [];\n\treturn [{\n\t\tkind: \"fields\",\n\t\trows: [{\n\t\t\tlabel: \"App-space marker\",\n\t\t\tvalue: [{\n\t\t\t\ttext: marker.storageHash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}, ...marker.profileHash === void 0 ? [] : [{\n\t\t\tlabel: \"Profile hash\",\n\t\t\tvalue: [{\n\t\t\t\ttext: marker.profileHash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}]]\n\t}];\n}\nfunction applyBlocks(result) {\n\tconst advanced = result.advancedRef;\n\treturn [\n\t\t{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: applySummaryText(result)\n\t\t},\n\t\t...operationBlocks$1(result),\n\t\t...fallbackMarkerBlocks(result),\n\t\t...advanced === null || advanced === void 0 ? [] : [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: [{ text: `Advanced ref \"${advanced.name}\" → ` }, {\n\t\t\t\ttext: advanced.hash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}]\n\t];\n}\n/** What a `db init` / `db update` result looks like in human mode. */\nfunction migrationResultBlocks(result) {\n\treturn result.mode === \"plan\" ? planBlocks(result) : applyBlocks(result);\n}\n/** Where the user goes next, as typed actions rather than trailing prose. */\nfunction migrationResultNextActions(result, applyCommand) {\n\treturn result.mode === \"plan\" ? [runCommandAction(\"Apply the planned operations\", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? \"Confirm the space is up to date\" : \"Confirm every space is up to date\", \"prisma-next migration status\")];\n}\n//#endregion\n//#region src/orm/migration/paths.ts\n/**\n* Where migrations live for this project. Resolved against the invocation\n* directory, which is also the config file's directory for every default\n* invocation.\n*/\nfunction migrationsDirFor(config, cwd) {\n\treturn resolve(cwd, config.migrations?.dir ?? \"migrations\");\n}\n/** The app subspace under {@link migrationsDirFor}. */\nfunction appMigrationsDirFor(config, cwd) {\n\treturn spaceMigrationDirectory(migrationsDirFor(config, cwd), APP_SPACE_ID);\n}\n/**\n* Where refs live. The framework keeps them under the app subspace rather than\n* at the migrations root.\n*/\nfunction appRefsDirFor(config, cwd) {\n\treturn resolve(appMigrationsDirFor(config, cwd), \"refs\");\n}\n/**\n* The emitted contract. The config loader has already resolved\n* `contract.output` against the config file's directory, so this only has an\n* effect for a config handed in raw, as tests do.\n*/\nfunction contractPathFor(config, cwd) {\n\tconst output = config.contract?.output;\n\treturn output === void 0 ? void 0 : resolve(cwd, output);\n}\n/**\n* The header's rendering of a path: relative to where the user invoked the\n* CLI, as the commander shell rendered it against the config file.\n*/\nfunction displayPath(path, cwd) {\n\treturn relative(cwd, path);\n}\n//#endregion\n//#region src/orm/db/prepare.ts\n/** Reads the emitted contract as the raw document the control API validates. */\nasync function readContractDocument(contractPath) {\n\tlet content;\n\ttry {\n\t\tcontent = await readFile(contractPath, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(normalizeError(Reflect.get(Object(error), \"code\") === \"ENOENT\" ? errorFileNotFound(contractPath, {\n\t\t\twhy: `Contract file not found at ${contractPath}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate contract.json, or update `contract.output` in prisma-next.config.ts\"\n\t\t}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` })));\n\t}\n\ttry {\n\t\treturn ok(castAs(JSON.parse(content)));\n\t} catch (error) {\n\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t}\n}\nasync function prepareMigrationRun(inputs) {\n\tconst { config, cwd, commandName } = inputs;\n\tconst contractPath = contractPathFor(config, cwd);\n\tif (contractPath === void 0) return notOk(normalizeError(errorConfigValidation(\"contract.output\", {\n\t\twhy: `${commandName} reads the emitted contract from config.contract.output; the config has no value to read.`,\n\t\tsection: \"contract\"\n\t})));\n\tconst contract = await readContractDocument(contractPath);\n\tif (!contract.ok) return notOk(contract.failure);\n\tconst dbConnection = inputs.db ?? config.db?.connection;\n\tif (dbConnection === void 0) return notOk(normalizeError(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${commandName} (set db.connection in prisma-next.config.ts, or pass --db <url>)`,\n\t\tcommandName,\n\t\tmissingFlags: [\"--db\"]\n\t})));\n\tif (config.driver === void 0) return notOk(normalizeError(errorDriverRequired({ why: `Config.driver is required for ${commandName}` })));\n\tif (!targetSupportsMigrations(config.target)) return notOk(normalizeError(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` })));\n\treturn ok({\n\t\tclient: inputs.createClient({\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\tcontractJson: contract.value,\n\t\tcontractPath,\n\t\tcontractDisplayPath: displayPath(contractPath, cwd),\n\t\tdbConnection,\n\t\tdatabase: typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0,\n\t\tmigrationsDir: migrationsDirFor(config, cwd),\n\t\trefsDir: appRefsDirFor(config, cwd)\n\t});\n}\n//#endregion\n//#region src/orm/db/init.ts\nfunction initPresentations(inputs) {\n\tconst { document, database, dryRun } = inputs;\n\treturn {\n\t\thuman: () => [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"contract\",\n\t\t\t\t\tvalue: inputs.contractPath\n\t\t\t\t},\n\t\t\t\t...database === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\tvalue: database\n\t\t\t\t}],\n\t\t\t\t...dryRun ? [{\n\t\t\t\t\tlabel: \"mode\",\n\t\t\t\t\tvalue: \"dry run\"\n\t\t\t\t}] : []\n\t\t\t]\n\t\t}, ...migrationResultBlocks(document)],\n\t\tjson: () => document,\n\t\tnext: () => migrationResultNextActions(document, \"prisma-next db init\")\n\t};\n}\nfunction initDocument(inputs) {\n\tconst { value } = inputs;\n\treturn {\n\t\tok: true,\n\t\tmode: value.mode,\n\t\tplan: {\n\t\t\ttargetId: inputs.targetId,\n\t\t\tdestination: {\n\t\t\t\tstorageHash: value.destination.storageHash,\n\t\t\t\t...ifDefined(\"profileHash\", value.destination.profileHash)\n\t\t\t},\n\t\t\toperations: value.plan.operations.map((operation) => ({\n\t\t\t\tid: operation.id,\n\t\t\t\tlabel: operation.label,\n\t\t\t\toperationClass: operation.operationClass\n\t\t\t})),\n\t\t\t...ifDefined(\"preview\", value.plan.preview)\n\t\t},\n\t\t...value.execution === void 0 ? {} : { execution: {\n\t\t\toperationsPlanned: value.execution.operationsPlanned,\n\t\t\toperationsExecuted: value.execution.operationsExecuted\n\t\t} },\n\t\t...value.marker === void 0 ? {} : { marker: {\n\t\t\tstorageHash: value.marker.storageHash,\n\t\t\t...ifDefined(\"profileHash\", value.marker.profileHash)\n\t\t} },\n\t\t...ifDefined(\"perSpace\", value.perSpace),\n\t\tadvancedRef: inputs.advancedRef,\n\t\tplannedAdvanceRef: inputs.plannedAdvanceRef,\n\t\tsummary: value.summary,\n\t\ttimings: { total: Date.now() - inputs.startedAt }\n\t};\n}\nfunction createDbInitCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Bootstrap a database to match the current contract and sign it\",\n\t\t\tdescription: \"Creates everything the emitted contract declares and the database does not\\nhave yet, using additive operations only. Structures already in place and\\ncompatible are left alone, a conflict that would need a destructive change\\nstops the run, and the database is signed with the contract it now matches.\\nUse --dry-run to see the operations without applying them.\",\n\t\t\texamples: [\n\t\t\t\t\"db init\",\n\t\t\t\t\"db init --db $DATABASE_URL\",\n\t\t\t\t\"db init --dry-run\",\n\t\t\t\t\"db init --advance-ref production\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: {\n\t\t\tdb: dbFlag,\n\t\t\tdryRun: flag.boolean({ brief: \"Preview the planned operations without applying them\" }),\n\t\t\tadvanceRef: flag.string({\n\t\t\t\tbrief: \"Advance the named ref to the post-command contract hash\",\n\t\t\t\tplaceholder: \"name\"\n\t\t\t})\n\t\t} },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst prepared = await prepareMigrationRun({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd,\n\t\t\t\tdb: args.flags.db,\n\t\t\t\tcommandName: \"db init\",\n\t\t\t\tcreateClient\n\t\t\t});\n\t\t\tif (!prepared.ok) return notOk(prepared.failure);\n\t\t\tconst { client, contractJson, contractPath, dbConnection, migrationsDir, refsDir } = prepared.value;\n\t\t\tlet document;\n\t\t\ttry {\n\t\t\t\tawait client.connect(dbConnection);\n\t\t\t\tconst result = await client.dbInit({\n\t\t\t\t\tcontract: contractJson,\n\t\t\t\t\tmode: args.flags.dryRun ? \"plan\" : \"apply\",\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report)\n\t\t\t\t});\n\t\t\t\tif (!result.ok) return notOk(normalizeError(mapDbInitFailure(result.failure)));\n\t\t\t\tconst advancementHash = result.value.mode === \"apply\" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;\n\t\t\t\tconst advancement = await resolveRefAdvancementFields({\n\t\t\t\t\t...ifDefined(\"advanceRef\", args.flags.advanceRef),\n\t\t\t\t\t...ifDefined(\"db\", args.flags.db),\n\t\t\t\t\trefsDir,\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tcontractJson,\n\t\t\t\t\tcontractJsonPath: contractPath,\n\t\t\t\t\tmode: result.value.mode,\n\t\t\t\t\thash: advancementHash\n\t\t\t\t});\n\t\t\t\tif (!advancement.ok) return notOk(normalizeError(advancement.failure));\n\t\t\t\tdocument = initDocument({\n\t\t\t\t\tvalue: result.value,\n\t\t\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\t\t\tadvancedRef: advancement.value.advancedRef,\n\t\t\t\t\tplannedAdvanceRef: advancement.value.plannedAdvanceRef,\n\t\t\t\t\tstartedAt\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tif (CliStructuredError$1.is(error)) return notOk(normalizeError(error));\n\t\t\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(normalizeError(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPath } })));\n\t\t\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\t\t\treturn notOk(normalizeError(errorUnexpected(safeMessage, { why: `Unexpected error during db init: ${safeMessage}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tctx.report({\n\t\t\t\tkind: \"message\",\n\t\t\t\tseverity: \"verbose\",\n\t\t\t\ttext: `Total time: ${document.timings.total}ms`\n\t\t\t});\n\t\t\treturn ok(ctx.present({ data: document }, initPresentations({\n\t\t\t\tdocument,\n\t\t\t\tcontractPath: prepared.value.contractDisplayPath,\n\t\t\t\tdatabase: prepared.value.database,\n\t\t\t\tdryRun: args.flags.dryRun\n\t\t\t})));\n\t\t}\n\t});\n}\nconst dbInitCommand = createDbInitCommand(createControlClient);\n//#endregion\n//#region src/orm/db/schema.ts\nconst SUMMARY = \"Schema read successfully\";\n/**\n* A leading keyword and the name it introduces: `<keyword> <name>`, or\n* `<keyword>: <name>`. The keyword recedes and the name is the identifier.\n*/\nfunction keywordThenName(label) {\n\tconst colon = label.match(/^(.+?):\\s*(\\S.*)$/);\n\tif (colon?.[1] !== void 0 && colon[2] !== void 0) return [\n\t\t{\n\t\t\ttext: colon[1],\n\t\t\ttone: \"muted\"\n\t\t},\n\t\t{ text: \": \" },\n\t\t{\n\t\t\ttext: colon[2],\n\t\t\ttone: \"identifier\"\n\t\t}\n\t];\n\tconst spaced = label.match(/^(\\S.*\\S|\\S+)\\s+(\\S+)$/);\n\tif (spaced?.[1] !== void 0 && spaced[2] !== void 0) return [\n\t\t{\n\t\t\ttext: spaced[1],\n\t\t\ttone: \"muted\"\n\t\t},\n\t\t{ text: \" \" },\n\t\t{\n\t\t\ttext: spaced[2],\n\t\t\ttone: \"identifier\"\n\t\t}\n\t];\n}\n/** `<name>: <detail> (<qualifier>)` — the name leads and the qualifier recedes. */\nfunction namedDetail(label) {\n\tconst parts = label.match(/^([^:]+):\\s*(.+)$/);\n\tif (parts?.[1] === void 0 || parts[2] === void 0) return;\n\tconst [, name, rest] = parts;\n\tconst qualified = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n\tif (qualified?.[1] !== void 0 && qualified[2] !== void 0) return [\n\t\t{\n\t\t\ttext: name,\n\t\t\ttone: \"identifier\"\n\t\t},\n\t\t{ text: `: ${qualified[1]} ` },\n\t\t{\n\t\t\ttext: qualified[2],\n\t\t\ttone: \"muted\"\n\t\t}\n\t];\n\treturn [{\n\t\ttext: name,\n\t\ttone: \"identifier\"\n\t}, { text: `: ${rest}` }];\n}\n/** `<name> <rest>` — the name leads and the prose behind it recedes. */\nfunction nameThenProse(label) {\n\tconst parts = label.match(/^(\\S+)\\s+(\\S.*)$/);\n\tif (parts?.[1] === void 0 || parts[2] === void 0) return;\n\treturn [\n\t\t{\n\t\t\ttext: parts[1],\n\t\t\ttone: \"identifier\"\n\t\t},\n\t\t{ text: \" \" },\n\t\t{\n\t\t\ttext: parts[2],\n\t\t\ttone: \"muted\"\n\t\t}\n\t];\n}\n/**\n* What a schema node's label means, said in tones.\n*\n* The families phrase these labels themselves, so the shapes recognised here\n* are positional (`<keyword> <name>`, `<name>: <detail>`) rather than a list of\n* words: a family that renames a keyword keeps its colouring, and no family's\n* vocabulary is written down in the framework layer.\n*/\nfunction labelSpans(node) {\n\tswitch (node.kind) {\n\t\tcase \"root\": return [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"emphasis\"\n\t\t}];\n\t\tcase \"collection\": return [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"muted\"\n\t\t}];\n\t\tcase \"entity\":\n\t\tcase \"index\": return keywordThenName(node.label) ?? [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"identifier\"\n\t\t}];\n\t\tcase \"field\": return namedDetail(node.label) ?? [{ text: node.label }];\n\t\tcase \"dependency\": return nameThenProse(node.label) ?? [{\n\t\t\ttext: node.label,\n\t\t\ttone: \"identifier\"\n\t\t}];\n\t\tdefault: return [{ text: node.label }];\n\t}\n}\nfunction treeNode(node) {\n\treturn {\n\t\tlabel: labelSpans(node),\n\t\t...ifDefined(\"children\", node.children === void 0 || node.children.length === 0 ? void 0 : node.children.map(treeNode))\n\t};\n}\nfunction schemaPresentations(inputs) {\n\tconst { document, schemaView, database } = inputs;\n\treturn {\n\t\thuman: () => [...database === void 0 ? [] : [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: database\n\t\t\t}]\n\t\t}], schemaView === void 0 ? {\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: document.summary\n\t\t} : {\n\t\t\tkind: \"tree\",\n\t\t\troots: [treeNode(schemaView.root)]\n\t\t}],\n\t\tjson: () => document\n\t};\n}\nfunction createDbSchemaCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Inspect the live database schema\",\n\t\t\tdescription: \"Reads the live database schema and prints it as a tree, or as the result\\ndocument with --json. Always read-only: it never writes a file and never\\nchanges the database.\",\n\t\t\texamples: [\n\t\t\t\t\"db schema\",\n\t\t\t\t\"db schema --db $DATABASE_URL\",\n\t\t\t\t\"db schema --json\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: { db: dbFlag } },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\t\tif (dbConnection === void 0) return notOk(normalizeError(errorDatabaseConnectionRequired({\n\t\t\t\twhy: \"Database connection is required for db schema (set db.connection in prisma-next.config.ts, or pass --db <url>)\",\n\t\t\t\tcommandName: \"db schema\",\n\t\t\t\tmissingFlags: [\"--db\"]\n\t\t\t})));\n\t\t\tif (ctx.config.driver === void 0) return notOk(normalizeError(errorDriverRequired({ why: \"Config.driver is required for db schema\" })));\n\t\t\tconst client = createClient({\n\t\t\t\tfamily: ctx.config.family,\n\t\t\t\ttarget: ctx.config.target,\n\t\t\t\tadapter: ctx.config.adapter,\n\t\t\t\tdriver: ctx.config.driver,\n\t\t\t\textensions: ctx.config.extensions ?? []\n\t\t\t});\n\t\t\tlet schema;\n\t\t\tlet schemaView;\n\t\t\ttry {\n\t\t\t\tschema = await client.introspect({\n\t\t\t\t\tconnection: dbConnection,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report)\n\t\t\t\t});\n\t\t\t\tschemaView = client.toSchemaView(schema);\n\t\t\t} catch (error) {\n\t\t\t\tif (CliStructuredError$1.is(error)) return notOk(normalizeError(error));\n\t\t\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\t\t\treturn notOk(normalizeError(errorUnexpected(safeMessage, { why: `Unexpected error during db schema: ${safeMessage}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tconst database = typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0;\n\t\t\tconst document = {\n\t\t\t\tok: true,\n\t\t\t\tsummary: SUMMARY,\n\t\t\t\ttarget: {\n\t\t\t\t\tfamilyId: ctx.config.family.familyId,\n\t\t\t\t\tid: ctx.config.target.targetId\n\t\t\t\t},\n\t\t\t\tschema,\n\t\t\t\tmeta: { ...ifDefined(\"dbUrl\", database) },\n\t\t\t\ttimings: { total: Date.now() - startedAt }\n\t\t\t};\n\t\t\treturn ok(ctx.present({ data: document }, schemaPresentations({\n\t\t\t\tdocument,\n\t\t\t\tschemaView,\n\t\t\t\tdatabase\n\t\t\t})));\n\t\t}\n\t});\n}\nconst dbSchemaCommand = createDbSchemaCommand(createControlClient);\n//#endregion\n//#region src/orm/format.ts\nconst NOTHING_TO_FORMAT = \"Nothing to format (contract source is not PSL).\";\nfunction formatPresentations(document, cwd) {\n\tconst path = document.path;\n\treturn {\n\t\thuman: () => document.formatted && path !== void 0 ? [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: [{ text: \"Formatted \" }, {\n\t\t\t\ttext: relative(cwd, path),\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]\n\t\t}] : [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: NOTHING_TO_FORMAT\n\t\t}],\n\t\tjson: () => document\n\t};\n}\nfunction createFormatCommand(execute = executeFormat) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Format your PSL contract source\",\n\t\t\tdescription: \"Formats the Prisma schema (PSL) contract source declared in your config\\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline\\nare read from the optional formatter config section, defaulting to two\\nspaces and the system newline.\",\n\t\t\texamples: [\"format\", \"format --json\"]\n\t\t},\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (_args, ctx) => {\n\t\t\tconst result = await execute({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(normalizeError(result.failure));\n\t\t\treturn ok(ctx.present({ data: result.value }, formatPresentations(result.value, ctx.cwd)));\n\t\t}\n\t});\n}\nconst formatCommand = createFormatCommand();\n//#endregion\n//#region src/orm/migrate.ts\nconst STATUS_ACTION = runCommandAction(\"Check every space against the database\", \"prisma-next migration status\");\n/**\n* The route the migration will take. The graph is a drawing — the engine cannot\n* derive a lane gutter — and the ordered list under it is drawn with the same\n* widths so every arrow lands in one column.\n*/\nfunction showPresentations$1(inputs) {\n\tconst { document, graph, runList } = inputs;\n\tconst count = document.migrations.length;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t\t},\n\t\t\t\t\t...inputs.database === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\t\tvalue: inputs.database\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.from === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\t\tvalue: inputs.from\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.to === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: inputs.to\n\t\t\t\t\t}]\n\t\t\t\t]\n\t\t\t},\n\t\t\t...graph.length === 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(graph)\n\t\t\t}],\n\t\t\t...count === 0 ? [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"info\",\n\t\t\t\ttext: document.summary\n\t\t\t}] : [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"info\",\n\t\t\t\ttext: `The following ${count} migration${count === 1 ? \"\" : \"s\"} will run:`\n\t\t\t}, {\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(runList.join(\"\\n\"))\n\t\t\t}]\n\t\t],\n\t\tjson: () => document\n\t};\n}\nfunction applyPresentations(inputs) {\n\tconst { document } = inputs;\n\tconst advanced = document.advancedRef;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t\t},\n\t\t\t\t\t...inputs.database === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\t\tvalue: inputs.database\n\t\t\t\t\t}],\n\t\t\t\t\t...inputs.to === void 0 ? [] : [{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: inputs.to\n\t\t\t\t\t}]\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: document.summary\n\t\t\t},\n\t\t\t...document.perSpace.length === 0 ? [] : perSpaceBlocks(document.perSpace, \"apply\"),\n\t\t\t...advanced === null || advanced === void 0 ? [] : [{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: [{ text: `Advanced ref \"${advanced.name}\" → ` }, {\n\t\t\t\t\ttext: advanced.hash,\n\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t}]\n\t\t\t}]\n\t\t],\n\t\tjson: () => document,\n\t\tnext: () => [STATUS_ACTION]\n\t};\n}\n/**\n* `--to` as a contract the app graph knows. A ref target keeps the invariants\n* the ref declares; a bare hash carries none. Omitting `--to` targets the\n* emitted contract, which needs no resolution at all.\n*/\nfunction resolveRequestedTarget(to, refs, graph) {\n\tif (to === void 0) return ok({\n\t\tentry: void 0,\n\t\trefName: void 0\n\t});\n\tconst resolved = resolveContractRef(to, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!resolved.ok) return notOk(normalizeError(resolved.failure));\n\tif (resolved.value.provenance.kind !== \"ref\") return ok({\n\t\tentry: {\n\t\t\thash: resolved.value.hash,\n\t\t\tinvariants: []\n\t\t},\n\t\trefName: void 0\n\t});\n\tconst refName = resolved.value.provenance.refName;\n\treturn ok({\n\t\tentry: refs[refName],\n\t\trefName\n\t});\n}\nfunction createMigrateCommand(createClient) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Apply planned migrations to advance the database\",\n\t\t\tdescription: \"Walks every contract space (app + extensions) and applies pending on-disk\\nmigrations in canonical order (extensions alphabetically, then app). It\\nreplays the on-disk migration graph and never invents an edge. Use --to to\\ntarget a specific contract (hash, ref name, or migration directory) and\\n--show for a read-only preview of the route it would take.\",\n\t\t\texamples: [\n\t\t\t\t\"migrate\",\n\t\t\t\t\"migrate --db $DATABASE_URL\",\n\t\t\t\t\"migrate --to production\",\n\t\t\t\t\"migrate --show\",\n\t\t\t\t\"migrate --show --from @contract --to production\"\n\t\t\t]\n\t\t},\n\t\targs: { flags: {\n\t\t\tdb: dbFlag,\n\t\t\tto: flag.string({\n\t\t\t\tbrief: \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\",\n\t\t\t\tplaceholder: \"contract\"\n\t\t\t}),\n\t\t\tadvanceRef: flag.string({\n\t\t\t\tbrief: \"Advance the named ref to the post-apply marker after success\",\n\t\t\t\tplaceholder: \"name\"\n\t\t\t}),\n\t\t\tshow: flag.boolean({ brief: \"Preview the migration route without applying (read-only)\" }),\n\t\t\tfrom: flag.string({\n\t\t\t\tbrief: \"From-state for the --show preview (@contract, @db, hash, ref name, or dir)\",\n\t\t\t\tplaceholder: \"contract\"\n\t\t\t})\n\t\t} },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst migrationsRelative = displayPath(migrationsDirFor(ctx.config, ctx.cwd), ctx.cwd);\n\t\t\tif (args.flags.show) {\n\t\t\t\tconst planned = await executeMigrateShowPlan({\n\t\t\t\t\tconfig: ctx.config,\n\t\t\t\t\tcwd: ctx.cwd,\n\t\t\t\t\tcreateClient,\n\t\t\t\t\t...ifDefined(\"db\", args.flags.db),\n\t\t\t\t\t...ifDefined(\"to\", args.flags.to),\n\t\t\t\t\t...ifDefined(\"from\", args.flags.from)\n\t\t\t\t});\n\t\t\t\tif (!planned.ok) return notOk(normalizeError(planned.failure));\n\t\t\t\tconst plan = planned.value;\n\t\t\t\tconst paint = {\n\t\t\t\t\tcolorize: true,\n\t\t\t\t\tglyphMode: \"unicode\",\n\t\t\t\t\tstyler: createToneMigrationListStyler(),\n\t\t\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t\t\t};\n\t\t\t\tconst rendering = renderMigrateShowGraph(plan, paint);\n\t\t\t\tconst document = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tmigrations: plan.migrations,\n\t\t\t\t\tsummary: plan.summary\n\t\t\t\t};\n\t\t\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\t\t\treturn ok(ctx.present({ data: document }, showPresentations$1({\n\t\t\t\t\tdocument,\n\t\t\t\t\tgraph: rendering.graphOutput,\n\t\t\t\t\trunList: migrateShowRunListRows(plan.migrations, rendering, paint),\n\t\t\t\t\tmigrationsDir: migrationsRelative,\n\t\t\t\t\tdatabase: args.flags.from === void 0 && typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0,\n\t\t\t\t\tfrom: args.flags.from,\n\t\t\t\t\tto: args.flags.to\n\t\t\t\t})));\n\t\t\t}\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst prepared = await prepareMigrationRun({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd,\n\t\t\t\tdb: args.flags.db,\n\t\t\t\tcommandName: \"migrate\",\n\t\t\t\tcreateClient\n\t\t\t});\n\t\t\tif (!prepared.ok) return notOk(prepared.failure);\n\t\t\tconst { client, contractJson, contractPath, dbConnection, migrationsDir, refsDir } = prepared.value;\n\t\t\tconst familyInstance = ctx.config.family.create(createControlStack(ctx.config));\n\t\t\tlet appContract;\n\t\t\ttry {\n\t\t\t\tappContract = familyInstance.deserializeContract(contractJson);\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t\t\t}\n\t\t\tconst loaded = await loadContractSpaceAggregateForCli({\n\t\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\t\tmigrationsDir,\n\t\t\t\tappContract,\n\t\t\t\textensions: ctx.config.extensions ?? [],\n\t\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t\t\t});\n\t\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\t\tconst aggregate = loaded.value;\n\t\t\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\t\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(castAs(ctx.config.extensions ?? [])),\n\t\t\t\tcheckContracts: true\n\t\t\t});\n\t\t\tif (integrityFailure) return notOk(normalizeError(integrityFailure));\n\t\t\tconst target = resolveRequestedTarget(args.flags.to, aggregate.app.refs, aggregate.app.graph());\n\t\t\tif (!target.ok) return notOk(target.failure);\n\t\t\tlet document;\n\t\t\ttry {\n\t\t\t\tawait client.connect(dbConnection);\n\t\t\t\tconst appGraph = aggregate.app.graph();\n\t\t\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\t\t\tif (appMarker !== null) {\n\t\t\t\t\tconst markerRefusal = refuseMarkerOutsideGraph({\n\t\t\t\t\t\tmarkerHash: appMarker.storageHash,\n\t\t\t\t\t\tgraph: appGraph\n\t\t\t\t\t});\n\t\t\t\t\tif (markerRefusal) return notOk(normalizeError(markerRefusal));\n\t\t\t\t}\n\t\t\t\tconst refEntry = target.value.entry;\n\t\t\t\tif (refEntry !== void 0 && refEntry.invariants.length > 0) {\n\t\t\t\t\tconst invariantRefusal = refuseUnknownInvariants({\n\t\t\t\t\t\tgraph: appGraph,\n\t\t\t\t\t\tmarkerInvariants: appMarker?.invariants ?? [],\n\t\t\t\t\t\trefInvariants: refEntry.invariants,\n\t\t\t\t\t\t...ifDefined(\"refName\", args.flags.to)\n\t\t\t\t\t});\n\t\t\t\t\tif (invariantRefusal) return notOk(normalizeError(invariantRefusal));\n\t\t\t\t}\n\t\t\t\tlet applyContract = appContract;\n\t\t\t\tlet snapshotContractJson = contractJson;\n\t\t\t\tlet snapshotContractDts;\n\t\t\t\tif (args.flags.to !== void 0 && refEntry !== void 0) {\n\t\t\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === refEntry.hash) !== void 0) try {\n\t\t\t\t\t\tconst at = await aggregate.app.contractAt(refEntry.hash, target.value.refName === void 0 ? void 0 : { refName: target.value.refName });\n\t\t\t\t\t\tapplyContract = at.contract;\n\t\t\t\t\t\tsnapshotContractJson = blindCast(at.contractJson);\n\t\t\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst mapped = mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t\t\t\tif (!mapped.ok) return notOk(normalizeError(mapped.failure));\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst applied = await client.migrate({\n\t\t\t\t\tcontract: applyContract,\n\t\t\t\t\tmigrationsDir,\n\t\t\t\t\tonProgress: controlProgressReporter(ctx.report),\n\t\t\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t\t\t...refEntry?.invariants === void 0 ? {} : { refInvariants: refEntry.invariants },\n\t\t\t\t\t...refEntry === void 0 ? {} : ifDefined(\"refName\", args.flags.to)\n\t\t\t\t});\n\t\t\t\tif (!applied.ok) return notOk(normalizeError(mapMigrateFailure(applied.failure)));\n\t\t\t\tconst { value } = applied;\n\t\t\t\tlet advancedRef = null;\n\t\t\t\tif (args.flags.advanceRef !== void 0) {\n\t\t\t\t\tconst contractIR = snapshotContractDts === void 0 ? await readContractIR(snapshotContractJson, contractPath) : {\n\t\t\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t\t\t};\n\t\t\t\t\tconst advanced = await advanceRefSafely({\n\t\t\t\t\t\trefsDir,\n\t\t\t\t\t\tmigrationsDir,\n\t\t\t\t\t\tname: args.flags.advanceRef,\n\t\t\t\t\t\thash: value.markerHash,\n\t\t\t\t\t\tcontractIR\n\t\t\t\t\t});\n\t\t\t\t\tif (!advanced.ok) return notOk(normalizeError(advanced.failure));\n\t\t\t\t\tadvancedRef = {\n\t\t\t\t\t\tname: advanced.value.name,\n\t\t\t\t\t\thash: advanced.value.hash\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdocument = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\t\t\tmigrationsTotal: value.applied.length,\n\t\t\t\t\tmarkerHash: value.markerHash,\n\t\t\t\t\tapplied: value.applied,\n\t\t\t\t\tsummary: value.summary,\n\t\t\t\t\tperSpace: value.perSpace,\n\t\t\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\t\t\ttimings: { total: Date.now() - startedAt },\n\t\t\t\t\tadvancedRef\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\treturn notOk(normalizeError(mapCaughtMigrationError(error) ?? errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` })));\n\t\t\t} finally {\n\t\t\t\tawait closeQuietly(client);\n\t\t\t}\n\t\t\tctx.report({\n\t\t\t\tkind: \"message\",\n\t\t\t\tseverity: \"verbose\",\n\t\t\t\ttext: `Total time: ${document.timings.total}ms`\n\t\t\t});\n\t\t\treturn ok(ctx.present({ data: document }, applyPresentations({\n\t\t\t\tdocument,\n\t\t\t\tmigrationsDir: migrationsRelative,\n\t\t\t\tdatabase: prepared.value.database,\n\t\t\t\tto: args.flags.to\n\t\t\t})));\n\t\t}\n\t});\n}\nconst migrateCommand = createMigrateCommand(createControlClient);\n//#endregion\n//#region src/orm/migration/graph.ts\n/**\n* The tree is a drawing for a reader; the DOT document is a graph description\n* for another program, so it is the one thing here that belongs on stdout.\n*/\nfunction graphPresentations(inputs) {\n\tconst { tree, dot, legend } = inputs;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t}, ...inputs.space === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: inputs.space\n\t\t\t\t}]]\n\t\t\t},\n\t\t\t...tree === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(tree)\n\t\t\t}],\n\t\t\t...legend === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(legend)\n\t\t\t}]\n\t\t],\n\t\t...dot === void 0 ? {} : { stdout: () => dot.split(\"\\n\") },\n\t\tjson: () => inputs.document\n\t};\n}\nfunction graphSummary(spaces) {\n\tconst contracts = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contracts} contract(s), ${migrations} migration(s)`;\n}\nconst migrationGraphCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Show the migration graph topology\",\n\t\tdescription: \"Renders the migration graph topology. Offline — does not consult the\\ndatabase. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\n--dot emits Graphviz DOT for the app graph instead of the tree, and\\nignores --space; in json mode the result carries the DOT text alongside\\nthe graph document.\",\n\t\texamples: [\n\t\t\t\"migration graph\",\n\t\t\t\"migration graph --json\",\n\t\t\t\"migration graph --dot\",\n\t\t\t\"migration graph --ascii\",\n\t\t\t\"migration graph --legend\",\n\t\t\t\"migration graph --space app\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tspace: flag.string({\n\t\t\tbrief: \"Narrow output to a single contract space\",\n\t\t\tplaceholder: \"id\"\n\t\t}),\n\t\tdot: flag.boolean({ brief: \"Emit Graphviz DOT for the app graph\" }),\n\t\tascii: flag.boolean({ brief: \"Use ASCII glyphs (pipe-friendly)\" }),\n\t\tlegend: flag.boolean({ brief: \"Print a key for the tree glyphs and lane colors\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tif (args.flags.legend && args.flags.dot) return notOk(normalizeError(errorLegendHumanOnly(\"--dot\")));\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst loaded = await buildReadAggregate(ctx.config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\t\tconst listed = runMigrationList({\n\t\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t\t...ifDefined(\"spaceFilter\", args.flags.space)\n\t\t});\n\t\tif (!listed.ok) return notOk(normalizeError(listed.failure));\n\t\tconst scopedSpaces = listed.value.spaces;\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\tconst graphSpaces = [...buildMigrationSpaceGraphEntries({\n\t\t\taggregate,\n\t\t\tscopedSpaces\n\t\t})];\n\t\tconst summary = graphSummary(graphSpaces);\n\t\tconst graphDocument = {\n\t\t\tok: true,\n\t\t\tspaces: graphSpaces,\n\t\t\tsummary\n\t\t};\n\t\tconst dot = args.flags.dot ? renderMigrationGraphDot(aggregate.app.graph()) : void 0;\n\t\tconst document = dot === void 0 ? graphDocument : {\n\t\t\t...graphDocument,\n\t\t\tdot\n\t\t};\n\t\tconst styler = createToneMigrationListStyler();\n\t\tconst tree = dot === void 0 ? renderMigrationGraphSections(buildMigrationGraphTreeSections({\n\t\t\taggregate,\n\t\t\tscopedSpaces,\n\t\t\tliveContractHash,\n\t\t\tglyphMode,\n\t\t\tcolorize: true,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}), styler.summary(summary)) : void 0;\n\t\tconst legend = args.flags.legend ? renderMigrationGraphLegend({\n\t\t\tcolorize: true,\n\t\t\tglyphMode,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}) : void 0;\n\t\treturn ok(ctx.present({ data: document }, graphPresentations({\n\t\t\tdocument,\n\t\t\ttree,\n\t\t\tdot,\n\t\t\tmigrationsDir: displayPath(migrationsDir, ctx.cwd),\n\t\t\tspace: args.flags.space,\n\t\t\tlegend\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/list.ts\nfunction listPresentations$1(inputs) {\n\tconst legend = inputs.legend;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: inputs.migrationsDir\n\t\t\t\t}, ...inputs.space === void 0 ? [] : [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: inputs.space\n\t\t\t\t}]]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(inputs.tree)\n\t\t\t},\n\t\t\t...legend === void 0 ? [] : [{\n\t\t\t\tkind: \"drawing\",\n\t\t\t\tlines: toneDrawing(legend)\n\t\t\t}]\n\t\t],\n\t\tjson: () => inputs.list\n\t};\n}\nconst migrationListCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"List on-disk migrations per contract space\",\n\t\tdescription: \"Enumerates every on-disk migration under migrations/<space>/ for every\\ncontract space found on disk. Offline — does not consult the database.\\nHuman output draws the shared migration graph tree with operation counts,\\ninvariants on each migration row, and refs on destination contract nodes.\\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\\ntree glyphs.\",\n\t\texamples: [\n\t\t\t\"migration list\",\n\t\t\t\"migration list --space app\",\n\t\t\t\"migration list --ascii\",\n\t\t\t\"migration list --legend\",\n\t\t\t\"migration list --json\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tspace: flag.string({\n\t\t\tbrief: \"Narrow output to a single contract space\",\n\t\t\tplaceholder: \"id\"\n\t\t}),\n\t\tascii: flag.boolean({ brief: \"Use ASCII kind glyphs (pipe-friendly)\" }),\n\t\tlegend: flag.boolean({ brief: \"Print a key for the tree glyphs and lane colors\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst loaded = await buildReadAggregate(ctx.config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\t\tconst listed = runMigrationList({\n\t\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t\t...ifDefined(\"spaceFilter\", args.flags.space)\n\t\t});\n\t\tif (!listed.ok) return notOk(normalizeError(listed.failure));\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\tconst styler = createToneMigrationListStyler();\n\t\tconst tree = renderMigrationListWithStyle(listed.value, styler, glyphMode, {\n\t\t\tcolorize: true,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE,\n\t\t\tliveContractHash,\n\t\t\tgraphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n\t\t\tappSpaceId: aggregate.app.spaceId\n\t\t});\n\t\tconst legend = args.flags.legend ? renderMigrationGraphLegend({\n\t\t\tcolorize: true,\n\t\t\tglyphMode,\n\t\t\tstyler,\n\t\t\tpalette: TONE_MIGRATION_GRAPH_PALETTE\n\t\t}) : void 0;\n\t\treturn ok(ctx.present({ data: listed.value }, listPresentations$1({\n\t\t\tlist: listed.value,\n\t\t\ttree,\n\t\t\tmigrationsDir: displayPath(migrationsDir, ctx.cwd),\n\t\t\tspace: args.flags.space,\n\t\t\tlegend\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/log.ts\nconst HEADING_APPLIED_AT = \"Applied at\";\nconst HEADING_SPACE = \"Space\";\nconst HEADING_MIGRATION = \"Migration\";\nconst HEADING_CHANGE = \"Change\";\nconst HEADING_OPS = \"Ops\";\n/**\n* The ledger laid out for the engine to size. The Space heading appears only\n* when more than one contract space has run, as it does in the commander shell.\n*/\nfunction ledgerGrid(entries, options) {\n\tconst styler = createToneMigrationListStyler();\n\tconst sorted = sortLedgerEntries(entries);\n\tconst showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n\tconst headings = [HEADING_APPLIED_AT];\n\tif (showSpace) headings.push(HEADING_SPACE);\n\theadings.push(HEADING_MIGRATION, HEADING_CHANGE, HEADING_OPS);\n\treturn {\n\t\theadings,\n\t\trows: sorted.map((entry) => {\n\t\t\tconst cells = [formatLedgerAppliedAt(entry.appliedAt, options.utc ? \"utc\" : \"local\")];\n\t\t\tif (showSpace) cells.push(entry.space);\n\t\t\tcells.push(toneSpans(styler.dirName(entry.migrationName)), toneSpans(styleHashTransition(entry.from, entry.to, styler, options.glyphMode)), `${entry.operationCount} ops`);\n\t\t\treturn cells;\n\t\t})\n\t};\n}\nfunction logPresentations(inputs) {\n\tconst grid = inputs.grid;\n\treturn {\n\t\thuman: () => [...inputs.database === void 0 ? [] : [{\n\t\t\tkind: \"fields\",\n\t\t\trail: true,\n\t\t\trows: [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: inputs.database\n\t\t\t}]\n\t\t}], ...grid === void 0 ? [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: MIGRATION_LOG_EMPTY_MESSAGE\n\t\t}] : [{\n\t\t\tkind: \"table\",\n\t\t\tcolumns: grid.headings,\n\t\t\trows: grid.rows\n\t\t}]],\n\t\tjson: () => inputs.document\n\t};\n}\nconst migrationLogCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Show executed migration history\",\n\t\tdescription: \"Reads the database ledger and displays every applied migration edge in\\nchronological order, including rollbacks and re-applies, merged across\\nall contract spaces. Requires a database connection.\",\n\t\texamples: [\n\t\t\t\"migration log\",\n\t\t\t\"migration log --db $DATABASE_URL\",\n\t\t\t\"migration log --utc\",\n\t\t\t\"migration log --json\"\n\t\t]\n\t},\n\targs: { flags: {\n\t\tdb: dbFlag,\n\t\tutc: flag.boolean({ brief: \"Render human timestamps in UTC instead of local time\" }),\n\t\tascii: flag.boolean({ brief: \"Use ASCII glyphs (pipe-friendly)\" })\n\t} },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst dbConnection = args.flags.db ?? ctx.config.db?.connection;\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver: ctx.config.driver !== void 0,\n\t\t\twhy: \"migration log needs a database connection and driver to read the ledger (set db.connection in prisma-next.config.ts, or pass --db <url>)\",\n\t\t\tcommandName: \"migration log\"\n\t\t});\n\t\tif (missingDb !== null) return notOk(normalizeError(missingDb));\n\t\tif (!targetSupportsMigrations(ctx.config.target)) return notOk(normalizeError(errorTargetMigrationNotSupported({ why: \"migration log reads the ledger a migration runner writes, and the configured target provides no runner.\" })));\n\t\tconst client = createControlClient({\n\t\t\tfamily: ctx.config.family,\n\t\t\ttarget: ctx.config.target,\n\t\t\tadapter: ctx.config.adapter,\n\t\t\t...ifDefined(\"driver\", ctx.config.driver),\n\t\t\textensions: ctx.config.extensions ?? []\n\t\t});\n\t\tlet entries;\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tentries = await client.readLedger();\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(mapCaughtMigrationError(error) ?? errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` })));\n\t\t} finally {\n\t\t\tawait closeQuietly(client);\n\t\t}\n\t\tconst records = serializeLedgerEntriesForJson(entries);\n\t\tconst document = {\n\t\t\tok: true,\n\t\t\trecords,\n\t\t\tsummary: `${records.length} migration(s) applied`\n\t\t};\n\t\tconst glyphMode = args.flags.ascii ? \"ascii\" : \"unicode\";\n\t\treturn ok(ctx.present({ data: document }, logPresentations({\n\t\t\tdocument,\n\t\t\tgrid: entries.length === 0 ? void 0 : ledgerGrid(entries, {\n\t\t\t\tutc: args.flags.utc,\n\t\t\t\tglyphMode\n\t\t\t}),\n\t\t\tdatabase: typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/migration/show.ts\n/** One node per operation, the destructive ones carrying the warning glyph. */\nfunction operationNodes(migration) {\n\treturn migration.operations.map((operation) => operation.operationClass === \"destructive\" ? {\n\t\tlabel: operation.label,\n\t\tstatus: \"warn\"\n\t} : { label: operation.label });\n}\nfunction operationBlocks(migration) {\n\tif (migration.operations.length === 0) return [{\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttext: \"No operations.\"\n\t}];\n\tconst destructive = migration.operations.some((operation) => operation.operationClass === \"destructive\");\n\treturn [{\n\t\tkind: \"tree\",\n\t\troots: [{\n\t\t\tlabel: `${migration.operations.length} operation(s)`,\n\t\t\tchildren: operationNodes(migration)\n\t\t}]\n\t}, ...destructive ? [{\n\t\tkind: \"summary\",\n\t\tstatus: \"warn\",\n\t\ttext: \"This migration contains destructive operations that may cause data loss.\"\n\t}] : []];\n}\n/**\n* The statement preview: text a database would run, printed verbatim rather\n* than laid out, so nothing is re-wrapped between here and the reader.\n*/\nfunction previewBlocks(migration) {\n\tconst statements = migration.preview.statements.map((statement) => renderPreviewStatement(statement.text, statement.language)).filter((text) => text !== void 0);\n\tif (statements.length === 0) return [];\n\treturn [{\n\t\tkind: \"summary\",\n\t\tstatus: \"info\",\n\t\ttone: \"muted\",\n\t\ttext: previewBlockHeader(migration.preview)\n\t}, {\n\t\tkind: \"drawing\",\n\t\tlines: statements\n\t}];\n}\nfunction showPresentations(inputs) {\n\tconst migration = inputs.document.migration;\n\treturn {\n\t\thuman: () => [\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trail: true,\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"contract\",\n\t\t\t\t\t\tvalue: inputs.contractPath\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\tvalue: inputs.appMigrationsRelative\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"target\",\n\t\t\t\t\t\tvalue: inputs.target\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"summary\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\ttext: [{\n\t\t\t\t\ttext: migration.name,\n\t\t\t\t\ttone: \"emphasis\"\n\t\t\t\t}]\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"fields\",\n\t\t\t\trows: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\t\tvalue: migration.fromContract === null ? [{\n\t\t\t\t\t\t\ttext: \"(baseline)\",\n\t\t\t\t\t\t\ttone: \"muted\"\n\t\t\t\t\t\t}] : [{\n\t\t\t\t\t\t\ttext: migration.fromContract,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.toContract,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"hash\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.hash,\n\t\t\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"created\",\n\t\t\t\t\t\tvalue: [{\n\t\t\t\t\t\t\ttext: migration.createdAt,\n\t\t\t\t\t\t\ttone: \"muted\"\n\t\t\t\t\t\t}]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t...operationBlocks(migration),\n\t\t\t...previewBlocks(migration)\n\t\t],\n\t\tjson: () => inputs.document\n\t};\n}\n/**\n* A path-looking target must land inside `migrations/app/`; anything else is a\n* migration reference resolved against the app graph and refs. Both routes are\n* app-space only, as they are today.\n*/\nfunction resolvePackage(inputs) {\n\tif (looksLikePath(inputs.target)) {\n\t\tconst path = resolveAppTargetPath(inputs.cwd, inputs.target, inputs.appMigrationsDir, inputs.appMigrationsRelative);\n\t\tif (!path.ok) return notOk(normalizeError(path.failure));\n\t\tconst matched = findPackageByDirPath(inputs.packages, path.value);\n\t\treturn matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`No loaded migration package at ${relative(inputs.cwd, path.value)}`))) : ok(matched);\n\t}\n\tif (inputs.packages.length === 0) return notOk(normalizeError(errorNoMigrations(inputs.appMigrationsRelative)));\n\tconst ref = resolveMigrationRef(inputs.target, {\n\t\tgraph: inputs.graph,\n\t\trefs: inputs.refs\n\t});\n\tif (!ref.ok) return notOk(normalizeError(ref.failure));\n\tconst matched = inputs.packages.find((candidate) => candidate.metadata.migrationHash === ref.value.migrationHash);\n\treturn matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`Resolved migration \"${ref.value.dirName}\" but the package was not loaded`))) : ok(matched);\n}\nconst migrationShowCommand = defineOrmCommand({\n\thelp: {\n\t\tsummary: \"Display migration package contents\",\n\t\tdescription: \"Shows the operations, statement preview, and metadata for one app-space\\nmigration. Accepts a directory path, directory name, or hash prefix.\\nOffline — does not consult the database.\",\n\t\texamples: [\n\t\t\t\"migration show 20260101_100000_add_user\",\n\t\t\t\"migration show a1b2c3\",\n\t\t\t\"migration show migrations/app/20260101_100000_add_user\",\n\t\t\t\"migration show 20260101_100000_add_user --json\"\n\t\t]\n\t},\n\targs: { positionals: { target: positional.string({\n\t\tbrief: \"Migration reference: directory name, hash/prefix, ref, or path\",\n\t\tplaceholder: \"target\"\n\t}) } },\n\tneeds: { config: ormConfigSection },\n\thandler: async (args, ctx) => {\n\t\tconst { target } = args.positionals;\n\t\tconst contractPath = contractPathFor(ctx.config, ctx.cwd);\n\t\tif (contractPath === void 0) return notOk(normalizeError(errorConfigValidation(\"contract.output\", {\n\t\t\twhy: \"migration show reads the emitted contract from config.contract.output; the config has no value to read.\",\n\t\t\tsection: \"contract\"\n\t\t})));\n\t\tconst migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst appMigrationsDir = appMigrationsDirFor(ctx.config, ctx.cwd);\n\t\tconst appMigrationsRelative = displayPath(appMigrationsDir, ctx.cwd);\n\t\tlet contractJson;\n\t\ttry {\n\t\t\tcontractJson = await readFile(contractPath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(Reflect.get(Object(error), \"code\") === \"ENOENT\" ? errorFileNotFound(contractPath, {\n\t\t\t\twhy: `Contract file not found at ${contractPath}`,\n\t\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${relative(ctx.cwd, contractPath)}`\n\t\t\t}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to read contract file\" })));\n\t\t}\n\t\tconst familyInstance = ctx.config.family.create(createControlStack(ctx.config));\n\t\tlet appContract;\n\t\ttry {\n\t\t\tappContract = familyInstance.deserializeContract(castAs(JSON.parse(contractJson)));\n\t\t} catch (error) {\n\t\t\treturn notOk(normalizeError(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));\n\t\t}\n\t\tconst loaded = await loadContractSpaceAggregateForCli({\n\t\t\ttargetId: ctx.config.target.targetId,\n\t\t\tmigrationsDir,\n\t\t\tappContract,\n\t\t\textensions: [],\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t\t});\n\t\tif (!loaded.ok) return notOk(normalizeError(loaded.failure));\n\t\tconst aggregate = loaded.value;\n\t\tconst resolved = resolvePackage({\n\t\t\ttarget,\n\t\t\tcwd: ctx.cwd,\n\t\t\tappMigrationsDir,\n\t\t\tappMigrationsRelative,\n\t\t\tpackages: aggregate.app.packages,\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs: aggregate.app.refs\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tconst pkg = resolved.value;\n\t\tconst client = createControlClient({\n\t\t\tfamily: ctx.config.family,\n\t\t\ttarget: ctx.config.target,\n\t\t\tadapter: ctx.config.adapter,\n\t\t\t...ifDefined(\"driver\", ctx.config.driver),\n\t\t\textensions: ctx.config.extensions ?? []\n\t\t});\n\t\tconst ops = castAs(pkg.ops);\n\t\tconst preview = client.toOperationPreview(ops) ?? { statements: [] };\n\t\tconst migration = {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\toperations: ops.map((op) => ({\n\t\t\t\tid: op.id,\n\t\t\t\tlabel: op.label,\n\t\t\t\toperationClass: op.operationClass\n\t\t\t})),\n\t\t\tpreview: { statements: [...preview.statements] }\n\t\t};\n\t\tconst document = {\n\t\t\tok: true,\n\t\t\tsummary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,\n\t\t\tmigration\n\t\t};\n\t\treturn ok(ctx.present({ data: document }, showPresentations({\n\t\t\tdocument,\n\t\t\tcontractPath: displayPath(contractPath, ctx.cwd),\n\t\t\tappMigrationsRelative,\n\t\t\ttarget\n\t\t})));\n\t}\n});\n//#endregion\n//#region src/orm/ref/delete.ts\nfunction deletePresentations(document) {\n\treturn {\n\t\thuman: () => [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: [\n\t\t\t\t{ text: \"Deleted ref \\\"\" },\n\t\t\t\t{\n\t\t\t\t\ttext: document.ref,\n\t\t\t\t\ttone: \"ref\"\n\t\t\t\t},\n\t\t\t\t{ text: \"\\\"\" }\n\t\t\t]\n\t\t}],\n\t\tjson: () => document\n\t};\n}\nfunction createRefDeleteCommand(execute = executeRefDeleteCommand) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Delete a ref\",\n\t\t\tdescription: \"Removes migrations/app/refs/<name>.json. The contract the ref pointed at\\nis untouched: a ref is a pointer, and its target survives the deletion.\",\n\t\t\texamples: [\"ref delete staging\", \"ref delete staging --json\"]\n\t\t},\n\t\targs: { positionals: { name: positional.string({\n\t\t\tbrief: \"Ref name to delete\",\n\t\t\tplaceholder: \"name\"\n\t\t}) } },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst result = await execute(args.positionals.name, {\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(normalizeError(result.failure));\n\t\t\treturn ok(ctx.present({ data: result.value }, deletePresentations(result.value)));\n\t\t}\n\t});\n}\nconst refDeleteCommand = createRefDeleteCommand();\n//#endregion\n//#region src/orm/ref/list.ts\nconst HEADING_REF = \"Ref\";\nconst HEADING_CONTRACT = \"Contract\";\nconst HEADING_INVARIANTS = \"Invariants\";\nconst EMPTY_MESSAGE = \"No refs defined\";\n/**\n* The refs as a grid the engine sizes. The invariants heading appears only\n* when a ref carries any, as the commander shell appended them only then.\n*/\nfunction refsGrid(refs) {\n\tconst entries = Object.entries(refs);\n\tconst showInvariants = entries.some(([, entry]) => entry.invariants.length > 0);\n\treturn {\n\t\tkind: \"table\",\n\t\tcolumns: showInvariants ? [\n\t\t\tHEADING_REF,\n\t\t\tHEADING_CONTRACT,\n\t\t\tHEADING_INVARIANTS\n\t\t] : [HEADING_REF, HEADING_CONTRACT],\n\t\trows: entries.map(([name, entry]) => {\n\t\t\tconst cells = [[{\n\t\t\t\ttext: name,\n\t\t\t\ttone: \"ref\"\n\t\t\t}], [{\n\t\t\t\ttext: entry.hash,\n\t\t\t\ttone: \"identifier\"\n\t\t\t}]];\n\t\t\tif (showInvariants) cells.push(entry.invariants.join(\", \"));\n\t\t\treturn cells;\n\t\t})\n\t};\n}\nfunction listPresentations(document) {\n\treturn {\n\t\thuman: () => Object.keys(document.refs).length === 0 ? [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"info\",\n\t\t\ttext: EMPTY_MESSAGE\n\t\t}] : [refsGrid(document.refs)],\n\t\tjson: () => document\n\t};\n}\nfunction createRefListCommand(execute = executeRefListCommand) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"List every named ref\",\n\t\t\tdescription: \"Reads migrations/app/refs/ and reports each ref with the contract hash it\\npoints at and the invariants recorded against it. Offline — does not\\nconsult the database.\",\n\t\t\texamples: [\"ref list\", \"ref list --json\"]\n\t\t},\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (_args, ctx) => {\n\t\t\tconst result = await execute({\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(normalizeError(result.failure));\n\t\t\treturn ok(ctx.present({ data: result.value }, listPresentations(result.value)));\n\t\t}\n\t});\n}\nconst refListCommand = createRefListCommand();\n//#endregion\n//#region src/orm/ref/set.ts\nfunction setPresentations(document) {\n\treturn {\n\t\thuman: () => [{\n\t\t\tkind: \"summary\",\n\t\t\tstatus: \"ok\",\n\t\t\ttext: [\n\t\t\t\t{ text: \"Set ref \\\"\" },\n\t\t\t\t{\n\t\t\t\t\ttext: document.ref,\n\t\t\t\t\ttone: \"ref\"\n\t\t\t\t},\n\t\t\t\t{ text: \"\\\" → \" },\n\t\t\t\t{\n\t\t\t\t\ttext: document.hash,\n\t\t\t\t\ttone: \"identifier\"\n\t\t\t\t}\n\t\t\t]\n\t\t}],\n\t\tjson: () => document\n\t};\n}\nfunction createRefSetCommand(execute = executeRefSetCommand) {\n\treturn defineOrmCommand({\n\t\thelp: {\n\t\t\tsummary: \"Point a ref at a contract\",\n\t\t\tdescription: \"Writes migrations/app/refs/<name>.json so a logical environment name\\nresolves to a contract hash. The contract is given as a hash or prefix,\\nanother ref name, a migration directory name, or <dir>^ for that\\nmigration's source contract. Offline — the contract must already be a\\nnode of the on-disk migration graph, with its snapshot present.\",\n\t\t\texamples: [\n\t\t\t\t\"ref set staging 4cb4256\",\n\t\t\t\t\"ref set production 20260101T1000_add_user\",\n\t\t\t\t\"ref set staging production --json\"\n\t\t\t]\n\t\t},\n\t\targs: { positionals: {\n\t\t\tname: positional.string({\n\t\t\t\tbrief: \"Ref name (e.g. staging, production)\",\n\t\t\t\tplaceholder: \"name\"\n\t\t\t}),\n\t\t\tcontract: positional.string({\n\t\t\t\tbrief: \"Contract reference: hash, prefix, ref name, migration dir name, or <dir>^\",\n\t\t\t\tplaceholder: \"contract\"\n\t\t\t})\n\t\t} },\n\t\tneeds: { config: ormConfigSection },\n\t\thandler: async (args, ctx) => {\n\t\t\tconst result = await execute(args.positionals.name, args.positionals.contract, {\n\t\t\t\tconfig: ctx.config,\n\t\t\t\tcwd: ctx.cwd\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(normalizeError(result.failure));\n\t\t\treturn ok(ctx.present({ data: result.value }, setPresentations(result.value)));\n\t\t}\n\t});\n}\nconst refSetCommand = createRefSetCommand();\n//#endregion\n//#region src/orm/family.ts\n/**\n* The engine derives each diagnostic's docs link from this base plus the\n* dotted code.\n*/\nconst DOCS_BASE_URL = `${DOCS_BASE}/`;\n/**\n* The unit the ORM contributes to a CLI: its config section, its commands by\n* name, where its diagnostics are documented, and the invocations it retired.\n* The shell owns the command tree, so nothing here says where a command mounts.\n*/\nconst ormCommandFamily = defineCommandFamily({\n\tconfigSection: ormConfigSection,\n\tcommands: {\n\t\t\"db init\": dbInitCommand,\n\t\t\"db schema\": dbSchemaCommand,\n\t\tformat: formatCommand,\n\t\tmigrate: migrateCommand,\n\t\t\"migration graph\": migrationGraphCommand,\n\t\t\"migration list\": migrationListCommand,\n\t\t\"migration log\": migrationLogCommand,\n\t\t\"migration show\": migrationShowCommand,\n\t\t\"ref delete\": refDeleteCommand,\n\t\t\"ref list\": refListCommand,\n\t\t\"ref set\": refSetCommand\n\t},\n\tdocsBaseUrl: DOCS_BASE_URL,\n\tredirects: [{\n\t\tfrom: \"migration apply\",\n\t\treplacement: \"{bin} migrate --to <contract>\",\n\t\treason: \"Applying a migration is a move to a target contract, not a verb of its own.\"\n\t}, {\n\t\tfrom: \"migration ref\",\n\t\treplacement: \"{bin} ref set|list|delete\",\n\t\treason: \"Refs are managed by their own command, for every space rather than migrations alone.\"\n\t}]\n});\n//#endregion\n//#region src/orm/load-config.ts\n/** The file the ORM's loader reads when `--config` names none. */\nconst ORM_CONFIG_FILENAME = \"prisma-next.config.ts\";\n/**\n* Builds the engine's `Runtime.config` from `prisma-next.config.ts`.\n*\n* The engine's own loader reads `prisma.config.ts` and the `$prismaConfig`\n* marker, which is not the file this bin reads, so the bin owns the load: the\n* ORM's c12 loader evaluates the module asynchronously and finalizes paths\n* against the config file's own directory. The whole result nests as the\n* single `orm` section — the engine models one section per family, and\n* `contract`, `db`, `migrations` and the rest are subsections of it.\n*\n* Only failures that prevent evaluation entirely are diagnostics here, and\n* they carry `section: null` so they fail exactly the commands that read\n* config. Structural verdicts belong to the section validator.\n*/\nasync function loadOrmConfig(options) {\n\tconst path = resolve(options.cwd, options.configPath ?? ORM_CONFIG_FILENAME);\n\tconst loaded = await loadConfig(options.configPath, { cwd: options.cwd });\n\tif (!loaded.ok) return {\n\t\tpath,\n\t\tsections: {},\n\t\tdiagnostics: [{\n\t\t\tsection: null,\n\t\t\tdiagnostic: toEngineDiagnostic(loaded.failure)\n\t\t}]\n\t};\n\treturn {\n\t\tpath,\n\t\tsections: { [\"orm\"]: loaded.value.config },\n\t\tdiagnostics: []\n\t};\n}\n//#endregion\nexport { refDeleteCommand as a, migrationListCommand as c, formatCommand as d, createDbSchemaCommand as f, ormConfigSection as h, refListCommand as i, migrationGraphCommand as l, normalizeError as m, ormCommandFamily as n, migrationShowCommand as o, createDbInitCommand as p, refSetCommand as r, migrationLogCommand as s, loadOrmConfig as t, createMigrateCommand as u };\n\n//# sourceMappingURL=load-config-h2VTJG-X.mjs.map","import { t as createContractEmitCommand } from \"../contract-emit-BlvUNMHM.mjs\";\nimport { t as createFormatCommand } from \"../format-DceifGAK.mjs\";\nimport { h as ormConfigSection, n as ormCommandFamily, t as loadOrmConfig } from \"../load-config-h2VTJG-X.mjs\";\nimport { CliStructuredError } from \"@internal/errors/control\";\nimport { join, resolve } from \"pathe\";\nimport { existsSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { tmpdir } from \"node:os\";\nimport { pathToFileURL } from \"node:url\";\nimport { build } from \"esbuild\";\n//#region src/load-ts-contract.ts\nfunction contractSourceError(code, message, options) {\n\tconst error = new CliStructuredError(code, message, options?.meta !== void 0 ? { meta: options.meta } : void 0);\n\tif (options?.cause !== void 0) error.cause = options.cause;\n\treturn error;\n}\nconst DEFAULT_ALLOWLIST = [\n\t\"@internal/*\",\n\t\"@prisma/orm-*\",\n\t\"node:crypto\"\n];\nfunction isAllowedImport(importPath, allowlist) {\n\tfor (const pattern of allowlist) if (pattern.endsWith(\"/*\")) {\n\t\tconst prefix = pattern.slice(0, -2);\n\t\tif (importPath === prefix || importPath.startsWith(`${prefix}/`)) return true;\n\t} else if (pattern.endsWith(\"*\")) {\n\t\tconst prefix = pattern.slice(0, -1);\n\t\tif (importPath.startsWith(prefix)) return true;\n\t} else if (importPath === pattern) return true;\n\treturn false;\n}\nfunction validatePurity(value, entryPath) {\n\tif (typeof value !== \"object\" || value === null) return;\n\tconst path = /* @__PURE__ */ new WeakSet();\n\tfunction check(value) {\n\t\tif (value === null || typeof value !== \"object\") return;\n\t\tif (path.has(value)) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", \"Contract export contains circular references\", { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"circular\"\n\t\t} });\n\t\tpath.add(value);\n\t\ttry {\n\t\t\tfor (const key in value) {\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\t\t\tif (descriptor && (descriptor.get || descriptor.set)) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export contains getter/setter at key \"${key}\"`, { meta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"getter\",\n\t\t\t\t\tkey\n\t\t\t\t} });\n\t\t\t\tif (descriptor && typeof descriptor.value === \"function\") throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export contains function at key \"${key}\"`, { meta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"function\",\n\t\t\t\t\tkey\n\t\t\t\t} });\n\t\t\t\tcheck(value[key]);\n\t\t\t}\n\t\t} finally {\n\t\t\tpath.delete(value);\n\t\t}\n\t}\n\ttry {\n\t\tcheck(value);\n\t\tJSON.stringify(value);\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tif (error.message.includes(\"getter\") || error.message.includes(\"circular\")) throw error;\n\t\t\tthrow contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export is not JSON-serializable: ${error.message}`, {\n\t\t\t\tmeta: {\n\t\t\t\t\tpath: entryPath,\n\t\t\t\t\treason: \"not-json-serializable\"\n\t\t\t\t},\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t\tthrow contractSourceError(\"CONTRACT.EXPORT_INVALID\", \"Contract export is not JSON-serializable\", { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"not-json-serializable\"\n\t\t} });\n\t}\n}\nfunction createImportAllowlistPlugin(allowlist, entryPath, collected) {\n\tconst entryAbs = resolve(entryPath);\n\tfunction isFromEntry(importer) {\n\t\treturn importer === entryAbs || importer === entryPath || importer === \"<stdin>\";\n\t}\n\treturn {\n\t\tname: \"import-allowlist\",\n\t\tsetup(build) {\n\t\t\tbuild.onResolve({ filter: /.*/ }, (args) => {\n\t\t\t\tif (args.kind === \"entry-point\") return;\n\t\t\t\tif (args.path.startsWith(\".\") || args.path.startsWith(\"/\")) return;\n\t\t\t\tif (isFromEntry(args.importer) && !isAllowedImport(args.path, allowlist)) {\n\t\t\t\t\tcollected.add(args.path);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpath: args.path,\n\t\t\t\t\t\texternal: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}\n/**\n* Loads a contract from a TypeScript file and returns it as Contract.\n*\n* **Responsibility: Parsing Only**\n* This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n* The contract should already be normalized if it was built using the contract builder.\n*\n* Normalization must happen in the contract builder when the contract is created.\n* This function only validates that the contract is JSON-serializable and returns it as-is.\n*\n* @param entryPath - Path to the TypeScript contract file\n* @param options - Optional configuration (import allowlist)\n* @returns The contract as Contract (should already be normalized)\n* @throws structured errors: `CLI.FILE_NOT_FOUND`, `CONTRACT.SOURCE_LOAD_FAILED`,\n* `CONTRACT.SOURCE_IMPORT_DISALLOWED`, `CONTRACT.MODULE_EXPORT_MISSING`, `CONTRACT.EXPORT_INVALID`\n*/\nasync function loadContractFromTs(entryPath, options) {\n\tconst allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\tif (!existsSync(entryPath)) throw new CliStructuredError(\"CLI.FILE_NOT_FOUND\", `Contract file not found: ${entryPath}`, { where: { path: entryPath } });\n\tconst tempFile = join(tmpdir(), `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`);\n\tconst disallowedFromEntry = /* @__PURE__ */ new Set();\n\ttry {\n\t\tconst result = await build({\n\t\t\tentryPoints: [entryPath],\n\t\t\tbundle: true,\n\t\t\tformat: \"esm\",\n\t\t\tplatform: \"node\",\n\t\t\ttarget: \"es2022\",\n\t\t\toutfile: tempFile,\n\t\t\twrite: false,\n\t\t\tmetafile: true,\n\t\t\tplugins: [createImportAllowlistPlugin(allowlist, entryPath, disallowedFromEntry)],\n\t\t\tlogLevel: \"error\"\n\t\t});\n\t\tif (result.errors.length > 0) throw contractSourceError(\"CONTRACT.SOURCE_LOAD_FAILED\", `Failed to bundle contract file: ${result.errors.map((e) => e.text).join(\"\\n\")}`, { meta: {\n\t\t\tpath: entryPath,\n\t\t\tstage: \"bundle\"\n\t\t} });\n\t\tif (!result.outputFiles || result.outputFiles.length === 0) throw new InternalError(\"No output files generated from bundling\");\n\t\tif (disallowedFromEntry.size > 0) throw contractSourceError(\"CONTRACT.SOURCE_IMPORT_DISALLOWED\", `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(\", \")}\\n Disallowed imports: ${[...disallowedFromEntry].join(\", \")}`, { meta: {\n\t\t\tallowlist: [...allowlist],\n\t\t\tdisallowed: [...disallowedFromEntry]\n\t\t} });\n\t\tconst bundleContent = result.outputFiles[0]?.text;\n\t\tif (bundleContent === void 0) throw new InternalError(\"Bundle content is undefined\");\n\t\twriteFileSync(tempFile, bundleContent, \"utf-8\");\n\t\tconst module = await import(\n\t\t\t/* @vite-ignore */\n\t\t\tpathToFileURL(tempFile).href\n);\n\t\tunlinkSync(tempFile);\n\t\tlet contract;\n\t\tif (module.default !== void 0) contract = module.default;\n\t\telse if (module.contract !== void 0) contract = module.contract;\n\t\telse throw new CliStructuredError(\"CONTRACT.MODULE_EXPORT_MISSING\", `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module).join(\", \") || \"none\"}`, { where: { path: entryPath } });\n\t\tif (typeof contract !== \"object\" || contract === null) throw contractSourceError(\"CONTRACT.EXPORT_INVALID\", `Contract export must be an object, got ${typeof contract}`, { meta: {\n\t\t\tpath: entryPath,\n\t\t\treason: \"not-object\"\n\t\t} });\n\t\tvalidatePurity(contract, entryPath);\n\t\treturn contract;\n\t} catch (error) {\n\t\ttry {\n\t\t\tif (tempFile) unlinkSync(tempFile);\n\t\t} catch {}\n\t\tif (error instanceof Error) throw error;\n\t\tthrow contractSourceError(\"CONTRACT.SOURCE_LOAD_FAILED\", `Failed to load contract from ${entryPath}: ${String(error)}`, {\n\t\t\tmeta: {\n\t\t\t\tpath: entryPath,\n\t\t\t\tstage: \"import\"\n\t\t\t},\n\t\t\tcause: error\n\t\t});\n\t}\n}\n//#endregion\nexport { createContractEmitCommand, createFormatCommand, loadContractFromTs, loadOrmConfig, ormCommandFamily, ormConfigSection };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,wBAAwB;CAC7B,MAAM;CACN,OAAO;CACP,SAAS;AACV;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO;EACN,MAAM;EACN,OAAO,WAAW,MAAM;CACzB;AACD;AACA,SAAS,gBAAgB,OAAO;CAC/B,OAAO;EACN,MAAM;EACN,UAAU;EACV,SAAS,MAAM;EACf,KAAK,MAAM;EACX,aAAa,CAAC,iBAAiB,MAAM,KAAK,CAAC;EAC3C,MAAM;GACL,OAAO,MAAM;GACb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