index.d.ts 11 KB

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