@@ -20,7 +20,7 @@ const internals = {
2020
2121exports . name = 'graphi' ;
2222
23- exports . register = function ( server , options ) {
23+ exports . register = function ( server , options ) {
2424 const settings = Merge ( { } , internals . defaults , options ) ;
2525
2626 server . expose ( 'resolvers' , { } ) ;
@@ -82,7 +82,7 @@ exports.graphql = Graphql;
8282
8383exports . makeExecutableSchema = Utils . makeExecutableSchema ;
8484
85- internals . registerSchema = function ( { schema = { } , resolvers = { } , subscriptionOptions = { } } ) {
85+ internals . registerSchema = function ( { schema = { } , resolvers = { } , subscriptionOptions = { } } ) {
8686 const server = this ;
8787 if ( typeof schema === 'string' ) {
8888 schema = Utils . makeExecutableSchema ( { schema, resolvers } ) ;
@@ -97,7 +97,7 @@ internals.registerSchema = function ({ schema = {}, resolvers = {}, subscription
9797 server . plugins . graphi . schema = schema ;
9898} ;
9999
100- internals . onPreStart = function ( server ) {
100+ internals . onPreStart = function ( server ) {
101101 const resolver = ( { prefix = '' , method = 'graphql' } ) => {
102102 return async ( payload , request , ast ) => {
103103 const url = `${ prefix } /${ ast . fieldName } ` ;
@@ -134,7 +134,7 @@ internals.onPreStart = function (server) {
134134 } ) ;
135135} ;
136136
137- internals . graphqlHandler = async function ( request , h ) {
137+ internals . graphqlHandler = async function ( request , h ) {
138138 if ( request . method . toUpperCase ( ) === 'OPTIONS' ) {
139139 return h . continue ;
140140 }
@@ -204,7 +204,16 @@ internals.graphqlHandler = async function (request, h) {
204204 return result ;
205205 } ;
206206
207- const result = await Graphql . execute ( schema , queryAST , resolvers , request , variables , operationName , fieldResolver ) ;
207+ const result = await Graphql . execute ( {
208+ schema,
209+ document : queryAST ,
210+ rootValue : resolvers ,
211+ contextValue : request ,
212+ variableValues : variables ,
213+ operationName,
214+ fieldResolver
215+ } ) ;
216+
208217 if ( result . errors ) {
209218 const formatError = request . server . plugins . graphi . settings . formatError ;
210219 if ( typeof formatError === 'function' ) {
@@ -225,7 +234,7 @@ internals.graphqlHandler = async function (request, h) {
225234 return result ;
226235} ;
227236
228- internals . graphiqlHandler = function ( request , h ) {
237+ internals . graphiqlHandler = function ( request , h ) {
229238 const { settings } = request . server . plugins . graphi ;
230239 const query = request . query ;
231240 const variables = query . variables || '{}' ;
@@ -239,7 +248,7 @@ internals.graphiqlHandler = function (request, h) {
239248 } ) ;
240249} ;
241250
242- internals . tryParseVariables = function ( input ) {
251+ internals . tryParseVariables = function ( input ) {
243252 if ( ! input || typeof input !== 'string' ) {
244253 return input ;
245254 }
0 commit comments