@graphql-mesh/transport-ws 1.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc → 1.0.0-alpha-0970bee38b7b2f35ae088184ca6a3b6700f5a1bd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,25 +1,30 @@
1
1
  # @graphql-mesh/transport-ws
2
2
 
3
- ## 1.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc
3
+ ## 1.0.0-alpha-0970bee38b7b2f35ae088184ca6a3b6700f5a1bd
4
4
 
5
5
  ### Major Changes
6
6
 
7
- - [#481](https://github.com/graphql-hive/gateway/pull/481) [`e968bd9`](https://github.com/graphql-hive/gateway/commit/e968bd9f7572217e885e8ddeb71f33cdd3e5064e) Thanks [@enisdenjo](https://github.com/enisdenjo)! - WebSocket transport is stable and production ready
7
+ - [#481](https://github.com/graphql-hive/gateway/pull/481) [`ddc90f3`](https://github.com/graphql-hive/gateway/commit/ddc90f330beb5551df50abf26b0a07d5c4d4f0b4) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Options allow configuring only `connectionParams`
8
+
9
+ In most of the cases you won't need to configure the underlying graphql-ws client any further.
10
+
11
+ - [#481](https://github.com/graphql-hive/gateway/pull/481) [`fc46acd`](https://github.com/graphql-hive/gateway/commit/fc46acd594803e73e4822388a2ce6efa8867d29b) Thanks [@enisdenjo](https://github.com/enisdenjo)! - WebSocket transport is stable and production ready
8
12
 
9
13
  ### Minor Changes
10
14
 
11
- - [#481](https://github.com/graphql-hive/gateway/pull/481) [`db32dfb`](https://github.com/graphql-hive/gateway/commit/db32dfb4f231e6a20e5c5932ca921823debf3188) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Upgrade graphql-ws to v6
15
+ - [#481](https://github.com/graphql-hive/gateway/pull/481) [`a4cb5cc`](https://github.com/graphql-hive/gateway/commit/a4cb5cc9b2807ccae5ce3631eb3705d929ee4599) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Upgrade graphql-ws to v6
12
16
 
13
17
  If you have a custom graphql-ws configuration when using the transport, you will have to migrate the graphql-ws side to v6. [Please consult the changelog of graphql-ws.](https://github.com/enisdenjo/graphql-ws/releases/tag/v6.0.0)
14
18
 
15
19
  ### Patch Changes
16
20
 
17
- - [#481](https://github.com/graphql-hive/gateway/pull/481) [`bd40c9b`](https://github.com/graphql-hive/gateway/commit/bd40c9b629efad6a7a3c91535359e2768bf6bcbf) Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
21
+ - [#481](https://github.com/graphql-hive/gateway/pull/481) [`9a763a5`](https://github.com/graphql-hive/gateway/commit/9a763a5de54ad4b033f410d6623da4cde79bd2b6) Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
18
22
 
19
- - Updated dependency [`graphql-ws@^6.0.1` ↗︎](https://www.npmjs.com/package/graphql-ws/v/6.0.1) (from `^5.16.0`, in `dependencies`)
23
+ - Updated dependency [`graphql-ws@^6.0.2` ↗︎](https://www.npmjs.com/package/graphql-ws/v/6.0.2) (from `^5.16.0`, in `dependencies`)
24
+ - Added dependency [`isomorphic-ws@^5.0.0` ↗︎](https://www.npmjs.com/package/isomorphic-ws/v/5.0.0) (to `dependencies`)
20
25
 
21
- - Updated dependencies [[`bd40c9b`](https://github.com/graphql-hive/gateway/commit/bd40c9b629efad6a7a3c91535359e2768bf6bcbf), [`db32dfb`](https://github.com/graphql-hive/gateway/commit/db32dfb4f231e6a20e5c5932ca921823debf3188)]:
22
- - @graphql-tools/executor-graphql-ws@2.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc
26
+ - Updated dependencies [[`9a763a5`](https://github.com/graphql-hive/gateway/commit/9a763a5de54ad4b033f410d6623da4cde79bd2b6), [`ddc90f3`](https://github.com/graphql-hive/gateway/commit/ddc90f330beb5551df50abf26b0a07d5c4d4f0b4), [`ddc90f3`](https://github.com/graphql-hive/gateway/commit/ddc90f330beb5551df50abf26b0a07d5c4d4f0b4), [`a4cb5cc`](https://github.com/graphql-hive/gateway/commit/a4cb5cc9b2807ccae5ce3631eb3705d929ee4599)]:
27
+ - @graphql-tools/executor-graphql-ws@2.0.0-alpha-0970bee38b7b2f35ae088184ca6a3b6700f5a1bd
23
28
 
24
29
  ## 0.4.16
25
30
 
package/dist/index.cjs CHANGED
@@ -4,6 +4,8 @@ var crossHelpers = require('@graphql-mesh/cross-helpers');
4
4
  var stringInterpolation = require('@graphql-mesh/string-interpolation');
5
5
  var utils = require('@graphql-mesh/utils');
6
6
  var executorGraphqlWs = require('@graphql-tools/executor-graphql-ws');
7
+ var graphqlWs = require('graphql-ws');
8
+ var isomorphicWs = require('isomorphic-ws');
7
9
 
8
10
  function switchProtocols(url) {
9
11
  if (url.startsWith("https://")) {
@@ -44,41 +46,47 @@ var index = {
44
46
  let wsExecutor = wsExecutorMap.get(hash);
45
47
  if (!wsExecutor) {
46
48
  const executorLogger = logger?.child("GraphQL WS").child(hash);
47
- wsExecutor = buildExecutor({
48
- url: wsUrl,
49
- lazy: true,
50
- lazyCloseTimeout: 3e3,
51
- ...transportEntry.options,
52
- headers,
53
- connectionParams,
54
- on: {
55
- connecting(isRetry) {
56
- executorLogger?.debug("connecting", { isRetry });
57
- },
58
- opened(socket) {
59
- executorLogger?.debug("opened", { socket });
60
- },
61
- connected(socket, payload) {
62
- executorLogger?.debug("connected", { socket, payload });
63
- },
64
- ping(received, payload) {
65
- executorLogger?.debug("ping", { received, payload });
66
- },
67
- pong(received, payload) {
68
- executorLogger?.debug("pong", { received, payload });
69
- },
70
- message(message) {
71
- executorLogger?.debug("message", { message });
72
- },
73
- closed(event) {
74
- executorLogger?.debug("closed", { event });
75
- wsExecutorMap.delete(hash);
76
- },
77
- error(error) {
78
- executorLogger?.debug("error", { error });
49
+ wsExecutor = buildExecutor(
50
+ graphqlWs.createClient({
51
+ webSocketImpl: headers ? class WebSocketWithHeaders extends isomorphicWs.WebSocket {
52
+ constructor(url, protocol) {
53
+ super(url, protocol, { headers });
54
+ }
55
+ } : isomorphicWs.WebSocket,
56
+ url: wsUrl,
57
+ lazy: true,
58
+ lazyCloseTimeout: 3e3,
59
+ ...transportEntry.options,
60
+ connectionParams,
61
+ on: {
62
+ connecting(isRetry) {
63
+ executorLogger?.debug("connecting", { isRetry });
64
+ },
65
+ opened(socket) {
66
+ executorLogger?.debug("opened", { socket });
67
+ },
68
+ connected(socket, payload) {
69
+ executorLogger?.debug("connected", { socket, payload });
70
+ },
71
+ ping(received, payload) {
72
+ executorLogger?.debug("ping", { received, payload });
73
+ },
74
+ pong(received, payload) {
75
+ executorLogger?.debug("pong", { received, payload });
76
+ },
77
+ message(message) {
78
+ executorLogger?.debug("message", { message });
79
+ },
80
+ closed(event) {
81
+ executorLogger?.debug("closed", { event });
82
+ wsExecutorMap.delete(hash);
83
+ },
84
+ error(error) {
85
+ executorLogger?.debug("error", { error });
86
+ }
79
87
  }
80
- }
81
- });
88
+ })
89
+ );
82
90
  wsExecutorMap.set(hash, wsExecutor);
83
91
  }
84
92
  return wsExecutor(execReq);
package/dist/index.d.cts CHANGED
@@ -1,11 +1,15 @@
1
1
  import * as _graphql_mesh_transport_common from '@graphql-mesh/transport-common';
2
2
  import { DisposableExecutor } from '@graphql-mesh/transport-common';
3
3
  import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
4
- import { ClientOptions } from 'graphql-ws';
5
4
 
6
- type WSTransportOptions = Omit<ClientOptions, 'url' | 'on' | 'connectionParams'> & {
5
+ interface WSTransportOptions {
6
+ /**
7
+ * Interpolated additional parameters, passed through the `payload` field with the `ConnectionInit` message,
8
+ * that the client specifies when establishing a connection with the server. You can use this
9
+ * for securely passing arguments for authentication.
10
+ */
7
11
  connectionParams?: Record<string, string>;
8
- };
12
+ }
9
13
  declare const _default: {
10
14
  getSubgraphExecutor({ transportEntry, logger }: _graphql_mesh_transport_common.TransportGetSubgraphExecutorOptions<WSTransportOptions>, buildExecutor?: typeof buildGraphQLWSExecutor): DisposableExecutor & AsyncDisposable;
11
15
  };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  import * as _graphql_mesh_transport_common from '@graphql-mesh/transport-common';
2
2
  import { DisposableExecutor } from '@graphql-mesh/transport-common';
3
3
  import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
4
- import { ClientOptions } from 'graphql-ws';
5
4
 
6
- type WSTransportOptions = Omit<ClientOptions, 'url' | 'on' | 'connectionParams'> & {
5
+ interface WSTransportOptions {
6
+ /**
7
+ * Interpolated additional parameters, passed through the `payload` field with the `ConnectionInit` message,
8
+ * that the client specifies when establishing a connection with the server. You can use this
9
+ * for securely passing arguments for authentication.
10
+ */
7
11
  connectionParams?: Record<string, string>;
8
- };
12
+ }
9
13
  declare const _default: {
10
14
  getSubgraphExecutor({ transportEntry, logger }: _graphql_mesh_transport_common.TransportGetSubgraphExecutorOptions<WSTransportOptions>, buildExecutor?: typeof buildGraphQLWSExecutor): DisposableExecutor & AsyncDisposable;
11
15
  };
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ import { process } from '@graphql-mesh/cross-helpers';
2
2
  import { getInterpolatedHeadersFactory } from '@graphql-mesh/string-interpolation';
3
3
  import { makeAsyncDisposable, isDisposable, dispose } from '@graphql-mesh/utils';
4
4
  import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
5
+ import { createClient } from 'graphql-ws';
6
+ import { WebSocket } from 'isomorphic-ws';
5
7
 
6
8
  function switchProtocols(url) {
7
9
  if (url.startsWith("https://")) {
@@ -42,41 +44,47 @@ var index = {
42
44
  let wsExecutor = wsExecutorMap.get(hash);
43
45
  if (!wsExecutor) {
44
46
  const executorLogger = logger?.child("GraphQL WS").child(hash);
45
- wsExecutor = buildExecutor({
46
- url: wsUrl,
47
- lazy: true,
48
- lazyCloseTimeout: 3e3,
49
- ...transportEntry.options,
50
- headers,
51
- connectionParams,
52
- on: {
53
- connecting(isRetry) {
54
- executorLogger?.debug("connecting", { isRetry });
55
- },
56
- opened(socket) {
57
- executorLogger?.debug("opened", { socket });
58
- },
59
- connected(socket, payload) {
60
- executorLogger?.debug("connected", { socket, payload });
61
- },
62
- ping(received, payload) {
63
- executorLogger?.debug("ping", { received, payload });
64
- },
65
- pong(received, payload) {
66
- executorLogger?.debug("pong", { received, payload });
67
- },
68
- message(message) {
69
- executorLogger?.debug("message", { message });
70
- },
71
- closed(event) {
72
- executorLogger?.debug("closed", { event });
73
- wsExecutorMap.delete(hash);
74
- },
75
- error(error) {
76
- executorLogger?.debug("error", { error });
47
+ wsExecutor = buildExecutor(
48
+ createClient({
49
+ webSocketImpl: headers ? class WebSocketWithHeaders extends WebSocket {
50
+ constructor(url, protocol) {
51
+ super(url, protocol, { headers });
52
+ }
53
+ } : WebSocket,
54
+ url: wsUrl,
55
+ lazy: true,
56
+ lazyCloseTimeout: 3e3,
57
+ ...transportEntry.options,
58
+ connectionParams,
59
+ on: {
60
+ connecting(isRetry) {
61
+ executorLogger?.debug("connecting", { isRetry });
62
+ },
63
+ opened(socket) {
64
+ executorLogger?.debug("opened", { socket });
65
+ },
66
+ connected(socket, payload) {
67
+ executorLogger?.debug("connected", { socket, payload });
68
+ },
69
+ ping(received, payload) {
70
+ executorLogger?.debug("ping", { received, payload });
71
+ },
72
+ pong(received, payload) {
73
+ executorLogger?.debug("pong", { received, payload });
74
+ },
75
+ message(message) {
76
+ executorLogger?.debug("message", { message });
77
+ },
78
+ closed(event) {
79
+ executorLogger?.debug("closed", { event });
80
+ wsExecutorMap.delete(hash);
81
+ },
82
+ error(error) {
83
+ executorLogger?.debug("error", { error });
84
+ }
77
85
  }
78
- }
79
- });
86
+ })
87
+ );
80
88
  wsExecutorMap.set(hash, wsExecutor);
81
89
  }
82
90
  return wsExecutor(execReq);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/transport-ws",
3
- "version": "1.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc",
3
+ "version": "1.0.0-alpha-0970bee38b7b2f35ae088184ca6a3b6700f5a1bd",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,9 +47,10 @@
47
47
  "@graphql-mesh/transport-common": "^0.7.27",
48
48
  "@graphql-mesh/types": "^0.103.6",
49
49
  "@graphql-mesh/utils": "^0.103.6",
50
- "@graphql-tools/executor-graphql-ws": "2.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc",
50
+ "@graphql-tools/executor-graphql-ws": "2.0.0-alpha-0970bee38b7b2f35ae088184ca6a3b6700f5a1bd",
51
51
  "@graphql-tools/utils": "^10.7.0",
52
- "graphql-ws": "^6.0.1",
52
+ "graphql-ws": "^6.0.2",
53
+ "isomorphic-ws": "^5.0.0",
53
54
  "tslib": "^2.8.1",
54
55
  "ws": "^8.18.0"
55
56
  },