@prisma/adapter-pg 7.3.0-integration-prisma6-fix-cloudflare-engine.3 → 7.3.0-integration-engines-7-3-0-12-parameterization-844f54891f0a80ec1820fc26cf513002357e4245.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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains the driver adapter for Prisma ORM that enables usage of th
8
8
 
9
9
  ## Usage
10
10
 
11
- This section explains how you can use it with Prisma ORM and the `@prisma/adapter-pg` driver adapter. Be sure that the `DATABASE_URL` environment variable is set to your PostgreSQL connection string (e.g. in a `.env` file).
11
+ This section explains how you can use it with Prisma ORM and the `@prisma/adapter-pg` driver adapter. Be sure that the `DATABASE_URL` environment variable is set to your PostgreSQL connection string (e.g. loaded using `dotenv` from a `.env` file).
12
12
 
13
13
  ### 1. Install the dependencies
14
14
 
package/dist/index.js CHANGED
@@ -50,6 +50,9 @@ var import_pg = __toESM(require("pg"));
50
50
  var import_postgres_array = require("postgres-array");
51
51
  var { types } = import_pg.default;
52
52
  var { builtins: ScalarColumnType, getTypeParser } = types;
53
+ var AdditionalScalarColumnType = {
54
+ NAME: 19
55
+ };
53
56
  var ArrayColumnType = {
54
57
  BIT_ARRAY: 1561,
55
58
  BOOL_ARRAY: 1e3,
@@ -240,6 +243,7 @@ function fieldToColumnType(fieldTypeId) {
240
243
  case ScalarColumnType.INET:
241
244
  case ScalarColumnType.CIDR:
242
245
  case ScalarColumnType.XML:
246
+ case AdditionalScalarColumnType.NAME:
243
247
  return import_driver_adapter_utils.ColumnTypeEnum.Text;
244
248
  case ScalarColumnType.BYTEA:
245
249
  return import_driver_adapter_utils.ColumnTypeEnum.Bytes;
@@ -321,18 +325,10 @@ function normalize_xml(xml) {
321
325
  function toJson(json) {
322
326
  return json;
323
327
  }
324
- function encodeBuffer(buffer) {
325
- return Array.from(new Uint8Array(buffer));
326
- }
327
328
  var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
328
- var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
329
- function normalizeByteaArray(serializedBytesArray) {
330
- const buffers = parseBytesArray(serializedBytesArray);
331
- return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
332
- }
329
+ var normalizeByteaArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
333
330
  function convertBytes(serializedBytes) {
334
- const buffer = parsePgBytes(serializedBytes);
335
- return encodeBuffer(buffer);
331
+ return parsePgBytes(serializedBytes);
336
332
  }
337
333
  function normalizeBit(bit) {
338
334
  return bit;
@@ -385,11 +381,8 @@ function mapArg(arg, argType) {
385
381
  if (typeof arg === "string" && argType.scalarType === "bytes") {
386
382
  return Buffer.from(arg, "base64");
387
383
  }
388
- if (Array.isArray(arg) && argType.scalarType === "bytes") {
389
- return Buffer.from(arg);
390
- }
391
384
  if (ArrayBuffer.isView(arg)) {
392
- return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
385
+ return new Uint8Array(arg.buffer, arg.byteOffset, arg.byteLength);
393
386
  }
394
387
  return arg;
395
388
  }
@@ -471,6 +464,11 @@ function mapDriverError(error) {
471
464
  kind: "ValueOutOfRange",
472
465
  cause: error.message
473
466
  };
467
+ case "22P02":
468
+ return {
469
+ kind: "InvalidInputValue",
470
+ message: error.message
471
+ };
474
472
  case "23505": {
475
473
  const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
476
474
  return {
package/dist/index.mjs CHANGED
@@ -14,6 +14,9 @@ import pg from "pg";
14
14
  import { parse as parseArray } from "postgres-array";
15
15
  var { types } = pg;
16
16
  var { builtins: ScalarColumnType, getTypeParser } = types;
17
+ var AdditionalScalarColumnType = {
18
+ NAME: 19
19
+ };
17
20
  var ArrayColumnType = {
18
21
  BIT_ARRAY: 1561,
19
22
  BOOL_ARRAY: 1e3,
@@ -204,6 +207,7 @@ function fieldToColumnType(fieldTypeId) {
204
207
  case ScalarColumnType.INET:
205
208
  case ScalarColumnType.CIDR:
206
209
  case ScalarColumnType.XML:
210
+ case AdditionalScalarColumnType.NAME:
207
211
  return ColumnTypeEnum.Text;
208
212
  case ScalarColumnType.BYTEA:
209
213
  return ColumnTypeEnum.Bytes;
@@ -285,18 +289,10 @@ function normalize_xml(xml) {
285
289
  function toJson(json) {
286
290
  return json;
287
291
  }
288
- function encodeBuffer(buffer) {
289
- return Array.from(new Uint8Array(buffer));
290
- }
291
292
  var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
292
- var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
293
- function normalizeByteaArray(serializedBytesArray) {
294
- const buffers = parseBytesArray(serializedBytesArray);
295
- return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
296
- }
293
+ var normalizeByteaArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
297
294
  function convertBytes(serializedBytes) {
298
- const buffer = parsePgBytes(serializedBytes);
299
- return encodeBuffer(buffer);
295
+ return parsePgBytes(serializedBytes);
300
296
  }
301
297
  function normalizeBit(bit) {
302
298
  return bit;
@@ -349,11 +345,8 @@ function mapArg(arg, argType) {
349
345
  if (typeof arg === "string" && argType.scalarType === "bytes") {
350
346
  return Buffer.from(arg, "base64");
351
347
  }
352
- if (Array.isArray(arg) && argType.scalarType === "bytes") {
353
- return Buffer.from(arg);
354
- }
355
348
  if (ArrayBuffer.isView(arg)) {
356
- return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
349
+ return new Uint8Array(arg.buffer, arg.byteOffset, arg.byteLength);
357
350
  }
358
351
  return arg;
359
352
  }
@@ -435,6 +428,11 @@ function mapDriverError(error) {
435
428
  kind: "ValueOutOfRange",
436
429
  cause: error.message
437
430
  };
431
+ case "22P02":
432
+ return {
433
+ kind: "InvalidInputValue",
434
+ message: error.message
435
+ };
438
436
  case "23505": {
439
437
  const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
440
438
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-pg",
3
- "version": "7.3.0-integration-prisma6-fix-cloudflare-engine.3",
3
+ "version": "7.3.0-integration-engines-7-3-0-12-parameterization-844f54891f0a80ec1820fc26cf513002357e4245.1",
4
4
  "description": "Prisma's driver adapter for \"pg\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,13 +31,13 @@
31
31
  "license": "Apache-2.0",
32
32
  "sideEffects": false,
33
33
  "dependencies": {
34
+ "pg": "^8.16.3",
34
35
  "postgres-array": "3.0.4",
35
- "pg": "^8.11.3",
36
- "@prisma/driver-adapter-utils": "7.3.0-integration-prisma6-fix-cloudflare-engine.3"
36
+ "@prisma/driver-adapter-utils": "7.3.0-integration-engines-7-3-0-12-parameterization-844f54891f0a80ec1820fc26cf513002357e4245.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/pg": "8.11.11",
40
- "@prisma/debug": "7.3.0-integration-prisma6-fix-cloudflare-engine.3"
40
+ "@prisma/debug": "7.3.0-integration-engines-7-3-0-12-parameterization-844f54891f0a80ec1820fc26cf513002357e4245.1"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "DEV=true tsx helpers/build.ts",