@graphql-mesh/transport-ws 0.3.7-alpha-20240925120814-cbe9a2609f311e5cfd1c5b24f373eb96268b7437 → 0.4.0-alpha-20240926192138-324615c9ddfa15a9d779f0826ebe608f64b98391
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/index.js +11 -1
- package/esm/index.js +11 -1
- package/package.json +2 -2
package/cjs/index.js
CHANGED
@@ -21,6 +21,9 @@ exports.default = {
|
|
21
21
|
const connectionParamsFactory = transportEntry.options.connectionParams
|
22
22
|
? (0, string_interpolation_1.getInterpolatedHeadersFactory)(transportEntry.options.connectionParams)
|
23
23
|
: undefined;
|
24
|
+
const headersFactory = transportEntry.headers
|
25
|
+
? (0, string_interpolation_1.getInterpolatedHeadersFactory)(Object.fromEntries(transportEntry.headers))
|
26
|
+
: undefined;
|
24
27
|
const mergedExecutor = function mergedExecutor(execReq) {
|
25
28
|
const connectionParams = connectionParamsFactory?.({
|
26
29
|
env: cross_helpers_1.process.env,
|
@@ -28,7 +31,13 @@ exports.default = {
|
|
28
31
|
context: execReq.context,
|
29
32
|
info: execReq.info,
|
30
33
|
});
|
31
|
-
const
|
34
|
+
const headers = headersFactory?.({
|
35
|
+
env: cross_helpers_1.process.env,
|
36
|
+
root: execReq.rootValue,
|
37
|
+
context: execReq.context,
|
38
|
+
info: execReq.info,
|
39
|
+
});
|
40
|
+
const hash = `${wsUrl}?connectionParams=${JSON.stringify(connectionParams)}&headers=${JSON.stringify(headers)}`;
|
32
41
|
let wsExecutor = wsExecutorMap.get(hash);
|
33
42
|
if (!wsExecutor) {
|
34
43
|
const executorLogger = logger.child('GraphQL WS').child(hash);
|
@@ -37,6 +46,7 @@ exports.default = {
|
|
37
46
|
lazy: true,
|
38
47
|
lazyCloseTimeout: 3_000,
|
39
48
|
...transportEntry.options,
|
49
|
+
headers,
|
40
50
|
connectionParams,
|
41
51
|
on: {
|
42
52
|
connecting(isRetry) {
|
package/esm/index.js
CHANGED
@@ -19,6 +19,9 @@ export default {
|
|
19
19
|
const connectionParamsFactory = transportEntry.options.connectionParams
|
20
20
|
? getInterpolatedHeadersFactory(transportEntry.options.connectionParams)
|
21
21
|
: undefined;
|
22
|
+
const headersFactory = transportEntry.headers
|
23
|
+
? getInterpolatedHeadersFactory(Object.fromEntries(transportEntry.headers))
|
24
|
+
: undefined;
|
22
25
|
const mergedExecutor = function mergedExecutor(execReq) {
|
23
26
|
const connectionParams = connectionParamsFactory?.({
|
24
27
|
env: process.env,
|
@@ -26,7 +29,13 @@ export default {
|
|
26
29
|
context: execReq.context,
|
27
30
|
info: execReq.info,
|
28
31
|
});
|
29
|
-
const
|
32
|
+
const headers = headersFactory?.({
|
33
|
+
env: process.env,
|
34
|
+
root: execReq.rootValue,
|
35
|
+
context: execReq.context,
|
36
|
+
info: execReq.info,
|
37
|
+
});
|
38
|
+
const hash = `${wsUrl}?connectionParams=${JSON.stringify(connectionParams)}&headers=${JSON.stringify(headers)}`;
|
30
39
|
let wsExecutor = wsExecutorMap.get(hash);
|
31
40
|
if (!wsExecutor) {
|
32
41
|
const executorLogger = logger.child('GraphQL WS').child(hash);
|
@@ -35,6 +44,7 @@ export default {
|
|
35
44
|
lazy: true,
|
36
45
|
lazyCloseTimeout: 3_000,
|
37
46
|
...transportEntry.options,
|
47
|
+
headers,
|
38
48
|
connectionParams,
|
39
49
|
on: {
|
40
50
|
connecting(isRetry) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-mesh/transport-ws",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.0-alpha-20240926192138-324615c9ddfa15a9d779f0826ebe608f64b98391",
|
4
4
|
"sideEffects": false,
|
5
5
|
"peerDependencies": {
|
6
6
|
"graphql": "*",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"@graphql-mesh/string-interpolation": "^0.5.6",
|
12
12
|
"@graphql-mesh/transport-common": "^0.7.6",
|
13
13
|
"@graphql-mesh/utils": "^0.102.5",
|
14
|
-
"@graphql-tools/executor-graphql-ws": "1.
|
14
|
+
"@graphql-tools/executor-graphql-ws": "^1.3.0",
|
15
15
|
"@graphql-tools/utils": "^10.5.3",
|
16
16
|
"graphql-ws": "^5.16.0",
|
17
17
|
"ws": "^8.18.0"
|