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

redux-saga

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-saga - npm Package Compare versions

Comparing version 0.15.3 to 0.15.4

.lintstagedrc

5

.eslintrc.json

@@ -8,3 +8,6 @@ {

},
"parser": "babel-eslint"
"parser": "babel-eslint",
"rules": {
"comma-dangle": ["error", "always-multiline"]
}
}

123

dist/redux-saga.js

@@ -184,3 +184,3 @@ (function (global, factory) {

var array = {
'from': function from(obj) {
from: function from(obj) {
var arr = Array(obj.length);

@@ -360,3 +360,3 @@ for (var i in obj) {

var BUFFER_OVERFLOW = 'Channel\'s Buffer overflow!';
var BUFFER_OVERFLOW = "Channel's Buffer overflow!";

@@ -439,3 +439,4 @@ var ON_OVERFLOW_THROW = 1;

},
take: take, flush: flush
take: take,
flush: flush
};

@@ -598,3 +599,3 @@ }

checkForbiddenStates();
check(cb, is.func, 'channel.take\'s callback must be a function');
check(cb, is.func, "channel.take's callback must be a function");

@@ -614,4 +615,4 @@ if (closed && buffer.isEmpty()) {

function flush$$1(cb) {
checkForbiddenStates(); // TODO: check if some new state should be forbidden now
check(cb, is.func, 'channel.flush\' callback must be a function');
checkForbiddenStates // TODO: check if some new state should be forbidden now
();check(cb, is.func, "channel.flush' callback must be a function");
if (closed && buffer.isEmpty()) {

@@ -638,3 +639,7 @@ cb(END);

return { take: take, put: put, flush: flush$$1, close: close,
return {
take: take,
put: put,
flush: flush$$1,
close: close,
get __takers__() {

@@ -711,3 +716,3 @@ return takers;

if (arguments.length > 1) {
check(matcher, is.func, 'channel.take\'s matcher argument must be a function');
check(matcher, is.func, "channel.take's matcher argument must be a function");
cb[MATCH] = matcher;

@@ -723,2 +728,14 @@ }

function safeName(patternOrChannel) {
if (is.channel(patternOrChannel)) {
return 'channel';
} else if (Array.isArray(patternOrChannel)) {
return String(patternOrChannel.map(function (entry) {
return String(entry);
}));
} else {
return String(patternOrChannel);
}
}
function fsmIterator(fsm, q0) {

@@ -757,15 +774,3 @@ var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'iterator';

function safeName(patternOrChannel) {
if (is.channel(patternOrChannel)) {
return 'channel';
} else if (Array.isArray(patternOrChannel)) {
return String(patternOrChannel.map(function (entry) {
return String(entry);
}));
} else {
return String(patternOrChannel);
}
}
function takeEveryHelper(patternOrChannel, worker) {
function takeEvery$2(patternOrChannel, worker) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {

@@ -795,5 +800,5 @@ args[_key - 2] = arguments[_key];

function takeLatestHelper(patternOrChannel, worker) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
function takeLatest$2(patternOrChannel, worker) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}

@@ -831,5 +836,5 @@

function throttleHelper(delayLength, pattern, worker) {
for (var _len3 = arguments.length, args = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
args[_key3 - 3] = arguments[_key3];
function throttle$2(delayLength, pattern, worker) {
for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
args[_key - 3] = arguments[_key];
}

@@ -875,6 +880,7 @@

};
var takeEvery$1 = deprecate(takeEveryHelper, deprecationWarning('takeEvery'));
var takeLatest$1 = deprecate(takeLatestHelper, deprecationWarning('takeLatest'));
var throttle$1 = deprecate(throttleHelper, deprecationWarning('throttle'));
var takeEvery$1 = /*#__PURE__*/deprecate(takeEvery$2, /*#__PURE__*/deprecationWarning('takeEvery'));
var takeLatest$1 = /*#__PURE__*/deprecate(takeLatest$2, /*#__PURE__*/deprecationWarning('takeLatest'));
var throttle$1 = /*#__PURE__*/deprecate(throttle$2, /*#__PURE__*/deprecationWarning('throttle'));
var IO = sym('IO');

@@ -926,3 +932,3 @@ var TAKE = 'TAKE';

var takem = deprecate(take.maybe, updateIncentive('takem', 'take.maybe'));
var takem = /*#__PURE__*/deprecate(take.maybe, /*#__PURE__*/updateIncentive('takem', 'take.maybe'));

@@ -1103,3 +1109,3 @@ function put(channel, action) {

return fork.apply(undefined, [takeEveryHelper, patternOrChannel, worker].concat(args));
return fork.apply(undefined, [takeEvery$2, patternOrChannel, worker].concat(args));
}

@@ -1112,3 +1118,3 @@

return fork.apply(undefined, [takeLatestHelper, patternOrChannel, worker].concat(args));
return fork.apply(undefined, [takeLatest$2, patternOrChannel, worker].concat(args));
}

@@ -1121,3 +1127,3 @@

return fork.apply(undefined, [throttleHelper, ms, pattern, worker].concat(args));
return fork.apply(undefined, [throttle$2, ms, pattern, worker].concat(args));
}

@@ -1188,2 +1194,3 @@

function matcher(pattern) {
// prettier-ignore
return (pattern === '*' ? matchers.wildcard : is.array(pattern) ? matchers.array : is.stringableFunc(pattern) ? matchers.default : is.func(pattern) ? matchers.predicate : matchers.default)(pattern);

@@ -1340,3 +1347,3 @@ }

var stdChannel$$1 = stdChannel(subscribe);
var taskContext = Object.create(parentContext);
var taskContext = Object.create(parentContext
/**

@@ -1347,3 +1354,3 @@ Tracks the current effect cancellation

**/
next.cancel = noop;
);next.cancel = noop;

@@ -1356,3 +1363,3 @@ /**

var mainTask = { name: name, cancel: cancelMain, isRunning: true };
var taskQueue = forkQueue(name, mainTask, end);
var taskQueue = forkQueue(name, mainTask, end

@@ -1362,3 +1369,3 @@ /**

**/
function cancelMain() {
);function cancelMain() {
if (mainTask.isRunning && !mainTask.isCancelled) {

@@ -1384,7 +1391,7 @@ mainTask.isCancelled = true;

iterator._isCancelled = true;
taskQueue.cancelAll();
taskQueue.cancelAll
/**
Ending with a Never result will propagate the Cancellation to all joiners
**/
end(TASK_CANCEL);
();end(TASK_CANCEL);
}

@@ -1402,6 +1409,6 @@ }

// kicks up the generator
next();
next
// then return the task descriptor to the caller
return task;
();return task;

@@ -1434,3 +1441,3 @@ /**

**/
next.cancel();
next.cancel
/**

@@ -1440,3 +1447,3 @@ If this Generator has a `return` method then invokes it

**/
result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
();result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
} else if (arg === CHANNEL_END) {

@@ -1502,3 +1509,3 @@ // We get CHANNEL_END by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)

var effectId = uid();
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect });
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect }

@@ -1510,3 +1517,3 @@ /**

**/
var effectSettled = void 0;
);var effectSettled = void 0;

@@ -1565,8 +1572,9 @@ // Completion callback passed to the appropriate effect runner

var data = void 0;
// prettier-ignore
return (
// Non declarative effect
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb)
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb
// declarative effects
: is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
) : is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
);

@@ -1577,4 +1585,11 @@ }

var cancelPromise = promise[CANCEL];
if (typeof cancelPromise === 'function') {
if (is.func(cancelPromise)) {
cb.cancel = cancelPromise;
} else if (is.func(promise.abort)) {
cb.cancel = function () {
return promise.abort
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
();
};
}

@@ -1632,4 +1647,5 @@ promise.then(cb, function (error) {

}
});
}
// Put effects are non cancellables
);
}

@@ -1725,4 +1741,5 @@

}
cb();
cb
// cancel effects are non cancellables
();
}

@@ -2004,4 +2021,4 @@

}
var result = next(action); // hit reducers
sagaEmitter.emit(action);
var result = next(action // hit reducers
);sagaEmitter.emit(action);
return result;

