@graphql-mesh/fusion-runtime 1.9.0 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @graphql-mesh/fusion-runtime
2
2
 
3
+ ## 1.10.0
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [`0625f67`](https://github.com/graphql-hive/gateway/commit/0625f67b021ce7edf912cad02f40fa276cd5ffb2) Thanks [@ardatan](https://github.com/ardatan)! - Add Generic SDK support with `gateway.sdkRequester` property, see https://github.com/graphql-hive/gateway/tree/main/examples/typed-sdk
9
+
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`7171b46`](https://github.com/graphql-hive/gateway/commit/7171b46546a8e60776f70d18d14dd6fa19d5649f)]:
14
+ - @graphql-tools/delegate@12.0.15
15
+
3
16
  ## 1.9.0
4
17
  ### Minor Changes
5
18
 
package/dist/index.cjs CHANGED
@@ -1853,17 +1853,23 @@ function getSdkRequesterForUnifiedGraph(opts) {
1853
1853
  ) : unifiedGraphExecutor;
1854
1854
  return promiseHelpers.handleMaybePromise(
1855
1855
  () => executor(executionRequest),
1856
- (result) => {
1857
- if (utils.isAsyncIterable(result)) {
1858
- return promiseHelpers.mapAsyncIterator(result, extractDataOrThrowErrors);
1859
- }
1860
- return extractDataOrThrowErrors(result);
1861
- }
1856
+ handleMaybePromiseMaybeAsyncIterableResult
1862
1857
  );
1863
1858
  }
1864
1859
  );
1865
1860
  };
1866
1861
  }
1862
+ function handleMaybePromiseMaybeAsyncIterableResult(result) {
1863
+ return promiseHelpers.handleMaybePromise(
1864
+ () => result,
1865
+ (resolvedResult) => {
1866
+ if (utils.isAsyncIterable(resolvedResult)) {
1867
+ return promiseHelpers.mapAsyncIterator(resolvedResult, extractDataOrThrowErrors);
1868
+ }
1869
+ return extractDataOrThrowErrors(resolvedResult);
1870
+ }
1871
+ );
1872
+ }
1867
1873
  function extractDataOrThrowErrors(result) {
1868
1874
  if (result.errors) {
1869
1875
  if (result.errors.length === 1) {
@@ -1888,6 +1894,7 @@ exports.getStitchingDirectivesTransformerForSubschema = getStitchingDirectivesTr
1888
1894
  exports.getTransportEntryMapUsingFusionAndFederationDirectives = getTransportEntryMapUsingFusionAndFederationDirectives;
1889
1895
  exports.handleFederationSubschema = handleFederationSubschema;
1890
1896
  exports.handleFederationSupergraph = handleFederationSupergraph;
1897
+ exports.handleMaybePromiseMaybeAsyncIterableResult = handleMaybePromiseMaybeAsyncIterableResult;
1891
1898
  exports.handleResolveToDirectives = handleResolveToDirectives;
1892
1899
  exports.millisecondsToStr = millisecondsToStr;
1893
1900
  exports.restoreExtraDirectives = restoreExtraDirectives;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _graphql_tools_utils from '@graphql-tools/utils';
2
- import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
2
+ import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, MaybeAsyncIterable, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
3
3
  import { Logger } from '@graphql-hive/logger';
4
4
  import { TransportContext, TransportEntry, Transport } from '@graphql-mesh/transport-common';
5
5
  export { TransportEntry, TransportGetSubgraphExecutor, TransportGetSubgraphExecutorOptions } from '@graphql-mesh/transport-common';
@@ -265,12 +265,13 @@ declare function handleFederationSubschema({ subschemaConfig, unifiedGraphDirect
265
265
  };
266
266
 
267
267
  type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
268
- declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<_graphql_tools_utils.MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
268
+ declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
269
269
  interface SdkRequesterOptions extends UnifiedGraphManagerOptions<any> {
270
270
  dataLoaderOptions?: Parameters<typeof getBatchingExecutor>[2];
271
271
  extensionsReducer?: (mergedExtensions: Record<string, any>, request: ExecutionRequest) => Record<string, any>;
272
272
  onExecutionRequest?(request: ExecutionRequest): MaybePromise<ExecutionRequest>;
273
273
  }
274
274
  declare function getSdkRequesterForUnifiedGraph(opts: SdkRequesterOptions): SdkRequester;
275
+ declare function handleMaybePromiseMaybeAsyncIterableResult<T>(result: MaybePromise<MaybeAsyncIterable<ExecutionResult$1<T>>>): MaybePromise<MaybeAsyncIterable<T | null>>;
275
276
 
276
- 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 };
277
+ 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, handleMaybePromiseMaybeAsyncIterableResult, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _graphql_tools_utils from '@graphql-tools/utils';
2
- import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
2
+ import { ExecutionRequest, Executor, TypeSource, IResolvers, MaybePromise as MaybePromise$1, Maybe, MaybeAsyncIterable, ExecutionResult as ExecutionResult$1 } from '@graphql-tools/utils';
3
3
  import { Logger } from '@graphql-hive/logger';
4
4
  import { TransportContext, TransportEntry, Transport } from '@graphql-mesh/transport-common';
5
5
  export { TransportEntry, TransportGetSubgraphExecutor, TransportGetSubgraphExecutorOptions } from '@graphql-mesh/transport-common';
@@ -265,12 +265,13 @@ declare function handleFederationSubschema({ subschemaConfig, unifiedGraphDirect
265
265
  };
266
266
 
267
267
  type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
268
- declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<_graphql_tools_utils.MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
268
+ declare function getExecutorForUnifiedGraph<TContext>(opts: UnifiedGraphManagerOptions<TContext>): ((execReq: ExecutionRequest) => MaybePromise<MaybeAsyncIterable<ExecutionResult$1<any, any>>>) & AsyncDisposable;
269
269
  interface SdkRequesterOptions extends UnifiedGraphManagerOptions<any> {
270
270
  dataLoaderOptions?: Parameters<typeof getBatchingExecutor>[2];
271
271
  extensionsReducer?: (mergedExtensions: Record<string, any>, request: ExecutionRequest) => Record<string, any>;
272
272
  onExecutionRequest?(request: ExecutionRequest): MaybePromise<ExecutionRequest>;
273
273
  }
274
274
  declare function getSdkRequesterForUnifiedGraph(opts: SdkRequesterOptions): SdkRequester;
275
+ declare function handleMaybePromiseMaybeAsyncIterableResult<T>(result: MaybePromise<MaybeAsyncIterable<ExecutionResult$1<T>>>): MaybePromise<MaybeAsyncIterable<T | null>>;
275
276
 
276
- 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 };
277
+ 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, handleMaybePromiseMaybeAsyncIterableResult, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
package/dist/index.js CHANGED
@@ -1851,17 +1851,23 @@ function getSdkRequesterForUnifiedGraph(opts) {
1851
1851
  ) : unifiedGraphExecutor;
1852
1852
  return handleMaybePromise(
1853
1853
  () => executor(executionRequest),
1854
- (result) => {
1855
- if (isAsyncIterable(result)) {
1856
- return mapAsyncIterator(result, extractDataOrThrowErrors);
1857
- }
1858
- return extractDataOrThrowErrors(result);
1859
- }
1854
+ handleMaybePromiseMaybeAsyncIterableResult
1860
1855
  );
1861
1856
  }
1862
1857
  );
1863
1858
  };
