@prisma/driver-adapter-utils 5.20.0-dev.20 → 5.20.0-dev.21
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 +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +8 -1
- package/dist/index.mjs +8 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,13 @@ export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' |
|
|
|
9
9
|
|
|
10
10
|
export declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter;
|
|
11
11
|
|
|
12
|
+
export declare interface BoundDriverAdapter extends Queryable, WithTransaction {
|
|
13
|
+
/**
|
|
14
|
+
* Optional method that returns extra connection info
|
|
15
|
+
*/
|
|
16
|
+
getConnectionInfo?(): Result<ConnectionInfo>;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
13
20
|
|
|
14
21
|
export declare const ColumnTypeEnum: {
|
|
@@ -53,11 +60,7 @@ export declare type ConnectionInfo = {
|
|
|
53
60
|
|
|
54
61
|
export { Debug }
|
|
55
62
|
|
|
56
|
-
export declare interface DriverAdapter extends Queryable {
|
|
57
|
-
/**
|
|
58
|
-
* Starts new transaction.
|
|
59
|
-
*/
|
|
60
|
-
transactionContext(): Promise<Result<TransactionContext>>;
|
|
63
|
+
export declare interface DriverAdapter extends Queryable, WithTransactionDeprecated, WithTransaction {
|
|
61
64
|
/**
|
|
62
65
|
* Optional method that returns extra connection info
|
|
63
66
|
*/
|
|
@@ -95,7 +98,7 @@ declare type Error_2 = {
|
|
|
95
98
|
};
|
|
96
99
|
export { Error_2 as Error }
|
|
97
100
|
|
|
98
|
-
export declare interface ErrorCapturingDriverAdapter extends
|
|
101
|
+
export declare interface ErrorCapturingDriverAdapter extends BoundDriverAdapter {
|
|
99
102
|
readonly errorRegistry: ErrorRegistry;
|
|
100
103
|
}
|
|
101
104
|
|
|
@@ -196,4 +199,20 @@ export declare type TransactionOptions = {
|
|
|
196
199
|
usePhantomQuery: boolean;
|
|
197
200
|
};
|
|
198
201
|
|
|
202
|
+
declare interface WithTransaction extends Queryable {
|
|
203
|
+
/**
|
|
204
|
+
* Starts new transaction.
|
|
205
|
+
* If `startTransaction` is not defined, `transactionContext` must be defined.
|
|
206
|
+
*/
|
|
207
|
+
transactionContext?(): Promise<Result<TransactionContext>>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare interface WithTransactionDeprecated extends Queryable {
|
|
211
|
+
/**
|
|
212
|
+
* Starts new transaction.
|
|
213
|
+
* @deprecated Use `transactionContext` instead.
|
|
214
|
+
*/
|
|
215
|
+
startTransaction?(): Promise<Result<Transaction>>;
|
|
216
|
+
}
|
|
217
|
+
|
|
199
218
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' |
|
|
|
9
9
|
|
|
10
10
|
export declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter;
|
|
11
11
|
|
|
12
|
+
export declare interface BoundDriverAdapter extends Queryable, WithTransaction {
|
|
13
|
+
/**
|
|
14
|
+
* Optional method that returns extra connection info
|
|
15
|
+
*/
|
|
16
|
+
getConnectionInfo?(): Result<ConnectionInfo>;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
13
20
|
|
|
14
21
|
export declare const ColumnTypeEnum: {
|
|
@@ -53,11 +60,7 @@ export declare type ConnectionInfo = {
|
|
|
53
60
|
|
|
54
61
|
export { Debug }
|
|
55
62
|
|
|
56
|
-
export declare interface DriverAdapter extends Queryable {
|
|
57
|
-
/**
|
|
58
|
-
* Starts new transaction.
|
|
59
|
-
*/
|
|
60
|
-
transactionContext(): Promise<Result<TransactionContext>>;
|
|
63
|
+
export declare interface DriverAdapter extends Queryable, WithTransactionDeprecated, WithTransaction {
|
|
61
64
|
/**
|
|
62
65
|
* Optional method that returns extra connection info
|
|
63
66
|
*/
|
|
@@ -95,7 +98,7 @@ declare type Error_2 = {
|
|
|
95
98
|
};
|
|
96
99
|
export { Error_2 as Error }
|
|
97
100
|
|
|
98
|
-
export declare interface ErrorCapturingDriverAdapter extends
|
|
101
|
+
export declare interface ErrorCapturingDriverAdapter extends BoundDriverAdapter {
|
|
99
102
|
readonly errorRegistry: ErrorRegistry;
|
|
100
103
|
}
|
|
101
104
|
|
|
@@ -196,4 +199,20 @@ export declare type TransactionOptions = {
|
|
|
196
199
|
usePhantomQuery: boolean;
|
|
197
200
|
};
|
|
198
201
|
|
|
202
|
+
declare interface WithTransaction extends Queryable {
|
|
203
|
+
/**
|
|
204
|
+
* Starts new transaction.
|
|
205
|
+
* If `startTransaction` is not defined, `transactionContext` must be defined.
|
|
206
|
+
*/
|
|
207
|
+
transactionContext?(): Promise<Result<TransactionContext>>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare interface WithTransactionDeprecated extends Queryable {
|
|
211
|
+
/**
|
|
212
|
+
* Starts new transaction.
|
|
213
|
+
* @deprecated Use `transactionContext` instead.
|
|
214
|
+
*/
|
|
215
|
+
startTransaction?(): Promise<Result<Transaction>>;
|
|
216
|
+
}
|
|
217
|
+
|
|
199
218
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,14 @@ var ErrorRegistryInternal = class {
|
|
|
73
73
|
};
|
|
74
74
|
var bindAdapter = (adapter) => {
|
|
75
75
|
const errorRegistry = new ErrorRegistryInternal();
|
|
76
|
-
|
|
76
|
+
if (adapter.transactionContext === void 0 && adapter.startTransaction === void 0) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
"[prisma:driverAdapters] Either `adapter.transactionContext` or `adapter.startTransaction` must be defined."
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
const createTransactionContext = adapter.transactionContext === void 0 ? wrapAsync(errorRegistry, () => {
|
|
82
|
+
return Promise.resolve(ok(adapter));
|
|
83
|
+
}) : wrapAsync(errorRegistry, adapter.transactionContext.bind(adapter));
|
|
77
84
|
const boundAdapter = {
|
|
78
85
|
adapterName: adapter.adapterName,
|
|
79
86
|
errorRegistry,
|
package/dist/index.mjs
CHANGED
|
@@ -43,7 +43,14 @@ var ErrorRegistryInternal = class {
|
|
|
43
43
|
};
|
|
44
44
|
var bindAdapter = (adapter) => {
|
|
45
45
|
const errorRegistry = new ErrorRegistryInternal();
|
|
46
|
-
|
|
46
|
+
if (adapter.transactionContext === void 0 && adapter.startTransaction === void 0) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"[prisma:driverAdapters] Either `adapter.transactionContext` or `adapter.startTransaction` must be defined."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const createTransactionContext = adapter.transactionContext === void 0 ? wrapAsync(errorRegistry, () => {
|
|
52
|
+
return Promise.resolve(ok(adapter));
|
|
53
|
+
}) : wrapAsync(errorRegistry, adapter.transactionContext.bind(adapter));
|
|
47
54
|
const boundAdapter = {
|
|
48
55
|
adapterName: adapter.adapterName,
|
|
49
56
|
errorRegistry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/driver-adapter-utils",
|
|
3
|
-
"version": "5.20.0-dev.
|
|
3
|
+
"version": "5.20.0-dev.21",
|
|
4
4
|
"description": "Internal set of utilities and types for Prisma's driver adapters.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@prisma/debug": "5.20.0-dev.
|
|
34
|
+
"@prisma/debug": "5.20.0-dev.21"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "DEV=true tsx helpers/build.ts",
|