import { NextApiRequest, NextApiResponse } from 'next'; import { Facade } from '../facade'; import { Controller } from '../controller'; import { SupportedRequestMethods } from '../controller/execution'; import { ActionReturn, Middleware as IMiddleware } from '../controller/types'; export declare class Middleware { handle: IMiddleware; private _except; private _only; constructor(handle: IMiddleware, _except?: string[], _only?: string[]); except(...actions: string[]): void; only(...actions: string[]): void; shouldExecute(method: string): boolean; } export declare class BeforeMiddleware extends Middleware { handle: IMiddleware; constructor(handle: IMiddleware); } export declare class AfterMiddleware extends Middleware { handle: IMiddleware; constructor(handle: IMiddleware); } export declare class MiddlewareProvider { protected middleware: Middleware; constructor(middleware: Middleware); except(action: SupportedRequestMethods): this; only(action: SupportedRequestMethods): this; } export declare class MiddlewareExecutor extends Facade { protected middleware: Middleware; private readonly method; constructor(middleware: Middleware, method: string); static before(method: string, controller: Controller, req: NextApiRequest, res: NextApiResponse): Promise; static after(method: string, controller: Controller, req: NextApiRequest, res: NextApiResponse): Promise; static create(middleware: Middleware, method: string): MiddlewareExecutor; shouldBeIncluded(): boolean; execute(req: NextApiRequest, res: NextApiResponse, stop: () => void): Promise; }