@graphql-tools/utils 7.2.4-alpha-08ab8c06.0 → 7.2.5
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/es5/index.cjs.js +6 -21
- package/es5/index.cjs.js.map +1 -1
- package/es5/index.esm.js +9 -24
- package/es5/index.esm.js.map +1 -1
- package/es5/package.json +2 -2
- package/index.cjs.js +6 -21
- package/index.cjs.js.map +1 -1
- package/index.esm.js +9 -24
- package/index.esm.js.map +1 -1
- package/package.json +2 -2
package/es5/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/utils/es5",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.5",
|
|
4
4
|
"description": "Common package containting utils and types for GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@ardatan/aggregate-error": "0.0.6",
|
|
11
11
|
"camel-case": "4.1.2",
|
|
12
|
-
"tslib": "~2.0
|
|
12
|
+
"tslib": "~2.1.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/index.cjs.js
CHANGED
|
@@ -268,20 +268,16 @@ function getDirectives(schema, node, pathToDirectivesInExtensions = ['directives
|
|
|
268
268
|
const result = {};
|
|
269
269
|
astNodes.forEach(astNode => {
|
|
270
270
|
if (astNode.directives) {
|
|
271
|
-
astNode.directives.forEach(
|
|
272
|
-
|
|
271
|
+
astNode.directives.forEach(directiveNode => {
|
|
272
|
+
var _a;
|
|
273
|
+
const schemaDirective = schemaDirectiveMap[directiveNode.name.value];
|
|
273
274
|
if (schemaDirective) {
|
|
274
|
-
const directiveValue = getDirectiveValues(schemaDirective, astNode);
|
|
275
275
|
if (schemaDirective.isRepeatable) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
result[schemaDirective.name] = [directiveValue];
|
|
281
|
-
}
|
|
276
|
+
result[schemaDirective.name] = (_a = result[schemaDirective.name]) !== null && _a !== void 0 ? _a : [];
|
|
277
|
+
result[schemaDirective.name].push(getArgumentValues(schemaDirective, directiveNode));
|
|
282
278
|
}
|
|
283
279
|
else {
|
|
284
|
-
result[schemaDirective.name] =
|
|
280
|
+
result[schemaDirective.name] = getArgumentValues(schemaDirective, directiveNode);
|
|
285
281
|
}
|
|
286
282
|
}
|
|
287
283
|
});
|
|
@@ -289,17 +285,6 @@ function getDirectives(schema, node, pathToDirectivesInExtensions = ['directives
|
|
|
289
285
|
});
|
|
290
286
|
return result;
|
|
291
287
|
}
|
|
292
|
-
// graphql-js getDirectiveValues does not handle repeatable directives
|
|
293
|
-
function getDirectiveValues(directiveDef, node) {
|
|
294
|
-
if (node.directives) {
|
|
295
|
-
if (directiveDef.isRepeatable) {
|
|
296
|
-
const directiveNodes = node.directives.filter(directive => directive.name.value === directiveDef.name);
|
|
297
|
-
return directiveNodes.map(directiveNode => getArgumentValues(directiveDef, directiveNode));
|
|
298
|
-
}
|
|
299
|
-
const directiveNode = node.directives.find(directive => directive.name.value === directiveDef.name);
|
|
300
|
-
return getArgumentValues(directiveDef, directiveNode);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
288
|
|
|
304
289
|
function parseDirectiveValue(value) {
|
|
305
290
|
switch (value.kind) {
|