Skip to content

PrismaParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/database-parser/src/parsers/prisma.parser.ts

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • PrismaParser stops the work with an early return when field.isList, in 2 places.
  • PrismaParser stops the work with an early return when !this.canParse(filePath).
  • PrismaParser stops the work with an early return when !field.relationName.
  • PrismaParser stops the work with an early return when field.relationFromFields && field.relationFromFields.length > 0.
  • PrismaParser stops the work with an early return when !field.default.
  • PrismaParser stops the work with an early return when typeof field.default === 'object' && field.default !== null.

When something fails

  • PrismaParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF