yoonite-saga
Version:
> Orchestration de workflows transactionnels avec gestion de compensation (pattern Saga)
17 lines (13 loc) • 457 B
text/typescript
import { ServicesList } from "./services.type";
export type Fn<T> = (context: any, services?: ServicesList) => T;
export type CompensateFn<T> = (context: any, payload: any) => T;
export type Condition = Fn<boolean>;
export type Compensation = CompensateFn<void>;
export type InvokeAction = {
name?: string;
validate?: any;
condition?: Condition;
action: Fn<any>;
withCompensation?: Compensation;
};
export type Invoke = Fn<any> | InvokeAction;