Skip to content

Commit

Permalink
Mark user-provided 'variableValues' as read-only (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 28, 2019
1 parent 9b2e626 commit edd925b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/execution/execute.js
Expand Up @@ -116,7 +116,7 @@ export type ExecutionArgs = {|
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand Down Expand Up @@ -144,7 +144,7 @@ declare function execute(
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand Down Expand Up @@ -266,7 +266,7 @@ export function addPath(prev: ResponsePath | void, key: string | number) {
export function assertValidExecutionArguments(
schema: GraphQLSchema,
document: DocumentNode,
rawVariableValues: ?ObjMap<mixed>,
rawVariableValues: ?{ +[variable: string]: mixed, ... },
): void {
invariant(document, 'Must provide document');

Expand All @@ -291,7 +291,7 @@ export function buildExecutionContext(
document: DocumentNode,
rootValue: mixed,
contextValue: mixed,
rawVariableValues: ?ObjMap<mixed>,
rawVariableValues: ?{ +[variable: string]: mixed, ... },
operationName: ?string,
fieldResolver: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand Down
2 changes: 1 addition & 1 deletion src/execution/values.js
Expand Up @@ -41,7 +41,7 @@ type CoercedVariableValues = {|
export function getVariableValues(
schema: GraphQLSchema,
varDefNodes: $ReadOnlyArray<VariableDefinitionNode>,
inputs: ObjMap<mixed>,
inputs: { +[variable: string]: mixed, ... },
): CoercedVariableValues {
const errors = [];
const coercedValues = {};
Expand Down
6 changes: 3 additions & 3 deletions src/graphql.js
Expand Up @@ -57,7 +57,7 @@ export type GraphQLArgs = {|
source: string | Source,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand All @@ -69,7 +69,7 @@ declare function graphql(
source: Source | string,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand Down Expand Up @@ -118,7 +118,7 @@ declare function graphqlSync(
source: Source | string,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
typeResolver?: ?GraphQLTypeResolver<any, any>,
Expand Down
6 changes: 3 additions & 3 deletions src/subscription/subscribe.js
Expand Up @@ -28,7 +28,7 @@ export type SubscriptionArgs = {|
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: ?GraphQLFieldResolver<any, any>,
Expand Down Expand Up @@ -64,7 +64,7 @@ declare function subscribe(
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: ?GraphQLFieldResolver<any, any>,
Expand Down Expand Up @@ -187,7 +187,7 @@ export function createSourceEventStream(
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed, ... },
variableValues?: ?{ +[variable: string]: mixed, ... },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
): Promise<AsyncIterable<mixed> | ExecutionResult> {
Expand Down

0 comments on commit edd925b

Please sign in to comment.