@prisma/config 6.20.0-integration-next.3 → 6.20.0-integration-feat-prisma-7-config.2
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 +33 -231
- package/dist/index.js +27 -205
- 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,15 @@ declare type ConnectionInfo = {
|
|
|
87
85
|
supportsRelationJoins: boolean;
|
|
88
86
|
};
|
|
89
87
|
|
|
88
|
+
export declare type Datasource = {
|
|
89
|
+
url: string;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated
|
|
92
|
+
*/
|
|
93
|
+
directUrl?: string;
|
|
94
|
+
shadowDatabaseUrl?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
90
97
|
/**
|
|
91
98
|
* This default config can be used as basis for unit and integration tests.
|
|
92
99
|
*/
|
|
@@ -119,34 +126,7 @@ declare type EnumsConfigShape = {
|
|
|
119
126
|
|
|
120
127
|
export declare function env<Env extends Record<string, string | undefined>>(name: keyof Env & string): string;
|
|
121
128
|
|
|
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
129
|
declare type ExperimentalConfig = {
|
|
146
|
-
/**
|
|
147
|
-
* Enable experimental adapter support.
|
|
148
|
-
*/
|
|
149
|
-
adapter?: boolean;
|
|
150
130
|
/**
|
|
151
131
|
* Enable experimental Prisma Studio features.
|
|
152
132
|
*/
|
|
@@ -204,116 +184,6 @@ declare type LoadConfigFromFileInput = {
|
|
|
204
184
|
configRoot?: string;
|
|
205
185
|
};
|
|
206
186
|
|
|
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
187
|
declare type MigrationsConfigShape = {
|
|
318
188
|
/**
|
|
319
189
|
* The path to the directory where Prisma should store migration files, and look for them.
|
|
@@ -338,37 +208,11 @@ declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
|
|
|
338
208
|
* The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
|
|
339
209
|
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
340
210
|
*/
|
|
341
|
-
export declare type PrismaConfig =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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 = {
|
|
211
|
+
export declare type PrismaConfig = {
|
|
212
|
+
/**
|
|
213
|
+
* The datasource URL configuration for the database connection.
|
|
214
|
+
*/
|
|
215
|
+
datasource: Simplify<Datasource>;
|
|
372
216
|
/**
|
|
373
217
|
* Experimental feature gates. Each experimental feature must be explicitly enabled.
|
|
374
218
|
*/
|
|
@@ -403,6 +247,23 @@ declare type PrismaConfigUnconditional = {
|
|
|
403
247
|
typedSql?: Simplify<TypedSqlConfigShape>;
|
|
404
248
|
};
|
|
405
249
|
|
|
250
|
+
export declare class PrismaConfigEnvError extends Error {
|
|
251
|
+
constructor(name: string);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The configuration for the Prisma Development Kit, after it has been parsed and processed
|
|
256
|
+
* by the `defineConfig` function.
|
|
257
|
+
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
258
|
+
*/
|
|
259
|
+
export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
|
260
|
+
__brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare type _PrismaConfigInternal = PrismaConfig & {
|
|
264
|
+
loadedFromFile: string | null;
|
|
265
|
+
};
|
|
266
|
+
|
|
406
267
|
declare type PrismaStudioConfigShape = {
|
|
407
268
|
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
408
269
|
};
|
|
@@ -420,69 +281,10 @@ declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
|
420
281
|
executeRaw(params: Query): Promise<number>;
|
|
421
282
|
}
|
|
422
283
|
|
|
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;
|
|
284
|
+
export declare type SchemaEngineConfigInternal = {
|
|
285
|
+
datasource: Datasource;
|
|
438
286
|
};
|
|
439
287
|
|
|
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
|
-
directUrl?: string;
|
|
454
|
-
shadowDatabaseUrl?: string;
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
export declare type SchemaEngineConfigInternal = SchemaEngineConfigJsInternal | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
458
|
-
|
|
459
|
-
declare type SchemaEngineConfigJs = {
|
|
460
|
-
/**
|
|
461
|
-
* Uses the new, unstable JavaScript based Schema Engine.
|
|
462
|
-
*/
|
|
463
|
-
engine: 'js';
|
|
464
|
-
/**
|
|
465
|
-
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
466
|
-
*/
|
|
467
|
-
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
declare type SchemaEngineConfigJsInternal = {
|
|
471
|
-
/**
|
|
472
|
-
* Uses the new, unstable JavaScript based Schema Engine.
|
|
473
|
-
*/
|
|
474
|
-
engine: 'js';
|
|
475
|
-
/**
|
|
476
|
-
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
477
|
-
*/
|
|
478
|
-
adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
declare const SchemaEngineConfigJsInternal: Schema.Struct<{
|
|
482
|
-
engine: Schema.Literal<["js"]>;
|
|
483
|
-
adapter: Schema.declare<() => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, readonly [], never>;
|
|
484
|
-
}>;
|
|
485
|
-
|
|
486
288
|
/**
|
|
487
289
|
* Simplifies the type signature of a type.
|
|
488
290
|
* 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"),
|
|
@@ -366,18 +244,16 @@ var import_effect = require("effect");
|
|
|
366
244
|
// src/defaultConfig.ts
|
|
367
245
|
function defaultConfig() {
|
|
368
246
|
return makePrismaConfigInternal({
|
|
369
|
-
loadedFromFile: null
|
|
247
|
+
loadedFromFile: null,
|
|
248
|
+
datasource: {
|
|
249
|
+
url: "<default_datasource_url>"
|
|
250
|
+
}
|
|
370
251
|
});
|
|
371
252
|
}
|
|
372
253
|
|
|
373
254
|
// src/defineConfig.ts
|
|
374
255
|
function validateExperimentalFeatures(config) {
|
|
375
256
|
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
257
|
if (config.studio && !experimental.studio) {
|
|
382
258
|
return import_effect.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
383
259
|
}
|
|
@@ -410,7 +286,7 @@ function defineConfig(configInput) {
|
|
|
410
286
|
debug2("[default]: %o", config);
|
|
411
287
|
defineExperimentalConfig(config, configInput);
|
|
412
288
|
defineSchemaConfig(config, configInput);
|
|
413
|
-
|
|
289
|
+
defineDatasource(config, configInput);
|
|
414
290
|
defineStudioConfig(config, configInput);
|
|
415
291
|
defineMigrationsConfig(config, configInput);
|
|
416
292
|
defineTablesConfig(config, configInput);
|
|
@@ -483,25 +359,10 @@ function defineStudioConfig(config, configInput) {
|
|
|
483
359
|
};
|
|
484
360
|
debug2("[config.studio]: %o", config.studio);
|
|
485
361
|
}
|
|
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
|
-
}
|
|
362
|
+
function defineDatasource(config, configInput) {
|
|
363
|
+
const { datasource } = configInput;
|
|
364
|
+
Object.assign(config, { datasource });
|
|
365
|
+
debug2("[config.datasource]: %o", datasource);
|
|
505
366
|
}
|
|
506
367
|
function defineExtensionsConfig(config, configInput) {
|
|
507
368
|
if (!configInput["extensions"]) {
|
|
@@ -523,47 +384,15 @@ var SqlMigrationAwareDriverAdapterFactoryShape = import_effect2.Schema.declare(
|
|
|
523
384
|
decode: import_effect2.identity
|
|
524
385
|
}
|
|
525
386
|
);
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
directUrl: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
541
|
-
shadowDatabaseUrl: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
542
|
-
})
|
|
543
|
-
});
|
|
544
|
-
var SchemaEngineConfigJsShape = import_effect2.Schema.Struct({
|
|
545
|
-
engine: import_effect2.Schema.Literal("js"),
|
|
546
|
-
adapter: SqlMigrationAwareDriverAdapterFactoryShape
|
|
547
|
-
});
|
|
548
|
-
var SchemaEngineConfigAbsentShape = import_effect2.Schema.Struct({
|
|
549
|
-
engine: import_effect2.Schema.optional(import_effect2.Schema.Never)
|
|
550
|
-
});
|
|
551
|
-
var SchemaEngineConfigShape = import_effect2.Schema.Union(
|
|
552
|
-
SchemaEngineConfigClassicShape,
|
|
553
|
-
SchemaEngineConfigJsShape,
|
|
554
|
-
SchemaEngineConfigAbsentShape
|
|
555
|
-
);
|
|
556
|
-
var SchemaEngineConfigJsInternal = import_effect2.Schema.Struct({
|
|
557
|
-
engine: import_effect2.Schema.Literal("js"),
|
|
558
|
-
adapter: ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape
|
|
387
|
+
var DatasourceShape = import_effect2.Schema.Struct({
|
|
388
|
+
url: import_effect2.Schema.String,
|
|
389
|
+
/**
|
|
390
|
+
* @deprecated
|
|
391
|
+
*/
|
|
392
|
+
directUrl: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
393
|
+
shadowDatabaseUrl: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
559
394
|
});
|
|
560
|
-
var SchemaEngineConfigInternal = import_effect2.Schema.Union(
|
|
561
|
-
SchemaEngineConfigClassicShape,
|
|
562
|
-
SchemaEngineConfigJsInternal,
|
|
563
|
-
SchemaEngineConfigAbsentShape
|
|
564
|
-
);
|
|
565
395
|
var ExperimentalConfigShape = import_effect2.Schema.Struct({
|
|
566
|
-
adapter: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
567
396
|
studio: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
568
397
|
externalTables: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
569
398
|
extensions: import_effect2.Schema.optional(import_effect2.Schema.Boolean)
|
|
@@ -623,7 +452,8 @@ if (false) {
|
|
|
623
452
|
__testPrismaConfig;
|
|
624
453
|
__testPrismaConfigInternal;
|
|
625
454
|
}
|
|
626
|
-
var
|
|
455
|
+
var PrismaConfigShape = import_effect2.Schema.Struct({
|
|
456
|
+
datasource: DatasourceShape,
|
|
627
457
|
experimental: import_effect2.Schema.optional(ExperimentalConfigShape),
|
|
628
458
|
schema: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
629
459
|
studio: import_effect2.Schema.optional(PrismaStudioConfigShape),
|
|
@@ -634,18 +464,12 @@ var PrismaConfigUnconditionalShape = import_effect2.Schema.Struct({
|
|
|
634
464
|
typedSql: import_effect2.Schema.optional(TypedSqlConfigShape),
|
|
635
465
|
extensions: import_effect2.Schema.optional(import_effect2.Schema.Any)
|
|
636
466
|
});
|
|
637
|
-
var PrismaConfigShape = import_effect2.Schema.extend(SchemaEngineConfigShape, PrismaConfigUnconditionalShape);
|
|
638
467
|
if (false) {
|
|
639
468
|
__testPrismaConfigValueA;
|
|
640
469
|
__testPrismaConfigValueB;
|
|
641
470
|
}
|
|
642
471
|
function validateExperimentalFeatures2(config) {
|
|
643
472
|
const experimental = config.experimental || {};
|
|
644
|
-
if (config.engine === "js" && !experimental.adapter) {
|
|
645
|
-
return import_effect2.Either.left(
|
|
646
|
-
new Error("The `engine === 'js'` configuration requires `experimental.adapter` to be set to `true`.")
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
473
|
if (config.studio && !experimental.studio) {
|
|
650
474
|
return import_effect2.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
651
475
|
}
|
|
@@ -682,15 +506,10 @@ function parsePrismaConfigShape(input) {
|
|
|
682
506
|
);
|
|
683
507
|
}
|
|
684
508
|
var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
|
|
685
|
-
var PrismaConfigInternalShape = import_effect2.Schema.
|
|
686
|
-
|
|
687
|
-
import_effect2.Schema.
|
|
688
|
-
|
|
689
|
-
import_effect2.Schema.Struct({
|
|
690
|
-
loadedFromFile: import_effect2.Schema.NullOr(import_effect2.Schema.String)
|
|
691
|
-
})
|
|
692
|
-
)
|
|
693
|
-
);
|
|
509
|
+
var PrismaConfigInternalShape = import_effect2.Schema.Struct({
|
|
510
|
+
...PrismaConfigShape.fields,
|
|
511
|
+
loadedFromFile: import_effect2.Schema.NullOr(import_effect2.Schema.String)
|
|
512
|
+
});
|
|
694
513
|
function brandPrismaConfigInternal(config) {
|
|
695
514
|
Object.defineProperty(config, "__brand", {
|
|
696
515
|
value: PRISMA_CONFIG_INTERNAL_BRAND,
|
|
@@ -720,7 +539,7 @@ function parsePrismaConfigInternalShape(input) {
|
|
|
720
539
|
);
|
|
721
540
|
}
|
|
722
541
|
function makePrismaConfigInternal(makeArgs) {
|
|
723
|
-
return
|
|
542
|
+
return (0, import_Function.pipe)(PrismaConfigInternalShape.make(makeArgs), brandPrismaConfigInternal);
|
|
724
543
|
}
|
|
725
544
|
function parseDefaultExport(defaultExport) {
|
|
726
545
|
const parseResultEither = (0, import_Function.pipe)(
|
|
@@ -742,7 +561,10 @@ function parseDefaultExport(defaultExport) {
|
|
|
742
561
|
// src/defaultTestConfig.ts
|
|
743
562
|
function defaultTestConfig() {
|
|
744
563
|
return makePrismaConfigInternal({
|
|
745
|
-
loadedFromFile: null
|
|
564
|
+
loadedFromFile: null,
|
|
565
|
+
datasource: {
|
|
566
|
+
url: "<default_datasource_url>"
|
|
567
|
+
}
|
|
746
568
|
});
|
|
747
569
|
}
|
|
748
570
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/config",
|
|
3
|
-
"version": "6.20.0-integration-
|
|
3
|
+
"version": "6.20.0-integration-feat-prisma-7-config.2",
|
|
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-
|
|
23
|
-
"@prisma/get-platform": "6.20.0-integration-
|
|
23
|
+
"@prisma/driver-adapter-utils": "6.20.0-integration-feat-prisma-7-config.2",
|
|
24
|
+
"@prisma/get-platform": "6.20.0-integration-feat-prisma-7-config.2"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"dist"
|