@micro.ts/core
Version:
Microservice framework with Typescript
47 lines (46 loc) • 2.76 kB
TypeScript
import { MethodOptions, AuthorizeOptions, MiddlewareOptions, ControllerOptions, BrokerFilter } from './types/MethodMetadataTypes';
import { ParamOptions } from './types/ParamMetadataTypes';
import { AppErrorHandler } from '../errors/types/ErrorHandlerTypes';
import { AppMiddleware } from '../middlewares/IMiddleware';
/**
* Registers or appends metadata to the method
* If the parameters of that method are not registered (from decorations) it saves only the types of the parameters
* @param target Target controller
* @param propertyKey method name
* @param _descriptor method descriptor
* @param options Options to attach
*/
export declare function registerHandlerMetadata(target: any, propertyKey: string, _descriptor: PropertyDescriptor, options: MethodOptions): void;
/**
* Register metadata for a single parameter
* @param target Target controller
* @param propertyKey Method name
* @param index Parameter Index
* @param options Parameter options
*/
export declare function registerParamMetadata(target: any, propertyKey: string, index: number, options?: ParamOptions): void;
/**
* Sets or unsets the authorized property for the method
* attaches authorization options and enabled flag to the method
* @param target Target controller
* @param propertyKey Method name
* @param _descriptor Method descriptor
* @param options Authorization options
* @param active Used to disable in case it's enabled by its controller
*/
export declare function attachHandlerAuthorization(target: any, propertyKey: string, _descriptor: PropertyDescriptor, options?: AuthorizeOptions, active?: boolean): void;
/**
* Attaches middlewares to the method
* @param target
* @param propertyKey
* @param _descriptor
* @param options
*/
export declare function attachHandlerMiddleware(target: any, propertyKey: string, _descriptor: PropertyDescriptor, options: MiddlewareOptions[]): void;
export declare function attachHandlerRedirect(target: any, propertyKey: string, _descriptor: PropertyDescriptor, url: string): void;
export declare function attachHandlerBrokersFitler(target: any, propertyKey: string, _descriptor: PropertyDescriptor, options: BrokerFilter): void;
export declare function attachHandlerErrorHandler(target: any, propertyKey: string, _descriptor: PropertyDescriptor, options: AppErrorHandler[]): void;
export declare function registerControllerMetadata(target: any, options?: ControllerOptions): void;
export declare function attachControllerErrorHandlers(target: any, errorHandlers: AppErrorHandler[]): void;
export declare function attachControllerMiddleware(target: any, middlewares: AppMiddleware[], before: boolean): void;
export declare function attachControllerAuthorization(target: any, options?: AuthorizeOptions): void;