UNPKG

1.42 kBTypeScriptView Raw
1import { GraphQLSchema } from 'graphql';
2import { IApplyOptions, IMiddleware, FragmentReplacement, IMiddlewareGenerator, GraphQLSchemaWithFragmentReplacements } from './types';
3/**
4 *
5 * @param schema
6 * @param options
7 * @param middleware
8 *
9 * Validates middleware and generates resolvers map for provided middleware.
10 * Applies middleware to the current schema and returns the modified one.
11 *
12 */
13export declare function addMiddlewareToSchema<TSource, TContext, TArgs>(schema: GraphQLSchema, options: IApplyOptions, middleware: IMiddleware<TSource, TContext, TArgs>): {
14 schema: GraphQLSchema;
15 fragmentReplacements: FragmentReplacement[];
16};
17/**
18 *
19 * @param schema
20 * @param middlewares
21 *
22 * Apply middleware to resolvers and return generated schema.
23 *
24 */
25export declare function applyMiddleware<TSource = any, TContext = any, TArgs = any>(schema: GraphQLSchema, ...middlewares: (IMiddleware<TSource, TContext, TArgs> | IMiddlewareGenerator<TSource, TContext, TArgs>)[]): GraphQLSchemaWithFragmentReplacements;
26/**
27 *
28 * @param schema
29 * @param middlewares
30 *
31 * Apply middleware to declared resolvers and return new schema.
32 *
33 */
34export declare function applyMiddlewareToDeclaredResolvers<TSource = any, TContext = any, TArgs = any>(schema: GraphQLSchema, ...middlewares: (IMiddleware<TSource, TContext, TArgs> | IMiddlewareGenerator<TSource, TContext, TArgs>)[]): GraphQLSchemaWithFragmentReplacements;