UNPKG

5.57 kBTypeScriptView Raw
1import { Maybe } from '../jsutils/Maybe';
2
3import { DirectiveLocationEnum } from '../language/directiveLocation';
4
5export interface IntrospectionOptions {
6 // Whether to include descriptions in the introspection result.
7 // Default: true
8 descriptions?: boolean;
9
10 // Whether to include `specifiedByUrl` in the introspection result.
11 // Default: false
12 specifiedByUrl?: boolean;
13
14 // Whether to include `isRepeatable` flag on directives.
15 // Default: false
16 directiveIsRepeatable?: boolean;
17
18 // Whether to include `description` field on schema.
19 // Default: false
20 schemaDescription?: boolean;
21
22 // Whether target GraphQL server support deprecation of input values.
23 // Default: false
24 inputValueDeprecation?: boolean;
25}
26
27export function getIntrospectionQuery(options?: IntrospectionOptions): string;
28
29export interface IntrospectionQuery {
30 readonly __schema: IntrospectionSchema;
31}
32
33export interface IntrospectionSchema {
34 readonly queryType: IntrospectionNamedTypeRef<IntrospectionObjectType>;
35 readonly mutationType: Maybe<
36 IntrospectionNamedTypeRef<IntrospectionObjectType>
37 >;
38 readonly subscriptionType: Maybe<
39 IntrospectionNamedTypeRef<IntrospectionObjectType>
40 >;
41 readonly types: ReadonlyArray<IntrospectionType>;
42 readonly directives: ReadonlyArray<IntrospectionDirective>;
43}
44
45export type IntrospectionType =
46 | IntrospectionScalarType
47 | IntrospectionObjectType
48 | IntrospectionInterfaceType
49 | IntrospectionUnionType
50 | IntrospectionEnumType
51 | IntrospectionInputObjectType;
52
53export type IntrospectionOutputType =
54 | IntrospectionScalarType
55 | IntrospectionObjectType
56 | IntrospectionInterfaceType
57 | IntrospectionUnionType
58 | IntrospectionEnumType;
59
60export type IntrospectionInputType =
61 | IntrospectionScalarType
62 | IntrospectionEnumType
63 | IntrospectionInputObjectType;
64
65export interface IntrospectionScalarType {
66 readonly kind: 'SCALAR';
67 readonly name: string;
68 readonly description?: Maybe<string>;
69 readonly specifiedByUrl?: Maybe<string>;
70}
71
72export interface IntrospectionObjectType {
73 readonly kind: 'OBJECT';
74 readonly name: string;
75 readonly description?: Maybe<string>;
76 readonly fields: ReadonlyArray<IntrospectionField>;
77 readonly interfaces: ReadonlyArray<
78 IntrospectionNamedTypeRef<IntrospectionInterfaceType>
79 >;
80}
81
82export interface IntrospectionInterfaceType {
83 readonly kind: 'INTERFACE';
84 readonly name: string;
85 readonly description?: Maybe<string>;
86 readonly fields: ReadonlyArray<IntrospectionField>;
87 readonly interfaces: ReadonlyArray<
88 IntrospectionNamedTypeRef<IntrospectionInterfaceType>
89 >;
90 readonly possibleTypes: ReadonlyArray<
91 IntrospectionNamedTypeRef<IntrospectionObjectType>
92 >;
93}
94
95export interface IntrospectionUnionType {
96 readonly kind: 'UNION';
97 readonly name: string;
98 readonly description?: Maybe<string>;
99 readonly possibleTypes: ReadonlyArray<
100 IntrospectionNamedTypeRef<IntrospectionObjectType>
101 >;
102}
103
104export interface IntrospectionEnumType {
105 readonly kind: 'ENUM';
106 readonly name: string;
107 readonly description?: Maybe<string>;
108 readonly enumValues: ReadonlyArray<IntrospectionEnumValue>;
109}
110
111export interface IntrospectionInputObjectType {
112 readonly kind: 'INPUT_OBJECT';
113 readonly name: string;
114 readonly description?: Maybe<string>;
115 readonly inputFields: ReadonlyArray<IntrospectionInputValue>;
116}
117
118export interface IntrospectionListTypeRef<
119 T extends IntrospectionTypeRef = IntrospectionTypeRef
120> {
121 readonly kind: 'LIST';
122 readonly ofType: T;
123}
124
125export interface IntrospectionNonNullTypeRef<
126 T extends IntrospectionTypeRef = IntrospectionTypeRef
127> {
128 readonly kind: 'NON_NULL';
129 readonly ofType: T;
130}
131
132export type IntrospectionTypeRef =
133 | IntrospectionNamedTypeRef
134 | IntrospectionListTypeRef<any>
135 | IntrospectionNonNullTypeRef<
136 IntrospectionNamedTypeRef | IntrospectionListTypeRef<any>
137 >;
138
139export type IntrospectionOutputTypeRef =
140 | IntrospectionNamedTypeRef<IntrospectionOutputType>
141 | IntrospectionListTypeRef<any>
142 | IntrospectionNonNullTypeRef<
143 | IntrospectionNamedTypeRef<IntrospectionOutputType>
144 | IntrospectionListTypeRef<any>
145 >;
146
147export type IntrospectionInputTypeRef =
148 | IntrospectionNamedTypeRef<IntrospectionInputType>
149 | IntrospectionListTypeRef<any>
150 | IntrospectionNonNullTypeRef<
151 | IntrospectionNamedTypeRef<IntrospectionInputType>
152 | IntrospectionListTypeRef<any>
153 >;
154
155export interface IntrospectionNamedTypeRef<
156 T extends IntrospectionType = IntrospectionType
157> {
158 readonly kind: T['kind'];
159 readonly name: string;
160}
161
162export interface IntrospectionField {
163 readonly name: string;
164 readonly description?: Maybe<string>;
165 readonly args: ReadonlyArray<IntrospectionInputValue>;
166 readonly type: IntrospectionOutputTypeRef;
167 readonly isDeprecated: boolean;
168 readonly deprecationReason?: Maybe<string>;
169}
170
171export interface IntrospectionInputValue {
172 readonly name: string;
173 readonly description?: Maybe<string>;
174 readonly type: IntrospectionInputTypeRef;
175 readonly defaultValue?: Maybe<string>;
176 readonly isDeprecated?: boolean;
177 readonly deprecationReason?: Maybe<string>;
178}
179
180export interface IntrospectionEnumValue {
181 readonly name: string;
182 readonly description?: Maybe<string>;
183 readonly isDeprecated: boolean;
184 readonly deprecationReason?: Maybe<string>;
185}
186
187export interface IntrospectionDirective {
188 readonly name: string;
189 readonly description?: Maybe<string>;
190 readonly isRepeatable?: boolean;
191 readonly locations: ReadonlyArray<DirectiveLocationEnum>;
192 readonly args: ReadonlyArray<IntrospectionInputValue>;
193}