@prisma/client-engine-runtime 6.16.0-integration-feat-orm-1074-package-dev-export.3 → 6.16.0-integration-push-prynymnkvlrn.2

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
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(index_exports);
52
52
  var import_decimal2 = require("decimal.js");
53
53
 
54
54
  // src/utils.ts
55
- var import_decimal = require("decimal.js");
55
+ var import_decimal = __toESM(require("decimal.js"));
56
56
  function assertNever(_, message) {
57
57
  throw new Error(message);
58
58
  }
@@ -67,7 +67,7 @@ function doKeysMatch(lhs, rhs) {
67
67
  if (typeof lhs[key] === typeof rhs[key] && typeof lhs[key] !== "object") {
68
68
  return lhs[key] === rhs[key];
69
69
  }
70
- if (import_decimal.Decimal.isDecimal(lhs[key]) || import_decimal.Decimal.isDecimal(rhs[key])) {
70
+ if (import_decimal.default.isDecimal(lhs[key]) || import_decimal.default.isDecimal(rhs[key])) {
71
71
  const lhsDecimal = asDecimal(lhs[key]);
72
72
  const rhsDecimal = asDecimal(rhs[key]);
73
73
  return lhsDecimal && rhsDecimal && lhsDecimal.equals(rhsDecimal);
@@ -86,10 +86,10 @@ function doKeysMatch(lhs, rhs) {
86
86
  });
87
87
  }
88
88
  function asDecimal(value) {
89
- if (import_decimal.Decimal.isDecimal(value)) {
89
+ if (import_decimal.default.isDecimal(value)) {
90
90
  return value;
91
91
  } else if (typeof value === "number" || typeof value === "string") {
92
- return new import_decimal.Decimal(value);
92
+ return new import_decimal.default(value);
93
93
  } else {
94
94
  return;
95
95
  }
@@ -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
  }
@@ -439,7 +443,7 @@ function convertCompactedRows(rows, compiledBatch) {
439
443
  }
440
444
 
441
445
  // src/interpreter/data-mapper.ts
442
- var import_decimal3 = require("decimal.js");
446
+ var import_decimal3 = __toESM(require("decimal.js"));
443
447
  var DataMapperError = class extends Error {
444
448
  name = "DataMapperError";
445
449
  };
@@ -601,7 +605,7 @@ function mapValue(value, columnName, scalarType, enums) {
601
605
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
602
606
  }
603
607
  case "decimal":
604
- if (typeof value !== "number" && typeof value !== "string" && !import_decimal3.Decimal.isDecimal(value)) {
608
+ if (typeof value !== "number" && typeof value !== "string" && !import_decimal3.default.isDecimal(value)) {
605
609
  throw new DataMapperError(`Expected a decimal in column '${columnName}', got ${typeof value}: ${value}`);
606
610
  }
607
611
  return { $type: "Decimal", value };
@@ -1814,7 +1818,7 @@ function evalFieldOperation(op, value, scope, generators) {
1814
1818
  }
1815
1819
 
1816
1820
  // src/raw-json-protocol.ts
1817
- var import_decimal4 = require("decimal.js");
1821
+ var import_decimal4 = __toESM(require("decimal.js"));
1818
1822
  function normalizeRawJsonProtocolResponse(response) {
1819
1823
  for (let i = 0; i < response.rows.length; i++) {
1820
1824
  const row = response.rows[i];
@@ -1832,7 +1836,7 @@ function normalizeValue(type, value) {
1832
1836
  case "bigint":
1833
1837
  return String(BigInt(value));
1834
1838
  case "decimal":
1835
- return String(new import_decimal4.Decimal(value));
1839
+ return String(new import_decimal4.default(value));
1836
1840
  case "bigint-array":
1837
1841
  return value.map((v) => normalizeValue("bigint", v));
1838
1842
  case "decimal-array":
@@ -1957,8 +1961,8 @@ var TransactionManager = class {
1957
1961
  this.transactions.set(transaction.id, transaction);
1958
1962
  let hasTimedOut = false;
1959
1963
  const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1960
- transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing);
1961
- clearTimeout(startTimer);
1964
+ startTimer.unref();
1965
+ transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing).finally(() => clearTimeout(startTimer));
1962
1966
  switch (transaction.status) {
1963
1967
  case "waiting":
1964
1968
  if (hasTimedOut) {
@@ -2036,7 +2040,7 @@ var TransactionManager = class {
2036
2040
  }
2037
2041
  #startTransactionTimeout(transactionId, timeout) {
2038
2042
  const timeoutStartedAt = Date.now();
2039
- return setTimeout(async () => {
2043
+ const timer = setTimeout(async () => {
2040
2044
  debug("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
2041
2045
  const tx = this.transactions.get(transactionId);
2042
2046
  if (tx && ["running", "waiting"].includes(tx.status)) {
@@ -2045,6 +2049,8 @@ var TransactionManager = class {
2045
2049
  debug("Transaction already committed or rolled back when timeout happened.", transactionId);
2046
2050
  }
2047
2051
  }, timeout);
2052
+ timer.unref();
2053
+ return timer;
2048
2054
  }
2049
2055
  async #closeTransaction(tx, status) {
2050
2056
  const createClosingPromise = async () => {
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Decimal as Decimal2 } from "decimal.js";
3
3
 
4
4
  // src/utils.ts
5
- import { Decimal } from "decimal.js";
5
+ import Decimal from "decimal.js";
6
6
  function assertNever(_, message) {
7
7
  throw new Error(message);
8
8
  }
@@ -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
  }
@@ -389,7 +393,7 @@ function convertCompactedRows(rows, compiledBatch) {
389
393
  }
390
394
 
391
395
  // src/interpreter/data-mapper.ts
392
- import { Decimal as Decimal3 } from "decimal.js";
396
+ import Decimal3 from "decimal.js";
393
397
  var DataMapperError = class extends Error {
394
398
  name = "DataMapperError";
395
399
  };
@@ -1764,7 +1768,7 @@ function evalFieldOperation(op, value, scope, generators) {
1764
1768
  }
1765
1769
 
1766
1770
  // src/raw-json-protocol.ts
1767
- import { Decimal as Decimal4 } from "decimal.js";
1771
+ import Decimal4 from "decimal.js";
1768
1772
  function normalizeRawJsonProtocolResponse(response) {
1769
1773
  for (let i = 0; i < response.rows.length; i++) {
1770
1774
  const row = response.rows[i];
@@ -1907,8 +1911,8 @@ var TransactionManager = class {
1907
1911
  this.transactions.set(transaction.id, transaction);
1908
1912
  let hasTimedOut = false;
1909
1913
  const startTimer = setTimeout(() => hasTimedOut = true, validatedOptions.maxWait);
1910
- transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing);
1911
- clearTimeout(startTimer);
1914
+ startTimer.unref();
1915
+ transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel).catch(rethrowAsUserFacing).finally(() => clearTimeout(startTimer));
1912
1916
  switch (transaction.status) {
1913
1917
  case "waiting":
1914
1918
  if (hasTimedOut) {
@@ -1986,7 +1990,7 @@ var TransactionManager = class {
1986
1990
  }
1987
1991
  #startTransactionTimeout(transactionId, timeout) {
1988
1992
  const timeoutStartedAt = Date.now();
1989
- return setTimeout(async () => {
1993
+ const timer = setTimeout(async () => {
1990
1994
  debug("Transaction timed out.", { transactionId, timeoutStartedAt, timeout });
1991
1995
  const tx = this.transactions.get(transactionId);
1992
1996
  if (tx && ["running", "waiting"].includes(tx.status)) {
@@ -1995,6 +1999,8 @@ var TransactionManager = class {
1995
1999
  debug("Transaction already committed or rolled back when timeout happened.", transactionId);
1996
2000
  }
1997
2001
  }, timeout);
2002
+ timer.unref();
2003
+ return timer;
1998
2004
  }
1999
2005
  async #closeTransaction(tx, status) {
2000
2006
  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-integration-feat-orm-1074-package-dev-export.3",
3
+ "version": "6.16.0-integration-push-prynymnkvlrn.2",
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-integration-feat-orm-1074-package-dev-export.3",
35
- "@prisma/driver-adapter-utils": "6.16.0-integration-feat-orm-1074-package-dev-export.3"
34
+ "@prisma/debug": "6.16.0-integration-push-prynymnkvlrn.2",
35
+ "@prisma/driver-adapter-utils": "6.16.0-integration-push-prynymnkvlrn.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",