@graphql-tools/delegate 7.1.3-alpha-1a132cb3.0 → 7.1.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 +12 -5
- package/es5/index.cjs.js.map +1 -1
- package/es5/index.esm.js +13 -6
- package/es5/index.esm.js.map +1 -1
- package/es5/package.json +4 -4
- package/index.cjs.js +10 -3
- package/index.cjs.js.map +1 -1
- package/index.esm.js +11 -4
- package/index.esm.js.map +1 -1
- package/package.json +4 -4
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneSchema, serializeInputValue, updateArgument, collectFields, relocatedError, mergeDeep, getResponseKeyFromInfo, implementsAbstractType, mapAsyncIterator } from '@graphql-tools/utils';
|
|
2
|
-
import { Kind, typeFromAST, GraphQLError, responsePathAsArray, getNamedType, getNullableType, isLeafType, isCompositeType, isListType, isAbstractType,
|
|
2
|
+
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';
|
|
3
3
|
import AggregateError from '@ardatan/aggregate-error';
|
|
4
4
|
import { ValueOrPromise } from 'value-or-promise';
|
|
5
5
|
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
@@ -177,7 +177,7 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
|
|
|
177
177
|
const results = [];
|
|
178
178
|
let errors = [];
|
|
179
179
|
sources.forEach((source, index) => {
|
|
180
|
-
if (source instanceof
|
|
180
|
+
if (source instanceof Error || source === null) {
|
|
181
181
|
const selectionSet = selectionSets[index];
|
|
182
182
|
const fieldNodes = collectFields({
|
|
183
183
|
schema,
|
|
@@ -186,8 +186,15 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
|
|
|
186
186
|
}, schema.getType(typeName), selectionSet, Object.create(null), Object.create(null));
|
|
187
187
|
const nullResult = {};
|
|
188
188
|
Object.keys(fieldNodes).forEach(responseKey => {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
if (source instanceof GraphQLError) {
|
|
190
|
+
nullResult[responseKey] = relocatedError(source, path.concat([responseKey]));
|
|
191
|
+
}
|
|
192
|
+
else if (source instanceof Error) {
|
|
193
|
+
nullResult[responseKey] = locatedError(source, fieldNodes[responseKey], path.concat([responseKey]));
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
nullResult[responseKey] = null;
|
|
197
|
+
}
|
|
191
198
|
});
|
|
192
199
|
results.push(nullResult);
|
|
193
200
|
}
|