chore(deps): update dependency graphql-ws to v6 #12282
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^5.5.5
->^5.5.5 || ^6.0.0
Release Notes
enisdenjo/graphql-ws (graphql-ws)
v6.0.1
Compare Source
Patch Changes
#618
6be34c7
Thanks @enisdenjo! - Remove exports for CommonJS for Deno exports in package.jsonDeno supports ECMAScript modules exclusively.
#618
6be34c7
Thanks @enisdenjo! - Define exports for CommonJS TypeScript definitions in package.jsonv6.0.0
Compare Source
Major Changes
b668b30
Thanks @enisdenjo! - @fastify/websocket WebSocket in the context extra has been renamed fromconnection
tosocket
Migrating from v5 to v6
#613
3f11aba
Thanks @enisdenjo! - Drop support forws
v7ws
v7 has been deprecated. Please upgrade and use v8.#613
3f11aba
Thanks @enisdenjo! - Drop support for deprecatedfastify-websocket
fastify-websocket
has been deprecated since v4.3.0.. Please upgrade and use@fastify/websocket
.#613
3f11aba
Thanks @enisdenjo! - The/lib/
part from imports has been removed, for examplegraphql-ws/lib/use/ws
becomesgraphql-ws/use/ws
Migrating from v5 to v6
Simply remove the
/lib/
part from your graphql-ws imports that use a handler.ws
uWebSockets.js
@fastify/websocket
Bun
Deno
#613
3f11aba
Thanks @enisdenjo! -ErrorMessage
uses andonError
returnsGraphQLFormattedError
(instead ofGraphQLError
)Thanks @benjie for working on this in #599
#613
3f11aba
Thanks @enisdenjo! - Least supported Node version is v20Node v10 has been deprecated for years now. There is no reason to support it. Bumping the engine to the current LTS (v20) also allows the code to be leaner and use less polyfills.
#613
3f11aba
Thanks @enisdenjo! - Least supportedgraphql
peer dependency is ^15.10.1 and ^16Users are advised to use the latest of
graphql
because of various improvements in performance and security.#613
3f11aba
Thanks @enisdenjo! -NextMessage
uses andonNext
returnsFormattedExecutionResult
(instead ofExecutionResult
)#613
3f11aba
Thanks @enisdenjo! -schema
,context
,onSubscribe
,onOperation
,onError
,onNext
andonComplete
hooks don't have the full accompanying message anymore, only the ID and the relevant part from the messageThere is really no need to pass the full
SubscribeMessage
to theonSubscribe
hook. The only relevant parts from the message are theid
and thepayload
, thetype
is useless since the hook inherently has it (onNext
isnext
type,onError
iserror
type, etc).The actual techincal reason for not having the full message is to avoid serialising results and errors twice. Both
onNext
andonError
allow the user to augment the result and return it to be used instead.onNext
originally had theNextMessage
argument which already has theFormattedExecutionResult
, andonError
originally had theErrorMessage
argument which already has theGraphQLFormattedError
, and they both also returnedFormattedExecutionResult
andGraphQLFormattedError
respectivelly - meaning, if the user serialised the results - the serialisation would happen twice.Additionally, the
onOperation
,onError
,onNext
andonComplete
now have thepayload
which is theSubscribeMessage.payload
(SubscribePayload
) for easier access to the original query as well as execution params extensions.Migrating from v5 to v6
schema
context
onSubscribe
onOperation
The
SubscribeMessage.payload
is not useful here at all, thepayload
has been parsed to ready-to-use graphql execution args and should be used instead.onError
The
ErrorMessage.payload
(GraphQLFormattedError[]
) is not useful here at all, the user has access toGraphQLError[]
that are true instances of the error containing object references tooriginalError
s and other properties. The user can always convert and returnGraphQLFormattedError[]
by using the.toJSON()
method.onNext
The
NextMessage.payload
(FormattedExecutionResult
) is not useful here at all, the user has access toExecutionResult
that contains actual object references to error instances. The user can always convert and returnFormattedExecutionResult
by serialising the errors withGraphQLError.toJSON()
method.onComplete
#613
3f11aba
Thanks @enisdenjo! - Errors thrown from subscription iterables will be caught and reported through theErrorMessage
Compared to the behaviour before, which terminated the whole WebSocket connection - those errors are now gracefully reported and terminate only the specific subscription that threw the error.
There's been an editorial change in the GraphQL Spec suggesting this being the correct approach.
Also, if you'd like to get involved and ideally drop your opinion about whether iterable errors should be reported as errors or
ExecutionResult
s witherrors
field set, please read more here.Migrating from v5 to v6
If you had used the suggested "ws server usage with custom subscribe method that gracefully handles thrown errors" recipe, you can simply remove it since this behaviour is now baked in.
3f11aba
Thanks @enisdenjo! - Remove deprecatedisMessage
, usevalidateMessage
insteadMigrating from v5 to v6
Replace all ocurrances of
isMessage
withvalidateMessage
. Note thatvalidateMessage
throws if the message is not valid, compared withisMessage
that simply returned true/false.3f11aba
Thanks @enisdenjo! - Removed deprecatedisFatalConnectionProblem
, useshouldRetry
insteadMigrating from v5 to v6
Replace all ocurrances of
isFatalConnectionProblem
withshouldRetry
. Note that the result is inverted, where you returnedfalse
inisFatalConnectionProblem
you should returntrue
inshouldRetry
.Minor Changes
#613
3f11aba
Thanks @enisdenjo! - Client is truly zero-dependency, not even a peer dependency ongraphql
In non-browser environments, you can use only the client and not even depend on
graphql
by importing fromgraphql-ws/client
.Note that, in browser envirments (and of course having your bundler use the
browser
package.json field), you don't have to import fromgraphql-ws/client
- simply importing fromgraphql-ws
will only have thecreateClient
available.#615
29dd26a
Thanks @enisdenjo! - Define optional peer dependencies and least supported versionsUsing the
peerDependencies
in combination withpeerDependenciesMeta
configuration inpackage.json
.v5.16.2
Compare Source
Patch Changes
#611
6a5fde1
Thanks @enisdenjo! - No more workspacesThis version does not contain any code changes.
v5.16.1
Compare Source
Patch Changes
#607
a629ec7
Thanks @enisdenjo! - Release with changesetsThis version does not contain any code changes.
Configuration
📅 Schedule: Branch creation - "every weekend" in timezone America/Los_Angeles, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.