Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
redux-swagger-client
Advanced tools
Swagger middleware for redux
This is an attempt to add asynchronous swagger api calls to redux. It works by dispatching an action that includes the field swagger
that takes a function and passes the swagger client element to that function. If the swagger spec has not yet been parsed, the action will get queued.
note: This module requires redux-thunk Github:
npm install --save github:noh4ck/redux-swagger-client
Package pending:
npm install --save redux-swagger-client
To enable Redux Swagger-client, use applyMiddleware()
:
import { createStore, applyMiddleware } from 'redux'
import swaggerClient from 'redux-swagger-client'
import thunk from 'redux-thunk'
const store = createStore(
rootReducer,
applyMiddleware([
thunk,
swaggerClient({url:'http://petstore.swagger.io/v2/swagger.json'})
])
);
function fetchPet() {
return {
types: ["FETCH_PETS", "FETCH_PETS_SUCCESS", "FETCH_PETS_FAILED"],
swagger: api => api.pet.findPetsByStatus({status: 'available'})
}
}
store.dispatch(fetchPets())
Note, it's also possible to dispatch functions:
function fetchPets_request(json) {
return {
type: 'FETCH_PETS',
receivedAt: Date.now()
}
}
function fetchPets_success(json) {
return {
type: 'FETCH_PETS_SUCCESS',
pets: json.result.body,
receivedAt: Date.now()
}
}
function fetchPets_failure(json) {
return {
type: 'FETCH_PETS_FAILED',
pets: null,
error,
receivedAt: Date.now()
}
}
function fetchPet() {
return {
actions: [fetchPets_request, fetchPets_success, fetchPets_failure],
swagger: api => api.pet.findPetsByStatus({status: 'available'})
}
}
store.dispatch(fetchPets())
FAQs
Swagger middleware for Redux.
We found that redux-swagger-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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 researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.