@prisma/adapter-pg 7.10.0-dev.8 → 7.10.0-integration-prisma7-project-closeout.6
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 +28 -1
- package/dist/index.mjs +28 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -471,9 +471,23 @@ function mapDriverError(error) {
|
|
|
471
471
|
};
|
|
472
472
|
case "23505": {
|
|
473
473
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
474
|
+
let constraint;
|
|
475
|
+
if (error.constraint) {
|
|
476
|
+
constraint = { index: error.constraint };
|
|
477
|
+
} else if (fields !== void 0) {
|
|
478
|
+
constraint = { fields };
|
|
479
|
+
}
|
|
480
|
+
let table = error.table;
|
|
481
|
+
if (table === void 0 && fields !== void 0 && fields.length > 0) {
|
|
482
|
+
const suffix = `_${fields.join("_")}_key`;
|
|
483
|
+
if (error.constraint?.endsWith(suffix)) {
|
|
484
|
+
table = error.constraint.slice(0, -suffix.length);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
474
487
|
return {
|
|
475
488
|
kind: "UniqueConstraintViolation",
|
|
476
|
-
constraint
|
|
489
|
+
constraint,
|
|
490
|
+
table
|
|
477
491
|
};
|
|
478
492
|
}
|
|
479
493
|
case "23502": {
|
|
@@ -495,6 +509,18 @@ function mapDriverError(error) {
|
|
|
495
509
|
constraint
|
|
496
510
|
};
|
|
497
511
|
}
|
|
512
|
+
case "23001": {
|
|
513
|
+
let constraint;
|
|
514
|
+
if (error.column) {
|
|
515
|
+
constraint = { fields: [error.column] };
|
|
516
|
+
} else if (error.constraint) {
|
|
517
|
+
constraint = { index: error.constraint };
|
|
518
|
+
}
|
|
519
|
+
return {
|
|
520
|
+
kind: "RestrictViolation",
|
|
521
|
+
constraint
|
|
522
|
+
};
|
|
523
|
+
}
|
|
498
524
|
case "3D000":
|
|
499
525
|
return {
|
|
500
526
|
kind: "DatabaseDoesNotExist",
|
|
@@ -511,6 +537,7 @@ function mapDriverError(error) {
|
|
|
511
537
|
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
512
538
|
};
|
|
513
539
|
case "40001":
|
|
540
|
+
case "40P01":
|
|
514
541
|
return {
|
|
515
542
|
kind: "TransactionWriteConflict"
|
|
516
543
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -435,9 +435,23 @@ function mapDriverError(error) {
|
|
|
435
435
|
};
|
|
436
436
|
case "23505": {
|
|
437
437
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
438
|
+
let constraint;
|
|
439
|
+
if (error.constraint) {
|
|
440
|
+
constraint = { index: error.constraint };
|
|
441
|
+
} else if (fields !== void 0) {
|
|
442
|
+
constraint = { fields };
|
|
443
|
+
}
|
|
444
|
+
let table = error.table;
|
|
445
|
+
if (table === void 0 && fields !== void 0 && fields.length > 0) {
|
|
446
|
+
const suffix = `_${fields.join("_")}_key`;
|
|
447
|
+
if (error.constraint?.endsWith(suffix)) {
|
|
448
|
+
table = error.constraint.slice(0, -suffix.length);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
438
451
|
return {
|
|
439
452
|
kind: "UniqueConstraintViolation",
|
|
440
|
-
constraint
|
|
453
|
+
constraint,
|
|
454
|
+
table
|
|
441
455
|
};
|
|
442
456
|
}
|
|
443
457
|
case "23502": {
|
|
@@ -459,6 +473,18 @@ function mapDriverError(error) {
|
|
|
459
473
|
constraint
|
|
460
474
|
};
|
|
461
475
|
}
|
|
476
|
+
case "23001": {
|
|
477
|
+
let constraint;
|
|
478
|
+
if (error.column) {
|
|
479
|
+
constraint = { fields: [error.column] };
|
|
480
|
+
} else if (error.constraint) {
|
|
481
|
+
constraint = { index: error.constraint };
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
kind: "RestrictViolation",
|
|
485
|
+
constraint
|
|
486
|
+
};
|
|
487
|
+
}
|
|
462
488
|
case "3D000":
|
|
463
489
|
return {
|
|
464
490
|
kind: "DatabaseDoesNotExist",
|
|
@@ -475,6 +501,7 @@ function mapDriverError(error) {
|
|
|
475
501
|
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
476
502
|
};
|
|
477
503
|
case "40001":
|
|
504
|
+
case "40P01":
|
|
478
505
|
return {
|
|
479
506
|
kind: "TransactionWriteConflict"
|
|
480
507
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-pg",
|
|
3
|
-
"version": "7.10.0-
|
|
3
|
+
"version": "7.10.0-integration-prisma7-project-closeout.6",
|
|
4
4
|
"description": "Prisma's driver adapter for \"pg\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"pg": "^8.16.3",
|
|
35
35
|
"postgres-array": "3.0.4",
|
|
36
36
|
"@types/pg": "^8.16.0",
|
|
37
|
-
"@prisma/driver-adapter-utils": "7.10.0-
|
|
37
|
+
"@prisma/driver-adapter-utils": "7.10.0-integration-prisma7-project-closeout.6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@prisma/debug": "7.10.0-
|
|
40
|
+
"@prisma/debug": "7.10.0-integration-prisma7-project-closeout.6"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "DEV=true tsx helpers/build.ts",
|