UNPKG

yoonite-saga

Version:

> Orchestration de workflows transactionnels avec gestion de compensation (pattern Saga)

14 lines (13 loc) 464 B
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;