@zenstackhq/language 3.0.0-alpha.2 → 3.0.0-alpha.20
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/dist/ast.cjs +97 -158
- package/dist/ast.cjs.map +1 -1
- package/dist/ast.d.cts +99 -133
- package/dist/ast.d.ts +99 -133
- package/dist/ast.js +81 -146
- package/dist/ast.js.map +1 -1
- package/dist/index.cjs +755 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +716 -652
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +1528 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +94 -0
- package/dist/utils.d.ts +94 -0
- package/dist/utils.js +1453 -0
- package/dist/utils.js.map +1 -0
- package/package.json +20 -9
- package/res/stdlib.zmodel +52 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/constants.ts","../src/generated/ast.ts"],"sourcesContent":["import { invariant } from '@zenstackhq/common-helpers';\nimport { AstUtils, URI, type AstNode, type LangiumDocument, type LangiumDocuments, type Reference } from 'langium';\nimport fs from 'node:fs';\nimport path from 'path';\nimport { STD_LIB_MODULE_NAME, type ExpressionContext } from './constants';\nimport {\n BinaryExpr,\n ConfigExpr,\n isArrayExpr,\n isBinaryExpr,\n isConfigArrayExpr,\n isDataField,\n isDataModel,\n isEnumField,\n isExpression,\n isInvocationExpr,\n isLiteralExpr,\n isMemberAccessExpr,\n isModel,\n isObjectExpr,\n isReferenceExpr,\n isStringLiteral,\n isTypeDef,\n Model,\n ModelImport,\n ReferenceExpr,\n type Attribute,\n type AttributeParam,\n type BuiltinType,\n type DataField,\n type DataFieldAttribute,\n type DataModel,\n type DataModelAttribute,\n type Enum,\n type EnumField,\n type Expression,\n type ExpressionType,\n type FunctionDecl,\n type TypeDef,\n} from './generated/ast';\n\nexport type AttributeTarget =\n | DataModel\n | TypeDef\n | DataField\n | Enum\n | EnumField\n | FunctionDecl\n | Attribute\n | AttributeParam;\n\nexport function hasAttribute(decl: AttributeTarget, name: string) {\n return !!getAttribute(decl, name);\n}\n\nexport function getAttribute(decl: AttributeTarget, name: string) {\n return (decl.attributes as (DataModelAttribute | DataFieldAttribute)[]).find((attr) => attr.decl.$refText === name);\n}\n\nexport function isFromStdlib(node: AstNode) {\n const model = AstUtils.getContainerOfType(node, isModel);\n return !!model && !!model.$document && model.$document.uri.path.endsWith(STD_LIB_MODULE_NAME);\n}\n\nexport function isAuthInvocation(node: AstNode) {\n return isInvocationExpr(node) && node.function.ref?.name === 'auth' && isFromStdlib(node.function.ref);\n}\n\n/**\n * Try getting string value from a potential string literal expression\n */\nexport function getStringLiteral(node: AstNode | undefined): string | undefined {\n return isStringLiteral(node) ? node.value : undefined;\n}\n\nconst isoDateTimeRegex = /^\\d{4}(-\\d\\d(-\\d\\d(T\\d\\d:\\d\\d(:\\d\\d)?(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?)?)?)?$/i;\n\n/**\n * Determines if the given sourceType is assignable to a destination of destType\n */\nexport function typeAssignable(destType: ExpressionType, sourceType: ExpressionType, sourceExpr?: Expression): boolean {\n // implicit conversion from ISO datetime string to datetime\n if (destType === 'DateTime' && sourceType === 'String' && sourceExpr && isStringLiteral(sourceExpr)) {\n const literal = getStringLiteral(sourceExpr);\n if (literal && isoDateTimeRegex.test(literal)) {\n // implicitly convert to DateTime\n sourceType = 'DateTime';\n }\n }\n\n switch (destType) {\n case 'Any':\n return true;\n case 'Float':\n return sourceType === 'Any' || sourceType === 'Int' || sourceType === 'Float';\n default:\n return sourceType === 'Any' || sourceType === destType;\n }\n}\n\n/**\n * Maps a ZModel builtin type to expression type\n */\nexport function mapBuiltinTypeToExpressionType(\n type: BuiltinType | 'Any' | 'Object' | 'Null' | 'Unsupported',\n): ExpressionType | 'Any' {\n switch (type) {\n case 'Any':\n case 'Boolean':\n case 'String':\n case 'DateTime':\n case 'Int':\n case 'Float':\n case 'Null':\n return type;\n case 'BigInt':\n return 'Int';\n case 'Decimal':\n return 'Float';\n case 'Json':\n case 'Bytes':\n return 'Any';\n case 'Object':\n return 'Object';\n case 'Unsupported':\n return 'Unsupported';\n }\n}\n\nexport function isAuthOrAuthMemberAccess(expr: Expression): boolean {\n return isAuthInvocation(expr) || (isMemberAccessExpr(expr) && isAuthOrAuthMemberAccess(expr.operand));\n}\n\nexport function isEnumFieldReference(node: AstNode): node is ReferenceExpr {\n return isReferenceExpr(node) && isEnumField(node.target.ref);\n}\n\nexport function isDataFieldReference(node: AstNode): node is ReferenceExpr {\n return isReferenceExpr(node) && isDataField(node.target.ref);\n}\n\n/**\n * Returns if the given field is a relation field.\n */\nexport function isRelationshipField(field: DataField) {\n return isDataModel(field.type.reference?.ref);\n}\n\nexport function isFutureExpr(node: AstNode) {\n return isInvocationExpr(node) && node.function.ref?.name === 'future' && isFromStdlib(node.function.ref);\n}\n\nexport function isDelegateModel(node: AstNode) {\n return isDataModel(node) && hasAttribute(node, '@@delegate');\n}\n\nexport function resolved<T extends AstNode>(ref: Reference<T>): T {\n if (!ref.ref) {\n throw new Error(`Reference not resolved: ${ref.$refText}`);\n }\n return ref.ref;\n}\n\nexport function getRecursiveBases(\n decl: DataModel | TypeDef,\n includeDelegate = true,\n seen = new Set<DataModel | TypeDef>(),\n): (TypeDef | DataModel)[] {\n const result: (TypeDef | DataModel)[] = [];\n if (seen.has(decl)) {\n return result;\n }\n seen.add(decl);\n decl.mixins.forEach((mixin) => {\n const baseDecl = mixin.ref;\n if (baseDecl) {\n if (!includeDelegate && isDelegateModel(baseDecl)) {\n return;\n }\n result.push(baseDecl);\n result.push(...getRecursiveBases(baseDecl, includeDelegate, seen));\n }\n });\n return result;\n}\n\n/**\n * Gets `@@id` fields declared at the data model level (including search in base models)\n */\nexport function getModelIdFields(model: DataModel) {\n const modelsToCheck = [model, ...getRecursiveBases(model)];\n\n for (const modelToCheck of modelsToCheck) {\n const allAttributes = getAllAttributes(modelToCheck);\n const idAttr = allAttributes.find((attr) => attr.decl.$refText === '@@id');\n if (!idAttr) {\n continue;\n }\n const fieldsArg = idAttr.args.find((a) => a.$resolvedParam?.name === 'fields');\n if (!fieldsArg || !isArrayExpr(fieldsArg.value)) {\n continue;\n }\n\n return fieldsArg.value.items\n .filter((item): item is ReferenceExpr => isReferenceExpr(item))\n .map((item) => resolved(item.target) as DataField);\n }\n\n return [];\n}\n\n/**\n * Gets `@@unique` fields declared at the data model level (including search in base models)\n */\nexport function getModelUniqueFields(model: DataModel) {\n const modelsToCheck = [model, ...getRecursiveBases(model)];\n\n for (const modelToCheck of modelsToCheck) {\n const allAttributes = getAllAttributes(modelToCheck);\n const uniqueAttr = allAttributes.find((attr) => attr.decl.$refText === '@@unique');\n if (!uniqueAttr) {\n continue;\n }\n const fieldsArg = uniqueAttr.args.find((a) => a.$resolvedParam?.name === 'fields');\n if (!fieldsArg || !isArrayExpr(fieldsArg.value)) {\n continue;\n }\n\n return fieldsArg.value.items\n .filter((item): item is ReferenceExpr => isReferenceExpr(item))\n .map((item) => resolved(item.target) as DataField);\n }\n\n return [];\n}\n\n/**\n * Gets lists of unique fields declared at the data model level\n *\n * TODO: merge this with {@link getModelUniqueFields}\n */\nexport function getUniqueFields(model: DataModel) {\n const uniqueAttrs = model.attributes.filter(\n (attr) => attr.decl.ref?.name === '@@unique' || attr.decl.ref?.name === '@@id',\n );\n return uniqueAttrs.map((uniqueAttr) => {\n const fieldsArg = uniqueAttr.args.find((a) => a.$resolvedParam?.name === 'fields');\n if (!fieldsArg || !isArrayExpr(fieldsArg.value)) {\n return [];\n }\n\n return fieldsArg.value.items\n .filter((item): item is ReferenceExpr => isReferenceExpr(item))\n .map((item) => resolved(item.target) as DataField);\n });\n}\n\nexport function findUpAst(node: AstNode, predicate: (node: AstNode) => boolean): AstNode | undefined {\n let curr: AstNode | undefined = node;\n while (curr) {\n if (predicate(curr)) {\n return curr;\n }\n curr = curr.$container;\n }\n return undefined;\n}\n\nexport function getLiteral<T extends string | number | boolean | any = any>(\n expr: Expression | ConfigExpr | undefined,\n): T | undefined {\n switch (expr?.$type) {\n case 'ObjectExpr':\n return getObjectLiteral<T>(expr);\n case 'StringLiteral':\n case 'BooleanLiteral':\n return expr.value as T;\n case 'NumberLiteral':\n return parseFloat(expr.value) as T;\n default:\n return undefined;\n }\n}\n\nexport function getObjectLiteral<T>(expr: Expression | ConfigExpr | undefined): T | undefined {\n if (!expr || !isObjectExpr(expr)) {\n return undefined;\n }\n const result: Record<string, unknown> = {};\n for (const field of expr.fields) {\n let fieldValue: unknown;\n if (isLiteralExpr(field.value)) {\n fieldValue = getLiteral(field.value);\n } else if (isArrayExpr(field.value)) {\n fieldValue = getLiteralArray(field.value);\n } else if (isObjectExpr(field.value)) {\n fieldValue = getObjectLiteral(field.value);\n }\n if (fieldValue === undefined) {\n return undefined;\n } else {\n result[field.name] = fieldValue;\n }\n }\n return result as T;\n}\n\nexport function getLiteralArray<T extends string | number | boolean | any = any>(\n expr: Expression | ConfigExpr | undefined,\n): T[] | undefined {\n const arr = getArray(expr);\n if (!arr) {\n return undefined;\n }\n return arr.map((item) => isExpression(item) && getLiteral<T>(item)).filter((v): v is T => v !== undefined);\n}\n\nfunction getArray(expr: Expression | ConfigExpr | undefined) {\n return isArrayExpr(expr) || isConfigArrayExpr(expr) ? expr.items : undefined;\n}\n\nexport function getAttributeArgLiteral<T extends string | number | boolean>(\n attr: DataModelAttribute | DataFieldAttribute,\n name: string,\n): T | undefined {\n for (const arg of attr.args) {\n if (arg.$resolvedParam?.name === name) {\n return getLiteral<T>(arg.value);\n }\n }\n return undefined;\n}\n\nexport function getFunctionExpressionContext(funcDecl: FunctionDecl) {\n const funcAllowedContext: ExpressionContext[] = [];\n const funcAttr = funcDecl.attributes.find((attr) => attr.decl.$refText === '@@@expressionContext');\n if (funcAttr) {\n const contextArg = funcAttr.args[0]?.value;\n if (isArrayExpr(contextArg)) {\n contextArg.items.forEach((item) => {\n if (isEnumFieldReference(item)) {\n funcAllowedContext.push(item.target.$refText as ExpressionContext);\n }\n });\n }\n }\n return funcAllowedContext;\n}\n\nexport function getFieldReference(expr: Expression): DataField | undefined {\n if (isReferenceExpr(expr) && isDataField(expr.target.ref)) {\n return expr.target.ref;\n } else if (isMemberAccessExpr(expr) && isDataField(expr.member.ref)) {\n return expr.member.ref;\n } else {\n return undefined;\n }\n}\n\nexport function isCheckInvocation(node: AstNode) {\n return isInvocationExpr(node) && node.function.ref?.name === 'check' && isFromStdlib(node.function.ref);\n}\n\nexport function resolveTransitiveImports(documents: LangiumDocuments, model: Model) {\n return resolveTransitiveImportsInternal(documents, model);\n}\n\nfunction resolveTransitiveImportsInternal(\n documents: LangiumDocuments,\n model: Model,\n initialModel = model,\n visited: Set<string> = new Set(),\n models: Set<Model> = new Set(),\n) {\n const doc = AstUtils.getDocument(model);\n const initialDoc = AstUtils.getDocument(initialModel);\n\n if (initialDoc.uri.fsPath.toLowerCase() !== doc.uri.fsPath.toLowerCase()) {\n models.add(model);\n }\n\n const normalizedPath = doc.uri.fsPath.toLowerCase();\n if (!visited.has(normalizedPath)) {\n visited.add(normalizedPath);\n for (const imp of model.imports) {\n const importedModel = resolveImport(documents, imp);\n if (importedModel) {\n resolveTransitiveImportsInternal(documents, importedModel, initialModel, visited, models);\n }\n }\n }\n return Array.from(models);\n}\n\nexport function resolveImport(documents: LangiumDocuments, imp: ModelImport) {\n const resolvedUri = resolveImportUri(imp);\n try {\n if (resolvedUri) {\n let resolvedDocument = documents.getDocument(resolvedUri);\n if (!resolvedDocument) {\n const content = fs.readFileSync(resolvedUri.fsPath, 'utf-8');\n resolvedDocument = documents.createDocument(resolvedUri, content);\n }\n const node = resolvedDocument.parseResult.value;\n if (isModel(node)) {\n return node;\n }\n }\n } catch {\n // NOOP\n }\n return undefined;\n}\n\nexport function resolveImportUri(imp: ModelImport) {\n if (!imp.path) {\n return undefined;\n }\n const doc = AstUtils.getDocument(imp);\n const dir = path.dirname(doc.uri.fsPath);\n const importPath = imp.path.endsWith('.zmodel') ? imp.path : `${imp.path}.zmodel`;\n return URI.file(path.resolve(dir, importPath));\n}\n\n/**\n * Gets data models and type defs in the ZModel schema.\n */\nexport function getDataModelAndTypeDefs(model: Model, includeIgnored = false) {\n const r = model.declarations.filter((d): d is DataModel | TypeDef => isDataModel(d) || isTypeDef(d));\n if (includeIgnored) {\n return r;\n } else {\n return r.filter((model) => !hasAttribute(model, '@@ignore'));\n }\n}\n\nexport function getAllDeclarationsIncludingImports(documents: LangiumDocuments, model: Model) {\n const imports = resolveTransitiveImports(documents, model);\n return model.declarations.concat(...imports.map((imp) => imp.declarations));\n}\n\nexport function getAuthDecl(decls: (DataModel | TypeDef)[]) {\n let authModel = decls.find((m) => hasAttribute(m, '@@auth'));\n if (!authModel) {\n authModel = decls.find((m) => m.name === 'User');\n }\n return authModel;\n}\n\nexport function isFutureInvocation(node: AstNode) {\n return isInvocationExpr(node) && node.function.ref?.name === 'future' && isFromStdlib(node.function.ref);\n}\n\nexport function isCollectionPredicate(node: AstNode): node is BinaryExpr {\n return isBinaryExpr(node) && ['?', '!', '^'].includes(node.operator);\n}\n\nexport function getAllLoadedDataModelsAndTypeDefs(langiumDocuments: LangiumDocuments) {\n return langiumDocuments.all\n .map((doc) => doc.parseResult.value as Model)\n .flatMap((model) => model.declarations.filter((d): d is DataModel | TypeDef => isDataModel(d) || isTypeDef(d)))\n .toArray();\n}\n\nexport function getAllDataModelsIncludingImports(documents: LangiumDocuments, model: Model) {\n return getAllDeclarationsIncludingImports(documents, model).filter(isDataModel);\n}\n\nexport function getAllLoadedAndReachableDataModelsAndTypeDefs(\n langiumDocuments: LangiumDocuments,\n fromModel?: DataModel,\n) {\n // get all data models from loaded documents\n const allDataModels = getAllLoadedDataModelsAndTypeDefs(langiumDocuments);\n\n if (fromModel) {\n // merge data models transitively reached from the current model\n const model = AstUtils.getContainerOfType(fromModel, isModel);\n if (model) {\n const transitiveDataModels = getAllDataModelsIncludingImports(langiumDocuments, model);\n transitiveDataModels.forEach((dm) => {\n if (!allDataModels.includes(dm)) {\n allDataModels.push(dm);\n }\n });\n }\n }\n\n return allDataModels;\n}\n\nexport function getContainingDataModel(node: Expression): DataModel | undefined {\n let curr: AstNode | undefined = node.$container;\n while (curr) {\n if (isDataModel(curr)) {\n return curr;\n }\n curr = curr.$container;\n }\n return undefined;\n}\n\nexport function isMemberContainer(node: unknown): node is DataModel | TypeDef {\n return isDataModel(node) || isTypeDef(node);\n}\n\nexport function getAllFields(\n decl: DataModel | TypeDef,\n includeIgnored = false,\n seen: Set<DataModel | TypeDef> = new Set(),\n): DataField[] {\n if (seen.has(decl)) {\n return [];\n }\n seen.add(decl);\n\n const fields: DataField[] = [];\n for (const mixin of decl.mixins) {\n invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);\n fields.push(...getAllFields(mixin.ref, includeIgnored, seen));\n }\n\n if (isDataModel(decl) && decl.baseModel) {\n invariant(decl.baseModel.ref, `Base model ${decl.baseModel.$refText} is not resolved`);\n fields.push(...getAllFields(decl.baseModel.ref, includeIgnored, seen));\n }\n\n fields.push(...decl.fields.filter((f) => includeIgnored || !hasAttribute(f, '@ignore')));\n return fields;\n}\n\nexport function getAllAttributes(\n decl: DataModel | TypeDef,\n seen: Set<DataModel | TypeDef> = new Set(),\n): DataModelAttribute[] {\n if (seen.has(decl)) {\n return [];\n }\n seen.add(decl);\n\n const attributes: DataModelAttribute[] = [];\n for (const mixin of decl.mixins) {\n invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);\n attributes.push(...getAllAttributes(mixin.ref, seen));\n }\n\n if (isDataModel(decl) && decl.baseModel) {\n invariant(decl.baseModel.ref, `Base model ${decl.baseModel.$refText} is not resolved`);\n attributes.push(...getAllAttributes(decl.baseModel.ref, seen));\n }\n\n attributes.push(...decl.attributes);\n return attributes;\n}\n\n/**\n * Retrieve the document in which the given AST node is contained. A reference to the document is\n * usually held by the root node of the AST.\n *\n * @throws an error if the node is not contained in a document.\n */\nexport function getDocument<T extends AstNode = AstNode>(node: AstNode): LangiumDocument<T> {\n const rootNode = findRootNode(node);\n const result = rootNode.$document;\n if (!result) {\n throw new Error('AST node has no document.');\n }\n return result as LangiumDocument<T>;\n}\n\n/**\n * Returns the root node of the given AST node by following the `$container` references.\n */\nexport function findRootNode(node: AstNode): AstNode {\n while (node.$container) {\n node = node.$container;\n }\n return node;\n}\n","/**\n * Supported Prisma db providers\n */\nexport const SUPPORTED_PROVIDERS = [\n 'sqlite',\n 'postgresql',\n // TODO: other providers\n // 'mysql',\n // 'sqlserver',\n // 'cockroachdb',\n];\n\n/**\n * All scalar types\n */\nexport const SCALAR_TYPES = ['String', 'Int', 'Float', 'Decimal', 'BigInt', 'Boolean', 'Bytes', 'DateTime'];\n\n/**\n * Name of standard library module\n */\nexport const STD_LIB_MODULE_NAME = 'stdlib.zmodel';\n\n/**\n * Name of module contributed by plugins\n */\nexport const PLUGIN_MODULE_NAME = 'plugin.zmodel';\n\n/**\n * Validation issues\n */\nexport enum IssueCodes {\n MissingOppositeRelation = 'miss-opposite-relation',\n}\n\n/**\n * Expression context\n */\nexport enum ExpressionContext {\n DefaultValue = 'DefaultValue',\n AccessPolicy = 'AccessPolicy',\n ValidationRule = 'ValidationRule',\n Index = 'Index',\n}\n","/******************************************************************************\n * This file was generated by langium-cli 3.5.0.\n * DO NOT EDIT MANUALLY!\n ******************************************************************************/\n\n/* eslint-disable */\nimport * as langium from 'langium';\n\nexport const ZModelTerminals = {\n WS: /\\s+/,\n INTERNAL_ATTRIBUTE_NAME: /@@@([_a-zA-Z][\\w_]*\\.)*[_a-zA-Z][\\w_]*/,\n MODEL_ATTRIBUTE_NAME: /@@([_a-zA-Z][\\w_]*\\.)*[_a-zA-Z][\\w_]*/,\n FIELD_ATTRIBUTE_NAME: /@([_a-zA-Z][\\w_]*\\.)*[_a-zA-Z][\\w_]*/,\n ID: /[_a-zA-Z][\\w_]*/,\n STRING: /\"(\\\\.|[^\"\\\\])*\"|'(\\\\.|[^'\\\\])*'/,\n NUMBER: /[+-]?[0-9]+(\\.[0-9]+)?/,\n TRIPLE_SLASH_COMMENT: /\\/\\/\\/[^\\n\\r]*/,\n ML_COMMENT: /\\/\\*[\\s\\S]*?\\*\\//,\n SL_COMMENT: /\\/\\/[^\\n\\r]*/,\n};\n\nexport type ZModelTerminalNames = keyof typeof ZModelTerminals;\n\nexport type ZModelKeywordNames =\n | \"!\"\n | \"!=\"\n | \"&&\"\n | \"(\"\n | \")\"\n | \",\"\n | \".\"\n | \":\"\n | \";\"\n | \"<\"\n | \"<=\"\n | \"=\"\n | \"==\"\n | \">\"\n | \">=\"\n | \"?\"\n | \"Any\"\n | \"BigInt\"\n | \"Boolean\"\n | \"Bytes\"\n | \"ContextType\"\n | \"DateTime\"\n | \"Decimal\"\n | \"FieldReference\"\n | \"Float\"\n | \"Int\"\n | \"Json\"\n | \"Null\"\n | \"Object\"\n | \"String\"\n | \"TransitiveFieldReference\"\n | \"Unsupported\"\n | \"[\"\n | \"]\"\n | \"^\"\n | \"_\"\n | \"abstract\"\n | \"attribute\"\n | \"datasource\"\n | \"enum\"\n | \"extends\"\n | \"false\"\n | \"function\"\n | \"generator\"\n | \"import\"\n | \"in\"\n | \"model\"\n | \"mutation\"\n | \"null\"\n | \"plugin\"\n | \"procedure\"\n | \"this\"\n | \"true\"\n | \"type\"\n | \"view\"\n | \"with\"\n | \"{\"\n | \"||\"\n | \"}\";\n\nexport type ZModelTokenNames = ZModelTerminalNames | ZModelKeywordNames;\n\nexport type AbstractDeclaration = Attribute | DataModel | DataSource | Enum | FunctionDecl | GeneratorDecl | Plugin | Procedure | TypeDef;\n\nexport const AbstractDeclaration = 'AbstractDeclaration';\n\nexport function isAbstractDeclaration(item: unknown): item is AbstractDeclaration {\n return reflection.isInstance(item, AbstractDeclaration);\n}\n\nexport type Boolean = boolean;\n\nexport function isBoolean(item: unknown): item is Boolean {\n return typeof item === 'boolean';\n}\n\nexport type BuiltinType = 'BigInt' | 'Boolean' | 'Bytes' | 'DateTime' | 'Decimal' | 'Float' | 'Int' | 'Json' | 'String';\n\nexport function isBuiltinType(item: unknown): item is BuiltinType {\n return item === 'String' || item === 'Boolean' || item === 'Int' || item === 'BigInt' || item === 'Float' || item === 'Decimal' || item === 'DateTime' || item === 'Json' || item === 'Bytes';\n}\n\nexport type ConfigExpr = ConfigArrayExpr | InvocationExpr | LiteralExpr;\n\nexport const ConfigExpr = 'ConfigExpr';\n\nexport function isConfigExpr(item: unknown): item is ConfigExpr {\n return reflection.isInstance(item, ConfigExpr);\n}\n\nexport type Expression = ArrayExpr | BinaryExpr | InvocationExpr | LiteralExpr | MemberAccessExpr | NullExpr | ObjectExpr | ReferenceExpr | ThisExpr | UnaryExpr;\n\nexport const Expression = 'Expression';\n\nexport function isExpression(item: unknown): item is Expression {\n return reflection.isInstance(item, Expression);\n}\n\nexport type ExpressionType = 'Any' | 'Boolean' | 'DateTime' | 'Float' | 'Int' | 'Null' | 'Object' | 'String' | 'Unsupported';\n\nexport function isExpressionType(item: unknown): item is ExpressionType {\n return item === 'String' || item === 'Int' || item === 'Float' || item === 'Boolean' || item === 'DateTime' || item === 'Null' || item === 'Object' || item === 'Any' || item === 'Unsupported';\n}\n\nexport type LiteralExpr = BooleanLiteral | NumberLiteral | StringLiteral;\n\nexport const LiteralExpr = 'LiteralExpr';\n\nexport function isLiteralExpr(item: unknown): item is LiteralExpr {\n return reflection.isInstance(item, LiteralExpr);\n}\n\nexport type MemberAccessTarget = DataField;\n\nexport const MemberAccessTarget = 'MemberAccessTarget';\n\nexport function isMemberAccessTarget(item: unknown): item is MemberAccessTarget {\n return reflection.isInstance(item, MemberAccessTarget);\n}\n\nexport type ReferenceTarget = DataField | EnumField | FunctionParam;\n\nexport const ReferenceTarget = 'ReferenceTarget';\n\nexport function isReferenceTarget(item: unknown): item is ReferenceTarget {\n return reflection.isInstance(item, ReferenceTarget);\n}\n\nexport type RegularID = 'abstract' | 'attribute' | 'datasource' | 'enum' | 'import' | 'in' | 'model' | 'plugin' | 'type' | 'view' | string;\n\nexport function isRegularID(item: unknown): item is RegularID {\n return item === 'model' || item === 'enum' || item === 'attribute' || item === 'datasource' || item === 'plugin' || item === 'abstract' || item === 'in' || item === 'view' || item === 'import' || item === 'type' || (typeof item === 'string' && (/[_a-zA-Z][\\w_]*/.test(item)));\n}\n\nexport type RegularIDWithTypeNames = 'Any' | 'BigInt' | 'Boolean' | 'Bytes' | 'DateTime' | 'Decimal' | 'Float' | 'Int' | 'Json' | 'Null' | 'Object' | 'String' | 'Unsupported' | RegularID;\n\nexport function isRegularIDWithTypeNames(item: unknown): item is RegularIDWithTypeNames {\n return isRegularID(item) || item === 'String' || item === 'Boolean' || item === 'Int' || item === 'BigInt' || item === 'Float' || item === 'Decimal' || item === 'DateTime' || item === 'Json' || item === 'Bytes' || item === 'Null' || item === 'Object' || item === 'Any' || item === 'Unsupported';\n}\n\nexport type TypeDeclaration = DataModel | Enum | TypeDef;\n\nexport const TypeDeclaration = 'TypeDeclaration';\n\nexport function isTypeDeclaration(item: unknown): item is TypeDeclaration {\n return reflection.isInstance(item, TypeDeclaration);\n}\n\nexport interface Argument extends langium.AstNode {\n readonly $container: InvocationExpr;\n readonly $type: 'Argument';\n value: Expression;\n}\n\nexport const Argument = 'Argument';\n\nexport function isArgument(item: unknown): item is Argument {\n return reflection.isInstance(item, Argument);\n}\n\nexport interface ArrayExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr;\n readonly $type: 'ArrayExpr';\n items: Array<Expression>;\n}\n\nexport const ArrayExpr = 'ArrayExpr';\n\nexport function isArrayExpr(item: unknown): item is ArrayExpr {\n return reflection.isInstance(item, ArrayExpr);\n}\n\nexport interface Attribute extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'Attribute';\n attributes: Array<InternalAttribute>;\n comments: Array<string>;\n name: string;\n params: Array<AttributeParam>;\n}\n\nexport const Attribute = 'Attribute';\n\nexport function isAttribute(item: unknown): item is Attribute {\n return reflection.isInstance(item, Attribute);\n}\n\nexport interface AttributeArg extends langium.AstNode {\n readonly $container: DataFieldAttribute | DataModelAttribute | InternalAttribute;\n readonly $type: 'AttributeArg';\n name?: RegularID;\n value: Expression;\n}\n\nexport const AttributeArg = 'AttributeArg';\n\nexport function isAttributeArg(item: unknown): item is AttributeArg {\n return reflection.isInstance(item, AttributeArg);\n}\n\nexport interface AttributeParam extends langium.AstNode {\n readonly $container: Attribute;\n readonly $type: 'AttributeParam';\n attributes: Array<InternalAttribute>;\n comments: Array<string>;\n default: boolean;\n name: RegularID;\n type: AttributeParamType;\n}\n\nexport const AttributeParam = 'AttributeParam';\n\nexport function isAttributeParam(item: unknown): item is AttributeParam {\n return reflection.isInstance(item, AttributeParam);\n}\n\nexport interface AttributeParamType extends langium.AstNode {\n readonly $container: AttributeParam;\n readonly $type: 'AttributeParamType';\n array: boolean;\n optional: boolean;\n reference?: langium.Reference<TypeDeclaration>;\n type?: 'ContextType' | 'FieldReference' | 'TransitiveFieldReference' | ExpressionType;\n}\n\nexport const AttributeParamType = 'AttributeParamType';\n\nexport function isAttributeParamType(item: unknown): item is AttributeParamType {\n return reflection.isInstance(item, AttributeParamType);\n}\n\nexport interface BinaryExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'BinaryExpr';\n left: Expression;\n operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | 'in' | '||';\n right: Expression;\n}\n\nexport const BinaryExpr = 'BinaryExpr';\n\nexport function isBinaryExpr(item: unknown): item is BinaryExpr {\n return reflection.isInstance(item, BinaryExpr);\n}\n\nexport interface BooleanLiteral extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;\n readonly $type: 'BooleanLiteral';\n value: Boolean;\n}\n\nexport const BooleanLiteral = 'BooleanLiteral';\n\nexport function isBooleanLiteral(item: unknown): item is BooleanLiteral {\n return reflection.isInstance(item, BooleanLiteral);\n}\n\nexport interface ConfigArrayExpr extends langium.AstNode {\n readonly $container: ConfigField;\n readonly $type: 'ConfigArrayExpr';\n items: Array<ConfigInvocationExpr | LiteralExpr>;\n}\n\nexport const ConfigArrayExpr = 'ConfigArrayExpr';\n\nexport function isConfigArrayExpr(item: unknown): item is ConfigArrayExpr {\n return reflection.isInstance(item, ConfigArrayExpr);\n}\n\nexport interface ConfigField extends langium.AstNode {\n readonly $container: DataSource | GeneratorDecl;\n readonly $type: 'ConfigField';\n name: RegularID;\n value: ConfigExpr;\n}\n\nexport const ConfigField = 'ConfigField';\n\nexport function isConfigField(item: unknown): item is ConfigField {\n return reflection.isInstance(item, ConfigField);\n}\n\nexport interface ConfigInvocationArg extends langium.AstNode {\n readonly $container: ConfigInvocationExpr;\n readonly $type: 'ConfigInvocationArg';\n name: string;\n value: LiteralExpr;\n}\n\nexport const ConfigInvocationArg = 'ConfigInvocationArg';\n\nexport function isConfigInvocationArg(item: unknown): item is ConfigInvocationArg {\n return reflection.isInstance(item, ConfigInvocationArg);\n}\n\nexport interface ConfigInvocationExpr extends langium.AstNode {\n readonly $container: ConfigArrayExpr;\n readonly $type: 'ConfigInvocationExpr';\n args: Array<ConfigInvocationArg>;\n name: string;\n}\n\nexport const ConfigInvocationExpr = 'ConfigInvocationExpr';\n\nexport function isConfigInvocationExpr(item: unknown): item is ConfigInvocationExpr {\n return reflection.isInstance(item, ConfigInvocationExpr);\n}\n\nexport interface DataField extends langium.AstNode {\n readonly $container: DataModel | TypeDef;\n readonly $type: 'DataField';\n attributes: Array<DataFieldAttribute>;\n comments: Array<string>;\n name: RegularIDWithTypeNames;\n type: DataFieldType;\n}\n\nexport const DataField = 'DataField';\n\nexport function isDataField(item: unknown): item is DataField {\n return reflection.isInstance(item, DataField);\n}\n\nexport interface DataFieldAttribute extends langium.AstNode {\n readonly $container: DataField | EnumField;\n readonly $type: 'DataFieldAttribute';\n args: Array<AttributeArg>;\n decl: langium.Reference<Attribute>;\n}\n\nexport const DataFieldAttribute = 'DataFieldAttribute';\n\nexport function isDataFieldAttribute(item: unknown): item is DataFieldAttribute {\n return reflection.isInstance(item, DataFieldAttribute);\n}\n\nexport interface DataFieldType extends langium.AstNode {\n readonly $container: DataField;\n readonly $type: 'DataFieldType';\n array: boolean;\n optional: boolean;\n reference?: langium.Reference<TypeDeclaration>;\n type?: BuiltinType;\n unsupported?: UnsupportedFieldType;\n}\n\nexport const DataFieldType = 'DataFieldType';\n\nexport function isDataFieldType(item: unknown): item is DataFieldType {\n return reflection.isInstance(item, DataFieldType);\n}\n\nexport interface DataModel extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'DataModel';\n attributes: Array<DataModelAttribute>;\n baseModel?: langium.Reference<DataModel>;\n comments: Array<string>;\n fields: Array<DataField>;\n isView: boolean;\n mixins: Array<langium.Reference<TypeDef>>;\n name: RegularID;\n}\n\nexport const DataModel = 'DataModel';\n\nexport function isDataModel(item: unknown): item is DataModel {\n return reflection.isInstance(item, DataModel);\n}\n\nexport interface DataModelAttribute extends langium.AstNode {\n readonly $container: DataModel | Enum | TypeDef;\n readonly $type: 'DataModelAttribute';\n args: Array<AttributeArg>;\n decl: langium.Reference<Attribute>;\n}\n\nexport const DataModelAttribute = 'DataModelAttribute';\n\nexport function isDataModelAttribute(item: unknown): item is DataModelAttribute {\n return reflection.isInstance(item, DataModelAttribute);\n}\n\nexport interface DataSource extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'DataSource';\n fields: Array<ConfigField>;\n name: RegularID;\n}\n\nexport const DataSource = 'DataSource';\n\nexport function isDataSource(item: unknown): item is DataSource {\n return reflection.isInstance(item, DataSource);\n}\n\nexport interface Enum extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'Enum';\n attributes: Array<DataModelAttribute>;\n comments: Array<string>;\n fields: Array<EnumField>;\n name: RegularID;\n}\n\nexport const Enum = 'Enum';\n\nexport function isEnum(item: unknown): item is Enum {\n return reflection.isInstance(item, Enum);\n}\n\nexport interface EnumField extends langium.AstNode {\n readonly $container: Enum;\n readonly $type: 'EnumField';\n attributes: Array<DataFieldAttribute>;\n comments: Array<string>;\n name: RegularIDWithTypeNames;\n}\n\nexport const EnumField = 'EnumField';\n\nexport function isEnumField(item: unknown): item is EnumField {\n return reflection.isInstance(item, EnumField);\n}\n\nexport interface FieldInitializer extends langium.AstNode {\n readonly $container: ObjectExpr;\n readonly $type: 'FieldInitializer';\n name: RegularID | string;\n value: Expression;\n}\n\nexport const FieldInitializer = 'FieldInitializer';\n\nexport function isFieldInitializer(item: unknown): item is FieldInitializer {\n return reflection.isInstance(item, FieldInitializer);\n}\n\nexport interface FunctionDecl extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'FunctionDecl';\n attributes: Array<InternalAttribute>;\n expression?: Expression;\n name: RegularID;\n params: Array<FunctionParam>;\n returnType: FunctionParamType;\n}\n\nexport const FunctionDecl = 'FunctionDecl';\n\nexport function isFunctionDecl(item: unknown): item is FunctionDecl {\n return reflection.isInstance(item, FunctionDecl);\n}\n\nexport interface FunctionParam extends langium.AstNode {\n readonly $container: FunctionDecl | Procedure;\n readonly $type: 'FunctionParam';\n name: RegularID;\n optional: boolean;\n type: FunctionParamType;\n}\n\nexport const FunctionParam = 'FunctionParam';\n\nexport function isFunctionParam(item: unknown): item is FunctionParam {\n return reflection.isInstance(item, FunctionParam);\n}\n\nexport interface FunctionParamType extends langium.AstNode {\n readonly $container: FunctionDecl | FunctionParam | Procedure | ProcedureParam;\n readonly $type: 'FunctionParamType';\n array: boolean;\n reference?: langium.Reference<TypeDeclaration>;\n type?: ExpressionType;\n}\n\nexport const FunctionParamType = 'FunctionParamType';\n\nexport function isFunctionParamType(item: unknown): item is FunctionParamType {\n return reflection.isInstance(item, FunctionParamType);\n}\n\nexport interface GeneratorDecl extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'GeneratorDecl';\n fields: Array<ConfigField>;\n name: RegularID;\n}\n\nexport const GeneratorDecl = 'GeneratorDecl';\n\nexport function isGeneratorDecl(item: unknown): item is GeneratorDecl {\n return reflection.isInstance(item, GeneratorDecl);\n}\n\nexport interface InternalAttribute extends langium.AstNode {\n readonly $container: Attribute | AttributeParam | FunctionDecl | Procedure;\n readonly $type: 'InternalAttribute';\n args: Array<AttributeArg>;\n decl: langium.Reference<Attribute>;\n}\n\nexport const InternalAttribute = 'InternalAttribute';\n\nexport function isInternalAttribute(item: unknown): item is InternalAttribute {\n return reflection.isInstance(item, InternalAttribute);\n}\n\nexport interface InvocationExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigField | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'InvocationExpr';\n args: Array<Argument>;\n function: langium.Reference<FunctionDecl>;\n}\n\nexport const InvocationExpr = 'InvocationExpr';\n\nexport function isInvocationExpr(item: unknown): item is InvocationExpr {\n return reflection.isInstance(item, InvocationExpr);\n}\n\nexport interface MemberAccessExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'MemberAccessExpr';\n member: langium.Reference<MemberAccessTarget>;\n operand: Expression;\n}\n\nexport const MemberAccessExpr = 'MemberAccessExpr';\n\nexport function isMemberAccessExpr(item: unknown): item is MemberAccessExpr {\n return reflection.isInstance(item, MemberAccessExpr);\n}\n\nexport interface Model extends langium.AstNode {\n readonly $type: 'Model';\n declarations: Array<AbstractDeclaration>;\n imports: Array<ModelImport>;\n}\n\nexport const Model = 'Model';\n\nexport function isModel(item: unknown): item is Model {\n return reflection.isInstance(item, Model);\n}\n\nexport interface ModelImport extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'ModelImport';\n path: string;\n}\n\nexport const ModelImport = 'ModelImport';\n\nexport function isModelImport(item: unknown): item is ModelImport {\n return reflection.isInstance(item, ModelImport);\n}\n\nexport interface NullExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'NullExpr';\n value: 'null';\n}\n\nexport const NullExpr = 'NullExpr';\n\nexport function isNullExpr(item: unknown): item is NullExpr {\n return reflection.isInstance(item, NullExpr);\n}\n\nexport interface NumberLiteral extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;\n readonly $type: 'NumberLiteral';\n value: string;\n}\n\nexport const NumberLiteral = 'NumberLiteral';\n\nexport function isNumberLiteral(item: unknown): item is NumberLiteral {\n return reflection.isInstance(item, NumberLiteral);\n}\n\nexport interface ObjectExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr;\n readonly $type: 'ObjectExpr';\n fields: Array<FieldInitializer>;\n}\n\nexport const ObjectExpr = 'ObjectExpr';\n\nexport function isObjectExpr(item: unknown): item is ObjectExpr {\n return reflection.isInstance(item, ObjectExpr);\n}\n\nexport interface Plugin extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'Plugin';\n fields: Array<PluginField>;\n name: RegularID;\n}\n\nexport const Plugin = 'Plugin';\n\nexport function isPlugin(item: unknown): item is Plugin {\n return reflection.isInstance(item, Plugin);\n}\n\nexport interface PluginField extends langium.AstNode {\n readonly $container: Plugin;\n readonly $type: 'PluginField';\n name: RegularID;\n value: ArrayExpr | LiteralExpr | ObjectExpr;\n}\n\nexport const PluginField = 'PluginField';\n\nexport function isPluginField(item: unknown): item is PluginField {\n return reflection.isInstance(item, PluginField);\n}\n\nexport interface Procedure extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'Procedure';\n attributes: Array<InternalAttribute>;\n mutation: boolean;\n name: RegularID;\n params: Array<FunctionParam | ProcedureParam>;\n returnType: FunctionParamType;\n}\n\nexport const Procedure = 'Procedure';\n\nexport function isProcedure(item: unknown): item is Procedure {\n return reflection.isInstance(item, Procedure);\n}\n\nexport interface ProcedureParam extends langium.AstNode {\n readonly $container: Procedure;\n readonly $type: 'ProcedureParam';\n name: RegularID;\n optional: boolean;\n type: FunctionParamType;\n}\n\nexport const ProcedureParam = 'ProcedureParam';\n\nexport function isProcedureParam(item: unknown): item is ProcedureParam {\n return reflection.isInstance(item, ProcedureParam);\n}\n\nexport interface ReferenceArg extends langium.AstNode {\n readonly $container: ReferenceExpr;\n readonly $type: 'ReferenceArg';\n name: string;\n value: Expression;\n}\n\nexport const ReferenceArg = 'ReferenceArg';\n\nexport function isReferenceArg(item: unknown): item is ReferenceArg {\n return reflection.isInstance(item, ReferenceArg);\n}\n\nexport interface ReferenceExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'ReferenceExpr';\n args: Array<ReferenceArg>;\n target: langium.Reference<ReferenceTarget>;\n}\n\nexport const ReferenceExpr = 'ReferenceExpr';\n\nexport function isReferenceExpr(item: unknown): item is ReferenceExpr {\n return reflection.isInstance(item, ReferenceExpr);\n}\n\nexport interface StringLiteral extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;\n readonly $type: 'StringLiteral';\n value: string;\n}\n\nexport const StringLiteral = 'StringLiteral';\n\nexport function isStringLiteral(item: unknown): item is StringLiteral {\n return reflection.isInstance(item, StringLiteral);\n}\n\nexport interface ThisExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'ThisExpr';\n value: 'this';\n}\n\nexport const ThisExpr = 'ThisExpr';\n\nexport function isThisExpr(item: unknown): item is ThisExpr {\n return reflection.isInstance(item, ThisExpr);\n}\n\nexport interface TypeDef extends langium.AstNode {\n readonly $container: Model;\n readonly $type: 'TypeDef';\n attributes: Array<DataModelAttribute>;\n comments: Array<string>;\n fields: Array<DataField>;\n mixins: Array<langium.Reference<TypeDef>>;\n name: RegularID;\n}\n\nexport const TypeDef = 'TypeDef';\n\nexport function isTypeDef(item: unknown): item is TypeDef {\n return reflection.isInstance(item, TypeDef);\n}\n\nexport interface UnaryExpr extends langium.AstNode {\n readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | FieldInitializer | FunctionDecl | MemberAccessExpr | ReferenceArg | UnaryExpr;\n readonly $type: 'UnaryExpr';\n operand: Expression;\n operator: '!';\n}\n\nexport const UnaryExpr = 'UnaryExpr';\n\nexport function isUnaryExpr(item: unknown): item is UnaryExpr {\n return reflection.isInstance(item, UnaryExpr);\n}\n\nexport interface UnsupportedFieldType extends langium.AstNode {\n readonly $container: DataFieldType;\n readonly $type: 'UnsupportedFieldType';\n value: LiteralExpr;\n}\n\nexport const UnsupportedFieldType = 'UnsupportedFieldType';\n\nexport function isUnsupportedFieldType(item: unknown): item is UnsupportedFieldType {\n return reflection.isInstance(item, UnsupportedFieldType);\n}\n\nexport type ZModelAstType = {\n AbstractDeclaration: AbstractDeclaration\n Argument: Argument\n ArrayExpr: ArrayExpr\n Attribute: Attribute\n AttributeArg: AttributeArg\n AttributeParam: AttributeParam\n AttributeParamType: AttributeParamType\n BinaryExpr: BinaryExpr\n BooleanLiteral: BooleanLiteral\n ConfigArrayExpr: ConfigArrayExpr\n ConfigExpr: ConfigExpr\n ConfigField: ConfigField\n ConfigInvocationArg: ConfigInvocationArg\n ConfigInvocationExpr: ConfigInvocationExpr\n DataField: DataField\n DataFieldAttribute: DataFieldAttribute\n DataFieldType: DataFieldType\n DataModel: DataModel\n DataModelAttribute: DataModelAttribute\n DataSource: DataSource\n Enum: Enum\n EnumField: EnumField\n Expression: Expression\n FieldInitializer: FieldInitializer\n FunctionDecl: FunctionDecl\n FunctionParam: FunctionParam\n FunctionParamType: FunctionParamType\n GeneratorDecl: GeneratorDecl\n InternalAttribute: InternalAttribute\n InvocationExpr: InvocationExpr\n LiteralExpr: LiteralExpr\n MemberAccessExpr: MemberAccessExpr\n MemberAccessTarget: MemberAccessTarget\n Model: Model\n ModelImport: ModelImport\n NullExpr: NullExpr\n NumberLiteral: NumberLiteral\n ObjectExpr: ObjectExpr\n Plugin: Plugin\n PluginField: PluginField\n Procedure: Procedure\n ProcedureParam: ProcedureParam\n ReferenceArg: ReferenceArg\n ReferenceExpr: ReferenceExpr\n ReferenceTarget: ReferenceTarget\n StringLiteral: StringLiteral\n ThisExpr: ThisExpr\n TypeDeclaration: TypeDeclaration\n TypeDef: TypeDef\n UnaryExpr: UnaryExpr\n UnsupportedFieldType: UnsupportedFieldType\n}\n\nexport class ZModelAstReflection extends langium.AbstractAstReflection {\n\n getAllTypes(): string[] {\n return [AbstractDeclaration, Argument, ArrayExpr, Attribute, AttributeArg, AttributeParam, AttributeParamType, BinaryExpr, BooleanLiteral, ConfigArrayExpr, ConfigExpr, ConfigField, ConfigInvocationArg, ConfigInvocationExpr, DataField, DataFieldAttribute, DataFieldType, DataModel, DataModelAttribute, DataSource, Enum, EnumField, Expression, FieldInitializer, FunctionDecl, FunctionParam, FunctionParamType, GeneratorDecl, InternalAttribute, InvocationExpr, LiteralExpr, MemberAccessExpr, MemberAccessTarget, Model, ModelImport, NullExpr, NumberLiteral, ObjectExpr, Plugin, PluginField, Procedure, ProcedureParam, ReferenceArg, ReferenceExpr, ReferenceTarget, StringLiteral, ThisExpr, TypeDeclaration, TypeDef, UnaryExpr, UnsupportedFieldType];\n }\n\n protected override computeIsSubtype(subtype: string, supertype: string): boolean {\n switch (subtype) {\n case ArrayExpr:\n case BinaryExpr:\n case MemberAccessExpr:\n case NullExpr:\n case ObjectExpr:\n case ReferenceExpr:\n case ThisExpr:\n case UnaryExpr: {\n return this.isSubtype(Expression, supertype);\n }\n case Attribute:\n case DataSource:\n case FunctionDecl:\n case GeneratorDecl:\n case Plugin:\n case Procedure: {\n return this.isSubtype(AbstractDeclaration, supertype);\n }\n case BooleanLiteral:\n case NumberLiteral:\n case StringLiteral: {\n return this.isSubtype(LiteralExpr, supertype);\n }\n case ConfigArrayExpr: {\n return this.isSubtype(ConfigExpr, supertype);\n }\n case DataField: {\n return this.isSubtype(MemberAccessTarget, supertype) || this.isSubtype(ReferenceTarget, supertype);\n }\n case DataModel:\n case Enum:\n case TypeDef: {\n return this.isSubtype(AbstractDeclaration, supertype) || this.isSubtype(TypeDeclaration, supertype);\n }\n case EnumField:\n case FunctionParam: {\n return this.isSubtype(ReferenceTarget, supertype);\n }\n case InvocationExpr:\n case LiteralExpr: {\n return this.isSubtype(ConfigExpr, supertype) || this.isSubtype(Expression, supertype);\n }\n default: {\n return false;\n }\n }\n }\n\n getReferenceType(refInfo: langium.ReferenceInfo): string {\n const referenceId = `${refInfo.container.$type}:${refInfo.property}`;\n switch (referenceId) {\n case 'AttributeParamType:reference':\n case 'DataFieldType:reference':\n case 'FunctionParamType:reference': {\n return TypeDeclaration;\n }\n case 'DataFieldAttribute:decl':\n case 'DataModelAttribute:decl':\n case 'InternalAttribute:decl': {\n return Attribute;\n }\n case 'DataModel:baseModel': {\n return DataModel;\n }\n case 'DataModel:mixins':\n case 'TypeDef:mixins': {\n return TypeDef;\n }\n case 'InvocationExpr:function': {\n return FunctionDecl;\n }\n case 'MemberAccessExpr:member': {\n return MemberAccessTarget;\n }\n case 'ReferenceExpr:target': {\n return ReferenceTarget;\n }\n default: {\n throw new Error(`${referenceId} is not a valid reference id.`);\n }\n }\n }\n\n getTypeMetaData(type: string): langium.TypeMetaData {\n switch (type) {\n case Argument: {\n return {\n name: Argument,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case ArrayExpr: {\n return {\n name: ArrayExpr,\n properties: [\n { name: 'items', defaultValue: [] }\n ]\n };\n }\n case Attribute: {\n return {\n name: Attribute,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'name' },\n { name: 'params', defaultValue: [] }\n ]\n };\n }\n case AttributeArg: {\n return {\n name: AttributeArg,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case AttributeParam: {\n return {\n name: AttributeParam,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'default', defaultValue: false },\n { name: 'name' },\n { name: 'type' }\n ]\n };\n }\n case AttributeParamType: {\n return {\n name: AttributeParamType,\n properties: [\n { name: 'array', defaultValue: false },\n { name: 'optional', defaultValue: false },\n { name: 'reference' },\n { name: 'type' }\n ]\n };\n }\n case BinaryExpr: {\n return {\n name: BinaryExpr,\n properties: [\n { name: 'left' },\n { name: 'operator' },\n { name: 'right' }\n ]\n };\n }\n case BooleanLiteral: {\n return {\n name: BooleanLiteral,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case ConfigArrayExpr: {\n return {\n name: ConfigArrayExpr,\n properties: [\n { name: 'items', defaultValue: [] }\n ]\n };\n }\n case ConfigField: {\n return {\n name: ConfigField,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case ConfigInvocationArg: {\n return {\n name: ConfigInvocationArg,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case ConfigInvocationExpr: {\n return {\n name: ConfigInvocationExpr,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case DataField: {\n return {\n name: DataField,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'name' },\n { name: 'type' }\n ]\n };\n }\n case DataFieldAttribute: {\n return {\n name: DataFieldAttribute,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'decl' }\n ]\n };\n }\n case DataFieldType: {\n return {\n name: DataFieldType,\n properties: [\n { name: 'array', defaultValue: false },\n { name: 'optional', defaultValue: false },\n { name: 'reference' },\n { name: 'type' },\n { name: 'unsupported' }\n ]\n };\n }\n case DataModel: {\n return {\n name: DataModel,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'baseModel' },\n { name: 'comments', defaultValue: [] },\n { name: 'fields', defaultValue: [] },\n { name: 'isView', defaultValue: false },\n { name: 'mixins', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case DataModelAttribute: {\n return {\n name: DataModelAttribute,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'decl' }\n ]\n };\n }\n case DataSource: {\n return {\n name: DataSource,\n properties: [\n { name: 'fields', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case Enum: {\n return {\n name: Enum,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'fields', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case EnumField: {\n return {\n name: EnumField,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case FieldInitializer: {\n return {\n name: FieldInitializer,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case FunctionDecl: {\n return {\n name: FunctionDecl,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'expression' },\n { name: 'name' },\n { name: 'params', defaultValue: [] },\n { name: 'returnType' }\n ]\n };\n }\n case FunctionParam: {\n return {\n name: FunctionParam,\n properties: [\n { name: 'name' },\n { name: 'optional', defaultValue: false },\n { name: 'type' }\n ]\n };\n }\n case FunctionParamType: {\n return {\n name: FunctionParamType,\n properties: [\n { name: 'array', defaultValue: false },\n { name: 'reference' },\n { name: 'type' }\n ]\n };\n }\n case GeneratorDecl: {\n return {\n name: GeneratorDecl,\n properties: [\n { name: 'fields', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case InternalAttribute: {\n return {\n name: InternalAttribute,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'decl' }\n ]\n };\n }\n case InvocationExpr: {\n return {\n name: InvocationExpr,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'function' }\n ]\n };\n }\n case MemberAccessExpr: {\n return {\n name: MemberAccessExpr,\n properties: [\n { name: 'member' },\n { name: 'operand' }\n ]\n };\n }\n case Model: {\n return {\n name: Model,\n properties: [\n { name: 'declarations', defaultValue: [] },\n { name: 'imports', defaultValue: [] }\n ]\n };\n }\n case ModelImport: {\n return {\n name: ModelImport,\n properties: [\n { name: 'path' }\n ]\n };\n }\n case NullExpr: {\n return {\n name: NullExpr,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case NumberLiteral: {\n return {\n name: NumberLiteral,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case ObjectExpr: {\n return {\n name: ObjectExpr,\n properties: [\n { name: 'fields', defaultValue: [] }\n ]\n };\n }\n case Plugin: {\n return {\n name: Plugin,\n properties: [\n { name: 'fields', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case PluginField: {\n return {\n name: PluginField,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case Procedure: {\n return {\n name: Procedure,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'mutation', defaultValue: false },\n { name: 'name' },\n { name: 'params', defaultValue: [] },\n { name: 'returnType' }\n ]\n };\n }\n case ProcedureParam: {\n return {\n name: ProcedureParam,\n properties: [\n { name: 'name' },\n { name: 'optional', defaultValue: false },\n { name: 'type' }\n ]\n };\n }\n case ReferenceArg: {\n return {\n name: ReferenceArg,\n properties: [\n { name: 'name' },\n { name: 'value' }\n ]\n };\n }\n case ReferenceExpr: {\n return {\n name: ReferenceExpr,\n properties: [\n { name: 'args', defaultValue: [] },\n { name: 'target' }\n ]\n };\n }\n case StringLiteral: {\n return {\n name: StringLiteral,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case ThisExpr: {\n return {\n name: ThisExpr,\n properties: [\n { name: 'value' }\n ]\n };\n }\n case TypeDef: {\n return {\n name: TypeDef,\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'comments', defaultValue: [] },\n { name: 'fields', defaultValue: [] },\n { name: 'mixins', defaultValue: [] },\n { name: 'name' }\n ]\n };\n }\n case UnaryExpr: {\n return {\n name: UnaryExpr,\n properties: [\n { name: 'operand' },\n { name: 'operator' }\n ]\n };\n }\n case UnsupportedFieldType: {\n return {\n name: UnsupportedFieldType,\n properties: [\n { name: 'value' }\n ]\n };\n }\n default: {\n return {\n name: type,\n properties: []\n };\n }\n }\n }\n}\n\nexport const reflection = new ZModelAstReflection();\n"],"mappings":";;;;AAAA,SAASA,iBAAiB;AAC1B,SAASC,UAAUC,WAAsF;AACzG,OAAOC,QAAQ;AACf,OAAOC,UAAU;;;ACiBV,IAAMC,sBAAsB;;;ACdnC,YAAYC,aAAa;AAkFlB,IAAMC,sBAAsB;AAoB5B,IAAMC,aAAa;AAQnB,IAAMC,aAAa;AAEnB,SAASC,aAAaC,MAAa;AACtC,SAAOC,WAAWC,WAAWF,MAAMF,UAAAA;AACvC;AAFgBC;AAYT,IAAMI,cAAc;AAEpB,SAASC,cAAcC,MAAa;AACvC,SAAOC,WAAWC,WAAWF,MAAMF,WAAAA;AACvC;AAFgBC;AAMT,IAAMI,qBAAqB;AAQ3B,IAAMC,kBAAkB;AAoBxB,IAAMC,kBAAkB;AAYxB,IAAMC,WAAW;AAYjB,IAAMC,YAAY;AAElB,SAASC,YAAYC,MAAa;AACrC,SAAOC,WAAWC,WAAWF,MAAMF,SAAAA;AACvC;AAFgBC;AAaT,IAAMI,YA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,MAAID,KAAKG,IAAI1D,IAAAA,GAAO;AAChB,WAAO,CAAA;EACX;AACAuD,OAAKI,IAAI3D,IAAAA;AAET,QAAMG,aAAmC,CAAA;AACzC,aAAW2D,SAAS9D,KAAK4D,QAAQ;AAC7BmH,cAAUjH,MAAMzC,KAAK,SAASyC,MAAMxD,QAAQ,kBAAkB;AAC9DH,eAAW6D,KAAI,GAAIK,iBAAiBP,MAAMzC,KAAKkC,IAAAA,CAAAA;EACnD;AAEA,MAAIR,YAAY/C,IAAAA,KAASA,KAAKgL,WAAW;AACrCD,cAAU/K,KAAKgL,UAAU3J,KAAK,cAAcrB,KAAKgL,UAAU1K,QAAQ,kBAAkB;AACrFH,eAAW6D,KAAI,GAAIK,iBAAiBrE,KAAKgL,UAAU3J,KAAKkC,IAAAA,CAAAA;EAC5D;AAEApD,aAAW6D,KAAI,GAAIhE,KAAKG,UAAU;AAClC,SAAOA;AACX;AAtBgBkE;AA8BT,SAASkD,YAAyC/G,MAAa;AAClE,QAAM0K,WAAWC,aAAa3K,IAAAA;AAC9B,QAAMiD,SAASyH,SAASrK;AACxB,MAAI,CAAC4C,QAAQ;AACT,UAAM,IAAIL,MAAM,2BAAA;EACpB;AACA,SAAOK;AACX;AAPgB8D;AAYT,SAAS4D,aAAa3K,MAAa;AACtC,SAAOA,KAAK+E,YAAY;AACpB/E,WAAOA,KAAK+E;EAChB;AACA,SAAO/E;AACX;AALgB2K;","names":["invariant","AstUtils","URI","fs","path","STD_LIB_MODULE_NAME","langium","AbstractDeclaration","ConfigExpr","Expression","isExpression","item","reflection","isInstance","LiteralExpr","isLiteralExpr","item","reflection","isInstance","MemberAccessTarget","ReferenceTarget","TypeDeclaration","Argument","ArrayExpr","isArrayExpr","item","reflection","isInstance","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","isBinaryExpr","item","reflection","isInstance","BooleanLiteral","ConfigArrayExpr","isConfigArrayExpr","item","reflection","isInstance","ConfigField","ConfigInvocationArg","ConfigInvocationExpr","DataField","isDataField","item","reflection","isInstance","DataFieldAttribute","DataFieldType","DataModel","isDataModel","item","reflection","isInstance","DataModelAttribute","DataSource","Enum","EnumField","isEnumField","item","reflection","isInstance","FieldInitializer","FunctionDecl","FunctionParam","FunctionParamType","GeneratorDecl","InternalAttribute","InvocationExpr","isInvocationExpr","item","reflection","isInstance","MemberAccessExpr","isMemberAccessExpr","Model","isModel","ModelImport","NullExpr","NumberLiteral","ObjectExpr","isObjectExpr","item","reflection","isInstance","Plugin","PluginField","Procedure","ProcedureParam","ReferenceArg","ReferenceExpr","isReferenceExpr","item","reflection","isInstance","StringLiteral","isStringLiteral","ThisExpr","TypeDef","isTypeDef","item","reflection","isInstance","UnaryExpr","UnsupportedFieldType","ZModelAstReflection","AbstractAstReflection","getAllTypes","AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","BooleanLiteral","ConfigArrayExpr","ConfigExpr","ConfigField","ConfigInvocationArg","ConfigInvocationExpr","DataField","DataFieldAttribute","DataFieldType","DataModel","DataModelAttribute","DataSource","Enum","EnumField","Expression","FieldInitializer","FunctionDecl","FunctionParam","FunctionParamType","GeneratorDecl","InternalAttribute","InvocationExpr","LiteralExpr","MemberAccessExpr","MemberAccessTarget","Model","ModelImport","NullExpr","NumberLiteral","ObjectExpr","Plugin","PluginField","Procedure","ProcedureParam","ReferenceArg","ReferenceExpr","ReferenceTarget","StringLiteral","ThisExpr","TypeDeclaration","TypeDef","UnaryExpr","UnsupportedFieldType","computeIsSubtype","subtype","supertype","isSubtype","getReferenceType","refInfo","referenceId","container","$type","property","Error","getTypeMetaData","type","name","properties","defaultValue","reflection","hasAttribute","decl","name","getAttribute","attributes","find","attr","$refText","isFromStdlib","node","model","AstUtils","getContainerOfType","isModel","$document","uri","path","endsWith","STD_LIB_MODULE_NAME","isAuthInvocation","isInvocationExpr","function","ref","getStringLiteral","isStringLiteral","value","undefined","isoDateTimeRegex","typeAssignable","destType","sourceType","sourceExpr","literal","test","mapBuiltinTypeToExpressionType","type","isAuthOrAuthMemberAccess","expr","isMemberAccessExpr","operand","isEnumFieldReference","isReferenceExpr","isEnumField","target","isDataFieldReference","isDataField","isRelationshipField","field","isDataModel","reference","isFutureExpr","isDelegateModel","resolved","Error","getRecursiveBases","includeDelegate","seen","Set","result","has","add","mixins","forEach","mixin","baseDecl","push","getModelIdFields","modelsToCheck","modelToCheck","allAttributes","getAllAttributes","idAttr","fieldsArg","args","a","$resolvedParam","isArrayExpr","items","filter","item","map","getModelUniqueFields","uniqueAttr","getUniqueFields","uniqueAttrs","findUpAst","predicate","curr","$container","getLiteral","$type","getObjectLiteral","parseFloat","isObjectExpr","fields","fieldValue","isLiteralExpr","getLiteralArray","arr","getArray","isExpression","v","isConfigArrayExpr","getAttributeArgLiteral","arg","getFunctionExpressionContext","funcDecl","funcAllowedContext","funcAttr","contextArg","getFieldReference","member","isCheckInvocation","resolveTransitiveImports","documents","resolveTransitiveImportsInternal","initialModel","visited","models","doc","getDocument","initialDoc","fsPath","toLowerCase","normalizedPath","imp","imports","importedModel","resolveImport","Array","from","resolvedUri","resolveImportUri","resolvedDocument","content","fs","readFileSync","createDocument","parseResult","dir","dirname","importPath","URI","file","resolve","getDataModelAndTypeDefs","includeIgnored","r","declarations","d","isTypeDef","getAllDeclarationsIncludingImports","concat","getAuthDecl","decls","authModel","m","isFutureInvocation","isCollectionPredicate","isBinaryExpr","includes","operator","getAllLoadedDataModelsAndTypeDefs","langiumDocuments","all","flatMap","toArray","getAllDataModelsIncludingImports","getAllLoadedAndReachableDataModelsAndTypeDefs","fromModel","allDataModels","transitiveDataModels","dm","getContainingDataModel","isMemberContainer","getAllFields","invariant","baseModel","f","rootNode","findRootNode"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/language",
|
|
3
3
|
"description": "ZenStack ZModel language specification",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.20",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ZenStack Team",
|
|
7
7
|
"files": [
|
|
@@ -30,21 +30,35 @@
|
|
|
30
30
|
"default": "./dist/ast.cjs"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
+
"./utils": {
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/utils.d.ts",
|
|
36
|
+
"default": "./dist/utils.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/utils.d.cts",
|
|
40
|
+
"default": "./dist/utils.cjs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
33
43
|
"./package.json": {
|
|
34
44
|
"import": "./package.json",
|
|
35
45
|
"require": "./package.json"
|
|
36
46
|
}
|
|
37
47
|
},
|
|
38
48
|
"dependencies": {
|
|
39
|
-
"langium": "
|
|
49
|
+
"langium": "3.5.0",
|
|
40
50
|
"pluralize": "^8.0.0",
|
|
41
|
-
"ts-pattern": "^5.
|
|
51
|
+
"ts-pattern": "^5.7.1"
|
|
42
52
|
},
|
|
43
53
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^20.0.0",
|
|
45
54
|
"@types/pluralize": "^0.0.33",
|
|
46
|
-
"langium-cli": "
|
|
47
|
-
"
|
|
55
|
+
"langium-cli": "3.5.0",
|
|
56
|
+
"tmp": "^0.2.3",
|
|
57
|
+
"@types/tmp": "^0.2.6",
|
|
58
|
+
"@zenstackhq/eslint-config": "3.0.0-alpha.20",
|
|
59
|
+
"@zenstackhq/typescript-config": "3.0.0-alpha.20",
|
|
60
|
+
"@zenstackhq/common-helpers": "3.0.0-alpha.20",
|
|
61
|
+
"@zenstackhq/vitest-config": "3.0.0-alpha.20"
|
|
48
62
|
},
|
|
49
63
|
"volta": {
|
|
50
64
|
"node": "18.19.1",
|
|
@@ -52,9 +66,6 @@
|
|
|
52
66
|
},
|
|
53
67
|
"scripts": {
|
|
54
68
|
"build": "pnpm langium:generate && tsup-node",
|
|
55
|
-
"watch": "run-p watch:*",
|
|
56
|
-
"watch:ts": "tsup-node --watch",
|
|
57
|
-
"watch:langium": "langium generate --watch",
|
|
58
69
|
"lint": "eslint src --ext ts",
|
|
59
70
|
"langium:generate": "langium generate",
|
|
60
71
|
"langium:generate:production": "langium generate --mode=production",
|
package/res/stdlib.zmodel
CHANGED
|
@@ -25,7 +25,7 @@ enum ReferentialAction {
|
|
|
25
25
|
* Used with "onUpdate": when updating the identifier of a referenced object, the scalar fields of the referencing objects will be set to NULL.
|
|
26
26
|
*/
|
|
27
27
|
SetNull
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
/**
|
|
30
30
|
* Used with "onDelete": the scalar field of the referencing object will be set to the fields default value.
|
|
31
31
|
* Used with "onUpdate": the scalar field of the referencing object will be set to the fields default value.
|
|
@@ -104,7 +104,7 @@ function ulid(): String {
|
|
|
104
104
|
} @@@expressionContext([DefaultValue])
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Creates a sequence of integers in the underlying database and assign the incremented
|
|
107
|
+
* Creates a sequence of integers in the underlying database and assign the incremented
|
|
108
108
|
* values to the ID values of the created records based on the sequence.
|
|
109
109
|
*/
|
|
110
110
|
function autoincrement(): Int {
|
|
@@ -174,9 +174,9 @@ function isEmpty(field: Any[]): Boolean {
|
|
|
174
174
|
/**
|
|
175
175
|
* The name of the model for which the policy rule is defined. If the rule is
|
|
176
176
|
* inherited to a sub model, this function returns the name of the sub model.
|
|
177
|
-
*
|
|
177
|
+
*
|
|
178
178
|
* @param optional parameter to control the casing of the returned value. Valid
|
|
179
|
-
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
179
|
+
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
180
180
|
* to "original".
|
|
181
181
|
*/
|
|
182
182
|
function currentModel(casing: String?): String {
|
|
@@ -186,7 +186,7 @@ function currentModel(casing: String?): String {
|
|
|
186
186
|
* The operation for which the policy rule is defined for. Note that a rule with
|
|
187
187
|
* "all" operation is expanded to "create", "read", "update", and "delete" rules,
|
|
188
188
|
* and the function returns corresponding value for each expanded version.
|
|
189
|
-
*
|
|
189
|
+
*
|
|
190
190
|
* @param optional parameter to control the casing of the returned value. Valid
|
|
191
191
|
* values are "original", "upper", "lower", "capitalize", "uncapitalize". Defaults
|
|
192
192
|
* to "original".
|
|
@@ -199,11 +199,6 @@ function currentOperation(casing: String?): String {
|
|
|
199
199
|
*/
|
|
200
200
|
attribute @@@targetField(_ targetField: AttributeTargetField[])
|
|
201
201
|
|
|
202
|
-
/**
|
|
203
|
-
* Marks an attribute to be applicable to type defs and fields.
|
|
204
|
-
*/
|
|
205
|
-
attribute @@@supportTypeDef()
|
|
206
|
-
|
|
207
202
|
/**
|
|
208
203
|
* Marks an attribute to be used for data validation.
|
|
209
204
|
*/
|
|
@@ -224,6 +219,11 @@ attribute @@@prisma()
|
|
|
224
219
|
*/
|
|
225
220
|
attribute @@@completionHint(_ values: String[])
|
|
226
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Indicates that the attribute can only be applied once to a declaration.
|
|
224
|
+
*/
|
|
225
|
+
attribute @@@once()
|
|
226
|
+
|
|
227
227
|
/**
|
|
228
228
|
* Defines a single-field ID on the model.
|
|
229
229
|
*
|
|
@@ -232,13 +232,13 @@ attribute @@@completionHint(_ values: String[])
|
|
|
232
232
|
* @param sort: Allows you to specify in what order the entries of the ID are stored in the database. The available options are Asc and Desc.
|
|
233
233
|
* @param clustered: Defines whether the ID is clustered or non-clustered. Defaults to true.
|
|
234
234
|
*/
|
|
235
|
-
attribute @id(map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma @@@
|
|
235
|
+
attribute @id(map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma @@@once
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
238
|
* Defines a default value for a field.
|
|
239
239
|
* @param value: An expression (e.g. 5, true, now(), auth()).
|
|
240
240
|
*/
|
|
241
|
-
attribute @default(_ value: ContextType, map: String?) @@@prisma
|
|
241
|
+
attribute @default(_ value: ContextType, map: String?) @@@prisma
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
244
|
* Defines a unique constraint for this field.
|
|
@@ -247,7 +247,7 @@ attribute @default(_ value: ContextType, map: String?) @@@prisma @@@supportTypeD
|
|
|
247
247
|
* @param sort: Allows you to specify in what order the entries of the constraint are stored in the database. The available options are Asc and Desc.
|
|
248
248
|
* @param clustered: Boolean Defines whether the constraint is clustered or non-clustered. Defaults to false.
|
|
249
249
|
*/
|
|
250
|
-
attribute @unique(map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma
|
|
250
|
+
attribute @unique(map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma @@@once
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* Defines a multi-field ID (composite ID) on the model.
|
|
@@ -259,7 +259,7 @@ attribute @unique(map: String?, length: Int?, sort: SortOrder?, clustered: Boole
|
|
|
259
259
|
* @param sort: Allows you to specify in what order the entries of the ID are stored in the database. The available options are Asc and Desc.
|
|
260
260
|
* @param clustered: Defines whether the ID is clustered or non-clustered. Defaults to true.
|
|
261
261
|
*/
|
|
262
|
-
attribute @@id(_ fields: FieldReference[], name: String?, map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma
|
|
262
|
+
attribute @@id(_ fields: FieldReference[], name: String?, map: String?, length: Int?, sort: SortOrder?, clustered: Boolean?) @@@prisma @@@once
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
265
|
* Defines a compound unique constraint for the specified fields.
|
|
@@ -523,13 +523,13 @@ attribute @@schema(_ name: String) @@@prisma
|
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* Indicates that the field is a password field and needs to be hashed before persistence.
|
|
526
|
-
*
|
|
526
|
+
*
|
|
527
527
|
* ZenStack uses `bcryptjs` library to hash password. You can use the `saltLength` parameter
|
|
528
528
|
* to configure the cost of hashing, or use `salt` parameter to provide an explicit salt.
|
|
529
529
|
* By default, salt length of 12 is used.
|
|
530
530
|
*
|
|
531
531
|
* @see https://www.npmjs.com/package/bcryptjs for details
|
|
532
|
-
*
|
|
532
|
+
*
|
|
533
533
|
* @param saltLength: length of salt to use (cost factor for the hash function)
|
|
534
534
|
* @param salt: salt to use (a pregenerated valid salt)
|
|
535
535
|
*/
|
|
@@ -538,8 +538,8 @@ attribute @password(saltLength: Int?, salt: String?) @@@targetField([StringField
|
|
|
538
538
|
|
|
539
539
|
/**
|
|
540
540
|
* Indicates that the field is encrypted when storing in the DB and should be decrypted when read
|
|
541
|
-
*
|
|
542
|
-
* ZenStack uses the Web Crypto API to encrypt and decrypt the field.
|
|
541
|
+
*
|
|
542
|
+
* ZenStack uses the Web Crypto API to encrypt and decrypt the field.
|
|
543
543
|
*/
|
|
544
544
|
attribute @encrypted() @@@targetField([StringField])
|
|
545
545
|
|
|
@@ -555,82 +555,82 @@ attribute @omit()
|
|
|
555
555
|
/**
|
|
556
556
|
* Validates length of a string field.
|
|
557
557
|
*/
|
|
558
|
-
attribute @length(_ min: Int?, _ max: Int?, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
558
|
+
attribute @length(_ min: Int?, _ max: Int?, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
561
|
* Validates a string field value starts with the given text.
|
|
562
562
|
*/
|
|
563
|
-
attribute @startsWith(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
563
|
+
attribute @startsWith(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
564
564
|
|
|
565
565
|
/**
|
|
566
566
|
* Validates a string field value ends with the given text.
|
|
567
567
|
*/
|
|
568
|
-
attribute @endsWith(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
568
|
+
attribute @endsWith(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
569
569
|
|
|
570
570
|
/**
|
|
571
571
|
* Validates a string field value contains the given text.
|
|
572
572
|
*/
|
|
573
|
-
attribute @contains(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
573
|
+
attribute @contains(_ text: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
574
574
|
|
|
575
575
|
/**
|
|
576
576
|
* Validates a string field value matches a regex.
|
|
577
577
|
*/
|
|
578
|
-
attribute @regex(_ regex: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
578
|
+
attribute @regex(_ regex: String, _ message: String?) @@@targetField([StringField]) @@@validation
|
|
579
579
|
|
|
580
580
|
/**
|
|
581
581
|
* Validates a string field value is a valid email address.
|
|
582
582
|
*/
|
|
583
|
-
attribute @email(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
583
|
+
attribute @email(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
584
584
|
|
|
585
585
|
/**
|
|
586
586
|
* Validates a string field value is a valid ISO datetime.
|
|
587
587
|
*/
|
|
588
|
-
attribute @datetime(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
588
|
+
attribute @datetime(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
589
589
|
|
|
590
590
|
/**
|
|
591
591
|
* Validates a string field value is a valid url.
|
|
592
592
|
*/
|
|
593
|
-
attribute @url(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
593
|
+
attribute @url(_ message: String?) @@@targetField([StringField]) @@@validation
|
|
594
594
|
|
|
595
595
|
/**
|
|
596
596
|
* Trims whitespaces from the start and end of the string.
|
|
597
597
|
*/
|
|
598
|
-
attribute @trim() @@@targetField([StringField]) @@@validation
|
|
598
|
+
attribute @trim() @@@targetField([StringField]) @@@validation
|
|
599
599
|
|
|
600
600
|
/**
|
|
601
601
|
* Transform entire string toLowerCase.
|
|
602
602
|
*/
|
|
603
|
-
attribute @lower() @@@targetField([StringField]) @@@validation
|
|
603
|
+
attribute @lower() @@@targetField([StringField]) @@@validation
|
|
604
604
|
|
|
605
605
|
/**
|
|
606
606
|
* Transform entire string toUpperCase.
|
|
607
607
|
*/
|
|
608
|
-
attribute @upper() @@@targetField([StringField]) @@@validation
|
|
608
|
+
attribute @upper() @@@targetField([StringField]) @@@validation
|
|
609
609
|
|
|
610
610
|
/**
|
|
611
611
|
* Validates a number field is greater than the given value.
|
|
612
612
|
*/
|
|
613
|
-
attribute @gt(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
613
|
+
attribute @gt(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
614
614
|
|
|
615
615
|
/**
|
|
616
616
|
* Validates a number field is greater than or equal to the given value.
|
|
617
617
|
*/
|
|
618
|
-
attribute @gte(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
618
|
+
attribute @gte(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
619
619
|
|
|
620
620
|
/**
|
|
621
621
|
* Validates a number field is less than the given value.
|
|
622
622
|
*/
|
|
623
|
-
attribute @lt(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
623
|
+
attribute @lt(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
624
624
|
|
|
625
625
|
/**
|
|
626
626
|
* Validates a number field is less than or equal to the given value.
|
|
627
627
|
*/
|
|
628
|
-
attribute @lte(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
628
|
+
attribute @lte(_ value: Int, _ message: String?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
|
|
629
629
|
|
|
630
630
|
/**
|
|
631
631
|
* Validates the entity with a complex condition.
|
|
632
632
|
*/
|
|
633
|
-
attribute @@validate(_ value: Boolean, _ message: String?, _ path: String[]?) @@@validation
|
|
633
|
+
attribute @@validate(_ value: Boolean, _ message: String?, _ path: String[]?) @@@validation
|
|
634
634
|
|
|
635
635
|
/**
|
|
636
636
|
* Validates length of a string field.
|
|
@@ -665,9 +665,9 @@ function url(field: String): Boolean {
|
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
667
|
* Checks if the current user can perform the given operation on the given field.
|
|
668
|
-
*
|
|
668
|
+
*
|
|
669
669
|
* @param field: The field to check access for
|
|
670
|
-
* @param operation: The operation to check access for. Can be "read", "create", "update", or "delete". If the operation is not provided,
|
|
670
|
+
* @param operation: The operation to check access for. Can be "read", "create", "update", or "delete". If the operation is not provided,
|
|
671
671
|
* it defaults the operation of the containing policy rule.
|
|
672
672
|
*/
|
|
673
673
|
function check(field: Any, operation: String?): Boolean {
|
|
@@ -718,4 +718,19 @@ function auth(): Any {
|
|
|
718
718
|
* Used to specify the model for resolving `auth()` function call in access policies. A Zmodel
|
|
719
719
|
* can have at most one model with this attribute. By default, the model named "User" is used.
|
|
720
720
|
*/
|
|
721
|
-
attribute @@auth()
|
|
721
|
+
attribute @@auth()
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Attaches arbitrary metadata to a model or type def.
|
|
725
|
+
*/
|
|
726
|
+
attribute @@meta(_ name: String, _ value: Any)
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Attaches arbitrary metadata to a field.
|
|
730
|
+
*/
|
|
731
|
+
attribute @meta(_ name: String, _ value: Any)
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Marks an attribute as deprecated.
|
|
735
|
+
*/
|
|
736
|
+
attribute @@@deprecated(_ message: String)
|