3.0.0 • Published 7 months ago

@envelop/immediate-introspection v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@envelop/immediate-introspection

Getting Started

yarn add @envelop/immediate-introspection

Usage Example

Context building can be costly and require calling remote services. For simple GraphQL operations that only select introspection fields building a context is not necessary.

The useImmediateIntrospection can be used to short circuit any further context building if a GraphQL operation selection set only includes introspection fields within the selection set.

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine, useImmediateIntrospection } from '@envelop/core'
import { schema } from './schema'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    useSchema(schema),
    useImmediateIntrospection()
    // additional plugins
  ]
})

In case you want to authorize that an user is authenticated before allowing introspection the plugin must be placed in front of the useImmediateIntrospection() call.

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine, useImmediateIntrospection } from '@envelop/core'
import { schema } from './schema'
import { useAuthorization } from './useAuthorization'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    useSchema(schema),
    useAuthorization(), // place this before
    useImmediateIntrospection()
    // additional plugins
  ]
})
3.0.0

7 months ago

2.0.3

8 months ago

2.0.2

8 months ago

2.0.1

9 months ago

2.0.0

12 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

1 year ago

1.0.3

2 years ago