@graphql-tools/delegate 10.2.19 → 10.2.20-alpha-de2e938a921f04ca4bef925ceb74197fd44f9017

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @graphql-tools/delegate
2
2
 
3
+ ## 10.2.20-alpha-de2e938a921f04ca4bef925ceb74197fd44f9017
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1280](https://github.com/graphql-hive/gateway/pull/1280) [`7552657`](https://github.com/graphql-hive/gateway/commit/75526572fdc9e766431539c6a68084ef1b2ee046) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Relocate each error in multi-error ExecutionResult
8
+
9
+ Handling errors now works the same for both single-error and multi-error ExecutionResults.
10
+
11
+ - [#1280](https://github.com/graphql-hive/gateway/pull/1280) [`de2e938`](https://github.com/graphql-hive/gateway/commit/de2e938a921f04ca4bef925ceb74197fd44f9017) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Remove trailing spaces when merging multi-error responses
12
+
13
+ - [#1280](https://github.com/graphql-hive/gateway/pull/1280) [`7552657`](https://github.com/graphql-hive/gateway/commit/75526572fdc9e766431539c6a68084ef1b2ee046) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Call onLocatedError hook from delegation context for each error in multi-error ExecutionResult
14
+
3
15
  ## 10.2.19
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -481,16 +481,12 @@ function mergeDataAndErrors(data, errors, path, onLocatedError, index = 1) {
481
481
  return { data: utils.relocatedError(errors[0], newPath), unpathedErrors: [] };
482
482
  }
483
483
  const combinedError = new AggregateError(
484
- errors.map(
485
- (e) => (
486
- // We cast path as any for GraphQL.js 14 compat
487
- // locatedError path argument must be defined, but it is just forwarded to a constructor that allows a undefined value
488
- // https://github.com/graphql/graphql-js/blob/b4bff0ba9c15c9d7245dd68556e754c41f263289/src/error/locatedError.js#L25
489
- // https://github.com/graphql/graphql-js/blob/b4bff0ba9c15c9d7245dd68556e754c41f263289/src/error/GraphQLError.js#L19
490
- graphql.locatedError(e, void 0, path)
491
- )
492
- ),
493
- errors.map((error) => error.message).join(", \n")
484
+ errors.map((e) => {
485
+ const error = onLocatedError ? onLocatedError(e) : e;
486
+ const newPath = path === void 0 ? error.path : !error.path ? path : path.concat(error.path.slice(1));
487
+ return utils.relocatedError(e, newPath);
488
+ }),
489
+ errors.map((error) => error.message).join(",\n")
494
490
  );
495
491
  return { data: combinedError, unpathedErrors: [] };
496
492
  }
package/dist/index.js CHANGED
@@ -481,16 +481,12 @@ function mergeDataAndErrors(data, errors, path, onLocatedError, index = 1) {
481
481
  return { data: relocatedError(errors[0], newPath), unpathedErrors: [] };
482
482
  }
483
483
  const combinedError = new AggregateError(
484
- errors.map(
485
- (e) => (
486
- // We cast path as any for GraphQL.js 14 compat
487
- // locatedError path argument must be defined, but it is just forwarded to a constructor that allows a undefined value
488
- // https://github.com/graphql/graphql-js/blob/b4bff0ba9c15c9d7245dd68556e754c41f263289/src/error/locatedError.js#L25
489
- // https://github.com/graphql/graphql-js/blob/b4bff0ba9c15c9d7245dd68556e754c41f263289/src/error/GraphQLError.js#L19
490
- locatedError(e, void 0, path)
491
- )
492
- ),
493
- errors.map((error) => error.message).join(", \n")
484
+ errors.map((e) => {
485
+ const error = onLocatedError ? onLocatedError(e) : e;
486
+ const newPath = path === void 0 ? error.path : !error.path ? path : path.concat(error.path.slice(1));
487
+ return relocatedError(e, newPath);
488
+ }),
489
+ errors.map((error) => error.message).join(",\n")
494
490
  );
495
491
  return { data: combinedError, unpathedErrors: [] };
496
492
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "10.2.19",
3
+ "version": "10.2.20-alpha-de2e938a921f04ca4bef925ceb74197fd44f9017",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {
@@ -49,9 +49,9 @@
49
49
  "tslib": "^2.8.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/lodash": "4.17.17",
52
+ "@types/lodash": "4.17.18",
53
53
  "graphql": "^16.9.0",
54
- "pkgroll": "2.12.2"
54
+ "pkgroll": "2.13.1"
55
55
  },
56
56
  "sideEffects": false
57
57
  }