@graphql-mesh/fusion-runtime 1.7.0 → 1.8.0-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
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 +18 -0
- package/dist/index.cjs +34 -21
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +36 -23
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @graphql-mesh/fusion-runtime
|
|
2
2
|
|
|
3
|
+
## 1.8.0-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#2076](https://github.com/graphql-hive/gateway/pull/2076) [`b8f9a4a`](https://github.com/graphql-hive/gateway/commit/b8f9a4a67984af67191079e5ce5ddbe232c0624d) Thanks [@ardatan](https://github.com/ardatan)! - Add automatic batching to SDK requester
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`b8f9a4a`](https://github.com/graphql-hive/gateway/commit/b8f9a4a67984af67191079e5ce5ddbe232c0624d)]:
|
|
14
|
+
- @graphql-tools/batch-execute@10.0.6-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
15
|
+
- @graphql-tools/delegate@12.0.10-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
16
|
+
- @graphql-tools/federation@4.2.14-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
17
|
+
- @graphql-tools/stitch@10.1.14-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
18
|
+
- @graphql-tools/stitching-directives@4.0.16-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
19
|
+
- @graphql-tools/wrap@11.1.10-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf
|
|
20
|
+
|
|
3
21
|
## 1.7.0
|
|
4
22
|
### Minor Changes
|
|
5
23
|
|
package/dist/index.cjs
CHANGED
|
@@ -1729,7 +1729,7 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1729
1729
|
function handleExecutor(executor) {
|
|
1730
1730
|
opts?.transportContext?.log.debug(
|
|
1731
1731
|
"Executing request on unified graph",
|
|
1732
|
-
() =>
|
|
1732
|
+
() => transportCommon.defaultPrintFn(execReq.document)
|
|
1733
1733
|
);
|
|
1734
1734
|
return executor({
|
|
1735
1735
|
...execReq,
|
|
@@ -1745,7 +1745,7 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1745
1745
|
(unifiedGraph) => {
|
|
1746
1746
|
opts?.transportContext?.log.debug(
|
|
1747
1747
|
"Executing request on unified graph",
|
|
1748
|
-
() =>
|
|
1748
|
+
() => transportCommon.defaultPrintFn(execReq.document)
|
|
1749
1749
|
);
|
|
1750
1750
|
executor = transportCommon.createDefaultExecutor(unifiedGraph);
|
|
1751
1751
|
return handleExecutor(executor);
|
|
@@ -1758,32 +1758,45 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
);
|
|
1760
1760
|
};
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
return
|
|
1766
|
-
opts?.transportContext?.log.debug("Disposing unified graph executor");
|
|
1767
|
-
return unifiedGraphManager[disposablestack.DisposableSymbols.asyncDispose]();
|
|
1768
|
-
};
|
|
1761
|
+
return utils$1.makeAsyncDisposable(
|
|
1762
|
+
unifiedGraphExecutor,
|
|
1763
|
+
function unifiedGraphExecutorDispose() {
|
|
1764
|
+
opts?.transportContext?.log.debug("Disposing unified graph executor");
|
|
1765
|
+
return unifiedGraphManager[disposablestack.DisposableSymbols.asyncDispose]();
|
|
1769
1766
|
}
|
|
1770
|
-
|
|
1771
|
-
return unifiedGraphExecutor;
|
|
1767
|
+
);
|
|
1772
1768
|
}
|
|
1769
|
+
const identity = (x) => x;
|
|
1773
1770
|
function getSdkRequesterForUnifiedGraph(opts) {
|
|
1774
1771
|
const unifiedGraphExecutor = getExecutorForUnifiedGraph(opts);
|
|
1772
|
+
const onExecutionRequest = opts.onExecutionRequest || identity;
|
|
1775
1773
|
return function sdkRequester(document, variables, operationContext) {
|
|
1774
|
+
let executionRequest = {
|
|
1775
|
+
document,
|
|
1776
|
+
variables,
|
|
1777
|
+
context: operationContext
|
|
1778
|
+
};
|
|
1776
1779
|
return promiseHelpers.handleMaybePromise(
|
|
1777
|
-
() =>
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
}),
|
|
1782
|
-
(result) => {
|
|
1783
|
-
if (utils.isAsyncIterable(result)) {
|
|
1784
|
-
return promiseHelpers.mapAsyncIterator(result, extractDataOrThrowErrors);
|
|
1780
|
+
() => onExecutionRequest(executionRequest),
|
|
1781
|
+
(onExecutionRequestResult) => {
|
|
1782
|
+
if (onExecutionRequestResult != null) {
|
|
1783
|
+
executionRequest = onExecutionRequestResult;
|
|
1785
1784
|
}
|
|
1786
|
-
|
|
1785
|
+
const executor = executionRequest.context != null ? batchExecute.getBatchingExecutor(
|
|
1786
|
+
executionRequest.context,
|
|
1787
|
+
unifiedGraphExecutor,
|
|
1788
|
+
opts?.dataLoaderOptions,
|
|
1789
|
+
opts?.extensionsReducer
|
|
1790
|
+
) : unifiedGraphExecutor;
|
|
1791
|
+
return promiseHelpers.handleMaybePromise(
|
|
1792
|
+
() => executor(executionRequest),
|
|
1793
|
+
(result) => {
|
|
1794
|
+
if (utils.isAsyncIterable(result)) {
|
|
1795
|
+
return promiseHelpers.mapAsyncIterator(result, extractDataOrThrowErrors);
|
|
1796
|
+
}
|
|
1797
|
+
return extractDataOrThrowErrors(result);
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1787
1800
|
}
|
|
1788
1801
|
);
|
|
1789
1802
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _graphql_tools_utils from '@graphql-tools/utils';
|
|
2
|
-
import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe,
|
|
2
|
+
import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
|
|
3
3
|
import { Logger } from '@graphql-hive/logger';
|
|
4
|
-
import {
|
|
4
|
+
import { TransportContext, TransportEntry, Transport } from '@graphql-mesh/transport-common';
|
|
5
5
|
export { TransportEntry, TransportGetSubgraphExecutor, TransportGetSubgraphExecutorOptions } from '@graphql-mesh/transport-common';
|
|
6
6
|
import { DelegationPlanBuilder, Subschema, MergedTypeResolver, SubschemaConfig } from '@graphql-tools/delegate';
|
|
7
7
|
import * as graphql from 'graphql';
|
|
@@ -10,6 +10,7 @@ import { GraphQLResolveInfo, GraphQLOutputType } from 'graphql/type';
|
|
|
10
10
|
import { OnDelegateHook } from '@graphql-mesh/types';
|
|
11
11
|
import { DisposableSymbols } from '@whatwg-node/disposablestack';
|
|
12
12
|
import { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
13
|
+
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
13
14
|
|
|
14
15
|
type TransportEntryAdditions = {
|
|
15
16
|
[subgraph: '*' | string]: Partial<TransportEntry>;
|
|
@@ -263,7 +264,12 @@ declare function handleFederationSubschema({ subschemaConfig, unifiedGraphDirect
|
|
|
263
264
|
};
|
|
264
265
|
|
|
265
266
|
type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
|
|
266
|
-
declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>):
|
|
267
|
-
|
|
267
|
+
declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<_graphql_tools_utils.MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
|
|
268
|
+
interface SdkRequesterOptions extends UnifiedGraphManagerOptions<any> {
|
|
269
|
+
dataLoaderOptions?: Parameters<typeof getBatchingExecutor>[2];
|
|
270
|
+
extensionsReducer?: (mergedExtensions: Record<string, any>, request: ExecutionRequest) => Record<string, any>;
|
|
271
|
+
onExecutionRequest?(request: ExecutionRequest): MaybePromise<ExecutionRequest>;
|
|
272
|
+
}
|
|
273
|
+
declare function getSdkRequesterForUnifiedGraph(opts: SdkRequesterOptions): SdkRequester;
|
|
268
274
|
|
|
269
|
-
export { type BatchDelegateOptions, type HandleFederationSubschemaOpts, type HandleFederationSupergraphResult, type Instrumentation, type OnDelegationPlanDoneHook, type OnDelegationPlanDonePayload, type OnDelegationPlanHook, type OnDelegationPlanHookPayload, type OnDelegationStageExecuteDoneHook, type OnDelegationStageExecuteDonePayload, type OnDelegationStageExecuteHook, type OnDelegationStageExecutePayload, type OnSubgraphExecuteDoneHook, type OnSubgraphExecuteDoneOnNextPayload, type OnSubgraphExecuteDonePayload, type OnSubgraphExecuteDoneResult, type OnSubgraphExecuteDoneResultOnEnd, type OnSubgraphExecuteDoneResultOnNext, type OnSubgraphExecuteHook, type OnSubgraphExecutePayload, type TransportEntryAdditions, type Transports, type UnifiedGraphHandler, type UnifiedGraphHandlerOpts, type UnifiedGraphHandlerResult, UnifiedGraphManager, type UnifiedGraphManagerOptions, type UnifiedGraphPlugin, type WrapExecuteWithHooksOptions, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
|
|
275
|
+
export { type BatchDelegateOptions, type HandleFederationSubschemaOpts, type HandleFederationSupergraphResult, type Instrumentation, type OnDelegationPlanDoneHook, type OnDelegationPlanDonePayload, type OnDelegationPlanHook, type OnDelegationPlanHookPayload, type OnDelegationStageExecuteDoneHook, type OnDelegationStageExecuteDonePayload, type OnDelegationStageExecuteHook, type OnDelegationStageExecutePayload, type OnSubgraphExecuteDoneHook, type OnSubgraphExecuteDoneOnNextPayload, type OnSubgraphExecuteDonePayload, type OnSubgraphExecuteDoneResult, type OnSubgraphExecuteDoneResultOnEnd, type OnSubgraphExecuteDoneResultOnNext, type OnSubgraphExecuteHook, type OnSubgraphExecutePayload, type SdkRequesterOptions, type TransportEntryAdditions, type Transports, type UnifiedGraphHandler, type UnifiedGraphHandlerOpts, type UnifiedGraphHandlerResult, UnifiedGraphManager, type UnifiedGraphManagerOptions, type UnifiedGraphPlugin, type WrapExecuteWithHooksOptions, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _graphql_tools_utils from '@graphql-tools/utils';
|
|
2
|
-
import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe,
|
|
2
|
+
import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
|
|
3
3
|
import { Logger } from '@graphql-hive/logger';
|
|
4
|
-
import {
|
|
4
|
+
import { TransportContext, TransportEntry, Transport } from '@graphql-mesh/transport-common';
|
|
5
5
|
export { TransportEntry, TransportGetSubgraphExecutor, TransportGetSubgraphExecutorOptions } from '@graphql-mesh/transport-common';
|
|
6
6
|
import { DelegationPlanBuilder, Subschema, MergedTypeResolver, SubschemaConfig } from '@graphql-tools/delegate';
|
|
7
7
|
import * as graphql from 'graphql';
|
|
@@ -10,6 +10,7 @@ import { GraphQLResolveInfo, GraphQLOutputType } from 'graphql/type';
|
|
|
10
10
|
import { OnDelegateHook } from '@graphql-mesh/types';
|
|
11
11
|
import { DisposableSymbols } from '@whatwg-node/disposablestack';
|
|
12
12
|
import { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
13
|
+
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
13
14
|
|
|
14
15
|
type TransportEntryAdditions = {
|
|
15
16
|
[subgraph: '*' | string]: Partial<TransportEntry>;
|
|
@@ -263,7 +264,12 @@ declare function handleFederationSubschema({ subschemaConfig, unifiedGraphDirect
|
|
|
263
264
|
};
|
|
264
265
|
|
|
265
266
|
type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
|
|
266
|
-
declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>):
|
|
267
|
-
|
|
267
|
+
declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<_graphql_tools_utils.MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
|
|
268
|
+
interface SdkRequesterOptions extends UnifiedGraphManagerOptions<any> {
|
|
269
|
+
dataLoaderOptions?: Parameters<typeof getBatchingExecutor>[2];
|
|
270
|
+
extensionsReducer?: (mergedExtensions: Record<string, any>, request: ExecutionRequest) => Record<string, any>;
|
|
271
|
+
onExecutionRequest?(request: ExecutionRequest): MaybePromise<ExecutionRequest>;
|
|
272
|
+
}
|
|
273
|
+
declare function getSdkRequesterForUnifiedGraph(opts: SdkRequesterOptions): SdkRequester;
|
|
268
274
|
|
|
269
|
-
export { type BatchDelegateOptions, type HandleFederationSubschemaOpts, type HandleFederationSupergraphResult, type Instrumentation, type OnDelegationPlanDoneHook, type OnDelegationPlanDonePayload, type OnDelegationPlanHook, type OnDelegationPlanHookPayload, type OnDelegationStageExecuteDoneHook, type OnDelegationStageExecuteDonePayload, type OnDelegationStageExecuteHook, type OnDelegationStageExecutePayload, type OnSubgraphExecuteDoneHook, type OnSubgraphExecuteDoneOnNextPayload, type OnSubgraphExecuteDonePayload, type OnSubgraphExecuteDoneResult, type OnSubgraphExecuteDoneResultOnEnd, type OnSubgraphExecuteDoneResultOnNext, type OnSubgraphExecuteHook, type OnSubgraphExecutePayload, type TransportEntryAdditions, type Transports, type UnifiedGraphHandler, type UnifiedGraphHandlerOpts, type UnifiedGraphHandlerResult, UnifiedGraphManager, type UnifiedGraphManagerOptions, type UnifiedGraphPlugin, type WrapExecuteWithHooksOptions, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
|
|
275
|
+
export { type BatchDelegateOptions, type HandleFederationSubschemaOpts, type HandleFederationSupergraphResult, type Instrumentation, type OnDelegationPlanDoneHook, type OnDelegationPlanDonePayload, type OnDelegationPlanHook, type OnDelegationPlanHookPayload, type OnDelegationStageExecuteDoneHook, type OnDelegationStageExecuteDonePayload, type OnDelegationStageExecuteHook, type OnDelegationStageExecutePayload, type OnSubgraphExecuteDoneHook, type OnSubgraphExecuteDoneOnNextPayload, type OnSubgraphExecuteDonePayload, type OnSubgraphExecuteDoneResult, type OnSubgraphExecuteDoneResultOnEnd, type OnSubgraphExecuteDoneResultOnNext, type OnSubgraphExecuteHook, type OnSubgraphExecutePayload, type SdkRequesterOptions, type TransportEntryAdditions, type Transports, type UnifiedGraphHandler, type UnifiedGraphHandlerOpts, type UnifiedGraphHandlerResult, UnifiedGraphManager, type UnifiedGraphManagerOptions, type UnifiedGraphPlugin, type WrapExecuteWithHooksOptions, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getInstrumented } from '@envelop/instrumentation';
|
|
2
2
|
import { LegacyLogger, Logger } from '@graphql-hive/logger';
|
|
3
3
|
import { defaultPrintFn, createDefaultExecutor } from '@graphql-mesh/transport-common';
|
|
4
|
-
import { getInContextSDK, getResolverForPubSubOperation, resolveAdditionalResolversWithoutImport, isDisposable, iterateAsync, dispose } from '@graphql-mesh/utils';
|
|
4
|
+
import { getInContextSDK, getResolverForPubSubOperation, resolveAdditionalResolversWithoutImport, isDisposable, iterateAsync, dispose, makeAsyncDisposable } from '@graphql-mesh/utils';
|
|
5
5
|
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
6
6
|
import { getDirectiveExtensions, mapSchema, MapperKind, astFromField, asArray, getDocumentNodeFromSchema, memoize1, isDocumentNode, printSchemaWithDirectives, mergeDeep, isAsyncIterable, createGraphQLError } from '@graphql-tools/utils';
|
|
7
7
|
import { handleMaybePromise, isPromise, mapAsyncIterator } from '@whatwg-node/promise-helpers';
|
|
8
|
-
import { isInterfaceType, Kind, isObjectType, typeFromAST, isOutputType, GraphQLSchema, GraphQLDirective, parseType, visit, GraphQLString, DirectiveLocation, isEnumType, isSchema, buildSchema, buildASTSchema
|
|
8
|
+
import { isInterfaceType, Kind, isObjectType, typeFromAST, isOutputType, GraphQLSchema, GraphQLDirective, parseType, visit, GraphQLString, DirectiveLocation, isEnumType, isSchema, buildSchema, buildASTSchema } from 'graphql';
|
|
9
9
|
import { defaultMergedResolver } from '@graphql-tools/delegate';
|
|
10
10
|
import { getStitchedSchemaFromSupergraphSdl } from '@graphql-tools/federation';
|
|
11
11
|
import { mergeTypeDefs } from '@graphql-tools/merge';
|
|
@@ -1727,7 +1727,7 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1727
1727
|
function handleExecutor(executor) {
|
|
1728
1728
|
opts?.transportContext?.log.debug(
|
|
1729
1729
|
"Executing request on unified graph",
|
|
1730
|
-
() =>
|
|
1730
|
+
() => defaultPrintFn(execReq.document)
|
|
1731
1731
|
);
|
|
1732
1732
|
return executor({
|
|
1733
1733
|
...execReq,
|
|
@@ -1743,7 +1743,7 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1743
1743
|
(unifiedGraph) => {
|
|
1744
1744
|
opts?.transportContext?.log.debug(
|
|
1745
1745
|
"Executing request on unified graph",
|
|
1746
|
-
() =>
|
|
1746
|
+
() => defaultPrintFn(execReq.document)
|
|
1747
1747
|
);
|
|
1748
1748
|
executor = createDefaultExecutor(unifiedGraph);
|
|
1749
1749
|
return handleExecutor(executor);
|
|
@@ -1756,32 +1756,45 @@ function getExecutorForUnifiedGraph(opts) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
);
|
|
1758
1758
|
};
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
return
|
|
1764
|
-
opts?.transportContext?.log.debug("Disposing unified graph executor");
|
|
1765
|
-
return unifiedGraphManager[DisposableSymbols.asyncDispose]();
|
|
1766
|
-
};
|
|
1759
|
+
return makeAsyncDisposable(
|
|
1760
|
+
unifiedGraphExecutor,
|
|
1761
|
+
function unifiedGraphExecutorDispose() {
|
|
1762
|
+
opts?.transportContext?.log.debug("Disposing unified graph executor");
|
|
1763
|
+
return unifiedGraphManager[DisposableSymbols.asyncDispose]();
|
|
1767
1764
|
}
|
|
1768
|
-
|
|
1769
|
-
return unifiedGraphExecutor;
|
|
1765
|
+
);
|
|
1770
1766
|
}
|
|
1767
|
+
const identity = (x) => x;
|
|
1771
1768
|
function getSdkRequesterForUnifiedGraph(opts) {
|
|
1772
1769
|
const unifiedGraphExecutor = getExecutorForUnifiedGraph(opts);
|
|
1770
|
+
const onExecutionRequest = opts.onExecutionRequest || identity;
|
|
1773
1771
|
return function sdkRequester(document, variables, operationContext) {
|
|
1772
|
+
let executionRequest = {
|
|
1773
|
+
document,
|
|
1774
|
+
variables,
|
|
1775
|
+
context: operationContext
|
|
1776
|
+
};
|
|
1774
1777
|
return handleMaybePromise(
|
|
1775
|
-
() =>
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}),
|
|
1780
|
-
(result) => {
|
|
1781
|
-
if (isAsyncIterable(result)) {
|
|
1782
|
-
return mapAsyncIterator(result, extractDataOrThrowErrors);
|
|
1778
|
+
() => onExecutionRequest(executionRequest),
|
|
1779
|
+
(onExecutionRequestResult) => {
|
|
1780
|
+
if (onExecutionRequestResult != null) {
|
|
1781
|
+
executionRequest = onExecutionRequestResult;
|
|
1783
1782
|
}
|
|
1784
|
-
|
|
1783
|
+
const executor = executionRequest.context != null ? getBatchingExecutor(
|
|
1784
|
+
executionRequest.context,
|
|
1785
|
+
unifiedGraphExecutor,
|
|
1786
|
+
opts?.dataLoaderOptions,
|
|
1787
|
+
opts?.extensionsReducer
|
|
1788
|
+
) : unifiedGraphExecutor;
|
|
1789
|
+
return handleMaybePromise(
|
|
1790
|
+
() => executor(executionRequest),
|
|
1791
|
+
(result) => {
|
|
1792
|
+
if (isAsyncIterable(result)) {
|
|
1793
|
+
return mapAsyncIterator(result, extractDataOrThrowErrors);
|
|
1794
|
+
}
|
|
1795
|
+
return extractDataOrThrowErrors(result);
|
|
1796
|
+
}
|
|
1797
|
+
);
|
|
1785
1798
|
}
|
|
1786
1799
|
);
|
|
1787
1800
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/fusion-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Runtime for GraphQL Mesh Fusion Supergraph",
|
|
6
6
|
"repository": {
|
|
@@ -50,22 +50,22 @@
|
|
|
50
50
|
"@graphql-mesh/transport-common": "^1.0.15",
|
|
51
51
|
"@graphql-mesh/types": "^0.104.16",
|
|
52
52
|
"@graphql-mesh/utils": "^0.104.16",
|
|
53
|
-
"@graphql-tools/batch-execute": "
|
|
54
|
-
"@graphql-tools/delegate": "
|
|
53
|
+
"@graphql-tools/batch-execute": "10.0.6-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
54
|
+
"@graphql-tools/delegate": "12.0.10-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
55
55
|
"@graphql-tools/executor": "^1.4.13",
|
|
56
|
-
"@graphql-tools/federation": "
|
|
56
|
+
"@graphql-tools/federation": "4.2.14-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
57
57
|
"@graphql-tools/merge": "^9.1.5",
|
|
58
|
-
"@graphql-tools/stitch": "
|
|
59
|
-
"@graphql-tools/stitching-directives": "
|
|
58
|
+
"@graphql-tools/stitch": "10.1.14-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
59
|
+
"@graphql-tools/stitching-directives": "4.0.16-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
60
60
|
"@graphql-tools/utils": "^11.0.0",
|
|
61
|
-
"@graphql-tools/wrap": "
|
|
61
|
+
"@graphql-tools/wrap": "11.1.10-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
62
62
|
"@whatwg-node/disposablestack": "^0.0.6",
|
|
63
63
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
64
64
|
"graphql-yoga": "^5.16.2",
|
|
65
65
|
"tslib": "^2.8.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@graphql-hive/router-runtime": "
|
|
68
|
+
"@graphql-hive/router-runtime": "1.1.16-alpha-4e9b1cb7a0b759840f7f11f208e2cbd12b552dbf",
|
|
69
69
|
"change-case": "^5.4.4",
|
|
70
70
|
"graphql": "^16.12.0",
|
|
71
71
|
"pkgroll": "2.27.0"
|