@prisma/adapter-pg 7.10.0-dev.4 → 7.10.0-dev.40
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 +23 -2
- package/dist/index.mjs +23 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -470,10 +470,18 @@ function mapDriverError(error) {
|
|
|
470
470
|
message: error.message
|
|
471
471
|
};
|
|
472
472
|
case "23505": {
|
|
473
|
-
|
|
473
|
+
let constraint;
|
|
474
|
+
if (error.constraint) {
|
|
475
|
+
constraint = { index: error.constraint };
|
|
476
|
+
} else {
|
|
477
|
+
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
478
|
+
if (fields !== void 0) {
|
|
479
|
+
constraint = { fields };
|
|
480
|
+
}
|
|
481
|
+
}
|
|
474
482
|
return {
|
|
475
483
|
kind: "UniqueConstraintViolation",
|
|
476
|
-
constraint
|
|
484
|
+
constraint
|
|
477
485
|
};
|
|
478
486
|
}
|
|
479
487
|
case "23502": {
|
|
@@ -495,6 +503,18 @@ function mapDriverError(error) {
|
|
|
495
503
|
constraint
|
|
496
504
|
};
|
|
497
505
|
}
|
|
506
|
+
case "23001": {
|
|
507
|
+
let constraint;
|
|
508
|
+
if (error.column) {
|
|
509
|
+
constraint = { fields: [error.column] };
|
|
510
|
+
} else if (error.constraint) {
|
|
511
|
+
constraint = { index: error.constraint };
|
|
512
|
+
}
|
|
513
|
+
return {
|
|
514
|
+
kind: "RestrictViolation",
|
|
515
|
+
constraint
|
|
516
|
+
};
|
|
517
|
+
}
|
|
498
518
|
case "3D000":
|
|
499
519
|
return {
|
|
500
520
|
kind: "DatabaseDoesNotExist",
|
|
@@ -511,6 +531,7 @@ function mapDriverError(error) {
|
|
|
511
531
|
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
512
532
|
};
|
|
513
533
|
case "40001":
|
|
534
|
+
case "40P01":
|
|
514
535
|
return {
|
|
515
536
|
kind: "TransactionWriteConflict"
|
|
516
537
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -434,10 +434,18 @@ function mapDriverError(error) {
|
|
|
434
434
|
message: error.message
|
|
435
435
|
};
|
|
436
436
|
case "23505": {
|
|
437
|
-
|
|
437
|
+
let constraint;
|
|
438
|
+
if (error.constraint) {
|
|
439
|
+
constraint = { index: error.constraint };
|
|
440
|
+
} else {
|
|
441
|
+
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
442
|
+
if (fields !== void 0) {
|
|
443
|
+
constraint = { fields };
|
|
444
|
+
}
|
|
445
|
+
}
|
|
438
446
|
return {
|
|
439
447
|
kind: "UniqueConstraintViolation",
|
|
440
|
-
constraint
|
|
448
|
+
constraint
|
|
441
449
|
};
|
|
442
450
|
}
|
|
443
451
|
case "23502": {
|
|
@@ -459,6 +467,18 @@ function mapDriverError(error) {
|
|
|
459
467
|
constraint
|
|
460
468
|
};
|
|
461
469
|
}
|
|
470
|
+
case "23001": {
|
|
471
|
+
let constraint;
|
|
472
|
+
if (error.column) {
|
|
473
|
+
constraint = { fields: [error.column] };
|
|
474
|
+
} else if (error.constraint) {
|
|
475
|
+
constraint = { index: error.constraint };
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
kind: "RestrictViolation",
|
|
479
|
+
constraint
|
|
480
|
+
};
|
|
481
|
+
}
|
|
462
482
|
case "3D000":
|
|
463
483
|
return {
|
|
464
484
|
kind: "DatabaseDoesNotExist",
|
|
@@ -475,6 +495,7 @@ function mapDriverError(error) {
|
|
|
475
495
|
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
476
496
|
};
|
|
477
497
|
case "40001":
|
|
498
|
+
case "40P01":
|
|
478
499
|
return {
|
|
479
500
|
kind: "TransactionWriteConflict"
|
|
480
501
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-pg",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.40",
|
|
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-dev.
|
|
37
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.40"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@prisma/debug": "7.10.0-dev.
|
|
40
|
+
"@prisma/debug": "7.10.0-dev.40"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "DEV=true tsx helpers/build.ts",
|