@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate/es5",
3
- "version": "7.1.3-alpha-1a132cb3.0",
3
+ "version": "7.1.5",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -8,12 +8,12 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@ardatan/aggregate-error": "0.0.6",
11
- "@graphql-tools/batch-execute": "7.1.1-alpha-1a132cb3.0",
12
- "@graphql-tools/schema": "7.1.4-alpha-1a132cb3.0",
11
+ "@graphql-tools/batch-execute": "^7.1.2",
12
+ "@graphql-tools/schema": "^7.1.5",
13
13
  "@graphql-tools/utils": "^7.7.1",
14
14
  "dataloader": "2.0.0",
15
15
  "tslib": "~2.2.0",
16
- "value-or-promise": "~1.0.5"
16
+ "value-or-promise": "1.0.6"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
package/index.cjs.js CHANGED
@@ -183,7 +183,7 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
183
183
  const results = [];
184
184
  let errors = [];
185
185
  sources.forEach((source, index) => {
186
- if (source instanceof graphql.GraphQLError || source === null) {
186
+ if (source instanceof Error || source === null) {
187
187
  const selectionSet = selectionSets[index];
188
188
  const fieldNodes = utils.collectFields({
189
189
  schema,
@@ -192,8 +192,15 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
192
192
  }, schema.getType(typeName), selectionSet, Object.create(null), Object.create(null));
193
193
  const nullResult = {};
194
194
  Object.keys(fieldNodes).forEach(responseKey => {
195
- nullResult[responseKey] =
196
- source instanceof graphql.GraphQLError ? utils.relocatedError(source, path.concat([responseKey])) : null;
195
+ if (source instanceof graphql.GraphQLError) {
196
+ nullResult[responseKey] = utils.relocatedError(source, path.concat([responseKey]));
197
+ }
198
+ else if (source instanceof Error) {
199
+ nullResult[responseKey] = graphql.locatedError(source, fieldNodes[responseKey], path.concat([responseKey]));
200
+ }
201
+ else {
202
+ nullResult[responseKey] = null;
203
+ }
197
204
  });
198
205
  results.push(nullResult);
199
206
  }