@@ -193,9 +193,9 @@ function executeImpl(
193
193
// If arguments are missing or incorrect, throw an error.
194
194
assertValidExecutionArguments ( schema , document , variableValues ) ;
195
195
196
- // If a valid context cannot be created due to incorrect arguments,
196
+ // If a valid execution context cannot be created due to incorrect arguments,
197
197
// a "Response" with only errors is returned.
198
- const context = buildExecutionContext (
198
+ const exeContext = buildExecutionContext (
199
199
schema ,
200
200
document ,
201
201
rootValue ,
@@ -206,8 +206,8 @@ function executeImpl(
206
206
) ;
207
207
208
208
// Return early errors if execution context failed.
209
- if ( Array . isArray ( context ) ) {
210
- return { errors : context } ;
209
+ if ( Array . isArray ( exeContext ) ) {
210
+ return { errors : exeContext } ;
211
211
}
212
212
213
213
// Return a Promise that will eventually resolve to the data described by
@@ -217,24 +217,24 @@ function executeImpl(
217
217
// field and its descendants will be omitted, and sibling fields will still
218
218
// be executed. An execution which encounters errors will still result in a
219
219
// resolved Promise.
220
- const data = executeOperation(context, context .operation, rootValue);
221
- return buildResponse(context , data);
220
+ const data = executeOperation(exeContext, exeContext .operation, rootValue);
221
+ return buildResponse(exeContext , data);
222
222
}
223
223
224
224
/**
225
225
* Given a completed execution context and data, build the { errors, data }
226
226
* response defined by the "Response" section of the GraphQL specification.
227
227
*/
228
228
function buildResponse (
229
- context : ExecutionContext ,
229
+ exeContext : ExecutionContext ,
230
230
data : MaybePromise < ObjMap < mixed > | null> ,
231
231
) {
232
232
if ( isPromise ( data ) ) {
233
- return data . then ( resolved => buildResponse ( context , resolved ) ) ;
233
+ return data . then ( resolved => buildResponse ( exeContext , resolved ) ) ;
234
234
}
235
- return context .errors.length === 0
235
+ return exeContext .errors.length === 0
236
236
? { data }
237
- : { errors : context . errors , data } ;
237
+ : { errors : exeContext . errors , data } ;
238
238
}
239
239
240
240
/**
@@ -767,9 +767,9 @@ export function resolveFieldValueOrError<TSource>(
767
767
// The resolve function's optional third argument is a context value that
768
768
// is provided to every resolve function within an execution. It is commonly
769
769
// used to represent an authenticated user, or request-specific caches.
770
- const context = exeContext . contextValue ;
770
+ const contextValue = exeContext . contextValue ;
771
771
772
- const result = resolveFn ( source , args , context , info ) ;
772
+ const result = resolveFn ( source , args , contextValue , info ) ;
773
773
return isPromise ( result ) ? result . then ( undefined , asErrorInstance ) : result ;
774
774
} catch ( error ) {
775
775
return asErrorInstance ( error ) ;
@@ -1174,7 +1174,7 @@ function collectAndExecuteSubfields(
1174
1174
}
1175
1175
1176
1176
/**
1177
- * A memoized collection of relevant subfields in the context of the return
1177
+ * A memoized collection of relevant subfields with regard to the return
1178
1178
* type. Memoizing ensures the subfields are not repeatedly calculated, which
1179
1179
* saves overhead when resolving lists of values.
1180
1180
*/
@@ -1213,7 +1213,7 @@ function _collectSubfields(
1213
1213
*/
1214
1214
function defaultResolveTypeFn (
1215
1215
value : mixed ,
1216
- context : mixed ,
1216
+ contextValue : mixed ,
1217
1217
info : GraphQLResolveInfo ,
1218
1218
abstractType : GraphQLAbstractType ,
1219
1219
) : MaybePromise < ?GraphQLObjectType | string > {
@@ -1234,7 +1234,7 @@ function defaultResolveTypeFn(
1234
1234
const type = possibleTypes [ i ] ;
1235
1235
1236
1236
if ( type . isTypeOf ) {
1237
- const isTypeOfResult = type . isTypeOf ( value , context , info ) ;
1237
+ const isTypeOfResult = type . isTypeOf ( value , contextValue , info ) ;
1238
1238
1239
1239
if ( isPromise ( isTypeOfResult ) ) {
1240
1240
promisedIsTypeOfResults [ i ] = isTypeOfResult ;
@@ -1259,19 +1259,19 @@ function defaultResolveTypeFn(
1259
1259
* If a resolve function is not given, then a default resolve behavior is used
1260
1260
* which takes the property of the source object of the same name as the field
1261
1261
* and returns it as the result, or if it's a function, returns the result
1262
- * of calling that function while passing along args and context.
1262
+ * of calling that function while passing along args and context value .
1263
1263
*/
1264
1264
export const defaultFieldResolver : GraphQLFieldResolver < any , * > = function (
1265
1265
source ,
1266
1266
args ,
1267
- context ,
1267
+ contextValue ,
1268
1268
info ,
1269
1269
) {
1270
1270
// ensure source is a value for which property access is acceptable.
1271
1271
if ( typeof source === 'object' || typeof source === 'function' ) {
1272
1272
const property = source [ info . fieldName ] ;
1273
1273
if ( typeof property === 'function' ) {
1274
- return source [ info . fieldName ] ( args , context , info ) ;
1274
+ return source [ info . fieldName ] ( args , contextValue , info ) ;
1275
1275
}
1276
1276
return property ;
1277
1277
}
0 commit comments