@prisma/config 6.20.0-integration-next.4 → 6.20.0-integration-next.6
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 +29 -230
- package/dist/index.js +15 -202
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* An interface that exposes some basic information about the
|
|
5
3
|
* adapter like its name and provider type.
|
|
@@ -87,6 +85,11 @@ declare type ConnectionInfo = {
|
|
|
87
85
|
supportsRelationJoins: boolean;
|
|
88
86
|
};
|
|
89
87
|
|
|
88
|
+
export declare type Datasource = {
|
|
89
|
+
url: string;
|
|
90
|
+
shadowDatabaseUrl?: string;
|
|
91
|
+
};
|
|
92
|
+
|
|
90
93
|
/**
|
|
91
94
|
* This default config can be used as basis for unit and integration tests.
|
|
92
95
|
*/
|
|
@@ -119,34 +122,7 @@ declare type EnumsConfigShape = {
|
|
|
119
122
|
|
|
120
123
|
export declare function env<Env extends Record<string, string | undefined>>(name: keyof Env & string): string;
|
|
121
124
|
|
|
122
|
-
declare type Error_2 = MappedError & {
|
|
123
|
-
originalCode?: string;
|
|
124
|
-
originalMessage?: 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
125
|
declare type ExperimentalConfig = {
|
|
146
|
-
/**
|
|
147
|
-
* Enable experimental adapter support.
|
|
148
|
-
*/
|
|
149
|
-
adapter?: boolean;
|
|
150
126
|
/**
|
|
151
127
|
* Enable experimental Prisma Studio features.
|
|
152
128
|
*/
|
|
@@ -204,116 +180,6 @@ declare type LoadConfigFromFileInput = {
|
|
|
204
180
|
configRoot?: string;
|
|
205
181
|
};
|
|
206
182
|
|
|
207
|
-
declare type MappedError = {
|
|
208
|
-
kind: 'GenericJs';
|
|
209
|
-
id: number;
|
|
210
|
-
} | {
|
|
211
|
-
kind: 'UnsupportedNativeDataType';
|
|
212
|
-
type: string;
|
|
213
|
-
} | {
|
|
214
|
-
kind: 'InvalidIsolationLevel';
|
|
215
|
-
level: string;
|
|
216
|
-
} | {
|
|
217
|
-
kind: 'LengthMismatch';
|
|
218
|
-
column?: string;
|
|
219
|
-
} | {
|
|
220
|
-
kind: 'UniqueConstraintViolation';
|
|
221
|
-
constraint?: {
|
|
222
|
-
fields: string[];
|
|
223
|
-
} | {
|
|
224
|
-
index: string;
|
|
225
|
-
} | {
|
|
226
|
-
foreignKey: {};
|
|
227
|
-
};
|
|
228
|
-
} | {
|
|
229
|
-
kind: 'NullConstraintViolation';
|
|
230
|
-
constraint?: {
|
|
231
|
-
fields: string[];
|
|
232
|
-
} | {
|
|
233
|
-
index: string;
|
|
234
|
-
} | {
|
|
235
|
-
foreignKey: {};
|
|
236
|
-
};
|
|
237
|
-
} | {
|
|
238
|
-
kind: 'ForeignKeyConstraintViolation';
|
|
239
|
-
constraint?: {
|
|
240
|
-
fields: string[];
|
|
241
|
-
} | {
|
|
242
|
-
index: string;
|
|
243
|
-
} | {
|
|
244
|
-
foreignKey: {};
|
|
245
|
-
};
|
|
246
|
-
} | {
|
|
247
|
-
kind: 'DatabaseNotReachable';
|
|
248
|
-
host?: string;
|
|
249
|
-
port?: number;
|
|
250
|
-
} | {
|
|
251
|
-
kind: 'DatabaseDoesNotExist';
|
|
252
|
-
db?: string;
|
|
253
|
-
} | {
|
|
254
|
-
kind: 'DatabaseAlreadyExists';
|
|
255
|
-
db?: string;
|
|
256
|
-
} | {
|
|
257
|
-
kind: 'DatabaseAccessDenied';
|
|
258
|
-
db?: string;
|
|
259
|
-
} | {
|
|
260
|
-
kind: 'ConnectionClosed';
|
|
261
|
-
} | {
|
|
262
|
-
kind: 'TlsConnectionError';
|
|
263
|
-
reason: string;
|
|
264
|
-
} | {
|
|
265
|
-
kind: 'AuthenticationFailed';
|
|
266
|
-
user?: string;
|
|
267
|
-
} | {
|
|
268
|
-
kind: 'TransactionWriteConflict';
|
|
269
|
-
} | {
|
|
270
|
-
kind: 'TableDoesNotExist';
|
|
271
|
-
table?: string;
|
|
272
|
-
} | {
|
|
273
|
-
kind: 'ColumnNotFound';
|
|
274
|
-
column?: string;
|
|
275
|
-
} | {
|
|
276
|
-
kind: 'TooManyConnections';
|
|
277
|
-
cause: string;
|
|
278
|
-
} | {
|
|
279
|
-
kind: 'ValueOutOfRange';
|
|
280
|
-
cause: string;
|
|
281
|
-
} | {
|
|
282
|
-
kind: 'MissingFullTextSearchIndex';
|
|
283
|
-
} | {
|
|
284
|
-
kind: 'SocketTimeout';
|
|
285
|
-
} | {
|
|
286
|
-
kind: 'InconsistentColumnData';
|
|
287
|
-
cause: string;
|
|
288
|
-
} | {
|
|
289
|
-
kind: 'TransactionAlreadyClosed';
|
|
290
|
-
cause: string;
|
|
291
|
-
} | {
|
|
292
|
-
kind: 'postgres';
|
|
293
|
-
code: string;
|
|
294
|
-
severity: string;
|
|
295
|
-
message: string;
|
|
296
|
-
detail: string | undefined;
|
|
297
|
-
column: string | undefined;
|
|
298
|
-
hint: string | undefined;
|
|
299
|
-
} | {
|
|
300
|
-
kind: 'mysql';
|
|
301
|
-
code: number;
|
|
302
|
-
message: string;
|
|
303
|
-
state: string;
|
|
304
|
-
} | {
|
|
305
|
-
kind: 'sqlite';
|
|
306
|
-
/**
|
|
307
|
-
* Sqlite extended error code: https://www.sqlite.org/rescode.html
|
|
308
|
-
*/
|
|
309
|
-
extendedCode: number;
|
|
310
|
-
message: string;
|
|
311
|
-
} | {
|
|
312
|
-
kind: 'mssql';
|
|
313
|
-
code: number;
|
|
314
|
-
message: string;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
183
|
declare type MigrationsConfigShape = {
|
|
318
184
|
/**
|
|
319
185
|
* The path to the directory where Prisma should store migration files, and look for them.
|
|
@@ -338,41 +204,15 @@ declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
|
|
|
338
204
|
* The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
|
|
339
205
|
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
340
206
|
*/
|
|
341
|
-
export declare type PrismaConfig =
|
|
342
|
-
|
|
343
|
-
export declare class PrismaConfigEnvError extends Error {
|
|
344
|
-
constructor(name: string);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* The configuration for the Prisma Development Kit, after it has been parsed and processed
|
|
349
|
-
* by the `defineConfig` function.
|
|
350
|
-
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
351
|
-
*/
|
|
352
|
-
export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
|
353
|
-
__brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
declare type _PrismaConfigInternal = Omit<PrismaConfig, 'engine' | 'datasource' | 'adapter'> & {
|
|
357
|
-
loadedFromFile: string | null;
|
|
358
|
-
} & ({
|
|
359
|
-
engine: 'classic';
|
|
360
|
-
datasource: {
|
|
361
|
-
url: string;
|
|
362
|
-
shadowDatabaseUrl?: string;
|
|
363
|
-
};
|
|
364
|
-
} | {
|
|
365
|
-
engine: 'js';
|
|
366
|
-
adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
367
|
-
} | {
|
|
368
|
-
engine?: never;
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
declare type PrismaConfigUnconditional = {
|
|
207
|
+
export declare type PrismaConfig = {
|
|
372
208
|
/**
|
|
373
209
|
* Experimental feature gates. Each experimental feature must be explicitly enabled.
|
|
374
210
|
*/
|
|
375
211
|
experimental?: Simplify<ExperimentalConfig>;
|
|
212
|
+
/**
|
|
213
|
+
* The datasource configuration. Optional for most cases, but required for migration / introspection commands.
|
|
214
|
+
*/
|
|
215
|
+
datasource?: Simplify<Datasource>;
|
|
376
216
|
/**
|
|
377
217
|
* The path to the schema file, or path to a folder that shall be recursively searched for *.prisma files.
|
|
378
218
|
*/
|
|
@@ -403,6 +243,23 @@ declare type PrismaConfigUnconditional = {
|
|
|
403
243
|
typedSql?: Simplify<TypedSqlConfigShape>;
|
|
404
244
|
};
|
|
405
245
|
|
|
246
|
+
export declare class PrismaConfigEnvError extends Error {
|
|
247
|
+
constructor(name: string);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The configuration for the Prisma Development Kit, after it has been parsed and processed
|
|
252
|
+
* by the `defineConfig` function.
|
|
253
|
+
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
254
|
+
*/
|
|
255
|
+
export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
|
256
|
+
__brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
declare type _PrismaConfigInternal = PrismaConfig & {
|
|
260
|
+
loadedFromFile: string | null;
|
|
261
|
+
};
|
|
262
|
+
|
|
406
263
|
declare type PrismaStudioConfigShape = {
|
|
407
264
|
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
408
265
|
};
|
|
@@ -420,68 +277,10 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
|
420
277
|
executeRaw(params: Query): Promise<number>;
|
|
421
278
|
}
|
|
422
279
|
|
|
423
|
-
declare type
|
|
424
|
-
|
|
425
|
-
flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
|
|
426
|
-
} & ({
|
|
427
|
-
readonly ok: true;
|
|
428
|
-
readonly value: T;
|
|
429
|
-
} | {
|
|
430
|
-
readonly ok: false;
|
|
431
|
-
readonly error: Error_2;
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
declare type SchemaEngineConfig = SchemaEngineConfigJs | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
435
|
-
|
|
436
|
-
declare type SchemaEngineConfigAbsent = {
|
|
437
|
-
engine?: never;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
declare type SchemaEngineConfigClassic = {
|
|
441
|
-
/**
|
|
442
|
-
* Uses the "old classic" Schema Engine binary
|
|
443
|
-
*/
|
|
444
|
-
engine: 'classic';
|
|
445
|
-
/**
|
|
446
|
-
* The database connection configuration, which overwrites the `datasource` block's `url`-like attributes in the Prisma schema file.
|
|
447
|
-
*/
|
|
448
|
-
datasource: SchemaEngineConfigClassicDatasource;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
export declare type SchemaEngineConfigClassicDatasource = {
|
|
452
|
-
url: string;
|
|
453
|
-
shadowDatabaseUrl?: string;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
export declare type SchemaEngineConfigInternal = SchemaEngineConfigJsInternal | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
457
|
-
|
|
458
|
-
declare type SchemaEngineConfigJs = {
|
|
459
|
-
/**
|
|
460
|
-
* Uses the new, unstable JavaScript based Schema Engine.
|
|
461
|
-
*/
|
|
462
|
-
engine: 'js';
|
|
463
|
-
/**
|
|
464
|
-
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
465
|
-
*/
|
|
466
|
-
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
280
|
+
export declare type SchemaEngineConfigInternal = {
|
|
281
|
+
datasource?: Datasource;
|
|
467
282
|
};
|
|
468
283
|
|
|
469
|
-
declare type SchemaEngineConfigJsInternal = {
|
|
470
|
-
/**
|
|
471
|
-
* Uses the new, unstable JavaScript based Schema Engine.
|
|
472
|
-
*/
|
|
473
|
-
engine: 'js';
|
|
474
|
-
/**
|
|
475
|
-
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
476
|
-
*/
|
|
477
|
-
adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
declare const SchemaEngineConfigJsInternal: Schema.Struct<{
|
|
481
|
-
engine: Schema.Literal<["js"]>;
|
|
482
|
-
adapter: Schema.declare<() => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, readonly [], never>;
|
|
483
|
-
}>;
|
|
484
|
-
|
|
485
284
|
/**
|
|
486
285
|
* Simplifies the type signature of a type.
|
|
487
286
|
* Re-exported from `effect/Types`.
|
package/dist/index.js
CHANGED
|
@@ -225,129 +225,7 @@ function safeStringify(value, indent = 2) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// ../driver-adapter-utils/dist/index.mjs
|
|
228
|
-
function isDriverAdapterError(error) {
|
|
229
|
-
return error["name"] === "DriverAdapterError" && typeof error["cause"] === "object";
|
|
230
|
-
}
|
|
231
|
-
function ok(value) {
|
|
232
|
-
return {
|
|
233
|
-
ok: true,
|
|
234
|
-
value,
|
|
235
|
-
map(fn) {
|
|
236
|
-
return ok(fn(value));
|
|
237
|
-
},
|
|
238
|
-
flatMap(fn) {
|
|
239
|
-
return fn(value);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
function err(error) {
|
|
244
|
-
return {
|
|
245
|
-
ok: false,
|
|
246
|
-
error,
|
|
247
|
-
map() {
|
|
248
|
-
return err(error);
|
|
249
|
-
},
|
|
250
|
-
flatMap() {
|
|
251
|
-
return err(error);
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
228
|
var debug = Debug("driver-adapter-utils");
|
|
256
|
-
var ErrorRegistryInternal = class {
|
|
257
|
-
registeredErrors = [];
|
|
258
|
-
consumeError(id) {
|
|
259
|
-
return this.registeredErrors[id];
|
|
260
|
-
}
|
|
261
|
-
registerNewError(error) {
|
|
262
|
-
let i = 0;
|
|
263
|
-
while (this.registeredErrors[i] !== void 0) {
|
|
264
|
-
i++;
|
|
265
|
-
}
|
|
266
|
-
this.registeredErrors[i] = { error };
|
|
267
|
-
return i;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
function copySymbolsFromSource(source, target) {
|
|
271
|
-
const symbols = Object.getOwnPropertySymbols(source);
|
|
272
|
-
const symbolObject = Object.fromEntries(symbols.map((symbol) => [symbol, true]));
|
|
273
|
-
Object.assign(target, symbolObject);
|
|
274
|
-
}
|
|
275
|
-
var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
|
|
276
|
-
const errorRegistry = new ErrorRegistryInternal();
|
|
277
|
-
const boundFactory = {
|
|
278
|
-
adapterName: adapterFactory.adapterName,
|
|
279
|
-
provider: adapterFactory.provider,
|
|
280
|
-
errorRegistry,
|
|
281
|
-
connect: async (...args) => {
|
|
282
|
-
const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args);
|
|
283
|
-
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
284
|
-
},
|
|
285
|
-
connectToShadowDb: async (...args) => {
|
|
286
|
-
const ctx = await wrapAsync(errorRegistry, adapterFactory.connectToShadowDb.bind(adapterFactory))(...args);
|
|
287
|
-
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
copySymbolsFromSource(adapterFactory, boundFactory);
|
|
291
|
-
return boundFactory;
|
|
292
|
-
};
|
|
293
|
-
var bindAdapter = (adapter, errorRegistry = new ErrorRegistryInternal()) => {
|
|
294
|
-
const boundAdapter = {
|
|
295
|
-
adapterName: adapter.adapterName,
|
|
296
|
-
errorRegistry,
|
|
297
|
-
queryRaw: wrapAsync(errorRegistry, adapter.queryRaw.bind(adapter)),
|
|
298
|
-
executeRaw: wrapAsync(errorRegistry, adapter.executeRaw.bind(adapter)),
|
|
299
|
-
executeScript: wrapAsync(errorRegistry, adapter.executeScript.bind(adapter)),
|
|
300
|
-
dispose: wrapAsync(errorRegistry, adapter.dispose.bind(adapter)),
|
|
301
|
-
provider: adapter.provider,
|
|
302
|
-
startTransaction: async (...args) => {
|
|
303
|
-
const ctx = await wrapAsync(errorRegistry, adapter.startTransaction.bind(adapter))(...args);
|
|
304
|
-
return ctx.map((ctx2) => bindTransaction(errorRegistry, ctx2));
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
if (adapter.getConnectionInfo) {
|
|
308
|
-
boundAdapter.getConnectionInfo = wrapSync(errorRegistry, adapter.getConnectionInfo.bind(adapter));
|
|
309
|
-
}
|
|
310
|
-
return boundAdapter;
|
|
311
|
-
};
|
|
312
|
-
var bindTransaction = (errorRegistry, transaction) => {
|
|
313
|
-
return {
|
|
314
|
-
adapterName: transaction.adapterName,
|
|
315
|
-
provider: transaction.provider,
|
|
316
|
-
options: transaction.options,
|
|
317
|
-
queryRaw: wrapAsync(errorRegistry, transaction.queryRaw.bind(transaction)),
|
|
318
|
-
executeRaw: wrapAsync(errorRegistry, transaction.executeRaw.bind(transaction)),
|
|
319
|
-
commit: wrapAsync(errorRegistry, transaction.commit.bind(transaction)),
|
|
320
|
-
rollback: wrapAsync(errorRegistry, transaction.rollback.bind(transaction))
|
|
321
|
-
};
|
|
322
|
-
};
|
|
323
|
-
function wrapAsync(registry, fn) {
|
|
324
|
-
return async (...args) => {
|
|
325
|
-
try {
|
|
326
|
-
return ok(await fn(...args));
|
|
327
|
-
} catch (error) {
|
|
328
|
-
debug("[error@wrapAsync]", error);
|
|
329
|
-
if (isDriverAdapterError(error)) {
|
|
330
|
-
return err(error.cause);
|
|
331
|
-
}
|
|
332
|
-
const id = registry.registerNewError(error);
|
|
333
|
-
return err({ kind: "GenericJs", id });
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function wrapSync(registry, fn) {
|
|
338
|
-
return (...args) => {
|
|
339
|
-
try {
|
|
340
|
-
return ok(fn(...args));
|
|
341
|
-
} catch (error) {
|
|
342
|
-
debug("[error@wrapSync]", error);
|
|
343
|
-
if (isDriverAdapterError(error)) {
|
|
344
|
-
return err(error.cause);
|
|
345
|
-
}
|
|
346
|
-
const id = registry.registerNewError(error);
|
|
347
|
-
return err({ kind: "GenericJs", id });
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
229
|
var mockAdapterErrors = {
|
|
352
230
|
queryRaw: new Error("Not implemented: queryRaw"),
|
|
353
231
|
executeRaw: new Error("Not implemented: executeRaw"),
|
|
@@ -373,11 +251,6 @@ function defaultConfig() {
|
|
|
373
251
|
// src/defineConfig.ts
|
|
374
252
|
function validateExperimentalFeatures(config) {
|
|
375
253
|
const experimental = config.experimental || {};
|
|
376
|
-
if (config.engine === "js" && !experimental.adapter) {
|
|
377
|
-
return import_effect.Either.left(
|
|
378
|
-
new Error('The `engine === "js"` configuration requires `experimental.adapter` to be set to `true`.')
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
254
|
if (config.studio && !experimental.studio) {
|
|
382
255
|
return import_effect.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
383
256
|
}
|
|
@@ -410,7 +283,7 @@ function defineConfig(configInput) {
|
|
|
410
283
|
debug2("[default]: %o", config);
|
|
411
284
|
defineExperimentalConfig(config, configInput);
|
|
412
285
|
defineSchemaConfig(config, configInput);
|
|
413
|
-
|
|
286
|
+
defineDatasource(config, configInput);
|
|
414
287
|
defineStudioConfig(config, configInput);
|
|
415
288
|
defineMigrationsConfig(config, configInput);
|
|
416
289
|
defineTablesConfig(config, configInput);
|
|
@@ -483,25 +356,10 @@ function defineStudioConfig(config, configInput) {
|
|
|
483
356
|
};
|
|
484
357
|
debug2("[config.studio]: %o", config.studio);
|
|
485
358
|
}
|
|
486
|
-
function
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const { engine, adapter: getAdapterFactory } = configInput;
|
|
491
|
-
const adapter = async () => {
|
|
492
|
-
const adapterFactory = await getAdapterFactory();
|
|
493
|
-
debug2("[config.adapter]: %o", adapterFactory.adapterName);
|
|
494
|
-
return bindMigrationAwareSqlAdapterFactory(adapterFactory);
|
|
495
|
-
};
|
|
496
|
-
Object.assign(config, { engine, adapter });
|
|
497
|
-
debug2("[config.engine]: %o", engine);
|
|
498
|
-
debug2("[config.adapter]: %o", adapter);
|
|
499
|
-
} else if (configInput.engine === "classic") {
|
|
500
|
-
const { engine, datasource } = configInput;
|
|
501
|
-
Object.assign(config, { engine, datasource });
|
|
502
|
-
debug2("[config.engine]: %o", engine);
|
|
503
|
-
debug2("[config.datasource]: %o", datasource);
|
|
504
|
-
}
|
|
359
|
+
function defineDatasource(config, configInput) {
|
|
360
|
+
const { datasource } = configInput;
|
|
361
|
+
Object.assign(config, { datasource });
|
|
362
|
+
debug2("[config.datasource]: %o", datasource);
|
|
505
363
|
}
|
|
506
364
|
function defineExtensionsConfig(config, configInput) {
|
|
507
365
|
if (!configInput["extensions"]) {
|
|
@@ -523,46 +381,11 @@ var SqlMigrationAwareDriverAdapterFactoryShape = import_effect2.Schema.declare(
|
|
|
523
381
|
decode: import_effect2.identity
|
|
524
382
|
}
|
|
525
383
|
);
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
identifier: "ErrorCapturingSqlMigrationAwareDriverAdapterFactory",
|
|
532
|
-
encode: import_effect2.identity,
|
|
533
|
-
decode: import_effect2.identity
|
|
534
|
-
}
|
|
535
|
-
);
|
|
536
|
-
var SchemaEngineConfigClassicShape = import_effect2.Schema.Struct({
|
|
537
|
-
engine: import_effect2.Schema.Literal("classic"),
|
|
538
|
-
datasource: import_effect2.Schema.Struct({
|
|
539
|
-
url: import_effect2.Schema.String,
|
|
540
|
-
shadowDatabaseUrl: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
541
|
-
})
|
|
384
|
+
var DatasourceShape = import_effect2.Schema.Struct({
|
|
385
|
+
url: import_effect2.Schema.String,
|
|
386
|
+
shadowDatabaseUrl: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
542
387
|
});
|
|
543
|
-
var SchemaEngineConfigJsShape = import_effect2.Schema.Struct({
|
|
544
|
-
engine: import_effect2.Schema.Literal("js"),
|
|
545
|
-
adapter: SqlMigrationAwareDriverAdapterFactoryShape
|
|
546
|
-
});
|
|
547
|
-
var SchemaEngineConfigAbsentShape = import_effect2.Schema.Struct({
|
|
548
|
-
engine: import_effect2.Schema.optional(import_effect2.Schema.Never)
|
|
549
|
-
});
|
|
550
|
-
var SchemaEngineConfigShape = import_effect2.Schema.Union(
|
|
551
|
-
SchemaEngineConfigClassicShape,
|
|
552
|
-
SchemaEngineConfigJsShape,
|
|
553
|
-
SchemaEngineConfigAbsentShape
|
|
554
|
-
);
|
|
555
|
-
var SchemaEngineConfigJsInternal = import_effect2.Schema.Struct({
|
|
556
|
-
engine: import_effect2.Schema.Literal("js"),
|
|
557
|
-
adapter: ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape
|
|
558
|
-
});
|
|
559
|
-
var SchemaEngineConfigInternal = import_effect2.Schema.Union(
|
|
560
|
-
SchemaEngineConfigClassicShape,
|
|
561
|
-
SchemaEngineConfigJsInternal,
|
|
562
|
-
SchemaEngineConfigAbsentShape
|
|
563
|
-
);
|
|
564
388
|
var ExperimentalConfigShape = import_effect2.Schema.Struct({
|
|
565
|
-
adapter: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
566
389
|
studio: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
567
390
|
externalTables: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
568
391
|
extensions: import_effect2.Schema.optional(import_effect2.Schema.Boolean)
|
|
@@ -622,8 +445,9 @@ if (false) {
|
|
|
622
445
|
__testPrismaConfig;
|
|
623
446
|
__testPrismaConfigInternal;
|
|
624
447
|
}
|
|
625
|
-
var
|
|
448
|
+
var PrismaConfigShape = import_effect2.Schema.Struct({
|
|
626
449
|
experimental: import_effect2.Schema.optional(ExperimentalConfigShape),
|
|
450
|
+
datasource: import_effect2.Schema.optional(DatasourceShape),
|
|
627
451
|
schema: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
628
452
|
studio: import_effect2.Schema.optional(PrismaStudioConfigShape),
|
|
629
453
|
migrations: import_effect2.Schema.optional(MigrationsConfigShape),
|
|
@@ -633,18 +457,12 @@ var PrismaConfigUnconditionalShape = import_effect2.Schema.Struct({
|
|
|
633
457
|
typedSql: import_effect2.Schema.optional(TypedSqlConfigShape),
|
|
634
458
|
extensions: import_effect2.Schema.optional(import_effect2.Schema.Any)
|
|
635
459
|
});
|
|
636
|
-
var PrismaConfigShape = import_effect2.Schema.extend(SchemaEngineConfigShape, PrismaConfigUnconditionalShape);
|
|
637
460
|
if (false) {
|
|
638
461
|
__testPrismaConfigValueA;
|
|
639
462
|
__testPrismaConfigValueB;
|
|
640
463
|
}
|
|
641
464
|
function validateExperimentalFeatures2(config) {
|
|
642
465
|
const experimental = config.experimental || {};
|
|
643
|
-
if (config.engine === "js" && !experimental.adapter) {
|
|
644
|
-
return import_effect2.Either.left(
|
|
645
|
-
new Error("The `engine === 'js'` configuration requires `experimental.adapter` to be set to `true`.")
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
466
|
if (config.studio && !experimental.studio) {
|
|
649
467
|
return import_effect2.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
650
468
|
}
|
|
@@ -681,15 +499,10 @@ function parsePrismaConfigShape(input) {
|
|
|
681
499
|
);
|
|
682
500
|
}
|
|
683
501
|
var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
|
|
684
|
-
var PrismaConfigInternalShape = import_effect2.Schema.
|
|
685
|
-
|
|
686
|
-
import_effect2.Schema.
|
|
687
|
-
|
|
688
|
-
import_effect2.Schema.Struct({
|
|
689
|
-
loadedFromFile: import_effect2.Schema.NullOr(import_effect2.Schema.String)
|
|
690
|
-
})
|
|
691
|
-
)
|
|
692
|
-
);
|
|
502
|
+
var PrismaConfigInternalShape = import_effect2.Schema.Struct({
|
|
503
|
+
...PrismaConfigShape.fields,
|
|
504
|
+
loadedFromFile: import_effect2.Schema.NullOr(import_effect2.Schema.String)
|
|
505
|
+
});
|
|
693
506
|
function brandPrismaConfigInternal(config) {
|
|
694
507
|
Object.defineProperty(config, "__brand", {
|
|
695
508
|
value: PRISMA_CONFIG_INTERNAL_BRAND,
|
|
@@ -719,7 +532,7 @@ function parsePrismaConfigInternalShape(input) {
|
|
|
719
532
|
);
|
|
720
533
|
}
|
|
721
534
|
function makePrismaConfigInternal(makeArgs) {
|
|
722
|
-
return
|
|
535
|
+
return (0, import_Function.pipe)(PrismaConfigInternalShape.make(makeArgs), brandPrismaConfigInternal);
|
|
723
536
|
}
|
|
724
537
|
function parseDefaultExport(defaultExport) {
|
|
725
538
|
const parseResultEither = (0, import_Function.pipe)(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/config",
|
|
3
|
-
"version": "6.20.0-integration-next.
|
|
3
|
+
"version": "6.20.0-integration-next.6",
|
|
4
4
|
"description": "Internal package used to define and read Prisma configuration files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
"empathic": "2.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"dotenv": "17.2.3",
|
|
21
22
|
"vitest": "3.2.4",
|
|
22
|
-
"@prisma/driver-adapter-utils": "6.20.0-integration-next.
|
|
23
|
-
"@prisma/get-platform": "6.20.0-integration-next.
|
|
23
|
+
"@prisma/driver-adapter-utils": "6.20.0-integration-next.6",
|
|
24
|
+
"@prisma/get-platform": "6.20.0-integration-next.6"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"dist"
|