@prisma/adapter-mssql 6.13.0-dev.2 → 6.13.0-dev.20

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,6 +1,29 @@
1
+ import { ConnectionInfo } from '@prisma/driver-adapter-utils';
2
+ import { IsolationLevel } from '@prisma/driver-adapter-utils';
1
3
  import sql from 'mssql';
2
4
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
5
  import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
6
+ import { SqlQuery } from '@prisma/driver-adapter-utils';
7
+ import { SqlQueryable } from '@prisma/driver-adapter-utils';
8
+ import { SqlResultSet } from '@prisma/driver-adapter-utils';
9
+ import { Transaction } from '@prisma/driver-adapter-utils';
10
+
11
+ declare type ArrayModeResult = {
12
+ recordset?: unknown[][];
13
+ rowsAffected?: number[];
14
+ columns?: sql.columns[];
15
+ };
16
+
17
+ declare class MssqlQueryable implements SqlQueryable {
18
+ private conn;
19
+ readonly provider = "sqlserver";
20
+ readonly adapterName: string;
21
+ constructor(conn: sql.ConnectionPool | sql.Transaction);
22
+ queryRaw(query: SqlQuery): Promise<SqlResultSet>;
23
+ executeRaw(query: SqlQuery): Promise<number>;
24
+ protected performIO(query: SqlQuery): Promise<ArrayModeResult>;
25
+ protected onError(error: any): never;
26
+ }
4
27
 
