UNPKG

1.03 kBTypeScriptView Raw
1import { GraphQLError, GraphQLSchema } from 'graphql';
2import { ExecutionRequest, ExecutionResult } from './Interfaces.js';
3export type ValueVisitor = (value: any) => any;
4export type ObjectValueVisitor = {
5 __enter?: ValueVisitor;
6 __leave?: ValueVisitor;
7} & Record<string, ValueVisitor>;
8export type ResultVisitorMap = Record<string, ValueVisitor | ObjectValueVisitor>;
9export type ErrorVisitor = (error: GraphQLError, pathIndex: number) => GraphQLError;
10export type ErrorVisitorMap = {
11 __unpathed?: (error: GraphQLError) => GraphQLError;
12} & Record<string, Record<string, ErrorVisitor>>;
13export declare function visitData(data: any, enter?: ValueVisitor, leave?: ValueVisitor): any;
14export declare function visitErrors(errors: ReadonlyArray<GraphQLError>, visitor: (error: GraphQLError) => GraphQLError): Array<GraphQLError>;
15export declare function visitResult(result: ExecutionResult, request: ExecutionRequest, schema: GraphQLSchema, resultVisitorMap?: ResultVisitorMap, errorVisitorMap?: ErrorVisitorMap): any;