prisma-next 0.11.0-dev.24 → 0.11.0-dev.26
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/{cli-errors-Bw2GlweY.mjs → cli-errors-DFF1LlfU.mjs} +42 -2
- package/dist/cli-errors-DFF1LlfU.mjs.map +1 -0
- package/dist/cli.mjs +8 -8
- package/dist/{client-DePN5ZzP.mjs → client-a5NJce0-.mjs} +4 -4
- package/dist/{client-DePN5ZzP.mjs.map → client-a5NJce0-.mjs.map} +1 -1
- package/dist/{command-helpers-137k3Zbi.mjs → command-helpers-BnqwTptC.mjs} +2 -2
- package/dist/{command-helpers-137k3Zbi.mjs.map → command-helpers-BnqwTptC.mjs.map} +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +5 -5
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.mjs +5 -5
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.mjs +4 -4
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +2 -2
- package/dist/commands/migration-list.d.mts +57 -13
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +2 -102
- package/dist/commands/migration-log.mjs +3 -3
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.d.mts +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.mjs +5 -5
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +5 -5
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +2 -2
- package/dist/{contract-emit-D3lPKeRC.mjs → contract-emit-DYBHfZqL.mjs} +3 -3
- package/dist/{contract-emit-D3lPKeRC.mjs.map → contract-emit-DYBHfZqL.mjs.map} +1 -1
- package/dist/{contract-emit-BBLRbwOP.mjs → contract-emit-aFcOi3aw.mjs} +4 -4
- package/dist/{contract-emit-BBLRbwOP.mjs.map → contract-emit-aFcOi3aw.mjs.map} +1 -1
- package/dist/{contract-infer-BLAYDLqC.mjs → contract-infer-BpJeg-Eu.mjs} +3 -3
- package/dist/{contract-infer-BLAYDLqC.mjs.map → contract-infer-BpJeg-Eu.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-CjVyPKxG.mjs → contract-space-aggregate-loader-EVU3n9YE.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-CjVyPKxG.mjs.map → contract-space-aggregate-loader-EVU3n9YE.mjs.map} +1 -1
- package/dist/{db-verify-6sapsnWU.mjs → db-verify-CxtdGiL3.mjs} +5 -5
- package/dist/{db-verify-6sapsnWU.mjs.map → db-verify-CxtdGiL3.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-Bexd0f4E.mjs → framework-components-DTcjouhS.mjs} +2 -2
- package/dist/{framework-components-Bexd0f4E.mjs.map → framework-components-DTcjouhS.mjs.map} +1 -1
- package/dist/{global-flags-CLwNZnki.d.mts → global-flags-CdE7M0d9.d.mts} +1 -1
- package/dist/{global-flags-CLwNZnki.d.mts.map → global-flags-CdE7M0d9.d.mts.map} +1 -1
- package/dist/{init-Ba-AZ0zh.mjs → init-eGkSo7hi.mjs} +5 -5
- package/dist/{init-Ba-AZ0zh.mjs.map → init-eGkSo7hi.mjs.map} +1 -1
- package/dist/{inspect-live-schema-B_xGH5G6.mjs → inspect-live-schema-B1GCyjAJ.mjs} +4 -4
- package/dist/{inspect-live-schema-B_xGH5G6.mjs.map → inspect-live-schema-B1GCyjAJ.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-Efyi26SZ.mjs → migration-command-scaffold-CNdZl60X.mjs} +4 -4
- package/dist/{migration-command-scaffold-Efyi26SZ.mjs.map → migration-command-scaffold-CNdZl60X.mjs.map} +1 -1
- package/dist/migration-list-CnYiHrNV.mjs +288 -0
- package/dist/migration-list-CnYiHrNV.mjs.map +1 -0
- package/dist/{migration-plan-C1blDFs-.mjs → migration-plan-BnmP_yNz.mjs} +5 -5
- package/dist/{migration-plan-C1blDFs-.mjs.map → migration-plan-BnmP_yNz.mjs.map} +1 -1
- package/dist/{migration-types-DOvz-F0g.d.mts → migration-types-BXWvz12q.d.mts} +1 -1
- package/dist/{migration-types-DOvz-F0g.d.mts.map → migration-types-BXWvz12q.d.mts.map} +1 -1
- package/dist/{migrations-B8Fjf_zG.mjs → migrations-C7YTBnLy.mjs} +2 -2
- package/dist/{migrations-B8Fjf_zG.mjs.map → migrations-C7YTBnLy.mjs.map} +1 -1
- package/dist/{output-BlsrGMEF.mjs → output-CUIdfYo5.mjs} +1 -1
- package/dist/{output-BlsrGMEF.mjs.map → output-CUIdfYo5.mjs.map} +1 -1
- package/dist/{types-CKdsR3HE.d.mts → types-UWB2-rrw.d.mts} +1 -1
- package/dist/{types-CKdsR3HE.d.mts.map → types-UWB2-rrw.d.mts.map} +1 -1
- package/dist/{verify-8e6M7ZXH.mjs → verify-DX4RQwq4.mjs} +2 -2
- package/dist/{verify-8e6M7ZXH.mjs.map → verify-DX4RQwq4.mjs.map} +1 -1
- package/package.json +11 -11
- package/dist/cli-errors-Bw2GlweY.mjs.map +0 -1
- package/dist/commands/migration-list.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { D as formatStyledHeader, o as maskConnectionUrl, u as sanitizeErrorMessage } from "./command-helpers-
|
|
2
|
+
import { O as errorUnexpected, c as errorDriverRequired, o as errorDatabaseConnectionRequired, t as CliStructuredError } from "./cli-errors-DFF1LlfU.mjs";
|
|
3
|
+
import { D as formatStyledHeader, o as maskConnectionUrl, u as sanitizeErrorMessage } from "./command-helpers-BnqwTptC.mjs";
|
|
4
4
|
import { t as createProgressAdapter } from "./progress-adapter-xASh41wr.mjs";
|
|
5
|
-
import { t as createControlClient } from "./client-
|
|
5
|
+
import { t as createControlClient } from "./client-a5NJce0-.mjs";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
7
7
|
import { relative, resolve } from "pathe";
|
|
8
8
|
//#region src/commands/inspect-live-schema.ts
|
|
@@ -87,4 +87,4 @@ async function inspectLiveSchema(options, flags, ui, startTime, context) {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { inspectLiveSchema as t };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=inspect-live-schema-
|
|
90
|
+
//# sourceMappingURL=inspect-live-schema-B1GCyjAJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-live-schema-
|
|
1
|
+
{"version":3,"file":"inspect-live-schema-B1GCyjAJ.mjs","names":[],"sources":["../src/commands/inspect-live-schema.ts"],"sourcesContent":["import type { CoreSchemaView } from '@prisma-next/framework-components/control';\nimport type { PslDocumentAst } from '@prisma-next/framework-components/psl-ast';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n CliStructuredError,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorUnexpected,\n} from '../utils/cli-errors';\nimport { maskConnectionUrl, sanitizeErrorMessage } from '../utils/command-helpers';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions, GlobalFlags } from '../utils/global-flags';\nimport { createProgressAdapter } from '../utils/progress-adapter';\nimport type { TerminalUI } from '../utils/terminal-ui';\n\nexport interface InspectLiveSchemaOptions extends CommonCommandOptions {\n readonly db?: string;\n readonly config?: string;\n}\n\ninterface InspectLiveSchemaContext {\n readonly commandName: string;\n readonly description: string;\n readonly url: string;\n}\n\ntype LoadedCliConfig = Awaited<ReturnType<typeof loadConfig>>;\n\nexport interface InspectLiveSchemaResult {\n readonly config: LoadedCliConfig;\n readonly schema: unknown;\n readonly schemaView: CoreSchemaView | undefined;\n /**\n * PSL AST inferred from the introspected schema, when the configured family\n * implements `PslContractInferCapable`. `undefined` for families that do not\n * support inference (e.g. Mongo today).\n */\n readonly pslContractAst: PslDocumentAst | undefined;\n readonly target: {\n readonly familyId: string;\n readonly id: string;\n };\n readonly meta: {\n readonly configPath?: string;\n readonly dbUrl?: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\nexport async function inspectLiveSchema(\n options: InspectLiveSchemaOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n context: InspectLiveSchemaContext,\n): Promise<Result<InspectLiveSchemaResult, CliStructuredError>> {\n let config: LoadedCliConfig;\n try {\n config = await loadConfig(options.config);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to load config',\n }),\n );\n }\n\n const configPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n ];\n\n if (options.db) {\n details.push({ label: 'database', value: maskConnectionUrl(options.db) });\n } else if (config.db?.connection && typeof config.db.connection === 'string') {\n details.push({ label: 'database', value: maskConnectionUrl(config.db.connection) });\n }\n\n ui.stderr(\n formatStyledHeader({\n command: context.commandName,\n description: context.description,\n url: context.url,\n details,\n flags,\n }),\n );\n }\n\n const dbConnection = options.db ?? config.db?.connection;\n if (!dbConnection) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: `Database connection is required for ${context.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n commandName: context.commandName,\n }),\n );\n }\n\n if (!config.driver) {\n return notOk(\n errorDriverRequired({\n why: `Config.driver is required for ${context.commandName}`,\n }),\n );\n }\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver,\n extensionPacks: config.extensionPacks ?? [],\n });\n const onProgress = createProgressAdapter({ ui, flags });\n\n try {\n const schema = await client.introspect({\n connection: dbConnection,\n onProgress,\n });\n const schemaView = client.toSchemaView(schema);\n const pslContractAst = client.inferPslContract(schema);\n\n const dbUrl = typeof dbConnection === 'string' ? maskConnectionUrl(dbConnection) : undefined;\n\n return ok({\n config,\n schema,\n schemaView,\n pslContractAst,\n target: {\n familyId: config.family.familyId,\n id: config.target.targetId,\n },\n meta: {\n configPath,\n ...(dbUrl ? { dbUrl } : {}),\n },\n timings: {\n total: Date.now() - startTime,\n },\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n\n const rawMessage = error instanceof Error ? error.message : String(error);\n const safeMessage = sanitizeErrorMessage(\n rawMessage,\n typeof dbConnection === 'string' ? dbConnection : undefined,\n );\n return notOk(\n errorUnexpected(safeMessage, {\n why: `Unexpected error during ${context.commandName}: ${safeMessage}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n"],"mappings":";;;;;;;;AAsDA,eAAsB,kBACpB,SACA,OACA,IACA,WACA,SAC8D;CAC9D,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC1C,SAAS,OAAO;EACd,IAAI,mBAAmB,GAAG,KAAK,GAC7B,OAAO,MAAM,KAAK;EAGpB,OAAO,MACL,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,EACtE,KAAK,wBACP,CAAC,CACH;CACF;CAEA,MAAM,aAAa,QAAQ,SACvB,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAC/C;CAEJ,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAC/B,MAAM,UAAmD,CACvD;GAAE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SAAS,EACP,OAAO,KAAK,IAAI,IAAI,UACtB;EACF,CAAC;CACH,SAAS,OAAO;EACd,IAAI,mBAAmB,GAAG,KAAK,GAC7B,OAAO,MAAM,KAAK;EAIpB,MAAM,cAAc,qBADD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAGtE,OAAO,iBAAiB,WAAW,eAAe,KAAA,CACpD;EACA,OAAO,MACL,gBAAgB,aAAa,EAC3B,KAAK,2BAA2B,QAAQ,YAAY,IAAI,cAC1D,CAAC,CACH;CACF,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;AACF"}
|
package/dist/{migration-command-scaffold-Efyi26SZ.mjs → migration-command-scaffold-CNdZl60X.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { E as errorUnexpected, a as errorContractValidationFailed, c as errorDriverRequired, l as errorFileNotFound, o as errorDatabaseConnectionRequired
|
|
3
|
-
import { D as formatStyledHeader, c as resolveContractPath, o as maskConnectionUrl, t as addGlobalOptions } from "./command-helpers-
|
|
2
|
+
import { E as errorTargetMigrationNotSupported, O as errorUnexpected, a as errorContractValidationFailed, c as errorDriverRequired, l as errorFileNotFound, o as errorDatabaseConnectionRequired } from "./cli-errors-DFF1LlfU.mjs";
|
|
3
|
+
import { D as formatStyledHeader, c as resolveContractPath, o as maskConnectionUrl, t as addGlobalOptions } from "./command-helpers-BnqwTptC.mjs";
|
|
4
4
|
import { t as createProgressAdapter } from "./progress-adapter-xASh41wr.mjs";
|
|
5
|
-
import { t as createControlClient } from "./client-
|
|
5
|
+
import { t as createControlClient } from "./client-a5NJce0-.mjs";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
8
8
|
import { hasMigrations } from "@prisma-next/framework-components/control";
|
|
@@ -101,4 +101,4 @@ function addMigrationCommandOptions(command) {
|
|
|
101
101
|
//#endregion
|
|
102
102
|
export { prepareMigrationContext as n, addMigrationCommandOptions as t };
|
|
103
103
|
|
|
104
|
-
//# sourceMappingURL=migration-command-scaffold-
|
|
104
|
+
//# sourceMappingURL=migration-command-scaffold-CNdZl60X.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-command-scaffold-
|
|
1
|
+
{"version":3,"file":"migration-command-scaffold-CNdZl60X.mjs","names":[],"sources":["../src/utils/migration-command-scaffold.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { hasMigrations } from '@prisma-next/framework-components/control';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport type { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport type { ControlClient } from '../control-api/types';\nimport {\n type CliStructuredError,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFileNotFound,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n} from './cli-errors';\nimport { addGlobalOptions, maskConnectionUrl, resolveContractPath } from './command-helpers';\nimport { formatStyledHeader } from './formatters/styled';\nimport type { GlobalFlags } from './global-flags';\nimport { createProgressAdapter } from './progress-adapter';\nimport type { TerminalUI } from './terminal-ui';\n\n/**\n * Resolved context for a migration command.\n * Contains everything needed to invoke a control-api operation.\n */\nexport interface MigrationContext {\n readonly client: ControlClient;\n readonly contractJson: Record<string, unknown>;\n readonly dbConnection: unknown;\n readonly onProgress: ReturnType<typeof createProgressAdapter>;\n readonly configPath: string;\n readonly contractPath: string;\n readonly contractPathAbsolute: string;\n readonly config: Awaited<ReturnType<typeof loadConfig>>;\n}\n\n/**\n * Command-specific configuration for the shared scaffold.\n */\nexport interface MigrationCommandDescriptor {\n readonly commandName: string;\n readonly description: string;\n readonly url: string;\n}\n\n/**\n * Prepares the shared context for migration commands (db init, db update).\n *\n * Handles: config loading, contract file reading, JSON parsing, connection resolution,\n * driver/migration-support validation, client creation, and header output.\n *\n * Returns a Result with either the resolved context or a structured error.\n */\nexport async function prepareMigrationContext(\n options: { readonly db?: string; readonly config?: string; readonly dryRun?: boolean },\n flags: GlobalFlags,\n ui: TerminalUI,\n descriptor: MigrationCommandDescriptor,\n): Promise<Result<MigrationContext, CliStructuredError>> {\n // Load config\n const config = await loadConfig(options.config);\n const configPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n const contractPathAbsolute = resolveContractPath(config);\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n // Output header to stderr (decoration)\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n ];\n if (options.db) {\n details.push({ label: 'database', value: maskConnectionUrl(options.db) });\n }\n if (options.dryRun) {\n details.push({ label: 'mode', value: 'dry run' });\n }\n const header = formatStyledHeader({\n command: descriptor.commandName,\n description: descriptor.description,\n url: descriptor.url,\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n // Load contract file\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as { code?: string }).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n }\n\n // Parse contract JSON\n let contractJson: Record<string, unknown>;\n try {\n contractJson = JSON.parse(contractJsonContent) as Record<string, unknown>;\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n // Resolve database connection (--db flag or config.db.connection)\n const dbConnection = options.db ?? config.db?.connection;\n if (!dbConnection) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: `Database connection is required for ${descriptor.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n commandName: descriptor.commandName,\n }),\n );\n }\n\n // Check for driver\n if (!config.driver) {\n return notOk(\n errorDriverRequired({ why: `Config.driver is required for ${descriptor.commandName}` }),\n );\n }\n\n if (!hasMigrations(config.target)) {\n return notOk(\n errorTargetMigrationNotSupported({\n why: `Target \"${config.target.id}\" does not support migrations`,\n }),\n );\n }\n\n // Create control client\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver,\n extensionPacks: config.extensionPacks ?? [],\n });\n\n // Create progress adapter\n const onProgress = createProgressAdapter({ ui, flags });\n\n return ok({\n client,\n contractJson,\n dbConnection,\n onProgress,\n configPath,\n contractPath,\n contractPathAbsolute,\n config,\n });\n}\n\n/**\n * Registers the shared CLI options for migration commands (db init, db update).\n */\nexport function addMigrationCommandOptions(command: Command): Command {\n addGlobalOptions(command);\n return command\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--dry-run', 'Preview planned operations without applying', false);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuDA,eAAsB,wBACpB,SACA,OACA,IACA,YACuD;CAEvD,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,aAAa,QAAQ,SACvB,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAC/C;CACJ,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,MAAM,eAAe,SAAS,QAAQ,IAAI,GAAG,oBAAoB;CAGjE,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAC/B,MAAM,UAAmD,CACvD;GAAE,OAAO;GAAU,OAAO;EAAW,GACrC;GAAE,OAAO;GAAY,OAAO;EAAa,CAC3C;EACA,IAAI,QAAQ,IACV,QAAQ,KAAK;GAAE,OAAO;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SAAS,oBAAoB;EACjC,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,gBAAgB,OAAO,kBAAkB,CAAC;CAC5C,CAAC;CAGD,MAAM,aAAa,sBAAsB;EAAE;EAAI;CAAM,CAAC;CAEtD,OAAO,GAAG;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH;;;;AAKA,SAAgB,2BAA2B,SAA2B;CACpE,iBAAiB,OAAO;CACxB,OAAO,QACJ,OAAO,cAAc,4BAA4B,EACjD,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,aAAa,+CAA+C,KAAK;AAC7E"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
|
|
2
|
+
import { O as errorUnexpected, T as errorSpaceNotFound, f as errorInvalidSpaceId, k as mapMigrationToolsError } from "./cli-errors-DFF1LlfU.mjs";
|
|
3
|
+
import { D as formatStyledHeader, d as setCommandDescriptions, f as setCommandExamples, l as resolveMigrationPaths, p as setCommandSeeAlso, t as addGlobalOptions, v as parseGlobalFlagsOrExit, x as handleResult, y as createTerminalUI } from "./command-helpers-BnqwTptC.mjs";
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
6
|
+
import { notOk, ok } from "@prisma-next/utils/result";
|
|
7
|
+
import { APP_SPACE_ID, isValidSpaceId } from "@prisma-next/migration-tools/spaces";
|
|
8
|
+
import { bold, cyan, cyanBright, dim, green, greenBright, yellow } from "colorette";
|
|
9
|
+
import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
|
|
10
|
+
import { enumerateMigrationSpaces } from "@prisma-next/migration-tools/enumerate-migration-spaces";
|
|
11
|
+
//#region src/utils/formatters/migration-list-render.ts
|
|
12
|
+
const HASH_WIDTH = 7;
|
|
13
|
+
const EMPTY_SOURCE = "∅";
|
|
14
|
+
const SELF_EDGE_GLYPH = "⟲";
|
|
15
|
+
const FORWARD_EDGE_GLYPH = "→";
|
|
16
|
+
const DECORATION_PREFIX = " ";
|
|
17
|
+
const IDENTITY_MIGRATION_LIST_STYLER = {
|
|
18
|
+
dirName: (text) => text,
|
|
19
|
+
sourceHash: (text) => text,
|
|
20
|
+
destHash: (text) => text,
|
|
21
|
+
glyph: (text) => text,
|
|
22
|
+
invariants: (ids) => `{${ids.join(", ")}}`,
|
|
23
|
+
refs: (names) => `(${names.join(", ")})`,
|
|
24
|
+
spaceHeading: (text) => text,
|
|
25
|
+
summary: (text) => text,
|
|
26
|
+
emptyState: (text) => text
|
|
27
|
+
};
|
|
28
|
+
function abbreviateContractHash(hash) {
|
|
29
|
+
return (hash.startsWith("sha256:") ? hash.slice(7) : hash).slice(0, HASH_WIDTH);
|
|
30
|
+
}
|
|
31
|
+
function formatSourceColumn(from, style) {
|
|
32
|
+
if (from === null) return style.glyph(EMPTY_SOURCE) + " ".repeat(HASH_WIDTH - 1);
|
|
33
|
+
return style.sourceHash(abbreviateContractHash(from));
|
|
34
|
+
}
|
|
35
|
+
function formatDestColumn(from, to, style) {
|
|
36
|
+
if (from !== null && from === to) return " ".repeat(HASH_WIDTH);
|
|
37
|
+
return style.destHash(abbreviateContractHash(to));
|
|
38
|
+
}
|
|
39
|
+
function formatArrowGlyph(from, to, style) {
|
|
40
|
+
return style.glyph(from !== null && from === to ? SELF_EDGE_GLYPH : FORWARD_EDGE_GLYPH);
|
|
41
|
+
}
|
|
42
|
+
function formatDecorations(providedInvariants, refs, style) {
|
|
43
|
+
const blocks = [];
|
|
44
|
+
if (providedInvariants.length > 0) blocks.push(style.invariants(providedInvariants));
|
|
45
|
+
if (refs.length > 0) blocks.push(style.refs(refs));
|
|
46
|
+
if (blocks.length === 0) return "";
|
|
47
|
+
return `${DECORATION_PREFIX}${blocks.join(" ")}`;
|
|
48
|
+
}
|
|
49
|
+
function formatMigrationRow(migration, dirNameWidth, style) {
|
|
50
|
+
const dirNamePadding = " ".repeat(Math.max(0, dirNameWidth - migration.dirName.length));
|
|
51
|
+
return `${`${style.dirName(migration.dirName)}${dirNamePadding}`}${formatSourceColumn(migration.from, style)} ${formatArrowGlyph(migration.from, migration.to, style)} ${formatDestColumn(migration.from, migration.to, style)}${formatDecorations(migration.providedInvariants, migration.refs, style)}`;
|
|
52
|
+
}
|
|
53
|
+
function formatEmptyStateLine(spaceId, style) {
|
|
54
|
+
return style.emptyState(`There are no migrations in migrations/${spaceId}/ yet`);
|
|
55
|
+
}
|
|
56
|
+
function renderSpaceBlock(spaceId, migrations, multiSpace, style) {
|
|
57
|
+
if (migrations.length === 0) {
|
|
58
|
+
const emptyLine = formatEmptyStateLine(spaceId, style);
|
|
59
|
+
if (!multiSpace) return [emptyLine];
|
|
60
|
+
return [style.spaceHeading(`${spaceId}:`), ` ${emptyLine}`];
|
|
61
|
+
}
|
|
62
|
+
const dirNameWidth = Math.max(...migrations.map((entry) => entry.dirName.length)) + 2;
|
|
63
|
+
const rows = migrations.map((entry) => formatMigrationRow(entry, dirNameWidth, style));
|
|
64
|
+
if (!multiSpace) return rows;
|
|
65
|
+
return [style.spaceHeading(`${spaceId}:`), ...rows.map((row) => ` ${row}`)];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Compose the styled `migration list` output. The renderer is
|
|
69
|
+
* presentation-neutral — every token passes through `style` before
|
|
70
|
+
* landing in the output, so the same composition serves the pure-text
|
|
71
|
+
* path ({@link renderMigrationList} via
|
|
72
|
+
* {@link IDENTITY_MIGRATION_LIST_STYLER}) and the ANSI-styled CLI path
|
|
73
|
+
* (via the ANSI styler the CLI shell wires up).
|
|
74
|
+
*/
|
|
75
|
+
function renderMigrationListWithStyle(result, style) {
|
|
76
|
+
const multiSpace = result.spaces.length > 1;
|
|
77
|
+
const lines = [];
|
|
78
|
+
for (let index = 0; index < result.spaces.length; index++) {
|
|
79
|
+
const space = result.spaces[index];
|
|
80
|
+
if (index > 0) lines.push("");
|
|
81
|
+
lines.push(...renderSpaceBlock(space.spaceId, space.migrations, multiSpace, style));
|
|
82
|
+
}
|
|
83
|
+
if (result.spaces.reduce((count, space) => count + space.migrations.length, 0) > 0) {
|
|
84
|
+
lines.push("");
|
|
85
|
+
lines.push(style.summary(result.summary));
|
|
86
|
+
}
|
|
87
|
+
return lines.join("\n");
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/utils/formatters/migration-list-styler.ts
|
|
91
|
+
/**
|
|
92
|
+
* The reserved ref name for the live-database marker. Treated as a
|
|
93
|
+
* structurally distinct token from user-named refs so the styler can
|
|
94
|
+
* make it visually pop in `(refs)` decorations.
|
|
95
|
+
*/
|
|
96
|
+
const DB_REF_NAME = "db";
|
|
97
|
+
function styleRefName(name) {
|
|
98
|
+
return name === DB_REF_NAME ? bold(greenBright(name)) : green(name);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Build a {@link MigrationListStyler} that decorates `migration list`
|
|
102
|
+
* tokens with ANSI SGR codes. When `useColor` is `false` (non-TTY,
|
|
103
|
+
* `--no-color`, `NO_COLOR=1`, piped output) the function returns the
|
|
104
|
+
* shared identity styler so callers get plain text with zero ANSI
|
|
105
|
+
* bytes — pipe-friendly by construction.
|
|
106
|
+
*
|
|
107
|
+
* Palette:
|
|
108
|
+
*
|
|
109
|
+
* - `dirName`: bold
|
|
110
|
+
* - `sourceHash`: dim cyan
|
|
111
|
+
* - `destHash`: bright cyan
|
|
112
|
+
* - `glyph` (`→` / `⟲` / `∅`): dim
|
|
113
|
+
* - `invariants` (`{...}`): yellow
|
|
114
|
+
* - `refs` (`(...)`): green; the live-DB `db` marker inside is green-bold
|
|
115
|
+
* - `spaceHeading` (`<spaceId>:`): bold
|
|
116
|
+
* - `summary`: dim
|
|
117
|
+
* - `emptyState`: dim
|
|
118
|
+
*/
|
|
119
|
+
function createAnsiMigrationListStyler(opts) {
|
|
120
|
+
if (!opts.useColor) return IDENTITY_MIGRATION_LIST_STYLER;
|
|
121
|
+
return {
|
|
122
|
+
dirName: (text) => bold(text),
|
|
123
|
+
sourceHash: (text) => dim(cyan(text)),
|
|
124
|
+
destHash: (text) => cyanBright(text),
|
|
125
|
+
glyph: (text) => dim(text),
|
|
126
|
+
invariants: (ids) => yellow(`{${ids.join(", ")}}`),
|
|
127
|
+
refs: (names) => {
|
|
128
|
+
const open = green("(");
|
|
129
|
+
const close = green(")");
|
|
130
|
+
const separator = green(", ");
|
|
131
|
+
return open + names.map(styleRefName).join(separator) + close;
|
|
132
|
+
},
|
|
133
|
+
spaceHeading: (text) => bold(text),
|
|
134
|
+
summary: (text) => dim(text),
|
|
135
|
+
emptyState: (text) => dim(text)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/commands/migration-list.ts
|
|
140
|
+
/**
|
|
141
|
+
* Compute the trailing one-line summary appended below the migration
|
|
142
|
+
* rows. Wording follows the existing CLI's pluralization style ("N
|
|
143
|
+
* migration(s) on disk" for the common single-space path; multi-space
|
|
144
|
+
* adds "across K contract space(s)" so consumers can see the spread).
|
|
145
|
+
*
|
|
146
|
+
* The renderer suppresses the summary line when `totalMigrations === 0`
|
|
147
|
+
* — the empty-state line carries enough information on its own — so
|
|
148
|
+
* this function always returns a string even for the empty-state.
|
|
149
|
+
*/
|
|
150
|
+
function computeSummary(spaces) {
|
|
151
|
+
const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
|
|
152
|
+
if (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;
|
|
153
|
+
return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The unit-testable core of `migration list`. Given an absolute
|
|
157
|
+
* `migrationsDir` and an optional `spaceFilter`, enumerates every
|
|
158
|
+
* on-disk migration (via {@link enumerateMigrationSpaces}), narrows to
|
|
159
|
+
* the requested space if any, and assembles a {@link MigrationListResult}
|
|
160
|
+
* ready for the renderer or JSON serializer.
|
|
161
|
+
*
|
|
162
|
+
* The enumerator is the single source of truth for "what is a contract
|
|
163
|
+
* space": existence, the `--space` candidate-suggestion list, and
|
|
164
|
+
* scoping are all derived from one {@link enumerateMigrationSpaces}
|
|
165
|
+
* traversal. This means the reserved-name exclusion the enumerator
|
|
166
|
+
* applies (e.g. the per-space `refs/` subdirectory) is honoured here for
|
|
167
|
+
* free — a `--space refs` request resolves to `SPACE_NOT_FOUND`, not a
|
|
168
|
+
* synthesized empty-state.
|
|
169
|
+
*
|
|
170
|
+
* Distinct empty-state paths:
|
|
171
|
+
*
|
|
172
|
+
* - `migrations/` missing or contains no valid space directories →
|
|
173
|
+
* synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]` so the
|
|
174
|
+
* renderer's empty-state path can name a directory (spec § Empty-state +
|
|
175
|
+
* the `migrations/` missing edge case).
|
|
176
|
+
* - `--space <id>` on an existing-but-empty space dir → the enumerator
|
|
177
|
+
* surfaces `{ spaceId, migrations: [] }`; `<id>` is in the set, so it
|
|
178
|
+
* scopes to that entry and renders the empty-state the same way.
|
|
179
|
+
* - `--space <id>` on a non-existent (or reserved) space → structured
|
|
180
|
+
* `MIGRATION.SPACE_NOT_FOUND` error (NOT empty-state).
|
|
181
|
+
*
|
|
182
|
+
* Errors caught here:
|
|
183
|
+
*
|
|
184
|
+
* - {@link MigrationToolsError} from the enumerator → mapped through
|
|
185
|
+
* {@link mapMigrationToolsError} so callers see the catalogue code.
|
|
186
|
+
* - Anything else (filesystem etc.) → wrapped via {@link errorUnexpected}.
|
|
187
|
+
*/
|
|
188
|
+
async function runMigrationList(inputs) {
|
|
189
|
+
const { migrationsDir, spaceFilter } = inputs;
|
|
190
|
+
if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
|
|
191
|
+
let spaces;
|
|
192
|
+
try {
|
|
193
|
+
spaces = await enumerateMigrationSpaces({ projectMigrationsDir: migrationsDir });
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
196
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to enumerate migrations: ${error instanceof Error ? error.message : String(error)}` }));
|
|
197
|
+
}
|
|
198
|
+
if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));
|
|
199
|
+
const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
|
|
200
|
+
const resultSpaces = scopedSpaces.length === 0 ? [{
|
|
201
|
+
spaceId: APP_SPACE_ID,
|
|
202
|
+
migrations: []
|
|
203
|
+
}] : scopedSpaces;
|
|
204
|
+
return ok({
|
|
205
|
+
ok: true,
|
|
206
|
+
spaces: resultSpaces,
|
|
207
|
+
summary: computeSummary(resultSpaces)
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* CLI shell: loads config, resolves paths, prints the styled header on
|
|
212
|
+
* stderr (interactive mode only), and delegates to {@link runMigrationList}.
|
|
213
|
+
* Kept intentionally thin so the unit-testable surface lives in the core.
|
|
214
|
+
*/
|
|
215
|
+
async function executeMigrationListCommand(options, flags, ui) {
|
|
216
|
+
const config = await loadConfig(options.config);
|
|
217
|
+
const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
218
|
+
if (!flags.json && !flags.quiet) {
|
|
219
|
+
const header = formatStyledHeader({
|
|
220
|
+
command: "migration list",
|
|
221
|
+
description: "List on-disk migrations, latest first, per contract space",
|
|
222
|
+
details: [
|
|
223
|
+
{
|
|
224
|
+
label: "config",
|
|
225
|
+
value: configPath
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
label: "migrations",
|
|
229
|
+
value: migrationsRelative
|
|
230
|
+
},
|
|
231
|
+
...options.space !== void 0 ? [{
|
|
232
|
+
label: "space",
|
|
233
|
+
value: options.space
|
|
234
|
+
}] : []
|
|
235
|
+
],
|
|
236
|
+
flags
|
|
237
|
+
});
|
|
238
|
+
ui.stderr(header);
|
|
239
|
+
}
|
|
240
|
+
return runMigrationList({
|
|
241
|
+
migrationsDir,
|
|
242
|
+
...ifDefined("spaceFilter", options.space)
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function createMigrationListCommand() {
|
|
246
|
+
const command = new Command("list");
|
|
247
|
+
setCommandDescriptions(command, "List on-disk migrations, latest first, per contract space", "Enumerates every on-disk migration under migrations/<space>/ for every\ncontract space found on disk, latest first. Offline — does not consult\nthe database. Each row shows source → destination contract hashes\n(7-char git-style), the self-edge marker (⟲), any provided invariants\n({...}), and refs landing on the destination ((production, db)). Pass\n--space <id> to narrow to a single contract space.");
|
|
248
|
+
setCommandExamples(command, [
|
|
249
|
+
"prisma-next migration list",
|
|
250
|
+
"prisma-next migration list --space app",
|
|
251
|
+
"prisma-next migration list --json"
|
|
252
|
+
]);
|
|
253
|
+
setCommandSeeAlso(command, [
|
|
254
|
+
{
|
|
255
|
+
verb: "migration status",
|
|
256
|
+
oneLiner: "Show migration path and pending status"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
verb: "migration log",
|
|
260
|
+
oneLiner: "Show executed migration history"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
verb: "migration graph",
|
|
264
|
+
oneLiner: "Show the migration graph topology"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
verb: "migration show",
|
|
268
|
+
oneLiner: "Display migration package contents"
|
|
269
|
+
}
|
|
270
|
+
]);
|
|
271
|
+
addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").option("--space <id>", "Narrow output to a single contract space").action(async (options) => {
|
|
272
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
273
|
+
const ui = createTerminalUI(flags);
|
|
274
|
+
const exitCode = handleResult(await executeMigrationListCommand(options, flags, ui), flags, ui, (listResult) => {
|
|
275
|
+
if (flags.json) ui.output(JSON.stringify(listResult, null, 2));
|
|
276
|
+
else if (!flags.quiet) {
|
|
277
|
+
const styler = createAnsiMigrationListStyler({ useColor: ui.useColor });
|
|
278
|
+
ui.output(renderMigrationListWithStyle(listResult, styler));
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
process.exit(exitCode);
|
|
282
|
+
});
|
|
283
|
+
return command;
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
export { runMigrationList as n, createMigrationListCommand as t };
|
|
287
|
+
|
|
288
|
+
//# sourceMappingURL=migration-list-CnYiHrNV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-list-CnYiHrNV.mjs","names":[],"sources":["../src/utils/formatters/migration-list-render.ts","../src/utils/formatters/migration-list-styler.ts","../src/commands/migration-list.ts"],"sourcesContent":["import type {\n MigrationListEntry,\n MigrationListResult,\n} from '@prisma-next/migration-tools/migration-list-types';\n\nexport type {\n MigrationListEntry,\n MigrationListResult,\n MigrationSpaceListEntry,\n} from '@prisma-next/migration-tools/migration-list-types';\n\nconst HASH_WIDTH = 7;\nconst EMPTY_SOURCE = '∅';\nconst SELF_EDGE_GLYPH = '⟲';\nconst FORWARD_EDGE_GLYPH = '→';\nconst DECORATION_PREFIX = ' ';\n\n/**\n * Semantic styler for `migration list` output tokens. Token-typed so\n * the renderer composes presentation-neutral fragments and the styler\n * decides how each token kind is decorated (ANSI codes, plain text,\n * etc.). The renderer pads with raw spaces *outside* styled tokens so\n * visible column widths stay stable regardless of what the styler\n * emits — adding ANSI escape sequences never disturbs alignment.\n *\n * `invariants` and `refs` receive the underlying string arrays rather\n * than a pre-joined string so per-element styling (e.g. distinguishing\n * the live-DB `db` marker from user-named refs) is possible without\n * having to re-parse a joined block.\n */\nexport interface MigrationListStyler {\n dirName(text: string): string;\n sourceHash(text: string): string;\n destHash(text: string): string;\n glyph(text: string): string;\n invariants(ids: readonly string[]): string;\n refs(names: readonly string[]): string;\n spaceHeading(text: string): string;\n summary(text: string): string;\n emptyState(text: string): string;\n}\n\nexport const IDENTITY_MIGRATION_LIST_STYLER: MigrationListStyler = {\n dirName: (text) => text,\n sourceHash: (text) => text,\n destHash: (text) => text,\n glyph: (text) => text,\n invariants: (ids) => `{${ids.join(', ')}}`,\n refs: (names) => `(${names.join(', ')})`,\n spaceHeading: (text) => text,\n summary: (text) => text,\n emptyState: (text) => text,\n};\n\nfunction abbreviateContractHash(hash: string): string {\n const stripped = hash.startsWith('sha256:') ? hash.slice(7) : hash;\n return stripped.slice(0, HASH_WIDTH);\n}\n\nfunction formatSourceColumn(from: string | null, style: MigrationListStyler): string {\n if (from === null) {\n return style.glyph(EMPTY_SOURCE) + ' '.repeat(HASH_WIDTH - EMPTY_SOURCE.length);\n }\n return style.sourceHash(abbreviateContractHash(from));\n}\n\nfunction formatDestColumn(from: string | null, to: string, style: MigrationListStyler): string {\n if (from !== null && from === to) {\n return ' '.repeat(HASH_WIDTH);\n }\n return style.destHash(abbreviateContractHash(to));\n}\n\nfunction formatArrowGlyph(from: string | null, to: string, style: MigrationListStyler): string {\n return style.glyph(from !== null && from === to ? SELF_EDGE_GLYPH : FORWARD_EDGE_GLYPH);\n}\n\nfunction formatDecorations(\n providedInvariants: readonly string[],\n refs: readonly string[],\n style: MigrationListStyler,\n): string {\n const blocks: string[] = [];\n if (providedInvariants.length > 0) {\n blocks.push(style.invariants(providedInvariants));\n }\n if (refs.length > 0) {\n blocks.push(style.refs(refs));\n }\n if (blocks.length === 0) return '';\n return `${DECORATION_PREFIX}${blocks.join(' ')}`;\n}\n\nfunction formatMigrationRow(\n migration: MigrationListEntry,\n dirNameWidth: number,\n style: MigrationListStyler,\n): string {\n const dirNamePadding = ' '.repeat(Math.max(0, dirNameWidth - migration.dirName.length));\n const dirName = `${style.dirName(migration.dirName)}${dirNamePadding}`;\n const source = formatSourceColumn(migration.from, style);\n const arrow = formatArrowGlyph(migration.from, migration.to, style);\n const dest = formatDestColumn(migration.from, migration.to, style);\n const decorations = formatDecorations(migration.providedInvariants, migration.refs, style);\n return `${dirName}${source} ${arrow} ${dest}${decorations}`;\n}\n\nfunction formatEmptyStateLine(spaceId: string, style: MigrationListStyler): string {\n return style.emptyState(`There are no migrations in migrations/${spaceId}/ yet`);\n}\n\nfunction renderSpaceBlock(\n spaceId: string,\n migrations: readonly MigrationListEntry[],\n multiSpace: boolean,\n style: MigrationListStyler,\n): readonly string[] {\n if (migrations.length === 0) {\n const emptyLine = formatEmptyStateLine(spaceId, style);\n if (!multiSpace) {\n return [emptyLine];\n }\n return [style.spaceHeading(`${spaceId}:`), ` ${emptyLine}`];\n }\n\n const dirNameWidth = Math.max(...migrations.map((entry) => entry.dirName.length)) + 2;\n const rows = migrations.map((entry) => formatMigrationRow(entry, dirNameWidth, style));\n if (!multiSpace) {\n return rows;\n }\n return [style.spaceHeading(`${spaceId}:`), ...rows.map((row) => ` ${row}`)];\n}\n\n/**\n * Compose the styled `migration list` output. The renderer is\n * presentation-neutral — every token passes through `style` before\n * landing in the output, so the same composition serves the pure-text\n * path ({@link renderMigrationList} via\n * {@link IDENTITY_MIGRATION_LIST_STYLER}) and the ANSI-styled CLI path\n * (via the ANSI styler the CLI shell wires up).\n */\nexport function renderMigrationListWithStyle(\n result: MigrationListResult,\n style: MigrationListStyler,\n): string {\n const multiSpace = result.spaces.length > 1;\n const lines: string[] = [];\n\n for (let index = 0; index < result.spaces.length; index++) {\n const space = result.spaces[index]!;\n if (index > 0) {\n lines.push('');\n }\n lines.push(...renderSpaceBlock(space.spaceId, space.migrations, multiSpace, style));\n }\n\n const totalMigrations = result.spaces.reduce(\n (count, space) => count + space.migrations.length,\n 0,\n );\n if (totalMigrations > 0) {\n lines.push('');\n lines.push(style.summary(result.summary));\n }\n\n return lines.join('\\n');\n}\n\nexport function renderMigrationList(result: MigrationListResult): string {\n return renderMigrationListWithStyle(result, IDENTITY_MIGRATION_LIST_STYLER);\n}\n","import { bold, cyan, cyanBright, dim, green, greenBright, yellow } from 'colorette';\nimport { IDENTITY_MIGRATION_LIST_STYLER, type MigrationListStyler } from './migration-list-render';\n\n/**\n * The reserved ref name for the live-database marker. Treated as a\n * structurally distinct token from user-named refs so the styler can\n * make it visually pop in `(refs)` decorations.\n */\nconst DB_REF_NAME = 'db';\n\nfunction styleRefName(name: string): string {\n return name === DB_REF_NAME ? bold(greenBright(name)) : green(name);\n}\n\n/**\n * Build a {@link MigrationListStyler} that decorates `migration list`\n * tokens with ANSI SGR codes. When `useColor` is `false` (non-TTY,\n * `--no-color`, `NO_COLOR=1`, piped output) the function returns the\n * shared identity styler so callers get plain text with zero ANSI\n * bytes — pipe-friendly by construction.\n *\n * Palette:\n *\n * - `dirName`: bold\n * - `sourceHash`: dim cyan\n * - `destHash`: bright cyan\n * - `glyph` (`→` / `⟲` / `∅`): dim\n * - `invariants` (`{...}`): yellow\n * - `refs` (`(...)`): green; the live-DB `db` marker inside is green-bold\n * - `spaceHeading` (`<spaceId>:`): bold\n * - `summary`: dim\n * - `emptyState`: dim\n */\nexport function createAnsiMigrationListStyler(opts: {\n readonly useColor: boolean;\n}): MigrationListStyler {\n if (!opts.useColor) {\n return IDENTITY_MIGRATION_LIST_STYLER;\n }\n return {\n dirName: (text) => bold(text),\n sourceHash: (text) => dim(cyan(text)),\n destHash: (text) => cyanBright(text),\n glyph: (text) => dim(text),\n invariants: (ids) => yellow(`{${ids.join(', ')}}`),\n refs: (names) => {\n const open = green('(');\n const close = green(')');\n const separator = green(', ');\n return open + names.map(styleRefName).join(separator) + close;\n },\n spaceHeading: (text) => bold(text),\n summary: (text) => dim(text),\n emptyState: (text) => dim(text),\n };\n}\n","import { enumerateMigrationSpaces } from '@prisma-next/migration-tools/enumerate-migration-spaces';\nimport { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport type {\n MigrationListResult,\n MigrationSpaceListEntry,\n} from '@prisma-next/migration-tools/migration-list-types';\nimport { APP_SPACE_ID, isValidSpaceId } from '@prisma-next/migration-tools/spaces';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport {\n type CliStructuredError,\n errorInvalidSpaceId,\n errorSpaceNotFound,\n errorUnexpected,\n mapMigrationToolsError,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { renderMigrationListWithStyle } from '../utils/formatters/migration-list-render';\nimport { createAnsiMigrationListStyler } from '../utils/formatters/migration-list-styler';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationListOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly space?: string;\n}\n\n/**\n * Inputs for {@link runMigrationList} — the pure-ish data-and-policy core\n * of `migration list` that tests exercise directly.\n *\n * The core depends only on the filesystem rooted at `migrationsDir`. It\n * does NOT call `loadConfig`, parse CLI flags, render a styled header,\n * or write to any stream. Output rendering is the caller's concern (the\n * CLI shell renders via {@link renderMigrationList}; JSON callers\n * serialize the {@link MigrationListResult} directly).\n */\nexport interface RunMigrationListInputs {\n /** Absolute path to the project's `migrations/` directory. */\n readonly migrationsDir: string;\n /**\n * Optional contract-space id to narrow the result to a single space.\n * Same validation rules as {@link isValidSpaceId}. When absent, every\n * on-disk space contributes.\n */\n readonly spaceFilter?: string;\n}\n\n/**\n * Compute the trailing one-line summary appended below the migration\n * rows. Wording follows the existing CLI's pluralization style (\"N\n * migration(s) on disk\" for the common single-space path; multi-space\n * adds \"across K contract space(s)\" so consumers can see the spread).\n *\n * The renderer suppresses the summary line when `totalMigrations === 0`\n * — the empty-state line carries enough information on its own — so\n * this function always returns a string even for the empty-state.\n */\nfunction computeSummary(spaces: readonly MigrationSpaceListEntry[]): string {\n const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n if (spaces.length <= 1) {\n return `${totalMigrations} migration(s) on disk`;\n }\n return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n\n/**\n * The unit-testable core of `migration list`. Given an absolute\n * `migrationsDir` and an optional `spaceFilter`, enumerates every\n * on-disk migration (via {@link enumerateMigrationSpaces}), narrows to\n * the requested space if any, and assembles a {@link MigrationListResult}\n * ready for the renderer or JSON serializer.\n *\n * The enumerator is the single source of truth for \"what is a contract\n * space\": existence, the `--space` candidate-suggestion list, and\n * scoping are all derived from one {@link enumerateMigrationSpaces}\n * traversal. This means the reserved-name exclusion the enumerator\n * applies (e.g. the per-space `refs/` subdirectory) is honoured here for\n * free — a `--space refs` request resolves to `SPACE_NOT_FOUND`, not a\n * synthesized empty-state.\n *\n * Distinct empty-state paths:\n *\n * - `migrations/` missing or contains no valid space directories →\n * synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]` so the\n * renderer's empty-state path can name a directory (spec § Empty-state +\n * the `migrations/` missing edge case).\n * - `--space <id>` on an existing-but-empty space dir → the enumerator\n * surfaces `{ spaceId, migrations: [] }`; `<id>` is in the set, so it\n * scopes to that entry and renders the empty-state the same way.\n * - `--space <id>` on a non-existent (or reserved) space → structured\n * `MIGRATION.SPACE_NOT_FOUND` error (NOT empty-state).\n *\n * Errors caught here:\n *\n * - {@link MigrationToolsError} from the enumerator → mapped through\n * {@link mapMigrationToolsError} so callers see the catalogue code.\n * - Anything else (filesystem etc.) → wrapped via {@link errorUnexpected}.\n */\nexport async function runMigrationList(\n inputs: RunMigrationListInputs,\n): Promise<Result<MigrationListResult, CliStructuredError>> {\n const { migrationsDir, spaceFilter } = inputs;\n\n if (spaceFilter !== undefined && !isValidSpaceId(spaceFilter)) {\n return notOk(errorInvalidSpaceId(spaceFilter));\n }\n\n let spaces: readonly MigrationSpaceListEntry[];\n try {\n spaces = await enumerateMigrationSpaces({ projectMigrationsDir: migrationsDir });\n } catch (error) {\n if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to enumerate migrations: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n }\n\n if (spaceFilter !== undefined && !spaces.some((s) => s.spaceId === spaceFilter)) {\n return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n }\n\n const scopedSpaces =\n spaceFilter !== undefined ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\n const resultSpaces: readonly MigrationSpaceListEntry[] =\n scopedSpaces.length === 0 ? [{ spaceId: APP_SPACE_ID, migrations: [] }] : scopedSpaces;\n\n return ok({\n ok: true,\n spaces: resultSpaces,\n summary: computeSummary(resultSpaces),\n });\n}\n\n/**\n * CLI shell: loads config, resolves paths, prints the styled header on\n * stderr (interactive mode only), and delegates to {@link runMigrationList}.\n * Kept intentionally thin so the unit-testable surface lives in the core.\n */\nasync function executeMigrationListCommand(\n options: MigrationListOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationListResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration list',\n description: 'List on-disk migrations, latest first, per contract space',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ...(options.space !== undefined ? [{ label: 'space', value: options.space }] : []),\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n return runMigrationList({\n migrationsDir,\n ...ifDefined('spaceFilter', options.space),\n });\n}\n\nexport function createMigrationListCommand(): Command {\n const command = new Command('list');\n setCommandDescriptions(\n command,\n 'List on-disk migrations, latest first, per contract space',\n 'Enumerates every on-disk migration under migrations/<space>/ for every\\n' +\n 'contract space found on disk, latest first. Offline — does not consult\\n' +\n 'the database. Each row shows source → destination contract hashes\\n' +\n '(7-char git-style), the self-edge marker (⟲), any provided invariants\\n' +\n '({...}), and refs landing on the destination ((production, db)). Pass\\n' +\n '--space <id> to narrow to a single contract space.',\n );\n setCommandExamples(command, [\n 'prisma-next migration list',\n 'prisma-next migration list --space app',\n 'prisma-next migration list --json',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .action(async (options: MigrationListOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationListCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (listResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(listResult, null, 2));\n } else if (!flags.quiet) {\n const styler = createAnsiMigrationListStyler({ useColor: ui.useColor });\n ui.output(renderMigrationListWithStyle(listResult, styler));\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AA2B1B,MAAa,iCAAsD;CACjE,UAAU,SAAS;CACnB,aAAa,SAAS;CACtB,WAAW,SAAS;CACpB,QAAQ,SAAS;CACjB,aAAa,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;CACxC,OAAO,UAAU,IAAI,MAAM,KAAK,IAAI,EAAE;CACtC,eAAe,SAAS;CACxB,UAAU,SAAS;CACnB,aAAa,SAAS;AACxB;AAEA,SAAS,uBAAuB,MAAsB;CAEpD,QADiB,KAAK,WAAW,SAAS,IAAI,KAAK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AAM;GAAmB,UAAU;EAAoC;EACzE;GAAE,MAAM;GAAkB,UAAU;EAAqC;CAC3E,CAAC;CACD,iBAAiB,OAAO,EACrB,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,gBAAgB,0CAA0C,EACjE,OAAO,OAAO,YAAkC;EAC/C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EAEjC,MAAM,WAAW,aAAa,MADT,4BAA4B,SAAS,OAAO,EAAE,GAC7B,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,OAAO;IACvB,MAAM,SAAS,8BAA8B,EAAE,UAAU,GAAG,SAAS,CAAC;IACtE,GAAG,OAAO,6BAA6B,YAAY,MAAM,CAAC;GAC5D;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as assertFrameworkComponentsCompatible } from "./framework-components-
|
|
4
|
-
import { D as formatStyledHeader, a as loadMigrationPackages, c as resolveContractPath, d as setCommandDescriptions, f as setCommandExamples, i as getTargetMigrations, l as resolveMigrationPaths, t as addGlobalOptions, v as parseGlobalFlagsOrExit, x as handleResult, y as createTerminalUI } from "./command-helpers-
|
|
5
|
-
import { n as toExtensionInputs, t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-
|
|
2
|
+
import { A as mapRefResolutionError, E as errorTargetMigrationNotSupported, O as errorUnexpected, a as errorContractValidationFailed, h as errorMigrationPlanningFailed, k as mapMigrationToolsError, l as errorFileNotFound, t as CliStructuredError, v as errorPlanForgotTheFlag, w as errorSnapshotMissing } from "./cli-errors-DFF1LlfU.mjs";
|
|
3
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-DTcjouhS.mjs";
|
|
4
|
+
import { D as formatStyledHeader, a as loadMigrationPackages, c as resolveContractPath, d as setCommandDescriptions, f as setCommandExamples, i as getTargetMigrations, l as resolveMigrationPaths, t as addGlobalOptions, v as parseGlobalFlagsOrExit, x as handleResult, y as createTerminalUI } from "./command-helpers-BnqwTptC.mjs";
|
|
5
|
+
import { n as toExtensionInputs, t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-EVU3n9YE.mjs";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
8
8
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -784,4 +784,4 @@ function resolveBundleByPrefix(bundles, needle) {
|
|
|
784
784
|
//#endregion
|
|
785
785
|
export { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };
|
|
786
786
|
|
|
787
|
-
//# sourceMappingURL=migration-plan-
|
|
787
|
+
//# sourceMappingURL=migration-plan-BnmP_yNz.mjs.map
|