UNPKG

2.05 kBTypeScriptView Raw
1import { AsyncCommand } from './command/AsyncCommand';
2import { Command } from './command/Command';
3import { Scheduler } from '../../arbitrary/scheduler';
4/**
5 * Synchronous definition of model and real
6 * @remarks Since 2.2.0
7 * @public
8 */
9export declare type ModelRunSetup<Model, Real> = () => {
10 model: Model;
11 real: Real;
12};
13/**
14 * Asynchronous definition of model and real
15 * @remarks Since 2.2.0
16 * @public
17 */
18export declare type ModelRunAsyncSetup<Model, Real> = () => Promise<{
19 model: Model;
20 real: Real;
21}>;
22/**
23 * Run synchronous commands over a `Model` and the `Real` system
24 *
25 * Throw in case of inconsistency
26 *
27 * @param s - Initial state provider
28 * @param cmds - Synchronous commands to be executed
29 *
30 * @remarks Since 1.5.0
31 * @public
32 */
33export declare function modelRun<Model extends object, Real, InitialModel extends Model>(s: ModelRunSetup<InitialModel, Real>, cmds: Iterable<Command<Model, Real>>): void;
34/**
35 * Run asynchronous commands over a `Model` and the `Real` system
36 *
37 * Throw in case of inconsistency
38 *
39 * @param s - Initial state provider
40 * @param cmds - Asynchronous commands to be executed
41 *
42 * @remarks Since 1.5.0
43 * @public
44 */
45export declare function asyncModelRun<Model extends object, Real, CheckAsync extends boolean, InitialModel extends Model>(s: ModelRunSetup<InitialModel, Real> | ModelRunAsyncSetup<InitialModel, Real>, cmds: Iterable<AsyncCommand<Model, Real, CheckAsync>>): Promise<void>;
46/**
47 * Run asynchronous and scheduled commands over a `Model` and the `Real` system
48 *
49 * Throw in case of inconsistency
50 *
51 * @param scheduler - Scheduler
52 * @param s - Initial state provider
53 * @param cmds - Asynchronous commands to be executed
54 *
55 * @remarks Since 1.24.0
56 * @public
57 */
58export declare function scheduledModelRun<Model extends object, Real, CheckAsync extends boolean, InitialModel extends Model>(scheduler: Scheduler, s: ModelRunSetup<InitialModel, Real> | ModelRunAsyncSetup<InitialModel, Real>, cmds: Iterable<AsyncCommand<Model, Real, CheckAsync>>): Promise<void>;