@prisma/client-engine-runtime 6.10.1 → 6.11.0-dev.10
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 +36 -22
- package/dist/index.mjs +36 -22
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -267,6 +267,9 @@ function mapValue(value, columnName, resultType, enums) {
|
|
|
267
267
|
if (Array.isArray(value)) {
|
|
268
268
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
269
269
|
}
|
|
270
|
+
if (value instanceof Uint8Array) {
|
|
271
|
+
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
272
|
+
}
|
|
270
273
|
throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
|
|
271
274
|
}
|
|
272
275
|
case "Enum": {
|
|
@@ -764,8 +767,16 @@ function doesRequireEvaluation(param) {
|
|
|
764
767
|
// src/interpreter/serializeSql.ts
|
|
765
768
|
var import_driver_adapter_utils2 = require("@prisma/driver-adapter-utils");
|
|
766
769
|
function serializeSql(resultSet) {
|
|
770
|
+
const mappers = resultSet.columnTypes.map((type) => {
|
|
771
|
+
switch (type) {
|
|
772
|
+
case import_driver_adapter_utils2.ColumnTypeEnum.Bytes:
|
|
773
|
+
return (value) => Array.isArray(value) ? new Uint8Array(value) : value;
|
|
774
|
+
default:
|
|
775
|
+
return (value) => value;
|
|
776
|
+
}
|
|
777
|
+
});
|
|
767
778
|
return resultSet.rows.map(
|
|
768
|
-
(row) => row.reduce((acc, value, index) => {
|
|
779
|
+
(row) => row.map((value, index) => mappers[index](value)).reduce((acc, value, index) => {
|
|
769
780
|
const splitByDot = resultSet.columnNames[index].split(".");
|
|
770
781
|
let nested = acc;
|
|
771
782
|
for (let i = 0; i < splitByDot.length; i++) {
|
|
@@ -1511,30 +1522,33 @@ var TransactionManager = class {
|
|
|
1511
1522
|
async closeTransaction(tx, status) {
|
|
1512
1523
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1513
1524
|
tx.status = status;
|
|
1514
|
-
|
|
1515
|
-
if (tx.transaction
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1525
|
+
try {
|
|
1526
|
+
if (tx.transaction && status === "committed") {
|
|
1527
|
+
if (tx.transaction.options.usePhantomQuery) {
|
|
1528
|
+
await this.#withQuerySpanAndEvent(PHANTOM_COMMIT_QUERY(), tx.transaction, () => tx.transaction.commit());
|
|
1529
|
+
} else {
|
|
1530
|
+
const query = COMMIT_QUERY();
|
|
1531
|
+
await this.#withQuerySpanAndEvent(query, tx.transaction, () => tx.transaction.executeRaw(query));
|
|
1532
|
+
await tx.transaction.commit();
|
|
1533
|
+
}
|
|
1534
|
+
} else if (tx.transaction) {
|
|
1535
|
+
if (tx.transaction.options.usePhantomQuery) {
|
|
1536
|
+
await this.#withQuerySpanAndEvent(PHANTOM_ROLLBACK_QUERY(), tx.transaction, () => tx.transaction.rollback());
|
|
1537
|
+
} else {
|
|
1538
|
+
const query = ROLLBACK_QUERY();
|
|
1539
|
+
await this.#withQuerySpanAndEvent(query, tx.transaction, () => tx.transaction.executeRaw(query));
|
|
1540
|
+
await tx.transaction.rollback();
|
|
1541
|
+
}
|
|
1521
1542
|
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1543
|
+
} finally {
|
|
1544
|
+
clearTimeout(tx.timer);
|
|
1545
|
+
tx.timer = void 0;
|
|
1546
|
+
this.transactions.delete(tx.id);
|
|
1547
|
+
this.closedTransactions.push(tx);
|
|
1548
|
+
if (this.closedTransactions.length > MAX_CLOSED_TRANSACTIONS) {
|
|
1549
|
+
this.closedTransactions.shift();
|
|
1529
1550
|
}
|
|
1530
1551
|
}
|
|
1531
|
-
clearTimeout(tx.timer);
|
|
1532
|
-
tx.timer = void 0;
|
|
1533
|
-
this.transactions.delete(tx.id);
|
|
1534
|
-
this.closedTransactions.push(tx);
|
|
1535
|
-
if (this.closedTransactions.length > MAX_CLOSED_TRANSACTIONS) {
|
|
1536
|
-
this.closedTransactions.shift();
|
|
1537
|
-
}
|
|
1538
1552
|
}
|
|
1539
1553
|
validateOptions(options) {
|
|
1540
1554
|
if (!options.timeout) throw new TransactionManagerError("timeout is required");
|
package/dist/index.mjs
CHANGED
|
@@ -219,6 +219,9 @@ function mapValue(value, columnName, resultType, enums) {
|
|
|
219
219
|
if (Array.isArray(value)) {
|
|
220
220
|
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
221
221
|
}
|
|
222
|
+
if (value instanceof Uint8Array) {
|
|
223
|
+
return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
|
|
224
|
+
}
|
|
222
225
|
throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
|
|
223
226
|
}
|
|
224
227
|
case "Enum": {
|
|
@@ -716,8 +719,16 @@ function doesRequireEvaluation(param) {
|
|
|
716
719
|
// src/interpreter/serializeSql.ts
|
|
717
720
|
import { ColumnTypeEnum } from "@prisma/driver-adapter-utils";
|
|
718
721
|
function serializeSql(resultSet) {
|
|
722
|
+
const mappers = resultSet.columnTypes.map((type) => {
|
|
723
|
+
switch (type) {
|
|
724
|
+
case ColumnTypeEnum.Bytes:
|
|
725
|
+
return (value) => Array.isArray(value) ? new Uint8Array(value) : value;
|
|
726
|
+
default:
|
|
727
|
+
return (value) => value;
|
|
728
|
+
}
|
|
729
|
+
});
|
|
719
730
|
return resultSet.rows.map(
|
|
720
|
-
(row) => row.reduce((acc, value, index) => {
|
|
731
|
+
(row) => row.map((value, index) => mappers[index](value)).reduce((acc, value, index) => {
|
|
721
732
|
const splitByDot = resultSet.columnNames[index].split(".");
|
|
722
733
|
let nested = acc;
|
|
723
734
|
for (let i = 0; i < splitByDot.length; i++) {
|
|
@@ -1463,30 +1474,33 @@ var TransactionManager = class {
|
|
|
1463
1474
|
async closeTransaction(tx, status) {
|
|
1464
1475
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
1465
1476
|
tx.status = status;
|
|
1466
|
-
|
|
1467
|
-
if (tx.transaction
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1477
|
+
try {
|
|
1478
|
+
if (tx.transaction && status === "committed") {
|
|
1479
|
+
if (tx.transaction.options.usePhantomQuery) {
|
|
1480
|
+
await this.#withQuerySpanAndEvent(PHANTOM_COMMIT_QUERY(), tx.transaction, () => tx.transaction.commit());
|
|
1481
|
+
} else {
|
|
1482
|
+
const query = COMMIT_QUERY();
|
|
1483
|
+
await this.#withQuerySpanAndEvent(query, tx.transaction, () => tx.transaction.executeRaw(query));
|
|
1484
|
+
await tx.transaction.commit();
|
|
1485
|
+
}
|
|
1486
|
+
} else if (tx.transaction) {
|
|
1487
|
+
if (tx.transaction.options.usePhantomQuery) {
|
|
1488
|
+
await this.#withQuerySpanAndEvent(PHANTOM_ROLLBACK_QUERY(), tx.transaction, () => tx.transaction.rollback());
|
|
1489
|
+
} else {
|
|
1490
|
+
const query = ROLLBACK_QUERY();
|
|
1491
|
+
await this.#withQuerySpanAndEvent(query, tx.transaction, () => tx.transaction.executeRaw(query));
|
|
1492
|
+
await tx.transaction.rollback();
|
|
1493
|
+
}
|
|
1473
1494
|
}
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1495
|
+
} finally {
|
|
1496
|
+
clearTimeout(tx.timer);
|
|
1497
|
+
tx.timer = void 0;
|
|
1498
|
+
this.transactions.delete(tx.id);
|
|
1499
|
+
this.closedTransactions.push(tx);
|
|
1500
|
+
if (this.closedTransactions.length > MAX_CLOSED_TRANSACTIONS) {
|
|
1501
|
+
this.closedTransactions.shift();
|
|
1481
1502
|
}
|
|
1482
1503
|
}
|
|
1483
|
-
clearTimeout(tx.timer);
|
|
1484
|
-
tx.timer = void 0;
|
|
1485
|
-
this.transactions.delete(tx.id);
|
|
1486
|
-
this.closedTransactions.push(tx);
|
|
1487
|
-
if (this.closedTransactions.length > MAX_CLOSED_TRANSACTIONS) {
|
|
1488
|
-
this.closedTransactions.shift();
|
|
1489
|
-
}
|
|
1490
1504
|
}
|
|
1491
1505
|
validateOptions(options) {
|
|
1492
1506
|
if (!options.timeout) throw new TransactionManagerError("timeout is required");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.10
|
|
3
|
+
"version": "6.11.0-dev.10",
|
|
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.10
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.10
|
|
34
|
+
"@prisma/debug": "6.11.0-dev.10",
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.11.0-dev.10"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|