graphql 16.3.0 → 16.4.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/error/GraphQLError.d.ts +2 -2
- package/error/GraphQLError.js +1 -1
- package/error/GraphQLError.mjs +1 -1
- package/error/locatedError.js +8 -8
- package/error/locatedError.mjs +8 -8
- package/error/syntaxError.js +3 -5
- package/error/syntaxError.mjs +4 -3
- package/execution/execute.js +15 -5
- package/execution/execute.mjs +15 -5
- package/execution/index.d.ts +5 -1
- package/execution/index.js +6 -0
- package/execution/index.mjs +5 -1
- package/execution/subscribe.js +6 -2
- package/execution/subscribe.mjs +6 -2
- package/execution/values.d.ts +0 -2
- package/execution/values.js +25 -17
- package/execution/values.mjs +25 -17
- package/index.d.ts +1 -0
- package/index.js +6 -0
- package/index.mjs +1 -0
- package/jsutils/instanceOf.js +2 -1
- package/jsutils/instanceOf.mjs +2 -1
- package/package.json +2 -2
- package/type/definition.d.ts +12 -6
- package/type/definition.js +18 -8
- package/type/definition.mjs +18 -8
- package/type/scalars.js +15 -5
- package/type/scalars.mjs +15 -5
- package/type/validate.js +5 -1
- package/type/validate.mjs +5 -1
- package/utilities/coerceInputValue.js +3 -5
- package/utilities/coerceInputValue.mjs +3 -8
- package/utilities/getOperationRootType.js +12 -4
- package/utilities/getOperationRootType.mjs +12 -10
- package/validation/rules/ExecutableDefinitionsRule.js +3 -1
- package/validation/rules/ExecutableDefinitionsRule.mjs +3 -4
- package/validation/rules/FieldsOnCorrectTypeRule.js +3 -1
- package/validation/rules/FieldsOnCorrectTypeRule.mjs +3 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.js +6 -2
- package/validation/rules/FragmentsOnCompositeTypesRule.mjs +6 -2
- package/validation/rules/KnownArgumentNamesRule.js +6 -2
- package/validation/rules/KnownArgumentNamesRule.mjs +6 -2
- package/validation/rules/KnownDirectivesRule.js +6 -2
- package/validation/rules/KnownDirectivesRule.mjs +6 -2
- package/validation/rules/KnownFragmentNamesRule.js +3 -1
- package/validation/rules/KnownFragmentNamesRule.mjs +3 -1
- package/validation/rules/KnownTypeNamesRule.js +3 -1
- package/validation/rules/KnownTypeNamesRule.mjs +3 -1
- package/validation/rules/LoneAnonymousOperationRule.js +3 -1
- package/validation/rules/LoneAnonymousOperationRule.mjs +3 -1
- package/validation/rules/LoneSchemaDefinitionRule.js +6 -2
- package/validation/rules/LoneSchemaDefinitionRule.mjs +6 -2
- package/validation/rules/NoFragmentCyclesRule.js +3 -1
- package/validation/rules/NoFragmentCyclesRule.mjs +3 -1
- package/validation/rules/NoUndefinedVariablesRule.js +3 -1
- package/validation/rules/NoUndefinedVariablesRule.mjs +3 -1
- package/validation/rules/NoUnusedFragmentsRule.js +3 -1
- package/validation/rules/NoUnusedFragmentsRule.mjs +3 -4
- package/validation/rules/NoUnusedVariablesRule.js +3 -1
- package/validation/rules/NoUnusedVariablesRule.mjs +3 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +3 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +3 -1
- package/validation/rules/PossibleFragmentSpreadsRule.js +6 -2
- package/validation/rules/PossibleFragmentSpreadsRule.mjs +6 -2
- package/validation/rules/PossibleTypeExtensionsRule.js +6 -2
- package/validation/rules/PossibleTypeExtensionsRule.mjs +6 -5
- package/validation/rules/ProvidedRequiredArgumentsRule.js +6 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +6 -2
- package/validation/rules/ScalarLeafsRule.js +6 -2
- package/validation/rules/ScalarLeafsRule.mjs +6 -2
- package/validation/rules/SingleFieldSubscriptionsRule.js +6 -2
- package/validation/rules/SingleFieldSubscriptionsRule.mjs +6 -2
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +3 -1
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +3 -1
- package/validation/rules/UniqueArgumentNamesRule.js +3 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
- package/validation/rules/UniqueDirectiveNamesRule.js +6 -2
- package/validation/rules/UniqueDirectiveNamesRule.mjs +6 -2
- package/validation/rules/UniqueDirectivesPerLocationRule.js +3 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +6 -2
- package/validation/rules/UniqueEnumValueNamesRule.mjs +6 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +6 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +6 -2
- package/validation/rules/UniqueFragmentNamesRule.js +3 -1
- package/validation/rules/UniqueFragmentNamesRule.mjs +3 -1
- package/validation/rules/UniqueInputFieldNamesRule.js +3 -1
- package/validation/rules/UniqueInputFieldNamesRule.mjs +3 -1
- package/validation/rules/UniqueOperationNamesRule.js +6 -1
- package/validation/rules/UniqueOperationNamesRule.mjs +6 -1
- package/validation/rules/UniqueOperationTypesRule.js +6 -2
- package/validation/rules/UniqueOperationTypesRule.mjs +6 -2
- package/validation/rules/UniqueTypeNamesRule.js +6 -2
- package/validation/rules/UniqueTypeNamesRule.mjs +6 -5
- package/validation/rules/UniqueVariableNamesRule.js +3 -1
- package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
- package/validation/rules/ValuesOfCorrectTypeRule.js +19 -10
- package/validation/rules/ValuesOfCorrectTypeRule.mjs +19 -10
- package/validation/rules/VariablesAreInputTypesRule.js +3 -1
- package/validation/rules/VariablesAreInputTypesRule.mjs +3 -1
- package/validation/rules/VariablesInAllowedPositionRule.js +3 -1
- package/validation/rules/VariablesInAllowedPositionRule.mjs +3 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.js +15 -5
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs +15 -5
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +3 -1
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +3 -1
- package/version.js +2 -2
- package/version.mjs +2 -2
package/error/GraphQLError.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare class GraphQLError extends Error {
|
|
|
75
75
|
* Extension fields to add to the formatted error.
|
|
76
76
|
*/
|
|
77
77
|
readonly extensions: GraphQLErrorExtensions;
|
|
78
|
+
constructor(message: string, args?: GraphQLErrorArgs);
|
|
78
79
|
/**
|
|
79
80
|
* @deprecated Please use the `GraphQLErrorArgs` constructor overload instead.
|
|
80
81
|
*/
|
|
@@ -91,7 +92,6 @@ export declare class GraphQLError extends Error {
|
|
|
91
92
|
>,
|
|
92
93
|
extensions?: Maybe<GraphQLErrorExtensions>,
|
|
93
94
|
);
|
|
94
|
-
constructor(message: string, args?: GraphQLErrorArgs);
|
|
95
95
|
get [Symbol.toStringTag](): string;
|
|
96
96
|
toString(): string;
|
|
97
97
|
toJSON(): GraphQLFormattedError;
|
|
@@ -137,6 +137,6 @@ export declare function printError(error: GraphQLError): string;
|
|
|
137
137
|
* Given a GraphQLError, format it according to the rules described by the
|
|
138
138
|
* Response Format, Errors section of the GraphQL Specification.
|
|
139
139
|
*
|
|
140
|
-
* @deprecated Please use `error.
|
|
140
|
+
* @deprecated Please use `error.toJSON` instead. Will be removed in v17
|
|
141
141
|
*/
|
|
142
142
|
export declare function formatError(error: GraphQLError): GraphQLFormattedError;
|
package/error/GraphQLError.js
CHANGED
|
@@ -259,7 +259,7 @@ function printError(error) {
|
|
|
259
259
|
* Given a GraphQLError, format it according to the rules described by the
|
|
260
260
|
* Response Format, Errors section of the GraphQL Specification.
|
|
261
261
|
*
|
|
262
|
-
* @deprecated Please use `error.
|
|
262
|
+
* @deprecated Please use `error.toJSON` instead. Will be removed in v17
|
|
263
263
|
*/
|
|
264
264
|
|
|
265
265
|
function formatError(error) {
|
package/error/GraphQLError.mjs
CHANGED
|
@@ -245,7 +245,7 @@ export function printError(error) {
|
|
|
245
245
|
* Given a GraphQLError, format it according to the rules described by the
|
|
246
246
|
* Response Format, Errors section of the GraphQL Specification.
|
|
247
247
|
*
|
|
248
|
-
* @deprecated Please use `error.
|
|
248
|
+
* @deprecated Please use `error.toJSON` instead. Will be removed in v17
|
|
249
249
|
*/
|
|
250
250
|
|
|
251
251
|
export function formatError(error) {
|
package/error/locatedError.js
CHANGED
|
@@ -23,16 +23,16 @@ function locatedError(rawOriginalError, nodes, path) {
|
|
|
23
23
|
return originalError;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
return new _GraphQLError.GraphQLError(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
originalError.source,
|
|
32
|
-
originalError.positions,
|
|
26
|
+
return new _GraphQLError.GraphQLError(originalError.message, {
|
|
27
|
+
nodes:
|
|
28
|
+
(_nodes = originalError.nodes) !== null && _nodes !== void 0
|
|
29
|
+
? _nodes
|
|
30
|
+
: nodes,
|
|
31
|
+
source: originalError.source,
|
|
32
|
+
positions: originalError.positions,
|
|
33
33
|
path,
|
|
34
34
|
originalError,
|
|
35
|
-
);
|
|
35
|
+
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function isLocatedGraphQLError(error) {
|
package/error/locatedError.mjs
CHANGED
|
@@ -15,16 +15,16 @@ export function locatedError(rawOriginalError, nodes, path) {
|
|
|
15
15
|
return originalError;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return new GraphQLError(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
originalError.source,
|
|
24
|
-
originalError.positions,
|
|
18
|
+
return new GraphQLError(originalError.message, {
|
|
19
|
+
nodes:
|
|
20
|
+
(_nodes = originalError.nodes) !== null && _nodes !== void 0
|
|
21
|
+
? _nodes
|
|
22
|
+
: nodes,
|
|
23
|
+
source: originalError.source,
|
|
24
|
+
positions: originalError.positions,
|
|
25
25
|
path,
|
|
26
26
|
originalError,
|
|
27
|
-
);
|
|
27
|
+
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function isLocatedGraphQLError(error) {
|
package/error/syntaxError.js
CHANGED
|
@@ -12,10 +12,8 @@ var _GraphQLError = require('./GraphQLError.js');
|
|
|
12
12
|
* descriptive information about the syntax error's position in the source.
|
|
13
13
|
*/
|
|
14
14
|
function syntaxError(source, position, description) {
|
|
15
|
-
return new _GraphQLError.GraphQLError(
|
|
16
|
-
`Syntax Error: ${description}`,
|
|
17
|
-
undefined,
|
|
15
|
+
return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, {
|
|
18
16
|
source,
|
|
19
|
-
[position],
|
|
20
|
-
);
|
|
17
|
+
positions: [position],
|
|
18
|
+
});
|
|
21
19
|
}
|
package/error/syntaxError.mjs
CHANGED
|
@@ -5,7 +5,8 @@ import { GraphQLError } from './GraphQLError.mjs';
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export function syntaxError(source, position, description) {
|
|
8
|
-
return new GraphQLError(`Syntax Error: ${description}`,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return new GraphQLError(`Syntax Error: ${description}`, {
|
|
9
|
+
source,
|
|
10
|
+
positions: [position],
|
|
11
|
+
});
|
|
11
12
|
}
|
package/execution/execute.js
CHANGED
|
@@ -324,7 +324,9 @@ function executeOperation(exeContext, operation, rootValue) {
|
|
|
324
324
|
if (rootType == null) {
|
|
325
325
|
throw new _GraphQLError.GraphQLError(
|
|
326
326
|
`Schema is not configured to execute ${operation.operation} operation.`,
|
|
327
|
-
|
|
327
|
+
{
|
|
328
|
+
nodes: operation,
|
|
329
|
+
},
|
|
328
330
|
);
|
|
329
331
|
}
|
|
330
332
|
|
|
@@ -842,21 +844,27 @@ function ensureValidRuntimeType(
|
|
|
842
844
|
if (runtimeType == null) {
|
|
843
845
|
throw new _GraphQLError.GraphQLError(
|
|
844
846
|
`Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
|
|
845
|
-
|
|
847
|
+
{
|
|
848
|
+
nodes: fieldNodes,
|
|
849
|
+
},
|
|
846
850
|
);
|
|
847
851
|
}
|
|
848
852
|
|
|
849
853
|
if (!(0, _definition.isObjectType)(runtimeType)) {
|
|
850
854
|
throw new _GraphQLError.GraphQLError(
|
|
851
855
|
`Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`,
|
|
852
|
-
|
|
856
|
+
{
|
|
857
|
+
nodes: fieldNodes,
|
|
858
|
+
},
|
|
853
859
|
);
|
|
854
860
|
}
|
|
855
861
|
|
|
856
862
|
if (!exeContext.schema.isSubType(returnType, runtimeType)) {
|
|
857
863
|
throw new _GraphQLError.GraphQLError(
|
|
858
864
|
`Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`,
|
|
859
|
-
|
|
865
|
+
{
|
|
866
|
+
nodes: fieldNodes,
|
|
867
|
+
},
|
|
860
868
|
);
|
|
861
869
|
}
|
|
862
870
|
|
|
@@ -910,7 +918,9 @@ function invalidReturnTypeError(returnType, result, fieldNodes) {
|
|
|
910
918
|
return new _GraphQLError.GraphQLError(
|
|
911
919
|
`Expected value of type "${returnType.name}" but got: ${(0,
|
|
912
920
|
_inspect.inspect)(result)}.`,
|
|
913
|
-
|
|
921
|
+
{
|
|
922
|
+
nodes: fieldNodes,
|
|
923
|
+
},
|
|
914
924
|
);
|
|
915
925
|
}
|
|
916
926
|
/**
|
package/execution/execute.mjs
CHANGED
|
@@ -305,7 +305,9 @@ function executeOperation(exeContext, operation, rootValue) {
|
|
|
305
305
|
if (rootType == null) {
|
|
306
306
|
throw new GraphQLError(
|
|
307
307
|
`Schema is not configured to execute ${operation.operation} operation.`,
|
|
308
|
-
|
|
308
|
+
{
|
|
309
|
+
nodes: operation,
|
|
310
|
+
},
|
|
309
311
|
);
|
|
310
312
|
}
|
|
311
313
|
|
|
@@ -812,21 +814,27 @@ function ensureValidRuntimeType(
|
|
|
812
814
|
if (runtimeType == null) {
|
|
813
815
|
throw new GraphQLError(
|
|
814
816
|
`Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
|
|
815
|
-
|
|
817
|
+
{
|
|
818
|
+
nodes: fieldNodes,
|
|
819
|
+
},
|
|
816
820
|
);
|
|
817
821
|
}
|
|
818
822
|
|
|
819
823
|
if (!isObjectType(runtimeType)) {
|
|
820
824
|
throw new GraphQLError(
|
|
821
825
|
`Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`,
|
|
822
|
-
|
|
826
|
+
{
|
|
827
|
+
nodes: fieldNodes,
|
|
828
|
+
},
|
|
823
829
|
);
|
|
824
830
|
}
|
|
825
831
|
|
|
826
832
|
if (!exeContext.schema.isSubType(returnType, runtimeType)) {
|
|
827
833
|
throw new GraphQLError(
|
|
828
834
|
`Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`,
|
|
829
|
-
|
|
835
|
+
{
|
|
836
|
+
nodes: fieldNodes,
|
|
837
|
+
},
|
|
830
838
|
);
|
|
831
839
|
}
|
|
832
840
|
|
|
@@ -879,7 +887,9 @@ function completeObjectValue(
|
|
|
879
887
|
function invalidReturnTypeError(returnType, result, fieldNodes) {
|
|
880
888
|
return new GraphQLError(
|
|
881
889
|
`Expected value of type "${returnType.name}" but got: ${inspect(result)}.`,
|
|
882
|
-
|
|
890
|
+
{
|
|
891
|
+
nodes: fieldNodes,
|
|
892
|
+
},
|
|
883
893
|
);
|
|
884
894
|
}
|
|
885
895
|
/**
|
package/execution/index.d.ts
CHANGED
|
@@ -11,4 +11,8 @@ export type {
|
|
|
11
11
|
FormattedExecutionResult,
|
|
12
12
|
} from './execute';
|
|
13
13
|
export { subscribe, createSourceEventStream } from './subscribe';
|
|
14
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
getArgumentValues,
|
|
16
|
+
getVariableValues,
|
|
17
|
+
getDirectiveValues,
|
|
18
|
+
} from './values';
|
package/execution/index.js
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, 'executeSync', {
|
|
|
33
33
|
return _execute.executeSync;
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, 'getArgumentValues', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _values.getArgumentValues;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, 'getDirectiveValues', {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function () {
|
package/execution/index.mjs
CHANGED
|
@@ -6,4 +6,8 @@ export {
|
|
|
6
6
|
defaultTypeResolver,
|
|
7
7
|
} from './execute.mjs';
|
|
8
8
|
export { subscribe, createSourceEventStream } from './subscribe.mjs';
|
|
9
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
getArgumentValues,
|
|
11
|
+
getVariableValues,
|
|
12
|
+
getDirectiveValues,
|
|
13
|
+
} from './values.mjs';
|
package/execution/subscribe.js
CHANGED
|
@@ -190,7 +190,9 @@ async function executeSubscription(exeContext) {
|
|
|
190
190
|
if (rootType == null) {
|
|
191
191
|
throw new _GraphQLError.GraphQLError(
|
|
192
192
|
'Schema is not configured to execute subscription operation.',
|
|
193
|
-
|
|
193
|
+
{
|
|
194
|
+
nodes: operation,
|
|
195
|
+
},
|
|
194
196
|
);
|
|
195
197
|
}
|
|
196
198
|
|
|
@@ -208,7 +210,9 @@ async function executeSubscription(exeContext) {
|
|
|
208
210
|
const fieldName = fieldNodes[0].name.value;
|
|
209
211
|
throw new _GraphQLError.GraphQLError(
|
|
210
212
|
`The subscription field "${fieldName}" is not defined.`,
|
|
211
|
-
|
|
213
|
+
{
|
|
214
|
+
nodes: fieldNodes,
|
|
215
|
+
},
|
|
212
216
|
);
|
|
213
217
|
}
|
|
214
218
|
|
package/execution/subscribe.mjs
CHANGED
|
@@ -176,7 +176,9 @@ async function executeSubscription(exeContext) {
|
|
|
176
176
|
if (rootType == null) {
|
|
177
177
|
throw new GraphQLError(
|
|
178
178
|
'Schema is not configured to execute subscription operation.',
|
|
179
|
-
|
|
179
|
+
{
|
|
180
|
+
nodes: operation,
|
|
181
|
+
},
|
|
180
182
|
);
|
|
181
183
|
}
|
|
182
184
|
|
|
@@ -194,7 +196,9 @@ async function executeSubscription(exeContext) {
|
|
|
194
196
|
const fieldName = fieldNodes[0].name.value;
|
|
195
197
|
throw new GraphQLError(
|
|
196
198
|
`The subscription field "${fieldName}" is not defined.`,
|
|
197
|
-
|
|
199
|
+
{
|
|
200
|
+
nodes: fieldNodes,
|
|
201
|
+
},
|
|
198
202
|
);
|
|
199
203
|
}
|
|
200
204
|
|
package/execution/values.d.ts
CHANGED
|
@@ -46,8 +46,6 @@ export declare function getVariableValues(
|
|
|
46
46
|
* Note: The returned value is a plain Object with a prototype, since it is
|
|
47
47
|
* exposed to user code. Care should be taken to not pull values from the
|
|
48
48
|
* Object prototype.
|
|
49
|
-
*
|
|
50
|
-
* @internal
|
|
51
49
|
*/
|
|
52
50
|
export declare function getArgumentValues(
|
|
53
51
|
def: GraphQLField<unknown, unknown> | GraphQLDirective,
|
package/execution/values.js
CHANGED
|
@@ -85,7 +85,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
85
85
|
onError(
|
|
86
86
|
new _GraphQLError.GraphQLError(
|
|
87
87
|
`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
|
|
88
|
-
|
|
88
|
+
{
|
|
89
|
+
nodes: varDefNode.type,
|
|
90
|
+
},
|
|
89
91
|
),
|
|
90
92
|
);
|
|
91
93
|
continue;
|
|
@@ -102,7 +104,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
102
104
|
onError(
|
|
103
105
|
new _GraphQLError.GraphQLError(
|
|
104
106
|
`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
|
|
105
|
-
|
|
107
|
+
{
|
|
108
|
+
nodes: varDefNode,
|
|
109
|
+
},
|
|
106
110
|
),
|
|
107
111
|
);
|
|
108
112
|
}
|
|
@@ -117,7 +121,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
117
121
|
onError(
|
|
118
122
|
new _GraphQLError.GraphQLError(
|
|
119
123
|
`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
|
|
120
|
-
|
|
124
|
+
{
|
|
125
|
+
nodes: varDefNode,
|
|
126
|
+
},
|
|
121
127
|
),
|
|
122
128
|
);
|
|
123
129
|
continue;
|
|
@@ -138,14 +144,10 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
onError(
|
|
141
|
-
new _GraphQLError.GraphQLError(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
undefined,
|
|
146
|
-
undefined,
|
|
147
|
-
error.originalError,
|
|
148
|
-
),
|
|
147
|
+
new _GraphQLError.GraphQLError(prefix + '; ' + error.message, {
|
|
148
|
+
nodes: varDefNode,
|
|
149
|
+
originalError: error.originalError,
|
|
150
|
+
}),
|
|
149
151
|
);
|
|
150
152
|
},
|
|
151
153
|
);
|
|
@@ -160,8 +162,6 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
160
162
|
* Note: The returned value is a plain Object with a prototype, since it is
|
|
161
163
|
* exposed to user code. Care should be taken to not pull values from the
|
|
162
164
|
* Object prototype.
|
|
163
|
-
*
|
|
164
|
-
* @internal
|
|
165
165
|
*/
|
|
166
166
|
|
|
167
167
|
function getArgumentValues(def, node, variableValues) {
|
|
@@ -193,7 +193,9 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
193
193
|
`Argument "${name}" of required type "${(0, _inspect.inspect)(
|
|
194
194
|
argType,
|
|
195
195
|
)}" ` + 'was not provided.',
|
|
196
|
-
|
|
196
|
+
{
|
|
197
|
+
nodes: node,
|
|
198
|
+
},
|
|
197
199
|
);
|
|
198
200
|
}
|
|
199
201
|
|
|
@@ -218,7 +220,9 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
218
220
|
argType,
|
|
219
221
|
)}" ` +
|
|
220
222
|
`was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
221
|
-
|
|
223
|
+
{
|
|
224
|
+
nodes: valueNode,
|
|
225
|
+
},
|
|
222
226
|
);
|
|
223
227
|
}
|
|
224
228
|
|
|
@@ -233,7 +237,9 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
233
237
|
`Argument "${name}" of non-null type "${(0, _inspect.inspect)(
|
|
234
238
|
argType,
|
|
235
239
|
)}" ` + 'must not be null.',
|
|
236
|
-
|
|
240
|
+
{
|
|
241
|
+
nodes: valueNode,
|
|
242
|
+
},
|
|
237
243
|
);
|
|
238
244
|
}
|
|
239
245
|
|
|
@@ -251,7 +257,9 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
251
257
|
`Argument "${name}" has invalid value ${(0, _printer.print)(
|
|
252
258
|
valueNode,
|
|
253
259
|
)}.`,
|
|
254
|
-
|
|
260
|
+
{
|
|
261
|
+
nodes: valueNode,
|
|
262
|
+
},
|
|
255
263
|
);
|
|
256
264
|
}
|
|
257
265
|
|
package/execution/values.mjs
CHANGED
|
@@ -67,7 +67,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
67
67
|
onError(
|
|
68
68
|
new GraphQLError(
|
|
69
69
|
`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
|
|
70
|
-
|
|
70
|
+
{
|
|
71
|
+
nodes: varDefNode.type,
|
|
72
|
+
},
|
|
71
73
|
),
|
|
72
74
|
);
|
|
73
75
|
continue;
|
|
@@ -81,7 +83,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
81
83
|
onError(
|
|
82
84
|
new GraphQLError(
|
|
83
85
|
`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
|
|
84
|
-
|
|
86
|
+
{
|
|
87
|
+
nodes: varDefNode,
|
|
88
|
+
},
|
|
85
89
|
),
|
|
86
90
|
);
|
|
87
91
|
}
|
|
@@ -96,7 +100,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
96
100
|
onError(
|
|
97
101
|
new GraphQLError(
|
|
98
102
|
`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
|
|
99
|
-
|
|
103
|
+
{
|
|
104
|
+
nodes: varDefNode,
|
|
105
|
+
},
|
|
100
106
|
),
|
|
101
107
|
);
|
|
102
108
|
continue;
|
|
@@ -114,14 +120,10 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
onError(
|
|
117
|
-
new GraphQLError(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
undefined,
|
|
122
|
-
undefined,
|
|
123
|
-
error.originalError,
|
|
124
|
-
),
|
|
123
|
+
new GraphQLError(prefix + '; ' + error.message, {
|
|
124
|
+
nodes: varDefNode,
|
|
125
|
+
originalError: error.originalError,
|
|
126
|
+
}),
|
|
125
127
|
);
|
|
126
128
|
},
|
|
127
129
|
);
|
|
@@ -136,8 +138,6 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
136
138
|
* Note: The returned value is a plain Object with a prototype, since it is
|
|
137
139
|
* exposed to user code. Care should be taken to not pull values from the
|
|
138
140
|
* Object prototype.
|
|
139
|
-
*
|
|
140
|
-
* @internal
|
|
141
141
|
*/
|
|
142
142
|
|
|
143
143
|
export function getArgumentValues(def, node, variableValues) {
|
|
@@ -165,7 +165,9 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
165
165
|
throw new GraphQLError(
|
|
166
166
|
`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
167
167
|
'was not provided.',
|
|
168
|
-
|
|
168
|
+
{
|
|
169
|
+
nodes: node,
|
|
170
|
+
},
|
|
169
171
|
);
|
|
170
172
|
}
|
|
171
173
|
|
|
@@ -188,7 +190,9 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
188
190
|
throw new GraphQLError(
|
|
189
191
|
`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
190
192
|
`was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
191
|
-
|
|
193
|
+
{
|
|
194
|
+
nodes: valueNode,
|
|
195
|
+
},
|
|
192
196
|
);
|
|
193
197
|
}
|
|
194
198
|
|
|
@@ -202,7 +206,9 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
202
206
|
throw new GraphQLError(
|
|
203
207
|
`Argument "${name}" of non-null type "${inspect(argType)}" ` +
|
|
204
208
|
'must not be null.',
|
|
205
|
-
|
|
209
|
+
{
|
|
210
|
+
nodes: valueNode,
|
|
211
|
+
},
|
|
206
212
|
);
|
|
207
213
|
}
|
|
208
214
|
|
|
@@ -214,7 +220,9 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
214
220
|
// continue with an invalid argument value.
|
|
215
221
|
throw new GraphQLError(
|
|
216
222
|
`Argument "${name}" has invalid value ${print(valueNode)}.`,
|
|
217
|
-
|
|
223
|
+
{
|
|
224
|
+
nodes: valueNode,
|
|
225
|
+
},
|
|
218
226
|
);
|
|
219
227
|
}
|
|
220
228
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -741,6 +741,12 @@ Object.defineProperty(exports, 'formatError', {
|
|
|
741
741
|
return _index5.formatError;
|
|
742
742
|
},
|
|
743
743
|
});
|
|
744
|
+
Object.defineProperty(exports, 'getArgumentValues', {
|
|
745
|
+
enumerable: true,
|
|
746
|
+
get: function () {
|
|
747
|
+
return _index3.getArgumentValues;
|
|
748
|
+
},
|
|
749
|
+
});
|
|
744
750
|
Object.defineProperty(exports, 'getDirectiveValues', {
|
|
745
751
|
enumerable: true,
|
|
746
752
|
get: function () {
|
package/index.mjs
CHANGED
package/jsutils/instanceOf.js
CHANGED
|
@@ -14,8 +14,9 @@ var _inspect = require('./inspect.js');
|
|
|
14
14
|
* See: https://webpack.js.org/guides/production/
|
|
15
15
|
*/
|
|
16
16
|
const instanceOf =
|
|
17
|
-
/* c8 ignore next
|
|
17
|
+
/* c8 ignore next 6 */
|
|
18
18
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
19
|
+
// eslint-disable-next-line no-undef
|
|
19
20
|
process.env.NODE_ENV === 'production'
|
|
20
21
|
? function instanceOf(value, constructor) {
|
|
21
22
|
return value instanceof constructor;
|
package/jsutils/instanceOf.mjs
CHANGED
|
@@ -7,8 +7,9 @@ import { inspect } from './inspect.mjs';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export const instanceOf =
|
|
10
|
-
/* c8 ignore next
|
|
10
|
+
/* c8 ignore next 6 */
|
|
11
11
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
12
|
+
// eslint-disable-next-line no-undef
|
|
12
13
|
process.env.NODE_ENV === 'production'
|
|
13
14
|
? function instanceOf(value, constructor) {
|
|
14
15
|
return value instanceof constructor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphql",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.0",
|
|
4
4
|
"description": "A Query Language and Runtime which can target any service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"graphql-js"
|
|
32
32
|
],
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": "^12.22.0 || ^14.16.0 ||
|
|
34
|
+
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"tag": "latest"
|
package/type/definition.d.ts
CHANGED
|
@@ -302,10 +302,9 @@ export interface GraphQLScalarTypeExtensions {
|
|
|
302
302
|
* Scalars (or Enums) and are defined with a name and a series of functions
|
|
303
303
|
* used to parse input from ast or variables and to ensure validity.
|
|
304
304
|
*
|
|
305
|
-
* If a type's serialize function does not return a value
|
|
306
|
-
* `undefined`) then an error will be raised and a `null`
|
|
307
|
-
* in the response.
|
|
308
|
-
* be included in the response.
|
|
305
|
+
* If a type's serialize function returns `null` or does not return a value
|
|
306
|
+
* (i.e. it returns `undefined`) then an error will be raised and a `null`
|
|
307
|
+
* value will be returned in the response. It is always better to validate
|
|
309
308
|
*
|
|
310
309
|
* Example:
|
|
311
310
|
*
|
|
@@ -313,9 +312,16 @@ export interface GraphQLScalarTypeExtensions {
|
|
|
313
312
|
* const OddType = new GraphQLScalarType({
|
|
314
313
|
* name: 'Odd',
|
|
315
314
|
* serialize(value) {
|
|
316
|
-
* if (value
|
|
317
|
-
*
|
|
315
|
+
* if (!Number.isFinite(value)) {
|
|
316
|
+
* throw new Error(
|
|
317
|
+
* `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
|
|
318
|
+
* );
|
|
318
319
|
* }
|
|
320
|
+
*
|
|
321
|
+
* if (value % 2 === 0) {
|
|
322
|
+
* throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
|
|
323
|
+
* }
|
|
324
|
+
* return value;
|
|
319
325
|
* }
|
|
320
326
|
* });
|
|
321
327
|
* ```
|