@prisma/adapter-planetscale 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.
package/dist/index.js CHANGED
@@ -187,10 +187,14 @@ function convertDriverError(error) {
187
187
  function mapDriverError(error) {
188
188
  switch (error.code) {
189
189
  case 1062: {
190
- const index = error.message.split(" ").pop()?.split("'").at(1)?.split(".").pop();
190
+ const rawKey = error.message.split(" ").pop()?.split("'").at(1);
191
+ const keyParts = rawKey?.split(".");
192
+ const table = keyParts && keyParts.length > 1 ? keyParts.slice(0, -1).join(".") : void 0;
193
+ const index = keyParts?.at(-1);
191
194
  return {
192
195
  kind: "UniqueConstraintViolation",
193
- constraint: index !== void 0 ? { index } : void 0
196
+ constraint: index !== void 0 ? { index } : void 0,
197
+ table
194
198
  };
195
199
  }
196
200
  case 1451:
package/dist/index.mjs CHANGED
@@ -151,10 +151,14 @@ function convertDriverError(error) {
151
151
  function mapDriverError(error) {
152
152
  switch (error.code) {
153
153
  case 1062: {
154
- const index = error.message.split(" ").pop()?.split("'").at(1)?.split(".").pop();
154
+ const rawKey = error.message.split(" ").pop()?.split("'").at(1);
155
+ const keyParts = rawKey?.split(".");
156
+ const table = keyParts && keyParts.length > 1 ? keyParts.slice(0, -1).join(".") : void 0;
157
+ const index = keyParts?.at(-1);
155
158
  return {
156
159
  kind: "UniqueConstraintViolation",
157
- constraint: index !== void 0 ? { index } : void 0
160
+ constraint: index !== void 0 ? { index } : void 0,
161
+ table
158
162
  };
159
163
  }
160
164
  case 1451:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-planetscale",
3
- "version": "7.10.0-dev.43",
3
+ "version": "7.10.0-dev.45",
4
4
  "description": "Prisma's driver adapter for \"@planetscale/database\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@planetscale/database": "^1.19.0",
35
35
  "async-mutex": "0.5.0",
36
- "@prisma/driver-adapter-utils": "7.10.0-dev.43"
36
+ "@prisma/driver-adapter-utils": "7.10.0-dev.45"
37
37
  },
38
38
  "devDependencies": {
39
39
  "undici": "7.4.0"