@@ -2008,0 +2025,0 @@ };

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.ReduxSaga=n.ReduxSaga||{})}(this,function(n){"use strict";function t(n,t,e){if(!t(n))throw f("error","uncaught at check",e),Error(e)}function e(n,t){return hn.notUndef(n)&&gn.call(n,t)}function r(n,t){var e=n.indexOf(t);0>e||n.splice(e,1)}function o(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=tn({},n),e=new Promise(function(n,e){t.resolve=n,t.reject=e});return t.promise=e,t}function u(n){for(var t=[],e=0;n>e;e++)t.push(o());return t}function a(n){var t=1>=arguments.length||void 0===arguments[1]||arguments[1],e=void 0,r=new Promise(function(r){e=setTimeout(function(){return r(t)},n)});return r[cn]=function(){return clearTimeout(e)},r}function i(){var n,t=!0,e=void 0,r=void 0;return n={},n[on]=!0,n.isRunning=function(){return t},n.result=function(){return e},n.error=function(){return r},n.setRunning=function(n){return t=n},n.setResult=function(n){return e=n},n.setError=function(n){return r=n},n}function c(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bn,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:e,next:n,throw:t,return:En};return r&&(o[un]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function f(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"undefined"==typeof window?console.log("redux-saga "+n+": "+t+"\n"+(e&&e.stack||e)):console[n](t,e)}function l(n,t){return function(){return n.apply(void 0,arguments)}}function s(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments[1],e=Array(n),r=0,o=0,u=0,a=function(t){e[o]=t,o=(o+1)%n,r++},i=function(){if(0!=r){var t=e[u];return e[u]=null,r--,u=(u+1)%n,t}},c=function(){for(var n=[];r;)n.push(i());return n};return{isEmpty:function(){return 0==r},put:function(i){if(n>r)a(i);else{var f=void 0;switch(t){case jn:throw Error(_n);case Sn:e[o]=i,o=(o+1)%n,u=o;break;case Tn:f=2*n,e=c(),r=e.length,o=e.length,u=0,e.length=f,n=f,a(i)}}},take:i,flush:c}}function d(n){try{g(),n()}finally{h()}}function v(n){Rn.push(n),Ln||(g(),p())}function g(){Ln++}function h(){Ln--}function p(){h();for(var n=void 0;!Ln&&void 0!==(n=Rn.shift());)d(n)}function y(){function n(n){return e.push(n),function(){return r(e,n)}}function t(n){for(var t=e.slice(),r=0,o=t.length;o>r;r++)t[r](n)}var e=[];return{subscribe:n,emit:t}}function m(){function n(){if(c&&f.length)throw Cn("Cannot have a closed channel with pending takers");if(f.length&&!i.isEmpty())throw Cn("Cannot have pending takers with non empty buffer")}function e(e){if(n(),t(e,hn.notUndef,In),!c){if(!f.length)return i.put(e);for(var r=0;f.length>r;r++){var o=f[r];if(!o[an]||o[an](e))return f.splice(r,1),o(e)}}}function o(e){n(),t(e,hn.func,"channel.take's callback must be a function"),c&&i.isEmpty()?e(qn):i.isEmpty()?(f.push(e),e.cancel=function(){return r(f,e)}):e(i.take())}function u(e){if(n(),t(e,hn.func,"channel.flush' callback must be a function"),c&&i.isEmpty())return void e(qn);e(i.flush())}function a(){if(n(),!c&&(c=!0,f.length)){var t=f;f=[];for(var e=0,r=t.length;r>e;e++)t[e](qn)}}var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nn.fixed(),c=!1,f=[];return t(i,hn.buffer,Mn),{take:o,put:e,flush:u,close:a,get __takers__(){return f},get __closed__(){return c}}}function b(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn.none(),r=arguments[2];arguments.length>2&&t(r,hn.func,"Invalid match function passed to eventChannel");var o=m(e),u=function(){o.__closed__||(a&&a(),o.close())},a=n(function(n){if(Un(n))return void u();r&&!r(n)||o.put(n)});if(o.__closed__&&a(),!hn.func(a))throw Error("in eventChannel: subscribe should return a function to unsubscribe");return{take:o.take,flush:o.flush,close:u}}function E(n){var e=b(function(t){return n(function(n){if(n[fn])return void t(n);v(function(){return t(n)})})});return tn({},e,{take:function(n,r){arguments.length>1&&(t(r,hn.func,"channel.take's matcher argument must be a function"),n[an]=r),e.take(n)}})}function k(n,t){function e(t,e){if(u===Dn)return Pn;if(e)throw u=Dn,e;o&&o(t);var r=n[u](),a=r[0],i=r[1],c=r[2];return u=a,o=c,u===Dn?Pn:i}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iterator",o=void 0,u=t;return c(e,function(n){return e(null,n)},r,!0)}function C(n){return hn.channel(n)?"channel":Array.isArray(n)?n.map(function(n){return n+""})+"":n+""}function A(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];var u={done:!1,value:_(n)},a=function(n){return{done:!1,value:q.apply(void 0,[t].concat(r,[n]))}},i=void 0,c=function(n){return i=n};return k({q1:function(){return["q2",u,c]},q2:function(){return i===qn?[Dn]:["q1",a(i)]}},"q1","takeEvery("+C(n)+", "+t.name+")")}function x(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];var u={done:!1,value:_(n)},a=function(n){return{done:!1,value:q.apply(void 0,[t].concat(r,[n]))}},i=function(n){return{done:!1,value:I(n)}},c=void 0,f=void 0,l=function(n){return c=n},s=function(n){return f=n};return k({q1:function(){return["q2",u,s]},q2:function(){return f===qn?[Dn]:c?["q3",i(c)]:["q1",a(f),l]},q3:function(){return["q1",a(f),l]}},"q1","takeLatest("+C(n)+", "+t.name+")")}function w(n,t,e){for(var r=arguments.length,o=Array(r>3?r-3:0),u=3;r>u;u++)o[u-3]=arguments[u];var i=void 0,c=void 0,f={done:!1,value:D(t,Nn.sliding(1))},l=function(){return{done:!1,value:_(c)}},s=function(n){return{done:!1,value:q.apply(void 0,[e].concat(o,[n]))}},d={done:!1,value:N(a,n)},v=function(n){return i=n},g=function(n){return c=n};return k({q1:function(){return["q2",f,g]},q2:function(){return["q3",l(),v]},q3:function(){return i===qn?[Dn]:["q4",s(i)]},q4:function(){return["q2",d]}},"q1","throttle("+C(t)+", "+e.name+")")}function _(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";if(arguments.length&&t(arguments[0],hn.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),hn.pattern(n))return it(Bn,{pattern:n});if(hn.channel(n))return it(Bn,{channel:n});throw Error("take(patternOrChannel): argument "+n+" is not valid channel or a valid pattern")}function j(n,e){return arguments.length>1?(t(n,hn.notUndef,"put(channel, action): argument channel is undefined"),t(n,hn.channel,"put(channel, action): argument "+n+" is not a valid channel"),t(e,hn.notUndef,"put(channel, action): argument action is undefined")):(t(n,hn.notUndef,"put(action): argument action is undefined"),e=n,n=null),it(Xn,{channel:n,action:e})}function S(n){return it(Jn,n)}function T(n){return it(Qn,n)}function O(n,e,r){t(e,hn.notUndef,n+": argument fn is undefined");var o=null;if(hn.array(e)){var u=e;o=u[0],e=u[1]}else if(e.fn){var a=e;o=a.context,e=a.fn}return o&&hn.string(e)&&hn.func(o[e])&&(e=o[e]),t(e,hn.func,n+": argument "+e+" is not a function"),{context:o,fn:e,args:r}}function N(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Vn,O("call",n,e))}function R(n,t){return it(Vn,O("apply",{context:n,fn:t},arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))}function L(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Wn,O("cps",n,e))}function q(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Yn,O("fork",n,e))}function U(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];var o=q.apply(void 0,[n].concat(e));return o[Yn].detached=!0,o}function M(){for(var n=arguments.length,e=Array(n),r=0;n>r;r++)e[r]=arguments[r];if(e.length>1)return S(e.map(function(n){return M(n)}));var o=e[0];return t(o,hn.notUndef,"join(task): argument task is undefined"),t(o,hn.task,"join(task): argument "+o+" is not a valid Task object "+at),it(Zn,o)}function I(){for(var n=arguments.length,e=Array(n),r=0;n>r;r++)e[r]=arguments[r];if(e.length>1)return S(e.map(function(n){return I(n)}));var o=e[0];return 1===e.length&&(t(o,hn.notUndef,"cancel(task): argument task is undefined"),t(o,hn.task,"cancel(task): argument "+o+" is not a valid Task object "+at)),it($n,o||ln)}function P(n){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;e>o;o++)r[o-1]=arguments[o];return 0===arguments.length?n=vn:(t(n,hn.notUndef,"select(selector,[...]): argument selector is undefined"),t(n,hn.func,"select(selector,[...]): argument "+n+" is not a function")),it(nt,{selector:n,args:r})}function D(n,e){return t(n,hn.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&(t(e,hn.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),t(e,hn.buffer,"actionChannel(pattern, buffer): argument "+e+" is not a valid buffer")),it(tt,{pattern:n,buffer:e})}function H(){return it(et,{})}function G(n){return t(n,hn.channel,"flush(channel): argument "+n+" is not valid channel"),it(rt,n)}function F(n){return t(n,hn.string,"getContext(prop): argument "+n+" is not a string"),it(ot,n)}function K(n){return t(n,hn.object,An(null,n)),it(ut,n)}function z(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];return q.apply(void 0,[A,n,t].concat(r))}function B(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];return q.apply(void 0,[x,n,t].concat(r))}function X(n,t,e){for(var r=arguments.length,o=Array(r>3?r-3:0),u=3;r>u;u++)o[u-3]=arguments[u];return q.apply(void 0,[w,n,t,e].concat(o))}function J(n){return("*"===n?gt.wildcard:hn.array(n)?gt.array:hn.stringableFunc(n)?gt.default:hn.func(n)?gt.predicate:gt.default)(n)}function Q(n,t,e){function o(n){a(),e(n,!0)}function u(n){i.push(n),n.cont=function(u,a){f||(r(i,n),n.cont=dn,a?o(u):(n===t&&(c=u),i.length||(f=!0,e(c))))}}function a(){f||(f=!0,i.forEach(function(n){n.cont=dn,n.cancel()}),i=[])}var i=[],c=void 0,f=!1;return u(t),{addTask:u,cancelAll:a,abort:o,getTasks:function(){return i},taskNames:function(){return i.map(function(n){return n.name})}}}function V(n){var t=n.context,e=n.fn,r=n.args;if(hn.iterator(e))return e;var o=void 0,u=void 0;try{o=e.apply(t,r)}catch(n){u=n}return hn.iterator(o)?o:c(u?function(){throw u}:function(){var n=void 0,t={done:!1,value:o},e=function(n){return{done:!0,value:n}};return function(r){return n?e(r):(n=!0,t)}}())}function W(n){function e(){$.isRunning&&!$.isCancelled&&($.isCancelled=!0,a(vt))}function u(){n._isRunning&&!n._isCancelled&&(n._isCancelled=!0,en.cancelAll(),i(vt))}function a(t,e){if(!$.isRunning)throw Error("Trying to resume an already finished generator");try{var r=void 0;e?r=n.throw(t):t===vt?($.isCancelled=!0,a.cancel(),r=hn.func(n.return)?n.return(vt):{done:!0,value:vt}):r=t===dt?hn.func(n.return)?n.return():{done:!0}:n.next(t),r.done?($.isMainRunning=!1,$.cont&&$.cont(r.value)):c(r.value,P,"",a)}catch(n){$.isCancelled&&B("error","uncaught at "+D,n.message),$.isMainRunning=!1,$.cont(n,!0)}}function i(t,e){n._isRunning=!1,X.close(),e?(t instanceof Error&&(t.sagaStack="at "+D+" \n "+(t.sagaStack||t.stack)),Z.cont||(B("error","uncaught",t.sagaStack||t.stack),t instanceof Error&&z&&z(t)),n._error=t,n._isAborted=!0,n._deferredEnd&&n._deferredEnd.reject(t)):(n._result=t,n._deferredEnd&&n._deferredEnd.resolve(t)),Z.cont&&Z.cont(t,e),Z.joiners.forEach(function(n){return n.cb(t,e)}),Z.joiners=null}function c(n,t){function e(n,t){a||(a=!0,o.cancel=dn,F&&(t?F.effectRejected(u,n):F.effectResolved(u,n)),o(n,t))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments[3],u=mn();F&&F.effectTriggered({effectId:u,parentEffectId:t,label:r,effect:n});var a=void 0;e.cancel=dn,o.cancel=function(){if(!a){a=!0;try{e.cancel()}catch(n){B("error","uncaught at "+D,n.message)}e.cancel=dn,F&&F.effectCancelled(u)}};var i=void 0;return hn.promise(n)?s(n,e):hn.helper(n)?C(ht(n),u,e):hn.iterator(n)?d(n,u,D,e):hn.array(n)?G(n,u,e):(i=lt.take(n))?h(i,e):(i=lt.put(n))?y(i,e):(i=lt.all(n))?w(i,u,e):(i=lt.race(n))?_(i,u,e):(i=lt.call(n))?m(i,u,e):(i=lt.cps(n))?k(i,e):(i=lt.fork(n))?C(i,u,e):(i=lt.join(n))?A(i,e):(i=lt.cancel(n))?x(i,e):(i=lt.select(n))?j(i,e):(i=lt.actionChannel(n))?S(i,e):(i=lt.flush(n))?O(i,e):(i=lt.cancelled(n))?T(i,e):(i=lt.getContext(n))?N(i,e):(i=lt.setContext(n))?R(i,e):e(n)}function s(n,t){var e=n[cn];"function"==typeof e&&(t.cancel=e),n.then(t,function(n){return t(n,!0)})}function d(n,t,e,r){W(n,L,q,U,Y,I,t,e,r)}function h(n,t){var e=n.channel,r=n.pattern,o=n.maybe;e=e||X;var u=function(n){return n instanceof Error?t(n,!0):t(Un(n)&&!o?dt:n)};try{e.take(u,J(r))}catch(n){return t(n,!0)}t.cancel=u.cancel}function y(n,t){var e=n.channel,r=n.action,o=n.resolve;v(function(){var n=void 0;try{n=(e?e.put:q)(r)}catch(n){if(e||o)return t(n,!0);B("error","uncaught at "+D,n.stack||n.message||n)}if(!o||!hn.promise(n))return t(n);s(n,t)})}function m(n,t,e){var r=n.context,o=n.fn,u=n.args,a=void 0;try{a=o.apply(r,u)}catch(n){return e(n,!0)}return hn.promise(a)?s(a,e):hn.iterator(a)?d(a,t,o.name,e):e(a)}function k(n,t){var e=n.context,r=n.fn,o=n.args;try{var u=function(n,e){return hn.undef(n)?t(e):t(n,!0)};r.apply(e,o.concat(u)),u.cancel&&(t.cancel=function(){return u.cancel()})}catch(n){return t(n,!0)}}function C(n,t,e){var r=n.context,o=n.fn,u=n.args,a=n.detached,i=V({context:r,fn:o,args:u});try{g();var c=W(i,L,q,U,Y,I,t,o.name,a?null:dn);a?e(c):i._isRunning?(en.addTask(c),e(c)):i._error?en.abort(i._error):e(c)}finally{p()}}function A(n,t){if(n.isRunning()){var e={task:Z,cb:t};t.cancel=function(){return r(n.joiners,e)},n.joiners.push(e)}else n.isAborted()?t(n.error(),!0):t(n.result())}function x(n,t){n===ln&&(n=Z),n.isRunning()&&n.cancel(),t()}function w(n,t,e){function r(){u===o.length&&(a=!0,e(hn.array(n)?yn.from(tn({},i,{length:o.length})):i))}var o=Object.keys(n);if(!o.length)return e(hn.array(n)?[]:{});var u=0,a=void 0,i={},f={};o.forEach(function(n){var t=function(t,o){a||(o||Un(t)||t===dt||t===vt?(e.cancel(),e(t,o)):(i[n]=t,u++,r()))};t.cancel=dn,f[n]=t}),e.cancel=function(){a||(a=!0,o.forEach(function(n){return f[n].cancel()}))},o.forEach(function(e){return c(n[e],t,e,f[e])})}function _(n,t,e){var r=void 0,o=Object.keys(n),u={};o.forEach(function(n){var t=function(t,o){if(!r)if(o)e.cancel(),e(t,!0);else if(!Un(t)&&t!==dt&&t!==vt){var u;e.cancel(),r=!0,e((u={},u[n]=t,u))}};t.cancel=dn,u[n]=t}),e.cancel=function(){r||(r=!0,o.forEach(function(n){return u[n].cancel()}))},o.forEach(function(e){r||c(n[e],t,e,u[e])})}function j(n,t){var e=n.selector,r=n.args;try{var o=e.apply(void 0,[U()].concat(r));t(o)}catch(n){t(n,!0)}}function S(n,t){var e=n.pattern,r=n.buffer,o=J(e);o.pattern=e,t(b(L,r||Nn.fixed(),o))}function T(n,t){t(!!$.isCancelled)}function O(n,t){n.flush(t)}function N(n,t){t(Y[n])}function R(n,t){pn.assign(Y,n),t()}var L=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return dn},q=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dn,U=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dn,M=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},I=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},P=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,D=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"anonymous",H=arguments[8];t(n,hn.iterator,st);var G=l(w,kn("[...effects]","all([...effects])")),F=I.sagaMonitor,K=I.logger,z=I.onError,B=K||f,X=E(L),Y=Object.create(M);a.cancel=dn;var Z=function(n,e,r,a){var i,c,f;return r._deferredEnd=null,c={},c[on]=!0,c.id=n,c.name=e,i="done",f={},f[i]=f[i]||{},f[i].get=function(){if(r._deferredEnd)return r._deferredEnd.promise;var n=o();return r._deferredEnd=n,r._isRunning||(r._error?n.reject(r._error):n.resolve(r._result)),n.promise},c.cont=a,c.joiners=[],c.cancel=u,c.isRunning=function(){return r._isRunning},c.isCancelled=function(){return r._isCancelled},c.isAborted=function(){return r._isAborted},c.result=function(){return r._result},c.error=function(){return r._error},c.setContext=function(n){t(n,hn.object,An("task",n)),pn.assign(Y,n)},nn(c,f),c}(P,D,n,H),$={name:D,cancel:e,isRunning:!0},en=Q(D,$,i);return H&&(H.cancel=u),n._isRunning=!0,a(),Z}function Y(n,e){for(var r=arguments.length,o=Array(r>2?r-2:0),u=2;r>u;u++)o[u-2]=arguments[u];var a=void 0;hn.iterator(n)?(a=n,n=e):(t(e,hn.func,pt),a=e.apply(void 0,o),t(a,hn.iterator,pt));var i=n,c=i.subscribe,f=i.dispatch,l=i.getState,s=i.context,d=i.sagaMonitor,v=i.logger,g=i.onError,h=mn();d&&(d.effectTriggered=d.effectTriggered||dn,d.effectResolved=d.effectResolved||dn,d.effectRejected=d.effectRejected||dn,d.effectCancelled=d.effectCancelled||dn,d.actionDispatched=d.actionDispatched||dn,d.effectTriggered({effectId:h,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:o}}));var p=W(a,c,xn(f),l,s,{sagaMonitor:d,logger:v,onError:g},h,e.name);return d&&d.effectResolved(h,p),p}function Z(){function n(t){var e=t.getState,r=t.dispatch,f=y();return f.emit=(u.emitter||vn)(f.emit),n.run=Y.bind(null,{context:o,subscribe:f.subscribe,dispatch:r,getState:e,sagaMonitor:a,logger:i,onError:c}),function(n){return function(t){a&&a.actionDispatched&&a.actionDispatched(t);var e=n(t);return f.emit(t),e}}}var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.context,o=void 0===r?{}:r,u=en(e,["context"]),a=u.sagaMonitor,i=u.logger,c=u.onError;if(hn.func(u))throw Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(i&&!hn.func(i))throw Error("`options.logger` passed to the Saga middleware is not a function!");if(c&&!hn.func(c))throw Error("`options.onError` passed to the Saga middleware is not a function!");if(u.emitter&&!hn.func(u.emitter))throw Error("`options.emitter` passed to the Saga middleware is not a function!");return n.run=function(){throw Error("Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware")},n.setContext=function(n){t(n,hn.object,An("sagaMiddleware",n)),pn.assign(o,n)},n}var $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},nn=function(n,t){for(var e in t){var r=t[e];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,e,r)}return n},tn=Object.assign||function(n){for(var t=1;arguments.length>t;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},en=function(n,t){var e={};for(var r in n)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},rn=function(n){return"@@redux-saga/"+n},on=rn("TASK"),un=rn("HELPER"),an=rn("MATCH"),cn=rn("CANCEL_PROMISE"),fn=rn("SAGA_ACTION"),ln=rn("SELF_CANCELLATION"),sn=function(n){return function(){return n}}(!0),dn=function(){},vn=function(n){return n},gn=Object.prototype.hasOwnProperty,hn={undef:function(n){return null===n||void 0===n},notUndef:function(n){return null!==n&&void 0!==n},func:function(n){return"function"==typeof n},number:function(n){return"number"==typeof n},string:function(n){return"string"==typeof n},array:Array.isArray,object:function(n){return n&&!hn.array(n)&&"object"===(void 0===n?"undefined":$(n))},promise:function(n){return n&&hn.func(n.then)},iterator:function(n){return n&&hn.func(n.next)&&hn.func(n.throw)},iterable:function(n){return n&&hn.func(Symbol)?hn.func(n[Symbol.iterator]):hn.array(n)},task:function(n){return n&&n[on]},observable:function(n){return n&&hn.func(n.subscribe)},buffer:function(n){return n&&hn.func(n.isEmpty)&&hn.func(n.take)&&hn.func(n.put)},pattern:function(n){return n&&(hn.string(n)||"symbol"===(void 0===n?"undefined":$(n))||hn.func(n)||hn.array(n))},channel:function(n){return n&&hn.func(n.take)&&hn.func(n.close)},helper:function(n){return n&&n[un]},stringableFunc:function(n){return hn.func(n)&&e(n,"toString")}},pn={assign:function(n,t){for(var r in t)e(t,r)&&(n[r]=t[r])}},yn={from:function(n){var t=Array(n.length);for(var r in n)e(n,r)&&(t[r]=n[r]);return t}},mn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++n}}(),bn=function(n){throw n},En=function(n){return{value:n,done:!0}},kn=function(n,t){return n+" has been deprecated in favor of "+t+", please update your code"},Cn=function(n){return Error("\n redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n Error: "+n+"\n")},An=function(n,t){return(n?n+".":"")+"setContext(props): argument "+t+" is not a plain object"},xn=function(n){return function(t){return n(Object.defineProperty(t,fn,{value:!0}))}},wn=function n(t){return function(){for(var e=arguments.length,r=Array(e),o=0;e>o;o++)r[o]=arguments[o];var u=[],a=t.apply(void 0,r);return{next:function(n){return u.push(n),a.next(n)},clone:function(){var e=n(t).apply(void 0,r);return u.forEach(function(n){return e.next(n)}),e},return:function(n){return a.return(n)},throw:function(n){return a.throw(n)}}}},_n="Channel's Buffer overflow!",jn=1,Sn=3,Tn=4,On={isEmpty:sn,put:dn,take:dn},Nn={none:function(){return On},fixed:function(n){return s(n,jn)},dropping:function(n){return s(n,2)},sliding:function(n){return s(n,Sn)},expanding:function(n){return s(n,Tn)}},Rn=[],Ln=0,qn={type:"@@redux-saga/CHANNEL_END"},Un=function(n){return n&&"@@redux-saga/CHANNEL_END"===n.type},Mn="invalid buffer passed to channel factory function",In="Saga was provided with an undefined action",Pn={done:!0,value:void 0},Dn={},Hn=function(n){return"import { "+n+" } from 'redux-saga' has been deprecated in favor of import { "+n+" } from 'redux-saga/effects'.\nThe latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.\nTherefore yield "+n+" will return task descriptor to your saga and execute next lines of code."},Gn=l(A,Hn("takeEvery")),Fn=l(x,Hn("takeLatest")),Kn=l(w,Hn("throttle")),zn=rn("IO"),Bn="TAKE",Xn="PUT",Jn="ALL",Qn="RACE",Vn="CALL",Wn="CPS",Yn="FORK",Zn="JOIN",$n="CANCEL",nt="SELECT",tt="ACTION_CHANNEL",et="CANCELLED",rt="FLUSH",ot="GET_CONTEXT",ut="SET_CONTEXT",at="\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)",it=function(n,t){var e;return e={},e[zn]=!0,e[n]=t,e};_.maybe=function(){var n=_.apply(void 0,arguments);return n[Bn].maybe=!0,n};var ct=l(_.maybe,kn("takem","take.maybe"));j.resolve=function(){var n=j.apply(void 0,arguments);return n[Xn].resolve=!0,n},j.sync=l(j.resolve,kn("put.sync","put.resolve"));var ft=function(n){return function(t){return t&&t[zn]&&t[n]}},lt={take:ft(Bn),put:ft(Xn),all:ft(Jn),race:ft(Qn),call:ft(Vn),cps:ft(Wn),fork:ft(Yn),join:ft(Zn),cancel:ft($n),select:ft(nt),actionChannel:ft(tt),cancelled:ft(et),flush:ft(rt),getContext:ft(ot),setContext:ft(ut)},st="proc first argument (Saga function result) must be an iterator",dt={toString:function(){return"@@redux-saga/CHANNEL_END"}},vt={toString:function(){return"@@redux-saga/TASK_CANCEL"}},gt={wildcard:function(){return sn},default:function(n){return"symbol"===(void 0===n?"undefined":$(n))?function(t){return t.type===n}:function(t){return t.type===n+""}},array:function(n){return function(t){return n.some(function(n){return J(n)(t)})}},predicate:function(n){return function(t){return n(t)}}},ht=function(n){return{fn:n}},pt="runSaga(storeInterface, saga, ...args): saga argument must be a Generator function!",yt=Object.freeze({take:_,takem:ct,put:j,all:S,race:T,call:N,apply:R,cps:L,fork:q,spawn:U,join:M,cancel:I,select:P,actionChannel:D,cancelled:H,flush:G,getContext:F,setContext:K,takeEvery:z,takeLatest:B,throttle:X}),mt=Object.freeze({TASK:on,SAGA_ACTION:fn,noop:dn,is:hn,deferred:o,arrayOfDeffered:u,createMockTask:i,cloneableGenerator:wn,asEffect:lt,CHANNEL_END:dt});n.default=Z,n.effects=yt,n.utils=mt,n.runSaga=Y,n.END=qn,n.eventChannel=b,n.channel=m,n.buffers=Nn,n.takeEvery=Gn,n.takeLatest=Fn,n.throttle=Kn,n.delay=a,n.CANCEL=cn,Object.defineProperty(n,"__esModule",{value:!0})});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.ReduxSaga=n.ReduxSaga||{})}(this,function(n){"use strict";function t(n,t,e){if(!t(n))throw f("error","uncaught at check",e),Error(e)}function e(n,t){return hn.notUndef(n)&&gn.call(n,t)}function r(n,t){var e=n.indexOf(t);0>e||n.splice(e,1)}function o(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=tn({},n),e=new Promise(function(n,e){t.resolve=n,t.reject=e});return t.promise=e,t}function u(n){for(var t=[],e=0;n>e;e++)t.push(o());return t}function a(n){var t=1>=arguments.length||void 0===arguments[1]||arguments[1],e=void 0,r=new Promise(function(r){e=setTimeout(function(){return r(t)},n)});return r[cn]=function(){return clearTimeout(e)},r}function i(){var n,t=!0,e=void 0,r=void 0;return n={},n[on]=!0,n.isRunning=function(){return t},n.result=function(){return e},n.error=function(){return r},n.setRunning=function(n){return t=n},n.setResult=function(n){return e=n},n.setError=function(n){return r=n},n}function c(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bn,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:e,next:n,throw:t,return:En};return r&&(o[un]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function f(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"undefined"==typeof window?console.log("redux-saga "+n+": "+t+"\n"+(e&&e.stack||e)):console[n](t,e)}function l(n,t){return function(){return n.apply(void 0,arguments)}}function s(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments[1],e=Array(n),r=0,o=0,u=0,a=function(t){e[o]=t,o=(o+1)%n,r++},i=function(){if(0!=r){var t=e[u];return e[u]=null,r--,u=(u+1)%n,t}},c=function(){for(var n=[];r;)n.push(i());return n};return{isEmpty:function(){return 0==r},put:function(i){if(n>r)a(i);else{var f=void 0;switch(t){case jn:throw Error(_n);case Sn:e[o]=i,o=(o+1)%n,u=o;break;case Tn:f=2*n,e=c(),r=e.length,o=e.length,u=0,e.length=f,n=f,a(i)}}},take:i,flush:c}}function d(n){try{g(),n()}finally{h()}}function v(n){Rn.push(n),Ln||(g(),p())}function g(){Ln++}function h(){Ln--}function p(){h();for(var n=void 0;!Ln&&void 0!==(n=Rn.shift());)d(n)}function y(){function n(n){return e.push(n),function(){return r(e,n)}}function t(n){for(var t=e.slice(),r=0,o=t.length;o>r;r++)t[r](n)}var e=[];return{subscribe:n,emit:t}}function m(){function n(){if(c&&f.length)throw Cn("Cannot have a closed channel with pending takers");if(f.length&&!i.isEmpty())throw Cn("Cannot have pending takers with non empty buffer")}function e(e){if(n(),t(e,hn.notUndef,In),!c){if(!f.length)return i.put(e);for(var r=0;f.length>r;r++){var o=f[r];if(!o[an]||o[an](e))return f.splice(r,1),o(e)}}}function o(e){n(),t(e,hn.func,"channel.take's callback must be a function"),c&&i.isEmpty()?e(qn):i.isEmpty()?(f.push(e),e.cancel=function(){return r(f,e)}):e(i.take())}function u(e){if(n(),t(e,hn.func,"channel.flush' callback must be a function"),c&&i.isEmpty())return void e(qn);e(i.flush())}function a(){if(n(),!c&&(c=!0,f.length)){var t=f;f=[];for(var e=0,r=t.length;r>e;e++)t[e](qn)}}var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nn.fixed(),c=!1,f=[];return t(i,hn.buffer,Mn),{take:o,put:e,flush:u,close:a,get __takers__(){return f},get __closed__(){return c}}}function b(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn.none(),r=arguments[2];arguments.length>2&&t(r,hn.func,"Invalid match function passed to eventChannel");var o=m(e),u=function(){o.__closed__||(a&&a(),o.close())},a=n(function(n){if(Un(n))return void u();r&&!r(n)||o.put(n)});if(o.__closed__&&a(),!hn.func(a))throw Error("in eventChannel: subscribe should return a function to unsubscribe");return{take:o.take,flush:o.flush,close:u}}function E(n){var e=b(function(t){return n(function(n){if(n[fn])return void t(n);v(function(){return t(n)})})});return tn({},e,{take:function(n,r){arguments.length>1&&(t(r,hn.func,"channel.take's matcher argument must be a function"),n[an]=r),e.take(n)}})}function k(n){return hn.channel(n)?"channel":Array.isArray(n)?n.map(function(n){return n+""})+"":n+""}function C(n,t){function e(t,e){if(u===Dn)return Pn;if(e)throw u=Dn,e;o&&o(t);var r=n[u](),a=r[0],i=r[1],c=r[2];return u=a,o=c,u===Dn?Pn:i}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iterator",o=void 0,u=t;return c(e,function(n){return e(null,n)},r,!0)}function A(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];var u={done:!1,value:_(n)},a=function(n){return{done:!1,value:q.apply(void 0,[t].concat(r,[n]))}},i=void 0,c=function(n){return i=n};return C({q1:function(){return["q2",u,c]},q2:function(){return i===qn?[Dn]:["q1",a(i)]}},"q1","takeEvery("+k(n)+", "+t.name+")")}function x(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];var u={done:!1,value:_(n)},a=function(n){return{done:!1,value:q.apply(void 0,[t].concat(r,[n]))}},i=function(n){return{done:!1,value:I(n)}},c=void 0,f=void 0,l=function(n){return c=n},s=function(n){return f=n};return C({q1:function(){return["q2",u,s]},q2:function(){return f===qn?[Dn]:c?["q3",i(c)]:["q1",a(f),l]},q3:function(){return["q1",a(f),l]}},"q1","takeLatest("+k(n)+", "+t.name+")")}function w(n,t,e){for(var r=arguments.length,o=Array(r>3?r-3:0),u=3;r>u;u++)o[u-3]=arguments[u];var i=void 0,c=void 0,f={done:!1,value:D(t,Nn.sliding(1))},l=function(){return{done:!1,value:_(c)}},s=function(n){return{done:!1,value:q.apply(void 0,[e].concat(o,[n]))}},d={done:!1,value:N(a,n)},v=function(n){return i=n},g=function(n){return c=n};return C({q1:function(){return["q2",f,g]},q2:function(){return["q3",l(),v]},q3:function(){return i===qn?[Dn]:["q4",s(i)]},q4:function(){return["q2",d]}},"q1","throttle("+k(t)+", "+e.name+")")}function _(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";if(arguments.length&&t(arguments[0],hn.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),hn.pattern(n))return it(Bn,{pattern:n});if(hn.channel(n))return it(Bn,{channel:n});throw Error("take(patternOrChannel): argument "+n+" is not valid channel or a valid pattern")}function j(n,e){return arguments.length>1?(t(n,hn.notUndef,"put(channel, action): argument channel is undefined"),t(n,hn.channel,"put(channel, action): argument "+n+" is not a valid channel"),t(e,hn.notUndef,"put(channel, action): argument action is undefined")):(t(n,hn.notUndef,"put(action): argument action is undefined"),e=n,n=null),it(Xn,{channel:n,action:e})}function S(n){return it(Jn,n)}function T(n){return it(Qn,n)}function O(n,e,r){t(e,hn.notUndef,n+": argument fn is undefined");var o=null;if(hn.array(e)){var u=e;o=u[0],e=u[1]}else if(e.fn){var a=e;o=a.context,e=a.fn}return o&&hn.string(e)&&hn.func(o[e])&&(e=o[e]),t(e,hn.func,n+": argument "+e+" is not a function"),{context:o,fn:e,args:r}}function N(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Vn,O("call",n,e))}function R(n,t){return it(Vn,O("apply",{context:n,fn:t},arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))}function L(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Wn,O("cps",n,e))}function q(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];return it(Yn,O("fork",n,e))}function U(n){for(var t=arguments.length,e=Array(t>1?t-1:0),r=1;t>r;r++)e[r-1]=arguments[r];var o=q.apply(void 0,[n].concat(e));return o[Yn].detached=!0,o}function M(){for(var n=arguments.length,e=Array(n),r=0;n>r;r++)e[r]=arguments[r];if(e.length>1)return S(e.map(function(n){return M(n)}));var o=e[0];return t(o,hn.notUndef,"join(task): argument task is undefined"),t(o,hn.task,"join(task): argument "+o+" is not a valid Task object "+at),it(Zn,o)}function I(){for(var n=arguments.length,e=Array(n),r=0;n>r;r++)e[r]=arguments[r];if(e.length>1)return S(e.map(function(n){return I(n)}));var o=e[0];return 1===e.length&&(t(o,hn.notUndef,"cancel(task): argument task is undefined"),t(o,hn.task,"cancel(task): argument "+o+" is not a valid Task object "+at)),it($n,o||ln)}function P(n){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;e>o;o++)r[o-1]=arguments[o];return 0===arguments.length?n=vn:(t(n,hn.notUndef,"select(selector,[...]): argument selector is undefined"),t(n,hn.func,"select(selector,[...]): argument "+n+" is not a function")),it(nt,{selector:n,args:r})}function D(n,e){return t(n,hn.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&(t(e,hn.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),t(e,hn.buffer,"actionChannel(pattern, buffer): argument "+e+" is not a valid buffer")),it(tt,{pattern:n,buffer:e})}function H(){return it(et,{})}function G(n){return t(n,hn.channel,"flush(channel): argument "+n+" is not valid channel"),it(rt,n)}function F(n){return t(n,hn.string,"getContext(prop): argument "+n+" is not a string"),it(ot,n)}function K(n){return t(n,hn.object,An(null,n)),it(ut,n)}function z(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];return q.apply(void 0,[A,n,t].concat(r))}function B(n,t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;e>o;o++)r[o-2]=arguments[o];return q.apply(void 0,[x,n,t].concat(r))}function X(n,t,e){for(var r=arguments.length,o=Array(r>3?r-3:0),u=3;r>u;u++)o[u-3]=arguments[u];return q.apply(void 0,[w,n,t,e].concat(o))}function J(n){return("*"===n?gt.wildcard:hn.array(n)?gt.array:hn.stringableFunc(n)?gt.default:hn.func(n)?gt.predicate:gt.default)(n)}function Q(n,t,e){function o(n){a(),e(n,!0)}function u(n){i.push(n),n.cont=function(u,a){f||(r(i,n),n.cont=dn,a?o(u):(n===t&&(c=u),i.length||(f=!0,e(c))))}}function a(){f||(f=!0,i.forEach(function(n){n.cont=dn,n.cancel()}),i=[])}var i=[],c=void 0,f=!1;return u(t),{addTask:u,cancelAll:a,abort:o,getTasks:function(){return i},taskNames:function(){return i.map(function(n){return n.name})}}}function V(n){var t=n.context,e=n.fn,r=n.args;if(hn.iterator(e))return e;var o=void 0,u=void 0;try{o=e.apply(t,r)}catch(n){u=n}return hn.iterator(o)?o:c(u?function(){throw u}:function(){var n=void 0,t={done:!1,value:o},e=function(n){return{done:!0,value:n}};return function(r){return n?e(r):(n=!0,t)}}())}function W(n){function e(){$.isRunning&&!$.isCancelled&&($.isCancelled=!0,a(vt))}function u(){n._isRunning&&!n._isCancelled&&(n._isCancelled=!0,en.cancelAll(),i(vt))}function a(t,e){if(!$.isRunning)throw Error("Trying to resume an already finished generator");try{var r=void 0;e?r=n.throw(t):t===vt?($.isCancelled=!0,a.cancel(),r=hn.func(n.return)?n.return(vt):{done:!0,value:vt}):r=t===dt?hn.func(n.return)?n.return():{done:!0}:n.next(t),r.done?($.isMainRunning=!1,$.cont&&$.cont(r.value)):c(r.value,P,"",a)}catch(n){$.isCancelled&&B("error","uncaught at "+D,n.message),$.isMainRunning=!1,$.cont(n,!0)}}function i(t,e){n._isRunning=!1,X.close(),e?(t instanceof Error&&(t.sagaStack="at "+D+" \n "+(t.sagaStack||t.stack)),Z.cont||(B("error","uncaught",t.sagaStack||t.stack),t instanceof Error&&z&&z(t)),n._error=t,n._isAborted=!0,n._deferredEnd&&n._deferredEnd.reject(t)):(n._result=t,n._deferredEnd&&n._deferredEnd.resolve(t)),Z.cont&&Z.cont(t,e),Z.joiners.forEach(function(n){return n.cb(t,e)}),Z.joiners=null}function c(n,t){function e(n,t){a||(a=!0,o.cancel=dn,F&&(t?F.effectRejected(u,n):F.effectResolved(u,n)),o(n,t))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments[3],u=mn();F&&F.effectTriggered({effectId:u,parentEffectId:t,label:r,effect:n});var a=void 0;e.cancel=dn,o.cancel=function(){if(!a){a=!0;try{e.cancel()}catch(n){B("error","uncaught at "+D,n.message)}e.cancel=dn,F&&F.effectCancelled(u)}};var i=void 0;return hn.promise(n)?s(n,e):hn.helper(n)?C(ht(n),u,e):hn.iterator(n)?d(n,u,D,e):hn.array(n)?G(n,u,e):(i=lt.take(n))?h(i,e):(i=lt.put(n))?y(i,e):(i=lt.all(n))?w(i,u,e):(i=lt.race(n))?_(i,u,e):(i=lt.call(n))?m(i,u,e):(i=lt.cps(n))?k(i,e):(i=lt.fork(n))?C(i,u,e):(i=lt.join(n))?A(i,e):(i=lt.cancel(n))?x(i,e):(i=lt.select(n))?j(i,e):(i=lt.actionChannel(n))?S(i,e):(i=lt.flush(n))?O(i,e):(i=lt.cancelled(n))?T(i,e):(i=lt.getContext(n))?N(i,e):(i=lt.setContext(n))?R(i,e):e(n)}function s(n,t){var e=n[cn];hn.func(e)?t.cancel=e:hn.func(n.abort)&&(t.cancel=function(){return n.abort()}),n.then(t,function(n){return t(n,!0)})}function d(n,t,e,r){W(n,L,q,U,Y,I,t,e,r)}function h(n,t){var e=n.channel,r=n.pattern,o=n.maybe;e=e||X;var u=function(n){return n instanceof Error?t(n,!0):t(Un(n)&&!o?dt:n)};try{e.take(u,J(r))}catch(n){return t(n,!0)}t.cancel=u.cancel}function y(n,t){var e=n.channel,r=n.action,o=n.resolve;v(function(){var n=void 0;try{n=(e?e.put:q)(r)}catch(n){if(e||o)return t(n,!0);B("error","uncaught at "+D,n.stack||n.message||n)}if(!o||!hn.promise(n))return t(n);s(n,t)})}function m(n,t,e){var r=n.context,o=n.fn,u=n.args,a=void 0;try{a=o.apply(r,u)}catch(n){return e(n,!0)}return hn.promise(a)?s(a,e):hn.iterator(a)?d(a,t,o.name,e):e(a)}function k(n,t){var e=n.context,r=n.fn,o=n.args;try{var u=function(n,e){return hn.undef(n)?t(e):t(n,!0)};r.apply(e,o.concat(u)),u.cancel&&(t.cancel=function(){return u.cancel()})}catch(n){return t(n,!0)}}function C(n,t,e){var r=n.context,o=n.fn,u=n.args,a=n.detached,i=V({context:r,fn:o,args:u});try{g();var c=W(i,L,q,U,Y,I,t,o.name,a?null:dn);a?e(c):i._isRunning?(en.addTask(c),e(c)):i._error?en.abort(i._error):e(c)}finally{p()}}function A(n,t){if(n.isRunning()){var e={task:Z,cb:t};t.cancel=function(){return r(n.joiners,e)},n.joiners.push(e)}else n.isAborted()?t(n.error(),!0):t(n.result())}function x(n,t){n===ln&&(n=Z),n.isRunning()&&n.cancel(),t()}function w(n,t,e){function r(){u===o.length&&(a=!0,e(hn.array(n)?yn.from(tn({},i,{length:o.length})):i))}var o=Object.keys(n);if(!o.length)return e(hn.array(n)?[]:{});var u=0,a=void 0,i={},f={};o.forEach(function(n){var t=function(t,o){a||(o||Un(t)||t===dt||t===vt?(e.cancel(),e(t,o)):(i[n]=t,u++,r()))};t.cancel=dn,f[n]=t}),e.cancel=function(){a||(a=!0,o.forEach(function(n){return f[n].cancel()}))},o.forEach(function(e){return c(n[e],t,e,f[e])})}function _(n,t,e){var r=void 0,o=Object.keys(n),u={};o.forEach(function(n){var t=function(t,o){if(!r)if(o)e.cancel(),e(t,!0);else if(!Un(t)&&t!==dt&&t!==vt){var u;e.cancel(),r=!0,e((u={},u[n]=t,u))}};t.cancel=dn,u[n]=t}),e.cancel=function(){r||(r=!0,o.forEach(function(n){return u[n].cancel()}))},o.forEach(function(e){r||c(n[e],t,e,u[e])})}function j(n,t){var e=n.selector,r=n.args;try{var o=e.apply(void 0,[U()].concat(r));t(o)}catch(n){t(n,!0)}}function S(n,t){var e=n.pattern,r=n.buffer,o=J(e);o.pattern=e,t(b(L,r||Nn.fixed(),o))}function T(n,t){t(!!$.isCancelled)}function O(n,t){n.flush(t)}function N(n,t){t(Y[n])}function R(n,t){pn.assign(Y,n),t()}var L=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return dn},q=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dn,U=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dn,M=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},I=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},P=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,D=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"anonymous",H=arguments[8];t(n,hn.iterator,st);var G=l(w,kn("[...effects]","all([...effects])")),F=I.sagaMonitor,K=I.logger,z=I.onError,B=K||f,X=E(L),Y=Object.create(M);a.cancel=dn;var Z=function(n,e,r,a){var i,c,f;return r._deferredEnd=null,c={},c[on]=!0,c.id=n,c.name=e,i="done",f={},f[i]=f[i]||{},f[i].get=function(){if(r._deferredEnd)return r._deferredEnd.promise;var n=o();return r._deferredEnd=n,r._isRunning||(r._error?n.reject(r._error):n.resolve(r._result)),n.promise},c.cont=a,c.joiners=[],c.cancel=u,c.isRunning=function(){return r._isRunning},c.isCancelled=function(){return r._isCancelled},c.isAborted=function(){return r._isAborted},c.result=function(){return r._result},c.error=function(){return r._error},c.setContext=function(n){t(n,hn.object,An("task",n)),pn.assign(Y,n)},nn(c,f),c}(P,D,n,H),$={name:D,cancel:e,isRunning:!0},en=Q(D,$,i);return H&&(H.cancel=u),n._isRunning=!0,a(),Z}function Y(n,e){for(var r=arguments.length,o=Array(r>2?r-2:0),u=2;r>u;u++)o[u-2]=arguments[u];var a=void 0;hn.iterator(n)?(a=n,n=e):(t(e,hn.func,pt),a=e.apply(void 0,o),t(a,hn.iterator,pt));var i=n,c=i.subscribe,f=i.dispatch,l=i.getState,s=i.context,d=i.sagaMonitor,v=i.logger,g=i.onError,h=mn();d&&(d.effectTriggered=d.effectTriggered||dn,d.effectResolved=d.effectResolved||dn,d.effectRejected=d.effectRejected||dn,d.effectCancelled=d.effectCancelled||dn,d.actionDispatched=d.actionDispatched||dn,d.effectTriggered({effectId:h,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:o}}));var p=W(a,c,xn(f),l,s,{sagaMonitor:d,logger:v,onError:g},h,e.name);return d&&d.effectResolved(h,p),p}function Z(){function n(t){var e=t.getState,r=t.dispatch,f=y();return f.emit=(u.emitter||vn)(f.emit),n.run=Y.bind(null,{context:o,subscribe:f.subscribe,dispatch:r,getState:e,sagaMonitor:a,logger:i,onError:c}),function(n){return function(t){a&&a.actionDispatched&&a.actionDispatched(t);var e=n(t);return f.emit(t),e}}}var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.context,o=void 0===r?{}:r,u=en(e,["context"]),a=u.sagaMonitor,i=u.logger,c=u.onError;if(hn.func(u))throw Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(i&&!hn.func(i))throw Error("`options.logger` passed to the Saga middleware is not a function!");if(c&&!hn.func(c))throw Error("`options.onError` passed to the Saga middleware is not a function!");if(u.emitter&&!hn.func(u.emitter))throw Error("`options.emitter` passed to the Saga middleware is not a function!");return n.run=function(){throw Error("Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware")},n.setContext=function(n){t(n,hn.object,An("sagaMiddleware",n)),pn.assign(o,n)},n}var $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},nn=function(n,t){for(var e in t){var r=t[e];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,e,r)}return n},tn=Object.assign||function(n){for(var t=1;arguments.length>t;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},en=function(n,t){var e={};for(var r in n)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},rn=function(n){return"@@redux-saga/"+n},on=rn("TASK"),un=rn("HELPER"),an=rn("MATCH"),cn=rn("CANCEL_PROMISE"),fn=rn("SAGA_ACTION"),ln=rn("SELF_CANCELLATION"),sn=function(n){return function(){return n}}(!0),dn=function(){},vn=function(n){return n},gn=Object.prototype.hasOwnProperty,hn={undef:function(n){return null===n||void 0===n},notUndef:function(n){return null!==n&&void 0!==n},func:function(n){return"function"==typeof n},number:function(n){return"number"==typeof n},string:function(n){return"string"==typeof n},array:Array.isArray,object:function(n){return n&&!hn.array(n)&&"object"===(void 0===n?"undefined":$(n))},promise:function(n){return n&&hn.func(n.then)},iterator:function(n){return n&&hn.func(n.next)&&hn.func(n.throw)},iterable:function(n){return n&&hn.func(Symbol)?hn.func(n[Symbol.iterator]):hn.array(n)},task:function(n){return n&&n[on]},observable:function(n){return n&&hn.func(n.subscribe)},buffer:function(n){return n&&hn.func(n.isEmpty)&&hn.func(n.take)&&hn.func(n.put)},pattern:function(n){return n&&(hn.string(n)||"symbol"===(void 0===n?"undefined":$(n))||hn.func(n)||hn.array(n))},channel:function(n){return n&&hn.func(n.take)&&hn.func(n.close)},helper:function(n){return n&&n[un]},stringableFunc:function(n){return hn.func(n)&&e(n,"toString")}},pn={assign:function(n,t){for(var r in t)e(t,r)&&(n[r]=t[r])}},yn={from:function(n){var t=Array(n.length);for(var r in n)e(n,r)&&(t[r]=n[r]);return t}},mn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++n}}(),bn=function(n){throw n},En=function(n){return{value:n,done:!0}},kn=function(n,t){return n+" has been deprecated in favor of "+t+", please update your code"},Cn=function(n){return Error("\n redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n Error: "+n+"\n")},An=function(n,t){return(n?n+".":"")+"setContext(props): argument "+t+" is not a plain object"},xn=function(n){return function(t){return n(Object.defineProperty(t,fn,{value:!0}))}},wn=function n(t){return function(){for(var e=arguments.length,r=Array(e),o=0;e>o;o++)r[o]=arguments[o];var u=[],a=t.apply(void 0,r);return{next:function(n){return u.push(n),a.next(n)},clone:function(){var e=n(t).apply(void 0,r);return u.forEach(function(n){return e.next(n)}),e},return:function(n){return a.return(n)},throw:function(n){return a.throw(n)}}}},_n="Channel's Buffer overflow!",jn=1,Sn=3,Tn=4,On={isEmpty:sn,put:dn,take:dn},Nn={none:function(){return On},fixed:function(n){return s(n,jn)},dropping:function(n){return s(n,2)},sliding:function(n){return s(n,Sn)},expanding:function(n){return s(n,Tn)}},Rn=[],Ln=0,qn={type:"@@redux-saga/CHANNEL_END"},Un=function(n){return n&&"@@redux-saga/CHANNEL_END"===n.type},Mn="invalid buffer passed to channel factory function",In="Saga was provided with an undefined action",Pn={done:!0,value:void 0},Dn={},Hn=function(n){return"import { "+n+" } from 'redux-saga' has been deprecated in favor of import { "+n+" } from 'redux-saga/effects'.\nThe latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.\nTherefore yield "+n+" will return task descriptor to your saga and execute next lines of code."},Gn=l(A,Hn("takeEvery")),Fn=l(x,Hn("takeLatest")),Kn=l(w,Hn("throttle")),zn=rn("IO"),Bn="TAKE",Xn="PUT",Jn="ALL",Qn="RACE",Vn="CALL",Wn="CPS",Yn="FORK",Zn="JOIN",$n="CANCEL",nt="SELECT",tt="ACTION_CHANNEL",et="CANCELLED",rt="FLUSH",ot="GET_CONTEXT",ut="SET_CONTEXT",at="\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)",it=function(n,t){var e;return e={},e[zn]=!0,e[n]=t,e};_.maybe=function(){var n=_.apply(void 0,arguments);return n[Bn].maybe=!0,n};var ct=l(_.maybe,kn("takem","take.maybe"));j.resolve=function(){var n=j.apply(void 0,arguments);return n[Xn].resolve=!0,n},j.sync=l(j.resolve,kn("put.sync","put.resolve"));var ft=function(n){return function(t){return t&&t[zn]&&t[n]}},lt={take:ft(Bn),put:ft(Xn),all:ft(Jn),race:ft(Qn),call:ft(Vn),cps:ft(Wn),fork:ft(Yn),join:ft(Zn),cancel:ft($n),select:ft(nt),actionChannel:ft(tt),cancelled:ft(et),flush:ft(rt),getContext:ft(ot),setContext:ft(ut)},st="proc first argument (Saga function result) must be an iterator",dt={toString:function(){return"@@redux-saga/CHANNEL_END"}},vt={toString:function(){return"@@redux-saga/TASK_CANCEL"}},gt={wildcard:function(){return sn},default:function(n){return"symbol"===(void 0===n?"undefined":$(n))?function(t){return t.type===n}:function(t){return t.type===n+""}},array:function(n){return function(t){return n.some(function(n){return J(n)(t)})}},predicate:function(n){return function(t){return n(t)}}},ht=function(n){return{fn:n}},pt="runSaga(storeInterface, saga, ...args): saga argument must be a Generator function!",yt=Object.freeze({take:_,takem:ct,put:j,all:S,race:T,call:N,apply:R,cps:L,fork:q,spawn:U,join:M,cancel:I,select:P,actionChannel:D,cancelled:H,flush:G,getContext:F,setContext:K,takeEvery:z,takeLatest:B,throttle:X}),mt=Object.freeze({TASK:on,SAGA_ACTION:fn,noop:dn,is:hn,deferred:o,arrayOfDeffered:u,createMockTask:i,cloneableGenerator:wn,asEffect:lt,CHANNEL_END:dt});n.default=Z,n.effects=yt,n.utils=mt,n.runSaga=Y,n.END=qn,n.eventChannel=b,n.channel=m,n.buffers=Nn,n.takeEvery=Gn,n.takeLatest=Fn,n.throttle=Kn,n.delay=a,n.CANCEL=cn,Object.defineProperty(n,"__esModule",{value:!0})});
import { kTrue, noop } from './utils';
export var BUFFER_OVERFLOW = 'Channel\'s Buffer overflow!';
export var BUFFER_OVERFLOW = "Channel's Buffer overflow!";

