import { AnnotationSpec, AtscriptDoc, SemanticInterfaceNode, SemanticNode, SemanticPropNode, SemanticStructureNode, TMessages, Token } from "@atscript/core"; //#region src/shared/annotation-utils.d.ts /** Asserts the field carrying this annotation does not also carry any of `others`. */ declare function validateExclusiveWith(token: Token, selfName: string, others: Array<{ key: string; displayName?: string; }>): TMessages; /** Asserts `args[0]` names a sibling property whose primitive base type is `string`. */ declare function validateSiblingStringField(token: Token, args: Token[], doc: AtscriptDoc, selfName: string): TMessages; /** * Traverse from annotation token → prop → structure → interface * to check if the parent interface has @db.table. */ declare function getDbTableOwner(token: Token): SemanticNode | undefined; /** * Get the parent structure node from an annotation token. */ declare function getParentStruct(token: Token): SemanticStructureNode | undefined; /** * Get the parent interface name (for error messages and cross-type resolution). */ declare function getParentTypeName(token: Token): string | undefined; /** * Validate that an annotation is on a field with the expected base type. */ declare function validateFieldBaseType(token: Token, doc: AtscriptDoc, annotationName: string, expectedType: string | string[]): TMessages; /** * Extract target type name from a navigational field definition. * Unwraps arrays (e.g., `Post[]` → `Post`). */ declare function getNavTargetTypeName(field: SemanticNode): string | undefined; /** * Get the alias argument from an annotation on a field. */ declare function getAnnotationAlias(prop: SemanticNode, annotationName: string): string | undefined; /** * Factory for @db.rel.onDelete / @db.rel.onUpdate — identical validation logic, * only the annotation name and description verb differ. */ declare function refActionAnnotation(name: "onDelete" | "onUpdate"): AnnotationSpec; //#endregion //#region src/shared/validation-utils.d.ts /** * Validate a ref annotation argument against the document's type registry. * Returns diagnostic messages for unknown types or fields. */ declare function validateRefArgument(token: Token, doc: AtscriptDoc, options?: { requireDbTable?: boolean; }): TMessages; interface TFKFieldMatch { name: string; prop: SemanticPropNode; chainRef: { type: string; field: string; }; } /** * Find all `@db.rel.FK` fields on a type that reference `targetTypeName`. * Resolves `extends` to include inherited fields. */ declare function findFKFieldsPointingTo(doc: AtscriptDoc, iface: SemanticInterfaceNode | SemanticStructureNode, targetTypeName: string, alias?: string): TFKFieldMatch[]; /** * Check if a node has any @db.view.* annotation. */ declare function hasAnyViewAnnotation(node: SemanticNode): boolean; /** * Validate that all type refs in a query expression are within the allowed scope. * * @param queryToken - The query arg token (must have .queryNode) * @param allowedTypes - Type names allowed as qualified refs * @param unqualifiedTarget - Type name for resolving unqualified refs, or null to disallow them * @param doc - The document for type lookups */ declare function validateQueryScope(queryToken: Token, allowedTypes: string[], unqualifiedTarget: string | null, doc: AtscriptDoc): TMessages; //#endregion export { TFKFieldMatch, findFKFieldsPointingTo, getAnnotationAlias, getDbTableOwner, getNavTargetTypeName, getParentStruct, getParentTypeName, hasAnyViewAnnotation, refActionAnnotation, validateExclusiveWith, validateFieldBaseType, validateQueryScope, validateRefArgument, validateSiblingStringField };