@ackee/antonio
Advanced tools
Comparing version 2.2.15 to 2.3.0
@@ -1,4 +0,13 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
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) { 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 _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 _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 { call } from 'redux-saga/effects'; | ||
@@ -15,5 +24,5 @@ import * as Store from '../store'; | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee() { | ||
regeneratorRuntime.mark(function _callee() { | ||
var _args = arguments; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
@@ -20,0 +29,0 @@ switch (_context.prev = _context.next) { |
@@ -1,3 +0,9 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
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 _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; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import * as Errors from '../errors'; | ||
@@ -4,0 +10,0 @@ import { enhancedError } from '../utilities'; |
@@ -1,6 +0,4 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(setAccessTokenTimeout); | ||
regeneratorRuntime.mark(setAccessTokenTimeout); | ||
@@ -23,3 +21,3 @@ import { delay } from 'redux-saga'; | ||
return _regeneratorRuntime.wrap(function setAccessTokenTimeout$(_context) { | ||
return regeneratorRuntime.wrap(function setAccessTokenTimeout$(_context) { | ||
while (1) { | ||
@@ -26,0 +24,0 @@ switch (_context.prev = _context.next) { |
@@ -1,53 +0,59 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(takeLatestRequest); | ||
regeneratorRuntime.mark(takeLatestRequest); | ||
import { takeEvery, put, fork } from 'redux-saga/effects'; | ||
import cancellableTask from '../cancelableTask'; | ||
import cancellableHandler from '../cancellableHandler'; | ||
/** | ||
* @param {{ REQUEST: String, cancelTask: Function }} params | ||
* @param {Function} task | ||
* @param {{ REQUEST: String, cancelTask: Function, requestIdSelector: Function? }} params | ||
* @param {Function} requestHandler | ||
*/ | ||
export default function takeLatestRequest(_ref, task) { | ||
var REQUEST, cancelTask, runningTask; | ||
return _regeneratorRuntime.wrap(function takeLatestRequest$(_context2) { | ||
export default function takeLatestRequest(_ref, requestHandler) { | ||
var REQUEST, cancelTask, requestIdSelector, runningTasks, DEFAULT_REQUEST_ID; | ||
return regeneratorRuntime.wrap(function takeLatestRequest$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
REQUEST = _ref.REQUEST, cancelTask = _ref.cancelTask; | ||
runningTask = null; | ||
_context2.next = 4; | ||
REQUEST = _ref.REQUEST, cancelTask = _ref.cancelTask, requestIdSelector = _ref.requestIdSelector; | ||
runningTasks = new Set(); | ||
DEFAULT_REQUEST_ID = Symbol('DEFAULT_REQUEST_ID'); | ||
_context2.next = 5; | ||
return takeEvery(REQUEST, | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(function _callee(action) { | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
regeneratorRuntime.mark(function _callee(action) { | ||
var requestId, runningTask; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
requestId = requestIdSelector ? requestIdSelector(action) : DEFAULT_REQUEST_ID; | ||
runningTask = runningTasks.get(requestId); | ||
if (!runningTask) { | ||
_context.next = 4; | ||
_context.next = 6; | ||
break; | ||
} | ||
_context.next = 3; | ||
return put(cancelTask(action)); | ||
_context.next = 5; | ||
return put(cancelTask(requestId, action)); | ||
case 3: | ||
runningTask = null; | ||
case 5: | ||
runningTasks.delete(requestId); | ||
case 4: | ||
_context.next = 6; | ||
return fork(cancellableTask, { | ||
task: task, | ||
taskArg: action, | ||
CANCEL: cancelTask(action).type | ||
case 6: | ||
_context.next = 8; | ||
return fork(cancellableHandler, { | ||
handler: requestHandler, | ||
handlerArg: action, | ||
CANCEL: cancelTask(action).type, | ||
onComplete: function onComplete() { | ||
runningTasks.delete(requestId); | ||
} | ||
}); | ||
case 6: | ||
runningTask = _context.sent; | ||
case 8: | ||
runningTasks.add(requestId); | ||
case 7: | ||
case 9: | ||
case "end": | ||
@@ -60,3 +66,3 @@ return _context.stop(); | ||
case 4: | ||
case 5: | ||
case "end": | ||
@@ -63,0 +69,0 @@ return _context2.stop(); |
@@ -1,12 +0,10 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(takeRequest); | ||
regeneratorRuntime.mark(takeRequest); | ||
import { take } from 'redux-saga/effects'; | ||
import cancellableTask from '../cancelableTask'; | ||
import cancellableHandler from '../cancellableHandler'; | ||
/** | ||
* Blocking custom saga effect that can actually cancel the API request | ||
* @param {{ REQUEST: String, CANCEL: String }} actionTypes | ||
* @param {{ REQUEST: String, CANCEL: String }} params | ||
* @param {Function} task | ||
@@ -20,3 +18,3 @@ */ | ||
_args = arguments; | ||
return _regeneratorRuntime.wrap(function takeRequest$(_context) { | ||
return regeneratorRuntime.wrap(function takeRequest$(_context) { | ||
while (1) { | ||
@@ -40,3 +38,3 @@ switch (_context.prev = _context.next) { | ||
_context.next = 8; | ||
return cancellableTask({ | ||
return cancellableHandler({ | ||
task: task, | ||
@@ -43,0 +41,0 @@ taskArg: action, |
export * from './effects'; | ||
export { default as cancelableTask } from './cancelableTask'; | ||
export { default as cancellableHandler } from './cancellableHandler'; |
@@ -1,6 +0,4 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(saga); | ||
regeneratorRuntime.mark(saga); | ||
@@ -12,3 +10,3 @@ import { call, all } from 'redux-saga/effects'; | ||
var sagas, tasks; | ||
return _regeneratorRuntime.wrap(function saga$(_context) { | ||
return regeneratorRuntime.wrap(function saga$(_context) { | ||
while (1) { | ||
@@ -15,0 +13,0 @@ switch (_context.prev = _context.next) { |
@@ -1,6 +0,4 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(manageAuthHeader); | ||
regeneratorRuntime.mark(manageAuthHeader); | ||
@@ -13,3 +11,3 @@ import { takeEvery } from 'redux-saga/effects'; | ||
return _regeneratorRuntime.wrap(function manageAuthHeader$(_context) { | ||
return regeneratorRuntime.wrap(function manageAuthHeader$(_context) { | ||
while (1) { | ||
@@ -16,0 +14,0 @@ switch (_context.prev = _context.next) { |
@@ -1,5 +0,5 @@ | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
var _state; | ||
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 defaultConfig from './defaultConfig'; | ||
@@ -6,0 +6,0 @@ import * as Errors from './errors'; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -14,2 +12,4 @@ value: true | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function createApiWithAxios(options, proxy) { | ||
@@ -16,0 +16,0 @@ var axiosClient = _axios.default.create(options); |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,8 +8,2 @@ value: true | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _effects = require("redux-saga/effects"); | ||
@@ -33,8 +23,24 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
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) { 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 _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 _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; } | ||
var authRequestProxy = function authRequestProxy(methodHandler) { | ||
return ( | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(function _callee() { | ||
regeneratorRuntime.mark(function _callee() { | ||
var _args = arguments; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
@@ -86,10 +92,10 @@ switch (_context.prev = _context.next) { | ||
var defaultConfig = Store.get(Store.keys.CONFIG); | ||
Store.set(Store.keys.CONFIG, (0, _objectSpread2.default)({}, defaultConfig, customConfig)); | ||
Store.set(Store.keys.CONFIG, _objectSpread({}, defaultConfig, customConfig)); | ||
var _createApiWithAxios = (0, _createApiWithAxios5.default)(axiosRequestConfig), | ||
_createApiWithAxios2 = (0, _slicedToArray2.default)(_createApiWithAxios, 1), | ||
_createApiWithAxios2 = _slicedToArray(_createApiWithAxios, 1), | ||
api = _createApiWithAxios2[0]; | ||
var _createApiWithAxios3 = (0, _createApiWithAxios5.default)(axiosRequestConfig, authRequestProxy), | ||
_createApiWithAxios4 = (0, _slicedToArray2.default)(_createApiWithAxios3, 2), | ||
_createApiWithAxios4 = _slicedToArray(_createApiWithAxios3, 2), | ||
authApi = _createApiWithAxios4[0], | ||
@@ -96,0 +102,0 @@ authAxiosClient = _createApiWithAxios4[1]; |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,6 +8,2 @@ value: true | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
var Errors = _interopRequireWildcard(require("../errors")); | ||
@@ -21,2 +13,12 @@ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
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 _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; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var isTokenTemplate = function isTokenTemplate(token) { | ||
@@ -29,3 +31,3 @@ return token.startsWith(':'); | ||
templateUrl = config.url, | ||
rest = (0, _objectWithoutProperties2.default)(config, ["uriParams", "url"]); | ||
rest = _objectWithoutProperties(config, ["uriParams", "url"]); | ||
@@ -53,3 +55,3 @@ var templateToValue = function templateToValue(token) { | ||
var url = templateUrl.split('/').map(templateToValue).join('/'); | ||
return (0, _objectSpread2.default)({}, rest, { | ||
return _objectSpread({}, rest, { | ||
uriParams: uriParams, | ||
@@ -56,0 +58,0 @@ url: url |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,4 +8,2 @@ value: true | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _reduxSaga = require("redux-saga"); | ||
@@ -27,5 +21,7 @@ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(setAccessTokenTimeout); | ||
regeneratorRuntime.mark(setAccessTokenTimeout); | ||
@@ -41,3 +37,3 @@ /** | ||
return _regenerator.default.wrap(function setAccessTokenTimeout$(_context) { | ||
return regeneratorRuntime.wrap(function setAccessTokenTimeout$(_context) { | ||
while (1) { | ||
@@ -44,0 +40,0 @@ switch (_context.prev = _context.next) { |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,2 +18,4 @@ value: true | ||
exports.sagaEffects = _sagaEffects; | ||
exports.sagaEffects = _sagaEffects; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -23,2 +21,4 @@ value: true | ||
var _takeRequest = _interopRequireDefault(require("./takeRequest")); | ||
var _takeRequest = _interopRequireDefault(require("./takeRequest")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,55 +8,63 @@ value: true | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _effects = require("redux-saga/effects"); | ||
var _cancelableTask = _interopRequireDefault(require("../cancelableTask")); | ||
var _cancellableHandler = _interopRequireDefault(require("../cancellableHandler")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(takeLatestRequest); | ||
regeneratorRuntime.mark(takeLatestRequest); | ||
/** | ||
* @param {{ REQUEST: String, cancelTask: Function }} params | ||
* @param {Function} task | ||
* @param {{ REQUEST: String, cancelTask: Function, requestIdSelector: Function? }} params | ||
* @param {Function} requestHandler | ||
*/ | ||
function takeLatestRequest(_ref, task) { | ||
var REQUEST, cancelTask, runningTask; | ||
return _regenerator.default.wrap(function takeLatestRequest$(_context2) { | ||
function takeLatestRequest(_ref, requestHandler) { | ||
var REQUEST, cancelTask, requestIdSelector, runningTasks, DEFAULT_REQUEST_ID; | ||
return regeneratorRuntime.wrap(function takeLatestRequest$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
REQUEST = _ref.REQUEST, cancelTask = _ref.cancelTask; | ||
runningTask = null; | ||
_context2.next = 4; | ||
REQUEST = _ref.REQUEST, cancelTask = _ref.cancelTask, requestIdSelector = _ref.requestIdSelector; | ||
runningTasks = new Set(); | ||
DEFAULT_REQUEST_ID = Symbol('DEFAULT_REQUEST_ID'); | ||
_context2.next = 5; | ||
return (0, _effects.takeEvery)(REQUEST, | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(function _callee(action) { | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
regeneratorRuntime.mark(function _callee(action) { | ||
var requestId, runningTask; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
requestId = requestIdSelector ? requestIdSelector(action) : DEFAULT_REQUEST_ID; | ||
runningTask = runningTasks.get(requestId); | ||
if (!runningTask) { | ||
_context.next = 4; | ||
_context.next = 6; | ||
break; | ||
} | ||
_context.next = 3; | ||
return (0, _effects.put)(cancelTask(action)); | ||
_context.next = 5; | ||
return (0, _effects.put)(cancelTask(requestId, action)); | ||
case 3: | ||
runningTask = null; | ||
case 5: | ||
runningTasks.delete(requestId); | ||
case 4: | ||
_context.next = 6; | ||
return (0, _effects.fork)(_cancelableTask.default, { | ||
task: task, | ||
taskArg: action, | ||
CANCEL: cancelTask(action).type | ||
case 6: | ||
_context.next = 8; | ||
return (0, _effects.fork)(_cancellableHandler.default, { | ||
handler: requestHandler, | ||
handlerArg: action, | ||
CANCEL: cancelTask(action).type, | ||
onComplete: function onComplete() { | ||
runningTasks.delete(requestId); | ||
} | ||
}); | ||
case 6: | ||
runningTask = _context.sent; | ||
case 8: | ||
runningTasks.add(requestId); | ||
case 7: | ||
case 9: | ||
case "end": | ||
@@ -71,3 +77,3 @@ return _context.stop(); | ||
case 4: | ||
case 5: | ||
case "end": | ||
@@ -74,0 +80,0 @@ return _context2.stop(); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,15 +8,15 @@ value: true | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _effects = require("redux-saga/effects"); | ||
var _cancelableTask = _interopRequireDefault(require("../cancelableTask")); | ||
var _cancellableHandler = _interopRequireDefault(require("../cancellableHandler")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(takeRequest); | ||
regeneratorRuntime.mark(takeRequest); | ||
/** | ||
* Blocking custom saga effect that can actually cancel the API request | ||
* @param {{ REQUEST: String, CANCEL: String }} actionTypes | ||
* @param {{ REQUEST: String, CANCEL: String }} params | ||
* @param {Function} task | ||
@@ -31,3 +29,3 @@ */ | ||
_args = arguments; | ||
return _regenerator.default.wrap(function takeRequest$(_context) { | ||
return regeneratorRuntime.wrap(function takeRequest$(_context) { | ||
while (1) { | ||
@@ -51,3 +49,3 @@ switch (_context.prev = _context.next) { | ||
_context.next = 8; | ||
return (0, _cancelableTask.default)({ | ||
return (0, _cancellableHandler.default)({ | ||
task: task, | ||
@@ -54,0 +52,0 @@ taskArg: action, |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,8 +7,8 @@ value: true | ||
var _exportNames = { | ||
cancelableTask: true | ||
cancellableHandler: true | ||
}; | ||
Object.defineProperty(exports, "cancelableTask", { | ||
Object.defineProperty(exports, "cancellableHandler", { | ||
enumerable: true, | ||
get: function get() { | ||
return _cancelableTask.default; | ||
return _cancellableHandler.default; | ||
} | ||
@@ -32,2 +30,4 @@ }); | ||
var _cancelableTask = _interopRequireDefault(require("./cancelableTask")); | ||
var _cancellableHandler = _interopRequireDefault(require("./cancellableHandler")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,4 +8,2 @@ value: true | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _effects = require("redux-saga/effects"); | ||
@@ -21,9 +15,13 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(saga); | ||
regeneratorRuntime.mark(saga); | ||
function saga() { | ||
var sagas, tasks; | ||
return _regenerator.default.wrap(function saga$(_context) { | ||
return regeneratorRuntime.wrap(function saga$(_context) { | ||
while (1) { | ||
@@ -30,0 +28,0 @@ switch (_context.prev = _context.next) { |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,4 +8,2 @@ value: true | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _effects = require("redux-saga/effects"); | ||
@@ -21,5 +15,7 @@ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(manageAuthHeader); | ||
regeneratorRuntime.mark(manageAuthHeader); | ||
@@ -29,3 +25,3 @@ function manageAuthHeader() { | ||
return _regenerator.default.wrap(function manageAuthHeader$(_context) { | ||
return regeneratorRuntime.wrap(function manageAuthHeader$(_context) { | ||
while (1) { | ||
@@ -32,0 +28,0 @@ switch (_context.prev = _context.next) { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,4 +8,2 @@ value: true | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _defaultConfig = _interopRequireDefault(require("./defaultConfig")); | ||
@@ -23,2 +17,8 @@ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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; } | ||
var keys = { | ||
@@ -32,3 +32,3 @@ IS_AUTH: 'isAuth', | ||
exports.keys = keys; | ||
var state = (_state = {}, (0, _defineProperty2.default)(_state, keys.IS_AUTH, false), (0, _defineProperty2.default)(_state, keys.AUTH_AXIOS, null), (0, _defineProperty2.default)(_state, keys.CONFIG, _defaultConfig.default), (0, _defineProperty2.default)(_state, keys.SAGA_INITIALIZED, false), (0, _defineProperty2.default)(_state, keys.WAS_INITIALIZED, false), _state); | ||
var state = (_state = {}, _defineProperty(_state, keys.IS_AUTH, false), _defineProperty(_state, keys.AUTH_AXIOS, null), _defineProperty(_state, keys.CONFIG, _defaultConfig.default), _defineProperty(_state, keys.SAGA_INITIALIZED, false), _defineProperty(_state, keys.WAS_INITIALIZED, false), _state); | ||
/** | ||
@@ -35,0 +35,0 @@ * @param {String} key |
{ | ||
"name": "@ackee/antonio", | ||
"version": "2.2.15", | ||
"version": "2.3.0", | ||
"description": "A HTTP client built on axios. An access token is injected to authorization header by @ackee/petrus.", | ||
@@ -23,30 +23,28 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.0", | ||
"@babel/core": "^7.2.0", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.2.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.2.0", | ||
"@babel/plugin-transform-runtime": "^7.2.0", | ||
"@babel/preset-env": "^7.2.0", | ||
"babel-eslint": "^10.0.1", | ||
"cross-env": "^5.2.0", | ||
"eslint": "^5.10.0", | ||
"eslint-config-ackee": "^0.9.0", | ||
"eslint-config-prettier": "^3.3.0", | ||
"husky": "^1.2.0", | ||
"lint-staged": "^8.1.0", | ||
"onchange": "^5.2.0", | ||
"prettier": "^1.15.3", | ||
"prettier-config-ackee": "^0.0.5", | ||
"redux-saga": "0.16.x" | ||
"@babel/cli": "7.x", | ||
"@babel/core": "7.x", | ||
"@babel/plugin-proposal-export-namespace-from": "7.x", | ||
"@babel/plugin-proposal-object-rest-spread": "7.x", | ||
"@babel/preset-env": "7.x", | ||
"babel-eslint": "10.x", | ||
"cross-env": "5.x", | ||
"eslint": "5.x", | ||
"eslint-config-ackee": "0.x", | ||
"eslint-config-prettier": "4.x", | ||
"husky": "1.x", | ||
"lint-staged": "8.x", | ||
"onchange": "5.x", | ||
"prettier": "1.x", | ||
"prettier-config-ackee": "0.x", | ||
"redux-saga": "0.x" | ||
}, | ||
"dependencies": { | ||
"@ackee/petrus": "3.0.x", | ||
"@babel/runtime": "^7.2.0", | ||
"@ackee/petrus": "3.1.2", | ||
"axios": "0.18.0" | ||
}, | ||
"peerDependencies": { | ||
"redux-saga": "0.16.x", | ||
"react": "^16.6.3", | ||
"react-redux": "^6.0.0", | ||
"redux": "^4.0.1" | ||
"redux-saga": "0.x", | ||
"react": "16.x", | ||
"react-redux": "6.x", | ||
"redux": "4.x" | ||
}, | ||
@@ -62,3 +60,4 @@ "browserslist": [ | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
"pre-commit": "lint-staged", | ||
"pre-push": "yarn lint" | ||
} | ||
@@ -65,0 +64,0 @@ }, |
@@ -15,3 +15,3 @@ ![ackee|Antonio](assets/ackee_git_frontend_antonio.png) | ||
- [create](#api-create) | ||
- [Saga Effects](src/saga-effects/saga-effects.md) | ||
- [Saga Effects](src/saga-effects/README.md) | ||
@@ -213,3 +213,3 @@ --- | ||
if (accessToken) { | ||
headers.common.Authorization = accessToken; | ||
headers.common.Authorization = `${accessToken.tokenType} ${accessToken.token}`; | ||
} else { | ||
@@ -231,2 +231,2 @@ delete headers.common.Authorization; | ||
Custom Saga effects with built-in cancelation of API requests, [see the docs](src/saga-effects/saga-effects.md). | ||
Custom Saga effects with built-in cancelation of API requests, [see the docs](src/saga-effects/README.md). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73138
6
16
39
1186
+ Added@ackee/petrus@3.1.2(transitive)
+ Addedlodash@4.17.21(transitive)
- Removed@babel/runtime@^7.2.0
- Removed@ackee/petrus@3.0.18(transitive)
Updated@ackee/petrus@3.1.2