Nascent Personality Manifestation

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

    1.3.1 • Public • Published

    @escape.tech/graphql-armor-max-tokens

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

    Getting Started

    # npm
    npm install @escape.tech/graphql-armor-max-tokens
    
    # yarn
    yarn add @escape.tech/graphql-armor-max-tokens

    Usage example

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

    import { envelop } from '@envelop/core';
    import { maxTokensPlugin } from '@escape.tech/graphql-armor-max-tokens';
    
    const getEnveloped = envelop({
      plugins: [
        // ... other plugins ...
        maxTokensPlugin({
            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.

    Keywords

    none

    Install

    npm i @escape.tech/graphql-armor-max-tokens

    DownloadsWeekly Downloads

    15,438

    Version

    1.3.1

    License

    MIT

    Unpacked Size

    10.7 kB

    Total Files

    8

    Last publish

    Collaborators

    • swan_escape
    • icarossio
    • glimow
    • steffthestunt