@prisma/orm-toolchain 8.0.0-rc.1-dev.38 → 8.0.0-rc.1-dev.39
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 +8 -301
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/cli.mjs +1944 -256
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__commands__migrate.mjs +1 -1
- package/dist/cli__commands__migration-check.d.mts +1 -1
- package/dist/cli__commands__migration-check.mjs +1 -1
- package/dist/cli__commands__migration-graph.d.mts +1 -1
- package/dist/cli__commands__migration-graph.mjs +1 -1
- package/dist/cli__commands__migration-list.d.mts +1 -1
- package/dist/cli__commands__migration-list.mjs +1 -1
- package/dist/cli__commands__migration-log.d.mts +1 -1
- package/dist/cli__commands__migration-log.mjs +1 -1
- package/dist/cli__commands__migration-show.d.mts +1 -1
- package/dist/cli__commands__migration-status.d.mts +1 -1
- package/dist/cli__commands__migration-status.mjs +2 -2
- package/dist/cli__control-api.d.mts +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__init-output.d.mts +1 -1
- package/dist/cli__init-output.mjs +1 -1
- package/dist/code-templates-CSLH8721-CWRA4Lru.mjs +295 -0
- package/dist/code-templates-CSLH8721-CWRA4Lru.mjs.map +1 -0
- package/dist/init-CcJxAIeS-CITTa8YU.mjs +800 -0
- package/dist/init-CcJxAIeS-CITTa8YU.mjs.map +1 -0
- package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs → migrate-BVEyoBor-CN_EOCzx.mjs} +3 -3
- package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs.map → migrate-BVEyoBor-CN_EOCzx.mjs.map} +1 -1
- package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs → migrate-failure-CKMEnA_x-ByHkYjn5.mjs} +3 -3
- package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs.map → migrate-failure-CKMEnA_x-ByHkYjn5.mjs.map} +1 -1
- package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs → migration-graph-D4sgTiXa-BLtiLIk7.mjs} +4 -4
- package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs.map → migration-graph-D4sgTiXa-BLtiLIk7.mjs.map} +1 -1
- package/dist/{migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs → migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs} +17 -3
- package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map +1 -0
- package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs → migration-graph-sections-B8WSWSkJ-CyaRo0T6.mjs} +3 -3
- package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs.map → migration-graph-sections-B8WSWSkJ-CyaRo0T6.mjs.map} +1 -1
- package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs → migration-list-BIL-re1m-CZY4m3d0.mjs} +3 -3
- package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs.map → migration-list-BIL-re1m-CZY4m3d0.mjs.map} +1 -1
- package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs → migration-log-BdBKYAUW-DTPxKZtD.mjs} +4 -4
- package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs.map → migration-log-BdBKYAUW-DTPxKZtD.mjs.map} +1 -1
- package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs → migration-log-table-eES9lPjv-BCFm8qJr.mjs} +3 -3
- package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs.map → migration-log-table-eES9lPjv-BCFm8qJr.mjs.map} +1 -1
- package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs → migration-status-DzPVkkB3-BA7jjITd.mjs} +5 -4
- package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs.map → migration-status-DzPVkkB3-BA7jjITd.mjs.map} +1 -1
- package/dist/{output-DWNYqZGc-D2sRgLAm.mjs → output-DP3woAjV-BxCr9nHA.mjs} +21 -11
- package/dist/output-DP3woAjV-BxCr9nHA.mjs.map +1 -0
- package/dist/{init-Bco4QkKJ-DqUZVrBU.mjs → redact-secrets-kQ0KKV1u-MnVSKe-u.mjs} +740 -1516
- package/dist/redact-secrets-kQ0KKV1u-MnVSKe-u.mjs.map +1 -0
- package/dist/{schemas-Bm2e3Hk1-qLKF0B36.d.mts → schemas-BGgjiKV0-Rh8RlMCl.d.mts} +4 -2
- package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts.map +1 -0
- package/dist/{schemas-BMkqaqvM-CLaqlat4.mjs → schemas-CYSD83Cu-Bff4PPoi.mjs} +3 -2
- package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/init-Bco4QkKJ-DqUZVrBU.mjs.map +0 -1
- package/dist/migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs.map +0 -1
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +0 -1
- package/dist/schemas-BMkqaqvM-CLaqlat4.mjs.map +0 -1
- package/dist/schemas-Bm2e3Hk1-qLKF0B36.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-CcJxAIeS-CITTa8YU.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/init-CcJxAIeS.mjs"],"sourcesContent":["import { c as targetLabel, i as scaffoldSpecifierResolverFor, l as targetPackageName, n as dbFile, o as starterSchema, r as defaultSchemaPath, t as configFile } from \"./code-templates-CSLH8721.mjs\";\nimport { t as CliStructuredError } from \"./cli-errors-BG6bItjG.mjs\";\nimport { i as formatErrorOutput, r as formatErrorJson, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { B as errorInitReinitNeedsForce, C as validateSchemaPath, E as envFileContent, F as errorInitInstallFailed, G as buildCatalogWarnings, H as errorInitStrictProbeWithoutProbe, I as errorInitInvalidManifest, L as errorInitInvalidTsconfig, M as resolveProjectSkillInstallCommands, N as probeServerVersion, O as DEFAULT_SKILL_SOURCES, P as errorInitEmitFailed, R as errorInitMissingFlags, S as resolveTarget, T as envExampleContent, U as errorInitUserAborted, V as errorInitSkillInstallFailed, _ as formatAddArgs, a as mergeTsConfig, b as hasProjectManifest, c as findStaleArtifacts, d as ensureEsmModuleType, f as mergePackageScripts, g as detectPackageManager, h as requiredGitattributesLines, i as defaultTsConfig, j as legacySkillDirs, k as formatSkillInstallCommand, l as removeDependency, m as mergeGitattributes, n as isRecognisedPnpmResolutionError, o as minimalProjectReadmeMd, p as mergeGitignore, r as TsConfigParseError, s as quickReferenceMd, t as redactSecrets, u as REQUIRED_SCRIPTS, v as formatAddDevArgs, w as MIN_SERVER_VERSION, x as resolveAuthoring, y as formatRunCommand, z as errorInitProbeFailed } from \"./redact-secrets-kQ0KKV1u.mjs\";\nimport { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from \"./output-DP3woAjV.mjs\";\nimport { basename, dirname, extname, isAbsolute, join } from \"pathe\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport * as clack from \"@clack/prompts\";\nimport { docsUrlFor } from \"@internal/utils/structured-error\";\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n//#region src/commands/init/inputs.ts\n/**\n* Resolves every required input for `runInit`. In interactive mode, missing\n* inputs are prompted via clack; in non-interactive mode, missing required\n* inputs throw a structured error listing exactly which flags are missing\n* (FR1.4). Throws `CliStructuredError` on any unrecoverable input issue.\n*\n* `canPrompt` is decoupled from `flags.interactive` so the action handler\n* (`./index.ts`) owns the merge of stdout-TTY (decoration) and stdin-TTY\n* (prompts). `flags.interactive` continues to gate `TerminalUI` decoration\n* — see [Style Guide § Interactivity](../../../../../../../docs/CLI%20Style%20Guide.md#interactivity).\n*/\nasync function resolveInitInputs(ctx) {\n\tconst { baseDir, options, flags, canPrompt } = ctx;\n\tconst force = Boolean(options.force);\n\tconst autoAcceptPrompts = Boolean(flags.yes);\n\tif (options.strictProbe && !options.probeDb) throw errorInitStrictProbeWithoutProbe();\n\tconst reinit = await resolveReinit({\n\t\tbaseDir,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst target = resolveTarget(options.target);\n\tconst authoring = resolveAuthoring(options.authoring);\n\tconst missing = [];\n\tif (target === void 0) missing.push(\"target\");\n\tif (authoring === void 0) missing.push(\"authoring\");\n\tif (!canPrompt && missing.length > 0) throw errorInitMissingFlags({\n\t\tmissing,\n\t\twhy: process.stdin.isTTY ? \"Non-interactive mode is active (`--no-interactive` or stdout is piped).\" : \"stdin is not a TTY, so `init` cannot prompt interactively.\"\n\t});\n\tconst finalTarget = target ?? await promptTarget();\n\tconst finalAuthoring = authoring ?? await promptAuthoring();\n\tconst finalSchemaPath = options.schemaPath !== void 0 ? validateSchemaPath(options.schemaPath, finalAuthoring) : canPrompt ? await promptSchemaPath(finalAuthoring) : defaultSchemaPath(finalAuthoring);\n\tconst writeEnv = await resolveWriteEnv({\n\t\tflag: options.writeEnv,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst removePreviousFacade = await resolveRemovePreviousFacade({\n\t\tbaseDir,\n\t\ttarget: finalTarget,\n\t\treinit,\n\t\tforce,\n\t\tcanPrompt,\n\t\tautoAcceptPrompts\n\t});\n\tconst installProjectSkill = options.skill !== false;\n\treturn {\n\t\ttarget: finalTarget,\n\t\tauthoring: finalAuthoring,\n\t\tschemaPath: finalSchemaPath,\n\t\tinstall: options.install !== false,\n\t\twriteEnv,\n\t\tprobeDb: Boolean(options.probeDb),\n\t\tstrictProbe: Boolean(options.strictProbe),\n\t\treinit,\n\t\tremovePreviousFacade,\n\t\tinstallProjectSkill\n\t};\n}\nasync function resolveWriteEnv(opts) {\n\tif (opts.flag !== void 0) return Boolean(opts.flag);\n\tif (!opts.canPrompt || opts.autoAcceptPrompts) return false;\n\tconst result = await clack.confirm({\n\t\tmessage: \"Also write a .env file from .env.example? (gitignored)\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn Boolean(result);\n}\n/**\n* FR9.2 — detects whether re-init is switching targets (the previous\n* facade differs from the chosen target's facade) and resolves the\n* remove-or-keep question.\n*\n* The non-interactive contract is the same as the `--force` re-init\n* gate above: a non-interactive run that reaches this helper always\n* has `--force` (otherwise `resolveReinit` would have thrown 5002), so\n* the removal proceeds without further prompting. Interactive runs see\n* a `clack.confirm` with `initialValue: true` — the destructive default\n* is correct because keeping both facades produces a project that\n* imports from one but pays for both in the lockfile, which is a\n* silent foot-gun the user almost never wants.\n*\n* Returns the previous facade package name when the user consented (or\n* was force-ed) to remove it, otherwise `null`. Parse failures on\n* `package.json` resolve to `null` here — `runInit`'s precondition\n* gate surfaces a structured 5010 error for the same file shortly\n* after, so we avoid double-reporting and keep this helper side-effect\n* free under hostile inputs.\n*/\nasync function resolveRemovePreviousFacade(opts) {\n\tif (!opts.reinit) return null;\n\tconst packageJsonPath = join(opts.baseDir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return null;\n\tconst otherTarget = opts.target === \"postgres\" ? \"mongo\" : \"postgres\";\n\tconst otherFacadeNames = [targetPackageName(otherTarget, scaffoldSpecifierResolverFor(otherTarget)), targetPackageName(otherTarget)];\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n\t} catch {\n\t\treturn null;\n\t}\n\tconst deps = parsed[\"dependencies\"];\n\tif (deps === null || typeof deps !== \"object\" || Array.isArray(deps)) return null;\n\tconst otherFacade = otherFacadeNames.find((name) => Object.hasOwn(deps, name));\n\tif (otherFacade === void 0) return null;\n\tif (opts.force || opts.canPrompt && opts.autoAcceptPrompts) return otherFacade;\n\tif (!opts.canPrompt) return otherFacade;\n\tconst result = await clack.confirm({\n\t\tmessage: `Switching from ${targetLabel(otherTarget)} to ${targetLabel(opts.target)} — remove ${otherFacade} from package.json dependencies?`,\n\t\tinitialValue: true,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result === true ? otherFacade : null;\n}\nasync function resolveReinit(opts) {\n\tif (!existsSync(join(opts.baseDir, \"prisma-next.config.ts\"))) return false;\n\tif (opts.force) return true;\n\tif (!opts.canPrompt) throw errorInitReinitNeedsForce();\n\tif (opts.autoAcceptPrompts) return true;\n\tconst result = await clack.confirm({\n\t\tmessage: \"This project is already initialized. Re-initialize? This will overwrite all generated files.\",\n\t\tinitialValue: false,\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result) || result !== true) throw errorInitUserAborted();\n\treturn true;\n}\nasync function promptTarget() {\n\tconst result = await clack.select({\n\t\tmessage: \"What database are you using?\",\n\t\toptions: [{\n\t\t\tvalue: \"postgres\",\n\t\t\tlabel: \"PostgreSQL\"\n\t\t}, {\n\t\t\tvalue: \"mongo\",\n\t\t\tlabel: \"MongoDB\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptAuthoring() {\n\tconst result = await clack.select({\n\t\tmessage: \"How do you want to write your schema?\",\n\t\toptions: [{\n\t\t\tvalue: \"psl\",\n\t\t\tlabel: \"Prisma Schema Language (.prisma)\"\n\t\t}, {\n\t\t\tvalue: \"typescript\",\n\t\t\tlabel: \"TypeScript (.ts)\"\n\t\t}],\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn result;\n}\nasync function promptSchemaPath(authoring) {\n\tconst expectedExt = authoring === \"typescript\" ? \".ts\" : \".prisma\";\n\tconst result = await clack.text({\n\t\tmessage: \"Where should the schema file go?\",\n\t\tinitialValue: defaultSchemaPath(authoring),\n\t\tvalidate(value = \"\") {\n\t\t\tconst trimmed = value.trim();\n\t\t\tif (trimmed.length === 0) return \"Path cannot be empty\";\n\t\t\tif (trimmed.endsWith(\"/\") || trimmed.endsWith(\"\\\\\")) return \"Path must be a file, not a directory\";\n\t\t\tconst ext = extname(trimmed).toLowerCase();\n\t\t\tif (ext === \"\") return \"Path must include a file extension (e.g. .prisma or .ts)\";\n\t\t\tif (ext !== expectedExt) return `Schema path must end in ${expectedExt} for --authoring ${authoring} (got ${ext}).`;\n\t\t},\n\t\toutput: process.stderr\n\t});\n\tif (clack.isCancel(result)) throw errorInitUserAborted();\n\treturn validateSchemaPath(result, authoring);\n}\n//#endregion\n//#region src/commands/init/skill-install.ts\nconst exec = promisify(execFile);\n/**\n* Parse the project-pm-formatted command into an exec call. The\n* format-then-parse split keeps the user-facing command string the same\n* as the surface the structured error advertises, so a user who copies\n* the error's `fix` line gets the same invocation that init just\n* attempted. Single-quoted tokens are preserved in the display form so\n* shell-sensitive characters stay copy-safe, then stripped before\n* `execFile`.\n*/\nfunction commandToExec(command) {\n\tconst tokens = (command.match(/'[^']*'|\\S+/g) ?? []).map((token) => token.startsWith(\"'\") && token.endsWith(\"'\") ? token.slice(1, -1) : token);\n\treturn {\n\t\tfile: tokens[0] ?? \"npx\",\n\t\targs: tokens.slice(1)\n\t};\n}\n/**\n* Runs the project-level skill install for every source in\n* `DEFAULT_SKILL_SOURCES`, in order. Returns\n* `{ ok: true, commands }` on success; throws a structured\n* `errorInitSkillInstallFailed` on the first failure (subsequent\n* sources are not attempted — the user opted into Prisma Next by\n* running `init` and a partial install would leave the project in an\n* ambiguous state). The throw is intentionally fatal — project-level\n* skill install is unconditional (modulo `--no-skill`).\n*/\nasync function runProjectLevelSkillInstall(ctx) {\n\tconst commands = [];\n\tconst installCommands = resolveProjectSkillInstallCommands(ctx.pm);\n\tfor (const command of installCommands) {\n\t\tconst { file, args } = commandToExec(command);\n\t\ttry {\n\t\t\tawait exec(file, args, { cwd: ctx.baseDir });\n\t\t\tcommands.push(command);\n\t\t} catch (err) {\n\t\t\tthrow errorInitSkillInstallFailed({\n\t\t\t\tskillInstallCommand: command,\n\t\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\t\tcause: redactSecrets(readChildStderr$1(err)) || (err instanceof Error ? err.message : String(err))\n\t\t\t});\n\t\t}\n\t}\n\treturn {\n\t\tok: true,\n\t\tcommands\n\t};\n}\nfunction readChildStderr$1(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n//#endregion\n//#region src/commands/init/init.ts\n/**\n* Runs the `init` command end-to-end and returns the exit code. Catches\n* structured CLI errors raised at every phase (input resolution, install,\n* emit) and renders them via the same UI surface as success output\n* (`--json` to stdout, human to stderr). Exit codes follow the documented\n* stable set in `./exit-codes.ts` and the\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes).\n*\n* Layered for testability: the action handler in `./index.ts` is\n* responsible for parsing flags and constructing `runOptions`; this\n* function does no flag parsing of its own.\n*/\nasync function runInit(baseDir, runOptions) {\n\tconst { options, flags, canPrompt, probeOverrides } = runOptions;\n\tconst ui = createTerminalUI(flags);\n\tconst warnings = [];\n\tconst filesWritten = [];\n\tconst filesDeleted = [];\n\tif (!flags.json && !flags.quiet) clack.intro(\"prisma-next init\", { output: process.stderr });\n\tlet inputs;\n\ttry {\n\t\tinputs = await resolveInitInputs({\n\t\t\tbaseDir,\n\t\t\toptions,\n\t\t\tflags,\n\t\t\tcanPrompt\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tconst pm = await detectPackageManager(baseDir);\n\tconst pkgRun = formatRunCommand(pm, \"prisma-next\", \"\").trimEnd();\n\tconst schemaDir = dirname(inputs.schemaPath);\n\tconst configContractPath = isAbsolute(inputs.schemaPath) ? inputs.schemaPath : `./${inputs.schemaPath}`;\n\tconst resolveImportSpecifier = scaffoldSpecifierResolverFor(inputs.target);\n\tconst filesToWrite = [\n\t\t{\n\t\t\tpath: inputs.schemaPath,\n\t\t\tcontent: starterSchema(inputs.target, inputs.authoring, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.config.ts\",\n\t\t\tcontent: configFile(inputs.target, configContractPath, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: join(schemaDir, \"db.ts\"),\n\t\t\tcontent: dbFile(inputs.target, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \"prisma-next.md\",\n\t\t\tcontent: quickReferenceMd(inputs.target, inputs.authoring, inputs.schemaPath, pkgRun, resolveImportSpecifier)\n\t\t},\n\t\t{\n\t\t\tpath: \".env.example\",\n\t\t\tcontent: envExampleContent(inputs.target)\n\t\t}\n\t];\n\tconst filesToDelete = inputs.reinit ? [...findStaleArtifacts(baseDir, schemaDir)] : [];\n\tconst legacyDirsToDelete = legacySkillDirs().filter((rel) => existsSync(join(baseDir, rel)));\n\tif (inputs.writeEnv) if (!existsSync(join(baseDir, \".env\"))) filesToWrite.push({\n\t\tpath: \".env\",\n\t\tcontent: envFileContent(inputs.target)\n\t});\n\telse warnings.push(\".env already exists; leaving it untouched. Compare with .env.example for any new keys.\");\n\tconst tsconfigPath = join(baseDir, \"tsconfig.json\");\n\tif (existsSync(tsconfigPath)) {\n\t\tconst existing = readFileSync(tsconfigPath, \"utf-8\");\n\t\tlet merged;\n\t\ttry {\n\t\t\tmerged = mergeTsConfig(existing);\n\t\t} catch (err) {\n\t\t\tif (err instanceof TsConfigParseError) return emitError(ui, flags, errorInitInvalidTsconfig({\n\t\t\t\tpath: \"tsconfig.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tfilesToWrite.push({\n\t\t\tpath: \"tsconfig.json\",\n\t\t\tcontent: merged,\n\t\t\tlogMessage: \"Updated tsconfig.json with required compiler options.\"\n\t\t});\n\t} else filesToWrite.push({\n\t\tpath: \"tsconfig.json\",\n\t\tcontent: defaultTsConfig()\n\t});\n\tconst gitignorePath = join(baseDir, \".gitignore\");\n\tconst newGitignore = mergeGitignore(existsSync(gitignorePath) ? readFileSync(gitignorePath, \"utf-8\") : void 0);\n\tif (newGitignore !== null) filesToWrite.push({\n\t\tpath: \".gitignore\",\n\t\tcontent: newGitignore\n\t});\n\tconst gitattributesPath = join(baseDir, \".gitattributes\");\n\tconst newGitattributes = mergeGitattributes(existsSync(gitattributesPath) ? readFileSync(gitattributesPath, \"utf-8\") : void 0, requiredGitattributesLines(schemaDir, inputs.target));\n\tif (newGitattributes !== null) filesToWrite.push({\n\t\tpath: \".gitattributes\",\n\t\tcontent: newGitattributes\n\t});\n\tconst packageJsonPath = join(baseDir, \"package.json\");\n\tconst packageJsonExisted = existsSync(packageJsonPath);\n\tconst synthesisePackageJson = !packageJsonExisted && !hasProjectManifest(baseDir);\n\tlet parsedPackageJson = null;\n\tif (packageJsonExisted || synthesisePackageJson) {\n\t\tconst pkgRaw = packageJsonExisted ? readFileSync(packageJsonPath, \"utf-8\") : defaultPackageJsonContent(basename(baseDir));\n\t\ttry {\n\t\t\tparsedPackageJson = JSON.parse(pkgRaw);\n\t\t} catch (err) {\n\t\t\tif (err instanceof SyntaxError) return emitError(ui, flags, errorInitInvalidManifest({\n\t\t\t\tpath: \"package.json\",\n\t\t\t\tcause: err.message\n\t\t\t}));\n\t\t\tthrow err;\n\t\t}\n\t\tlet workingPkg = pkgRaw;\n\t\tlet pkgChanged = synthesisePackageJson;\n\t\tif (inputs.removePreviousFacade !== null) {\n\t\t\tconst next = removeDependency(workingPkg, inputs.removePreviousFacade);\n\t\t\tif (next !== null) {\n\t\t\t\tworkingPkg = next;\n\t\t\t\tpkgChanged = true;\n\t\t\t}\n\t\t}\n\t\tconst { content: nextPkg, warnings: scriptWarnings } = mergePackageScripts(workingPkg, REQUIRED_SCRIPTS);\n\t\tif (nextPkg !== null) {\n\t\t\tworkingPkg = nextPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tconst { content: typedPkg, warning: typeWarning } = ensureEsmModuleType(workingPkg);\n\t\tif (typedPkg !== null) {\n\t\t\tworkingPkg = typedPkg;\n\t\t\tpkgChanged = true;\n\t\t}\n\t\tif (pkgChanged) filesToWrite.push({\n\t\t\tpath: \"package.json\",\n\t\t\tcontent: workingPkg\n\t\t});\n\t\twarnings.push(...scriptWarnings);\n\t\tif (typeWarning !== null) warnings.push(typeWarning);\n\t\tif (synthesisePackageJson) warnings.push(\"No package.json found in the target directory; created a minimal one. Edit `name` / `version` to taste.\");\n\t}\n\tif (existsSync(join(baseDir, \"src/index.ts\"))) if (!existsSync(join(baseDir, \"README.md\"))) {\n\t\tconst rawName = parsedPackageJson !== null && typeof parsedPackageJson[\"name\"] === \"string\" ? parsedPackageJson[\"name\"] : basename(baseDir);\n\t\tfilesToWrite.push({\n\t\t\tpath: \"README.md\",\n\t\t\tcontent: minimalProjectReadmeMd(inputs.target, inputs.schemaPath, sanitisePackageName(rawName), pm)\n\t\t});\n\t} else warnings.push(\"README.md already exists; leaving it untouched.\");\n\tfor (const file of filesToWrite) {\n\t\tconst fullPath = join(baseDir, file.path);\n\t\tmkdirSync(dirname(fullPath), { recursive: true });\n\t\twriteFileSync(fullPath, file.content, \"utf-8\");\n\t\tfilesWritten.push(file.path);\n\t\tif (file.logMessage !== void 0 && !flags.json && !flags.quiet) ui.log(file.logMessage);\n\t}\n\tfor (const rel of filesToDelete) {\n\t\tconst fullPath = join(baseDir, rel);\n\t\tif (!existsSync(fullPath)) continue;\n\t\ttry {\n\t\t\tunlinkSync(fullPath);\n\t\t\tfilesDeleted.push(rel);\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof Error && \"code\" in err && err.code === \"ENOENT\")) throw err;\n\t\t}\n\t}\n\tfor (const rel of legacyDirsToDelete) {\n\t\trmSync(join(baseDir, rel), {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tfilesDeleted.push(rel);\n\t}\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tlet install;\n\ttry {\n\t\tinstall = await runInstall({\n\t\t\tbaseDir,\n\t\t\tpm,\n\t\t\ttarget: inputs.target,\n\t\t\tinstall: inputs.install,\n\t\t\tflags,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\tresolveImportSpecifier,\n\t\t\thasTypesNode: parsedPackageJson !== null ? hasDirectDep(parsedPackageJson, \"@types/node\") : false\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\twarnings.push(...install.warnings);\n\tlet contractEmitted = false;\n\tif (!install.skipped) try {\n\t\tawait runEmit({\n\t\t\tbaseDir,\n\t\t\tui,\n\t\t\tfilesWritten,\n\t\t\temitCommand\n\t\t});\n\t\tcontractEmitted = true;\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return emitError(ui, flags, error);\n\t\tthrow error;\n\t}\n\tif (inputs.probeDb) {\n\t\tconst escalated = applyProbeOutcome(await probeServerVersion({\n\t\t\tbaseDir,\n\t\t\ttarget: inputs.target,\n\t\t\tdatabaseUrl: process.env[\"DATABASE_URL\"],\n\t\t\tminVersion: MIN_SERVER_VERSION[inputs.target]\n\t\t}, probeOverrides ?? {}), {\n\t\t\tstrictProbe: inputs.strictProbe,\n\t\t\twarnings\n\t\t});\n\t\tif (escalated !== null) return emitError(ui, flags, errorInitProbeFailed({\n\t\t\tcause: escalated,\n\t\t\tfilesWritten\n\t\t}));\n\t}\n\tconst manualProjectSkillSummary = DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({\n\t\tpm: install.effectivePm,\n\t\tsource\n\t})).map((c) => `\\`${c}\\``).join(\" && \");\n\tlet skillRegistered = false;\n\tif (!inputs.installProjectSkill) warnings.push(`Skipped Prisma Next skills install (--no-skill). To install the skills later, run: ${manualProjectSkillSummary}`);\n\telse {\n\t\tconst spinner = ui.spinner();\n\t\tspinner.start(\"Registering Prisma Next skills with the agent runtime...\");\n\t\ttry {\n\t\t\tconst project = await runProjectLevelSkillInstall({\n\t\t\t\tbaseDir,\n\t\t\t\tpm: install.effectivePm,\n\t\t\t\tfilesWritten\n\t\t\t});\n\t\t\tspinner.stop(`Registered Prisma Next skills (project level) — ran ${project.commands.map((c) => `\\`${c}\\``).join(\", \")}`);\n\t\t\tskillRegistered = true;\n\t\t} catch (error) {\n\t\t\tspinner.stop(\"Agent-skill install failed\");\n\t\t\tif (CliStructuredError.is(error)) return emitError(ui, flags, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\tconst packagesInstalled = install.skipped ? \"skipped\" : \"installed\";\n\tconst output = {\n\t\tok: true,\n\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\tauthoring: inputs.authoring,\n\t\tschemaPath: inputs.schemaPath,\n\t\tfilesWritten,\n\t\tfilesDeleted,\n\t\tpackagesInstalled: {\n\t\t\tstatus: packagesInstalled,\n\t\t\tdeps: [...install.deps],\n\t\t\tdevDeps: [...install.devDeps]\n\t\t},\n\t\tcontractEmitted,\n\t\tnextSteps: buildNextSteps({\n\t\t\ttarget: inputs.target === \"mongo\" ? \"mongodb\" : \"postgres\",\n\t\t\tpackagesInstalled,\n\t\t\tcontractEmitted,\n\t\t\temitCommand,\n\t\t\tschemaPath: inputs.schemaPath,\n\t\t\tskillRegistered\n\t\t}),\n\t\twarnings\n\t};\n\tconst validated = InitOutputSchema(output);\n\tif (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\", \"Init produced an invalid output document\", {\n\t\twhy: `The success document failed schema validation: ${String(validated)}`,\n\t\tfix: \"This is a bug in prisma-next. Please report it with the full `-v` output.\",\n\t\tdocsUrl: docsUrlFor(\"CLI.INIT_INVALID_OUTPUT_DOCUMENT\")\n\t}));\n\tif (flags.json) ui.output(formatInitJson(output));\n\telse {\n\t\trenderInitOutro(ui, output, flags);\n\t\tif (!flags.quiet) clack.outro(\"Done. Open prisma-next.md to get started.\", { output: process.stderr });\n\t}\n\treturn 0;\n}\n/**\n* Renders a structured CLI error to the right channel and returns the exit\n* code derived from the error's PN code. JSON-mode errors go to stdout\n* (so consumers always parse from one place); human-mode errors go to\n* stderr. Mirrors `handleResult` but returns init-specific exit codes\n* rather than the CLI/RUN binary.\n*/\nfunction emitError(ui, flags, error) {\n\tconst envelope = error.toEnvelope();\n\tif (flags.json) ui.output(formatErrorJson(envelope));\n\telse ui.error(formatErrorOutput(envelope, flags));\n\treturn exitCodeForError(error);\n}\n/**\n* Maps a structured init error to its documented exit code. Centralised so\n* the error → exit-code contract lives next to the codes themselves.\n*\n* `CLI.INIT_INVALID_OUTPUT_DOCUMENT` (and the unknown-code default branch)\n* routes to `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next\n* bugs the user did not cause — surfacing them as `PRECONDITION` would\n* mislead automation into thinking the caller mis-invoked the CLI.\n*\n* See [exit-codes.ts](./exit-codes.ts) for the canonical list and\n* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes)\n* for the reservation policy.\n*\n* Exported for unit tests so the mapping can be asserted without\n* round-tripping a full `runInit` invocation.\n*/\nfunction exitCodeForError(error) {\n\tswitch (error.code) {\n\t\tcase \"CLI.INIT_REINIT_NEEDS_FORCE\":\n\t\tcase \"CLI.INIT_MISSING_FLAGS\":\n\t\tcase \"CLI.INIT_INVALID_FLAG_VALUE\":\n\t\tcase \"CLI.INIT_STRICT_PROBE_WITHOUT_PROBE\":\n\t\tcase \"CLI.INIT_INVALID_MANIFEST\":\n\t\tcase \"CLI.INIT_INVALID_TSCONFIG\":\n\t\tcase \"CLI.INIT_PROBE_FAILED\":\n\t\tcase \"CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH\":\n\t\tcase \"CLI.INIT_WRITE_FAILED\": return 2;\n\t\tcase \"CLI.INIT_USER_ABORTED\": return 3;\n\t\tcase \"CLI.INIT_INSTALL_FAILED\": return 4;\n\t\tcase \"CLI.INIT_EMIT_FAILED\": return 5;\n\t\tcase \"CLI.INIT_INVALID_OUTPUT_DOCUMENT\": return 1;\n\t\tcase \"CLI.INIT_SKILL_INSTALL_FAILED\": return 6;\n\t\tdefault: return 1;\n\t}\n}\n/**\n* Folds a `ProbeOutcome` into init's warning channel and returns the\n* fatal cause string when `--strict-probe` should escalate. Mirrors\n* the FR8.3 contract:\n*\n* - `ok` — informational; nothing surfaced unless verbose. (We could\n* plumb a `note` here, but the spec only requires the warning side\n* of the contract; an \"all good\" line would just be noise on the\n* common path.)\n* - `below-minimum` — warning regardless of `--strict-probe`. The\n* probe ran successfully and found an old server; that is not a\n* probe *failure* (which is what `--strict-probe` escalates), it\n* is the probe doing its job.\n* - `no-database-url` / `connection-failed` / `driver-missing` —\n* warning by default, fatal under `--strict-probe`.\n*\n* Exported for unit tests so the branching contract can be asserted\n* without spinning up a full `runInit` round trip.\n*/\nfunction applyProbeOutcome(outcome, ctx) {\n\tswitch (outcome.kind) {\n\t\tcase \"ok\": return null;\n\t\tcase \"below-minimum\":\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t\tcase \"no-database-url\":\n\t\tcase \"connection-failed\":\n\t\tcase \"driver-missing\":\n\t\t\tif (ctx.strictProbe) return outcome.message;\n\t\t\tctx.warnings.push(outcome.message);\n\t\t\treturn null;\n\t}\n}\n/**\n* Drives the `pnpm add` / `npm install` step. Failures are escalated to\n* a structured `errorInitInstallFailed` (exit code 4) — the spec treats\n* an unrecoverable install as a hard outcome rather than a warning so\n* CI/agents can branch on the exit code (FR1.6).\n*\n* For pnpm specifically, we additionally implement the FR7.2 fallback:\n* if pnpm fails with a recognised workspace/catalog resolution error\n* class (typically caused by a registry version that leaked\n* `workspace:*` or `catalog:` specifiers), we retry the install using\n* `npm` and surface a non-fatal warning explaining the swap.\n*/\nasync function runInstall(ctx) {\n\tconst { baseDir, pm, target, install, flags, ui, filesWritten, hasTypesNode } = ctx;\n\tconst deps = [targetPackageName(target, ctx.resolveImportSpecifier), \"dotenv\"];\n\tconst devDeps = hasTypesNode ? [\"prisma-next\"] : [\"prisma-next\", \"@types/node\"];\n\tconst addCommand = `${pm} ${formatAddArgs(pm, deps).join(\" \")}`;\n\tconst addDevCommand = `${pm} ${formatAddDevArgs(pm, devDeps).join(\" \")}`;\n\tconst emitCommand = formatRunCommand(pm, \"prisma-next\", \"contract emit\");\n\tconst catalogWarnings = pm === \"pnpm\" ? buildCatalogWarnings(baseDir, [...deps, ...devDeps]) : [];\n\tif (!install) {\n\t\tif (!flags.json && !flags.quiet) ui.note([\n\t\t\t\"Run the following commands to complete setup:\",\n\t\t\t\"\",\n\t\t\t\" 1. Install dependencies:\",\n\t\t\t` ${addCommand}`,\n\t\t\t` ${addDevCommand}`,\n\t\t\t\"\",\n\t\t\t\" 2. Emit the contract:\",\n\t\t\t` ${emitCommand}`\n\t\t].join(\"\\n\"), \"Manual steps\");\n\t\treturn {\n\t\t\tskipped: true,\n\t\t\tdeps: [],\n\t\t\tdevDeps: [],\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t}\n\tconst exec = promisify(execFile);\n\tconst runPair = async (manager) => {\n\t\tawait exec(manager, formatAddArgs(manager, deps), { cwd: baseDir });\n\t\tawait exec(manager, formatAddDevArgs(manager, devDeps), { cwd: baseDir });\n\t};\n\tconst allPackages = [...deps, ...devDeps].join(\", \");\n\tconst spinner = ui.spinner();\n\tspinner.start(`Installing ${allPackages}...`);\n\ttry {\n\t\tawait runPair(pm);\n\t\tspinner.stop(`Installed ${allPackages}`);\n\t\treturn {\n\t\t\tskipped: false,\n\t\t\tdeps,\n\t\t\tdevDeps,\n\t\t\twarnings: catalogWarnings,\n\t\t\teffectivePm: pm\n\t\t};\n\t} catch (err) {\n\t\tconst stderrText = redactSecrets(readChildStderr(err));\n\t\tif (pm === \"pnpm\" && isRecognisedPnpmResolutionError(stderrText)) {\n\t\t\tspinner.message(\"pnpm could not resolve a workspace/catalog dependency, retrying with npm...\");\n\t\t\ttry {\n\t\t\t\tawait runPair(\"npm\");\n\t\t\t\tspinner.stop(`Installed ${allPackages} via npm (pnpm fallback)`);\n\t\t\t\treturn {\n\t\t\t\t\tskipped: false,\n\t\t\t\t\tdeps,\n\t\t\t\t\tdevDeps,\n\t\t\t\t\twarnings: [[\n\t\t\t\t\t\t\"pnpm could not install: a published Prisma Next dependency leaked a `workspace:*` or `catalog:` specifier.\",\n\t\t\t\t\t\t\"Falling back to `npm install` so init can complete.\",\n\t\t\t\t\t\tstderrText ? ` pnpm error: ${stderrText.trim().split(\"\\n\")[0]}` : \"\",\n\t\t\t\t\t\t\"Once the offending package republishes a clean version, re-run `pnpm install` to switch back.\"\n\t\t\t\t\t].filter(Boolean).join(\"\\n\")],\n\t\t\t\t\teffectivePm: \"npm\"\n\t\t\t\t};\n\t\t\t} catch (npmErr) {\n\t\t\t\tspinner.stop(\"Installation failed\");\n\t\t\t\tthrow errorInitInstallFailed({\n\t\t\t\t\taddCommand,\n\t\t\t\t\taddDevCommand,\n\t\t\t\t\temitCommand,\n\t\t\t\t\tfilesWritten,\n\t\t\t\t\tstderrLines: [stderrText, redactSecrets(readChildStderr(npmErr))]\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tspinner.stop(\"Installation failed\");\n\t\tthrow errorInitInstallFailed({\n\t\t\taddCommand,\n\t\t\taddDevCommand,\n\t\t\temitCommand,\n\t\t\tfilesWritten,\n\t\t\tstderrLines: [stderrText]\n\t\t});\n\t}\n}\n/**\n* FR2.1 — true when the parsed `package.json` declares `name` directly\n* in either `dependencies` or `devDependencies`. We deliberately don't\n* inspect `peerDependencies` (irrelevant for a leaf project) or the\n* lockfile (transitive presence is brittle to detect and not the\n* realistic clobber-risk path).\n*\n* Exported for unit tests.\n*/\nfunction hasDirectDep(parsed, name) {\n\tfor (const field of [\"dependencies\", \"devDependencies\"]) {\n\t\tconst value = parsed[field];\n\t\tif (value !== null && typeof value === \"object\" && name in value) return true;\n\t}\n\treturn false;\n}\nfunction readChildStderr(err) {\n\tif (err instanceof Error && \"stderr\" in err) return String(err.stderr ?? \"\");\n\treturn \"\";\n}\n/**\n* Drives `prisma-next contract emit` against the freshly scaffolded\n* project. On failure, throws `errorInitEmitFailed` with the underlying\n* cause embedded in `meta.cause` so the user can re-run with `-v` to see\n* the full envelope and follow the fix steps. Maps to exit code\n* `5 = EMIT_FAILED` (FR1.6).\n*/\nasync function runEmit(ctx) {\n\tconst spinner = ctx.ui.spinner();\n\tspinner.start(\"Emitting contract...\");\n\ttry {\n\t\tconst { executeContractEmit } = await import(\"./contract-emit-Bzt11N4v.mjs\");\n\t\tconst { loadConfigForSections } = await import(\"@internal/config-loader\");\n\t\tconst configFilePath = join(ctx.baseDir, \"prisma-next.config.ts\");\n\t\tconst configResult = await loadConfigForSections(configFilePath, [\n\t\t\t\"contract\",\n\t\t\t\"family\",\n\t\t\t\"target\",\n\t\t\t\"adapter\",\n\t\t\t\"extensions\"\n\t\t]);\n\t\tif (!configResult.ok) throw configResult.failure;\n\t\tawait executeContractEmit({\n\t\t\tconfig: configResult.value,\n\t\t\tcwd: process.cwd(),\n\t\t\tconfigPath: configFilePath\n\t\t});\n\t\tspinner.stop(\"Contract emitted\");\n\t} catch (err) {\n\t\tspinner.stop(\"Contract emission failed\");\n\t\tthrow errorInitEmitFailed({\n\t\t\temitCommand: ctx.emitCommand,\n\t\t\tfilesWritten: ctx.filesWritten,\n\t\t\tcause: causeMessage(err)\n\t\t});\n\t}\n}\nfunction causeMessage(err) {\n\tif (err instanceof Error) return err.message;\n\treturn String(err);\n}\n/**\n* Minimal `package.json` content used when init runs in a directory\n* that has no project manifest (TML-2496). Mirrors the npm 11 `init -y`\n* defaults, with two deliberate deviations:\n*\n* - `\"private\": true` so a stray `npm publish` cannot leak the\n* placeholder. Users who want to publish have to opt in by removing\n* the field.\n* - `\"type\": \"module\"` so the scaffolded ESM imports in\n* `prisma-next.config.ts` and `db.ts` typecheck and run without\n* additional tsconfig coercion.\n*\n* Exported for unit tests so the canonical shape is asserted in one\n* place rather than re-derived at every call site.\n*/\nfunction defaultPackageJsonContent(rawName) {\n\treturn `${JSON.stringify({\n\t\tname: sanitisePackageName(rawName),\n\t\tversion: \"0.0.0\",\n\t\tprivate: true,\n\t\ttype: \"module\"\n\t}, null, 2)}\\n`;\n}\n/**\n* npm package names are restricted to lowercase, no leading dot/underscore,\n* and a small URL-safe character set. `basename(cwd)` happily returns\n* \"My Project\" or \".hidden\" — both rejected by `npm install` validation.\n* Coerce to a safe fallback rather than emit a manifest npm refuses to\n* read.\n*/\nfunction sanitisePackageName(raw) {\n\tconst trimmed = raw.toLowerCase().replace(/[^a-z0-9._~-]/g, \"-\").replace(/^[._-]+/, \"\").replace(/-+/g, \"-\");\n\treturn trimmed.length > 0 ? trimmed : \"my-app\";\n}\n//#endregion\nexport { runInit };\n\n//# sourceMappingURL=init-CcJxAIeS.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,eAAe,kBAAkB,KAAK;CACrC,MAAM,EAAE,SAAS,SAAS,OAAO,cAAc;CAC/C,MAAM,QAAQ,QAAQ,QAAQ,KAAK;CACnC,MAAM,oBAAoB,QAAQ,MAAM,GAAG;CAC3C,IAAI,QAAQ,eAAe,CAAC,QAAQ,SAAS,MAAM,iCAAiC;CACpF,MAAM,SAAS,MAAM,cAAc;EAClC;EACA;EACA;EACA;CACD,CAAC;CACD,MAAM,SAAS,cAAc,QAAQ,MAAM;CAC3C,MAAM,YAAY,iBAAiB,QAAQ,SAAS;CACpD,MAAM,UAAU,CAAC;CACjB,IAAI,WAAW,KAAK,GAAG,QAAQ,KAAK,QAAQ;CAC5C,IAAI,cAAc,KAAK,GAAG,QAAQ,KAAK,WAAW;CAClD,IAAI,CAAC,aAAa,QAAQ,SAAS,GAAG,MAAM,sBAAsB;EACjE;EACA,KAAK,QAAQ,MAAM,QAAQ,4EAA4E;CACxG,CAAC;CACD,MAAM,cAAc,UAAU,MAAM,aAAa;CACjD,MAAM,iBAAiB,aAAa,MAAM,gBAAgB;CAC1D,MAAM,kBAAkB,QAAQ,eAAe,KA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;EACT,SAAS;EACT,MAAM;CACP,GAAG,MAAM,CAAC,EAAE;AACb;;;;;;;;AAQA,SAAS,oBAAoB,KAAK;CACjC,MAAM,UAAU,IAAI,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC,QAAQ,OAAO,GAAG;CAC1G,OAAO,QAAQ,SAAS,IAAI,UAAU;AACvC"}
|
|
@@ -10,13 +10,13 @@ import { t as mapContractAtError } from "./contract-at-errors-Dptf8RE_-B5gr04Sc.
|
|
|
10
10
|
import { i as refuseUnknownInvariants, n as refuseMarkerOutsideGraph } from "./invariants-1zL5-9Mc-BCeOLxd_.mjs";
|
|
11
11
|
import { t as executeMigrateShowPlan } from "./migrate-show-kVUG1xdo-bVTW8tu4.mjs";
|
|
12
12
|
import { t as resolveContractRef } from "./ref-resolution-DAK4OK3x-B-8ZZc0f.mjs";
|
|
13
|
-
import { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from "./migrate-failure-
|
|
13
|
+
import { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from "./migrate-failure-CKMEnA_x-ByHkYjn5.mjs";
|
|
14
14
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
15
15
|
import { readFile } from "node:fs/promises";
|
|
16
16
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
17
17
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
18
18
|
import { Command } from "commander";
|
|
19
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migrate-
|
|
19
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migrate-BVEyoBor.mjs
|
|
20
20
|
/**
|
|
21
21
|
* Read-only preview of the migration path `migrate` will take. Delegates the
|
|
22
22
|
* path computation to {@link executeMigrateShowPlan} (the control-api core)
|
|
@@ -340,4 +340,4 @@ function createMigrateCommand() {
|
|
|
340
340
|
//#endregion
|
|
341
341
|
export { createMigrateCommand as t };
|
|
342
342
|
|
|
343
|
-
//# sourceMappingURL=migrate-
|
|
343
|
+
//# sourceMappingURL=migrate-BVEyoBor-CN_EOCzx.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-CgSnzAUm-aGstaO5N.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-CgSnzAUm.mjs"],"sourcesContent":["import { N as errorUnexpected, c as errorDatabaseConnectionRequired, d as errorFileNotFound, j as errorTargetMigrationNotSupported, s as errorContractValidationFailed, u as errorDriverRequired } from \"./cli-errors-BG6bItjG.mjs\";\nimport { a as formatMigrationApplyCommandOutput, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, p as targetSupportsMigrations, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { a as loadContractSpaceAggregateForCli, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CoLTf3Ce.mjs\";\nimport { t as createControlClient } from \"./client-DU9qtBxW.mjs\";\nimport { a as readContractIR, t as advanceRefSafely } from \"./ref-advancement-DaZBzm7m.mjs\";\nimport { t as mapCaughtMigrationError } from \"./caught-errors-DLPzfzIW.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-Dptf8RE_.mjs\";\nimport { i as refuseMarkerOutsideGraph, n as refuseUnknownInvariants } from \"./invariants-1zL5-9Mc.mjs\";\nimport { t as executeMigrateShowPlan } from \"./migrate-show-kVUG1xdo.mjs\";\nimport { t as resolveContractRef } from \"./ref-resolution-DAK4OK3x.mjs\";\nimport { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from \"./migrate-failure-CnoUcDms.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\n//#region src/commands/migrate.ts\n/**\n* Read-only preview of the migration path `migrate` will take. Delegates the\n* path computation to {@link executeMigrateShowPlan} (the control-api core)\n* and keeps only the styled header plus the Tier-3 graph rendering here.\n*/\nasync function executeMigrateShowCommand(options, flags, ui) {\n\tconst readsLiveMarker = options.from === void 0 || options.from === \"@db\";\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t...readsLiveMarker ? [\"driver\"] : [],\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst planResult = await executeMigrateShowPlan({\n\t\tconfig: configResult.value,\n\t\tcwd: process.cwd(),\n\t\t...ifDefined(\"configPath\", options.config),\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"to\", options.to),\n\t\t...ifDefined(\"from\", options.from),\n\t\tonPreflightComplete: ({ configPath, migrationsRelative, dbConnection, hasExplicitFrom }) => {\n\t\t\tif (!flags.json && !flags.quiet) {\n\t\t\t\tconst details = [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t}, {\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t}];\n\t\t\t\tif (dbConnection && !hasExplicitFrom) details.push({\n\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t\t\t});\n\t\t\t\tif (options.from) details.push({\n\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\tvalue: options.from\n\t\t\t\t});\n\t\t\t\tif (options.to) details.push({\n\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\tvalue: options.to\n\t\t\t\t});\n\t\t\t\tconst header = formatStyledHeader({\n\t\t\t\t\tcommand: \"migrate --show\",\n\t\t\t\t\tdescription: \"Preview the migration path migrate will take (read-only)\",\n\t\t\t\t\tdetails,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tui.stderr(header);\n\t\t\t}\n\t\t}\n\t});\n\tif (!planResult.ok) return notOk(planResult.failure);\n\tconst plan = planResult.value;\n\tconst orderedMigrations = plan.migrations;\n\tlet graphOutput;\n\tlet runListDirNameWidth;\n\tlet runListLeftPad;\n\tif (!flags.json) {\n\t\tconst rendering = renderMigrateShowGraph(plan, {\n\t\t\tcolorize: flags.color !== false,\n\t\t\tglyphMode: \"unicode\"\n\t\t});\n\t\tgraphOutput = rendering.graphOutput;\n\t\trunListDirNameWidth = rendering.runListDirNameWidth;\n\t\trunListLeftPad = rendering.runListLeftPad;\n\t}\n\treturn ok({\n\t\tok: true,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: plan.summary,\n\t\t...graphOutput !== void 0 ? { graphOutput } : {},\n\t\t...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},\n\t\t...runListLeftPad !== void 0 ? { runListLeftPad } : {}\n\t});\n}\nfunction formatMigrateShowOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tif (result.graphOutput !== void 0 && result.graphOutput.length > 0) {\n\t\tlines.push(result.graphOutput);\n\t\tlines.push(\"\");\n\t}\n\tconst n = result.migrations.length;\n\tif (n === 0) {\n\t\tlines.push(result.summary);\n\t\treturn lines.join(\"\\n\");\n\t}\n\tlines.push(`The following ${n} migration${n === 1 ? \"\" : \"s\"} will run:`);\n\tlines.push(...migrateShowRunListRows(result.migrations, {\n\t\trunListDirNameWidth: result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length)),\n\t\trunListLeftPad: result.runListLeftPad\n\t}, {\n\t\tcolorize: flags.color !== false,\n\t\tglyphMode: \"unicode\"\n\t}));\n\treturn lines.join(\"\\n\");\n}\nasync function executeMigrateCommand(options, flags, ui, startTime) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migrate\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for migrate\" }));\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst toArg = options.to;\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractRaw;\n\tlet contractContent;\n\ttry {\n\t\tcontractContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate a valid contract.json, then retry.\"\n\t\t}));\n\t\treturn notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\ttry {\n\t\tcontractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst loadedAggregate = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: contractRaw,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loadedAggregate.ok) return notOk(loadedAggregate.failure);\n\tconst aggregate = loadedAggregate.value;\n\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),\n\t\tcheckContracts: true\n\t});\n\tif (integrityFailure) return notOk(integrityFailure);\n\tlet refEntry;\n\tlet refName;\n\tif (toArg) {\n\t\tconst refs = aggregate.app.refs;\n\t\tconst refResult = resolveContractRef(toArg, {\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(refResult.failure);\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\trefName = refResult.value.provenance.refName;\n\t\t\tconst resolved = refs[refName];\n\t\t\tif (resolved) refEntry = resolved;\n\t\t} else refEntry = {\n\t\t\thash: refResult.value.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (typeof dbConnection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t});\n\t\tif (toArg) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: toArg\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate\",\n\t\t\tdescription: \"Apply planned migrations to advance the database\",\n\t\t\turl: \"https://pris.ly/migrate\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\tif (appMarker !== null) {\n\t\t\tconst markerRefusal = refuseMarkerOutsideGraph({\n\t\t\t\tmarkerHash: appMarker.storageHash,\n\t\t\t\tgraph: appGraph\n\t\t\t});\n\t\t\tif (markerRefusal) return notOk(markerRefusal);\n\t\t}\n\t\tif (refEntry && refEntry.invariants.length > 0) {\n\t\t\tconst invariantRefusal = refuseUnknownInvariants({\n\t\t\t\tgraph: appGraph,\n\t\t\t\tmarkerInvariants: appMarker?.invariants ?? [],\n\t\t\t\trefInvariants: refEntry.invariants,\n\t\t\t\t...ifDefined(\"refName\", toArg)\n\t\t\t});\n\t\t\tif (invariantRefusal) return notOk(invariantRefusal);\n\t\t}\n\t\tif (!flags.quiet && !flags.json) ui.step(\"Loading contract spaces…\");\n\t\tlet applyContract = contractRaw;\n\t\tlet snapshotContractJson = JSON.parse(contractContent);\n\t\tlet snapshotContractDts;\n\t\tif (toArg && refEntry) {\n\t\t\tconst targetHash = refEntry.hash;\n\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {\n\t\t\t\tconst at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);\n\t\t\t\tapplyContract = at.contract;\n\t\t\t\tsnapshotContractJson = at.contractJson;\n\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t} catch (error) {\n\t\t\t\treturn mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t}\n\t\t}\n\t\tconst applyResult = await client.migrate({\n\t\t\tcontract: applyContract,\n\t\t\tmigrationsDir,\n\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},\n\t\t\t...refEntry !== void 0 ? ifDefined(\"refName\", toArg) : {}\n\t\t});\n\t\tif (!applyResult.ok) return notOk(mapMigrateFailure(applyResult.failure));\n\t\tconst { value } = applyResult;\n\t\tlet advancedRef = null;\n\t\tif (options.advanceRef !== void 0) {\n\t\t\tconst contractIR = snapshotContractDts !== void 0 ? {\n\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t} : await readContractIR(snapshotContractJson, contractPathAbsolute);\n\t\t\tconst advanced = await advanceRefSafely({\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tname: options.advanceRef,\n\t\t\t\thash: value.markerHash,\n\t\t\t\tcontractIR\n\t\t\t});\n\t\t\tif (!advanced.ok) return notOk(advanced.failure);\n\t\t\tadvancedRef = {\n\t\t\t\tname: advanced.value.name,\n\t\t\t\thash: advanced.value.hash\n\t\t\t};\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\tmigrationsTotal: value.perSpace.length,\n\t\t\tmarkerHash: value.markerHash,\n\t\t\tapplied: value.applied,\n\t\t\tsummary: value.summary,\n\t\t\tperSpace: value.perSpace,\n\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\ttimings: { total: Date.now() - startTime },\n\t\t\tadvancedRef\n\t\t});\n\t} catch (error) {\n\t\tconst mapped = mapCaughtMigrationError(error);\n\t\tif (mapped) return notOk(mapped);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createMigrateCommand() {\n\tconst command = new Command(\"migrate\");\n\tsetCommandDescriptions(command, \"Apply planned migrations to advance the database\", \"Walks every contract space (app + extensions) and applies pending\\non-disk migrations in canonical order (extensions alphabetically,\\nthen app). Graph-walks the on-disk migration graph for every space.\\nUse --to to target a specific contract (hash, ref name, migration dir).\\nUse --show for a read-only preview of the path that would run.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migrate --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to abc123 --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --from @contract --to production\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--advance-ref <name>\", \"Advance the named ref to the post-apply marker after success\").option(\"--show\", \"Preview the migration path without applying (read-only)\").option(\"--from <contract>\", \"From-state for --show preview (@contract, @db, hash, ref name, or migration dir)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (options.show) {\n\t\t\tconst exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {\n\t\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\t\telse ui.output(formatMigrateShowOutput(showResult, flags));\n\t\t\t});\n\t\t\tprocess.exit(exitCode);\n\t\t\treturn;\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrateCommand as t };\n\n//# sourceMappingURL=migrate-CgSnzAUm.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,eAAe,0BAA0B,SAAS,OAAO,IAAI;CAC5D,MAAM,kBAAkB,QAAQ,SAAS,KAAK,KAAK,QAAQ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AAC,CAAC,OAAO,mBAAmB,2FAA2F,CAAC,CAAC,OAAO,wBAAwB,8DAA8D,CAAC,CAAC,OAAO,UAAU,yDAAyD,CAAC,CAAC,OAAO,qBAAqB,kFAAkF,CAAC,CAAC,OAAO,OAAO,YAAY;EACnjB,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,YAAY,KAAK,IAAI;EAC3B,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,QAAQ,MAAM;GACjB,MAAM,WAAW,aAAa,MAAM,0BAA0B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,eAAe;IAC7G,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;SACxD,GAAG,OAAO,wBAAwB,YAAY,KAAK,CAAC;GAC1D,CAAC;GACD,QAAQ,KAAK,QAAQ;GACrB;EACD;EACA,MAAM,WAAW,aAAa,MAAM,sBAAsB,SAAS,OAAO,IAAI,SAAS,GAAG,OAAO,KAAK,kBAAkB;GACvH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,OAAO,GAAG,IAAI,kCAAkC,eAAe,KAAK,CAAC;EACtF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"migrate-BVEyoBor-CN_EOCzx.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-BVEyoBor.mjs"],"sourcesContent":["import { N as errorUnexpected, c as errorDatabaseConnectionRequired, d as errorFileNotFound, j as errorTargetMigrationNotSupported, s as errorContractValidationFailed, u as errorDriverRequired } from \"./cli-errors-BG6bItjG.mjs\";\nimport { a as formatMigrationApplyCommandOutput, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, p as targetSupportsMigrations, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { a as loadContractSpaceAggregateForCli, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CoLTf3Ce.mjs\";\nimport { t as createControlClient } from \"./client-DU9qtBxW.mjs\";\nimport { a as readContractIR, t as advanceRefSafely } from \"./ref-advancement-DaZBzm7m.mjs\";\nimport { t as mapCaughtMigrationError } from \"./caught-errors-DLPzfzIW.mjs\";\nimport { t as mapContractAtError } from \"./contract-at-errors-Dptf8RE_.mjs\";\nimport { i as refuseMarkerOutsideGraph, n as refuseUnknownInvariants } from \"./invariants-1zL5-9Mc.mjs\";\nimport { t as executeMigrateShowPlan } from \"./migrate-show-kVUG1xdo.mjs\";\nimport { t as resolveContractRef } from \"./ref-resolution-DAK4OK3x.mjs\";\nimport { n as migrateShowRunListRows, r as renderMigrateShowGraph, t as mapMigrateFailure } from \"./migrate-failure-CKMEnA_x.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\n//#region src/commands/migrate.ts\n/**\n* Read-only preview of the migration path `migrate` will take. Delegates the\n* path computation to {@link executeMigrateShowPlan} (the control-api core)\n* and keeps only the styled header plus the Tier-3 graph rendering here.\n*/\nasync function executeMigrateShowCommand(options, flags, ui) {\n\tconst readsLiveMarker = options.from === void 0 || options.from === \"@db\";\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t...readsLiveMarker ? [\"driver\"] : [],\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst planResult = await executeMigrateShowPlan({\n\t\tconfig: configResult.value,\n\t\tcwd: process.cwd(),\n\t\t...ifDefined(\"configPath\", options.config),\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"to\", options.to),\n\t\t...ifDefined(\"from\", options.from),\n\t\tonPreflightComplete: ({ configPath, migrationsRelative, dbConnection, hasExplicitFrom }) => {\n\t\t\tif (!flags.json && !flags.quiet) {\n\t\t\t\tconst details = [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t}, {\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t}];\n\t\t\t\tif (dbConnection && !hasExplicitFrom) details.push({\n\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t\t\t});\n\t\t\t\tif (options.from) details.push({\n\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\tvalue: options.from\n\t\t\t\t});\n\t\t\t\tif (options.to) details.push({\n\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\tvalue: options.to\n\t\t\t\t});\n\t\t\t\tconst header = formatStyledHeader({\n\t\t\t\t\tcommand: \"migrate --show\",\n\t\t\t\t\tdescription: \"Preview the migration path migrate will take (read-only)\",\n\t\t\t\t\tdetails,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tui.stderr(header);\n\t\t\t}\n\t\t}\n\t});\n\tif (!planResult.ok) return notOk(planResult.failure);\n\tconst plan = planResult.value;\n\tconst orderedMigrations = plan.migrations;\n\tlet graphOutput;\n\tlet runListDirNameWidth;\n\tlet runListLeftPad;\n\tif (!flags.json) {\n\t\tconst rendering = renderMigrateShowGraph(plan, {\n\t\t\tcolorize: flags.color !== false,\n\t\t\tglyphMode: \"unicode\"\n\t\t});\n\t\tgraphOutput = rendering.graphOutput;\n\t\trunListDirNameWidth = rendering.runListDirNameWidth;\n\t\trunListLeftPad = rendering.runListLeftPad;\n\t}\n\treturn ok({\n\t\tok: true,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: plan.summary,\n\t\t...graphOutput !== void 0 ? { graphOutput } : {},\n\t\t...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},\n\t\t...runListLeftPad !== void 0 ? { runListLeftPad } : {}\n\t});\n}\nfunction formatMigrateShowOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tif (result.graphOutput !== void 0 && result.graphOutput.length > 0) {\n\t\tlines.push(result.graphOutput);\n\t\tlines.push(\"\");\n\t}\n\tconst n = result.migrations.length;\n\tif (n === 0) {\n\t\tlines.push(result.summary);\n\t\treturn lines.join(\"\\n\");\n\t}\n\tlines.push(`The following ${n} migration${n === 1 ? \"\" : \"s\"} will run:`);\n\tlines.push(...migrateShowRunListRows(result.migrations, {\n\t\trunListDirNameWidth: result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length)),\n\t\trunListLeftPad: result.runListLeftPad\n\t}, {\n\t\tcolorize: flags.color !== false,\n\t\tglyphMode: \"unicode\"\n\t}));\n\treturn lines.join(\"\\n\");\n}\nasync function executeMigrateCommand(options, flags, ui, startTime) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migrate\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for migrate\" }));\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst toArg = options.to;\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractRaw;\n\tlet contractContent;\n\ttry {\n\t\tcontractContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate a valid contract.json, then retry.\"\n\t\t}));\n\t\treturn notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\ttry {\n\t\tcontractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst loadedAggregate = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: contractRaw,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loadedAggregate.ok) return notOk(loadedAggregate.failure);\n\tconst aggregate = loadedAggregate.value;\n\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),\n\t\tcheckContracts: true\n\t});\n\tif (integrityFailure) return notOk(integrityFailure);\n\tlet refEntry;\n\tlet refName;\n\tif (toArg) {\n\t\tconst refs = aggregate.app.refs;\n\t\tconst refResult = resolveContractRef(toArg, {\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(refResult.failure);\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\trefName = refResult.value.provenance.refName;\n\t\t\tconst resolved = refs[refName];\n\t\t\tif (resolved) refEntry = resolved;\n\t\t} else refEntry = {\n\t\t\thash: refResult.value.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (typeof dbConnection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t});\n\t\tif (toArg) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: toArg\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate\",\n\t\t\tdescription: \"Apply planned migrations to advance the database\",\n\t\t\turl: \"https://pris.ly/migrate\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\tif (appMarker !== null) {\n\t\t\tconst markerRefusal = refuseMarkerOutsideGraph({\n\t\t\t\tmarkerHash: appMarker.storageHash,\n\t\t\t\tgraph: appGraph\n\t\t\t});\n\t\t\tif (markerRefusal) return notOk(markerRefusal);\n\t\t}\n\t\tif (refEntry && refEntry.invariants.length > 0) {\n\t\t\tconst invariantRefusal = refuseUnknownInvariants({\n\t\t\t\tgraph: appGraph,\n\t\t\t\tmarkerInvariants: appMarker?.invariants ?? [],\n\t\t\t\trefInvariants: refEntry.invariants,\n\t\t\t\t...ifDefined(\"refName\", toArg)\n\t\t\t});\n\t\t\tif (invariantRefusal) return notOk(invariantRefusal);\n\t\t}\n\t\tif (!flags.quiet && !flags.json) ui.step(\"Loading contract spaces…\");\n\t\tlet applyContract = contractRaw;\n\t\tlet snapshotContractJson = JSON.parse(contractContent);\n\t\tlet snapshotContractDts;\n\t\tif (toArg && refEntry) {\n\t\t\tconst targetHash = refEntry.hash;\n\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {\n\t\t\t\tconst at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);\n\t\t\t\tapplyContract = at.contract;\n\t\t\t\tsnapshotContractJson = at.contractJson;\n\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t} catch (error) {\n\t\t\t\treturn mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t}\n\t\t}\n\t\tconst applyResult = await client.migrate({\n\t\t\tcontract: applyContract,\n\t\t\tmigrationsDir,\n\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},\n\t\t\t...refEntry !== void 0 ? ifDefined(\"refName\", toArg) : {}\n\t\t});\n\t\tif (!applyResult.ok) return notOk(mapMigrateFailure(applyResult.failure));\n\t\tconst { value } = applyResult;\n\t\tlet advancedRef = null;\n\t\tif (options.advanceRef !== void 0) {\n\t\t\tconst contractIR = snapshotContractDts !== void 0 ? {\n\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t} : await readContractIR(snapshotContractJson, contractPathAbsolute);\n\t\t\tconst advanced = await advanceRefSafely({\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tname: options.advanceRef,\n\t\t\t\thash: value.markerHash,\n\t\t\t\tcontractIR\n\t\t\t});\n\t\t\tif (!advanced.ok) return notOk(advanced.failure);\n\t\t\tadvancedRef = {\n\t\t\t\tname: advanced.value.name,\n\t\t\t\thash: advanced.value.hash\n\t\t\t};\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\tmigrationsTotal: value.perSpace.length,\n\t\t\tmarkerHash: value.markerHash,\n\t\t\tapplied: value.applied,\n\t\t\tsummary: value.summary,\n\t\t\tperSpace: value.perSpace,\n\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\ttimings: { total: Date.now() - startTime },\n\t\t\tadvancedRef\n\t\t});\n\t} catch (error) {\n\t\tconst mapped = mapCaughtMigrationError(error);\n\t\tif (mapped) return notOk(mapped);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createMigrateCommand() {\n\tconst command = new Command(\"migrate\");\n\tsetCommandDescriptions(command, \"Apply planned migrations to advance the database\", \"Walks every contract space (app + extensions) and applies pending\\non-disk migrations in canonical order (extensions alphabetically,\\nthen app). Graph-walks the on-disk migration graph for every space.\\nUse --to to target a specific contract (hash, ref name, migration dir).\\nUse --show for a read-only preview of the path that would run.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migrate --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to abc123 --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --from @contract --to production\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--advance-ref <name>\", \"Advance the named ref to the post-apply marker after success\").option(\"--show\", \"Preview the migration path without applying (read-only)\").option(\"--from <contract>\", \"From-state for --show preview (@contract, @db, hash, ref name, or migration dir)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (options.show) {\n\t\t\tconst exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {\n\t\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\t\telse ui.output(formatMigrateShowOutput(showResult, flags));\n\t\t\t});\n\t\t\tprocess.exit(exitCode);\n\t\t\treturn;\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrateCommand as t };\n\n//# sourceMappingURL=migrate-BVEyoBor.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,eAAe,0BAA0B,SAAS,OAAO,IAAI;CAC5D,MAAM,kBAAkB,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS;CACpE,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA,GAAG,kBAAkB,CAAC,QAAQ,IAAI,CAAC;EACnC;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,aAAa,MAAM,uBAAuB;EAC/C,QAAQ,aAAa;EACrB,KAAK,QAAQ,IAAI;EACjB,GAAG,UAAU,cAAc,QAAQ,MAAM;EACzC,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,QAAQ,QAAQ,IAAI;EACjC,sBAAsB,EAAE,YAAY,oBAAoB,cAAc,sBAAsB;GAC3F,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;IAChC,MAAM,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Q;GACrB;EACD;EACA,MAAM,WAAW,aAAa,MAAM,sBAAsB,SAAS,OAAO,IAAI,SAAS,GAAG,OAAO,KAAK,kBAAkB;GACvH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,OAAO,GAAG,IAAI,kCAAkC,eAAe,KAAK,CAAC;EACtF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs → migrate-failure-CKMEnA_x-ByHkYjn5.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { C as errorPathUnreachable, O as errorRunnerFailed } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
|
|
2
2
|
import { t as listRefsByContractHash } from "./migration-list-BQTfSGbT-DoNqbNsu.mjs";
|
|
3
|
-
import { _ as renderMigrationGraphCommand, a as buildMigrationGraphRows, c as computeLabelColumn, f as formatOnPathMigrationRow, i as buildGrid, l as computeMaxDirNameWidth, m as indentMigrationGraphTreeBlock, p as highlightFromEdgeAnnotations } from "./migration-graph-command-render-
|
|
3
|
+
import { _ as renderMigrationGraphCommand, a as buildMigrationGraphRows, c as computeLabelColumn, f as formatOnPathMigrationRow, i as buildGrid, l as computeMaxDirNameWidth, m as indentMigrationGraphTreeBlock, p as highlightFromEdgeAnnotations } from "./migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs";
|
|
4
4
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
5
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migrate-failure-
|
|
5
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migrate-failure-CKMEnA_x.mjs
|
|
6
6
|
const LABEL_GAP = 2;
|
|
7
7
|
const MIN_HASH_DATA_COLUMN = 25;
|
|
8
8
|
const LIST_INDENT = 2;
|
|
@@ -93,4 +93,4 @@ function mapMigrateFailure(failure) {
|
|
|
93
93
|
//#endregion
|
|
94
94
|
export { migrateShowRunListRows as n, renderMigrateShowGraph as r, mapMigrateFailure as t };
|
|
95
95
|
|
|
96
|
-
//# sourceMappingURL=migrate-failure-
|
|
96
|
+
//# sourceMappingURL=migrate-failure-CKMEnA_x-ByHkYjn5.mjs.map
|
package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs.map → migrate-failure-CKMEnA_x-ByHkYjn5.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-failure-
|
|
1
|
+
{"version":3,"file":"migrate-failure-CKMEnA_x-ByHkYjn5.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-failure-CKMEnA_x.mjs"],"sourcesContent":["import { D as errorRunnerFailed, S as errorPathUnreachable } from \"./cli-errors-BG6bItjG.mjs\";\nimport { t as listRefsByContractHash } from \"./migration-list-BQTfSGbT.mjs\";\nimport { _ as buildGrid, f as highlightFromEdgeAnnotations, g as buildMigrationGraphRows, i as formatOnPathMigrationRow, n as computeMaxDirNameWidth, p as indentMigrationGraphTreeBlock, r as renderMigrationGraphCommand, t as computeLabelColumn } from \"./migration-graph-command-render-h0VdTkSM.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/utils/formatters/migrate-show-render.ts\nconst LABEL_GAP = 2;\nconst MIN_HASH_DATA_COLUMN = 25;\nconst LIST_INDENT = 2;\nfunction paintOverrides(options) {\n\treturn {\n\t\t...options.styler === void 0 ? {} : { styler: options.styler },\n\t\t...options.palette === void 0 ? {} : { palette: options.palette }\n\t};\n}\n/**\n* Every space, with the migrations on the chosen path lifted to focus mode and\n* everything else dimmed. Widths are computed across all spaces first so the\n* sections and the run-list below them share their columns.\n*/\nfunction renderMigrateShowGraph(plan, options) {\n\tconst { aggregate, contractHash } = plan;\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tconst onPathHashes = new Set(plan.migrations.map((migration) => migration.migrationHash));\n\tconst spaceLayouts = allSpaces.map((space) => {\n\t\tconst isApp = space.spaceId === aggregate.app.spaceId;\n\t\tconst spaceGraph = space.graph();\n\t\tconst rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});\n\t\tconst edgeAnnotations = /* @__PURE__ */ new Map();\n\t\tfor (const edge of spaceGraph.migrationByHash.values()) edgeAnnotations.set(edge.migrationHash, { pathHighlight: onPathHashes.has(edge.migrationHash) ? \"on-path\" : \"off-path\" });\n\t\treturn {\n\t\t\tspace,\n\t\t\tisApp,\n\t\t\trowModel,\n\t\t\tgrid: buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations)),\n\t\t\tedgeAnnotations\n\t\t};\n\t});\n\tconst multiSpace = spaceLayouts.length > 1;\n\tconst globalLabelColumn = multiSpace ? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, options.glyphMode))) : void 0;\n\tconst widestRunListName = plan.migrations.length > 0 ? Math.max(...plan.migrations.map((migration) => migration.dirName.length)) : 0;\n\tconst globalMaxDirNameWidth = multiSpace ? Math.max(Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel))), widestRunListName) : void 0;\n\tconst sections = [];\n\tfor (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {\n\t\tconst liveMarkerHash = plan.renderMarkerHashBySpace.get(space.spaceId);\n\t\tconst tree = renderMigrationGraphCommand({\n\t\t\tgrid,\n\t\t\trowModel,\n\t\t\tcontractHash,\n\t\t\tisAppSpace: isApp,\n\t\t\t...plan.usedLiveMarker && liveMarkerHash !== void 0 ? { dbHash: liveMarkerHash } : {},\n\t\t\trefsByHash: listRefsByContractHash(space),\n\t\t\tedgeAnnotationsByHash: edgeAnnotations,\n\t\t\tcolorize: options.colorize,\n\t\t\tglyphMode: options.glyphMode,\n\t\t\t...paintOverrides(options),\n\t\t\t...globalLabelColumn === void 0 ? {} : { globalLabelColumn },\n\t\t\t...globalMaxDirNameWidth === void 0 ? {} : { globalMaxDirNameWidth }\n\t\t});\n\t\tif (tree.length === 0) continue;\n\t\tsections.push(multiSpace ? `${space.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, \" \")}` : tree);\n\t}\n\treturn {\n\t\tgraphOutput: sections.join(\"\\n\\n\"),\n\t\trunListDirNameWidth: globalMaxDirNameWidth ?? widestRunListName,\n\t\trunListLeftPad: globalLabelColumn\n\t};\n}\n/**\n* The ordered \"will run\" rows, aligned with the graph above them.\n*\n* The `→` arrow has to land in the same absolute column in a list row as in a\n* graph edge row. A graph edge row is `[gutter][name][hashes]`; a list row is\n* `[indent][name][indent][hashes]`, so the list's name column absorbs the\n* gutter width and the indent — twice over when a flat tree has no space\n* headings indenting it.\n*/\nfunction migrateShowRunListRows(migrations, rendering, options) {\n\tconst gutter = rendering.runListLeftPad ?? 0;\n\tconst multiSpace = rendering.runListLeftPad !== void 0;\n\tconst listDirNameWidth = gutter + Math.max(rendering.runListDirNameWidth + LABEL_GAP, MIN_HASH_DATA_COLUMN - gutter) - (multiSpace ? LIST_INDENT : LIST_INDENT * 2);\n\treturn migrations.map((migration) => ` ${formatOnPathMigrationRow(migration.dirName, migration.from, migration.to, listDirNameWidth, options.colorize, options.glyphMode, paintOverrides(options))}`);\n}\n//#endregion\n//#region src/utils/migrate-failure.ts\n/** A `migrate` apply failure as the CLI's structured error. */\nfunction mapMigrateFailure(failure) {\n\tif (failure.code === \"MIGRATION_PATH_NOT_FOUND\") return errorPathUnreachable(failure);\n\treturn errorRunnerFailed(failure.summary, {\n\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\tfix: \"Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.\",\n\t\tmeta: failure.meta ?? {},\n\t\t...ifDefined(\"cause\", failure.cause)\n\t});\n}\n//#endregion\nexport { migrateShowRunListRows as n, renderMigrateShowGraph as r, mapMigrateFailure as t };\n\n//# sourceMappingURL=migrate-failure-CKMEnA_x.mjs.map"],"mappings":";;;;;AAKA,MAAM,YAAY;A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AO,kBAAkB,QAAQ,SAAS;EACzC,KAAK,QAAQ,OAAO;EACpB,KAAK;EACL,MAAM,QAAQ,QAAQ,CAAC;EACvB,GAAG,UAAU,SAAS,QAAQ,KAAK;CACpC,CAAC;AACF"}
|
package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs → migration-graph-D4sgTiXa-BLtiLIk7.mjs}
RENAMED
|
@@ -3,14 +3,14 @@ import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
|
|
|
3
3
|
import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, x as setCommandSeeAlso, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
|
|
4
4
|
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-CoLTf3Ce-pQDru2w0.mjs";
|
|
5
5
|
import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-BQTfSGbT-DoNqbNsu.mjs";
|
|
6
|
-
import { v as renderMigrationGraphLegend } from "./migration-graph-command-render-
|
|
6
|
+
import { v as renderMigrationGraphLegend } from "./migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs";
|
|
7
7
|
import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-B30X5398-BH3zB9Mn.mjs";
|
|
8
|
-
import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-
|
|
8
|
+
import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-B8WSWSkJ-CyaRo0T6.mjs";
|
|
9
9
|
import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-BQcPKTLe-bn9e4_ZU.mjs";
|
|
10
10
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
11
11
|
import { ok } from "@prisma/orm-framework/utils/result";
|
|
12
12
|
import { Command } from "commander";
|
|
13
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-graph-
|
|
13
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-graph-D4sgTiXa.mjs
|
|
14
14
|
function computeGraphSummary(spaces) {
|
|
15
15
|
const contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);
|
|
16
16
|
const migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);
|
|
@@ -141,4 +141,4 @@ function createMigrationGraphCommand() {
|
|
|
141
141
|
//#endregion
|
|
142
142
|
export { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };
|
|
143
143
|
|
|
144
|
-
//# sourceMappingURL=migration-graph-
|
|
144
|
+
//# sourceMappingURL=migration-graph-D4sgTiXa-BLtiLIk7.mjs.map
|
package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs.map → migration-graph-D4sgTiXa-BLtiLIk7.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph-
|
|
1
|
+
{"version":3,"file":"migration-graph-D4sgTiXa-BLtiLIk7.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-D4sgTiXa.mjs"],"sourcesContent":["import { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, f as setCommandSeeAlso, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-CoLTf3Ce.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"./migration-list-BQTfSGbT.mjs\";\nimport { a as renderMigrationGraphLegend } from \"./migration-graph-command-render-h0VdTkSM.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"./migration-graph-B30X5398.mjs\";\nimport { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from \"./migration-graph-sections-B8WSWSkJ.mjs\";\nimport { n as validateLegendOptions, t as shouldShowLegend } from \"./legend-BQcPKTLe.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/commands/migration-graph.ts\nfunction computeGraphSummary(spaces) {\n\tconst contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contractCount} contract(s), ${migrationCount} migration(s)`;\n}\nfunction formatMigrationGraphHumanOutput(result) {\n\treturn renderMigrationGraphSections(result.treeSections, result.summary);\n}\nasync function executeMigrationGraphCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration graph\",\n\t\t\tdescription: \"Show the migration graph topology\",\n\t\t\tdetails: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t},\n\t\t\t\t...options.space !== void 0 ? [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: options.space\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return loaded;\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst treeSections = buildMigrationGraphTreeSections({\n\t\taggregate,\n\t\tscopedSpaces,\n\t\tliveContractHash,\n\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\tcolorize: flags.color !== false\n\t});\n\tconst spaces = [...buildMigrationSpaceGraphEntries({\n\t\taggregate,\n\t\tscopedSpaces\n\t})];\n\treturn ok({\n\t\tok: true,\n\t\tgraph: appGraph,\n\t\tspaces,\n\t\ttreeSections,\n\t\tsummary: computeGraphSummary(spaces)\n\t});\n}\nfunction createMigrationGraphCommand() {\n\tconst command = new Command(\"graph\");\n\tsetCommandDescriptions(command, \"Show the migration graph topology\", \"Renders the migration graph topology.\\nOffline — does not consult the database.\\n--ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\nUse --json for machine-readable output, or --dot for Graphviz DOT\\nformat.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration graph\",\n\t\t\"prisma-next migration graph --json\",\n\t\t\"prisma-next migration graph --dot\",\n\t\t\"prisma-next migration graph --ascii\",\n\t\t\"prisma-next migration graph --legend\",\n\t\t\"prisma-next migration graph --space app\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration log\",\n\t\t\toneLiner: \"Show executed migration history\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--dot\", \"Output in Graphviz DOT format\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {\n\t\t\tif (options.dot) ui.output(renderMigrationGraphDot(graphResult.graph));\n\t\t\telse if (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...graphResult.spaces],\n\t\t\t\t\tsummary: graphResult.summary\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };\n\n//# sourceMappingURL=migration-graph-D4sgTiXa.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,oBAAoB,QAAQ;CACpC,MAAM,gBAAgB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,UAAU,QAAQ,CAAC;CACvF,MAAM,iBAAiB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,WAAW,QAAQ,CAAC;CACzF,OAAO,GAAG,OAAO,OA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CAAC,GAAG,YAAY,MAAM;KAC9B,SAAS,YAAY;IACtB;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAChF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -3,7 +3,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
|
3
3
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
4
4
|
import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
|
|
5
5
|
import stringWidth from "string-width";
|
|
6
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-graph-command-render-
|
|
6
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-graph-command-render-h0VdTkSM.mjs
|
|
7
7
|
/**
|
|
8
8
|
* The drawing formatters compose one string per line, measuring display widths
|
|
9
9
|
* with `string-width` as they go. To carry colour through that pipeline without
|
|
@@ -1367,6 +1367,20 @@ function renderMigrationGraphSpaceTreeInternal(input) {
|
|
|
1367
1367
|
function renderMigrationGraphSpaceTree(input) {
|
|
1368
1368
|
return renderMigrationGraphSpaceTreeInternal(input);
|
|
1369
1369
|
}
|
|
1370
|
+
function renderMigrationGraphSpaceTrees(inputs) {
|
|
1371
|
+
const globalInputs = inputs.map((input) => ({
|
|
1372
|
+
graph: input.graph,
|
|
1373
|
+
liveContractHash: input.liveContractHash
|
|
1374
|
+
}));
|
|
1375
|
+
const glyphMode = inputs[0]?.glyphMode ?? "unicode";
|
|
1376
|
+
const globalLabelColumn = inputs.length > 1 ? computeGlobalMaxEdgeTreePrefixWidth(globalInputs, glyphMode) : void 0;
|
|
1377
|
+
const globalMaxDirName = inputs.length > 1 ? computeGlobalMaxDirNameWidth(globalInputs) : void 0;
|
|
1378
|
+
return inputs.map((input) => renderMigrationGraphSpaceTreeInternal({
|
|
1379
|
+
...input,
|
|
1380
|
+
...globalLabelColumn !== void 0 ? { globalMaxEdgeTreePrefixWidth: globalLabelColumn } : {},
|
|
1381
|
+
...globalMaxDirName !== void 0 ? { globalMaxDirNameWidth: globalMaxDirName } : {}
|
|
1382
|
+
}));
|
|
1383
|
+
}
|
|
1370
1384
|
function indentMigrationGraphTreeBlock(treeOutput, indent) {
|
|
1371
1385
|
if (treeOutput.length === 0) return treeOutput;
|
|
1372
1386
|
return treeOutput.split("\n").map((line) => line.length === 0 ? line : `${indent}${line}`).join("\n");
|
|
@@ -2108,6 +2122,6 @@ function renderMigrationGraphCommand(input) {
|
|
|
2108
2122
|
return lines.join("\n");
|
|
2109
2123
|
}
|
|
2110
2124
|
//#endregion
|
|
2111
|
-
export { toneSpans as S, renderMigrationGraphCommand as _, buildMigrationGraphRows as a,
|
|
2125
|
+
export { toneSpans as C, toneDrawing as S, renderMigrationGraphCommand as _, buildMigrationGraphRows as a, renderMigrationGraphSpaceTrees as b, computeLabelColumn as c, createToneMigrationListStyler as d, formatOnPathMigrationRow as f, migrationListForwardArrow as g, migrationListEmptySource as h, buildGrid as i, computeMaxDirNameWidth as l, indentMigrationGraphTreeBlock as m, TONE_MIGRATION_GRAPH_PALETTE as n, computeGlobalMaxDirNameWidth as o, highlightFromEdgeAnnotations as p, abbreviateContractHash as r, computeGlobalMaxEdgeTreePrefixWidth as s, IDENTITY_MIGRATION_LIST_STYLER as t, createAnsiMigrationListStyler as u, renderMigrationGraphLegend as v, renderMigrationListWithStyle as x, renderMigrationGraphSpaceTree as y };
|
|
2112
2126
|
|
|
2113
|
-
//# sourceMappingURL=migration-graph-command-render-
|
|
2127
|
+
//# sourceMappingURL=migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map
|