@graphql-mesh/fusion-execution
Version:
Runtime for Fusion Supergraph
62 lines (61 loc) • 3.03 kB
TypeScript
import { DocumentNode, GraphQLError } from 'graphql';
import { Executor } from '@graphql-tools/utils';
import { ResolverOperationNode } from './query-planning.js';
export type OnExecuteFn = (subgraphName: string, document: DocumentNode, variables: Record<string, any>, context: any) => ReturnType<Executor>;
export interface ExecutableResolverOperationNode extends ResolverOperationNode {
id: number;
providedVariablePathMap: Map<string, string[]>;
requiredVariableNames: Set<string>;
exportPath: string[];
resolverDependencyFieldMap: Map<string, ExecutableResolverOperationNode[]>;
batchedResolverDependencyFieldMap: Map<string, ExecutableResolverOperationNode[]>;
resolverDependencies: ExecutableResolverOperationNode[];
batchedResolverDependencies: ExecutableResolverOperationNode[];
resolverPreDependencies: ExecutableResolverOperationNode[];
batchedPreResolverDependencies: ExecutableResolverOperationNode[];
}
export declare function createExecutableResolverOperationNode(resolverOperationNode: ResolverOperationNode, currentId: number): ExecutableResolverOperationNode;
export declare function createExecutableResolverOperationNodesWithDependencyMap(resolverOperationNodes: ResolverOperationNode[], resolverDependencyFieldMap: Map<string, ResolverOperationNode[]>, currentId: number): {
resolverOperationNodes: ExecutableResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ExecutableResolverOperationNode[]>;
};
export declare function createResolverOperationNodeFromExecutable(executableNode: ExecutableResolverOperationNode, currentId: number): ResolverOperationNode;
export declare function executeResolverOperationNodesWithDependenciesInParallel({ resolverOperationNodes, fieldDependencyMap, inputVariableMap, onExecute, obj, context, path, errors, }: {
context: any;
resolverOperationNodes: ExecutableResolverOperationNode[];
fieldDependencyMap: Map<string, ExecutableResolverOperationNode[]>;
inputVariableMap: Map<string, any>;
onExecute: OnExecuteFn;
path: string[];
errors: GraphQLError[];
obj?: any;
}): {
exported: any;
outputVariableMap: Map<any, any>;
} | Promise<{
exported: any;
outputVariableMap: Map<any, any>;
}> | AsyncIterableIterator<{
exported: any;
outputVariableMap: Map<any, any>;
}>;
export declare function executeResolverOperationNode({ resolverOperationNode, inputVariableMap, onExecute, context, path, errors, }: {
resolverOperationNode: ExecutableResolverOperationNode;
inputVariableMap: Map<string, any>;
onExecute: OnExecuteFn;
context: any;
path: string[];
errors: GraphQLError[];
}): AsyncIterableIterator<unknown> | {
exported: any;
outputVariableMap: Map<any, any>;
} | PromiseLike<AsyncIterableIterator<{
exported: any;
outputVariableMap: Map<any, any>;
}> | {
exported: any;
outputVariableMap: Map<any, any>;
}> | Promise<AsyncIterableIterator<unknown> | {
exported: any;
outputVariableMap: Map<any, any>;
}>;