@prisma/client-engine-runtime 6.13.0-dev.5 → 6.13.0-dev.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 CHANGED
@@ -1555,17 +1555,21 @@ var TransactionManager = class {
1555
1555
  transaction: void 0
1556
1556
  };
1557
1557
  this.transactions.set(transaction.id, transaction);
1558
- const startTimer = setTimeout(() => transaction.status = "timed_out", validatedOptions.maxWait);
1558
+ let hasTimedOut = false;
1559
+ const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1559
1560
  transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1560
1561
  clearTimeout(startTimer);
1561
1562
  switch (transaction.status) {
1562
1563
  case "waiting":
1564
+ if (hasTimedOut) {
1565
+ await this.closeTransaction(transaction, "timed_out");
1566
+ throw new TransactionStartTimeoutError();
1567
+ }
1563
1568
  transaction.status = "running";
1564
1569
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
1565
1570
  return { id: transaction.id };
1571
+ case "closing":
1566
1572
  case "timed_out":
1567
- await this.closeTransaction(transaction, "timed_out");
1568
- throw new TransactionStartTimeoutError();
1569
1573
  case "running":
1570
1574
  case "committed":
1571
1575
  case "rolled_back":
@@ -1600,6 +1604,7 @@ var TransactionManager = class {
1600
1604
  if (closedTransaction) {
1601
1605
  debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
1602
1606
  switch (closedTransaction.status) {
1607
+ case "closing":
1603
1608
  case "waiting":
1604
1609
  case "running":
1605
1610
  throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
@@ -1640,7 +1645,7 @@ var TransactionManager = class {
1640
1645
  }
1641
1646
  async closeTransaction(tx, status) {
1642
1647
  debug("Closing transaction.", { transactionId: tx.id, status });
1643
- tx.status = status;
1648
+ tx.status = "closing";
1644
1649
  try {
1645
1650
  if (tx.transaction && status === "committed") {
1646
1651
  if (tx.transaction.options.usePhantomQuery) {
@@ -1660,6 +1665,7 @@ var TransactionManager = class {
1660
1665
  }
1661
1666
  }
1662
1667
  } finally {
1668
+ tx.status = status;
1663
1669
  clearTimeout(tx.timer);
1664
1670
  tx.timer = void 0;
1665
1671
  this.transactions.delete(tx.id);
package/dist/index.mjs CHANGED
@@ -1506,17 +1506,21 @@ var TransactionManager = class {
1506
1506
  transaction: void 0
1507
1507
  };
1508
1508
  this.transactions.set(transaction.id, transaction);
1509
- const startTimer = setTimeout(() => transaction.status = "timed_out", validatedOptions.maxWait);
1509
+ let hasTimedOut = false;
1510
+ const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1510
1511
  transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1511
1512
  clearTimeout(startTimer);
1512
1513
  switch (transaction.status) {
1513
1514
  case "waiting":
1515
+ if (hasTimedOut) {
1516
+ await this.closeTransaction(transaction, "timed_out");
1517
+ throw new TransactionStartTimeoutError();
1518
+ }
1514
1519
  transaction.status = "running";
1515
1520
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
1516
1521
  return { id: transaction.id };
1522
+ case "closing":
1517
1523
  case "timed_out":
1518
- await this.closeTransaction(transaction, "timed_out");
1519
- throw new TransactionStartTimeoutError();
1520
1524
  case "running":
1521
1525
  case "committed":
1522
1526
  case "rolled_back":
@@ -1551,6 +1555,7 @@ var TransactionManager = class {
1551
1555
  if (closedTransaction) {
1552
1556
  debug("Transaction already closed.", { transactionId, status: closedTransaction.status });
1553
1557
  switch (closedTransaction.status) {
1558
+ case "closing":
1554
1559
  case "waiting":
1555
1560
  case "running":
1556
1561
  throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.");
@@ -1591,7 +1596,7 @@ var TransactionManager = class {
1591
1596
  }
1592
1597
  async closeTransaction(tx, status) {
1593
1598
  debug("Closing transaction.", { transactionId: tx.id, status });
1594
- tx.status = status;
1599
+ tx.status = "closing";
1595
1600
  try {
1596
1601
  if (tx.transaction && status === "committed") {
1597
1602
  if (tx.transaction.options.usePhantomQuery) {
@@ -1611,6 +1616,7 @@ var TransactionManager = class {
1611
1616
  }
1612
1617
  }
1613
1618
  } finally {
1619
+ tx.status = status;
1614
1620
  clearTimeout(tx.timer);
1615
1621
  tx.timer = void 0;
1616
1622
  this.transactions.delete(tx.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.13.0-dev.5",
3
+ "version": "6.13.0-dev.6",
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.5",
35
- "@prisma/driver-adapter-utils": "6.13.0-dev.5"
34
+ "@prisma/debug": "6.13.0-dev.6",
35
+ "@prisma/driver-adapter-utils": "6.13.0-dev.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",