Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ngrx-store-manager
Advanced tools
* An implementation of NgRx Facades on Angular 7.2.0. * The purpose behind this library is to enable developers to create dynamic stores with dynamic actions and effects. * All actions results will be saved in the store automatically on success. * Allows
Run npm i ngrx-store-manager --save
to install the package.
Create a new store.config.ts
file with
import { StoreConfig } from 'ngrx-store-manager';
import { AppService } from './app.service';
export const AppConfig: StoreConfig[] = [
{
state: 'test',
initialState: {
approved: true
},
actions: [
{
name: 'GET_OTHER',
service: AppService,
method: 'getOtherData'
},
{
name: 'SET_OTHER',
service: AppService,
method: 'setOtherData'
}
]
}
];
And in your .module.ts
file add StoreManagerModule
to the imports
of your root module
StorageManagerModule.forRoot(AppConfig)
Or if you are using it in a feature module you can use StorageManagerModule.forChild
test
and we added an initial state for that storeGET
and SET
which will use two methods from AppService
to execute the actionsforRoot
method can take options
as second argument, the current acceptable options is useLocalStorage
which can be set to true
which will make the module always save store states into localStorage. Since this is obviously not recommended in production environment, it is best to use !environment.production
from your Angular environment file.
StorageManagerModule.forRoot(AppConfig, { useLocalStorage: !environment.production })
Using the facade will be easy from here on, just import the facade into your component file and add it to the constructor
import { StoreFacade } from 'ngrx-store-manager';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
constructor(public store: StoreFacade) { }
}
this.store.select('test')
will get the store named test
synchronously.this.store.select('test', false)
will create an observable for the store named test
which you can use with the async
pipe.GET
as default action and no payload.this.store.getData('test', 'GET_OTHER')
will dispatch a GET_OTHER
event.SET
as default action and payload is required.this.store.getData('test', payload, 'SET_OTHER')
will dispatch a SET_OTHER
event.Please refer to the demo folder or follow this link https://stackblitz.com/edit/ngrx-store-manager-demo
FAQs
* An implementation of NgRx Facades on Angular 7.2.0. * The purpose behind this library is to enable developers to create dynamic stores with dynamic actions and effects. * All actions results will be saved in the store automatically on success. * Allows
We found that ngrx-store-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.