@prisma/config 6.6.0-dev.9 → 6.6.0-dev.91
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.ts +106 -33
- package/dist/index.js +937 -917
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -80,8 +80,70 @@ export declare function defaultTestConfig<Env extends Record<string, string | un
|
|
|
80
80
|
*/
|
|
81
81
|
export declare function defineConfig<Env extends Record<string, string | undefined> = never>(configInput: PrismaConfig<Env>): PrismaConfigInternal<Env>;
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* A generic driver adapter factory that allows the user to instantiate a
|
|
85
|
+
* driver adapter. The query and result types are specific to the adapter.
|
|
86
|
+
*/
|
|
87
|
+
declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo {
|
|
88
|
+
/**
|
|
89
|
+
* Instantiate a driver adapter.
|
|
90
|
+
*/
|
|
91
|
+
connect(): Promise<Queryable<Query, Result>>;
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
declare type EnvVars = Record<string, string | undefined>;
|
|
84
95
|
|
|
96
|
+
declare type Error_2 = {
|
|
97
|
+
kind: 'GenericJs';
|
|
98
|
+
id: number;
|
|
99
|
+
} | {
|
|
100
|
+
kind: 'UnsupportedNativeDataType';
|
|
101
|
+
type: string;
|
|
102
|
+
} | {
|
|
103
|
+
kind: 'InvalidIsolationLevel';
|
|
104
|
+
level: string;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'postgres';
|
|
107
|
+
code: string;
|
|
108
|
+
severity: string;
|
|
109
|
+
message: string;
|
|
110
|
+
detail: string | undefined;
|
|
111
|
+
column: string | undefined;
|
|
112
|
+
hint: string | undefined;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'mysql';
|
|
115
|
+
code: number;
|
|
116
|
+
message: string;
|
|
117
|
+
state: string;
|
|
118
|
+
} | {
|
|
119
|
+
kind: 'sqlite';
|
|
120
|
+
/**
|
|
121
|
+
* Sqlite extended error code: https://www.sqlite.org/rescode.html
|
|
122
|
+
*/
|
|
123
|
+
extendedCode: number;
|
|
124
|
+
message: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
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;
|
|
128
|
+
|
|
129
|
+
declare type ErrorCapturingInterface<T> = {
|
|
130
|
+
[K in keyof T]: ErrorCapturingFunction<T[K]>;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
|
|
134
|
+
readonly errorRegistry: ErrorRegistry;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare type ErrorRecord = {
|
|
138
|
+
error: unknown;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
declare interface ErrorRegistry {
|
|
142
|
+
consumeError(id: number): ErrorRecord | undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
146
|
+
|
|
85
147
|
/**
|
|
86
148
|
* Load a Prisma config file from the given directory.
|
|
87
149
|
* This function may fail, but it will never throw.
|
|
@@ -127,13 +189,17 @@ export declare type PrismaConfig<Env extends EnvVars = never> = {
|
|
|
127
189
|
*/
|
|
128
190
|
earlyAccess: true;
|
|
129
191
|
/**
|
|
130
|
-
* The
|
|
192
|
+
* The path to the schema file or path to a folder that shall be recursively searched for .prisma files.
|
|
131
193
|
*/
|
|
132
|
-
schema?:
|
|
194
|
+
schema?: string;
|
|
133
195
|
/**
|
|
134
196
|
* The configuration for Prisma Studio.
|
|
135
197
|
*/
|
|
136
198
|
studio?: PrismaStudioConfigShape<Env>;
|
|
199
|
+
/**
|
|
200
|
+
* The configuration for Prisma Migrate + Introspect
|
|
201
|
+
*/
|
|
202
|
+
migrate?: PrismaMigrateConfigShape<Env>;
|
|
137
203
|
};
|
|
138
204
|
|
|
139
205
|
/**
|
|
@@ -151,13 +217,17 @@ declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
|
|
|
151
217
|
*/
|
|
152
218
|
earlyAccess: true;
|
|
153
219
|
/**
|
|
154
|
-
* The
|
|
220
|
+
* The path to the schema file or path to a folder that shall be recursively searched for .prisma files.
|
|
155
221
|
*/
|
|
156
|
-
schema?:
|
|
222
|
+
schema?: string;
|
|
157
223
|
/**
|
|
158
224
|
* The configuration for Prisma Studio.
|
|
159
225
|
*/
|
|
160
226
|
studio?: PrismaStudioConfigShape<Env>;
|
|
227
|
+
/**
|
|
228
|
+
* The configuration for Prisma Migrate + Introspect
|
|
229
|
+
*/
|
|
230
|
+
migrate?: PrismaMigrateConfigInternalShape<Env>;
|
|
161
231
|
/**
|
|
162
232
|
* The path from where the config was loaded.
|
|
163
233
|
* It's set to `null` if no config file was found and only default config is applied.
|
|
@@ -165,29 +235,16 @@ declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
|
|
|
165
235
|
loadedFromFile: string | null;
|
|
166
236
|
};
|
|
167
237
|
|
|
168
|
-
declare type
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
* The path to a single `.prisma` schema file.
|
|
175
|
-
*/
|
|
176
|
-
filePath: string;
|
|
177
|
-
} | {
|
|
178
|
-
/**
|
|
179
|
-
* Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
|
|
180
|
-
*/
|
|
181
|
-
kind: 'multi';
|
|
182
|
-
/**
|
|
183
|
-
* The path to a folder containing multiple `.prisma` schema files.
|
|
184
|
-
* All of the files in this folder will be used.
|
|
185
|
-
*/
|
|
186
|
-
folderPath: string;
|
|
238
|
+
declare type PrismaMigrateConfigInternalShape<Env extends EnvVars = never> = {
|
|
239
|
+
adapter: (env: Env) => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
declare type PrismaMigrateConfigShape<Env extends EnvVars = never> = {
|
|
243
|
+
adapter: (env: Env) => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
187
244
|
};
|
|
188
245
|
|
|
189
246
|
declare type PrismaStudioConfigShape<Env extends EnvVars = never> = {
|
|
190
|
-
adapter: (env: Env) => Promise<
|
|
247
|
+
adapter: (env: Env) => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
191
248
|
};
|
|
192
249
|
|
|
193
250
|
declare type Provider = 'mysql' | 'postgres' | 'sqlite';
|
|
@@ -203,7 +260,18 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
|
203
260
|
executeRaw(params: Query): Promise<number>;
|
|
204
261
|
}
|
|
205
262
|
|
|
206
|
-
declare
|
|
263
|
+
declare type Result<T> = {
|
|
264
|
+
map<U>(fn: (value: T) => U): Result<U>;
|
|
265
|
+
flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
|
|
266
|
+
} & ({
|
|
267
|
+
readonly ok: true;
|
|
268
|
+
readonly value: T;
|
|
269
|
+
} | {
|
|
270
|
+
readonly ok: false;
|
|
271
|
+
readonly error: Error_2;
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
declare interface SqlDriverAdapter extends SqlQueryable {
|
|
207
275
|
/**
|
|
208
276
|
* Execute multiple SQL statements separated by semicolon.
|
|
209
277
|
*/
|
|
@@ -211,7 +279,7 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
211
279
|
/**
|
|
212
280
|
* Start new transaction.
|
|
213
281
|
*/
|
|
214
|
-
|
|
282
|
+
startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
|
|
215
283
|
/**
|
|
216
284
|
* Optional method that returns extra connection info
|
|
217
285
|
*/
|
|
@@ -222,6 +290,18 @@ declare interface SqlConnection extends SqlQueryable {
|
|
|
222
290
|
dispose(): Promise<void>;
|
|
223
291
|
}
|
|
224
292
|
|
|
293
|
+
declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
|
|
294
|
+
connect(): Promise<SqlDriverAdapter>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* An SQL migration adapter that is aware of the notion of a shadow database
|
|
299
|
+
* and can create a connection to it.
|
|
300
|
+
*/
|
|
301
|
+
declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
|
|
302
|
+
connectToShadowDb(): Promise<SqlDriverAdapter>;
|
|
303
|
+
}
|
|
304
|
+
|
|
225
305
|
declare type SqlQuery = {
|
|
226
306
|
sql: string;
|
|
227
307
|
args: Array<unknown>;
|
|
@@ -268,13 +348,6 @@ declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
|
268
348
|
rollback(): Promise<void>;
|
|
269
349
|
}
|
|
270
350
|
|
|
271
|
-
declare interface TransactionContext extends AdapterInfo, SqlQueryable {
|
|
272
|
-
/**
|
|
273
|
-
* Start new transaction.
|
|
274
|
-
*/
|
|
275
|
-
startTransaction(): Promise<Transaction>;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
351
|
declare type TransactionOptions = {
|
|
279
352
|
usePhantomQuery: boolean;
|
|
280
353
|
};
|