@graphql-tools/delegate 8.4.1 → 8.4.4-alpha-40340ed2.0

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/README.md CHANGED
@@ -3,5 +3,3 @@ https://www.graphql-tools.com/docs/api/modules/delegate_src
3
3
 
4
4
  You can also learn more about Schema Delegation in this chapter;
5
5
  https://www.graphql-tools.com/docs/schema-delegation
6
-
7
-
package/index.js CHANGED
@@ -1185,8 +1185,9 @@ function delegateRequest(options) {
1185
1185
  return new valueOrPromise.ValueOrPromise(() => executor(processedRequest))
1186
1186
  .then(originalResult => {
1187
1187
  if (utils.isAsyncIterable(originalResult)) {
1188
+ const iterator = originalResult[Symbol.asyncIterator]();
1188
1189
  // "subscribe" to the subscription result and map the result through the transforms
1189
- return utils.mapAsyncIterator(originalResult, result => transformer.transformResult(result));
1190
+ return utils.mapAsyncIterator(iterator, result => transformer.transformResult(result));
1190
1191
  }
1191
1192
  return transformer.transformResult(originalResult);
1192
1193
  })
@@ -1250,13 +1251,13 @@ function validateRequest(delegationContext, document) {
1250
1251
  throw error.originalError || error;
1251
1252
  }
1252
1253
  }
1254
+ const GLOBAL_CONTEXT = {};
1253
1255
  function getExecutor(delegationContext) {
1254
- var _a, _b;
1255
1256
  const { subschemaConfig, targetSchema, context } = delegationContext;
1256
1257
  let executor = (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.executor) || createDefaultExecutor(targetSchema);
1257
1258
  if (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batch) {
1258
1259
  const batchingOptions = subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batchingOptions;
1259
- executor = batchExecute.getBatchingExecutor((_b = (_a = context !== null && context !== void 0 ? context : globalThis) !== null && _a !== void 0 ? _a : window) !== null && _b !== void 0 ? _b : global, executor, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.dataLoaderOptions, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.extensionsReducer);
1260
+ executor = batchExecute.getBatchingExecutor(context !== null && context !== void 0 ? context : GLOBAL_CONTEXT, executor, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.dataLoaderOptions, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.extensionsReducer);
1260
1261
  }
1261
1262
  return executor;
1262
1263
  }
package/index.mjs CHANGED
@@ -1181,8 +1181,9 @@ function delegateRequest(options) {
1181
1181
  return new ValueOrPromise(() => executor(processedRequest))
1182
1182
  .then(originalResult => {
1183
1183
  if (isAsyncIterable(originalResult)) {
1184
+ const iterator = originalResult[Symbol.asyncIterator]();
1184
1185
  // "subscribe" to the subscription result and map the result through the transforms
1185
- return mapAsyncIterator(originalResult, result => transformer.transformResult(result));
1186
+ return mapAsyncIterator(iterator, result => transformer.transformResult(result));
1186
1187
  }
1187
1188
  return transformer.transformResult(originalResult);
1188
1189
  })
@@ -1246,13 +1247,13 @@ function validateRequest(delegationContext, document) {
1246
1247
  throw error.originalError || error;
1247
1248
  }
1248
1249
  }
1250
+ const GLOBAL_CONTEXT = {};
1249
1251
  function getExecutor(delegationContext) {
1250
- var _a, _b;
1251
1252
  const { subschemaConfig, targetSchema, context } = delegationContext;
1252
1253
  let executor = (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.executor) || createDefaultExecutor(targetSchema);
1253
1254
  if (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batch) {
1254
1255
  const batchingOptions = subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batchingOptions;
1255
- executor = getBatchingExecutor((_b = (_a = context !== null && context !== void 0 ? context : globalThis) !== null && _a !== void 0 ? _a : window) !== null && _b !== void 0 ? _b : global, executor, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.dataLoaderOptions, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.extensionsReducer);
1256
+ executor = getBatchingExecutor(context !== null && context !== void 0 ? context : GLOBAL_CONTEXT, executor, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.dataLoaderOptions, batchingOptions === null || batchingOptions === void 0 ? void 0 : batchingOptions.extensionsReducer);
1256
1257
  }
1257
1258
  return executor;
1258
1259
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "8.4.1",
3
+ "version": "8.4.4-alpha-40340ed2.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-tools/batch-execute": "^8.3.1",
11
- "@graphql-tools/schema": "^8.3.1",
12
- "@graphql-tools/utils": "^8.5.1",
10
+ "@graphql-tools/batch-execute": "8.3.2-alpha-40340ed2.0",
11
+ "@graphql-tools/schema": "8.3.2-alpha-40340ed2.0",
12
+ "@graphql-tools/utils": "8.6.1-alpha-40340ed2.0",
13
13
  "dataloader": "2.0.0",
14
14
  "tslib": "~2.3.0",
15
15
  "value-or-promise": "1.0.11"
@@ -34,6 +34,7 @@
34
34
  "./*": {
35
35
  "require": "./*.js",
36
36
  "import": "./*.mjs"
37
- }
37
+ },
38
+ "./package.json": "./package.json"
38
39
  }
39
40
  }