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

Release 2.11.0 #3763

Merged
merged 37 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d34d34d
changelog: Kick-off v2.11.0.
abernix Feb 6, 2020
b3b2484
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 6, 2020
9bd4e7b
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 6, 2020
1ea1bde
breaking: Change `RemoteGraphQLDataSource` `didReceiveResponse` (#3743)
abernix Feb 7, 2020
7a8826a
gateway: Allow use of APQ when querying downstream services. (#3744)
abernix Feb 7, 2020
eaf92a1
docs: Add description of #3744's `apq` option to gateway API docs.
abernix Feb 7, 2020
2a3e294
Release
abernix Feb 7, 2020
4131c58
changelog: Update gateway changelog header to reflect prerelease vers…
abernix Feb 7, 2020
c108026
Merge branch 'master' into release-2.11.0
abernix Feb 7, 2020
c8b7df6
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 10, 2020
f25d6aa
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 10, 2020
10ac19f
no-op: Rename `test` to `it` for consistency.
abernix Feb 4, 2020
671afe6
tests: Remove unnecessary casting to `any`.
abernix Feb 4, 2020
cf6c7ad
tests: Improve typing and pass `queryHash` through to `addTrace` mock.
abernix Feb 4, 2020
e97260d
tests: types: Fix type errors within tests.
abernix Feb 4, 2020
4f38dbb
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 14, 2020
e405526
Update CHANGELOG.md version headings prior to bumping version.
abernix Feb 14, 2020
df345c6
Release
abernix Feb 14, 2020
c48c0a3
Gateway(experimental): compress downstream requests via generat… (#3791)
trevor-scheer Feb 15, 2020
ff47978
Release
trevor-scheer Feb 15, 2020
9420aa0
Gateway: introduce `make-fetch-happen` (#3783)
trevor-scheer Feb 20, 2020
397a735
Use the logger rather than console where the logger is already availa…
abernix Feb 20, 2020
1d6b895
Gateway: provide `user-agent` header to fetcher (#3810)
trevor-scheer Feb 20, 2020
417aca4
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 24, 2020
014bc70
Merge remote-tracking branch 'origin/master' into release-2.11.0
abernix Feb 24, 2020
c33d01f
Add `^15.0.0-rc.2` to `peerDependencies` range for `graphql`. (#3825)
abernix Feb 24, 2020
f5abe1e
Add CHANGELOG.md for #3825.
abernix Feb 24, 2020
4f911ba
Update CHANGELOG.md prior to prerelease.
abernix Feb 24, 2020
71e5956
Update `version` in `@apollo/federation`'s `package.json` to reflect …
abernix Feb 24, 2020
a07ce0f
Release
abernix Feb 24, 2020
daac9ee
Switch to existing `fetch` type, rather than that of `make-fetc… (#3829)
abernix Feb 25, 2020
5235abd
Release
abernix Feb 25, 2020
ce5ac56
Same/similar to daac9ee06f159f111fc9fc375d965bbdec0db125 in #3829.
abernix Feb 25, 2020
062e6a3
Release
abernix Feb 25, 2020
8b70079
Merge branch 'master' into release-2.11.0
trevor-scheer Feb 26, 2020
4155e73
Cleanup networkRequests tests
trevor-scheer Feb 27, 2020
feea6fd
Merge branch 'master' into release-2.11.0
abernix Mar 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ The version headers in this history reflect the versions of Apollo Server itself
- [__CHANGELOG for `@apollo/gateway`__](https://github.com/apollographql/apollo-server/blob/master/packages/apollo-gateway/CHANGELOG.md)
- [__CHANGELOG for `@apollo/federation`__](https://github.com/apollographql/apollo-server/blob/master/packages/apollo-federation/CHANGELOG.md)

### vNEXT
### v2.11.0

> 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 the appropriate changes within that release will be moved into the new section.

- _Nothing yet! Stay tuned._
- The range of accepted `peerDepedencies` versions for `graphql` has been widened to include `graphql@^15.0.0-rc.2` so as to accommodate the latest release-candidate of the `graphql@15` package, and an intention to support it when it is finally released on the `latest` npm tag. While this change will subdue peer dependency warnings for Apollo Server packages, many dependencies from outside of this repository will continue to raise similar warnings until those packages own `peerDependencies` are updated. It is unlikely that all of those packages will update their ranges prior to the final version of `graphql@15` being released, but if everything is working as expected, the warnings can be safely ignored. [PR #3825](https://github.com/apollographql/apollo-server/pull/3825)

### v2.10.1

Expand Down
44 changes: 33 additions & 11 deletions docs/source/api/apollo-gateway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ example of using `ApolloGateway`, see [Implementing a federated graph](/federati
});
```

* `apq`: `Boolean`

When enabled the gateway will attempt to use [automated persisted queries (APQ)](https://www.apollographql.com/docs/apollo-server/performance/apq/)
when sending queries to downstream services. Depending on the complexity
of queries sent to downstream services, this technique can greatly reduce
the size of the payloads being transmitted over the network. Downstream
implementing services must also support APQ functionality to participate
in this feature (Apollo Server does by default unless it has been
explicitly disabled). As with typical APQ behavior, a downstream server
must have received and registered a query once before it will be able to
serve an APQ request.

* `buildService`: `(service: ServiceDefinition) => GraphQLDataSource`

Define this function to customize your gateway's data transport to some or
Expand Down Expand Up @@ -158,24 +170,34 @@ These methods are described in detail below.
});
```

### `didReceiveResponse`: `(response: Response, request: Request, context: TContext) => Promise<TResult>`
### `didReceiveResponse`: `(requestContext: {request: GraphQLRequest, response: GraphQLResponse, context: Record<string, any>}) => Promise<GraphQLResponse>`

Override this method to customize the gateway's behavior after completing
a fetch to the implementing service. The method takes the original `request`, the implementing service's `response`, and the current `context` as parameters, allowing you to modify any combination of the context and the final result of the fetch.

This method must return an object that matches the structure of a
[`GraphQLExecutionResult`](https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-types/src/index.ts#L105-L109) (i.e., it
should include `data`, `errors`, and/or `extensions` fields).

```js{2-9}
a fetch to the implementing service. The method receives an object (a
[`GraphQLRequestContext`](https://github.com/apollographql/apollo-server/blob/2562d096/packages/apollo-server-types/src/index.ts#L61-L92))
containing the `request` (a `GraphQLRequest`), the implementing service's
`response` (a `GraphQLResponse`), and the current `context` as parameters.
This allows modification of the context and the final result of the fetch.

The `http` property on the `request` and `response` objects will contain
additional HTTP-specific properties, like `headers`.

Any implementation of this method must return an object that matches the
structure of a [`GraphQLResponse`](https://github.com/apollographql/apollo-server/blob/2562d096/packages/apollo-server-types/src/index.ts#L43-L48)
(i.e., it should include `http`, `data`, `errors`, and/or `extensions`
fields). If no modifications are necessary, simply return the original
`response`.

```javascript
class CookieDataSource extends RemoteGraphQLDataSource {
didReceiveResponse(response, request, context) {
const body = super.didReceiveResponse(response, request, context);
didReceiveResponse({ response, request, context }) {
const cookie = request.http.headers.get('Cookie');
if (cookie) {
context.responseCookies.push(cookie);
}
return body;

// Return the response back, even when unchanged.
return response;
}
}
```
9 changes: 5 additions & 4 deletions docs/source/federation/implementing.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,15 @@ const { ApolloGateway, RemoteGraphQLDataSource } = require('@apollo/gateway');

class DataSourceWithServerId extends RemoteGraphQLDataSource {
// highlight-start
async didReceiveResponse(response, request, context) {
const body = await super.didReceiveResponse(response, request, context);
async didReceiveResponse({ response, request, context }) {
// Parse the Server-Id header and add it to the array on context
const serverId = response.headers.get('Server-Id');
const serverId = response.http.headers.get('Server-Id');
if (serverId) {
context.serverIds.push(serverId);
}
return body;

// Return the response, even when unchanged.
return response;
}
// highlight-end
}
Expand Down
Loading