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

redux-promise-middleware

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-promise-middleware - npm Package Compare versions

Comparing version 6.1.2 to 6.1.3

103

dist/es/index.js

@@ -1,7 +0,16 @@

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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; }
import isPromise from './isPromise.js';
/**

@@ -11,2 +20,3 @@ * For TypeScript support: Remember to check and make sure

*/
export var ActionType = {

@@ -17,3 +27,2 @@ Pending: 'PENDING',

};
/**

@@ -24,16 +33,12 @@ * Function: createPromise

*/
export function createPromise() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultTypes = [ActionType.Pending, ActionType.Fulfilled, ActionType.Rejected];
var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter === undefined ? '_' : config.promiseTypeDelimiter;
return function (ref) {
var dispatch = ref.dispatch;
return function (next) {
return function (action) {
/**

@@ -44,5 +49,4 @@ * Instantiate variables to hold:

*/
var promise = void 0;
var data = void 0;
var promise;
var data;
/**

@@ -58,43 +62,32 @@ * There are multiple ways to dispatch a promise. The first step is to

*/
// Step 1a: Is there a payload?
// Step 1a: Is there a payload?
if (action.payload) {
var PAYLOAD = action.payload;
var PAYLOAD = action.payload; // Step 1.1: Is the promise implicitly defined?
// Step 1.1: Is the promise implicitly defined?
if (isPromise(PAYLOAD)) {
promise = PAYLOAD;
}
// Step 1.2: Is the promise explicitly defined?
} // Step 1.2: Is the promise explicitly defined?
else if (isPromise(PAYLOAD.promise)) {
promise = PAYLOAD.promise;
data = PAYLOAD.data;
}
// Step 1.3: Is the promise returned by an async function?
} // Step 1.3: Is the promise returned by an async function?
else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {
promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();
data = PAYLOAD.promise ? PAYLOAD.data : undefined;
data = PAYLOAD.promise ? PAYLOAD.data : undefined; // Step 1.3.1: Is the return of action.payload a promise?
// Step 1.3.1: Is the return of action.payload a promise?
if (!isPromise(promise)) {
// If not, move on to the next middleware.
return next(_extends({}, action, {
return next(_objectSpread({}, action, {
payload: promise
}));
}
}
// Step 1.4: If there's no promise, move on to the next middleware.
} // Step 1.4: If there's no promise, move on to the next middleware.
else {
return next(action);
}
} // Step 1b: If there's no payload, move on to the next middleware.
// Step 1b: If there's no payload, move on to the next middleware.
} else {
return next(action);
}
/**

@@ -105,5 +98,6 @@ * Instantiate and define constants for:

*/
var TYPE = action.type;
var META = action.meta;
/**

@@ -118,3 +112,2 @@ * Instantiate and define constants for the action type suffixes.

REJECTED = _PROMISE_TYPE_SUFFIXE[2];
/**

@@ -146,13 +139,13 @@ * Function: getAction

var getAction = function getAction(newPayload, isRejected) {
return _extends({
return _objectSpread({
// Concatenate the type string property.
type: [TYPE, isRejected ? REJECTED : FULFILLED].join(PROMISE_TYPE_DELIMITER)
}, newPayload === null || typeof newPayload === 'undefined' ? {} : {
payload: newPayload
}, META !== undefined ? { meta: META } : {}, isRejected ? {
}, {}, META !== undefined ? {
meta: META
} : {}, {}, isRejected ? {
error: true
} : {});
};
/**

@@ -166,9 +159,9 @@ * Function: handleReject

*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};
/**

@@ -181,11 +174,13 @@ * Function: handleFulfill

*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return { value: value, action: resolvedAction };
return {
value: value,
action: resolvedAction
};
};
/**

@@ -196,8 +191,12 @@ * First, dispatch the pending action:

*/
next(_extends({
next(_objectSpread({
// Concatenate the type string.
type: [TYPE, PENDING].join(PROMISE_TYPE_DELIMITER)
}, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));
}, data !== undefined ? {
payload: data
} : {}, {}, META !== undefined ? {
meta: META
} : {}));
/**

@@ -207,2 +206,3 @@ * Second, dispatch a rejected or fulfilled action and move on to the

*/
return promise.then(handleFulfill, handleReject);

@@ -213,3 +213,2 @@ };

}
export default function middleware() {

@@ -220,3 +219,5 @@ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},