5
28
  export declare class PrismaMssql implements SqlDriverAdapterFactory {
6
29
  private readonly config;
@@ -8,7 +31,18 @@ export declare class PrismaMssql implements SqlDriverAdapterFactory {
8
31
  readonly provider = "sqlserver";
9
32
  readonly adapterName: string;
10
33
  constructor(config: sql.config, options?: PrismaMssqlOptions | undefined);
11
- connect(): Promise<SqlDriverAdapter>;
34
+ connect(): Promise<PrismaMssqlAdapter>;
35
+ }
36
+
37
+ declare class PrismaMssqlAdapter extends MssqlQueryable implements SqlDriverAdapter {
38
+ private pool;
39
+ private readonly options?;
40
+ constructor(pool: sql.ConnectionPool, options?: PrismaMssqlOptions | undefined);
41
+ executeScript(_script: string): Promise<void>;
42
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
43
+ getConnectionInfo?(): ConnectionInfo;
44
+ dispose(): Promise<void>;
45
+ underlyingDriver(): sql.ConnectionPool;
12
46
  }
13
47
 
14
48
  declare type PrismaMssqlOptions = {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,29 @@
1
+ import { ConnectionInfo } from '@prisma/driver-adapter-utils';
2
+ import { IsolationLevel } from '@prisma/driver-adapter-utils';
1
3
  import sql from 'mssql';
2
4
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
5
  import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
6
+ import { SqlQuery } from '@prisma/driver-adapter-utils';
7
+ import { SqlQueryable } from '@prisma/driver-adapter-utils';
8
+ import { SqlResultSet } from '@prisma/driver-adapter-utils';
9
+ import { Transaction } from '@prisma/driver-adapter-utils';
10
+
11
+ declare type ArrayModeResult = {
12
+ recordset?: unknown[][];
13
+ rowsAffected?: number[];
14
+ columns?: sql.columns[];
15
+ };
16
+
17
+ declare class MssqlQueryable implements SqlQueryable {
18
+ private conn;
19
+ readonly provider = "sqlserver";
20
+ readonly adapterName: string;
21
+ constructor(conn: sql.ConnectionPool | sql.Transaction);
22
+ queryRaw(query: SqlQuery): Promise<SqlResultSet>;
23
+ executeRaw(query: SqlQuery): Promise<number>;
24
+ protected performIO(query: SqlQuery): Promise<ArrayModeResult>;
25
+ protected onError(error: any): never;
26
+ }
4
27
 
5
28
  export declare class PrismaMssql implements SqlDriverAdapterFactory {
6
29
  private readonly config;
@@ -8,7 +31,18 @@ export declare class PrismaMssql implements SqlDriverAdapterFactory {
8
31
  readonly provider = "sqlserver";
9
32
  readonly adapterName: string;
10
33
  constructor(config: sql.config, options?: PrismaMssqlOptions | undefined);
11
- connect(): Promise<SqlDriverAdapter>;
34
+ connect(): Promise<PrismaMssqlAdapter>;
35
+ }
36
+
37
+ declare class PrismaMssqlAdapter extends MssqlQueryable implements SqlDriverAdapter {
38
+ private pool;
39
+ private readonly options?;
40
+ constructor(pool: sql.ConnectionPool, options?: PrismaMssqlOptions | undefined);
41
+ executeScript(_script: string): Promise<void>;
42
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
43
+ getConnectionInfo?(): ConnectionInfo;
44
+ dispose(): Promise<void>;
45
+ underlyingDriver(): sql.ConnectionPool;
12
46
  }
13
47
 
14
48
  declare type PrismaMssqlOptions = {
package/dist/index.js CHANGED
@@ -365,16 +365,15 @@ var MssqlQueryable = class {
365
365
  throw new import_driver_adapter_utils2.DriverAdapterError(convertDriverError(error));
366
366
  }
367
367
  };
368
- var LOCK_TAG = Symbol();
369
368
  var MssqlTransaction = class extends MssqlQueryable {
370
369
  constructor(transaction, options) {
371
370
  super(transaction);
372
371
  this.transaction = transaction;
373
372
  this.options = options;
374
373
  }
375
- [LOCK_TAG] = new import_async_mutex.Mutex();
374
+ #mutex = new import_async_mutex.Mutex();
376
375
  async performIO(query) {
377
- const release = await this[LOCK_TAG].acquire();
376
+ const release = await this.#mutex.acquire();
378
377
  try {
379
378
  return await super.performIO(query);
380
379
  } catch (e) {
@@ -431,6 +430,9 @@ var PrismaMssqlAdapter = class extends MssqlQueryable {
431
430
  async dispose() {
432
431
  await this.pool.close();
433
432
  }
433
+ underlyingDriver() {
434
+ return this.pool;
435
+ }
434
436
  };
435
437
  var PrismaMssqlAdapterFactory = class {
436
438
  constructor(config, options) {
package/dist/index.mjs CHANGED
@@ -332,16 +332,15 @@ var MssqlQueryable = class {
332
332
  throw new DriverAdapterError2(convertDriverError(error));
333
333
  }
334
334
  };
335
- var LOCK_TAG = Symbol();
336
335
  var MssqlTransaction = class extends MssqlQueryable {
337
336
  constructor(transaction, options) {
338
337
  super(transaction);
339
338
  this.transaction = transaction;
340
339
  this.options = options;
341
340
  }
342
- [LOCK_TAG] = new Mutex();
341
+ #mutex = new Mutex();
343
342
  async performIO(query) {
344
- const release = await this[LOCK_TAG].acquire();
343
+ const release = await this.#mutex.acquire();
345
344
  try {
346
345
  return await super.performIO(query);
347
346
  } catch (e) {
@@ -398,6 +397,9 @@ var PrismaMssqlAdapter = class extends MssqlQueryable {
398
397
  async dispose() {
399
398
  await this.pool.close();
400
399
  }
400
+ underlyingDriver() {
401
+ return this.pool;
402
+ }
401
403
  };
402
404
  var PrismaMssqlAdapterFactory = class {
403
405
  constructor(config, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-mssql",
3
- "version": "6.13.0-dev.2",
3
+ "version": "6.13.0-dev.20",
4
4
  "description": "Prisma's driver adapter for \"mssql\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "mssql": "^11.0.1",
35
35
  "async-mutex": "0.5.0",
36
- "@prisma/driver-adapter-utils": "6.13.0-dev.2"
36
+ "@prisma/driver-adapter-utils": "6.13.0-dev.20"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/mssql": "9.1.7",