@graphql-tools/executor-graphql-ws 1.2.1 → 1.3.0-alpha-20240925195618-76a963d2812a0cd2c8dab7afc36a51c77cbb0aad
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/cjs/index.js +10 -1
- package/esm/index.js +10 -1
- package/package.json +1 -1
- package/typings/index.d.cts +4 -0
- package/typings/index.d.ts +4 -0
package/cjs/index.js
CHANGED
|
@@ -21,8 +21,17 @@ function buildGraphQLWSExecutor(clientOptionsOrClient) {
|
|
|
21
21
|
if (clientOptionsOrClient.print) {
|
|
22
22
|
printFn = clientOptionsOrClient.print;
|
|
23
23
|
}
|
|
24
|
+
const webSocketImpl = clientOptionsOrClient.headers
|
|
25
|
+
? class WebSocketWithHeaders extends isomorphic_ws_1.default {
|
|
26
|
+
constructor(url, protocol) {
|
|
27
|
+
super(url, protocol, {
|
|
28
|
+
headers: clientOptionsOrClient.headers,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
: isomorphic_ws_1.default;
|
|
24
33
|
graphqlWSClient = (0, graphql_ws_1.createClient)({
|
|
25
|
-
webSocketImpl
|
|
34
|
+
webSocketImpl,
|
|
26
35
|
lazy: true,
|
|
27
36
|
...clientOptionsOrClient,
|
|
28
37
|
connectionParams: () => {
|
package/esm/index.js
CHANGED
|
@@ -17,8 +17,17 @@ export function buildGraphQLWSExecutor(clientOptionsOrClient) {
|
|
|
17
17
|
if (clientOptionsOrClient.print) {
|
|
18
18
|
printFn = clientOptionsOrClient.print;
|
|
19
19
|
}
|
|
20
|
+
const webSocketImpl = clientOptionsOrClient.headers
|
|
21
|
+
? class WebSocketWithHeaders extends WebSocket {
|
|
22
|
+
constructor(url, protocol) {
|
|
23
|
+
super(url, protocol, {
|
|
24
|
+
headers: clientOptionsOrClient.headers,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
: WebSocket;
|
|
20
29
|
graphqlWSClient = createClient({
|
|
21
|
-
webSocketImpl
|
|
30
|
+
webSocketImpl,
|
|
22
31
|
lazy: true,
|
|
23
32
|
...clientOptionsOrClient,
|
|
24
33
|
connectionParams: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/executor-graphql-ws",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-alpha-20240925195618-76a963d2812a0cd2c8dab7afc36a51c77cbb0aad",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
package/typings/index.d.cts
CHANGED
|
@@ -4,6 +4,10 @@ import { DisposableExecutor } from '@graphql-tools/utils';
|
|
|
4
4
|
interface GraphQLWSExecutorOptions extends ClientOptions {
|
|
5
5
|
onClient?: (client: Client) => void;
|
|
6
6
|
print?: typeof print;
|
|
7
|
+
/**
|
|
8
|
+
* Additional headers to include when querying the original schema
|
|
9
|
+
*/
|
|
10
|
+
headers?: Record<string, string>;
|
|
7
11
|
}
|
|
8
12
|
export declare function buildGraphQLWSExecutor(clientOptionsOrClient: GraphQLWSExecutorOptions | Client): DisposableExecutor;
|
|
9
13
|
export {};
|
package/typings/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { DisposableExecutor } from '@graphql-tools/utils';
|
|
|
4
4
|
interface GraphQLWSExecutorOptions extends ClientOptions {
|
|
5
5
|
onClient?: (client: Client) => void;
|
|
6
6
|
print?: typeof print;
|
|
7
|
+
/**
|
|
8
|
+
* Additional headers to include when querying the original schema
|
|
9
|
+
*/
|
|
10
|
+
headers?: Record<string, string>;
|
|
7
11
|
}
|
|
8
12
|
export declare function buildGraphQLWSExecutor(clientOptionsOrClient: GraphQLWSExecutorOptions | Client): DisposableExecutor;
|
|
9
13
|
export {};
|