nestjs-resilience
Version:
A module for improving the reliability and fault-tolerance of your NestJS applications
23 lines (22 loc) • 913 B
TypeScript
import { Logger } from '@nestjs/common';
import { Strategy } from '../strategies';
import { ResilienceEventBus } from '../resilience.event-bus';
export type ParametersOfRun<T extends BaseCommand> = Parameters<T['run']>;
export type ReturnTypeOfRun<T extends BaseCommand> = ReturnType<T['run']>;
export declare abstract class BaseCommand {
protected readonly logger: Logger;
protected readonly eventBus: ResilienceEventBus;
protected readonly strategies: Strategy[];
readonly group: string;
readonly name: string;
constructor(strategies: Strategy[], group?: string, name?: string);
/**
* Abstract method to be implemented by the command
* @param args
*/
abstract run(...args: any[]): any;
abstract execute(...args: ParametersOfRun<this>): ReturnTypeOfRun<this>;
protected onSuccess(): void;
protected onFailure(error: any): any;
toString(): string;
}