From 224ab1e63a628881704279c683941de75a00e379 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Wed, 25 Sep 2024 16:00:09 +0300 Subject: [PATCH] expose VariableValues breaking change, have to do it in v17 or would have to wait until v18 --- src/execution/__tests__/executor-test.ts | 14 +++++++++++++- src/execution/execute.ts | 2 +- src/type/definition.ts | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/execution/__tests__/executor-test.ts b/src/execution/__tests__/executor-test.ts index 6cb6858e46..aa84f7cc94 100644 --- a/src/execution/__tests__/executor-test.ts +++ b/src/execution/__tests__/executor-test.ts @@ -240,7 +240,19 @@ describe('Execute: Handles basic execution tasks', () => { expect(resolvedInfo).to.deep.include({ fieldNodes: [field], path: { prev: undefined, key: 'result', typename: 'Test' }, - variableValues: { var: 'abc' }, + variableValues: { + sources: { + var: { + signature: { + name: 'var', + type: GraphQLString, + defaultValue: undefined, + }, + value: 'abc', + }, + }, + coerced: { var: 'abc' }, + }, }); }); diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 939104c430..6909765041 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -843,7 +843,7 @@ export function buildResolveInfo( ), rootValue: exeContext.rootValue, operation: exeContext.operation, - variableValues: exeContext.variableValues.coerced, + variableValues: exeContext.variableValues, }; } diff --git a/src/type/definition.ts b/src/type/definition.ts index 4ebb5ae928..6ce4115a87 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -40,6 +40,8 @@ import type { import { Kind } from '../language/kinds.js'; import { print } from '../language/printer.js'; +import type { VariableValues } from '../execution/values.js'; + import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.js'; import { assertEnumValueName, assertName } from './assertName.js'; @@ -897,7 +899,7 @@ export interface GraphQLResolveInfo { readonly fragments: ObjMap; readonly rootValue: unknown; readonly operation: OperationDefinitionNode; - readonly variableValues: { [variable: string]: unknown }; + readonly variableValues: VariableValues; } /**