index.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. // Minimum TypeScript Version: 2.6
  2. /**
  3. * GraphQL.js provides a reference implementation for the GraphQL specification
  4. * but is also a useful utility for operating on GraphQL files and building
  5. * sophisticated tools.
  6. *
  7. * This primary module exports a general purpose function for fulfilling all
  8. * steps of the GraphQL specification in a single operation, but also includes
  9. * utilities for every part of the GraphQL specification:
  10. *
  11. * - Parsing the GraphQL language.
  12. * - Building a GraphQL type schema.
  13. * - Validating a GraphQL request against a type schema.
  14. * - Executing a GraphQL request against a type schema.
  15. *
  16. * This also includes utility functions for operating on GraphQL types and
  17. * GraphQL documents to facilitate building tools.
  18. *
  19. * You may also import from each sub-directory directly. For example, the
  20. * following two import statements are equivalent:
  21. *
  22. * import { parse } from 'graphql';
  23. * import { parse } from 'graphql/language';
  24. */
  25. // The GraphQL.js version info.
  26. export { version, versionInfo } from './version';
  27. // The primary entry point into fulfilling a GraphQL request.
  28. export { GraphQLArgs, graphql, graphqlSync } from './graphql';
  29. // Create and operate on GraphQL type definitions and schema.
  30. export {
  31. // Definitions
  32. GraphQLSchema,
  33. GraphQLDirective,
  34. GraphQLScalarType,
  35. GraphQLObjectType,
  36. GraphQLInterfaceType,
  37. GraphQLUnionType,
  38. GraphQLEnumType,
  39. GraphQLInputObjectType,
  40. GraphQLList,
  41. GraphQLNonNull,
  42. // Standard GraphQL Scalars
  43. specifiedScalarTypes,
  44. GraphQLInt,
  45. GraphQLFloat,
  46. GraphQLString,
  47. GraphQLBoolean,
  48. GraphQLID,
  49. // Built-in Directives defined by the Spec
  50. specifiedDirectives,
  51. GraphQLIncludeDirective,
  52. GraphQLSkipDirective,
  53. GraphQLDeprecatedDirective,
  54. GraphQLSpecifiedByDirective,
  55. // "Enum" of Type Kinds
  56. TypeKind,
  57. // Constant Deprecation Reason
  58. DEFAULT_DEPRECATION_REASON,
  59. // GraphQL Types for introspection.
  60. introspectionTypes,
  61. __Schema,
  62. __Directive,
  63. __DirectiveLocation,
  64. __Type,
  65. __Field,
  66. __InputValue,
  67. __EnumValue,
  68. __TypeKind,
  69. // Meta-field definitions.
  70. SchemaMetaFieldDef,
  71. TypeMetaFieldDef,
  72. TypeNameMetaFieldDef,
  73. // Predicates
  74. isSchema,
  75. isDirective,
  76. isType,
  77. isScalarType,
  78. isObjectType,
  79. isInterfaceType,
  80. isUnionType,
  81. isEnumType,
  82. isInputObjectType,
  83. isListType,
  84. isNonNullType,
  85. isInputType,
  86. isOutputType,
  87. isLeafType,
  88. isCompositeType,
  89. isAbstractType,
  90. isWrappingType,
  91. isNullableType,
  92. isNamedType,
  93. isRequiredArgument,
  94. isRequiredInputField,
  95. isSpecifiedScalarType,
  96. isIntrospectionType,
  97. isSpecifiedDirective,
  98. // Assertions
  99. assertSchema,
  100. assertDirective,
  101. assertType,
  102. assertScalarType,
  103. assertObjectType,
  104. assertInterfaceType,
  105. assertUnionType,
  106. assertEnumType,
  107. assertInputObjectType,
  108. assertListType,
  109. assertNonNullType,
  110. assertInputType,
  111. assertOutputType,
  112. assertLeafType,
  113. assertCompositeType,
  114. assertAbstractType,
  115. assertWrappingType,
  116. assertNullableType,
  117. assertNamedType,
  118. // Un-modifiers
  119. getNullableType,
  120. getNamedType,
  121. // Validate GraphQL schema.
  122. validateSchema,
  123. assertValidSchema,
  124. } from './type/index';
  125. export {
  126. GraphQLType,
  127. GraphQLInputType,
  128. GraphQLOutputType,
  129. GraphQLLeafType,
  130. GraphQLCompositeType,
  131. GraphQLAbstractType,
  132. GraphQLWrappingType,
  133. GraphQLNullableType,
  134. GraphQLNamedType,
  135. Thunk,
  136. GraphQLSchemaConfig,
  137. GraphQLSchemaExtensions,
  138. GraphQLDirectiveConfig,
  139. GraphQLDirectiveExtensions,
  140. GraphQLArgument,
  141. GraphQLArgumentConfig,
  142. GraphQLArgumentExtensions,
  143. GraphQLEnumTypeConfig,
  144. GraphQLEnumTypeExtensions,
  145. GraphQLEnumValue,
  146. GraphQLEnumValueConfig,
  147. GraphQLEnumValueExtensions,
  148. GraphQLEnumValueConfigMap,
  149. GraphQLField,
  150. GraphQLFieldConfig,
  151. GraphQLFieldExtensions,
  152. GraphQLFieldConfigArgumentMap,
  153. GraphQLFieldConfigMap,
  154. GraphQLFieldMap,
  155. GraphQLFieldResolver,
  156. GraphQLInputField,
  157. GraphQLInputFieldConfig,
  158. GraphQLInputFieldExtensions,
  159. GraphQLInputFieldConfigMap,
  160. GraphQLInputFieldMap,
  161. GraphQLInputObjectTypeConfig,
  162. GraphQLInputObjectTypeExtensions,
  163. GraphQLInterfaceTypeConfig,
  164. GraphQLInterfaceTypeExtensions,
  165. GraphQLIsTypeOfFn,
  166. GraphQLObjectTypeConfig,
  167. GraphQLObjectTypeExtensions,
  168. GraphQLResolveInfo,
  169. ResponsePath,
  170. GraphQLScalarTypeConfig,
  171. GraphQLScalarTypeExtensions,
  172. GraphQLTypeResolver,
  173. GraphQLUnionTypeConfig,
  174. GraphQLUnionTypeExtensions,
  175. GraphQLScalarSerializer,
  176. GraphQLScalarValueParser,
  177. GraphQLScalarLiteralParser,
  178. } from './type/index';
  179. // Parse and operate on GraphQL language source files.
  180. export {
  181. Token,
  182. Source,
  183. Location,
  184. getLocation,
  185. // Print source location
  186. printLocation,
  187. printSourceLocation,
  188. // Lex
  189. Lexer,
  190. TokenKind,
  191. // Parse
  192. parse,
  193. parseValue,
  194. parseType,
  195. // Print
  196. print,
  197. // Visit
  198. visit,
  199. visitInParallel,
  200. getVisitFn,
  201. BREAK,
  202. Kind,
  203. DirectiveLocation,
  204. // Predicates
  205. isDefinitionNode,
  206. isExecutableDefinitionNode,
  207. isSelectionNode,
  208. isValueNode,
  209. isTypeNode,
  210. isTypeSystemDefinitionNode,
  211. isTypeDefinitionNode,
  212. isTypeSystemExtensionNode,
  213. isTypeExtensionNode,
  214. } from './language/index';
  215. export {
  216. ParseOptions,
  217. SourceLocation,
  218. TokenKindEnum,
  219. KindEnum,
  220. DirectiveLocationEnum,
  221. // Visitor utilities
  222. ASTVisitor,
  223. Visitor,
  224. VisitFn,
  225. VisitorKeyMap,
  226. // AST nodes
  227. ASTNode,
  228. ASTKindToNode,
  229. // Each kind of AST node
  230. NameNode,
  231. DocumentNode,
  232. DefinitionNode,
  233. ExecutableDefinitionNode,
  234. OperationDefinitionNode,
  235. OperationTypeNode,
  236. VariableDefinitionNode,
  237. VariableNode,
  238. SelectionSetNode,
  239. SelectionNode,
  240. FieldNode,
  241. ArgumentNode,
  242. FragmentSpreadNode,
  243. InlineFragmentNode,
  244. FragmentDefinitionNode,
  245. ValueNode,
  246. IntValueNode,
  247. FloatValueNode,
  248. StringValueNode,
  249. BooleanValueNode,
  250. NullValueNode,
  251. EnumValueNode,
  252. ListValueNode,
  253. ObjectValueNode,
  254. ObjectFieldNode,
  255. DirectiveNode,
  256. TypeNode,
  257. NamedTypeNode,
  258. ListTypeNode,
  259. NonNullTypeNode,
  260. TypeSystemDefinitionNode,
  261. SchemaDefinitionNode,
  262. OperationTypeDefinitionNode,
  263. TypeDefinitionNode,
  264. ScalarTypeDefinitionNode,
  265. ObjectTypeDefinitionNode,
  266. FieldDefinitionNode,
  267. InputValueDefinitionNode,
  268. InterfaceTypeDefinitionNode,
  269. UnionTypeDefinitionNode,
  270. EnumTypeDefinitionNode,
  271. EnumValueDefinitionNode,
  272. InputObjectTypeDefinitionNode,
  273. DirectiveDefinitionNode,
  274. TypeSystemExtensionNode,
  275. SchemaExtensionNode,
  276. TypeExtensionNode,
  277. ScalarTypeExtensionNode,
  278. ObjectTypeExtensionNode,
  279. InterfaceTypeExtensionNode,
  280. UnionTypeExtensionNode,
  281. EnumTypeExtensionNode,
  282. InputObjectTypeExtensionNode,
  283. } from './language/index';
  284. // Execute GraphQL queries.
  285. export {
  286. execute,
  287. executeSync,
  288. defaultFieldResolver,
  289. defaultTypeResolver,
  290. responsePathAsArray,
  291. getDirectiveValues,
  292. ExecutionArgs,
  293. ExecutionResult,
  294. FormattedExecutionResult,
  295. } from './execution/index';
  296. export {
  297. subscribe,
  298. createSourceEventStream,
  299. SubscriptionArgs,
  300. } from './subscription/index';
  301. // Validate GraphQL documents.
  302. export {
  303. validate,
  304. ValidationContext,
  305. // All validation rules in the GraphQL Specification.
  306. specifiedRules,
  307. // Individual validation rules.
  308. ExecutableDefinitionsRule,
  309. FieldsOnCorrectTypeRule,
  310. FragmentsOnCompositeTypesRule,
  311. KnownArgumentNamesRule,
  312. KnownDirectivesRule,
  313. KnownFragmentNamesRule,
  314. KnownTypeNamesRule,
  315. LoneAnonymousOperationRule,
  316. NoFragmentCyclesRule,
  317. NoUndefinedVariablesRule,
  318. NoUnusedFragmentsRule,
  319. NoUnusedVariablesRule,
  320. OverlappingFieldsCanBeMergedRule,
  321. PossibleFragmentSpreadsRule,
  322. ProvidedRequiredArgumentsRule,
  323. ScalarLeafsRule,
  324. SingleFieldSubscriptionsRule,
  325. UniqueArgumentNamesRule,
  326. UniqueDirectivesPerLocationRule,
  327. UniqueFragmentNamesRule,
  328. UniqueInputFieldNamesRule,
  329. UniqueOperationNamesRule,
  330. UniqueVariableNamesRule,
  331. ValuesOfCorrectTypeRule,
  332. VariablesAreInputTypesRule,
  333. VariablesInAllowedPositionRule,
  334. // SDL-specific validation rules
  335. LoneSchemaDefinitionRule,
  336. UniqueOperationTypesRule,
  337. UniqueTypeNamesRule,
  338. UniqueEnumValueNamesRule,
  339. UniqueFieldDefinitionNamesRule,
  340. UniqueDirectiveNamesRule,
  341. PossibleTypeExtensionsRule,
  342. // Custom validation rules
  343. NoDeprecatedCustomRule,
  344. NoSchemaIntrospectionCustomRule,
  345. ValidationRule,
  346. } from './validation/index';
  347. // Create, format, and print GraphQL errors.
  348. export {
  349. GraphQLError,
  350. syntaxError,
  351. locatedError,
  352. printError,
  353. formatError,
  354. GraphQLFormattedError,
  355. } from './error/index';
  356. // Utilities for operating on GraphQL type schema and parsed sources.
  357. export {
  358. // Produce the GraphQL query recommended for a full schema introspection.
  359. // Accepts optional IntrospectionOptions.
  360. getIntrospectionQuery,
  361. // Gets the target Operation from a Document.
  362. getOperationAST,
  363. // Gets the Type for the target Operation AST.
  364. getOperationRootType,
  365. // Convert a GraphQLSchema to an IntrospectionQuery.
  366. introspectionFromSchema,
  367. // Build a GraphQLSchema from an introspection result.
  368. buildClientSchema,
  369. // Build a GraphQLSchema from a parsed GraphQL Schema language AST.
  370. buildASTSchema,
  371. // Build a GraphQLSchema from a GraphQL schema language document.
  372. buildSchema,
  373. // @deprecated: Get the description from a schema AST node and supports legacy
  374. // syntax for specifying descriptions - will be removed in v16.
  375. getDescription,
  376. // Extends an existing GraphQLSchema from a parsed GraphQL Schema
  377. // language AST.
  378. extendSchema,
  379. // Sort a GraphQLSchema.
  380. lexicographicSortSchema,
  381. // Print a GraphQLSchema to GraphQL Schema language.
  382. printSchema,
  383. // Print a GraphQLType to GraphQL Schema language.
  384. printType,
  385. // Prints the built-in introspection schema in the Schema Language
  386. // format.
  387. printIntrospectionSchema,
  388. // Create a GraphQLType from a GraphQL language AST.
  389. typeFromAST,
  390. // Create a JavaScript value from a GraphQL language AST with a Type.
  391. valueFromAST,
  392. // Create a JavaScript value from a GraphQL language AST without a Type.
  393. valueFromASTUntyped,
  394. // Create a GraphQL language AST from a JavaScript value.
  395. astFromValue,
  396. // A helper to use within recursive-descent visitors which need to be aware of
  397. // the GraphQL type system.
  398. TypeInfo,
  399. visitWithTypeInfo,
  400. // Coerces a JavaScript value to a GraphQL type, or produces errors.
  401. coerceInputValue,
  402. // Concatenates multiple AST together.
  403. concatAST,
  404. // Separates an AST into an AST per Operation.
  405. separateOperations,
  406. // Strips characters that are not significant to the validity or execution
  407. // of a GraphQL document.
  408. stripIgnoredCharacters,
  409. // Comparators for types
  410. isEqualType,
  411. isTypeSubTypeOf,
  412. doTypesOverlap,
  413. // Asserts a string is a valid GraphQL name.
  414. assertValidName,
  415. // Determine if a string is a valid GraphQL name.
  416. isValidNameError,
  417. // Compares two GraphQLSchemas and detects breaking changes.
  418. BreakingChangeType,
  419. DangerousChangeType,
  420. findBreakingChanges,
  421. findDangerousChanges,
  422. // @deprecated: Report all deprecated usage within a GraphQL document.
  423. findDeprecatedUsages,
  424. } from './utilities/index';
  425. export {
  426. IntrospectionOptions,
  427. IntrospectionQuery,
  428. IntrospectionSchema,
  429. IntrospectionType,
  430. IntrospectionInputType,
  431. IntrospectionOutputType,
  432. IntrospectionScalarType,
  433. IntrospectionObjectType,
  434. IntrospectionInterfaceType,
  435. IntrospectionUnionType,
  436. IntrospectionEnumType,
  437. IntrospectionInputObjectType,
  438. IntrospectionTypeRef,
  439. IntrospectionInputTypeRef,
  440. IntrospectionOutputTypeRef,
  441. IntrospectionNamedTypeRef,
  442. IntrospectionListTypeRef,
  443. IntrospectionNonNullTypeRef,
  444. IntrospectionField,
  445. IntrospectionInputValue,
  446. IntrospectionEnumValue,
  447. IntrospectionDirective,
  448. BuildSchemaOptions,
  449. BreakingChange,
  450. DangerousChange,
  451. TypedQueryDocumentNode,
  452. } from './utilities/index';