@prisma/adapter-pg 7.2.0-dev.2 → 7.2.0-dev.21

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
@@ -325,18 +325,10 @@ function normalize_xml(xml) {
325
325
  function toJson(json) {
326
326
  return json;
327
327
  }
328
- function encodeBuffer(buffer) {
329
- return Array.from(new Uint8Array(buffer));
330
- }
331
328
  var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
332
- var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
333
- function normalizeByteaArray(serializedBytesArray) {
334
- const buffers = parseBytesArray(serializedBytesArray);
335
- return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
336
- }
329
+ var normalizeByteaArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
337
330
  function convertBytes(serializedBytes) {
338
- const buffer = parsePgBytes(serializedBytes);
339
- return encodeBuffer(buffer);
331
+ return parsePgBytes(serializedBytes);
340
332
  }
341
333
  function normalizeBit(bit) {
342
334
  return bit;
@@ -389,11 +381,8 @@ function mapArg(arg, argType) {
389
381
  if (typeof arg === "string" && argType.scalarType === "bytes") {
390
382
  return Buffer.from(arg, "base64");
391
383
  }
392
- if (Array.isArray(arg) && argType.scalarType === "bytes") {
393
- return Buffer.from(arg);
394
- }
395
384
  if (ArrayBuffer.isView(arg)) {
396
- return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
385
+ return new Uint8Array(arg.buffer, arg.byteOffset, arg.byteLength);
397
386
  }
398
387
  return arg;
399
388
  }
@@ -475,6 +464,11 @@ function mapDriverError(error) {
475
464
  kind: "ValueOutOfRange",
476
465
  cause: error.message
477
466
  };
467
+ case "22P02":
468
+ return {
469
+ kind: "InvalidInputValue",
470
+ message: error.message
471
+ };
478
472
  case "23505": {
479
473
  const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
480
474
  return {
package/dist/index.mjs CHANGED
@@ -289,18 +289,10 @@ function normalize_xml(xml) {
289
289
  function toJson(json) {
290
290
  return json;
291
291
  }
292
- function encodeBuffer(buffer) {
293
- return Array.from(new Uint8Array(buffer));
294
- }
295
292
  var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
296
- var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
297
- function normalizeByteaArray(serializedBytesArray) {
298
- const buffers = parseBytesArray(serializedBytesArray);
299
- return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
300
- }
293
+ var normalizeByteaArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
301
294
  function convertBytes(serializedBytes) {
302
- const buffer = parsePgBytes(serializedBytes);
303
- return encodeBuffer(buffer);
295
+ return parsePgBytes(serializedBytes);
304
296
  }
305
297
  function normalizeBit(bit) {
306
298
  return bit;
@@ -353,11 +345,8 @@ function mapArg(arg, argType) {
353
345
  if (typeof arg === "string" && argType.scalarType === "bytes") {
354
346
  return Buffer.from(arg, "base64");
355
347
  }
356
- if (Array.isArray(arg) && argType.scalarType === "bytes") {
357
- return Buffer.from(arg);
358
- }
359
348
  if (ArrayBuffer.isView(arg)) {
360
- return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
349
+ return new Uint8Array(arg.buffer, arg.byteOffset, arg.byteLength);
361
350
  }
362
351
  return arg;
363
352
  }
@@ -439,6 +428,11 @@ function mapDriverError(error) {
439
428
  kind: "ValueOutOfRange",
440
429
  cause: error.message
441
430
  };
431
+ case "22P02":
432
+ return {
433
+ kind: "InvalidInputValue",
434
+ message: error.message
435
+ };
442
436
  case "23505": {
443
437
  const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
444
438
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-pg",
3
- "version": "7.2.0-dev.2",
3
+ "version": "7.2.0-dev.21",
4
4
  "description": "Prisma's driver adapter for \"pg\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,11 +33,11 @@
33
33
  "dependencies": {
34
34
  "pg": "^8.16.3",
35
35
  "postgres-array": "3.0.4",
36
- "@prisma/driver-adapter-utils": "7.2.0-dev.2"
36
+ "@prisma/driver-adapter-utils": "7.2.0-dev.21"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/pg": "8.11.11",
40
- "@prisma/debug": "7.2.0-dev.2"
40
+ "@prisma/debug": "7.2.0-dev.21"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "DEV=true tsx helpers/build.ts",