@graphql-tools/executor-graphql-ws
Advanced tools
Comparing version
# @graphql-tools/executor-graphql-ws | ||
## 1.3.7-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19 | ||
### Patch Changes | ||
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`e31d79c`](https://github.com/graphql-hive/gateway/commit/e31d79c704014d5180074bdb3ce11dcd1675eb58) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates: | ||
- Added dependency [`@graphql-tools/executor-common@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor-common/v/workspace:^) (to `dependencies`) | ||
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`73dbe3a`](https://github.com/graphql-hive/gateway/commit/73dbe3a2dabb6b84105c4dac3586696daa3d4fcb) Thanks [@ardatan](https://github.com/ardatan)! - Like HMAC Upstream Signature plugin, different components of the gateway were using different ways of serializing the execution request. | ||
Some of them were ignoring `variables` if it is empty, some of not, this was causing the signature generation to be different for the same query. | ||
For example, it was working as expected in Proxy mode, but not working as expected in Federation Gateway mode. | ||
With this change, now we have a shared helper to serialize the upstream execution request with a memoized `print` function for query AST etc to have a consistent serialization so consistent signature generation for HMAC. | ||
- Updated dependencies [[`73dbe3a`](https://github.com/graphql-hive/gateway/commit/73dbe3a2dabb6b84105c4dac3586696daa3d4fcb)]: | ||
- @graphql-tools/executor-common@0.0.1-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19 | ||
## 1.3.6 | ||
@@ -4,0 +21,0 @@ |
@@ -1,8 +0,7 @@ | ||
import { memoize1, getOperationASTFromRequest, registerAbortSignalListener } from '@graphql-tools/utils'; | ||
import { serializeExecutionRequest, defaultPrintFn } from '@graphql-tools/executor-common'; | ||
import { getOperationASTFromRequest, registerAbortSignalListener } from '@graphql-tools/utils'; | ||
import { DisposableSymbols } from '@whatwg-node/disposablestack'; | ||
import { print } from 'graphql'; | ||
import { createClient } from 'graphql-ws'; | ||
import WebSocket from 'isomorphic-ws'; | ||
const defaultPrintFn = memoize1(print); | ||
function isClient(client) { | ||
@@ -43,5 +42,2 @@ return "subscribe" in client; | ||
const { | ||
document, | ||
variables, | ||
operationName, | ||
extensions, | ||
@@ -58,9 +54,5 @@ operationType = getOperationASTFromRequest(executionRequest).operation, | ||
} | ||
const query = printFn(document); | ||
const iterableIterator = graphqlWSClient.iterate({ | ||
query, | ||
variables, | ||
operationName, | ||
extensions | ||
}); | ||
const iterableIterator = graphqlWSClient.iterate( | ||
serializeExecutionRequest({ executionRequest, printFn }) | ||
); | ||
if (iterableIterator.return && signal) { | ||
@@ -67,0 +59,0 @@ registerAbortSignalListener(signal, () => { |
{ | ||
"name": "@graphql-tools/executor-graphql-ws", | ||
"version": "1.3.6", | ||
"version": "1.3.7-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19", | ||
"type": "module", | ||
@@ -42,2 +42,3 @@ "description": "A set of utils for faster development of GraphQL tools", | ||
"dependencies": { | ||
"@graphql-tools/executor-common": "0.0.1-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19", | ||
"@graphql-tools/utils": "^10.7.0", | ||
@@ -44,0 +45,0 @@ "@whatwg-node/disposablestack": "^0.0.5", |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
21057
7.6%8
14.29%163
-8.94%2
100%+ Added
+ Added
+ Added
+ Added
+ Added