@apollo/query-graphs
Advanced tools
Comparing version 2.4.8 to 2.4.9
@@ -9,6 +9,6 @@ "use strict"; | ||
const cache = new querygraph_1.QueryGraphState(graph); | ||
return (edge, context, excludedEdges, excludedConditions) => { | ||
return (edge, context, excludedDestinations, excludedConditions) => { | ||
(0, federation_internals_1.assert)(edge.conditions, 'Should not have been called for edge without conditions'); | ||
if (!context.isEmpty() || excludedConditions.length > 0) { | ||
return resolver(edge, context, excludedEdges, excludedConditions); | ||
return resolver(edge, context, excludedDestinations, excludedConditions); | ||
} | ||
@@ -18,9 +18,9 @@ const cachedResolutionAndExcludedEdges = cache.getEdgeState(edge); | ||
const [cachedResolution, forExcludedEdges] = cachedResolutionAndExcludedEdges; | ||
return (0, graphPath_1.sameExcludedEdges)(forExcludedEdges, excludedEdges) | ||
return (0, graphPath_1.sameExcludedDestinations)(forExcludedEdges, excludedDestinations) | ||
? cachedResolution | ||
: resolver(edge, context, excludedEdges, excludedConditions); | ||
: resolver(edge, context, excludedDestinations, excludedConditions); | ||
} | ||
else { | ||
const resolution = resolver(edge, context, excludedEdges, excludedConditions); | ||
cache.setEdgeState(edge, [resolution, excludedEdges]); | ||
const resolution = resolver(edge, context, excludedDestinations, excludedConditions); | ||
cache.setEdgeState(edge, [resolution, excludedDestinations]); | ||
return resolution; | ||
@@ -27,0 +27,0 @@ } |
@@ -67,3 +67,3 @@ import { NamedType, OperationElement, Schema, SchemaRootKind, SelectionSet, ObjectType, DeferDirectiveArgs } from "@apollo/federation-internals"; | ||
export declare function traversePath(path: GraphPath<any>, onEdges: (edge: Edge) => void): void; | ||
export type ConditionResolver = (edge: Edge, context: PathContext, excludedEdges: ExcludedEdges, excludedConditions: ExcludedConditions) => ConditionResolution; | ||
export type ConditionResolver = (edge: Edge, context: PathContext, excludedDestinations: ExcludedDestinations, excludedConditions: ExcludedConditions) => ConditionResolution; | ||
export type ConditionResolution = { | ||
@@ -111,4 +111,4 @@ satisfied: boolean; | ||
export declare function advancePathWithTransition<V extends Vertex>(subgraphPath: TransitionPathWithLazyIndirectPaths<V>, transition: Transition, targetType: NamedType): TransitionPathWithLazyIndirectPaths<V>[] | Unadvanceables; | ||
export type ExcludedEdges = readonly [number, number][]; | ||
export declare function sameExcludedEdges(ex1: ExcludedEdges, ex2: ExcludedEdges): boolean; | ||
export type ExcludedDestinations = readonly string[]; | ||
export declare function sameExcludedDestinations(ex1: ExcludedDestinations, ex2: ExcludedDestinations): boolean; | ||
export type ExcludedConditions = readonly SelectionSet[]; | ||
@@ -127,6 +127,6 @@ export declare function addConditionExclusion(excluded: ExcludedConditions, newExclusion: SelectionSet | undefined): ExcludedConditions; | ||
readonly conditionResolver: ConditionResolver; | ||
readonly excludedNonCollectingEdges: ExcludedEdges; | ||
readonly excludedNonCollectingEdges: ExcludedDestinations; | ||
readonly excludedConditionsOnNonCollectingEdges: ExcludedConditions; | ||
private lazilyComputedIndirectPaths; | ||
constructor(paths: SimultaneousPaths<V>, context: PathContext, conditionResolver: ConditionResolver, excludedNonCollectingEdges?: ExcludedEdges, excludedConditionsOnNonCollectingEdges?: ExcludedConditions); | ||
constructor(paths: SimultaneousPaths<V>, context: PathContext, conditionResolver: ConditionResolver, excludedNonCollectingEdges?: ExcludedDestinations, excludedConditionsOnNonCollectingEdges?: ExcludedConditions); | ||
indirectOptions(updatedContext: PathContext, pathIdx: number): OpIndirectPaths<V>; | ||
@@ -139,4 +139,4 @@ private computeIndirectPaths; | ||
export declare function advanceSimultaneousPathsWithOperation<V extends Vertex>(supergraphSchema: Schema, subgraphSimultaneousPaths: SimultaneousPathsWithLazyIndirectPaths<V>, operation: OperationElement): SimultaneousPathsWithLazyIndirectPaths<V>[] | undefined; | ||
export declare function createInitialOptions<V extends Vertex>(initialPath: OpGraphPath<V>, initialContext: PathContext, conditionResolver: ConditionResolver, excludedEdges: ExcludedEdges, excludedConditions: ExcludedConditions): SimultaneousPathsWithLazyIndirectPaths<V>[]; | ||
export declare function createInitialOptions<V extends Vertex>(initialPath: OpGraphPath<V>, initialContext: PathContext, conditionResolver: ConditionResolver, excludedEdges: ExcludedDestinations, excludedConditions: ExcludedConditions): SimultaneousPathsWithLazyIndirectPaths<V>[]; | ||
export {}; | ||
//# sourceMappingURL=graphPath.d.ts.map |
@@ -8,2 +8,3 @@ export * from './querygraph'; | ||
export * from './conditionsCaching'; | ||
export * from './conditionsValidation'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -24,2 +24,3 @@ "use strict"; | ||
__exportStar(require("./conditionsCaching"), exports); | ||
__exportStar(require("./conditionsValidation"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@apollo/query-graphs", | ||
"version": "2.4.8", | ||
"version": "2.4.9", | ||
"description": "Apollo Federation library to work with 'query graphs'", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@apollo/federation-internals": "2.4.8", | ||
"@apollo/federation-internals": "2.4.9", | ||
"deep-equal": "^2.0.5", | ||
@@ -29,0 +29,0 @@ "ts-graphviz": "^1.5.4", |
import { assert } from "@apollo/federation-internals"; | ||
import { ConditionResolution, ConditionResolver, ExcludedConditions, ExcludedEdges, sameExcludedEdges } from "./graphPath"; | ||
import { ConditionResolution, ConditionResolver, ExcludedConditions, ExcludedDestinations, sameExcludedDestinations } from "./graphPath"; | ||
import { PathContext } from "./pathContext"; | ||
@@ -16,4 +16,4 @@ import { Edge, QueryGraph, QueryGraphState } from "./querygraph"; | ||
// the excluded edges we see on the first ever call is actually the proper thing to do. | ||
const cache = new QueryGraphState<undefined, [ConditionResolution, ExcludedEdges]>(graph); | ||
return (edge: Edge, context: PathContext, excludedEdges: ExcludedEdges, excludedConditions: ExcludedConditions) => { | ||
const cache = new QueryGraphState<undefined, [ConditionResolution, ExcludedDestinations]>(graph); | ||
return (edge: Edge, context: PathContext, excludedDestinations: ExcludedDestinations, excludedConditions: ExcludedConditions) => { | ||
assert(edge.conditions, 'Should not have been called for edge without conditions'); | ||
@@ -30,3 +30,3 @@ | ||
if (!context.isEmpty() || excludedConditions.length > 0) { | ||
return resolver(edge, context, excludedEdges, excludedConditions); | ||
return resolver(edge, context, excludedDestinations, excludedConditions); | ||
} | ||
@@ -37,8 +37,8 @@ | ||
const [cachedResolution, forExcludedEdges] = cachedResolutionAndExcludedEdges; | ||
return sameExcludedEdges(forExcludedEdges, excludedEdges) | ||
return sameExcludedDestinations(forExcludedEdges, excludedDestinations) | ||
? cachedResolution | ||
: resolver(edge, context, excludedEdges, excludedConditions); | ||
: resolver(edge, context, excludedDestinations, excludedConditions); | ||
} else { | ||
const resolution = resolver(edge, context, excludedEdges, excludedConditions); | ||
cache.setEdgeState(edge, [resolution, excludedEdges]); | ||
const resolution = resolver(edge, context, excludedDestinations, excludedConditions); | ||
cache.setEdgeState(edge, [resolution, excludedDestinations]); | ||
return resolution; | ||
@@ -45,0 +45,0 @@ } |
@@ -8,1 +8,2 @@ export * from './querygraph'; | ||
export * from './conditionsCaching'; | ||
export * from './conditionsValidation'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
560026
52
8112
+ Added@apollo/federation-internals@2.4.9(transitive)
- Removed@apollo/federation-internals@2.4.8(transitive)