@prisma/client-engine-runtime 6.7.0-dev.2 → 6.7.0-dev.3
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.js
CHANGED
|
@@ -486,11 +486,6 @@ var TransactionManagerError = class extends Error {
|
|
|
486
486
|
}
|
|
487
487
|
code = "P2028";
|
|
488
488
|
};
|
|
489
|
-
var TransactionDriverAdapterError = class extends TransactionManagerError {
|
|
490
|
-
constructor(message, errorParams) {
|
|
491
|
-
super(`Error from Driver Adapter: ${message}`, { ...errorParams.driverAdapterError });
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
489
|
var TransactionNotFoundError = class extends TransactionManagerError {
|
|
495
490
|
constructor() {
|
|
496
491
|
super(
|
|
@@ -508,7 +503,7 @@ var TransactionRolledBackError = class extends TransactionManagerError {
|
|
|
508
503
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`);
|
|
509
504
|
}
|
|
510
505
|
};
|
|
511
|
-
var
|
|
506
|
+
var TransactionStartTimeoutError = class extends TransactionManagerError {
|
|
512
507
|
constructor() {
|
|
513
508
|
super("Unable to start a transaction in the given time.");
|
|
514
509
|
}
|
|
@@ -561,14 +556,7 @@ var TransactionManager = class {
|
|
|
561
556
|
};
|
|
562
557
|
this.transactions.set(transaction.id, transaction);
|
|
563
558
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
|
|
564
|
-
|
|
565
|
-
try {
|
|
566
|
-
startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
567
|
-
} catch (error) {
|
|
568
|
-
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
569
|
-
driverAdapterError: error
|
|
570
|
-
});
|
|
571
|
-
}
|
|
559
|
+
const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
572
560
|
switch (transaction.status) {
|
|
573
561
|
case "waiting":
|
|
574
562
|
transaction.transaction = startedTransaction;
|
|
@@ -578,7 +566,7 @@ var TransactionManager = class {
|
|
|
578
566
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
579
567
|
return { id: transaction.id };
|
|
580
568
|
case "timed_out":
|
|
581
|
-
throw new
|
|
569
|
+
throw new TransactionStartTimeoutError();
|
|
582
570
|
case "running":
|
|
583
571
|
case "committed":
|
|
584
572
|
case "rolled_back":
|
|
@@ -651,24 +639,12 @@ var TransactionManager = class {
|
|
|
651
639
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
652
640
|
tx.status = status;
|
|
653
641
|
if (tx.transaction && status === "committed") {
|
|
654
|
-
|
|
655
|
-
await tx.transaction.commit();
|
|
656
|
-
} catch (error) {
|
|
657
|
-
throw new TransactionDriverAdapterError("Failed to commit transaction.", {
|
|
658
|
-
driverAdapterError: error
|
|
659
|
-
});
|
|
660
|
-
}
|
|
642
|
+
await tx.transaction.commit();
|
|
661
643
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
662
644
|
await tx.transaction.executeRaw(COMMIT_QUERY());
|
|
663
645
|
}
|
|
664
646
|
} else if (tx.transaction) {
|
|
665
|
-
|
|
666
|
-
await tx.transaction.rollback();
|
|
667
|
-
} catch (error) {
|
|
668
|
-
throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
|
|
669
|
-
driverAdapterError: error
|
|
670
|
-
});
|
|
671
|
-
}
|
|
647
|
+
await tx.transaction.rollback();
|
|
672
648
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
673
649
|
await tx.transaction.executeRaw(ROLLBACK_QUERY());
|
|
674
650
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -446,11 +446,6 @@ var TransactionManagerError = class extends Error {
|
|
|
446
446
|
}
|
|
447
447
|
code = "P2028";
|
|
448
448
|
};
|
|
449
|
-
var TransactionDriverAdapterError = class extends TransactionManagerError {
|
|
450
|
-
constructor(message, errorParams) {
|
|
451
|
-
super(`Error from Driver Adapter: ${message}`, { ...errorParams.driverAdapterError });
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
449
|
var TransactionNotFoundError = class extends TransactionManagerError {
|
|
455
450
|
constructor() {
|
|
456
451
|
super(
|
|
@@ -468,7 +463,7 @@ var TransactionRolledBackError = class extends TransactionManagerError {
|
|
|
468
463
|
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`);
|
|
469
464
|
}
|
|
470
465
|
};
|
|
471
|
-
var
|
|
466
|
+
var TransactionStartTimeoutError = class extends TransactionManagerError {
|
|
472
467
|
constructor() {
|
|
473
468
|
super("Unable to start a transaction in the given time.");
|
|
474
469
|
}
|
|
@@ -521,14 +516,7 @@ var TransactionManager = class {
|
|
|
521
516
|
};
|
|
522
517
|
this.transactions.set(transaction.id, transaction);
|
|
523
518
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
|
|
524
|
-
|
|
525
|
-
try {
|
|
526
|
-
startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
527
|
-
} catch (error) {
|
|
528
|
-
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
529
|
-
driverAdapterError: error
|
|
530
|
-
});
|
|
531
|
-
}
|
|
519
|
+
const startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
532
520
|
switch (transaction.status) {
|
|
533
521
|
case "waiting":
|
|
534
522
|
transaction.transaction = startedTransaction;
|
|
@@ -538,7 +526,7 @@ var TransactionManager = class {
|
|
|
538
526
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
539
527
|
return { id: transaction.id };
|
|
540
528
|
case "timed_out":
|
|
541
|
-
throw new
|
|
529
|
+
throw new TransactionStartTimeoutError();
|
|
542
530
|
case "running":
|
|
543
531
|
case "committed":
|
|
544
532
|
case "rolled_back":
|
|
@@ -611,24 +599,12 @@ var TransactionManager = class {
|
|
|
611
599
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
612
600
|
tx.status = status;
|
|
613
601
|
if (tx.transaction && status === "committed") {
|
|
614
|
-
|
|
615
|
-
await tx.transaction.commit();
|
|
616
|
-
} catch (error) {
|
|
617
|
-
throw new TransactionDriverAdapterError("Failed to commit transaction.", {
|
|
618
|
-
driverAdapterError: error
|
|
619
|
-
});
|
|
620
|
-
}
|
|
602
|
+
await tx.transaction.commit();
|
|
621
603
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
622
604
|
await tx.transaction.executeRaw(COMMIT_QUERY());
|
|
623
605
|
}
|
|
624
606
|
} else if (tx.transaction) {
|
|
625
|
-
|
|
626
|
-
await tx.transaction.rollback();
|
|
627
|
-
} catch (error) {
|
|
628
|
-
throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
|
|
629
|
-
driverAdapterError: error
|
|
630
|
-
});
|
|
631
|
-
}
|
|
607
|
+
await tx.transaction.rollback();
|
|
632
608
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
633
609
|
await tx.transaction.executeRaw(ROLLBACK_QUERY());
|
|
634
610
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { Error as DriverAdapterError } from '@prisma/driver-adapter-utils';
|
|
2
1
|
export declare class TransactionManagerError extends Error {
|
|
3
2
|
meta?: Record<string, unknown> | undefined;
|
|
4
3
|
code: string;
|
|
5
4
|
constructor(message: string, meta?: Record<string, unknown> | undefined);
|
|
6
5
|
}
|
|
7
|
-
export declare class TransactionDriverAdapterError extends TransactionManagerError {
|
|
8
|
-
constructor(message: string, errorParams: {
|
|
9
|
-
driverAdapterError: DriverAdapterError;
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
6
|
export declare class TransactionNotFoundError extends TransactionManagerError {
|
|
13
7
|
constructor();
|
|
14
8
|
}
|
|
@@ -18,7 +12,7 @@ export declare class TransactionClosedError extends TransactionManagerError {
|
|
|
18
12
|
export declare class TransactionRolledBackError extends TransactionManagerError {
|
|
19
13
|
constructor(operation: string);
|
|
20
14
|
}
|
|
21
|
-
export declare class
|
|
15
|
+
export declare class TransactionStartTimeoutError extends TransactionManagerError {
|
|
22
16
|
constructor();
|
|
23
17
|
}
|
|
24
18
|
export declare class TransactionExecutionTimeoutError extends TransactionManagerError {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.7.0-dev.
|
|
3
|
+
"version": "6.7.0-dev.3",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"nanoid": "5.1.5",
|
|
30
30
|
"ulid": "3.0.0",
|
|
31
31
|
"uuid": "11.1.0",
|
|
32
|
-
"@prisma/
|
|
33
|
-
"@prisma/
|
|
32
|
+
"@prisma/driver-adapter-utils": "6.7.0-dev.3",
|
|
33
|
+
"@prisma/debug": "6.7.0-dev.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "29.5.14",
|