import * as rx from 'rxjs'; export type ActionFunctions = Record; export type EmptyActionFunctions = Record; export type InferPayload = F extends (...a: infer P) => any ? P : unknown[]; export type ActionMeta = { /** id */ i: number; /** reference to other actions */ r?: number | number[]; }; export type ArrayOrTuple = T[] | readonly T[] | readonly [T, ...T[]]; export type Action = { /** type */ t: string; /** payload **/ p: InferPayload; } & ActionMeta; export type Dispatch = (...params: InferPayload) => Action; export type DispatchFor = (origActionMeta: ActionMeta | ArrayOrTuple, ...params: InferPayload) => Action; export type CoreOptions = { name?: string; /** default is `true`, set to `false` will result in Connectable multicast action observable "action$" not * being automatically connected, you have to manually call `RxController::connect()` or `action$.connect()`, * otherwise, any actions that is dispatched to `actionUpstream` will not be observed and emitted by `action$`, * Refer to [https://rxjs.dev/api/index/function/connectable](https://rxjs.dev/api/index/function/connectable) * */ autoConnect?: boolean; debug?: boolean; debugExcludeTypes?: (keyof I & string)[]; logStyle?: 'full' | 'noParam'; log?: (msg: string, ...objs: any[]) => unknown; }; export declare const has: (v: PropertyKey) => boolean; export declare class ControllerCore { opts?: CoreOptions | undefined; actionUpstream: rx.Subject>; interceptor$: rx.BehaviorSubject<(up: rx.Observable>) => rx.Observable>>; typePrefix: string; logPrefix: string; action$: rx.Observable>; debugExcludeSet: Set; /** Event when `action$` is first time subscribed */ actionSubscribed$: rx.Observable; /** Event when `action$` is entirely unsubscribed by all observers */ actionUnsubscribed$: rx.Observable; protected dispatcher: { [K in keyof I]: Dispatch; }; protected dispatcherFor: { [K in keyof I]: DispatchFor; }; protected actionSubDispatcher: rx.Subject; protected actionUnsubDispatcher: rx.Subject; private connectableAction$; constructor(opts?: CoreOptions | undefined); createAction(type: K, params?: InferPayload): Action; /** change the "name" as previous specified in CoreOptions of constructor */ setName(name: string | null | undefined): void; dispatchFactory(type: K): Dispatch; dispatchForFactory(type: K): DispatchFor; updateInterceptor(factory: (previous: (up: rx.Observable>) => rx.Observable>) => (up: rx.Observable>) => rx.Observable>): void; ofType(...types: T): (up: rx.Observable>) => rx.Observable>; notOfType(...types: T): (up: rx.Observable>) => rx.Observable>>; connect(): void; } /** * Get the "action name" from payload's "type" field, * `payload.type`` is actually consist of string like `${Prefix}/${actionName}`, * this function returns the `actionName` part * @return undefined if current action doesn't have a valid "type" field */ export declare function nameOfAction(action: Pick, 't'>): keyof I & string; export declare function actionMetaToStr(action: ActionMeta): string;