UNPKG

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