@prisma/client-engine-runtime 6.16.0-dev.3 → 6.16.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
@@ -136,8 +136,8 @@ function safeJsonStringify(obj) {
136
136
  return JSON.stringify(obj, (_key, val) => {
137
137
  if (typeof val === "bigint") {
138
138
  return val.toString();
139
- } else if (val instanceof Uint8Array) {
140
- return Buffer.from(val).toString("base64");
139
+ } else if (ArrayBuffer.isView(val)) {
140
+ return Buffer.from(val.buffer, val.byteOffset, val.byteLength).toString("base64");
141
141
  }
142
142
  return val;
143
143
  });
@@ -155,6 +155,10 @@ function normalizeJsonProtocolValues(result) {
155
155
  if (isTaggedValue(result)) {
156
156
  return normalizeTaggedValue(result);
157
157
  }
158
+ if (ArrayBuffer.isView(result)) {
159
+ const buffer = Buffer.from(result.buffer, result.byteOffset, result.byteLength);
160
+ return buffer.toString("base64");
161
+ }
158
162
  if (result.constructor !== null && result.constructor.name !== "Object") {
159
163
  return result;
160
164
  }
@@ -1189,19 +1193,7 @@ var import_driver_adapter_utils2 = require("@prisma/driver-adapter-utils");
1189
1193
  function serializeSql(resultSet) {
1190
1194
  return resultSet.rows.map(
1191
1195
  (row) => row.reduce((acc, value, index) => {
1192
- const splitByDot = resultSet.columnNames[index].split(".");
1193
- let nested = acc;
1194
- for (let i = 0; i < splitByDot.length; i++) {
1195
- const key = splitByDot[i];
1196
- if (i === splitByDot.length - 1) {
1197
- nested[key] = value;
1198
- } else {
1199
- if (nested[key] === void 0) {
1200
- nested[key] = {};
1201
- }
1202
- nested = nested[key];
1203
- }
1204
- }
1196
+ acc[resultSet.columnNames[index]] = value;
1205
1197
  return acc;
1206
1198
  }, {})
1207
1199
  );
@@ -1957,6 +1949,7 @@ var TransactionManager = class {
1957
1949
  this.transactions.set(transaction.id, transaction);
1958
1950
  let hasTimedOut = false;
1959
1951
  const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1952
+ startTimer.unref();
1960
1953
  transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing);
1961
1954
  clearTimeout(startTimer);
1962
1955
  switch (transaction.status) {
@@ -2036,7 +2029,7 @@ var TransactionManager = class {
2036
2029
  }
2037
2030
  #startTransactionTimeout(transactionId, timeout) {
2038
2031
  const timeoutStartedAt = Date.now();
2039
- return setTimeout(async () => {
2032
+ const timer = setTimeout(async () => {
2040
2033
  debug("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
2041
2034
  const tx = this.transactions.get(transactionId);
2042
2035
  if (tx && ["running", "waiting"].includes(tx.status)) {
@@ -2045,6 +2038,8 @@ var TransactionManager = class {
2045
2038
  debug("Transaction already committed or rolled back when timeout happened.", transactionId);
2046
2039
  }
2047
2040
  }, timeout);
2041
+ timer.unref();
2042
+ return timer;
2048
2043
  }
2049
2044
  async #closeTransaction(tx, status) {
2050
2045
  const createClosingPromise = async () => {
package/dist/index.mjs CHANGED
@@ -86,8 +86,8 @@ function safeJsonStringify(obj) {
86
86
  return JSON.stringify(obj, (_key, val) => {
87
87
  if (typeof val === "bigint") {
88
88
  return val.toString();
89
- } else if (val instanceof Uint8Array) {
90
- return Buffer.from(val).toString("base64");
89
+ } else if (ArrayBuffer.isView(val)) {
90
+ return Buffer.from(val.buffer, val.byteOffset, val.byteLength).toString("base64");
91
91
  }
92
92
  return val;
93
93
  });
@@ -105,6 +105,10 @@ function normalizeJsonProtocolValues(result) {
105
105
  if (isTaggedValue(result)) {
106
106
  return normalizeTaggedValue(result);
107
107
  }
108
+ if (ArrayBuffer.isView(result)) {
109
+ const buffer = Buffer.from(result.buffer, result.byteOffset, result.byteLength);
110
+ return buffer.toString("base64");
111
+ }
108
112
  if (result.constructor !== null && result.constructor.name !== "Object") {
109
113
  return result;
110
114
  }
@@ -1139,19 +1143,7 @@ import { ColumnTypeEnum } from "@prisma/driver-adapter-utils";
1139
1143
  function serializeSql(resultSet) {
1140
1144
  return resultSet.rows.map(
1141
1145
  (row) => row.reduce((acc, value, index) => {
1142
- const splitByDot = resultSet.columnNames[index].split(".");
1143
- let nested = acc;
1144
- for (let i = 0; i < splitByDot.length; i++) {
1145
- const key = splitByDot[i];
1146
- if (i === splitByDot.length - 1) {
1147
- nested[key] = value;
1148
- } else {
1149
- if (nested[key] === void 0) {
1150
- nested[key] = {};
1151
- }
1152
- nested = nested[key];
1153
- }
1154
- }
1146
+ acc[resultSet.columnNames[index]] = value;
1155
1147
  return acc;
1156
1148
  }, {})
1157
1149
  );
@@ -1907,6 +1899,7 @@ var TransactionManager = class {
1907
1899
  this.transactions.set(transaction.id, transaction);
1908
1900
  let hasTimedOut = false;
1909
1901
  const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1902
+ startTimer.unref();
1910
1903
  transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing);
1911
1904
  clearTimeout(startTimer);
1912
1905
  switch (transaction.status) {
@@ -1986,7 +1979,7 @@ var TransactionManager = class {
1986
1979
  }
1987
1980
  #startTransactionTimeout(transactionId, timeout) {
1988
1981
  const timeoutStartedAt = Date.now();
1989
- return setTimeout(async () => {
1982
+ const timer = setTimeout(async () => {
1990
1983
  debug("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
1991
1984
  const tx = this.transactions.get(transactionId);
1992
1985
  if (tx && ["running", "waiting"].includes(tx.status)) {
@@ -1995,6 +1988,8 @@ var TransactionManager = class {
1995
1988
  debug("Transaction already committed or rolled back when timeout happened.", transactionId);
1996
1989
  }
1997
1990
  }, timeout);
1991
+ timer.unref();
1992
+ return timer;
1998
1993
  }
1999
1994
  async #closeTransaction(tx, status) {
2000
1995
  const createClosingPromise = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.16.0-dev.3",
3
+ "version": "6.16.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/debug": "6.16.0-dev.3",
35
- "@prisma/driver-adapter-utils": "6.16.0-dev.3"
34
+ "@prisma/debug": "6.16.0-dev.31",
35
+ "@prisma/driver-adapter-utils": "6.16.0-dev.31"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",