/** * @license * Copyright Andrey Chalkin (https://github.com/L2jLiga). All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/L2jLiga/fastify-decorators/blob/master/LICENSE */ import { ContextConfigDefault, FastifyInstance, FastifyReply, FastifyRequest, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault, RequestGenericInterface } from 'fastify'; import { CREATOR } from '../symbols/index.js'; /** * Abstract class which should extend all decorated request handlers */ export declare abstract class RequestHandler = RawRequestDefaultExpression, RawReply extends RawReplyDefaultExpression = RawReplyDefaultExpression, RequestGeneric extends RequestGenericInterface = RequestGenericInterface, ContextConfig = ContextConfigDefault> { protected request: FastifyRequest; protected reply: FastifyReply; /** * Static method to register handler by autoloader (bootstrap) */ static readonly [CREATOR]: { register: (instance: FastifyInstance) => void; }; protected constructor(request: FastifyRequest, reply: FastifyReply); /** * Main method for request handling */ abstract handle(): void | Promise; } export interface RequestHook { name: 'onRequest' | 'preParsing' | 'preValidation' | 'preHandler' | 'preSerialization' | 'onSend' | 'onResponse' | 'onTimeout' | 'onError'; handlerName: string | symbol; }