MCPcopy
hub / github.com/prisma/prisma / parseDefaultExport

Function parseDefaultExport

packages/config/src/PrismaConfig.ts:355–374  ·  view source on GitHub ↗
(defaultExport: unknown)

Source from the content-addressed store, hash-verified

353}
354
355export 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}

Callers 1

loadConfigFromFileFunction · 0.90

Calls 5

defineConfigFunction · 0.90
parsePrismaConfigShapeFunction · 0.85
debugFunction · 0.85
pipeFunction · 0.50

Tested by

no test coverage detected