@prisma/driver-adapter-utils 6.6.0-dev.5 → 6.6.0-dev.52
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 +24 -32
- package/dist/index.d.ts +24 -32
- package/dist/index.js +6 -24
- package/dist/index.mjs +6 -26
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ declare interface AdapterInfo {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' | 'Enum' | 'EnumArray' | 'Bytes' | 'Boolean' | 'Char' | 'Array' | 'Numeric' | 'Json' | 'Xml' | 'Uuid' | 'DateTime' | 'Date' | 'Time';
|
|
18
18
|
|
|
19
|
-
export declare const bindAdapter: (adapter:
|
|
19
|
+
export declare const bindAdapter: (adapter: SqlDriverAdapter) => ErrorCapturingSqlDriverAdapter;
|
|
20
20
|
|
|
21
21
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
22
22
|
|
|
@@ -62,23 +62,23 @@ export declare type ConnectionInfo = {
|
|
|
62
62
|
|
|
63
63
|
export { Debug }
|
|
64
64
|
|
|
65
|
+
export declare class DriverAdapterError extends Error {
|
|
66
|
+
name: string;
|
|
67
|
+
cause: Error_2;
|
|
68
|
+
constructor(payload: Error_2);
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
/**
|
|
66
|
-
* A generic driver adapter that allows the user to
|
|
67
|
-
*
|
|
72
|
+
* A generic driver adapter factory that allows the user to instantiate a
|
|
73
|
+
* driver adapter. The query and result types are specific to the adapter.
|
|
68
74
|
*/
|
|
69
|
-
declare interface
|
|
75
|
+
export declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo {
|
|
70
76
|
/**
|
|
71
|
-
*
|
|
77
|
+
* Instantiate a driver adapter.
|
|
72
78
|
*/
|
|
73
79
|
connect(): Promise<Queryable<Query, Result>>;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
export declare class DriverAdapterError extends Error {
|
|
77
|
-
name: string;
|
|
78
|
-
cause: Error_2;
|
|
79
|
-
constructor(payload: Error_2);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
82
|
export declare function err<T>(error: Error_2): Result<T>;
|
|
83
83
|
|
|
84
84
|
declare type Error_2 = {
|
|
@@ -87,6 +87,9 @@ declare type Error_2 = {
|
|
|
87
87
|
} | {
|
|
88
88
|
kind: 'UnsupportedNativeDataType';
|
|
89
89
|
type: string;
|
|
90
|
+
} | {
|
|
91
|
+
kind: 'InvalidIsolationLevel';
|
|
92
|
+
level: string;
|
|
90
93
|
} | {
|
|
91
94
|
kind: 'postgres';
|
|
92
95
|
code: string;
|
|
@@ -116,18 +119,14 @@ declare type ErrorCapturingInterface<T> = {
|
|
|
116
119
|
[K in keyof T]: ErrorCapturingFunction<T[K]>;
|
|
117
120
|
};
|
|
118
121
|
|
|
119
|
-
declare interface
|
|
122
|
+
export declare interface ErrorCapturingSqlDriverAdapter extends ErrorCapturingInterface<SqlDriverAdapter> {
|
|
120
123
|
readonly errorRegistry: ErrorRegistry;
|
|
121
124
|
}
|
|
122
|
-
export { ErrorCapturingSqlConnection as ErrorCapturingDriverAdapter }
|
|
123
|
-
export { ErrorCapturingSqlConnection }
|
|
124
125
|
|
|
125
126
|
export declare type ErrorCapturingSqlQueryable = ErrorCapturingInterface<SqlQueryable>;
|
|
126
127
|
|
|
127
128
|
export declare type ErrorCapturingTransaction = ErrorCapturingInterface<Transaction>;
|
|
128
129
|
|
|
129
|
-
export declare type ErrorCapturingTransactionContext = ErrorCapturingInterface<TransactionContext>;
|
|
130
|
-
|
|
131
130
|
export declare type ErrorRecord = {
|
|
132
131
|
error: unknown;
|
|
133
132
|
};
|
|
@@ -136,13 +135,15 @@ export declare interface ErrorRegistry {
|
|
|
136
135
|
consumeError(id: number): ErrorRecord | undefined;
|
|
137
136
|
}
|
|
138
137
|
|
|
138
|
+
export declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
139
|
+
|
|
139
140
|
declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
|
|
140
141
|
|
|
141
142
|
export declare function ok<T>(value: T): Result<T>;
|
|
142
143
|
|
|
143
144
|
export declare type Provider = 'mysql' | 'postgres' | 'sqlite';
|
|
144
145
|
|
|
145
|
-
declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
146
|
+
export declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
146
147
|
/**
|
|
147
148
|
* Execute a query and return its result.
|
|
148
149
|
*/
|
|
@@ -164,7 +165,7 @@ export declare type Result<T> = {
|
|
|
164
165
|
readonly error: Error_2;
|
|
165
166
|
});
|
|
166
167
|
|
|
167
|
-
declare interface
|
|
168
|
+
export declare interface SqlDriverAdapter extends SqlQueryable {
|
|
168
169
|
/**
|
|
169
170
|
* Execute multiple SQL statements separated by semicolon.
|
|
170
171
|
*/
|
|
@@ -172,7 +173,7 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
172
173
|
/**
|
|
173
174
|
* Start new transaction.
|
|
174
175
|
*/
|
|
175
|
-
|
|
176
|
+
startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
|
|
176
177
|
/**
|
|
177
178
|
* Optional method that returns extra connection info
|
|
178
179
|
*/
|
|
@@ -182,19 +183,17 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
182
183
|
*/
|
|
183
184
|
dispose(): Promise<void>;
|
|
184
185
|
}
|
|
185
|
-
export { SqlConnection as DriverAdapter }
|
|
186
|
-
export { SqlConnection }
|
|
187
186
|
|
|
188
|
-
declare interface
|
|
189
|
-
connect(): Promise<
|
|
187
|
+
export declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
|
|
188
|
+
connect(): Promise<SqlDriverAdapter>;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
/**
|
|
193
192
|
* An SQL migration adapter that is aware of the notion of a shadow database
|
|
194
193
|
* and can create a connection to it.
|
|
195
194
|
*/
|
|
196
|
-
export declare interface
|
|
197
|
-
connectToShadowDb(): Promise<
|
|
195
|
+
export declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
|
|
196
|
+
connectToShadowDb(): Promise<SqlDriverAdapter>;
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
export declare type SqlQuery = {
|
|
@@ -243,13 +242,6 @@ export declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
|
243
242
|
rollback(): Promise<void>;
|
|
244
243
|
}
|
|
245
244
|
|
|
246
|
-
export declare interface TransactionContext extends AdapterInfo, SqlQueryable {
|
|
247
|
-
/**
|
|
248
|
-
* Start new transaction.
|
|
249
|
-
*/
|
|
250
|
-
startTransaction(): Promise<Transaction>;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
245
|
export declare type TransactionOptions = {
|
|
254
246
|
usePhantomQuery: boolean;
|
|
255
247
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare interface AdapterInfo {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' | 'Enum' | 'EnumArray' | 'Bytes' | 'Boolean' | 'Char' | 'Array' | 'Numeric' | 'Json' | 'Xml' | 'Uuid' | 'DateTime' | 'Date' | 'Time';
|
|
18
18
|
|
|
19
|
-
export declare const bindAdapter: (adapter:
|
|
19
|
+
export declare const bindAdapter: (adapter: SqlDriverAdapter) => ErrorCapturingSqlDriverAdapter;
|
|
20
20
|
|
|
21
21
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
22
22
|
|
|
@@ -62,23 +62,23 @@ export declare type ConnectionInfo = {
|
|
|
62
62
|
|
|
63
63
|
export { Debug }
|
|
64
64
|
|
|
65
|
+
export declare class DriverAdapterError extends Error {
|
|
66
|
+
name: string;
|
|
67
|
+
cause: Error_2;
|
|
68
|
+
constructor(payload: Error_2);
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
/**
|
|
66
|
-
* A generic driver adapter that allows the user to
|
|
67
|
-
*
|
|
72
|
+
* A generic driver adapter factory that allows the user to instantiate a
|
|
73
|
+
* driver adapter. The query and result types are specific to the adapter.
|
|
68
74
|
*/
|
|
69
|
-
declare interface
|
|
75
|
+
export declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo {
|
|
70
76
|
/**
|
|
71
|
-
*
|
|
77
|
+
* Instantiate a driver adapter.
|
|
72
78
|
*/
|
|
73
79
|
connect(): Promise<Queryable<Query, Result>>;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
export declare class DriverAdapterError extends Error {
|
|
77
|
-
name: string;
|
|
78
|
-
cause: Error_2;
|
|
79
|
-
constructor(payload: Error_2);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
82
|
export declare function err<T>(error: Error_2): Result<T>;
|
|
83
83
|
|
|
84
84
|
declare type Error_2 = {
|
|
@@ -87,6 +87,9 @@ declare type Error_2 = {
|
|
|
87
87
|
} | {
|
|
88
88
|
kind: 'UnsupportedNativeDataType';
|
|
89
89
|
type: string;
|
|
90
|
+
} | {
|
|
91
|
+
kind: 'InvalidIsolationLevel';
|
|
92
|
+
level: string;
|
|
90
93
|
} | {
|
|
91
94
|
kind: 'postgres';
|
|
92
95
|
code: string;
|
|
@@ -116,18 +119,14 @@ declare type ErrorCapturingInterface<T> = {
|
|
|
116
119
|
[K in keyof T]: ErrorCapturingFunction<T[K]>;
|
|
117
120
|
};
|
|
118
121
|
|
|
119
|
-
declare interface
|
|
122
|
+
export declare interface ErrorCapturingSqlDriverAdapter extends ErrorCapturingInterface<SqlDriverAdapter> {
|
|
120
123
|
readonly errorRegistry: ErrorRegistry;
|
|
121
124
|
}
|
|
122
|
-
export { ErrorCapturingSqlConnection as ErrorCapturingDriverAdapter }
|
|
123
|
-
export { ErrorCapturingSqlConnection }
|
|
124
125
|
|
|
125
126
|
export declare type ErrorCapturingSqlQueryable = ErrorCapturingInterface<SqlQueryable>;
|
|
126
127
|
|
|
127
128
|
export declare type ErrorCapturingTransaction = ErrorCapturingInterface<Transaction>;
|
|
128
129
|
|
|
129
|
-
export declare type ErrorCapturingTransactionContext = ErrorCapturingInterface<TransactionContext>;
|
|
130
|
-
|
|
131
130
|
export declare type ErrorRecord = {
|
|
132
131
|
error: unknown;
|
|
133
132
|
};
|
|
@@ -136,13 +135,15 @@ export declare interface ErrorRegistry {
|
|
|
136
135
|
consumeError(id: number): ErrorRecord | undefined;
|
|
137
136
|
}
|
|
138
137
|
|
|
138
|
+
export declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
139
|
+
|
|
139
140
|
declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
|
|
140
141
|
|
|
141
142
|
export declare function ok<T>(value: T): Result<T>;
|
|
142
143
|
|
|
143
144
|
export declare type Provider = 'mysql' | 'postgres' | 'sqlite';
|
|
144
145
|
|
|
145
|
-
declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
146
|
+
export declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
146
147
|
/**
|
|
147
148
|
* Execute a query and return its result.
|
|
148
149
|
*/
|
|
@@ -164,7 +165,7 @@ export declare type Result<T> = {
|
|
|
164
165
|
readonly error: Error_2;
|
|
165
166
|
});
|
|
166
167
|
|
|
167
|
-
declare interface
|
|
168
|
+
export declare interface SqlDriverAdapter extends SqlQueryable {
|
|
168
169
|
/**
|
|
169
170
|
* Execute multiple SQL statements separated by semicolon.
|
|
170
171
|
*/
|
|
@@ -172,7 +173,7 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
172
173
|
/**
|
|
173
174
|
* Start new transaction.
|
|
174
175
|
*/
|
|
175
|
-
|
|
176
|
+
startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
|
|
176
177
|
/**
|
|
177
178
|
* Optional method that returns extra connection info
|
|
178
179
|
*/
|
|
@@ -182,19 +183,17 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
182
183
|
*/
|
|
183
184
|
dispose(): Promise<void>;
|
|
184
185
|
}
|
|
185
|
-
export { SqlConnection as DriverAdapter }
|
|
186
|
-
export { SqlConnection }
|
|
187
186
|
|
|
188
|
-
declare interface
|
|
189
|
-
connect(): Promise<
|
|
187
|
+
export declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
|
|
188
|
+
connect(): Promise<SqlDriverAdapter>;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
/**
|
|
193
192
|
* An SQL migration adapter that is aware of the notion of a shadow database
|
|
194
193
|
* and can create a connection to it.
|
|
195
194
|
*/
|
|
196
|
-
export declare interface
|
|
197
|
-
connectToShadowDb(): Promise<
|
|
195
|
+
export declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
|
|
196
|
+
connectToShadowDb(): Promise<SqlDriverAdapter>;
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
export declare type SqlQuery = {
|
|
@@ -243,13 +242,6 @@ export declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
|
243
242
|
rollback(): Promise<void>;
|
|
244
243
|
}
|
|
245
244
|
|
|
246
|
-
export declare interface TransactionContext extends AdapterInfo, SqlQueryable {
|
|
247
|
-
/**
|
|
248
|
-
* Start new transaction.
|
|
249
|
-
*/
|
|
250
|
-
startTransaction(): Promise<Transaction>;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
245
|
export declare type TransactionOptions = {
|
|
254
246
|
usePhantomQuery: boolean;
|
|
255
247
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
19
|
|
|
22
20
|
// src/index.ts
|
|
23
21
|
var index_exports = {};
|
|
@@ -33,10 +31,10 @@ module.exports = __toCommonJS(index_exports);
|
|
|
33
31
|
|
|
34
32
|
// src/error.ts
|
|
35
33
|
var DriverAdapterError = class extends Error {
|
|
34
|
+
name = "DriverAdapterError";
|
|
35
|
+
cause;
|
|
36
36
|
constructor(payload) {
|
|
37
37
|
super(typeof payload["message"] === "string" ? payload["message"] : payload.kind);
|
|
38
|
-
__publicField(this, "name", "DriverAdapterError");
|
|
39
|
-
__publicField(this, "cause");
|
|
40
38
|
this.cause = payload;
|
|
41
39
|
}
|
|
42
40
|
};
|
|
@@ -72,9 +70,7 @@ function err(error) {
|
|
|
72
70
|
|
|
73
71
|
// src/binder.ts
|
|
74
72
|
var ErrorRegistryInternal = class {
|
|
75
|
-
|
|
76
|
-
__publicField(this, "registeredErrors", []);
|
|
77
|
-
}
|
|
73
|
+
registeredErrors = [];
|
|
78
74
|
consumeError(id) {
|
|
79
75
|
return this.registeredErrors[id];
|
|
80
76
|
}
|
|
@@ -89,7 +85,6 @@ var ErrorRegistryInternal = class {
|
|
|
89
85
|
};
|
|
90
86
|
var bindAdapter = (adapter) => {
|
|
91
87
|
const errorRegistry = new ErrorRegistryInternal();
|
|
92
|
-
const createTransactionContext = wrapAsync(errorRegistry, adapter.transactionContext.bind(adapter));
|
|
93
88
|
const boundAdapter = {
|
|
94
89
|
adapterName: adapter.adapterName,
|
|
95
90
|
errorRegistry,
|
|
@@ -98,9 +93,9 @@ var bindAdapter = (adapter) => {
|
|
|
98
93
|
executeScript: wrapAsync(errorRegistry, adapter.executeScript.bind(adapter)),
|
|
99
94
|
dispose: wrapAsync(errorRegistry, adapter.dispose.bind(adapter)),
|
|
100
95
|
provider: adapter.provider,
|
|
101
|
-
|
|
102
|
-
const ctx = await
|
|
103
|
-
return ctx.map((ctx2) =>
|
|
96
|
+
startTransaction: async (...args) => {
|
|
97
|
+
const ctx = await wrapAsync(errorRegistry, adapter.startTransaction.bind(adapter))(...args);
|
|
98
|
+
return ctx.map((ctx2) => bindTransaction(errorRegistry, ctx2));
|
|
104
99
|
}
|
|
105
100
|
};
|
|
106
101
|
if (adapter.getConnectionInfo) {
|
|
@@ -108,19 +103,6 @@ var bindAdapter = (adapter) => {
|
|
|
108
103
|
}
|
|
109
104
|
return boundAdapter;
|
|
110
105
|
};
|
|
111
|
-
var bindTransactionContext = (errorRegistry, ctx) => {
|
|
112
|
-
const startTransaction = wrapAsync(errorRegistry, ctx.startTransaction.bind(ctx));
|
|
113
|
-
return {
|
|
114
|
-
adapterName: ctx.adapterName,
|
|
115
|
-
provider: ctx.provider,
|
|
116
|
-
queryRaw: wrapAsync(errorRegistry, ctx.queryRaw.bind(ctx)),
|
|
117
|
-
executeRaw: wrapAsync(errorRegistry, ctx.executeRaw.bind(ctx)),
|
|
118
|
-
startTransaction: async (...args) => {
|
|
119
|
-
const result = await startTransaction(...args);
|
|
120
|
-
return result.map((tx) => bindTransaction(errorRegistry, tx));
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
106
|
var bindTransaction = (errorRegistry, transaction) => {
|
|
125
107
|
return {
|
|
126
108
|
adapterName: transaction.adapterName,
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
1
|
// src/error.ts
|
|
6
2
|
var DriverAdapterError = class extends Error {
|
|
3
|
+
name = "DriverAdapterError";
|
|
4
|
+
cause;
|
|
7
5
|
constructor(payload) {
|
|
8
6
|
super(typeof payload["message"] === "string" ? payload["message"] : payload.kind);
|
|
9
|
-
__publicField(this, "name", "DriverAdapterError");
|
|
10
|
-
__publicField(this, "cause");
|
|
11
7
|
this.cause = payload;
|
|
12
8
|
}
|
|
13
9
|
};
|
|
@@ -43,9 +39,7 @@ function err(error) {
|
|
|
43
39
|
|
|
44
40
|
// src/binder.ts
|
|
45
41
|
var ErrorRegistryInternal = class {
|
|
46
|
-
|
|
47
|
-
__publicField(this, "registeredErrors", []);
|
|
48
|
-
}
|
|
42
|
+
registeredErrors = [];
|
|
49
43
|
consumeError(id) {
|
|
50
44
|
return this.registeredErrors[id];
|
|
51
45
|
}
|
|
@@ -60,7 +54,6 @@ var ErrorRegistryInternal = class {
|
|
|
60
54
|
};
|
|
61
55
|
var bindAdapter = (adapter) => {
|
|
62
56
|
const errorRegistry = new ErrorRegistryInternal();
|
|
63
|
-
const createTransactionContext = wrapAsync(errorRegistry, adapter.transactionContext.bind(adapter));
|
|
64
57
|
const boundAdapter = {
|
|
65
58
|
adapterName: adapter.adapterName,
|
|
66
59
|
errorRegistry,
|
|
@@ -69,9 +62,9 @@ var bindAdapter = (adapter) => {
|
|
|
69
62
|
executeScript: wrapAsync(errorRegistry, adapter.executeScript.bind(adapter)),
|
|
70
63
|
dispose: wrapAsync(errorRegistry, adapter.dispose.bind(adapter)),
|
|
71
64
|
provider: adapter.provider,
|
|
72
|
-
|
|
73
|
-
const ctx = await
|
|
74
|
-
return ctx.map((ctx2) =>
|
|
65
|
+
startTransaction: async (...args) => {
|
|
66
|
+
const ctx = await wrapAsync(errorRegistry, adapter.startTransaction.bind(adapter))(...args);
|
|
67
|
+
return ctx.map((ctx2) => bindTransaction(errorRegistry, ctx2));
|
|
75
68
|
}
|
|
76
69
|
};
|
|
77
70
|
if (adapter.getConnectionInfo) {
|
|
@@ -79,19 +72,6 @@ var bindAdapter = (adapter) => {
|
|
|
79
72
|
}
|
|
80
73
|
return boundAdapter;
|
|
81
74
|
};
|
|
82
|
-
var bindTransactionContext = (errorRegistry, ctx) => {
|
|
83
|
-
const startTransaction = wrapAsync(errorRegistry, ctx.startTransaction.bind(ctx));
|
|
84
|
-
return {
|
|
85
|
-
adapterName: ctx.adapterName,
|
|
86
|
-
provider: ctx.provider,
|
|
87
|
-
queryRaw: wrapAsync(errorRegistry, ctx.queryRaw.bind(ctx)),
|
|
88
|
-
executeRaw: wrapAsync(errorRegistry, ctx.executeRaw.bind(ctx)),
|
|
89
|
-
startTransaction: async (...args) => {
|
|
90
|
-
const result = await startTransaction(...args);
|
|
91
|
-
return result.map((tx) => bindTransaction(errorRegistry, tx));
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
75
|
var bindTransaction = (errorRegistry, transaction) => {
|
|
96
76
|
return {
|
|
97
77
|
adapterName: transaction.adapterName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/driver-adapter-utils",
|
|
3
|
-
"version": "6.6.0-dev.
|
|
3
|
+
"version": "6.6.0-dev.52",
|
|
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": "6.6.0-dev.
|
|
34
|
+
"@prisma/debug": "6.6.0-dev.52"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "DEV=true tsx helpers/build.ts",
|