@graphql-tools/delegate 9.0.18-alpha-20221207043740-d7efc77d → 9.0.18

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.
@@ -122,12 +122,21 @@ function addVariablesToRootFields(targetSchema, operations, args) {
122
122
  };
123
123
  }
124
124
  function updateArguments(targetField, argumentNodeMap, variableDefinitionMap, variableValues, newArgs) {
125
+ var _a;
125
126
  const generateVariableName = (0, utils_1.createVariableNameGenerator)(variableDefinitionMap);
126
127
  for (const argument of targetField.args) {
127
128
  const argName = argument.name;
128
129
  const argType = argument.type;
129
130
  if (argName in newArgs) {
130
- (0, utils_1.updateArgument)(argumentNodeMap, variableDefinitionMap, variableValues, argName, generateVariableName(argName), argType, (0, utils_1.serializeInputValue)(argType, newArgs[argName]));
131
+ let value;
132
+ const existingValueNode = (_a = argumentNodeMap[argName]) === null || _a === void 0 ? void 0 : _a.value;
133
+ if (existingValueNode != null) {
134
+ value = (0, graphql_1.valueFromAST)(existingValueNode, argType, variableValues);
135
+ }
136
+ if (value == null) {
137
+ value = (0, utils_1.serializeInputValue)(argType, newArgs[argName]);
138
+ }
139
+ (0, utils_1.updateArgument)(argumentNodeMap, variableDefinitionMap, variableValues, argName, generateVariableName(argName), argType, value);
131
140
  }
132
141
  }
133
142
  }
@@ -1,4 +1,4 @@
1
- import { getNamedType, isAbstractType, isInterfaceType, isObjectType, Kind, TypeInfo, TypeNameMetaFieldDef, versionInfo as graphqlVersionInfo, visit, visitWithTypeInfo, } from 'graphql';
1
+ import { getNamedType, isAbstractType, isInterfaceType, isObjectType, Kind, TypeInfo, TypeNameMetaFieldDef, valueFromAST, versionInfo as graphqlVersionInfo, visit, visitWithTypeInfo, } from 'graphql';
2
2
  import { getDefinedRootType, serializeInputValue, updateArgument, createVariableNameGenerator, implementsAbstractType, inspect, } from '@graphql-tools/utils';
3
3
  import { getDocumentMetadata } from './getDocumentMetadata.js';
4
4
  function finalizeGatewayDocument(targetSchema, fragments, operations) {
@@ -118,12 +118,21 @@ function addVariablesToRootFields(targetSchema, operations, args) {
118
118
  };
119
119
  }
120
120
  function updateArguments(targetField, argumentNodeMap, variableDefinitionMap, variableValues, newArgs) {
121
+ var _a;
121
122
  const generateVariableName = createVariableNameGenerator(variableDefinitionMap);
122
123
  for (const argument of targetField.args) {
123
124
  const argName = argument.name;
124
125
  const argType = argument.type;
125
126
  if (argName in newArgs) {
126
- updateArgument(argumentNodeMap, variableDefinitionMap, variableValues, argName, generateVariableName(argName), argType, serializeInputValue(argType, newArgs[argName]));
127
+ let value;
128
+ const existingValueNode = (_a = argumentNodeMap[argName]) === null || _a === void 0 ? void 0 : _a.value;
129
+ if (existingValueNode != null) {
130
+ value = valueFromAST(existingValueNode, argType, variableValues);
131
+ }
132
+ if (value == null) {
133
+ value = serializeInputValue(argType, newArgs[argName]);
134
+ }
135
+ updateArgument(argumentNodeMap, variableDefinitionMap, variableValues, argName, generateVariableName(argName), argType, value);
127
136
  }
128
137
  }
129
138
  }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "9.0.18-alpha-20221207043740-d7efc77d",
3
+ "version": "9.0.18",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-tools/batch-execute": "8.5.12",
11
- "@graphql-tools/executor": "0.0.9",
12
- "@graphql-tools/schema": "9.0.10",
13
- "@graphql-tools/utils": "9.1.1",
10
+ "@graphql-tools/batch-execute": "8.5.13",
11
+ "@graphql-tools/executor": "0.0.10",
12
+ "@graphql-tools/schema": "9.0.11",
13
+ "@graphql-tools/utils": "9.1.2",
14
14
  "dataloader": "2.1.0",
15
15
  "tslib": "~2.4.0",
16
16
  "value-or-promise": "1.0.11"