@prisma-next/errors
Advanced tools
+22
-26
@@ -24,5 +24,22 @@ import { r as CliStructuredError } from "./control-M7-bPTyk.mjs"; | ||
| /** | ||
| * A `dataTransform(endContract, …)` factory was handed a `SqlQueryPlan` whose | ||
| * `meta.storageHash` does not match the `endContract.storage.storageHash` it | ||
| * was configured with. This almost always means the user's query-builder | ||
| * (`sql({ context: createExecutionContext({ contract: endContract, … }) })`) | ||
| * was instantiated from a different contract reference than the one passed | ||
| * to `dataTransform(endContract, …)`. | ||
| * | ||
| * Distinct from `runtimeError('PLAN.HASH_MISMATCH', …)` (`PN-RUN-*`) which | ||
| * rejects a plan at runtime execution; this is an authoring-time rejection | ||
| * so it lives in the `MIG` namespace. | ||
| */ | ||
| declare function errorDataTransformContractMismatch(options: { | ||
| readonly dataTransformName: string; | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| }): CliStructuredError; | ||
| /** | ||
| * `migration.ts` was expected at the given package directory but could not be | ||
| * located. Thrown by `emitMigration` (and, as a belt-and-suspenders, by | ||
| * class-flow `emit` capabilities) when the file is missing. | ||
| * located. Thrown when consumers attempt to read a migration package that is | ||
| * missing its source file. | ||
| */ | ||
@@ -41,29 +58,8 @@ declare function errorMigrationFileMissing(dir: string): CliStructuredError; | ||
| /** | ||
| * A class-flow `Migration.operations` getter returned a value that is not an | ||
| * array. Used by class-flow emit capabilities after instantiating the | ||
| * authored migration. | ||
| * A `Migration.operations` getter returned a value that is not an array. Used | ||
| * by emit capabilities after instantiating the authored migration. | ||
| */ | ||
| declare function errorMigrationPlanNotArray(dir: string, actualValueDescription?: string): CliStructuredError; | ||
| /** | ||
| * A target's migrations capability registers neither `resolveDescriptors` | ||
| * (descriptor flow) nor `emit` (class flow). Surfaced by the strategy | ||
| * selector when it is unable to choose a flow for the target. This is an | ||
| * internal wiring error: every migration-supporting target must implement | ||
| * exactly one of the two flows. | ||
| */ | ||
| declare function errorTargetHasIncompleteMigrationCapabilities(options: { | ||
| readonly targetId: string; | ||
| }): CliStructuredError; | ||
| /** | ||
| * A migration plan was asked to render itself back to TypeScript but the | ||
| * target does not support authoring-surface rendering. Thrown by Postgres's | ||
| * descriptor-flow plan when `renderTypeScript()` is invoked (the CLI only | ||
| * calls it in the class-flow branch of `migration plan`, so this acts as a | ||
| * safety rail rather than a user-visible error in normal use). | ||
| */ | ||
| declare function errorPlanDoesNotSupportAuthoringSurface(options: { | ||
| readonly targetId: string; | ||
| }): CliStructuredError; | ||
| //#endregion | ||
| export { errorMigrationFileMissing, errorMigrationInvalidDefaultExport, errorMigrationPlanNotArray, errorPlanDoesNotSupportAuthoringSurface, errorTargetHasIncompleteMigrationCapabilities, errorUnfilledPlaceholder, placeholder }; | ||
| export { errorDataTransformContractMismatch, errorMigrationFileMissing, errorMigrationInvalidDefaultExport, errorMigrationPlanNotArray, errorUnfilledPlaceholder, placeholder }; | ||
| //# sourceMappingURL=migration.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"migration.d.mts","names":[],"sources":["../src/migration.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;AAkBA;AASA;AAkBA;AAuBA;AAyBgB,iBA7FA,wBAAA,CA6FA,IAA6C,EAAA,MAAA,CAAA,EA7FL,kBA+FpD;AAgBJ;;;;;;;;;iBA7FgB,WAAA;;;;;;iBASA,yBAAA,eAAwC;;;;;;;;;;iBAkBxC,kCAAA,iDAGb;;;;;;iBAoBa,0BAAA,gDAGb;;;;;;;;iBAsBa,6CAAA;;IAEZ;;;;;;;;iBAgBY,uCAAA;;IAEZ"} | ||
| {"version":3,"file":"migration.d.mts","names":[],"sources":["../src/migration.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;AAkBA;AAgBA;AAsBA;AAkBA;AAsBgB,iBAhGA,wBAAA,CAmGb,IAAA,EAAA,MAAA,CAAA,EAnGqD,kBAmGnC;;;;;;;;;;iBAjFL,WAAA;;;;;;;;;;;;;iBAgBA,kCAAA;;;;IAIZ;;;;;;iBAkBY,yBAAA,eAAwC;;;;;;;;;;iBAkBxC,kCAAA,iDAGb;;;;;iBAmBa,0BAAA,gDAGb"} |
+29
-36
@@ -32,5 +32,29 @@ import { t as CliStructuredError } from "./control-CjD1SB2D.mjs"; | ||
| /** | ||
| * A `dataTransform(endContract, …)` factory was handed a `SqlQueryPlan` whose | ||
| * `meta.storageHash` does not match the `endContract.storage.storageHash` it | ||
| * was configured with. This almost always means the user's query-builder | ||
| * (`sql({ context: createExecutionContext({ contract: endContract, … }) })`) | ||
| * was instantiated from a different contract reference than the one passed | ||
| * to `dataTransform(endContract, …)`. | ||
| * | ||
| * Distinct from `runtimeError('PLAN.HASH_MISMATCH', …)` (`PN-RUN-*`) which | ||
| * rejects a plan at runtime execution; this is an authoring-time rejection | ||
| * so it lives in the `MIG` namespace. | ||
| */ | ||
| function errorDataTransformContractMismatch(options) { | ||
| return new CliStructuredError("2005", "dataTransform query plan built against wrong contract", { | ||
| domain: "MIG", | ||
| why: `Data transform "${options.dataTransformName}" produced a query plan whose storage hash (${options.actual}) does not match the migration's contract (${options.expected}). The query builder was configured with a different contract than the one passed to dataTransform(endContract, ...).`, | ||
| fix: "Ensure the `endContract` imported at module scope (used for both `dataTransform(endContract, …)` and `sql({ context: createExecutionContext({ contract: endContract, … }) })`) is the same reference.", | ||
| meta: { | ||
| dataTransformName: options.dataTransformName, | ||
| expected: options.expected, | ||
| actual: options.actual | ||
| } | ||
| }); | ||
| } | ||
| /** | ||
| * `migration.ts` was expected at the given package directory but could not be | ||
| * located. Thrown by `emitMigration` (and, as a belt-and-suspenders, by | ||
| * class-flow `emit` capabilities) when the file is missing. | ||
| * located. Thrown when consumers attempt to read a migration package that is | ||
| * missing its source file. | ||
| */ | ||
@@ -66,5 +90,4 @@ function errorMigrationFileMissing(dir) { | ||
| /** | ||
| * A class-flow `Migration.operations` getter returned a value that is not an | ||
| * array. Used by class-flow emit capabilities after instantiating the | ||
| * authored migration. | ||
| * A `Migration.operations` getter returned a value that is not an array. Used | ||
| * by emit capabilities after instantiating the authored migration. | ||
| */ | ||
@@ -82,35 +105,5 @@ function errorMigrationPlanNotArray(dir, actualValueDescription) { | ||
| } | ||
| /** | ||
| * A target's migrations capability registers neither `resolveDescriptors` | ||
| * (descriptor flow) nor `emit` (class flow). Surfaced by the strategy | ||
| * selector when it is unable to choose a flow for the target. This is an | ||
| * internal wiring error: every migration-supporting target must implement | ||
| * exactly one of the two flows. | ||
| */ | ||
| function errorTargetHasIncompleteMigrationCapabilities(options) { | ||
| return new CliStructuredError("2011", "Target migrations capability is incomplete", { | ||
| domain: "MIG", | ||
| why: `Target "${options.targetId}" registers a migrations capability but implements neither \`resolveDescriptors\` (descriptor flow) nor \`emit\` (class flow); the CLI cannot choose an authoring strategy.`, | ||
| fix: "This is an internal wiring error. Report it — the target descriptor must implement exactly one of the two migration flows.", | ||
| meta: { targetId: options.targetId } | ||
| }); | ||
| } | ||
| /** | ||
| * A migration plan was asked to render itself back to TypeScript but the | ||
| * target does not support authoring-surface rendering. Thrown by Postgres's | ||
| * descriptor-flow plan when `renderTypeScript()` is invoked (the CLI only | ||
| * calls it in the class-flow branch of `migration plan`, so this acts as a | ||
| * safety rail rather than a user-visible error in normal use). | ||
| */ | ||
| function errorPlanDoesNotSupportAuthoringSurface(options) { | ||
| return new CliStructuredError("2010", "Migration plan does not support TypeScript authoring surface", { | ||
| domain: "MIG", | ||
| why: `Target "${options.targetId}" produced a descriptor-flow plan; descriptor-flow plans cannot be rendered back to TypeScript via renderTypeScript().`, | ||
| fix: "This is an internal wiring error. Report it — the CLI should route descriptor-flow targets through renderDescriptorTypeScript, not renderTypeScript.", | ||
| meta: { targetId: options.targetId } | ||
| }); | ||
| } | ||
| //#endregion | ||
| export { errorMigrationFileMissing, errorMigrationInvalidDefaultExport, errorMigrationPlanNotArray, errorPlanDoesNotSupportAuthoringSurface, errorTargetHasIncompleteMigrationCapabilities, errorUnfilledPlaceholder, placeholder }; | ||
| export { errorDataTransformContractMismatch, errorMigrationFileMissing, errorMigrationInvalidDefaultExport, errorMigrationPlanNotArray, errorUnfilledPlaceholder, placeholder }; | ||
| //# sourceMappingURL=migration.mjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"migration.mjs","names":[],"sources":["../src/migration.ts"],"sourcesContent":["import { CliStructuredError } from './control';\n\n// ============================================================================\n// Migration Errors (PN-MIG-2000-2999)\n//\n// Errors raised by the migration subsystem (authoring, planning, emit).\n// Domain `MIG` distinguishes these from generic application runtime errors\n// (`RUN`) and from CLI argument/config errors (`CLI`). See\n// `docs/CLI Style Guide.md` for the canonical domain taxonomy.\n// ============================================================================\n\n/**\n * A scaffolded migration contains a placeholder slot that was never filled in.\n *\n * Thrown at emit time (when `check.source()` or `run()` is invoked) via the\n * `placeholder(...)` utility. The `slot` identifies the exact location the\n * author still needs to edit, e.g. `\"backfill-product-status:check.source\"`.\n */\nexport function errorUnfilledPlaceholder(slot: string): CliStructuredError {\n return new CliStructuredError('2001', 'Unfilled migration placeholder', {\n domain: 'MIG',\n why: `The migration contains a placeholder that has not been filled in: ${slot}`,\n fix: 'Open migration.ts and replace the `placeholder(...)` call with your actual query.',\n meta: { slot },\n });\n}\n\n/**\n * Scaffolded `migration.ts` files call this wherever the scaffolder couldn't\n * emit a real query and the author is expected to fill one in. Always throws\n * a structured migration error (`PN-MIG-2001`).\n *\n * The return type `never` makes it assignable to any expected return type, so\n * a scaffolded `() => placeholder('...')` satisfies signatures like\n * `() => MongoQueryPlan` without polluting them with a sentinel union arm.\n */\nexport function placeholder(slot: string): never {\n throw errorUnfilledPlaceholder(slot);\n}\n\n/**\n * `migration.ts` was expected at the given package directory but could not be\n * located. Thrown by `emitMigration` (and, as a belt-and-suspenders, by\n * class-flow `emit` capabilities) when the file is missing.\n */\nexport function errorMigrationFileMissing(dir: string): CliStructuredError {\n return new CliStructuredError('2002', 'migration.ts not found', {\n domain: 'MIG',\n why: `No migration.ts file was found at \"${dir}\"`,\n fix: 'Scaffold one with `prisma-next migration new` or `prisma-next migration plan`.',\n meta: { dir },\n });\n}\n\n/**\n * The `migration.ts` at the given package directory does not default-export a\n * valid migration shape. Two shapes are accepted: a `Migration` subclass, or a\n * factory function returning a `MigrationPlan`-shaped object (with at least\n * an `operations` array, plus `targetId` and `destination`). Thrown when the\n * default export is missing, is not a constructor/function, does not extend\n * `Migration`, or (for factory functions) returns a value that is not\n * `MigrationPlan`-shaped.\n */\nexport function errorMigrationInvalidDefaultExport(\n dir: string,\n actualExportDescription?: string,\n): CliStructuredError {\n return new CliStructuredError('2003', 'migration.ts default export is not a valid migration', {\n domain: 'MIG',\n why:\n actualExportDescription !== undefined\n ? `migration.ts at \"${dir}\" must default-export a Migration subclass or a factory function returning a MigrationPlan-shaped object; got ${actualExportDescription}`\n : `migration.ts at \"${dir}\" must default-export a Migration subclass or a factory function returning a MigrationPlan-shaped object.`,\n fix: 'Use `export default class extends Migration { ... }` or `export default () => ({ targetId, destination, operations })`.',\n meta: {\n dir,\n ...(actualExportDescription !== undefined ? { actualExport: actualExportDescription } : {}),\n },\n });\n}\n\n/**\n * A class-flow `Migration.operations` getter returned a value that is not an\n * array. Used by class-flow emit capabilities after instantiating the\n * authored migration.\n */\nexport function errorMigrationPlanNotArray(\n dir: string,\n actualValueDescription?: string,\n): CliStructuredError {\n return new CliStructuredError('2004', 'Migration.operations must be an array of operations', {\n domain: 'MIG',\n why:\n actualValueDescription !== undefined\n ? `Migration.operations for migration.ts at \"${dir}\" was ${actualValueDescription}; an array of operations is required.`\n : `Migration.operations for migration.ts at \"${dir}\" is not an array of operations.`,\n fix: 'Ensure your `operations` getter returns an array of operations; see the data-migrations authoring guide.',\n meta: {\n dir,\n ...(actualValueDescription !== undefined ? { actualValue: actualValueDescription } : {}),\n },\n });\n}\n\n/**\n * A target's migrations capability registers neither `resolveDescriptors`\n * (descriptor flow) nor `emit` (class flow). Surfaced by the strategy\n * selector when it is unable to choose a flow for the target. This is an\n * internal wiring error: every migration-supporting target must implement\n * exactly one of the two flows.\n */\nexport function errorTargetHasIncompleteMigrationCapabilities(options: {\n readonly targetId: string;\n}): CliStructuredError {\n return new CliStructuredError('2011', 'Target migrations capability is incomplete', {\n domain: 'MIG',\n why: `Target \"${options.targetId}\" registers a migrations capability but implements neither \\`resolveDescriptors\\` (descriptor flow) nor \\`emit\\` (class flow); the CLI cannot choose an authoring strategy.`,\n fix: 'This is an internal wiring error. Report it — the target descriptor must implement exactly one of the two migration flows.',\n meta: { targetId: options.targetId },\n });\n}\n\n/**\n * A migration plan was asked to render itself back to TypeScript but the\n * target does not support authoring-surface rendering. Thrown by Postgres's\n * descriptor-flow plan when `renderTypeScript()` is invoked (the CLI only\n * calls it in the class-flow branch of `migration plan`, so this acts as a\n * safety rail rather than a user-visible error in normal use).\n */\nexport function errorPlanDoesNotSupportAuthoringSurface(options: {\n readonly targetId: string;\n}): CliStructuredError {\n return new CliStructuredError(\n '2010',\n 'Migration plan does not support TypeScript authoring surface',\n {\n domain: 'MIG',\n why: `Target \"${options.targetId}\" produced a descriptor-flow plan; descriptor-flow plans cannot be rendered back to TypeScript via renderTypeScript().`,\n fix: 'This is an internal wiring error. Report it — the CLI should route descriptor-flow targets through renderDescriptorTypeScript, not renderTypeScript.',\n meta: { targetId: options.targetId },\n },\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAgB,yBAAyB,MAAkC;AACzE,QAAO,IAAI,mBAAmB,QAAQ,kCAAkC;EACtE,QAAQ;EACR,KAAK,qEAAqE;EAC1E,KAAK;EACL,MAAM,EAAE,MAAM;EACf,CAAC;;;;;;;;;;;AAYJ,SAAgB,YAAY,MAAqB;AAC/C,OAAM,yBAAyB,KAAK;;;;;;;AAQtC,SAAgB,0BAA0B,KAAiC;AACzE,QAAO,IAAI,mBAAmB,QAAQ,0BAA0B;EAC9D,QAAQ;EACR,KAAK,sCAAsC,IAAI;EAC/C,KAAK;EACL,MAAM,EAAE,KAAK;EACd,CAAC;;;;;;;;;;;AAYJ,SAAgB,mCACd,KACA,yBACoB;AACpB,QAAO,IAAI,mBAAmB,QAAQ,wDAAwD;EAC5F,QAAQ;EACR,KACE,4BAA4B,SACxB,oBAAoB,IAAI,gHAAgH,4BACxI,oBAAoB,IAAI;EAC9B,KAAK;EACL,MAAM;GACJ;GACA,GAAI,4BAA4B,SAAY,EAAE,cAAc,yBAAyB,GAAG,EAAE;GAC3F;EACF,CAAC;;;;;;;AAQJ,SAAgB,2BACd,KACA,wBACoB;AACpB,QAAO,IAAI,mBAAmB,QAAQ,uDAAuD;EAC3F,QAAQ;EACR,KACE,2BAA2B,SACvB,6CAA6C,IAAI,QAAQ,uBAAuB,yCAChF,6CAA6C,IAAI;EACvD,KAAK;EACL,MAAM;GACJ;GACA,GAAI,2BAA2B,SAAY,EAAE,aAAa,wBAAwB,GAAG,EAAE;GACxF;EACF,CAAC;;;;;;;;;AAUJ,SAAgB,8CAA8C,SAEvC;AACrB,QAAO,IAAI,mBAAmB,QAAQ,8CAA8C;EAClF,QAAQ;EACR,KAAK,WAAW,QAAQ,SAAS;EACjC,KAAK;EACL,MAAM,EAAE,UAAU,QAAQ,UAAU;EACrC,CAAC;;;;;;;;;AAUJ,SAAgB,wCAAwC,SAEjC;AACrB,QAAO,IAAI,mBACT,QACA,gEACA;EACE,QAAQ;EACR,KAAK,WAAW,QAAQ,SAAS;EACjC,KAAK;EACL,MAAM,EAAE,UAAU,QAAQ,UAAU;EACrC,CACF"} | ||
| {"version":3,"file":"migration.mjs","names":[],"sources":["../src/migration.ts"],"sourcesContent":["import { CliStructuredError } from './control';\n\n// ============================================================================\n// Migration Errors (PN-MIG-2000-2999)\n//\n// Errors raised by the migration subsystem (authoring, planning, emit).\n// Domain `MIG` distinguishes these from generic application runtime errors\n// (`RUN`) and from CLI argument/config errors (`CLI`). See\n// `docs/CLI Style Guide.md` for the canonical domain taxonomy.\n// ============================================================================\n\n/**\n * A scaffolded migration contains a placeholder slot that was never filled in.\n *\n * Thrown at emit time (when `check.source()` or `run()` is invoked) via the\n * `placeholder(...)` utility. The `slot` identifies the exact location the\n * author still needs to edit, e.g. `\"backfill-product-status:check.source\"`.\n */\nexport function errorUnfilledPlaceholder(slot: string): CliStructuredError {\n return new CliStructuredError('2001', 'Unfilled migration placeholder', {\n domain: 'MIG',\n why: `The migration contains a placeholder that has not been filled in: ${slot}`,\n fix: 'Open migration.ts and replace the `placeholder(...)` call with your actual query.',\n meta: { slot },\n });\n}\n\n/**\n * Scaffolded `migration.ts` files call this wherever the scaffolder couldn't\n * emit a real query and the author is expected to fill one in. Always throws\n * a structured migration error (`PN-MIG-2001`).\n *\n * The return type `never` makes it assignable to any expected return type, so\n * a scaffolded `() => placeholder('...')` satisfies signatures like\n * `() => MongoQueryPlan` without polluting them with a sentinel union arm.\n */\nexport function placeholder(slot: string): never {\n throw errorUnfilledPlaceholder(slot);\n}\n\n/**\n * A `dataTransform(endContract, …)` factory was handed a `SqlQueryPlan` whose\n * `meta.storageHash` does not match the `endContract.storage.storageHash` it\n * was configured with. This almost always means the user's query-builder\n * (`sql({ context: createExecutionContext({ contract: endContract, … }) })`)\n * was instantiated from a different contract reference than the one passed\n * to `dataTransform(endContract, …)`.\n *\n * Distinct from `runtimeError('PLAN.HASH_MISMATCH', …)` (`PN-RUN-*`) which\n * rejects a plan at runtime execution; this is an authoring-time rejection\n * so it lives in the `MIG` namespace.\n */\nexport function errorDataTransformContractMismatch(options: {\n readonly dataTransformName: string;\n readonly expected: string;\n readonly actual: string;\n}): CliStructuredError {\n return new CliStructuredError('2005', 'dataTransform query plan built against wrong contract', {\n domain: 'MIG',\n why: `Data transform \"${options.dataTransformName}\" produced a query plan whose storage hash (${options.actual}) does not match the migration's contract (${options.expected}). The query builder was configured with a different contract than the one passed to dataTransform(endContract, ...).`,\n fix: 'Ensure the `endContract` imported at module scope (used for both `dataTransform(endContract, …)` and `sql({ context: createExecutionContext({ contract: endContract, … }) })`) is the same reference.',\n meta: {\n dataTransformName: options.dataTransformName,\n expected: options.expected,\n actual: options.actual,\n },\n });\n}\n\n/**\n * `migration.ts` was expected at the given package directory but could not be\n * located. Thrown when consumers attempt to read a migration package that is\n * missing its source file.\n */\nexport function errorMigrationFileMissing(dir: string): CliStructuredError {\n return new CliStructuredError('2002', 'migration.ts not found', {\n domain: 'MIG',\n why: `No migration.ts file was found at \"${dir}\"`,\n fix: 'Scaffold one with `prisma-next migration new` or `prisma-next migration plan`.',\n meta: { dir },\n });\n}\n\n/**\n * The `migration.ts` at the given package directory does not default-export a\n * valid migration shape. Two shapes are accepted: a `Migration` subclass, or a\n * factory function returning a `MigrationPlan`-shaped object (with at least\n * an `operations` array, plus `targetId` and `destination`). Thrown when the\n * default export is missing, is not a constructor/function, does not extend\n * `Migration`, or (for factory functions) returns a value that is not\n * `MigrationPlan`-shaped.\n */\nexport function errorMigrationInvalidDefaultExport(\n dir: string,\n actualExportDescription?: string,\n): CliStructuredError {\n return new CliStructuredError('2003', 'migration.ts default export is not a valid migration', {\n domain: 'MIG',\n why:\n actualExportDescription !== undefined\n ? `migration.ts at \"${dir}\" must default-export a Migration subclass or a factory function returning a MigrationPlan-shaped object; got ${actualExportDescription}`\n : `migration.ts at \"${dir}\" must default-export a Migration subclass or a factory function returning a MigrationPlan-shaped object.`,\n fix: 'Use `export default class extends Migration { ... }` or `export default () => ({ targetId, destination, operations })`.',\n meta: {\n dir,\n ...(actualExportDescription !== undefined ? { actualExport: actualExportDescription } : {}),\n },\n });\n}\n\n/**\n * A `Migration.operations` getter returned a value that is not an array. Used\n * by emit capabilities after instantiating the authored migration.\n */\nexport function errorMigrationPlanNotArray(\n dir: string,\n actualValueDescription?: string,\n): CliStructuredError {\n return new CliStructuredError('2004', 'Migration.operations must be an array of operations', {\n domain: 'MIG',\n why:\n actualValueDescription !== undefined\n ? `Migration.operations for migration.ts at \"${dir}\" was ${actualValueDescription}; an array of operations is required.`\n : `Migration.operations for migration.ts at \"${dir}\" is not an array of operations.`,\n fix: 'Ensure your `operations` getter returns an array of operations; see the data-migrations authoring guide.',\n meta: {\n dir,\n ...(actualValueDescription !== undefined ? { actualValue: actualValueDescription } : {}),\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAgB,yBAAyB,MAAkC;AACzE,QAAO,IAAI,mBAAmB,QAAQ,kCAAkC;EACtE,QAAQ;EACR,KAAK,qEAAqE;EAC1E,KAAK;EACL,MAAM,EAAE,MAAM;EACf,CAAC;;;;;;;;;;;AAYJ,SAAgB,YAAY,MAAqB;AAC/C,OAAM,yBAAyB,KAAK;;;;;;;;;;;;;;AAetC,SAAgB,mCAAmC,SAI5B;AACrB,QAAO,IAAI,mBAAmB,QAAQ,yDAAyD;EAC7F,QAAQ;EACR,KAAK,mBAAmB,QAAQ,kBAAkB,8CAA8C,QAAQ,OAAO,6CAA6C,QAAQ,SAAS;EAC7K,KAAK;EACL,MAAM;GACJ,mBAAmB,QAAQ;GAC3B,UAAU,QAAQ;GAClB,QAAQ,QAAQ;GACjB;EACF,CAAC;;;;;;;AAQJ,SAAgB,0BAA0B,KAAiC;AACzE,QAAO,IAAI,mBAAmB,QAAQ,0BAA0B;EAC9D,QAAQ;EACR,KAAK,sCAAsC,IAAI;EAC/C,KAAK;EACL,MAAM,EAAE,KAAK;EACd,CAAC;;;;;;;;;;;AAYJ,SAAgB,mCACd,KACA,yBACoB;AACpB,QAAO,IAAI,mBAAmB,QAAQ,wDAAwD;EAC5F,QAAQ;EACR,KACE,4BAA4B,SACxB,oBAAoB,IAAI,gHAAgH,4BACxI,oBAAoB,IAAI;EAC9B,KAAK;EACL,MAAM;GACJ;GACA,GAAI,4BAA4B,SAAY,EAAE,cAAc,yBAAyB,GAAG,EAAE;GAC3F;EACF,CAAC;;;;;;AAOJ,SAAgB,2BACd,KACA,wBACoB;AACpB,QAAO,IAAI,mBAAmB,QAAQ,uDAAuD;EAC3F,QAAQ;EACR,KACE,2BAA2B,SACvB,6CAA6C,IAAI,QAAQ,uBAAuB,yCAChF,6CAA6C,IAAI;EACvD,KAAK;EACL,MAAM;GACJ;GACA,GAAI,2BAA2B,SAAY,EAAE,aAAa,wBAAwB,GAAG,EAAE;GACxF;EACF,CAAC"} |
+5
-5
| { | ||
| "name": "@prisma-next/errors", | ||
| "version": "0.4.0-dev.13", | ||
| "version": "0.4.1", | ||
| "type": "module", | ||
@@ -8,4 +8,4 @@ "sideEffects": false, | ||
| "dependencies": { | ||
| "@prisma-next/framework-components": "0.4.0-dev.13", | ||
| "@prisma-next/utils": "0.4.0-dev.13" | ||
| "@prisma-next/framework-components": "0.4.1", | ||
| "@prisma-next/utils": "0.4.1" | ||
| }, | ||
@@ -16,4 +16,4 @@ "devDependencies": { | ||
| "vitest": "4.0.17", | ||
| "@prisma-next/tsconfig": "0.0.0", | ||
| "@prisma-next/tsdown": "0.0.0" | ||
| "@prisma-next/tsdown": "0.0.0", | ||
| "@prisma-next/tsconfig": "0.0.0" | ||
| }, | ||
@@ -20,0 +20,0 @@ "files": [ |
| export { | ||
| errorDataTransformContractMismatch, | ||
| errorMigrationFileMissing, | ||
| errorMigrationInvalidDefaultExport, | ||
| errorMigrationPlanNotArray, | ||
| errorPlanDoesNotSupportAuthoringSurface, | ||
| errorTargetHasIncompleteMigrationCapabilities, | ||
| errorUnfilledPlaceholder, | ||
| placeholder, | ||
| } from '../migration'; |
+33
-45
@@ -42,5 +42,34 @@ import { CliStructuredError } from './control'; | ||
| /** | ||
| * A `dataTransform(endContract, …)` factory was handed a `SqlQueryPlan` whose | ||
| * `meta.storageHash` does not match the `endContract.storage.storageHash` it | ||
| * was configured with. This almost always means the user's query-builder | ||
| * (`sql({ context: createExecutionContext({ contract: endContract, … }) })`) | ||
| * was instantiated from a different contract reference than the one passed | ||
| * to `dataTransform(endContract, …)`. | ||
| * | ||
| * Distinct from `runtimeError('PLAN.HASH_MISMATCH', …)` (`PN-RUN-*`) which | ||
| * rejects a plan at runtime execution; this is an authoring-time rejection | ||
| * so it lives in the `MIG` namespace. | ||
| */ | ||
| export function errorDataTransformContractMismatch(options: { | ||
| readonly dataTransformName: string; | ||
| readonly expected: string; | ||
| readonly actual: string; | ||
| }): CliStructuredError { | ||
| return new CliStructuredError('2005', 'dataTransform query plan built against wrong contract', { | ||
| domain: 'MIG', | ||
| why: `Data transform "${options.dataTransformName}" produced a query plan whose storage hash (${options.actual}) does not match the migration's contract (${options.expected}). The query builder was configured with a different contract than the one passed to dataTransform(endContract, ...).`, | ||
| fix: 'Ensure the `endContract` imported at module scope (used for both `dataTransform(endContract, …)` and `sql({ context: createExecutionContext({ contract: endContract, … }) })`) is the same reference.', | ||
| meta: { | ||
| dataTransformName: options.dataTransformName, | ||
| expected: options.expected, | ||
| actual: options.actual, | ||
| }, | ||
| }); | ||
| } | ||
| /** | ||
| * `migration.ts` was expected at the given package directory but could not be | ||
| * located. Thrown by `emitMigration` (and, as a belt-and-suspenders, by | ||
| * class-flow `emit` capabilities) when the file is missing. | ||
| * located. Thrown when consumers attempt to read a migration package that is | ||
| * missing its source file. | ||
| */ | ||
@@ -84,5 +113,4 @@ export function errorMigrationFileMissing(dir: string): CliStructuredError { | ||
| /** | ||
| * A class-flow `Migration.operations` getter returned a value that is not an | ||
| * array. Used by class-flow emit capabilities after instantiating the | ||
| * authored migration. | ||
| * A `Migration.operations` getter returned a value that is not an array. Used | ||
| * by emit capabilities after instantiating the authored migration. | ||
| */ | ||
@@ -106,41 +134,1 @@ export function errorMigrationPlanNotArray( | ||
| } | ||
| /** | ||
| * A target's migrations capability registers neither `resolveDescriptors` | ||
| * (descriptor flow) nor `emit` (class flow). Surfaced by the strategy | ||
| * selector when it is unable to choose a flow for the target. This is an | ||
| * internal wiring error: every migration-supporting target must implement | ||
| * exactly one of the two flows. | ||
| */ | ||
| export function errorTargetHasIncompleteMigrationCapabilities(options: { | ||
| readonly targetId: string; | ||
| }): CliStructuredError { | ||
| return new CliStructuredError('2011', 'Target migrations capability is incomplete', { | ||
| domain: 'MIG', | ||
| why: `Target "${options.targetId}" registers a migrations capability but implements neither \`resolveDescriptors\` (descriptor flow) nor \`emit\` (class flow); the CLI cannot choose an authoring strategy.`, | ||
| fix: 'This is an internal wiring error. Report it — the target descriptor must implement exactly one of the two migration flows.', | ||
| meta: { targetId: options.targetId }, | ||
| }); | ||
| } | ||
| /** | ||
| * A migration plan was asked to render itself back to TypeScript but the | ||
| * target does not support authoring-surface rendering. Thrown by Postgres's | ||
| * descriptor-flow plan when `renderTypeScript()` is invoked (the CLI only | ||
| * calls it in the class-flow branch of `migration plan`, so this acts as a | ||
| * safety rail rather than a user-visible error in normal use). | ||
| */ | ||
| export function errorPlanDoesNotSupportAuthoringSurface(options: { | ||
| readonly targetId: string; | ||
| }): CliStructuredError { | ||
| return new CliStructuredError( | ||
| '2010', | ||
| 'Migration plan does not support TypeScript authoring surface', | ||
| { | ||
| domain: 'MIG', | ||
| why: `Target "${options.targetId}" produced a descriptor-flow plan; descriptor-flow plans cannot be rendered back to TypeScript via renderTypeScript().`, | ||
| fix: 'This is an internal wiring error. Report it — the CLI should route descriptor-flow targets through renderDescriptorTypeScript, not renderTypeScript.', | ||
| meta: { targetId: options.targetId }, | ||
| }, | ||
| ); | ||
| } |
105958
-1.7%1147
-1.46%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated