getIntrospectionQuery.d.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. import type { Maybe } from '../jsutils/Maybe';
  2. import type { DirectiveLocation } from '../language/directiveLocation';
  3. export 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. /**
  31. * Produce the GraphQL query recommended for a full schema introspection.
  32. * Accepts optional IntrospectionOptions.
  33. */
  34. export declare function getIntrospectionQuery(
  35. options?: IntrospectionOptions,
  36. ): string;
  37. export interface IntrospectionQuery {
  38. readonly __schema: IntrospectionSchema;
  39. }
  40. export interface IntrospectionSchema {
  41. readonly description?: Maybe<string>;
  42. readonly queryType: IntrospectionNamedTypeRef<IntrospectionObjectType>;
  43. readonly mutationType: Maybe<
  44. IntrospectionNamedTypeRef<IntrospectionObjectType>
  45. >;
  46. readonly subscriptionType: Maybe<
  47. IntrospectionNamedTypeRef<IntrospectionObjectType>
  48. >;
  49. readonly types: ReadonlyArray<IntrospectionType>;
  50. readonly directives: ReadonlyArray<IntrospectionDirective>;
  51. }
  52. export declare type IntrospectionType =
  53. | IntrospectionScalarType
  54. | IntrospectionObjectType
  55. | IntrospectionInterfaceType
  56. | IntrospectionUnionType
  57. | IntrospectionEnumType
  58. | IntrospectionInputObjectType;
  59. export declare type IntrospectionOutputType =
  60. | IntrospectionScalarType
  61. | IntrospectionObjectType
  62. | IntrospectionInterfaceType
  63. | IntrospectionUnionType
  64. | IntrospectionEnumType;
  65. export declare type IntrospectionInputType =
  66. | IntrospectionScalarType
  67. | IntrospectionEnumType
  68. | IntrospectionInputObjectType;
  69. export interface IntrospectionScalarType {
  70. readonly kind: 'SCALAR';
  71. readonly name: string;
  72. readonly description?: Maybe<string>;
  73. readonly specifiedByURL?: Maybe<string>;
  74. }
  75. export interface IntrospectionObjectType {
  76. readonly kind: 'OBJECT';
  77. readonly name: string;
  78. readonly description?: Maybe<string>;
  79. readonly fields: ReadonlyArray<IntrospectionField>;
  80. readonly interfaces: ReadonlyArray<
  81. IntrospectionNamedTypeRef<IntrospectionInterfaceType>
  82. >;
  83. }
  84. export interface IntrospectionInterfaceType {
  85. readonly kind: 'INTERFACE';
  86. readonly name: string;
  87. readonly description?: Maybe<string>;
  88. readonly fields: ReadonlyArray<IntrospectionField>;
  89. readonly interfaces: ReadonlyArray<
  90. IntrospectionNamedTypeRef<IntrospectionInterfaceType>
  91. >;
  92. readonly possibleTypes: ReadonlyArray<
  93. IntrospectionNamedTypeRef<IntrospectionObjectType>
  94. >;
  95. }
  96. export interface IntrospectionUnionType {
  97. readonly kind: 'UNION';
  98. readonly name: string;
  99. readonly description?: Maybe<string>;
  100. readonly possibleTypes: ReadonlyArray<
  101. IntrospectionNamedTypeRef<IntrospectionObjectType>
  102. >;
  103. }
  104. export interface IntrospectionEnumType {
  105. readonly kind: 'ENUM';
  106. readonly name: string;
  107. readonly description?: Maybe<string>;
  108. readonly enumValues: ReadonlyArray<IntrospectionEnumValue>;
  109. }
  110. export interface IntrospectionInputObjectType {
  111. readonly kind: 'INPUT_OBJECT';
  112. readonly name: string;
  113. readonly description?: Maybe<string>;
  114. readonly inputFields: ReadonlyArray<IntrospectionInputValue>;
  115. }
  116. export interface IntrospectionListTypeRef<
  117. T extends IntrospectionTypeRef = IntrospectionTypeRef,
  118. > {
  119. readonly kind: 'LIST';
  120. readonly ofType: T;
  121. }
  122. export interface IntrospectionNonNullTypeRef<
  123. T extends IntrospectionTypeRef = IntrospectionTypeRef,
  124. > {
  125. readonly kind: 'NON_NULL';
  126. readonly ofType: T;
  127. }
  128. export declare type IntrospectionTypeRef =
  129. | IntrospectionNamedTypeRef
  130. | IntrospectionListTypeRef
  131. | IntrospectionNonNullTypeRef<
  132. IntrospectionNamedTypeRef | IntrospectionListTypeRef
  133. >;
  134. export declare type IntrospectionOutputTypeRef =
  135. | IntrospectionNamedTypeRef<IntrospectionOutputType>
  136. | IntrospectionListTypeRef<IntrospectionOutputTypeRef>
  137. | IntrospectionNonNullTypeRef<
  138. | IntrospectionNamedTypeRef<IntrospectionOutputType>
  139. | IntrospectionListTypeRef<IntrospectionOutputTypeRef>
  140. >;
  141. export declare type IntrospectionInputTypeRef =
  142. | IntrospectionNamedTypeRef<IntrospectionInputType>
  143. | IntrospectionListTypeRef<IntrospectionInputTypeRef>
  144. | IntrospectionNonNullTypeRef<
  145. | IntrospectionNamedTypeRef<IntrospectionInputType>
  146. | IntrospectionListTypeRef<IntrospectionInputTypeRef>
  147. >;
  148. export interface IntrospectionNamedTypeRef<
  149. T extends IntrospectionType = IntrospectionType,
  150. > {
  151. readonly kind: T['kind'];
  152. readonly name: string;
  153. }
  154. export interface IntrospectionField {
  155. readonly name: string;
  156. readonly description?: Maybe<string>;
  157. readonly args: ReadonlyArray<IntrospectionInputValue>;
  158. readonly type: IntrospectionOutputTypeRef;
  159. readonly isDeprecated: boolean;
  160. readonly deprecationReason: Maybe<string>;
  161. }
  162. export interface IntrospectionInputValue {
  163. readonly name: string;
  164. readonly description?: Maybe<string>;
  165. readonly type: IntrospectionInputTypeRef;
  166. readonly defaultValue: Maybe<string>;
  167. readonly isDeprecated?: boolean;
  168. readonly deprecationReason?: Maybe<string>;
  169. }
  170. export interface IntrospectionEnumValue {
  171. readonly name: string;
  172. readonly description?: Maybe<string>;
  173. readonly isDeprecated: boolean;
  174. readonly deprecationReason: Maybe<string>;
  175. }
  176. export interface IntrospectionDirective {
  177. readonly name: string;
  178. readonly description?: Maybe<string>;
  179. readonly isRepeatable?: boolean;
  180. readonly locations: ReadonlyArray<DirectiveLocation>;
  181. readonly args: ReadonlyArray<IntrospectionInputValue>;
  182. }