@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/index.cjs.js
CHANGED
|
@@ -290,20 +290,16 @@ function getDirectives(schema, node, pathToDirectivesInExtensions) {
|
|
|
290
290
|
var result = {};
|
|
291
291
|
astNodes.forEach(function (astNode) {
|
|
292
292
|
if (astNode.directives) {
|
|
293
|
-
astNode.directives.forEach(function (
|
|
294
|
-
var
|
|
293
|
+
astNode.directives.forEach(function (directiveNode) {
|
|
294
|
+
var _a;
|
|
295
|
+
var schemaDirective = schemaDirectiveMap[directiveNode.name.value];
|
|
295
296
|
if (schemaDirective) {
|
|
296
|
-
var directiveValue = getDirectiveValues(schemaDirective, astNode);
|
|
297
297
|
if (schemaDirective.isRepeatable) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
result[schemaDirective.name] = [directiveValue];
|
|
303
|
-
}
|
|
298
|
+
result[schemaDirective.name] = (_a = result[schemaDirective.name]) !== null && _a !== void 0 ? _a : [];
|
|
299
|
+
result[schemaDirective.name].push(getArgumentValues(schemaDirective, directiveNode));
|
|
304
300
|
}
|
|
305
301
|
else {
|
|
306
|
-
result[schemaDirective.name] =
|
|
302
|
+
result[schemaDirective.name] = getArgumentValues(schemaDirective, directiveNode);
|
|
307
303
|
}
|
|
308
304
|
}
|
|
309
305
|
});
|
|
@@ -311,17 +307,6 @@ function getDirectives(schema, node, pathToDirectivesInExtensions) {
|
|
|
311
307
|
});
|
|
312
308
|
return result;
|
|
313
309
|
}
|
|
314
|
-
// graphql-js getDirectiveValues does not handle repeatable directives
|
|
315
|
-
function getDirectiveValues(directiveDef, node) {
|
|
316
|
-
if (node.directives) {
|
|
317
|
-
if (directiveDef.isRepeatable) {
|
|
318
|
-
var directiveNodes = node.directives.filter(function (directive) { return directive.name.value === directiveDef.name; });
|
|
319
|
-
return directiveNodes.map(function (directiveNode) { return getArgumentValues(directiveDef, directiveNode); });
|
|
320
|
-
}
|
|
321
|
-
var directiveNode = node.directives.find(function (directive) { return directive.name.value === directiveDef.name; });
|
|
322
|
-
return getArgumentValues(directiveDef, directiveNode);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
310
|
|
|
326
311
|
function parseDirectiveValue(value) {
|
|
327
312
|
switch (value.kind) {
|