@prisma/client-engine-runtime 6.6.0-dev.31 → 6.6.0-dev.33

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,14 +1,7 @@
1
- import { ErrorCapturingSqlConnection } from '@prisma/driver-adapter-utils';
1
+ import { ErrorCapturingSqlDriverAdapter } from '@prisma/driver-adapter-utils';
2
2
  import { ErrorCapturingSqlQueryable } from '@prisma/driver-adapter-utils';
3
3
  import { ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
4
-
5
- export declare const enum IsolationLevel {
6
- ReadUncommitted = "ReadUncommitted",
7
- ReadCommitted = "ReadCommitted",
8
- RepeatableRead = "RepeatableRead",
9
- Snapshot = "Snapshot",
10
- Serializable = "Serializable"
11
- }
4
+ import type { IsolationLevel } from '@prisma/driver-adapter-utils';
12
5
 
13
6
  export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
14
7
 
@@ -121,7 +114,7 @@ export declare class TransactionManager {
121
114
  private closedTransactions;
122
115
  private readonly driverAdapter;
123
116
  constructor({ driverAdapter }: {
124
- driverAdapter: ErrorCapturingSqlConnection;
117
+ driverAdapter: ErrorCapturingSqlDriverAdapter;
125
118
  });
126
119
  startTransaction(options: TransactionOptions): Promise<TransactionInfo>;
127
120
  commitTransaction(transactionId: string): Promise<void>;
@@ -132,7 +125,6 @@ export declare class TransactionManager {
132
125
  private startTransactionTimeout;
133
126
  private closeTransaction;
134
127
  private validateOptions;
135
- private requiresSettingIsolationLevelFirst;
136
128
  }
137
129
 
138
130
  export declare class TransactionManagerError extends Error {
package/dist/index.d.ts CHANGED
@@ -1,14 +1,7 @@
1
- import { ErrorCapturingSqlConnection } from '@prisma/driver-adapter-utils';
1
+ import { ErrorCapturingSqlDriverAdapter } from '@prisma/driver-adapter-utils';
2
2
  import { ErrorCapturingSqlQueryable } from '@prisma/driver-adapter-utils';
3
3
  import { ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
4
-
5
- export declare const enum IsolationLevel {
6
- ReadUncommitted = "ReadUncommitted",
7
- ReadCommitted = "ReadCommitted",
8
- RepeatableRead = "RepeatableRead",
9
- Snapshot = "Snapshot",
10
- Serializable = "Serializable"
11
- }
4
+ import type { IsolationLevel } from '@prisma/driver-adapter-utils';
12
5
 
13
6
  export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
14
7
 
@@ -121,7 +114,7 @@ export declare class TransactionManager {
121
114
  private closedTransactions;
122
115
  private readonly driverAdapter;
123
116
  constructor({ driverAdapter }: {
124
- driverAdapter: ErrorCapturingSqlConnection;
117
+ driverAdapter: ErrorCapturingSqlDriverAdapter;
125
118
  });
126
119
  startTransaction(options: TransactionOptions): Promise<TransactionInfo>;
127
120
  commitTransaction(transactionId: string): Promise<void>;
@@ -132,7 +125,6 @@ export declare class TransactionManager {
132
125
  private startTransactionTimeout;
133
126
  private closeTransaction;
134
127
  private validateOptions;
135
- private requiresSettingIsolationLevelFirst;
136
128
  }
137
129
 
138
130
  export declare class TransactionManagerError extends Error {
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- IsolationLevel: () => IsolationLevel,
34
33
  QueryInterpreter: () => QueryInterpreter,
35
34
  TransactionManager: () => TransactionManager,
36
35
  TransactionManagerError: () => TransactionManagerError,
@@ -412,16 +411,6 @@ function childRecordMatchesParent(childRecord, parentRecord, joinExpr) {
412
411
  return true;
413
412
  }
414
413
 
415
- // src/transactionManager/Transaction.ts
416
- var IsolationLevel = /* @__PURE__ */ ((IsolationLevel2) => {
417
- IsolationLevel2["ReadUncommitted"] = "ReadUncommitted";
418
- IsolationLevel2["ReadCommitted"] = "ReadCommitted";
419
- IsolationLevel2["RepeatableRead"] = "RepeatableRead";
420
- IsolationLevel2["Snapshot"] = "Snapshot";
421
- IsolationLevel2["Serializable"] = "Serializable";
422
- return IsolationLevel2;
423
- })(IsolationLevel || {});
424
-
425
414
  // src/transactionManager/TransactionManager.ts
426
415
  var import_debug = __toESM(require("@prisma/debug"));
427
416
 
@@ -495,21 +484,9 @@ var InvalidTransactionIsolationLevelError = class extends TransactionManagerErro
495
484
 
496
485
  // src/transactionManager/TransactionManager.ts
497
486
  var MAX_CLOSED_TRANSACTIONS = 100;
498
- var isolationLevelMap = {
499
- ReadUncommitted: "READ UNCOMMITTED",
500
- ReadCommitted: "READ COMMITTED",
501
- RepeatableRead: "REPEATABLE READ",
502
- Snapshot: "SNAPSHOT",
503
- Serializable: "SERIALIZABLE"
504
- };
505
487
  var debug = (0, import_debug.default)("prisma:client:transactionManager");
506
488
  var COMMIT_QUERY = () => ({ sql: "COMMIT", args: [], argTypes: [] });
507
489
  var ROLLBACK_QUERY = () => ({ sql: "ROLLBACK", args: [], argTypes: [] });
508
- var ISOLATION_LEVEL_QUERY = (isolationLevel) => ({
509
- sql: "SET TRANSACTION ISOLATION LEVEL " + isolationLevelMap[isolationLevel],
510
- args: [],
511
- argTypes: []
512
- });
513
490
  var TransactionManager = class {
514
491
  // The map of active transactions.
515
492
  transactions = /* @__PURE__ */ new Map();
@@ -532,25 +509,11 @@ var TransactionManager = class {
532
509
  };
533
510
  this.transactions.set(transaction.id, transaction);
534
511
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
535
- const txContext = await this.driverAdapter.transactionContext();
536
- if (!txContext.ok)
537
- throw new TransactionDriverAdapterError("Failed to start transaction.", {
538
- driverAdapterError: txContext.error
539
- });
540
- if (this.requiresSettingIsolationLevelFirst() && validatedOptions.isolationLevel) {
541
- await txContext.value.executeRaw(ISOLATION_LEVEL_QUERY(validatedOptions.isolationLevel));
542
- }
543
- const startedTransaction = await txContext.value.startTransaction();
512
+ const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
544
513
  if (!startedTransaction.ok)
545
514
  throw new TransactionDriverAdapterError("Failed to start transaction.", {
546
515
  driverAdapterError: startedTransaction.error
547
516
  });
548
- if (!startedTransaction.value.options.usePhantomQuery) {
549
- await startedTransaction.value.executeRaw({ sql: "BEGIN", args: [], argTypes: [] });
550
- if (!this.requiresSettingIsolationLevelFirst() && validatedOptions.isolationLevel) {
551
- await txContext.value.executeRaw(ISOLATION_LEVEL_QUERY(validatedOptions.isolationLevel));
552
- }
553
- }
554
517
  switch (transaction.status) {
555
518
  case "waiting":
556
519
  transaction.transaction = startedTransaction.value;
@@ -662,23 +625,16 @@ var TransactionManager = class {
662
625
  validateOptions(options) {
663
626
  if (!options.timeout) throw new TransactionManagerError("timeout is required");
664
627
  if (!options.maxWait) throw new TransactionManagerError("maxWait is required");
665
- if (options.isolationLevel === "Snapshot" /* Snapshot */)
666
- throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
667
- if (this.driverAdapter.provider === "sqlite" && options.isolationLevel && options.isolationLevel !== "Serializable" /* Serializable */)
668
- throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
628
+ if (options.isolationLevel === "SNAPSHOT") throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
669
629
  return {
670
630
  ...options,
671
631
  timeout: options.timeout,
672
632
  maxWait: options.maxWait
673
633
  };
674
634
  }
675
- requiresSettingIsolationLevelFirst() {
676
- return this.driverAdapter.provider === "mysql";
677
- }
678
635
  };
679
636
  // Annotate the CommonJS export names for ESM import in node:
680
637
  0 && (module.exports = {
681
- IsolationLevel,
682
638
  QueryInterpreter,
683
639
  TransactionManager,
684
640
  TransactionManagerError,
package/dist/index.mjs CHANGED
@@ -372,16 +372,6 @@ function childRecordMatchesParent(childRecord, parentRecord, joinExpr) {
372
372
  return true;
373
373
  }
374
374
 
375
- // src/transactionManager/Transaction.ts
376
- var IsolationLevel = /* @__PURE__ */ ((IsolationLevel2) => {
377
- IsolationLevel2["ReadUncommitted"] = "ReadUncommitted";
378
- IsolationLevel2["ReadCommitted"] = "ReadCommitted";
379
- IsolationLevel2["RepeatableRead"] = "RepeatableRead";
380
- IsolationLevel2["Snapshot"] = "Snapshot";
381
- IsolationLevel2["Serializable"] = "Serializable";
382
- return IsolationLevel2;
383
- })(IsolationLevel || {});
384
-
385
375
  // src/transactionManager/TransactionManager.ts
386
376
  import Debug from "@prisma/debug";
387
377
 
@@ -455,21 +445,9 @@ var InvalidTransactionIsolationLevelError = class extends TransactionManagerErro
455
445
 
456
446
  // src/transactionManager/TransactionManager.ts
457
447
  var MAX_CLOSED_TRANSACTIONS = 100;
458
- var isolationLevelMap = {
459
- ReadUncommitted: "READ UNCOMMITTED",
460
- ReadCommitted: "READ COMMITTED",
461
- RepeatableRead: "REPEATABLE READ",
462
- Snapshot: "SNAPSHOT",
463
- Serializable: "SERIALIZABLE"
464
- };
465
448
  var debug = Debug("prisma:client:transactionManager");
466
449
  var COMMIT_QUERY = () => ({ sql: "COMMIT", args: [], argTypes: [] });
467
450
  var ROLLBACK_QUERY = () => ({ sql: "ROLLBACK", args: [], argTypes: [] });
468
- var ISOLATION_LEVEL_QUERY = (isolationLevel) => ({
469
- sql: "SET TRANSACTION ISOLATION LEVEL " + isolationLevelMap[isolationLevel],
470
- args: [],
471
- argTypes: []
472
- });
473
451
  var TransactionManager = class {
474
452
  // The map of active transactions.
475
453
  transactions = /* @__PURE__ */ new Map();
@@ -492,25 +470,11 @@ var TransactionManager = class {
492
470
  };
493
471
  this.transactions.set(transaction.id, transaction);
494
472
  transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
495
- const txContext = await this.driverAdapter.transactionContext();
496
- if (!txContext.ok)
497
- throw new TransactionDriverAdapterError("Failed to start transaction.", {
498
- driverAdapterError: txContext.error
499
- });
500
- if (this.requiresSettingIsolationLevelFirst() && validatedOptions.isolationLevel) {
501
- await txContext.value.executeRaw(ISOLATION_LEVEL_QUERY(validatedOptions.isolationLevel));
502
- }
503
- const startedTransaction = await txContext.value.startTransaction();
473
+ const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
504
474
  if (!startedTransaction.ok)
505
475
  throw new TransactionDriverAdapterError("Failed to start transaction.", {
506
476
  driverAdapterError: startedTransaction.error
507
477
  });
508
- if (!startedTransaction.value.options.usePhantomQuery) {
509
- await startedTransaction.value.executeRaw({ sql: "BEGIN", args: [], argTypes: [] });
510
- if (!this.requiresSettingIsolationLevelFirst() && validatedOptions.isolationLevel) {
511
- await txContext.value.executeRaw(ISOLATION_LEVEL_QUERY(validatedOptions.isolationLevel));
512
- }
513
- }
514
478
  switch (transaction.status) {
515
479
  case "waiting":
516
480
  transaction.transaction = startedTransaction.value;
@@ -622,22 +586,15 @@ var TransactionManager = class {
622
586
  validateOptions(options) {
623
587
  if (!options.timeout) throw new TransactionManagerError("timeout is required");
624
588
  if (!options.maxWait) throw new TransactionManagerError("maxWait is required");
625
- if (options.isolationLevel === "Snapshot" /* Snapshot */)
626
- throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
627
- if (this.driverAdapter.provider === "sqlite" && options.isolationLevel && options.isolationLevel !== "Serializable" /* Serializable */)
628
- throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
589
+ if (options.isolationLevel === "SNAPSHOT") throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
629
590
  return {
630
591
  ...options,
631
592
  timeout: options.timeout,
632
593
  maxWait: options.maxWait
633
594
  };
634
595
  }
635
- requiresSettingIsolationLevelFirst() {
636
- return this.driverAdapter.provider === "mysql";
637
- }
638
596
  };
639
597
  export {
640
- IsolationLevel,
641
598
  QueryInterpreter,
642
599
  TransactionManager,
643
600
  TransactionManagerError,
@@ -1,10 +1,4 @@
1
- export declare const enum IsolationLevel {
2
- ReadUncommitted = "ReadUncommitted",
3
- ReadCommitted = "ReadCommitted",
4
- RepeatableRead = "RepeatableRead",
5
- Snapshot = "Snapshot",
6
- Serializable = "Serializable"
7
- }
1
+ import type { IsolationLevel } from '@prisma/driver-adapter-utils';
8
2
  export type Options = {
9
3
  maxWait?: number;
10
4
  timeout?: number;
@@ -1,11 +1,11 @@
1
- import { ErrorCapturingSqlConnection, ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
1
+ import { ErrorCapturingSqlDriverAdapter, ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
2
2
  import { Options, TransactionInfo } from './Transaction';
3
3
  export declare class TransactionManager {
4
4
  private transactions;
5
5
  private closedTransactions;
6
6
  private readonly driverAdapter;
7
7
  constructor({ driverAdapter }: {
8
- driverAdapter: ErrorCapturingSqlConnection;
8
+ driverAdapter: ErrorCapturingSqlDriverAdapter;
9
9
  });
10
10
  startTransaction(options: Options): Promise<TransactionInfo>;
11
11
  commitTransaction(transactionId: string): Promise<void>;
@@ -16,5 +16,4 @@ export declare class TransactionManager {
16
16
  private startTransactionTimeout;
17
17
  private closeTransaction;
18
18
  private validateOptions;
19
- private requiresSettingIsolationLevelFirst;
20
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.6.0-dev.31",
3
+ "version": "6.6.0-dev.33",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@prisma/debug": "6.6.0-dev.31",
28
- "@prisma/driver-adapter-utils": "6.6.0-dev.31"
27
+ "@prisma/debug": "6.6.0-dev.33",
28
+ "@prisma/driver-adapter-utils": "6.6.0-dev.33"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/jest": "29.5.14",