@graphql-tools/utils 8.7.0 → 8.7.1-alpha-b3506926.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.
Files changed (3) hide show
  1. package/index.js +11 -1
  2. package/index.mjs +12 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4102,7 +4102,17 @@ function visitObjectValue(object, type, fieldNodeMap, schema, fragments, variabl
4102
4102
  }
4103
4103
  for (const [responseKey, subFieldNodes] of fieldNodeMap) {
4104
4104
  const fieldName = subFieldNodes[0].name.value;
4105
- const fieldType = fieldName === '__typename' ? graphql.TypeNameMetaFieldDef.type : (_a = fieldMap[fieldName]) === null || _a === void 0 ? void 0 : _a.type;
4105
+ let fieldType = (_a = fieldMap[fieldName]) === null || _a === void 0 ? void 0 : _a.type;
4106
+ if (fieldType == null) {
4107
+ switch (fieldName) {
4108
+ case '__typename':
4109
+ fieldType = graphql.TypeNameMetaFieldDef.type;
4110
+ break;
4111
+ case '__schema':
4112
+ fieldType = graphql.SchemaMetaFieldDef.type;
4113
+ break;
4114
+ }
4115
+ }
4106
4116
  const newPathIndex = pathIndex + 1;
4107
4117
  let fieldErrors;
4108
4118
  if (errorMap) {
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, versionInfo, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, 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';
1
+ import { parse, versionInfo, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, 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, SchemaMetaFieldDef, 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;
@@ -4101,7 +4101,17 @@ function visitObjectValue(object, type, fieldNodeMap, schema, fragments, variabl
4101
4101
  }
4102
4102
  for (const [responseKey, subFieldNodes] of fieldNodeMap) {
4103
4103
  const fieldName = subFieldNodes[0].name.value;
4104
- const fieldType = fieldName === '__typename' ? TypeNameMetaFieldDef.type : (_a = fieldMap[fieldName]) === null || _a === void 0 ? void 0 : _a.type;
4104
+ let fieldType = (_a = fieldMap[fieldName]) === null || _a === void 0 ? void 0 : _a.type;
4105
+ if (fieldType == null) {
4106
+ switch (fieldName) {
4107
+ case '__typename':
4108
+ fieldType = TypeNameMetaFieldDef.type;
4109
+ break;
4110
+ case '__schema':
4111
+ fieldType = SchemaMetaFieldDef.type;
4112
+ break;
4113
+ }
4114
+ }
4105
4115
  const newPathIndex = pathIndex + 1;
4106
4116
  let fieldErrors;
4107
4117
  if (errorMap) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "8.7.0",
3
+ "version": "8.7.1-alpha-b3506926.0",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {