@prisma/adapter-planetscale 6.13.0-dev.3 → 6.13.0-dev.31

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,13 +1,53 @@
1
+ import type { ConnectionInfo } from '@prisma/driver-adapter-utils';
2
+ import type { IsolationLevel } from '@prisma/driver-adapter-utils';
1
3
  import * as planetScale from '@planetscale/database';
2
4
  import type { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
5
  import type { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
6
+ import type { SqlQuery } from '@prisma/driver-adapter-utils';
7
+ import type { SqlQueryable } from '@prisma/driver-adapter-utils';
8
+ import type { SqlResultSet } from '@prisma/driver-adapter-utils';
9
+ import type { Transaction } from '@prisma/driver-adapter-utils';
10
+ import type { TransactionOptions } from '@prisma/driver-adapter-utils';
11
+
12
+ declare class PlanetScaleQueryable<ClientT extends planetScale.Client | planetScale.Transaction | planetScale.Connection> implements SqlQueryable {
13
+ protected client: ClientT;
14
+ readonly provider = "mysql";
15
+ readonly adapterName: string;
16
+ constructor(client: ClientT);
17
+ /**
18
+ * Execute a query given as SQL, interpolating the given parameters.
19
+ */
20
+ queryRaw(query: SqlQuery): Promise<SqlResultSet>;
21
+ /**
22
+ * Execute a query given as SQL, interpolating the given parameters and
23
+ * returning the number of affected rows.
24
+ * Note: Queryable expects a u64, but napi.rs only supports u32.
25
+ */
26
+ executeRaw(query: SqlQuery): Promise<number>;
27
+ /**
28
+ * Run a query against the database, returning the result set.
29
+ * Should the query fail due to a connection error, the connection is
30
+ * marked as unhealthy.
31
+ */
32
+ protected performIO(query: SqlQuery): Promise<planetScale.ExecutedQuery>;
33
+ }
4
34
 
5
35
  export declare class PrismaPlanetScale implements SqlDriverAdapterFactory {
6
- private readonly config;
36
+ #private;
7
37
  readonly provider = "mysql";
8
38
  readonly adapterName: string;
9
- constructor(config: planetScale.Config);
10
- connect(): Promise<SqlDriverAdapter>;
39
+ constructor(arg: planetScale.Config | planetScale.Client);
40
+ connect(): Promise<PrismaPlanetScaleAdapter>;
41
+ }
42
+
43
+ declare class PrismaPlanetScaleAdapter extends PlanetScaleQueryable<planetScale.Client> implements SqlDriverAdapter {
44
+ constructor(client: planetScale.Client);
45
+ executeScript(_script: string): Promise<void>;
46
+ getConnectionInfo(): ConnectionInfo;
47
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
48
+ startTransactionInner(conn: planetScale.Connection, options: TransactionOptions): Promise<Transaction>;
49
+ dispose(): Promise<void>;
50
+ underlyingDriver(): planetScale.Client;
11
51
  }
12
52
 
13
53
  export { }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,53 @@
1
+ import type { ConnectionInfo } from '@prisma/driver-adapter-utils';
2
+ import type { IsolationLevel } from '@prisma/driver-adapter-utils';
1
3
  import * as planetScale from '@planetscale/database';
2
4
  import type { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
5
  import type { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
6
+ import type { SqlQuery } from '@prisma/driver-adapter-utils';
7
+ import type { SqlQueryable } from '@prisma/driver-adapter-utils';
8
+ import type { SqlResultSet } from '@prisma/driver-adapter-utils';
9
+ import type { Transaction } from '@prisma/driver-adapter-utils';
10
+ import type { TransactionOptions } from '@prisma/driver-adapter-utils';
11
+
12
+ declare class PlanetScaleQueryable<ClientT extends planetScale.Client | planetScale.Transaction | planetScale.Connection> implements SqlQueryable {
13
+ protected client: ClientT;
14
+ readonly provider = "mysql";
15
+ readonly adapterName: string;
16
+ constructor(client: ClientT);
17
+ /**
18
+ * Execute a query given as SQL, interpolating the given parameters.
19
+ */
20
+ queryRaw(query: SqlQuery): Promise<SqlResultSet>;
21
+ /**
22
+ * Execute a query given as SQL, interpolating the given parameters and
23
+ * returning the number of affected rows.
24
+ * Note: Queryable expects a u64, but napi.rs only supports u32.
25
+ */
26
+ executeRaw(query: SqlQuery): Promise<number>;
27
+ /**
28
+ * Run a query against the database, returning the result set.
29
+ * Should the query fail due to a connection error, the connection is
30
+ * marked as unhealthy.
31
+ */
32
+ protected performIO(query: SqlQuery): Promise<planetScale.ExecutedQuery>;
33
+ }
4
34
 
5
35
  export declare class PrismaPlanetScale implements SqlDriverAdapterFactory {
6
- private readonly config;
36
+ #private;
7
37
  readonly provider = "mysql";
8
38
  readonly adapterName: string;
9
- constructor(config: planetScale.Config);
10
- connect(): Promise<SqlDriverAdapter>;
39
+ constructor(arg: planetScale.Config | planetScale.Client);
40
+ connect(): Promise<PrismaPlanetScaleAdapter>;
41
+ }
42
+
43
+ declare class PrismaPlanetScaleAdapter extends PlanetScaleQueryable<planetScale.Client> implements SqlDriverAdapter {
44
+ constructor(client: planetScale.Client);
45
+ executeScript(_script: string): Promise<void>;
46
+ getConnectionInfo(): ConnectionInfo;
47
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
48
+ startTransactionInner(conn: planetScale.Connection, options: TransactionOptions): Promise<Transaction>;
49
+ dispose(): Promise<void>;
50
+ underlyingDriver(): planetScale.Client;
11
51
  }
12
52
 
13
53
  export { }
package/dist/index.js CHANGED
@@ -415,15 +415,25 @@ var PrismaPlanetScaleAdapter = class extends PlanetScaleQueryable {
415
415
  }
416
416
  async dispose() {
417
417
  }
418
+ underlyingDriver() {
419
+ return this.client;
420
+ }
418
421
  };
419
422
  var PrismaPlanetScaleAdapterFactory = class {
420
- constructor(config) {
421
- this.config = config;
422
- }
423
423
  provider = "mysql";
424
424
  adapterName = name;
425
+ #config;
426
+ #client;
427
+ constructor(arg) {
428
+ if (arg instanceof planetScale.Client) {
429
+ this.#config = arg.config;
430
+ this.#client = arg;
431
+ } else {
432
+ this.#config = arg;
433
+ }
434
+ }
425
435
  async connect() {
426
- return new PrismaPlanetScaleAdapter(new planetScale.Client(this.config));
436
+ return new PrismaPlanetScaleAdapter(this.#client ?? new planetScale.Client(this.#config));
427
437
  }
428
438
  };
429
439
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -379,15 +379,25 @@ var PrismaPlanetScaleAdapter = class extends PlanetScaleQueryable {
379
379
  }
380
380
  async dispose() {
381
381
  }
382
+ underlyingDriver() {
383
+ return this.client;
384
+ }
382
385
  };
383
386
  var PrismaPlanetScaleAdapterFactory = class {
384
- constructor(config) {
385
- this.config = config;
386
- }
387
387
  provider = "mysql";
388
388
  adapterName = name;
389
+ #config;
390
+ #client;
391
+ constructor(arg) {
392
+ if (arg instanceof planetScale.Client) {
393
+ this.#config = arg.config;
394
+ this.#client = arg;
395
+ } else {
396
+ this.#config = arg;
397
+ }
398
+ }
389
399
  async connect() {
390
- return new PrismaPlanetScaleAdapter(new planetScale.Client(this.config));
400
+ return new PrismaPlanetScaleAdapter(this.#client ?? new planetScale.Client(this.#config));
391
401
  }
392
402
  };
393
403
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-planetscale",
3
- "version": "6.13.0-dev.3",
3
+ "version": "6.13.0-dev.31",
4
4
  "description": "Prisma's driver adapter for \"@planetscale/database\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "async-mutex": "0.5.0",
35
35
  "@planetscale/database": "^1.15.0",
36
- "@prisma/driver-adapter-utils": "6.13.0-dev.3"
36
+ "@prisma/driver-adapter-utils": "6.13.0-dev.31"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@swc/core": "1.11.5",