@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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedScalarType, isIntrospectionType, astFromValue, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, isSpecifiedDirective, GraphQLDeprecatedDirective, specifiedRules, validate, buildSchema, Source, TokenKind, visit, isTypeSystemDefinitionNode, buildClientSchema, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isSchema, isInputType, valueFromASTUntyped, isDirective, getDirectiveValues as getDirectiveValues$1, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, isCompositeType, doTypesOverlap, getOperationAST, getOperationRootType } from 'graphql';
1
+ import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedScalarType, isIntrospectionType, astFromValue, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, isSpecifiedDirective, GraphQLDeprecatedDirective, specifiedRules, validate, buildSchema, Source, TokenKind, visit, isTypeSystemDefinitionNode, buildClientSchema, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isSchema, isInputType, valueFromASTUntyped, isDirective, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, isCompositeType, doTypesOverlap, getOperationAST, getOperationRootType } from 'graphql';
2
2
  import { __spread, __read, __assign, __values, __awaiter, __generator, __extends } from 'tslib';
3
3
  import AggregateError from '@ardatan/aggregate-error';
4
4
  import { camelCase } from 'camel-case';
@@ -284,20 +284,16 @@ function getDirectives(schema, node, pathToDirectivesInExtensions) {
284
284
  var result = {};
285
285
  astNodes.forEach(function (astNode) {
286
286
  if (astNode.directives) {
287
- astNode.directives.forEach(function (directive) {
288
- var schemaDirective = schemaDirectiveMap[directive.name.value];
287
+ astNode.directives.forEach(function (directiveNode) {
288
+ var _a;
289
+ var schemaDirective = schemaDirectiveMap[directiveNode.name.value];
289
290
  if (schemaDirective) {
290
- var directiveValue = getDirectiveValues(schemaDirective, astNode);
291
291
  if (schemaDirective.isRepeatable) {
292
- if (result[schemaDirective.name]) {
293
- result[schemaDirective.name] = result[schemaDirective.name].concat([directiveValue]);
294
- }
295
- else {
296
- result[schemaDirective.name] = [directiveValue];
297
- }
292
+ result[schemaDirective.name] = (_a = result[schemaDirective.name]) !== null && _a !== void 0 ? _a : [];
293
+ result[schemaDirective.name].push(getArgumentValues(schemaDirective, directiveNode));
298
294
  }
299
295
  else {
300
- result[schemaDirective.name] = directiveValue;
296
+ result[schemaDirective.name] = getArgumentValues(schemaDirective, directiveNode);
301
297
  }
302
298
  }
303
299
  });
@@ -305,17 +301,6 @@ function getDirectives(schema, node, pathToDirectivesInExtensions) {
305
301
  });
306
302
  return result;
307
303
  }
308
- // graphql-js getDirectiveValues does not handle repeatable directives
309
- function getDirectiveValues(directiveDef, node) {
310
- if (node.directives) {
311
- if (directiveDef.isRepeatable) {
312
- var directiveNodes = node.directives.filter(function (directive) { return directive.name.value === directiveDef.name; });
313
- return directiveNodes.map(function (directiveNode) { return getArgumentValues(directiveDef, directiveNode); });
314
- }
315
- var directiveNode = node.directives.find(function (directive) { return directive.name.value === directiveDef.name; });
316
- return getArgumentValues(directiveDef, directiveNode);
317
- }
318
- }
319
304
 
320
305
  function parseDirectiveValue(value) {
321
306
  switch (value.kind) {
@@ -3814,11 +3799,11 @@ function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFra
3814
3799
  * directives, where @skip has higher precedence than @include.
3815
3800
  */
3816
3801
  function shouldIncludeNode(exeContext, node) {
3817
- var skip = getDirectiveValues$1(GraphQLSkipDirective, node, exeContext.variableValues);
3802
+ var skip = getDirectiveValues(GraphQLSkipDirective, node, exeContext.variableValues);
3818
3803
  if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) {
3819
3804
  return false;
3820
3805
  }
3821
- var include = getDirectiveValues$1(GraphQLIncludeDirective, node, exeContext.variableValues);
3806
+ var include = getDirectiveValues(GraphQLIncludeDirective, node, exeContext.variableValues);
3822
3807
  if ((include === null || include === void 0 ? void 0 : include.if) === false) {
3823
3808
  return false;
3824
3809
  }