Skip to content

PrismaParser

reference
1 min readUpdated

Kind: Class

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

Prisma Parser implementation

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 !fileContent.trim().
  • PrismaParser stops the work with an early return when value === 'true' || value === 'false'.
  • PrismaParser stops the work with an early return when /^\d+$/.test(value).
  • PrismaParser stops the work with an early return when /^\d+\.\d+$/.test(value).

When something fails

  • PrismaParser handles failure in 2 places: it turns it into a return value in all 2.

Was this page helpful?

Download as PDF