Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-api-middleware

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-api-middleware - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

10

es/middleware.js

@@ -1,3 +0,5 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -16,4 +18,3 @@

const defaults = {
ok: res => res.ok,
fetch
ok: res => res.ok
};

@@ -70,3 +71,3 @@ /**

options = {},
fetch: doFetch = middlewareOptions.fetch,
fetch: doFetch = middlewareOptions.fetch || fetch,
ok = middlewareOptions.ok

@@ -193,2 +194,3 @@ } = callAPI;

* @access public
* @deprecated since v3.2.0 use `createMiddleware`
*/

@@ -195,0 +197,0 @@

4

es/middleware.test.js

@@ -1,3 +0,5 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -4,0 +6,0 @@

@@ -1,3 +0,5 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -4,0 +6,0 @@

@@ -288,16 +288,31 @@ 'use strict';

function _objectSpread(target) {
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}

@@ -353,3 +368,3 @@

successType = _objectSpread({
successType = _objectSpread2({
payload: (action, state, res) => getJSON(res)

@@ -364,3 +379,3 @@ }, successType);

failureType = _objectSpread({
failureType = _objectSpread2({
payload: (action, state, res) => getJSON(res).then(json => new ApiError(res.status, res.statusText, json))

@@ -422,4 +437,3 @@ }, failureType);

const defaults = {
ok: res => res.ok,
fetch
ok: res => res.ok
};

@@ -476,3 +490,3 @@ /**

options = {},
fetch: doFetch = middlewareOptions.fetch,
fetch: doFetch = middlewareOptions.fetch || fetch,
ok = middlewareOptions.ok

@@ -493,3 +507,3 @@ } = callAPI;

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError('[RSAA].bailout function failed'),

@@ -505,3 +519,3 @@ error: true

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError('[RSAA].endpoint function failed'),

@@ -518,3 +532,3 @@ error: true

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError('[RSAA].body function failed'),

@@ -531,3 +545,3 @@ error: true

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError('[RSAA].headers function failed'),

@@ -544,3 +558,3 @@ error: true

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError('[RSAA].options function failed'),

@@ -563,3 +577,3 @@ error: true

// Make the API call
res = await doFetch(endpoint, _objectSpread({}, options, {
res = await doFetch(endpoint, _objectSpread2({}, options, {
method,

@@ -572,3 +586,3 @@ body: body || undefined,

// The request was malformed, or there was a network error
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new RequestError(e.message),

@@ -584,3 +598,3 @@ error: true

} catch (e) {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
payload: new InternalError('[RSAA].ok function failed'),

@@ -595,3 +609,3 @@ error: true

} else {
return next((await actionWith(_objectSpread({}, failureType, {
return next((await actionWith(_objectSpread2({}, failureType, {
error: true

@@ -608,2 +622,3 @@ }), [action, getState(), res])));

* @access public
* @deprecated since v3.2.0 use `createMiddleware`
*/

@@ -620,30 +635,13 @@

/**
* Redux middleware for calling an API
* @module redux-api-middleware
* @requires lodash.isplainobject
* @exports {string} RSAA
* @exports {function} isRSAA
* @exports {function} validateRSAA
* @exports {function} isValidRSAA
* @exports {error} InvalidRSAA
* @exports {error} InternalError
* @exports {error} RequestError
* @exports {error} ApiError
* @exports {function} getJSON
* @exports {function} createMiddleware
* @exports {ReduxMiddleWare} apiMiddleware
*/
exports.ApiError = ApiError;
exports.InternalError = InternalError;
exports.InvalidRSAA = InvalidRSAA;
exports.RSAA = RSAA;
exports.isRSAA = isRSAA;
exports.validateRSAA = validateRSAA;
exports.isValidRSAA = isValidRSAA;
exports.InvalidRSAA = InvalidRSAA;
exports.InternalError = InternalError;
exports.RequestError = RequestError;
exports.ApiError = ApiError;
exports.getJSON = getJSON;
exports.apiMiddleware = apiMiddleware;
exports.createAction = createAction;
exports.createMiddleware = createMiddleware;
exports.apiMiddleware = apiMiddleware;
exports.getJSON = getJSON;
exports.isRSAA = isRSAA;
exports.isValidRSAA = isValidRSAA;
exports.validateRSAA = validateRSAA;
{
"name": "redux-api-middleware",
"version": "3.2.0",
"version": "3.2.1",
"description": "Redux middleware for calling an API.",

@@ -36,20 +36,21 @@ "main": "lib/index.cjs.js",

"devDependencies": {
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@size-limit/preset-small-lib": "^4.4.0",
"babel-core": "^7.0.0-bridge.0",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"eslint": "^5.9.0",
"eslint-plugin-jest": "^22.0.0",
"eslint-plugin-prettier": "^3.0.0",
"coveralls": "^3.0.9",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^23.6.0",
"jest-fetch-mock": "^1.7.4",
"prettier": "^1.15.2",
"rimraf": "^2.6.2",
"rollup": "^0.67.1",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^3.4.0",
"size-limit": "^0.21.0"
"jest-fetch-mock": "^1.7.5",
"prettier": "^1.19.1",
"rimraf": "^2.7.1",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.4.0",
"size-limit": "^4.4.0"
},

@@ -56,0 +57,0 @@ "files": [

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc