@graphql-tools/delegate 7.1.3-alpha-3bf9d67c.0 → 7.1.3

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,6 +1,6 @@
1
1
  import { cloneSchema, serializeInputValue, updateArgument, collectFields, relocatedError, mergeDeep, getResponseKeyFromInfo, implementsAbstractType, mapAsyncIterator } from '@graphql-tools/utils/es5';
2
2
  import { __assign, __spreadArray, __read, __values } from 'tslib';
3
- import { Kind, typeFromAST, GraphQLError, responsePathAsArray, getNamedType, getNullableType, isLeafType, isCompositeType, isListType, isAbstractType, locatedError, defaultFieldResolver, TypeInfo, visit, visitWithTypeInfo, print, isInterfaceType, isObjectType, TypeNameMetaFieldDef, getOperationAST, subscribe, validate, execute } from 'graphql';
3
+ import { Kind, typeFromAST, GraphQLError, locatedError, responsePathAsArray, getNamedType, getNullableType, isLeafType, isCompositeType, isListType, isAbstractType, defaultFieldResolver, TypeInfo, visit, visitWithTypeInfo, print, isInterfaceType, isObjectType, TypeNameMetaFieldDef, getOperationAST, subscribe, validate, execute } from 'graphql';
4
4
  import AggregateError from '@ardatan/aggregate-error';
5
5
  import isPromise from 'is-promise';
6
6
  import { getBatchingExecutor } from '@graphql-tools/batch-execute/es5';
@@ -184,17 +184,24 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
184
184
  var results = [];
185
185
  var errors = [];
186
186
  sources.forEach(function (source, index) {
187
- if (source instanceof GraphQLError || source === null) {
187
+ if (source instanceof Error || source === null) {
188
188
  var selectionSet = selectionSets[index];
189
- var fieldNodes = collectFields({
189
+ var fieldNodes_1 = collectFields({
190
190
  schema: schema,
191
191
  variableValues: {},
192
192
  fragments: {},
193
193
  }, schema.getType(typeName), selectionSet, Object.create(null), Object.create(null));
194
194
  var nullResult_1 = {};
195
- Object.keys(fieldNodes).forEach(function (responseKey) {
196
- nullResult_1[responseKey] =
197
- source instanceof GraphQLError ? relocatedError(source, path.concat([responseKey])) : null;
195
+ Object.keys(fieldNodes_1).forEach(function (responseKey) {
196
+ if (source instanceof GraphQLError) {
197
+ nullResult_1[responseKey] = relocatedError(source, path.concat([responseKey]));
198
+ }
199
+ else if (source instanceof Error) {
200
+ nullResult_1[responseKey] = locatedError(source, fieldNodes_1[responseKey], path.concat([responseKey]));
201
+ }
202
+ else {
203
+ nullResult_1[responseKey] = null;
204
+ }
198
205
  });
199
206
  results.push(nullResult_1);
200
207
  }