graphql 14.5.0 → 14.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/error/GraphQLError.d.ts +21 -12
- package/error/formatError.d.ts +1 -1
- package/error/formatError.js +3 -0
- package/error/formatError.js.flow +22 -0
- package/error/formatError.mjs +3 -0
- package/error/index.d.ts +1 -2
- package/error/locatedError.d.ts +1 -1
- package/execution/execute.d.ts +33 -30
- package/execution/index.d.ts +3 -1
- package/execution/values.d.ts +12 -11
- package/graphql.d.ts +5 -2
- package/index.d.ts +107 -54
- package/jsutils/Path.d.ts +14 -0
- package/language/ast.d.ts +1 -1
- package/language/blockString.d.ts +14 -0
- package/language/index.d.ts +6 -3
- package/language/lexer.d.ts +3 -40
- package/language/parser.d.ts +1 -27
- package/language/printLocation.d.ts +16 -0
- package/language/tokenKind.d.ts +35 -0
- package/language/visitor.d.ts +107 -15
- package/package.json +2 -1
- package/polyfills/flatMap.js +5 -3
- package/polyfills/flatMap.js.flow +5 -2
- package/polyfills/flatMap.mjs +5 -2
- package/polyfills/isFinite.js +2 -2
- package/polyfills/isFinite.js.flow +5 -4
- package/polyfills/isFinite.mjs +2 -2
- package/subscription/asyncIteratorReject.d.ts +6 -0
- package/subscription/index.d.ts +5 -1
- package/subscription/mapAsyncIterator.d.ts +11 -0
- package/subscription/subscribe.d.ts +16 -12
- package/type/definition.d.ts +54 -23
- package/type/definition.js +10 -6
- package/type/definition.js.flow +2 -3
- package/type/definition.mjs +10 -6
- package/type/directives.d.ts +10 -2
- package/type/directives.js +1 -1
- package/type/directives.js.flow +1 -1
- package/type/directives.mjs +1 -1
- package/type/index.d.ts +6 -1
- package/type/introspection.d.ts +3 -8
- package/type/scalars.d.ts +1 -1
- package/type/schema.d.ts +9 -3
- package/type/validate.d.ts +1 -1
- package/utilities/TypeInfo.d.ts +4 -4
- package/utilities/buildASTSchema.d.ts +13 -11
- package/utilities/coerceInputValue.d.ts +17 -0
- package/utilities/coerceValue.d.ts +2 -6
- package/utilities/extendSchema.d.ts +1 -2
- package/utilities/findBreakingChanges.d.ts +9 -135
- package/utilities/findDeprecatedUsages.d.ts +2 -2
- package/utilities/getOperationRootType.d.ts +1 -1
- package/utilities/index.d.ts +7 -0
- package/utilities/separateOperations.d.ts +1 -1
- package/utilities/stripIgnoredCharacters.d.ts +55 -0
- package/utilities/typeComparators.d.ts +1 -5
- package/utilities/typeFromAST.d.ts +2 -9
- package/utilities/valueFromAST.d.ts +1 -6
- package/validation/ValidationContext.d.ts +23 -14
- package/validation/index.d.ts +1 -1
- package/validation/rules/ExecutableDefinitions.d.ts +1 -1
- package/validation/rules/FieldsOnCorrectType.d.ts +8 -1
- package/validation/rules/FragmentsOnCompositeTypes.d.ts +1 -1
- package/validation/rules/KnownArgumentNames.d.ts +2 -2
- package/validation/rules/KnownDirectives.d.ts +1 -1
- package/validation/rules/KnownFragmentNames.d.ts +1 -1
- package/validation/rules/KnownTypeNames.d.ts +1 -1
- package/validation/rules/LoneAnonymousOperation.d.ts +1 -1
- package/validation/rules/LoneSchemaDefinition.d.ts +1 -1
- package/validation/rules/NoFragmentCycles.d.ts +2 -2
- package/validation/rules/NoUndefinedVariables.d.ts +1 -1
- package/validation/rules/NoUnusedFragments.d.ts +1 -1
- package/validation/rules/NoUnusedVariables.d.ts +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.d.ts +1 -1
- package/validation/rules/PossibleFragmentSpreads.d.ts +1 -1
- package/validation/rules/PossibleTypeExtensions.d.ts +21 -0
- package/validation/rules/ProvidedRequiredArguments.d.ts +1 -1
- package/validation/rules/ScalarLeafs.d.ts +1 -1
- package/validation/rules/SingleFieldSubscriptions.d.ts +1 -1
- package/validation/rules/UniqueArgumentNames.d.ts +1 -1
- package/validation/rules/UniqueDirectiveNames.d.ts +13 -0
- package/validation/rules/UniqueDirectivesPerLocation.d.ts +1 -1
- package/validation/rules/UniqueEnumValueNames.d.ts +19 -0
- package/validation/rules/UniqueFieldDefinitionNames.d.ts +21 -0
- package/validation/rules/UniqueFragmentNames.d.ts +1 -1
- package/validation/rules/UniqueInputFieldNames.d.ts +1 -1
- package/validation/rules/UniqueOperationNames.d.ts +1 -1
- package/validation/rules/UniqueOperationTypes.d.ts +13 -0
- package/validation/rules/UniqueTypeNames.d.ts +13 -0
- package/validation/rules/UniqueVariableNames.d.ts +1 -1
- package/validation/rules/ValuesOfCorrectType.d.ts +8 -2
- package/validation/rules/VariablesAreInputTypes.d.ts +1 -1
- package/validation/rules/VariablesInAllowedPosition.d.ts +1 -1
- package/validation/specifiedRules.d.ts +8 -2
- package/validation/validate.d.ts +4 -2
- package/version.d.ts +14 -0
- package/version.js +2 -2
- package/version.js.flow +2 -2
- package/version.mjs +2 -2
- package/error/printError.d.ts +0 -7
package/error/GraphQLError.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Maybe from '../tsutils/Maybe';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { ASTNode } from '../language/ast';
|
|
4
4
|
import { Source } from '../language/source';
|
|
5
|
-
import { SourceLocation } from '../language/location';
|
|
5
|
+
import { SourceLocation, getLocation } from '../language/location';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A GraphQLError describes an Error found during the parse, validate, or
|
|
@@ -11,6 +11,16 @@ import { SourceLocation } from '../language/location';
|
|
|
11
11
|
* GraphQL document and/or execution result that correspond to the Error.
|
|
12
12
|
*/
|
|
13
13
|
export class GraphQLError extends Error {
|
|
14
|
+
constructor(
|
|
15
|
+
message: string,
|
|
16
|
+
nodes?: ReadonlyArray<ASTNode> | ASTNode | undefined,
|
|
17
|
+
source?: Maybe<Source>,
|
|
18
|
+
positions?: Maybe<ReadonlyArray<number>>,
|
|
19
|
+
path?: Maybe<ReadonlyArray<string | number>>,
|
|
20
|
+
originalError?: Maybe<Error>,
|
|
21
|
+
extensions?: Maybe<{ [key: string]: any }>,
|
|
22
|
+
);
|
|
23
|
+
|
|
14
24
|
/**
|
|
15
25
|
* A message describing the Error for debugging purposes.
|
|
16
26
|
*
|
|
@@ -47,6 +57,9 @@ export class GraphQLError extends Error {
|
|
|
47
57
|
|
|
48
58
|
/**
|
|
49
59
|
* The source GraphQL document corresponding to this error.
|
|
60
|
+
*
|
|
61
|
+
* Note that if this Error represents more than one node, the source may not
|
|
62
|
+
* represent nodes after the first node.
|
|
50
63
|
*/
|
|
51
64
|
readonly source: Source | undefined;
|
|
52
65
|
|
|
@@ -65,14 +78,10 @@ export class GraphQLError extends Error {
|
|
|
65
78
|
* Extension fields to add to the formatted error.
|
|
66
79
|
*/
|
|
67
80
|
readonly extensions: { [key: string]: any } | undefined;
|
|
68
|
-
|
|
69
|
-
constructor(
|
|
70
|
-
message: string,
|
|
71
|
-
nodes?: ReadonlyArray<ASTNode> | ASTNode | undefined,
|
|
72
|
-
source?: Maybe<Source>,
|
|
73
|
-
positions?: Maybe<ReadonlyArray<number>>,
|
|
74
|
-
path?: Maybe<ReadonlyArray<string | number>>,
|
|
75
|
-
originalError?: Maybe<Error>,
|
|
76
|
-
extensions?: Maybe<{ [key: string]: any }>,
|
|
77
|
-
);
|
|
78
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Prints a GraphQLError to a string, representing useful location information
|
|
85
|
+
* about the error's position in the source.
|
|
86
|
+
*/
|
|
87
|
+
export function printError(error: GraphQLError): string;
|
package/error/formatError.d.ts
CHANGED
package/error/formatError.js
CHANGED
|
@@ -22,9 +22,31 @@ export function formatError(error: GraphQLError): GraphQLFormattedError {
|
|
|
22
22
|
: { message, locations, path };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors
|
|
27
|
+
*/
|
|
25
28
|
export type GraphQLFormattedError = {|
|
|
29
|
+
/**
|
|
30
|
+
* A short, human-readable summary of the problem that **SHOULD NOT** change
|
|
31
|
+
* from occurrence to occurrence of the problem, except for purposes of
|
|
32
|
+
* localization.
|
|
33
|
+
*/
|
|
26
34
|
+message: string,
|
|
35
|
+
/**
|
|
36
|
+
* If an error can be associated to a particular point in the requested
|
|
37
|
+
* GraphQL document, it should contain a list of locations.
|
|
38
|
+
*/
|
|
27
39
|
+locations: $ReadOnlyArray<SourceLocation> | void,
|
|
40
|
+
/**
|
|
41
|
+
* If an error can be associated to a particular field in the GraphQL result,
|
|
42
|
+
* it _must_ contain an entry with the key `path` that details the path of
|
|
43
|
+
* the response field which experienced the error. This allows clients to
|
|
44
|
+
* identify whether a null result is intentional or caused by a runtime error.
|
|
45
|
+
*/
|
|
28
46
|
+path: $ReadOnlyArray<string | number> | void,
|
|
47
|
+
/**
|
|
48
|
+
* Reserved for implementors to extend the protocol however they see fit,
|
|
49
|
+
* and hence there are no additional restrictions on its contents.
|
|
50
|
+
*/
|
|
29
51
|
+extensions?: { [key: string]: mixed, ... },
|
|
30
52
|
|};
|
package/error/formatError.mjs
CHANGED
package/error/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { GraphQLError } from './GraphQLError';
|
|
1
|
+
export { GraphQLError, printError } from './GraphQLError';
|
|
2
2
|
export { syntaxError } from './syntaxError';
|
|
3
3
|
export { locatedError } from './locatedError';
|
|
4
|
-
export { printError } from './printError';
|
|
5
4
|
export { formatError, GraphQLFormattedError } from './formatError';
|
package/error/locatedError.d.ts
CHANGED
package/execution/execute.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import Maybe from '../tsutils/Maybe';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
GraphQLObjectType,
|
|
9
|
-
GraphQLResolveInfo,
|
|
10
|
-
} from '../type/definition';
|
|
2
|
+
import { PromiseOrValue } from '../jsutils/PromiseOrValue';
|
|
3
|
+
import { Path, addPath, pathToArray } from '../jsutils/Path';
|
|
4
|
+
|
|
5
|
+
import { GraphQLError } from '../error/GraphQLError';
|
|
6
|
+
import { locatedError } from '../error/locatedError';
|
|
7
|
+
|
|
11
8
|
import {
|
|
12
9
|
DirectiveNode,
|
|
13
10
|
DocumentNode,
|
|
@@ -17,7 +14,14 @@ import {
|
|
|
17
14
|
InlineFragmentNode,
|
|
18
15
|
FragmentDefinitionNode,
|
|
19
16
|
} from '../language/ast';
|
|
20
|
-
import {
|
|
17
|
+
import { GraphQLSchema } from '../type/schema';
|
|
18
|
+
import {
|
|
19
|
+
GraphQLField,
|
|
20
|
+
GraphQLFieldResolver,
|
|
21
|
+
GraphQLResolveInfo,
|
|
22
|
+
GraphQLTypeResolver,
|
|
23
|
+
GraphQLObjectType,
|
|
24
|
+
} from '../type/definition';
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Data that must be available at all points during query execution.
|
|
@@ -46,9 +50,10 @@ export interface ExecutionResultDataDefault {
|
|
|
46
50
|
* - `errors` is included when any errors occurred as a non-empty array.
|
|
47
51
|
* - `data` is the result of a successful execution of the query.
|
|
48
52
|
*/
|
|
53
|
+
// TS_SPECIFIC: TData and ExecutionResultDataDefault
|
|
49
54
|
export interface ExecutionResult<TData = ExecutionResultDataDefault> {
|
|
50
55
|
errors?: ReadonlyArray<GraphQLError>;
|
|
51
|
-
data?: TData;
|
|
56
|
+
data?: TData | null;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
export type ExecutionArgs = {
|
|
@@ -59,6 +64,7 @@ export type ExecutionArgs = {
|
|
|
59
64
|
variableValues?: Maybe<{ [key: string]: any }>;
|
|
60
65
|
operationName?: Maybe<string>;
|
|
61
66
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
|
|
67
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
|
|
62
68
|
};
|
|
63
69
|
|
|
64
70
|
/**
|
|
@@ -84,26 +90,9 @@ export function execute<TData = ExecutionResultDataDefault>(
|
|
|
84
90
|
variableValues?: Maybe<{ [key: string]: any }>,
|
|
85
91
|
operationName?: Maybe<string>,
|
|
86
92
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
|
|
93
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
|
87
94
|
): PromiseOrValue<ExecutionResult<TData>>;
|
|
88
95
|
|
|
89
|
-
/**
|
|
90
|
-
* Given a ResponsePath (found in the `path` entry in the information provided
|
|
91
|
-
* as the last argument to a field resolver), return an Array of the path keys.
|
|
92
|
-
*/
|
|
93
|
-
export function responsePathAsArray(
|
|
94
|
-
path: ResponsePath,
|
|
95
|
-
): ReadonlyArray<string | number>;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Given a ResponsePath and a key, return a new ResponsePath containing the
|
|
99
|
-
* new key.
|
|
100
|
-
|
|
101
|
-
*/
|
|
102
|
-
export function addPath(
|
|
103
|
-
prev: ResponsePath | undefined,
|
|
104
|
-
key: string | number,
|
|
105
|
-
): { prev: ResponsePath | undefined; key: string | number };
|
|
106
|
-
|
|
107
96
|
/**
|
|
108
97
|
* Essential assertions before executing to provide developer feedback for
|
|
109
98
|
* improper use of the GraphQL library.
|
|
@@ -128,6 +117,7 @@ export function buildExecutionContext(
|
|
|
128
117
|
rawVariableValues: Maybe<{ [key: string]: any }>,
|
|
129
118
|
operationName: Maybe<string>,
|
|
130
119
|
fieldResolver: Maybe<GraphQLFieldResolver<any, any>>,
|
|
120
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
|
131
121
|
): ReadonlyArray<GraphQLError> | ExecutionContext;
|
|
132
122
|
|
|
133
123
|
/**
|
|
@@ -151,11 +141,12 @@ export function buildResolveInfo(
|
|
|
151
141
|
fieldDef: GraphQLField<any, any>,
|
|
152
142
|
fieldNodes: ReadonlyArray<FieldNode>,
|
|
153
143
|
parentType: GraphQLObjectType,
|
|
154
|
-
path:
|
|
144
|
+
path: Path,
|
|
155
145
|
): GraphQLResolveInfo;
|
|
156
146
|
|
|
157
147
|
// Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
|
|
158
148
|
// function. Returns the result of resolveFn or the abrupt-return Error object.
|
|
149
|
+
// TS_SPECIFIC: TSource
|
|
159
150
|
export function resolveFieldValueOrError<TSource>(
|
|
160
151
|
exeContext: ExecutionContext,
|
|
161
152
|
fieldDef: GraphQLField<TSource, any>,
|
|
@@ -165,6 +156,18 @@ export function resolveFieldValueOrError<TSource>(
|
|
|
165
156
|
info: GraphQLResolveInfo,
|
|
166
157
|
): Error | any;
|
|
167
158
|
|
|
159
|
+
/**
|
|
160
|
+
* If a resolveType function is not given, then a default resolve behavior is
|
|
161
|
+
* used which attempts two strategies:
|
|
162
|
+
*
|
|
163
|
+
* First, See if the provided value has a `__typename` field defined, if so, use
|
|
164
|
+
* that value as name of the resolved type.
|
|
165
|
+
*
|
|
166
|
+
* Otherwise, test each possible type for the abstract type by calling
|
|
167
|
+
* isTypeOf for the object being coerced, returning the first type that matches.
|
|
168
|
+
*/
|
|
169
|
+
export const defaultTypeResolver: GraphQLTypeResolver<any, any>;
|
|
170
|
+
|
|
168
171
|
/**
|
|
169
172
|
* If a resolve function is not given, then a default resolve behavior is used
|
|
170
173
|
* which takes the property of the source object of the same name as the field
|
package/execution/index.d.ts
CHANGED
package/execution/values.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import Maybe from '../tsutils/Maybe';
|
|
2
2
|
import { GraphQLError } from '../error/GraphQLError';
|
|
3
|
-
import {
|
|
4
|
-
GraphQLInputType,
|
|
5
|
-
GraphQLField,
|
|
6
|
-
GraphQLArgument,
|
|
7
|
-
} from '../type/definition';
|
|
8
|
-
import { GraphQLDirective } from '../type/directives';
|
|
9
|
-
import { GraphQLSchema } from '../type/schema';
|
|
10
3
|
import {
|
|
11
4
|
FieldNode,
|
|
12
5
|
DirectiveNode,
|
|
13
6
|
VariableDefinitionNode,
|
|
14
7
|
} from '../language/ast';
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
import { GraphQLDirective } from '../type/directives';
|
|
10
|
+
import { GraphQLSchema } from '../type/schema';
|
|
11
|
+
import {
|
|
12
|
+
GraphQLInputType,
|
|
13
|
+
GraphQLField,
|
|
14
|
+
GraphQLArgument,
|
|
15
|
+
} from '../type/definition';
|
|
16
|
+
|
|
17
|
+
type CoercedVariableValues =
|
|
18
|
+
| { errors: ReadonlyArray<GraphQLError>; coerced?: never }
|
|
19
|
+
| { errors?: never; coerced: { [key: string]: any } };
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Prepares an object map of variableValues of the correct type based on the
|
|
@@ -31,6 +31,7 @@ export function getVariableValues(
|
|
|
31
31
|
schema: GraphQLSchema,
|
|
32
32
|
varDefNodes: VariableDefinitionNode[],
|
|
33
33
|
inputs: { [key: string]: any },
|
|
34
|
+
options?: { maxErrors?: number },
|
|
34
35
|
): CoercedVariableValues;
|
|
35
36
|
|
|
36
37
|
/**
|
package/graphql.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Maybe from './tsutils/Maybe';
|
|
2
2
|
import { Source } from './language/source';
|
|
3
|
-
import { GraphQLFieldResolver } from './type/definition';
|
|
4
3
|
import { GraphQLSchema } from './type/schema';
|
|
4
|
+
import { GraphQLFieldResolver, GraphQLTypeResolver } from './type/definition';
|
|
5
5
|
import {
|
|
6
6
|
ExecutionResult,
|
|
7
7
|
ExecutionResultDataDefault,
|
|
@@ -44,12 +44,13 @@ import {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface GraphQLArgs {
|
|
46
46
|
schema: GraphQLSchema;
|
|
47
|
-
source:
|
|
47
|
+
source: string | Source;
|
|
48
48
|
rootValue?: any;
|
|
49
49
|
contextValue?: any;
|
|
50
50
|
variableValues?: Maybe<{ [key: string]: any }>;
|
|
51
51
|
operationName?: Maybe<string>;
|
|
52
52
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
|
|
53
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
export function graphql<TData = ExecutionResultDataDefault>(
|
|
@@ -63,6 +64,7 @@ export function graphql<TData = ExecutionResultDataDefault>(
|
|
|
63
64
|
variableValues?: Maybe<{ [key: string]: any }>,
|
|
64
65
|
operationName?: Maybe<string>,
|
|
65
66
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
|
|
67
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
|
66
68
|
): Promise<ExecutionResult<TData>>;
|
|
67
69
|
|
|
68
70
|
/**
|
|
@@ -82,4 +84,5 @@ export function graphqlSync<TData = ExecutionResultDataDefault>(
|
|
|
82
84
|
variableValues?: Maybe<{ [key: string]: any }>,
|
|
83
85
|
operationName?: Maybe<string>,
|
|
84
86
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
|
|
87
|
+
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
|
85
88
|
): ExecutionResult<TData>;
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
// TypeScript Version: 2.6
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL.js provides a reference implementation for the GraphQL specification
|
|
5
|
+
* but is also a useful utility for operating on GraphQL files and building
|
|
6
|
+
* sophisticated tools.
|
|
7
|
+
*
|
|
8
|
+
* This primary module exports a general purpose function for fulfilling all
|
|
9
|
+
* steps of the GraphQL specification in a single operation, but also includes
|
|
10
|
+
* utilities for every part of the GraphQL specification:
|
|
11
|
+
*
|
|
12
|
+
* - Parsing the GraphQL language.
|
|
13
|
+
* - Building a GraphQL type schema.
|
|
14
|
+
* - Validating a GraphQL request against a type schema.
|
|
15
|
+
* - Executing a GraphQL request against a type schema.
|
|
16
|
+
*
|
|
17
|
+
* This also includes utility functions for operating on GraphQL types and
|
|
18
|
+
* GraphQL documents to facilitate building tools.
|
|
19
|
+
*
|
|
20
|
+
* You may also import from each sub-directory directly. For example, the
|
|
21
|
+
* following two import statements are equivalent:
|
|
22
|
+
*
|
|
23
|
+
* import { parse } from 'graphql';
|
|
24
|
+
* import { parse } from 'graphql/language';
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
// The GraphQL.js version info.
|
|
28
|
+
export { version, versionInfo } from './version';
|
|
29
|
+
|
|
3
30
|
// The primary entry point into fulfilling a GraphQL request.
|
|
4
|
-
export { graphql, graphqlSync
|
|
31
|
+
export { GraphQLArgs, graphql, graphqlSync } from './graphql';
|
|
5
32
|
|
|
6
33
|
// Create and operate on GraphQL type definitions and schema.
|
|
7
34
|
export {
|
|
8
|
-
GraphQLSchema,
|
|
9
35
|
// Definitions
|
|
36
|
+
GraphQLSchema,
|
|
37
|
+
GraphQLDirective,
|
|
10
38
|
GraphQLScalarType,
|
|
11
39
|
GraphQLObjectType,
|
|
12
40
|
GraphQLInterfaceType,
|
|
@@ -15,10 +43,7 @@ export {
|
|
|
15
43
|
GraphQLInputObjectType,
|
|
16
44
|
GraphQLList,
|
|
17
45
|
GraphQLNonNull,
|
|
18
|
-
|
|
19
|
-
// "Enum" of Type Kinds
|
|
20
|
-
TypeKind,
|
|
21
|
-
// Scalars
|
|
46
|
+
// Standard GraphQL Scalars
|
|
22
47
|
specifiedScalarTypes,
|
|
23
48
|
GraphQLInt,
|
|
24
49
|
GraphQLFloat,
|
|
@@ -30,12 +55,10 @@ export {
|
|
|
30
55
|
GraphQLIncludeDirective,
|
|
31
56
|
GraphQLSkipDirective,
|
|
32
57
|
GraphQLDeprecatedDirective,
|
|
58
|
+
// "Enum" of Type Kinds
|
|
59
|
+
TypeKind,
|
|
33
60
|
// Constant Deprecation Reason
|
|
34
61
|
DEFAULT_DEPRECATION_REASON,
|
|
35
|
-
// Meta-field definitions.
|
|
36
|
-
SchemaMetaFieldDef,
|
|
37
|
-
TypeMetaFieldDef,
|
|
38
|
-
TypeNameMetaFieldDef,
|
|
39
62
|
// GraphQL Types for introspection.
|
|
40
63
|
introspectionTypes,
|
|
41
64
|
__Schema,
|
|
@@ -46,6 +69,10 @@ export {
|
|
|
46
69
|
__InputValue,
|
|
47
70
|
__EnumValue,
|
|
48
71
|
__TypeKind,
|
|
72
|
+
// Meta-field definitions.
|
|
73
|
+
SchemaMetaFieldDef,
|
|
74
|
+
TypeMetaFieldDef,
|
|
75
|
+
TypeNameMetaFieldDef,
|
|
49
76
|
// Predicates
|
|
50
77
|
isSchema,
|
|
51
78
|
isDirective,
|
|
@@ -72,6 +99,8 @@ export {
|
|
|
72
99
|
isIntrospectionType,
|
|
73
100
|
isSpecifiedDirective,
|
|
74
101
|
// Assertions
|
|
102
|
+
assertSchema,
|
|
103
|
+
assertDirective,
|
|
75
104
|
assertType,
|
|
76
105
|
assertScalarType,
|
|
77
106
|
assertObjectType,
|
|
@@ -95,7 +124,9 @@ export {
|
|
|
95
124
|
// Validate GraphQL schema.
|
|
96
125
|
validateSchema,
|
|
97
126
|
assertValidSchema,
|
|
98
|
-
|
|
127
|
+
} from './type';
|
|
128
|
+
|
|
129
|
+
export {
|
|
99
130
|
GraphQLType,
|
|
100
131
|
GraphQLInputType,
|
|
101
132
|
GraphQLOutputType,
|
|
@@ -107,6 +138,7 @@ export {
|
|
|
107
138
|
GraphQLNamedType,
|
|
108
139
|
Thunk,
|
|
109
140
|
GraphQLSchemaConfig,
|
|
141
|
+
GraphQLDirectiveConfig,
|
|
110
142
|
GraphQLArgument,
|
|
111
143
|
GraphQLArgumentConfig,
|
|
112
144
|
GraphQLEnumTypeConfig,
|
|
@@ -132,7 +164,6 @@ export {
|
|
|
132
164
|
GraphQLScalarTypeConfig,
|
|
133
165
|
GraphQLTypeResolver,
|
|
134
166
|
GraphQLUnionTypeConfig,
|
|
135
|
-
GraphQLDirectiveConfig,
|
|
136
167
|
GraphQLScalarSerializer,
|
|
137
168
|
GraphQLScalarValueParser,
|
|
138
169
|
GraphQLScalarLiteralParser,
|
|
@@ -142,6 +173,12 @@ export {
|
|
|
142
173
|
export {
|
|
143
174
|
Source,
|
|
144
175
|
getLocation,
|
|
176
|
+
// Print source location
|
|
177
|
+
printLocation,
|
|
178
|
+
printSourceLocation,
|
|
179
|
+
// Lex
|
|
180
|
+
createLexer,
|
|
181
|
+
TokenKind,
|
|
145
182
|
// Parse
|
|
146
183
|
parse,
|
|
147
184
|
parseValue,
|
|
@@ -153,10 +190,9 @@ export {
|
|
|
153
190
|
visitInParallel,
|
|
154
191
|
visitWithTypeInfo,
|
|
155
192
|
getVisitFn,
|
|
193
|
+
BREAK,
|
|
156
194
|
Kind,
|
|
157
|
-
TokenKind,
|
|
158
195
|
DirectiveLocation,
|
|
159
|
-
BREAK,
|
|
160
196
|
// Predicates
|
|
161
197
|
isDefinitionNode,
|
|
162
198
|
isExecutableDefinitionNode,
|
|
@@ -167,20 +203,26 @@ export {
|
|
|
167
203
|
isTypeDefinitionNode,
|
|
168
204
|
isTypeSystemExtensionNode,
|
|
169
205
|
isTypeExtensionNode,
|
|
170
|
-
|
|
206
|
+
} from './language';
|
|
207
|
+
|
|
208
|
+
export {
|
|
171
209
|
Lexer,
|
|
172
210
|
ParseOptions,
|
|
173
211
|
SourceLocation,
|
|
212
|
+
Location,
|
|
213
|
+
Token,
|
|
214
|
+
TokenKindEnum,
|
|
215
|
+
KindEnum,
|
|
216
|
+
DirectiveLocationEnum,
|
|
174
217
|
// Visitor utilities
|
|
175
218
|
ASTVisitor,
|
|
176
219
|
Visitor,
|
|
177
220
|
VisitFn,
|
|
178
221
|
VisitorKeyMap,
|
|
179
222
|
// AST nodes
|
|
180
|
-
Location,
|
|
181
|
-
Token,
|
|
182
223
|
ASTNode,
|
|
183
224
|
ASTKindToNode,
|
|
225
|
+
// Each kind of AST node
|
|
184
226
|
NameNode,
|
|
185
227
|
DocumentNode,
|
|
186
228
|
DefinitionNode,
|
|
@@ -234,25 +276,26 @@ export {
|
|
|
234
276
|
UnionTypeExtensionNode,
|
|
235
277
|
EnumTypeExtensionNode,
|
|
236
278
|
InputObjectTypeExtensionNode,
|
|
237
|
-
KindEnum,
|
|
238
|
-
TokenKindEnum,
|
|
239
|
-
DirectiveLocationEnum,
|
|
240
279
|
} from './language';
|
|
241
280
|
|
|
242
281
|
// Execute GraphQL queries.
|
|
243
282
|
export {
|
|
244
283
|
execute,
|
|
245
284
|
defaultFieldResolver,
|
|
285
|
+
defaultTypeResolver,
|
|
246
286
|
responsePathAsArray,
|
|
247
287
|
getDirectiveValues,
|
|
248
|
-
// type
|
|
249
288
|
ExecutionArgs,
|
|
250
289
|
ExecutionResult,
|
|
251
290
|
} from './execution';
|
|
252
291
|
|
|
253
|
-
export {
|
|
292
|
+
export {
|
|
293
|
+
subscribe,
|
|
294
|
+
createSourceEventStream,
|
|
295
|
+
SubscriptionArgs,
|
|
296
|
+
} from './subscription';
|
|
254
297
|
|
|
255
|
-
// Validate GraphQL
|
|
298
|
+
// Validate GraphQL documents.
|
|
256
299
|
export {
|
|
257
300
|
validate,
|
|
258
301
|
ValidationContext,
|
|
@@ -284,13 +327,16 @@ export {
|
|
|
284
327
|
ValuesOfCorrectTypeRule,
|
|
285
328
|
VariablesAreInputTypesRule,
|
|
286
329
|
VariablesInAllowedPositionRule,
|
|
330
|
+
ValidationRule,
|
|
287
331
|
} from './validation';
|
|
288
332
|
|
|
289
|
-
// Create and
|
|
333
|
+
// Create, format, and print GraphQL errors.
|
|
290
334
|
export {
|
|
291
335
|
GraphQLError,
|
|
292
|
-
|
|
336
|
+
syntaxError,
|
|
337
|
+
locatedError,
|
|
293
338
|
printError,
|
|
339
|
+
formatError,
|
|
294
340
|
GraphQLFormattedError,
|
|
295
341
|
} from './error';
|
|
296
342
|
|
|
@@ -299,13 +345,13 @@ export {
|
|
|
299
345
|
// Produce the GraphQL query recommended for a full schema introspection.
|
|
300
346
|
// Accepts optional IntrospectionOptions.
|
|
301
347
|
getIntrospectionQuery,
|
|
302
|
-
// @deprecated: use getIntrospectionQuery - will be removed in v15
|
|
348
|
+
// @deprecated: use getIntrospectionQuery - will be removed in v15.
|
|
303
349
|
introspectionQuery,
|
|
304
|
-
// Gets the target Operation from a Document
|
|
350
|
+
// Gets the target Operation from a Document.
|
|
305
351
|
getOperationAST,
|
|
306
352
|
// Gets the Type for the target Operation AST.
|
|
307
353
|
getOperationRootType,
|
|
308
|
-
// Convert a GraphQLSchema to an IntrospectionQuery
|
|
354
|
+
// Convert a GraphQLSchema to an IntrospectionQuery.
|
|
309
355
|
introspectionFromSchema,
|
|
310
356
|
// Build a GraphQLSchema from an introspection result.
|
|
311
357
|
buildClientSchema,
|
|
@@ -314,7 +360,7 @@ export {
|
|
|
314
360
|
// Build a GraphQLSchema from a GraphQL schema language document.
|
|
315
361
|
buildSchema,
|
|
316
362
|
// @deprecated: Get the description from a schema AST node and supports legacy
|
|
317
|
-
// syntax for specifying descriptions - will be removed in v16
|
|
363
|
+
// syntax for specifying descriptions - will be removed in v16.
|
|
318
364
|
getDescription,
|
|
319
365
|
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
|
|
320
366
|
// language AST.
|
|
@@ -323,11 +369,11 @@ export {
|
|
|
323
369
|
lexicographicSortSchema,
|
|
324
370
|
// Print a GraphQLSchema to GraphQL Schema language.
|
|
325
371
|
printSchema,
|
|
372
|
+
// Print a GraphQLType to GraphQL Schema language.
|
|
373
|
+
printType,
|
|
326
374
|
// Prints the built-in introspection schema in the Schema Language
|
|
327
375
|
// format.
|
|
328
376
|
printIntrospectionSchema,
|
|
329
|
-
// Print a GraphQLType to GraphQL Schema language.
|
|
330
|
-
printType,
|
|
331
377
|
// Create a GraphQLType from a GraphQL language AST.
|
|
332
378
|
typeFromAST,
|
|
333
379
|
// Create a JavaScript value from a GraphQL language AST with a Type.
|
|
@@ -340,8 +386,10 @@ export {
|
|
|
340
386
|
// the GraphQL type system.
|
|
341
387
|
TypeInfo,
|
|
342
388
|
// Coerces a JavaScript value to a GraphQL type, or produces errors.
|
|
389
|
+
coerceInputValue,
|
|
390
|
+
// @deprecated use coerceInputValue - will be removed in v15
|
|
343
391
|
coerceValue,
|
|
344
|
-
// @deprecated use
|
|
392
|
+
// @deprecated use coerceInputValue - will be removed in v15
|
|
345
393
|
isValidJSValue,
|
|
346
394
|
// @deprecated use validation - will be removed in v15
|
|
347
395
|
isValidLiteralValue,
|
|
@@ -349,6 +397,9 @@ export {
|
|
|
349
397
|
concatAST,
|
|
350
398
|
// Separates an AST into an AST per Operation.
|
|
351
399
|
separateOperations,
|
|
400
|
+
// Strips characters that are not significant to the validity or execution
|
|
401
|
+
// of a GraphQL document.
|
|
402
|
+
stripIgnoredCharacters,
|
|
352
403
|
// Comparators for types
|
|
353
404
|
isEqualType,
|
|
354
405
|
isTypeSubTypeOf,
|
|
@@ -358,36 +409,38 @@ export {
|
|
|
358
409
|
// Determine if a string is a valid GraphQL name.
|
|
359
410
|
isValidNameError,
|
|
360
411
|
// Compares two GraphQLSchemas and detects breaking changes.
|
|
361
|
-
findBreakingChanges,
|
|
362
|
-
findDangerousChanges,
|
|
363
412
|
BreakingChangeType,
|
|
364
413
|
DangerousChangeType,
|
|
414
|
+
findBreakingChanges,
|
|
415
|
+
findDangerousChanges,
|
|
365
416
|
// Report all deprecated usage within a GraphQL document.
|
|
366
417
|
findDeprecatedUsages,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
DangerousChange,
|
|
418
|
+
} from './utilities';
|
|
419
|
+
|
|
420
|
+
export {
|
|
371
421
|
IntrospectionOptions,
|
|
372
|
-
|
|
422
|
+
IntrospectionQuery,
|
|
423
|
+
IntrospectionSchema,
|
|
424
|
+
IntrospectionType,
|
|
425
|
+
IntrospectionInputType,
|
|
426
|
+
IntrospectionOutputType,
|
|
427
|
+
IntrospectionScalarType,
|
|
428
|
+
IntrospectionObjectType,
|
|
429
|
+
IntrospectionInterfaceType,
|
|
430
|
+
IntrospectionUnionType,
|
|
373
431
|
IntrospectionEnumType,
|
|
374
|
-
IntrospectionEnumValue,
|
|
375
|
-
IntrospectionField,
|
|
376
432
|
IntrospectionInputObjectType,
|
|
377
|
-
|
|
433
|
+
IntrospectionTypeRef,
|
|
378
434
|
IntrospectionInputTypeRef,
|
|
379
|
-
|
|
380
|
-
IntrospectionInterfaceType,
|
|
381
|
-
IntrospectionListTypeRef,
|
|
435
|
+
IntrospectionOutputTypeRef,
|
|
382
436
|
IntrospectionNamedTypeRef,
|
|
437
|
+
IntrospectionListTypeRef,
|
|
383
438
|
IntrospectionNonNullTypeRef,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
IntrospectionTypeRef,
|
|
392
|
-
IntrospectionUnionType,
|
|
439
|
+
IntrospectionField,
|
|
440
|
+
IntrospectionInputValue,
|
|
441
|
+
IntrospectionEnumValue,
|
|
442
|
+
IntrospectionDirective,
|
|
443
|
+
BuildSchemaOptions,
|
|
444
|
+
BreakingChange,
|
|
445
|
+
DangerousChange,
|
|
393
446
|
} from './utilities';
|