Gathering detailed insights and metrics for @budarin/redux-business-logic-middleare
Gathering detailed insights and metrics for @budarin/redux-business-logic-middleare
Gathering detailed insights and metrics for @budarin/redux-business-logic-middleare
Gathering detailed insights and metrics for @budarin/redux-business-logic-middleare
Middleware for processing business login in redux application
npm install @budarin/redux-business-logic-middleare
Typescript
Module System
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
121 Commits
2 Watchers
2 Branches
1 Contributors
Updated on Sep 01, 2024
Latest Version
2.1.11
Package Id
@budarin/redux-business-logic-middleare@2.1.11
Unpacked Size
12.54 kB
Size
4.82 kB
File Count
10
Published on
Apr 05, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Middleware for processing business login in redux application.
Using npm
1npm install --save-dev @budarin/redux-business-logic-middleare
Using yarn
1yarn add -D @budarin/redux-business-logic-middleare
Let's implement a simple business rule for Todo: “when creating a todo, send the todo to the server and to the redux store”.
Let's describe the essence of Todo — its constants, actions, business rules and a redeser in accordance with the concept of ducks.
./ducks/todo.js
1import { sendTodo } from 'src/services/api' 2import { onAction } from'@budarin/redux-business-logic-middleare'; 3 4const SET_ERROR = 'TODO/SET_ERROR'; 5export const ADD_TODO = 'TODO/ADD_TODO'; 6 7export const setError = (error) => ({ 8 type: SET_ERROR, 9 payload: error 10}) 11 12export const addTodo = ( todo ) => ({ 13 type: ADD_TODO, 14 payload: todo 15}); 16 17// our business rule 18export const addTodoMiddleware = async (store, next, action) => { 19 // call the API method to send todo to the server 20 try { 21 await sendTodo(action.payload); 22 } catch(error) { 23 return store.dispatch(setError(error)); 24 } 25 26 // otherwise, we pass the action to the next middleware 27 return next(action); 28} 29 30// let's add the business rule 31onAction(ADD_TODO, addTodoMiddleware) 32 33 34export default const reducer = (state = initialState, action) => { 35 switch (action.type) { 36 case ADD_TODO: { 37 ... 38 } 39 case SET_ERROR { 40 ... 41 } 42 default: 43 return state; 44 } 45};
Add midleware to stores middlewares
1import todoReducer from '../ducks/todo.js' 2import { createStore, applyMiddleware, combineReducers } from 'redux' 3import { bussinesLogicMiddleware } from '@budarin/redux-business-logic-middleare'; 4 5const reducers = combineReducers( 6 ... 7 todoReducer, 8 ... 9); 10 11const store = createStore( 12 reducers, 13 initialState, 14 applyMiddleware(bussinesLogicMiddleware) 15);
To remove bussines-rule from processing
1import { ADD_TODO } from '../ducks/todo.js' 2import { offAction } from '@budarin/redux-business-logic-middleare'; 3 4offAction(ADD_TODO);
To remove all bussines-rules from processing
1import { removeAllBusinessRules } from '@budarin/redux-business-logic-middleare'; 2 3removeAllBusinessRules();
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More