@apollo/query-graphs
Advanced tools
Comparing version 2.5.4 to 2.5.5
@@ -9,2 +9,3 @@ export * from './querygraph'; | ||
export * from './conditionsValidation'; | ||
export * from './mermaid'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,2 +25,3 @@ "use strict"; | ||
__exportStar(require("./conditionsValidation"), exports); | ||
__exportStar(require("./mermaid"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,3 @@ import { MultiMap, NamedType, Schema, SchemaRootKind, SelectionSet, MapWithCachedArrays, Supergraph } from '@apollo/federation-internals'; | ||
hasReachableCrossSubgraphEdges: boolean; | ||
provideId: number | undefined; | ||
constructor(index: number, type: NamedType, source: string); | ||
@@ -13,0 +14,0 @@ toString(): string; |
@@ -26,3 +26,4 @@ "use strict"; | ||
toString() { | ||
return `${this.type}(${this.source})`; | ||
const label = `${this.type}(${this.source})`; | ||
return this.provideId ? `${label}-${this.provideId}` : label; | ||
} | ||
@@ -302,2 +303,3 @@ } | ||
} | ||
let provideId = 0; | ||
for (const [i, subgraph] of subgraphs.entries()) { | ||
@@ -314,2 +316,3 @@ const subgraphSchema = schemas[i]; | ||
for (const providesApplication of field.appliedDirectivesOf(providesDirective)) { | ||
++provideId; | ||
const fieldType = (0, federation_internals_1.baseType)(field.type); | ||
@@ -321,5 +324,5 @@ (0, federation_internals_1.assert)((0, federation_internals_1.isCompositeType)(fieldType), () => `Invalid @provide on field "${field}" whose type "${fieldType}" is not a composite type`); | ||
const copiedEdge = builder.edge(head, e.index); | ||
const copiedTail = builder.makeCopy(tail); | ||
const copiedTail = builder.makeCopy(tail, provideId); | ||
builder.updateEdgeTail(copiedEdge, copiedTail); | ||
addProvidesEdges(subgraphSchema, builder, copiedTail, provided); | ||
addProvidesEdges(subgraphSchema, builder, copiedTail, provided, provideId); | ||
} | ||
@@ -349,3 +352,3 @@ } | ||
} | ||
function addProvidesEdges(schema, builder, from, provided) { | ||
function addProvidesEdges(schema, builder, from, provided, provideId) { | ||
const stack = [[from, provided]]; | ||
@@ -362,3 +365,3 @@ const source = from.source; | ||
if (selection.selectionSet) { | ||
const copiedTail = builder.makeCopy(existingEdge.tail); | ||
const copiedTail = builder.makeCopy(existingEdge.tail, provideId); | ||
builder.updateEdgeTail(existingEdge, copiedTail); | ||
@@ -373,3 +376,3 @@ stack.push([copiedTail, selection.selectionSet]); | ||
if (selection.selectionSet) { | ||
const copiedTail = existingTail ? builder.makeCopy(existingTail) : newTail; | ||
const copiedTail = existingTail ? builder.makeCopy(existingTail, provideId) : newTail; | ||
builder.addEdge(v, copiedTail, new transition_1.FieldCollection(fieldDef, true)); | ||
@@ -388,3 +391,3 @@ stack.push([copiedTail, selection.selectionSet]); | ||
(0, federation_internals_1.assert)(existingEdge, () => `Shouldn't have ${selection} with no corresponding edge on ${v} (edges are: [${builder.edges(v)}])`); | ||
const copiedTail = builder.makeCopy(existingEdge.tail); | ||
const copiedTail = builder.makeCopy(existingEdge.tail, provideId); | ||
builder.updateEdgeTail(existingEdge, copiedTail); | ||
@@ -502,4 +505,5 @@ stack.push([copiedTail, selection.selectionSet]); | ||
} | ||
makeCopy(vertex) { | ||
makeCopy(vertex, provideId) { | ||
const newVertex = this.createNewVertex(vertex.type, vertex.source, this.sources.get(vertex.source)); | ||
newVertex.provideId = provideId; | ||
newVertex.hasReachableCrossSubgraphEdges = vertex.hasReachableCrossSubgraphEdges; | ||
@@ -536,4 +540,3 @@ for (const edge of this.outEdges[vertex.index]) { | ||
this.supergraph = supergraph; | ||
this.isFederatedSubgraph = (0, federation_internals_1.isFederationSubgraphSchema)(schema); | ||
(0, federation_internals_1.assert)(!this.isFederatedSubgraph || supergraph, `Missing supergraph schema for building the federated subgraph graph`); | ||
this.isFederatedSubgraph = !!supergraph && (0, federation_internals_1.isFederationSubgraphSchema)(schema); | ||
} | ||
@@ -540,0 +543,0 @@ hasDirective(elt, directiveFct) { |
{ | ||
"name": "@apollo/query-graphs", | ||
"version": "2.5.4", | ||
"version": "2.5.5", | ||
"description": "Apollo Federation library to work with 'query graphs'", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@apollo/federation-internals": "2.5.4", | ||
"@apollo/federation-internals": "2.5.5", | ||
"deep-equal": "^2.0.5", | ||
@@ -29,0 +29,0 @@ "ts-graphviz": "^1.5.4", |
@@ -9,1 +9,2 @@ export * from './querygraph'; | ||
export * from './conditionsValidation'; | ||
export * from './mermaid'; |
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 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
577928
57
8390
+ Added@apollo/federation-internals@2.5.5(transitive)
- Removed@apollo/federation-internals@2.5.4(transitive)