@graphql-mesh/hmac-upstream-signature 1.2.18-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058 → 1.2.19-alpha-73dbe3a2dabb6b84105c4dac3586696daa3d4fcb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # @graphql-mesh/hmac-upstream-signature
2
2
 
3
- ## 1.2.18-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058
3
+ ## 1.2.19-alpha-73dbe3a2dabb6b84105c4dac3586696daa3d4fcb
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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.
8
+ 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.
9
+ For example, it was working as expected in Proxy mode, but not working as expected in Federation Gateway mode.
10
+
11
+ 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.
12
+
13
+ ## 1.2.18
4
14
 
5
15
  ### Patch Changes
6
16
 
@@ -9,7 +19,7 @@
9
19
  - Updated dependency [`@graphql-tools/utils@^10.7.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.7.0) (from `^10.6.2`, in `dependencies`)
10
20
 
11
21
  - Updated dependencies [[`e606975`](https://github.com/graphql-hive/gateway/commit/e60697593290255fb9ac407e591ae3e8cb752df2), [`15975c2`](https://github.com/graphql-hive/gateway/commit/15975c28daddbb4f31d520371f53520aecacaac7)]:
12
- - @graphql-mesh/transport-common@0.7.24-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058
22
+ - @graphql-mesh/transport-common@0.7.24
13
23
 
14
24
  ## 1.2.17
15
25
 
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var transportCommon = require('@graphql-mesh/transport-common');
3
+ var executorCommon = require('@graphql-tools/executor-common');
4
4
  var utils = require('@graphql-tools/utils');
5
5
  var jsonStableStringify = require('json-stable-stringify');
6
6
 
@@ -10,13 +10,17 @@ var jsonStableStringify__default = /*#__PURE__*/_interopDefault(jsonStableString
10
10
 
11
11
  const DEFAULT_EXTENSION_NAME = "hmac-signature";
12
12
  const DEFAULT_SHOULD_SIGN_FN = () => true;
13
- const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify__default.default({
14
- query: transportCommon.defaultPrintFn(executionRequest.document),
15
- variables: executionRequest.variables
16
- });
13
+ const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify__default.default(
14
+ executorCommon.executionRequestToGraphQLParams({
15
+ executionRequest: {
16
+ document: executionRequest.document,
17
+ variables: executionRequest.variables
18
+ }
19
+ })
20
+ );
17
21
  const defaultParamsSerializer = (params) => jsonStableStringify__default.default({
18
22
  query: params.query,
19
- variables: params.variables
23
+ variables: params.variables != null && Object.keys(params.variables).length > 0 ? params.variables : void 0
20
24
  });
21
25
  function createCryptoKey({
22
26
  textEncoder,
package/dist/index.d.cts CHANGED
@@ -1,11 +1,18 @@
1
1
  import { ExecutionRequest, Executor, ExecutionResult, MaybePromise, Maybe } from '@graphql-tools/utils';
2
2
  import { Plugin, YogaInitialContext, GraphQLParams } from 'graphql-yoga';
3
- import { TransportEntry } from '@graphql-mesh/transport-common';
4
- import { Logger, OnFetchHook, MeshFetch, MeshPubSub, KeyValueCache } from '@graphql-mesh/types';
5
3
  import { GraphQLSchema, FragmentDefinitionNode, FieldNode, GraphQLResolveInfo, SelectionSetNode, GraphQLOutputType, GraphQLFieldResolver, OperationTypeNode, GraphQLError, SelectionNode, ExecutionResult as ExecutionResult$1 } from 'graphql';
4
+ import { Logger, OnFetchHook, MeshFetch, MeshPubSub, KeyValueCache } from '@graphql-mesh/types';
6
5
  import DataLoader from 'dataloader';
7
6
  import { GraphQLResolveInfo as GraphQLResolveInfo$1, GraphQLOutputType as GraphQLOutputType$1 } from 'graphql/type';
8
7
 
8
+ interface TransportEntry<Options extends Record<string, any> = Record<string, any>> {
9
+ kind: string;
10
+ subgraph: string;
11
+ location?: string;
12
+ headers?: [string, string][];
13
+ options?: Options;
14
+ }
15
+
9
16
  type SchemaTransform<TContext = Record<any, string>> = (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>) => GraphQLSchema;
10
17
  type RequestTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest;
11
18
  type ResultTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  import { ExecutionRequest, Executor, ExecutionResult, MaybePromise, Maybe } from '@graphql-tools/utils';
2
2
  import { Plugin, YogaInitialContext, GraphQLParams } from 'graphql-yoga';
3
- import { TransportEntry } from '@graphql-mesh/transport-common';
4
- import { Logger, OnFetchHook, MeshFetch, MeshPubSub, KeyValueCache } from '@graphql-mesh/types';
5
3
  import { GraphQLSchema, FragmentDefinitionNode, FieldNode, GraphQLResolveInfo, SelectionSetNode, GraphQLOutputType, GraphQLFieldResolver, OperationTypeNode, GraphQLError, SelectionNode, ExecutionResult as ExecutionResult$1 } from 'graphql';
4
+ import { Logger, OnFetchHook, MeshFetch, MeshPubSub, KeyValueCache } from '@graphql-mesh/types';
6
5
  import DataLoader from 'dataloader';
7
6
  import { GraphQLResolveInfo as GraphQLResolveInfo$1, GraphQLOutputType as GraphQLOutputType$1 } from 'graphql/type';
8
7
 
8
+ interface TransportEntry<Options extends Record<string, any> = Record<string, any>> {
9
+ kind: string;
10
+ subgraph: string;
11
+ location?: string;
12
+ headers?: [string, string][];
13
+ options?: Options;
14
+ }
15
+
9
16
  type SchemaTransform<TContext = Record<any, string>> = (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>) => GraphQLSchema;
10
17
  type RequestTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest;
11
18
  type ResultTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult;
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
- import { defaultPrintFn } from '@graphql-mesh/transport-common';
1
+ import { executionRequestToGraphQLParams } from '@graphql-tools/executor-common';
2
2
  import { mapMaybePromise } from '@graphql-tools/utils';
3
3
  import jsonStableStringify from 'json-stable-stringify';
4
4
 
5
5
  const DEFAULT_EXTENSION_NAME = "hmac-signature";
6
6
  const DEFAULT_SHOULD_SIGN_FN = () => true;
7
- const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify({
8
- query: defaultPrintFn(executionRequest.document),
9
- variables: executionRequest.variables
10
- });
7
+ const defaultExecutionRequestSerializer = (executionRequest) => jsonStableStringify(
8
+ executionRequestToGraphQLParams({
9
+ executionRequest: {
10
+ document: executionRequest.document,
11
+ variables: executionRequest.variables
12
+ }
13
+ })
14
+ );
11
15
  const defaultParamsSerializer = (params) => jsonStableStringify({
12
16
  query: params.query,
13
- variables: params.variables
17
+ variables: params.variables != null && Object.keys(params.variables).length > 0 ? params.variables : void 0
14
18
  });
15
19
  function createCryptoKey({
16
20
  textEncoder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/hmac-upstream-signature",
3
- "version": "1.2.18-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058",
3
+ "version": "1.2.19-alpha-73dbe3a2dabb6b84105c4dac3586696daa3d4fcb",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@graphql-mesh/cross-helpers": "^0.4.9",
46
- "@graphql-mesh/transport-common": "0.7.24-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058",
47
46
  "@graphql-mesh/types": "^0.103.6",
48
47
  "@graphql-mesh/utils": "^0.103.6",
48
+ "@graphql-tools/executor-common": "^0.0.0",
49
49
  "@graphql-tools/utils": "^10.7.0",
50
50
  "json-stable-stringify": "^1.1.1",
51
51
  "tslib": "^2.8.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@graphql-hive/gateway": "1.7.3-rc-81e14e92bfa84c052ad669d5dd6db7a839f65058",
54
+ "@graphql-hive/gateway": "1.7.4-alpha-73dbe3a2dabb6b84105c4dac3586696daa3d4fcb",
55
55
  "@types/json-stable-stringify": "^1.1.0",
56
56
  "graphql": "^16.9.0",
57
57
  "graphql-yoga": "^5.10.6",