@@ -81,3 +81,4 @@ var ON_OVERFLOW_THROW = 1;

},
take: take, flush: flush
take: take,
flush: flush
};

@@ -84,0 +85,0 @@ }

@@ -80,3 +80,3 @@ 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; };

checkForbiddenStates();
check(cb, is.func, 'channel.take\'s callback must be a function');
check(cb, is.func, "channel.take's callback must be a function");

@@ -96,4 +96,4 @@ if (closed && buffer.isEmpty()) {

function flush(cb) {
checkForbiddenStates(); // TODO: check if some new state should be forbidden now
check(cb, is.func, 'channel.flush\' callback must be a function');
checkForbiddenStates // TODO: check if some new state should be forbidden now
();check(cb, is.func, "channel.flush' callback must be a function");
if (closed && buffer.isEmpty()) {

@@ -120,3 +120,7 @@ cb(END);

return { take: take, put: put, flush: flush, close: close,
return {
take: take,
put: put,
flush: flush,
close: close,
get __takers__() {

@@ -193,3 +197,3 @@ return takers;

if (arguments.length > 1) {
check(matcher, is.func, 'channel.take\'s matcher argument must be a function');
check(matcher, is.func, "channel.take's matcher argument must be a function");
cb[MATCH] = matcher;

@@ -196,0 +200,0 @@ }

@@ -50,3 +50,3 @@ import { sym, is, ident, check, deprecate, updateIncentive, createSetContextWarning, SELF_CANCELLATION } from './utils';

export var takem = deprecate(take.maybe, updateIncentive('takem', 'take.maybe'));
export var takem = /*#__PURE__*/deprecate(take.maybe, /*#__PURE__*/updateIncentive('takem', 'take.maybe'));

@@ -53,0 +53,0 @@ export function put(channel, action) {

@@ -66,4 +66,4 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

}
var result = next(action); // hit reducers
sagaEmitter.emit(action);
var result = next(action // hit reducers
);sagaEmitter.emit(action);
return result;

@@ -70,0 +70,0 @@ };

@@ -52,2 +52,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function matcher(pattern) {
// prettier-ignore
return (pattern === '*' ? matchers.wildcard : is.array(pattern) ? matchers.array : is.stringableFunc(pattern) ? matchers.default : is.func(pattern) ? matchers.predicate : matchers.default)(pattern);

@@ -204,3 +205,3 @@ }

var stdChannel = _stdChannel(subscribe);
var taskContext = Object.create(parentContext);
var taskContext = Object.create(parentContext
/**

@@ -211,3 +212,3 @@ Tracks the current effect cancellation

**/
next.cancel = noop;
);next.cancel = noop;

@@ -220,3 +221,3 @@ /**

var mainTask = { name: name, cancel: cancelMain, isRunning: true };
var taskQueue = forkQueue(name, mainTask, end);
var taskQueue = forkQueue(name, mainTask, end

@@ -226,3 +227,3 @@ /**

**/
function cancelMain() {
);function cancelMain() {
if (mainTask.isRunning && !mainTask.isCancelled) {

@@ -248,7 +249,7 @@ mainTask.isCancelled = true;

iterator._isCancelled = true;
taskQueue.cancelAll();
taskQueue.cancelAll
/**
Ending with a Never result will propagate the Cancellation to all joiners
**/
end(TASK_CANCEL);
();end(TASK_CANCEL);
}

@@ -266,6 +267,6 @@ }

// kicks up the generator
next();
next
// then return the task descriptor to the caller
return task;
();return task;

@@ -298,3 +299,3 @@ /**

**/
next.cancel();
next.cancel
/**

@@ -304,3 +305,3 @@ If this Generator has a `return` method then invokes it

**/
result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
();result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
} else if (arg === CHANNEL_END) {

@@ -366,3 +367,3 @@ // We get CHANNEL_END by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)

var effectId = nextEffectId();
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect });
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect }

@@ -374,3 +375,3 @@ /**

**/
var effectSettled = void 0;
);var effectSettled = void 0;

@@ -429,8 +430,9 @@ // Completion callback passed to the appropriate effect runner

var data = void 0;
// prettier-ignore
return (
// Non declarative effect
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb)
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb
// declarative effects
: is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
) : is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
);

