Socket
Socket
Sign inDemoInstall

@graphql-tools/executor-graphql-ws

Package Overview
Dependencies
Maintainers
0
Versions
146
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 1.2.0-alpha-20240705100208-2c45d68202694271ec429328237d4eee506d251e to 1.2.0-alpha-20240705110827-1fef94a25ba18b5ae498ae9aa88fde050ae610cd

12

cjs/index.js

@@ -9,2 +9,3 @@ "use strict";

const utils_1 = require("@graphql-tools/utils");
const defaultPrintFn = (0, utils_1.memoize1)(graphql_1.print);
function isClient(client) {

@@ -16,2 +17,3 @@ return 'subscribe' in client;

let executorConnectionParams = {};
let printFn = defaultPrintFn;
if (isClient(clientOptionsOrClient)) {

@@ -21,2 +23,5 @@ graphqlWSClient = clientOptionsOrClient;

else {
if (clientOptionsOrClient.print) {
printFn = clientOptionsOrClient.print;
}
graphqlWSClient = (0, graphql_ws_1.createClient)({

@@ -44,3 +49,3 @@ ...clientOptionsOrClient,

}
const query = (0, graphql_1.print)(document);
const query = printFn(document);
const iterableIterator = graphqlWSClient.iterate({

@@ -57,7 +62,8 @@ query,

};
executor[Symbol.asyncDispose] = function disposeWS() {
const disposableExecutor = executor;
disposableExecutor[Symbol.asyncDispose] = function disposeWS() {
return graphqlWSClient.dispose();
};
return executor;
return disposableExecutor;
}
exports.buildGraphQLWSExecutor = buildGraphQLWSExecutor;
import { print } from 'graphql';
import { createClient } from 'graphql-ws';
import WebSocket from 'isomorphic-ws';
import { getOperationASTFromRequest, } from '@graphql-tools/utils';
import { getOperationASTFromRequest, memoize1, } from '@graphql-tools/utils';
const defaultPrintFn = memoize1(print);
function isClient(client) {

@@ -11,2 +12,3 @@ return 'subscribe' in client;

let executorConnectionParams = {};
let printFn = defaultPrintFn;
if (isClient(clientOptionsOrClient)) {

@@ -16,2 +18,5 @@ graphqlWSClient = clientOptionsOrClient;

else {
if (clientOptionsOrClient.print) {
printFn = clientOptionsOrClient.print;
}
graphqlWSClient = createClient({

@@ -39,3 +44,3 @@ ...clientOptionsOrClient,

}
const query = print(document);
const query = printFn(document);
const iterableIterator = graphqlWSClient.iterate({

@@ -52,6 +57,7 @@ query,

};
executor[Symbol.asyncDispose] = function disposeWS() {
const disposableExecutor = executor;
disposableExecutor[Symbol.asyncDispose] = function disposeWS() {
return graphqlWSClient.dispose();
};
return executor;
return disposableExecutor;
}
{
"name": "@graphql-tools/executor-graphql-ws",
"version": "1.2.0-alpha-20240705100208-2c45d68202694271ec429328237d4eee506d251e",
"version": "1.2.0-alpha-20240705110827-1fef94a25ba18b5ae498ae9aa88fde050ae610cd",
"description": "A set of utils for faster development of GraphQL tools",

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

"dependencies": {
"@graphql-tools/utils": "10.3.0-alpha-20240705100208-2c45d68202694271ec429328237d4eee506d251e",
"@graphql-tools/utils": "10.3.0-alpha-20240705110827-1fef94a25ba18b5ae498ae9aa88fde050ae610cd",
"@types/ws": "^8.0.0",

@@ -13,0 +13,0 @@ "graphql-ws": "^5.14.0",

@@ -0,1 +1,2 @@

import { print } from 'graphql';
import { Client, ClientOptions } from 'graphql-ws';

@@ -5,4 +6,5 @@ import { DisposableExecutor } from '@graphql-tools/utils';

onClient?: (client: Client) => void;
print?: typeof print;
}
export declare function buildGraphQLWSExecutor(clientOptionsOrClient: GraphQLWSExecutorOptions | Client): DisposableExecutor;
export {};

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