# @types/graphql-validation-complexity

> TypeScript definitions for graphql-validation-complexity

Latest version **0.4.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/graphql-validation-complexity
pnpm add @types/graphql-validation-complexity
yarn add @types/graphql-validation-complexity
bun add @types/graphql-validation-complexity
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.4.4 |
| Published | 2023-11-07 |
| First published | 2022-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51432 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/graphql-validation-complexity
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-validation-complexity
- npm.io page: https://npm.io/package/@types/graphql-validation-complexity

## Dependencies (1)

- [graphql](https://npm.io/package/graphql.md) 15.4.0 || ^16.5.0

## Recent versions

- 0.4.4 (latest) — 2023-11-07
- 0.4.0 (ts4.1) — 2022-08-16
- 0.4.3 — 2023-10-18
- 0.4.2 — 2023-10-10
- 0.4.1 — 2023-09-20

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-validation-complexity/index.d.ts)
````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](https://npmjs.com/package/graphql)

# Credits
These definitions were written by [Krunal G](https://github.com/krunalg).

---
_Source: https://npm.io/package/@types/graphql-validation-complexity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
