@prisma/client-engine-runtime 6.11.0-dev.8 → 6.11.0-integration-fix-generator-ts-pre-preview.1

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
@@ -230,6 +230,12 @@ function mapValue(value, columnName, resultType, enums) {
230
230
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
231
231
  }
232
232
  }
233
+ if (value instanceof Uint8Array) {
234
+ for (const byte of value) {
235
+ if (byte !== 0) return true;
236
+ }
237
+ return false;
238
+ }
233
239
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
234
240
  }
235
241
  case "Decimal":
@@ -267,6 +273,9 @@ function mapValue(value, columnName, resultType, enums) {
267
273
  if (Array.isArray(value)) {
268
274
  return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
269
275
  }
276
+ if (value instanceof Uint8Array) {
277
+ return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
278
+ }
270
279
  throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
271
280
  }
272
281
  case "Enum": {
@@ -764,8 +773,16 @@ function doesRequireEvaluation(param) {
764
773
  // src/interpreter/serializeSql.ts
765
774
  var import_driver_adapter_utils2 = require("@prisma/driver-adapter-utils");
766
775
  function serializeSql(resultSet) {
776
+ const mappers = resultSet.columnTypes.map((type) => {
777
+ switch (type) {
778
+ case import_driver_adapter_utils2.ColumnTypeEnum.Bytes:
779
+ return (value) => Array.isArray(value) ? new Uint8Array(value) : value;
780
+ default:
781
+ return (value) => value;
782
+ }
783
+ });
767
784
  return resultSet.rows.map(
768
- (row) => row.reduce((acc, value, index) => {
785
+ (row) => row.map((value, index) => mappers[index](value)).reduce((acc, value, index) => {
769
786
  const splitByDot = resultSet.columnNames[index].split(".");
770
787
  let nested = acc;
771
788
  for (let i = 0; i < splitByDot.length; i++) {
@@ -1424,17 +1441,16 @@ var TransactionManager = class {
1424
1441
  transaction: void 0
1425
1442
  };
1426
1443
  this.transactions.set(transaction.id, transaction);
1427
- transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
1428
- const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1444
+ const startTimer = setTimeout(() => transaction.status = "timed_out", validatedOptions.maxWait);
1445
+ transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1446
+ clearTimeout(startTimer);
1429
1447
  switch (transaction.status) {
1430
1448
  case "waiting":
1431
- transaction.transaction = startedTransaction;
1432
- clearTimeout(transaction.timer);
1433
- transaction.timer = void 0;
1434
1449
  transaction.status = "running";
1435
1450
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
1436
1451
  return { id: transaction.id };
1437
1452
  case "timed_out":
1453
+ await this.closeTransaction(transaction, "timed_out");
1438
1454
  throw new TransactionStartTimeoutError();
1439
1455
  case "running":
1440
1456
  case "committed":
package/dist/index.mjs CHANGED
@@ -182,6 +182,12 @@ function mapValue(value, columnName, resultType, enums) {
182
182
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
183
183
  }
184
184
  }
185
+ if (value instanceof Uint8Array) {
186
+ for (const byte of value) {
187
+ if (byte !== 0) return true;
188
+ }
189
+ return false;
190
+ }
185
191
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
186
192
  }
187
193
  case "Decimal":
@@ -219,6 +225,9 @@ function mapValue(value, columnName, resultType, enums) {
219
225
  if (Array.isArray(value)) {
220
226
  return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
221
227
  }
228
+ if (value instanceof Uint8Array) {
229
+ return { $type: "Bytes", value: Buffer.from(value).toString("base64") };
230
+ }
222
231
  throw new DataMapperError(`Expected a byte array in column '${columnName}', got ${typeof value}: ${value}`);
223
232
  }
224
233
  case "Enum": {
@@ -716,8 +725,16 @@ function doesRequireEvaluation(param) {
716
725
  // src/interpreter/serializeSql.ts
717
726
  import { ColumnTypeEnum } from "@prisma/driver-adapter-utils";
718
727
  function serializeSql(resultSet) {
728
+ const mappers = resultSet.columnTypes.map((type) => {
729
+ switch (type) {
730
+ case ColumnTypeEnum.Bytes:
731
+ return (value) => Array.isArray(value) ? new Uint8Array(value) : value;
732
+ default:
733
+ return (value) => value;
734
+ }
735
+ });
719
736
  return resultSet.rows.map(
720
- (row) => row.reduce((acc, value, index) => {
737
+ (row) => row.map((value, index) => mappers[index](value)).reduce((acc, value, index) => {
721
738
  const splitByDot = resultSet.columnNames[index].split(".");
722
739
  let nested = acc;
723
740
  for (let i = 0; i < splitByDot.length; i++) {
@@ -1376,17 +1393,16 @@ var TransactionManager = class {
1376
1393
  transaction: void 0
1377
1394
  };
1378
1395
  this.transactions.set(transaction.id, transaction);
1379
- transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
1380
- const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1396
+ const startTimer = setTimeout(() => transaction.status = "timed_out", validatedOptions.maxWait);
1397
+ transaction.transaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
1398
+ clearTimeout(startTimer);
1381
1399
  switch (transaction.status) {
1382
1400
  case "waiting":
1383
- transaction.transaction = startedTransaction;
1384
- clearTimeout(transaction.timer);
1385
- transaction.timer = void 0;
1386
1401
  transaction.status = "running";
1387
1402
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
1388
1403
  return { id: transaction.id };
1389
1404
  case "timed_out":
1405
+ await this.closeTransaction(transaction, "timed_out");
1390
1406
  throw new TransactionStartTimeoutError();
1391
1407
  case "running":
1392
1408
  case "committed":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.11.0-dev.8",
3
+ "version": "6.11.0-integration-fix-generator-ts-pre-preview.1",
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.11.0-dev.8",
35
- "@prisma/driver-adapter-utils": "6.11.0-dev.8"
34
+ "@prisma/debug": "6.11.0-integration-fix-generator-ts-pre-preview.1",
35
+ "@prisma/driver-adapter-utils": "6.11.0-integration-fix-generator-ts-pre-preview.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",