@graphql-tools/batch-execute 10.0.8 → 10.0.9-alpha-adaef9d2f8175d3f2870a7f6efd2df86b4a46a9c

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,16 @@
1
1
  # @graphql-tools/batch-execute
2
2
 
3
+ ## 10.0.9-alpha-adaef9d2f8175d3f2870a7f6efd2df86b4a46a9c
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#2452](https://github.com/graphql-hive/gateway/pull/2452) [`4311d79`](https://github.com/graphql-hive/gateway/commit/4311d79d854a589f2f6295629b9ad5b0a5c00f92) Thanks [@wijskinner](https://github.com/wijskinner)! - Fix `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array` thrown when a batched subgraph response omits some of the merged sub-requests.
9
+
10
+ `splitResult` builds `new Array(numResults)` and only assigns the indices present in the merged response's `data`/`errors`. When a subgraph answers only some of the batched operations — returning neither a data key nor a path-scoped error for the rest — those slots stay holes. A hole at the trailing slot fails DataLoader's `isArrayLike` check (which requires `hasOwnProperty(length - 1)`) even though `Array.isArray` is `true`, so the batching executor's DataLoader throws. The result is now densified to `numResults`, filling any missing slot with an empty `ExecutionResult`.
11
+
12
+ This mirrors the sibling fix for `@graphql-tools/batch-delegate` in [#2393](https://github.com/graphql-hive/gateway/issues/2393).
13
+
3
14
  ## 10.0.8
4
15
  ### Patch Changes
5
16
 
package/dist/index.cjs CHANGED
@@ -313,6 +313,11 @@ function splitResult({ data, errors }, numResults) {
313
313
  }
314
314
  }
315
315
  }
316
+ for (let i = 0; i < numResults; i++) {
317
+ if (splitResults[i] == null) {
318
+ splitResults[i] = { data: {} };
319
+ }
320
+ }
316
321
  return splitResults;
317
322
  }
318
323
 
package/dist/index.js CHANGED
@@ -307,6 +307,11 @@ function splitResult({ data, errors }, numResults) {
307
307
  }
308
308
  }
309
309
  }
310
+ for (let i = 0; i < numResults; i++) {
311
+ if (splitResults[i] == null) {
312
+ splitResults[i] = { data: {} };
313
+ }
314
+ }
310
315
  return splitResults;
311
316
  }
312
317
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/batch-execute",
3
- "version": "10.0.8",
3
+ "version": "10.0.9-alpha-adaef9d2f8175d3f2870a7f6efd2df86b4a46a9c",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "graphql": "^16.12.0",
48
- "pkgroll": "2.27.0"
48
+ "pkgroll": "2.27.1"
49
49
  },
50
50
  "sideEffects": false
51
51
  }