@graphql-tools/batch-execute 10.3.1 → 10.3.2-alpha-f4200d760e418b0fdb4cebdecd8dbc6c01e0dcb3
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 +14 -0
- package/dist/index.cjs +4 -20
- package/dist/index.js +4 -20
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @graphql-tools/batch-execute
|
|
2
2
|
|
|
3
|
+
## 10.3.2-alpha-f4200d760e418b0fdb4cebdecd8dbc6c01e0dcb3
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#2728](https://github.com/graphql-hive/gateway/pull/2728) [`f4200d7`](https://github.com/graphql-hive/gateway/commit/f4200d760e418b0fdb4cebdecd8dbc6c01e0dcb3) Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies updates:
|
|
9
|
+
|
|
10
|
+
- Updated dependency [`@graphql-tools/utils@^13.0.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/13.0.0) (from `^12.1.0`, in `dependencies`)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
- [`e288224`](https://github.com/graphql-hive/gateway/commit/e28822460e2189e3b1e112bf2ad9072d68c01f90) Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
|
|
14
|
+
|
|
15
|
+
- Updated dependency [`@graphql-tools/utils@^12.1.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/12.1.0) (from `^12.0.1`, in `dependencies`)
|
|
16
|
+
|
|
3
17
|
## 10.3.1
|
|
4
18
|
### Patch Changes
|
|
5
19
|
|
package/dist/index.cjs
CHANGED
|
@@ -361,31 +361,15 @@ function splitResult({ data, errors }, numResults) {
|
|
|
361
361
|
|
|
362
362
|
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer = defaultExtensionsReducer, defer = false) {
|
|
363
363
|
const loadFn = createLoadFn(executor, extensionsReducer, defer);
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
function getLoaders(context) {
|
|
367
|
-
const isObject = typeof context === "object" && context !== null || typeof context === "function";
|
|
368
|
-
let loaders = isObject ? loadersByObjectContext.get(context) : loadersByPrimitiveContext.get(context);
|
|
369
|
-
if (!loaders) {
|
|
370
|
-
loaders = {
|
|
371
|
-
query: new DataLoader__default.default(loadFn, dataLoaderOptions),
|
|
372
|
-
mutation: new DataLoader__default.default(loadFn, dataLoaderOptions)
|
|
373
|
-
};
|
|
374
|
-
if (isObject) {
|
|
375
|
-
loadersByObjectContext.set(context, loaders);
|
|
376
|
-
} else {
|
|
377
|
-
loadersByPrimitiveContext.set(context, loaders);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
return loaders;
|
|
381
|
-
}
|
|
364
|
+
const queryLoader = new DataLoader__default.default(loadFn, dataLoaderOptions);
|
|
365
|
+
const mutationLoader = new DataLoader__default.default(loadFn, dataLoaderOptions);
|
|
382
366
|
return function batchingExecutor(request) {
|
|
383
367
|
const operationType = request.operationType ?? utils.getOperationASTFromRequest(request)?.operation;
|
|
384
368
|
switch (operationType) {
|
|
385
369
|
case "query":
|
|
386
|
-
return
|
|
370
|
+
return queryLoader.load(request);
|
|
387
371
|
case "mutation":
|
|
388
|
-
return
|
|
372
|
+
return mutationLoader.load(request);
|
|
389
373
|
case "subscription":
|
|
390
374
|
return executor(request);
|
|
391
375
|
default:
|
package/dist/index.js
CHANGED
|
@@ -355,31 +355,15 @@ function splitResult({ data, errors }, numResults) {
|
|
|
355
355
|
|
|
356
356
|
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer = defaultExtensionsReducer, defer = false) {
|
|
357
357
|
const loadFn = createLoadFn(executor, extensionsReducer, defer);
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
function getLoaders(context) {
|
|
361
|
-
const isObject = typeof context === "object" && context !== null || typeof context === "function";
|
|
362
|
-
let loaders = isObject ? loadersByObjectContext.get(context) : loadersByPrimitiveContext.get(context);
|
|
363
|
-
if (!loaders) {
|
|
364
|
-
loaders = {
|
|
365
|
-
query: new DataLoader(loadFn, dataLoaderOptions),
|
|
366
|
-
mutation: new DataLoader(loadFn, dataLoaderOptions)
|
|
367
|
-
};
|
|
368
|
-
if (isObject) {
|
|
369
|
-
loadersByObjectContext.set(context, loaders);
|
|
370
|
-
} else {
|
|
371
|
-
loadersByPrimitiveContext.set(context, loaders);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return loaders;
|
|
375
|
-
}
|
|
358
|
+
const queryLoader = new DataLoader(loadFn, dataLoaderOptions);
|
|
359
|
+
const mutationLoader = new DataLoader(loadFn, dataLoaderOptions);
|
|
376
360
|
return function batchingExecutor(request) {
|
|
377
361
|
const operationType = request.operationType ?? getOperationASTFromRequest(request)?.operation;
|
|
378
362
|
switch (operationType) {
|
|
379
363
|
case "query":
|
|
380
|
-
return
|
|
364
|
+
return queryLoader.load(request);
|
|
381
365
|
case "mutation":
|
|
382
|
-
return
|
|
366
|
+
return mutationLoader.load(request);
|
|
383
367
|
case "subscription":
|
|
384
368
|
return executor(request);
|
|
385
369
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/batch-execute",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.2-alpha-f4200d760e418b0fdb4cebdecd8dbc6c01e0dcb3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@graphql-hive/signal": "^2.1.0",
|
|
42
|
-
"@graphql-tools/utils": "^
|
|
42
|
+
"@graphql-tools/utils": "^13.0.0",
|
|
43
43
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
44
44
|
"dataloader": "^2.2.3",
|
|
45
45
|
"tslib": "^2.8.1"
|