Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/executor-legacy-ws

Package Overview
Dependencies
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.0.1 to 1.0.2-alpha-20230906162118-0d524f64

10

cjs/index.js

@@ -5,5 +5,5 @@ "use strict";

const tslib_1 = require("tslib");
const utils_1 = require("@graphql-tools/utils");
const graphql_1 = require("graphql");
const isomorphic_ws_1 = tslib_1.__importDefault(require("isomorphic-ws"));
const utils_1 = require("@graphql-tools/utils");
var LEGACY_WS;

@@ -23,2 +23,3 @@ (function (LEGACY_WS) {

function buildWSLegacyExecutor(subscriptionsEndpoint, WebSocketImpl, options) {
let executorConnectionParams = {};
let websocket = null;

@@ -43,2 +44,3 @@ const ensureWebsocket = (errorHandler = err => console.error(err)) => {

}
payload = Object.assign(payload, executorConnectionParams);
websocket.send(JSON.stringify({

@@ -71,2 +73,8 @@ type: LEGACY_WS.CONNECTION_INIT,

return function legacyExecutor(request) {
// additional connection params can be supplied through the "connectionParams" field in extensions.
// TODO: connection params only from the FIRST operation in lazy mode will be used (detect connectionParams changes and reconnect, too implicit?)
if (request.extensions?.['connectionParams'] &&
typeof request.extensions?.['connectionParams'] === 'object') {
executorConnectionParams = Object.assign(executorConnectionParams, request.extensions['connectionParams']);
}
const id = Date.now().toString();

@@ -73,0 +81,0 @@ return (0, utils_1.observableToAsyncIterable)({

@@ -1,4 +0,4 @@

import { observableToAsyncIterable } from '@graphql-tools/utils';
import { print } from 'graphql';
import WebSocket from 'isomorphic-ws';
import { observableToAsyncIterable } from '@graphql-tools/utils';
export var LEGACY_WS;

@@ -18,2 +18,3 @@ (function (LEGACY_WS) {

export function buildWSLegacyExecutor(subscriptionsEndpoint, WebSocketImpl, options) {
let executorConnectionParams = {};
let websocket = null;

@@ -38,2 +39,3 @@ const ensureWebsocket = (errorHandler = err => console.error(err)) => {

}
payload = Object.assign(payload, executorConnectionParams);
websocket.send(JSON.stringify({

@@ -66,2 +68,8 @@ type: LEGACY_WS.CONNECTION_INIT,

return function legacyExecutor(request) {
// additional connection params can be supplied through the "connectionParams" field in extensions.
// TODO: connection params only from the FIRST operation in lazy mode will be used (detect connectionParams changes and reconnect, too implicit?)
if (request.extensions?.['connectionParams'] &&
typeof request.extensions?.['connectionParams'] === 'object') {
executorConnectionParams = Object.assign(executorConnectionParams, request.extensions['connectionParams']);
}
const id = Date.now().toString();

@@ -68,0 +76,0 @@ return observableToAsyncIterable({

8

package.json
{
"name": "@graphql-tools/executor-legacy-ws",
"version": "1.0.1",
"version": "1.0.2-alpha-20230906162118-0d524f64",
"description": "A set of utils for faster development of GraphQL tools",

@@ -10,7 +10,7 @@ "sideEffects": false,

"dependencies": {
"@graphql-tools/utils": "^10.0.0",
"@types/ws": "^8.0.0",
"@graphql-tools/utils": "^10.0.0",
"isomorphic-ws": "5.0.0",
"ws": "8.13.0",
"tslib": "^2.4.0"
"tslib": "^2.4.0",
"ws": "8.14.0"
},

@@ -17,0 +17,0 @@ "repository": {

/// <reference types="ws" />
import WebSocket from 'isomorphic-ws';
import { Executor } from '@graphql-tools/utils';
import WebSocket from 'isomorphic-ws';
export declare enum LEGACY_WS {

@@ -17,5 +17,5 @@ CONNECTION_INIT = "connection_init",

export interface LegacyWSExecutorOpts {
connectionParams?: Record<string, any>;
connectionParams?: Record<string, unknown> | (() => Record<string, unknown>);
headers?: Record<string, any>;
}
export declare function buildWSLegacyExecutor(subscriptionsEndpoint: string, WebSocketImpl: typeof WebSocket, options?: LegacyWSExecutorOpts): Executor;

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