@prisma/query-plan-executor 7.10.0-dev.43 → 7.10.0-dev.45

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.
Files changed (2) hide show
  1. package/dist/index.js +36 -15
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -92936,7 +92936,7 @@ __export(index_exports, {
92936
92936
  module.exports = __toCommonJS(index_exports);
92937
92937
 
92938
92938
  // package.json
92939
- var version = "7.10.0-dev.43";
92939
+ var version = "7.10.0-dev.45";
92940
92940
 
92941
92941
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
92942
92942
  function clampProp(e2, n2, t2, o2, r2) {
@@ -103086,7 +103086,11 @@ function rethrowAsUserFacing(error44) {
103086
103086
  const code = getErrorCode(error44);
103087
103087
  const message = renderErrorMessage(error44);
103088
103088
  if (code !== void 0 && message !== void 0) {
103089
- throw new UserFacingError(message, code, { driverAdapterError: error44 });
103089
+ const meta = { driverAdapterError: error44 };
103090
+ if (error44.cause.kind === "UniqueConstraintViolation" && error44.cause.table) {
103091
+ meta.table = error44.cause.table;
103092
+ }
103093
+ throw new UserFacingError(message, code, meta);
103090
103094
  }
103091
103095
  if (isGenericDatabaseErrorKind(error44.cause.kind)) {
103092
103096
  throw buildUnmappedDatabaseUserFacingError(error44);
@@ -107828,10 +107832,14 @@ function convertDriverError(error44) {
107828
107832
  function mapDriverError(error44) {
107829
107833
  switch (error44.errno) {
107830
107834
  case 1062: {
107831
- const index = error44.sqlMessage?.split(" ").pop()?.split("'").at(1)?.split(".").pop();
107835
+ const rawKey = error44.sqlMessage?.split(" ").pop()?.split("'").at(1);
107836
+ const keyParts = rawKey?.split(".");
107837
+ const table = keyParts && keyParts.length > 1 ? keyParts.slice(0, -1).join(".") : void 0;
107838
+ const index = keyParts?.at(-1);
107832
107839
  return {
107833
107840
  kind: "UniqueConstraintViolation",
107834
- constraint: index !== void 0 ? { index } : void 0
107841
+ constraint: index !== void 0 ? { index } : void 0,
107842
+ table
107835
107843
  };
107836
107844
  }
107837
107845
  case 1451:
@@ -108902,10 +108910,11 @@ function mapDriverError2(error44) {
108902
108910
  };
108903
108911
  }
108904
108912
  case 2627: {
108905
- const index = error44.message.split(". ").at(1)?.split(" ").pop()?.split("'").at(1);
108913
+ const object2 = error44.message.split(". ").at(1)?.split(" ").pop()?.split("'").at(1);
108906
108914
  return {
108907
108915
  kind: "UniqueConstraintViolation",
108908
- constraint: index ? { index } : void 0
108916
+ constraint: object2 ? { index: object2 } : void 0,
108917
+ table: object2?.split(".").pop()
108909
108918
  };
108910
108919
  }
108911
108920
  case 547: {
@@ -108916,17 +108925,23 @@ function mapDriverError2(error44) {
108916
108925
  };
108917
108926
  }
108918
108927
  case 1505: {
108919
- const index = error44.message.split("'").at(3);
108928
+ const segments = error44.message.split("'");
108929
+ const table = segments.at(1)?.split(".").pop();
108930
+ const index = segments.at(3);
108920
108931
  return {
108921
108932
  kind: "UniqueConstraintViolation",
108922
- constraint: index ? { index } : void 0
108933
+ constraint: index ? { index } : void 0,
108934
+ table
108923
108935
  };
108924
108936
  }
108925
108937
  case 2601: {
108926
- const index = error44.message.split(" ").at(11)?.split("'").at(1);
108938
+ const words = error44.message.split(" ");
108939
+ const table = words.at(7)?.split("'").at(1)?.split(".").pop();
108940
+ const index = words.at(11)?.split("'").at(1);
108927
108941
  return {
108928
108942
  kind: "UniqueConstraintViolation",
108929
- constraint: index ? { index } : void 0
108943
+ constraint: index ? { index } : void 0,
108944
+ table
108930
108945
  };
108931
108946
  }
108932
108947
  case 2628: {
@@ -109634,18 +109649,24 @@ function mapDriverError3(error44) {
109634
109649
  message: error44.message
109635
109650
  };
109636
109651
  case "23505": {
109652
+ const fields = error44.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
109637
109653
  let constraint;
109638
109654
  if (error44.constraint) {
109639
109655
  constraint = { index: error44.constraint };
109640
- } else {
109641
- const fields = error44.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
109642
- if (fields !== void 0) {
109643
- constraint = { fields };
109656
+ } else if (fields !== void 0) {
109657
+ constraint = { fields };
109658
+ }
109659
+ let table = error44.table;
109660
+ if (table === void 0 && fields !== void 0 && fields.length > 0) {
109661
+ const suffix = `_${fields.join("_")}_key`;
109662
+ if (error44.constraint?.endsWith(suffix)) {
109663
+ table = error44.constraint.slice(0, -suffix.length);
109644
109664
  }
109645
109665
  }
109646
109666
  return {
109647
109667
  kind: "UniqueConstraintViolation",
109648
- constraint
109668
+ constraint,
109669
+ table
109649
109670
  };
109650
109671
  }
109651
109672
  case "23502": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/query-plan-executor",
3
- "version": "7.10.0-dev.43",
3
+ "version": "7.10.0-dev.45",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,11 +19,11 @@
19
19
  "hono": "^4.12.23",
20
20
  "temporal-polyfill": "0.3.0",
21
21
  "zod": "4.1.3",
22
- "@prisma/adapter-pg": "7.10.0-dev.43",
23
- "@prisma/adapter-mariadb": "7.10.0-dev.43",
24
- "@prisma/adapter-mssql": "7.10.0-dev.43",
25
- "@prisma/client-engine-runtime": "7.10.0-dev.43",
26
- "@prisma/driver-adapter-utils": "7.10.0-dev.43"
22
+ "@prisma/adapter-mariadb": "7.10.0-dev.45",
23
+ "@prisma/adapter-pg": "7.10.0-dev.45",
24
+ "@prisma/adapter-mssql": "7.10.0-dev.45",
25
+ "@prisma/client-engine-runtime": "7.10.0-dev.45",
26
+ "@prisma/driver-adapter-utils": "7.10.0-dev.45"
27
27
  },
28
28
  "files": [
29
29
  "dist"