index.d.ts 3.2 KB

12345678910111213141516171819202122232425262728
  1. import { AnyFunctionMap, BaseContext, GraphQLServiceContext, GraphQLRequestContext, GraphQLRequest, GraphQLResponse, ValueOrPromise, WithRequired, GraphQLFieldResolverParams, GraphQLRequestContextDidResolveSource, GraphQLRequestContextParsingDidStart, GraphQLRequestContextValidationDidStart, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors, GraphQLRequestContextResponseForOperation, GraphQLRequestContextExecutionDidStart, GraphQLRequestContextWillSendResponse } from 'apollo-server-types';
  2. export { BaseContext, GraphQLServiceContext, GraphQLRequestContext, GraphQLRequest, GraphQLResponse, ValueOrPromise, WithRequired, GraphQLFieldResolverParams, GraphQLRequestContextDidResolveSource, GraphQLRequestContextParsingDidStart, GraphQLRequestContextValidationDidStart, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors, GraphQLRequestContextResponseForOperation, GraphQLRequestContextExecutionDidStart, GraphQLRequestContextWillSendResponse, };
  3. export interface ApolloServerPlugin<TContext extends BaseContext = BaseContext> {
  4. serverWillStart?(service: GraphQLServiceContext): ValueOrPromise<GraphQLServerListener | void>;
  5. requestDidStart?(requestContext: GraphQLRequestContext<TContext>): GraphQLRequestListener<TContext> | void;
  6. }
  7. export interface GraphQLServerListener {
  8. serverWillStop?(): ValueOrPromise<void>;
  9. }
  10. export declare type GraphQLRequestListenerParsingDidEnd = (err?: Error) => void;
  11. export declare type GraphQLRequestListenerValidationDidEnd = ((err?: ReadonlyArray<Error>) => void);
  12. export declare type GraphQLRequestListenerExecutionDidEnd = ((err?: Error) => void);
  13. export declare type GraphQLRequestListenerDidResolveField = ((error: Error | null, result?: any) => void);
  14. export interface GraphQLRequestListener<TContext extends BaseContext = BaseContext> extends AnyFunctionMap {
  15. didResolveSource?(requestContext: GraphQLRequestContextDidResolveSource<TContext>): ValueOrPromise<void>;
  16. parsingDidStart?(requestContext: GraphQLRequestContextParsingDidStart<TContext>): GraphQLRequestListenerParsingDidEnd | void;
  17. validationDidStart?(requestContext: GraphQLRequestContextValidationDidStart<TContext>): GraphQLRequestListenerValidationDidEnd | void;
  18. didResolveOperation?(requestContext: GraphQLRequestContextDidResolveOperation<TContext>): ValueOrPromise<void>;
  19. didEncounterErrors?(requestContext: GraphQLRequestContextDidEncounterErrors<TContext>): ValueOrPromise<void>;
  20. responseForOperation?(requestContext: GraphQLRequestContextResponseForOperation<TContext>): ValueOrPromise<GraphQLResponse | null>;
  21. executionDidStart?(requestContext: GraphQLRequestContextExecutionDidStart<TContext>): GraphQLRequestExecutionListener | GraphQLRequestListenerExecutionDidEnd | void;
  22. willSendResponse?(requestContext: GraphQLRequestContextWillSendResponse<TContext>): ValueOrPromise<void>;
  23. }
  24. export interface GraphQLRequestExecutionListener<TContext extends BaseContext = BaseContext> extends AnyFunctionMap {
  25. executionDidEnd?: GraphQLRequestListenerExecutionDidEnd;
  26. willResolveField?(fieldResolverParams: GraphQLFieldResolverParams<any, TContext>): GraphQLRequestListenerDidResolveField | void;
  27. }
  28. //# sourceMappingURL=index.d.ts.map