Skip to content

Commit

Permalink
chore(deps): update all non-major dependencies (main) (#1928)
Browse files Browse the repository at this point in the history
* chore(deps): update all non-major dependencies

* Treat GraphQLRequestContext.overallCachePolicy as optional

This got changed in apollographql/apollo-server#5248 but the code using it calls out we need to maintain compatibility with Apollo Server https://github.com/apollographql/federation/blob/d900859c766645cd617eb865864d326c0431a380/gateway-js/src/datasources/RemoteGraphQLDataSource.ts#L116-L124

This fixes the following Typescript validation error:

```
gateway-js/src/datasources/RemoteGraphQLDataSource.ts:122:7 - error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?

122       options.incomingRequestContext.overallCachePolicy?.restrict
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

It _seems_ like we should've run into this previously, since this the ternary version of this check was fixed in TS 3.9.0 according to microsoft/TypeScript/#36048

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ben <benweatherman@gmail.com>
  • Loading branch information
renovate[bot] and benweatherman authored Jun 24, 2022
1 parent 73b83e5 commit 5310a7a
Show file tree
Hide file tree
Showing 4 changed files with 1,114 additions and 789 deletions.
2 changes: 1 addition & 1 deletion gateway-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@apollo/utils.logger": "^1.0.0",
"@josephg/resolvable": "^1.0.1",
"@opentelemetry/api": "^1.0.1",
"@types/node-fetch": "2.6.1",
"@types/node-fetch": "2.6.2",
"apollo-reporting-protobuf": "^0.8.0 || ^3.0.0",
"apollo-server-caching": "^0.7.0 || ^3.0.0",
"apollo-server-core": "^2.23.0 || ^3.0.0",
Expand Down
9 changes: 8 additions & 1 deletion gateway-js/src/datasources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ export type GraphQLDataSourceProcessOptions<
* The GraphQLRequestContext for the operation received by the gateway, or
* one of the strings if this operation is generated by the gateway without an
* incoming request.
*
* For backwards compatibility with Apollo Server 3, `overallCachePolicy` needs
* to be treated as optional.
*/
incomingRequestContext: GraphQLRequestContext<TContext>;
incomingRequestContext: Omit<
GraphQLRequestContext<TContext>,
'overallCachePolicy'
> &
Pick<Partial<GraphQLRequestContext<TContext>>, 'overallCachePolicy'>;
/**
* Equivalent to incomingRequestContext.context (provided here for
* backwards compatibility): the object created by the Apollo Server
Expand Down
Loading

0 comments on commit 5310a7a

Please sign in to comment.