(defaultExport: unknown)
| 353 | } |
| 354 | |
| 355 | export function parseDefaultExport(defaultExport: unknown) { |
| 356 | const parseResultEither = pipe( |
| 357 | // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`. |
| 358 | parsePrismaConfigShape(defaultExport), |
| 359 | Either.map((config) => { |
| 360 | debug('Parsed `PrismaConfig` shape: %o', config) |
| 361 | return defineConfig(config) |
| 362 | }), |
| 363 | // Otherwise, try to parse it as a `PrismaConfigInternal` shape. |
| 364 | Either.orElse(() => parsePrismaConfigInternalShape(defaultExport)), |
| 365 | ) |
| 366 | |
| 367 | // Failure case |
| 368 | if (Either.isLeft(parseResultEither)) { |
| 369 | throw parseResultEither.left |
| 370 | } |
| 371 | |
| 372 | // Success case |
| 373 | return parseResultEither.right |
| 374 | } |
no test coverage detected