@prisma/client-engine-runtime 6.6.0-dev.35 → 6.6.0-dev.37
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,7 +1,7 @@
|
|
|
1
|
-
import { ErrorCapturingSqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
2
|
-
import { ErrorCapturingSqlQueryable } from '@prisma/driver-adapter-utils';
|
|
3
|
-
import { ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
|
|
4
1
|
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
2
|
+
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
|
+
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
5
|
|
|
6
6
|
export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
|
|
7
7
|
|
|
@@ -36,7 +36,7 @@ export declare class QueryInterpreter {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export declare type QueryInterpreterOptions = {
|
|
39
|
-
queryable:
|
|
39
|
+
queryable: SqlQueryable;
|
|
40
40
|
placeholderValues: Record<string, unknown>;
|
|
41
41
|
onQuery?: (event: QueryEvent) => void;
|
|
42
42
|
};
|
|
@@ -114,12 +114,12 @@ export declare class TransactionManager {
|
|
|
114
114
|
private closedTransactions;
|
|
115
115
|
private readonly driverAdapter;
|
|
116
116
|
constructor({ driverAdapter }: {
|
|
117
|
-
driverAdapter:
|
|
117
|
+
driverAdapter: SqlDriverAdapter;
|
|
118
118
|
});
|
|
119
119
|
startTransaction(options: TransactionOptions): Promise<TransactionInfo>;
|
|
120
120
|
commitTransaction(transactionId: string): Promise<void>;
|
|
121
121
|
rollbackTransaction(transactionId: string): Promise<void>;
|
|
122
|
-
getTransaction(txInfo: TransactionInfo, operation: string):
|
|
122
|
+
getTransaction(txInfo: TransactionInfo, operation: string): Transaction;
|
|
123
123
|
private getActiveTransaction;
|
|
124
124
|
cancelAllTransactions(): Promise<void>;
|
|
125
125
|
private startTransactionTimeout;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ErrorCapturingSqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
2
|
-
import { ErrorCapturingSqlQueryable } from '@prisma/driver-adapter-utils';
|
|
3
|
-
import { ErrorCapturingTransaction } from '@prisma/driver-adapter-utils';
|
|
4
1
|
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
2
|
+
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
3
|
+
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
4
|
+
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
5
|
|
|
6
6
|
export declare function isPrismaValuePlaceholder(value: unknown): value is PrismaValuePlaceholder;
|
|
7
7
|
|
|
@@ -36,7 +36,7 @@ export declare class QueryInterpreter {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export declare type QueryInterpreterOptions = {
|
|
39
|
-
queryable:
|
|
39
|
+
queryable: SqlQueryable;
|
|
40
40
|
placeholderValues: Record<string, unknown>;
|
|
41
41
|
onQuery?: (event: QueryEvent) => void;
|
|
42
42
|
};
|
|
@@ -114,12 +114,12 @@ export declare class TransactionManager {
|
|
|
114
114
|
private closedTransactions;
|
|
115
115
|
private readonly driverAdapter;
|
|
116
116
|
constructor({ driverAdapter }: {
|
|
117
|
-
driverAdapter:
|
|
117
|
+
driverAdapter: SqlDriverAdapter;
|
|
118
118
|
});
|
|
119
119
|
startTransaction(options: TransactionOptions): Promise<TransactionInfo>;
|
|
120
120
|
commitTransaction(transactionId: string): Promise<void>;
|
|
121
121
|
rollbackTransaction(transactionId: string): Promise<void>;
|
|
122
|
-
getTransaction(txInfo: TransactionInfo, operation: string):
|
|
122
|
+
getTransaction(txInfo: TransactionInfo, operation: string): Transaction;
|
|
123
123
|
private getActiveTransaction;
|
|
124
124
|
cancelAllTransactions(): Promise<void>;
|
|
125
125
|
private startTransactionTimeout;
|
package/dist/index.js
CHANGED
|
@@ -275,23 +275,13 @@ var QueryInterpreter = class {
|
|
|
275
275
|
case "execute": {
|
|
276
276
|
const query = renderQuery(node.args, scope);
|
|
277
277
|
return this.#withQueryEvent(query, async () => {
|
|
278
|
-
|
|
279
|
-
if (result.ok) {
|
|
280
|
-
return result.value;
|
|
281
|
-
} else {
|
|
282
|
-
throw result.error;
|
|
283
|
-
}
|
|
278
|
+
return await this.#queryable.executeRaw(query);
|
|
284
279
|
});
|
|
285
280
|
}
|
|
286
281
|
case "query": {
|
|
287
282
|
const query = renderQuery(node.args, scope);
|
|
288
283
|
return this.#withQueryEvent(query, async () => {
|
|
289
|
-
|
|
290
|
-
if (result.ok) {
|
|
291
|
-
return serialize(result.value);
|
|
292
|
-
} else {
|
|
293
|
-
throw result.error;
|
|
294
|
-
}
|
|
284
|
+
return serialize(await this.#queryable.queryRaw(query));
|
|
295
285
|
});
|
|
296
286
|
}
|
|
297
287
|
case "reverse": {
|
|
@@ -509,14 +499,17 @@ var TransactionManager = class {
|
|
|
509
499
|
};
|
|
510
500
|
this.transactions.set(transaction.id, transaction);
|
|
511
501
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
|
|
512
|
-
|
|
513
|
-
|
|
502
|
+
let startedTransaction;
|
|
503
|
+
try {
|
|
504
|
+
startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
505
|
+
} catch (error) {
|
|
514
506
|
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
515
|
-
driverAdapterError:
|
|
507
|
+
driverAdapterError: error
|
|
516
508
|
});
|
|
509
|
+
}
|
|
517
510
|
switch (transaction.status) {
|
|
518
511
|
case "waiting":
|
|
519
|
-
transaction.transaction = startedTransaction
|
|
512
|
+
transaction.transaction = startedTransaction;
|
|
520
513
|
clearTimeout(transaction.timer);
|
|
521
514
|
transaction.timer = void 0;
|
|
522
515
|
transaction.status = "running";
|
|
@@ -596,20 +589,24 @@ var TransactionManager = class {
|
|
|
596
589
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
597
590
|
tx.status = status;
|
|
598
591
|
if (tx.transaction && status === "committed") {
|
|
599
|
-
|
|
600
|
-
|
|
592
|
+
try {
|
|
593
|
+
await tx.transaction.commit();
|
|
594
|
+
} catch (error) {
|
|
601
595
|
throw new TransactionDriverAdapterError("Failed to commit transaction.", {
|
|
602
|
-
driverAdapterError:
|
|
596
|
+
driverAdapterError: error
|
|
603
597
|
});
|
|
598
|
+
}
|
|
604
599
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
605
600
|
await tx.transaction.executeRaw(COMMIT_QUERY());
|
|
606
601
|
}
|
|
607
602
|
} else if (tx.transaction) {
|
|
608
|
-
|
|
609
|
-
|
|
603
|
+
try {
|
|
604
|
+
await tx.transaction.rollback();
|
|
605
|
+
} catch (error) {
|
|
610
606
|
throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
|
|
611
|
-
driverAdapterError:
|
|
607
|
+
driverAdapterError: error
|
|
612
608
|
});
|
|
609
|
+
}
|
|
613
610
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
614
611
|
await tx.transaction.executeRaw(ROLLBACK_QUERY());
|
|
615
612
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -236,23 +236,13 @@ var QueryInterpreter = class {
|
|
|
236
236
|
case "execute": {
|
|
237
237
|
const query = renderQuery(node.args, scope);
|
|
238
238
|
return this.#withQueryEvent(query, async () => {
|
|
239
|
-
|
|
240
|
-
if (result.ok) {
|
|
241
|
-
return result.value;
|
|
242
|
-
} else {
|
|
243
|
-
throw result.error;
|
|
244
|
-
}
|
|
239
|
+
return await this.#queryable.executeRaw(query);
|
|
245
240
|
});
|
|
246
241
|
}
|
|
247
242
|
case "query": {
|
|
248
243
|
const query = renderQuery(node.args, scope);
|
|
249
244
|
return this.#withQueryEvent(query, async () => {
|
|
250
|
-
|
|
251
|
-
if (result.ok) {
|
|
252
|
-
return serialize(result.value);
|
|
253
|
-
} else {
|
|
254
|
-
throw result.error;
|
|
255
|
-
}
|
|
245
|
+
return serialize(await this.#queryable.queryRaw(query));
|
|
256
246
|
});
|
|
257
247
|
}
|
|
258
248
|
case "reverse": {
|
|
@@ -470,14 +460,17 @@ var TransactionManager = class {
|
|
|
470
460
|
};
|
|
471
461
|
this.transactions.set(transaction.id, transaction);
|
|
472
462
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.maxWait);
|
|
473
|
-
|
|
474
|
-
|
|
463
|
+
let startedTransaction;
|
|
464
|
+
try {
|
|
465
|
+
startedTransaction = await this.driverAdapter.startTransaction(validatedOptions.isolationLevel);
|
|
466
|
+
} catch (error) {
|
|
475
467
|
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
476
|
-
driverAdapterError:
|
|
468
|
+
driverAdapterError: error
|
|
477
469
|
});
|
|
470
|
+
}
|
|
478
471
|
switch (transaction.status) {
|
|
479
472
|
case "waiting":
|
|
480
|
-
transaction.transaction = startedTransaction
|
|
473
|
+
transaction.transaction = startedTransaction;
|
|
481
474
|
clearTimeout(transaction.timer);
|
|
482
475
|
transaction.timer = void 0;
|
|
483
476
|
transaction.status = "running";
|
|
@@ -557,20 +550,24 @@ var TransactionManager = class {
|
|
|
557
550
|
debug("Closing transaction.", { transactionId: tx.id, status });
|
|
558
551
|
tx.status = status;
|
|
559
552
|
if (tx.transaction && status === "committed") {
|
|
560
|
-
|
|
561
|
-
|
|
553
|
+
try {
|
|
554
|
+
await tx.transaction.commit();
|
|
555
|
+
} catch (error) {
|
|
562
556
|
throw new TransactionDriverAdapterError("Failed to commit transaction.", {
|
|
563
|
-
driverAdapterError:
|
|
557
|
+
driverAdapterError: error
|
|
564
558
|
});
|
|
559
|
+
}
|
|
565
560
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
566
561
|
await tx.transaction.executeRaw(COMMIT_QUERY());
|
|
567
562
|
}
|
|
568
563
|
} else if (tx.transaction) {
|
|
569
|
-
|
|
570
|
-
|
|
564
|
+
try {
|
|
565
|
+
await tx.transaction.rollback();
|
|
566
|
+
} catch (error) {
|
|
571
567
|
throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
|
|
572
|
-
driverAdapterError:
|
|
568
|
+
driverAdapterError: error
|
|
573
569
|
});
|
|
570
|
+
}
|
|
574
571
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
575
572
|
await tx.transaction.executeRaw(ROLLBACK_QUERY());
|
|
576
573
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
2
2
|
import { QueryEvent } from '../events';
|
|
3
3
|
import { QueryPlanNode } from '../QueryPlan';
|
|
4
4
|
export type QueryInterpreterOptions = {
|
|
5
|
-
queryable:
|
|
5
|
+
queryable: SqlQueryable;
|
|
6
6
|
placeholderValues: Record<string, unknown>;
|
|
7
7
|
onQuery?: (event: QueryEvent) => void;
|
|
8
8
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SqlDriverAdapter, Transaction } 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:
|
|
8
|
+
driverAdapter: SqlDriverAdapter;
|
|
9
9
|
});
|
|
10
10
|
startTransaction(options: Options): Promise<TransactionInfo>;
|
|
11
11
|
commitTransaction(transactionId: string): Promise<void>;
|
|
12
12
|
rollbackTransaction(transactionId: string): Promise<void>;
|
|
13
|
-
getTransaction(txInfo: TransactionInfo, operation: string):
|
|
13
|
+
getTransaction(txInfo: TransactionInfo, operation: string): Transaction;
|
|
14
14
|
private getActiveTransaction;
|
|
15
15
|
cancelAllTransactions(): Promise<void>;
|
|
16
16
|
private startTransactionTimeout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.6.0-dev.
|
|
3
|
+
"version": "6.6.0-dev.37",
|
|
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/
|
|
28
|
-
"@prisma/
|
|
27
|
+
"@prisma/driver-adapter-utils": "6.6.0-dev.37",
|
|
28
|
+
"@prisma/debug": "6.6.0-dev.37"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/jest": "29.5.14",
|