Skip to content

Commit

Permalink
expose VariableValues
Browse files Browse the repository at this point in the history
breaking change, have to do it in v17 or would have to wait until v18
  • Loading branch information
yaacovCR committed Sep 25, 2024
1 parent 4e43409 commit 224ab1e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/execution/__tests__/executor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
},
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ export function buildResolveInfo(
),
rootValue: exeContext.rootValue,
operation: exeContext.operation,
variableValues: exeContext.variableValues.coerced,
variableValues: exeContext.variableValues,
};
}

Expand Down
4 changes: 3 additions & 1 deletion src/type/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -897,7 +899,7 @@ export interface GraphQLResolveInfo {
readonly fragments: ObjMap<FragmentDefinitionNode>;
readonly rootValue: unknown;
readonly operation: OperationDefinitionNode;
readonly variableValues: { [variable: string]: unknown };
readonly variableValues: VariableValues;
}

/**
Expand Down

0 comments on commit 224ab1e

Please sign in to comment.