@escape.tech/graphql-armor-document-token-limit
TypeScript icon, indicating that this package has built-in type declarations

1.3.4 • Public • Published

@escape.tech/graphql-armor-document-token-limit

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

Getting Started

# npm
npm install @escape.tech/graphql-armor-document-token-limit

# yarn
yarn add @escape.tech/graphql-armor-document-token-limit

Usage example

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

import { envelop } from '@envelop/core';
import { documentTokenLimitPlugin } from '@escape.tech/graphql-armor-document-token-limit';

const getEnveloped = envelop({
  plugins: [
    // ... other plugins ...
    documentTokenLimitPlugin({
        maxTokenCount: 2000, // Number of characters allowed | Default: 2000
    }),
  ]
})

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @escape.tech/graphql-armor-document-token-limit

Weekly Downloads

2

Version

1.3.4

License

MIT

Unpacked Size

8.97 kB

Total Files

8

Last publish

Collaborators

  • gauben
  • bsodium
  • gby56
  • swan_escape
  • icarossio
  • steffthestunt