UNPKG

2.68 kBTypeScriptView Raw
1import { ClientApplication } from '../client/types';
2import { Indexable } from './merge';
3import { ActionCallback, ActionSetInterface, ActionSubscription, Component, ErrorCallback, Unsubscribe } from './types';
4export declare function actionWrapper(action: any): any;
5export declare function getVersion(): any;
6/**
7 * Returns full event name with prefix, group, subgroups and type formatted with separators
8 * @internal
9 * */
10export declare function getEventNameSpace(group: string, eventName: string, component?: Component): string;
11export declare function isValidOptionalNumber(value?: number): boolean;
12export declare function isValidOptionalString(value?: string): boolean;
13export declare abstract class ActionSet implements ActionSetInterface {
14 app: ClientApplication<any>;
15 type: string;
16 group: string;
17 readonly id: string;
18 readonly defaultGroup: string;
19 subgroups: string[];
20 subscriptions: ActionSubscription[];
21 constructor(app: ClientApplication<any>, type: string, group: string, id?: string);
22 set(..._: any[]): void;
23 readonly component: Component;
24 updateSubscription(subscriptionToRemove: ActionSubscription, group: string, subgroups: string[]): Unsubscribe;
25 error(callback: ErrorCallback): Unsubscribe;
26 subscribe(eventName: string, callback: ActionCallback, component?: Component, currentIndex?: number): Unsubscribe;
27 unsubscribe(resetOnly?: boolean): this;
28}
29export declare abstract class ActionSetWithChildren extends ActionSet {
30 children: ActionSetChildAction[];
31 unsubscribe(unsubscribeChildren?: boolean, resetParentOnly?: boolean): this;
32 getChild(id: string): ActionSetChildAction | undefined;
33 getChildIndex(id: string): number;
34 getChildSubscriptions(id: string, eventType?: string): ActionSubscription[];
35 addChild(child: ActionSetChildAction, group: string, subgroups: string[]): this;
36 removeChild(id: string): this;
37 subscribeToChild(child: ActionSetChildAction, eventName: string | string[], callback: (childData: any) => void): this;
38 getUpdatedChildActions<A extends ActionSetChildAction>(newActions: A[], currentActions: A[]): A[] | undefined;
39}
40export declare type ActionSetChildAction = ActionSet | ActionSetWithChildren;
41export declare function updateActionFromPayload<A extends Partial<ActionSetInterface>>(action: A, newProps: A): boolean;
42export declare function getMergedProps<Prop extends Indexable>(props: Prop, newProps: Partial<Prop>): Prop;
43export declare function forEachInEnum<E extends Indexable>(types: E, callback: (prop: string) => void): void;
44export declare function findMatchInEnum<E extends Indexable>(types: E, lookup: string): string | undefined;