GitHub

DaffOperationEntityStateAdapter

import { DaffOperationEntityStateAdapter } from '@daffodil/core/state'
class DaffOperationEntityStateAdapter<<T extends DaffIdentifiable = DaffIdentifiable>>  implements DaffOperationEntityStateAdapterInterface<T> {
  protected adapter: EntityAdapter<DaffOperationEntity<T>>
  list<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entities: T[]
    state: S
  ): S
  preload<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    id: string
    state: S
  ): S
  load<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entity: T
    state: S
  ): S
  preadd<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entity: T
    state: S
    placeholderId?: string
  ): S
  add<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entity: T
    state: S
    placeholderId?: string
  ): S
  preupdate<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entity: Partial<T> & DaffIdentifiable
    state: S
  ): S
  update<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    entity: Partial<T> & DaffIdentifiable
    state: S
  ): S
  preremove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    key: string
    state: S
  ): S
  remove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    key: string
    state: S
  ): S
  operationFailed<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    key: string
    errors: DaffStateError[]
    state: S
  ): S
  resetState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(
    key: string
    state: S
  ): S
  getInitialState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(state?: S): S
  getSelectors<TRootState>(selectState: (state: TRootState) => DaffOperationEntityState<T>): DaffOperationEntityStateSelectors<TRootState, T>
}

Properties

Name Type Description
adapter EntityAdapter<DaffOperationEntity<T>>
list S

Stores a list of entities in state and resets them all to stable.

preload S

Optimistically adds a placeholder entity into state if necessary and sets the entity to resolving.

load S

Upserts the entity into state and resets operation state and errors.

preadd S

Adds a placeholder entity into state if placeholderId is specified and sets state to adding.

add S

Adds the entity into state, sets operation state to added, and resets errors.

preupdate S

Sets the entity's operation state to mutating.

update S

Upserts the entity into state, sets operation state to mutated, and resets errors.

preremove S

Sets the entity's operation state to deleting.

remove S

Removes the entity from state.

operationFailed S

Resets the entity's operation state and stores errors on the entity.

resetState S

Resets the entity's operation state to stable.

getInitialState S

Gets an empty entity state.

getSelectors DaffOperationEntityStateSelectors<TRootState, T>

Gets entity selectors.