@prisma/adapter-neon 7.2.0 → 7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.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 +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -13
- package/dist/index.mjs +18 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The [Neon serverless driver](https://github.com/neondatabase/serverless) is a lo
|
|
|
8
8
|
|
|
9
9
|
## Getting started
|
|
10
10
|
|
|
11
|
-
> **Note**: Make sure your connection string exists in your `
|
|
11
|
+
> **Note**: Make sure your connection string exists in your `.env` file. Refer to [Neon's docs](https://neon.tech/docs/connect/connect-from-any-app) to learn how to retrieve your database's connection string.
|
|
12
12
|
>
|
|
13
13
|
> ```bash
|
|
14
14
|
> DATABASE_URL="postgres://user:password@server.us-east-2.aws.neon.tech/neondb"
|
package/dist/index.d.mts
CHANGED
|
@@ -66,7 +66,7 @@ declare class PrismaNeonAdapter extends NeonWsQueryable<neon.Pool> implements Sq
|
|
|
66
66
|
underlyingDriver(): neon.Pool;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export declare class
|
|
69
|
+
export declare class PrismaNeonHTTP implements SqlDriverAdapterFactory {
|
|
70
70
|
private readonly connectionString;
|
|
71
71
|
private readonly options;
|
|
72
72
|
readonly provider = "postgres";
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ declare class PrismaNeonAdapter extends NeonWsQueryable<neon.Pool> implements Sq
|
|
|
66
66
|
underlyingDriver(): neon.Pool;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export declare class
|
|
69
|
+
export declare class PrismaNeonHTTP implements SqlDriverAdapterFactory {
|
|
70
70
|
private readonly connectionString;
|
|
71
71
|
private readonly options;
|
|
72
72
|
readonly provider = "postgres";
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
PrismaNeon: () => PrismaNeonAdapterFactory,
|
|
34
|
-
|
|
34
|
+
PrismaNeonHTTP: () => PrismaNeonHTTPAdapterFactory
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
@@ -316,10 +316,18 @@ function normalize_xml(xml) {
|
|
|
316
316
|
function toJson(json) {
|
|
317
317
|
return json;
|
|
318
318
|
}
|
|
319
|
+
function encodeBuffer(buffer) {
|
|
320
|
+
return Array.from(new Uint8Array(buffer));
|
|
321
|
+
}
|
|
319
322
|
var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
|
|
320
|
-
var
|
|
323
|
+
var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
|
|
324
|
+
function normalizeByteaArray(serializedBytesArray) {
|
|
325
|
+
const buffers = parseBytesArray(serializedBytesArray);
|
|
326
|
+
return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
|
|
327
|
+
}
|
|
321
328
|
function convertBytes(serializedBytes) {
|
|
322
|
-
|
|
329
|
+
const buffer = parsePgBytes(serializedBytes);
|
|
330
|
+
return encodeBuffer(buffer);
|
|
323
331
|
}
|
|
324
332
|
function normalizeBit(bit) {
|
|
325
333
|
return bit;
|
|
@@ -372,8 +380,11 @@ function mapArg(arg, argType) {
|
|
|
372
380
|
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
373
381
|
return Buffer.from(arg, "base64");
|
|
374
382
|
}
|
|
383
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
384
|
+
return Buffer.from(arg);
|
|
385
|
+
}
|
|
375
386
|
if (ArrayBuffer.isView(arg)) {
|
|
376
|
-
return
|
|
387
|
+
return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
|
|
377
388
|
}
|
|
378
389
|
return arg;
|
|
379
390
|
}
|
|
@@ -415,11 +426,6 @@ function mapDriverError(error) {
|
|
|
415
426
|
kind: "ValueOutOfRange",
|
|
416
427
|
cause: error.message
|
|
417
428
|
};
|
|
418
|
-
case "22P02":
|
|
419
|
-
return {
|
|
420
|
-
kind: "InvalidInputValue",
|
|
421
|
-
message: error.message
|
|
422
|
-
};
|
|
423
429
|
case "23505": {
|
|
424
430
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
425
431
|
return {
|
|
@@ -678,7 +684,7 @@ var PrismaNeonAdapterFactory = class {
|
|
|
678
684
|
return new PrismaNeonAdapter(pool, this.options);
|
|
679
685
|
}
|
|
680
686
|
};
|
|
681
|
-
var
|
|
687
|
+
var PrismaNeonHTTPAdapter = class extends NeonQueryable {
|
|
682
688
|
client;
|
|
683
689
|
constructor(client) {
|
|
684
690
|
super();
|
|
@@ -714,7 +720,7 @@ var PrismaNeonHttpAdapter = class extends NeonQueryable {
|
|
|
714
720
|
async dispose() {
|
|
715
721
|
}
|
|
716
722
|
};
|
|
717
|
-
var
|
|
723
|
+
var PrismaNeonHTTPAdapterFactory = class {
|
|
718
724
|
constructor(connectionString, options) {
|
|
719
725
|
this.connectionString = connectionString;
|
|
720
726
|
this.options = options;
|
|
@@ -722,11 +728,11 @@ var PrismaNeonHttpAdapterFactory = class {
|
|
|
722
728
|
provider = "postgres";
|
|
723
729
|
adapterName = name;
|
|
724
730
|
async connect() {
|
|
725
|
-
return new
|
|
731
|
+
return new PrismaNeonHTTPAdapter(neon.neon(this.connectionString, this.options));
|
|
726
732
|
}
|
|
727
733
|
};
|
|
728
734
|
// Annotate the CommonJS export names for ESM import in node:
|
|
729
735
|
0 && (module.exports = {
|
|
730
736
|
PrismaNeon,
|
|
731
|
-
|
|
737
|
+
PrismaNeonHTTP
|
|
732
738
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -279,10 +279,18 @@ function normalize_xml(xml) {
|
|
|
279
279
|
function toJson(json) {
|
|
280
280
|
return json;
|
|
281
281
|
}
|
|
282
|
+
function encodeBuffer(buffer) {
|
|
283
|
+
return Array.from(new Uint8Array(buffer));
|
|
284
|
+
}
|
|
282
285
|
var parsePgBytes = getTypeParser(ScalarColumnType.BYTEA);
|
|
283
|
-
var
|
|
286
|
+
var parseBytesArray = getTypeParser(ArrayColumnType.BYTEA_ARRAY);
|
|
287
|
+
function normalizeByteaArray(serializedBytesArray) {
|
|
288
|
+
const buffers = parseBytesArray(serializedBytesArray);
|
|
289
|
+
return buffers.map((buf) => buf ? encodeBuffer(buf) : null);
|
|
290
|
+
}
|
|
284
291
|
function convertBytes(serializedBytes) {
|
|
285
|
-
|
|
292
|
+
const buffer = parsePgBytes(serializedBytes);
|
|
293
|
+
return encodeBuffer(buffer);
|
|
286
294
|
}
|
|
287
295
|
function normalizeBit(bit) {
|
|
288
296
|
return bit;
|
|
@@ -335,8 +343,11 @@ function mapArg(arg, argType) {
|
|
|
335
343
|
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
336
344
|
return Buffer.from(arg, "base64");
|
|
337
345
|
}
|
|
346
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
347
|
+
return Buffer.from(arg);
|
|
348
|
+
}
|
|
338
349
|
if (ArrayBuffer.isView(arg)) {
|
|
339
|
-
return
|
|
350
|
+
return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
|
|
340
351
|
}
|
|
341
352
|
return arg;
|
|
342
353
|
}
|
|
@@ -378,11 +389,6 @@ function mapDriverError(error) {
|
|
|
378
389
|
kind: "ValueOutOfRange",
|
|
379
390
|
cause: error.message
|
|
380
391
|
};
|
|
381
|
-
case "22P02":
|
|
382
|
-
return {
|
|
383
|
-
kind: "InvalidInputValue",
|
|
384
|
-
message: error.message
|
|
385
|
-
};
|
|
386
392
|
case "23505": {
|
|
387
393
|
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
388
394
|
return {
|
|
@@ -641,7 +647,7 @@ var PrismaNeonAdapterFactory = class {
|
|
|
641
647
|
return new PrismaNeonAdapter(pool, this.options);
|
|
642
648
|
}
|
|
643
649
|
};
|
|
644
|
-
var
|
|
650
|
+
var PrismaNeonHTTPAdapter = class extends NeonQueryable {
|
|
645
651
|
client;
|
|
646
652
|
constructor(client) {
|
|
647
653
|
super();
|
|
@@ -677,7 +683,7 @@ var PrismaNeonHttpAdapter = class extends NeonQueryable {
|
|
|
677
683
|
async dispose() {
|
|
678
684
|
}
|
|
679
685
|
};
|
|
680
|
-
var
|
|
686
|
+
var PrismaNeonHTTPAdapterFactory = class {
|
|
681
687
|
constructor(connectionString, options) {
|
|
682
688
|
this.connectionString = connectionString;
|
|
683
689
|
this.options = options;
|
|
@@ -685,10 +691,10 @@ var PrismaNeonHttpAdapterFactory = class {
|
|
|
685
691
|
provider = "postgres";
|
|
686
692
|
adapterName = name;
|
|
687
693
|
async connect() {
|
|
688
|
-
return new
|
|
694
|
+
return new PrismaNeonHTTPAdapter(neon.neon(this.connectionString, this.options));
|
|
689
695
|
}
|
|
690
696
|
};
|
|
691
697
|
export {
|
|
692
698
|
PrismaNeonAdapterFactory as PrismaNeon,
|
|
693
|
-
|
|
699
|
+
PrismaNeonHTTPAdapterFactory as PrismaNeonHTTP
|
|
694
700
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-neon",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"postgres-array": "3.0.4",
|
|
35
35
|
"@neondatabase/serverless": ">0.6.0 <2",
|
|
36
|
-
"@prisma/driver-adapter-utils": "7.
|
|
36
|
+
"@prisma/driver-adapter-utils": "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@prisma/debug": "7.
|
|
39
|
+
"@prisma/debug": "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"dev": "DEV=true tsx helpers/build.ts",
|