@graphql-tools/batch-execute 9.0.12 → 9.0.13-alpha-3b2000e3a6b9e871ed2700b7795f23d2a15358ce
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 +8 -0
- package/dist/index.cjs +15 -11
- package/dist/index.js +14 -10
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @graphql-tools/batch-execute
|
|
2
2
|
|
|
3
|
+
## 9.0.13-alpha-3b2000e3a6b9e871ed2700b7795f23d2a15358ce
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#726](https://github.com/graphql-hive/gateway/pull/726) [`3b2000e`](https://github.com/graphql-hive/gateway/commit/3b2000e3a6b9e871ed2700b7795f23d2a15358ce) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
|
8
|
+
|
|
9
|
+
- Added dependency [`@whatwg-node/promise-helpers@^1.0.0` ↗︎](https://www.npmjs.com/package/@whatwg-node/promise-helpers/v/1.0.0) (to `dependencies`)
|
|
10
|
+
|
|
3
11
|
## 9.0.12
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var utils = require('@graphql-tools/utils');
|
|
4
|
+
var promiseHelpers = require('@whatwg-node/promise-helpers');
|
|
4
5
|
var DataLoader = require('dataloader');
|
|
5
6
|
var graphql = require('graphql');
|
|
6
7
|
|
|
@@ -301,24 +302,27 @@ function createLoadFn(executor, extensionsReducer) {
|
|
|
301
302
|
return function batchExecuteLoadFn(requests) {
|
|
302
303
|
if (requests.length === 1 && requests[0]) {
|
|
303
304
|
const request = requests[0];
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
executor(request),
|
|
305
|
+
return promiseHelpers.fakePromise(
|
|
306
|
+
promiseHelpers.handleMaybePromise(
|
|
307
|
+
() => executor(request),
|
|
307
308
|
(result) => [result],
|
|
308
309
|
(err) => [err]
|
|
309
310
|
)
|
|
310
311
|
);
|
|
311
312
|
}
|
|
312
313
|
const mergedRequests = mergeRequests(requests, extensionsReducer);
|
|
313
|
-
return
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
return promiseHelpers.fakePromise(
|
|
315
|
+
promiseHelpers.handleMaybePromise(
|
|
316
|
+
() => executor(mergedRequests),
|
|
317
|
+
(resultBatches) => {
|
|
318
|
+
if (utils.isAsyncIterable(resultBatches)) {
|
|
319
|
+
throw new Error(
|
|
320
|
+
"Executor must not return incremental results for batching"
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
return splitResult(resultBatches, requests.length);
|
|
319
324
|
}
|
|
320
|
-
|
|
321
|
-
})
|
|
325
|
+
)
|
|
322
326
|
);
|
|
323
327
|
};
|
|
324
328
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getOperationASTFromRequest, relocatedError,
|
|
1
|
+
import { getOperationASTFromRequest, relocatedError, isAsyncIterable, memoize2of4 } from '@graphql-tools/utils';
|
|
2
|
+
import { fakePromise, handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
3
|
import DataLoader from 'dataloader';
|
|
3
4
|
import { Kind, visit } from 'graphql';
|
|
4
5
|
|
|
@@ -296,8 +297,8 @@ function createLoadFn(executor, extensionsReducer) {
|
|
|
296
297
|
if (requests.length === 1 && requests[0]) {
|
|
297
298
|
const request = requests[0];
|
|
298
299
|
return fakePromise(
|
|
299
|
-
|
|
300
|
-
executor(request),
|
|
300
|
+
handleMaybePromise(
|
|
301
|
+
() => executor(request),
|
|
301
302
|
(result) => [result],
|
|
302
303
|
(err) => [err]
|
|
303
304
|
)
|
|
@@ -305,14 +306,17 @@ function createLoadFn(executor, extensionsReducer) {
|
|
|
305
306
|
}
|
|
306
307
|
const mergedRequests = mergeRequests(requests, extensionsReducer);
|
|
307
308
|
return fakePromise(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
handleMaybePromise(
|
|
310
|
+
() => executor(mergedRequests),
|
|
311
|
+
(resultBatches) => {
|
|
312
|
+
if (isAsyncIterable(resultBatches)) {
|
|
313
|
+
throw new Error(
|
|
314
|
+
"Executor must not return incremental results for batching"
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return splitResult(resultBatches, requests.length);
|
|
313
318
|
}
|
|
314
|
-
|
|
315
|
-
})
|
|
319
|
+
)
|
|
316
320
|
);
|
|
317
321
|
};
|
|
318
322
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/batch-execute",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.13-alpha-3b2000e3a6b9e871ed2700b7795f23d2a15358ce",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@graphql-tools/utils": "^10.8.1",
|
|
42
|
+
"@whatwg-node/promise-helpers": "^1.0.0",
|
|
42
43
|
"dataloader": "^2.2.3",
|
|
43
44
|
"tslib": "^2.8.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"graphql": "^16.9.0",
|
|
47
|
-
"pkgroll": "2.
|
|
48
|
+
"pkgroll": "2.11.0"
|
|
48
49
|
},
|
|
49
50
|
"sideEffects": false
|
|
50
51
|
}
|