Registry / http-networking / redux-shapeshifter-middleware

redux-shapeshifter-middleware

JSON →
library1.3.5jsnpmunverified

Redux middleware version 1.3.5 that enhances Redux actions to handle AJAX calls using axios and qs. It allows actions to define API endpoints, methods, payload generators, authentication from Redux store state, and advanced features like ETags, request cancellation, and response transformations. Released under an active maintenance cadence, it differentiates from other Redux async middleware by integrating deeply with axios configuration and supporting generator-based action flows.

npm install redux-shapeshifter-middleware
INSTALL
IMPORT
SIG · REDUX-SHAPESHIFTER
R
redux-shapeshifter-middleware
http-networkingjavascriptv1.3.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import shapeshifter from 'redux-shapeshifter-middleware'
const shapeshifter = require('redux-shapeshifter-middleware')
ESM default export; CJS require also works but typings may be lost.
shapeshifterMiddleware
import shapeshifter from 'redux-shapeshifter-middleware'
import { shapeshifterMiddleware } from 'redux-shapeshifter-middleware'
The package exports a single function as default. Named import does not exist.
createShapeshifter
import shapeshifter from 'redux-shapeshifter-middleware'
import { createShapeshifter } from 'redux-shapeshifter-middleware'
There is no named export. Use default import.

Demonstrates setting up the middleware with a base URL and auth config, then dispatching a GET request action with lifecycle types.

import { createStore, applyMiddleware } from 'redux'; import shapeshifter from 'redux-shapeshifter-middleware'; const apiMiddleware = shapeshifter({ base: 'https://api.example.com/', auth: { user: 'token' }, fallbackToAxiosStatusResponse: true }); const reducer = (state = {}) => state; const store = createStore(reducer, applyMiddleware(apiMiddleware)); // Dispatch an API action store.dispatch({ type: 'FETCH_USER', types: ['FETCH_USER_PENDING', 'FETCH_USER_SUCCESS', 'FETCH_USER_ERROR'], method: 'GET', payload: { url: '/users/123', auth: true } });
Debug
Known issues
breaking{action}.payload.types is deprecated in favor of {action}.types
fix
Move the 'types' array from payload to the top-level action object.
affects: >=0.1.1
deprecatedThe 'errors' array check was fixed in v0.4.1 to only reject when length > 0, but older versions rejected empty arrays.
fix
Upgrade to v0.4.1 or later.
affects: <=0.4.0
gotchaIf 'useFullResponseObject' is not set in action or config, the middleware slices the response to only return data.
fix
Set 'useFullResponseObject: true' in config or action to get the full axios response object.
affects: >=0.1.0
gotchaThe 'auth' property in config must match a path in the Redux store; otherwise, authentication headers will be undefined.
fix
Ensure the nested object path exists in state, e.g., state.user.token for auth: { user: 'token' }.
affects: >=0.5.2
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'types')
Action object does not have a 'types' array at the top level or in payload.
fix
Add a 'types' array to your action with three strings for pending, success, and error action types.
Uncaught (in promise) Error: shapeshifter middleware: payload object is undefined
Action payload is not defined or is undefined.
fix
Ensure the action has a 'payload' property with at least a 'url' string.
Error: shapeshifter middleware: axios is not installed or not passable in config
Axios is not installed as a peer dependency.
fix
Run 'npm install axios' or 'yarn add axios'.
Error: shapeshifter middleware: method must be a valid HTTP method string
Action 'method' property is missing or is an invalid HTTP method.
fix
Set 'method' to one of: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
Upgrade
Version history
1.3.5latest on npm
Audit
Dependencies
axiosrequiredHTTP client for making AJAX requests
Agent activity
4 hits · last 30 days
node
4
Resources
redux-shapeshifter-middleware — npm install redux-shapeshifter-middleware · libregistry