Skip to content

Commit

Permalink
chore: merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkrone committed Sep 15, 2017
2 parents fb427fc + d2e41a0 commit e8d5ddb
Show file tree
Hide file tree
Showing 19 changed files with 491 additions and 137 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
* _1.0.3_
* fixed typos (thanks to [@hoisel](https://github.com/hoisel))
* exporting types for reuse in other libraries

* _1.0.2_
* improved documentation
* improved code coverage (100%)
* `SetData` action for setting entity data instead of updating and adding data

* _1.0.1_
* `actionCreators` for creating schema bound actions
* improved code coverage

* _1.0.0_
* first production version

* _0.0.1_
* first development version
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ngrx-normalizr

[![Build Status](https://travis-ci.org/michaelkrone/ngrx-normalizr.svg?branch=master)](https://travis-ci.org/michaelkrone/ngrx-normalizr)
![AOT compatible](https://img.shields.io/badge/aot-compatible-blue.svg)

> Managing [normalized state](http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html) in [ngrx](https://github.com/ngrx/platform) applications, transparently.
Expand Down Expand Up @@ -28,7 +29,7 @@ npm i @ngrx/store normalizr

## Usage
Also refer to the [Typedoc documentation](https://michaelkrone.github.io/ngrx-normalizr/).
To enable the normalizing reducer to store normalized data, you have to add it to your state. The best place for this might be the root state of your application, but feature states may use their own normalized state as well. Extend your state interface with the `NormalizedState` interface. This will force the `ActionReducerMap` to implement a reducer which reduces the state to a `NormalizedState`.
To enable the normalizing reducer to store normalized data, you have to add it to your state. The best place for this might be the root state of your application, but feature states may use their own normalized state as well. Extend your state interface with the `NormalizedState` interface. The`ActionReducerMap` has to implement a reducer which reduces the state to a `NormalizedState`.

```javascript
import { ActionReducerMap } from '@ngrx/store';
Expand All @@ -44,12 +45,12 @@ export const reducers: ActionReducerMap<State> = {
};
```

If there are no other state properties, it is sufficient to add the *ngrx-normalizr* reducer to your state reducers:
If there are no other state properties, it is sufficient to add the *ngrx-normalizr* reducer to your state reducers or simply pass it to `StoreModule.forRoot`.
```javascript
export const reducers: ActionReducerMap<NormalizedState> = { normalized };
```

Now you have a `normalized` state property which can will the normalized data. Do not worry about the weird name,
Now you have a `normalized` state property which will hold the normalized data. Do not worry about the weird name,
you will not have to deal with it.

### Schemas
Expand Down Expand Up @@ -98,7 +99,8 @@ loadEffect$ = this.actions$
```

### Setting data
The `SetData` action will overwrite all entities for a given schema with the normalized entities of the `data` property of the action payload.
The `SetData` action will overwrite all entities for a given schema with the normalized entities of the `data` property of the action payload. This action can
be used for resetting entity state data instead of adding and updating existing entities.

### Removing data
To remove data, *ngrx-normalizr* provides a `RemoveData` action.
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions docs/classes/_actions_normalize_.adddata.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L104">actions/normalize.ts:104</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L124">actions/normalize.ts:124</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -163,7 +163,7 @@ <h3>payload</h3>
<div class="tsd-signature tsd-kind-icon">payload<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-signature-type">NormalizeDataPayload</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">T</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L110">actions/normalize.ts:110</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L130">actions/normalize.ts:130</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -178,7 +178,7 @@ <h3>type</h3>
<div class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;NormalizeActionTypes.ADD_DATA</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L104">actions/normalize.ts:104</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L124">actions/normalize.ts:124</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -241,6 +241,9 @@ <h3>type</h3>
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="_actions_normalize_.setdata.html" class="tsd-kind-icon">Set<wbr>Data</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizeactioncreators.html" class="tsd-kind-icon">Normalize<wbr>Action<wbr>Creators</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-kind-icon">Normalize<wbr>Data<wbr>Payload</a>
</li>
Expand Down
9 changes: 6 additions & 3 deletions docs/classes/_actions_normalize_.normalizeactiontypes.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> ADD_<wbr>DATA</h3>
<div class="tsd-signature tsd-kind-icon">ADD_<wbr>DATA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;&#x60;${ACTION_NAMESPACE} Add Data&#x60;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L71">actions/normalize.ts:71</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L91">actions/normalize.ts:91</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -122,7 +122,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> REMOVE_<wbr>DATA</h3>
<div class="tsd-signature tsd-kind-icon">REMOVE_<wbr>DATA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;&#x60;${ACTION_NAMESPACE} Remove Data&#x60;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L76">actions/normalize.ts:76</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L96">actions/normalize.ts:96</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -137,7 +137,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> SET_<wbr>DATA</h3>
<div class="tsd-signature tsd-kind-icon">SET_<wbr>DATA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;&#x60;${ACTION_NAMESPACE} Set Data&#x60;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L66">actions/normalize.ts:66</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L86">actions/normalize.ts:86</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -200,6 +200,9 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> SET_<wbr>DATA</h3>
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="_actions_normalize_.setdata.html" class="tsd-kind-icon">Set<wbr>Data</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizeactioncreators.html" class="tsd-kind-icon">Normalize<wbr>Action<wbr>Creators</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-kind-icon">Normalize<wbr>Data<wbr>Payload</a>
</li>
Expand Down
9 changes: 6 additions & 3 deletions docs/classes/_actions_normalize_.removedata.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L121">actions/normalize.ts:121</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L141">actions/normalize.ts:141</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -155,7 +155,7 @@ <h3>payload</h3>
<div class="tsd-signature tsd-kind-icon">payload<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_actions_normalize_.normalizeremovepayload.html" class="tsd-signature-type">NormalizeRemovePayload</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L127">actions/normalize.ts:127</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L147">actions/normalize.ts:147</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -170,7 +170,7 @@ <h3>type</h3>
<div class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;NormalizeActionTypes.REMOVE_DATA</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L121">actions/normalize.ts:121</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L141">actions/normalize.ts:141</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -233,6 +233,9 @@ <h3>type</h3>
<li class=" tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="_actions_normalize_.setdata.html" class="tsd-kind-icon">Set<wbr>Data</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizeactioncreators.html" class="tsd-kind-icon">Normalize<wbr>Action<wbr>Creators</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-kind-icon">Normalize<wbr>Data<wbr>Payload</a>
</li>
Expand Down
9 changes: 6 additions & 3 deletions docs/classes/_actions_normalize_.setdata.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L87">actions/normalize.ts:87</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L107">actions/normalize.ts:107</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -163,7 +163,7 @@ <h3>payload</h3>
<div class="tsd-signature tsd-kind-icon">payload<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-signature-type">NormalizeDataPayload</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">T</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L93">actions/normalize.ts:93</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L113">actions/normalize.ts:113</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -178,7 +178,7 @@ <h3>type</h3>
<div class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;NormalizeActionTypes.SET_DATA</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/ef30679/src/actions/normalize.ts#L87">actions/normalize.ts:87</a></li>
<li>Defined in <a href="https://github.com/michaelkrone/ngrx-normalizr/blob/fb427fc/src/actions/normalize.ts#L107">actions/normalize.ts:107</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -241,6 +241,9 @@ <h3>type</h3>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizeactioncreators.html" class="tsd-kind-icon">Normalize<wbr>Action<wbr>Creators</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-has-type-parameter tsd-is-external">
<a href="../interfaces/_actions_normalize_.normalizedatapayload.html" class="tsd-kind-icon">Normalize<wbr>Data<wbr>Payload</a>
</li>
Expand Down
Loading

0 comments on commit e8d5ddb

Please sign in to comment.