UNPKG

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