@prisma/driver-adapter-utils 6.6.0-dev.90 → 6.6.0-dev.92
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 +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +62 -0
- package/dist/index.mjs +57 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -18,6 +18,8 @@ export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' |
|
|
|
18
18
|
|
|
19
19
|
export declare const bindAdapter: (adapter: SqlDriverAdapter, errorRegistry?: ErrorRegistryInternal) => ErrorCapturingSqlDriverAdapter;
|
|
20
20
|
|
|
21
|
+
export declare const bindMigrationAwareSqlAdapterFactory: (adapterFactory: SqlMigrationAwareDriverAdapterFactory) => ErrorCapturingSqlMigrationAwareDriverAdapterFactory;
|
|
22
|
+
|
|
21
23
|
export declare const bindSqlAdapterFactory: (adapterFactory: SqlDriverAdapterFactory) => ErrorCapturingSqlDriverAdapterFactory;
|
|
22
24
|
|
|
23
25
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
@@ -129,6 +131,10 @@ export declare interface ErrorCapturingSqlDriverAdapterFactory extends ErrorCapt
|
|
|
129
131
|
readonly errorRegistry: ErrorRegistry;
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
export declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
|
|
135
|
+
readonly errorRegistry: ErrorRegistry;
|
|
136
|
+
}
|
|
137
|
+
|
|
132
138
|
export declare type ErrorCapturingSqlQueryable = ErrorCapturingInterface<SqlQueryable>;
|
|
133
139
|
|
|
134
140
|
export declare type ErrorCapturingTransaction = ErrorCapturingInterface<Transaction>;
|
|
@@ -149,6 +155,29 @@ declare class ErrorRegistryInternal implements ErrorRegistry {
|
|
|
149
155
|
|
|
150
156
|
export declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
151
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Create an adapter stub for testing.
|
|
160
|
+
*/
|
|
161
|
+
export declare function mockAdapter(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapter;
|
|
162
|
+
|
|
163
|
+
export declare const mockAdapterErrors: {
|
|
164
|
+
queryRaw: Error;
|
|
165
|
+
executeRaw: Error;
|
|
166
|
+
startTransaction: Error;
|
|
167
|
+
executeScript: Error;
|
|
168
|
+
dispose: Error;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Create an adapter factory stub for testing.
|
|
173
|
+
*/
|
|
174
|
+
export declare function mockAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapterFactory;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Create an adapter factory stub for testing.
|
|
178
|
+
*/
|
|
179
|
+
export declare function mockMigrationAwareAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlMigrationAwareDriverAdapterFactory;
|
|
180
|
+
|
|
152
181
|
declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
|
|
153
182
|
|
|
154
183
|
export declare function ok<T>(value: T): Result<T>;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' |
|
|
|
18
18
|
|
|
19
19
|
export declare const bindAdapter: (adapter: SqlDriverAdapter, errorRegistry?: ErrorRegistryInternal) => ErrorCapturingSqlDriverAdapter;
|
|
20
20
|
|
|
21
|
+
export declare const bindMigrationAwareSqlAdapterFactory: (adapterFactory: SqlMigrationAwareDriverAdapterFactory) => ErrorCapturingSqlMigrationAwareDriverAdapterFactory;
|
|
22
|
+
|
|
21
23
|
export declare const bindSqlAdapterFactory: (adapterFactory: SqlDriverAdapterFactory) => ErrorCapturingSqlDriverAdapterFactory;
|
|
22
24
|
|
|
23
25
|
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
@@ -129,6 +131,10 @@ export declare interface ErrorCapturingSqlDriverAdapterFactory extends ErrorCapt
|
|
|
129
131
|
readonly errorRegistry: ErrorRegistry;
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
export declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
|
|
135
|
+
readonly errorRegistry: ErrorRegistry;
|
|
136
|
+
}
|
|
137
|
+
|
|
132
138
|
export declare type ErrorCapturingSqlQueryable = ErrorCapturingInterface<SqlQueryable>;
|
|
133
139
|
|
|
134
140
|
export declare type ErrorCapturingTransaction = ErrorCapturingInterface<Transaction>;
|
|
@@ -149,6 +155,29 @@ declare class ErrorRegistryInternal implements ErrorRegistry {
|
|
|
149
155
|
|
|
150
156
|
export declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
151
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Create an adapter stub for testing.
|
|
160
|
+
*/
|
|
161
|
+
export declare function mockAdapter(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapter;
|
|
162
|
+
|
|
163
|
+
export declare const mockAdapterErrors: {
|
|
164
|
+
queryRaw: Error;
|
|
165
|
+
executeRaw: Error;
|
|
166
|
+
startTransaction: Error;
|
|
167
|
+
executeScript: Error;
|
|
168
|
+
dispose: Error;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Create an adapter factory stub for testing.
|
|
173
|
+
*/
|
|
174
|
+
export declare function mockAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapterFactory;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Create an adapter factory stub for testing.
|
|
178
|
+
*/
|
|
179
|
+
export declare function mockMigrationAwareAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlMigrationAwareDriverAdapterFactory;
|
|
180
|
+
|
|
152
181
|
declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
|
|
153
182
|
|
|
154
183
|
export declare function ok<T>(value: T): Result<T>;
|
package/dist/index.js
CHANGED
|
@@ -24,8 +24,13 @@ __export(index_exports, {
|
|
|
24
24
|
Debug: () => import_debug.Debug,
|
|
25
25
|
DriverAdapterError: () => DriverAdapterError,
|
|
26
26
|
bindAdapter: () => bindAdapter,
|
|
27
|
+
bindMigrationAwareSqlAdapterFactory: () => bindMigrationAwareSqlAdapterFactory,
|
|
27
28
|
bindSqlAdapterFactory: () => bindSqlAdapterFactory,
|
|
28
29
|
err: () => err,
|
|
30
|
+
mockAdapter: () => mockAdapter,
|
|
31
|
+
mockAdapterErrors: () => mockAdapterErrors,
|
|
32
|
+
mockAdapterFactory: () => mockAdapterFactory,
|
|
33
|
+
mockMigrationAwareAdapterFactory: () => mockMigrationAwareAdapterFactory,
|
|
29
34
|
ok: () => ok
|
|
30
35
|
});
|
|
31
36
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -84,6 +89,23 @@ var ErrorRegistryInternal = class {
|
|
|
84
89
|
return i;
|
|
85
90
|
}
|
|
86
91
|
};
|
|
92
|
+
var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
|
|
93
|
+
const errorRegistry = new ErrorRegistryInternal();
|
|
94
|
+
const boundFactory = {
|
|
95
|
+
adapterName: adapterFactory.adapterName,
|
|
96
|
+
provider: adapterFactory.provider,
|
|
97
|
+
errorRegistry,
|
|
98
|
+
connect: async (...args) => {
|
|
99
|
+
const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
|
|
100
|
+
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
101
|
+
},
|
|
102
|
+
connectToShadowDb: async (...args) => {
|
|
103
|
+
const ctx = await wrapAsync(errorRegistry, adapterFactory.connectToShadowDb.bind(adapterFactory))(...args);
|
|
104
|
+
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return boundFactory;
|
|
108
|
+
};
|
|
87
109
|
var bindSqlAdapterFactory = (adapterFactory) => {
|
|
88
110
|
const errorRegistry = new ErrorRegistryInternal();
|
|
89
111
|
const boundFactory = {
|
|
@@ -195,13 +217,53 @@ var ColumnTypeEnum = {
|
|
|
195
217
|
|
|
196
218
|
// src/debug.ts
|
|
197
219
|
var import_debug = require("@prisma/debug");
|
|
220
|
+
|
|
221
|
+
// src/mock.ts
|
|
222
|
+
var mockAdapterErrors = {
|
|
223
|
+
queryRaw: new Error("Not implemented: queryRaw"),
|
|
224
|
+
executeRaw: new Error("Not implemented: executeRaw"),
|
|
225
|
+
startTransaction: new Error("Not implemented: startTransaction"),
|
|
226
|
+
executeScript: new Error("Not implemented: executeScript"),
|
|
227
|
+
dispose: new Error("Not implemented: dispose")
|
|
228
|
+
};
|
|
229
|
+
function mockAdapter(provider) {
|
|
230
|
+
return {
|
|
231
|
+
provider,
|
|
232
|
+
adapterName: "@prisma/adapter-mock",
|
|
233
|
+
queryRaw: () => Promise.reject(mockAdapterErrors.queryRaw),
|
|
234
|
+
executeRaw: () => Promise.reject(mockAdapterErrors.executeRaw),
|
|
235
|
+
startTransaction: () => Promise.reject(mockAdapterErrors.startTransaction),
|
|
236
|
+
executeScript: () => Promise.reject(mockAdapterErrors.executeScript),
|
|
237
|
+
dispose: () => Promise.reject(mockAdapterErrors.dispose)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function mockAdapterFactory(provider) {
|
|
241
|
+
return {
|
|
242
|
+
provider,
|
|
243
|
+
adapterName: "@prisma/adapter-mock",
|
|
244
|
+
connect: () => Promise.resolve(mockAdapter(provider))
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function mockMigrationAwareAdapterFactory(provider) {
|
|
248
|
+
return {
|
|
249
|
+
provider,
|
|
250
|
+
adapterName: "@prisma/adapter-mock",
|
|
251
|
+
connect: () => Promise.resolve(mockAdapter(provider)),
|
|
252
|
+
connectToShadowDb: () => Promise.resolve(mockAdapter(provider))
|
|
253
|
+
};
|
|
254
|
+
}
|
|
198
255
|
// Annotate the CommonJS export names for ESM import in node:
|
|
199
256
|
0 && (module.exports = {
|
|
200
257
|
ColumnTypeEnum,
|
|
201
258
|
Debug,
|
|
202
259
|
DriverAdapterError,
|
|
203
260
|
bindAdapter,
|
|
261
|
+
bindMigrationAwareSqlAdapterFactory,
|
|
204
262
|
bindSqlAdapterFactory,
|
|
205
263
|
err,
|
|
264
|
+
mockAdapter,
|
|
265
|
+
mockAdapterErrors,
|
|
266
|
+
mockAdapterFactory,
|
|
267
|
+
mockMigrationAwareAdapterFactory,
|
|
206
268
|
ok
|
|
207
269
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -52,6 +52,23 @@ var ErrorRegistryInternal = class {
|
|
|
52
52
|
return i;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
|
|
56
|
+
const errorRegistry = new ErrorRegistryInternal();
|
|
57
|
+
const boundFactory = {
|
|
58
|
+
adapterName: adapterFactory.adapterName,
|
|
59
|
+
provider: adapterFactory.provider,
|
|
60
|
+
errorRegistry,
|
|
61
|
+
connect: async (...args) => {
|
|
62
|
+
const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
|
|
63
|
+
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
64
|
+
},
|
|
65
|
+
connectToShadowDb: async (...args) => {
|
|
66
|
+
const ctx = await wrapAsync(errorRegistry, adapterFactory.connectToShadowDb.bind(adapterFactory))(...args);
|
|
67
|
+
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return boundFactory;
|
|
71
|
+
};
|
|
55
72
|
var bindSqlAdapterFactory = (adapterFactory) => {
|
|
56
73
|
const errorRegistry = new ErrorRegistryInternal();
|
|
57
74
|
const boundFactory = {
|
|
@@ -163,12 +180,52 @@ var ColumnTypeEnum = {
|
|
|
163
180
|
|
|
164
181
|
// src/debug.ts
|
|
165
182
|
import { Debug } from "@prisma/debug";
|
|
183
|
+
|
|
184
|
+
// src/mock.ts
|
|
185
|
+
var mockAdapterErrors = {
|
|
186
|
+
queryRaw: new Error("Not implemented: queryRaw"),
|
|
187
|
+
executeRaw: new Error("Not implemented: executeRaw"),
|
|
188
|
+
startTransaction: new Error("Not implemented: startTransaction"),
|
|
189
|
+
executeScript: new Error("Not implemented: executeScript"),
|
|
190
|
+
dispose: new Error("Not implemented: dispose")
|
|
191
|
+
};
|
|
192
|
+
function mockAdapter(provider) {
|
|
193
|
+
return {
|
|
194
|
+
provider,
|
|
195
|
+
adapterName: "@prisma/adapter-mock",
|
|
196
|
+
queryRaw: () => Promise.reject(mockAdapterErrors.queryRaw),
|
|
197
|
+
executeRaw: () => Promise.reject(mockAdapterErrors.executeRaw),
|
|
198
|
+
startTransaction: () => Promise.reject(mockAdapterErrors.startTransaction),
|
|
199
|
+
executeScript: () => Promise.reject(mockAdapterErrors.executeScript),
|
|
200
|
+
dispose: () => Promise.reject(mockAdapterErrors.dispose)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function mockAdapterFactory(provider) {
|
|
204
|
+
return {
|
|
205
|
+
provider,
|
|
206
|
+
adapterName: "@prisma/adapter-mock",
|
|
207
|
+
connect: () => Promise.resolve(mockAdapter(provider))
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function mockMigrationAwareAdapterFactory(provider) {
|
|
211
|
+
return {
|
|
212
|
+
provider,
|
|
213
|
+
adapterName: "@prisma/adapter-mock",
|
|
214
|
+
connect: () => Promise.resolve(mockAdapter(provider)),
|
|
215
|
+
connectToShadowDb: () => Promise.resolve(mockAdapter(provider))
|
|
216
|
+
};
|
|
217
|
+
}
|
|
166
218
|
export {
|
|
167
219
|
ColumnTypeEnum,
|
|
168
220
|
Debug,
|
|
169
221
|
DriverAdapterError,
|
|
170
222
|
bindAdapter,
|
|
223
|
+
bindMigrationAwareSqlAdapterFactory,
|
|
171
224
|
bindSqlAdapterFactory,
|
|
172
225
|
err,
|
|
226
|
+
mockAdapter,
|
|
227
|
+
mockAdapterErrors,
|
|
228
|
+
mockAdapterFactory,
|
|
229
|
+
mockMigrationAwareAdapterFactory,
|
|
173
230
|
ok
|
|
174
231
|
};
|
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.92",
|
|
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.92"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "DEV=true tsx helpers/build.ts",
|