@prisma/config 6.18.0-dev.20 → 6.18.0-dev.21
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 +103 -48
- package/dist/index.js +76 -29
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* An interface that exposes some basic information about the
|
|
3
5
|
* adapter like its name and provider type.
|
|
@@ -348,44 +350,7 @@ declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
|
|
|
348
350
|
* The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
|
|
349
351
|
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
350
352
|
*/
|
|
351
|
-
export declare type PrismaConfig =
|
|
352
|
-
/**
|
|
353
|
-
* Experimental feature gates. Each experimental feature must be explicitly enabled.
|
|
354
|
-
*/
|
|
355
|
-
experimental?: Simplify<ExperimentalConfig>;
|
|
356
|
-
/**
|
|
357
|
-
* The path to the schema file, or path to a folder that shall be recursively searched for *.prisma files.
|
|
358
|
-
*/
|
|
359
|
-
schema?: string;
|
|
360
|
-
/**
|
|
361
|
-
* The Driver Adapter used for Prisma CLI.
|
|
362
|
-
*/
|
|
363
|
-
adapter?: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
364
|
-
/**
|
|
365
|
-
* The configuration for Prisma Studio.
|
|
366
|
-
*/
|
|
367
|
-
studio?: Simplify<PrismaStudioConfigShape>;
|
|
368
|
-
/**
|
|
369
|
-
* Configuration for Prisma migrations.
|
|
370
|
-
*/
|
|
371
|
-
migrations?: Simplify<MigrationsConfigShape>;
|
|
372
|
-
/**
|
|
373
|
-
* Configuration for the database table entities.
|
|
374
|
-
*/
|
|
375
|
-
tables?: Simplify<TablesConfigShape>;
|
|
376
|
-
/**
|
|
377
|
-
* Configuration for the database enum entities.
|
|
378
|
-
*/
|
|
379
|
-
enums?: Simplify<EnumsConfigShape>;
|
|
380
|
-
/**
|
|
381
|
-
* Configuration for the database view entities.
|
|
382
|
-
*/
|
|
383
|
-
views?: Simplify<ViewsConfigShape>;
|
|
384
|
-
/**
|
|
385
|
-
* Configuration for the `typedSql` preview feature.
|
|
386
|
-
*/
|
|
387
|
-
typedSql?: Simplify<TypedSqlConfigShape>;
|
|
388
|
-
};
|
|
353
|
+
export declare type PrismaConfig = PrismaConfigUnconditional & SchemaEngineConfig;
|
|
389
354
|
|
|
390
355
|
/**
|
|
391
356
|
* The configuration for the Prisma Development Kit, after it has been parsed and processed
|
|
@@ -396,15 +361,7 @@ export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
|
|
396
361
|
__brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
|
397
362
|
};
|
|
398
363
|
|
|
399
|
-
declare type _PrismaConfigInternal = Omit<PrismaConfig, 'adapter'> & {
|
|
400
|
-
/**
|
|
401
|
-
* The Driver Adapter used for Prisma CLI.
|
|
402
|
-
*/
|
|
403
|
-
adapter?: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
404
|
-
/**
|
|
405
|
-
* The path from where the config was loaded.
|
|
406
|
-
* It's set to `null` if no config file was found and only default config is applied.
|
|
407
|
-
*/
|
|
364
|
+
declare type _PrismaConfigInternal = Omit<PrismaConfig, 'engine' | 'datasource' | 'adapter'> & {
|
|
408
365
|
loadedFromFile: string | null;
|
|
409
366
|
/**
|
|
410
367
|
* The deprecated Prisma configuration from `package.json#prisma`.
|
|
@@ -425,7 +382,18 @@ declare type _PrismaConfigInternal = Omit<PrismaConfig, 'adapter'> & {
|
|
|
425
382
|
*/
|
|
426
383
|
loadedFromFile: string;
|
|
427
384
|
} | null;
|
|
428
|
-
}
|
|
385
|
+
} & ({
|
|
386
|
+
engine: 'classic';
|
|
387
|
+
datasource: {
|
|
388
|
+
url: string;
|
|
389
|
+
shadowDatabaseUrl?: string;
|
|
390
|
+
};
|
|
391
|
+
} | {
|
|
392
|
+
engine: 'js';
|
|
393
|
+
adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
394
|
+
} | {
|
|
395
|
+
engine?: never;
|
|
396
|
+
});
|
|
429
397
|
|
|
430
398
|
/**
|
|
431
399
|
* Example:
|
|
@@ -441,6 +409,41 @@ declare type PrismaConfigPackageJson = {
|
|
|
441
409
|
seed?: string;
|
|
442
410
|
};
|
|
443
411
|
|
|
412
|
+
declare type PrismaConfigUnconditional = {
|
|
413
|
+
/**
|
|
414
|
+
* Experimental feature gates. Each experimental feature must be explicitly enabled.
|
|
415
|
+
*/
|
|
416
|
+
experimental?: Simplify<ExperimentalConfig>;
|
|
417
|
+
/**
|
|
418
|
+
* The path to the schema file, or path to a folder that shall be recursively searched for *.prisma files.
|
|
419
|
+
*/
|
|
420
|
+
schema?: string;
|
|
421
|
+
/**
|
|
422
|
+
* The configuration for Prisma Studio.
|
|
423
|
+
*/
|
|
424
|
+
studio?: Simplify<PrismaStudioConfigShape>;
|
|
425
|
+
/**
|
|
426
|
+
* Configuration for Prisma migrations.
|
|
427
|
+
*/
|
|
428
|
+
migrations?: Simplify<MigrationsConfigShape>;
|
|
429
|
+
/**
|
|
430
|
+
* Configuration for the database table entities.
|
|
431
|
+
*/
|
|
432
|
+
tables?: Simplify<TablesConfigShape>;
|
|
433
|
+
/**
|
|
434
|
+
* Configuration for the database enum entities.
|
|
435
|
+
*/
|
|
436
|
+
enums?: Simplify<EnumsConfigShape>;
|
|
437
|
+
/**
|
|
438
|
+
* Configuration for the database view entities.
|
|
439
|
+
*/
|
|
440
|
+
views?: Simplify<ViewsConfigShape>;
|
|
441
|
+
/**
|
|
442
|
+
* Configuration for the `typedSql` preview feature.
|
|
443
|
+
*/
|
|
444
|
+
typedSql?: Simplify<TypedSqlConfigShape>;
|
|
445
|
+
};
|
|
446
|
+
|
|
444
447
|
declare type PrismaStudioConfigShape = {
|
|
445
448
|
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
446
449
|
};
|
|
@@ -469,6 +472,58 @@ declare type Result<T> = {
|
|
|
469
472
|
readonly error: Error_2;
|
|
470
473
|
});
|
|
471
474
|
|
|
475
|
+
declare type SchemaEngineConfig = SchemaEngineConfigJs | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
476
|
+
|
|
477
|
+
declare type SchemaEngineConfigAbsent = {
|
|
478
|
+
engine?: never;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
declare type SchemaEngineConfigClassic = {
|
|
482
|
+
/**
|
|
483
|
+
* Uses the "old classic" Schema Engine binary
|
|
484
|
+
*/
|
|
485
|
+
engine: 'classic';
|
|
486
|
+
/**
|
|
487
|
+
* The database connection configuration, which overwrites the `datasource` block's `url`-like attributes in the Prisma schema file.
|
|
488
|
+
*/
|
|
489
|
+
datasource: SchemaEngineConfigClassicDatasource;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
export declare type SchemaEngineConfigClassicDatasource = {
|
|
493
|
+
url: string;
|
|
494
|
+
directUrl?: string;
|
|
495
|
+
shadowDatabaseUrl?: string;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export declare type SchemaEngineConfigInternal = SchemaEngineConfigJsInternal | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
499
|
+
|
|
500
|
+
declare type SchemaEngineConfigJs = {
|
|
501
|
+
/**
|
|
502
|
+
* Uses the new, unstable JavaScript based Schema Engine.
|
|
503
|
+
*/
|
|
504
|
+
engine: 'js';
|
|
505
|
+
/**
|
|
506
|
+
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
507
|
+
*/
|
|
508
|
+
adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
declare type SchemaEngineConfigJsInternal = {
|
|
512
|
+
/**
|
|
513
|
+
* Uses the new, unstable JavaScript based Schema Engine.
|
|
514
|
+
*/
|
|
515
|
+
engine: 'js';
|
|
516
|
+
/**
|
|
517
|
+
* The function that instantiates the driver adapter to use for the JavaScript based Schema Engine.
|
|
518
|
+
*/
|
|
519
|
+
adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
declare const SchemaEngineConfigJsInternal: Schema.Struct<{
|
|
523
|
+
engine: Schema.Literal<["js"]>;
|
|
524
|
+
adapter: Schema.declare<() => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, readonly [], never>;
|
|
525
|
+
}>;
|
|
526
|
+
|
|
472
527
|
/**
|
|
473
528
|
* Simplifies the type signature of a type.
|
|
474
529
|
* Re-exported from `effect/Types`.
|
package/dist/index.js
CHANGED
|
@@ -266,6 +266,11 @@ var ErrorRegistryInternal = class {
|
|
|
266
266
|
return i;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
|
+
function copySymbolsFromSource(source, target) {
|
|
270
|
+
const symbols = Object.getOwnPropertySymbols(source);
|
|
271
|
+
const symbolObject = Object.fromEntries(symbols.map((symbol) => [symbol, true]));
|
|
272
|
+
Object.assign(target, symbolObject);
|
|
273
|
+
}
|
|
269
274
|
var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
|
|
270
275
|
const errorRegistry = new ErrorRegistryInternal();
|
|
271
276
|
const boundFactory = {
|
|
@@ -281,6 +286,7 @@ var bindMigrationAwareSqlAdapterFactory = (adapterFactory) => {
|
|
|
281
286
|
return ctx.map((ctx2) => bindAdapter(ctx2, errorRegistry));
|
|
282
287
|
}
|
|
283
288
|
};
|
|
289
|
+
copySymbolsFromSource(adapterFactory, boundFactory);
|
|
284
290
|
return boundFactory;
|
|
285
291
|
};
|
|
286
292
|
var bindAdapter = (adapter, errorRegistry = new ErrorRegistryInternal()) => {
|
|
@@ -367,8 +373,10 @@ function defaultConfig() {
|
|
|
367
373
|
// src/defineConfig.ts
|
|
368
374
|
function validateExperimentalFeatures(config) {
|
|
369
375
|
const experimental = config.experimental || {};
|
|
370
|
-
if (config.
|
|
371
|
-
return import_effect.Either.left(
|
|
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
|
+
);
|
|
372
380
|
}
|
|
373
381
|
if (config.studio && !experimental.studio) {
|
|
374
382
|
return import_effect.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
@@ -402,7 +410,7 @@ function defineConfig(configInput) {
|
|
|
402
410
|
debug2("[default]: %o", config);
|
|
403
411
|
defineExperimentalConfig(config, configInput);
|
|
404
412
|
defineSchemaConfig(config, configInput);
|
|
405
|
-
|
|
413
|
+
defineEngineConfig(config, configInput);
|
|
406
414
|
defineStudioConfig(config, configInput);
|
|
407
415
|
defineMigrationsConfig(config, configInput);
|
|
408
416
|
defineTablesConfig(config, configInput);
|
|
@@ -475,17 +483,25 @@ function defineStudioConfig(config, configInput) {
|
|
|
475
483
|
};
|
|
476
484
|
debug2("[config.studio]: %o", config.studio);
|
|
477
485
|
}
|
|
478
|
-
function
|
|
479
|
-
if (
|
|
486
|
+
function defineEngineConfig(config, configInput) {
|
|
487
|
+
if (configInput.engine === void 0) {
|
|
480
488
|
return;
|
|
489
|
+
} else if (configInput.engine === "js") {
|
|
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);
|
|
481
504
|
}
|
|
482
|
-
const { adapter: getAdapterFactory } = configInput;
|
|
483
|
-
config.adapter = async () => {
|
|
484
|
-
const adapterFactory = await getAdapterFactory();
|
|
485
|
-
debug2("[config.adapter]: %o", adapterFactory.adapterName);
|
|
486
|
-
return bindMigrationAwareSqlAdapterFactory(adapterFactory);
|
|
487
|
-
};
|
|
488
|
-
debug2("[config.adapter]: %o", config.adapter);
|
|
489
505
|
}
|
|
490
506
|
function defineExtensionsConfig(config, configInput) {
|
|
491
507
|
if (!configInput["extensions"]) {
|
|
@@ -545,6 +561,35 @@ var ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape = import_effect3.Sc
|
|
|
545
561
|
decode: import_effect3.identity
|
|
546
562
|
}
|
|
547
563
|
);
|
|
564
|
+
var SchemaEngineConfigClassicShape = import_effect3.Schema.Struct({
|
|
565
|
+
engine: import_effect3.Schema.Literal("classic"),
|
|
566
|
+
datasource: import_effect3.Schema.Struct({
|
|
567
|
+
url: import_effect3.Schema.String,
|
|
568
|
+
directUrl: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
569
|
+
shadowDatabaseUrl: import_effect3.Schema.optional(import_effect3.Schema.String)
|
|
570
|
+
})
|
|
571
|
+
});
|
|
572
|
+
var SchemaEngineConfigJsShape = import_effect3.Schema.Struct({
|
|
573
|
+
engine: import_effect3.Schema.Literal("js"),
|
|
574
|
+
adapter: SqlMigrationAwareDriverAdapterFactoryShape
|
|
575
|
+
});
|
|
576
|
+
var SchemaEngineConfigAbsentShape = import_effect3.Schema.Struct({
|
|
577
|
+
engine: import_effect3.Schema.optional(import_effect3.Schema.Never)
|
|
578
|
+
});
|
|
579
|
+
var SchemaEngineConfigShape = import_effect3.Schema.Union(
|
|
580
|
+
SchemaEngineConfigClassicShape,
|
|
581
|
+
SchemaEngineConfigJsShape,
|
|
582
|
+
SchemaEngineConfigAbsentShape
|
|
583
|
+
);
|
|
584
|
+
var SchemaEngineConfigJsInternal = import_effect3.Schema.Struct({
|
|
585
|
+
engine: import_effect3.Schema.Literal("js"),
|
|
586
|
+
adapter: ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape
|
|
587
|
+
});
|
|
588
|
+
var SchemaEngineConfigInternal = import_effect3.Schema.Union(
|
|
589
|
+
SchemaEngineConfigClassicShape,
|
|
590
|
+
SchemaEngineConfigJsInternal,
|
|
591
|
+
SchemaEngineConfigAbsentShape
|
|
592
|
+
);
|
|
548
593
|
var ExperimentalConfigShape = import_effect3.Schema.Struct({
|
|
549
594
|
adapter: import_effect3.Schema.optional(import_effect3.Schema.Boolean),
|
|
550
595
|
studio: import_effect3.Schema.optional(import_effect3.Schema.Boolean),
|
|
@@ -606,11 +651,10 @@ if (false) {
|
|
|
606
651
|
__testPrismaConfig;
|
|
607
652
|
__testPrismaConfigInternal;
|
|
608
653
|
}
|
|
609
|
-
var
|
|
654
|
+
var PrismaConfigUnconditionalShape = import_effect3.Schema.Struct({
|
|
610
655
|
experimental: import_effect3.Schema.optional(ExperimentalConfigShape),
|
|
611
656
|
schema: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
612
657
|
studio: import_effect3.Schema.optional(PrismaStudioConfigShape),
|
|
613
|
-
adapter: import_effect3.Schema.optional(SqlMigrationAwareDriverAdapterFactoryShape),
|
|
614
658
|
migrations: import_effect3.Schema.optional(MigrationsConfigShape),
|
|
615
659
|
tables: import_effect3.Schema.optional(TablesConfigShape),
|
|
616
660
|
enums: import_effect3.Schema.optional(EnumsConfigShape),
|
|
@@ -618,14 +662,17 @@ var PrismaConfigShape = import_effect3.Schema.Struct({
|
|
|
618
662
|
typedSql: import_effect3.Schema.optional(TypedSqlConfigShape),
|
|
619
663
|
extensions: import_effect3.Schema.optional(import_effect3.Schema.Any)
|
|
620
664
|
});
|
|
665
|
+
var PrismaConfigShape = import_effect3.Schema.extend(SchemaEngineConfigShape, PrismaConfigUnconditionalShape);
|
|
621
666
|
if (false) {
|
|
622
667
|
__testPrismaConfigValueA;
|
|
623
668
|
__testPrismaConfigValueB;
|
|
624
669
|
}
|
|
625
670
|
function validateExperimentalFeatures2(config) {
|
|
626
671
|
const experimental = config.experimental || {};
|
|
627
|
-
if (config.
|
|
628
|
-
return import_effect3.Either.left(
|
|
672
|
+
if (config.engine === "js" && !experimental.adapter) {
|
|
673
|
+
return import_effect3.Either.left(
|
|
674
|
+
new Error("The `engine === 'js'` configuration requires `experimental.adapter` to be set to `true`.")
|
|
675
|
+
);
|
|
629
676
|
}
|
|
630
677
|
if (config.studio && !experimental.studio) {
|
|
631
678
|
return import_effect3.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
@@ -663,21 +710,21 @@ function parsePrismaConfigShape(input) {
|
|
|
663
710
|
);
|
|
664
711
|
}
|
|
665
712
|
var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
|
|
666
|
-
var PrismaConfigInternalShape = import_effect3.Schema.
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
deprecatedPackageJson: import_effect3.Schema.NullOr(
|
|
713
|
+
var PrismaConfigInternalShape = import_effect3.Schema.extend(
|
|
714
|
+
PrismaConfigUnconditionalShape,
|
|
715
|
+
import_effect3.Schema.extend(
|
|
716
|
+
SchemaEngineConfigInternal,
|
|
671
717
|
import_effect3.Schema.Struct({
|
|
672
|
-
|
|
673
|
-
|
|
718
|
+
loadedFromFile: import_effect3.Schema.NullOr(import_effect3.Schema.String),
|
|
719
|
+
deprecatedPackageJson: import_effect3.Schema.NullOr(
|
|
720
|
+
import_effect3.Schema.Struct({
|
|
721
|
+
config: PrismaConfigPackageJsonShape,
|
|
722
|
+
loadedFromFile: import_effect3.Schema.String
|
|
723
|
+
})
|
|
724
|
+
)
|
|
674
725
|
})
|
|
675
726
|
)
|
|
676
|
-
|
|
677
|
-
if (false) {
|
|
678
|
-
__testPrismaConfigInternalValueA;
|
|
679
|
-
__testPrismaConfigInternalValueB;
|
|
680
|
-
}
|
|
727
|
+
);
|
|
681
728
|
function brandPrismaConfigInternal(config) {
|
|
682
729
|
Object.defineProperty(config, "__brand", {
|
|
683
730
|
value: PRISMA_CONFIG_INTERNAL_BRAND,
|
|
@@ -707,7 +754,7 @@ function parsePrismaConfigInternalShape(input) {
|
|
|
707
754
|
);
|
|
708
755
|
}
|
|
709
756
|
function makePrismaConfigInternal(makeArgs) {
|
|
710
|
-
return (
|
|
757
|
+
return brandPrismaConfigInternal(makeArgs);
|
|
711
758
|
}
|
|
712
759
|
function parseDefaultExport(defaultExport) {
|
|
713
760
|
const parseResultEither = (0, import_Function.pipe)(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/config",
|
|
3
|
-
"version": "6.18.0-dev.
|
|
3
|
+
"version": "6.18.0-dev.21",
|
|
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",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"c12": "3.1.0",
|
|
16
16
|
"deepmerge-ts": "7.1.5",
|
|
17
|
-
"effect": "3.
|
|
17
|
+
"effect": "3.18.4",
|
|
18
18
|
"empathic": "2.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"vitest": "3.2.4",
|
|
22
|
-
"@prisma/driver-adapter-utils": "6.18.0-dev.
|
|
23
|
-
"@prisma/get-platform": "6.18.0-dev.
|
|
22
|
+
"@prisma/driver-adapter-utils": "6.18.0-dev.21",
|
|
23
|
+
"@prisma/get-platform": "6.18.0-dev.21"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|