import * as rx from 'rxjs'; import { RxController, ActionTable, ActionFunctions } from './control'; import { DuplexController, DuplexOptions } from './duplex'; export type Reactor = (ctl: RxController) => rx.Observable; export type DuplexReactor = (ctl: DuplexController) => rx.Observable; export type InferFuncReturnEvents = { [K in keyof I as `${K & string}Resolved`]: (p: ReturnType extends PromiseLike ? P : ReturnType extends rx.Observable ? OB : ReturnType) => void; } & { [K in keyof I as `${K & string}Completed`]: () => void; }; export interface ReactorCompositeOpt, O extends ActionFunctions = Record, LI extends readonly (keyof I)[] = readonly [], LO extends readonly (keyof O)[] = readonly []> extends DuplexOptions { name: string; inputTableFor?: LI; outputTableFor?: LO; } export declare class ReactorComposite, O extends ActionFunctions = Record, LI extends readonly (keyof I)[] = readonly [], LO extends readonly (keyof O)[] = readonly []> extends DuplexController { private opts?; protected errorSubject: rx.Subject<[lable: string, originError: any]>; /** All catched error goes here */ error$: rx.Observable<[lable: string, originError: any]>; destory$: rx.Subject; get inputTable(): ActionTable; get outputTable(): ActionTable; private iTable; private oTable; protected reactorSubj: rx.Subject<[label: string, stream: rx.Observable, disableCatchError?: boolean]>; constructor(opts?: ReactorCompositeOpt | undefined); /** @deprecated no longer needed, always start automatically after being contructed */ startAll(): void; destory(): void; reactivize(fObject: F): ReactorComposite extends PromiseLike ? P : ReturnType extends rx.Observable ? OB : ReturnType) => void; } & { [K_1 in keyof F as `${K_1 & string}Completed`]: () => void; } & O, LI, LO>; reativizeRecursiveFuncs(fObject: F): ReactorComposite<{ [K in keyof F as `${K & string}Resolved`]: (p: ReturnType extends PromiseLike ? P : ReturnType extends rx.Observable ? OB : ReturnType) => void; } & { [K_1 in keyof F as `${K_1 & string}Completed`]: () => void; } & I & F, { [K in keyof F as `${K & string}Resolved`]: (p: ReturnType extends PromiseLike ? P : ReturnType extends rx.Observable ? OB : ReturnType) => void; } & { [K_1 in keyof F as `${K_1 & string}Completed`]: () => void; } & O, LI, LO>; /** * It is just a declaration of mergeMap() operator, which merge an observable to the main stream * which will be or has already been observed by `startAll()`. * This is where we can add `side effect`s * */ addReaction(...params: [label: string, stream: rx.Observable, disableCatchError?: boolean]): void; /** Abbrevation of addReaction */ r: (...params: [label: string, stream: rx.Observable, disableCatchError?: boolean] | [stream: rx.Observable, disableCatchError?: boolean]) => void; /** * An rx operator tracks down "lobel" information in error log via a 'catchError' inside it, to help to locate errors. * This operator will continue to throw any errors from upstream observable, if you want to play any side-effect to * errors, you should add your own "catchError" after. * * `addReaction(lable, ...)` uses this op internally. */ labelError(label: string): (upStream: rx.Observable) => rx.Observable; protected reactivizeFunction(key: string, func: (...a: any[]) => any, funcThisRef?: any): string; protected logError(label: string, err: any): void; protected handleError(upStream: rx.Observable, label?: string, hehavior?: 'continue' | 'stop' | 'throw'): rx.Observable; }