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

@graphql-tools/executor-common

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.1-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202 to 0.0.1-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd

28

CHANGELOG.md
# @graphql-tools/executor-common
## 0.0.1-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202
## 0.0.1-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd
### Patch Changes
- [#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.
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`55eb1b4`](https://github.com/graphql-hive/gateway/commit/55eb1b4d14aec7b3e6c7bcf9f596bc01192d022c) Thanks [@ardatan](https://github.com/ardatan)! - This is a bugfix with some internal changes, no user action is needed. This bugfix and improvement is done to improve the stability of some components of the gateway;
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.

@@ -12,1 +14,23 @@ 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.
For example instead of using `print`, you should use `defaultPrintFn` that memoizes `print` operation and also used the string version of it parsed before by Envelop/Yoga.
```diff
-import { print } from 'graphql';
-const query = print(parsedQuery);
+import { defaultPrintFn } from '@graphql-tools/executor-common';
+const query = defaultPrintFn(parsedQuery);
```
Or instead of creating objects from `ExecutionRequest`, use `serializeExecutionRequest` helper.
```diff
-const serializedRequest = {
- query: print(executionRequest.document),
- variables: executionRequest.variables,
- operationName: executionRequest.operationName,
- extensions: executionRequest.extensions,
-};
+import { serializeExecutionRequest } from '@graphql-tools/executor-common';
+const serializedRequest = serializeExecutionRequest(executionRequest);
```

2

package.json
{
"name": "@graphql-tools/executor-common",
"version": "0.0.1-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202",
"version": "0.0.1-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd",
"type": "module",

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

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