import { execute } from 'graphql' ; import { ExecutableSchema , GraphQLServiceContext } from '../typings' ; export const run = ( executableSchema ) => async function runHttpQuery ( ctx , next ) { const { graphql : { query } , } = ctx ; const { document , operationName , variables : variableValues } = query ! ; const schema = executableSchema . schema ; const response = await execute ( { contextValue : ctx , document , fieldResolver : ( root , _ , __ , info ) => root [ info . fieldName ] , operationName , rootValue : null , schema , variableValues , } ) ; ctx . graphql . graphqlResponse = response ; await next ( ) ; } ;