import { NamedType, OperationElement, Schema, SchemaRootKind, SelectionSet, ObjectType, DeferDirectiveArgs, Type } from "@apollo/federation-internals"; import { OpPathTree } from "./pathTree"; import { Vertex, QueryGraph, Edge, RootVertex } from "./querygraph"; import { Transition } from "./transition"; import { PathContext } from "./pathContext"; export type ContextAtUsageEntry = { contextId: string; relativePath: string[]; selectionSet: SelectionSet; subgraphArgType: Type; }; export declare class GraphPath implements Iterable<[Edge | TNullEdge, TTrigger, OpPathTree | null, Set | null, Map | null]> { private readonly props; private constructor(); get graph(): QueryGraph; get root(): RV; get tail(): Vertex; get deferOnTail(): DeferDirectiveArgs | undefined; get subgraphEnteringEdge(): { index: number; edge: Edge; cost: number; } | undefined; static create(graph: QueryGraph, root: RV): GraphPath; static fromGraphRoot(graph: QueryGraph, rootKind: SchemaRootKind): RootPath | undefined; get size(): number; countSubgraphJumpsAfterLastCommonVertex(that: GraphPath): { thisJumps: number; thatJumps: number; }; private findLastCommonVertex; private subgraphJumpsAtIdx; subgraphJumps(): number; isEquivalentSaveForTypeExplosionTo(that: GraphPath): boolean; [Symbol.iterator](): PathIterator; lastEdge(): Edge | TNullEdge | undefined; lastTrigger(): TTrigger | undefined; tailPossibleRuntimeTypes(): readonly ObjectType[]; lastIsIntefaceObjectFakeDownCastAfterEnteringSubgraph(): boolean; private lastIsInterfaceObjectFakeDownCast; add(trigger: TTrigger, edge: Edge | TNullEdge, conditionsResolution: ConditionResolution, defer?: DeferDirectiveArgs): GraphPath; private mergeEdgeConditionsWithResolution; concat(tailPath: GraphPath): GraphPath; checkDirectPathFromPreviousSubgraphTo(typeName: string, triggerToEdge: (graph: QueryGraph, vertex: Vertex, t: TTrigger, overrideConditions: Map) => Edge | null | undefined, overrideConditions: Map, prevSubgraphStartingVertex?: Vertex): Vertex | undefined; nextEdges(): readonly Edge[]; isTerminal(): boolean; isRootPath(): this is RootPath; mapMainPath(mapper: (e: Edge | TNullEdge, pathIdx: number) => T): T[]; private edgeAt; reduceMainPath(reducer: (accumulator: T, edge: Edge | TNullEdge, pathIdx: number) => T, initialValue: T): T; hasJustCycled(): boolean; hasAnyEdgeConditions(): boolean; isOnTopLevelQueryRoot(): boolean; truncateTrailingDowncasts(): GraphPath; markOverridding(otherOptions: GraphPath[][]): { thisPath: GraphPath; otherOptions: GraphPath[][]; }; isOverriddenBy(otherPath: GraphPath): boolean; tailIsInterfaceObject(): boolean; toString(): string; } export interface PathIterator extends Iterator<[Edge | TNullEdge, TTrigger, OpPathTree | null, Set | null, Map | null]> { currentIndex: number; currentVertex: Vertex; } export type RootPath = GraphPath; export type OpTrigger = OperationElement | PathContext; export type OpGraphPath = GraphPath; export type OpRootPath = OpGraphPath; export declare function isRootPath(path: OpGraphPath): path is OpRootPath; export declare function terminateWithNonRequestedTypenameField(path: OpGraphPath, overrideConditions: Map): OpGraphPath; export declare function traversePath(path: GraphPath, onEdges: (edge: Edge) => void): void; export type ConditionResolver = (edge: Edge, context: PathContext, excludedDestinations: ExcludedDestinations, excludedConditions: ExcludedConditions, extraConditions?: SelectionSet) => ConditionResolution; type ContextMapEntry = { levelsInDataPath: number; levelsInQueryPath: number; pathTree?: OpPathTree; selectionSet: SelectionSet; inboundEdge: Edge; paramName: string; argType: Type; id: string; }; export type ConditionResolution = { satisfied: boolean; cost: number; pathTree?: OpPathTree; contextMap?: Map; unsatisfiedConditionReason?: UnsatisfiedConditionReason; }; export declare enum UnsatisfiedConditionReason { NO_POST_REQUIRE_KEY = 0, NO_CONTEXT_SET = 1 } export declare const noConditionsResolution: ConditionResolution; export declare const unsatisfiedConditionsResolution: ConditionResolution; export declare enum UnadvanceableReason { UNSATISFIABLE_KEY_CONDITION = 0, UNSATISFIABLE_REQUIRES_CONDITION = 1, UNRESOLVABLE_INTERFACE_OBJECT = 2, NO_MATCHING_TRANSITION = 3, UNREACHABLE_TYPE = 4, IGNORED_INDIRECT_PATH = 5, UNSATISFIABLE_OVERRIDE_CONDITION = 6 } export type Unadvanceable = { sourceSubgraph: string; destSubgraph: string; reason: UnadvanceableReason; details: string; }; export declare class Unadvanceables { readonly reasons: Unadvanceable[]; constructor(reasons: Unadvanceable[]); toString(): string; } export type UnadvanceableClosure = () => Unadvanceable | Unadvanceable[]; export declare class UnadvanceableClosures { private _unadvanceables; readonly closures: UnadvanceableClosure[]; constructor(closures: UnadvanceableClosure | UnadvanceableClosure[]); toUnadvanceables(): Unadvanceables; } export declare function isUnadvanceableClosures(result: any[] | UnadvanceableClosures): result is UnadvanceableClosures; export declare class TransitionPathWithLazyIndirectPaths { readonly path: GraphPath; readonly conditionResolver: ConditionResolver; readonly overrideConditions: Map; private lazilyComputedIndirectPaths; constructor(path: GraphPath, conditionResolver: ConditionResolver, overrideConditions: Map); static initial(initialPath: GraphPath, conditionResolver: ConditionResolver, overrideConditions: Map): TransitionPathWithLazyIndirectPaths; indirectOptions(): IndirectPaths; private computeIndirectPaths; toString(): string; } export declare function advancePathWithTransition(subgraphPath: TransitionPathWithLazyIndirectPaths, transition: Transition, targetType: NamedType, overrideConditions: Map): TransitionPathWithLazyIndirectPaths[] | UnadvanceableClosures; export type ExcludedDestinations = readonly string[]; export declare function sameExcludedDestinations(ex1: ExcludedDestinations, ex2: ExcludedDestinations): boolean; export type ExcludedConditions = readonly SelectionSet[]; export declare function addConditionExclusion(excluded: ExcludedConditions, newExclusion: SelectionSet | undefined): ExcludedConditions; export type IndirectPaths = { paths: GraphPath[]; deadEnds: TDeadEnds; }; export declare function getLocallySatisfiableKey(graph: QueryGraph, typeVertex: Vertex): SelectionSet | undefined; export type SimultaneousPaths = OpGraphPath[]; type OpIndirectPaths = IndirectPaths; export declare class SimultaneousPathsWithLazyIndirectPaths { readonly paths: SimultaneousPaths; readonly context: PathContext; readonly conditionResolver: ConditionResolver; readonly excludedNonCollectingEdges: ExcludedDestinations; readonly excludedConditionsOnNonCollectingEdges: ExcludedConditions; readonly overrideConditions: Map; private lazilyComputedIndirectPaths; constructor(paths: SimultaneousPaths, context: PathContext, conditionResolver: ConditionResolver, excludedNonCollectingEdges: ExcludedDestinations, excludedConditionsOnNonCollectingEdges: ExcludedConditions, overrideConditions: Map); indirectOptions(updatedContext: PathContext, pathIdx: number): OpIndirectPaths; private computeIndirectPaths; toString(): string; } export declare function simultaneousPathsToString(simultaneousPaths: SimultaneousPaths | SimultaneousPathsWithLazyIndirectPaths, indentOnNewLine?: string): string; export declare function advanceOptionsToString(options: (SimultaneousPaths | SimultaneousPathsWithLazyIndirectPaths | GraphPath)[] | undefined): string; export declare function advanceSimultaneousPathsWithOperation(supergraphSchema: Schema, subgraphSimultaneousPaths: SimultaneousPathsWithLazyIndirectPaths, operation: OperationElement, overrideConditions: Map): SimultaneousPathsWithLazyIndirectPaths[] | undefined; export declare function createInitialOptions(initialPath: OpGraphPath, initialContext: PathContext, conditionResolver: ConditionResolver, excludedEdges: ExcludedDestinations, excludedConditions: ExcludedConditions, overrideConditions: Map, initialSubgraphConstraint: string | null): SimultaneousPathsWithLazyIndirectPaths[]; export {}; //# sourceMappingURL=graphPath.d.ts.map