npm.io
0.1.0-alpha-09b76bb.0 • Published 4 years ago

@envelop/graphql-executor

Licence
MIT
Version
0.1.0-alpha-09b76bb.0
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
825

@envelop/graphql-executor

A customizable GraphQL Spec compliant Executor.

GraphQL Executor provides:

  1. A way to fork the GraphQL.JS executor without introducing multiple versions of graphql-js into your project. graphql-executor is a smart fork of only the execution module of graphql-js. You can safely fork graphql-executor to customize your execution flow as needed.
  2. A code-only method of customizing the executor by subclassing the exported internal Executor class as above.
  3. Direct benefits from our own customizations! GraphQL Executor is spec-compliant, but aims to support experimental features (such as @defer/@stream support) and provide other improvements as possible. See (https://github.com/yaacovCR/graphql-executor/releases) to track any new features.

Getting Started

Start by installing the plugin:

yarn add @envelop/graphql-executor

Then, use the plugin with your validation rules:

import { useGraphQLExecutor } from '@envelop/extended-validation';

const getEnveloped = envelop({
  plugins: [useGraphQLExecutor({})],
});

To create your custom executor, implement the Executor class from graphql-executor.

For example:

import { Executor } from 'graphql-executor';
import { useGraphQLExecutor } from '@envelop/extended-validation';

class MyCustomExecutor extends Executor {
  // ...
}

const getEnveloped = envelop({
  plugins: [useGraphQLExecutor({ customExecutor: new MyCustomExecutor() })],
});