Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gateway): Implement new supergraphSdl() config option for dynamic gateway updates #1246

Merged
merged 87 commits into from Jan 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c2f2e68
Initial update of types, introduce deprecation warnings and prelim TODOs
trevor-scheer Nov 24, 2021
78a6e51
Implementation and tests
trevor-scheer Nov 25, 2021
b7dfbac
Types and signature cleanup
trevor-scheer Nov 29, 2021
e7786a6
Implement serviceList shim
trevor-scheer Dec 2, 2021
748d433
Use createHash from apollo-graphql
trevor-scheer Dec 2, 2021
f700641
Refactor health checks and provide external health check hook to new …
trevor-scheer Dec 3, 2021
db77d2f
Fix regex
trevor-scheer Dec 3, 2021
3e3aa08
Fix tests
trevor-scheer Dec 4, 2021
8723c5f
add state to prevent extra polling after cleanup
trevor-scheer Dec 7, 2021
8bce79f
Prevent re-entrant calls to update callback
trevor-scheer Dec 9, 2021
2f67f2d
Catch unexpected state case and throw
trevor-scheer Dec 9, 2021
07ac065
Add test for invalid update, fix uncovered bug
trevor-scheer Dec 9, 2021
559ed47
Handle update failures gracefully, address polling not finished bug w…
trevor-scheer Dec 9, 2021
eeee2e6
Add missing file
trevor-scheer Dec 9, 2021
cde70c2
Rename to IntrospectAndCompose
trevor-scheer Dec 9, 2021
212b67d
Migrate related file into legacy folder
trevor-scheer Dec 9, 2021
35a9189
Docs WIP
trevor-scheer Dec 10, 2021
97f6eca
Brief intermission to adjust buildService implementation...
trevor-scheer Dec 17, 2021
8731e5a
More docs
trevor-scheer Dec 17, 2021
e811777
Merge branch 'release-gateway-0.45.0' into trevor/improve-supergraphSdl
trevor-scheer Dec 17, 2021
e1d081c
Fix docs?
trevor-scheer Dec 17, 2021
1c49051
Use createHash implementation safe for non-node envs
trevor-scheer Dec 20, 2021
7f8377e
Fix broken links
trevor-scheer Dec 20, 2021
b5fe3fd
Merge branch 'version-0.x' into trevor/improve-supergraphSdl
trevor-scheer Jan 3, 2022
144e0cd
Add example using buildService
trevor-scheer Jan 3, 2022
5221b99
Add parens for clarity
trevor-scheer Jan 3, 2022
e9e191e
docs tweak
trevor-scheer Jan 3, 2022
773578d
Use fs/promises for file read example
trevor-scheer Jan 3, 2022
9a284d5
Add clarity around subgraph names
trevor-scheer Jan 3, 2022
399a7d1
remove extraneous note
trevor-scheer Jan 3, 2022
c0b3c40
Implement object.initialize behavior for supergraphSdl property
trevor-scheer Jan 3, 2022
961c36e
move out of legacy directory
trevor-scheer Jan 3, 2022
0605407
remove waitUntil, use resolvable
trevor-scheer Jan 3, 2022
497c1de
missed a spot
trevor-scheer Jan 3, 2022
1eb06b9
Update usage recommendations
trevor-scheer Jan 3, 2022
3edaf0d
Remove buildService warning/deprecation
trevor-scheer Jan 3, 2022
36f9ded
Only cleanup user fns in appropriate states
trevor-scheer Jan 3, 2022
24ae881
Add healthCheck capability to IntrospectAndCompose
trevor-scheer Jan 4, 2022
ef82f49
grammar tweak
trevor-scheer Jan 5, 2022
eddf8eb
consistent utf-8
trevor-scheer Jan 5, 2022
d4fcb52
dont pull initialize function off of object, breaks 'this' usages int…
trevor-scheer Jan 5, 2022
4f06450
use resolvable in places
trevor-scheer Jan 5, 2022
55f1b44
Use IntrospectAndCompose internally (under the hood swap for serviceL…
trevor-scheer Jan 5, 2022
c7cdf4c
Big checkpoint, maybe just localServiceList to deal with?
trevor-scheer Jan 6, 2022
143f03a
Remove composition from gateway, more cleanup, local compose in a sep…
trevor-scheer Jan 6, 2022
c139198
cleanup, move things around
trevor-scheer Jan 7, 2022
484d182
missed a few spots
trevor-scheer Jan 7, 2022
29305ca
docs updates
trevor-scheer Jan 7, 2022
e999f2a
missed a docs suggestion
trevor-scheer Jan 7, 2022
64b8bd5
update codegen config
trevor-scheer Jan 7, 2022
eecd5e9
Merge branch 'version-0.x' into trevor/improve-supergraphSdl
trevor-scheer Jan 7, 2022
2eaaab9
only need one Fixture def
trevor-scheer Jan 7, 2022
97b6561
unfocus test and address failures
trevor-scheer Jan 7, 2022
556a4e1
fix tsdoc
trevor-scheer Jan 7, 2022
4666916
update and use predicates
trevor-scheer Jan 7, 2022
4dffaab
rename / cleanup
trevor-scheer Jan 7, 2022
53b00d2
reorder if elses for simplicity
trevor-scheer Jan 7, 2022
8df89e7
protect against invalid cleanup property
trevor-scheer Jan 7, 2022
f2a0e2f
update comments on external hook functions
trevor-scheer Jan 7, 2022
437edd6
rename createAndCacheDataSource
trevor-scheer Jan 7, 2022
83f5d34
update comment
trevor-scheer Jan 7, 2022
c546ce5
export useful types
trevor-scheer Jan 7, 2022
0c471c5
Add deprecation warning for schemaConfigDeliveryEndpoint option (unre…
trevor-scheer Jan 7, 2022
4e6049c
deprecate experimental_pollInterval
trevor-scheer Jan 7, 2022
3b03867
rename fn to match filename
trevor-scheer Jan 7, 2022
45c9cda
reference new supergraph managers in warnings. export LocalCompose
trevor-scheer Jan 7, 2022
547d02c
Document setting gateway poll interval
Jan 6, 2022
ad8121d
Merge pull request #1366 from StephenBarlow/sb/docs-poll-interval
Jan 7, 2022
3a301d3
Update gateway-js/src/__tests__/integration/networkRequests.test.ts
trevor-scheer Jan 8, 2022
6cfae46
Merge branch 'version-0.x' into trevor/improve-supergraphSdl
trevor-scheer Jan 10, 2022
49200f6
expand on IntrospectAndCompose description
trevor-scheer Jan 10, 2022
95e6caa
remove failure hook from config base
trevor-scheer Jan 10, 2022
5158be7
update deprecation comments
trevor-scheer Jan 10, 2022
c5dcc7a
Add clarifying comment to uplinkEndpoints option
trevor-scheer Jan 10, 2022
fa7dc25
clarify endpoints comment
trevor-scheer Jan 10, 2022
adcab86
No need to log and rethrow on init failure, just throw
trevor-scheer Jan 10, 2022
9d321f8
rename performCleanup fn
trevor-scheer Jan 10, 2022
2198c42
handle stopping case
trevor-scheer Jan 10, 2022
7b7101d
update error message on bad call to stop
trevor-scheer Jan 10, 2022
2a63f07
Remove unrefs and use clearTimeout instead of clearInterval
trevor-scheer Jan 10, 2022
335553f
Update comment for LegacyFetcher
trevor-scheer Jan 10, 2022
2ba31fe
rename experimental_didUpdateComposition to didUpdateSupergraph
trevor-scheer Jan 10, 2022
01761a0
update types
trevor-scheer Jan 10, 2022
7ad0ac1
changelog entry
trevor-scheer Jan 10, 2022
59e9f55
keep it experimental
trevor-scheer Jan 10, 2022
d49dcf9
remove extraneous work being done around schema objects, no longer ne…
trevor-scheer Jan 10, 2022
fd995bb
changelog tweaks
trevor-scheer Jan 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion gateway-js/CHANGELOG.md
Expand Up @@ -4,7 +4,24 @@

> The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. When a release is being prepared, a new header will be (manually) created below and the appropriate changes within that release will be moved into the new section.

- _Nothing yet! Stay tuned._
- __BREAKING__: Improve `supergraphSdl` configuration option, provide a clean and flexible interface for updating gateway schema on load and at runtime. This PR brings a number of updates and deprecations to the gateway. Previous options for loading the gateway's supergraph (`serviceList`, `localServiceList`, `experimental_updateServiceDefinitions`, `experimental_supergraphSdl`) are all deprecated going forward. The migration paths all point to the updated `supergraphSdl` configuration option.
trevor-scheer marked this conversation as resolved.
Show resolved Hide resolved

The most notable change here is the introduction of the concept of a `SupergraphManager` (one new possible type of `supergraphSdl`). This interface (when implemented) provides a means for userland code to update the gateway supergraph dynamically, perform subgraph healthchecks, and access subgraph datasources. All of the mentioned deprecated configurations now either use an implementation of a `SupergraphManager` internally or export one to be configured by the user (`IntrospectAndCompose` and `LocalCompose`).

For now: all of the mentioned deprecated configurations will still continue to work as expected. Their usage will come with deprecation warnings advising a switch to `supergraphSdl`.
* `serviceList` users should switch to the now-exported `IntrospectAndCompose` class.
* `localServiceList` users should switch to the similar `LocalCompose` class.
* `experimental_{updateServiceDefinitions|supergraphSdl}` users should migrate their implementation to a custom `SupergraphSdlHook` or `SupergraphManager`.

Since the gateway itself is no longer responsible for composition:
* `experimental_didUpdateComposition` has been renamed more appropriately to `didUpdateSupergraph` (no signature change)
* `experimental_compositionDidFail` hook is removed

`experimental_pollInterval` is deprecated and will issue a warning. Its renamed equivalent is `pollIntervalInMs`.

Some defensive code around gateway shutdown has been removed which was only relevant to users who are running the gateway within `ApolloServer` <=v2.18. If you are still running one of these versions, server shutdown may not happen as smoothly.
trevor-scheer marked this conversation as resolved.
Show resolved Hide resolved

[#1246](https://github.com/apollographql/federation/pull/1246)

## v0.45.1

Expand Down