@prisma/adapter-neon 6.5.0-integration-fix-e2e-prisma-config-2.9 → 6.5.0-integration-fix-client-read-replicas.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.d.mts +20 -17
- package/dist/index.d.ts +20 -17
- package/dist/index.js +51 -49
- package/dist/index.mjs +52 -50
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ConnectionInfo } from '@prisma/driver-adapter-utils';
|
|
2
|
-
import type { DriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
2
|
import * as neon from '@neondatabase/serverless';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
3
|
+
import type { SqlConnection } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import type { SqlQuery } from '@prisma/driver-adapter-utils';
|
|
5
|
+
import type { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
6
|
+
import type { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
8
7
|
import type { TransactionContext } from '@prisma/driver-adapter-utils';
|
|
9
8
|
|
|
10
9
|
declare type ARRAY_MODE_ENABLED = true;
|
|
@@ -12,25 +11,25 @@ declare type ARRAY_MODE_ENABLED = true;
|
|
|
12
11
|
/**
|
|
13
12
|
* Base class for http client, ws client and ws transaction
|
|
14
13
|
*/
|
|
15
|
-
declare abstract class NeonQueryable implements
|
|
14
|
+
declare abstract class NeonQueryable implements SqlQueryable {
|
|
16
15
|
readonly provider = "postgres";
|
|
17
16
|
readonly adapterName: string;
|
|
18
17
|
/**
|
|
19
18
|
* Execute a query given as SQL, interpolating the given parameters.
|
|
20
19
|
*/
|
|
21
|
-
queryRaw(query:
|
|
20
|
+
queryRaw(query: SqlQuery): Promise<SqlResultSet>;
|
|
22
21
|
/**
|
|
23
22
|
* Execute a query given as SQL, interpolating the given parameters and
|
|
24
23
|
* returning the number of affected rows.
|
|
25
24
|
* Note: Queryable expects a u64, but napi.rs only supports u32.
|
|
26
25
|
*/
|
|
27
|
-
executeRaw(query:
|
|
26
|
+
executeRaw(query: SqlQuery): Promise<number>;
|
|
28
27
|
/**
|
|
29
28
|
* Run a query against the database, returning the result set.
|
|
30
29
|
* Should the query fail due to a connection error, the connection is
|
|
31
30
|
* marked as unhealthy.
|
|
32
31
|
*/
|
|
33
|
-
abstract performIO(query:
|
|
32
|
+
abstract performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -39,25 +38,29 @@ declare abstract class NeonQueryable implements Queryable {
|
|
|
39
38
|
declare class NeonWsQueryable<ClientT extends neon.Pool | neon.PoolClient> extends NeonQueryable {
|
|
40
39
|
protected client: ClientT;
|
|
41
40
|
constructor(client: ClientT);
|
|
42
|
-
performIO(query:
|
|
41
|
+
performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
42
|
+
protected onError(e: any): never;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
declare type PerformIOResult = neon.QueryResult<any> | neon.FullQueryResults<ARRAY_MODE_ENABLED>;
|
|
46
46
|
|
|
47
|
-
export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements
|
|
47
|
+
export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements SqlConnection {
|
|
48
48
|
private options?;
|
|
49
49
|
private isRunning;
|
|
50
50
|
constructor(pool: neon.Pool, options?: PrismaNeonOptions | undefined);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
executeScript(_script: string): Promise<void>;
|
|
52
|
+
getConnectionInfo(): ConnectionInfo;
|
|
53
|
+
transactionContext(): Promise<TransactionContext>;
|
|
54
|
+
dispose(): Promise<void>;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
export declare class PrismaNeonHTTP extends NeonQueryable implements
|
|
57
|
+
export declare class PrismaNeonHTTP extends NeonQueryable implements SqlConnection {
|
|
57
58
|
private client;
|
|
58
59
|
constructor(client: neon.NeonQueryFunction<any, any>);
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
executeScript(_script: string): Promise<void>;
|
|
61
|
+
performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
62
|
+
transactionContext(): Promise<TransactionContext>;
|
|
63
|
+
dispose(): Promise<void>;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
declare type PrismaNeonOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ConnectionInfo } from '@prisma/driver-adapter-utils';
|
|
2
|
-
import type { DriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
2
|
import * as neon from '@neondatabase/serverless';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
3
|
+
import type { SqlConnection } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import type { SqlQuery } from '@prisma/driver-adapter-utils';
|
|
5
|
+
import type { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
6
|
+
import type { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
8
7
|
import type { TransactionContext } from '@prisma/driver-adapter-utils';
|
|
9
8
|
|
|
10
9
|
declare type ARRAY_MODE_ENABLED = true;
|
|
@@ -12,25 +11,25 @@ declare type ARRAY_MODE_ENABLED = true;
|
|
|
12
11
|
/**
|
|
13
12
|
* Base class for http client, ws client and ws transaction
|
|
14
13
|
*/
|
|
15
|
-
declare abstract class NeonQueryable implements
|
|
14
|
+
declare abstract class NeonQueryable implements SqlQueryable {
|
|
16
15
|
readonly provider = "postgres";
|
|
17
16
|
readonly adapterName: string;
|
|
18
17
|
/**
|
|
19
18
|
* Execute a query given as SQL, interpolating the given parameters.
|
|
20
19
|
*/
|
|
21
|
-
queryRaw(query:
|
|
20
|
+
queryRaw(query: SqlQuery): Promise<SqlResultSet>;
|
|
22
21
|
/**
|
|
23
22
|
* Execute a query given as SQL, interpolating the given parameters and
|
|
24
23
|
* returning the number of affected rows.
|
|
25
24
|
* Note: Queryable expects a u64, but napi.rs only supports u32.
|
|
26
25
|
*/
|
|
27
|
-
executeRaw(query:
|
|
26
|
+
executeRaw(query: SqlQuery): Promise<number>;
|
|
28
27
|
/**
|
|
29
28
|
* Run a query against the database, returning the result set.
|
|
30
29
|
* Should the query fail due to a connection error, the connection is
|
|
31
30
|
* marked as unhealthy.
|
|
32
31
|
*/
|
|
33
|
-
abstract performIO(query:
|
|
32
|
+
abstract performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -39,25 +38,29 @@ declare abstract class NeonQueryable implements Queryable {
|
|
|
39
38
|
declare class NeonWsQueryable<ClientT extends neon.Pool | neon.PoolClient> extends NeonQueryable {
|
|
40
39
|
protected client: ClientT;
|
|
41
40
|
constructor(client: ClientT);
|
|
42
|
-
performIO(query:
|
|
41
|
+
performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
42
|
+
protected onError(e: any): never;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
declare type PerformIOResult = neon.QueryResult<any> | neon.FullQueryResults<ARRAY_MODE_ENABLED>;
|
|
46
46
|
|
|
47
|
-
export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements
|
|
47
|
+
export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements SqlConnection {
|
|
48
48
|
private options?;
|
|
49
49
|
private isRunning;
|
|
50
50
|
constructor(pool: neon.Pool, options?: PrismaNeonOptions | undefined);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
executeScript(_script: string): Promise<void>;
|
|
52
|
+
getConnectionInfo(): ConnectionInfo;
|
|
53
|
+
transactionContext(): Promise<TransactionContext>;
|
|
54
|
+
dispose(): Promise<void>;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
export declare class PrismaNeonHTTP extends NeonQueryable implements
|
|
57
|
+
export declare class PrismaNeonHTTP extends NeonQueryable implements SqlConnection {
|
|
57
58
|
private client;
|
|
58
59
|
constructor(client: neon.NeonQueryFunction<any, any>);
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
executeScript(_script: string): Promise<void>;
|
|
61
|
+
performIO(query: SqlQuery): Promise<PerformIOResult>;
|
|
62
|
+
transactionContext(): Promise<TransactionContext>;
|
|
63
|
+
dispose(): Promise<void>;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
declare type PrismaNeonOptions = {
|
package/dist/index.js
CHANGED
|
@@ -381,29 +381,25 @@ var NeonQueryable = class {
|
|
|
381
381
|
async queryRaw(query) {
|
|
382
382
|
const tag = "[js::query_raw]";
|
|
383
383
|
debug(`${tag} %O`, query);
|
|
384
|
-
const
|
|
385
|
-
if (!res.ok) {
|
|
386
|
-
return (0, import_driver_adapter_utils2.err)(res.error);
|
|
387
|
-
}
|
|
388
|
-
const { fields, rows } = res.value;
|
|
384
|
+
const { fields, rows } = await this.performIO(query);
|
|
389
385
|
const columnNames = fields.map((field) => field.name);
|
|
390
386
|
let columnTypes = [];
|
|
391
387
|
try {
|
|
392
388
|
columnTypes = fields.map((field) => fieldToColumnType(field.dataTypeID));
|
|
393
389
|
} catch (e) {
|
|
394
390
|
if (e instanceof UnsupportedNativeDataType) {
|
|
395
|
-
|
|
391
|
+
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
396
392
|
kind: "UnsupportedNativeDataType",
|
|
397
393
|
type: e.type
|
|
398
394
|
});
|
|
399
395
|
}
|
|
400
396
|
throw e;
|
|
401
397
|
}
|
|
402
|
-
return
|
|
398
|
+
return {
|
|
403
399
|
columnNames,
|
|
404
400
|
columnTypes,
|
|
405
401
|
rows
|
|
406
|
-
}
|
|
402
|
+
};
|
|
407
403
|
}
|
|
408
404
|
/**
|
|
409
405
|
* Execute a query given as SQL, interpolating the given parameters and
|
|
@@ -413,7 +409,7 @@ var NeonQueryable = class {
|
|
|
413
409
|
async executeRaw(query) {
|
|
414
410
|
const tag = "[js::execute_raw]";
|
|
415
411
|
debug(`${tag} %O`, query);
|
|
416
|
-
return (await this.performIO(query)).
|
|
412
|
+
return (await this.performIO(query)).rowCount ?? 0;
|
|
417
413
|
}
|
|
418
414
|
};
|
|
419
415
|
var NeonWsQueryable = class extends NeonQueryable {
|
|
@@ -452,22 +448,25 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
452
448
|
},
|
|
453
449
|
fixArrayBufferValues(values)
|
|
454
450
|
);
|
|
455
|
-
return
|
|
451
|
+
return result;
|
|
456
452
|
} catch (e) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
453
|
+
this.onError(e);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
onError(e) {
|
|
457
|
+
debug("Error in onError: %O", e);
|
|
458
|
+
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
|
|
459
|
+
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
460
|
+
kind: "postgres",
|
|
461
|
+
code: e.code,
|
|
462
|
+
severity: e.severity,
|
|
463
|
+
message: e.message,
|
|
464
|
+
detail: e.detail,
|
|
465
|
+
column: e.column,
|
|
466
|
+
hint: e.hint
|
|
467
|
+
});
|
|
470
468
|
}
|
|
469
|
+
throw e;
|
|
471
470
|
}
|
|
472
471
|
};
|
|
473
472
|
var NeonTransaction = class extends NeonWsQueryable {
|
|
@@ -478,12 +477,10 @@ var NeonTransaction = class extends NeonWsQueryable {
|
|
|
478
477
|
async commit() {
|
|
479
478
|
debug(`[js::commit]`);
|
|
480
479
|
this.client.release();
|
|
481
|
-
return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
|
|
482
480
|
}
|
|
483
481
|
async rollback() {
|
|
484
482
|
debug(`[js::rollback]`);
|
|
485
483
|
this.client.release();
|
|
486
|
-
return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
|
|
487
484
|
}
|
|
488
485
|
};
|
|
489
486
|
var NeonTransactionContext = class extends NeonWsQueryable {
|
|
@@ -497,7 +494,7 @@ var NeonTransactionContext = class extends NeonWsQueryable {
|
|
|
497
494
|
};
|
|
498
495
|
const tag = "[js::startTransaction]";
|
|
499
496
|
debug("%s options: %O", tag, options);
|
|
500
|
-
return
|
|
497
|
+
return new NeonTransaction(this.conn, options);
|
|
501
498
|
}
|
|
502
499
|
};
|
|
503
500
|
var PrismaNeon = class extends NeonWsQueryable {
|
|
@@ -513,21 +510,23 @@ const adapter = new PrismaNeon(pool)
|
|
|
513
510
|
this.options = options;
|
|
514
511
|
this.isRunning = true;
|
|
515
512
|
}
|
|
513
|
+
executeScript(_script) {
|
|
514
|
+
throw new Error("Not implemented yet");
|
|
515
|
+
}
|
|
516
516
|
getConnectionInfo() {
|
|
517
|
-
return
|
|
517
|
+
return {
|
|
518
518
|
schemaName: this.options?.schema
|
|
519
|
-
}
|
|
519
|
+
};
|
|
520
520
|
}
|
|
521
521
|
async transactionContext() {
|
|
522
522
|
const conn = await this.client.connect();
|
|
523
|
-
return
|
|
523
|
+
return new NeonTransactionContext(conn);
|
|
524
524
|
}
|
|
525
|
-
async
|
|
525
|
+
async dispose() {
|
|
526
526
|
if (this.isRunning) {
|
|
527
527
|
await this.client.end();
|
|
528
528
|
this.isRunning = false;
|
|
529
529
|
}
|
|
530
|
-
return (0, import_driver_adapter_utils2.ok)(void 0);
|
|
531
530
|
}
|
|
532
531
|
};
|
|
533
532
|
var PrismaNeonHTTP = class extends NeonQueryable {
|
|
@@ -535,32 +534,35 @@ var PrismaNeonHTTP = class extends NeonQueryable {
|
|
|
535
534
|
super();
|
|
536
535
|
this.client = client;
|
|
537
536
|
}
|
|
537
|
+
executeScript(_script) {
|
|
538
|
+
throw new Error("Not implemented yet");
|
|
539
|
+
}
|
|
538
540
|
async performIO(query) {
|
|
539
541
|
const { sql, args: values } = query;
|
|
540
|
-
return (
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
return customParsers[oid];
|
|
552
|
-
}
|
|
553
|
-
return neon.types.getTypeParser(oid, format);
|
|
542
|
+
return await this.client(sql, values, {
|
|
543
|
+
arrayMode: true,
|
|
544
|
+
fullResults: true,
|
|
545
|
+
// pass type parsers to neon() HTTP client, same as in WS client above
|
|
546
|
+
//
|
|
547
|
+
// requires @neondatabase/serverless >= 0.9.5
|
|
548
|
+
// - types option added in https://github.com/neondatabase/serverless/pull/92
|
|
549
|
+
types: {
|
|
550
|
+
getTypeParser: (oid, format) => {
|
|
551
|
+
if (format === "text" && customParsers[oid]) {
|
|
552
|
+
return customParsers[oid];
|
|
554
553
|
}
|
|
554
|
+
return neon.types.getTypeParser(oid, format);
|
|
555
555
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
);
|
|
556
|
+
}
|
|
557
|
+
// type `as` cast required until neon types are corrected:
|
|
558
|
+
// https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
|
|
559
|
+
});
|
|
560
560
|
}
|
|
561
561
|
transactionContext() {
|
|
562
562
|
return Promise.reject(new Error("Transactions are not supported in HTTP mode"));
|
|
563
563
|
}
|
|
564
|
+
async dispose() {
|
|
565
|
+
}
|
|
564
566
|
};
|
|
565
567
|
// Annotate the CommonJS export names for ESM import in node:
|
|
566
568
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/neon.ts
|
|
2
2
|
import * as neon from "@neondatabase/serverless";
|
|
3
|
-
import { Debug,
|
|
3
|
+
import { Debug, DriverAdapterError } from "@prisma/driver-adapter-utils";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var name = "@prisma/adapter-neon";
|
|
@@ -344,29 +344,25 @@ var NeonQueryable = class {
|
|
|
344
344
|
async queryRaw(query) {
|
|
345
345
|
const tag = "[js::query_raw]";
|
|
346
346
|
debug(`${tag} %O`, query);
|
|
347
|
-
const
|
|
348
|
-
if (!res.ok) {
|
|
349
|
-
return err(res.error);
|
|
350
|
-
}
|
|
351
|
-
const { fields, rows } = res.value;
|
|
347
|
+
const { fields, rows } = await this.performIO(query);
|
|
352
348
|
const columnNames = fields.map((field) => field.name);
|
|
353
349
|
let columnTypes = [];
|
|
354
350
|
try {
|
|
355
351
|
columnTypes = fields.map((field) => fieldToColumnType(field.dataTypeID));
|
|
356
352
|
} catch (e) {
|
|
357
353
|
if (e instanceof UnsupportedNativeDataType) {
|
|
358
|
-
|
|
354
|
+
throw new DriverAdapterError({
|
|
359
355
|
kind: "UnsupportedNativeDataType",
|
|
360
356
|
type: e.type
|
|
361
357
|
});
|
|
362
358
|
}
|
|
363
359
|
throw e;
|
|
364
360
|
}
|
|
365
|
-
return
|
|
361
|
+
return {
|
|
366
362
|
columnNames,
|
|
367
363
|
columnTypes,
|
|
368
364
|
rows
|
|
369
|
-
}
|
|
365
|
+
};
|
|
370
366
|
}
|
|
371
367
|
/**
|
|
372
368
|
* Execute a query given as SQL, interpolating the given parameters and
|
|
@@ -376,7 +372,7 @@ var NeonQueryable = class {
|
|
|
376
372
|
async executeRaw(query) {
|
|
377
373
|
const tag = "[js::execute_raw]";
|
|
378
374
|
debug(`${tag} %O`, query);
|
|
379
|
-
return (await this.performIO(query)).
|
|
375
|
+
return (await this.performIO(query)).rowCount ?? 0;
|
|
380
376
|
}
|
|
381
377
|
};
|
|
382
378
|
var NeonWsQueryable = class extends NeonQueryable {
|
|
@@ -415,22 +411,25 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
415
411
|
},
|
|
416
412
|
fixArrayBufferValues(values)
|
|
417
413
|
);
|
|
418
|
-
return
|
|
414
|
+
return result;
|
|
419
415
|
} catch (e) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
416
|
+
this.onError(e);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
onError(e) {
|
|
420
|
+
debug("Error in onError: %O", e);
|
|
421
|
+
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
|
|
422
|
+
throw new DriverAdapterError({
|
|
423
|
+
kind: "postgres",
|
|
424
|
+
code: e.code,
|
|
425
|
+
severity: e.severity,
|
|
426
|
+
message: e.message,
|
|
427
|
+
detail: e.detail,
|
|
428
|
+
column: e.column,
|
|
429
|
+
hint: e.hint
|
|
430
|
+
});
|
|
433
431
|
}
|
|
432
|
+
throw e;
|
|
434
433
|
}
|
|
435
434
|
};
|
|
436
435
|
var NeonTransaction = class extends NeonWsQueryable {
|
|
@@ -441,12 +440,10 @@ var NeonTransaction = class extends NeonWsQueryable {
|
|
|
441
440
|
async commit() {
|
|
442
441
|
debug(`[js::commit]`);
|
|
443
442
|
this.client.release();
|
|
444
|
-
return Promise.resolve(ok(void 0));
|
|
445
443
|
}
|
|
446
444
|
async rollback() {
|
|
447
445
|
debug(`[js::rollback]`);
|
|
448
446
|
this.client.release();
|
|
449
|
-
return Promise.resolve(ok(void 0));
|
|
450
447
|
}
|
|
451
448
|
};
|
|
452
449
|
var NeonTransactionContext = class extends NeonWsQueryable {
|
|
@@ -460,7 +457,7 @@ var NeonTransactionContext = class extends NeonWsQueryable {
|
|
|
460
457
|
};
|
|
461
458
|
const tag = "[js::startTransaction]";
|
|
462
459
|
debug("%s options: %O", tag, options);
|
|
463
|
-
return
|
|
460
|
+
return new NeonTransaction(this.conn, options);
|
|
464
461
|
}
|
|
465
462
|
};
|
|
466
463
|
var PrismaNeon = class extends NeonWsQueryable {
|
|
@@ -476,21 +473,23 @@ const adapter = new PrismaNeon(pool)
|
|
|
476
473
|
this.options = options;
|
|
477
474
|
this.isRunning = true;
|
|
478
475
|
}
|
|
476
|
+
executeScript(_script) {
|
|
477
|
+
throw new Error("Not implemented yet");
|
|
478
|
+
}
|
|
479
479
|
getConnectionInfo() {
|
|
480
|
-
return
|
|
480
|
+
return {
|
|
481
481
|
schemaName: this.options?.schema
|
|
482
|
-
}
|
|
482
|
+
};
|
|
483
483
|
}
|
|
484
484
|
async transactionContext() {
|
|
485
485
|
const conn = await this.client.connect();
|
|
486
|
-
return
|
|
486
|
+
return new NeonTransactionContext(conn);
|
|
487
487
|
}
|
|
488
|
-
async
|
|
488
|
+
async dispose() {
|
|
489
489
|
if (this.isRunning) {
|
|
490
490
|
await this.client.end();
|
|
491
491
|
this.isRunning = false;
|
|
492
492
|
}
|
|
493
|
-
return ok(void 0);
|
|
494
493
|
}
|
|
495
494
|
};
|
|
496
495
|
var PrismaNeonHTTP = class extends NeonQueryable {
|
|
@@ -498,32 +497,35 @@ var PrismaNeonHTTP = class extends NeonQueryable {
|
|
|
498
497
|
super();
|
|
499
498
|
this.client = client;
|
|
500
499
|
}
|
|
500
|
+
executeScript(_script) {
|
|
501
|
+
throw new Error("Not implemented yet");
|
|
502
|
+
}
|
|
501
503
|
async performIO(query) {
|
|
502
504
|
const { sql, args: values } = query;
|
|
503
|
-
return
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return customParsers[oid];
|
|
515
|
-
}
|
|
516
|
-
return neon.types.getTypeParser(oid, format);
|
|
505
|
+
return await this.client(sql, values, {
|
|
506
|
+
arrayMode: true,
|
|
507
|
+
fullResults: true,
|
|
508
|
+
// pass type parsers to neon() HTTP client, same as in WS client above
|
|
509
|
+
//
|
|
510
|
+
// requires @neondatabase/serverless >= 0.9.5
|
|
511
|
+
// - types option added in https://github.com/neondatabase/serverless/pull/92
|
|
512
|
+
types: {
|
|
513
|
+
getTypeParser: (oid, format) => {
|
|
514
|
+
if (format === "text" && customParsers[oid]) {
|
|
515
|
+
return customParsers[oid];
|
|
517
516
|
}
|
|
517
|
+
return neon.types.getTypeParser(oid, format);
|
|
518
518
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
);
|
|
519
|
+
}
|
|
520
|
+
// type `as` cast required until neon types are corrected:
|
|
521
|
+
// https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
|
|
522
|
+
});
|
|
523
523
|
}
|
|
524
524
|
transactionContext() {
|
|
525
525
|
return Promise.reject(new Error("Transactions are not supported in HTTP mode"));
|
|
526
526
|
}
|
|
527
|
+
async dispose() {
|
|
528
|
+
}
|
|
527
529
|
};
|
|
528
530
|
export {
|
|
529
531
|
PrismaNeon,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-neon",
|
|
3
|
-
"version": "6.5.0-integration-fix-
|
|
3
|
+
"version": "6.5.0-integration-fix-client-read-replicas.2",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"postgres-array": "3.0.2",
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.5.0-integration-fix-
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.5.0-integration-fix-client-read-replicas.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@neondatabase/serverless": "0.10.2",
|