@prisma/config 6.6.0-dev.8 → 6.6.0-dev.80

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +42 -33
  2. package/dist/index.js +753 -866
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -80,8 +80,21 @@ 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 IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
97
+
85
98
  /**
86
99
  * Load a Prisma config file from the given directory.
87
100
  * This function may fail, but it will never throw.
@@ -127,13 +140,17 @@ export declare type PrismaConfig<Env extends EnvVars = never> = {
127
140
  */
128
141
  earlyAccess: true;
129
142
  /**
130
- * The configuration for the Prisma schema file(s).
143
+ * The path to the schema file or path to a folder that shall be recursively searched for .prisma files.
131
144
  */
132
- schema?: PrismaSchemaConfigShape;
145
+ schema?: string;
133
146
  /**
134
147
  * The configuration for Prisma Studio.
135
148
  */
136
149
  studio?: PrismaStudioConfigShape<Env>;
150
+ /**
151
+ * The configuration for Prisma Migrate + Introspect
152
+ */
153
+ migrate?: PrismaMigrateConfigShape<Env>;
137
154
  };
138
155
 
139
156
  /**
@@ -151,13 +168,17 @@ declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
151
168
  */
152
169
  earlyAccess: true;
153
170
  /**
154
- * The configuration for the Prisma schema file(s).
171
+ * The path to the schema file or path to a folder that shall be recursively searched for .prisma files.
155
172
  */
156
- schema?: PrismaSchemaConfigShape;
173
+ schema?: string;
157
174
  /**
158
175
  * The configuration for Prisma Studio.
159
176
  */
160
177
  studio?: PrismaStudioConfigShape<Env>;
178
+ /**
179
+ * The configuration for Prisma Migrate + Introspect
180
+ */
181
+ migrate?: PrismaMigrateConfigShape<Env>;
161
182
  /**
162
183
  * The path from where the config was loaded.
163
184
  * It's set to `null` if no config file was found and only default config is applied.
@@ -165,29 +186,12 @@ declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
165
186
  loadedFromFile: string | null;
166
187
  };
167
188
 
168
- declare type PrismaSchemaConfigShape = {
169
- /**
170
- * Tell Prisma to use a single `.prisma` schema file.
171
- */
172
- kind: 'single';
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;
189
+ declare type PrismaMigrateConfigShape<Env extends EnvVars = never> = {
190
+ adapter: (env: Env) => Promise<SqlMigrationAwareDriverAdapterFactory>;
187
191
  };
188
192
 
189
193
  declare type PrismaStudioConfigShape<Env extends EnvVars = never> = {
190
- adapter: (env: Env) => Promise<SqlConnection>;
194
+ adapter: (env: Env) => Promise<SqlDriverAdapter>;
191
195
  };
192
196
 
193
197
  declare type Provider = 'mysql' | 'postgres' | 'sqlite';
@@ -203,7 +207,7 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
203
207
  executeRaw(params: Query): Promise<number>;
204
208
  }
205
209
 
206
- declare interface SqlConnection extends SqlQueryable {
210
+ declare interface SqlDriverAdapter extends SqlQueryable {
207
211
  /**
208
212
  * Execute multiple SQL statements separated by semicolon.
209
213
  */
@@ -211,7 +215,7 @@ declare interface SqlConnection extends SqlQueryable {
211
215
  /**
212
216
  * Start new transaction.
213
217
  */
214
- transactionContext(): Promise<TransactionContext>;
218
+ startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
215
219
  /**
216
220
  * Optional method that returns extra connection info
217
221
  */
@@ -222,6 +226,18 @@ declare interface SqlConnection extends SqlQueryable {
222
226
  dispose(): Promise<void>;
223
227
  }
224
228
 
229
+ declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
230
+ connect(): Promise<SqlDriverAdapter>;
231
+ }
232
+
233
+ /**
234
+ * An SQL migration adapter that is aware of the notion of a shadow database
235
+ * and can create a connection to it.
236
+ */
237
+ declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
238
+ connectToShadowDb(): Promise<SqlDriverAdapter>;
239
+ }
240
+
225
241
  declare type SqlQuery = {
226
242
  sql: string;
227
243
  args: Array<unknown>;
@@ -268,13 +284,6 @@ declare interface Transaction extends AdapterInfo, SqlQueryable {
268
284
  rollback(): Promise<void>;
269
285
  }
270
286
 
271
- declare interface TransactionContext extends AdapterInfo, SqlQueryable {
272
- /**
273
- * Start new transaction.
274
- */
275
- startTransaction(): Promise<Transaction>;
276
- }
277
-
278
287
  declare type TransactionOptions = {
279
288
  usePhantomQuery: boolean;
280
289
  };