graphql 16.13.1 → 16.14.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/execution/values.js +4 -4
- package/execution/values.mjs +4 -4
- package/index.d.ts +1 -0
- package/language/ast.d.ts +10 -1
- package/language/ast.js +8 -1
- package/language/ast.mjs +8 -1
- package/language/directiveLocation.d.ts +1 -0
- package/language/directiveLocation.js +1 -0
- package/language/directiveLocation.mjs +1 -0
- package/language/index.d.ts +1 -0
- package/language/kinds.d.ts +1 -0
- package/language/kinds.js +1 -0
- package/language/kinds.mjs +1 -0
- package/language/parser.d.ts +14 -0
- package/language/parser.js +33 -0
- package/language/parser.mjs +33 -0
- package/language/predicates.js +3 -1
- package/language/predicates.mjs +5 -1
- package/language/printer.js +13 -1
- package/language/printer.mjs +13 -1
- package/package.json +1 -1
- package/type/directives.d.ts +9 -1
- package/type/directives.js +10 -1
- package/type/directives.mjs +10 -1
- package/type/introspection.js +24 -1
- package/type/introspection.mjs +24 -1
- package/utilities/buildASTSchema.js +4 -0
- package/utilities/buildASTSchema.mjs +4 -0
- package/utilities/buildClientSchema.js +1 -0
- package/utilities/buildClientSchema.mjs +1 -0
- package/utilities/coerceInputValue.js +2 -2
- package/utilities/coerceInputValue.mjs +2 -2
- package/utilities/extendSchema.js +58 -3
- package/utilities/extendSchema.mjs +58 -3
- package/utilities/getIntrospectionQuery.d.ts +16 -0
- package/utilities/getIntrospectionQuery.js +31 -38
- package/utilities/getIntrospectionQuery.mjs +31 -38
- package/utilities/introspectionFromSchema.js +1 -0
- package/utilities/introspectionFromSchema.mjs +1 -0
- package/utilities/printSchema.js +1 -0
- package/utilities/printSchema.mjs +1 -0
- package/utilities/valueFromAST.js +12 -2
- package/utilities/valueFromAST.mjs +12 -2
- package/validation/rules/KnownDirectivesRule.js +4 -0
- package/validation/rules/KnownDirectivesRule.mjs +4 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
- package/validation/rules/ValuesOfCorrectTypeRule.js +0 -11
- package/validation/rules/ValuesOfCorrectTypeRule.mjs +0 -11
- package/version.js +3 -3
- package/version.mjs +3 -3
|
@@ -45,7 +45,11 @@ function valueFromAST(valueNode, type, variables) {
|
|
|
45
45
|
if (valueNode.kind === _kinds.Kind.VARIABLE) {
|
|
46
46
|
const variableName = valueNode.name.value;
|
|
47
47
|
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
variables == null ||
|
|
50
|
+
variables[variableName] === undefined ||
|
|
51
|
+
!hasOwnProperty(variables, variableName)
|
|
52
|
+
) {
|
|
49
53
|
// No valid return value.
|
|
50
54
|
return;
|
|
51
55
|
}
|
|
@@ -192,6 +196,12 @@ function valueFromAST(valueNode, type, variables) {
|
|
|
192
196
|
function isMissingVariable(valueNode, variables) {
|
|
193
197
|
return (
|
|
194
198
|
valueNode.kind === _kinds.Kind.VARIABLE &&
|
|
195
|
-
(variables == null ||
|
|
199
|
+
(variables == null ||
|
|
200
|
+
variables[valueNode.name.value] === undefined ||
|
|
201
|
+
!hasOwnProperty(variables, valueNode.name.value))
|
|
196
202
|
);
|
|
197
203
|
}
|
|
204
|
+
|
|
205
|
+
function hasOwnProperty(obj, prop) {
|
|
206
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
207
|
+
}
|
|
@@ -39,7 +39,11 @@ export function valueFromAST(valueNode, type, variables) {
|
|
|
39
39
|
if (valueNode.kind === Kind.VARIABLE) {
|
|
40
40
|
const variableName = valueNode.name.value;
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (
|
|
43
|
+
variables == null ||
|
|
44
|
+
variables[variableName] === undefined ||
|
|
45
|
+
!hasOwnProperty(variables, variableName)
|
|
46
|
+
) {
|
|
43
47
|
// No valid return value.
|
|
44
48
|
return;
|
|
45
49
|
}
|
|
@@ -179,6 +183,12 @@ export function valueFromAST(valueNode, type, variables) {
|
|
|
179
183
|
function isMissingVariable(valueNode, variables) {
|
|
180
184
|
return (
|
|
181
185
|
valueNode.kind === Kind.VARIABLE &&
|
|
182
|
-
(variables == null ||
|
|
186
|
+
(variables == null ||
|
|
187
|
+
variables[valueNode.name.value] === undefined ||
|
|
188
|
+
!hasOwnProperty(variables, valueNode.name.value))
|
|
183
189
|
);
|
|
184
190
|
}
|
|
191
|
+
|
|
192
|
+
function hasOwnProperty(obj, prop) {
|
|
193
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
194
|
+
}
|
|
@@ -140,6 +140,10 @@ function getDirectiveLocationForASTPath(ancestors) {
|
|
|
140
140
|
? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION
|
|
141
141
|
: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION;
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
case _kinds.Kind.DIRECTIVE_DEFINITION:
|
|
145
|
+
case _kinds.Kind.DIRECTIVE_EXTENSION:
|
|
146
|
+
return _directiveLocation.DirectiveLocation.DIRECTIVE_DEFINITION;
|
|
143
147
|
// Not reachable, all possible types have been considered.
|
|
144
148
|
|
|
145
149
|
/* c8 ignore next */
|
|
@@ -127,6 +127,10 @@ function getDirectiveLocationForASTPath(ancestors) {
|
|
|
127
127
|
? DirectiveLocation.INPUT_FIELD_DEFINITION
|
|
128
128
|
: DirectiveLocation.ARGUMENT_DEFINITION;
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
case Kind.DIRECTIVE_DEFINITION:
|
|
132
|
+
case Kind.DIRECTIVE_EXTENSION:
|
|
133
|
+
return DirectiveLocation.DIRECTIVE_DEFINITION;
|
|
130
134
|
// Not reachable, all possible types have been considered.
|
|
131
135
|
|
|
132
136
|
/* c8 ignore next */
|
|
@@ -42,6 +42,7 @@ function UniqueDirectivesPerLocationRule(context) {
|
|
|
42
42
|
|
|
43
43
|
const schemaDirectives = Object.create(null);
|
|
44
44
|
const typeDirectivesMap = Object.create(null);
|
|
45
|
+
const directiveDirectivesMap = Object.create(null);
|
|
45
46
|
return {
|
|
46
47
|
// Many different AST nodes may contain directives. Rather than listing
|
|
47
48
|
// them all, just listen for entering any node, and check to see if it
|
|
@@ -68,6 +69,17 @@ function UniqueDirectivesPerLocationRule(context) {
|
|
|
68
69
|
if (seenDirectives === undefined) {
|
|
69
70
|
typeDirectivesMap[typeName] = seenDirectives = Object.create(null);
|
|
70
71
|
}
|
|
72
|
+
} else if (
|
|
73
|
+
node.kind === _kinds.Kind.DIRECTIVE_DEFINITION ||
|
|
74
|
+
node.kind === _kinds.Kind.DIRECTIVE_EXTENSION
|
|
75
|
+
) {
|
|
76
|
+
const directiveName = node.name.value;
|
|
77
|
+
seenDirectives = directiveDirectivesMap[directiveName];
|
|
78
|
+
|
|
79
|
+
if (seenDirectives === undefined) {
|
|
80
|
+
directiveDirectivesMap[directiveName] = seenDirectives =
|
|
81
|
+
Object.create(null);
|
|
82
|
+
}
|
|
71
83
|
} else {
|
|
72
84
|
seenDirectives = Object.create(null);
|
|
73
85
|
}
|
|
@@ -35,6 +35,7 @@ export function UniqueDirectivesPerLocationRule(context) {
|
|
|
35
35
|
|
|
36
36
|
const schemaDirectives = Object.create(null);
|
|
37
37
|
const typeDirectivesMap = Object.create(null);
|
|
38
|
+
const directiveDirectivesMap = Object.create(null);
|
|
38
39
|
return {
|
|
39
40
|
// Many different AST nodes may contain directives. Rather than listing
|
|
40
41
|
// them all, just listen for entering any node, and check to see if it
|
|
@@ -58,6 +59,17 @@ export function UniqueDirectivesPerLocationRule(context) {
|
|
|
58
59
|
if (seenDirectives === undefined) {
|
|
59
60
|
typeDirectivesMap[typeName] = seenDirectives = Object.create(null);
|
|
60
61
|
}
|
|
62
|
+
} else if (
|
|
63
|
+
node.kind === Kind.DIRECTIVE_DEFINITION ||
|
|
64
|
+
node.kind === Kind.DIRECTIVE_EXTENSION
|
|
65
|
+
) {
|
|
66
|
+
const directiveName = node.name.value;
|
|
67
|
+
seenDirectives = directiveDirectivesMap[directiveName];
|
|
68
|
+
|
|
69
|
+
if (seenDirectives === undefined) {
|
|
70
|
+
directiveDirectivesMap[directiveName] = seenDirectives =
|
|
71
|
+
Object.create(null);
|
|
72
|
+
}
|
|
61
73
|
} else {
|
|
62
74
|
seenDirectives = Object.create(null);
|
|
63
75
|
}
|
|
@@ -30,18 +30,7 @@ var _definition = require('../../type/definition.js');
|
|
|
30
30
|
* See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type
|
|
31
31
|
*/
|
|
32
32
|
function ValuesOfCorrectTypeRule(context) {
|
|
33
|
-
let variableDefinitions = {};
|
|
34
33
|
return {
|
|
35
|
-
OperationDefinition: {
|
|
36
|
-
enter() {
|
|
37
|
-
variableDefinitions = {};
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
VariableDefinition(definition) {
|
|
42
|
-
variableDefinitions[definition.variable.name.value] = definition;
|
|
43
|
-
},
|
|
44
|
-
|
|
45
34
|
ListValue(node) {
|
|
46
35
|
// Note: TypeInfo will traverse into a list's item type, so look to the
|
|
47
36
|
// parent input type to check if it is a list.
|
|
@@ -24,18 +24,7 @@ import {
|
|
|
24
24
|
* See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type
|
|
25
25
|
*/
|
|
26
26
|
export function ValuesOfCorrectTypeRule(context) {
|
|
27
|
-
let variableDefinitions = {};
|
|
28
27
|
return {
|
|
29
|
-
OperationDefinition: {
|
|
30
|
-
enter() {
|
|
31
|
-
variableDefinitions = {};
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
VariableDefinition(definition) {
|
|
36
|
-
variableDefinitions[definition.variable.name.value] = definition;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
28
|
ListValue(node) {
|
|
40
29
|
// Note: TypeInfo will traverse into a list's item type, so look to the
|
|
41
30
|
// parent input type to check if it is a list.
|
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.14.0';
|
|
14
14
|
/**
|
|
15
15
|
* An object containing the components of the GraphQL.js version string
|
|
16
16
|
*/
|
|
@@ -18,8 +18,8 @@ const version = '16.13.1';
|
|
|
18
18
|
exports.version = version;
|
|
19
19
|
const versionInfo = Object.freeze({
|
|
20
20
|
major: 16,
|
|
21
|
-
minor:
|
|
22
|
-
patch:
|
|
21
|
+
minor: 14,
|
|
22
|
+
patch: 0,
|
|
23
23
|
preReleaseTag: null,
|
|
24
24
|
});
|
|
25
25
|
exports.versionInfo = versionInfo;
|
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.14.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:
|
|
15
|
-
patch:
|
|
14
|
+
minor: 14,
|
|
15
|
+
patch: 0,
|
|
16
16
|
preReleaseTag: null,
|
|
17
17
|
});
|