if (typeof dispatch === 'function') {
return createPromise()({ dispatch: dispatch });
return createPromise()({
dispatch: dispatch
});
}

@@ -226,3 +227,3 @@

// eslint-disable-next-line no-console
console.warn('Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the "createPromise" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from \'redux-promise-middleware\';\nconst promise = createPromise({ types: { fulfilled: \'success\' } });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from \'redux-promise-middleware\';\napplyMiddleware(promise);\n ');
console.warn("Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the \"createPromise\" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from 'redux-promise-middleware';\nconst promise = createPromise({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from 'redux-promise-middleware';\napplyMiddleware(promise);\n ");
}

@@ -229,0 +230,0 @@

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

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
export default function isPromise(value) {
if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
if (value !== null && _typeof(value) === 'object') {
return value && typeof value.then === 'function';

@@ -6,0 +6,0 @@ }

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,17 +6,24 @@ Object.defineProperty(exports, "__esModule", {

});
exports.ActionType = undefined;
exports.createPromise = createPromise;
exports["default"] = middleware;
exports.ActionType = void 0;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _isPromise = _interopRequireDefault(require("./isPromise.js"));
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.createPromise = createPromise;
exports.default = middleware;
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
var _isPromise = require('./isPromise.js');
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
var _isPromise2 = _interopRequireDefault(_isPromise);
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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; }
/**

@@ -26,3 +33,3 @@ * For TypeScript support: Remember to check and make sure

*/
var ActionType = exports.ActionType = {
var ActionType = {
Pending: 'PENDING',

@@ -32,3 +39,2 @@ Fulfilled: 'FULFILLED',

};
/**

@@ -39,16 +45,14 @@ * Function: createPromise

*/
exports.ActionType = ActionType;
function createPromise() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultTypes = [ActionType.Pending, ActionType.Fulfilled, ActionType.Rejected];
var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter === undefined ? '_' : config.promiseTypeDelimiter;
return function (ref) {
var dispatch = ref.dispatch;
return function (next) {
return function (action) {
/**

@@ -59,5 +63,4 @@ * Instantiate variables to hold:

*/
var promise = void 0;
var data = void 0;
var promise;
var data;
/**

@@ -73,43 +76,32 @@ * There are multiple ways to dispatch a promise. The first step is to

*/
// Step 1a: Is there a payload?
// Step 1a: Is there a payload?
if (action.payload) {
var PAYLOAD = action.payload;
var PAYLOAD = action.payload; // Step 1.1: Is the promise implicitly defined?
// Step 1.1: Is the promise implicitly defined?
if ((0, _isPromise2.default)(PAYLOAD)) {
if ((0, _isPromise["default"])(PAYLOAD)) {
promise = PAYLOAD;
}
// Step 1.2: Is the promise explicitly defined?
else if ((0, _isPromise2.default)(PAYLOAD.promise)) {
} // Step 1.2: Is the promise explicitly defined?
else if ((0, _isPromise["default"])(PAYLOAD.promise)) {
promise = PAYLOAD.promise;
data = PAYLOAD.data;
}
// Step 1.3: Is the promise returned by an async function?
} // Step 1.3: Is the promise returned by an async function?
else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {
promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();
data = PAYLOAD.promise ? PAYLOAD.data : undefined;
data = PAYLOAD.promise ? PAYLOAD.data : undefined; // Step 1.3.1: Is the return of action.payload a promise?
// Step 1.3.1: Is the return of action.payload a promise?
if (!(0, _isPromise2.default)(promise)) {
if (!(0, _isPromise["default"])(promise)) {
// If not, move on to the next middleware.
return next(_extends({}, action, {
return next(_objectSpread({}, action, {
payload: promise
}));
}
}
// Step 1.4: If there's no promise, move on to the next middleware.
} // Step 1.4: If there's no promise, move on to the next middleware.
else {
return next(action);
}
} // Step 1b: If there's no payload, move on to the next middleware.
// Step 1b: If there's no payload, move on to the next middleware.
} else {
return next(action);
}
/**

@@ -120,5 +112,6 @@ * Instantiate and define constants for:

*/
var TYPE = action.type;
var META = action.meta;
/**

@@ -133,3 +126,2 @@ * Instantiate and define constants for the action type suffixes.

REJECTED = _PROMISE_TYPE_SUFFIXE[2];
/**

@@ -161,13 +153,13 @@ * Function: getAction

var getAction = function getAction(newPayload, isRejected) {
return _extends({
return _objectSpread({
// Concatenate the type string property.
type: [TYPE, isRejected ? REJECTED : FULFILLED].join(PROMISE_TYPE_DELIMITER)
}, newPayload === null || typeof newPayload === 'undefined' ? {} : {
payload: newPayload
}, META !== undefined ? { meta: META } : {}, isRejected ? {
}, {}, META !== undefined ? {
meta: META
} : {}, {}, isRejected ? {
error: true
} : {});
};
/**

@@ -181,9 +173,9 @@ * Function: handleReject

*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};
/**

@@ -196,11 +188,13 @@ * Function: handleFulfill

*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return { value: value, action: resolvedAction };
return {
value: value,
action: resolvedAction
};
};
/**

@@ -211,8 +205,12 @@ * First, dispatch the pending action:

*/
next(_extends({
next(_objectSpread({
// Concatenate the type string.
type: [TYPE, PENDING].join(PROMISE_TYPE_DELIMITER)
}, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));
}, data !== undefined ? {
payload: data
} : {}, {}, META !== undefined ? {
meta: META
} : {}));
/**

@@ -222,2 +220,3 @@ * Second, dispatch a rejected or fulfilled action and move on to the

*/
return promise.then(handleFulfill, handleReject);

@@ -234,3 +233,5 @@ };

if (typeof dispatch === 'function') {
return createPromise()({ dispatch: dispatch });
return createPromise()({
dispatch: dispatch
});
}

@@ -240,3 +241,3 @@

// eslint-disable-next-line no-console
console.warn('Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the "createPromise" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from \'redux-promise-middleware\';\nconst promise = createPromise({ types: { fulfilled: \'success\' } });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from \'redux-promise-middleware\';\napplyMiddleware(promise);\n ');
console.warn("Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the \"createPromise\" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from 'redux-promise-middleware';\nconst promise = createPromise({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from 'redux-promise-middleware';\napplyMiddleware(promise);\n ");
}

@@ -243,0 +244,0 @@

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = isPromise;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
exports.default = isPromise;
function isPromise(value) {
if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
if (value !== null && _typeof(value) === 'object') {
return value && typeof value.then === 'function';

@@ -14,0 +14,0 @@ }

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ReduxPromiseMiddleware"] = factory();
})(this, function() {
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -47,16 +47,33 @@ /******/ // The module cache

/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -77,4 +94,5 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })

@@ -84,16 +102,10 @@ /************************************************************************/

/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isPromise; });
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = isPromise;
function isPromise(value) {
if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
if (value !== null && _typeof(value) === 'object') {
return value && typeof value.then === 'function';

@@ -107,2 +119,231 @@ }

/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionType", function() { return ActionType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPromise", function() { return createPromise; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return middleware; });
/* harmony import */ var _isPromise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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; }
/**
* For TypeScript support: Remember to check and make sure
* that `index.d.ts` is also up to date with the implementation.
*/
var ActionType = {
Pending: 'PENDING',
Fulfilled: 'FULFILLED',
Rejected: 'REJECTED'
};
/**
* Function: createPromise
* Description: The main createPromise accepts a configuration
* object and returns the middleware.
*/
function createPromise() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultTypes = [ActionType.Pending, ActionType.Fulfilled, ActionType.Rejected];
var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter === undefined ? '_' : config.promiseTypeDelimiter;
return function (ref) {
var dispatch = ref.dispatch;
return function (next) {
return function (action) {
/**
* Instantiate variables to hold:
* (1) the promise
* (2) the data for optimistic updates
*/
var promise;
var data;
/**
* There are multiple ways to dispatch a promise. The first step is to
* determine if the promise is defined:
* (a) explicitly (action.payload.promise is the promise)
* (b) implicitly (action.payload is the promise)
* (c) as an async function (returns a promise when called)
*
* If the promise is not defined in one of these three ways, we don't do
* anything and move on to the next middleware in the middleware chain.
*/
// Step 1a: Is there a payload?
if (action.payload) {
var PAYLOAD = action.payload; // Step 1.1: Is the promise implicitly defined?
if (Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(PAYLOAD)) {
promise = PAYLOAD;
} // Step 1.2: Is the promise explicitly defined?
else if (Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(PAYLOAD.promise)) {
promise = PAYLOAD.promise;
data = PAYLOAD.data;
} // Step 1.3: Is the promise returned by an async function?
else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {
promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();
data = PAYLOAD.promise ? PAYLOAD.data : undefined; // Step 1.3.1: Is the return of action.payload a promise?
if (!Object(_isPromise_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(promise)) {
// If not, move on to the next middleware.
return next(_objectSpread({}, action, {
payload: promise
}));
}
} // Step 1.4: If there's no promise, move on to the next middleware.
else {
return next(action);
} // Step 1b: If there's no payload, move on to the next middleware.
} else {
return next(action);
}
/**
* Instantiate and define constants for:
* (1) the action type
* (2) the action meta
*/
var TYPE = action.type;
var META = action.meta;
/**
* Instantiate and define constants for the action type suffixes.
* These are appended to the end of the action type.
*/
var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),
PENDING = _PROMISE_TYPE_SUFFIXE[0],
FULFILLED = _PROMISE_TYPE_SUFFIXE[1],
REJECTED = _PROMISE_TYPE_SUFFIXE[2];
/**
* Function: getAction
* Description: This function constructs and returns a rejected
* or fulfilled action object. The action object is based off the Flux
* Standard Action (FSA).
*
* Given an original action with the type FOO:
*
* The rejected object model will be:
* {
* error: true,
* type: 'FOO_REJECTED',
* payload: ...,
* meta: ... (optional)
* }
*
* The fulfilled object model will be:
* {
* type: 'FOO_FULFILLED',
* payload: ...,
* meta: ... (optional)
* }
*/
var getAction = function getAction(newPayload, isRejected) {
return _objectSpread({
// Concatenate the type string property.
type: [TYPE, isRejected ? REJECTED : FULFILLED].join(PROMISE_TYPE_DELIMITER)
}, newPayload === null || typeof newPayload === 'undefined' ? {} : {
payload: newPayload
}, {}, META !== undefined ? {
meta: META
} : {}, {}, isRejected ? {
error: true
} : {});
};
/**
* Function: handleReject
* Calls: getAction to construct the rejected action
* Description: This function dispatches the rejected action and returns
* the original Error object. Please note the developer is responsible
* for constructing and throwing an Error object. The middleware does not
* construct any Errors.
*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};
/**
* Function: handleFulfill
* Calls: getAction to construct the fullfilled action
* Description: This function dispatches the fulfilled action and
* returns the success object. The success object should
* contain the value and the dispatched action.
*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return {
value: value,
action: resolvedAction
};
};
/**
* First, dispatch the pending action:
* This object describes the pending state of a promise and will include
* any data (for optimistic updates) and/or meta from the original action.
*/
next(_objectSpread({
// Concatenate the type string.
type: [TYPE, PENDING].join(PROMISE_TYPE_DELIMITER)
}, data !== undefined ? {
payload: data
} : {}, {}, META !== undefined ? {
meta: META
} : {}));
/**
* Second, dispatch a rejected or fulfilled action and move on to the
* next middleware.
*/
return promise.then(handleFulfill, handleReject);
};
};
};
}
function middleware() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
dispatch = _ref.dispatch;
if (typeof dispatch === 'function') {
return createPromise()({
dispatch: dispatch
});
}
if (process && process.env && "production" !== 'production') {
// eslint-disable-next-line no-console
console.warn("Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the \"createPromise\" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from 'redux-promise-middleware';\nconst promise = createPromise({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from 'redux-promise-middleware';\napplyMiddleware(promise);\n ");
}
return null;
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
/***/ }),
/* 2 */
/***/ (function(module, exports) {

@@ -296,241 +537,4 @@

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ActionType = undefined;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.createPromise = createPromise;
exports.default = middleware;
var _isPromise = __webpack_require__(0);
var _isPromise2 = _interopRequireDefault(_isPromise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* For TypeScript support: Remember to check and make sure
* that `index.d.ts` is also up to date with the implementation.
*/
var ActionType = exports.ActionType = {
Pending: 'PENDING',
Fulfilled: 'FULFILLED',
Rejected: 'REJECTED'
};
/**
* Function: createPromise
* Description: The main createPromise accepts a configuration
* object and returns the middleware.
*/
function createPromise() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultTypes = [ActionType.Pending, ActionType.Fulfilled, ActionType.Rejected];
var PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;
var PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';
return function (ref) {
var dispatch = ref.dispatch;
return function (next) {
return function (action) {
/**
* Instantiate variables to hold:
* (1) the promise
* (2) the data for optimistic updates
*/
var promise = void 0;
var data = void 0;
/**
* There are multiple ways to dispatch a promise. The first step is to
* determine if the promise is defined:
* (a) explicitly (action.payload.promise is the promise)
* (b) implicitly (action.payload is the promise)
* (c) as an async function (returns a promise when called)
*
* If the promise is not defined in one of these three ways, we don't do
* anything and move on to the next middleware in the middleware chain.
*/
// Step 1a: Is there a payload?
if (action.payload) {
var PAYLOAD = action.payload;
// Step 1.1: Is the promise implicitly defined?
if ((0, _isPromise2.default)(PAYLOAD)) {
promise = PAYLOAD;
}
// Step 1.2: Is the promise explicitly defined?
else if ((0, _isPromise2.default)(PAYLOAD.promise)) {
promise = PAYLOAD.promise;
data = PAYLOAD.data;
}
// Step 1.3: Is the promise returned by an async function?
else if (typeof PAYLOAD === 'function' || typeof PAYLOAD.promise === 'function') {
promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();
data = PAYLOAD.promise ? PAYLOAD.data : undefined;
// Step 1.3.1: Is the return of action.payload a promise?
if (!(0, _isPromise2.default)(promise)) {
// If not, move on to the next middleware.
return next(_extends({}, action, {
payload: promise
}));
}
}
// Step 1.4: If there's no promise, move on to the next middleware.
else {
return next(action);
}
// Step 1b: If there's no payload, move on to the next middleware.
} else {
return next(action);
}
/**
* Instantiate and define constants for:
* (1) the action type
* (2) the action meta
*/
var TYPE = action.type;
var META = action.meta;
/**
* Instantiate and define constants for the action type suffixes.
* These are appended to the end of the action type.
*/
var _PROMISE_TYPE_SUFFIXE = _slicedToArray(PROMISE_TYPE_SUFFIXES, 3),
PENDING = _PROMISE_TYPE_SUFFIXE[0],
FULFILLED = _PROMISE_TYPE_SUFFIXE[1],
REJECTED = _PROMISE_TYPE_SUFFIXE[2];
/**
* Function: getAction
* Description: This function constructs and returns a rejected
* or fulfilled action object. The action object is based off the Flux
* Standard Action (FSA).
*
* Given an original action with the type FOO:
*
* The rejected object model will be:
* {
* error: true,
* type: 'FOO_REJECTED',
* payload: ...,
* meta: ... (optional)
* }
*
* The fulfilled object model will be:
* {
* type: 'FOO_FULFILLED',
* payload: ...,
* meta: ... (optional)
* }
*/
var getAction = function getAction(newPayload, isRejected) {
return _extends({
// Concatenate the type string property.
type: [TYPE, isRejected ? REJECTED : FULFILLED].join(PROMISE_TYPE_DELIMITER)
}, newPayload === null || typeof newPayload === 'undefined' ? {} : {
payload: newPayload
}, META !== undefined ? { meta: META } : {}, isRejected ? {
error: true
} : {});
};
/**
* Function: handleReject
* Calls: getAction to construct the rejected action
* Description: This function dispatches the rejected action and returns
* the original Error object. Please note the developer is responsible
* for constructing and throwing an Error object. The middleware does not
* construct any Errors.
*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};
/**
* Function: handleFulfill
* Calls: getAction to construct the fullfilled action
* Description: This function dispatches the fulfilled action and
* returns the success object. The success object should
* contain the value and the dispatched action.
*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return { value: value, action: resolvedAction };
};
/**
* First, dispatch the pending action:
* This object describes the pending state of a promise and will include
* any data (for optimistic updates) and/or meta from the original action.
*/
next(_extends({
// Concatenate the type string.
type: [TYPE, PENDING].join(PROMISE_TYPE_DELIMITER)
}, data !== undefined ? { payload: data } : {}, META !== undefined ? { meta: META } : {}));
/**
* Second, dispatch a rejected or fulfilled action and move on to the
* next middleware.
*/
return promise.then(handleFulfill, handleReject);
};
};
};
}
function middleware() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
dispatch = _ref.dispatch;
if (typeof dispatch === 'function') {
return createPromise()({ dispatch: dispatch });
}
if (process && process.env && process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn('Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the "createPromise" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from \'redux-promise-middleware\';\nconst promise = createPromise({ types: { fulfilled: \'success\' } });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from \'redux-promise-middleware\';\napplyMiddleware(promise);\n ');
}
return null;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
/***/ })
/******/ ]);
});

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ReduxPromiseMiddleware=t():e.ReduxPromiseMiddleware=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";function n(e){return null!==e&&"object"===(void 0===e?"undefined":o(e))&&(e&&"function"==typeof e.then)}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function i(e){if(s===clearTimeout)return clearTimeout(e);if((s===n||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{return s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}function u(){y&&p&&(y=!1,p.length?m=p.concat(m):h=-1,m.length&&c())}function c(){if(!y){var e=o(u);y=!0;for(var t=m.length;t;){for(p=m,m=[];++h<t;)p&&p[h].run();h=-1,t=m.length}p=null,y=!1,i(e)}}function a(e,t){this.fun=e,this.array=t}function f(){}var l,s,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{s="function"==typeof clearTimeout?clearTimeout:n}catch(e){s=n}}();var p,m=[],y=!1,h=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];m.push(new a(e,t)),1!==m.length||y||o(c)},a.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=f,d.addListener=f,d.once=f,d.off=f,d.removeListener=f,d.removeAllListeners=f,d.emit=f,d.prependListener=f,d.prependOnceListener=f,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,r){"use strict";(function(e){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[f.Pending,f.Fulfilled,f.Rejected],r=e.promiseTypeSuffixes||t,n=e.promiseTypeDelimiter||"_";return function(e){var t=e.dispatch;return function(e){return function(o){var c=void 0,f=void 0;if(!o.payload)return e(o);var l=o.payload;if((0,a.default)(l))c=l;else if((0,a.default)(l.promise))c=l.promise,f=l.data;else{if("function"!=typeof l&&"function"!=typeof l.promise)return e(o);if(c=l.promise?l.promise():l(),f=l.promise?l.data:void 0,!(0,a.default)(c))return e(u({},o,{payload:c}))}var s=o.type,d=o.meta,p=i(r,3),m=p[0],y=p[1],h=p[2],v=function(e,t){return u({type:[s,t?h:y].join(n)},null===e||void 0===e?{}:{payload:e},void 0!==d?{meta:d}:{},t?{error:!0}:{})},g=function(e){var r=v(e,!0);throw t(r),e},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=v(e,!1);return t(r),{value:e,action:r}};return e(u({type:[s,m].join(n)},void 0!==f?{payload:f}:{},void 0!==d?{meta:d}:{})),c.then(b,g)}}}}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.dispatch;return"function"==typeof r?n()({dispatch:r}):(e&&e.env&&"production"!==e.env.NODE_ENV&&console.warn("Redux Promise Middleware: As of version 6.0.0, the middleware library supports both preconfigured and custom configured middleware. To use a custom configuration, use the \"createPromise\" export and call this function with your configuration property. To use a preconfiguration, use the default export. For more help, check the upgrading guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6\n\nFor custom configuration:\nimport { createPromise } from 'redux-promise-middleware';\nconst promise = createPromise({ types: { fulfilled: 'success' } });\napplyMiddleware(promise);\n\nFor preconfiguration:\nimport promise from 'redux-promise-middleware';\napplyMiddleware(promise);\n "),null)}Object.defineProperty(t,"__esModule",{value:!0}),t.ActionType=void 0;var i=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&c.return&&c.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.createPromise=n,t.default=o;var c=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(c),f=t.ActionType={Pending:"PENDING",Fulfilled:"FULFILLED",Rejected:"REJECTED"}}).call(t,r(1))}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ReduxPromiseMiddleware=t():e.ReduxPromiseMiddleware=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return null!==e&&"object"===n(e)&&(e&&"function"==typeof e.then)}r.d(t,"a",(function(){return o}))},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"ActionType",(function(){return f})),r.d(t,"createPromise",(function(){return l})),r.d(t,"default",(function(){return a}));var n=r(0);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f={Pending:"PENDING",Fulfilled:"FULFILLED",Rejected:"REJECTED"};function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[f.Pending,f.Fulfilled,f.Rejected],r=e.promiseTypeSuffixes||t,i=void 0===e.promiseTypeDelimiter?"_":e.promiseTypeDelimiter;return function(e){var t=e.dispatch;return function(e){return function(c){var f,l;if(!c.payload)return e(c);var a=c.payload;if(Object(n.a)(a))f=a;else if(Object(n.a)(a.promise))f=a.promise,l=a.data;else{if("function"!=typeof a&&"function"!=typeof a.promise)return e(c);if(f=a.promise?a.promise():a(),l=a.promise?a.data:void 0,!Object(n.a)(f))return e(u({},c,{payload:f}))}var p=c.type,s=c.meta,d=o(r,3),y=d[0],m=d[1],b=d[2],v=function(e,t){return u({type:[p,t?b:m].join(i)},null==e?{}:{payload:e},{},void 0!==s?{meta:s}:{},{},t?{error:!0}:{})};return e(u({type:[p,y].join(i)},void 0!==l?{payload:l}:{},{},void 0!==s?{meta:s}:{})),f.then((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=v(e,!1);return t(r),{value:e,action:r}}),(function(e){var r=v(e,!0);throw t(r),e}))}}}}function a(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).dispatch;return"function"==typeof t?l()({dispatch:t}):(e&&e.env,null)}}.call(this,r(2))},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(e){n=u}}();var f,l=[],a=!1,p=-1;function s(){a&&f&&(a=!1,f.length?l=f.concat(l):p=-1,l.length&&d())}function d(){if(!a){var e=c(s);a=!0;for(var t=l.length;t;){for(f=l,l=[];++p<t;)f&&f[p].run();p=-1,t=l.length}f=null,a=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new y(e,t)),1!==l.length||a||c(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));
{
"name": "redux-promise-middleware",
"description": "Enables simple, yet robust handling of async action creators in Redux",
"version": "6.1.2",
"version": "6.1.3",
"main": "dist/index.js",

@@ -14,4 +14,4 @@ "types": "src/index.d.ts",

"build-commonjs": "`npm bin`/babel src -d dist",
"build-umd": "`npm bin`/webpack dist/umd/redux-promise-middleware.js",
"build-umd-min": "NODE_ENV=production `npm bin`/webpack dist/umd/redux-promise-middleware.min.js",
"build-umd": "`npm bin`/webpack --output-filename umd/redux-promise-middleware.js",
"build-umd-min": "NODE_ENV=production `npm bin`/webpack --output-filename umd/redux-promise-middleware.min.js",
"pretest": "npm run lint",

@@ -47,19 +47,21 @@ "test": "`npm bin`/jest",

"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"bluebird": "^3.5.0",
"coveralls": "^2.13.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
"coveralls": "^3.0.8",
"eslint": "^6.7.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"istanbul": "^1.0.0-alpha.2",
"jest": "^23.3.0",
"jest": "^24.9.0",
"redux": "4.0.0",
"webpack": "^2.6.1"
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},

