UNPKG

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