@@ -441,4 +443,11 @@ }

var cancelPromise = promise[CANCEL];
if (typeof cancelPromise === 'function') {
if (is.func(cancelPromise)) {
cb.cancel = cancelPromise;
} else if (is.func(promise.abort)) {
cb.cancel = function () {
return promise.abort
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
();
};
}

@@ -496,4 +505,5 @@ promise.then(cb, function (error) {

}
});
}
// Put effects are non cancellables
);
}

@@ -589,4 +599,5 @@

}
cb();
cb
// cancel effects are non cancellables
();
}

@@ -593,0 +604,0 @@

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

var queue = [];

@@ -3,0 +2,0 @@ /**

@@ -109,3 +109,3 @@ 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; };

export var array = {
'from': function from(obj) {
from: function from(obj) {
var arr = Array(obj.length);

@@ -112,0 +112,0 @@ for (var i in obj) {

@@ -8,126 +8,126 @@ 'use strict';

Object.defineProperty(exports, 'take', {
enumerable: true,
get: function get() {
return _io.take;
}
enumerable: true,
get: function get() {
return _io.take;
}
});
Object.defineProperty(exports, 'takem', {
enumerable: true,
get: function get() {
return _io.takem;
}
enumerable: true,
get: function get() {
return _io.takem;
}
});
Object.defineProperty(exports, 'put', {
enumerable: true,
get: function get() {
return _io.put;
}
enumerable: true,
get: function get() {
return _io.put;
}
});
Object.defineProperty(exports, 'all', {
enumerable: true,
get: function get() {
return _io.all;
}
enumerable: true,
get: function get() {
return _io.all;
}
});
Object.defineProperty(exports, 'race', {
enumerable: true,
get: function get() {
return _io.race;
}
enumerable: true,
get: function get() {
return _io.race;
}
});
Object.defineProperty(exports, 'call', {
enumerable: true,
get: function get() {
return _io.call;
}
enumerable: true,
get: function get() {
return _io.call;
}
});
Object.defineProperty(exports, 'apply', {
enumerable: true,
get: function get() {
return _io.apply;
}
enumerable: true,
get: function get() {
return _io.apply;
}
});
Object.defineProperty(exports, 'cps', {
enumerable: true,
get: function get() {
return _io.cps;
}
enumerable: true,
get: function get() {
return _io.cps;
}
});
Object.defineProperty(exports, 'fork', {
enumerable: true,
get: function get() {
return _io.fork;
}
enumerable: true,
get: function get() {
return _io.fork;
}
});
Object.defineProperty(exports, 'spawn', {
enumerable: true,
get: function get() {
return _io.spawn;
}
enumerable: true,
get: function get() {
return _io.spawn;
}
});
Object.defineProperty(exports, 'join', {
enumerable: true,
get: function get() {
return _io.join;
}
enumerable: true,
get: function get() {
return _io.join;
}
});
Object.defineProperty(exports, 'cancel', {
enumerable: true,
get: function get() {
return _io.cancel;
}
enumerable: true,
get: function get() {
return _io.cancel;
}
});
Object.defineProperty(exports, 'select', {
enumerable: true,
get: function get() {
return _io.select;
}
enumerable: true,
get: function get() {
return _io.select;
}
});
Object.defineProperty(exports, 'actionChannel', {
enumerable: true,
get: function get() {
return _io.actionChannel;
}
enumerable: true,
get: function get() {
return _io.actionChannel;
}
});
Object.defineProperty(exports, 'cancelled', {
enumerable: true,
get: function get() {
return _io.cancelled;
}
enumerable: true,
get: function get() {
return _io.cancelled;
}
});
Object.defineProperty(exports, 'flush', {
enumerable: true,
get: function get() {
return _io.flush;
}
enumerable: true,
get: function get() {
return _io.flush;
}
});
Object.defineProperty(exports, 'getContext', {
enumerable: true,
get: function get() {
return _io.getContext;
}
enumerable: true,
get: function get() {
return _io.getContext;
}
});
Object.defineProperty(exports, 'setContext', {
enumerable: true,
get: function get() {
return _io.setContext;
}
enumerable: true,
get: function get() {
return _io.setContext;
}
});
Object.defineProperty(exports, 'takeEvery', {
enumerable: true,
get: function get() {
return _io.takeEvery;
}
enumerable: true,
get: function get() {
return _io.takeEvery;
}
});
Object.defineProperty(exports, 'takeLatest', {
enumerable: true,
get: function get() {
return _io.takeLatest;
}
enumerable: true,
get: function get() {
return _io.takeLatest;
}
});
Object.defineProperty(exports, 'throttle', {
enumerable: true,
get: function get() {
return _io.throttle;
}
enumerable: true,
get: function get() {
return _io.throttle;
}
});

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

'use strict';
"use strict";

@@ -6,5 +6,5 @@ exports.__esModule = true;

var _utils = require('./utils');
var _utils = require("./utils");
var BUFFER_OVERFLOW = exports.BUFFER_OVERFLOW = 'Channel\'s Buffer overflow!';
var BUFFER_OVERFLOW = exports.BUFFER_OVERFLOW = "Channel's Buffer overflow!";

@@ -87,3 +87,4 @@ var ON_OVERFLOW_THROW = 1;

},
take: take, flush: flush
take: take,
flush: flush
};

@@ -90,0 +91,0 @@ }

@@ -92,3 +92,3 @@ 'use strict';

checkForbiddenStates();
(0, _utils.check)(cb, _utils.is.func, 'channel.take\'s callback must be a function');
(0, _utils.check)(cb, _utils.is.func, "channel.take's callback must be a function");

@@ -108,4 +108,4 @@ if (closed && buffer.isEmpty()) {

function flush(cb) {
checkForbiddenStates(); // TODO: check if some new state should be forbidden now
(0, _utils.check)(cb, _utils.is.func, 'channel.flush\' callback must be a function');
checkForbiddenStates // TODO: check if some new state should be forbidden now
();(0, _utils.check)(cb, _utils.is.func, "channel.flush' callback must be a function");
if (closed && buffer.isEmpty()) {

@@ -132,3 +132,7 @@ cb(END);

return { take: take, put: put, flush: flush, close: close,
return {
take: take,
put: put,
flush: flush,
close: close,
get __takers__() {

@@ -205,3 +209,3 @@ return takers;

if (arguments.length > 1) {
(0, _utils.check)(matcher, _utils.is.func, 'channel.take\'s matcher argument must be a function');
(0, _utils.check)(matcher, _utils.is.func, "channel.take's matcher argument must be a function");
cb[_utils.MATCH] = matcher;

@@ -208,0 +212,0 @@ }

@@ -76,3 +76,3 @@ 'use strict';

var takem = exports.takem = (0, _utils.deprecate)(take.maybe, (0, _utils.updateIncentive)('takem', 'take.maybe'));
var takem = /*#__PURE__*/exports.takem = (0, _utils.deprecate)(take.maybe, /*#__PURE__*/(0, _utils.updateIncentive)('takem', 'take.maybe'));

