@angstone/monostone
Version:
monolitic event-sourced framework
20 lines (19 loc) • 574 B
TypeScript
/**
* A file loaded to generate the business rule object for the command
*/
export interface IRule {
/**
* pre-validates the request (used for validation that does not require database access)
*/
preValidation?: (req: any) => Promise<string | undefined>;
/**
* validate parameters using business rule and database
*/
validation?: (req: any) => Promise<string | undefined | {
req: any;
}>;
/**
* Data to respond after the event beeing reduced
*/
respond?: (eventNumber: number, req: any) => Promise<any>;
}