Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "reducers/normalize"

Index

Variables

STATE_KEY

STATE_KEY: "normalized" = "normalized"

The state key under which the normalized state will be stored

getNormalizedEntities

getNormalizedEntities: MemoizedSelector<any, EntityMap> = createSelector(getNormalizedState,(state: NormalizedEntityState) => state.entities)

Selects all normalized entities of the state, regardless of their schema. This selector should be used to enable denormalizing projector functions access to all needed schema entities.

getResult

getResult: MemoizedSelector<any, string[]> = createSelector(getNormalizedState,(state: NormalizedEntityState) => state.result)

Select the result order of the last set operation.

Functions

createEntitiesProjector

  • createEntitiesProjector<T>(schema: Entity): (Anonymous function)
  • Create a schema bound projector function to denormalize an object of normalized entities

    Type parameters

    • T

    Parameters

    • schema: Entity

      The schema to bind this selector to

    Returns (Anonymous function)

createEntitiesSelector

  • createEntitiesSelector<T>(schema: Entity): MemoizedSelector<__type, T[]>
  • Create a schema bound selector which denormalizes all entities with the given schema.

    Type parameters

    • T

    Parameters

    • schema: Entity

      The schema to bind this selector to

    Returns MemoizedSelector<__type, T[]>

createEntityProjector

  • createEntityProjector<T>(schema: Entity): (Anonymous function)
  • Create a schema bound projector function to denormalize a single entity.

    Type parameters

    • T

    Parameters

    • schema: Entity

      The schema to bind this selector to

    Returns (Anonymous function)

createMultipleDenormalizer

  • createMultipleDenormalizer(schema: Entity): (Anonymous function)
  • Create a schema bound denormalizer.

    Parameters

    • schema: Entity

      The schema to bind this selector to

    Returns (Anonymous function)

createSchemaSelectors

  • Creates an object of selectors and projector functions bound to the given schema.

    Type parameters

    • T

    Parameters

    • schema: Entity

      The schema to bind the selectors and projectors to

    Returns SchemaSelectors<T>

createSingleDenormalizer

  • createSingleDenormalizer(schema: Entity): (Anonymous function)
  • Create a schema bound denormalizer.

    Parameters

    • schema: Entity

      The schema to bind this selector to

    Returns (Anonymous function)

getNormalizedState

Private getParentReferences

normalized

  • The normalizing reducer function which will handle actions with the types NormalizeActionTypes.SET_DATA, NormalizeActionTypes.ADD_DATA and NormalizeActionTypes.REMOVE_DATA.

    On an NormalizeActionTypes.SET_DATA action:

    All entities and childs of the given schema will be replaced with the new entities.

    On an NormalizeActionTypes.ADD_DATA action:

    Entities are identified by their id attribute set in the schema passed by the payload. Existing entities will be overwritten by updated data, new entities will be added to the store.

    On an NormalizeActionTypes.REMOVE_DATA action:

    Entities are identified by their id attribute set in the schema passed by the payload. The entity with the passed id will be removed. If a removeChildren option is set in the action payload, it is assumed as a map of schema keys to object property names. All referenced children of the entity will be read by the object propety name and removed by the schema key.

    Parameters

    • Default value state: NormalizedEntityState = initialState

      The current state

    • action: any

      The dispatched action, one of NormalizeActionTypes.ADD_DATA or NormalizeActionTypes.REMOVE_DATA.

    Returns object

    • result: any
    • entities: object

Object literals

initialState

initialState: object

The initial state for the normalized entity state.

entities

entities: object

Type declaration

result

result: undefined[] = []

Generated using TypeDoc