graphql 16.0.0 → 16.2.0
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/README.md +4 -4
- package/error/GraphQLError.js +4 -1
- package/error/GraphQLError.mjs +4 -1
- package/error/locatedError.js +2 -8
- package/error/locatedError.mjs +2 -6
- package/execution/collectFields.d.ts +6 -6
- package/execution/collectFields.js +6 -6
- package/execution/collectFields.mjs +6 -6
- package/execution/execute.js +16 -5
- package/execution/execute.mjs +16 -5
- package/execution/mapAsyncIterator.js +3 -1
- package/execution/mapAsyncIterator.mjs +3 -1
- package/execution/subscribe.js +8 -0
- package/execution/subscribe.mjs +7 -0
- package/execution/values.js +3 -2
- package/execution/values.mjs +3 -2
- package/graphql.js +8 -0
- package/graphql.mjs +7 -0
- package/index.d.ts +5 -0
- package/index.js +24 -0
- package/index.mjs +5 -0
- package/jsutils/devAssert.js +1 -1
- package/jsutils/devAssert.mjs +1 -1
- package/jsutils/instanceOf.js +3 -1
- package/jsutils/instanceOf.mjs +3 -1
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.mjs +1 -1
- package/jsutils/mapValue.js +2 -2
- package/jsutils/mapValue.mjs +2 -2
- package/jsutils/toError.d.ts +4 -0
- package/jsutils/toError.js +25 -0
- package/jsutils/toError.mjs +18 -0
- package/language/blockString.d.ts +7 -3
- package/language/blockString.js +121 -64
- package/language/blockString.mjs +111 -62
- package/language/characterClasses.d.ts +9 -0
- package/language/characterClasses.js +13 -0
- package/language/characterClasses.mjs +12 -0
- package/language/lexer.js +20 -9
- package/language/lexer.mjs +21 -10
- package/language/parser.js +3 -2
- package/language/parser.mjs +3 -2
- package/language/printer.js +3 -1
- package/language/printer.mjs +3 -1
- package/language/visitor.js +2 -1
- package/language/visitor.mjs +2 -1
- package/package.json +4 -1
- package/type/definition.d.ts +4 -0
- package/type/definition.js +2 -0
- package/type/definition.mjs +2 -3
- package/type/directives.d.ts +1 -1
- package/type/directives.js +3 -3
- package/type/directives.mjs +3 -3
- package/type/index.d.ts +5 -0
- package/type/index.js +24 -0
- package/type/index.mjs +5 -0
- package/type/introspection.js +8 -4
- package/type/introspection.mjs +8 -4
- package/type/scalars.d.ts +10 -0
- package/type/scalars.js +18 -10
- package/type/scalars.mjs +16 -11
- package/type/schema.d.ts +1 -1
- package/type/schema.js +5 -3
- package/type/schema.mjs +4 -3
- package/type/validate.js +35 -26
- package/type/validate.mjs +35 -26
- package/utilities/TypeInfo.js +4 -0
- package/utilities/TypeInfo.mjs +4 -0
- package/utilities/assertValidName.js +3 -2
- package/utilities/assertValidName.mjs +3 -2
- package/utilities/astFromValue.js +4 -2
- package/utilities/astFromValue.mjs +4 -2
- package/utilities/buildClientSchema.js +2 -0
- package/utilities/buildClientSchema.mjs +2 -0
- package/utilities/coerceInputValue.js +4 -2
- package/utilities/coerceInputValue.mjs +4 -2
- package/utilities/extendSchema.js +40 -32
- package/utilities/extendSchema.mjs +40 -29
- package/utilities/findBreakingChanges.js +4 -2
- package/utilities/findBreakingChanges.mjs +4 -2
- package/utilities/lexicographicSortSchema.js +6 -5
- package/utilities/lexicographicSortSchema.mjs +6 -5
- package/utilities/printSchema.js +9 -7
- package/utilities/printSchema.mjs +10 -5
- package/utilities/separateOperations.js +2 -0
- package/utilities/separateOperations.mjs +2 -0
- package/utilities/stripIgnoredCharacters.js +3 -19
- package/utilities/stripIgnoredCharacters.mjs +4 -23
- package/utilities/typeFromAST.js +13 -24
- package/utilities/typeFromAST.mjs +12 -17
- package/utilities/valueFromAST.js +4 -2
- package/utilities/valueFromAST.mjs +4 -2
- package/utilities/valueFromASTUntyped.js +1 -11
- package/utilities/valueFromASTUntyped.mjs +1 -5
- package/validation/rules/KnownArgumentNamesRule.js +3 -1
- package/validation/rules/KnownArgumentNamesRule.mjs +3 -1
- package/validation/rules/KnownDirectivesRule.js +11 -7
- package/validation/rules/KnownDirectivesRule.mjs +7 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +4 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +4 -3
- package/validation/rules/PossibleTypeExtensionsRule.js +14 -8
- package/validation/rules/PossibleTypeExtensionsRule.mjs +10 -4
- package/validation/rules/ProvidedRequiredArgumentsRule.js +8 -3
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +8 -3
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +9 -3
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +9 -3
- package/validation/rules/UniqueArgumentNamesRule.js +3 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.mjs +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +3 -1
- package/validation/rules/UniqueOperationTypesRule.js +3 -1
- package/validation/rules/UniqueOperationTypesRule.mjs +3 -1
- package/validation/rules/UniqueVariableNamesRule.js +3 -1
- package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
- package/version.js +2 -2
- package/version.mjs +2 -2
package/README.md
CHANGED
|
@@ -71,9 +71,9 @@ or an array of promises. A more complex example is included in the top-level [te
|
|
|
71
71
|
Then, serve the result of a query against that type schema.
|
|
72
72
|
|
|
73
73
|
```js
|
|
74
|
-
var
|
|
74
|
+
var source = '{ hello }';
|
|
75
75
|
|
|
76
|
-
graphql(schema,
|
|
76
|
+
graphql({ schema, source }).then((result) => {
|
|
77
77
|
// Prints
|
|
78
78
|
// {
|
|
79
79
|
// data: { hello: "world" }
|
|
@@ -87,9 +87,9 @@ first ensure the query is syntactically and semantically valid before executing
|
|
|
87
87
|
it, reporting errors otherwise.
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
|
-
var
|
|
90
|
+
var source = '{ BoyHowdy }';
|
|
91
91
|
|
|
92
|
-
graphql(schema,
|
|
92
|
+
graphql({ schema, source }).then((result) => {
|
|
93
93
|
// Prints
|
|
94
94
|
// {
|
|
95
95
|
// errors: [
|
package/error/GraphQLError.js
CHANGED
|
@@ -151,7 +151,9 @@ class GraphQLError extends Error {
|
|
|
151
151
|
enumerable: false,
|
|
152
152
|
},
|
|
153
153
|
}); // Include (non-enumerable) stack trace.
|
|
154
|
-
|
|
154
|
+
|
|
155
|
+
/* c8 ignore start */
|
|
156
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
155
157
|
|
|
156
158
|
if (
|
|
157
159
|
originalError !== null &&
|
|
@@ -172,6 +174,7 @@ class GraphQLError extends Error {
|
|
|
172
174
|
configurable: true,
|
|
173
175
|
});
|
|
174
176
|
}
|
|
177
|
+
/* c8 ignore stop */
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
get [Symbol.toStringTag]() {
|
package/error/GraphQLError.mjs
CHANGED
|
@@ -150,7 +150,9 @@ export class GraphQLError extends Error {
|
|
|
150
150
|
enumerable: false,
|
|
151
151
|
},
|
|
152
152
|
}); // Include (non-enumerable) stack trace.
|
|
153
|
-
|
|
153
|
+
|
|
154
|
+
/* c8 ignore start */
|
|
155
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
154
156
|
|
|
155
157
|
if (
|
|
156
158
|
originalError !== null &&
|
|
@@ -171,6 +173,7 @@ export class GraphQLError extends Error {
|
|
|
171
173
|
configurable: true,
|
|
172
174
|
});
|
|
173
175
|
}
|
|
176
|
+
/* c8 ignore stop */
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
get [Symbol.toStringTag]() {
|
package/error/locatedError.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
5
5
|
});
|
|
6
6
|
exports.locatedError = locatedError;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _toError = require('../jsutils/toError.js');
|
|
9
9
|
|
|
10
10
|
var _GraphQLError = require('./GraphQLError.js');
|
|
11
11
|
|
|
@@ -17,13 +17,7 @@ var _GraphQLError = require('./GraphQLError.js');
|
|
|
17
17
|
function locatedError(rawOriginalError, nodes, path) {
|
|
18
18
|
var _nodes;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const originalError =
|
|
22
|
-
rawOriginalError instanceof Error
|
|
23
|
-
? rawOriginalError
|
|
24
|
-
: new Error(
|
|
25
|
-
'Unexpected error value: ' + (0, _inspect.inspect)(rawOriginalError),
|
|
26
|
-
); // Note: this uses a brand-check to support GraphQL errors originating from other contexts.
|
|
20
|
+
const originalError = (0, _toError.toError)(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts.
|
|
27
21
|
|
|
28
22
|
if (isLocatedGraphQLError(originalError)) {
|
|
29
23
|
return originalError;
|
package/error/locatedError.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toError } from '../jsutils/toError.mjs';
|
|
2
2
|
import { GraphQLError } from './GraphQLError.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Given an arbitrary value, presumably thrown while attempting to execute a
|
|
@@ -9,11 +9,7 @@ import { GraphQLError } from './GraphQLError.mjs';
|
|
|
9
9
|
export function locatedError(rawOriginalError, nodes, path) {
|
|
10
10
|
var _nodes;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
const originalError =
|
|
14
|
-
rawOriginalError instanceof Error
|
|
15
|
-
? rawOriginalError
|
|
16
|
-
: new Error('Unexpected error value: ' + inspect(rawOriginalError)); // Note: this uses a brand-check to support GraphQL errors originating from other contexts.
|
|
12
|
+
const originalError = toError(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts.
|
|
17
13
|
|
|
18
14
|
if (isLocatedGraphQLError(originalError)) {
|
|
19
15
|
return originalError;
|
|
@@ -7,11 +7,11 @@ import type {
|
|
|
7
7
|
import type { GraphQLSchema } from '../type/schema';
|
|
8
8
|
import type { GraphQLObjectType } from '../type/definition';
|
|
9
9
|
/**
|
|
10
|
-
* Given a selectionSet,
|
|
10
|
+
* Given a selectionSet, collects all of the fields and returns them.
|
|
11
11
|
*
|
|
12
|
-
* CollectFields requires the "runtime type" of an object. For a field
|
|
12
|
+
* CollectFields requires the "runtime type" of an object. For a field that
|
|
13
13
|
* returns an Interface or Union type, the "runtime type" will be the actual
|
|
14
|
-
*
|
|
14
|
+
* object type returned by that field.
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
@@ -26,11 +26,11 @@ export declare function collectFields(
|
|
|
26
26
|
): Map<string, ReadonlyArray<FieldNode>>;
|
|
27
27
|
/**
|
|
28
28
|
* Given an array of field nodes, collects all of the subfields of the passed
|
|
29
|
-
* in fields, and returns
|
|
29
|
+
* in fields, and returns them at the end.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
31
|
+
* CollectSubFields requires the "return type" of an object. For a field that
|
|
32
32
|
* returns an Interface or Union type, the "return type" will be the actual
|
|
33
|
-
*
|
|
33
|
+
* object type returned by that field.
|
|
34
34
|
*
|
|
35
35
|
* @internal
|
|
36
36
|
*/
|
|
@@ -17,11 +17,11 @@ var _typeFromAST = require('../utilities/typeFromAST.js');
|
|
|
17
17
|
var _values = require('./values.js');
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Given a selectionSet,
|
|
20
|
+
* Given a selectionSet, collects all of the fields and returns them.
|
|
21
21
|
*
|
|
22
|
-
* CollectFields requires the "runtime type" of an object. For a field
|
|
22
|
+
* CollectFields requires the "runtime type" of an object. For a field that
|
|
23
23
|
* returns an Interface or Union type, the "runtime type" will be the actual
|
|
24
|
-
*
|
|
24
|
+
* object type returned by that field.
|
|
25
25
|
*
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
@@ -46,11 +46,11 @@ function collectFields(
|
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Given an array of field nodes, collects all of the subfields of the passed
|
|
49
|
-
* in fields, and returns
|
|
49
|
+
* in fields, and returns them at the end.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
51
|
+
* CollectSubFields requires the "return type" of an object. For a field that
|
|
52
52
|
* returns an Interface or Union type, the "return type" will be the actual
|
|
53
|
-
*
|
|
53
|
+
* object type returned by that field.
|
|
54
54
|
*
|
|
55
55
|
* @internal
|
|
56
56
|
*/
|
|
@@ -7,11 +7,11 @@ import { isAbstractType } from '../type/definition.mjs';
|
|
|
7
7
|
import { typeFromAST } from '../utilities/typeFromAST.mjs';
|
|
8
8
|
import { getDirectiveValues } from './values.mjs';
|
|
9
9
|
/**
|
|
10
|
-
* Given a selectionSet,
|
|
10
|
+
* Given a selectionSet, collects all of the fields and returns them.
|
|
11
11
|
*
|
|
12
|
-
* CollectFields requires the "runtime type" of an object. For a field
|
|
12
|
+
* CollectFields requires the "runtime type" of an object. For a field that
|
|
13
13
|
* returns an Interface or Union type, the "runtime type" will be the actual
|
|
14
|
-
*
|
|
14
|
+
* object type returned by that field.
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
@@ -37,11 +37,11 @@ export function collectFields(
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Given an array of field nodes, collects all of the subfields of the passed
|
|
40
|
-
* in fields, and returns
|
|
40
|
+
* in fields, and returns them at the end.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
42
|
+
* CollectSubFields requires the "return type" of an object. For a field that
|
|
43
43
|
* returns an Interface or Union type, the "return type" will be the actual
|
|
44
|
-
*
|
|
44
|
+
* object type returned by that field.
|
|
45
45
|
*
|
|
46
46
|
* @internal
|
|
47
47
|
*/
|
package/execution/execute.js
CHANGED
|
@@ -102,6 +102,12 @@ const collectSubfields = (0, _memoize.memoize3)(
|
|
|
102
102
|
* a GraphQLError will be thrown immediately explaining the invalid input.
|
|
103
103
|
*/
|
|
104
104
|
function execute(args) {
|
|
105
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
106
|
+
arguments.length < 2 ||
|
|
107
|
+
(0, _devAssert.devAssert)(
|
|
108
|
+
false,
|
|
109
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
110
|
+
);
|
|
105
111
|
const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error.
|
|
106
112
|
|
|
107
113
|
assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,
|
|
@@ -247,6 +253,8 @@ function buildExecutionContext(args) {
|
|
|
247
253
|
case _kinds.Kind.FRAGMENT_DEFINITION:
|
|
248
254
|
fragments[definition.name.value] = definition;
|
|
249
255
|
break;
|
|
256
|
+
|
|
257
|
+
default: // ignore non-executable definitions
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
260
|
|
|
@@ -260,7 +268,9 @@ function buildExecutionContext(args) {
|
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
return [new _GraphQLError.GraphQLError('Must provide an operation.')];
|
|
263
|
-
} //
|
|
271
|
+
} // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
272
|
+
|
|
273
|
+
/* c8 ignore next */
|
|
264
274
|
|
|
265
275
|
const variableDefinitions =
|
|
266
276
|
(_operation$variableDe = operation.variableDefinitions) !== null &&
|
|
@@ -424,7 +434,7 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
|
|
|
424
434
|
return (0, _promiseForObject.promiseForObject)(results);
|
|
425
435
|
}
|
|
426
436
|
/**
|
|
427
|
-
* Implements the "Executing
|
|
437
|
+
* Implements the "Executing fields" section of the spec
|
|
428
438
|
* In particular, this function figures out the value that the field returns by
|
|
429
439
|
* calling its resolve function, then calls completeValue to complete promises,
|
|
430
440
|
* serialize scalars, or execute the sub-selection-set for objects.
|
|
@@ -541,7 +551,7 @@ function handleFieldError(error, returnType, exeContext) {
|
|
|
541
551
|
}
|
|
542
552
|
/**
|
|
543
553
|
* Implements the instructions for completeValue as defined in the
|
|
544
|
-
* "
|
|
554
|
+
* "Value Completion" section of the spec.
|
|
545
555
|
*
|
|
546
556
|
* If the field type is Non-Null, then this recursively completes the value
|
|
547
557
|
* for the inner type. It throws a field error if that completion returns null,
|
|
@@ -618,7 +628,6 @@ function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
|
618
628
|
result,
|
|
619
629
|
);
|
|
620
630
|
} // If field type is Object, execute and complete all sub-selections.
|
|
621
|
-
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
622
631
|
|
|
623
632
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
624
633
|
return completeObjectValue(
|
|
@@ -629,7 +638,9 @@ function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
|
629
638
|
path,
|
|
630
639
|
result,
|
|
631
640
|
);
|
|
632
|
-
}
|
|
641
|
+
}
|
|
642
|
+
/* c8 ignore next 6 */
|
|
643
|
+
// Not reachable, all possible output types have been considered.
|
|
633
644
|
|
|
634
645
|
false ||
|
|
635
646
|
(0, _invariant.invariant)(
|
package/execution/execute.mjs
CHANGED
|
@@ -83,6 +83,12 @@ const collectSubfields = memoize3((exeContext, returnType, fieldNodes) =>
|
|
|
83
83
|
* a GraphQLError will be thrown immediately explaining the invalid input.
|
|
84
84
|
*/
|
|
85
85
|
export function execute(args) {
|
|
86
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
87
|
+
arguments.length < 2 ||
|
|
88
|
+
devAssert(
|
|
89
|
+
false,
|
|
90
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
91
|
+
);
|
|
86
92
|
const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error.
|
|
87
93
|
|
|
88
94
|
assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,
|
|
@@ -232,6 +238,8 @@ export function buildExecutionContext(args) {
|
|
|
232
238
|
case Kind.FRAGMENT_DEFINITION:
|
|
233
239
|
fragments[definition.name.value] = definition;
|
|
234
240
|
break;
|
|
241
|
+
|
|
242
|
+
default: // ignore non-executable definitions
|
|
235
243
|
}
|
|
236
244
|
}
|
|
237
245
|
|
|
@@ -241,7 +249,9 @@ export function buildExecutionContext(args) {
|
|
|
241
249
|
}
|
|
242
250
|
|
|
243
251
|
return [new GraphQLError('Must provide an operation.')];
|
|
244
|
-
} //
|
|
252
|
+
} // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
253
|
+
|
|
254
|
+
/* c8 ignore next */
|
|
245
255
|
|
|
246
256
|
const variableDefinitions =
|
|
247
257
|
(_operation$variableDe = operation.variableDefinitions) !== null &&
|
|
@@ -405,7 +415,7 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
|
|
|
405
415
|
return promiseForObject(results);
|
|
406
416
|
}
|
|
407
417
|
/**
|
|
408
|
-
* Implements the "Executing
|
|
418
|
+
* Implements the "Executing fields" section of the spec
|
|
409
419
|
* In particular, this function figures out the value that the field returns by
|
|
410
420
|
* calling its resolve function, then calls completeValue to complete promises,
|
|
411
421
|
* serialize scalars, or execute the sub-selection-set for objects.
|
|
@@ -520,7 +530,7 @@ function handleFieldError(error, returnType, exeContext) {
|
|
|
520
530
|
}
|
|
521
531
|
/**
|
|
522
532
|
* Implements the instructions for completeValue as defined in the
|
|
523
|
-
* "
|
|
533
|
+
* "Value Completion" section of the spec.
|
|
524
534
|
*
|
|
525
535
|
* If the field type is Non-Null, then this recursively completes the value
|
|
526
536
|
* for the inner type. It throws a field error if that completion returns null,
|
|
@@ -597,7 +607,6 @@ function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
|
597
607
|
result,
|
|
598
608
|
);
|
|
599
609
|
} // If field type is Object, execute and complete all sub-selections.
|
|
600
|
-
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
601
610
|
|
|
602
611
|
if (isObjectType(returnType)) {
|
|
603
612
|
return completeObjectValue(
|
|
@@ -608,7 +617,9 @@ function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
|
608
617
|
path,
|
|
609
618
|
result,
|
|
610
619
|
);
|
|
611
|
-
}
|
|
620
|
+
}
|
|
621
|
+
/* c8 ignore next 6 */
|
|
622
|
+
// Not reachable, all possible output types have been considered.
|
|
612
623
|
|
|
613
624
|
false ||
|
|
614
625
|
invariant(
|
|
@@ -23,7 +23,8 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
23
23
|
done: false,
|
|
24
24
|
};
|
|
25
25
|
} catch (error) {
|
|
26
|
-
|
|
26
|
+
/* c8 ignore start */
|
|
27
|
+
// FIXME: add test case
|
|
27
28
|
if (typeof iterator.return === 'function') {
|
|
28
29
|
try {
|
|
29
30
|
await iterator.return();
|
|
@@ -33,6 +34,7 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
throw error;
|
|
37
|
+
/* c8 ignore stop */
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -16,7 +16,8 @@ export function mapAsyncIterator(iterable, callback) {
|
|
|
16
16
|
done: false,
|
|
17
17
|
};
|
|
18
18
|
} catch (error) {
|
|
19
|
-
|
|
19
|
+
/* c8 ignore start */
|
|
20
|
+
// FIXME: add test case
|
|
20
21
|
if (typeof iterator.return === 'function') {
|
|
21
22
|
try {
|
|
22
23
|
await iterator.return();
|
|
@@ -26,6 +27,7 @@ export function mapAsyncIterator(iterable, callback) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
throw error;
|
|
30
|
+
/* c8 ignore stop */
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
package/execution/subscribe.js
CHANGED
|
@@ -8,6 +8,8 @@ exports.subscribe = subscribe;
|
|
|
8
8
|
|
|
9
9
|
var _inspect = require('../jsutils/inspect.js');
|
|
10
10
|
|
|
11
|
+
var _devAssert = require('../jsutils/devAssert.js');
|
|
12
|
+
|
|
11
13
|
var _isAsyncIterable = require('../jsutils/isAsyncIterable.js');
|
|
12
14
|
|
|
13
15
|
var _Path = require('../jsutils/Path.js');
|
|
@@ -46,6 +48,12 @@ var _mapAsyncIterator = require('./mapAsyncIterator.js');
|
|
|
46
48
|
* Accepts either an object with named arguments, or individual arguments.
|
|
47
49
|
*/
|
|
48
50
|
async function subscribe(args) {
|
|
51
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
52
|
+
arguments.length < 2 ||
|
|
53
|
+
(0, _devAssert.devAssert)(
|
|
54
|
+
false,
|
|
55
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
56
|
+
);
|
|
49
57
|
const {
|
|
50
58
|
schema,
|
|
51
59
|
document,
|
package/execution/subscribe.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inspect } from '../jsutils/inspect.mjs';
|
|
2
|
+
import { devAssert } from '../jsutils/devAssert.mjs';
|
|
2
3
|
import { isAsyncIterable } from '../jsutils/isAsyncIterable.mjs';
|
|
3
4
|
import { addPath, pathToArray } from '../jsutils/Path.mjs';
|
|
4
5
|
import { GraphQLError } from '../error/GraphQLError.mjs';
|
|
@@ -36,6 +37,12 @@ import { mapAsyncIterator } from './mapAsyncIterator.mjs';
|
|
|
36
37
|
*/
|
|
37
38
|
|
|
38
39
|
export async function subscribe(args) {
|
|
40
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
41
|
+
arguments.length < 2 ||
|
|
42
|
+
devAssert(
|
|
43
|
+
false,
|
|
44
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
45
|
+
);
|
|
39
46
|
const {
|
|
40
47
|
schema,
|
|
41
48
|
document,
|
package/execution/values.js
CHANGED
|
@@ -169,7 +169,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
169
169
|
function getArgumentValues(def, node, variableValues) {
|
|
170
170
|
var _node$arguments;
|
|
171
171
|
|
|
172
|
-
const coercedValues = {}; //
|
|
172
|
+
const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
173
|
+
|
|
174
|
+
/* c8 ignore next */
|
|
173
175
|
|
|
174
176
|
const argumentNodes =
|
|
175
177
|
(_node$arguments = node.arguments) !== null && _node$arguments !== void 0
|
|
@@ -275,7 +277,6 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
275
277
|
function getDirectiveValues(directiveDef, node, variableValues) {
|
|
276
278
|
var _node$directives;
|
|
277
279
|
|
|
278
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
279
280
|
const directiveNode =
|
|
280
281
|
(_node$directives = node.directives) === null || _node$directives === void 0
|
|
281
282
|
? void 0
|
package/execution/values.mjs
CHANGED
|
@@ -145,7 +145,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
145
145
|
export function getArgumentValues(def, node, variableValues) {
|
|
146
146
|
var _node$arguments;
|
|
147
147
|
|
|
148
|
-
const coercedValues = {}; //
|
|
148
|
+
const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
149
|
+
|
|
150
|
+
/* c8 ignore next */
|
|
149
151
|
|
|
150
152
|
const argumentNodes =
|
|
151
153
|
(_node$arguments = node.arguments) !== null && _node$arguments !== void 0
|
|
@@ -238,7 +240,6 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
238
240
|
export function getDirectiveValues(directiveDef, node, variableValues) {
|
|
239
241
|
var _node$directives;
|
|
240
242
|
|
|
241
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
242
243
|
const directiveNode =
|
|
243
244
|
(_node$directives = node.directives) === null || _node$directives === void 0
|
|
244
245
|
? void 0
|
package/graphql.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.graphql = graphql;
|
|
7
7
|
exports.graphqlSync = graphqlSync;
|
|
8
8
|
|
|
9
|
+
var _devAssert = require('./jsutils/devAssert.js');
|
|
10
|
+
|
|
9
11
|
var _isPromise = require('./jsutils/isPromise.js');
|
|
10
12
|
|
|
11
13
|
var _parser = require('./language/parser.js');
|
|
@@ -38,6 +40,12 @@ function graphqlSync(args) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function graphqlImpl(args) {
|
|
43
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
44
|
+
arguments.length < 2 ||
|
|
45
|
+
(0, _devAssert.devAssert)(
|
|
46
|
+
false,
|
|
47
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
48
|
+
);
|
|
41
49
|
const {
|
|
42
50
|
schema,
|
|
43
51
|
source,
|
package/graphql.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { devAssert } from './jsutils/devAssert.mjs';
|
|
1
2
|
import { isPromise } from './jsutils/isPromise.mjs';
|
|
2
3
|
import { parse } from './language/parser.mjs';
|
|
3
4
|
import { validate } from './validation/validate.mjs';
|
|
@@ -65,6 +66,12 @@ export function graphqlSync(args) {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
function graphqlImpl(args) {
|
|
69
|
+
// Temporary for v15 to v16 migration. Remove in v17
|
|
70
|
+
arguments.length < 2 ||
|
|
71
|
+
devAssert(
|
|
72
|
+
false,
|
|
73
|
+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
|
|
74
|
+
);
|
|
68
75
|
const {
|
|
69
76
|
schema,
|
|
70
77
|
source,
|
package/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type { GraphQLArgs } from './graphql';
|
|
|
30
30
|
export { graphql, graphqlSync } from './graphql';
|
|
31
31
|
/** Create and operate on GraphQL type definitions and schema. */
|
|
32
32
|
export {
|
|
33
|
+
resolveObjMapThunk,
|
|
34
|
+
resolveReadonlyArrayThunk,
|
|
33
35
|
/** Definitions */
|
|
34
36
|
GraphQLSchema,
|
|
35
37
|
GraphQLDirective,
|
|
@@ -48,6 +50,9 @@ export {
|
|
|
48
50
|
GraphQLString,
|
|
49
51
|
GraphQLBoolean,
|
|
50
52
|
GraphQLID,
|
|
53
|
+
/** Int boundaries constants */
|
|
54
|
+
GRAPHQL_MAX_INT,
|
|
55
|
+
GRAPHQL_MIN_INT,
|
|
51
56
|
/** Built-in Directives defined by the Spec */
|
|
52
57
|
specifiedDirectives,
|
|
53
58
|
GraphQLIncludeDirective,
|
package/index.js
CHANGED
|
@@ -51,6 +51,18 @@ Object.defineProperty(exports, 'FragmentsOnCompositeTypesRule', {
|
|
|
51
51
|
return _index4.FragmentsOnCompositeTypesRule;
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, 'GRAPHQL_MAX_INT', {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _index.GRAPHQL_MAX_INT;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, 'GRAPHQL_MIN_INT', {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _index.GRAPHQL_MIN_INT;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
54
66
|
Object.defineProperty(exports, 'GraphQLBoolean', {
|
|
55
67
|
enumerable: true,
|
|
56
68
|
get: function () {
|
|
@@ -1107,6 +1119,18 @@ Object.defineProperty(exports, 'printType', {
|
|
|
1107
1119
|
return _index6.printType;
|
|
1108
1120
|
},
|
|
1109
1121
|
});
|
|
1122
|
+
Object.defineProperty(exports, 'resolveObjMapThunk', {
|
|
1123
|
+
enumerable: true,
|
|
1124
|
+
get: function () {
|
|
1125
|
+
return _index.resolveObjMapThunk;
|
|
1126
|
+
},
|
|
1127
|
+
});
|
|
1128
|
+
Object.defineProperty(exports, 'resolveReadonlyArrayThunk', {
|
|
1129
|
+
enumerable: true,
|
|
1130
|
+
get: function () {
|
|
1131
|
+
return _index.resolveReadonlyArrayThunk;
|
|
1132
|
+
},
|
|
1133
|
+
});
|
|
1110
1134
|
Object.defineProperty(exports, 'responsePathAsArray', {
|
|
1111
1135
|
enumerable: true,
|
|
1112
1136
|
get: function () {
|
package/index.mjs
CHANGED
|
@@ -32,6 +32,8 @@ export { graphql, graphqlSync } from './graphql.mjs';
|
|
|
32
32
|
/** Create and operate on GraphQL type definitions and schema. */
|
|
33
33
|
|
|
34
34
|
export {
|
|
35
|
+
resolveObjMapThunk,
|
|
36
|
+
resolveReadonlyArrayThunk,
|
|
35
37
|
/** Definitions */
|
|
36
38
|
GraphQLSchema,
|
|
37
39
|
GraphQLDirective,
|
|
@@ -50,6 +52,9 @@ export {
|
|
|
50
52
|
GraphQLString,
|
|
51
53
|
GraphQLBoolean,
|
|
52
54
|
GraphQLID,
|
|
55
|
+
/** Int boundaries constants */
|
|
56
|
+
GRAPHQL_MAX_INT,
|
|
57
|
+
GRAPHQL_MIN_INT,
|
|
53
58
|
/** Built-in Directives defined by the Spec */
|
|
54
59
|
specifiedDirectives,
|
|
55
60
|
GraphQLIncludeDirective,
|
package/jsutils/devAssert.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.devAssert = devAssert;
|
|
7
7
|
|
|
8
8
|
function devAssert(condition, message) {
|
|
9
|
-
const booleanCondition = Boolean(condition);
|
|
9
|
+
const booleanCondition = Boolean(condition);
|
|
10
10
|
|
|
11
11
|
if (!booleanCondition) {
|
|
12
12
|
throw new Error(message);
|
package/jsutils/devAssert.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function devAssert(condition, message) {
|
|
2
|
-
const booleanCondition = Boolean(condition);
|
|
2
|
+
const booleanCondition = Boolean(condition);
|
|
3
3
|
|
|
4
4
|
if (!booleanCondition) {
|
|
5
5
|
throw new Error(message);
|
package/jsutils/instanceOf.js
CHANGED
|
@@ -14,7 +14,9 @@ var _inspect = require('./inspect.js');
|
|
|
14
14
|
* See: https://webpack.js.org/guides/production/
|
|
15
15
|
*/
|
|
16
16
|
const instanceOf =
|
|
17
|
-
|
|
17
|
+
/* c8 ignore next 5 */
|
|
18
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
19
|
+
process.env.NODE_ENV === 'production'
|
|
18
20
|
? function instanceOf(value, constructor) {
|
|
19
21
|
return value instanceof constructor;
|
|
20
22
|
}
|
package/jsutils/instanceOf.mjs
CHANGED
|
@@ -7,7 +7,9 @@ import { inspect } from './inspect.mjs';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export const instanceOf =
|
|
10
|
-
|
|
10
|
+
/* c8 ignore next 5 */
|
|
11
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
12
|
+
process.env.NODE_ENV === 'production'
|
|
11
13
|
? function instanceOf(value, constructor) {
|
|
12
14
|
return value instanceof constructor;
|
|
13
15
|
}
|
package/jsutils/invariant.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.invariant = invariant;
|
|
7
7
|
|
|
8
8
|
function invariant(condition, message) {
|
|
9
|
-
const booleanCondition = Boolean(condition);
|
|
9
|
+
const booleanCondition = Boolean(condition);
|
|
10
10
|
|
|
11
11
|
if (!booleanCondition) {
|
|
12
12
|
throw new Error(
|
package/jsutils/invariant.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function invariant(condition, message) {
|
|
2
|
-
const booleanCondition = Boolean(condition);
|
|
2
|
+
const booleanCondition = Boolean(condition);
|
|
3
3
|
|
|
4
4
|
if (!booleanCondition) {
|
|
5
5
|
throw new Error(
|
package/jsutils/mapValue.js
CHANGED
|
@@ -12,8 +12,8 @@ exports.mapValue = mapValue;
|
|
|
12
12
|
function mapValue(map, fn) {
|
|
13
13
|
const result = Object.create(null);
|
|
14
14
|
|
|
15
|
-
for (const
|
|
16
|
-
result[key] = fn(
|
|
15
|
+
for (const key of Object.keys(map)) {
|
|
16
|
+
result[key] = fn(map[key], key);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return result;
|
package/jsutils/mapValue.mjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
export function mapValue(map, fn) {
|
|
6
6
|
const result = Object.create(null);
|
|
7
7
|
|
|
8
|
-
for (const
|
|
9
|
-
result[key] = fn(
|
|
8
|
+
for (const key of Object.keys(map)) {
|
|
9
|
+
result[key] = fn(map[key], key);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
return result;
|