@@ -79,0 +79,0 @@ function put(channel, action) {

@@ -72,4 +72,4 @@ 'use strict';

}
var result = next(action); // hit reducers
sagaEmitter.emit(action);
var result = next(action // hit reducers
);sagaEmitter.emit(action);
return result;

@@ -76,0 +76,0 @@ };

@@ -63,2 +63,3 @@ 'use strict';

function matcher(pattern) {
// prettier-ignore
return (pattern === '*' ? matchers.wildcard : _utils.is.array(pattern) ? matchers.array : _utils.is.stringableFunc(pattern) ? matchers.default : _utils.is.func(pattern) ? matchers.predicate : matchers.default)(pattern);

@@ -215,3 +216,3 @@ }

var stdChannel = (0, _channel.stdChannel)(subscribe);
var taskContext = Object.create(parentContext);
var taskContext = Object.create(parentContext
/**

@@ -222,3 +223,3 @@ Tracks the current effect cancellation

**/
next.cancel = _utils.noop;
);next.cancel = _utils.noop;

@@ -231,3 +232,3 @@ /**

var mainTask = { name: name, cancel: cancelMain, isRunning: true };
var taskQueue = forkQueue(name, mainTask, end);
var taskQueue = forkQueue(name, mainTask, end

@@ -237,3 +238,3 @@ /**

**/
function cancelMain() {
);function cancelMain() {
if (mainTask.isRunning && !mainTask.isCancelled) {

@@ -259,7 +260,7 @@ mainTask.isCancelled = true;

iterator._isCancelled = true;
taskQueue.cancelAll();
taskQueue.cancelAll
/**
Ending with a Never result will propagate the Cancellation to all joiners
**/
end(TASK_CANCEL);
();end(TASK_CANCEL);
}

@@ -277,6 +278,6 @@ }

// kicks up the generator
next();
next
// then return the task descriptor to the caller
return task;
();return task;

@@ -309,3 +310,3 @@ /**

**/
next.cancel();
next.cancel
/**

@@ -315,3 +316,3 @@ If this Generator has a `return` method then invokes it

**/
result = _utils.is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
();result = _utils.is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
} else if (arg === CHANNEL_END) {

@@ -377,3 +378,3 @@ // We get CHANNEL_END by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)

var effectId = (0, _utils.uid)();
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect });
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect }

