Skip to content

0.6.0 Beta (2021-04-02)

Compare
Choose a tag to compare
@jrista jrista released this 06 Apr 00:16
· 77 commits to develop since this release

Auto-Entity version 0.6 introduces NgRx 8+ compatible action factory functions. Similar to the
kind of actions (technically factory functions that create actions!) you get when using the
createAction factory function from NgRx itself. This change is NON-Breaking, as all legacy
actions remain in place and fully usable, allowing migration to the new actions to be done
progressively if necessary.

New actions may be destructured from the object returend by calling buildState and buildFeatureState,
as with all other auto-entity state functionality. Simply destructure the new actions property:

export const {
  actions: {
    loadAll: loadAllCustomers,
    create: createCustomer,
    update: updateCustomer,
    delete: deleteCustomer,
    select: selectCustomer,
    deselect: deselectCustomer,
    // ... many more!
  }
} = buildState(Customer);

Actions introduce a new mechanism for building auto-entity state. Only the actions that are actually
used (i.e. destructured) are actually created for the specified entity. This should limit the amount
of memory used for auto-entity related functionality. This mechanism will be expanded
to the rest of the state related functionality that can be generated by the build state calls
in the future.

The breaking changes this release should be minimally breaking, and mostly backwards compatible except
in fringe cases covering more unusual use cases. Conversion of selection properties from read only getters
to simple fields should improve the unit testability of facades by allowing simpler mocks, stubs, and fakes,
easier spying, etc. This may also improve support for more custom use cases and extensions in concrete
facade classes.

Features

  • actions: Add NgRx 8+ style action factory functions (#76)
  • util: Add support for NgRx 8+ style action factory generation (#76)
  • actions: Add "bare edit" support with EditNew action (#161)
  • facades: Add "bare edit" support with editNew activity method (#161)
  • selectors: Add new selectHasEntities and selectHasNoEntities selectors (#149)
  • facades: Add new hasEntities$ and hasNoEntities$ selections to facades (#149)

Bug Fix

  • reducer: Fix issue with meta reducer not calling next reducer with next state (#170)
  • decorators: Fix @key decorator to only try to attach NAE_KEYS internal property if it has not yet been set
  • reducer: Add missing updatedAt and replacedAt timestamps in state for each entity

Breaking Changes !!

  • facades: Convert getter properties to fields to improve unit testability/mocking/spying (#150)