mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
Rename dispatcher methods to clarify they invoke hooks
This commit is contained in:
parent
b4863f65e9
commit
f4400ac8af
2 changed files with 7 additions and 7 deletions
|
@ -184,7 +184,7 @@ export class GraphQLRequestPipeline<TContext> {
|
|||
persistedQueryRegister,
|
||||
});
|
||||
|
||||
const parsingDidEnd = await dispatcher.invokeDidStart(
|
||||
const parsingDidEnd = await dispatcher.invokeDidStartHook(
|
||||
'parsingDidStart',
|
||||
requestContext,
|
||||
);
|
||||
|
@ -207,7 +207,7 @@ export class GraphQLRequestPipeline<TContext> {
|
|||
|
||||
requestContext.document = document;
|
||||
|
||||
const validationDidEnd = await dispatcher.invokeDidStart(
|
||||
const validationDidEnd = await dispatcher.invokeDidStartHook(
|
||||
'validationDidStart',
|
||||
requestContext as WithRequired<typeof requestContext, 'document'>,
|
||||
);
|
||||
|
@ -238,7 +238,7 @@ export class GraphQLRequestPipeline<TContext> {
|
|||
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<TContext> {
|
|||
>,
|
||||
);
|
||||
|
||||
const executionDidEnd = await dispatcher.invokeDidStart(
|
||||
const executionDidEnd = await dispatcher.invokeDidStartHook(
|
||||
'executionDidStart',
|
||||
requestContext as WithRequired<
|
||||
typeof requestContext,
|
||||
|
@ -355,7 +355,7 @@ export class GraphQLRequestPipeline<TContext> {
|
|||
extensions: response.extensions,
|
||||
},
|
||||
}).graphqlResponse;
|
||||
await dispatcher.invokeAsync(
|
||||
await dispatcher.invokeHookAsync(
|
||||
'willSendResponse',
|
||||
requestContext as WithRequired<typeof requestContext, 'response'>,
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ type DidEndHook<TArgs extends any[]> = (...args: TArgs) => void;
|
|||
export class Dispatcher<T> {
|
||||
constructor(protected targets: T[]) {}
|
||||
|
||||
public async invokeAsync<
|
||||
public async invokeHookAsync<
|
||||
TMethodName extends FunctionPropertyNames<Required<T>>
|
||||
>(
|
||||
methodName: TMethodName,
|
||||
|
@ -27,7 +27,7 @@ export class Dispatcher<T> {
|
|||
);
|
||||
}
|
||||
|
||||
public invokeDidStart<
|
||||
public invokeDidStartHook<
|
||||
TMethodName extends FunctionPropertyNames<
|
||||
Required<T>,
|
||||
((...args: any[]) => AnyFunction | void)
|
||||
|
|
Loading…
Add table
Reference in a new issue