@graphql-tools/executor-envelop
Version:
A set of utils for faster development of GraphQL tools
21 lines (20 loc) • 820 B
TypeScript
import { Plugin } from '@envelop/core';
import { Executor, MaybePromise } from '@graphql-tools/utils';
import { schemaFromExecutor } from '@graphql-tools/wrap';
type GraphQLSchema = any;
export interface ExecutorPluginContext {
schema$?: MaybePromise<GraphQLSchema>;
schema?: GraphQLSchema;
schemaSetPromise$?: PromiseLike<void>;
skipIntrospection: boolean;
}
export type ExecutorPluginOpts = Parameters<typeof schemaFromExecutor>[2] & {
polling?: number;
};
export interface ExecutorPluginExtras {
invalidateUnifiedGraph: () => void;
pluginCtx: ExecutorPluginContext;
ensureSchema(ctx?: any): void;
}
export declare function useExecutor<TPluginContext extends Record<string, any>>(executor: Executor, opts?: ExecutorPluginOpts): Plugin<TPluginContext> & ExecutorPluginExtras;
export {};