export declare type Comparer = (a: T, b: T) => number; export declare type IdSelectorStr = (model: T) => string; export declare type IdSelectorNum = (model: T) => number; export declare type IdSelector = IdSelectorStr | IdSelectorNum; export interface DictionaryNum { [id: number]: T | undefined; } export declare abstract class Dictionary implements DictionaryNum { [id: string]: T | undefined; } export interface UpdateStr { id: string; changes: Partial; } export interface UpdateNum { id: number; changes: Partial; } export declare type Update = UpdateStr | UpdateNum; export declare type Predicate = (entity: T) => boolean; export declare type EntityMap = (entity: T) => T; export interface EntityMapOneNum { id: number; map: EntityMap; } export interface EntityMapOneStr { id: string; map: EntityMap; } export declare type EntityMapOne = EntityMapOneNum | EntityMapOneStr; export interface EntityState { ids: string[] | number[]; entities: Dictionary; } export interface EntityDefinition { selectId: IdSelector; sortComparer: false | Comparer; } export interface EntityStateAdapter { addOne>(entity: T, state: S): S; addMany>(entities: T[], state: S): S; setAll>(entities: T[], state: S): S; setOne>(entity: T, state: S): S; setMany>(entities: T[], state: S): S; removeOne>(key: string, state: S): S; removeOne>(key: number, state: S): S; removeMany>(keys: string[], state: S): S; removeMany>(keys: number[], state: S): S; removeMany>(predicate: Predicate, state: S): S; removeAll>(state: S): S; updateOne>(update: Update, state: S): S; updateMany>(updates: Update[], state: S): S; upsertOne>(entity: T, state: S): S; upsertMany>(entities: T[], state: S): S; mapOne>(map: EntityMapOne, state: S): S; map>(map: EntityMap, state: S): S; } export interface EntitySelectors { selectIds: (state: V) => string[] | number[]; selectEntities: (state: V) => Dictionary; selectAll: (state: V) => T[]; selectTotal: (state: V) => number; } export interface EntityAdapter extends EntityStateAdapter { selectId: IdSelector; sortComparer: false | Comparer; getInitialState(): EntityState; getInitialState(state: S): EntityState & S; getSelectors(): EntitySelectors>; getSelectors(selectState: (state: V) => EntityState): EntitySelectors; }