@prisma-next/psl-parser 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/parser-BP2RP4rk.mjs +681 -0
- package/dist/parser-BP2RP4rk.mjs.map +1 -0
- package/dist/parser-CUqO9VeG.d.mts +7 -0
- package/dist/parser-CUqO9VeG.d.mts.map +1 -0
- package/dist/parser.d.mts +2 -0
- package/dist/parser.mjs +3 -0
- package/dist/types-QqDFOzNR.d.mts +119 -0
- package/dist/types-QqDFOzNR.d.mts.map +1 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +45 -0
- package/src/exports/index.ts +26 -0
- package/src/exports/parser.ts +1 -0
- package/src/exports/types.ts +28 -0
- package/src/parser.ts +927 -0
- package/src/types.ts +151 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-BP2RP4rk.mjs","names":["diagnostics: PslDiagnostic[]","context: ParserContext","models: PslModel[]","enums: PslEnum[]","typesBlock: PslTypesBlock | undefined","fields: PslField[]","attributes: PslModelAttribute[]","values: PslEnumValue[]","declarations: PslNamedTypeDeclaration[]","attributes: PslFieldAttribute[]","args: readonly PslAttributeArgument[]","args: PslAttributeArgument[]","quote: '\"' | \"'\" | null","parts: TopLevelSegment[]","tokens: { text: string; span: PslSpan }[]"],"sources":["../src/parser.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\nimport type {\n ParsePslDocumentInput,\n ParsePslDocumentResult,\n PslAttribute,\n PslAttributeArgument,\n PslAttributeTarget,\n PslDiagnostic,\n PslDiagnosticCode,\n PslDocumentAst,\n PslEnum,\n PslEnumValue,\n PslField,\n PslFieldAttribute,\n PslModel,\n PslModelAttribute,\n PslNamedTypeDeclaration,\n PslPosition,\n PslSpan,\n PslTypesBlock,\n} from './types';\n\nconst SCALAR_TYPES = new Set([\n 'String',\n 'Boolean',\n 'Int',\n 'BigInt',\n 'Float',\n 'Decimal',\n 'DateTime',\n 'Json',\n 'Bytes',\n]);\n\ninterface BlockBounds {\n readonly startLine: number;\n readonly endLine: number;\n readonly closed: boolean;\n}\n\ninterface ParserContext {\n readonly schema: string;\n readonly sourceId: string;\n readonly lines: readonly string[];\n readonly lineOffsets: readonly number[];\n readonly diagnostics: PslDiagnostic[];\n}\n\nexport function parsePslDocument(input: ParsePslDocumentInput): ParsePslDocumentResult {\n const normalizedSchema = input.schema.replaceAll('\\r\\n', '\\n');\n const lines = normalizedSchema.split('\\n');\n const lineOffsets = computeLineOffsets(normalizedSchema);\n const diagnostics: PslDiagnostic[] = [];\n const context: ParserContext = {\n schema: normalizedSchema,\n sourceId: input.sourceId,\n lines,\n lineOffsets,\n diagnostics,\n };\n\n const models: PslModel[] = [];\n const enums: PslEnum[] = [];\n let typesBlock: PslTypesBlock | undefined;\n\n let lineIndex = 0;\n while (lineIndex < lines.length) {\n const rawLine = lines[lineIndex] ?? '';\n const line = stripInlineComment(rawLine).trim();\n if (line.length === 0) {\n lineIndex += 1;\n continue;\n }\n\n const modelMatch = line.match(/^model\\s+([A-Za-z_]\\w*)\\s*\\{$/);\n if (modelMatch) {\n const bounds = findBlockBounds(context, lineIndex);\n const name = modelMatch[1] ?? '';\n if (name.length === 0) {\n lineIndex = bounds.endLine + 1;\n continue;\n }\n models.push(parseModelBlock(context, name, bounds));\n lineIndex = bounds.endLine + 1;\n continue;\n }\n\n const enumMatch = line.match(/^enum\\s+([A-Za-z_]\\w*)\\s*\\{$/);\n if (enumMatch) {\n const bounds = findBlockBounds(context, lineIndex);\n const name = enumMatch[1] ?? '';\n if (name.length === 0) {\n lineIndex = bounds.endLine + 1;\n continue;\n }\n enums.push(parseEnumBlock(context, name, bounds));\n lineIndex = bounds.endLine + 1;\n continue;\n }\n\n if (/^types\\s*\\{$/.test(line)) {\n const bounds = findBlockBounds(context, lineIndex);\n typesBlock = parseTypesBlock(context, bounds);\n lineIndex = bounds.endLine + 1;\n continue;\n }\n\n if (line.includes('{')) {\n const blockName = line.split(/\\s+/)[0] ?? 'block';\n pushDiagnostic(context, {\n code: 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK',\n message: `Unsupported top-level block \"${blockName}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n const bounds = findBlockBounds(context, lineIndex);\n lineIndex = bounds.endLine + 1;\n continue;\n }\n\n pushDiagnostic(context, {\n code: 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK',\n message: `Unsupported top-level declaration \"${line}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n lineIndex += 1;\n }\n\n const namedTypeNames = new Set(\n (typesBlock?.declarations ?? []).map((declaration) => declaration.name),\n );\n const modelNames = new Set(models.map((model) => model.name));\n const enumNames = new Set(enums.map((enumBlock) => enumBlock.name));\n for (const declaration of typesBlock?.declarations ?? []) {\n if (SCALAR_TYPES.has(declaration.name)) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_TYPES_MEMBER',\n message: `Named type \"${declaration.name}\" conflicts with scalar type \"${declaration.name}\"`,\n span: declaration.span,\n });\n continue;\n }\n if (modelNames.has(declaration.name)) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_TYPES_MEMBER',\n message: `Named type \"${declaration.name}\" conflicts with model name \"${declaration.name}\"`,\n span: declaration.span,\n });\n continue;\n }\n if (enumNames.has(declaration.name)) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_TYPES_MEMBER',\n message: `Named type \"${declaration.name}\" conflicts with enum name \"${declaration.name}\"`,\n span: declaration.span,\n });\n }\n }\n const normalizedModels = models.map((model) => ({\n ...model,\n fields: model.fields.map((field) => {\n if (!namedTypeNames.has(field.typeName)) {\n return field;\n }\n const hasRelationAttribute = field.attributes.some(\n (attribute) => attribute.name === 'relation',\n );\n if (\n hasRelationAttribute ||\n modelNames.has(field.typeName) ||\n enumNames.has(field.typeName) ||\n SCALAR_TYPES.has(field.typeName)\n ) {\n return field;\n }\n return {\n ...field,\n typeRef: field.typeName,\n };\n }),\n }));\n\n const ast: PslDocumentAst = {\n kind: 'document',\n sourceId: input.sourceId,\n models: normalizedModels,\n enums,\n ...ifDefined('types', typesBlock),\n span: {\n start: createPosition(context, 0, 0),\n end: createPosition(\n context,\n Math.max(lines.length - 1, 0),\n (lines[Math.max(lines.length - 1, 0)] ?? '').length,\n ),\n },\n };\n\n return {\n ast,\n diagnostics,\n ok: diagnostics.length === 0,\n };\n}\n\nfunction parseModelBlock(context: ParserContext, name: string, bounds: BlockBounds): PslModel {\n const fields: PslField[] = [];\n const attributes: PslModelAttribute[] = [];\n\n for (let lineIndex = bounds.startLine + 1; lineIndex < bounds.endLine; lineIndex += 1) {\n const raw = context.lines[lineIndex] ?? '';\n const line = stripInlineComment(raw).trim();\n if (line.length === 0) {\n continue;\n }\n\n if (line.startsWith('@@')) {\n const attribute = parseModelAttribute(context, line, lineIndex);\n if (attribute) {\n attributes.push(attribute);\n }\n continue;\n }\n\n const field = parseField(context, line, lineIndex);\n if (field) {\n fields.push(field);\n }\n }\n\n return {\n kind: 'model',\n name,\n fields,\n attributes,\n span: createLineRangeSpan(context, bounds.startLine, bounds.endLine),\n };\n}\n\nfunction parseEnumBlock(context: ParserContext, name: string, bounds: BlockBounds): PslEnum {\n const values: PslEnumValue[] = [];\n\n for (let lineIndex = bounds.startLine + 1; lineIndex < bounds.endLine; lineIndex += 1) {\n const raw = context.lines[lineIndex] ?? '';\n const line = stripInlineComment(raw).trim();\n if (line.length === 0) {\n continue;\n }\n\n const valueMatch = line.match(/^([A-Za-z_]\\w*)$/);\n if (!valueMatch) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ENUM_MEMBER',\n message: `Invalid enum value declaration \"${line}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n continue;\n }\n\n values.push({\n kind: 'enumValue',\n name: valueMatch[1] ?? '',\n span: createTrimmedLineSpan(context, lineIndex),\n });\n }\n\n return {\n kind: 'enum',\n name,\n values,\n span: createLineRangeSpan(context, bounds.startLine, bounds.endLine),\n };\n}\n\nfunction parseTypesBlock(context: ParserContext, bounds: BlockBounds): PslTypesBlock {\n const declarations: PslNamedTypeDeclaration[] = [];\n\n for (let lineIndex = bounds.startLine + 1; lineIndex < bounds.endLine; lineIndex += 1) {\n const raw = context.lines[lineIndex] ?? '';\n const lineWithoutComment = stripInlineComment(raw);\n const line = lineWithoutComment.trim();\n if (line.length === 0) {\n continue;\n }\n\n const declarationMatch = line.match(/^([A-Za-z_]\\w*)\\s*=\\s*([A-Za-z_]\\w*)(.*)$/);\n if (!declarationMatch) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_TYPES_MEMBER',\n message: `Invalid types declaration \"${line}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n continue;\n }\n\n const declarationName = declarationMatch[1] ?? '';\n const baseType = declarationMatch[2] ?? '';\n const attributePart = declarationMatch[3] ?? '';\n const trimmedStartColumn = firstNonWhitespaceColumn(raw);\n const attributeOffset = line.length - attributePart.length;\n const attributeSource = attributePart.trimStart();\n const leadingAttributeWhitespace = attributePart.length - attributeSource.length;\n const attributeParse = extractAttributeTokensWithSpans(\n context,\n lineIndex,\n attributeSource,\n trimmedStartColumn + attributeOffset + leadingAttributeWhitespace,\n );\n if (!attributeParse.ok) {\n continue;\n }\n const attributes = attributeParse.tokens\n .map((token) =>\n parseAttributeToken(context, {\n token: token.text,\n target: 'namedType',\n lineIndex,\n span: token.span,\n }),\n )\n .filter((attribute): attribute is PslAttribute => Boolean(attribute));\n\n declarations.push({\n kind: 'namedType',\n name: declarationName,\n baseType,\n attributes,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n }\n\n return {\n kind: 'types',\n declarations,\n span: createLineRangeSpan(context, bounds.startLine, bounds.endLine),\n };\n}\n\nfunction parseModelAttribute(\n context: ParserContext,\n line: string,\n lineIndex: number,\n): PslModelAttribute | undefined {\n const rawLine = context.lines[lineIndex] ?? '';\n const tokenParse = extractAttributeTokensWithSpans(\n context,\n lineIndex,\n line,\n firstNonWhitespaceColumn(rawLine),\n );\n if (!tokenParse.ok || tokenParse.tokens.length !== 1) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid model attribute syntax \"${line}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n return undefined;\n }\n const token = tokenParse.tokens[0];\n if (!token) {\n return undefined;\n }\n return parseAttributeToken(context, {\n token: token.text,\n target: 'model',\n lineIndex,\n span: token.span,\n });\n}\n\nfunction parseField(context: ParserContext, line: string, lineIndex: number): PslField | undefined {\n const fieldMatch = line.match(/^([A-Za-z_]\\w*)\\s+([A-Za-z_]\\w*(?:\\[\\])?)(\\?)?(.*)$/);\n if (!fieldMatch) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_MODEL_MEMBER',\n message: `Invalid model member declaration \"${line}\"`,\n span: createTrimmedLineSpan(context, lineIndex),\n });\n return undefined;\n }\n\n const fieldName = fieldMatch[1] ?? '';\n const rawTypeToken = fieldMatch[2] ?? '';\n const optionalMarker = fieldMatch[3] ?? '';\n const attributePart = fieldMatch[4] ?? '';\n const list = rawTypeToken.endsWith('[]');\n const typeName = list ? rawTypeToken.slice(0, -2) : rawTypeToken;\n const optional = optionalMarker === '?';\n\n const attributes: PslFieldAttribute[] = [];\n const rawLine = context.lines[lineIndex] ?? '';\n const trimmedStartColumn = firstNonWhitespaceColumn(rawLine);\n const attributeOffset = line.length - attributePart.length;\n const attributeSource = attributePart.trimStart();\n const leadingAttributeWhitespace = attributePart.length - attributeSource.length;\n const tokenParse = extractAttributeTokensWithSpans(\n context,\n lineIndex,\n attributeSource,\n trimmedStartColumn + attributeOffset + leadingAttributeWhitespace,\n );\n if (!tokenParse.ok) {\n return {\n kind: 'field',\n name: fieldName,\n typeName,\n optional,\n list,\n attributes,\n span: createTrimmedLineSpan(context, lineIndex),\n };\n }\n\n for (const token of tokenParse.tokens) {\n const parsed = parseAttributeToken(context, {\n token: token.text,\n target: 'field',\n lineIndex,\n span: token.span,\n });\n if (parsed) {\n attributes.push(parsed);\n }\n }\n\n return {\n kind: 'field',\n name: fieldName,\n typeName,\n optional,\n list,\n attributes,\n span: createTrimmedLineSpan(context, lineIndex),\n };\n}\n\nfunction parseAttributeToken(\n context: ParserContext,\n input: {\n readonly token: string;\n readonly target: PslAttributeTarget;\n readonly lineIndex: number;\n readonly span: PslSpan;\n },\n): PslAttribute | undefined {\n const expectsModelPrefix = input.target === 'model';\n if (expectsModelPrefix && !input.token.startsWith('@@')) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Model attribute \"${input.token}\" must use @@ prefix`,\n span: input.span,\n });\n return undefined;\n }\n if (!expectsModelPrefix && !input.token.startsWith('@')) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Attribute \"${input.token}\" must use @ prefix`,\n span: input.span,\n });\n return undefined;\n }\n if (!expectsModelPrefix && input.token.startsWith('@@')) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Attribute \"${input.token}\" is not valid in ${input.target} context`,\n span: input.span,\n });\n return undefined;\n }\n\n const rawBody = expectsModelPrefix ? input.token.slice(2) : input.token.slice(1);\n const openParen = rawBody.indexOf('(');\n const closeParen = rawBody.lastIndexOf(')');\n const hasArgs = openParen >= 0 || closeParen >= 0;\n if ((openParen >= 0 && closeParen === -1) || (openParen === -1 && closeParen >= 0)) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid attribute syntax \"${input.token}\"`,\n span: input.span,\n });\n return undefined;\n }\n\n const name = (openParen >= 0 ? rawBody.slice(0, openParen) : rawBody).trim();\n if (!/^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)*$/.test(name)) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid attribute name \"${name || input.token}\"`,\n span: input.span,\n });\n return undefined;\n }\n\n let args: readonly PslAttributeArgument[] = [];\n if (hasArgs && openParen >= 0 && closeParen >= openParen) {\n if (closeParen !== rawBody.length - 1) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid trailing syntax in attribute \"${input.token}\"`,\n span: input.span,\n });\n return undefined;\n }\n const argsRaw = rawBody.slice(openParen + 1, closeParen);\n const parsedArgs = parseAttributeArguments(context, {\n argsRaw,\n argsOffset: input.span.start.column - 1 + (expectsModelPrefix ? 2 : 1) + openParen + 1,\n lineIndex: input.lineIndex,\n token: input.token,\n span: input.span,\n });\n if (!parsedArgs) {\n return undefined;\n }\n args = parsedArgs;\n }\n\n return {\n kind: 'attribute',\n target: input.target,\n name,\n args,\n span: input.span,\n };\n}\n\nfunction parseAttributeArguments(\n context: ParserContext,\n input: {\n readonly argsRaw: string;\n readonly argsOffset: number;\n readonly lineIndex: number;\n readonly token: string;\n readonly span: PslSpan;\n },\n): readonly PslAttributeArgument[] | undefined {\n const trimmed = input.argsRaw.trim();\n if (trimmed.length === 0) {\n return [];\n }\n\n const parts = splitTopLevelSegments(input.argsRaw, ',');\n const args: PslAttributeArgument[] = [];\n\n for (const part of parts) {\n const original = part.value;\n const trimmedPart = original.trim();\n if (trimmedPart.length === 0) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid empty argument in attribute \"${input.token}\"`,\n span: input.span,\n });\n return undefined;\n }\n\n const leadingWhitespace = original.length - original.trimStart().length;\n const partStart = input.argsOffset + part.start + leadingWhitespace;\n const partEnd = partStart + trimmedPart.length;\n const partSpan = createInlineSpan(context, input.lineIndex, partStart, partEnd);\n\n const namedSplit = splitTopLevelSegments(trimmedPart, ':');\n if (namedSplit.length > 1) {\n const first = namedSplit[0];\n if (!first) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid named argument syntax \"${trimmedPart}\"`,\n span: partSpan,\n });\n return undefined;\n }\n const name = first.value.trim();\n const rawValue = trimmedPart.slice(first.end + 1).trim();\n if (!name || rawValue.length === 0) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid named argument syntax \"${trimmedPart}\"`,\n span: partSpan,\n });\n return undefined;\n }\n args.push({\n kind: 'named',\n name,\n value: normalizeAttributeArgumentValue(rawValue),\n span: partSpan,\n });\n continue;\n }\n\n args.push({\n kind: 'positional',\n value: normalizeAttributeArgumentValue(trimmedPart),\n span: partSpan,\n });\n }\n\n return args;\n}\n\nfunction normalizeAttributeArgumentValue(value: string): string {\n return value.trim();\n}\n\nfunction findBlockBounds(context: ParserContext, startLine: number): BlockBounds {\n let depth = 0;\n\n for (let lineIndex = startLine; lineIndex < context.lines.length; lineIndex += 1) {\n const line = stripInlineComment(context.lines[lineIndex] ?? '');\n let quote: '\"' | \"'\" | null = null;\n let previousCharacter = '';\n for (const character of line) {\n if (quote) {\n if (character === quote && previousCharacter !== '\\\\') {\n quote = null;\n }\n previousCharacter = character;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n previousCharacter = character;\n continue;\n }\n\n if (character === '{') {\n depth += 1;\n }\n if (character === '}') {\n depth -= 1;\n if (depth === 0) {\n return { startLine, endLine: lineIndex, closed: true };\n }\n }\n previousCharacter = character;\n }\n }\n\n pushDiagnostic(context, {\n code: 'PSL_UNTERMINATED_BLOCK',\n message: 'Unterminated block declaration',\n span: createTrimmedLineSpan(context, startLine),\n });\n return {\n startLine,\n endLine: context.lines.length - 1,\n closed: false,\n };\n}\n\ninterface TopLevelSegment {\n readonly value: string;\n readonly start: number;\n readonly end: number;\n}\n\nfunction splitTopLevelSegments(value: string, separator: ',' | ':'): TopLevelSegment[] {\n const parts: TopLevelSegment[] = [];\n let depthParen = 0;\n let depthBracket = 0;\n let quote: '\"' | \"'\" | null = null;\n let start = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index] ?? '';\n if (quote) {\n if (character === quote && value[index - 1] !== '\\\\') {\n quote = null;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n\n if (character === '(') {\n depthParen += 1;\n continue;\n }\n if (character === ')') {\n depthParen = Math.max(0, depthParen - 1);\n continue;\n }\n if (character === '[') {\n depthBracket += 1;\n continue;\n }\n if (character === ']') {\n depthBracket = Math.max(0, depthBracket - 1);\n continue;\n }\n\n if (character === separator && depthParen === 0 && depthBracket === 0) {\n parts.push({\n value: value.slice(start, index),\n start,\n end: index,\n });\n start = index + 1;\n }\n }\n\n parts.push({\n value: value.slice(start),\n start,\n end: value.length,\n });\n return parts;\n}\n\nfunction extractAttributeTokensWithSpans(\n context: ParserContext,\n lineIndex: number,\n value: string,\n startColumn: number,\n): { readonly ok: boolean; readonly tokens: readonly { text: string; span: PslSpan }[] } {\n const tokens: { text: string; span: PslSpan }[] = [];\n let index = 0;\n while (index < value.length) {\n while (index < value.length && /\\s/.test(value[index] ?? '')) {\n index += 1;\n }\n if (index >= value.length) {\n break;\n }\n\n if (value[index] !== '@') {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid attribute syntax \"${value.trim()}\"`,\n span: createInlineSpan(context, lineIndex, startColumn + index, startColumn + value.length),\n });\n return { ok: false, tokens };\n }\n\n const start = index;\n index += 1;\n if (value[index] === '@') {\n index += 1;\n }\n\n const nameStart = index;\n while (index < value.length && /[A-Za-z0-9_.-]/.test(value[index] ?? '')) {\n index += 1;\n }\n\n if (index === nameStart) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid attribute syntax \"${value.slice(start).trim()}\"`,\n span: createInlineSpan(context, lineIndex, startColumn + start, startColumn + value.length),\n });\n return { ok: false, tokens };\n }\n\n if (value[index] === '(') {\n let depth = 0;\n let quote: '\"' | \"'\" | null = null;\n while (index < value.length) {\n const char = value[index] ?? '';\n if (quote) {\n if (char === quote && value[index - 1] !== '\\\\') {\n quote = null;\n }\n index += 1;\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n quote = char;\n index += 1;\n continue;\n }\n\n if (char === '(') {\n depth += 1;\n } else if (char === ')') {\n depth -= 1;\n if (depth === 0) {\n index += 1;\n break;\n }\n }\n index += 1;\n }\n if (depth !== 0) {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Unterminated attribute argument list in \"${value.slice(start).trim()}\"`,\n span: createInlineSpan(\n context,\n lineIndex,\n startColumn + start,\n startColumn + value.length,\n ),\n });\n return { ok: false, tokens };\n }\n }\n\n const tokenText = value.slice(start, index).trim();\n tokens.push({\n text: tokenText,\n span: createInlineSpan(context, lineIndex, startColumn + start, startColumn + index),\n });\n\n while (index < value.length && /\\s/.test(value[index] ?? '')) {\n index += 1;\n }\n\n if (index < value.length && value[index] !== '@') {\n break;\n }\n }\n\n if (index < value.length && value[index] !== '@') {\n pushDiagnostic(context, {\n code: 'PSL_INVALID_ATTRIBUTE_SYNTAX',\n message: `Invalid attribute syntax \"${value.trim()}\"`,\n span: createInlineSpan(context, lineIndex, startColumn + index, startColumn + value.length),\n });\n return { ok: false, tokens };\n }\n\n return { ok: true, tokens };\n}\n\nfunction stripInlineComment(line: string): string {\n let quote: '\"' | \"'\" | null = null;\n for (let index = 0; index < line.length - 1; index += 1) {\n const current = line[index] ?? '';\n const next = line[index + 1] ?? '';\n\n if (quote) {\n if (current === quote && line[index - 1] !== '\\\\') {\n quote = null;\n }\n continue;\n }\n\n if (current === '\"' || current === \"'\") {\n quote = current;\n continue;\n }\n\n if (current === '/' && next === '/') {\n return line.slice(0, index);\n }\n }\n\n return line;\n}\n\nfunction computeLineOffsets(schema: string): number[] {\n const offsets = [0];\n for (let index = 0; index < schema.length; index += 1) {\n if (schema[index] === '\\n') {\n offsets.push(index + 1);\n }\n }\n return offsets;\n}\n\nfunction firstNonWhitespaceColumn(line: string): number {\n const first = line.search(/\\S/);\n return first === -1 ? 0 : first;\n}\n\nfunction createInlineSpan(\n context: ParserContext,\n lineIndex: number,\n startColumn: number,\n endColumn: number,\n): PslSpan {\n return {\n start: createPosition(context, lineIndex, startColumn),\n end: createPosition(context, lineIndex, endColumn),\n };\n}\n\nfunction createTrimmedLineSpan(context: ParserContext, lineIndex: number): PslSpan {\n const line = context.lines[lineIndex] ?? '';\n const startColumn = firstNonWhitespaceColumn(line);\n return {\n start: createPosition(context, lineIndex, startColumn),\n end: createPosition(context, lineIndex, line.length),\n };\n}\n\nfunction createLineRangeSpan(context: ParserContext, startLine: number, endLine: number): PslSpan {\n const startLineText = context.lines[startLine] ?? '';\n const endLineText = context.lines[endLine] ?? '';\n const startColumn = firstNonWhitespaceColumn(startLineText);\n return {\n start: createPosition(context, startLine, startColumn),\n end: createPosition(context, endLine, endLineText.length),\n };\n}\n\nfunction createPosition(\n context: ParserContext,\n lineIndex: number,\n columnIndex: number,\n): PslPosition {\n const clampedLineIndex = Math.max(0, Math.min(lineIndex, context.lineOffsets.length - 1));\n const lineText = context.lines[clampedLineIndex] ?? '';\n const clampedColumnIndex = Math.max(0, Math.min(columnIndex, lineText.length));\n return {\n offset: (context.lineOffsets[clampedLineIndex] ?? 0) + clampedColumnIndex,\n line: clampedLineIndex + 1,\n column: clampedColumnIndex + 1,\n };\n}\n\nfunction pushDiagnostic(\n context: ParserContext,\n diagnostic: Omit<PslDiagnostic, 'sourceId'> & { readonly code: PslDiagnosticCode },\n): void {\n context.diagnostics.push({\n ...diagnostic,\n sourceId: context.sourceId,\n });\n}\n"],"mappings":";;;AAsBA,MAAM,eAAe,IAAI,IAAI;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAgBF,SAAgB,iBAAiB,OAAsD;CACrF,MAAM,mBAAmB,MAAM,OAAO,WAAW,QAAQ,KAAK;CAC9D,M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entInput } from "./types-QqDFOzNR.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/parser.d.ts
|
|
4
|
+
declare function parsePslDocument(input: ParsePslDocumentInput): ParsePslDocumentResult;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { parsePslDocument as t };
|
|
7
|
+
//# sourceMappingURL=parser-CUqO9VeG.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-CUqO9VeG.d.mts","names":[],"sources":["../src/parser.ts"],"sourcesContent":[],"mappings":";;;iBAgDgB,gBAAA,QAAwB,wBAAwB"}
|
package/dist/parser.mjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
interface PslPosition {
|
|
3
|
+
readonly offset: number;
|
|
4
|
+
readonly line: number;
|
|
5
|
+
readonly column: number;
|
|
6
|
+
}
|
|
7
|
+
interface PslSpan {
|
|
8
|
+
readonly start: PslPosition;
|
|
9
|
+
readonly end: PslPosition;
|
|
10
|
+
}
|
|
11
|
+
type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER';
|
|
12
|
+
interface PslDiagnostic {
|
|
13
|
+
readonly code: PslDiagnosticCode;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly sourceId: string;
|
|
16
|
+
readonly span: PslSpan;
|
|
17
|
+
}
|
|
18
|
+
interface PslDefaultFunctionValue {
|
|
19
|
+
readonly kind: 'function';
|
|
20
|
+
readonly name: 'autoincrement' | 'now';
|
|
21
|
+
}
|
|
22
|
+
interface PslDefaultLiteralValue {
|
|
23
|
+
readonly kind: 'literal';
|
|
24
|
+
readonly value: string | number | boolean;
|
|
25
|
+
}
|
|
26
|
+
type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
|
|
27
|
+
type PslAttributeTarget = 'field' | 'model' | 'namedType';
|
|
28
|
+
interface PslAttributePositionalArgument {
|
|
29
|
+
readonly kind: 'positional';
|
|
30
|
+
readonly value: string;
|
|
31
|
+
readonly span: PslSpan;
|
|
32
|
+
}
|
|
33
|
+
interface PslAttributeNamedArgument {
|
|
34
|
+
readonly kind: 'named';
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly value: string;
|
|
37
|
+
readonly span: PslSpan;
|
|
38
|
+
}
|
|
39
|
+
type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
|
|
40
|
+
interface PslAttribute {
|
|
41
|
+
readonly kind: 'attribute';
|
|
42
|
+
readonly target: PslAttributeTarget;
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly args: readonly PslAttributeArgument[];
|
|
45
|
+
readonly span: PslSpan;
|
|
46
|
+
}
|
|
47
|
+
type PslReferentialAction = string;
|
|
48
|
+
type PslFieldAttribute = PslAttribute;
|
|
49
|
+
interface PslField {
|
|
50
|
+
readonly kind: 'field';
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly typeName: string;
|
|
53
|
+
readonly optional: boolean;
|
|
54
|
+
readonly list: boolean;
|
|
55
|
+
readonly typeRef?: string;
|
|
56
|
+
readonly attributes: readonly PslFieldAttribute[];
|
|
57
|
+
readonly span: PslSpan;
|
|
58
|
+
}
|
|
59
|
+
interface PslUniqueConstraint {
|
|
60
|
+
readonly kind: 'unique';
|
|
61
|
+
readonly fields: readonly string[];
|
|
62
|
+
readonly span: PslSpan;
|
|
63
|
+
}
|
|
64
|
+
interface PslIndexConstraint {
|
|
65
|
+
readonly kind: 'index';
|
|
66
|
+
readonly fields: readonly string[];
|
|
67
|
+
readonly span: PslSpan;
|
|
68
|
+
}
|
|
69
|
+
type PslModelAttribute = PslAttribute;
|
|
70
|
+
interface PslModel {
|
|
71
|
+
readonly kind: 'model';
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly fields: readonly PslField[];
|
|
74
|
+
readonly attributes: readonly PslModelAttribute[];
|
|
75
|
+
readonly span: PslSpan;
|
|
76
|
+
}
|
|
77
|
+
interface PslEnumValue {
|
|
78
|
+
readonly kind: 'enumValue';
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly span: PslSpan;
|
|
81
|
+
}
|
|
82
|
+
interface PslEnum {
|
|
83
|
+
readonly kind: 'enum';
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly values: readonly PslEnumValue[];
|
|
86
|
+
readonly span: PslSpan;
|
|
87
|
+
}
|
|
88
|
+
interface PslNamedTypeDeclaration {
|
|
89
|
+
readonly kind: 'namedType';
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly baseType: string;
|
|
92
|
+
readonly attributes: readonly PslAttribute[];
|
|
93
|
+
readonly span: PslSpan;
|
|
94
|
+
}
|
|
95
|
+
interface PslTypesBlock {
|
|
96
|
+
readonly kind: 'types';
|
|
97
|
+
readonly declarations: readonly PslNamedTypeDeclaration[];
|
|
98
|
+
readonly span: PslSpan;
|
|
99
|
+
}
|
|
100
|
+
interface PslDocumentAst {
|
|
101
|
+
readonly kind: 'document';
|
|
102
|
+
readonly sourceId: string;
|
|
103
|
+
readonly models: readonly PslModel[];
|
|
104
|
+
readonly enums: readonly PslEnum[];
|
|
105
|
+
readonly types?: PslTypesBlock;
|
|
106
|
+
readonly span: PslSpan;
|
|
107
|
+
}
|
|
108
|
+
interface ParsePslDocumentInput {
|
|
109
|
+
readonly schema: string;
|
|
110
|
+
readonly sourceId: string;
|
|
111
|
+
}
|
|
112
|
+
interface ParsePslDocumentResult {
|
|
113
|
+
readonly ast: PslDocumentAst;
|
|
114
|
+
readonly diagnostics: readonly PslDiagnostic[];
|
|
115
|
+
readonly ok: boolean;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { PslReferentialAction as C, PslUniqueConstraint as E, PslPosition as S, PslTypesBlock as T, PslFieldAttribute as _, PslAttributeNamedArgument as a, PslModelAttribute as b, PslDefaultFunctionValue as c, PslDiagnostic as d, PslDiagnosticCode as f, PslField as g, PslEnumValue as h, PslAttributeArgument as i, PslDefaultLiteralValue as l, PslEnum as m, ParsePslDocumentResult as n, PslAttributePositionalArgument as o, PslDocumentAst as p, PslAttribute as r, PslAttributeTarget as s, ParsePslDocumentInput as t, PslDefaultValue as u, PslIndexConstraint as v, PslSpan as w, PslNamedTypeDeclaration as x, PslModel as y };
|
|
119
|
+
//# sourceMappingURL=types-QqDFOzNR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-QqDFOzNR.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";UAAiB,WAAA;EAAA,SAAA,MAAW,EAAA,MAAA;EAMX,SAAA,IAAO,EAAA,MACN;EAIN,SAAA,MAAA,EAAA,MAAiB;AAa7B;AAOiB,UAzBA,OAAA,CAyBA;EAKA,SAAA,KAAA,EA7BC,WA6BqB;EAK3B,SAAA,GAAA,EAjCI,WAiCW;AAE3B;AAEiB,KAlCL,iBAAA,GAkCK,wBAGO,GAAA,iCAAA,GAAA,8BAAA,GAAA,0BAAA,GAAA,iCAAA,GAAA,iCAAA,GAAA,gCAAA,GAAA,gCAAA,GAAA,2BAAA,GAAA,yBAAA,GAAA,0BAAA;AAGP,UA3BA,aAAA,CA2BA;EAOL,SAAA,IAAA,EAjCK,iBAiCe;EAEf,SAAA,OAAY,EAAA,MAAA;EAEV,SAAA,QAAA,EAAA,MAAA;EAEO,SAAA,IAAA,EApCT,OAoCS;;AACF,UAlCP,uBAAA,CAkCO;EAGZ,SAAA,IAAA,EAAA,UAAoB;EAEpB,SAAA,IAAA,EAAA,eAAiB,GAAG,KAAA;AAEhC;AAWiB,UA/CA,sBAAA,CAkDA;EAGA,SAAA,IAAA,EAAA,SAAkB;EAMvB,SAAA,KAAA,EAAA,MAAiB,GAAA,MAAA,GAAG,OAAA;AAEhC;AAG4B,KA3DhB,eAAA,GAAkB,uBA2DF,GA3D4B,sBA2D5B;AACI,KA1DpB,kBAAA,GA0DoB,OAAA,GAAA,OAAA,GAAA,WAAA;AACf,UAzDA,8BAAA,CAyDA;EAAO,SAAA,IAAA,EAAA,YAAA;EAGP,SAAA,KAAA,EAAY,MAAA;EAMZ,SAAA,IAAO,EA/DP,OAkEW;AAI5B;AAQiB,UA3EA,yBAAA,CA6EiB;EAIjB,SAAA,IAAA,EAAA,OAAc;EAGH,SAAA,IAAA,EAAA,MAAA;EACD,SAAA,KAAA,EAAA,MAAA;EACR,SAAA,IAAA,EAlFF,OAkFE;;AACK,KAhFZ,oBAAA,GAAuB,8BAgFX,GAhF4C,yBAgF5C;AAGP,UAjFA,YAAA,CAiFqB;EAKrB,SAAA,IAAA,EAAA,WAAsB;mBApFpB;;0BAEO;iBACT;;KAGL,oBAAA;KAEA,iBAAA,GAAoB;UAEf,QAAA;;;;;;;gCAOe;iBACf;;UAGA,mBAAA;;;iBAGA;;UAGA,kBAAA;;;iBAGA;;KAGL,iBAAA,GAAoB;UAEf,QAAA;;;4BAGW;gCACI;iBACf;;UAGA,YAAA;;;iBAGA;;UAGA,OAAA;;;4BAGW;iBACX;;UAGA,uBAAA;;;;gCAIe;iBACf;;UAGA,aAAA;;kCAEiB;iBACjB;;UAGA,cAAA;;;4BAGW;2BACD;mBACR;iBACF;;UAGA,qBAAA;;;;UAKA,sBAAA;gBACD;iCACiB"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as PslReferentialAction, E as PslUniqueConstraint, S as PslPosition, T as PslTypesBlock, _ as PslFieldAttribute, a as PslAttributeNamedArgument, b as PslModelAttribute, c as PslDefaultFunctionValue, d as PslDiagnostic, f as PslDiagnosticCode, g as PslField, h as PslEnumValue, i as PslAttributeArgument, l as PslDefaultLiteralValue, m as PslEnum, n as ParsePslDocumentResult, o as PslAttributePositionalArgument, p as PslDocumentAst, r as PslAttribute, s as PslAttributeTarget, t as ParsePslDocumentInput, u as PslDefaultValue, v as PslIndexConstraint, w as PslSpan, x as PslNamedTypeDeclaration, y as PslModel } from "./types-QqDFOzNR.mjs";
|
|
2
|
+
export { type ParsePslDocumentInput, type ParsePslDocumentResult, type PslAttribute, type PslAttributeArgument, type PslAttributeNamedArgument, type PslAttributePositionalArgument, type PslAttributeTarget, type PslDefaultFunctionValue, type PslDefaultLiteralValue, type PslDefaultValue, type PslDiagnostic, type PslDiagnosticCode, type PslDocumentAst, type PslEnum, type PslEnumValue, type PslField, type PslFieldAttribute, type PslIndexConstraint, type PslModel, type PslModelAttribute, type PslNamedTypeDeclaration, type PslPosition, type PslReferentialAction, type PslSpan, type PslTypesBlock, type PslUniqueConstraint };
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma-next/psl-parser",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"description": "Reusable parser for Prisma Schema Language (PSL)",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsdown",
|
|
9
|
+
"test": "vitest run",
|
|
10
|
+
"test:coverage": "vitest run --coverage",
|
|
11
|
+
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
12
|
+
"lint": "biome check . --error-on-warnings",
|
|
13
|
+
"lint:fix": "biome check --write .",
|
|
14
|
+
"lint:fix:unsafe": "biome check --write --unsafe .",
|
|
15
|
+
"clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@prisma-next/utils": "workspace:*"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@prisma-next/tsconfig": "workspace:*",
|
|
22
|
+
"@prisma-next/tsdown": "workspace:*",
|
|
23
|
+
"tsdown": "catalog:",
|
|
24
|
+
"typescript": "catalog:",
|
|
25
|
+
"vitest": "catalog:"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": "./dist/index.mjs",
|
|
33
|
+
"./parser": "./dist/parser.mjs",
|
|
34
|
+
"./types": "./dist/types.mjs",
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/index.mjs",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/prisma/prisma-next.git",
|
|
43
|
+
"directory": "packages/1-framework/2-authoring/psl-parser"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { parsePslDocument } from '../parser';
|
|
2
|
+
export type {
|
|
3
|
+
ParsePslDocumentInput,
|
|
4
|
+
ParsePslDocumentResult,
|
|
5
|
+
PslAttribute,
|
|
6
|
+
PslAttributeArgument,
|
|
7
|
+
PslAttributeNamedArgument,
|
|
8
|
+
PslAttributePositionalArgument,
|
|
9
|
+
PslAttributeTarget,
|
|
10
|
+
PslDefaultFunctionValue,
|
|
11
|
+
PslDefaultLiteralValue,
|
|
12
|
+
PslDefaultValue,
|
|
13
|
+
PslDiagnostic,
|
|
14
|
+
PslDiagnosticCode,
|
|
15
|
+
PslDocumentAst,
|
|
16
|
+
PslEnum,
|
|
17
|
+
PslEnumValue,
|
|
18
|
+
PslField,
|
|
19
|
+
PslFieldAttribute,
|
|
20
|
+
PslModel,
|
|
21
|
+
PslModelAttribute,
|
|
22
|
+
PslNamedTypeDeclaration,
|
|
23
|
+
PslPosition,
|
|
24
|
+
PslSpan,
|
|
25
|
+
PslTypesBlock,
|
|
26
|
+
} from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parsePslDocument } from '../parser';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ParsePslDocumentInput,
|
|
3
|
+
ParsePslDocumentResult,
|
|
4
|
+
PslAttribute,
|
|
5
|
+
PslAttributeArgument,
|
|
6
|
+
PslAttributeNamedArgument,
|
|
7
|
+
PslAttributePositionalArgument,
|
|
8
|
+
PslAttributeTarget,
|
|
9
|
+
PslDefaultFunctionValue,
|
|
10
|
+
PslDefaultLiteralValue,
|
|
11
|
+
PslDefaultValue,
|
|
12
|
+
PslDiagnostic,
|
|
13
|
+
PslDiagnosticCode,
|
|
14
|
+
PslDocumentAst,
|
|
15
|
+
PslEnum,
|
|
16
|
+
PslEnumValue,
|
|
17
|
+
PslField,
|
|
18
|
+
PslFieldAttribute,
|
|
19
|
+
PslIndexConstraint,
|
|
20
|
+
PslModel,
|
|
21
|
+
PslModelAttribute,
|
|
22
|
+
PslNamedTypeDeclaration,
|
|
23
|
+
PslPosition,
|
|
24
|
+
PslReferentialAction,
|
|
25
|
+
PslSpan,
|
|
26
|
+
PslTypesBlock,
|
|
27
|
+
PslUniqueConstraint,
|
|
28
|
+
} from '../types';
|