forked from depop/archived-graphql-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
60 lines (56 loc) · 1.75 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import {
GraphQLType,
GraphQLResolveInfo,
GraphQLInterfaceType,
GraphQLOutputType,
GraphQLArgument,
GraphQLFieldResolver,
GraphQLInputType,
GraphQLNamedType,
GraphQLObjectType,
} from "graphql";
type ResolversMap = {
[key: string]: Function;
};
interface GraphQLFieldDefinition {
args: Array<GraphQLArgument>;
deprecationReason?: string;
description: string;
name: string;
resolve?: GraphQLFieldResolver<any, any>;
// eslint-disable-next-line @typescript-eslint/tslint/config
type: GraphQLOutputType;
}
interface GraphQLFieldDefinitionMap {
[fieldName: string]: GraphQLFieldDefinition;
}
export interface Middleware {
wrapMutations?: (mutationType: GraphQLObjectType) => GraphQLObjectType;
}
/* eslint-disable @typescript-eslint/tslint/config */
export class Registry {
public types: { [typeName: string]: GraphQLNamedType };
public constructor(middleware?: Middleware);
public addInterface(interface: GraphQLInterfaceType): void;
public addInterface(interface: GraphQLInterfaceType): void;
public addMutations(type: GraphQLObjectType): void;
public addType(type: GraphQLType): void;
public buildInterface(graphQLSpec: string, resolvers?: ResolversMap): any;
public createInterface(graphQLSpec: string): GraphQLInterfaceType;
public createMutations(
graphQLSpec: string,
resolvers?: ResolversMap
): GraphQLObjectType;
public createSubscriptions(
graphQLSpec: string,
resolvers?: ResolversMap
): GraphQLObjectType;
public createType(
graphQLSpec: string,
resolvers?: ResolversMap
): GraphQLObjectType;
public getMutationType(): GraphQLObjectType;
public getSubscriptionType(): GraphQLObjectType;
public getType(name: string): GraphQLType;
}
/* eslint-enable @typescript-eslint/tslint/config */