@graphql-tools/utils 8.6.10 → 8.6.11

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.
Files changed (3) hide show
  1. package/index.js +11 -1
  2. package/index.mjs +11 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4016,8 +4016,18 @@ function visitErrorsByType(errors, errorVisitorMap, errorInfo) {
4016
4016
  return newError;
4017
4017
  });
4018
4018
  }
4019
+ function getOperationRootType(schema, operationDef) {
4020
+ switch (operationDef.operation) {
4021
+ case 'query':
4022
+ return schema.getQueryType();
4023
+ case 'mutation':
4024
+ return schema.getMutationType();
4025
+ case 'subscription':
4026
+ return schema.getSubscriptionType();
4027
+ }
4028
+ }
4019
4029
  function visitRoot(root, operation, schema, fragments, variableValues, resultVisitorMap, errors, errorInfo) {
4020
- const operationRootType = graphql.getOperationRootType(schema, operation);
4030
+ const operationRootType = getOperationRootType(schema, operation);
4021
4031
  const collectedFields = collectFields(schema, fragments, variableValues, operationRootType, operation.selectionSet, new Map(), new Set());
4022
4032
  return visitObjectValue(root, operationRootType, collectedFields, schema, fragments, variableValues, resultVisitorMap, 0, errors, errorInfo);
4023
4033
  }
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, versionInfo, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getOperationAST, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, getOperationRootType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
1
+ import { parse, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, versionInfo, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getOperationAST, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
2
2
 
3
3
  const asArray = (fns) => (Array.isArray(fns) ? fns : fns ? [fns] : []);
4
4
  const invalidDocRegex = /\.[a-z0-9]+$/i;
@@ -4014,6 +4014,16 @@ function visitErrorsByType(errors, errorVisitorMap, errorInfo) {
4014
4014
  return newError;
4015
4015
  });
4016
4016
  }
4017
+ function getOperationRootType(schema, operationDef) {
4018
+ switch (operationDef.operation) {
4019
+ case 'query':
4020
+ return schema.getQueryType();
4021
+ case 'mutation':
4022
+ return schema.getMutationType();
4023
+ case 'subscription':
4024
+ return schema.getSubscriptionType();
4025
+ }
4026
+ }
4017
4027
  function visitRoot(root, operation, schema, fragments, variableValues, resultVisitorMap, errors, errorInfo) {
4018
4028
  const operationRootType = getOperationRootType(schema, operation);
4019
4029
  const collectedFields = collectFields(schema, fragments, variableValues, operationRootType, operation.selectionSet, new Map(), new Set());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "8.6.10",
3
+ "version": "8.6.11",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {