Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Latest commit

 

History

History
77 lines (60 loc) · 1.58 KB

README.md

File metadata and controls

77 lines (60 loc) · 1.58 KB

Entities

Action creators

/**
 * Merges many entities at once
 */
declare function mergeEntities(entityMap: object): object;

/**
 * Merge a field inside an entity
 */
declare function mergeEntity(domain: string, id: string, data: any): object;

/**
 * Removes multiple entities at once (of a single type/domain)
 */
declare function removeMany(domain: string, keys: string[]): object;

/**
 * Removes one entity by id
 */
declare function removeOne(domain: string, key: string): object;

/**
 * Removes all entities by domain
 */
declare function removeAll(domain: string): object;

/**
 * Clears the whole entity cache
 */
declare function clear(): object;

/**
 * Update all entities with the new ones
 */
declare function updateEntities(entityMap: object): object;

/**
 * Update one entities with a new data
 */
declare function updateEntity(domain: string, id: string, data: any): object;

Selectors

Note that all selectors are currified

/**
 * Get all the entities as Object
 */
declare const getEntities: (state: object) => object[];

/**
 * Get all entities for domain as an object
 */
declare const getDomain: (domain: string, state: object) => object[];

/**
 * Get single entity from domain, by it's id
 */
declare const getOne: (domain: string, id: string | number, state: object) => object;

/**
 * Get the entities with specific ids in a domain
 */
declare const getSome: (domain: string, ids: string[] | number[], state: object) => object[];

/**
 * Get ids of the entities inside a domain
 */
declare const getIds: (domain: string, state: object) => string[];