@prisma-next/cli 0.15.0 → 0.16.0-dev.1
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.d.mts +1 -1
- package/dist/cli.mjs +13 -13
- package/dist/{client-DigVI8zX.mjs → client-KuBQftxz.mjs} +67 -36
- package/dist/client-KuBQftxz.mjs.map +1 -0
- package/dist/{command-helpers-CUoKYTlG.mjs → command-helpers-Cpq44aVa.mjs} +21 -5
- package/dist/command-helpers-Cpq44aVa.mjs.map +1 -0
- package/dist/commands/contract-emit.d.mts +0 -1
- package/dist/commands/contract-emit.d.mts.map +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.d.mts +0 -1
- package/dist/commands/contract-infer.d.mts.map +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts +0 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +6 -6
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.d.mts +0 -1
- package/dist/commands/db-schema.d.mts.map +1 -1
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.d.mts +0 -1
- package/dist/commands/db-sign.d.mts.map +1 -1
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.d.mts +0 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +5 -5
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.d.mts +0 -1
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -2
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +5 -5
- package/dist/commands/migration-check.d.mts +1 -2
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +2 -3
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +3 -3
- package/dist/commands/migration-list.d.mts +2 -3
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +2 -3
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.d.mts +0 -1
- package/dist/commands/migration-new.d.mts.map +1 -1
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.d.mts +0 -1
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +0 -1
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +3 -3
- package/dist/commands/migration-status.d.mts +2 -3
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -2
- package/dist/commands/ref.d.mts.map +1 -1
- package/dist/commands/ref.mjs +2 -2
- package/dist/commands/telemetry/index.d.mts +0 -1
- package/dist/commands/telemetry/index.d.mts.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-D8CNDD7g.mjs → contract-at-errors-D9gEjYtg.mjs} +2 -2
- package/dist/{contract-at-errors-D8CNDD7g.mjs.map → contract-at-errors-D9gEjYtg.mjs.map} +1 -1
- package/dist/{contract-emit-wgqrOXUI.mjs → contract-emit-CgnXSANN.mjs} +3 -3
- package/dist/{contract-emit-wgqrOXUI.mjs.map → contract-emit-CgnXSANN.mjs.map} +1 -1
- package/dist/{contract-emit-sYrqzsdN.mjs → contract-emit-cJQBlvGb.mjs} +3 -3
- package/dist/{contract-emit-sYrqzsdN.mjs.map → contract-emit-cJQBlvGb.mjs.map} +1 -1
- package/dist/{contract-infer-6SQnnVj7.mjs → contract-infer-Cg8evbeg.mjs} +3 -3
- package/dist/{contract-infer-6SQnnVj7.mjs.map → contract-infer-Cg8evbeg.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-DpB4x97a.mjs → contract-space-aggregate-loader-D_3VeHVb.mjs} +14 -15
- package/dist/contract-space-aggregate-loader-D_3VeHVb.mjs.map +1 -0
- package/dist/{db-verify-CEsG5Gek.mjs → db-verify-BEclUzki.mjs} +6 -7
- package/dist/db-verify-BEclUzki.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +1 -2
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.d.mts +0 -1
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +2 -2
- package/dist/exports/init-output.d.mts +1 -0
- package/dist/exports/init-output.d.mts.map +1 -1
- package/dist/{format-CjongNb1.mjs → format-DAUAZqPt.mjs} +2 -2
- package/dist/{format-CjongNb1.mjs.map → format-DAUAZqPt.mjs.map} +1 -1
- package/dist/{framework-components-BbnM1RYm.mjs → framework-components-CnbUbiJw.mjs} +2 -2
- package/dist/{framework-components-BbnM1RYm.mjs.map → framework-components-CnbUbiJw.mjs.map} +1 -1
- package/dist/global-flags-BpoOYtNZ.d.mts.map +1 -1
- package/dist/{init-D8YFfaD6.mjs → init-C3JhkHg-.mjs} +33 -46
- package/dist/init-C3JhkHg-.mjs.map +1 -0
- package/dist/{inspect-live-schema-CEt_ztBJ.mjs → inspect-live-schema-CX7EA5C3.mjs} +3 -3
- package/dist/{inspect-live-schema-CEt_ztBJ.mjs.map → inspect-live-schema-CX7EA5C3.mjs.map} +1 -1
- package/dist/{migration-check-ByeQHOhK.mjs → migration-check-MHT3w7_v.mjs} +24 -24
- package/dist/migration-check-MHT3w7_v.mjs.map +1 -0
- package/dist/migration-cli.d.mts +0 -1
- package/dist/migration-cli.d.mts.map +1 -1
- package/dist/migration-cli.mjs +3 -3
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-CJO3tjiR.mjs → migration-command-scaffold-CRyYrHZ9.mjs} +3 -3
- package/dist/{migration-command-scaffold-CJO3tjiR.mjs.map → migration-command-scaffold-CRyYrHZ9.mjs.map} +1 -1
- package/dist/{migration-list-DTYM8xvm.mjs → migration-list-BAKujUjh.mjs} +3 -3
- package/dist/{migration-list-DTYM8xvm.mjs.map → migration-list-BAKujUjh.mjs.map} +1 -1
- package/dist/{migration-log-qZ8LpQIl.mjs → migration-log-C_xam2HZ.mjs} +3 -3
- package/dist/{migration-log-qZ8LpQIl.mjs.map → migration-log-C_xam2HZ.mjs.map} +1 -1
- package/dist/{migration-path-target-DmNwsDgs.mjs → migration-path-target-DpPTsRCg.mjs} +2 -2
- package/dist/{migration-path-target-DmNwsDgs.mjs.map → migration-path-target-DpPTsRCg.mjs.map} +1 -1
- package/dist/{migration-plan-CfPrB80t.mjs → migration-plan-CreSVtWZ.mjs} +6 -6
- package/dist/migration-plan-CreSVtWZ.mjs.map +1 -0
- package/dist/{migration-status-DRuS-rP5.mjs → migration-status-YgEvXf-u.mjs} +5 -5
- package/dist/{migration-status-DRuS-rP5.mjs.map → migration-status-YgEvXf-u.mjs.map} +1 -1
- package/dist/schemas-CeGMYFYX.d.mts.map +1 -1
- package/dist/{telemetry-DHBBq5wT.mjs → telemetry-DVr6RFnq.mjs} +2 -2
- package/dist/{telemetry-DHBBq5wT.mjs.map → telemetry-DVr6RFnq.mjs.map} +1 -1
- package/dist/{terminal-ui-DGRNFWna.d.mts → terminal-ui-BN4QOsm5.d.mts} +1 -2
- package/dist/terminal-ui-BN4QOsm5.d.mts.map +1 -0
- package/dist/{types-DFoqNIcQ.d.mts → types-D4r_HI9-.d.mts} +8 -4
- package/dist/types-D4r_HI9-.d.mts.map +1 -0
- package/dist/{verify-DDCb0R2r.mjs → verify-CgDVZjhc.mjs} +9 -8
- package/dist/verify-CgDVZjhc.mjs.map +1 -0
- package/package.json +25 -25
- package/src/commands/db-init.ts +3 -3
- package/src/commands/db-update.ts +1 -1
- package/src/commands/db-verify.ts +2 -3
- package/src/commands/init/errors.ts +62 -58
- package/src/commands/init/init.ts +29 -26
- package/src/commands/migration-check.ts +7 -7
- package/src/commands/migration-plan.ts +1 -1
- package/src/control-api/operations/db-run.ts +4 -4
- package/src/control-api/operations/db-verify.ts +12 -9
- package/src/control-api/operations/migrate.ts +70 -26
- package/src/control-api/types.ts +4 -1
- package/src/migration-cli.ts +5 -5
- package/src/utils/cli-errors.ts +15 -2
- package/src/utils/combine-verify-results.ts +1 -1
- package/src/utils/contract-space-aggregate-loader.ts +12 -13
- package/src/utils/formatters/errors.ts +24 -3
- package/src/utils/formatters/verify.ts +7 -6
- package/src/utils/integrity-violation-to-check-failure.ts +14 -14
- package/src/utils/result-handler.ts +4 -2
- package/dist/client-DigVI8zX.mjs.map +0 -1
- package/dist/command-helpers-CUoKYTlG.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-DpB4x97a.mjs.map +0 -1
- package/dist/db-verify-CEsG5Gek.mjs.map +0 -1
- package/dist/init-D8YFfaD6.mjs.map +0 -1
- package/dist/migration-check-ByeQHOhK.mjs.map +0 -1
- package/dist/migration-plan-CfPrB80t.mjs.map +0 -1
- package/dist/terminal-ui-DGRNFWna.d.mts.map +0 -1
- package/dist/types-DFoqNIcQ.d.mts.map +0 -1
- package/dist/verify-DDCb0R2r.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/commands/format.ts","../../src/load-ts-contract.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/commands/format.ts","../../src/load-ts-contract.ts"],"mappings":";;;;iBAmBgB,uBAAuB;;;UCXtB;WACN,YAAY;;;;;;;;;;;;;;;;;iBA4HD,mBACpB,mBACA,UAAU,wBACT,QAAQ"}
|
package/dist/exports/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createContractEmitCommand } from "../contract-emit-
|
|
2
|
-
import { t as createFormatCommand } from "../format-
|
|
1
|
+
import { t as createContractEmitCommand } from "../contract-emit-CgnXSANN.mjs";
|
|
2
|
+
import { t as createFormatCommand } from "../format-DAUAZqPt.mjs";
|
|
3
3
|
import { join, resolve } from "pathe";
|
|
4
4
|
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-output.d.mts","names":[],"sources":["../../src/commands/init/output.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-output.d.mts","names":[],"sources":["../../src/commands/init/output.ts"],"mappings":";;;;;;;;;;;;;;;;cAkBa,gEAAgB;;;;;;;;;;;;;;;;KAwBjB,oBAAoB,iBAAiB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorRuntime, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-
|
|
1
|
+
import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorRuntime, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-Cpq44aVa.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { loadConfig } from "@prisma-next/config-loader";
|
|
4
4
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
@@ -99,4 +99,4 @@ function createFormatCommand() {
|
|
|
99
99
|
//#endregion
|
|
100
100
|
export { createFormatCommand as t };
|
|
101
101
|
|
|
102
|
-
//# sourceMappingURL=format-
|
|
102
|
+
//# sourceMappingURL=format-DAUAZqPt.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-
|
|
1
|
+
{"version":3,"file":"format-DAUAZqPt.mjs","names":[],"sources":["../src/control-api/operations/format.ts","../src/commands/format.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises';\nimport { EOL } from 'node:os';\nimport { loadConfig } from '@prisma-next/config-loader';\nimport { type FormatOptions, format, PslFormatError } from '@prisma-next/psl-parser/format';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { CliStructuredError, errorRuntime, errorUnexpected } from '../../utils/cli-errors';\n\nexport interface FormatOperationOptions {\n readonly configPath?: string;\n readonly eol?: string;\n}\n\nexport interface FormatOperationResult {\n readonly formatted: boolean;\n readonly path?: string;\n}\n\nexport function resolveNewline(\n formatterNewline: 'LF' | 'CRLF' | undefined,\n eol: string,\n): 'LF' | 'CRLF' {\n if (formatterNewline !== undefined) {\n return formatterNewline;\n }\n return eol === '\\r\\n' ? 'CRLF' : 'LF';\n}\n\nexport async function executeFormat(\n options: FormatOperationOptions,\n): Promise<Result<FormatOperationResult, CliStructuredError>> {\n const eol = options.eol ?? EOL;\n\n let config: Awaited<ReturnType<typeof loadConfig>>;\n try {\n config = await loadConfig(options.configPath);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n }\n\n const source = config.contract?.source;\n if (source?.sourceFormat !== 'psl') {\n return ok({ formatted: false });\n }\n\n const inputPath = source.inputs?.[0];\n if (inputPath === undefined) {\n return ok({ formatted: false });\n }\n\n let contents: string;\n try {\n contents = await readFile(inputPath, 'utf-8');\n } catch (error) {\n return notOk(\n errorRuntime('Failed to read contract source file', {\n why: error instanceof Error ? error.message : String(error),\n fix: `Check that ${inputPath} exists and is readable.`,\n }),\n );\n }\n\n const formatOptions: FormatOptions = {\n indent: config.formatter?.indent ?? 2,\n newline: resolveNewline(config.formatter?.newline, eol),\n };\n\n let formatted: string;\n try {\n formatted = format(contents, formatOptions);\n } catch (error) {\n if (error instanceof PslFormatError) {\n return notOk(\n errorRuntime('Cannot format PSL with parse errors', {\n why: error.message,\n fix: 'Fix the parse errors in your schema and try again.',\n meta: { diagnostics: error.diagnostics },\n }),\n );\n }\n return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n }\n\n try {\n await writeFile(inputPath, formatted, 'utf-8');\n } catch (error) {\n return notOk(\n errorRuntime('Failed to write formatted contract source file', {\n why: error instanceof Error ? error.message : String(error),\n fix: `Check that ${inputPath} is writable.`,\n }),\n );\n }\n\n return ok({ formatted: true, path: inputPath });\n}\n","import { ifDefined } from '@prisma-next/utils/defined';\nimport { Command } from 'commander';\nimport { relative, resolve } from 'pathe';\nimport { executeFormat } from '../control-api/operations/format';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI } from '../utils/terminal-ui';\n\ninterface FormatCommandOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport function createFormatCommand(): Command {\n const command = new Command('format');\n setCommandDescriptions(\n command,\n 'Format your PSL contract source',\n 'Formats the Prisma schema (PSL) contract source declared in your config\\n' +\n '(contract.source.inputs[0]) in place. Only runs when contract.source.sourceFormat\\n' +\n \"is 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\\n\" +\n 'read from the optional formatter config section, defaulting to two spaces and the\\n' +\n 'system newline.',\n );\n setCommandExamples(command, [\n 'prisma-next format',\n 'prisma-next format --config ./custom-config.ts',\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (options: FormatCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n\n if (!flags.json && !flags.quiet) {\n const displayConfigPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n ui.stderr(\n formatStyledHeader({\n command: 'format',\n description: 'Format your PSL contract source',\n details: [{ label: 'config', value: displayConfigPath }],\n flags,\n }),\n );\n }\n\n const result = await executeFormat({ ...ifDefined('configPath', options.config) });\n\n const exitCode = handleResult(result, flags, ui, (value) => {\n if (flags.json) {\n ui.output(JSON.stringify(value));\n return;\n }\n if (flags.quiet) {\n return;\n }\n if (value.formatted) {\n ui.success(`Formatted ${relative(process.cwd(), value.path ?? '')}`);\n } else {\n ui.info('Nothing to format (contract source is not PSL).');\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as errorConfigValidation } from "./command-helpers-
|
|
1
|
+
import { R as errorConfigValidation } from "./command-helpers-Cpq44aVa.mjs";
|
|
2
2
|
import "@prisma-next/framework-components/components";
|
|
3
3
|
//#region src/utils/framework-components.ts
|
|
4
4
|
/**
|
|
@@ -55,4 +55,4 @@ function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId,
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { assertFrameworkComponentsCompatible as t };
|
|
57
57
|
|
|
58
|
-
//# sourceMappingURL=framework-components-
|
|
58
|
+
//# sourceMappingURL=framework-components-CnbUbiJw.mjs.map
|
package/dist/{framework-components-BbnM1RYm.mjs.map → framework-components-CnbUbiJw.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-components-
|
|
1
|
+
{"version":3,"file":"framework-components-CnbUbiJw.mjs","names":[],"sources":["../src/utils/framework-components.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport {\n checkContractComponentRequirements,\n type TargetBoundComponentDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { errorConfigValidation, errorContractMissingExtensionPacks } from './cli-errors';\n\n/**\n * Asserts that all framework components are compatible with the expected family and target.\n *\n * This function validates that each component in the framework components array:\n * - Has kind 'target', 'adapter', 'extension', or 'driver'\n * - Has familyId matching expectedFamilyId\n * - Has targetId matching expectedTargetId\n *\n * This validation happens at the CLI composition boundary, before passing components\n * to typed planner/runner instances. It fills the gap between runtime validation\n * (via `validateConfig()`) and compile-time type enforcement.\n *\n * @param expectedFamilyId - The expected family ID (e.g., 'sql')\n * @param expectedTargetId - The expected target ID (e.g., 'postgres')\n * @param frameworkComponents - Array of framework components to validate\n * @returns The same array typed as TargetBoundComponentDescriptor\n * @throws CliStructuredError if any component is incompatible\n *\n * @example\n * ```ts\n * const config = await loadConfig();\n * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];\n *\n * // Validate and type-narrow components before passing to planner\n * const typedComponents = assertFrameworkComponentsCompatible(\n * config.family.familyId,\n * config.target.targetId,\n * frameworkComponents\n * );\n *\n * const planner = target.migrations.createPlanner(familyInstance);\n * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n * ```\n */\nexport function assertFrameworkComponentsCompatible<\n TFamilyId extends string,\n TTargetId extends string,\n>(\n expectedFamilyId: TFamilyId,\n expectedTargetId: TTargetId,\n frameworkComponents: ReadonlyArray<unknown>,\n): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>> {\n for (let i = 0; i < frameworkComponents.length; i++) {\n const component = frameworkComponents[i];\n\n // Check that component is an object\n if (typeof component !== 'object' || component === null) {\n throw errorConfigValidation('frameworkComponents[]', {\n why: `Framework component at index ${i} must be an object`,\n });\n }\n\n const record = component as Record<string, unknown>;\n\n // Check kind\n if (!Object.hasOwn(record, 'kind')) {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} must have 'kind' property`,\n });\n }\n\n const kind = record['kind'];\n if (kind !== 'target' && kind !== 'adapter' && kind !== 'extension' && kind !== 'driver') {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')`,\n });\n }\n\n // Check familyId\n if (!Object.hasOwn(record, 'familyId')) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property`,\n });\n }\n\n const familyId = record['familyId'];\n if (familyId !== expectedFamilyId) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'`,\n });\n }\n\n // Check targetId\n if (!Object.hasOwn(record, 'targetId')) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property`,\n });\n }\n\n const targetId = record['targetId'];\n if (targetId !== expectedTargetId) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'`,\n });\n }\n }\n\n // Type assertion is safe because we've validated all components above\n return frameworkComponents as ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;\n}\n\n/**\n * Validates that a contract is compatible with the configured target, adapter,\n * and extension packs. Throws on family/target mismatches or missing extension packs.\n *\n * This check ensures the emitted contract matches the CLI config before running\n * commands that depend on the contract (e.g., db verify, db sign).\n *\n * @param contract - The contract to validate (must include targetFamily, target, extensionPacks).\n * @param stack - The control plane stack (target, adapter, driver, extensionPacks).\n *\n * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target\n * doesn't match the configured family/target.\n * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires\n * extension packs that are not provided in the config (includes all missing packs in error.meta).\n *\n * @example\n * ```ts\n * import { assertContractRequirementsSatisfied } from './framework-components';\n *\n * const config = await loadConfig();\n * const contract = await loadContractJson(config.contract.output);\n * const stack = createControlStack({ family: config.family, target: config.target, adapter: config.adapter, ... });\n *\n * // Throws if contract is incompatible with config\n * assertContractRequirementsSatisfied({ contract, stack });\n * ```\n */\nexport function assertContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n stack,\n}: {\n readonly contract: Pick<Contract, 'targetFamily' | 'target' | 'extensionPacks'>;\n readonly stack: ControlStack<TFamilyId, TTargetId>;\n}): void {\n const providedComponentIds = new Set<string>([\n stack.target.id,\n ...(stack.adapter ? [stack.adapter.id] : []),\n ]);\n for (const extension of stack.extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetFamily: stack.target.familyId,\n expectedTargetId: stack.target.targetId,\n providedComponentIds,\n });\n\n if (result.familyMismatch) {\n throw errorConfigValidation('contract.targetFamily', {\n why: `Contract was emitted for family '${result.familyMismatch.actual}' but CLI config is wired to '${result.familyMismatch.expected}'.`,\n });\n }\n\n if (result.targetMismatch) {\n throw errorConfigValidation('contract.target', {\n why: `Contract target '${result.targetMismatch.actual}' does not match CLI target '${result.targetMismatch.expected}'.`,\n });\n }\n\n if (result.missingExtensionPackIds.length > 0) {\n throw errorContractMissingExtensionPacks({\n missingExtensionPacks: result.missingExtensionPackIds,\n providedComponentIds: [...providedComponentIds],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oCAId,kBACA,kBACA,qBACqE;CACrE,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACnD,MAAM,YAAY,oBAAoB;EAGtC,IAAI,OAAO,cAAc,YAAY,cAAc,MACjD,MAAM,sBAAsB,yBAAyB,EACnD,KAAK,gCAAgC,EAAE,oBACzC,CAAC;EAGH,MAAM,SAAS;EAGf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAC/B,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,4BACzC,CAAC;EAGH,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAC9E,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAC3E,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;EAIH,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GACnC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAChE,CAAC;EAGH,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GACtI,CAAC;CAEL;CAGA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-flags-BpoOYtNZ.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY
|
|
1
|
+
{"version":3,"file":"global-flags-BpoOYtNZ.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";KAMY;UAEK;WACN,QAAQ;WACR;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;UAOM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as CliStructuredError, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from "./command-helpers-
|
|
1
|
+
import { F as CliStructuredError, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from "./command-helpers-Cpq44aVa.mjs";
|
|
2
2
|
import { a as starterSchema, c as version, i as schemaSample, n as dbFile, o as targetLabel, r as defaultSchemaPath, s as targetPackageName, t as configFile } from "./cli.mjs";
|
|
3
3
|
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-mEQ74_nd.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -182,8 +182,7 @@ function stripQuotes(value) {
|
|
|
182
182
|
* the user was never given the choice — `--force` is the contract.
|
|
183
183
|
*/
|
|
184
184
|
function errorInitReinitNeedsForce() {
|
|
185
|
-
return new CliStructuredError("
|
|
186
|
-
domain: "CLI",
|
|
185
|
+
return new CliStructuredError("CLI.INIT_REINIT_NEEDS_FORCE", "Project is already initialized", {
|
|
187
186
|
why: "A `prisma-next.config.ts` already exists in this directory. Re-running `init` would overwrite the scaffolded files; in non-interactive mode `init` will not do that without `--force`.",
|
|
188
187
|
fix: "Pass `--force` to overwrite the existing scaffold, or run `init` interactively to confirm.",
|
|
189
188
|
docsUrl: "https://prisma-next.dev/docs/cli/init"
|
|
@@ -208,8 +207,7 @@ function errorInitMissingFlags(options) {
|
|
|
208
207
|
default: return `--${flag} <value>`;
|
|
209
208
|
}
|
|
210
209
|
}).join(" ");
|
|
211
|
-
return new CliStructuredError("
|
|
212
|
-
domain: "CLI",
|
|
210
|
+
return new CliStructuredError("CLI.INIT_MISSING_FLAGS", "Missing required flags", {
|
|
213
211
|
why: `${options.why} Missing required flag(s): ${flagList}.`,
|
|
214
212
|
fix: `Re-run with the missing flag(s) supplied, e.g. \`prisma-next init --yes ${fixList}\`. Use \`prisma-next init --help\` to see every flag.`,
|
|
215
213
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -221,8 +219,7 @@ function errorInitMissingFlags(options) {
|
|
|
221
219
|
* allowed values in `meta` for machine-readable consumption.
|
|
222
220
|
*/
|
|
223
221
|
function errorInitInvalidFlagValue(options) {
|
|
224
|
-
return new CliStructuredError("
|
|
225
|
-
domain: "CLI",
|
|
222
|
+
return new CliStructuredError("CLI.INIT_INVALID_FLAG_VALUE", `Invalid value for --${options.flag}`, {
|
|
226
223
|
why: `\`--${options.flag} ${options.value}\` is not one of: ${options.allowed.join(", ")}.`,
|
|
227
224
|
fix: `Use one of: ${options.allowed.map((v) => `--${options.flag} ${v}`).join(", ")}.`,
|
|
228
225
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -240,8 +237,7 @@ function errorInitInvalidFlagValue(options) {
|
|
|
240
237
|
*/
|
|
241
238
|
function errorInitAuthoringSchemaPathMismatch(options) {
|
|
242
239
|
const expectedAuthoring = options.expectedExtension === ".ts" ? "typescript" : "psl";
|
|
243
|
-
return new CliStructuredError("
|
|
244
|
-
domain: "CLI",
|
|
240
|
+
return new CliStructuredError("CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH", "Authoring and schema path do not match", {
|
|
245
241
|
why: `\`--authoring ${options.authoring}\` requires a schema file ending in ${options.expectedExtension}, but \`--schema-path ${options.schemaPath}\` ends in ${options.actualExtension}.`,
|
|
246
242
|
fix: `Use a matching pair, for example \`--authoring ${expectedAuthoring} --schema-path <path>${options.expectedExtension}\`, or change \`--authoring\` to match the path you supplied. You can also omit \`--schema-path\` to use the default for the chosen authoring.`,
|
|
247
243
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -261,8 +257,7 @@ function errorInitAuthoringSchemaPathMismatch(options) {
|
|
|
261
257
|
* 3 (USER_ABORTED).
|
|
262
258
|
*/
|
|
263
259
|
function errorInitUserAborted() {
|
|
264
|
-
return new CliStructuredError("
|
|
265
|
-
domain: "CLI",
|
|
260
|
+
return new CliStructuredError("CLI.INIT_USER_ABORTED", "Init cancelled", {
|
|
266
261
|
why: "The interactive prompt was cancelled before all required inputs were supplied. No files were modified.",
|
|
267
262
|
fix: "Re-run `prisma-next init` and complete the prompts, or pass the required inputs as flags (see `--help`) for a non-interactive run.",
|
|
268
263
|
severity: "info"
|
|
@@ -277,8 +272,7 @@ function errorInitUserAborted() {
|
|
|
277
272
|
* mode is supposed to prevent.
|
|
278
273
|
*/
|
|
279
274
|
function errorInitStrictProbeWithoutProbe() {
|
|
280
|
-
return new CliStructuredError("
|
|
281
|
-
domain: "CLI",
|
|
275
|
+
return new CliStructuredError("CLI.INIT_STRICT_PROBE_WITHOUT_PROBE", "`--strict-probe` requires `--probe-db`", {
|
|
282
276
|
why: "`--strict-probe` only changes how a *failed* probe is reported; without `--probe-db` no probe is attempted in the first place. (`init` is offline-by-default — it never opens a connection to your database without explicit consent.)",
|
|
283
277
|
fix: "Add `--probe-db` to opt in to the probe, or drop `--strict-probe` if you do not need the version check.",
|
|
284
278
|
docsUrl: "https://prisma-next.dev/docs/cli/init"
|
|
@@ -293,8 +287,7 @@ function errorInitStrictProbeWithoutProbe() {
|
|
|
293
287
|
*/
|
|
294
288
|
function errorInitInstallFailed(options) {
|
|
295
289
|
const trimmed = options.stderrLines.map((s) => s.trim()).filter(Boolean);
|
|
296
|
-
return new CliStructuredError("
|
|
297
|
-
domain: "CLI",
|
|
290
|
+
return new CliStructuredError("CLI.INIT_INSTALL_FAILED", "Failed to install dependencies", {
|
|
298
291
|
why: trimmed.length === 0 ? "The package manager exited with an error and no recoverable fallback applied." : `The package manager exited with: ${trimmed[0]}`,
|
|
299
292
|
fix: `Install manually:\n ${options.addCommand}\n ${options.addDevCommand}\nThen run \`${options.emitCommand}\` to emit the contract.`,
|
|
300
293
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -316,8 +309,7 @@ function errorInitInstallFailed(options) {
|
|
|
316
309
|
* and re-run.
|
|
317
310
|
*/
|
|
318
311
|
function errorInitInvalidManifest(options) {
|
|
319
|
-
return new CliStructuredError("
|
|
320
|
-
domain: "CLI",
|
|
312
|
+
return new CliStructuredError("CLI.INIT_INVALID_MANIFEST", `Failed to parse ${options.path}`, {
|
|
321
313
|
why: `\`${options.path}\` is not valid JSON: ${options.cause}`,
|
|
322
314
|
fix: `Fix the JSON syntax in \`${options.path}\` (a missing comma or unbalanced brace is the most common cause), then re-run \`prisma-next init\`.`,
|
|
323
315
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -342,8 +334,7 @@ function errorInitInvalidManifest(options) {
|
|
|
342
334
|
* re-run.
|
|
343
335
|
*/
|
|
344
336
|
function errorInitInvalidTsconfig(options) {
|
|
345
|
-
return new CliStructuredError("
|
|
346
|
-
domain: "CLI",
|
|
337
|
+
return new CliStructuredError("CLI.INIT_INVALID_TSCONFIG", `Failed to parse ${options.path}`, {
|
|
347
338
|
why: `\`${options.path}\` is not valid JSON or JSONC: ${options.cause}`,
|
|
348
339
|
fix: `Fix the syntax in \`${options.path}\` and re-run \`prisma-next init\`. \`init\` accepts JSONC (comments and trailing commas) but cannot recover from unbalanced braces or missing commas.`,
|
|
349
340
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -368,8 +359,7 @@ function errorInitInvalidTsconfig(options) {
|
|
|
368
359
|
* carries `filesWritten` so a follow-up agent can resume manually.
|
|
369
360
|
*/
|
|
370
361
|
function errorInitProbeFailed(options) {
|
|
371
|
-
return new CliStructuredError("
|
|
372
|
-
domain: "CLI",
|
|
362
|
+
return new CliStructuredError("CLI.INIT_PROBE_FAILED", "Database probe failed", {
|
|
373
363
|
why: `\`--probe-db\` could not complete and \`--strict-probe\` was set: ${options.cause}`,
|
|
374
364
|
fix: "Confirm `DATABASE_URL` points at a reachable server, or drop `--strict-probe` to treat probe failures as warnings.",
|
|
375
365
|
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
@@ -386,8 +376,7 @@ function errorInitProbeFailed(options) {
|
|
|
386
376
|
* `5 = EMIT_FAILED`.
|
|
387
377
|
*/
|
|
388
378
|
function errorInitEmitFailed(options) {
|
|
389
|
-
return new CliStructuredError("
|
|
390
|
-
domain: "CLI",
|
|
379
|
+
return new CliStructuredError("CLI.INIT_EMIT_FAILED", "Failed to emit contract", {
|
|
391
380
|
why: `\`prisma-next contract emit\` failed: ${options.cause}`,
|
|
392
381
|
fix: `Inspect your contract file, fix the underlying issue, then re-run \`${options.emitCommand}\`. Pass \`-v\` for the full error envelope.`,
|
|
393
382
|
docsUrl: "https://prisma-next.dev/docs/cli/contract-emit",
|
|
@@ -409,8 +398,7 @@ function errorInitEmitFailed(options) {
|
|
|
409
398
|
* semantics. Maps to exit code `6 = SKILL_INSTALL_FAILED`.
|
|
410
399
|
*/
|
|
411
400
|
function errorInitSkillInstallFailed(options) {
|
|
412
|
-
return new CliStructuredError("
|
|
413
|
-
domain: "CLI",
|
|
401
|
+
return new CliStructuredError("CLI.INIT_SKILL_INSTALL_FAILED", "Failed to install Prisma Next skills", {
|
|
414
402
|
why: `\`${options.skillInstallCommand}\` exited with an error: ${options.cause}`,
|
|
415
403
|
fix: `Either:
|
|
416
404
|
- Re-run \`prisma-next init --no-skill${options.filesWritten.length > 0 ? " --force" : ""}\` to skip the skill install for this run, or\n - Fix the underlying issue (network, npm registry, \`npx skills\` on PATH) and install manually:\n ${options.skillInstallCommand}`,
|
|
@@ -1880,8 +1868,7 @@ async function runInit(baseDir, runOptions) {
|
|
|
1880
1868
|
warnings
|
|
1881
1869
|
};
|
|
1882
1870
|
const validated = InitOutputSchema(output);
|
|
1883
|
-
if (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError("
|
|
1884
|
-
domain: "CLI",
|
|
1871
|
+
if (validated instanceof Error || validated.problems !== void 0) return emitError(ui, flags, new CliStructuredError("CLI.INIT_INVALID_OUTPUT_DOCUMENT", "Init produced an invalid output document", {
|
|
1885
1872
|
why: `The success document failed schema validation: ${String(validated)}`,
|
|
1886
1873
|
fix: "This is a bug in prisma-next. Please report it with the full `-v` output.",
|
|
1887
1874
|
docsUrl: "https://prisma-next.dev/docs/cli/init"
|
|
@@ -1910,10 +1897,10 @@ function emitError(ui, flags, error) {
|
|
|
1910
1897
|
* Maps a structured init error to its documented exit code. Centralised so
|
|
1911
1898
|
* the error → exit-code contract lives next to the codes themselves.
|
|
1912
1899
|
*
|
|
1913
|
-
* `
|
|
1914
|
-
* `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next
|
|
1915
|
-
* user did not cause — surfacing them as `PRECONDITION` would
|
|
1916
|
-
* automation into thinking the caller mis-invoked the CLI.
|
|
1900
|
+
* `CLI.INIT_INVALID_OUTPUT_DOCUMENT` (and the unknown-code default branch)
|
|
1901
|
+
* routes to `INIT_EXIT_INTERNAL_ERROR` because those represent prisma-next
|
|
1902
|
+
* bugs the user did not cause — surfacing them as `PRECONDITION` would
|
|
1903
|
+
* mislead automation into thinking the caller mis-invoked the CLI.
|
|
1917
1904
|
*
|
|
1918
1905
|
* See [exit-codes.ts](./exit-codes.ts) for the canonical list and
|
|
1919
1906
|
* [Style Guide § Exit Codes](../../../../../../../docs/CLI%20Style%20Guide.md#exit-codes)
|
|
@@ -1924,19 +1911,19 @@ function emitError(ui, flags, error) {
|
|
|
1924
1911
|
*/
|
|
1925
1912
|
function exitCodeForError(error) {
|
|
1926
1913
|
switch (error.code) {
|
|
1927
|
-
case "
|
|
1928
|
-
case "
|
|
1929
|
-
case "
|
|
1930
|
-
case "
|
|
1931
|
-
case "
|
|
1932
|
-
case "
|
|
1933
|
-
case "
|
|
1934
|
-
case "
|
|
1935
|
-
case "
|
|
1936
|
-
case "
|
|
1937
|
-
case "
|
|
1938
|
-
case "
|
|
1939
|
-
case "
|
|
1914
|
+
case "CLI.INIT_REINIT_NEEDS_FORCE":
|
|
1915
|
+
case "CLI.INIT_MISSING_FLAGS":
|
|
1916
|
+
case "CLI.INIT_INVALID_FLAG_VALUE":
|
|
1917
|
+
case "CLI.INIT_STRICT_PROBE_WITHOUT_PROBE":
|
|
1918
|
+
case "CLI.INIT_INVALID_MANIFEST":
|
|
1919
|
+
case "CLI.INIT_INVALID_TSCONFIG":
|
|
1920
|
+
case "CLI.INIT_PROBE_FAILED":
|
|
1921
|
+
case "CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH": return 2;
|
|
1922
|
+
case "CLI.INIT_USER_ABORTED": return 3;
|
|
1923
|
+
case "CLI.INIT_INSTALL_FAILED": return 4;
|
|
1924
|
+
case "CLI.INIT_EMIT_FAILED": return 5;
|
|
1925
|
+
case "CLI.INIT_INVALID_OUTPUT_DOCUMENT": return 1;
|
|
1926
|
+
case "CLI.INIT_SKILL_INSTALL_FAILED": return 6;
|
|
1940
1927
|
default: return 1;
|
|
1941
1928
|
}
|
|
1942
1929
|
}
|
|
@@ -2153,7 +2140,7 @@ async function runEmit(ctx) {
|
|
|
2153
2140
|
const spinner = ctx.ui.spinner();
|
|
2154
2141
|
spinner.start("Emitting contract...");
|
|
2155
2142
|
try {
|
|
2156
|
-
const { executeContractEmit } = await import("./contract-emit-
|
|
2143
|
+
const { executeContractEmit } = await import("./contract-emit-cJQBlvGb.mjs").then((n) => n.t);
|
|
2157
2144
|
await executeContractEmit({ configPath: join(ctx.baseDir, "prisma-next.config.ts") });
|
|
2158
2145
|
spinner.stop("Contract emitted");
|
|
2159
2146
|
} catch (err) {
|
|
@@ -2206,4 +2193,4 @@ function sanitisePackageName(raw) {
|
|
|
2206
2193
|
//#endregion
|
|
2207
2194
|
export { runInit };
|
|
2208
2195
|
|
|
2209
|
-
//# sourceMappingURL=init-
|
|
2196
|
+
//# sourceMappingURL=init-C3JhkHg-.mjs.map
|