@graphql-mesh/fusion-execution
Version:
Runtime for Fusion Supergraph
48 lines (47 loc) • 2.35 kB
TypeScript
import { DocumentNode, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, VariableDefinitionNode } from 'graphql';
import { FlattenedFieldNode } from './flattenSelections.js';
import { GlobalResolverConfig, RegularResolverConfig, ResolverKind, ResolverRefConfig, ResolverVariableConfig } from './types.js';
export declare function createResolveNode({ parentSubgraph, fieldNode, resolverOperationString, resolverKind, variableDirectives, resolverSelections, resolverArguments, ctx, }: {
parentSubgraph: string;
fieldNode: FlattenedFieldNode;
resolverOperationString: string;
resolverKind?: ResolverKind;
variableDirectives: ResolverVariableConfig[];
resolverSelections: FlattenedFieldNode[];
resolverArguments: FlattenedFieldNode['arguments'];
ctx: VisitorContext;
}): {
newFieldNode: FlattenedFieldNode;
resolverOperationDocument: DocumentNode;
resolvedFieldPath: (string | number)[];
variablesFromDifferentSubgraph: {
variableDirective: ResolverVariableConfig;
newVariableName: string;
}[];
batch: boolean;
defer: boolean;
};
export declare function isList(type: GraphQLOutputType): boolean;
export declare function getGlobalResolver(fusiongraph: GraphQLSchema, resolverName: string, subgraphName: string): GlobalResolverConfig | undefined;
export declare function resolveResolverOperationStringAndKind(fusiongraph: GraphQLSchema, resolverDirective: ResolverRefConfig | RegularResolverConfig): {
resolverOperationString: string;
resolverKind: ResolverKind;
};
export declare function visitFieldNodeForTypeResolvers(parentSubgraph: string, fieldNode: FlattenedFieldNode, type: GraphQLObjectType, fusiongraph: GraphQLSchema, ctx: VisitorContext): {
newFieldNode: FlattenedFieldNode;
resolverOperationNodes: ResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ResolverOperationNode[]>;
};
export interface ResolverOperationNode {
subgraph: string;
resolverOperationDocument: DocumentNode;
resolverPreDependencies: ResolverOperationNode[];
resolverDependencies: ResolverOperationNode[];
resolverDependencyFieldMap: Map<string, ResolverOperationNode[]>;
batch?: boolean;
defer?: boolean;
}
export interface VisitorContext {
currentVariableIndex: number;
rootVariableMap: Map<string, VariableDefinitionNode>;
}