@@ -66,0 +68,0 @@ "peerDependencies": {

@@ -57,3 +57,3 @@ # Redux Promise Middleware

For older versions:
- [5.x](https://github.com/pburtchaell/redux-promise-middleware/tree/5.0.1)
- [5.x](https://github.com/pburtchaell/redux-promise-middleware/tree/5.1.1)
- [4.x](https://github.com/pburtchaell/redux-promise-middleware/tree/4.4.0)

@@ -60,0 +60,0 @@ - [3.x](https://github.com/pburtchaell/redux-promise-middleware/tree/3.3.0)

@@ -21,3 +21,5 @@ import isPromise from './isPromise.js';

const PROMISE_TYPE_SUFFIXES = config.promiseTypeSuffixes || defaultTypes;
const PROMISE_TYPE_DELIMITER = config.promiseTypeDelimiter || '_';
const PROMISE_TYPE_DELIMITER = (
config.promiseTypeDelimiter === undefined ? '_' : config.promiseTypeDelimiter
);

@@ -65,4 +67,4 @@ return ref => {

else if (
typeof PAYLOAD === 'function' ||
typeof PAYLOAD.promise === 'function'
typeof PAYLOAD === 'function'
|| typeof PAYLOAD.promise === 'function'
) {

@@ -225,3 +227,3 @@ promise = PAYLOAD.promise ? PAYLOAD.promise() : PAYLOAD();

import { createPromise } from 'redux-promise-middleware';
const promise = createPromise({ types: { fulfilled: 'success' } });
const promise = createPromise({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] });
applyMiddleware(promise);

@@ -228,0 +230,0 @@

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