1864
1859
  }
1860
+ function handleMaybePromiseMaybeAsyncIterableResult(result) {
1861
+ return handleMaybePromise(
1862
+ () => result,
1863
+ (resolvedResult) => {
1864
+ if (isAsyncIterable(resolvedResult)) {
1865
+ return mapAsyncIterator(resolvedResult, extractDataOrThrowErrors);
1866
+ }
1867
+ return extractDataOrThrowErrors(resolvedResult);
1868
+ }
1869
+ );
1870
+ }
1865
1871
  function extractDataOrThrowErrors(result) {
1866
1872
  if (result.errors) {
1867
1873
  if (result.errors.length === 1) {
@@ -1875,4 +1881,4 @@ function extractDataOrThrowErrors(result) {
1875
1881
  return result.data;
1876
1882
  }
1877
1883
 
1878
- export { UnifiedGraphManager, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
1884
+ export { UnifiedGraphManager, compareSchemas, compareSubgraphNames, ensureSchema, getExecutorForUnifiedGraph, getOnSubgraphExecute, getSdkRequesterForUnifiedGraph, getStitchingDirectivesTransformerForSubschema, getTransportEntryMapUsingFusionAndFederationDirectives, handleFederationSubschema, handleFederationSupergraph, handleMaybePromiseMaybeAsyncIterableResult, handleResolveToDirectives, millisecondsToStr, restoreExtraDirectives, wrapExecutorWithHooks, wrapMergedTypeResolver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/fusion-runtime",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "Runtime for GraphQL Mesh Fusion Supergraph",
6
6
  "repository": {
@@ -51,7 +51,7 @@
51
51
  "@graphql-mesh/types": "^0.104.27",
52
52
  "@graphql-mesh/utils": "^0.104.36",
53
53
  "@graphql-tools/batch-execute": "^10.0.8",
54
- "@graphql-tools/delegate": "^12.0.14",
54
+ "@graphql-tools/delegate": "^12.0.15",
55
55
  "@graphql-tools/executor": "^1.4.13",
56
56
  "@graphql-tools/federation": "^4.4.0",
57
57
  "@graphql-tools/merge": "^9.1.5",