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

Experimental support for incremental delivery (@defer/@stream) #6671

Closed
glasser opened this issue Jul 12, 2022 · 1 comment
Closed

Experimental support for incremental delivery (@defer/@stream) #6671

glasser opened this issue Jul 12, 2022 · 1 comment
Assignees
Milestone

Comments

@glasser
Copy link
Member

glasser commented Jul 12, 2022

We'd like Apollo Server 4.0 to support incremental delivery (@defer/@stream) if combined with a version of graphql-js that supports it. We expect this may impact the plugin API (as it will affect the shape of GraphQLResponse). We expect that we will describe this support as "experimental".

@glasser glasser added this to the Release 4.0 milestone Jul 12, 2022
glasser added a commit that referenced this issue Sep 23, 2022
Requires a pre-release of graphql@17.

More detailed commit message to come.

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
Requires a pre-release of graphql@17.

More detailed commit message to come.

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
Requires a pre-release of graphql@17.

More detailed commit message to come.

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
Also provides improved compatibility with the graphql-over-http spec by
supporting `content-type: application/graphql-response+json` if requested via
`accept` header, and adds `; charset=utf-8` to content-types.

Executing `@defer` and `@stream` directives requires you to install pre-release
of `graphql@17` in your server. This PR does not update `package.json` to
install that prerelease (nor does it even broaden peer deps, which would be
inadequate as many of its dependencies have peer deps that won't include v17).
However, it does add a new CI step that installs a particular v17 pre-release
and runs the test suite and smoke test (including running some
otherwise-disabled tests that exercise the execution of these directives). We
also add a new `__testing_incrementalExecutionResults` option that lets us test
transport-level behavior without installing the prerelease.

This change reworks `GraphQLResponse` and `HTTPGraphQLResponse` to allow
responses to be single- or multi-part. `GraphQLResponse` had previously (in v4)
moved most of its fields onto `result`; we now instead of `body` with two
`kind`s determining the structure of the rest of the response.
`HTTPGraphQLResponse` (new in v4) had tried to anticipate this change, but now
the structure is a bit different.

A few other changes were made for compatibility with `graphql@17` such as
removing some uses of the non-options multi-argument GraphQLError constructor.

Add two new plugin APIs: `didEncounterSubsequentErrors` and
`willSendSubsequentPayload`.

Updates to plugins:
- Usage reporting waits until all payloads are ready before it's done with
  a given operation.
- The response cache does not cache incremental responses (although that would
  likely be quite helpful).
- No cache-control HTTP headers are written with incremental responses (since we
  don't know all the fields that will be executed yet).
- Inline traces are not added to incremental delivery responses (though it might
  make sense to add them to the last payload or something).

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
Also provides improved compatibility with the graphql-over-http spec by
supporting `content-type: application/graphql-response+json` if requested via
`accept` header, and adds `; charset=utf-8` to content-types.

Executing `@defer` and `@stream` directives requires you to install pre-release
of `graphql@17` in your server. This PR does not update `package.json` to
install that prerelease (nor does it even broaden peer deps, which would be
inadequate as many of its dependencies have peer deps that won't include v17).
However, it does add a new CI step that installs a particular v17 pre-release
and runs the test suite and smoke test (including running some
otherwise-disabled tests that exercise the execution of these directives). We
also add a new `__testing_incrementalExecutionResults` option that lets us test
transport-level behavior without installing the prerelease.

This change reworks `GraphQLResponse` and `HTTPGraphQLResponse` to allow
responses to be single- or multi-part. `GraphQLResponse` had previously (in v4)
moved most of its fields onto `result`; we now instead of `body` with two
`kind`s determining the structure of the rest of the response.
`HTTPGraphQLResponse` (new in v4) had tried to anticipate this change, but now
the structure is a bit different.

A few other changes were made for compatibility with `graphql@17` such as
removing some uses of the non-options multi-argument GraphQLError constructor.

Add two new plugin APIs: `didEncounterSubsequentErrors` and
`willSendSubsequentPayload`.

Updates to plugins:
- Usage reporting waits until all payloads are ready before it's done with
  a given operation.
- The response cache does not cache incremental responses (although that would
  likely be quite helpful).
- No cache-control HTTP headers are written with incremental responses (since we
  don't know all the fields that will be executed yet).
- Inline traces are not added to incremental delivery responses (though it might
  make sense to add them to the last payload or something).

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
Also provides improved compatibility with the graphql-over-http spec by
supporting `content-type: application/graphql-response+json` if requested via
`accept` header, and adds `; charset=utf-8` to content-types.

Executing `@defer` and `@stream` directives requires you to install pre-release
of `graphql@17` in your server. This PR does not update `package.json` to
install that prerelease (nor does it even broaden peer deps, which would be
inadequate as many of its dependencies have peer deps that won't include v17).
However, it does add a new CI step that installs a particular v17 pre-release
and runs the test suite and smoke test (including running some
otherwise-disabled tests that exercise the execution of these directives). We
also add a new `__testing_incrementalExecutionResults` option that lets us test
transport-level behavior without installing the prerelease.

This change reworks `GraphQLResponse` and `HTTPGraphQLResponse` to allow
responses to be single- or multi-part. `GraphQLResponse` had previously (in v4)
moved most of its fields onto `result`; we now instead of `body` with two
`kind`s determining the structure of the rest of the response.
`HTTPGraphQLResponse` (new in v4) had tried to anticipate this change, but now
the structure is a bit different.

A few other changes were made for compatibility with `graphql@17` such as
removing some uses of the non-options multi-argument GraphQLError constructor.

Add two new plugin APIs: `didEncounterSubsequentErrors` and
`willSendSubsequentPayload`.

Updates to plugins:
- Usage reporting waits until all payloads are ready before it's done with
  a given operation.
- The response cache does not cache incremental responses (although that would
  likely be quite helpful).
- No cache-control HTTP headers are written with incremental responses (since we
  don't know all the fields that will be executed yet).
- Inline traces are not added to incremental delivery responses (though it might
  make sense to add them to the last payload or something).

Fixes #6671.
glasser added a commit that referenced this issue Sep 23, 2022
…6827)

Also provides improved compatibility with the graphql-over-http spec by
supporting `content-type: application/graphql-response+json` if requested via
`accept` header, and adds `; charset=utf-8` to content-types.

Executing `@defer` and `@stream` directives requires you to install pre-release
of `graphql@17` in your server. This PR does not update `package.json` to
install that prerelease (nor does it even broaden peer deps, which would be
inadequate as many of its dependencies have peer deps that won't include v17).
However, it does add a new CI step that installs a particular v17 pre-release
and runs the test suite and smoke test (including running some
otherwise-disabled tests that exercise the execution of these directives). We
also add a new `__testing_incrementalExecutionResults` option that lets us test
transport-level behavior without installing the prerelease.

This change reworks `GraphQLResponse` and `HTTPGraphQLResponse` to allow
responses to be single- or multi-part. `GraphQLResponse` had previously (in v4)
moved most of its fields onto `result`; we now instead of `body` with two
`kind`s determining the structure of the rest of the response.
`HTTPGraphQLResponse` (new in v4) had tried to anticipate this change, but now
the structure is a bit different.

A few other changes were made for compatibility with `graphql@17` such as
removing some uses of the non-options multi-argument GraphQLError constructor.

Add two new plugin APIs: `didEncounterSubsequentErrors` and
`willSendSubsequentPayload`.

Updates to plugins:
- Usage reporting waits until all payloads are ready before it's done with
  a given operation.
- The response cache does not cache incremental responses (although that would
  likely be quite helpful).
- No cache-control HTTP headers are written with incremental responses (since we
  don't know all the fields that will be executed yet).
- Inline traces are not added to incremental delivery responses (though it might
  make sense to add them to the last payload or something).

Fixes #6671.
@glasser
Copy link
Member Author

glasser commented Sep 27, 2022

Fixed on version-4

@glasser glasser closed this as completed Sep 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant