moleculer-decorators
Version:
decorators for moleculer
20 lines (19 loc) • 935 B
TypeScript
import { ServiceSchema, ActionSchema, ActionHandler, ServiceEventHandler, EventSchema } from "moleculer";
export interface Options extends Partial<ServiceSchema> {
name?: string;
constructOverride?: boolean;
}
export interface ActionOptions extends Partial<ActionSchema> {
name?: string;
handler?: ActionHandler<any>;
skipHandler?: boolean;
}
export interface EventOptions extends Partial<EventSchema> {
name?: string;
group?: string;
handler?: ServiceEventHandler;
}
export declare function Method(target: any, key: string, descriptor: PropertyDescriptor): void;
export declare function Event(options?: EventOptions): (target: any, key: string, descriptor: PropertyDescriptor) => void;
export declare function Action(options?: ActionOptions): (target: any, key: string, descriptor: PropertyDescriptor) => void;
export declare function Service<T extends Options>(opts?: T): Function;