1 | import { GraphQLResolveInfo, GraphQLSchema, GraphQLTypeResolver, GraphQLIsTypeOfFn } from 'graphql';
|
2 | import { StitchingInfo } from '@graphql-tools/delegate';
|
3 | export declare type IMiddlewareFragment = string;
|
4 | export declare type IMiddlewareResolver<TSource = any, TContext = any, TArgs = any> = (resolve: (source?: TSource, args?: TArgs, context?: TContext, info?: GraphQLResolveInfo & {
|
5 | stitchingInfo?: StitchingInfo;
|
6 | }) => any, parent: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<any>;
|
7 | export interface IMiddlewareWithOptions<TSource = any, TContext = any, TArgs = any> {
|
8 | fragment?: IMiddlewareFragment;
|
9 | fragments?: IMiddlewareFragment[];
|
10 | resolve?: IMiddlewareResolver<TSource, TContext, TArgs>;
|
11 | }
|
12 | export declare type IMiddlewareFunction<TSource = any, TContext = any, TArgs = any> = IMiddlewareWithOptions<TSource, TContext, TArgs> | IMiddlewareResolver<TSource, TContext, TArgs>;
|
13 | export interface IMiddlewareTypeMap<TSource = any, TContext = any, TArgs = any> {
|
14 | [key: string]: IMiddlewareFunction<TSource, TContext, TArgs> | IMiddlewareFieldMap<TSource, TContext, TArgs>;
|
15 | }
|
16 | export interface IMiddlewareFieldMap<TSource = any, TContext = any, TArgs = any> {
|
17 | [key: string]: IMiddlewareFunction<TSource, TContext, TArgs>;
|
18 | }
|
19 | export declare class IMiddlewareGenerator<TSource, TContext, TArgs> {
|
20 | constructor(generator: IMiddlewareGeneratorConstructor<TSource, TContext, TArgs>);
|
21 | generate(schema: GraphQLSchema): IMiddleware<TSource, TContext, TArgs>;
|
22 | }
|
23 | export declare type IMiddlewareGeneratorConstructor<TSource = any, TContext = any, TArgs = any> = (schema: GraphQLSchema) => IMiddleware<TSource, TContext, TArgs>;
|
24 | export declare type IMiddleware<TSource = any, TContext = any, TArgs = any> = IMiddlewareFunction<TSource, TContext, TArgs> | IMiddlewareTypeMap<TSource, TContext, TArgs>;
|
25 | export declare type IApplyOptions = {
|
26 | onlyDeclaredResolvers: boolean;
|
27 | };
|
28 | export declare type GraphQLSchemaWithFragmentReplacements = GraphQLSchema & {
|
29 | schema?: GraphQLSchema;
|
30 | fragmentReplacements?: FragmentReplacement[];
|
31 | };
|
32 | export interface FragmentReplacement {
|
33 | field: string;
|
34 | fragment: string;
|
35 | }
|
36 | export interface IResolvers<TSource = any, TContext = any> {
|
37 | [key: string]: IResolverObject<TSource, TContext>;
|
38 | }
|
39 | export interface IResolverObject<TSource = any, TContext = any> {
|
40 | [key: string]: IFieldResolver<TSource, TContext> | IResolverOptions<TSource, TContext>;
|
41 | }
|
42 | export interface IResolverOptions<TSource = any, TContext = any> {
|
43 | fragment?: string;
|
44 | fragments?: string[];
|
45 | resolve?: IFieldResolver<TSource, TContext>;
|
46 | subscribe?: IFieldResolver<TSource, TContext>;
|
47 | __resolveType?: GraphQLTypeResolver<TSource, TContext>;
|
48 | __isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
|
49 | }
|
50 | export declare type IFieldResolver<TSource, TContext> = (source: TSource, args: {
|
51 | [argument: string]: any;
|
52 | }, context: TContext, info: GraphQLResolveInfo & {
|
53 | stitchingInfo?: StitchingInfo;
|
54 | }) => any;
|