apollo-server/packages/graphql-server-core/src/graphqlOptions.ts

31 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-01-04 18:03:11 -08:00
import { GraphQLSchema, ValidationContext } from 'graphql';
import { LogFunction } from './runQuery';
2016-07-04 22:03:59 -07:00
/*
* GraphQLServerOptions
2016-07-04 22:03:59 -07:00
*
* - schema: an executable GraphQL schema used to fulfill requests.
* - (optional) formatError: Formatting function applied to all errors before response is sent
* - (optional) rootValue: rootValue passed to GraphQL execution
* - (optional) context: the context passed to GraphQL execution
* - (optional) logFunction: a function called for logging events such as execution times
* - (optional) formatParams: a function applied to the parameters of every invocation of runQuery
* - (optional) validationRules: extra validation rules applied to requests
* - (optional) formatResponse: a function applied to each graphQL execution result
* - (optional) debug: a boolean that will print additional debug logging if execution errors occur
2016-07-04 22:03:59 -07:00
*
*/
interface GraphQLServerOptions {
schema: GraphQLSchema;
2016-07-04 22:03:59 -07:00
formatError?: Function;
rootValue?: any;
context?: any;
logFunction?: LogFunction;
2016-07-04 22:03:59 -07:00
formatParams?: Function;
2017-01-04 18:03:11 -08:00
validationRules?: Array<(context: ValidationContext) => any>;
2016-07-04 22:03:59 -07:00
formatResponse?: Function;
debug?: boolean;
2016-07-04 22:03:59 -07:00
}
export default GraphQLServerOptions;