@graphql-tools/delegate 12.0.2 → 12.0.3-alpha-00280152c16b87d5e9e83a122ce3477b4f9f5b66

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,5 +1,64 @@
1
1
  # @graphql-tools/delegate
2
2
 
3
+ ## 12.0.3-alpha-00280152c16b87d5e9e83a122ce3477b4f9f5b66
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#1835](https://github.com/graphql-hive/gateway/pull/1835) [`0028015`](https://github.com/graphql-hive/gateway/commit/00280152c16b87d5e9e83a122ce3477b4f9f5b66) Thanks [@ardatan](https://github.com/ardatan)! - Delegate variable values correctly;
9
+
10
+ When delegating requests with variables that include nested arrays, ensure that null values are preserved and passed correctly to the subschema. This fix addresses issues where null values in nested arrays were not handled properly during delegation.
11
+
12
+ Let's say we have the following schema;
13
+
14
+ ```ts
15
+ makeExecutableSchema({
16
+ typeDefs: /* GraphQL */ `
17
+ type Query {
18
+ test(input: InputType!): [String!]
19
+ }
20
+ input InputType {
21
+ value: [String!]
22
+ }
23
+ `,
24
+ resolvers: {
25
+ Query: {
26
+ test: (_parent, args, _ctx, info) => {
27
+ console.log(print(info.operation), info.variableValues)
28
+ return args.input.value;
29
+ },
30
+ },
31
+ }
32
+ });
33
+ ```
34
+
35
+ When delegating a query with a variable like:
36
+
37
+ ```json
38
+ {
39
+ "query": "query Test($value: [String!]) { test(input: { value: $value } ) }",
40
+ "variables": { "value": null }
41
+ }
42
+ ```
43
+
44
+ And the result was
45
+ ```json
46
+ {
47
+ "data": {
48
+ "test": []
49
+ }
50
+ }
51
+ ```
52
+
53
+ But with this fix, the result will correctly be:
54
+ ```json
55
+ {
56
+ "data": {
57
+ "test": null
58
+ }
59
+ }
60
+ ```
61
+
3
62
  ## 12.0.2
4
63
  ### Patch Changes
5
64
 
package/dist/index.cjs CHANGED
@@ -1883,6 +1883,9 @@ function createRequest({
1883
1883
  };
1884
1884
  }
1885
1885
  function projectArgumentValue(argValue, argType) {
1886
+ if (argValue == null) {
1887
+ return argValue;
1888
+ }
1886
1889
  if (graphql.isNonNullType(argType)) {
1887
1890
  return projectArgumentValue(argValue, argType.ofType);
1888
1891
  }
package/dist/index.js CHANGED
@@ -1883,6 +1883,9 @@ function createRequest({
1883
1883
  };
1884
1884
  }
1885
1885
  function projectArgumentValue(argValue, argType) {
1886
+ if (argValue == null) {
1887
+ return argValue;
1888
+ }
1886
1889
  if (isNonNullType(argType)) {
1887
1890
  return projectArgumentValue(argValue, argType.ofType);
1888
1891
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "12.0.2",
3
+ "version": "12.0.3-alpha-00280152c16b87d5e9e83a122ce3477b4f9f5b66",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {