import { Entities, Entity, EntityDefinition, EntityHandler, BakedEntityHandler, HandlerSetter, Constraints, ConditionFunc, Options } from 'interfaces'; import Operation from './Operation'; import * as Actions from './Actions'; export default class EntityManager { _orderedListLastItemDocRefs: { [orderBy: string]: any; }; _queriedListLastItemDocRefs: { [queryName: string]: any; }; _fetchingPromises: { [id: string]: Promise<'DONE'>; }; _firestore: any; _errorHandler: (error: Error) => any; _runTransactionManager: (dispatch: any, getState: any, initialOperation: Operation, conditionFunc?: ConditionFunc) => Promise<'DONE'>; _getEntities: (state: Object) => Entities; _getEntity: (entities: Object) => Entity; getById: (state: Object) => Entity['byId']; getAllIds: (state: Object) => Entity['allIds']; getOrderedListMap: (state: Object) => Entity['orderedList']; getQueriedListMap: (state: Object) => Entity['queriedList']; getItem: (id: string) => (state: Object) => any; getAllItemList: () => (state: Object) => Array; getOrderedList: (orderBy: string) => (state: Object) => Array; getQueriedList: (queryName: string) => (state: Object) => Array; _entityType: string; _entityDefinition: EntityDefinition; _childHandlerSetters: Array; _parents: { [parentEntityType: string]: { propKey: string; type: 'MULTIPLE' | 'SINGLE'; }; }; _constraints: { [propKey: string]: Constraints; }; _options: Options; _handlers: { ADD: Array; UPDATE: Array; DELETE: Array; }; constructor(entityType: string, entityDefinition: EntityDefinition, getEntities: (state: Object) => Entities, errorHandler: (error: Error) => any, runTransactionManager: (dispatch: any, getState: any, initialOperation: Operation) => Promise<'DONE'>, firestore: any, options: Options); _inspect(): void; _concatHandlers(selfHandlerSetters: Array, childHandlerSetters?: Array): void; _compile(): void; _getChildHandlerSetters(): HandlerSetter[]; _setChildHandler(handlerSetter: HandlerSetter): void; _generateReducer(): (state: Entity, action: Actions.SuccessAddItem | Actions.SuccessUpdateItem | Actions.SuccessDeleteItem | Actions.SuccessFetchItemAction | Actions.SuccessFetchListAction | Actions.SuccessQueryListAction) => Entity; _getBakedEntityHandlers(operation: Operation): Array; addItem(entityItem: any): (dispatch: any, getState: any) => Promise; updateItem(id: string, partialEntityItem: Object, conditionFunc?: ConditionFunc): (dispatch: any, getState: any) => Promise<"DONE">; deleteItem(id: string): (dispatch: any, getState: any) => Promise<"DONE">; fetchItem(id: string): (dispatch: any, getState: any) => Promise; fetchList(orderBy?: string, directionStr?: 'asc' | 'desc'): (dispatch: any) => (limit?: number, startAt?: any) => any; /** * firestore's rule : 어떤 propKey에 대해 equality test ('==') where절이 있다면 그 propKey 대해 orderBy 불가능 */ queryList(queryName: string, filters?: Array<[string, '==' | '<' | '<=' | '>' | '>=', any]>, orderBy?: string, directionStr?: 'asc' | 'desc'): (dispatch: any) => (limit?: number, startAt?: any) => any; _getItem(id: string): (state: Object) => any; _getItemListWithIds(byId: { [id: string]: Object; }, ids: string[]): Object[]; _getAllItemList(): (state: Object) => Array; _getOrderedList(orderBy?: string): (state: Object) => Array; _getQueriedList(queryName: string): (state: Object) => Array; generateId(): string; }