@prisma/adapter-neon 6.5.0-dev.6 → 6.5.0-dev.60

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 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 { Query } from '@prisma/driver-adapter-utils';
5
- import type { Queryable } from '@prisma/driver-adapter-utils';
6
- import type { Result } from '@prisma/driver-adapter-utils';
7
- import type { ResultSet } from '@prisma/driver-adapter-utils';
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 Queryable {
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: Query): Promise<Result<ResultSet>>;
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: Query): Promise<Result<number>>;
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: Query): Promise<Result<PerformIOResult>>;
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: Query): Promise<Result<PerformIOResult>>;
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 DriverAdapter {
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
- getConnectionInfo(): Result<ConnectionInfo>;
52
- transactionContext(): Promise<Result<TransactionContext>>;
53
- close(): Promise<Result<undefined>>;
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 DriverAdapter {
57
+ export declare class PrismaNeonHTTP extends NeonQueryable implements SqlConnection {
57
58
  private client;
58
59
  constructor(client: neon.NeonQueryFunction<any, any>);
59
- performIO(query: Query): Promise<Result<PerformIOResult>>;
60
- transactionContext(): Promise<Result<TransactionContext>>;
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 { Query } from '@prisma/driver-adapter-utils';
5
- import type { Queryable } from '@prisma/driver-adapter-utils';
6
- import type { Result } from '@prisma/driver-adapter-utils';
7
- import type { ResultSet } from '@prisma/driver-adapter-utils';
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 Queryable {
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: Query): Promise<Result<ResultSet>>;
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: Query): Promise<Result<number>>;
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: Query): Promise<Result<PerformIOResult>>;
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: Query): Promise<Result<PerformIOResult>>;
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 DriverAdapter {
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
- getConnectionInfo(): Result<ConnectionInfo>;
52
- transactionContext(): Promise<Result<TransactionContext>>;
53
- close(): Promise<Result<undefined>>;
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 DriverAdapter {
57
+ export declare class PrismaNeonHTTP extends NeonQueryable implements SqlConnection {
57
58
  private client;
58
59
  constructor(client: neon.NeonQueryFunction<any, any>);
59
- performIO(query: Query): Promise<Result<PerformIOResult>>;
60
- transactionContext(): Promise<Result<TransactionContext>>;
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
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __export = (target, all) => {
9
10
  for (var name2 in all)
10
11
  __defProp(target, name2, { get: all[name2], enumerable: true });
@@ -26,6 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  mod
27
28
  ));
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
29
31
 
30
32
  // src/index.ts
31
33
  var index_exports = {};
@@ -77,12 +79,13 @@ var ArrayColumnType = {
77
79
  var _UnsupportedNativeDataType = class _UnsupportedNativeDataType extends Error {
78
80
  constructor(code) {
79
81
  super();
82
+ __publicField(this, "type");
80
83
  this.type = _UnsupportedNativeDataType.typeNames[code] || "Unknown";
81
84
  this.message = `Unsupported column type ${this.type}`;
82
85
  }
83
86
  };
84
87
  // map of type codes to type names
85
- _UnsupportedNativeDataType.typeNames = {
88
+ __publicField(_UnsupportedNativeDataType, "typeNames", {
86
89
  16: "bool",
87
90
  17: "bytea",
88
91
  18: "char",
@@ -195,7 +198,7 @@ _UnsupportedNativeDataType.typeNames = {
195
198
  5078: "anycompatiblearray",
196
199
  5079: "anycompatiblenonarray",
197
200
  5080: "anycompatiblerange"
198
- };
201
+ });
199
202
  var UnsupportedNativeDataType = _UnsupportedNativeDataType;
200
203
  function fieldToColumnType(fieldTypeId) {
201
204
  switch (fieldTypeId) {
@@ -372,8 +375,8 @@ function fixArrayBufferValues(values) {
372
375
  var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:neon");
373
376
  var NeonQueryable = class {
374
377
  constructor() {
375
- this.provider = "postgres";
376
- this.adapterName = name;
378
+ __publicField(this, "provider", "postgres");
379
+ __publicField(this, "adapterName", name);
377
380
  }
378
381
  /**
379
382
  * Execute a query given as SQL, interpolating the given parameters.
@@ -381,29 +384,25 @@ var NeonQueryable = class {
381
384
  async queryRaw(query) {
382
385
  const tag = "[js::query_raw]";
383
386
  debug(`${tag} %O`, query);
384
- const res = await this.performIO(query);
385
- if (!res.ok) {
386
- return (0, import_driver_adapter_utils2.err)(res.error);
387
- }
388
- const { fields, rows } = res.value;
387
+ const { fields, rows } = await this.performIO(query);
389
388
  const columnNames = fields.map((field) => field.name);
390
389
  let columnTypes = [];
391
390
  try {
392
391
  columnTypes = fields.map((field) => fieldToColumnType(field.dataTypeID));
393
392
  } catch (e) {
394
393
  if (e instanceof UnsupportedNativeDataType) {
395
- return (0, import_driver_adapter_utils2.err)({
394
+ throw new import_driver_adapter_utils2.DriverAdapterError({
396
395
  kind: "UnsupportedNativeDataType",
397
396
  type: e.type
398
397
  });
399
398
  }
400
399
  throw e;
401
400
  }
402
- return (0, import_driver_adapter_utils2.ok)({
401
+ return {
403
402
  columnNames,
404
403
  columnTypes,
405
404
  rows
406
- });
405
+ };
407
406
  }
408
407
  /**
409
408
  * Execute a query given as SQL, interpolating the given parameters and
@@ -413,7 +412,7 @@ var NeonQueryable = class {
413
412
  async executeRaw(query) {
414
413
  const tag = "[js::execute_raw]";
415
414
  debug(`${tag} %O`, query);
416
- return (await this.performIO(query)).map((r) => r.rowCount ?? 0);
415
+ return (await this.performIO(query)).rowCount ?? 0;
417
416
  }
418
417
  };
419
418
  var NeonWsQueryable = class extends NeonQueryable {
@@ -452,22 +451,25 @@ var NeonWsQueryable = class extends NeonQueryable {
452
451
  },
453
452
  fixArrayBufferValues(values)
454
453
  );
455
- return (0, import_driver_adapter_utils2.ok)(result);
454
+ return result;
456
455
  } catch (e) {
457
- debug("Error in performIO: %O", e);
458
- if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
459
- return (0, import_driver_adapter_utils2.err)({
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
- });
468
- }
469
- throw e;
456
+ this.onError(e);
457
+ }
458
+ }
459
+ onError(e) {
460
+ debug("Error in onError: %O", e);
461
+ if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
462
+ throw new import_driver_adapter_utils2.DriverAdapterError({
463
+ kind: "postgres",
464
+ code: e.code,
465
+ severity: e.severity,
466
+ message: e.message,
467
+ detail: e.detail,
468
+ column: e.column,
469
+ hint: e.hint
470
+ });
470
471
  }
472
+ throw e;
471
473
  }
472
474
  };
473
475
  var NeonTransaction = class extends NeonWsQueryable {
@@ -478,12 +480,10 @@ var NeonTransaction = class extends NeonWsQueryable {
478
480
  async commit() {
479
481
  debug(`[js::commit]`);
480
482
  this.client.release();
481
- return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
482
483
  }
483
484
  async rollback() {
484
485
  debug(`[js::rollback]`);
485
486
  this.client.release();
486
- return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
487
487
  }
488
488
  };
489
489
  var NeonTransactionContext = class extends NeonWsQueryable {
@@ -497,7 +497,7 @@ var NeonTransactionContext = class extends NeonWsQueryable {
497
497
  };
498
498
  const tag = "[js::startTransaction]";
499
499
  debug("%s options: %O", tag, options);
500
- return (0, import_driver_adapter_utils2.ok)(new NeonTransaction(this.conn, options));
500
+ return new NeonTransaction(this.conn, options);
501
501
  }
502
502
  };
503
503
  var PrismaNeon = class extends NeonWsQueryable {
@@ -511,23 +511,25 @@ const adapter = new PrismaNeon(pool)
511
511
  }
512
512
  super(pool);
513
513
  this.options = options;
514
- this.isRunning = true;
514
+ __publicField(this, "isRunning", true);
515
+ }
516
+ executeScript(_script) {
517
+ throw new Error("Not implemented yet");
515
518
  }
516
519
  getConnectionInfo() {
517
- return (0, import_driver_adapter_utils2.ok)({
520
+ return {
518
521
  schemaName: this.options?.schema
519
- });
522
+ };
520
523
  }
521
524
  async transactionContext() {
522
525
  const conn = await this.client.connect();
523
- return (0, import_driver_adapter_utils2.ok)(new NeonTransactionContext(conn));
526
+ return new NeonTransactionContext(conn);
524
527
  }
525
- async close() {
528
+ async dispose() {
526
529
  if (this.isRunning) {
527
530
  await this.client.end();
528
531
  this.isRunning = false;
529
532
  }
530
- return (0, import_driver_adapter_utils2.ok)(void 0);
531
533
  }
532
534
  };
533
535
  var PrismaNeonHTTP = class extends NeonQueryable {
@@ -535,32 +537,35 @@ var PrismaNeonHTTP = class extends NeonQueryable {
535
537
  super();
536
538
  this.client = client;
537
539
  }
540
+ executeScript(_script) {
541
+ throw new Error("Not implemented yet");
542
+ }
538
543
  async performIO(query) {
539
544
  const { sql, args: values } = query;
540
- return (0, import_driver_adapter_utils2.ok)(
541
- await this.client(sql, values, {
542
- arrayMode: true,
543
- fullResults: true,
544
- // pass type parsers to neon() HTTP client, same as in WS client above
545
- //
546
- // requires @neondatabase/serverless >= 0.9.5
547
- // - types option added in https://github.com/neondatabase/serverless/pull/92
548
- types: {
549
- getTypeParser: (oid, format) => {
550
- if (format === "text" && customParsers[oid]) {
551
- return customParsers[oid];
552
- }
553
- return neon.types.getTypeParser(oid, format);
545
+ return await this.client(sql, values, {
546
+ arrayMode: true,
547
+ fullResults: true,
548
+ // pass type parsers to neon() HTTP client, same as in WS client above
549
+ //
550
+ // requires @neondatabase/serverless >= 0.9.5
551
+ // - types option added in https://github.com/neondatabase/serverless/pull/92
552
+ types: {
553
+ getTypeParser: (oid, format) => {
554
+ if (format === "text" && customParsers[oid]) {
555
+ return customParsers[oid];
554
556
  }
557
+ return neon.types.getTypeParser(oid, format);
555
558
  }
556
- // type `as` cast required until neon types are corrected:
557
- // https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
558
- })
559
- );
559
+ }
560
+ // type `as` cast required until neon types are corrected:
561
+ // https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
562
+ });
560
563
  }
561
564
  transactionContext() {
562
565
  return Promise.reject(new Error("Transactions are not supported in HTTP mode"));
563
566
  }
567
+ async dispose() {
568
+ }
564
569
  };
565
570
  // Annotate the CommonJS export names for ESM import in node:
566
571
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
1
5
  // src/neon.ts
2
6
  import * as neon from "@neondatabase/serverless";
3
- import { Debug, err, ok } from "@prisma/driver-adapter-utils";
7
+ import { Debug, DriverAdapterError } from "@prisma/driver-adapter-utils";
4
8
 
5
9
  // package.json
6
10
  var name = "@prisma/adapter-neon";
@@ -40,12 +44,13 @@ var ArrayColumnType = {
40
44
  var _UnsupportedNativeDataType = class _UnsupportedNativeDataType extends Error {
41
45
  constructor(code) {
42
46
  super();
47
+ __publicField(this, "type");
43
48
  this.type = _UnsupportedNativeDataType.typeNames[code] || "Unknown";
44
49
  this.message = `Unsupported column type ${this.type}`;
45
50
  }
46
51
  };
47
52
  // map of type codes to type names
48
- _UnsupportedNativeDataType.typeNames = {
53
+ __publicField(_UnsupportedNativeDataType, "typeNames", {
49
54
  16: "bool",
50
55
  17: "bytea",
51
56
  18: "char",
@@ -158,7 +163,7 @@ _UnsupportedNativeDataType.typeNames = {
158
163
  5078: "anycompatiblearray",
159
164
  5079: "anycompatiblenonarray",
160
165
  5080: "anycompatiblerange"
161
- };
166
+ });
162
167
  var UnsupportedNativeDataType = _UnsupportedNativeDataType;
163
168
  function fieldToColumnType(fieldTypeId) {
164
169
  switch (fieldTypeId) {
@@ -335,8 +340,8 @@ function fixArrayBufferValues(values) {
335
340
  var debug = Debug("prisma:driver-adapter:neon");
336
341
  var NeonQueryable = class {
337
342
  constructor() {
338
- this.provider = "postgres";
339
- this.adapterName = name;
343
+ __publicField(this, "provider", "postgres");
344
+ __publicField(this, "adapterName", name);
340
345
  }
341
346
  /**
342
347
  * Execute a query given as SQL, interpolating the given parameters.
@@ -344,29 +349,25 @@ var NeonQueryable = class {
344
349
  async queryRaw(query) {
345
350
  const tag = "[js::query_raw]";
346
351
  debug(`${tag} %O`, query);
347
- const res = await this.performIO(query);
348
- if (!res.ok) {
349
- return err(res.error);
350
- }
351
- const { fields, rows } = res.value;
352
+ const { fields, rows } = await this.performIO(query);
352
353
  const columnNames = fields.map((field) => field.name);
353
354
  let columnTypes = [];
354
355
  try {
355
356
  columnTypes = fields.map((field) => fieldToColumnType(field.dataTypeID));
356
357
  } catch (e) {
357
358
  if (e instanceof UnsupportedNativeDataType) {
358
- return err({
359
+ throw new DriverAdapterError({
359
360
  kind: "UnsupportedNativeDataType",
360
361
  type: e.type
361
362
  });
362
363
  }
363
364
  throw e;
364
365
  }
365
- return ok({
366
+ return {
366
367
  columnNames,
367
368
  columnTypes,
368
369
  rows
369
- });
370
+ };
370
371
  }
371
372
  /**
372
373
  * Execute a query given as SQL, interpolating the given parameters and
@@ -376,7 +377,7 @@ var NeonQueryable = class {
376
377
  async executeRaw(query) {
377
378
  const tag = "[js::execute_raw]";
378
379
  debug(`${tag} %O`, query);
379
- return (await this.performIO(query)).map((r) => r.rowCount ?? 0);
380
+ return (await this.performIO(query)).rowCount ?? 0;
380
381
  }
381
382
  };
382
383
  var NeonWsQueryable = class extends NeonQueryable {
@@ -415,22 +416,25 @@ var NeonWsQueryable = class extends NeonQueryable {
415
416
  },
416
417
  fixArrayBufferValues(values)
417
418
  );
418
- return ok(result);
419
+ return result;
419
420
  } catch (e) {
420
- debug("Error in performIO: %O", e);
421
- if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
422
- return err({
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
- });
431
- }
432
- throw e;
421
+ this.onError(e);
422
+ }
423
+ }
424
+ onError(e) {
425
+ debug("Error in onError: %O", e);
426
+ if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
427
+ throw new DriverAdapterError({
428
+ kind: "postgres",
429
+ code: e.code,
430
+ severity: e.severity,
431
+ message: e.message,
432
+ detail: e.detail,
433
+ column: e.column,
434
+ hint: e.hint
435
+ });
433
436
  }
437
+ throw e;
434
438
  }
435
439
  };
436
440
  var NeonTransaction = class extends NeonWsQueryable {
@@ -441,12 +445,10 @@ var NeonTransaction = class extends NeonWsQueryable {
441
445
  async commit() {
442
446
  debug(`[js::commit]`);
443
447
  this.client.release();
444
- return Promise.resolve(ok(void 0));
445
448
  }
446
449
  async rollback() {
447
450
  debug(`[js::rollback]`);
448
451
  this.client.release();
449
- return Promise.resolve(ok(void 0));
450
452
  }
451
453
  };
452
454
  var NeonTransactionContext = class extends NeonWsQueryable {
@@ -460,7 +462,7 @@ var NeonTransactionContext = class extends NeonWsQueryable {
460
462
  };
461
463
  const tag = "[js::startTransaction]";
462
464
  debug("%s options: %O", tag, options);
463
- return ok(new NeonTransaction(this.conn, options));
465
+ return new NeonTransaction(this.conn, options);
464
466
  }
465
467
  };
466
468
  var PrismaNeon = class extends NeonWsQueryable {
@@ -474,23 +476,25 @@ const adapter = new PrismaNeon(pool)
474
476
  }
475
477
  super(pool);
476
478
  this.options = options;
477
- this.isRunning = true;
479
+ __publicField(this, "isRunning", true);
480
+ }
481
+ executeScript(_script) {
482
+ throw new Error("Not implemented yet");
478
483
  }
479
484
  getConnectionInfo() {
480
- return ok({
485
+ return {
481
486
  schemaName: this.options?.schema
482
- });
487
+ };
483
488
  }
484
489
  async transactionContext() {
485
490
  const conn = await this.client.connect();
486
- return ok(new NeonTransactionContext(conn));
491
+ return new NeonTransactionContext(conn);
487
492
  }
488
- async close() {
493
+ async dispose() {
489
494
  if (this.isRunning) {
490
495
  await this.client.end();
491
496
  this.isRunning = false;
492
497
  }
493
- return ok(void 0);
494
498
  }
495
499
  };
496
500
  var PrismaNeonHTTP = class extends NeonQueryable {
@@ -498,32 +502,35 @@ var PrismaNeonHTTP = class extends NeonQueryable {
498
502
  super();
499
503
  this.client = client;
500
504
  }
505
+ executeScript(_script) {
506
+ throw new Error("Not implemented yet");
507
+ }
501
508
  async performIO(query) {
502
509
  const { sql, args: values } = query;
503
- return ok(
504
- await this.client(sql, values, {
505
- arrayMode: true,
506
- fullResults: true,
507
- // pass type parsers to neon() HTTP client, same as in WS client above
508
- //
509
- // requires @neondatabase/serverless >= 0.9.5
510
- // - types option added in https://github.com/neondatabase/serverless/pull/92
511
- types: {
512
- getTypeParser: (oid, format) => {
513
- if (format === "text" && customParsers[oid]) {
514
- return customParsers[oid];
515
- }
516
- return neon.types.getTypeParser(oid, format);
510
+ return await this.client(sql, values, {
511
+ arrayMode: true,
512
+ fullResults: true,
513
+ // pass type parsers to neon() HTTP client, same as in WS client above
514
+ //
515
+ // requires @neondatabase/serverless >= 0.9.5
516
+ // - types option added in https://github.com/neondatabase/serverless/pull/92
517
+ types: {
518
+ getTypeParser: (oid, format) => {
519
+ if (format === "text" && customParsers[oid]) {
520
+ return customParsers[oid];
517
521
  }
522
+ return neon.types.getTypeParser(oid, format);
518
523
  }
519
- // type `as` cast required until neon types are corrected:
520
- // https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
521
- })
522
- );
524
+ }
525
+ // type `as` cast required until neon types are corrected:
526
+ // https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
527
+ });
523
528
  }
524
529
  transactionContext() {
525
530
  return Promise.reject(new Error("Transactions are not supported in HTTP mode"));
526
531
  }
532
+ async dispose() {
533
+ }
527
534
  };
528
535
  export {
529
536
  PrismaNeon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-neon",
3
- "version": "6.5.0-dev.6",
3
+ "version": "6.5.0-dev.60",
4
4
  "description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,11 +32,11 @@
32
32
  "sideEffects": false,
33
33
  "dependencies": {
34
34
  "postgres-array": "3.0.2",
35
- "@prisma/driver-adapter-utils": "6.5.0-dev.6"
35
+ "@prisma/driver-adapter-utils": "6.5.0-dev.60"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@neondatabase/serverless": "0.10.2",
39
- "@swc/core": "1.10.11",
39
+ "@swc/core": "1.11.5",
40
40
  "@swc/jest": "0.2.37",
41
41
  "jest": "29.7.0",
42
42
  "jest-junit": "16.0.0"