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

V0: Change dependency on Apollo Server 3 to new type package #2050

Merged
merged 3 commits into from
Aug 9, 2022

Conversation

glasser
Copy link
Member

@glasser glasser commented Aug 8, 2022

Backport of #2044.

This removes the last dependency on Apollo Server from Apollo Gateway.

Part of apollographql/apollo-server#6057 and
apollographql/apollo-server#6719

The new package @apollo/server-gateway-interface (in the apollo-utils
repo for now, though it should move to the apollo-server repo once AS4
is fully released) defines types that are pretty close to compatible
with the AS3 types previously used here, but don't require a dependency
on the entirety of AS3. This new package will be used by AS4 and AS4
will convert its data into the format described by these types.

This change is entirely a build-time change (other than a slight change
to how a enum is referenced). So the worst case scenario if this differs
unintentionally from the original AS3 definitions is that users can
apply a bit of as any to fix it.

Note that we've removed some <TContext> from types that it turned out
were only ever instantiated with Record<string, any> anyway. They are
left in in RemoteGraphQLDataSource because users making their own data
sources can explicitly specify their context type.

The types in @apollo/server-gateway-interface are pretty close to the
AS3 types (with different names) but there are some slight differences.
The cache scope enum is replaced with any, as enums are not
structurally typed and it is otherwise difficult to type them.
GatewayInterface now expects onSchemaLoadOrUpdate to exist and
doesn't mention the old onSchemaChange.

For now, we leave apollo-reporting-protobuf alone, so we don't have a direct
dependency on a prerelease.

Backport of #2044.

This removes the last dependency on Apollo Server from Apollo Gateway.

Part of apollographql/apollo-server#6057 and
apollographql/apollo-server#6719

The new package `@apollo/server-gateway-interface` (in the apollo-utils
repo for now, though it should move to the apollo-server repo once AS4
is fully released) defines types that are pretty close to compatible
with the AS3 types previously used here, but don't require a dependency
on the entirety of AS3. This new package will be used by AS4 and AS4
will convert its data into the format described by these types.

This change is entirely a build-time change (other than a slight change
to how a enum is referenced). So the worst case scenario if this differs
unintentionally from the original AS3 definitions is that users can
apply a bit of `as any` to fix it.

Note that we've removed some `<TContext>` from types that it turned out
were only ever instantiated with `Record<string, any>` anyway. They are
left in in RemoteGraphQLDataSource because users making their own data
sources can explicitly specify their context type.

The types in `@apollo/server-gateway-interface` are pretty close to the
AS3 types (with different names) but there are some slight differences.
The cache scope enum is replaced with `any`, as enums are not
structurally typed and it is otherwise difficult to type them.
`GatewayInterface` now expects `onSchemaLoadOrUpdate` to exist and
doesn't mention the old `onSchemaChange`.

For now, we leave `apollo-reporting-protobuf` alone, so we don't have a direct
dependency on a prerelease.
@netlify
Copy link

netlify bot commented Aug 8, 2022

Deploy Preview for apollo-federation-docs ready!

Name Link
🔨 Latest commit f5c5543
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/62f2cb0e997e390009ad592e
😎 Deploy Preview https://deploy-preview-2050--apollo-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@glasser glasser marked this pull request as ready for review August 8, 2022 23:59
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 8, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@trevor-scheer
Copy link
Member

Looks like we need to publish it with support for Node v12

Copy link
Contributor

@benweatherman benweatherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants