# ngx-painless-redux

> ### Description

Latest version **4.0.14** (published 2021-01-11) · 0 weekly downloads

## Install

```sh
npm install ngx-painless-redux
pnpm add ngx-painless-redux
yarn add ngx-painless-redux
bun add ngx-painless-redux
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.14 |
| Published | 2021-01-11 |
| First published | 2020-04-26 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 202.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | grushinegor |

## Links

- npm: https://www.npmjs.com/package/ngx-painless-redux
- npm.io page: https://npm.io/package/ngx-painless-redux

## Recent versions

- 4.0.14 (latest) — 2021-01-11
- 4.0.13 — 2021-01-11
- 4.0.12 — 2020-12-21
- 4.0.11 — 2020-05-06
- 4.0.10 — 2020-05-05
- 4.0.9 — 2020-05-05
- 4.0.8 — 2020-05-05
- 0.0.0 — 2020-05-05
- 4.0.7 — 2020-05-04
- 4.0.6 — 2020-05-04
- 4.0.5 — 2020-05-04
- 4.0.4 — 2020-04-29
- 4.0.3 — 2020-04-29
- 4.0.2 — 2020-04-29
- 4.0.1 — 2020-04-26
- … 2 more at https://npm.io/package/ngx-painless-redux/versions

## README

# NgxPainlessRedux

### Description

This is [painless-redux](https://github.com/egorgrushin/painless-redux) adapter for Angular using [@ngrx/store](https://www.npmjs.com/package/@ngrx/store).

### Install: 
1. `npm i painless-redux ngx-painless-redux @ngrx/store`
2. Import `NgxPainlessReduxModule` to your app module next to `StoreModule` from [@ngrx/store](https://www.npmjs.com/package/@ngrx/store), then import `actionSanitizer` from `painless-redux` and add it as actionSanitizer for ` StoreDevtoolsModule.instrument` param:

```typescript
import { NgxPainlessReduxModule } from 'ngx-painless-redux';
import { actionSanitizer } from 'painless-redux';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    StoreModule.forRoot({}),
    StoreDevtoolsModule.instrument({
      actionSanitizer, // <-- here
    }),
    NgxPainlessReduxModule, // <-- here
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}
```

3. Inherit from `EntityStorageService`:

```typescript
import { Injectable } from '@angular/core';
import { EntityStorageService } from 'ngx-painless-redux';

export interface Entity1 {
  id: string;
  name: string;
  age: number;
}

@Injectable({ providedIn: 'root' })
export class Entity1Storage extends EntityStorageService<Entity1> {

  constructor() {
    super({ name: 'Entity1', pageSize: 2, maxPagesCount: 2 });
  }
}
```

4. or from `WorkspaceStorageService`:

```typescript
import { Injectable } from '@angular/core';
import { WorkspaceStorageService } from 'ngx-painless-redux';

export interface Workspace1 {
  filter: number[];
}

@Injectable({ providedIn: 'root' })
export class Workspace1Storage extends WorkspaceStorageService<Workspace1> {

  constructor() {
    super({
      name: 'Workspace1', 
      initialValue: {
        filter: [1, 2, 3],
      },
    });
  }
}
```
5. inject it to your components / services

---
_Source: https://npm.io/package/ngx-painless-redux · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
