Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/query-graphs

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/query-graphs - npm Package Compare versions

Comparing version 2.1.0-alpha.4 to 2.1.0

15

CHANGELOG.md
# CHANGELOG for `@apollo/query-graphs`
## 2.1.0-alpha.4
## vNext
## 2.1.0
- Fix abnormally high memory usage when extracting subgraphs for some fed1 supergraphs (and small other memory footprint improvements) [PR #2089](https://github.com/apollographql/federation/pull/2089).
- Fix issue when type is only reachable through a @provides [PR #2083](https://github.com/apollographql/federation/pull/2083).
- Update peer dependency `graphql` to `^16.5.0` to use `GraphQLErrorOptions` [PR #2060](https://github.com/apollographql/federation/pull/2060)
## 2.1.0-alpha.3
- Add `@defer` support [PR #1958](https://github.com/apollographql/federation/pull/1958)
## 2.1.0-alpha.1
- Fix issue generating plan for a "diamond-shaped" dependency [PR #1900](https://github.com/apollographql/federation/pull/1900)
- Avoid type-explosion with fed1 supergraphs using a fed2 query planner [PR #1994](https://github.com/apollographql/federation/pull/1994).
## 2.1.0-alpha.0
- Expand support for Node.js v18 [PR #1884](https://github.com/apollographql/federation/pull/1884)

@@ -19,0 +14,0 @@

@@ -37,3 +37,3 @@ import { MultiMap, NamedType, Schema, SchemaRootKind, SelectionSet, MapWithCachedArrays } from '@apollo/federation-internals';

readonly name: string;
private readonly vertices;
readonly vertices: Vertex[];
private readonly adjacencies;

@@ -40,0 +40,0 @@ private readonly typesToVertices;

@@ -337,3 +337,3 @@ "use strict";

const existingEdge = builder.edges(v).find(e => e.transition.kind === 'DownCast' && e.transition.castedType.name === typeCondition.name);
(0, federation_internals_1.assert)(existingEdge, () => `Shouldn't have ${selection} with no corresponding edge on ${v}`);
(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);

@@ -404,10 +404,9 @@ builder.updateEdgeTail(existingEdge, copiedTail);

const offset = this.nextIndex;
simpleTraversal(graph, v => {
this.getOrCopyVertex(v, offset, graph);
}, e => {
const newHead = this.getOrCopyVertex(e.head, offset, graph);
const newTail = this.getOrCopyVertex(e.tail, offset, graph);
this.addEdge(newHead, newTail, e.transition, e.conditions);
return true;
});
for (const vertex of graph.vertices) {
const newHead = this.getOrCopyVertex(vertex, offset, graph);
for (const edge of graph.outEdges(vertex, true)) {
const newTail = this.getOrCopyVertex(edge.tail, offset, graph);
this.addEdge(newHead, newTail, edge.transition, edge.conditions);
}
}
this.nextIndex += graph.verticesCount();

@@ -497,6 +496,11 @@ const that = this;

for (const field of type.allFields()) {
if (field.isSchemaIntrospectionField() || this.hasDirective(field, (m) => m.externalDirective())) {
if (field.isSchemaIntrospectionField()) {
continue;
}
this.addEdgeForField(field, head);
if (this.hasDirective(field, (m) => m.externalDirective())) {
this.addTypeRecursively(field.type);
}
else {
this.addEdgeForField(field, head);
}
}

@@ -503,0 +507,0 @@ }

{
"name": "@apollo/query-graphs",
"version": "2.1.0-alpha.4",
"version": "2.1.0",
"description": "Apollo Federation library to work with 'query graphs'",

@@ -26,3 +26,3 @@ "main": "dist/index.js",

"dependencies": {
"@apollo/federation-internals": "^2.1.0-alpha.4",
"@apollo/federation-internals": "^2.1.0",
"deep-equal": "^2.0.5",

@@ -37,3 +37,3 @@ "ts-graphviz": "^0.16.0"

},
"gitHead": "db61f574cc2ee95a53dac8b95a5a320f8caf6fbc"
"gitHead": "6dec2f26af031434c56bea46a75330559dac5f5b"
}

@@ -279,3 +279,3 @@ import {

/** The vertices of the query graph. The index of each vertex in the array will be the value of its `Vertex.index` value. */
private readonly vertices: Vertex[],
readonly vertices: Vertex[],
/**

@@ -778,3 +778,3 @@ * For each vertex, the edges that originate from that array. This array has the same length as `vertices` and `adjacencies[i]`

// to mark a full type as @external).
assert(existingEdge, () => `Shouldn't have ${selection} with no corresponding edge on ${v}`);
assert(existingEdge, () => `Shouldn't have ${selection} with no corresponding edge on ${v} (edges are: [${builder.edges(v)}])`);
const copiedTail = builder.makeCopy(existingEdge.tail);

@@ -863,14 +863,16 @@ builder.updateEdgeTail(existingEdge, copiedTail);

const offset = this.nextIndex;
simpleTraversal(
graph,
v => {
this.getOrCopyVertex(v, offset, graph);
},
e => {
const newHead = this.getOrCopyVertex(e.head, offset, graph);
const newTail = this.getOrCopyVertex(e.tail, offset, graph);
this.addEdge(newHead, newTail, e.transition, e.conditions);
return true; // Always traverse edges
// Note that we don't use a normal traversal to do the copying because it's possible the provided `graph`
// has some sub-parts that are not reachable from one of the roots but that we still want to copy those
// sub-parts. The reason is that, while we don't care about unreachable parts in general, at the time
// this method is called, we haven't added edges for @provides, and adding those edges may "connect" those
// currently unreachable parts. And to be connected, they need to exist/have been copied in the first
// place (note that this means we may copy some unreachable sub-parts that will _not_ be connected later (a subgraph
// can well have genuinely unreachable definitions), but that's harmless).
for (const vertex of graph.vertices) {
const newHead = this.getOrCopyVertex(vertex, offset, graph);
for (const edge of graph.outEdges(vertex, true)) {
const newTail = this.getOrCopyVertex(edge.tail, offset, graph);
this.addEdge(newHead, newTail, edge.transition, edge.conditions);
}
);
}
this.nextIndex += graph.verticesCount();

@@ -914,3 +916,3 @@ const that = this;

/**
* Replaces the provided edge by an exact copy except for the tail that is said to the provide `newTail` vertex.
* Replaces the provided edge by a copy but with the provided new tail vertex.
*

@@ -1023,7 +1025,17 @@ * @param edge - the edge to replace.

for (const field of type.allFields()) {
// Field marked @external only exists to ensure subgraphs schema are valid graphQL, but they don't really exist as far as federation goes.
if (field.isSchemaIntrospectionField() || this.hasDirective(field, (m) => m.externalDirective())) {
if (field.isSchemaIntrospectionField()) {
continue;
}
this.addEdgeForField(field, head);
// Field marked @external only exists to ensure subgraphs schema are valid graphQL, but they don't create actual edges.
// However, even if we don't add an edge, we still want to add the field type. The reason is that while we don't add
// a "general" edge for an external field, we may later add path-specific edges for the field due to a `@provides`. When
// we do so, we need the vertex corresponding to that field type to exists, and in rare cases a type could be only
// mentioned in this external field, so if we don't add the type here, we'll never do and get an issue later as we
// add @provides edges.
if (this.hasDirective(field, (m) => m.externalDirective())) {
this.addTypeRecursively(field.type!)
} else {
this.addEdgeForField(field, head);
}
}

@@ -1030,0 +1042,0 @@ }

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc