import { EventEmitter } from 'events'; export declare class Store { name: string; private initialState; protected state: T; protected events: EventEmitter; /** * Create a Store that hold the state of the component * @param name The name of the store * @param initialState The initial state of the store */ constructor(name: string, initialState: T); /** Listen on event from the store */ readonly on: (type: string | number, listener: import("events").Listener) => EventEmitter; /** Liste once on event from the store */ readonly once: (type: string | number, listener: import("events").Listener) => EventEmitter; /** Update one field of the state */ update(state: Partial): void; /** Get one field of the state */ get(key: Key): T[Key]; /** Reset the state its initial value */ reset(): void; /** Dispatch an event with the new state */ dispatch(): void; } interface EntityState { ids: string[]; actives: string[]; entities: { [id: string]: T; }; [key: string]: any; } export declare class EntityStore extends Store> { private keyId; /** * Create a entity Store that hold a map entity of the same model * @param name The name of the store * @param initialState The initial state of the store * @param keyId The value used as a key for the `entities` and inside `ids` */ constructor(name: string, initialState: EntityState, keyId: keyof T); /** Tne entities as a Map */ readonly entities: { [id: string]: T; }; /** List of all the ids */ readonly ids: string[]; /** List of all active ID */ readonly actives: string[]; /** Return the length of the entity collection */ readonly length: number; /** Add a new entity to the state */ add(entity: T): void; /** Remove an entity from the state */ remove(id: string): void; /** Update one entity of the state */ updateOne(id: string, update: Partial): void; /** Set the actives entities */ setActive(ids: string[] | string): void; /** Activate one or several entity from the state */ activate(ids: string[] | string): void; /** Remove one or */ deactivate(ids: string[] | string): void; /** Get one entity */ getOne(id: string): T; /** Get many entities as an array */ getMany(ids: string[]): T[]; /** Get all the entities as an array */ getAll(): T[]; /** Get all active entities */ getActives(): T[]; /** Is the entity active */ isActive(id: string): boolean; /** Is this id inside the store */ hasEntity(id: string): boolean; /** Is the state empty */ isEmpty(): boolean; } export {};