@envelop/depth-limit
TypeScript icon, indicating that this package has built-in type declarations

5.1.3 • Public • Published

@envelop/depth-limit

This plugins uses graphql-depth-limit in order to limit the depth of executed selection sets (by injecting a new GraphQL validation rule into your execution).

Getting Started

yarn add @envelop/depth-limit

Usage Example

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useDepthLimit } from '@envelop/depth-limit'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useDepthLimit({
      maxDepth: 10
      // ignore: [ ... ] - you can set this to ignore specific fields or types
    })
  ]
})

Notes

You can find more details here: https://www.npmjs.com/package/graphql-depth-limit#documentation

Readme

Keywords

none

Package Sidebar

Install

npm i @envelop/depth-limit

Weekly Downloads

14,290

Version

5.1.3

License

MIT

Unpacked Size

4.63 kB

Total Files

8

Last publish

Collaborators

  • dotansimha
  • theguild-bot