@graphql-tools/executor-http
Advanced tools
Comparing version 1.2.2 to 1.2.3-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19
# @graphql-tools/executor-http | ||
## 1.2.3-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.2.2 | ||
@@ -4,0 +21,0 @@ |
@@ -83,8 +83,2 @@ import { ExecutionRequest, DisposableSyncExecutor, DisposableAsyncExecutor } from '@graphql-tools/utils'; | ||
} | ||
type SerializedRequest = { | ||
query?: string; | ||
variables?: Record<string, any>; | ||
operationName?: string; | ||
extensions?: any; | ||
}; | ||
type HeadersConfig = Record<string, string>; | ||
@@ -102,2 +96,2 @@ declare function buildHTTPExecutor(options?: Omit<HTTPExecutorOptions, 'fetch'> & { | ||
export { type AsyncFetchFn, type AsyncImportFn, type FetchFn, type HTTPExecutorOptions, type HeadersConfig, type RegularFetchFn, type SerializedRequest, type SyncFetchFn, type SyncImportFn, type SyncResponse, buildHTTPExecutor, isLiveQueryOperationDefinitionNode }; | ||
export { type AsyncFetchFn, type AsyncImportFn, type FetchFn, type HTTPExecutorOptions, type HeadersConfig, type RegularFetchFn, type SyncFetchFn, type SyncImportFn, type SyncResponse, buildHTTPExecutor, isLiveQueryOperationDefinitionNode }; |
import { abortSignalAny } from '@graphql-hive/gateway-abort-signal-any'; | ||
import { isAsyncIterable, isPromise, mapMaybePromise, memoize1, createGraphQLError, inspect, mapAsyncIterator, mergeIncrementalResult, getOperationASTFromRequest } from '@graphql-tools/utils'; | ||
import { defaultPrintFn, serializeExecutionRequest } from '@graphql-tools/executor-common'; | ||
import { isAsyncIterable, isPromise, mapMaybePromise, createGraphQLError, inspect, mapAsyncIterator, mergeIncrementalResult, memoize1, getOperationASTFromRequest } from '@graphql-tools/utils'; | ||
import { DisposableSymbols } from '@whatwg-node/disposablestack'; | ||
@@ -7,4 +8,4 @@ import { File, FormData, TextEncoder, crypto, TextDecoder, fetch } from '@whatwg-node/fetch'; | ||
import { extractFiles, isExtractableFile } from 'extract-files'; | ||
import { stripIgnoredCharacters, print, GraphQLError } from 'graphql'; | ||
import { Repeater } from '@repeaterjs/repeater'; | ||
import { GraphQLError } from 'graphql'; | ||
import { meros as meros$1 } from 'meros/browser'; | ||
@@ -123,6 +124,2 @@ import { meros } from 'meros/node'; | ||
const defaultPrintFn = memoize1(function defaultPrintFn2(document) { | ||
return stripIgnoredCharacters(print(document)); | ||
}); | ||
function createAbortErrorReason() { | ||
@@ -358,8 +355,7 @@ return new Error("Executor was disposed."); | ||
let serializeFn = function serialize() { | ||
return { | ||
query: excludeQuery ? void 0 : printFn(request.document), | ||
variables: (request.variables && Object.keys(request.variables).length) > 0 ? request.variables : void 0, | ||
operationName: request.operationName ? request.operationName : void 0, | ||
extensions: request.extensions && Object.keys(request.extensions).length > 0 ? request.extensions : void 0 | ||
}; | ||
return serializeExecutionRequest({ | ||
executionRequest: request, | ||
excludeQuery, | ||
printFn | ||
}); | ||
}; | ||
@@ -374,8 +370,10 @@ if (options?.apq) { | ||
}; | ||
return { | ||
query: excludeQuery ? void 0 : query, | ||
variables: (request.variables && Object.keys(request.variables).length) > 0 ? request.variables : void 0, | ||
operationName: request.operationName ? request.operationName : void 0, | ||
extensions | ||
}; | ||
return serializeExecutionRequest({ | ||
executionRequest: { | ||
...request, | ||
extensions | ||
}, | ||
excludeQuery, | ||
printFn | ||
}); | ||
}); | ||
@@ -382,0 +380,0 @@ }; |
{ | ||
"name": "@graphql-tools/executor-http", | ||
"version": "1.2.2", | ||
"version": "1.2.3-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19", | ||
"type": "module", | ||
@@ -43,2 +43,3 @@ "description": "A set of utils for faster development of GraphQL tools", | ||
"@graphql-hive/gateway-abort-signal-any": "^0.0.2", | ||
"@graphql-tools/executor-common": "0.0.1-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19", | ||
"@graphql-tools/utils": "^10.7.0", | ||
@@ -45,0 +46,0 @@ "@repeaterjs/repeater": "^3.0.4", |
Sorry, the diff of this file is not supported yet
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
73644
11
1338
2
+ Added@graphql-tools/executor-common@0.0.1-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19
+ Added@envelop/core@5.0.3(transitive)
+ Added@envelop/types@5.0.0(transitive)
+ Added@graphql-tools/executor-common@0.0.1-alpha-3df7faeea69a8bf7e4423f5661c1cb8974232f19(transitive)