@@ -385,3 +386,3 @@ /**

**/
var effectSettled = void 0;
);var effectSettled = void 0;

@@ -440,8 +441,9 @@ // Completion callback passed to the appropriate effect runner

var data = void 0;
// prettier-ignore
return (
// Non declarative effect
_utils.is.promise(effect) ? resolvePromise(effect, currCb) : _utils.is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : _utils.is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb)
_utils.is.promise(effect) ? resolvePromise(effect, currCb) : _utils.is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : _utils.is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb
// declarative effects
: _utils.is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = _io.asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = _io.asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = _io.asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = _io.asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = _io.asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = _io.asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = _io.asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = _io.asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = _io.asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = _io.asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = _io.asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = _io.asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = _io.asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = _io.asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = _io.asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
) : _utils.is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = _io.asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = _io.asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = _io.asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = _io.asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = _io.asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = _io.asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = _io.asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = _io.asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = _io.asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = _io.asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = _io.asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = _io.asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = _io.asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = _io.asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = _io.asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
);

@@ -452,4 +454,11 @@ }

var cancelPromise = promise[_utils.CANCEL];
if (typeof cancelPromise === 'function') {
if (_utils.is.func(cancelPromise)) {
cb.cancel = cancelPromise;
} else if (_utils.is.func(promise.abort)) {
cb.cancel = function () {
return promise.abort
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
();
};
}

@@ -507,4 +516,5 @@ promise.then(cb, function (error) {

}
});
}
// Put effects are non cancellables
);
}

@@ -600,4 +610,5 @@

}
cb();
cb
// cancel effects are non cancellables
();
}

@@ -604,0 +615,0 @@

@@ -7,3 +7,2 @@ "use strict";

exports.flush = flush;
var queue = [];

