@cran/lib.gql.core
Version:
GQL Core Functionality
23 lines (22 loc) • 958 B
TypeScript
import type { GraphQLSchema } from "graphql";
import type { IResolvers, TypeSource } from "@graphql-tools/utils";
export declare namespace Plugin {
enum Phase {
PREPARE = 0,
DEFAULT = 1,
FINALIZE = 2
}
type Transformer = (schema: GraphQLSchema) => GraphQLSchema;
type Transformers = {
[Key in `${Phase}`]?: Transformer;
};
function apply<Context = any>(plugin: Plugin<Context>): GraphQLSchema;
function compose<Context = any>(plugins: Array<Plugin<Context>>): Plugin<Context>;
function composeTransformerByPhase<Context>(plugins: Array<Plugin<Context>>, phase: Phase): (schema: GraphQLSchema) => GraphQLSchema;
function getTransformerByPhase<Context>(plugin: Plugin<Context>, phase: Phase): Transformer | undefined;
}
export interface Plugin<Context = any> {
typeDefs?: TypeSource;
resolvers?: IResolvers<any, Context>;
transformer?: Plugin.Transformer | Plugin.Transformers;
}