On this page

useFilterAllowedOperations

This plugins injects a validation rule into the validation phase that only allows the specified operation types (e.g. subscription, query or mutation).

Weekly downloads
31k
Version
9.2.0
License
MIT
Updated
Aug 19, 2026

utilitiessecurity

@envelop/filter-operation-type

This plugins injects a validation rule into the validation phase that only allows the specified operation types (e.g. subscription, query or mutation).

Getting Started

yarn add @envelop/filter-operation-type

Usage Example

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useFilterAllowedOperations } from '@envelop/filter-operation-type'

const getEnveloped = envelop({
  // only allow execution of subscription operations
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    useFilterAllowedOperations(['subscription'])
  ]
})