@graphql-tools/batch-delegate 10.0.1 → 10.0.2-alpha-bb9905fa22f9cde363771a3d706f7c31a828a1ed
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 +10 -0
- package/dist/index.cjs +12 -3
- package/dist/index.js +13 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @graphql-tools/batch-delegate
|
|
2
2
|
|
|
3
|
+
## 10.0.2-alpha-bb9905fa22f9cde363771a3d706f7c31a828a1ed
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#1556](https://github.com/graphql-hive/gateway/pull/1556) [`6eaefe7`](https://github.com/graphql-hive/gateway/commit/6eaefe7d808a5f681ef227956aabf83595968cc8) Thanks [@ardatan](https://github.com/ardatan)! - Correct error paths in case of batch delegation with the same error
|
|
9
|
+
|
|
10
|
+
- Updated dependencies [[`6eaefe7`](https://github.com/graphql-hive/gateway/commit/6eaefe7d808a5f681ef227956aabf83595968cc8)]:
|
|
11
|
+
- @graphql-tools/delegate@11.0.2-alpha-bb9905fa22f9cde363771a3d706f7c31a828a1ed
|
|
12
|
+
|
|
3
13
|
## 10.0.1
|
|
4
14
|
### Patch Changes
|
|
5
15
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var delegate = require('@graphql-tools/delegate');
|
|
4
3
|
var utils = require('@graphql-tools/utils');
|
|
5
4
|
var promiseHelpers = require('@whatwg-node/promise-helpers');
|
|
6
|
-
var DataLoader = require('dataloader');
|
|
7
5
|
var graphql = require('graphql');
|
|
6
|
+
var delegate = require('@graphql-tools/delegate');
|
|
7
|
+
var DataLoader = require('dataloader');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
@@ -107,7 +107,16 @@ function batchDelegateToSchema(options) {
|
|
|
107
107
|
return [];
|
|
108
108
|
}
|
|
109
109
|
const loader = getLoader(options);
|
|
110
|
-
return
|
|
110
|
+
return promiseHelpers.handleMaybePromise(
|
|
111
|
+
() => Array.isArray(key) ? loader.loadMany(key) : loader.load(key),
|
|
112
|
+
(res) => res,
|
|
113
|
+
(error) => {
|
|
114
|
+
if (options.info?.path && error instanceof graphql.GraphQLError) {
|
|
115
|
+
return utils.relocatedError(error, utils.pathToArray(options.info.path));
|
|
116
|
+
}
|
|
117
|
+
return error;
|
|
118
|
+
}
|
|
119
|
+
);
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
function createBatchDelegateFn(optionsOrArgsFromKeys, lazyOptionsFn, dataLoaderOptions, valuesFromResults) {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { memoize2, memoize1, relocatedError, pathToArray } from '@graphql-tools/utils';
|
|
2
|
+
import { fakePromise, handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
3
|
+
import { getNamedType, print, GraphQLList, GraphQLError } from 'graphql';
|
|
1
4
|
import { getActualFieldNodes, delegateToSchema } from '@graphql-tools/delegate';
|
|
2
|
-
import { memoize2, memoize1, relocatedError } from '@graphql-tools/utils';
|
|
3
|
-
import { fakePromise } from '@whatwg-node/promise-helpers';
|
|
4
5
|
import DataLoader from 'dataloader';
|
|
5
|
-
import { getNamedType, print, GraphQLList } from 'graphql';
|
|
6
6
|
|
|
7
7
|
const DEFAULT_ARGS_FROM_KEYS = (keys) => ({ ids: keys });
|
|
8
8
|
function createBatchFn(options) {
|
|
@@ -101,7 +101,16 @@ function batchDelegateToSchema(options) {
|
|
|
101
101
|
return [];
|
|
102
102
|
}
|
|
103
103
|
const loader = getLoader(options);
|
|
104
|
-
return
|
|
104
|
+
return handleMaybePromise(
|
|
105
|
+
() => Array.isArray(key) ? loader.loadMany(key) : loader.load(key),
|
|
106
|
+
(res) => res,
|
|
107
|
+
(error) => {
|
|
108
|
+
if (options.info?.path && error instanceof GraphQLError) {
|
|
109
|
+
return relocatedError(error, pathToArray(options.info.path));
|
|
110
|
+
}
|
|
111
|
+
return error;
|
|
112
|
+
}
|
|
113
|
+
);
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
function createBatchDelegateFn(optionsOrArgsFromKeys, lazyOptionsFn, dataLoaderOptions, valuesFromResults) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/batch-delegate",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2-alpha-bb9905fa22f9cde363771a3d706f7c31a828a1ed",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphql-tools/delegate": "
|
|
41
|
+
"@graphql-tools/delegate": "11.0.2-alpha-bb9905fa22f9cde363771a3d706f7c31a828a1ed",
|
|
42
42
|
"@graphql-tools/utils": "^10.9.1",
|
|
43
43
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
44
44
|
"dataloader": "^2.2.3",
|