@@ -10,0 +9,0 @@ /**

@@ -124,3 +124,3 @@ 'use strict';

var array = exports.array = {
'from': function from(obj) {
from: function from(obj) {
var arr = Array(obj.length);

@@ -127,0 +127,0 @@ for (var i in obj) {

{
"name": "redux-saga",
"version": "0.15.3",
"version": "0.15.4",
"description": "Saga middleware for Redux to handle Side Effects",

@@ -12,7 +12,8 @@ "main": "lib/index.js",

"check": "npm run lint && npm run test",
"compile": "rimraf lib && cross-env BABEL_ENV=cjs babel src --out-dir lib",
"clean": "rimraf dist es lib",
"build:umd:dev": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c -i src/index.js -o dist/redux-saga.js",
"build:umd:prod": "cross-env BABEL_ENV=es NODE_ENV=production rollup -c -i src/index.js -o dist/redux-saga.min.js",
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build": "rimraf dist es && npm run build:umd:dev && npm run build:umd:prod && npm run build:es",
"build": "npm run clean && run-p build:**",
"counter": "cross-env BABEL_ENV=cjs node examples/counter/server.js",

@@ -31,3 +32,5 @@ "cancellable-counter": "cross-env BABEL_ENV=cjs node examples/cancellable-counter/server.js",

"docs:publish": "npm run docs:clean && npm run docs:build && cp CNAME _book && cd _book && git init && git commit --allow-empty -m 'update book' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update book' && git push git@github.com:redux-saga/redux-saga gh-pages --force",
"prerelease": "npm run check && npm run compile && npm run build",
"precommit": "lint-staged && run-p build:umd:** && git add dist",
"prepare": "npm run build",
"prerelease": "npm run check && npm run prepare",
"release:patch": "npm run prerelease && npm version patch && git push --follow-tags && npm publish",

@@ -50,2 +53,5 @@ "release:minor": "npm run prerelease && npm version minor && git push --follow-tags && npm publish",

"author": "Yassine ELOUAFI <yelouafi@gmail.com>",
"contributors": [
"Mateusz Burzyński <mateuszburzynski@gmail.com> (https://github.com/Andarist)"
],
"license": "MIT",

@@ -55,3 +61,3 @@ "bugs": {

},
"homepage": "https://github.com/redux-saga/redux-saga#readme",
"homepage": "https://redux-saga.js.org/",
"dependencies": {},

@@ -72,4 +78,8 @@ "devDependencies": {

"gitbook-cli": "2.3.0",
"husky": "^0.13.3",
"isomorphic-fetch": "^2.2.0",
"lint-staged": "^3.4.2",
"lolex": "^1.5.2",
"npm-run-all": "^4.0.2",
"prettier": "^1.4.1",
"react": "^15.0.0",

@@ -79,3 +89,2 @@ "react-dom": "^15.0.0",

"redux": "^3.5.1",
"redux-logger": "^2.6.1",
"rimraf": "^2.4.3",

@@ -86,3 +95,3 @@ "rollup": "^0.41.6",

"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1",
"rollup-plugin-uglify": "^1.0.2",
"tap-spec": "^4.1.1",

@@ -89,0 +98,0 @@ "tape": "^4.2.2",

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

<img src='logo/0800/Redux-Saga-Logo-Landscape.png' alt='Redux Logo Landscape' width='800px'>
<img src='https://redux-saga.js.org/logo/0800/Redux-Saga-Logo-Landscape.png' alt='Redux Logo Landscape' width='800px'>

@@ -34,3 +34,3 @@ # redux-saga

Suppose we have an UI to fetch some user data from a remote server when a button is clicked. (For brevity, we'll just show the action triggering code.)
Suppose we have a UI to fetch some user data from a remote server when a button is clicked. (For brevity, we'll just show the action triggering code.)

@@ -134,4 +134,8 @@ ```javascript

There is also a **umd** build of `redux-saga` available in the `dist/` folder. When using the umd build `redux-saga` is available as `ReduxSaga` in the window object.
There is also a **umd** build of `redux-saga` available in the `dist/` folder. When using the umd build `redux-saga` is available as `ReduxSaga` in the window object. This enables you to create Saga middleware without using ES6 `import` sytnax like this:
```javascript
var sagaMiddleware = ReduxSaga.default()
```
The umd version is useful if you don't use Webpack or Browserify. You can access it directly from [unpkg](https://unpkg.com/).

@@ -138,0 +142,0 @@

@@ -13,12 +13,12 @@ import nodeResolve from 'rollup-plugin-node-resolve';

nodeResolve({
jsnext: true
jsnext: true,
}),
babel({
exclude: 'node_modules/**',
plugins: ['external-helpers']
plugins: ['external-helpers'],
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
})
]
'process.env.NODE_ENV': JSON.stringify(env),
}),
],
}

@@ -34,10 +34,10 @@

warnings: false,
screw_ie8: true
screw_ie8: true,
},
mangle: {
screw_ie8: true
screw_ie8: true,
},
output: {
screw_ie8: true
}
screw_ie8: true,
},
})

@@ -44,0 +44,0 @@ )

export {
take,
takem,
put,
all,
race,
call,
apply,
cps,
fork,
spawn,
join,
cancel,
select,
actionChannel,
cancelled,
flush,
getContext,
setContext,
takeEvery,
takeLatest,
throttle
take,
takem,
put,
all,
race,
call,
apply,
cps,
fork,
spawn,
join,
cancel,
select,
actionChannel,
cancelled,
flush,
getContext,
setContext,
takeEvery,
takeLatest,
throttle,
} from './internal/io'
import { kTrue, noop } from './utils'
export const BUFFER_OVERFLOW = 'Channel\'s Buffer overflow!'
export const BUFFER_OVERFLOW = "Channel's Buffer overflow!"

@@ -10,3 +10,3 @@ const ON_OVERFLOW_THROW = 1

const zeroBuffer = {isEmpty: kTrue, put: noop, take: noop}
const zeroBuffer = { isEmpty: kTrue, put: noop, take: noop }

@@ -19,3 +19,3 @@ function ringBuffer(limit = 10, overflowAction) {

const push = (it) => {
const push = it => {
arr[pushIndex] = it

@@ -47,7 +47,7 @@ pushIndex = (pushIndex + 1) % limit

put: it => {
if(length < limit) {
if (length < limit) {
push(it)
} else {
let doubledLimit
switch(overflowAction) {
switch (overflowAction) {
case ON_OVERFLOW_THROW:

@@ -75,7 +75,8 @@ throw new Error(BUFFER_OVERFLOW)

default:
// DROP
// DROP
}
}
},
take, flush
take,
flush,
}

@@ -89,3 +90,3 @@ }

sliding: limit => ringBuffer(limit, ON_OVERFLOW_SLIDE),
expanding: initialSize => ringBuffer(initialSize, ON_OVERFLOW_EXPAND)
expanding: initialSize => ringBuffer(initialSize, ON_OVERFLOW_EXPAND),
}

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

import { is, check, remove, MATCH, internalErr, SAGA_ACTION} from './utils'
import {buffers} from './buffers'
import { is, check, remove, MATCH, internalErr, SAGA_ACTION } from './utils'
import { buffers } from './buffers'
import { asap } from './scheduler'
const CHANNEL_END_TYPE = '@@redux-saga/CHANNEL_END'
export const END = {type: CHANNEL_END_TYPE}
export const END = { type: CHANNEL_END_TYPE }
export const isEnd = a => a && a.type === CHANNEL_END_TYPE

@@ -19,3 +19,3 @@

const arr = subscribers.slice()
for (var i = 0, len = arr.length; i < len; i++) {
for (var i = 0, len = arr.length; i < len; i++) {
arr[i](item)

@@ -27,3 +27,3 @@ }

subscribe,
emit
emit,
}

@@ -35,3 +35,3 @@ }

if(process.env.NODE_ENV !== 'production') {
if (process.env.NODE_ENV !== 'production') {
UNDEFINED_INPUT_ERROR += `\nHints:

@@ -50,6 +50,6 @@ - check that your Action Creator returns a non-undefined value

function checkForbiddenStates() {
if(closed && takers.length) {
if (closed && takers.length) {
throw internalErr('Cannot have a closed channel with pending takers')
}
if(takers.length && !buffer.isEmpty()) {
if (takers.length && !buffer.isEmpty()) {
throw internalErr('Cannot have pending takers with non empty buffer')

@@ -70,3 +70,3 @@ }

const cb = takers[i]
if(!cb[MATCH] || cb[MATCH](input)) {
if (!cb[MATCH] || cb[MATCH](input)) {
takers.splice(i, 1)

@@ -80,7 +80,7 @@ return cb(input)

checkForbiddenStates()
check(cb, is.func, 'channel.take\'s callback must be a function')
check(cb, is.func, "channel.take's callback must be a function")
if(closed && buffer.isEmpty()) {
if (closed && buffer.isEmpty()) {
cb(END)
} else if(!buffer.isEmpty()) {
} else if (!buffer.isEmpty()) {
cb(buffer.take())

@@ -95,3 +95,3 @@ } else {

checkForbiddenStates() // TODO: check if some new state should be forbidden now
check(cb, is.func, 'channel.flush\' callback must be a function')
check(cb, is.func, "channel.flush' callback must be a function")
if (closed && buffer.isEmpty()) {

@@ -106,5 +106,5 @@ cb(END)

checkForbiddenStates()
if(!closed) {
if (!closed) {
closed = true
if(takers.length) {
if (takers.length) {
const arr = takers

@@ -119,5 +119,13 @@ takers = []

return {take, put, flush, close,
get __takers__() { return takers },
get __closed__() { return closed }
return {
take,
put,
flush,
close,
get __takers__() {
return takers
},
get __closed__() {
return closed
},
}

@@ -131,3 +139,3 @@ }

**/
if(arguments.length > 2) {
if (arguments.length > 2) {
check(matcher, is.func, 'Invalid match function passed to eventChannel')

@@ -138,3 +146,3 @@ }

const close = () => {
if(!chan.__closed__) {
if (!chan.__closed__) {
if (unsubscribe) {

@@ -147,7 +155,7 @@ unsubscribe()

const unsubscribe = subscribe(input => {
if(isEnd(input)) {
if (isEnd(input)) {
close()
return
}
if(matcher && !matcher(input)) {
if (matcher && !matcher(input)) {
return

@@ -161,3 +169,3 @@ }

if(!is.func(unsubscribe)) {
if (!is.func(unsubscribe)) {
throw new Error('in eventChannel: subscribe should return a function to unsubscribe')

@@ -169,3 +177,3 @@ }

flush: chan.flush,
close
close,
}

@@ -175,9 +183,11 @@ }

export function stdChannel(subscribe) {
const chan = eventChannel(cb => subscribe(input => {
if (input[SAGA_ACTION]) {
cb(input)
return
}
asap(() => cb(input))
}))
const chan = eventChannel(cb =>
subscribe(input => {
if (input[SAGA_ACTION]) {
cb(input)
return
}
asap(() => cb(input))
}),
)

@@ -187,9 +197,9 @@ return {

take(cb, matcher) {
if(arguments.length > 1) {
check(matcher, is.func, 'channel.take\'s matcher argument must be a function')
if (arguments.length > 1) {
check(matcher, is.func, "channel.take's matcher argument must be a function")
cb[MATCH] = matcher
}
chan.take(cb)
}
},
}
}
import { sym, is, ident, check, deprecate, updateIncentive, createSetContextWarning, SELF_CANCELLATION } from './utils'
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers'
const IO = sym('IO')
const TAKE = 'TAKE'
const PUT = 'PUT'
const ALL = 'ALL'
const RACE = 'RACE'
const CALL = 'CALL'
const CPS = 'CPS'
const FORK = 'FORK'
const JOIN = 'JOIN'
const CANCEL = 'CANCEL'
const SELECT = 'SELECT'
const IO = sym('IO')
const TAKE = 'TAKE'
const PUT = 'PUT'
const ALL = 'ALL'
const RACE = 'RACE'
const CALL = 'CALL'
const CPS = 'CPS'
const FORK = 'FORK'
const JOIN = 'JOIN'
const CANCEL = 'CANCEL'
const SELECT = 'SELECT'
const ACTION_CHANNEL = 'ACTION_CHANNEL'
const CANCELLED = 'CANCELLED'
const FLUSH = 'FLUSH'
const GET_CONTEXT = 'GET_CONTEXT'
const SET_CONTEXT = 'SET_CONTEXT'
const CANCELLED = 'CANCELLED'
const FLUSH = 'FLUSH'
const GET_CONTEXT = 'GET_CONTEXT'
const SET_CONTEXT = 'SET_CONTEXT'
const TEST_HINT = '\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)'
const TEST_HINT =
'\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)'
const effect = (type, payload) => ({[IO]: true, [type]: payload})
const effect = (type, payload) => ({ [IO]: true, [type]: payload })

@@ -35,3 +36,5 @@ export function take(patternOrChannel = '*') {

}
throw new Error(`take(patternOrChannel): argument ${String(patternOrChannel)} is not valid channel or a valid pattern`)
throw new Error(
`take(patternOrChannel): argument ${String(patternOrChannel)} is not valid channel or a valid pattern`,
)
}

@@ -45,6 +48,6 @@

export const takem = deprecate(take.maybe, updateIncentive('takem', 'take.maybe'))
export const takem = /*#__PURE__*/ deprecate(take.maybe, /*#__PURE__*/ updateIncentive('takem', 'take.maybe'))
export function put(channel, action) {
if(arguments.length > 1) {
if (arguments.length > 1) {
check(channel, is.notUndef, 'put(channel, action): argument channel is undefined')

@@ -58,3 +61,3 @@ check(channel, is.channel, `put(channel, action): argument ${channel} is not a valid channel`)

}
return effect(PUT, {channel, action})
return effect(PUT, { channel, action })
}

@@ -82,6 +85,6 @@

let context = null
if(is.array(fn)) {
if (is.array(fn)) {
[context, fn] = fn
} else if(fn.fn) {
({context, fn} = fn)
} else if (fn.fn) {
({ context, fn } = fn)
}

@@ -93,3 +96,3 @@ if (context && is.string(fn) && is.func(context[fn])) {

return {context, fn, args}
return { context, fn, args }
}

@@ -102,3 +105,3 @@

export function apply(context, fn, args = []) {
return effect(CALL, getFnCallDesc('apply', {context, fn}, args))
return effect(CALL, getFnCallDesc('apply', { context, fn }, args))
}

@@ -126,3 +129,3 @@

check(task, is.notUndef, 'join(task): argument task is undefined')
check(task, is.task, `join(task): argument ${task} is not a valid Task object ${ TEST_HINT }`)
check(task, is.task, `join(task): argument ${task} is not a valid Task object ${TEST_HINT}`)
return effect(JOIN, task)

@@ -138,3 +141,3 @@ }

check(task, is.notUndef, 'cancel(task): argument task is undefined')
check(task, is.task, `cancel(task): argument ${task} is not a valid Task object ${ TEST_HINT }`)
check(task, is.task, `cancel(task): argument ${task} is not a valid Task object ${TEST_HINT}`)
}

@@ -145,3 +148,3 @@ return effect(CANCEL, task || SELF_CANCELLATION)

export function select(selector, ...args) {
if(arguments.length === 0) {
if (arguments.length === 0) {
selector = ident

@@ -152,3 +155,3 @@ } else {

}
return effect(SELECT, {selector, args})
return effect(SELECT, { selector, args })
}

@@ -161,7 +164,7 @@

check(pattern, is.notUndef, 'actionChannel(pattern,...): argument pattern is undefined')
if(arguments.length > 1) {
if (arguments.length > 1) {
check(buffer, is.notUndef, 'actionChannel(pattern, buffer): argument buffer is undefined')
check(buffer, is.buffer, `actionChannel(pattern, buffer): argument ${buffer} is not a valid buffer`)
}
return effect(ACTION_CHANNEL, {pattern, buffer})
return effect(ACTION_CHANNEL, { pattern, buffer })
}

@@ -179,3 +182,3 @@

export function getContext(prop) {
check(prop, is.string, `getContext(prop): argument ${ prop } is not a string`)
check(prop, is.string, `getContext(prop): argument ${prop} is not a string`)
return effect(GET_CONTEXT, prop)

@@ -204,17 +207,17 @@ }

export const asEffect = {
take : createAsEffectType(TAKE),
put : createAsEffectType(PUT),
all : createAsEffectType(ALL),
race : createAsEffectType(RACE),
call : createAsEffectType(CALL),
cps : createAsEffectType(CPS),
fork : createAsEffectType(FORK),
join : createAsEffectType(JOIN),
cancel : createAsEffectType(CANCEL),
select : createAsEffectType(SELECT),
take: createAsEffectType(TAKE),
put: createAsEffectType(PUT),
all: createAsEffectType(ALL),
race: createAsEffectType(RACE),
call: createAsEffectType(CALL),
cps: createAsEffectType(CPS),
fork: createAsEffectType(FORK),
join: createAsEffectType(JOIN),
cancel: createAsEffectType(CANCEL),
select: createAsEffectType(SELECT),
actionChannel: createAsEffectType(ACTION_CHANNEL),
cancelled : createAsEffectType(CANCELLED),
flush : createAsEffectType(FLUSH),
getContext : createAsEffectType(GET_CONTEXT),
setContext : createAsEffectType(SET_CONTEXT)
cancelled: createAsEffectType(CANCELLED),
flush: createAsEffectType(FLUSH),
getContext: createAsEffectType(GET_CONTEXT),
setContext: createAsEffectType(SET_CONTEXT),
}

@@ -7,9 +7,10 @@ import { is, check, object, createSetContextWarning } from './utils'

export default function sagaMiddlewareFactory({ context = {}, ...options } = {}) {
const {sagaMonitor, logger, onError} = options
const { sagaMonitor, logger, onError } = options
if(is.func(options)) {
if (is.func(options)) {
if (process.env.NODE_ENV === 'production') {
throw new Error('Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead');
throw new Error('Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead')
} else {
throw new Error(`You passed a function to the Saga middleware. You are likely trying to start a\
throw new Error(
`You passed a function to the Saga middleware. You are likely trying to start a\
Saga by directly passing it to the middleware. This is no longer possible starting from 0.10.0.\

@@ -24,8 +25,8 @@ To run a Saga, you must do it dynamically AFTER mounting the middleware into the store.

sagaMiddleware.run(saga, ...args)
`)
`,
)
}
}
if(logger && !is.func(logger)) {
if (logger && !is.func(logger)) {
throw new Error('`options.logger` passed to the Saga middleware is not a function!')

@@ -38,7 +39,7 @@ }

if(onError && !is.func(onError)) {
if (onError && !is.func(onError)) {
throw new Error('`options.onError` passed to the Saga middleware is not a function!')
}
if(options.emitter && !is.func(options.emitter)) {
if (options.emitter && !is.func(options.emitter)) {
throw new Error('`options.emitter` passed to the Saga middleware is not a function!')

@@ -49,3 +50,3 @@ }

const sagaEmitter = emitter()
sagaEmitter.emit = (options.emitter || ident)(sagaEmitter.emit);
sagaEmitter.emit = (options.emitter || ident)(sagaEmitter.emit)

@@ -59,7 +60,7 @@ sagaMiddleware.run = runSaga.bind(null, {

logger,
onError
onError,
})
return next => action => {
if(sagaMonitor && sagaMonitor.actionDispatched) {
if (sagaMonitor && sagaMonitor.actionDispatched) {
sagaMonitor.actionDispatched(action)

@@ -73,5 +74,7 @@ }

sagaMiddleware.run = () => { throw new Error('Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware') }
sagaMiddleware.run = () => {
throw new Error('Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware')
}
sagaMiddleware.setContext = (props) => {
sagaMiddleware.setContext = props => {
check(props, is.object, createSetContextWarning('sagaMiddleware', props))

@@ -78,0 +81,0 @@ object.assign(context, props)

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

import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, array, remove, object, TASK, CANCEL, SELF_CANCELLATION, makeIterator, createSetContextWarning, deprecate, updateIncentive } from './utils'
import {
noop,
kTrue,
is,
log as _log,
check,
deferred,
uid as nextEffectId,
array,
remove,
object,
TASK,
CANCEL,
SELF_CANCELLATION,
makeIterator,
createSetContextWarning,
deprecate,
updateIncentive,
} from './utils'
import { asap, suspend, flush } from './scheduler'

@@ -9,13 +27,23 @@ import { asEffect } from './io'

export const CHANNEL_END = {toString() { return '@@redux-saga/CHANNEL_END' }}
export const TASK_CANCEL = {toString() { return '@@redux-saga/TASK_CANCEL' }}
export const CHANNEL_END = {
toString() {
return '@@redux-saga/CHANNEL_END'
},
}
export const TASK_CANCEL = {
toString() {
return '@@redux-saga/TASK_CANCEL'
},
}
const matchers = {
wildcard : () => kTrue,
default : pattern => (typeof pattern === 'symbol' ? input => input.type === pattern : input => input.type === String(pattern)),
array : patterns => input => patterns.some(p => matcher(p)(input)),
predicate : predicate => input => predicate(input)
wildcard: () => kTrue,
default: pattern =>
typeof pattern === 'symbol' ? input => input.type === pattern : input => input.type === String(pattern),
array: patterns => input => patterns.some(p => matcher(p)(input)),
predicate: predicate => input => predicate(input),
}
function matcher(pattern) {
// prettier-ignore
return (

@@ -46,3 +74,5 @@ pattern === '*' ? matchers.wildcard

function forkQueue(name, mainTask, cb) {
let tasks = [], result, completed = false
let tasks = [],
result,
completed = false
addTask(mainTask)

@@ -58,3 +88,3 @@

task.cont = (res, isErr) => {
if(completed) {
if (completed) {
return

@@ -65,9 +95,9 @@ }

task.cont = noop
if(isErr) {
if (isErr) {
abort(res)
} else {
if(task === mainTask) {
if (task === mainTask) {
result = res
}
if(!tasks.length) {
if (!tasks.length) {
completed = true

@@ -82,3 +112,3 @@ cb(result)

function cancelAll() {
if(completed) {
if (completed) {
return

@@ -99,7 +129,7 @@ }

getTasks: () => tasks,
taskNames: () => tasks.map(t => t.name)
taskNames: () => tasks.map(t => t.name),
}
}
function createTaskIterator({context, fn, args}) {
function createTaskIterator({ context, fn, args }) {
if (is.iterator(fn)) {

@@ -113,3 +143,3 @@ return fn

result = fn.apply(context, args)
} catch(err) {
} catch (err) {
error = err

@@ -126,19 +156,23 @@ }

return error
? makeIterator(() => { throw error })
: makeIterator((function() {
let pc
const eff = {done: false, value: result}
const ret = value => ({done: true, value})
return arg => {
if(!pc) {
pc = true
return eff
} else {
return ret(arg)
? makeIterator(() => {
throw error
})
: makeIterator(
(function() {
let pc
const eff = { done: false, value: result }
const ret = value => ({ done: true, value })
return arg => {
if (!pc) {
pc = true
return eff
} else {
return ret(arg)
}
}
}
})())
})(),
)
}
const wrapHelper = (helper) => ({ fn: helper })
const wrapHelper = helper => ({ fn: helper })

@@ -154,3 +188,3 @@ export default function proc(

name = 'anonymous',
cont
cont,
) {

@@ -160,5 +194,5 @@ check(iterator, is.iterator, NOT_ITERATOR_ERROR)

const effectsString = '[...effects]'
const runParallelEffect = deprecate(runAllEffect, updateIncentive(effectsString, `all(${ effectsString })`))
const runParallelEffect = deprecate(runAllEffect, updateIncentive(effectsString, `all(${effectsString})`))
const {sagaMonitor, logger, onError} = options
const { sagaMonitor, logger, onError } = options
const log = logger || _log

@@ -179,3 +213,3 @@ const stdChannel = _stdChannel(subscribe)

const task = newTask(parentEffectId, name, iterator, cont)
const mainTask = {name, cancel: cancelMain, isRunning: true}
const mainTask = { name, cancel: cancelMain, isRunning: true }
const taskQueue = forkQueue(name, mainTask, end)

@@ -187,3 +221,3 @@

function cancelMain() {
if(mainTask.isRunning && !mainTask.isCancelled) {
if (mainTask.isRunning && !mainTask.isCancelled) {
mainTask.isCancelled = true

@@ -208,3 +242,3 @@ next(TASK_CANCEL)

**/
if(iterator._isRunning && !iterator._isCancelled) {
if (iterator._isRunning && !iterator._isCancelled) {
iterator._isCancelled = true

@@ -240,3 +274,3 @@ taskQueue.cancelAll()

// Preventive measure. If we end up here, then there is really something wrong
if(!mainTask.isRunning) {
if (!mainTask.isRunning) {
throw new Error('Trying to resume an already finished generator')

@@ -247,5 +281,5 @@ }

let result
if(isErr) {
if (isErr) {
result = iterator.throw(arg)
} else if(arg === TASK_CANCEL) {
} else if (arg === TASK_CANCEL) {
/**

@@ -267,6 +301,6 @@ getting TASK_CANCEL automatically cancels the main task

**/
result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : {done: true, value: TASK_CANCEL}
} else if(arg === CHANNEL_END) {
result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL }
} else if (arg === CHANNEL_END) {
// We get CHANNEL_END by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)
result = is.func(iterator.return) ? iterator.return() : {done: true}
result = is.func(iterator.return) ? iterator.return() : { done: true }
} else {

@@ -276,4 +310,4 @@ result = iterator.next(arg)

if(!result.done) {
runEffect(result.value, parentEffectId, '', next)
if (!result.done) {
runEffect(result.value, parentEffectId, '', next)
} else {

@@ -286,4 +320,4 @@ /**

}
} catch(error) {
if(mainTask.isCancelled) {
} catch (error) {
if (mainTask.isCancelled) {
log('error', `uncaught at ${name}`, error.message)

@@ -299,4 +333,4 @@ }

stdChannel.close()
if(!isErr) {
if(process.env.NODE_ENV === 'development' && result === TASK_CANCEL) {
if (!isErr) {
if (process.env.NODE_ENV === 'development' && result === TASK_CANCEL) {
log('info', `${name} has been cancelled`, '')

@@ -307,8 +341,8 @@ }

} else {
if(result instanceof Error) {
if (result instanceof Error) {
result.sagaStack = `at ${name} \n ${result.sagaStack || result.stack}`
}
if(!task.cont) {
if (!task.cont) {
log('error', `uncaught`, result.sagaStack || result.stack)
if((result instanceof Error) && onError) {
if (result instanceof Error && onError) {
onError(result)

@@ -328,3 +362,3 @@ }

const effectId = nextEffectId()
sagaMonitor && sagaMonitor.effectTriggered({effectId, parentEffectId, label, effect})
sagaMonitor && sagaMonitor.effectTriggered({ effectId, parentEffectId, label, effect })

@@ -340,13 +374,10 @@ /**

function currCb(res, isErr) {
if(effectSettled) {
if (effectSettled) {
return
}
effectSettled = true
cb.cancel = noop // defensive measure
if(sagaMonitor) {
isErr ?
sagaMonitor.effectRejected(effectId, res)
: sagaMonitor.effectResolved(effectId, res)
if (sagaMonitor) {
isErr ? sagaMonitor.effectRejected(effectId, res) : sagaMonitor.effectResolved(effectId, res)
}

@@ -361,3 +392,3 @@ cb(res, isErr)

// prevents cancelling an already completed effect
if(effectSettled) {
if (effectSettled) {
return

@@ -374,3 +405,3 @@ }

currCb.cancel()
} catch(err) {
} catch (err) {
log('error', `uncaught at ${name}`, err.message)

@@ -399,2 +430,3 @@ }

let data
// prettier-ignore
return (

@@ -423,3 +455,3 @@ // Non declarative effect

: (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb)
: /* anything else returned as is */ currCb(effect)
: /* anything else returned as is */ currCb(effect)
)

@@ -430,9 +462,10 @@ }

const cancelPromise = promise[CANCEL]
if(typeof cancelPromise === 'function') {
if (is.func(cancelPromise)) {
cb.cancel = cancelPromise
} else if (is.func(promise.abort)) {
cb.cancel = () => promise.abort()
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
}
promise.then(
cb,
error => cb(error, true)
)
promise.then(cb, error => cb(error, true))
}

@@ -444,12 +477,8 @@

function runTakeEffect({channel, pattern, maybe}, cb) {
function runTakeEffect({ channel, pattern, maybe }, cb) {
channel = channel || stdChannel
const takeCb = inp => (
inp instanceof Error ? cb(inp, true)
: isEnd(inp) && !maybe ? cb(CHANNEL_END)
: cb(inp)
)
const takeCb = inp => (inp instanceof Error ? cb(inp, true) : isEnd(inp) && !maybe ? cb(CHANNEL_END) : cb(inp))
try {
channel.take(takeCb, matcher(pattern))
} catch(err) {
} catch (err) {
return cb(err, true)

@@ -460,3 +489,3 @@ }

function runPutEffect({channel, action, resolve}, cb) {
function runPutEffect({ channel, action, resolve }, cb) {
/**

@@ -471,3 +500,3 @@ Schedule the put in case another saga is holding a lock.

result = (channel ? channel.put : dispatch)(action)
} catch(error) {
} catch (error) {
// If we have a channel or `put.resolve` was used then bubble up the error.

@@ -478,3 +507,3 @@ if (channel || resolve) return cb(error, true)

if(resolve && is.promise(result)) {
if (resolve && is.promise(result)) {
resolvePromise(result, cb)

@@ -488,3 +517,3 @@ } else {

function runCallEffect({context, fn, args}, effectId, cb) {
function runCallEffect({ context, fn, args }, effectId, cb) {
let result

@@ -494,13 +523,11 @@ // catch synchronous failures; see #152

result = fn.apply(context, args)
} catch(error) {
} catch (error) {
return cb(error, true)
}
return (
is.promise(result) ? resolvePromise(result, cb)
: is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb)
: cb(result)
)
return is.promise(result)
? resolvePromise(result, cb)
: is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb) : cb(result)
}
function runCPSEffect({context, fn, args}, cb) {
function runCPSEffect({ context, fn, args }, cb) {
// CPS (ie node style functions) can define their own cancellation logic

@@ -511,8 +538,8 @@ // by setting cancel field on the cb

try {
const cpsCb = (err, res) => is.undef(err) ? cb(res) : cb(err, true);
fn.apply(context, args.concat(cpsCb));
const cpsCb = (err, res) => (is.undef(err) ? cb(res) : cb(err, true))
fn.apply(context, args.concat(cpsCb))
if (cpsCb.cancel) {
cb.cancel = () => cpsCb.cancel();
cb.cancel = () => cpsCb.cancel()
}
} catch(error) {
} catch (error) {
return cb(error, true)

@@ -522,4 +549,4 @@ }

function runForkEffect({context, fn, args, detached}, effectId, cb) {
const taskIterator = createTaskIterator({context, fn, args})
function runForkEffect({ context, fn, args, detached }, effectId, cb) {
const taskIterator = createTaskIterator({ context, fn, args })

@@ -537,12 +564,12 @@ try {

fn.name,
(detached ? null : noop)
detached ? null : noop,
)
if(detached) {
if (detached) {
cb(task)
} else {
if(taskIterator._isRunning) {
if (taskIterator._isRunning) {
taskQueue.addTask(task)
cb(task)
} else if(taskIterator._error) {
} else if (taskIterator._error) {
taskQueue.abort(taskIterator._error)

@@ -560,4 +587,4 @@ } else {

function runJoinEffect(t, cb) {
if(t.isRunning()) {
const joiner = {task, cb}
if (t.isRunning()) {
const joiner = { task, cb }
cb.cancel = () => remove(t.joiners, joiner)

@@ -574,3 +601,3 @@ t.joiners.push(joiner)

}
if(taskToCancel.isRunning()) {
if (taskToCancel.isRunning()) {
taskToCancel.cancel()

@@ -585,3 +612,3 @@ }

if(!keys.length) {
if (!keys.length) {
return cb(is.array(effects) ? [] : {})

@@ -596,3 +623,3 @@ }

function checkEffectEnd() {
if(completedCount === keys.length) {
if (completedCount === keys.length) {
completed = true

@@ -604,21 +631,21 @@ cb(is.array(effects) ? array.from({ ...results, length: keys.length }) : results)

keys.forEach(key => {
const chCbAtKey = (res, isErr) => {
if(completed) {
return
}
if(isErr || isEnd(res) || res === CHANNEL_END || res === TASK_CANCEL) {
cb.cancel()
cb(res, isErr)
} else {
results[key] = res
completedCount++
checkEffectEnd()
}
const chCbAtKey = (res, isErr) => {
if (completed) {
return
}
chCbAtKey.cancel = noop
childCbs[key] = chCbAtKey
if (isErr || isEnd(res) || res === CHANNEL_END || res === TASK_CANCEL) {
cb.cancel()
cb(res, isErr)
} else {
results[key] = res
completedCount++
checkEffectEnd()
}
}
chCbAtKey.cancel = noop
childCbs[key] = chCbAtKey
})
cb.cancel = () => {
if(!completed) {
if (!completed) {
completed = true

@@ -639,14 +666,14 @@ keys.forEach(key => childCbs[key].cancel())

const chCbAtKey = (res, isErr) => {
if(completed) {
if (completed) {
return
}
if(isErr) {
if (isErr) {
// Race Auto cancellation
cb.cancel()
cb(res, true)
} else if(!isEnd(res) && res !== CHANNEL_END && res !== TASK_CANCEL) {
} else if (!isEnd(res) && res !== CHANNEL_END && res !== TASK_CANCEL) {
cb.cancel()
completed = true
cb({[key]: res})
cb({ [key]: res })
}

@@ -660,3 +687,3 @@ }

// prevents unnecessary cancellation
if(!completed) {
if (!completed) {
completed = true

@@ -667,3 +694,3 @@ keys.forEach(key => childCbs[key].cancel())

keys.forEach(key => {
if(completed) {
if (completed) {
return

@@ -675,7 +702,7 @@ }

function runSelectEffect({selector, args}, cb) {
function runSelectEffect({ selector, args }, cb) {
try {
const state = selector(getState(), ...args)
cb(state)
} catch(error) {
} catch (error) {
cb(error, true)

@@ -685,3 +712,3 @@ }

function runChannelEffect({pattern, buffer}, cb) {
function runChannelEffect({ pattern, buffer }, cb) {
const match = matcher(pattern)

@@ -716,3 +743,3 @@ match.pattern = pattern

get done() {
if(iterator._deferredEnd) {
if (iterator._deferredEnd) {
return iterator._deferredEnd.promise

@@ -722,3 +749,3 @@ } else {

iterator._deferredEnd = def
if(!iterator._isRunning) {
if (!iterator._isRunning) {
iterator._error ? def.reject(iterator._error) : def.resolve(iterator._result)

@@ -740,5 +767,5 @@ }

object.assign(taskContext, props)
}
},
}
}
}

@@ -5,9 +5,5 @@ import { is, check, uid as nextSagaId, wrapSagaDispatch, noop, log } from './utils'

const RUN_SAGA_SIGNATURE = 'runSaga(storeInterface, saga, ...args)'
const NON_GENERATOR_ERR = `${ RUN_SAGA_SIGNATURE }: saga argument must be a Generator function!`
const NON_GENERATOR_ERR = `${RUN_SAGA_SIGNATURE}: saga argument must be a Generator function!`
export function runSaga(
storeInterface,
saga,
...args
) {
export function runSaga(storeInterface, saga, ...args) {
let iterator

@@ -17,3 +13,3 @@

if (process.env.NODE_ENV === 'development') {
log('warn', `runSaga(iterator, storeInterface) has been deprecated in favor of ${ RUN_SAGA_SIGNATURE }`)
log('warn', `runSaga(iterator, storeInterface) has been deprecated in favor of ${RUN_SAGA_SIGNATURE}`)
}

@@ -28,15 +24,7 @@ iterator = storeInterface

const {
subscribe,
dispatch,
getState,
context,
sagaMonitor,
logger,
onError
} = storeInterface
const { subscribe, dispatch, getState, context, sagaMonitor, logger, onError } = storeInterface
const effectId = nextSagaId()
if(sagaMonitor) {
if (sagaMonitor) {
// monitors are expected to have a certain interface, let's fill-in any missing ones

@@ -49,3 +37,3 @@ sagaMonitor.effectTriggered = sagaMonitor.effectTriggered || noop

sagaMonitor.effectTriggered({effectId, root: true, parentEffectId: 0, effect: {root: true, saga, args}})
sagaMonitor.effectTriggered({ effectId, root: true, parentEffectId: 0, effect: { root: true, saga, args } })
}

@@ -59,8 +47,8 @@

context,
{sagaMonitor, logger, onError},
{ sagaMonitor, logger, onError },
effectId,
saga.name
saga.name,
)
if(sagaMonitor) {
if (sagaMonitor) {
sagaMonitor.effectResolved(effectId, task)

@@ -67,0 +55,0 @@ }

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

const queue = []

@@ -3,0 +2,0 @@ /**

export const sym = id => `@@redux-saga/${id}`
export const TASK = sym('TASK')
export const HELPER = sym('HELPER')
export const TASK = sym('TASK')
export const HELPER = sym('HELPER')
export const MATCH = sym('MATCH')

@@ -16,3 +16,3 @@ export const CANCEL = sym('CANCEL_PROMISE')

export function check(value, predicate, error) {
if(!predicate(value)) {
if (!predicate(value)) {
log('error', 'uncaught at check', error)

@@ -29,19 +29,19 @@ throw new Error(error)

export const is = {
undef : v => v === null || v === undefined,
notUndef : v => v !== null && v !== undefined,
func : f => typeof f === 'function',
number : n => typeof n === 'number',
string : s => typeof s === 'string',
array : Array.isArray,
object : obj => obj && !is.array(obj) && typeof obj === 'object',
promise : p => p && is.func(p.then),
iterator : it => it && is.func(it.next) && is.func(it.throw),
iterable : it => it && is.func(Symbol) ? is.func(it[Symbol.iterator]) : is.array(it),
task : t => t && t[TASK],
observable : ob => ob && is.func(ob.subscribe),
buffer : buf => buf && is.func(buf.isEmpty) && is.func(buf.take) && is.func(buf.put),
pattern : pat => pat && (is.string(pat) || (typeof pat === 'symbol') || is.func(pat) || is.array(pat)),
channel : ch => ch && is.func(ch.take) && is.func(ch.close),
helper : it => it && it[HELPER],
stringableFunc : f => is.func(f) && hasOwn(f, 'toString')
undef: v => v === null || v === undefined,
notUndef: v => v !== null && v !== undefined,
func: f => typeof f === 'function',
number: n => typeof n === 'number',
string: s => typeof s === 'string',
array: Array.isArray,
object: obj => obj && !is.array(obj) && typeof obj === 'object',
promise: p => p && is.func(p.then),
iterator: it => it && is.func(it.next) && is.func(it.throw),
iterable: it => (it && is.func(Symbol) ? is.func(it[Symbol.iterator]) : is.array(it)),
task: t => t && t[TASK],
observable: ob => ob && is.func(ob.subscribe),
buffer: buf => buf && is.func(buf.isEmpty) && is.func(buf.take) && is.func(buf.put),
pattern: pat => pat && (is.string(pat) || typeof pat === 'symbol' || is.func(pat) || is.array(pat)),
channel: ch => ch && is.func(ch.take) && is.func(ch.close),
helper: it => it && it[HELPER],
stringableFunc: f => is.func(f) && hasOwn(f, 'toString'),
}

@@ -56,3 +56,3 @@

}
}
},
}

@@ -62,3 +62,3 @@

const index = array.indexOf(item)
if(index >= 0) {
if (index >= 0) {
array.splice(index, 1)

@@ -69,3 +69,3 @@ }

export const array = {
'from'(obj) {
from(obj) {
const arr = Array(obj.length)

@@ -78,7 +78,7 @@ for (let i in obj) {

return arr
}
},
}
export function deferred(props = {}) {
let def = {...props}
let def = { ...props }
const promise = new Promise((resolve, reject) => {

@@ -121,5 +121,5 @@ def.resolve = resolve

setRunning : b => running = b,
setResult : r => result = r,
setError : e => error = e
setRunning: b => (running = b),
setResult: r => (result = r),
setError: e => (error = e),
}

@@ -134,6 +134,8 @@ }

const kThrow = err => { throw err }
const kReturn = value => ({value, done: true})
const kThrow = err => {
throw err
}
const kReturn = value => ({ value, done: true })
export function makeIterator(next, thro = kThrow, name = '', isHelper) {
const iterator = {name, next, throw: thro, return: kReturn}
const iterator = { name, next, throw: thro, return: kReturn }

@@ -143,3 +145,3 @@ if (isHelper) {

}
if(typeof Symbol !== 'undefined') {
if (typeof Symbol !== 'undefined') {
iterator[Symbol.iterator] = () => iterator

@@ -157,3 +159,3 @@ }

/*eslint-disable no-console*/
if(typeof window === 'undefined') {
if (typeof window === 'undefined') {
console.log(`redux-saga ${level}: ${message}\n${(error && error.stack) || error}`)

@@ -173,30 +175,35 @@ } else {

export const updateIncentive = (deprecated, preferred) =>
`${ deprecated } has been deprecated in favor of ${ preferred }, please update your code`
`${deprecated} has been deprecated in favor of ${preferred}, please update your code`
export const internalErr = err => new Error(`
export const internalErr = err =>
new Error(
`
redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug
in redux-saga code and not yours. Thanks for reporting this in the project's github repo.
Error: ${err}
`)
`,
)
export const createSetContextWarning = (ctx, props) => `${ ctx ? ctx + '.' : '' }setContext(props): argument ${ props } is not a plain object`
export const createSetContextWarning = (ctx, props) =>
`${ctx ? ctx + '.' : ''}setContext(props): argument ${props} is not a plain object`
export const wrapSagaDispatch = dispatch => action => dispatch(Object.defineProperty(action, SAGA_ACTION, { value: true }))
export const wrapSagaDispatch = dispatch => action =>
dispatch(Object.defineProperty(action, SAGA_ACTION, { value: true }))
export const cloneableGenerator = (generatorFunc) => (...args) => {
const history = [];
const gen = generatorFunc(...args);
export const cloneableGenerator = generatorFunc => (...args) => {
const history = []
const gen = generatorFunc(...args)
return {
next: (arg) => {
history.push(arg);
return gen.next(arg);
next: arg => {
history.push(arg)
return gen.next(arg)
},
clone: () => {
const clonedGen = cloneableGenerator(generatorFunc)(...args);
history.forEach((arg) => clonedGen.next(arg));
return clonedGen;
const clonedGen = cloneableGenerator(generatorFunc)(...args)
history.forEach(arg => clonedGen.next(arg))
return clonedGen
},
return: (value) => gen.return(value),
throw: (exception) => gen.throw(exception)
};
};
return: value => gen.return(value),
throw: exception => gen.throw(exception),
}
}

@@ -1,3 +0,12 @@

export { TASK, SAGA_ACTION, noop, is, deferred, arrayOfDeffered, createMockTask, cloneableGenerator } from './internal/utils'
export {
TASK,
SAGA_ACTION,
noop,
is,
deferred,
arrayOfDeffered,
createMockTask,
cloneableGenerator,
} from './internal/utils'
export { asEffect } from './internal/io'
export { CHANNEL_END } from './internal/proc'
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc