forked from jjwtay/graphSchemaToJson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
89 lines (77 loc) · 1.48 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
type GraphQLType = {
astNode?: {
directives?: GraphQLDirective[]
}
}
type GraphQLDirective = {
name: {
value: string;
};
arguments?: GraphQLArgument[]
}
type GraphQLArgumentValue = {
kind: string;
value?: any;
fields?: GraphQLArgument[];
values?: GraphQLArgumentValue[];
}
type GraphQLArgument = {
name: {
value: string;
};
value: GraphQLArgumentValue;
}
type Argument = {
name: string;
value: string | number | Argument | Argument[];
}
type Directive = {
name: string;
arguments: Argument[];
}
type Field = {
type?: string;
directives?: {
[key: string]: Directive;
}
isList?: boolean;
isNullable?: boolean;
}
type Enum = {
fields: string[];
type: string;
directives?: {
[key: string]: Directive
};
}
type Type = {
fields: {
[key: string]: Field
};
directives: {
[key: string]: Directive
};
type: string;
implements: string[];
}
type Types = {
[key: string]: Types
}
type Schema = {
types: Types
}
type JSSchema = {
[key: string]: Type | Enum
}
declare function schemaToJS(schema: any) : JSSchema
declare namespace consts {
const ENUM: string
const GRAPHQL_LIST: string
const GRAPHQL_NON_NULL: string
const GRAPHQL_OBJECT_TYPE: string
const GRAPHQL_SCALAR_TYPE: string
const GRAPHQL_ENUM_TYPE: string
const LIST_TYPE: string
const NON_NULL_TYPE: string
const OBJECT: string
}