| 44 | * Define the configuration for the Prisma Development Kit. |
| 45 | */ |
| 46 | export function defineConfig(configInput: PrismaConfig): PrismaConfigInternal { |
| 47 | class="cm">// First validate the experimental feature gates |
| 48 | const validationResult = validateExperimentalFeatures(configInput) |
| 49 | if (validationResult._tag === class="st">'Left') { |
| 50 | throw validationResult.left |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * We temporarily treat config as mutable, to simplify the implementation of this function. |
| 55 | */ |
| 56 | const config = defaultConfig() |
| 57 | debug(class="st">'[default]: %o', config) |
| 58 | |
| 59 | defineExperimentalConfig(config, configInput) |
| 60 | defineSchemaConfig(config, configInput) |
| 61 | defineDatasource(config, configInput) |
| 62 | defineMigrationsConfig(config, configInput) |
| 63 | defineTablesConfig(config, configInput) |
| 64 | defineEnumsConfig(config, configInput) |
| 65 | defineTypedSqlConfig(config, configInput) |
| 66 | defineViewsConfig(config, configInput) |
| 67 | defineExtensionsConfig(config, configInput) |
| 68 | |
| 69 | /** |
| 70 | * We cast the type of `config` back to its original, deeply-nested |
| 71 | * `Readonly` type |
| 72 | */ |
| 73 | return config as PrismaConfigInternal |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * `configInput.experimental` is forwarded to `config.experimental` as is. |