@prisma/client-engine-runtime 6.13.0-dev.5 → 6.13.0-dev.7
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
|
@@ -1473,6 +1473,11 @@ var TransactionClosedError = class extends TransactionManagerError {
|
|
|
1473
1473
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction.`);
|
|
1474
1474
|
}
|
|
1475
1475
|
};
|
|
1476
|
+
var TransactionClosingError = class extends TransactionManagerError {
|
|
1477
|
+
constructor(operation) {
|
|
1478
|
+
super(`Transaction is being closed: A ${operation} cannot be executed on a closing transaction.`);
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1476
1481
|
var TransactionRolledBackError = class extends TransactionManagerError {
|
|
1477
1482
|
constructor(operation) {
|
|
1478
1483
|
super(`Transaction already closed: A ${operation} cannot be executed on a transaction that was rolled back.`);
|
|
@@ -1555,17 +1560,21 @@ var TransactionManager = class {
|
|
|
1555
1560
|
transaction: void 0
|
|
1556
1561
|
};
|
|
1557
1562
|
this.transactions.set(transaction.id, transaction);
|
|
1558
|
-
|
|
1563
|
+
let hasTimedOut = false;
|
|
1564
|
+
const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
|
|
1559
1565
|
transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
1560
1566
|
clearTimeout(startTimer);
|
|
1561
1567
|
switch (transaction.status) {
|
|
1562
1568
|
case "waiting":
|
|
1569
|
+
if (hasTimedOut) {
|
|
1570
|
+
await this.closeTransaction(transaction, "timed_out");
|
|
1571
|
+
throw new TransactionStartTimeoutError();
|
|
1572
|
+
}
|
|
1563
1573
|
transaction.status = "running";
|
|
1564
1574
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
1565
1575
|
return { id: transaction.id };
|
|
1576
|
+
case "closing":
|
|
1566
1577
|
case "timed_out":
|
|
1567
|
-
await this.closeTransaction(transaction, "timed_out");
|
|
1568
|
-
throw new TransactionStartTimeoutError();
|
|
1569
1578
|
case "running":
|
|
1570
1579
|
case "committed":
|
|
1571
1580
|
case "rolled_back":
|
|
@@ -1600,6 +1609,7 @@ var TransactionManager = class {
|
|
|
1600
1609
|
if (closedTransaction) {
|
|
1601
1610
|
debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
1602
1611
|
switch (closedTransaction.status) {
|
|
1612
|
+
case "closing":
|
|
1603
1613
|
case "waiting":
|
|
1604
1614
|
case "running":
|
|
1605
1615
|
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
|
|
@@ -1618,6 +1628,9 @@ var TransactionManager = class {
|
|
|
1618
1628
|
throw new TransactionNotFoundError();
|
|
1619
1629
|
}
|
|
1620
1630
|
}
|
|
1631
|
+
if (transaction.status === "closing") {
|
|
1632
|
+
throw new TransactionClosingError(operation);
|
|
1633
|
+
}
|
|
1621
1634
|
if (["committed", "rolled_back", "timed_out"].includes(transaction.status)) {
|
|
1622
1635
|
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map.");
|
|
1623
1636
|
}
|
|
@@ -1640,7 +1653,7 @@ var TransactionManager = class {
|
|
|
1640
1653
|
}
|
|
1641
1654
|
async closeTransaction(tx, status) {
|
|
1642
1655
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1643
|
-
tx.status =
|
|
1656
|
+
tx.status = "closing";
|
|
1644
1657
|
try {
|
|
1645
1658
|
if (tx.transaction && status === "committed") {
|
|
1646
1659
|
if (tx.transaction.options.usePhantomQuery) {
|
|
@@ -1660,6 +1673,7 @@ var TransactionManager = class {
|
|
|
1660
1673
|
}
|
|
1661
1674
|
}
|
|
1662
1675
|
} finally {
|
|
1676
|
+
tx.status = status;
|
|
1663
1677
|
clearTimeout(tx.timer);
|
|
1664
1678
|
tx.timer = void 0;
|
|
1665
1679
|
this.transactions.delete(tx.id);
|
package/dist/index.mjs
CHANGED
|
@@ -1424,6 +1424,11 @@ var TransactionClosedError = class extends TransactionManagerError {
|
|
|
1424
1424
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction.`);
|
|
1425
1425
|
}
|
|
1426
1426
|
};
|
|
1427
|
+
var TransactionClosingError = class extends TransactionManagerError {
|
|
1428
|
+
constructor(operation) {
|
|
1429
|
+
super(`Transaction is being closed: A ${operation} cannot be executed on a closing transaction.`);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1427
1432
|
var TransactionRolledBackError = class extends TransactionManagerError {
|
|
1428
1433
|
constructor(operation) {
|
|
1429
1434
|
super(`Transaction already closed: A ${operation} cannot be executed on a transaction that was rolled back.`);
|
|
@@ -1506,17 +1511,21 @@ var TransactionManager = class {
|
|
|
1506
1511
|
transaction: void 0
|
|
1507
1512
|
};
|
|
1508
1513
|
this.transactions.set(transaction.id, transaction);
|
|
1509
|
-
|
|
1514
|
+
let hasTimedOut = false;
|
|
1515
|
+
const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
|
|
1510
1516
|
transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
1511
1517
|
clearTimeout(startTimer);
|
|
1512
1518
|
switch (transaction.status) {
|
|
1513
1519
|
case "waiting":
|
|
1520
|
+
if (hasTimedOut) {
|
|
1521
|
+
await this.closeTransaction(transaction, "timed_out");
|
|
1522
|
+
throw new TransactionStartTimeoutError();
|
|
1523
|
+
}
|
|
1514
1524
|
transaction.status = "running";
|
|
1515
1525
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
1516
1526
|
return { id: transaction.id };
|
|
1527
|
+
case "closing":
|
|
1517
1528
|
case "timed_out":
|
|
1518
|
-
await this.closeTransaction(transaction, "timed_out");
|
|
1519
|
-
throw new TransactionStartTimeoutError();
|
|
1520
1529
|
case "running":
|
|
1521
1530
|
case "committed":
|
|
1522
1531
|
case "rolled_back":
|
|
@@ -1551,6 +1560,7 @@ var TransactionManager = class {
|
|
|
1551
1560
|
if (closedTransaction) {
|
|
1552
1561
|
debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
1553
1562
|
switch (closedTransaction.status) {
|
|
1563
|
+
case "closing":
|
|
1554
1564
|
case "waiting":
|
|
1555
1565
|
case "running":
|
|
1556
1566
|
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
|
|
@@ -1569,6 +1579,9 @@ var TransactionManager = class {
|
|
|
1569
1579
|
throw new TransactionNotFoundError();
|
|
1570
1580
|
}
|
|
1571
1581
|
}
|
|
1582
|
+
if (transaction.status === "closing") {
|
|
1583
|
+
throw new TransactionClosingError(operation);
|
|
1584
|
+
}
|
|
1572
1585
|
if (["committed", "rolled_back", "timed_out"].includes(transaction.status)) {
|
|
1573
1586
|
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map.");
|
|
1574
1587
|
}
|
|
@@ -1591,7 +1604,7 @@ var TransactionManager = class {
|
|
|
1591
1604
|
}
|
|
1592
1605
|
async closeTransaction(tx, status) {
|
|
1593
1606
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1594
|
-
tx.status =
|
|
1607
|
+
tx.status = "closing";
|
|
1595
1608
|
try {
|
|
1596
1609
|
if (tx.transaction && status === "committed") {
|
|
1597
1610
|
if (tx.transaction.options.usePhantomQuery) {
|
|
@@ -1611,6 +1624,7 @@ var TransactionManager = class {
|
|
|
1611
1624
|
}
|
|
1612
1625
|
}
|
|
1613
1626
|
} finally {
|
|
1627
|
+
tx.status = status;
|
|
1614
1628
|
clearTimeout(tx.timer);
|
|
1615
1629
|
tx.timer = void 0;
|
|
1616
1630
|
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.7",
|
|
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/debug": "6.13.0-dev.
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.13.0-dev.
|
|
34
|
+
"@prisma/debug": "6.13.0-dev.7",
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.13.0-dev.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|