@prisma/client-engine-runtime 6.13.0-dev.3 → 6.13.0-dev.31
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
|
@@ -454,6 +454,8 @@ function getErrorCode(err) {
|
|
|
454
454
|
switch (err.cause.kind) {
|
|
455
455
|
case "AuthenticationFailed":
|
|
456
456
|
return "P1000";
|
|
457
|
+
case "DatabaseNotReachable":
|
|
458
|
+
return "P1001";
|
|
457
459
|
case "DatabaseDoesNotExist":
|
|
458
460
|
return "P1003";
|
|
459
461
|
case "SocketTimeout":
|
|
@@ -462,6 +464,10 @@ function getErrorCode(err) {
|
|
|
462
464
|
return "P1009";
|
|
463
465
|
case "DatabaseAccessDenied":
|
|
464
466
|
return "P1010";
|
|
467
|
+
case "TlsConnectionError":
|
|
468
|
+
return "P1011";
|
|
469
|
+
case "ConnectionClosed":
|
|
470
|
+
return "P1017";
|
|
465
471
|
case "TransactionAlreadyClosed":
|
|
466
472
|
return "P1018";
|
|
467
473
|
case "LengthMismatch":
|
|
@@ -506,6 +512,10 @@ function renderErrorMessage(err) {
|
|
|
506
512
|
const user = err.cause.user ?? "(not available)";
|
|
507
513
|
return `Authentication failed against the database server, the provided database credentials for \`${user}\` are not valid`;
|
|
508
514
|
}
|
|
515
|
+
case "DatabaseNotReachable": {
|
|
516
|
+
const address = err.cause.host && err.cause.port ? `${err.cause.host}:${err.cause.port}` : err.cause.host;
|
|
517
|
+
return `Can't reach database server${address ? ` at ${address}` : ""}`;
|
|
518
|
+
}
|
|
509
519
|
case "DatabaseDoesNotExist": {
|
|
510
520
|
const db = err.cause.db ?? "(not available)";
|
|
511
521
|
return `Database \`${db}\` does not exist on the database server`;
|
|
@@ -520,6 +530,12 @@ function renderErrorMessage(err) {
|
|
|
520
530
|
const db = err.cause.db ?? "(not available)";
|
|
521
531
|
return `User was denied access on the database \`${db}\``;
|
|
522
532
|
}
|
|
533
|
+
case "TlsConnectionError": {
|
|
534
|
+
return `Error opening a TLS connection: ${err.cause.reason}`;
|
|
535
|
+
}
|
|
536
|
+
case "ConnectionClosed": {
|
|
537
|
+
return "Server has closed the connection.";
|
|
538
|
+
}
|
|
523
539
|
case "TransactionAlreadyClosed":
|
|
524
540
|
return err.cause.cause;
|
|
525
541
|
case "LengthMismatch": {
|
|
@@ -1473,6 +1489,11 @@ var TransactionClosedError = class extends TransactionManagerError {
|
|
|
1473
1489
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction.`);
|
|
1474
1490
|
}
|
|
1475
1491
|
};
|
|
1492
|
+
var TransactionClosingError = class extends TransactionManagerError {
|
|
1493
|
+
constructor(operation) {
|
|
1494
|
+
super(`Transaction is being closed: A ${operation} cannot be executed on a closing transaction.`);
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1476
1497
|
var TransactionRolledBackError = class extends TransactionManagerError {
|
|
1477
1498
|
constructor(operation) {
|
|
1478
1499
|
super(`Transaction already closed: A ${operation} cannot be executed on a transaction that was rolled back.`);
|
|
@@ -1555,17 +1576,21 @@ var TransactionManager = class {
|
|
|
1555
1576
|
transaction: void 0
|
|
1556
1577
|
};
|
|
1557
1578
|
this.transactions.set(transaction.id, transaction);
|
|
1558
|
-
|
|
1579
|
+
let hasTimedOut = false;
|
|
1580
|
+
const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
|
|
1559
1581
|
transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
1560
1582
|
clearTimeout(startTimer);
|
|
1561
1583
|
switch (transaction.status) {
|
|
1562
1584
|
case "waiting":
|
|
1585
|
+
if (hasTimedOut) {
|
|
1586
|
+
await this.closeTransaction(transaction, "timed_out");
|
|
1587
|
+
throw new TransactionStartTimeoutError();
|
|
1588
|
+
}
|
|
1563
1589
|
transaction.status = "running";
|
|
1564
1590
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
1565
1591
|
return { id: transaction.id };
|
|
1592
|
+
case "closing":
|
|
1566
1593
|
case "timed_out":
|
|
1567
|
-
await this.closeTransaction(transaction, "timed_out");
|
|
1568
|
-
throw new TransactionStartTimeoutError();
|
|
1569
1594
|
case "running":
|
|
1570
1595
|
case "committed":
|
|
1571
1596
|
case "rolled_back":
|
|
@@ -1600,6 +1625,7 @@ var TransactionManager = class {
|
|
|
1600
1625
|
if (closedTransaction) {
|
|
1601
1626
|
debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
1602
1627
|
switch (closedTransaction.status) {
|
|
1628
|
+
case "closing":
|
|
1603
1629
|
case "waiting":
|
|
1604
1630
|
case "running":
|
|
1605
1631
|
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
|
|
@@ -1618,6 +1644,9 @@ var TransactionManager = class {
|
|
|
1618
1644
|
throw new TransactionNotFoundError();
|
|
1619
1645
|
}
|
|
1620
1646
|
}
|
|
1647
|
+
if (transaction.status === "closing") {
|
|
1648
|
+
throw new TransactionClosingError(operation);
|
|
1649
|
+
}
|
|
1621
1650
|
if (["committed", "rolled_back", "timed_out"].includes(transaction.status)) {
|
|
1622
1651
|
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map.");
|
|
1623
1652
|
}
|
|
@@ -1640,7 +1669,7 @@ var TransactionManager = class {
|
|
|
1640
1669
|
}
|
|
1641
1670
|
async closeTransaction(tx, status) {
|
|
1642
1671
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1643
|
-
tx.status =
|
|
1672
|
+
tx.status = "closing";
|
|
1644
1673
|
try {
|
|
1645
1674
|
if (tx.transaction && status === "committed") {
|
|
1646
1675
|
if (tx.transaction.options.usePhantomQuery) {
|
|
@@ -1660,6 +1689,7 @@ var TransactionManager = class {
|
|
|
1660
1689
|
}
|
|
1661
1690
|
}
|
|
1662
1691
|
} finally {
|
|
1692
|
+
tx.status = status;
|
|
1663
1693
|
clearTimeout(tx.timer);
|
|
1664
1694
|
tx.timer = void 0;
|
|
1665
1695
|
this.transactions.delete(tx.id);
|
package/dist/index.mjs
CHANGED
|
@@ -405,6 +405,8 @@ function getErrorCode(err) {
|
|
|
405
405
|
switch (err.cause.kind) {
|
|
406
406
|
case "AuthenticationFailed":
|
|
407
407
|
return "P1000";
|
|
408
|
+
case "DatabaseNotReachable":
|
|
409
|
+
return "P1001";
|
|
408
410
|
case "DatabaseDoesNotExist":
|
|
409
411
|
return "P1003";
|
|
410
412
|
case "SocketTimeout":
|
|
@@ -413,6 +415,10 @@ function getErrorCode(err) {
|
|
|
413
415
|
return "P1009";
|
|
414
416
|
case "DatabaseAccessDenied":
|
|
415
417
|
return "P1010";
|
|
418
|
+
case "TlsConnectionError":
|
|
419
|
+
return "P1011";
|
|
420
|
+
case "ConnectionClosed":
|
|
421
|
+
return "P1017";
|
|
416
422
|
case "TransactionAlreadyClosed":
|
|
417
423
|
return "P1018";
|
|
418
424
|
case "LengthMismatch":
|
|
@@ -457,6 +463,10 @@ function renderErrorMessage(err) {
|
|
|
457
463
|
const user = err.cause.user ?? "(not available)";
|
|
458
464
|
return `Authentication failed against the database server, the provided database credentials for \`${user}\` are not valid`;
|
|
459
465
|
}
|
|
466
|
+
case "DatabaseNotReachable": {
|
|
467
|
+
const address = err.cause.host && err.cause.port ? `${err.cause.host}:${err.cause.port}` : err.cause.host;
|
|
468
|
+
return `Can't reach database server${address ? ` at ${address}` : ""}`;
|
|
469
|
+
}
|
|
460
470
|
case "DatabaseDoesNotExist": {
|
|
461
471
|
const db = err.cause.db ?? "(not available)";
|
|
462
472
|
return `Database \`${db}\` does not exist on the database server`;
|
|
@@ -471,6 +481,12 @@ function renderErrorMessage(err) {
|
|
|
471
481
|
const db = err.cause.db ?? "(not available)";
|
|
472
482
|
return `User was denied access on the database \`${db}\``;
|
|
473
483
|
}
|
|
484
|
+
case "TlsConnectionError": {
|
|
485
|
+
return `Error opening a TLS connection: ${err.cause.reason}`;
|
|
486
|
+
}
|
|
487
|
+
case "ConnectionClosed": {
|
|
488
|
+
return "Server has closed the connection.";
|
|
489
|
+
}
|
|
474
490
|
case "TransactionAlreadyClosed":
|
|
475
491
|
return err.cause.cause;
|
|
476
492
|
case "LengthMismatch": {
|
|
@@ -1424,6 +1440,11 @@ var TransactionClosedError = class extends TransactionManagerError {
|
|
|
1424
1440
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction.`);
|
|
1425
1441
|
}
|
|
1426
1442
|
};
|
|
1443
|
+
var TransactionClosingError = class extends TransactionManagerError {
|
|
1444
|
+
constructor(operation) {
|
|
1445
|
+
super(`Transaction is being closed: A ${operation} cannot be executed on a closing transaction.`);
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1427
1448
|
var TransactionRolledBackError = class extends TransactionManagerError {
|
|
1428
1449
|
constructor(operation) {
|
|
1429
1450
|
super(`Transaction already closed: A ${operation} cannot be executed on a transaction that was rolled back.`);
|
|
@@ -1506,17 +1527,21 @@ var TransactionManager = class {
|
|
|
1506
1527
|
transaction: void 0
|
|
1507
1528
|
};
|
|
1508
1529
|
this.transactions.set(transaction.id, transaction);
|
|
1509
|
-
|
|
1530
|
+
let hasTimedOut = false;
|
|
1531
|
+
const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
|
|
1510
1532
|
transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
1511
1533
|
clearTimeout(startTimer);
|
|
1512
1534
|
switch (transaction.status) {
|
|
1513
1535
|
case "waiting":
|
|
1536
|
+
if (hasTimedOut) {
|
|
1537
|
+
await this.closeTransaction(transaction, "timed_out");
|
|
1538
|
+
throw new TransactionStartTimeoutError();
|
|
1539
|
+
}
|
|
1514
1540
|
transaction.status = "running";
|
|
1515
1541
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
1516
1542
|
return { id: transaction.id };
|
|
1543
|
+
case "closing":
|
|
1517
1544
|
case "timed_out":
|
|
1518
|
-
await this.closeTransaction(transaction, "timed_out");
|
|
1519
|
-
throw new TransactionStartTimeoutError();
|
|
1520
1545
|
case "running":
|
|
1521
1546
|
case "committed":
|
|
1522
1547
|
case "rolled_back":
|
|
@@ -1551,6 +1576,7 @@ var TransactionManager = class {
|
|
|
1551
1576
|
if (closedTransaction) {
|
|
1552
1577
|
debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
1553
1578
|
switch (closedTransaction.status) {
|
|
1579
|
+
case "closing":
|
|
1554
1580
|
case "waiting":
|
|
1555
1581
|
case "running":
|
|
1556
1582
|
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
|
|
@@ -1569,6 +1595,9 @@ var TransactionManager = class {
|
|
|
1569
1595
|
throw new TransactionNotFoundError();
|
|
1570
1596
|
}
|
|
1571
1597
|
}
|
|
1598
|
+
if (transaction.status === "closing") {
|
|
1599
|
+
throw new TransactionClosingError(operation);
|
|
1600
|
+
}
|
|
1572
1601
|
if (["committed", "rolled_back", "timed_out"].includes(transaction.status)) {
|
|
1573
1602
|
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map.");
|
|
1574
1603
|
}
|
|
@@ -1591,7 +1620,7 @@ var TransactionManager = class {
|
|
|
1591
1620
|
}
|
|
1592
1621
|
async closeTransaction(tx, status) {
|
|
1593
1622
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1594
|
-
tx.status =
|
|
1623
|
+
tx.status = "closing";
|
|
1595
1624
|
try {
|
|
1596
1625
|
if (tx.transaction && status === "committed") {
|
|
1597
1626
|
if (tx.transaction.options.usePhantomQuery) {
|
|
@@ -1611,6 +1640,7 @@ var TransactionManager = class {
|
|
|
1611
1640
|
}
|
|
1612
1641
|
}
|
|
1613
1642
|
} finally {
|
|
1643
|
+
tx.status = status;
|
|
1614
1644
|
clearTimeout(tx.timer);
|
|
1615
1645
|
tx.timer = void 0;
|
|
1616
1646
|
this.transactions.delete(tx.id);
|
|
@@ -9,6 +9,9 @@ export declare class TransactionNotFoundError extends TransactionManagerError {
|
|
|
9
9
|
export declare class TransactionClosedError extends TransactionManagerError {
|
|
10
10
|
constructor(operation: string);
|
|
11
11
|
}
|
|
12
|
+
export declare class TransactionClosingError extends TransactionManagerError {
|
|
13
|
+
constructor(operation: string);
|
|
14
|
+
}
|
|
12
15
|
export declare class TransactionRolledBackError extends TransactionManagerError {
|
|
13
16
|
constructor(operation: string);
|
|
14
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.13.0-dev.
|
|
3
|
+
"version": "6.13.0-dev.31",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "11.1.0",
|
|
34
|
-
"@prisma/
|
|
35
|
-
"@prisma/
|
|
34
|
+
"@prisma/debug": "6.13.0-dev.31",
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.13.0-dev.31"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|