@graphql-mesh/transport-ws 0.4.0-alpha-20241021203115-9d2e78b5b8a7fceb8f1237706008feb9253b90cb → 0.4.0-alpha-20241024081932-3ee73bb98c2cf864970c6ddb7b244c724f2c9637

Sign up to get free protection for your applications and to get access to all the features.
package/cjs/index.js CHANGED
@@ -16,9 +16,10 @@ function switchProtocols(url) {
16
16
  }
17
17
  exports.default = {
18
18
  getSubgraphExecutor({ transportEntry, logger }) {
19
+ const buildExecutor = transportEntry.options?.buildGraphQLWSExecutor ?? executor_graphql_ws_1.buildGraphQLWSExecutor;
19
20
  const wsExecutorMap = new Map();
20
21
  const wsUrl = switchProtocols(transportEntry.location);
21
- const connectionParamsFactory = transportEntry.options.connectionParams
22
+ const connectionParamsFactory = transportEntry.options?.connectionParams
22
23
  ? (0, string_interpolation_1.getInterpolatedHeadersFactory)(transportEntry.options.connectionParams)
23
24
  : undefined;
24
25
  const headersFactory = transportEntry.headers
@@ -41,7 +42,7 @@ exports.default = {
41
42
  let wsExecutor = wsExecutorMap.get(hash);
42
43
  if (!wsExecutor) {
43
44
  const executorLogger = logger.child('GraphQL WS').child(hash);
44
- wsExecutor = (0, executor_graphql_ws_1.buildGraphQLWSExecutor)({
45
+ wsExecutor = buildExecutor({
45
46
  url: wsUrl,
46
47
  lazy: true,
47
48
  lazyCloseTimeout: 3_000,
package/esm/index.js CHANGED
@@ -14,9 +14,10 @@ function switchProtocols(url) {
14
14
  }
15
15
  export default {
16
16
  getSubgraphExecutor({ transportEntry, logger }) {
17
+ const buildExecutor = transportEntry.options?.buildGraphQLWSExecutor ?? buildGraphQLWSExecutor;
17
18
  const wsExecutorMap = new Map();
18
19
  const wsUrl = switchProtocols(transportEntry.location);
19
- const connectionParamsFactory = transportEntry.options.connectionParams
20
+ const connectionParamsFactory = transportEntry.options?.connectionParams
20
21
  ? getInterpolatedHeadersFactory(transportEntry.options.connectionParams)
21
22
  : undefined;
22
23
  const headersFactory = transportEntry.headers
@@ -39,7 +40,7 @@ export default {
39
40
  let wsExecutor = wsExecutorMap.get(hash);
40
41
  if (!wsExecutor) {
41
42
  const executorLogger = logger.child('GraphQL WS').child(hash);
42
- wsExecutor = buildGraphQLWSExecutor({
43
+ wsExecutor = buildExecutor({
43
44
  url: wsUrl,
44
45
  lazy: true,
45
46
  lazyCloseTimeout: 3_000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/transport-ws",
3
- "version": "0.4.0-alpha-20241021203115-9d2e78b5b8a7fceb8f1237706008feb9253b90cb",
3
+ "version": "0.4.0-alpha-20241024081932-3ee73bb98c2cf864970c6ddb7b244c724f2c9637",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*",
@@ -9,8 +9,8 @@
9
9
  "dependencies": {
10
10
  "@graphql-mesh/cross-helpers": "0.4.7",
11
11
  "@graphql-mesh/string-interpolation": "^0.5.6",
12
- "@graphql-mesh/transport-common": "^0.7.8",
13
- "@graphql-mesh/utils": "^0.102.7",
12
+ "@graphql-mesh/transport-common": "^0.7.10",
13
+ "@graphql-mesh/utils": "^0.102.9",
14
14
  "@graphql-tools/executor-graphql-ws": "^1.3.0",
15
15
  "@graphql-tools/utils": "^10.5.5",
16
16
  "graphql-ws": "^5.16.0",
@@ -1,7 +1,9 @@
1
1
  import type { ClientOptions } from 'graphql-ws';
2
2
  import { type DisposableExecutor } from '@graphql-mesh/transport-common';
3
+ import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
3
4
  export type WSTransportOptions = Omit<ClientOptions, 'url' | 'on' | 'connectionParams'> & {
4
5
  connectionParams?: Record<string, string>;
6
+ buildGraphQLWSExecutor?: typeof buildGraphQLWSExecutor;
5
7
  };
6
8
  declare const _default: {
7
9
  getSubgraphExecutor({ transportEntry, logger }: import("@graphql-mesh/transport-common").TransportGetSubgraphExecutorOptions<WSTransportOptions>): DisposableExecutor & AsyncDisposable;
@@ -1,7 +1,9 @@
1
1
  import type { ClientOptions } from 'graphql-ws';
2
2
  import { type DisposableExecutor } from '@graphql-mesh/transport-common';
3
+ import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
3
4
  export type WSTransportOptions = Omit<ClientOptions, 'url' | 'on' | 'connectionParams'> & {
4
5
  connectionParams?: Record<string, string>;
6
+ buildGraphQLWSExecutor?: typeof buildGraphQLWSExecutor;
5
7
  };
6
8
  declare const _default: {
7
9
  getSubgraphExecutor({ transportEntry, logger }: import("@graphql-mesh/transport-common").TransportGetSubgraphExecutorOptions<WSTransportOptions>): DisposableExecutor & AsyncDisposable;