prisma-next 0.11.0-dev.24 → 0.11.0-dev.25
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
|
@@ -26,6 +26,46 @@ function errorRefSetEmptySentinel(hash) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* `--space <id>` was given a value that doesn't satisfy the contract-space
|
|
31
|
+
* naming rule (`[a-z][a-z0-9_-]{0,63}` per `isValidSpaceId`). Fires before
|
|
32
|
+
* any fs work — the input is syntactically rejected the same way an on-disk
|
|
33
|
+
* directory with that name would be skipped by the enumerator.
|
|
34
|
+
*/
|
|
35
|
+
function errorInvalidSpaceId(spaceId) {
|
|
36
|
+
return errorRuntime(`Invalid contract space id: ${spaceId}`, {
|
|
37
|
+
why: "Contract space ids must match [a-z][a-z0-9_-]{0,63} (lowercase, starts with a letter, max 64 characters — the rule applied to every on-disk space directory).",
|
|
38
|
+
fix: "Pass a space id that matches the directory naming rule, or omit --space to list every space.",
|
|
39
|
+
meta: {
|
|
40
|
+
code: "MIGRATION.INVALID_SPACE_ID",
|
|
41
|
+
spaceId
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `migration list --space <id>` was given a contract-space id that has no
|
|
47
|
+
* directory under `migrations/`. Distinct from "the space exists but is
|
|
48
|
+
* empty" — that path renders the empty-state line and exits 0 per the
|
|
49
|
+
* slice spec § Empty-state. This error fires only when `<projectMigrationsDir>/<spaceId>`
|
|
50
|
+
* does not exist on disk.
|
|
51
|
+
*
|
|
52
|
+
* `availableSpaces` lists the contract-space directory names actually
|
|
53
|
+
* present, sorted lex-asc, so the diagnostic can suggest a near match
|
|
54
|
+
* without making the user reach for `ls`.
|
|
55
|
+
*/
|
|
56
|
+
function errorSpaceNotFound(spaceId, availableSpaces) {
|
|
57
|
+
const availableList = availableSpaces.length > 0 ? availableSpaces.join(", ") : "(none — no contract spaces on disk yet)";
|
|
58
|
+
const fix = availableSpaces.length > 0 ? `Pick one of: ${availableList}. Run \`prisma-next migration list\` (no --space) to see every space's migrations.` : "Author a migration with `prisma-next migration new` to create the first contract-space directory.";
|
|
59
|
+
return errorRuntime(`Unknown contract space: ${spaceId}`, {
|
|
60
|
+
why: `No directory named "${spaceId}" exists under the migrations root.`,
|
|
61
|
+
fix,
|
|
62
|
+
meta: {
|
|
63
|
+
code: "MIGRATION.SPACE_NOT_FOUND",
|
|
64
|
+
spaceId,
|
|
65
|
+
availableSpaces: [...availableSpaces]
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
29
69
|
function errorRefSetBundleNotFound(hash) {
|
|
30
70
|
return errorRuntime(`No migration bundle matches graph-node hash ${hash}`, {
|
|
31
71
|
why: `The hash is a graph node but no on-disk bundle has metadata.to = ${hash}.`,
|
|
@@ -170,6 +210,6 @@ function mapRefResolutionError(error) {
|
|
|
170
210
|
}
|
|
171
211
|
}
|
|
172
212
|
//#endregion
|
|
173
|
-
export {
|
|
213
|
+
export { mapRefResolutionError as A, errorRuntime$1 as C, errorTargetMismatch as D, errorTargetMigrationNotSupported as E, errorUnexpected$1 as O, errorRunnerFailed as S, errorSpaceNotFound as T, errorPathUnreachable as _, errorContractValidationFailed as a, errorRefSetEmptySentinel as b, errorDriverRequired as c, errorInvalidOutputFormat as d, errorInvalidSpaceId as f, errorOutputFormatMutex as g, errorMigrationPlanningFailed as h, errorContractConfigMissing$1 as i, mapMigrationToolsError as k, errorFileNotFound as l, errorMarkerMissing as m, ERROR_CODE_DESTRUCTIVE_CHANGES as n, errorDatabaseConnectionRequired as o, errorMarkerMismatch as p, errorConfigValidation$1 as r, errorDestructiveChanges as s, CliStructuredError$1 as t, errorHashMismatch as u, errorPlanForgotTheFlag as v, errorSnapshotMissing as w, errorRefSetHashNotInGraph as x, errorRefSetBundleNotFound as y };
|
|
174
214
|
|
|
175
|
-
//# sourceMappingURL=cli-errors-
|
|
215
|
+
//# sourceMappingURL=cli-errors-DFF1LlfU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-errors-DFF1LlfU.mjs","names":[],"sources":["../src/utils/cli-errors.ts"],"sourcesContent":["/**\n * Re-export all domain error factories from @prisma-next/errors for convenience.\n * CLI-specific errors (e.g., Commander argument validation in the main CLI, or\n * clipanion parse errors in the migration-file CLI) can be added here if needed.\n */\nexport type { CliErrorConflict, CliErrorEnvelope } from '@prisma-next/errors/control';\n\nimport {\n CliStructuredError,\n errorConfigFileNotFound,\n errorConfigValidation,\n errorContractConfigMissing,\n errorContractMissingExtensionPacks,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFamilyReadMarkerSqlRequired,\n errorFileNotFound,\n errorInvalidOutputFormat,\n errorMigrationCliInvalidConfigArg,\n errorMigrationCliUnknownFlag,\n errorMigrationPlanningFailed,\n errorOutputFormatMutex,\n errorQueryRunnerFactoryRequired,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n} from '@prisma-next/errors/control';\nimport { errorRuntime } from '@prisma-next/errors/execution';\nimport type { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport type { RefResolutionError } from '@prisma-next/migration-tools/ref-resolution';\nimport type { MigrationApplyFailure } from '../control-api/types';\n\nexport {\n ERROR_CODE_DESTRUCTIVE_CHANGES,\n errorDestructiveChanges,\n errorHashMismatch,\n errorMarkerMissing,\n errorMarkerRequired,\n errorRunnerFailed,\n errorRuntime,\n errorSchemaVerificationFailed,\n errorTargetMismatch,\n} from '@prisma-next/errors/execution';\nexport {\n errorMigrationFileMissing,\n errorMigrationInvalidDefaultExport,\n errorMigrationPlanNotArray,\n errorUnfilledPlaceholder,\n placeholder,\n} from '@prisma-next/errors/migration';\nexport {\n CliStructuredError,\n errorConfigFileNotFound,\n errorConfigValidation,\n errorContractConfigMissing,\n errorContractMissingExtensionPacks,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFamilyReadMarkerSqlRequired,\n errorFileNotFound,\n errorInvalidOutputFormat,\n errorMigrationCliInvalidConfigArg,\n errorMigrationCliUnknownFlag,\n errorMigrationPlanningFailed,\n errorOutputFormatMutex,\n errorQueryRunnerFactoryRequired,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n};\n\nexport function errorRefSetHashNotInGraph(\n resolvedHash: string,\n reachableHashes: readonly string[],\n graphTipHash: string | null,\n): CliStructuredError {\n const reachableList =\n reachableHashes.length > 0 ? reachableHashes.join(', ') : '(none — migration graph is empty)';\n const fix =\n reachableHashes.length > 0\n ? graphTipHash !== null\n ? `Set the ref to a graph-node hash such as ${graphTipHash}, or run \\`prisma-next migration plan\\` to extend the graph.`\n : 'Set the ref to a hash that appears in the migration graph.'\n : 'Run `prisma-next migration plan` first.';\n return errorRuntime(`Resolved contract hash is not in the migration graph: ${resolvedHash}`, {\n why:\n reachableHashes.length > 0\n ? `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`\n : 'The migration graph is empty — no hashes reachable.',\n fix,\n meta: {\n code: 'MIGRATION.HASH_NOT_IN_GRAPH',\n resolvedHash,\n reachableHashes: [...reachableHashes],\n ...(graphTipHash !== null ? { graphTipHash } : {}),\n },\n });\n}\n\nexport function errorRefSetEmptySentinel(hash: string): CliStructuredError {\n return errorRuntime(`Cannot set ref to the empty-database sentinel: ${hash}`, {\n why: 'The empty-database sentinel is a planner internal; it is not a valid ref target.',\n fix: 'Set the ref to a contract hash from the migration graph, or use another ref name.',\n meta: {\n code: 'MIGRATION.REF_SET_EMPTY_SENTINEL',\n hash,\n },\n });\n}\n\n/**\n * `--space <id>` was given a value that doesn't satisfy the contract-space\n * naming rule (`[a-z][a-z0-9_-]{0,63}` per `isValidSpaceId`). Fires before\n * any fs work — the input is syntactically rejected the same way an on-disk\n * directory with that name would be skipped by the enumerator.\n */\nexport function errorInvalidSpaceId(spaceId: string): CliStructuredError {\n return errorRuntime(`Invalid contract space id: ${spaceId}`, {\n why: 'Contract space ids must match [a-z][a-z0-9_-]{0,63} (lowercase, starts with a letter, max 64 characters — the rule applied to every on-disk space directory).',\n fix: 'Pass a space id that matches the directory naming rule, or omit --space to list every space.',\n meta: {\n code: 'MIGRATION.INVALID_SPACE_ID',\n spaceId,\n },\n });\n}\n\n/**\n * `migration list --space <id>` was given a contract-space id that has no\n * directory under `migrations/`. Distinct from \"the space exists but is\n * empty\" — that path renders the empty-state line and exits 0 per the\n * slice spec § Empty-state. This error fires only when `<projectMigrationsDir>/<spaceId>`\n * does not exist on disk.\n *\n * `availableSpaces` lists the contract-space directory names actually\n * present, sorted lex-asc, so the diagnostic can suggest a near match\n * without making the user reach for `ls`.\n */\nexport function errorSpaceNotFound(\n spaceId: string,\n availableSpaces: readonly string[],\n): CliStructuredError {\n const availableList =\n availableSpaces.length > 0\n ? availableSpaces.join(', ')\n : '(none — no contract spaces on disk yet)';\n const fix =\n availableSpaces.length > 0\n ? `Pick one of: ${availableList}. Run \\`prisma-next migration list\\` (no --space) to see every space's migrations.`\n : 'Author a migration with `prisma-next migration new` to create the first contract-space directory.';\n return errorRuntime(`Unknown contract space: ${spaceId}`, {\n why: `No directory named \"${spaceId}\" exists under the migrations root.`,\n fix,\n meta: {\n code: 'MIGRATION.SPACE_NOT_FOUND',\n spaceId,\n availableSpaces: [...availableSpaces],\n },\n });\n}\n\nexport function errorRefSetBundleNotFound(hash: string): CliStructuredError {\n return errorRuntime(`No migration bundle matches graph-node hash ${hash}`, {\n why: `The hash is a graph node but no on-disk bundle has metadata.to = ${hash}.`,\n fix: 'Run `pnpm fixtures:check`, or re-emit the migration that produces this hash so its bundle is restored.',\n meta: {\n code: 'MIGRATION.REF_SET_BUNDLE_NOT_FOUND',\n hash,\n },\n });\n}\n\nexport function errorPlanForgotTheFlag(\n resolvedHash: string,\n reachableRefs: ReadonlyArray<{ readonly name: string; readonly hash: string }>,\n graphTipHash: string | null,\n): CliStructuredError {\n const reachableList =\n reachableRefs.length > 0\n ? reachableRefs.map((r) => `${r.name} (${r.hash})`).join(', ')\n : '(none)';\n const refFix =\n reachableRefs.length > 0\n ? `Run migration plan with ${reachableRefs.map((r) => `--from ${r.name}`).join(' or ')}.`\n : graphTipHash !== null\n ? `Run migration plan --from ${graphTipHash}.`\n : 'Commit pending migrations first, then run migration plan.';\n return errorRuntime(`Resolved from-hash is not in the migration graph: ${resolvedHash}`, {\n why: `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`,\n fix: refFix,\n meta: {\n code: 'MIGRATION.HASH_NOT_IN_GRAPH',\n resolvedHash,\n reachableRefs: reachableRefs.map((r) => r.name),\n ...(graphTipHash !== null ? { graphTipHash } : {}),\n },\n });\n}\n\nexport function errorSnapshotMissing(\n identifier: string,\n options?: { readonly viaRef?: boolean },\n): CliStructuredError {\n const viaRef = options?.viaRef !== false;\n const fix = viaRef\n ? `Run \"prisma-next db update --advance-ref ${identifier}\" to repopulate the snapshot, or \"prisma-next ref delete ${identifier}\" to clear the orphan pointer.`\n : `No contract source exists for hash \"${identifier}\" on an empty migration graph. Use --from with a ref name that has a paired snapshot, or run db update first.`;\n return errorRuntime(\n viaRef\n ? `Ref \"${identifier}\" has no paired contract snapshot`\n : `No contract source for from-hash \"${identifier}\"`,\n {\n why: viaRef\n ? `Ref \"${identifier}\" exists but its paired snapshot files are missing.`\n : `Hash \"${identifier}\" is not a graph node and no paired ref snapshot supplies a contract.`,\n fix,\n meta: {\n code: 'MIGRATION.SNAPSHOT_MISSING',\n identifier,\n viaRef,\n },\n },\n );\n}\n\nexport function errorMarkerMismatch(\n markerHash: string,\n reachableHashes: readonly string[],\n graphTip: string | null,\n): CliStructuredError {\n const reachableList =\n reachableHashes.length > 0 ? reachableHashes.join(', ') : '(none — migration graph is empty)';\n const planFromFix =\n graphTip !== null\n ? `Run \\`prisma-next migration plan --from ${graphTip}\\` if the live marker is canonical and the on-disk graph needs catching up.`\n : 'Run `prisma-next migration plan` if the live marker is canonical and the on-disk graph needs catching up.';\n return errorRuntime('Database marker is not reachable in the on-disk migration graph', {\n why: `DB marker is ${markerHash}, but the on-disk migration graph reaches: ${reachableList}.`,\n fix: [\n planFromFix,\n `Run \\`prisma-next ref set db ${markerHash}\\` if the on-disk graph is canonical and the local \\`db\\` ref drifted.`,\n 'Investigate whether the database was migrated by an out-of-band process.',\n ].join('\\n'),\n meta: {\n code: 'MIGRATION.MARKER_MISMATCH',\n markerHash,\n reachableHashes: [...reachableHashes],\n ...(graphTip !== null ? { graphTip } : {}),\n },\n });\n}\n\nexport function errorPathUnreachable(failure: MigrationApplyFailure): CliStructuredError {\n const meta = failure.meta ?? {};\n const fromHash = typeof meta['fromHash'] === 'string' ? meta['fromHash'] : null;\n const targetHash =\n typeof meta['targetHash'] === 'string'\n ? meta['targetHash']\n : typeof meta['target'] === 'string'\n ? meta['target']\n : null;\n const deadEnds = meta['deadEnds'];\n const deadEndsSuffix =\n Array.isArray(deadEnds) && deadEnds.length > 0\n ? ` Dead-ends: ${deadEnds.map(String).join(', ')}.`\n : '';\n const planFix = (() => {\n if (fromHash !== null && targetHash !== null) {\n return `Run \\`prisma-next migration plan --from ${fromHash} --to ${targetHash}\\` to introduce the missing path.`;\n }\n if (targetHash !== null) {\n return `Run \\`prisma-next migration plan --to ${targetHash}\\` to introduce the missing path.`;\n }\n if (fromHash !== null) {\n return `Run \\`prisma-next migration plan --from ${fromHash}\\` to introduce the missing path.`;\n }\n return 'Run `prisma-next migration plan` to introduce the missing path.';\n })();\n return errorRuntime(failure.summary, {\n why:\n failure.why ??\n `Cannot reach target \"${targetHash ?? '<unknown>'}\" from current marker \"${fromHash ?? '<unknown>'}\".${deadEndsSuffix}`,\n fix: [\n 'Run `prisma-next migration list` to see the on-disk graph.',\n planFix,\n 'Run `prisma-next migration show <bundle>` for any bundle in the path you expected.',\n ].join('\\n'),\n meta: {\n ...meta,\n code: 'MIGRATION.PATH_UNREACHABLE',\n },\n });\n}\n\n/**\n * Maps a `MigrationToolsError` raised by the migration-tools loader/graph\n * surface (`readMigrationPackage`, `readMigrationsDir`, `readRefs`,\n * `resolveRef`, `reconstructGraph`, ...) into a CLI `errorRuntime` envelope.\n *\n * The full `error.details` payload is forwarded into `meta` so machine\n * consumers (`--json`) see structural fields like `dir`, `storedHash`,\n * `computedHash` (for `MIGRATION.HASH_MISMATCH`) alongside the stable\n * `code`. The user-visible `summary`/`why`/`fix` text is unchanged.\n *\n * Callers are expected to gate on `MigrationToolsError.is(error)` first\n * (mirroring the original inline pattern); non-`MigrationToolsError`\n * values are caller-classified (rethrow, wrap with command-specific\n * `errorUnexpected`, etc.).\n */\nexport function mapMigrationToolsError(error: MigrationToolsError): CliStructuredError {\n return errorRuntime(error.message, {\n why: error.why,\n fix: error.fix,\n meta: { code: error.code, ...(error.details ?? {}) },\n });\n}\n\n/**\n * Maps a `RefResolutionError` from the contract/migration reference\n * resolver into a CLI structured error envelope.\n */\nexport function mapRefResolutionError(error: RefResolutionError): CliStructuredError {\n switch (error.kind) {\n case 'not-found':\n return errorRuntime(`Not a known ${error.grammar} reference: \"${error.input}\"`, {\n why: `No ${error.grammar} matching \"${error.input}\" exists in the migration graph or refs index.`,\n fix:\n error.grammar === 'contract'\n ? 'Provide a valid contract hash, ref name, or migration directory name.'\n : 'Provide a valid migration directory name or migration hash.',\n meta: { input: error.input, grammar: error.grammar },\n });\n case 'ambiguous':\n return errorRuntime(`Ambiguous ${error.grammar} reference: \"${error.input}\"`, {\n why: `\"${error.input}\" matches multiple ${error.grammar}s: ${error.candidates.join(', ')}`,\n fix: 'Provide a longer prefix or use the full hash to disambiguate.',\n meta: { input: error.input, candidates: error.candidates, grammar: error.grammar },\n });\n case 'wrong-grammar':\n return errorRuntime(error.message, {\n why: error.message,\n fix: error.fix,\n meta: { input: error.input, expectedGrammar: error.expectedGrammar },\n });\n case 'invalid-format':\n return errorRuntime(`Invalid reference format: \"${error.input}\"`, {\n why: error.reason,\n fix: 'Provide a valid contract hash, ref name, or migration directory name.',\n meta: { input: error.input },\n });\n }\n}\n"],"mappings":";;;;AAuEA,SAAgB,0BACd,cACA,iBACA,cACoB;CACpB,MAAM,gBACJ,gBAAgB,SAAS,IAAI,gBAAgB,KAAK,IAAI,IAAI;CAC5D,MAAM,MACJ,gBAAgB,SAAS,IACrB,iBAAiB,OACf,4CAA4C,aAAa,gEACzD,+DACF;CACN,OAAO,aAAa,yDAAyD,gBAAgB;EAC3F,KACE,gBAAgB,SAAS,IACrB,+BAA+B,cAAc,aAAa,aAAa,wBACvE;EACN;EACA,MAAM;GACJ,MAAM;GACN;GACA,iBAAiB,CAA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AM;GAAgB;EACrE,CAAC;EACH,KAAK,kBACH,OAAO,aAAa,8BAA8B,MAAM,MAAM,IAAI;GAChE,KAAK,MAAM;GACX,KAAK;GACL,MAAM,EAAE,OAAO,MAAM,MAAM;EAC7B,CAAC;CACL;AACF"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { E as formatRootHelp, T as formatCommandHelp, _ as parseGlobalFlags, b as installShutdownHandlers, d as setCommandDescriptions, f as setCommandExamples, t as addGlobalOptions, v as parseGlobalFlagsOrExit, w as isCI } from "./command-helpers-
|
|
3
|
-
import { t as createContractEmitCommand } from "./contract-emit-
|
|
4
|
-
import { t as createContractInferCommand } from "./contract-infer-
|
|
2
|
+
import { E as formatRootHelp, T as formatCommandHelp, _ as parseGlobalFlags, b as installShutdownHandlers, d as setCommandDescriptions, f as setCommandExamples, t as addGlobalOptions, v as parseGlobalFlagsOrExit, w as isCI } from "./command-helpers-BnqwTptC.mjs";
|
|
3
|
+
import { t as createContractEmitCommand } from "./contract-emit-aFcOi3aw.mjs";
|
|
4
|
+
import { t as createContractInferCommand } from "./contract-infer-BpJeg-Eu.mjs";
|
|
5
5
|
import { createDbInitCommand } from "./commands/db-init.mjs";
|
|
6
6
|
import { createDbSchemaCommand } from "./commands/db-schema.mjs";
|
|
7
7
|
import { createDbSignCommand } from "./commands/db-sign.mjs";
|
|
8
8
|
import { createDbUpdateCommand } from "./commands/db-update.mjs";
|
|
9
|
-
import { t as createDbVerifyCommand } from "./db-verify-
|
|
9
|
+
import { t as createDbVerifyCommand } from "./db-verify-CxtdGiL3.mjs";
|
|
10
10
|
import { createMigrateCommand } from "./commands/migrate.mjs";
|
|
11
11
|
import { createMigrationCheckCommand } from "./commands/migration-check.mjs";
|
|
12
12
|
import { createMigrationGraphCommand } from "./commands/migration-graph.mjs";
|
|
13
|
-
import { createMigrationListCommand } from "./
|
|
13
|
+
import { t as createMigrationListCommand } from "./migration-list-CnYiHrNV.mjs";
|
|
14
14
|
import { createMigrationLogCommand } from "./commands/migration-log.mjs";
|
|
15
15
|
import { createMigrationNewCommand } from "./commands/migration-new.mjs";
|
|
16
|
-
import { t as createMigrationPlanCommand } from "./migration-plan-
|
|
16
|
+
import { t as createMigrationPlanCommand } from "./migration-plan-BnmP_yNz.mjs";
|
|
17
17
|
import { createMigrationShowCommand } from "./commands/migration-show.mjs";
|
|
18
18
|
import { createMigrationStatusCommand } from "./commands/migration-status.mjs";
|
|
19
19
|
import { createRefCommand } from "./commands/ref.mjs";
|
|
@@ -24,7 +24,7 @@ import { fileURLToPath } from "node:url";
|
|
|
24
24
|
import { readUserConfig, resolveGating, runTelemetry } from "@prisma-next/cli-telemetry";
|
|
25
25
|
import { distance } from "closest-match";
|
|
26
26
|
//#region package.json
|
|
27
|
-
var version = "0.11.0-dev.
|
|
27
|
+
var version = "0.11.0-dev.25";
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/utils/telemetry.ts
|
|
30
30
|
/**
|
|
@@ -412,7 +412,7 @@ Exit codes (see CLI Style Guide § Exit Codes):
|
|
|
412
412
|
"prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)"
|
|
413
413
|
]);
|
|
414
414
|
return addGlobalOptions(command).option("--target <db>", "Database target: postgres or mongodb").option("--authoring <style>", "Schema authoring style: psl or typescript").option("--schema-path <path>", `Where to write the starter schema (default: ${defaultSchemaPath("psl")})`).option("--force", "Overwrite an existing scaffold without prompting").option("--write-env", "Write a .env file from .env.example (gitignored; default: only .env.example)").option("--probe-db", "Connect to DATABASE_URL once and check the server version against the target minimum (opt-in; off by default)").option("--strict-probe", "Treat a failed --probe-db as fatal (no-op without --probe-db; init is offline-by-default)").option("--no-install", "Skip dependency installation and contract emission").option("--no-skill", "Skip Prisma Next skills install (air-gapped CI, restricted registries, etc.)").action(async (options, actionCommand) => {
|
|
415
|
-
const { runInit } = await import("./init-
|
|
415
|
+
const { runInit } = await import("./init-eGkSo7hi.mjs");
|
|
416
416
|
const flags = parseGlobalFlagsOrExit(options);
|
|
417
417
|
const canPrompt = deriveCanPrompt({
|
|
418
418
|
flagsInteractive: flags.interactive,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as assertFrameworkComponentsCompatible } from "./framework-components-
|
|
1
|
+
import { S as errorRunnerFailed, t as CliStructuredError } from "./cli-errors-DFF1LlfU.mjs";
|
|
2
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-DTcjouhS.mjs";
|
|
3
3
|
import { t as enrichContract } from "./contract-enrichment-XmUPhmsS.mjs";
|
|
4
|
-
import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-
|
|
4
|
+
import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-EVU3n9YE.mjs";
|
|
5
5
|
import { emit } from "@prisma-next/emitter";
|
|
6
6
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
7
7
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1481,4 +1481,4 @@ var ControlClientImpl = class {
|
|
|
1481
1481
|
//#endregion
|
|
1482
1482
|
export { ContractValidationError as a, executeDbInit as i, executeDbVerify as n, executeDbUpdate as r, createControlClient as t };
|
|
1483
1483
|
|
|
1484
|
-
//# sourceMappingURL=client-
|
|
1484
|
+
//# sourceMappingURL=client-a5NJce0-.mjs.map
|