introspectionQuery.d.ts 4.9 KB

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