import { SchemaComposer } from 'graphql-compose'; import { AstRootTypeNode, AstDirNode, AstFileNode, AstRootNode } from './directoryToAst'; import { VisitInfo } from './VisitInfo'; /** * Do not traverse children, and go to next sibling. */ export declare const VISITOR_SKIP_CHILDREN = false; /** * Remove Node from AST and do not traverse children. */ export declare const VISITOR_REMOVE_NODE: any; export declare type VisitorEmptyResult = void | typeof VISITOR_REMOVE_NODE | typeof VISITOR_SKIP_CHILDREN; export declare type VisitKindFn = ( /** Info & helper functions from visitor during traversing AST tree */ info: VisitInfo) => VisitorEmptyResult | TNode; /** * Functions for every type of AST nodes which will be called by visitor. */ export declare type AstVisitor = { DIR?: VisitKindFn; FILE?: VisitKindFn; ROOT_TYPE?: VisitKindFn; }; /** * Traverse AST for applying modifications to DIRs, FILEs & ROOT_TYPEs * Useful for writing middlewares which transform FieldConfigs entrypoints. * * @example * const ast = directoryToAst(module); * astVisitor(ast, schemaComposer, { * ROOT_TYPE: () => {}, // run for query, mutation, subscription * DIR: () => {}, // executes on visiting DIR node * FILE: () => {}, // executes on visiting FILE node * }); */ export declare function astVisitor(ast: AstRootNode, schemaComposer: SchemaComposer, visitor: AstVisitor): void; export declare function visitNode(info: VisitInfo, visitor: AstVisitor): void; export declare function forEachKey(obj: Record, callback: (value: V, key: string) => void): void; //# sourceMappingURL=astVisitor.d.ts.map