@graphql-mesh/transport-ws 0.4.0-alpha-20241023130420-283b902e5311d8bf300420a18f07391eb1dcff65 → 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 +3 -2
- package/esm/index.js +3 -2
- package/package.json +1 -1
- package/typings/index.d.cts +2 -0
- package/typings/index.d.ts +2 -0
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
|
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 = (
|
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
|
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 =
|
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-
|
3
|
+
"version": "0.4.0-alpha-20241024081932-3ee73bb98c2cf864970c6ddb7b244c724f2c9637",
|
4
4
|
"sideEffects": false,
|
5
5
|
"peerDependencies": {
|
6
6
|
"graphql": "*",
|
package/typings/index.d.cts
CHANGED
@@ -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;
|
package/typings/index.d.ts
CHANGED
@@ -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;
|