@graphql-tools/delegate 8.4.2-alpha-9f8b9c45.0 → 8.4.4-alpha-b935d9b2.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 +0 -2
- package/index.js +7 -4
- package/index.mjs +8 -5
- package/package.json +7 -5
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const graphql = require('graphql');
|
|
6
6
|
const utils = require('@graphql-tools/utils');
|
|
7
|
+
const graphqlExecutor = require('graphql-executor');
|
|
7
8
|
const valueOrPromise = require('value-or-promise');
|
|
8
9
|
const batchExecute = require('@graphql-tools/batch-execute');
|
|
9
10
|
|
|
@@ -1185,8 +1186,9 @@ function delegateRequest(options) {
|
|
|
1185
1186
|
return new valueOrPromise.ValueOrPromise(() => executor(processedRequest))
|
|
1186
1187
|
.then(originalResult => {
|
|
1187
1188
|
if (utils.isAsyncIterable(originalResult)) {
|
|
1189
|
+
const iterator = originalResult[Symbol.asyncIterator]();
|
|
1188
1190
|
// "subscribe" to the subscription result and map the result through the transforms
|
|
1189
|
-
return utils.mapAsyncIterator(
|
|
1191
|
+
return utils.mapAsyncIterator(iterator, result => transformer.transformResult(result));
|
|
1190
1192
|
}
|
|
1191
1193
|
return transformer.transformResult(originalResult);
|
|
1192
1194
|
})
|
|
@@ -1250,17 +1252,18 @@ function validateRequest(delegationContext, document) {
|
|
|
1250
1252
|
throw error.originalError || error;
|
|
1251
1253
|
}
|
|
1252
1254
|
}
|
|
1255
|
+
const GLOBAL_CONTEXT = {};
|
|
1253
1256
|
function getExecutor(delegationContext) {
|
|
1254
|
-
var _a, _b;
|
|
1255
1257
|
const { subschemaConfig, targetSchema, context } = delegationContext;
|
|
1256
1258
|
let executor = (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.executor) || createDefaultExecutor(targetSchema);
|
|
1257
1259
|
if (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batch) {
|
|
1258
1260
|
const batchingOptions = subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batchingOptions;
|
|
1259
|
-
executor = batchExecute.getBatchingExecutor(
|
|
1261
|
+
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
1262
|
}
|
|
1261
1263
|
return executor;
|
|
1262
1264
|
}
|
|
1263
1265
|
const createDefaultExecutor = utils.memoize1(function createDefaultExecutor(schema) {
|
|
1266
|
+
const executor = new graphqlExecutor.Executor({ schema });
|
|
1264
1267
|
return function defaultExecutor(request) {
|
|
1265
1268
|
const operationAst = utils.getOperationASTFromRequest(request);
|
|
1266
1269
|
const executionArgs = {
|
|
@@ -1274,7 +1277,7 @@ const createDefaultExecutor = utils.memoize1(function createDefaultExecutor(sche
|
|
|
1274
1277
|
if (operationAst.operation === 'subscription') {
|
|
1275
1278
|
return graphql.subscribe(executionArgs);
|
|
1276
1279
|
}
|
|
1277
|
-
return
|
|
1280
|
+
return executor.execute(executionArgs);
|
|
1278
1281
|
};
|
|
1279
1282
|
});
|
|
1280
1283
|
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Kind, isAbstractType, isInterfaceType, TypeInfo, visit, visitWithTypeInfo, getNamedType, isObjectType, versionInfo, TypeNameMetaFieldDef, responsePathAsArray, GraphQLError, locatedError, getNullableType, isCompositeType, isListType, typeFromAST, defaultFieldResolver, validate, subscribe
|
|
1
|
+
import { Kind, isAbstractType, isInterfaceType, TypeInfo, visit, visitWithTypeInfo, getNamedType, isObjectType, versionInfo, TypeNameMetaFieldDef, responsePathAsArray, GraphQLError, locatedError, getNullableType, isCompositeType, isListType, typeFromAST, defaultFieldResolver, validate, subscribe } from 'graphql';
|
|
2
2
|
import { memoize2, implementsAbstractType, getRootTypeNames, getDefinedRootType, createVariableNameGenerator, updateArgument, serializeInputValue, inspect, collectFields, relocatedError, AggregateError, getResponseKeyFromInfo, isAsyncIterable, mapAsyncIterator, getOperationASTFromRequest, memoize1 } from '@graphql-tools/utils';
|
|
3
|
+
import { Executor } from 'graphql-executor';
|
|
3
4
|
import { ValueOrPromise } from 'value-or-promise';
|
|
4
5
|
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
5
6
|
|
|
@@ -1181,8 +1182,9 @@ function delegateRequest(options) {
|
|
|
1181
1182
|
return new ValueOrPromise(() => executor(processedRequest))
|
|
1182
1183
|
.then(originalResult => {
|
|
1183
1184
|
if (isAsyncIterable(originalResult)) {
|
|
1185
|
+
const iterator = originalResult[Symbol.asyncIterator]();
|
|
1184
1186
|
// "subscribe" to the subscription result and map the result through the transforms
|
|
1185
|
-
return mapAsyncIterator(
|
|
1187
|
+
return mapAsyncIterator(iterator, result => transformer.transformResult(result));
|
|
1186
1188
|
}
|
|
1187
1189
|
return transformer.transformResult(originalResult);
|
|
1188
1190
|
})
|
|
@@ -1246,17 +1248,18 @@ function validateRequest(delegationContext, document) {
|
|
|
1246
1248
|
throw error.originalError || error;
|
|
1247
1249
|
}
|
|
1248
1250
|
}
|
|
1251
|
+
const GLOBAL_CONTEXT = {};
|
|
1249
1252
|
function getExecutor(delegationContext) {
|
|
1250
|
-
var _a, _b;
|
|
1251
1253
|
const { subschemaConfig, targetSchema, context } = delegationContext;
|
|
1252
1254
|
let executor = (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.executor) || createDefaultExecutor(targetSchema);
|
|
1253
1255
|
if (subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batch) {
|
|
1254
1256
|
const batchingOptions = subschemaConfig === null || subschemaConfig === void 0 ? void 0 : subschemaConfig.batchingOptions;
|
|
1255
|
-
executor = getBatchingExecutor(
|
|
1257
|
+
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
1258
|
}
|
|
1257
1259
|
return executor;
|
|
1258
1260
|
}
|
|
1259
1261
|
const createDefaultExecutor = memoize1(function createDefaultExecutor(schema) {
|
|
1262
|
+
const executor = new Executor({ schema });
|
|
1260
1263
|
return function defaultExecutor(request) {
|
|
1261
1264
|
const operationAst = getOperationASTFromRequest(request);
|
|
1262
1265
|
const executionArgs = {
|
|
@@ -1270,7 +1273,7 @@ const createDefaultExecutor = memoize1(function createDefaultExecutor(schema) {
|
|
|
1270
1273
|
if (operationAst.operation === 'subscription') {
|
|
1271
1274
|
return subscribe(executionArgs);
|
|
1272
1275
|
}
|
|
1273
|
-
return execute(executionArgs);
|
|
1276
|
+
return executor.execute(executionArgs);
|
|
1274
1277
|
};
|
|
1275
1278
|
});
|
|
1276
1279
|
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/delegate",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.4-alpha-b935d9b2.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.2-alpha-
|
|
11
|
-
"@graphql-tools/schema": "8.3.2-alpha-
|
|
12
|
-
"@graphql-tools/utils": "8.
|
|
10
|
+
"@graphql-tools/batch-execute": "8.3.2-alpha-b935d9b2.0",
|
|
11
|
+
"@graphql-tools/schema": "8.3.2-alpha-b935d9b2.0",
|
|
12
|
+
"@graphql-tools/utils": "8.6.1-alpha-b935d9b2.0",
|
|
13
13
|
"dataloader": "2.0.0",
|
|
14
|
+
"graphql-executor": "0.0.14",
|
|
14
15
|
"tslib": "~2.3.0",
|
|
15
16
|
"value-or-promise": "1.0.11"
|
|
16
17
|
},
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"./*": {
|
|
35
36
|
"require": "./*.js",
|
|
36
37
|
"import": "./*.mjs"
|
|
37
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json"
|
|
38
40
|
}
|
|
39
41
|
}
|