@types/graphql-validation-complexity
TypeScript icon, indicating that this package has built-in type declarations

0.4.4 • Public • Published

Installation

npm install --save @types/graphql-validation-complexity

Summary

This package contains type definitions for graphql-validation-complexity (https://github.com/4Catalyzer/graphql-validation-complexity (Does not have to be to GitHub).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-validation-complexity.

index.d.ts

import type { ASTNode, GraphQLError, ValidationContext } from "graphql";

export interface Options {
    onCost?: (cost: number, context: ValidationContext) => void;
    createError?: (cost: number, node: ASTNode) => GraphQLError;
    formatErrorMessage?: (cost: number) => string;

    scalarCost?: number;
    objectCost?: number;
    listFactor?: number;
    introspectionListFactor?: number;
}

export function createComplexityLimitRule(
    maxCost: number,
    options?: Options,
): (ctx: ValidationContext) => any;

export function complexityLimitExceededErrorMessage(): string;

declare class ComplexityVisitor {
    constructor(context: any, { scalarCost, objectCost, listFactor, introspectionListFactor }: {
        scalarCost?: number;
        objectCost?: number;
        listFactor?: number;
        introspectionListFactor?: number;
    });
    context: any;
    scalarCost: number;
    objectCost: number;
    listFactor: number;
    introspectionListFactor: number;
    costFactor: number;
    cost: number;
    Field: {
        enter: () => void;
        leave: () => void;
    };
    FragmentDefinition: () => boolean;
    SelectionSet: (selectionSet: any) => any;
    flattenFragmentSpreads(selectionSet: any): any;
    enterField(): void;
    leaveField(): void;
    getFieldCostFactor(): any;
    getTypeCostFactor(type: any): any;
    isIntrospectionList({ ofType }: {
        ofType: any;
    }): boolean;
    getFieldCost(): any;
    getTypeCost(type: any): any;
    getDirectiveValue(directiveName: any): number;
    getCost(): number;
}

export { ComplexityVisitor };

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: graphql

Credits

These definitions were written by Krunal G.

Dependents (0)

Package Sidebar

Install

npm i @types/graphql-validation-complexity

Weekly Downloads

2,077

Version

0.4.4

License

MIT

Unpacked Size

6.01 kB

Total Files

5

Last publish

Collaborators

  • types