diff --git a/packages/apollo-server-core/src/requestPipeline.ts b/packages/apollo-server-core/src/requestPipeline.ts index 8526d777..1fa004ef 100644 --- a/packages/apollo-server-core/src/requestPipeline.ts +++ b/packages/apollo-server-core/src/requestPipeline.ts @@ -184,7 +184,7 @@ export class GraphQLRequestPipeline { persistedQueryRegister, }); - const parsingDidEnd = await dispatcher.invokeDidStart( + const parsingDidEnd = await dispatcher.invokeDidStartHook( 'parsingDidStart', requestContext, ); @@ -207,7 +207,7 @@ export class GraphQLRequestPipeline { requestContext.document = document; - const validationDidEnd = await dispatcher.invokeDidStart( + const validationDidEnd = await dispatcher.invokeDidStartHook( 'validationDidStart', requestContext as WithRequired, ); @@ -238,7 +238,7 @@ export class GraphQLRequestPipeline { requestContext.operationName = (operation && operation.name && operation.name.value) || null; - await dispatcher.invokeAsync( + await dispatcher.invokeHookAsync( 'didResolveOperation', requestContext as WithRequired< typeof requestContext, @@ -246,7 +246,7 @@ export class GraphQLRequestPipeline { >, ); - const executionDidEnd = await dispatcher.invokeDidStart( + const executionDidEnd = await dispatcher.invokeDidStartHook( 'executionDidStart', requestContext as WithRequired< typeof requestContext, @@ -355,7 +355,7 @@ export class GraphQLRequestPipeline { extensions: response.extensions, }, }).graphqlResponse; - await dispatcher.invokeAsync( + await dispatcher.invokeHookAsync( 'willSendResponse', requestContext as WithRequired, ); diff --git a/packages/apollo-server-core/src/utils/dispatcher.ts b/packages/apollo-server-core/src/utils/dispatcher.ts index b305830a..c2748a65 100644 --- a/packages/apollo-server-core/src/utils/dispatcher.ts +++ b/packages/apollo-server-core/src/utils/dispatcher.ts @@ -11,7 +11,7 @@ type DidEndHook = (...args: TArgs) => void; export class Dispatcher { constructor(protected targets: T[]) {} - public async invokeAsync< + public async invokeHookAsync< TMethodName extends FunctionPropertyNames> >( methodName: TMethodName, @@ -27,7 +27,7 @@ export class Dispatcher { ); } - public invokeDidStart< + public invokeDidStartHook< TMethodName extends FunctionPropertyNames< Required, ((...args: any[]) => AnyFunction | void)