Package nameWeekly DownloadsVersionLicenseUpdated (opens in a new tab)DownloadsVersionLicenseJan 9th, 2023

This plugin will limit the number of tokens in a GraphQL operation.

Getting Started

# npm
npm install
# yarn
yarn add

Usage example

With @envelop/core from @the-guild-org

import { envelop } from '@envelop/core';
import { maxTokensPlugin } from '';
const getEnveloped = envelop({
  plugins: [
    // ... other plugins ...
        maxTokenCount: 1000, // Number of tokens allowed in a document | Default: 1000

Design considerations

This plugin relies on a parser plugin to works and access query from the context.

This should be supported by the engine you use.

If you experience any issues, please open an issue.