Packages

@envelop/core

6.0.1 · 12 Nov 2026MIT12.6M / weekRepositoryHomepagenpmAtom feed

Your version

3.0.0

major12 Oct 2022Where it was published

3.0.6 is the newest release of 3.x.

In short

1 breaking

  • Breaking

    Remove isIntrospectionQuery utility

Release note

The section about @envelop/core of a note shared by several packages.

Major Changes

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove isIntrospectionQuery utility

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove async schema loading plugin. This was a
    mistake from beginning as we cannot asynchronously validate and parse since with GraphQL.js
    are synchronous in nature.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove onResolverCalled

    We decided to drop onResolverCalled hook and instead
    provide a new plugin that will let you hook into
    this phase.

    import { parse, validate, execute, subscribe } from 'graphql'
    import { envelop, Plugin, useEngine } from '@envelop/core'
    + import { useOnResolve } from '@envelop/on-resolve'
    
    import { onResolverCalled } from './my-resolver'
    
    function useResolve(): Plugin {
      return {
    -   onResolverCalled: onResolverCalled,
    +   onPluginInit: ({ addPlugin }) => {
    +     addPlugin(useOnResolve(onResolverCalled))
    +   },
      }
    }
    
    const getEnveloped = envelop({
      plugins: [
        useEngine({ parse, validate, execute, subscribe }),
        // ... other plugins ...
        useResolve(),
      ],
    });
  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Drop useTiming plugin

    This plugin was dependent on tracing the schema. As we no longer support wrap the schema out of
    the box we decided to drop this plugin.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove isIntrospectionDocument utility

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Drop Node v12 support

    Node.js v12 is no longer supported by the Node.js team.
    github.com/nodejs/Release/

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Drop EnvelopError class

    To keep the core agnostic from a specific implementation we no longer provide the EnvelopError
    class.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove useAsyncSchema plugin

    This was a mistake from beginning as we cannot asynchronously validate and parse since with
    graphql these functions are synchronous in nature.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove graphql as a peer dependency

    We have built the new envelop to be engine agnostic. graphql-js is no longer a peer
    dependency. Now you can use any spec compliant GraphQL engine with envelop and get the benefit
    of building a plugin system. We have introduced a new plugin that can be used to customize the
    GraphQL Engine.

    - import { envelop } from '@envelop/core'
    + import { envelop, useEngine } from '@envelop/core'
    + import { parse, validate, execute, subscribe } from 'graphql';
    
    - const getEnveloped = envelop([ ... ])
    + const getEnveloped = envelop({ plugins: [useEngine({ parse, validate, execute, subscribe })] })
    
    

    Checkout the
    migration guide for
    more details.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Rename useLazyLoadedSchema to
    useSchemaByContext since the original name was vert misleading.

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove enableIf utility in favor of more type
    safe way to conditionally enable plugins. It wasn't a great experience to have a utility

    We can easily replace usage like this:

    - import { envelop, useMaskedErrors, enableIf } from '@envelop/core'
    + import { envelop, useMaskedErrors } from '@envelop/core'
    import { parse, validate, execute, subscribe } from 'graphql'
    
    const isProd = process.env.NODE_ENV === 'production'
    
    const getEnveloped = envelop({
      parse,
      validate,
      execute,
      subscribe,
      plugins: [
        // This plugin is enabled only in production
    -    enableIf(isProd, useMaskedErrors())
    +    isProd && useMaskedErrors()
      ]
    })
  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Remove handleValidationErrors and
    handleParseErrors options from useMaskedErrors.

    ONLY masking validation errors OR ONLY disabling introspection errors does not make sense, as
    both can be abused for reverse-engineering the GraphQL schema (see
    github.com/nikitastupin/clairvoyance for reverse-engineering the schema based on
    validation error suggestions). #1482

    Rename formatError function option to maskError

  • Breaking

    #1487
    dc1e24b5
    Thanks @saihaj! - Removed orchestrator tracing

    GraphQLSchema was wrapped to provide resolvers/fields tracing from the schema. Issue with this
    approach was it was very specific to the underlying engine's implementation. With the new version
    we no longer want to depend to a specific implementation. Now users can wrap their schemas and add
    tracing themselves.

Minor Changes

  • #1487
    dc1e24b5
    Thanks @saihaj! - respond to context, parse and validate errors in
    useErrorHandler plugin

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.