redux-saga
Advanced tools
Comparing version 0.9.4 to 0.9.5
@@ -129,7 +129,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
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; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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.ident = ident; | ||
@@ -270,4 +271,2 @@ exports.check = check; | ||
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"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -277,2 +276,5 @@ value: true | ||
exports.asEffect = exports.SELECT_ARG_ERROR = exports.INVALID_PATTERN = exports.CANCEL_ARG_ERROR = exports.JOIN_ARG_ERROR = exports.FORK_ARG_ERROR = exports.CALL_FUNCTION_ARG_ERROR = 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"); } }; }(); | ||
exports.matcher = matcher; | ||
@@ -564,2 +566,3 @@ exports.take = take; | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -604,4 +607,4 @@ | ||
/** | ||
this maybe called by a parent generator to trigger/propagate cancellation | ||
W'll simply cancel the current effect, which will reject that effect | ||
This may be called by a parent generator to trigger/propagate cancellation | ||
We'll simply cancel the current effect, which will reject that effect | ||
The rejection will throw the injected SagaCancellationException into the flow | ||
@@ -627,12 +630,26 @@ of this generator | ||
/** | ||
Print error in a useful way whether in a browser environment | ||
(with expandable error stack traces), or in a node.js environment | ||
(text-only log output) | ||
**/ | ||
function logError(level, message, error) { | ||
/*eslint-disable no-console*/ | ||
if (typeof window === 'undefined') { | ||
console.log('redux-saga ' + level + ': ' + message + '\n' + error.stack); | ||
} else { | ||
console[level].call(console, message, error); | ||
} | ||
} | ||
/** | ||
This is the generator driver | ||
It's a recursive aysnc/continuation function which calls itself | ||
It's a recursive async/continuation function which calls itself | ||
until the generator terminates or throws | ||
**/ | ||
function next(error, arg) { | ||
// Preventive measure. If we endup here, then there is really something wrong | ||
// Preventive measure. If we end up here, then there is really something wrong | ||
if (!iterator._isRunning) throw new Error('Trying to resume an already finished generator'); | ||
try { | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// calling iterator.throw on a generator that doesn't define a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
@@ -648,7 +665,8 @@ var result = error ? iterator.throw(error) : iterator.next(arg); | ||
/*eslint-disable no-console*/ | ||
if (error instanceof _SagaCancellationException2.default) { | ||
if (_utils.isDev) console.warn(name + ': uncaught', error); | ||
if (_utils.isDev) { | ||
logError('warn', name + ': uncaught', error); | ||
} | ||
} else { | ||
console.error(name + ': uncaught', error); | ||
logError('error', name + ': uncaught', error); | ||
//if(!forked) | ||
@@ -915,3 +933,3 @@ // throw error | ||
var chCbAtIdx = function chCbAtIdx(err, res) { | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
if (completed) return; | ||
@@ -1079,5 +1097,19 @@ // one of the effects failed | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.select = exports.cancel = exports.join = exports.fork = exports.cps = exports.apply = exports.call = exports.race = exports.put = exports.take = undefined; | ||
var _io = __webpack_require__(3); | ||
module.exports = { take: _io.take, put: _io.put, race: _io.race, call: _io.call, apply: _io.apply, cps: _io.cps, fork: _io.fork, join: _io.join, cancel: _io.cancel, select: _io.select }; | ||
exports.take = _io.take; | ||
exports.put = _io.put; | ||
exports.race = _io.race; | ||
exports.call = _io.call; | ||
exports.apply = _io.apply; | ||
exports.cps = _io.cps; | ||
exports.fork = _io.fork; | ||
exports.join = _io.join; | ||
exports.cancel = _io.cancel; | ||
exports.select = _io.select; | ||
@@ -1257,2 +1289,3 @@ /***/ }, | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -1269,7 +1302,8 @@ | ||
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"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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"); } }; }(); | ||
exports.takeEvery = takeEvery; | ||
@@ -1294,2 +1328,4 @@ exports.takeLatest = takeLatest; | ||
function fsmIterator(fsm, nextState) { | ||
var name = arguments.length <= 2 || arguments[2] === undefined ? 'iterator' : arguments[2]; | ||
var aborted = undefined, | ||
@@ -1321,2 +1357,3 @@ updateState = undefined; | ||
var iterator = { | ||
name: name, | ||
next: next, | ||
@@ -1327,2 +1364,7 @@ throw: function _throw(error) { | ||
}; | ||
if (typeof Symbol !== 'undefined') { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
@@ -1344,3 +1386,3 @@ } | ||
'fork': [yieldFork, 'take'] | ||
}, 'take'); | ||
}, 'take', 'takeEvery(' + pattern + ', ' + worker.name + ')'); | ||
} | ||
@@ -1374,3 +1416,3 @@ | ||
}] | ||
}, 'take'); | ||
}, 'take', 'takeLatest(' + pattern + ', ' + worker.name + ')'); | ||
} | ||
@@ -1421,2 +1463,7 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.monitorActions = exports.createMockTask = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.CANCEL = exports.asap = exports.arrayOfDeffered = exports.deferred = exports.asEffect = exports.is = exports.noop = exports.TASK = undefined; | ||
var _utils = __webpack_require__(1); | ||
@@ -1436,20 +1483,16 @@ | ||
module.exports = { | ||
TASK: _utils.TASK, | ||
noop: _utils.noop, | ||
is: _utils.is, asEffect: _io.asEffect, | ||
deferred: _utils.deferred, | ||
arrayOfDeffered: _utils.arrayOfDeffered, | ||
asap: _utils.asap, | ||
exports.TASK = _utils.TASK; | ||
exports.noop = _utils.noop; | ||
exports.is = _utils.is; | ||
exports.asEffect = _io.asEffect; | ||
exports.deferred = _utils.deferred; | ||
exports.arrayOfDeffered = _utils.arrayOfDeffered; | ||
exports.asap = _utils.asap; | ||
exports.CANCEL = _proc.CANCEL; | ||
exports.RACE_AUTO_CANCEL = _proc.RACE_AUTO_CANCEL; | ||
exports.PARALLEL_AUTO_CANCEL = _proc.PARALLEL_AUTO_CANCEL; | ||
exports.MANUAL_CANCEL = _proc.MANUAL_CANCEL; | ||
exports.createMockTask = _testUtils.createMockTask; | ||
exports.monitorActions = monitorActions; | ||
CANCEL: _proc.CANCEL, | ||
RACE_AUTO_CANCEL: _proc.RACE_AUTO_CANCEL, | ||
PARALLEL_AUTO_CANCEL: _proc.PARALLEL_AUTO_CANCEL, | ||
MANUAL_CANCEL: _proc.MANUAL_CANCEL, | ||
createMockTask: _testUtils.createMockTask, | ||
monitorActions: monitorActions | ||
}; | ||
/***/ }, | ||
@@ -1456,0 +1499,0 @@ /* 13 */ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var u=t[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,n),u.loaded=!0,u.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.effects=n.takeLatest=n.takeEvery=n.storeIO=n.runSaga=n.isCancelError=n.SagaCancellationException=void 0;var a=t(9);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return a.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return a.storeIO}});var o=t(10);Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return o.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return o.takeLatest}});var i=t(8),c=u(i),f=t(2),s=u(f),l=t(7),d=r(l),v=t(12),g=r(v);n.default=c.default;var p=n.SagaCancellationException=s.default;n.isCancelError=function(e){return e instanceof p};n.effects=d,n.utils=g},function(e,n,t){(function(e){"use strict";function t(e){return e}function r(e,n,t){if(!n(e))throw new Error(t)}function u(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function a(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=s({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function o(e){for(var n=[],t=0;e>t;t++)n.push(a());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}function f(e){v&&console.warn("DEPRECATION WARNING",e)}var s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};Object.defineProperty(n,"__esModule",{value:!0}),n.ident=t,n.check=r,n.remove=u,n.deferred=a,n.arrayOfDeffered=o,n.autoInc=i,n.asap=c,n.warnDeprecated=f;var l=n.sym=function(e){return"@@redux-saga/"+e},d=n.TASK=l("TASK"),v=(n.kTrue=function(){return!0},n.noop=function(){},n.isDev="undefined"!=typeof e&&e.env&&!1),g=n.is={undef:function(e){return null===e||void 0===e},notUndef:function(e){return null!==e&&void 0!==e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&g.func(e.then)},iterator:function(e){return e&&g.func(e.next)&&g.func(e.throw)},task:function(e){return e&&e[d]}}}).call(n,t(13))},function(e,n){"use strict";function t(e,n,t){var r="SagaCancellationException; type: "+e+", saga: "+n+", origin: "+t;this.name="SagaCancellationException",this.message=r,this.type=e,this.saga=n,this.origin=t,this.stack=(new Error).stack}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t,t.prototype=Object.create(Error.prototype),t.prototype.constructor=t},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(e){return("*"===e?x.wildcard:E.is.array(e)?x.array:E.is.func(e)?x.predicate:x.default)(e)}function a(e){if(arguments.length>0&&E.is.undef(e))throw new Error(_);return j(C,E.is.undef(e)?"*":e)}function o(e){return j(b,e)}function i(e){return j(T,e)}function c(e,n){(0,E.check)(e,E.is.notUndef,h);var t=null;if(E.is.array(e)){var r=e,u=m(r,2);t=u[0],e=u[1]}else if(e.fn){var a=e;t=a.context,e=a.fn}return(0,E.check)(e,E.is.func,h),{context:t,fn:e,args:n}}function f(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(w,c(e,t))}function s(e,n){var t=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return j(w,c({context:e,fn:n},t))}function l(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(k,c(e,t))}function d(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(L,c(e,t))}function v(e){if(!P(e))throw new Error(y);return j(N,e)}function g(e){if(!P(e))throw new Error(A);return j(S,e)}function p(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return 0===arguments.length?e=E.ident:(0,E.check)(e,E.is.func,R),j(I,{selector:e,args:t})}var m=function(){function e(e,n){var t=[],r=!0,u=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){u=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.SELECT_ARG_ERROR=n.INVALID_PATTERN=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0,n.matcher=u,n.take=a,n.put=o,n.race=i,n.call=f,n.apply=s,n.cps=l,n.fork=d,n.join=v,n.cancel=g,n.select=p;var E=t(1),h=n.CALL_FUNCTION_ARG_ERROR="call/cps/fork first argument must be a function, an array [context, function] or an object {context, fn}",y=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),A=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",_=n.INVALID_PATTERN="Invalid pattern passed to `take` (HINT: check if you didn't mispell a constant)",R=n.SELECT_ARG_ERROR="select first argument must be a function",O=(0,E.sym)("IO"),C="TAKE",b="PUT",T="RACE",w="CALL",k="CPS",L="FORK",N="JOIN",S="CANCEL",I="SELECT",j=function(e,n){var t;return t={},r(t,O,!0),r(t,e,n),t},x={wildcard:function(){return E.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},P=function(e){return e[E.TASK]};n.asEffect={take:function(e){return e&&e[O]&&e[C]},put:function(e){return e&&e[O]&&e[b]},race:function(e){return e&&e[O]&&e[T]},call:function(e){return e&&e[O]&&e[w]},cps:function(e){return e&&e[O]&&e[k]},fork:function(e){return e&&e[O]&&e[L]},join:function(e){return e&&e[O]&&e[N]},cancel:function(e){return e&&e[O]&&e[S]},select:function(e){return e&&e[O]&&e[I]}}},function(e,n){"use strict";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n,r,u){var a;return a={},t(a,o,!0),t(a,"type",i),t(a,"effectId",e),t(a,"parentEffectId",n),t(a,"label",r),t(a,"effect",u),a}function u(e,n){var r;return r={},t(r,o,!0),t(r,"type",c),t(r,"effectId",e),t(r,"result",n),r}function a(e,n){var r;return r={},t(r,o,!0),t(r,"type",f),t(r,"effectId",e),t(r,"error",n),r}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=u,n.effectRejected=a;var o=n.MONITOR_ACTION="MONITOR_ACTION",i=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",c=n.EFFECT_RESOLVED="EFFECT_RESOLVED",f=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function a(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){function n(u,a){if(!e._isRunning)throw new Error("Trying to resume an already finished generator");try{var o=u?e.throw(u):e.next(a);o.done?t(o.value):r(o.value,P,"",n)}catch(u){t(u,!0),u instanceof v.default?c.isDev&&console.warn(M+": uncaught",u):console.error(M+": uncaught",u)}}function t(n,t){e._isRunning=!1,t?(e._error=n,F.reject(n)):(e._result=n,F.resolve(n)),K()}function r(e,n){function t(e,n){i||(i=!0,a.cancel=c.noop,x(e?l.effectRejected(o,e):l.effectResolved(o,n)),a(e,n))}var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],a=arguments[3],o=A();x(l.effectTriggered(o,n,r,e));var i=void 0;t.cancel=c.noop,a.cancel=function(e){if(!i){i=!0;try{t.cancel(e)}catch(n){}t.cancel=c.noop,a(e),x(l.effectRejected(o,e))}};var v=void 0;return c.is.promise(e)?u(e,t):c.is.iterator(e)?s(e,o,M,t):c.is.array(e)?w(e,o,t):c.is.notUndef(v=f.asEffect.take(e))?d(v,t):c.is.notUndef(v=f.asEffect.put(e))?_(v,t):c.is.notUndef(v=f.asEffect.race(e))?k(v,o,t):c.is.notUndef(v=f.asEffect.call(e))?R(v,o,t):c.is.notUndef(v=f.asEffect.cps(e))?O(v,t):c.is.notUndef(v=f.asEffect.fork(e))?C(v,o,t):c.is.notUndef(v=f.asEffect.join(e))?b(v,t):c.is.notUndef(v=f.asEffect.cancel(e))?T(v,t):c.is.notUndef(v=f.asEffect.select(e))?L(v,t):t(null,e)}function u(e,n){var t=e[m];"function"==typeof t&&(n.cancel=t),e.then(function(e){return n(null,e)},function(e){return n(e)})}function s(e,n,t,r){u(i(e,S,I,j,x,n,t).done,r)}function d(e,n){var t={match:(0,f.matcher)(e),pattern:e,resolve:function(e){return n(null,e)}};G.push(t),n.cancel=function(){return(0,c.remove)(G,t)}}function _(e,n){(0,c.asap)(function(){return n(null,I(e))})}function R(e,n,t){var r=e.context,a=e.fn,o=e.args,i=void 0;try{i=a.apply(r,o)}catch(f){return t(f)}return c.is.promise(i)?u(i,t):c.is.iterator(i)?s(i,n,a.name,t):t(null,i)}function O(e,n){var t=e.context,r=e.fn,u=e.args;try{r.apply(t,u.concat(n))}catch(a){return n(a)}}function C(e,n,t){var r=e.context,u=e.fn,a=e.args,o=void 0,f=void 0,s=void 0;try{o=u.apply(r,a)}catch(l){f=f}s=c.is.iterator(o)?o:(f?regeneratorRuntime.mark(function d(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw f;case 1:case"end":return e.stop()}},d,this)}):regeneratorRuntime.mark(function v(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o;case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},v,this)}))(),t(null,i(s,S,I,j,x,n,u.name,!0))}function b(e,n){u(e.done,n)}function T(e,n){e.done[m](new v.default(y,M,M)),n()}function w(e,n,t){function u(){a===i.length&&(o=!0,t(null,i))}if(!e.length)return void t(null,[]);var a=0,o=void 0,i=Array(e.length),f=e.map(function(e,n){var r=function(e,r){if(!o)if(e){try{t.cancel(new v.default(E,M,M))}catch(e){}t(e)}else i[n]=r,a++,u()};return r.cancel=c.noop,r});t.cancel=function(e){o||(o=!0,f.forEach(function(n){return n.cancel(e)}))},e.forEach(function(e,t){return r(e,n,t,f[t])})}function k(e,n,t){var u=void 0,a=Object.keys(e),i={};a.forEach(function(e){var n=function(n,r){if(!u)if(n){try{t.cancel(new v.default(h,M,M))}catch(n){}t(o({},e,n))}else{try{t.cancel(new v.default(h,M,M))}catch(n){}u=!0,t(null,o({},e,r))}};n.cancel=c.noop,i[e]=n}),t.cancel=function(e){u||(u=!0,a.forEach(function(n){return i[n].cancel(e)}))},a.forEach(function(t){return r(e[t],n,t,i[t])})}function L(e,n){var t=e.selector,r=e.args;try{var u=t.apply(void 0,[j()].concat(a(r)));n(null,u)}catch(o){n(o)}}function N(e,n,t,r,u){var a;return a={},o(a,c.TASK,!0),o(a,"id",e),o(a,"name",n),o(a,"done",r),o(a,"forked",u),o(a,"cancel",function(e){e instanceof v.default||(e=new v.default(y,n,e)),r[m](e)}),o(a,"isRunning",function(){return t._isRunning}),o(a,"result",function(){return t._result}),o(a,"error",function(){return t._error}),a}var S=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],I=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],j=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],x=arguments.length<=4||void 0===arguments[4]?c.noop:arguments[4],P=arguments.length<=5||void 0===arguments[5]?0:arguments[5],M=arguments.length<=6||void 0===arguments[6]?"anonymous":arguments[6],U=arguments[7];(0,c.check)(e,c.is.iterator,g);var D=p(M),G=[],F=(0,c.deferred)(),K=S(function(e){if(void 0===e)throw D;for(var n=0;n<G.length;n++){var t=G[n];t.match(e)&&(G=[],t.resolve(e))}});n.cancel=c.noop;var J=N(P,M,e,F.promise,U);return J.done[m]=function(e){var t=e.type,r=e.origin;n.cancel(new v.default(t,M,r))},e._isRunning=!0,n(),J}Object.defineProperty(n,"__esModule",{value:!0}),n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.CANCEL=n.undefindInputError=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=t(1),f=t(3),s=t(4),l=u(s),d=t(2),v=r(d),g=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.undefindInputError=function(e){return"\n "+e+" saga was provided with an undefined input action\n Hints :\n - check that your Action Creator returns a non undefined value\n - if the Saga was started using runSaga, check that your subscribe source provides the action to its listeners\n"},m=n.CANCEL=(0,c.sym)("@@redux-saga/cancelPromise"),E=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",h=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",y=n.MANUAL_CANCEL="MANUAL_CANCEL",A=(0,c.autoInc)()},function(e,n,t){"use strict";function r(){function e(e){return t.push(e),function(){return(0,u.remove)(t,e)}}function n(e){t.slice().forEach(function(n){return n(e)})}var t=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r;var u=t(1)},function(e,n,t){"use strict";var r=t(3);e.exports={take:r.take,put:r.put,race:r.race,call:r.call,apply:r.apply,cps:r.cps,fork:r.fork,join:r.join,cancel:r.cancel,select:r.select}},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(){function e(e){function n(e){for(var n=arguments.length,t=Array(n>1?n-1:0),u=1;n>u;u++)t[u-1]=arguments[u];return(0,i.default)(e.apply(void 0,[d].concat(t)),c.subscribe,o,r,l,0,e.name)}var r=e.getState,o=e.dispatch,c=(0,f.default)(),l=a.isDev?function(e){return(0,a.asap)(function(){return o(e)})}:void 0,d=function(){return(0,a.warnDeprecated)(p),r()};return u=n,t.forEach(n),function(e){return function(n){var t=e(n);return n[s.MONITOR_ACTION]||c.emit(n),t}}}for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];var u=void 0;return t.forEach(function(e,n){return(0,a.check)(e,a.is.func,v("createSagaMiddleware",n,e))}),e.run=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];if(!u)throw new Error(g);(0,a.check)(e,a.is.func,v("sagaMiddleware.run",0,e));var o=u.apply(void 0,[e].concat(t));return o.done.catch(function(e){if(!(e instanceof d.default))throw e}),o},e}Object.defineProperty(n,"__esModule",{value:!0}),n.GET_STATE_DEPRECATED_WARNING=n.RUN_SAGA_DYNAMIC_ERROR=n.sagaArgError=void 0,n.default=u;var a=t(1),o=t(5),i=r(o),c=t(6),f=r(c),s=t(4),l=t(2),d=r(l),v=n.sagaArgError=function(e,n,t){return"\n "+e+" can only be called on Generator functions\n Argument "+t+" at position "+n+" is not function!\n"},g=n.RUN_SAGA_DYNAMIC_ERROR="Before running a Saga dynamically using middleware.run, you must mount the Saga middleware on the Store using applyMiddleware",p=n.GET_STATE_DEPRECATED_WARNING="\n Using the 'getState' param of Sagas to access the state is deprecated since 0.9.1\n To access the Store's state use 'yield select()' instead\n For more infos see http://yelouafi.github.io/redux-saga/docs/api/index.html#selectselector-args\n"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if((0,o.warnDeprecated)("storeIO is deprecated, to run Saga dynamically, use 'run' method of the middleware"),e[d])return e[d];var n=(0,s.default)(),t=e.dispatch;return e.dispatch=function(e){var r=t(e);return n.emit(e),r},e[d]={subscribe:n.subscribe,dispatch:e.dispatch,getState:e.getState},e[d]}function a(e,n){var t=n.subscribe,r=n.dispatch,u=n.getState,a=arguments.length<=2||void 0===arguments[2]?o.noop:arguments[2];return(0,o.check)(e,o.is.iterator,l),(0,c.default)(e,t,r,u,a)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=u,n.runSaga=a;var o=t(1),i=t(5),c=r(i),f=t(6),s=r(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=(0,o.sym)("IO")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e,n){function t(t,a){if(r)return v;if(a){if(r=!0,!(a instanceof l.default))throw a;return v}u&&u(t);var o=i(e[n],3),c=o[0],f=o[1],s=o[2];return u=s,n=d(f,t),d(c,t)}var r=void 0,u=void 0,a={next:t,"throw":function(e){return t(null,e)}};return a}function a(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),a=2;t>a;a++)r[a-2]=arguments[a];var o={done:!1,value:(0,f.take)(e)},i=function(e){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[e]))}};return u({take:[o,"fork"],fork:[i,"take"]},"take")}function o(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),a=2;t>a;a++)r[a-2]=arguments[a];var o={done:!1,value:(0,f.take)(e)},i=function(){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[d]))}},c=function(){return{done:!1,value:(0,f.cancel)(l)}},s=function(){return l?"cancel":"fork"},l=void 0,d=void 0;return u({take:[o,s,function(e){return d=e}],cancel:[c,"fork"],fork:[i,"take",function(e){return l=e}]},"take")}var i=function(){function e(e,n){var t=[],r=!0,u=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){u=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(n,"__esModule",{value:!0}),n.takeEvery=a,n.takeLatest=o;var c=t(1),f=t(3),s=t(2),l=r(s),d=function(e,n){return c.is.func(e)?e(n):e},v={done:!0}},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(){var e,n=!0,t=void 0,u=void 0;return e={},r(e,a.TASK,!0),r(e,"isRunning",function(){return n}),r(e,"result",function(){return t}),r(e,"error",function(){return u}),r(e,"setRunning",function(e){return n=e}),r(e,"setResult",function(e){return t=e}),r(e,"setError",function(e){return u=e}),e}Object.defineProperty(n,"__esModule",{value:!0}),n.createMockTask=u;var a=t(1)},function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}var u=t(1),a=t(3),o=t(5),i=t(11),c=t(4),f=r(c);e.exports={TASK:u.TASK,noop:u.noop,is:u.is,asEffect:a.asEffect,deferred:u.deferred,arrayOfDeffered:u.arrayOfDeffered,asap:u.asap,CANCEL:o.CANCEL,RACE_AUTO_CANCEL:o.RACE_AUTO_CANCEL,PARALLEL_AUTO_CANCEL:o.PARALLEL_AUTO_CANCEL,MANUAL_CANCEL:o.MANUAL_CANCEL,createMockTask:i.createMockTask,monitorActions:f}},function(e,n){function t(){f=!1,o.length?c=o.concat(c):s=-1,c.length&&r()}function r(){if(!f){var e=setTimeout(t);f=!0;for(var n=c.length;n;){for(o=c,c=[];++s<n;)o&&o[s].run();s=-1,n=c.length}o=null,f=!1,clearTimeout(e)}}function u(e,n){this.fun=e,this.array=n}function a(){}var o,i=e.exports={},c=[],f=!1,s=-1;i.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];c.push(new u(e,n)),1!==c.length||f||setTimeout(r,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=a,i.addListener=a,i.once=a,i.off=a,i.removeListener=a,i.removeAllListeners=a,i.emit=a,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var a=t[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.effects=n.takeLatest=n.takeEvery=n.storeIO=n.runSaga=n.isCancelError=n.SagaCancellationException=void 0;var u=t(9);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return u.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return u.storeIO}});var o=t(10);Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return o.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return o.takeLatest}});var i=t(8),c=a(i),f=t(2),s=a(f),l=t(7),d=r(l),v=t(12),g=r(v);n.default=c.default;var p=n.SagaCancellationException=s.default;n.isCancelError=function(e){return e instanceof p};n.effects=d,n.utils=g},function(e,n,t){(function(e){"use strict";function t(e){return e}function r(e,n,t){if(!n(e))throw new Error(t)}function a(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=s({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function o(e){for(var n=[],t=0;e>t;t++)n.push(u());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}function f(e){v&&console.warn("DEPRECATION WARNING",e)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};n.ident=t,n.check=r,n.remove=a,n.deferred=u,n.arrayOfDeffered=o,n.autoInc=i,n.asap=c,n.warnDeprecated=f;var l=n.sym=function(e){return"@@redux-saga/"+e},d=n.TASK=l("TASK"),v=(n.kTrue=function(){return!0},n.noop=function(){},n.isDev="undefined"!=typeof e&&e.env&&!1),g=n.is={undef:function(e){return null===e||void 0===e},notUndef:function(e){return null!==e&&void 0!==e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&g.func(e.then)},iterator:function(e){return e&&g.func(e.next)&&g.func(e.throw)},task:function(e){return e&&e[d]}}}).call(n,t(13))},function(e,n){"use strict";function t(e,n,t){var r="SagaCancellationException; type: "+e+", saga: "+n+", origin: "+t;this.name="SagaCancellationException",this.message=r,this.type=e,this.saga=n,this.origin=t,this.stack=(new Error).stack}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t,t.prototype=Object.create(Error.prototype),t.prototype.constructor=t},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e){return("*"===e?P.wildcard:E.is.array(e)?P.array:E.is.func(e)?P.predicate:P.default)(e)}function u(e){if(arguments.length>0&&E.is.undef(e))throw new Error(_);return I(C,E.is.undef(e)?"*":e)}function o(e){return I(b,e)}function i(e){return I(T,e)}function c(e,n){(0,E.check)(e,E.is.notUndef,h);var t=null;if(E.is.array(e)){var r=e,a=m(r,2);t=a[0],e=a[1]}else if(e.fn){var u=e;t=u.context,e=u.fn}return(0,E.check)(e,E.is.func,h),{context:t,fn:e,args:n}}function f(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return I(k,c(e,t))}function s(e,n){var t=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return I(k,c({context:e,fn:n},t))}function l(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return I(w,c(e,t))}function d(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return I(L,c(e,t))}function v(e){if(!x(e))throw new Error(y);return I(N,e)}function g(e){if(!x(e))throw new Error(A);return I(S,e)}function p(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return 0===arguments.length?e=E.ident:(0,E.check)(e,E.is.func,R),I(j,{selector:e,args:t})}Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.SELECT_ARG_ERROR=n.INVALID_PATTERN=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0;var m=function(){function e(e,n){var t=[],r=!0,a=!1,u=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){a=!0,u=c}finally{try{!r&&i.return&&i.return()}finally{if(a)throw u}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.matcher=a,n.take=u,n.put=o,n.race=i,n.call=f,n.apply=s,n.cps=l,n.fork=d,n.join=v,n.cancel=g,n.select=p;var E=t(1),h=n.CALL_FUNCTION_ARG_ERROR="call/cps/fork first argument must be a function, an array [context, function] or an object {context, fn}",y=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),A=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",_=n.INVALID_PATTERN="Invalid pattern passed to `take` (HINT: check if you didn't mispell a constant)",R=n.SELECT_ARG_ERROR="select first argument must be a function",O=(0,E.sym)("IO"),C="TAKE",b="PUT",T="RACE",k="CALL",w="CPS",L="FORK",N="JOIN",S="CANCEL",j="SELECT",I=function(e,n){var t;return t={},r(t,O,!0),r(t,e,n),t},P={wildcard:function(){return E.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},x=function(e){return e[E.TASK]};n.asEffect={take:function(e){return e&&e[O]&&e[C]},put:function(e){return e&&e[O]&&e[b]},race:function(e){return e&&e[O]&&e[T]},call:function(e){return e&&e[O]&&e[k]},cps:function(e){return e&&e[O]&&e[w]},fork:function(e){return e&&e[O]&&e[L]},join:function(e){return e&&e[O]&&e[N]},cancel:function(e){return e&&e[O]&&e[S]},select:function(e){return e&&e[O]&&e[j]}}},function(e,n){"use strict";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n,r,a){var u;return u={},t(u,o,!0),t(u,"type",i),t(u,"effectId",e),t(u,"parentEffectId",n),t(u,"label",r),t(u,"effect",a),u}function a(e,n){var r;return r={},t(r,o,!0),t(r,"type",c),t(r,"effectId",e),t(r,"result",n),r}function u(e,n){var r;return r={},t(r,o,!0),t(r,"type",f),t(r,"effectId",e),t(r,"error",n),r}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=a,n.effectRejected=u;var o=n.MONITOR_ACTION="MONITOR_ACTION",i=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",c=n.EFFECT_RESOLVED="EFFECT_RESOLVED",f=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function u(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){function n(e,n,t){"undefined"==typeof window?console.log("redux-saga "+e+": "+n+"\n"+t.stack):console[e].call(console,n,t)}function t(u,o){if(!e._isRunning)throw new Error("Trying to resume an already finished generator");try{var i=u?e.throw(u):e.next(o);i.done?r(i.value):a(i.value,M,"",t)}catch(u){r(u,!0),u instanceof v.default?c.isDev&&n("warn",U+": uncaught",u):n("error",U+": uncaught",u)}}function r(n,t){e._isRunning=!1,t?(e._error=n,K.reject(n)):(e._result=n,K.resolve(n)),J()}function a(e,n){function t(e,n){o||(o=!0,a.cancel=c.noop,x(e?l.effectRejected(u,e):l.effectResolved(u,n)),a(e,n))}var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],a=arguments[3],u=A();x(l.effectTriggered(u,n,r,e));var o=void 0;t.cancel=c.noop,a.cancel=function(e){if(!o){o=!0;try{t.cancel(e)}catch(n){}t.cancel=c.noop,a(e),x(l.effectRejected(u,e))}};var i=void 0;return c.is.promise(e)?s(e,t):c.is.iterator(e)?d(e,u,U,t):c.is.array(e)?w(e,u,t):c.is.notUndef(i=f.asEffect.take(e))?_(i,t):c.is.notUndef(i=f.asEffect.put(e))?R(i,t):c.is.notUndef(i=f.asEffect.race(e))?L(i,u,t):c.is.notUndef(i=f.asEffect.call(e))?O(i,u,t):c.is.notUndef(i=f.asEffect.cps(e))?C(i,t):c.is.notUndef(i=f.asEffect.fork(e))?b(i,u,t):c.is.notUndef(i=f.asEffect.join(e))?T(i,t):c.is.notUndef(i=f.asEffect.cancel(e))?k(i,t):c.is.notUndef(i=f.asEffect.select(e))?N(i,t):t(null,e)}function s(e,n){var t=e[m];"function"==typeof t&&(n.cancel=t),e.then(function(e){return n(null,e)},function(e){return n(e)})}function d(e,n,t,r){s(i(e,j,I,P,x,n,t).done,r)}function _(e,n){var t={match:(0,f.matcher)(e),pattern:e,resolve:function(e){return n(null,e)}};F.push(t),n.cancel=function(){return(0,c.remove)(F,t)}}function R(e,n){(0,c.asap)(function(){return n(null,I(e))})}function O(e,n,t){var r=e.context,a=e.fn,u=e.args,o=void 0;try{o=a.apply(r,u)}catch(i){return t(i)}return c.is.promise(o)?s(o,t):c.is.iterator(o)?d(o,n,a.name,t):t(null,o)}function C(e,n){var t=e.context,r=e.fn,a=e.args;try{r.apply(t,a.concat(n))}catch(u){return n(u)}}function b(e,n,t){var r=e.context,a=e.fn,u=e.args,o=void 0,f=void 0,s=void 0;try{o=a.apply(r,u)}catch(l){f=f}s=c.is.iterator(o)?o:(f?regeneratorRuntime.mark(function d(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw f;case 1:case"end":return e.stop()}},d,this)}):regeneratorRuntime.mark(function v(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o;case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},v,this)}))(),t(null,i(s,j,I,P,x,n,a.name,!0))}function T(e,n){s(e.done,n)}function k(e,n){e.done[m](new v.default(y,U,U)),n()}function w(e,n,t){function r(){u===i.length&&(o=!0,t(null,i))}if(!e.length)return void t(null,[]);var u=0,o=void 0,i=Array(e.length),f=e.map(function(e,n){var a=function(e,a){if(!o)if(e){try{t.cancel(new v.default(E,U,U))}catch(e){}t(e)}else i[n]=a,u++,r()};return a.cancel=c.noop,a});t.cancel=function(e){o||(o=!0,f.forEach(function(n){return n.cancel(e)}))},e.forEach(function(e,t){return a(e,n,t,f[t])})}function L(e,n,t){var r=void 0,u=Object.keys(e),i={};u.forEach(function(e){var n=function(n,a){if(!r)if(n){try{t.cancel(new v.default(h,U,U))}catch(n){}t(o({},e,n))}else{try{t.cancel(new v.default(h,U,U))}catch(n){}r=!0,t(null,o({},e,a))}};n.cancel=c.noop,i[e]=n}),t.cancel=function(e){r||(r=!0,u.forEach(function(n){return i[n].cancel(e)}))},u.forEach(function(t){return a(e[t],n,t,i[t])})}function N(e,n){var t=e.selector,r=e.args;try{var a=t.apply(void 0,[P()].concat(u(r)));n(null,a)}catch(o){n(o)}}function S(e,n,t,r,a){var u;return u={},o(u,c.TASK,!0),o(u,"id",e),o(u,"name",n),o(u,"done",r),o(u,"forked",a),o(u,"cancel",function(e){e instanceof v.default||(e=new v.default(y,n,e)),r[m](e)}),o(u,"isRunning",function(){return t._isRunning}),o(u,"result",function(){return t._result}),o(u,"error",function(){return t._error}),u}var j=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],I=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],P=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],x=arguments.length<=4||void 0===arguments[4]?c.noop:arguments[4],M=arguments.length<=5||void 0===arguments[5]?0:arguments[5],U=arguments.length<=6||void 0===arguments[6]?"anonymous":arguments[6],D=arguments[7];(0,c.check)(e,c.is.iterator,g);var G=p(U),F=[],K=(0,c.deferred)(),J=j(function(e){if(void 0===e)throw G;for(var n=0;n<F.length;n++){var t=F[n];t.match(e)&&(F=[],t.resolve(e))}});t.cancel=c.noop;var V=S(M,U,e,K.promise,D);return V.done[m]=function(e){var n=e.type,r=e.origin;t.cancel(new v.default(n,U,r))},e._isRunning=!0,t(),V}Object.defineProperty(n,"__esModule",{value:!0}),n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.CANCEL=n.undefindInputError=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=t(1),f=t(3),s=t(4),l=a(s),d=t(2),v=r(d),g=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.undefindInputError=function(e){return"\n "+e+" saga was provided with an undefined input action\n Hints :\n - check that your Action Creator returns a non undefined value\n - if the Saga was started using runSaga, check that your subscribe source provides the action to its listeners\n"},m=n.CANCEL=(0,c.sym)("@@redux-saga/cancelPromise"),E=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",h=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",y=n.MANUAL_CANCEL="MANUAL_CANCEL",A=(0,c.autoInc)()},function(e,n,t){"use strict";function r(){function e(e){return t.push(e),function(){return(0,a.remove)(t,e)}}function n(e){t.slice().forEach(function(n){return n(e)})}var t=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r;var a=t(1)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.select=n.cancel=n.join=n.fork=n.cps=n.apply=n.call=n.race=n.put=n.take=void 0;var r=t(3);n.take=r.take,n.put=r.put,n.race=r.race,n.call=r.call,n.apply=r.apply,n.cps=r.cps,n.fork=r.fork,n.join=r.join,n.cancel=r.cancel,n.select=r.select},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){function e(e){function n(e){for(var n=arguments.length,t=Array(n>1?n-1:0),a=1;n>a;a++)t[a-1]=arguments[a];return(0,i.default)(e.apply(void 0,[d].concat(t)),c.subscribe,o,r,l,0,e.name)}var r=e.getState,o=e.dispatch,c=(0,f.default)(),l=u.isDev?function(e){return(0,u.asap)(function(){return o(e)})}:void 0,d=function(){return(0,u.warnDeprecated)(p),r()};return a=n,t.forEach(n),function(e){return function(n){var t=e(n);return n[s.MONITOR_ACTION]||c.emit(n),t}}}for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];var a=void 0;return t.forEach(function(e,n){return(0,u.check)(e,u.is.func,v("createSagaMiddleware",n,e))}),e.run=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];if(!a)throw new Error(g);(0,u.check)(e,u.is.func,v("sagaMiddleware.run",0,e));var o=a.apply(void 0,[e].concat(t));return o.done.catch(function(e){if(!(e instanceof d.default))throw e}),o},e}Object.defineProperty(n,"__esModule",{value:!0}),n.GET_STATE_DEPRECATED_WARNING=n.RUN_SAGA_DYNAMIC_ERROR=n.sagaArgError=void 0,n.default=a;var u=t(1),o=t(5),i=r(o),c=t(6),f=r(c),s=t(4),l=t(2),d=r(l),v=n.sagaArgError=function(e,n,t){return"\n "+e+" can only be called on Generator functions\n Argument "+t+" at position "+n+" is not function!\n"},g=n.RUN_SAGA_DYNAMIC_ERROR="Before running a Saga dynamically using middleware.run, you must mount the Saga middleware on the Store using applyMiddleware",p=n.GET_STATE_DEPRECATED_WARNING="\n Using the 'getState' param of Sagas to access the state is deprecated since 0.9.1\n To access the Store's state use 'yield select()' instead\n For more infos see http://yelouafi.github.io/redux-saga/docs/api/index.html#selectselector-args\n"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){if((0,o.warnDeprecated)("storeIO is deprecated, to run Saga dynamically, use 'run' method of the middleware"),e[d])return e[d];var n=(0,s.default)(),t=e.dispatch;return e.dispatch=function(e){var r=t(e);return n.emit(e),r},e[d]={subscribe:n.subscribe,dispatch:e.dispatch,getState:e.getState},e[d]}function u(e,n){var t=n.subscribe,r=n.dispatch,a=n.getState,u=arguments.length<=2||void 0===arguments[2]?o.noop:arguments[2];return(0,o.check)(e,o.is.iterator,l),(0,c.default)(e,t,r,a,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=a,n.runSaga=u;var o=t(1),i=t(5),c=r(i),f=t(6),s=r(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=(0,o.sym)("IO")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,n){function t(t,r){if(a)return v;if(r){if(a=!0,!(r instanceof l.default))throw r;return v}u&&u(t);var o=i(e[n],3),c=o[0],f=o[1],s=o[2];return u=s,n=d(f,t),d(c,t)}var r=arguments.length<=2||void 0===arguments[2]?"iterator":arguments[2],a=void 0,u=void 0,o={name:r,next:t,"throw":function(e){return t(null,e)}};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function u(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),u=2;t>u;u++)r[u-2]=arguments[u];var o={done:!1,value:(0,f.take)(e)},i=function(e){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[e]))}};return a({take:[o,"fork"],fork:[i,"take"]},"take","takeEvery("+e+", "+n.name+")")}function o(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),u=2;t>u;u++)r[u-2]=arguments[u];var o={done:!1,value:(0,f.take)(e)},i=function(){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[d]))}},c=function(){return{done:!1,value:(0,f.cancel)(l)}},s=function(){return l?"cancel":"fork"},l=void 0,d=void 0;return a({take:[o,s,function(e){return d=e}],cancel:[c,"fork"],fork:[i,"take",function(e){return l=e}]},"take","takeLatest("+e+", "+n.name+")")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,n){var t=[],r=!0,a=!1,u=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){a=!0,u=c}finally{try{!r&&i.return&&i.return()}finally{if(a)throw u}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.takeEvery=u,n.takeLatest=o;var c=t(1),f=t(3),s=t(2),l=r(s),d=function(e,n){return c.is.func(e)?e(n):e},v={done:!0}},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){var e,n=!0,t=void 0,a=void 0;return e={},r(e,u.TASK,!0),r(e,"isRunning",function(){return n}),r(e,"result",function(){return t}),r(e,"error",function(){return a}),r(e,"setRunning",function(e){return n=e}),r(e,"setResult",function(e){return t=e}),r(e,"setError",function(e){return a=e}),e}Object.defineProperty(n,"__esModule",{value:!0}),n.createMockTask=a;var u=t(1)},function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}Object.defineProperty(n,"__esModule",{value:!0}),n.monitorActions=n.createMockTask=n.MANUAL_CANCEL=n.PARALLEL_AUTO_CANCEL=n.RACE_AUTO_CANCEL=n.CANCEL=n.asap=n.arrayOfDeffered=n.deferred=n.asEffect=n.is=n.noop=n.TASK=void 0;var a=t(1),u=t(3),o=t(5),i=t(11),c=t(4),f=r(c);n.TASK=a.TASK,n.noop=a.noop,n.is=a.is,n.asEffect=u.asEffect,n.deferred=a.deferred,n.arrayOfDeffered=a.arrayOfDeffered,n.asap=a.asap,n.CANCEL=o.CANCEL,n.RACE_AUTO_CANCEL=o.RACE_AUTO_CANCEL,n.PARALLEL_AUTO_CANCEL=o.PARALLEL_AUTO_CANCEL,n.MANUAL_CANCEL=o.MANUAL_CANCEL,n.createMockTask=i.createMockTask,n.monitorActions=f},function(e,n){function t(){f=!1,o.length?c=o.concat(c):s=-1,c.length&&r()}function r(){if(!f){var e=setTimeout(t);f=!0;for(var n=c.length;n;){for(o=c,c=[];++s<n;)o&&o[s].run();s=-1,n=c.length}o=null,f=!1,clearTimeout(e)}}function a(e,n){this.fun=e,this.array=n}function u(){}var o,i=e.exports={},c=[],f=!1,s=-1;i.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];c.push(new a(e,n)),1!==c.length||f||setTimeout(r,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=u,i.addListener=u,i.once=u,i.off=u,i.removeListener=u,i.removeAllListeners=u,i.emit=u,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.select = exports.cancel = exports.join = exports.fork = exports.cps = exports.apply = exports.call = exports.race = exports.put = exports.take = undefined; | ||
var _io = require('./internal/io'); | ||
module.exports = { take: _io.take, put: _io.put, race: _io.race, call: _io.call, apply: _io.apply, cps: _io.cps, fork: _io.fork, join: _io.join, cancel: _io.cancel, select: _io.select }; | ||
exports.take = _io.take; | ||
exports.put = _io.put; | ||
exports.race = _io.race; | ||
exports.call = _io.call; | ||
exports.apply = _io.apply; | ||
exports.cps = _io.cps; | ||
exports.fork = _io.fork; | ||
exports.join = _io.join; | ||
exports.cancel = _io.cancel; | ||
exports.select = _io.select; |
"use strict"; | ||
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"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,2 +7,5 @@ value: true | ||
exports.asEffect = exports.SELECT_ARG_ERROR = exports.INVALID_PATTERN = exports.CANCEL_ARG_ERROR = exports.JOIN_ARG_ERROR = exports.FORK_ARG_ERROR = exports.CALL_FUNCTION_ARG_ERROR = 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"); } }; }(); | ||
exports.matcher = matcher; | ||
@@ -11,0 +12,0 @@ exports.take = take; |
@@ -52,2 +52,3 @@ 'use strict'; | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -92,4 +93,4 @@ | ||
/** | ||
this maybe called by a parent generator to trigger/propagate cancellation | ||
W'll simply cancel the current effect, which will reject that effect | ||
This may be called by a parent generator to trigger/propagate cancellation | ||
We'll simply cancel the current effect, which will reject that effect | ||
The rejection will throw the injected SagaCancellationException into the flow | ||
@@ -115,12 +116,26 @@ of this generator | ||
/** | ||
Print error in a useful way whether in a browser environment | ||
(with expandable error stack traces), or in a node.js environment | ||
(text-only log output) | ||
**/ | ||
function logError(level, message, error) { | ||
/*eslint-disable no-console*/ | ||
if (typeof window === 'undefined') { | ||
console.log('redux-saga ' + level + ': ' + message + '\n' + error.stack); | ||
} else { | ||
console[level].call(console, message, error); | ||
} | ||
} | ||
/** | ||
This is the generator driver | ||
It's a recursive aysnc/continuation function which calls itself | ||
It's a recursive async/continuation function which calls itself | ||
until the generator terminates or throws | ||
**/ | ||
function next(error, arg) { | ||
// Preventive measure. If we endup here, then there is really something wrong | ||
// Preventive measure. If we end up here, then there is really something wrong | ||
if (!iterator._isRunning) throw new Error('Trying to resume an already finished generator'); | ||
try { | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// calling iterator.throw on a generator that doesn't define a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
@@ -136,7 +151,8 @@ var result = error ? iterator.throw(error) : iterator.next(arg); | ||
/*eslint-disable no-console*/ | ||
if (error instanceof _SagaCancellationException2.default) { | ||
if (_utils.isDev) console.warn(name + ': uncaught', error); | ||
if (_utils.isDev) { | ||
logError('warn', name + ': uncaught', error); | ||
} | ||
} else { | ||
console.error(name + ': uncaught', error); | ||
logError('error', name + ': uncaught', error); | ||
//if(!forked) | ||
@@ -403,3 +419,3 @@ // throw error | ||
var chCbAtIdx = function chCbAtIdx(err, res) { | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
if (completed) return; | ||
@@ -406,0 +422,0 @@ // one of the effects failed |
@@ -62,2 +62,3 @@ 'use strict'; | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -64,0 +65,0 @@ |
'use strict'; | ||
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"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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"); } }; }(); | ||
exports.takeEvery = takeEvery; | ||
@@ -27,2 +28,4 @@ exports.takeLatest = takeLatest; | ||
function fsmIterator(fsm, nextState) { | ||
var name = arguments.length <= 2 || arguments[2] === undefined ? 'iterator' : arguments[2]; | ||
var aborted = undefined, | ||
@@ -54,2 +57,3 @@ updateState = undefined; | ||
var iterator = { | ||
name: name, | ||
next: next, | ||
@@ -60,2 +64,7 @@ throw: function _throw(error) { | ||
}; | ||
if (typeof Symbol !== 'undefined') { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
@@ -77,3 +86,3 @@ } | ||
'fork': [yieldFork, 'take'] | ||
}, 'take'); | ||
}, 'take', 'takeEvery(' + pattern + ', ' + worker.name + ')'); | ||
} | ||
@@ -107,3 +116,3 @@ | ||
}] | ||
}, 'take'); | ||
}, 'take', 'takeLatest(' + pattern + ', ' + worker.name + ')'); | ||
} |
'use strict'; | ||
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; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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.ident = ident; | ||
@@ -9,0 +10,0 @@ exports.check = check; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.monitorActions = exports.createMockTask = exports.MANUAL_CANCEL = exports.PARALLEL_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = exports.CANCEL = exports.asap = exports.arrayOfDeffered = exports.deferred = exports.asEffect = exports.is = exports.noop = exports.TASK = undefined; | ||
var _utils = require('./internal/utils'); | ||
@@ -17,18 +22,14 @@ | ||
module.exports = { | ||
TASK: _utils.TASK, | ||
noop: _utils.noop, | ||
is: _utils.is, asEffect: _io.asEffect, | ||
deferred: _utils.deferred, | ||
arrayOfDeffered: _utils.arrayOfDeffered, | ||
asap: _utils.asap, | ||
CANCEL: _proc.CANCEL, | ||
RACE_AUTO_CANCEL: _proc.RACE_AUTO_CANCEL, | ||
PARALLEL_AUTO_CANCEL: _proc.PARALLEL_AUTO_CANCEL, | ||
MANUAL_CANCEL: _proc.MANUAL_CANCEL, | ||
createMockTask: _testUtils.createMockTask, | ||
monitorActions: monitorActions | ||
}; | ||
exports.TASK = _utils.TASK; | ||
exports.noop = _utils.noop; | ||
exports.is = _utils.is; | ||
exports.asEffect = _io.asEffect; | ||
exports.deferred = _utils.deferred; | ||
exports.arrayOfDeffered = _utils.arrayOfDeffered; | ||
exports.asap = _utils.asap; | ||
exports.CANCEL = _proc.CANCEL; | ||
exports.RACE_AUTO_CANCEL = _proc.RACE_AUTO_CANCEL; | ||
exports.PARALLEL_AUTO_CANCEL = _proc.PARALLEL_AUTO_CANCEL; | ||
exports.MANUAL_CANCEL = _proc.MANUAL_CANCEL; | ||
exports.createMockTask = _testUtils.createMockTask; | ||
exports.monitorActions = monitorActions; |
{ | ||
"name": "redux-saga", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "Saga middleware for Redux to handle Side Effects", | ||
"main": "lib/index.js", | ||
"jsnext:main": "src/index.js", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "lint": "eslint src", |
@@ -1,4 +0,3 @@ | ||
import { take, put, race, call, apply, cps, fork, join, cancel, select } from './internal/io' | ||
module.exports = { take, put, race, call, apply, cps, fork, join, cancel, select } | ||
export { take, put, race, call, apply, cps, fork, join, cancel, select } |
@@ -76,4 +76,4 @@ import { sym, noop, is, isDev, check, remove, deferred, autoInc, asap, TASK } from './utils' | ||
/** | ||
this maybe called by a parent generator to trigger/propagate cancellation | ||
W'll simply cancel the current effect, which will reject that effect | ||
This may be called by a parent generator to trigger/propagate cancellation | ||
We'll simply cancel the current effect, which will reject that effect | ||
The rejection will throw the injected SagaCancellationException into the flow | ||
@@ -98,8 +98,22 @@ of this generator | ||
/** | ||
Print error in a useful way whether in a browser environment | ||
(with expandable error stack traces), or in a node.js environment | ||
(text-only log output) | ||
**/ | ||
function logError(level, message, error) { | ||
/*eslint-disable no-console*/ | ||
if (typeof window === 'undefined') { | ||
console.log(`redux-saga ${level}: ${message}\n${error.stack}`) | ||
} else { | ||
console[level].call(console, message, error) | ||
} | ||
} | ||
/** | ||
This is the generator driver | ||
It's a recursive aysnc/continuation function which calls itself | ||
It's a recursive async/continuation function which calls itself | ||
until the generator terminates or throws | ||
**/ | ||
function next(error, arg) { | ||
// Preventive measure. If we endup here, then there is really something wrong | ||
// Preventive measure. If we end up here, then there is really something wrong | ||
if(!iterator._isRunning) | ||
@@ -110,3 +124,3 @@ throw new Error('Trying to resume an already finished generator') | ||
try { | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// calling iterator.throw on a generator that doesn't define a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
@@ -122,8 +136,8 @@ const result = error ? iterator.throw(error) : iterator.next(arg) | ||
/*eslint-disable no-console*/ | ||
if(error instanceof SagaCancellationException) { | ||
if(isDev) | ||
console.warn(`${name}: uncaught`, error ) | ||
if(isDev) { | ||
logError('warn', `${name}: uncaught`, error) | ||
} | ||
} else { | ||
console.error(`${name}: uncaught`, error ) | ||
logError('error', `${name}: uncaught`, error) | ||
//if(!forked) | ||
@@ -369,3 +383,3 @@ // throw error | ||
const chCbAtIdx = (err, res) => { | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
// Either we've been cancelled, or an error aborted the whole effect | ||
if(completed) | ||
@@ -372,0 +386,0 @@ return |
@@ -8,3 +8,3 @@ import { is } from './utils' | ||
function fsmIterator(fsm, nextState) { | ||
function fsmIterator(fsm, nextState, name = 'iterator') { | ||
let aborted, updateState | ||
@@ -33,5 +33,9 @@ | ||
const iterator = { | ||
name, | ||
next, | ||
throw: error => next(null, error) | ||
} | ||
if(typeof Symbol !== 'undefined') { | ||
iterator[Symbol.iterator] = () => iterator | ||
} | ||
return iterator | ||
@@ -47,3 +51,3 @@ } | ||
'fork' : [yieldFork, 'take'] | ||
}, 'take') | ||
}, 'take', `takeEvery(${pattern}, ${worker.name})`) | ||
} | ||
@@ -62,3 +66,3 @@ | ||
'fork' : [yieldFork, 'take', task => currentTask = task ] | ||
}, 'take') | ||
}, 'take', `takeLatest(${pattern}, ${worker.name})`) | ||
} |
@@ -1,2 +0,1 @@ | ||
import { | ||
@@ -24,4 +23,3 @@ TASK, | ||
module.exports = { | ||
export { | ||
TASK, | ||
@@ -28,0 +26,0 @@ noop, |
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
226387
3281