This change introduces a configurable query plan cache. This option allows (#2385)
developers to provide their own query plan cache like so:
new ApolloGateway({
queryPlannerConfig: {
cache: new MyCustomQueryPlanCache(),
},
});
The current default implementation is effectively as follows:
import { InMemoryLRUCache } from "@apollo/utils.keyvaluecache";
const cache = new InMemoryLRUCache<string>({
maxSize: Math.pow(2, 20) * 30,
sizeCalculation<T>(obj: T): number {
return Buffer.byteLength(JSON.stringify(obj), "utf8");
},
});
TypeScript users should implement the QueryPlanCache type which is now
exported by @apollo/query-planner:
import { QueryPlanCache } from '@apollo/query-planner';
class MyCustomQueryPlanCache implements QueryPlanCache {
// ...
}
Adds debug/testing query planner options (debug.bypassPlannerForSingleSubgraph) to bypass the query planning (#2441)
process for federated supergraph having only a single subgraph. The option is disabled by default, is not recommended
for production, and is not supported (it may be removed later). It is meant for debugging/testing purposes.
Patch Changes
Refactor the internal implementation of selection sets used by the query planner to decrease the code complexity and (#2387)
improve query plan generation performance in many cases.
Optimises query plan generation for parts of queries that can statically be known to not cross across subgraphs (#2449)
Handle defaulted variables correctly during post-processing. (#2443)
Users who tried to use built-in conditional directives (skip/include) with defaulted variables and no variable provided would encounter an error thrown by operation post-processing saying that the variables weren't provided. The defaulted values went unaccounted for, so the operation would validate but then fail an assertion while resolving the conditional.
With this change, defaulted variable values are now collected and provided to post-processing (with defaults being overwritten by variables that are actually provided).
Exposes, for each subgraph request, the path in the overall gateway operation at which that subgraph request gets inserted. This path is now available as the pathInIncomingRequest field in the arguments of RemoteGraphQLDataSource.willSendRequest and RemoteGraphQLDataSource.didReceiveResponse. (#2384)
Previously the queryPlanStoreKey was a hash of the query concatenated with an unhashed operationName if it was present. This resulted in variable length cache keys that could become unnecessarily long, occupying additional space in the query plan cache. (#2310)
This change incorporates the operationNameinto the hash itself (if operationName is present).
Update @apollo/utils.createhash package, which drops support for node 12 (#2266)
Update @apollo/utils.isnodelike package, which dropped support for node 12 (#2268)
Update @apollo/utils.fetcher package, which drops support for node 12 (#2267)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps @apollo/gateway from 2.0.4 to 2.4.0.
Release notes
Sourced from
@apollo/gateway
's releases.... (truncated)
Changelog
Sourced from
@apollo/gateway
's changelog.... (truncated)
Commits
51a8822
Version Packages (#2465)62b3a65
Merge remote-tracking branch 'origin/main' into nextcab383b
Optim local value types (#2449)260c357
Refactor selection set implementation to be immutable (#2387)01b9c31
Version Packages (alpha) (#2452)3f2045f
Version Packages (alpha) (#2364)cf0e24d
Version Packages (#2446)c572afd
Generates condition nodes for @include/@skip
when possible (#2424)3d3bc24
Update docs to use 2.4 instead of 2.3 (#2448)a9385bd
subscriptions support in the query planner (#2389)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)