graphql 16.10.0 → 16.11.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 +1 -1
- package/execution/execute.d.ts +5 -0
- package/execution/execute.js +10 -2
- package/execution/execute.mjs +10 -2
- package/language/visitor.js +1 -4
- package/language/visitor.mjs +1 -4
- package/package.json +1 -1
- package/utilities/coerceInputValue.js +4 -1
- package/utilities/coerceInputValue.mjs +1 -1
- package/validation/ValidationContext.d.ts +1 -0
- package/validation/ValidationContext.js +1 -0
- package/validation/ValidationContext.mjs +1 -0
- package/validation/rules/VariablesInAllowedPositionRule.js +16 -1
- package/validation/rules/VariablesInAllowedPositionRule.mjs +21 -2
- package/version.js +2 -2
- package/version.mjs +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://graphql.org/conf/2025/?utm_source=github&utm_medium=graphql_js&utm_campaign=readme)
|
|
2
2
|
|
|
3
3
|
# GraphQL.js
|
|
4
4
|
|
package/execution/execute.d.ts
CHANGED
|
@@ -92,6 +92,11 @@ export interface ExecutionArgs {
|
|
|
92
92
|
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
|
|
93
93
|
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
|
|
94
94
|
subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
|
|
95
|
+
/** Additional execution options. */
|
|
96
|
+
options?: {
|
|
97
|
+
/** Set the maximum number of errors allowed for coercing (defaults to 50). */
|
|
98
|
+
maxCoercionErrors?: number;
|
|
99
|
+
};
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
102
|
* Implements the "Executing requests" section of the GraphQL specification.
|
package/execution/execute.js
CHANGED
|
@@ -210,7 +210,7 @@ function assertValidExecutionArguments(schema, document, rawVariableValues) {
|
|
|
210
210
|
*/
|
|
211
211
|
|
|
212
212
|
function buildExecutionContext(args) {
|
|
213
|
-
var _definition$name, _operation$variableDe;
|
|
213
|
+
var _definition$name, _operation$variableDe, _options$maxCoercionE;
|
|
214
214
|
|
|
215
215
|
const {
|
|
216
216
|
schema,
|
|
@@ -222,6 +222,7 @@ function buildExecutionContext(args) {
|
|
|
222
222
|
fieldResolver,
|
|
223
223
|
typeResolver,
|
|
224
224
|
subscribeFieldResolver,
|
|
225
|
+
options,
|
|
225
226
|
} = args;
|
|
226
227
|
let operation;
|
|
227
228
|
const fragments = Object.create(null);
|
|
@@ -284,7 +285,14 @@ function buildExecutionContext(args) {
|
|
|
284
285
|
? rawVariableValues
|
|
285
286
|
: {},
|
|
286
287
|
{
|
|
287
|
-
maxErrors:
|
|
288
|
+
maxErrors:
|
|
289
|
+
(_options$maxCoercionE =
|
|
290
|
+
options === null || options === void 0
|
|
291
|
+
? void 0
|
|
292
|
+
: options.maxCoercionErrors) !== null &&
|
|
293
|
+
_options$maxCoercionE !== void 0
|
|
294
|
+
? _options$maxCoercionE
|
|
295
|
+
: 50,
|
|
288
296
|
},
|
|
289
297
|
);
|
|
290
298
|
|
package/execution/execute.mjs
CHANGED
|
@@ -195,7 +195,7 @@ export function assertValidExecutionArguments(
|
|
|
195
195
|
*/
|
|
196
196
|
|
|
197
197
|
export function buildExecutionContext(args) {
|
|
198
|
-
var _definition$name, _operation$variableDe;
|
|
198
|
+
var _definition$name, _operation$variableDe, _options$maxCoercionE;
|
|
199
199
|
|
|
200
200
|
const {
|
|
201
201
|
schema,
|
|
@@ -207,6 +207,7 @@ export function buildExecutionContext(args) {
|
|
|
207
207
|
fieldResolver,
|
|
208
208
|
typeResolver,
|
|
209
209
|
subscribeFieldResolver,
|
|
210
|
+
options,
|
|
210
211
|
} = args;
|
|
211
212
|
let operation;
|
|
212
213
|
const fragments = Object.create(null);
|
|
@@ -265,7 +266,14 @@ export function buildExecutionContext(args) {
|
|
|
265
266
|
? rawVariableValues
|
|
266
267
|
: {},
|
|
267
268
|
{
|
|
268
|
-
maxErrors:
|
|
269
|
+
maxErrors:
|
|
270
|
+
(_options$maxCoercionE =
|
|
271
|
+
options === null || options === void 0
|
|
272
|
+
? void 0
|
|
273
|
+
: options.maxCoercionErrors) !== null &&
|
|
274
|
+
_options$maxCoercionE !== void 0
|
|
275
|
+
? _options$maxCoercionE
|
|
276
|
+
: 50,
|
|
269
277
|
},
|
|
270
278
|
);
|
|
271
279
|
|
package/language/visitor.js
CHANGED
|
@@ -145,10 +145,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
} else {
|
|
148
|
-
node =
|
|
149
|
-
{},
|
|
150
|
-
Object.getOwnPropertyDescriptors(node),
|
|
151
|
-
);
|
|
148
|
+
node = { ...node };
|
|
152
149
|
|
|
153
150
|
for (const [editKey, editValue] of edits) {
|
|
154
151
|
node[editKey] = editValue;
|
package/language/visitor.mjs
CHANGED
|
@@ -133,10 +133,7 @@ export function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
} else {
|
|
136
|
-
node =
|
|
137
|
-
{},
|
|
138
|
-
Object.getOwnPropertyDescriptors(node),
|
|
139
|
-
);
|
|
136
|
+
node = { ...node };
|
|
140
137
|
|
|
141
138
|
for (const [editKey, editValue] of edits) {
|
|
142
139
|
node[editKey] = editValue;
|
package/package.json
CHANGED
|
@@ -80,7 +80,10 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
83
|
-
if (
|
|
83
|
+
if (
|
|
84
|
+
!(0, _isObjectLike.isObjectLike)(inputValue) ||
|
|
85
|
+
Array.isArray(inputValue)
|
|
86
|
+
) {
|
|
84
87
|
onError(
|
|
85
88
|
(0, _Path.pathToArray)(path),
|
|
86
89
|
inputValue,
|
|
@@ -27,6 +27,7 @@ interface VariableUsage {
|
|
|
27
27
|
readonly node: VariableNode;
|
|
28
28
|
readonly type: Maybe<GraphQLInputType>;
|
|
29
29
|
readonly defaultValue: Maybe<unknown>;
|
|
30
|
+
readonly parentType: Maybe<GraphQLInputType>;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* An instance of this class is passed as the "this" context to all validators,
|
|
@@ -35,7 +35,7 @@ function VariablesInAllowedPositionRule(context) {
|
|
|
35
35
|
leave(operation) {
|
|
36
36
|
const usages = context.getRecursiveVariableUsages(operation);
|
|
37
37
|
|
|
38
|
-
for (const { node, type, defaultValue } of usages) {
|
|
38
|
+
for (const { node, type, defaultValue, parentType } of usages) {
|
|
39
39
|
const varName = node.name.value;
|
|
40
40
|
const varDef = varDefMap[varName];
|
|
41
41
|
|
|
@@ -69,6 +69,21 @@ function VariablesInAllowedPositionRule(context) {
|
|
|
69
69
|
),
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
(0, _definition.isInputObjectType)(parentType) &&
|
|
75
|
+
parentType.isOneOf &&
|
|
76
|
+
(0, _definition.isNullableType)(varType)
|
|
77
|
+
) {
|
|
78
|
+
context.reportError(
|
|
79
|
+
new _GraphQLError.GraphQLError(
|
|
80
|
+
`Variable "$${varName}" is of type "${varType}" but must be non-nullable to be used for OneOf Input Object "${parentType}".`,
|
|
81
|
+
{
|
|
82
|
+
nodes: [varDef, node],
|
|
83
|
+
},
|
|
84
|
+
),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
89
|
},
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { inspect } from '../../jsutils/inspect.mjs';
|
|
2
2
|
import { GraphQLError } from '../../error/GraphQLError.mjs';
|
|
3
3
|
import { Kind } from '../../language/kinds.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isInputObjectType,
|
|
6
|
+
isNonNullType,
|
|
7
|
+
isNullableType,
|
|
8
|
+
} from '../../type/definition.mjs';
|
|
5
9
|
import { isTypeSubTypeOf } from '../../utilities/typeComparators.mjs';
|
|
6
10
|
import { typeFromAST } from '../../utilities/typeFromAST.mjs';
|
|
7
11
|
|
|
@@ -23,7 +27,7 @@ export function VariablesInAllowedPositionRule(context) {
|
|
|
23
27
|
leave(operation) {
|
|
24
28
|
const usages = context.getRecursiveVariableUsages(operation);
|
|
25
29
|
|
|
26
|
-
for (const { node, type, defaultValue } of usages) {
|
|
30
|
+
for (const { node, type, defaultValue, parentType } of usages) {
|
|
27
31
|
const varName = node.name.value;
|
|
28
32
|
const varDef = varDefMap[varName];
|
|
29
33
|
|
|
@@ -57,6 +61,21 @@ export function VariablesInAllowedPositionRule(context) {
|
|
|
57
61
|
),
|
|
58
62
|
);
|
|
59
63
|
}
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
isInputObjectType(parentType) &&
|
|
67
|
+
parentType.isOneOf &&
|
|
68
|
+
isNullableType(varType)
|
|
69
|
+
) {
|
|
70
|
+
context.reportError(
|
|
71
|
+
new GraphQLError(
|
|
72
|
+
`Variable "$${varName}" is of type "${varType}" but must be non-nullable to be used for OneOf Input Object "${parentType}".`,
|
|
73
|
+
{
|
|
74
|
+
nodes: [varDef, node],
|
|
75
|
+
},
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
60
79
|
}
|
|
61
80
|
}
|
|
62
81
|
},
|
package/version.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.versionInfo = exports.version = void 0;
|
|
|
10
10
|
/**
|
|
11
11
|
* A string containing the version of the GraphQL.js library
|
|
12
12
|
*/
|
|
13
|
-
const version = '16.
|
|
13
|
+
const version = '16.11.0';
|
|
14
14
|
/**
|
|
15
15
|
* An object containing the components of the GraphQL.js version string
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ const version = '16.10.0';
|
|
|
18
18
|
exports.version = version;
|
|
19
19
|
const versionInfo = Object.freeze({
|
|
20
20
|
major: 16,
|
|
21
|
-
minor:
|
|
21
|
+
minor: 11,
|
|
22
22
|
patch: 0,
|
|
23
23
|
preReleaseTag: null,
|
|
24
24
|
});
|
package/version.mjs
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* A string containing the version of the GraphQL.js library
|
|
6
6
|
*/
|
|
7
|
-
export const version = '16.
|
|
7
|
+
export const version = '16.11.0';
|
|
8
8
|
/**
|
|
9
9
|
* An object containing the components of the GraphQL.js version string
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
export const versionInfo = Object.freeze({
|
|
13
13
|
major: 16,
|
|
14
|
-
minor:
|
|
14
|
+
minor: 11,
|
|
15
15
|
patch: 0,
|
|
16
16
|
preReleaseTag: null,
|
|
17
17
|
});
|