UNPKG

967 BTypeScriptView Raw
1import { ApolloLink, Operation, FetchResult, Observable } from 'apollo-link';
2import { GraphQLSchema } from 'graphql';
3export declare namespace SchemaLink {
4 type ResolverContextFunction = (operation: Operation) => Record<string, any>;
5 interface Options {
6 /**
7 * The schema to generate responses from.
8 */
9 schema: GraphQLSchema;
10 /**
11 * The root value to use when generating responses.
12 */
13 rootValue?: any;
14 /**
15 * A context to provide to resolvers declared within the schema.
16 */
17 context?: ResolverContextFunction | Record<string, any>;
18 }
19}
20export declare class SchemaLink extends ApolloLink {
21 schema: GraphQLSchema;
22 rootValue: any;
23 context: SchemaLink.ResolverContextFunction | any;
24 constructor({ schema, rootValue, context }: SchemaLink.Options);
25 request(operation: Operation): Observable<FetchResult> | null;
26}
27export default SchemaLink;