/** * Created by Ivo Meißner on 28.07.17. */ import type { DocumentNode, FieldNode, FragmentDefinitionNode, GraphQLCompositeType, GraphQLDirective, GraphQLField, GraphQLSchema, GraphQLUnionType, InlineFragmentNode, OperationDefinitionNode } from 'graphql'; import { GraphQLError, GraphQLInterfaceType, GraphQLObjectType, ValidationContext } from 'graphql'; export type ComplexityEstimatorArgs = { args: { [key: string]: any; }; childComplexity: number; context?: Record; field: GraphQLField; node: FieldNode; type: GraphQLCompositeType; }; export type ComplexityEstimator = (options: ComplexityEstimatorArgs) => number | void; export type Complexity = any; export interface QueryComplexityOptions { context?: Record; createError?: (max: number, actual: number) => GraphQLError; estimators: Array; maximumComplexity: number; onComplete?: (complexity: number) => void; operationName?: string; variables?: Record; } export declare function getComplexity(options: { context?: Record; estimators: ComplexityEstimator[]; operationName?: string; query: DocumentNode; schema: GraphQLSchema; variables?: Record; }): number; export declare class QueryComplexity { complexity: number; context: ValidationContext; estimators: Array; includeDirectiveDef: GraphQLDirective; OperationDefinition: Record; options: QueryComplexityOptions; requestContext?: Record; skipDirectiveDef: GraphQLDirective; variableValues: Record; constructor(context: ValidationContext, options: QueryComplexityOptions); createError(): GraphQLError; nodeComplexity(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode, typeDef: GraphQLInterfaceType | GraphQLObjectType | GraphQLUnionType): number; onOperationDefinitionEnter(operation: OperationDefinitionNode): void; onOperationDefinitionLeave(operation: OperationDefinitionNode): GraphQLError | void; } //# sourceMappingURL=QueryComplexity.d.ts.map