import { BaseDocument , UniqueId } from './models/base-document' ; export const entityStartProcessingFn = < T > ( state ) => ( { ... ( state as any ) , ids : [ ] , entities : { } , isProcessing : true , selectedId : undefined } ) ; export const entityStopProcessingFn = < T > ( state ) => ( { ... ( state as any ) , isProcessing : false } ) ; export const entityErrorFn = < T > ( state ) => ( error ) => ( { ... ( state as any ) , ids : [ ] , entities : { } , isProcessing : false , selectedId : undefined , error } ) ; export const entityResetFn = < T > ( state ) => ( value ) => ( { ... ( state as any ) , isProcessing : false , selectedId : value . id , error : value . error } ) ; export const entityReducer = < T extends BaseDocument > ( acc , cur ) => ( { ... acc , [ cur . id ] : cur } ) ;