@prisma-lossless/driver-adapter-utils 7.8.0-lossless.11

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.
@@ -0,0 +1,403 @@
1
+ import { Debug } from '@prisma-lossless/debug';
2
+
3
+ /**
4
+ * An interface that exposes some basic information about the
5
+ * adapter like its name and provider type.
6
+ */
7
+ declare interface AdapterInfo {
8
+ readonly provider: Provider;
9
+ readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {});
10
+ }
11
+
12
+ export declare type ArgScalarType = 'string' | 'int' | 'bigint' | 'float' | 'decimal' | 'boolean' | 'enum' | 'uuid' | 'json' | 'datetime' | 'bytes' | 'unknown';
13
+
14
+ export declare type ArgType = {
15
+ scalarType: ArgScalarType;
16
+ dbType?: string;
17
+ arity: Arity;
18
+ };
19
+
20
+ export declare type Arity = 'scalar' | 'list';
21
+
22
+ export declare const bindAdapter: (adapter: SqlDriverAdapter, errorRegistry?: ErrorRegistryInternal) => ErrorCapturingSqlDriverAdapter;
23
+
24
+ export declare const bindMigrationAwareSqlAdapterFactory: (adapterFactory: SqlMigrationAwareDriverAdapterFactory) => ErrorCapturingSqlMigrationAwareDriverAdapterFactory;
25
+
26
+ export declare const bindSqlAdapterFactory: (adapterFactory: SqlDriverAdapterFactory) => ErrorCapturingSqlDriverAdapterFactory;
27
+
28
+ export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
29
+
30
+ export declare const ColumnTypeEnum: {
31
+ readonly Int32: 0;
32
+ readonly Int64: 1;
33
+ readonly Float: 2;
34
+ readonly Double: 3;
35
+ readonly Numeric: 4;
36
+ readonly Boolean: 5;
37
+ readonly Character: 6;
38
+ readonly Text: 7;
39
+ readonly Date: 8;
40
+ readonly Time: 9;
41
+ readonly DateTime: 10;
42
+ readonly Json: 11;
43
+ readonly Enum: 12;
44
+ readonly Bytes: 13;
45
+ readonly Set: 14;
46
+ readonly Uuid: 15;
47
+ readonly Int32Array: 64;
48
+ readonly Int64Array: 65;
49
+ readonly FloatArray: 66;
50
+ readonly DoubleArray: 67;
51
+ readonly NumericArray: 68;
52
+ readonly BooleanArray: 69;
53
+ readonly CharacterArray: 70;
54
+ readonly TextArray: 71;
55
+ readonly DateArray: 72;
56
+ readonly TimeArray: 73;
57
+ readonly DateTimeArray: 74;
58
+ readonly JsonArray: 75;
59
+ readonly EnumArray: 76;
60
+ readonly BytesArray: 77;
61
+ readonly UuidArray: 78;
62
+ readonly UnknownNumber: 128;
63
+ };
64
+
65
+ export declare type ConnectionInfo = {
66
+ schemaName?: string;
67
+ maxBindValues?: number;
68
+ supportsRelationJoins: boolean;
69
+ };
70
+
71
+ export { Debug }
72
+
73
+ export declare class DriverAdapterError extends Error {
74
+ name: string;
75
+ cause: Error_2;
76
+ constructor(payload: Error_2);
77
+ }
78
+
79
+ /**
80
+ * A generic driver adapter factory that allows the user to instantiate a
81
+ * driver adapter. The query and result types are specific to the adapter.
82
+ */
83
+ export declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo {
84
+ /**
85
+ * Instantiate a driver adapter.
86
+ */
87
+ connect(): Promise<Queryable<Query, Result>>;
88
+ }
89
+
90
+ export declare function err<T>(error: Error_2): Result<T>;
91
+
92
+ declare type Error_2 = MappedError & {
93
+ originalCode?: string;
94
+ originalMessage?: string;
95
+ };
96
+ export { Error_2 as Error }
97
+
98
+ declare type ErrorCapturingFunction<T> = T extends (...args: infer A) => Promise<infer R> ? (...args: A) => Promise<Result<ErrorCapturingInterface<R>>> : T extends (...args: infer A) => infer R ? (...args: A) => Result<ErrorCapturingInterface<R>> : T;
99
+
100
+ declare type ErrorCapturingInterface<T> = {
101
+ [K in keyof T]: ErrorCapturingFunction<T[K]>;
102
+ };
103
+
104
+ export declare interface ErrorCapturingSqlDriverAdapter extends ErrorCapturingInterface<SqlDriverAdapter> {
105
+ readonly errorRegistry: ErrorRegistry;
106
+ }
107
+
108
+ export declare interface ErrorCapturingSqlDriverAdapterFactory extends ErrorCapturingInterface<SqlDriverAdapterFactory> {
109
+ readonly errorRegistry: ErrorRegistry;
110
+ }
111
+
112
+ export declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
113
+ readonly errorRegistry: ErrorRegistry;
114
+ }
115
+
116
+ export declare type ErrorCapturingSqlQueryable = ErrorCapturingInterface<SqlQueryable>;
117
+
118
+ export declare type ErrorCapturingTransaction = ErrorCapturingInterface<Transaction>;
119
+
120
+ export declare type ErrorRecord = {
121
+ error: unknown;
122
+ };
123
+
124
+ export declare interface ErrorRegistry {
125
+ consumeError(id: number): ErrorRecord | undefined;
126
+ }
127
+
128
+ declare class ErrorRegistryInternal implements ErrorRegistry {
129
+ private registeredErrors;
130
+ consumeError(id: number): ErrorRecord | undefined;
131
+ registerNewError(error: unknown): number;
132
+ }
133
+
134
+ export declare function isDriverAdapterError(error: any): error is DriverAdapterError;
135
+
136
+ export declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
137
+
138
+ export declare type MappedError = {
139
+ kind: 'GenericJs';
140
+ id: number;
141
+ } | {
142
+ kind: 'UnsupportedNativeDataType';
143
+ type: string;
144
+ } | {
145
+ kind: 'InvalidIsolationLevel';
146
+ level: string;
147
+ } | {
148
+ kind: 'LengthMismatch';
149
+ column?: string;
150
+ } | {
151
+ kind: 'UniqueConstraintViolation';
152
+ constraint?: {
153
+ fields: string[];
154
+ } | {
155
+ index: string;
156
+ } | {
157
+ foreignKey: {};
158
+ };
159
+ } | {
160
+ kind: 'NullConstraintViolation';
161
+ constraint?: {
162
+ fields: string[];
163
+ } | {
164
+ index: string;
165
+ } | {
166
+ foreignKey: {};
167
+ };
168
+ } | {
169
+ kind: 'ForeignKeyConstraintViolation';
170
+ constraint?: {
171
+ fields: string[];
172
+ } | {
173
+ index: string;
174
+ } | {
175
+ foreignKey: {};
176
+ };
177
+ } | {
178
+ kind: 'DatabaseNotReachable';
179
+ host?: string;
180
+ port?: number;
181
+ } | {
182
+ kind: 'DatabaseDoesNotExist';
183
+ db?: string;
184
+ } | {
185
+ kind: 'DatabaseAlreadyExists';
186
+ db?: string;
187
+ } | {
188
+ kind: 'DatabaseAccessDenied';
189
+ db?: string;
190
+ } | {
191
+ kind: 'ConnectionClosed';
192
+ } | {
193
+ kind: 'TlsConnectionError';
194
+ reason: string;
195
+ } | {
196
+ kind: 'AuthenticationFailed';
197
+ user?: string;
198
+ } | {
199
+ kind: 'TransactionWriteConflict';
200
+ } | {
201
+ kind: 'TableDoesNotExist';
202
+ table?: string;
203
+ } | {
204
+ kind: 'ColumnNotFound';
205
+ column?: string;
206
+ } | {
207
+ kind: 'TooManyConnections';
208
+ cause: string;
209
+ } | {
210
+ kind: 'ValueOutOfRange';
211
+ cause: string;
212
+ } | {
213
+ kind: 'InvalidInputValue';
214
+ message: string;
215
+ } | {
216
+ kind: 'MissingFullTextSearchIndex';
217
+ } | {
218
+ kind: 'SocketTimeout';
219
+ } | {
220
+ kind: 'InconsistentColumnData';
221
+ cause: string;
222
+ } | {
223
+ kind: 'TransactionAlreadyClosed';
224
+ cause: string;
225
+ } | {
226
+ kind: 'postgres';
227
+ code: string;
228
+ severity: string;
229
+ message: string;
230
+ detail: string | undefined;
231
+ column: string | undefined;
232
+ hint: string | undefined;
233
+ } | {
234
+ kind: 'mysql';
235
+ code: number;
236
+ message: string;
237
+ state: string;
238
+ cause?: string;
239
+ } | {
240
+ kind: 'sqlite';
241
+ /**
242
+ * Sqlite extended error code: https://www.sqlite.org/rescode.html
243
+ */
244
+ extendedCode: number;
245
+ message: string;
246
+ } | {
247
+ kind: 'mssql';
248
+ code: number;
249
+ message: string;
250
+ };
251
+
252
+ /**
253
+ * Create an adapter stub for testing.
254
+ */
255
+ export declare function mockAdapter(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapter;
256
+
257
+ export declare const mockAdapterErrors: {
258
+ queryRaw: Error;
259
+ executeRaw: Error;
260
+ startTransaction: Error;
261
+ executeScript: Error;
262
+ dispose: Error;
263
+ };
264
+
265
+ /**
266
+ * Create an adapter factory stub for testing.
267
+ */
268
+ export declare function mockAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlDriverAdapterFactory;
269
+
270
+ /**
271
+ * Create an adapter factory stub for testing.
272
+ */
273
+ export declare function mockMigrationAwareAdapterFactory(provider: 'mysql' | 'sqlite' | 'postgres'): SqlMigrationAwareDriverAdapterFactory;
274
+
275
+ export declare type OfficialDriverAdapterName = (typeof officialPrismaAdapters)[number];
276
+
277
+ declare const officialPrismaAdapters: readonly ["@prisma-lossless/adapter-planetscale", "@prisma-lossless/adapter-neon", "@prisma-lossless/adapter-libsql", "@prisma-lossless/adapter-better-sqlite3", "@prisma-lossless/adapter-d1", "@prisma-lossless/adapter-pg", "@prisma-lossless/adapter-pg", "@prisma-lossless/adapter-mssql", "@prisma-lossless/adapter-mariadb"];
278
+
279
+ export declare function ok<T>(value: T): Result<T>;
280
+
281
+ export declare type Provider = 'mysql' | 'postgres' | 'sqlite' | 'sqlserver';
282
+
283
+ export declare interface Queryable<Query, Result> extends AdapterInfo {
284
+ /**
285
+ * Execute a query and return its result.
286
+ */
287
+ queryRaw(params: Query): Promise<Result>;
288
+ /**
289
+ * Execute a query and return the number of affected rows.
290
+ */
291
+ executeRaw(params: Query): Promise<number>;
292
+ }
293
+
294
+ export declare type Result<T> = {
295
+ map<U>(fn: (value: T) => U): Result<U>;
296
+ flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
297
+ } & ({
298
+ readonly ok: true;
299
+ readonly value: T;
300
+ } | {
301
+ readonly ok: false;
302
+ readonly error: Error_2;
303
+ });
304
+
305
+ /**
306
+ * Represents a value that can be returned for a column from `queryRaw`.
307
+ */
308
+ export declare type ResultValue = number | string | boolean | null | ResultValue[] | Uint8Array;
309
+
310
+ export declare interface SqlDriverAdapter extends SqlQueryable {
311
+ /**
312
+ * Execute multiple SQL statements separated by semicolon.
313
+ */
314
+ executeScript(script: string): Promise<void>;
315
+ /**
316
+ * Start new transaction.
317
+ */
318
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
319
+ /**
320
+ * Optional method that returns extra connection info
321
+ */
322
+ getConnectionInfo?(): ConnectionInfo;
323
+ /**
324
+ * Dispose of the connection and release any resources.
325
+ */
326
+ dispose(): Promise<void>;
327
+ }
328
+
329
+ export declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
330
+ connect(): Promise<SqlDriverAdapter>;
331
+ }
332
+
333
+ /**
334
+ * An SQL migration adapter that is aware of the notion of a shadow database
335
+ * and can create a connection to it.
336
+ */
337
+ export declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
338
+ connectToShadowDb(): Promise<SqlDriverAdapter>;
339
+ }
340
+
341
+ export declare type SqlQuery = {
342
+ sql: string;
343
+ args: Array<unknown>;
344
+ argTypes: Array<ArgType>;
345
+ };
346
+
347
+ export declare interface SqlQueryable extends Queryable<SqlQuery, SqlResultSet> {
348
+ }
349
+
350
+ export declare interface SqlResultSet {
351
+ /**
352
+ * List of column types appearing in a database query, in the same order as `columnNames`.
353
+ * They are used within the Query Engine to convert values from JS to Quaint values.
354
+ */
355
+ columnTypes: Array<ColumnType>;
356
+ /**
357
+ * List of column names appearing in a database query, in the same order as `columnTypes`.
358
+ */
359
+ columnNames: Array<string>;
360
+ /**
361
+ * List of rows retrieved from a database query.
362
+ * Each row is a list of values, whose length matches `columnNames` and `columnTypes`.
363
+ */
364
+ rows: Array<Array<unknown>>;
365
+ /**
366
+ * The last ID of an `INSERT` statement, if any.
367
+ * This is required for `AUTO_INCREMENT` columns in databases based on MySQL and SQLite.
368
+ */
369
+ lastInsertId?: string;
370
+ }
371
+
372
+ export declare interface Transaction extends AdapterInfo, SqlQueryable {
373
+ /**
374
+ * Transaction options.
375
+ */
376
+ readonly options: TransactionOptions;
377
+ /**
378
+ * Commit the transaction.
379
+ */
380
+ commit(): Promise<void>;
381
+ /**
382
+ * Roll back the transaction.
383
+ */
384
+ rollback(): Promise<void>;
385
+ /**
386
+ * Creates a savepoint within the currently running transaction.
387
+ */
388
+ createSavepoint?(name: string): Promise<void>;
389
+ /**
390
+ * Rolls back transaction state to a previously created savepoint.
391
+ */
392
+ rollbackToSavepoint?(name: string): Promise<void>;
393
+ /**
394
+ * Releases a previously created savepoint. Optional because not every connector supports this operation.
395
+ */
396
+ releaseSavepoint?(name: string): Promise<void>;
397
+ }
398
+
399
+ export declare type TransactionOptions = {
400
+ usePhantomQuery: boolean;
401
+ };
402
+
403
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ColumnTypeEnum: () => ColumnTypeEnum,
24
+ Debug: () => import_debug.Debug,
25
+ DriverAdapterError: () => DriverAdapterError,
26
+ bindAdapter: () => bindAdapter,
27
+ bindMigrationAwareSqlAdapterFactory: () => bindMigrationAwareSqlAdapterFactory,
28
+ bindSqlAdapterFactory: () => bindSqlAdapterFactory,
29
+ err: () => err,
30
+ isDriverAdapterError: () => isDriverAdapterError,
31
+ mockAdapter: () => mockAdapter,
32
+ mockAdapterErrors: () => mockAdapterErrors,
33
+ mockAdapterFactory: () => mockAdapterFactory,
34
+ mockMigrationAwareAdapterFactory: () => mockMigrationAwareAdapterFactory,
35
+ ok: () => ok
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+
39
+ // src/debug.ts
40
+ var import_debug = require("@prisma-lossless/debug");
41
+
42
+ // src/error.ts
43
+ var DriverAdapterError = class extends Error {
44
+ name = "DriverAdapterError";
45
+ cause;
46
+ constructor(payload) {
47
+ super(typeof payload["message"] === "string" ? payload["message"] : payload.kind);
48
+ this.cause = payload;
49
+ }
50
+ };
51
+ function isDriverAdapterError(error) {
52
+ return error["name"] === "DriverAdapterError" && typeof error["cause"] === "object";
53
+ }
54
+
55
+ // src/result.ts
56
+ function ok(value) {
57
+ return {
58
+ ok: true,
59
+ value,
60
+ map(fn) {
61
+ return ok(fn(value));
62
+ },
63
+ flatMap(fn) {
64
+ return fn(value);
65
+ }
66
+ };
67
+ }
68
+ function err(error) {
69
+ return {
70
+ ok: false,
71
+ error,
72
+ map() {
73
+ return err(error);
74
+ },
75
+ flatMap() {
76
+ return err(error);
77
+ }
78
+ };
79
+ }
80
+
81
+ // src/binder.ts
82
+ var debug = (0, import_debug.Debug)("driver-adapter-utils");
83
+ var ErrorRegistryInternal = class {
84
+ registeredErrors = [];
85
+ consumeError(id) {
86
+ return this.registeredErrors[id];
87
+ }
88
+ registerNewError(error) {
89
+ let i = 0;
90
+ while (this.registeredErrors[i] !== void 0) {
91
+ i++;
92
+ }
93
+ this.registeredErrors[i] = { error };
94
+ return i;
95
+ }
96
+ };
97
+ function copySymbolsFromSource(source, target) {
98
+ const symbols = Object.getOwnPropertySymbols(source);
99
+ const symbolObject = Object.fromEntries(symbols.map((symbol) => [symbol, true]));
100
+ Object.assign(target, symbolObject);
101
+ }
102
+ var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
103
+ const errorRegistry = new ErrorRegistryInternal();
104
+ const boundFactory = {
105
+ adapterName: adapterFactory.adapterName,
106
+ provider: adapterFactory.provider,
107
+ errorRegistry,
108
+ connect: async (...args) => {
109
+ const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
110
+ return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
111
+ },
112
+ connectToShadowDb: async (...args) => {
113
+ const ctx = await wrapAsync(errorRegistry, adapterFactory.connectToShadowDb.bind(adapterFactory))(...args);
114
+ return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
115
+ }
116
+ };
117
+ copySymbolsFromSource(adapterFactory, boundFactory);
118
+ return boundFactory;
119
+ };
120
+ var bindSqlAdapterFactory = (adapterFactory) => {
121
+ const errorRegistry = new ErrorRegistryInternal();
122
+ const boundFactory = {
123
+ adapterName: adapterFactory.adapterName,
124
+ provider: adapterFactory.provider,
125
+ errorRegistry,
126
+ connect: async (...args) => {
127
+ const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
128
+ return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
129
+ }
130
+ };
131
+ copySymbolsFromSource(adapterFactory, boundFactory);
132
+ return boundFactory;
133
+ };
134
+ var bindAdapter = (adapter, errorRegistry = new ErrorRegistryInternal()) => {
135
+ const boundAdapter = {
136
+ adapterName: adapter.adapterName,
137
+ errorRegistry,
138
+ queryRaw: wrapAsync(errorRegistry, adapter.queryRaw.bind(adapter)),
139
+ executeRaw: wrapAsync(errorRegistry, adapter.executeRaw.bind(adapter)),
140
+ executeScript: wrapAsync(errorRegistry, adapter.executeScript.bind(adapter)),
141
+ dispose: wrapAsync(errorRegistry, adapter.dispose.bind(adapter)),
142
+ provider: adapter.provider,
143
+ startTransaction: async (...args) => {
144
+ const ctx = await wrapAsync(errorRegistry, adapter.startTransaction.bind(adapter))(...args);
145
+ return ctx.map((ctx2) => bindTransaction(errorRegistry, ctx2));
146
+ }
147
+ };
148
+ if (adapter.getConnectionInfo) {
149
+ boundAdapter.getConnectionInfo = wrapSync(errorRegistry, adapter.getConnectionInfo.bind(adapter));
150
+ }
151
+ return boundAdapter;
152
+ };
153
+ var bindTransaction = (errorRegistry, transaction) => {
154
+ const boundTransaction = {
155
+ adapterName: transaction.adapterName,
156
+ provider: transaction.provider,
157
+ options: transaction.options,
158
+ queryRaw: wrapAsync(errorRegistry, transaction.queryRaw.bind(transaction)),
159
+ executeRaw: wrapAsync(errorRegistry, transaction.executeRaw.bind(transaction)),
160
+ commit: wrapAsync(errorRegistry, transaction.commit.bind(transaction)),
161
+ rollback: wrapAsync(errorRegistry, transaction.rollback.bind(transaction))
162
+ };
163
+ if (transaction.createSavepoint) {
164
+ boundTransaction.createSavepoint = wrapAsync(errorRegistry, transaction.createSavepoint.bind(transaction));
165
+ }
166
+ if (transaction.rollbackToSavepoint) {
167
+ boundTransaction.rollbackToSavepoint = wrapAsync(errorRegistry, transaction.rollbackToSavepoint.bind(transaction));
168
+ }
169
+ if (transaction.releaseSavepoint) {
170
+ boundTransaction.releaseSavepoint = wrapAsync(errorRegistry, transaction.releaseSavepoint.bind(transaction));
171
+ }
172
+ return boundTransaction;
173
+ };
174
+ function wrapAsync(registry, fn) {
175
+ return async (...args) => {
176
+ try {
177
+ return ok(await fn(...args));
178
+ } catch (error) {
179
+ debug("[error@wrapAsync]", error);
180
+ if (isDriverAdapterError(error)) {
181
+ return err(error.cause);
182
+ }
183
+ const id = registry.registerNewError(error);
184
+ return err({ kind: "GenericJs", id });
185
+ }
186
+ };
187
+ }
188
+ function wrapSync(registry, fn) {
189
+ return (...args) => {
190
+ try {
191
+ return ok(fn(...args));
192
+ } catch (error) {
193
+ debug("[error@wrapSync]", error);
194
+ if (isDriverAdapterError(error)) {
195
+ return err(error.cause);
196
+ }
197
+ const id = registry.registerNewError(error);
198
+ return err({ kind: "GenericJs", id });
199
+ }
200
+ };
201
+ }
202
+
203
+ // src/const.ts
204
+ var ColumnTypeEnum = {
205
+ // Scalars
206
+ Int32: 0,
207
+ Int64: 1,
208
+ Float: 2,
209
+ Double: 3,
210
+ Numeric: 4,
211
+ Boolean: 5,
212
+ Character: 6,
213
+ Text: 7,
214
+ Date: 8,
215
+ Time: 9,
216
+ DateTime: 10,
217
+ Json: 11,
218
+ Enum: 12,
219
+ Bytes: 13,
220
+ Set: 14,
221
+ Uuid: 15,
222
+ // Arrays
223
+ Int32Array: 64,
224
+ Int64Array: 65,
225
+ FloatArray: 66,
226
+ DoubleArray: 67,
227
+ NumericArray: 68,
228
+ BooleanArray: 69,
229
+ CharacterArray: 70,
230
+ TextArray: 71,
231
+ DateArray: 72,
232
+ TimeArray: 73,
233
+ DateTimeArray: 74,
234
+ JsonArray: 75,
235
+ EnumArray: 76,
236
+ BytesArray: 77,
237
+ UuidArray: 78,
238
+ // Custom
239
+ UnknownNumber: 128
240
+ };
241
+
242
+ // src/mock.ts
243
+ var mockAdapterErrors = {
244
+ queryRaw: new Error("Not implemented: queryRaw"),
245
+ executeRaw: new Error("Not implemented: executeRaw"),
246
+ startTransaction: new Error("Not implemented: startTransaction"),
247
+ executeScript: new Error("Not implemented: executeScript"),
248
+ dispose: new Error("Not implemented: dispose")
249
+ };
250
+ function mockAdapter(provider) {
251
+ return {
252
+ provider,
253
+ adapterName: "@prisma/adapter-mock",
254
+ queryRaw: () => Promise.reject(mockAdapterErrors.queryRaw),
255
+ executeRaw: () => Promise.reject(mockAdapterErrors.executeRaw),
256
+ startTransaction: () => Promise.reject(mockAdapterErrors.startTransaction),
257
+ executeScript: () => Promise.reject(mockAdapterErrors.executeScript),
258
+ dispose: () => Promise.reject(mockAdapterErrors.dispose),
259
+ [Symbol.for("adapter.mockAdapter")]: true
260
+ };
261
+ }
262
+ function mockAdapterFactory(provider) {
263
+ return {
264
+ provider,
265
+ adapterName: "@prisma/adapter-mock",
266
+ connect: () => Promise.resolve(mockAdapter(provider)),
267
+ [Symbol.for("adapter.mockAdapterFactory")]: true
268
+ };
269
+ }
270
+ function mockMigrationAwareAdapterFactory(provider) {
271
+ return {
272
+ provider,
273
+ adapterName: "@prisma/adapter-mock",
274
+ connect: () => Promise.resolve(mockAdapter(provider)),
275
+ connectToShadowDb: () => Promise.resolve(mockAdapter(provider)),
276
+ [Symbol.for("adapter.mockMigrationAwareAdapterFactory")]: true
277
+ };
278
+ }
279
+ // Annotate the CommonJS export names for ESM import in node:
280
+ 0 && (module.exports = {
281
+ ColumnTypeEnum,
282
+ Debug,
283
+ DriverAdapterError,
284
+ bindAdapter,
285
+ bindMigrationAwareSqlAdapterFactory,
286
+ bindSqlAdapterFactory,
287
+ err,
288
+ isDriverAdapterError,
289
+ mockAdapter,
290
+ mockAdapterErrors,
291
+ mockAdapterFactory,
292
+ mockMigrationAwareAdapterFactory,
293
+ ok
294
+ });