@prisma/client-engine-runtime 7.10.0-dev.38 → 7.10.0-dev.39
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 +90 -55
- package/dist/index.mjs +90 -55
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -803,6 +803,7 @@ function normalizeDateTime(dt) {
|
|
|
803
803
|
}
|
|
804
804
|
|
|
805
805
|
// src/interpreter/query-interpreter.ts
|
|
806
|
+
var import_debug = require("@prisma/debug");
|
|
806
807
|
var import_klona2 = require("klona");
|
|
807
808
|
|
|
808
809
|
// src/sql-commenter.ts
|
|
@@ -1595,6 +1596,7 @@ function getErrorCode2(error) {
|
|
|
1595
1596
|
}
|
|
1596
1597
|
|
|
1597
1598
|
// src/interpreter/query-interpreter.ts
|
|
1599
|
+
var debug = (0, import_debug.Debug)("prisma:client:queryInterpreter");
|
|
1598
1600
|
var QueryInterpreter = class _QueryInterpreter {
|
|
1599
1601
|
#onQuery;
|
|
1600
1602
|
#generators = new GeneratorRegistry();
|
|
@@ -1685,42 +1687,46 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1685
1687
|
}
|
|
1686
1688
|
case "execute": {
|
|
1687
1689
|
const queries = renderQuery(node.args, context.scope, context.generators, this.#maxChunkSize());
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
(
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1690
|
+
return this.#withChunkTransaction(queries.length, context, async (context2) => {
|
|
1691
|
+
let sum = 0;
|
|
1692
|
+
for (const query of queries) {
|
|
1693
|
+
const commentedQuery = applyComments(query, context2.sqlCommenter);
|
|
1694
|
+
sum += await this.#withQuerySpanAndEvent(
|
|
1695
|
+
commentedQuery,
|
|
1696
|
+
context2.queryable,
|
|
1697
|
+
() => context2.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
1698
|
+
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1699
|
+
)
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
return { value: sum };
|
|
1703
|
+
});
|
|
1700
1704
|
}
|
|
1701
1705
|
case "query": {
|
|
1702
1706
|
const queries = renderQuery(node.args, context.scope, context.generators, this.#maxChunkSize());
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
(
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
results
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1707
|
+
return this.#withChunkTransaction(queries.length, context, async (context2) => {
|
|
1708
|
+
let results;
|
|
1709
|
+
for (const query of queries) {
|
|
1710
|
+
const commentedQuery = applyComments(query, context2.sqlCommenter);
|
|
1711
|
+
const result = await this.#withQuerySpanAndEvent(
|
|
1712
|
+
commentedQuery,
|
|
1713
|
+
context2.queryable,
|
|
1714
|
+
() => context2.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
1715
|
+
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1716
|
+
)
|
|
1717
|
+
);
|
|
1718
|
+
if (results === void 0) {
|
|
1719
|
+
results = result;
|
|
1720
|
+
} else {
|
|
1721
|
+
appendToArray(results.rows, result.rows);
|
|
1722
|
+
results.lastInsertId = result.lastInsertId;
|
|
1723
|
+
}
|
|
1718
1724
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
};
|
|
1725
|
+
return {
|
|
1726
|
+
value: node.args.type === "rawSql" ? this.#rawSerializer(results) : this.#serializer(results),
|
|
1727
|
+
lastInsertId: results?.lastInsertId
|
|
1728
|
+
};
|
|
1729
|
+
});
|
|
1724
1730
|
}
|
|
1725
1731
|
case "reverse": {
|
|
1726
1732
|
const { value, lastInsertId } = await this.interpretNode(node.args, context);
|
|
@@ -1761,20 +1767,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1761
1767
|
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
1762
1768
|
}
|
|
1763
1769
|
case "transaction": {
|
|
1764
|
-
|
|
1765
|
-
return this.interpretNode(node.args, context);
|
|
1766
|
-
}
|
|
1767
|
-
const transactionManager = context.transactionManager.manager;
|
|
1768
|
-
const transactionInfo = await transactionManager.startInternalTransaction();
|
|
1769
|
-
const transaction = await transactionManager.getTransaction(transactionInfo, "query");
|
|
1770
|
-
try {
|
|
1771
|
-
const value = await this.interpretNode(node.args, { ...context, queryable: transaction });
|
|
1772
|
-
await transactionManager.commitTransaction(transactionInfo.id);
|
|
1773
|
-
return value;
|
|
1774
|
-
} catch (e) {
|
|
1775
|
-
await transactionManager.rollbackTransaction(transactionInfo.id);
|
|
1776
|
-
throw e;
|
|
1777
|
-
}
|
|
1770
|
+
return this.#withInternalTransaction(context, (context2) => this.interpretNode(node.args, context2));
|
|
1778
1771
|
}
|
|
1779
1772
|
case "dataMap": {
|
|
1780
1773
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
@@ -1959,6 +1952,48 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1959
1952
|
assertNever(node, `Unexpected node type: ${node.type}`);
|
|
1960
1953
|
}
|
|
1961
1954
|
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Runs the statements of a `query` or `execute` node via `fn`, wrapping them in a
|
|
1957
|
+
* transaction when a chunkable statement was split into multiple queries at render time,
|
|
1958
|
+
* so that a partially applied write cannot be observed or left behind if a later chunk
|
|
1959
|
+
* fails. A single statement is atomic on its own, so it runs on the current context.
|
|
1960
|
+
*/
|
|
1961
|
+
#withChunkTransaction(statementCount, context, fn) {
|
|
1962
|
+
if (statementCount <= 1) {
|
|
1963
|
+
return fn(context);
|
|
1964
|
+
}
|
|
1965
|
+
return this.#withInternalTransaction(context, fn);
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Runs `fn` with a context whose queryable is guaranteed to be a transaction, starting a
|
|
1969
|
+
* new internal transaction and committing or rolling it back around the call.
|
|
1970
|
+
*
|
|
1971
|
+
* A disabled transaction manager means the queryable already is a transaction: executors
|
|
1972
|
+
* pass `{ enabled: false }` when the plan runs inside an interactive transaction, and the
|
|
1973
|
+
* context handed to `fn` carries it for the duration of an internal transaction. In that
|
|
1974
|
+
* case `fn` runs on the current context, since the statements it issues are already
|
|
1975
|
+
* covered by the surrounding transaction.
|
|
1976
|
+
*/
|
|
1977
|
+
async #withInternalTransaction(context, fn) {
|
|
1978
|
+
if (!context.transactionManager.enabled) {
|
|
1979
|
+
return fn(context);
|
|
1980
|
+
}
|
|
1981
|
+
const transactionManager = context.transactionManager.manager;
|
|
1982
|
+
const transactionInfo = await transactionManager.startInternalTransaction();
|
|
1983
|
+
const transaction = await transactionManager.getTransaction(transactionInfo, "query");
|
|
1984
|
+
try {
|
|
1985
|
+
const result = await fn({ ...context, queryable: transaction, transactionManager: { enabled: false } });
|
|
1986
|
+
await transactionManager.commitTransaction(transactionInfo.id);
|
|
1987
|
+
return result;
|
|
1988
|
+
} catch (e) {
|
|
1989
|
+
try {
|
|
1990
|
+
await transactionManager.rollbackTransaction(transactionInfo.id);
|
|
1991
|
+
} catch (rollbackError) {
|
|
1992
|
+
debug("failed to roll back an internal transaction", rollbackError);
|
|
1993
|
+
}
|
|
1994
|
+
throw e;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1962
1997
|
#maxChunkSize() {
|
|
1963
1998
|
if (this.#connectionInfo?.maxBindValues !== void 0) {
|
|
1964
1999
|
return this.#connectionInfo.maxBindValues;
|
|
@@ -2736,7 +2771,7 @@ function normalizeValue(type, value) {
|
|
|
2736
2771
|
}
|
|
2737
2772
|
|
|
2738
2773
|
// src/transaction-manager/transaction-manager.ts
|
|
2739
|
-
var
|
|
2774
|
+
var import_debug2 = require("@prisma/debug");
|
|
2740
2775
|
|
|
2741
2776
|
// src/crypto.ts
|
|
2742
2777
|
async function getCrypto() {
|
|
@@ -2812,7 +2847,7 @@ function trackStartingTransaction() {
|
|
|
2812
2847
|
});
|
|
2813
2848
|
return { abortController: new AbortController(), settled, markSettled };
|
|
2814
2849
|
}
|
|
2815
|
-
var
|
|
2850
|
+
var debug2 = (0, import_debug2.Debug)("prisma:client:transactionManager");
|
|
2816
2851
|
var COMMIT_QUERY = () => ({ sql: "COMMIT", args: [], argTypes: [] });
|
|
2817
2852
|
var ROLLBACK_QUERY = () => ({ sql: "ROLLBACK", args: [], argTypes: [] });
|
|
2818
2853
|
var PHANTOM_COMMIT_QUERY = () => ({
|
|
@@ -2981,7 +3016,7 @@ var TransactionManager = class {
|
|
|
2981
3016
|
}
|
|
2982
3017
|
}
|
|
2983
3018
|
} catch (e) {
|
|
2984
|
-
|
|
3019
|
+
debug2("error in discarded transaction:", e);
|
|
2985
3020
|
}
|
|
2986
3021
|
}
|
|
2987
3022
|
async commitTransaction(transactionId) {
|
|
@@ -3045,7 +3080,7 @@ var TransactionManager = class {
|
|
|
3045
3080
|
if (!transaction) {
|
|
3046
3081
|
const closedTransaction = this.closedTransactions.find((tx) => tx.id === transactionId);
|
|
3047
3082
|
if (closedTransaction) {
|
|
3048
|
-
|
|
3083
|
+
debug2("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
3049
3084
|
switch (closedTransaction.status) {
|
|
3050
3085
|
case "closing":
|
|
3051
3086
|
case "waiting":
|
|
@@ -3062,7 +3097,7 @@ var TransactionManager = class {
|
|
|
3062
3097
|
});
|
|
3063
3098
|
}
|
|
3064
3099
|
} else {
|
|
3065
|
-
|
|
3100
|
+
debug2(`Transaction not found.`, transactionId);
|
|
3066
3101
|
throw new TransactionNotFoundError();
|
|
3067
3102
|
}
|
|
3068
3103
|
}
|
|
@@ -3113,13 +3148,13 @@ var TransactionManager = class {
|
|
|
3113
3148
|
}
|
|
3114
3149
|
}
|
|
3115
3150
|
#debugTransactionAlreadyClosedOnTimeout(transactionId) {
|
|
3116
|
-
|
|
3151
|
+
debug2("Transaction already committed or rolled back when timeout happened.", transactionId);
|
|
3117
3152
|
}
|
|
3118
3153
|
#startTransactionTimeout(transactionId, timeout) {
|
|
3119
3154
|
const timeoutStartedAt = Date.now();
|
|
3120
3155
|
const timer = createTimeoutIfDefined(async () => {
|
|
3121
3156
|
try {
|
|
3122
|
-
|
|
3157
|
+
debug2("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
|
|
3123
3158
|
const tx = this.transactions.get(transactionId);
|
|
3124
3159
|
if (!tx) {
|
|
3125
3160
|
this.#debugTransactionAlreadyClosedOnTimeout(transactionId);
|
|
@@ -3134,7 +3169,7 @@ var TransactionManager = class {
|
|
|
3134
3169
|
}
|
|
3135
3170
|
});
|
|
3136
3171
|
} catch (error) {
|
|
3137
|
-
|
|
3172
|
+
debug2("Error while closing timed-out transaction.", { transactionId, error });
|
|
3138
3173
|
}
|
|
3139
3174
|
}, timeout);
|
|
3140
3175
|
timer?.unref?.();
|
|
@@ -3167,7 +3202,7 @@ var TransactionManager = class {
|
|
|
3167
3202
|
}
|
|
3168
3203
|
async #closeTransaction(tx, status) {
|
|
3169
3204
|
const createClosingPromise = async () => {
|
|
3170
|
-
|
|
3205
|
+
debug2("Closing transaction.", { transactionId: tx.id, status });
|
|
3171
3206
|
try {
|
|
3172
3207
|
if (tx.transaction && status === "committed") {
|
|
3173
3208
|
if (tx.transaction.options.usePhantomQuery) {
|
package/dist/index.mjs
CHANGED
|
@@ -750,6 +750,7 @@ function normalizeDateTime(dt) {
|
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
// src/interpreter/query-interpreter.ts
|
|
753
|
+
import { Debug } from "@prisma/debug";
|
|
753
754
|
import { klona as klona2 } from "klona";
|
|
754
755
|
|
|
755
756
|
// src/sql-commenter.ts
|
|
@@ -1542,6 +1543,7 @@ function getErrorCode2(error) {
|
|
|
1542
1543
|
}
|
|
1543
1544
|
|
|
1544
1545
|
// src/interpreter/query-interpreter.ts
|
|
1546
|
+
var debug = Debug("prisma:client:queryInterpreter");
|
|
1545
1547
|
var QueryInterpreter = class _QueryInterpreter {
|
|
1546
1548
|
#onQuery;
|
|
1547
1549
|
#generators = new GeneratorRegistry();
|
|
@@ -1632,42 +1634,46 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1632
1634
|
}
|
|
1633
1635
|
case "execute": {
|
|
1634
1636
|
const queries = renderQuery(node.args, context.scope, context.generators, this.#maxChunkSize());
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
(
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1637
|
+
return this.#withChunkTransaction(queries.length, context, async (context2) => {
|
|
1638
|
+
let sum = 0;
|
|
1639
|
+
for (const query of queries) {
|
|
1640
|
+
const commentedQuery = applyComments(query, context2.sqlCommenter);
|
|
1641
|
+
sum += await this.#withQuerySpanAndEvent(
|
|
1642
|
+
commentedQuery,
|
|
1643
|
+
context2.queryable,
|
|
1644
|
+
() => context2.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
1645
|
+
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1646
|
+
)
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
return { value: sum };
|
|
1650
|
+
});
|
|
1647
1651
|
}
|
|
1648
1652
|
case "query": {
|
|
1649
1653
|
const queries = renderQuery(node.args, context.scope, context.generators, this.#maxChunkSize());
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
(
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
results
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1654
|
+
return this.#withChunkTransaction(queries.length, context, async (context2) => {
|
|
1655
|
+
let results;
|
|
1656
|
+
for (const query of queries) {
|
|
1657
|
+
const commentedQuery = applyComments(query, context2.sqlCommenter);
|
|
1658
|
+
const result = await this.#withQuerySpanAndEvent(
|
|
1659
|
+
commentedQuery,
|
|
1660
|
+
context2.queryable,
|
|
1661
|
+
() => context2.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
1662
|
+
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1663
|
+
)
|
|
1664
|
+
);
|
|
1665
|
+
if (results === void 0) {
|
|
1666
|
+
results = result;
|
|
1667
|
+
} else {
|
|
1668
|
+
appendToArray(results.rows, result.rows);
|
|
1669
|
+
results.lastInsertId = result.lastInsertId;
|
|
1670
|
+
}
|
|
1665
1671
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
};
|
|
1672
|
+
return {
|
|
1673
|
+
value: node.args.type === "rawSql" ? this.#rawSerializer(results) : this.#serializer(results),
|
|
1674
|
+
lastInsertId: results?.lastInsertId
|
|
1675
|
+
};
|
|
1676
|
+
});
|
|
1671
1677
|
}
|
|
1672
1678
|
case "reverse": {
|
|
1673
1679
|
const { value, lastInsertId } = await this.interpretNode(node.args, context);
|
|
@@ -1708,20 +1714,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1708
1714
|
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
1709
1715
|
}
|
|
1710
1716
|
case "transaction": {
|
|
1711
|
-
|
|
1712
|
-
return this.interpretNode(node.args, context);
|
|
1713
|
-
}
|
|
1714
|
-
const transactionManager = context.transactionManager.manager;
|
|
1715
|
-
const transactionInfo = await transactionManager.startInternalTransaction();
|
|
1716
|
-
const transaction = await transactionManager.getTransaction(transactionInfo, "query");
|
|
1717
|
-
try {
|
|
1718
|
-
const value = await this.interpretNode(node.args, { ...context, queryable: transaction });
|
|
1719
|
-
await transactionManager.commitTransaction(transactionInfo.id);
|
|
1720
|
-
return value;
|
|
1721
|
-
} catch (e) {
|
|
1722
|
-
await transactionManager.rollbackTransaction(transactionInfo.id);
|
|
1723
|
-
throw e;
|
|
1724
|
-
}
|
|
1717
|
+
return this.#withInternalTransaction(context, (context2) => this.interpretNode(node.args, context2));
|
|
1725
1718
|
}
|
|
1726
1719
|
case "dataMap": {
|
|
1727
1720
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
@@ -1906,6 +1899,48 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1906
1899
|
assertNever(node, `Unexpected node type: ${node.type}`);
|
|
1907
1900
|
}
|
|
1908
1901
|
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Runs the statements of a `query` or `execute` node via `fn`, wrapping them in a
|
|
1904
|
+
* transaction when a chunkable statement was split into multiple queries at render time,
|
|
1905
|
+
* so that a partially applied write cannot be observed or left behind if a later chunk
|
|
1906
|
+
* fails. A single statement is atomic on its own, so it runs on the current context.
|
|
1907
|
+
*/
|
|
1908
|
+
#withChunkTransaction(statementCount, context, fn) {
|
|
1909
|
+
if (statementCount <= 1) {
|
|
1910
|
+
return fn(context);
|
|
1911
|
+
}
|
|
1912
|
+
return this.#withInternalTransaction(context, fn);
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Runs `fn` with a context whose queryable is guaranteed to be a transaction, starting a
|
|
1916
|
+
* new internal transaction and committing or rolling it back around the call.
|
|
1917
|
+
*
|
|
1918
|
+
* A disabled transaction manager means the queryable already is a transaction: executors
|
|
1919
|
+
* pass `{ enabled: false }` when the plan runs inside an interactive transaction, and the
|
|
1920
|
+
* context handed to `fn` carries it for the duration of an internal transaction. In that
|
|
1921
|
+
* case `fn` runs on the current context, since the statements it issues are already
|
|
1922
|
+
* covered by the surrounding transaction.
|
|
1923
|
+
*/
|
|
1924
|
+
async #withInternalTransaction(context, fn) {
|
|
1925
|
+
if (!context.transactionManager.enabled) {
|
|
1926
|
+
return fn(context);
|
|
1927
|
+
}
|
|
1928
|
+
const transactionManager = context.transactionManager.manager;
|
|
1929
|
+
const transactionInfo = await transactionManager.startInternalTransaction();
|
|
1930
|
+
const transaction = await transactionManager.getTransaction(transactionInfo, "query");
|
|
1931
|
+
try {
|
|
1932
|
+
const result = await fn({ ...context, queryable: transaction, transactionManager: { enabled: false } });
|
|
1933
|
+
await transactionManager.commitTransaction(transactionInfo.id);
|
|
1934
|
+
return result;
|
|
1935
|
+
} catch (e) {
|
|
1936
|
+
try {
|
|
1937
|
+
await transactionManager.rollbackTransaction(transactionInfo.id);
|
|
1938
|
+
} catch (rollbackError) {
|
|
1939
|
+
debug("failed to roll back an internal transaction", rollbackError);
|
|
1940
|
+
}
|
|
1941
|
+
throw e;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1909
1944
|
#maxChunkSize() {
|
|
1910
1945
|
if (this.#connectionInfo?.maxBindValues !== void 0) {
|
|
1911
1946
|
return this.#connectionInfo.maxBindValues;
|
|
@@ -2683,7 +2718,7 @@ function normalizeValue(type, value) {
|
|
|
2683
2718
|
}
|
|
2684
2719
|
|
|
2685
2720
|
// src/transaction-manager/transaction-manager.ts
|
|
2686
|
-
import { Debug } from "@prisma/debug";
|
|
2721
|
+
import { Debug as Debug2 } from "@prisma/debug";
|
|
2687
2722
|
|
|
2688
2723
|
// src/crypto.ts
|
|
2689
2724
|
async function getCrypto() {
|
|
@@ -2759,7 +2794,7 @@ function trackStartingTransaction() {
|
|
|
2759
2794
|
});
|
|
2760
2795
|
return { abortController: new AbortController(), settled, markSettled };
|
|
2761
2796
|
}
|
|
2762
|
-
var
|
|
2797
|
+
var debug2 = Debug2("prisma:client:transactionManager");
|
|
2763
2798
|
var COMMIT_QUERY = () => ({ sql: "COMMIT", args: [], argTypes: [] });
|
|
2764
2799
|
var ROLLBACK_QUERY = () => ({ sql: "ROLLBACK", args: [], argTypes: [] });
|
|
2765
2800
|
var PHANTOM_COMMIT_QUERY = () => ({
|
|
@@ -2928,7 +2963,7 @@ var TransactionManager = class {
|
|
|
2928
2963
|
}
|
|
2929
2964
|
}
|
|
2930
2965
|
} catch (e) {
|
|
2931
|
-
|
|
2966
|
+
debug2("error in discarded transaction:", e);
|
|
2932
2967
|
}
|
|
2933
2968
|
}
|
|
2934
2969
|
async commitTransaction(transactionId) {
|
|
@@ -2992,7 +3027,7 @@ var TransactionManager = class {
|
|
|
2992
3027
|
if (!transaction) {
|
|
2993
3028
|
const closedTransaction = this.closedTransactions.find((tx) => tx.id === transactionId);
|
|
2994
3029
|
if (closedTransaction) {
|
|
2995
|
-
|
|
3030
|
+
debug2("Transaction already closed.", { transactionId, status: closedTransaction.status });
|
|
2996
3031
|
switch (closedTransaction.status) {
|
|
2997
3032
|
case "closing":
|
|
2998
3033
|
case "waiting":
|
|
@@ -3009,7 +3044,7 @@ var TransactionManager = class {
|
|
|
3009
3044
|
});
|
|
3010
3045
|
}
|
|
3011
3046
|
} else {
|
|
3012
|
-
|
|
3047
|
+
debug2(`Transaction not found.`, transactionId);
|
|
3013
3048
|
throw new TransactionNotFoundError();
|
|
3014
3049
|
}
|
|
3015
3050
|
}
|
|
@@ -3060,13 +3095,13 @@ var TransactionManager = class {
|
|
|
3060
3095
|
}
|
|
3061
3096
|
}
|
|
3062
3097
|
#debugTransactionAlreadyClosedOnTimeout(transactionId) {
|
|
3063
|
-
|
|
3098
|
+
debug2("Transaction already committed or rolled back when timeout happened.", transactionId);
|
|
3064
3099
|
}
|
|
3065
3100
|
#startTransactionTimeout(transactionId, timeout) {
|
|
3066
3101
|
const timeoutStartedAt = Date.now();
|
|
3067
3102
|
const timer = createTimeoutIfDefined(async () => {
|
|
3068
3103
|
try {
|
|
3069
|
-
|
|
3104
|
+
debug2("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
|
|
3070
3105
|
const tx = this.transactions.get(transactionId);
|
|
3071
3106
|
if (!tx) {
|
|
3072
3107
|
this.#debugTransactionAlreadyClosedOnTimeout(transactionId);
|
|
@@ -3081,7 +3116,7 @@ var TransactionManager = class {
|
|
|
3081
3116
|
}
|
|
3082
3117
|
});
|
|
3083
3118
|
} catch (error) {
|
|
3084
|
-
|
|
3119
|
+
debug2("Error while closing timed-out transaction.", { transactionId, error });
|
|
3085
3120
|
}
|
|
3086
3121
|
}, timeout);
|
|
3087
3122
|
timer?.unref?.();
|
|
@@ -3114,7 +3149,7 @@ var TransactionManager = class {
|
|
|
3114
3149
|
}
|
|
3115
3150
|
async #closeTransaction(tx, status) {
|
|
3116
3151
|
const createClosingPromise = async () => {
|
|
3117
|
-
|
|
3152
|
+
debug2("Closing transaction.", { transactionId: tx.id, status });
|
|
3118
3153
|
try {
|
|
3119
3154
|
if (tx.transaction && status === "committed") {
|
|
3120
3155
|
if (tx.transaction.options.usePhantomQuery) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.39",
|
|
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,20 +31,20 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "14.0.0",
|
|
34
|
-
"@prisma/client-runtime-utils": "7.10.0-dev.
|
|
35
|
-
"@prisma/debug": "7.10.0-dev.
|
|
36
|
-
"@prisma/driver-adapter-utils": "7.10.0-dev.
|
|
37
|
-
"@prisma/sqlcommenter": "7.10.0-dev.
|
|
38
|
-
"@prisma/param-graph": "7.10.0-dev.
|
|
39
|
-
"@prisma/json-protocol": "7.10.0-dev.
|
|
34
|
+
"@prisma/client-runtime-utils": "7.10.0-dev.39",
|
|
35
|
+
"@prisma/debug": "7.10.0-dev.39",
|
|
36
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.39",
|
|
37
|
+
"@prisma/sqlcommenter": "7.10.0-dev.39",
|
|
38
|
+
"@prisma/param-graph": "7.10.0-dev.39",
|
|
39
|
+
"@prisma/json-protocol": "7.10.0-dev.39"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@codspeed/benchmark.js-plugin": "4.0.0",
|
|
43
43
|
"@types/benchmark": "2.1.5",
|
|
44
44
|
"@types/node": "~20.19.24",
|
|
45
45
|
"benchmark": "2.1.4",
|
|
46
|
-
"@prisma/
|
|
47
|
-
"@prisma/
|
|
46
|
+
"@prisma/param-graph-builder": "7.10.0-dev.39",
|
|
47
|
+
"@prisma/get-dmmf": "7.10.0-dev.39"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist"
|