UNPKG

atombeak

Version:

Create asynchronous atomic functions!

28 lines (27 loc) 1.12 kB
import { Log } from '../Log'; export declare const SHOULD_RESTART: 'SHOULD_RESTART'; export declare type ShouldRestart<Outer, Action> = Readonly<{ type: typeof SHOULD_RESTART; attempt: number; log: Log<Outer, Action>; }>; export declare function shouldRestart<Outer, Action>(attempt: number, log: Log<Outer, Action>): ShouldRestart<Outer, Action>; export declare const SHOULD_CONTINUE: 'SHOULD_CONTINUE'; export declare type ShouldContinue<Outer, Action> = Readonly<{ type: typeof SHOULD_CONTINUE; attempt: number; log: Log<Outer, Action>; }>; export declare function shouldContinue<Outer, Action>(attempt: number, log: Log<Outer, Action>): ShouldContinue<Outer, Action>; export declare const RESOLVE = "RESOLVE"; export declare type Resolve<Inner, Action> = { type: 'RESOLVE'; inner: Inner; actions: Action[]; }; export declare const NO_OP: 'NO_OP'; export declare type NoOp = { type: typeof NO_OP; }; export declare const noOp: NoOp; export declare type Command<Outer, Inner, Action> = ShouldRestart<Outer, Action> | ShouldContinue<Outer, Action> | Resolve<Inner, Action> | NoOp;