import { HttpVerb } from "./http-verb"; export interface LynxRouteBody { name: string; schema: any; } export interface LynxRouteMetadata { type: HttpVerb; path: string; method: any; body?: LynxRouteBody; isAPI: boolean; isMultipartForm: boolean; verifiers: { fun: Function; isAsync: boolean; }[]; name?: string; } export interface LynxControllerMetadata { controllerPath: string; routes: LynxRouteMetadata[]; } /** * Decorator to set the base route of a controller. * @param path the route path for the controller. */ export declare function Route(path: string): (target: any) => void; /** * Set the decorated method to a GET endpoint with the specified path. * @param path the endpoint path */ export declare function GET(path: string): (target: any, method: any, _: any) => void; /** * Set the decorated method to a POST endpoint with the specified path. * @param path the endpoint path */ export declare function POST(path: string): (target: any, method: any, _: any) => void; /** * Set the decorated method to a PUT endpoint with the specified path. * @param path the endpoint path */ export declare function PUT(path: string): (target: any, method: any, _: any) => void; /** * Set the decorated method to a DELETE endpoint with the specified path. * @param path the endpoint path */ export declare function DELETE(path: string): (target: any, method: any, _: any) => void; /** * Set the decorated method to a PATH endpoint with the specified path. * @param path the endpoint path */ export declare function PATCH(path: string): (target: any, method: any, _: any) => void; /** * Add to the decorated method a body to be injected. The body will be validated * using the specified schema. * @param name the name of the argument in the method to map the body * @param schema a JOI schema to validate the body object */ export declare function Body(name: string, schema: any): (target: any, _: any, __: any) => void; /** * Set the decorated method to an API endpoints. * In this way, the returned value of the method will be encapsulated in a * standard API envelope and serialized to JSON using the Lynx serialization system. */ export declare function API(): (target: any, _: any, __: any) => void; /** * Set the decorated method to accept MultipartForm requested. */ export declare function MultipartForm(): (target: any, _: any, __: any) => void; /** * Add to the decorated method a route name, in order to easely generate redirect * or, more general, the execution of the `route` method. * @param name the name of the route */ export declare function Name(name: string): (_: any, __: any, ___: any) => void; /** * Add to the decorated method a verification function that will be executed * BEFORE the route. The function must NOT be an async function, and it shell * return a boolean value. If true is returned, the method is then executed. * This method is fundamental to implement authorization to a single endpoint. * NOTE: this is the sync version of the AsyncVerify decorator. * @param func the verification function to be executed. It must NOT be an async function, and return a boolean value. */ export declare function Verify(func: Function): (target: any, _: any, __: any) => void; /** * Add to the decorated method a verification function that will be executed * BEFORE the route. The function must NOT be an async function, and it shell * return a boolean value. If true is returned, the method is then executed. * This method is fundamental to implement authorization to a single endpoint. * NOTE: this is the async version of the Verify decorator. * @param func the verification function to be executed. It MUST BE an async function, and return a boolean value. */ export declare function AsyncVerify(func: Function): (target: any, _: any, __: any) => void; /** * Add to the decorated class a path to be executed as middleware. * @param path the endpoint path */ export declare function Middleware(path: string): (target: any) => void;