New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/executor-graphql-ws

Package Overview
Dependencies
Maintainers
4
Versions
471
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/executor-graphql-ws - npm Package Compare versions

Comparing version 2.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc to 2.0.0-alpha-4c51bd8bb08df38e00c9d97ddb5d04633c181bce

29

CHANGELOG.md
# @graphql-tools/executor-graphql-ws
## 2.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc
## 2.0.0-alpha-4c51bd8bb08df38e00c9d97ddb5d04633c181bce
### Major Changes
- [#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
- [#481](https://github.com/graphql-hive/gateway/pull/481) [`ddc90f3`](https://github.com/graphql-hive/gateway/commit/ddc90f330beb5551df50abf26b0a07d5c4d4f0b4) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Executor options don't exist graphql-ws dependency options
Removing the dependency on the types. Some options are still exposed, but if you want to further customise the graphql-ws client, you should pass your own instance of the client instead.
```ts
import { buildGraphQLWSExecutor } from '@graphql-tools/executor-graphql-ws';
import { createClient } from 'graphql-ws';
import { options } from './my-graphql-ws-client-options';
const executor = buildGraphQLWSExecutor(
createClient({
url: 'ws://localhost:4000/graphql',
...options,
}),
);
```
- [#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
If you have a custom graphql-ws configuration when building the executor with `buildGraphQLWSExecutor`, 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)
### Minor Changes
- [#481](https://github.com/graphql-hive/gateway/pull/481) [`ddc90f3`](https://github.com/graphql-hive/gateway/commit/ddc90f330beb5551df50abf26b0a07d5c4d4f0b4) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Export GraphQLWSExecutorOptions type
### Patch Changes
- [#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:
- [#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:
- Updated dependency [`graphql-ws@^6.0.1` ↗︎](https://www.npmjs.com/package/graphql-ws/v/6.0.1) (from `^5.14.0`, in `dependencies`)
- Updated dependency [`graphql-ws@^6.0.2` ↗︎](https://www.npmjs.com/package/graphql-ws/v/6.0.2) (from `^5.14.0`, in `dependencies`)

@@ -17,0 +38,0 @@ ## 1.3.7

import { DisposableAsyncExecutor } from '@graphql-tools/utils';
import { print } from 'graphql';
import { Client, ClientOptions } from 'graphql-ws';
import { Client } from 'graphql-ws';
interface GraphQLWSExecutorOptions extends ClientOptions {
interface GraphQLWSExecutorOptions {
onClient?: (client: Client) => void;
print?: typeof print;
/** The URL of the WebSocket server to connect to. */
url: string;
/**

@@ -15,5 +17,25 @@ * Additional headers to include with the upgrade request.

headers?: Record<string, string>;
/**
* Optional parameters, passed through the `payload` field with the `ConnectionInit` message,
* that the client specifies when establishing a connection with the server. You can use this
* for securely passing arguments for authentication.
*/
connectionParams?: Record<string, unknown> | (() => Record<string, unknown>);
/**
* How to establish the connection to the server, on-demand or eagerly.
*
* @default true
*/
lazy?: boolean;
/**
* How long should the client wait before closing the socket after the last operation has
* completed. This is meant to be used in combination with `lazy`. You might want to have
* a calmdown time before actually closing the connection. Kinda' like a lazy close "debounce".
*
* @default 0
*/
lazyCloseTimeout?: number;
}
declare function buildGraphQLWSExecutor(clientOptionsOrClient: GraphQLWSExecutorOptions | Client): DisposableAsyncExecutor;
export { buildGraphQLWSExecutor };
export { type GraphQLWSExecutorOptions, buildGraphQLWSExecutor };

9

dist/index.js

@@ -20,13 +20,12 @@ import { serializeExecutionRequest, defaultPrintFn } from '@graphql-tools/executor-common';

}
const webSocketImpl = clientOptionsOrClient.headers ? class WebSocketWithHeaders extends WebSocket {
const headers = clientOptionsOrClient.headers;
const webSocketImpl = headers ? class WebSocketWithHeaders extends WebSocket {
constructor(url, protocol) {
super(url, protocol, {
headers: clientOptionsOrClient.headers
});
super(url, protocol, { headers });
}
} : WebSocket;
graphqlWSClient = createClient({
url: clientOptionsOrClient.url,
webSocketImpl,
lazy: true,
...clientOptionsOrClient,
connectionParams: () => {

@@ -33,0 +32,0 @@ const optionsConnectionParams = (typeof clientOptionsOrClient.connectionParams === "function" ? clientOptionsOrClient.connectionParams() : clientOptionsOrClient.connectionParams) || {};

{
"name": "@graphql-tools/executor-graphql-ws",
"version": "2.0.0-alpha-3280cb5550288831bfd63abd59265cd5bbac5fcc",
"version": "2.0.0-alpha-4c51bd8bb08df38e00c9d97ddb5d04633c181bce",
"type": "module",

@@ -45,3 +45,3 @@ "description": "A set of utils for faster development of GraphQL tools",

"@whatwg-node/disposablestack": "^0.0.5",
"graphql-ws": "^6.0.1",
"graphql-ws": "^6.0.2",
"isomorphic-ws": "^5.0.0",

@@ -48,0 +48,0 @@ "tslib": "^2.8.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc