UNPKG

@graphql-tools/executor-envelop

Version:

A set of utils for faster development of GraphQL tools

23 lines (22 loc) • 904 B
import { Plugin } from '@envelop/core'; import { Executor } from '@graphql-tools/utils'; import { schemaFromExecutor } from '@graphql-tools/wrap'; import { type MaybePromise } from '@whatwg-node/promise-helpers'; type GraphQLSchema = any; export interface ExecutorPluginContext { schema$?: MaybePromise<GraphQLSchema>; schema?: GraphQLSchema; schemaSetPromise$?: Promise<void>; skipIntrospection: boolean; } export type ExecutorPluginOpts = Parameters<typeof schemaFromExecutor>[2] & { polling?: number; logWarn?(...args: any[]): void; }; 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 {};