@graphql-mesh/fusion-execution
Version:
Runtime for Fusion Supergraph
144 lines (143 loc) • 5.07 kB
text/typescript
import { DocumentNode, GraphQLError, GraphQLSchema } from 'graphql';
import { Repeater } from '@repeaterjs/repeater';
import { ExecutableResolverOperationNode, OnExecuteFn } from './execution.cjs';
import { ResolverOperationNode } from './query-planning.cjs';
import { SerializedResolverOperationNode } from './serialization.cjs';
export declare function planOperation(fusiongraph: GraphQLSchema, document: DocumentNode, operationName?: string): {
resolverOperationNodes: ResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ResolverOperationNode[]>;
defaultVariables: Record<string, any>;
};
export interface ExecutableOperationPlan {
resolverOperationNodes: ExecutableResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ExecutableResolverOperationNode[]>;
defaultVariables: Record<string, any>;
}
export interface NonExecutableOperationPlan {
resolverOperationNodes: ResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ResolverOperationNode[]>;
defaultVariables: Record<string, any>;
}
export interface SerializableOperationPlan {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: Map<string, SerializedResolverOperationNode[]>;
defaultVariables: Record<string, any>;
}
export declare function executeOperation({ fusiongraph, onExecute, document, operationName, variables, context, }: {
fusiongraph: GraphQLSchema;
onExecute: OnExecuteFn;
document: DocumentNode;
operationName?: string;
variables?: Record<string, any>;
context?: any;
}): {
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
} | Promise<{
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
}> | AsyncIterableIterator<{
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
}>;
export declare function executeOperationWithPatches({ fusiongraph, onExecute, document, operationName, variables, context, }: {
fusiongraph: GraphQLSchema;
onExecute: OnExecuteFn;
document: DocumentNode;
operationName?: string;
variables?: Record<string, any>;
context?: any;
}): Repeater<unknown, void, unknown>;
export declare function createExecutablePlanForOperation({ fusiongraph, document, operationName, }: {
fusiongraph: GraphQLSchema;
document: DocumentNode;
operationName?: string;
}): ExecutableOperationPlan;
export declare function executeOperationPlanWithPatches(params: Parameters<typeof executeOperationPlan>[0]): Repeater<unknown, void, unknown>;
export declare function executeOperationPlan({ executablePlan, onExecute, variables, context, }: {
executablePlan: ExecutableOperationPlan;
onExecute: OnExecuteFn;
variables?: Record<string, any>;
context: any;
}): {
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
} | Promise<{
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
}> | AsyncIterableIterator<{
data: any;
errors: GraphQLError[];
extensions: {
executionPlan: {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};
outputVariables: {
[k: string]: any;
};
};
}>;
export declare function serializeExecutableOperationPlan(executablePlan: ExecutableOperationPlan): {
resolverOperationNodes: SerializedResolverOperationNode[];
resolverDependencyFieldMap: {
[k: string]: SerializedResolverOperationNode[];
};
};