@envelop/types
Version:
40 lines (39 loc) • 1.26 kB
text/typescript
import { OnEnvelopedHook, OnContextBuildingHook, OnExecuteHook, OnParseHook, OnPluginInitHook, OnSchemaChangeHook, OnSubscribeHook, OnValidateHook, OnPerformHook } from './hooks.cjs';
export interface Plugin<PluginContext extends Record<string, any> = {}> {
/**
* Invoked for each call to getEnveloped.
*/
onEnveloped?: OnEnvelopedHook<PluginContext>;
/**
* Invoked each time the GraphQL schema has been replaced from within a plugin.
*/
onSchemaChange?: OnSchemaChangeHook;
/**
* Invoked when a plugin is initialized.
*/
onPluginInit?: OnPluginInitHook<PluginContext>;
/**
* Invoked for each execute call.
*/
onExecute?: OnExecuteHook<PluginContext>;
/**
* Invoked for each subscribe call.
*/
onSubscribe?: OnSubscribeHook<PluginContext>;
/**
* Invoked for each parse call.
*/
onParse?: OnParseHook<PluginContext>;
/**
* Invoked for each validate call.
*/
onValidate?: OnValidateHook<PluginContext>;
/**
* Invoked for each time the context is builded.
*/
onContextBuilding?: OnContextBuildingHook<PluginContext>;
/**
* Invoked for each perform call.
*/
onPerform?: OnPerformHook<PluginContext>;
}