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.13.0 to 0.14.0

0

.eslintrc.json

@@ -0,0 +0,0 @@ {

2

dist/redux-saga.min.js

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

!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ReduxSaga=e():n.ReduxSaga=e()}(this,function(){return function(n){function e(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return n[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var t={};return e.m=n,e.c=t,e.p="",e(0)}([function(n,e,t){"use strict";function r(n){if(n&&n.__esModule)return n;var e={};if(null!=n)for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function o(n){return n&&n.__esModule?n:{"default":n}}Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.effects=e.CANCEL=e.delay=e.throttle=e.takeLatest=e.takeEvery=e.buffers=e.channel=e.eventChannel=e.END=e.runSaga=void 0;var u=t(9);Object.defineProperty(e,"runSaga",{enumerable:!0,get:function(){return u.runSaga}});var a=t(3);Object.defineProperty(e,"END",{enumerable:!0,get:function(){return a.END}}),Object.defineProperty(e,"eventChannel",{enumerable:!0,get:function(){return a.eventChannel}}),Object.defineProperty(e,"channel",{enumerable:!0,get:function(){return a.channel}});var i=t(2);Object.defineProperty(e,"buffers",{enumerable:!0,get:function(){return i.buffers}});var c=t(10);Object.defineProperty(e,"takeEvery",{enumerable:!0,get:function(){return c.takeEvery}}),Object.defineProperty(e,"takeLatest",{enumerable:!0,get:function(){return c.takeLatest}}),Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return c.throttle}});var f=t(1);Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return f.delay}}),Object.defineProperty(e,"CANCEL",{enumerable:!0,get:function(){return f.CANCEL}});var l=t(8),s=o(l),d=t(7),v=r(d),p=t(11),g=r(p);e.default=s.default,e.effects=v,e.utils=g},function(n,e){"use strict";function t(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function r(n,e,t){if(!e(n))throw s("error","uncaught at check",t),new Error(t)}function o(n,e){var t=n.indexOf(e);t>=0&&n.splice(t,1)}function u(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=v({},n),t=new Promise(function(n,t){e.resolve=n,e.reject=t});return e.promise=t,e}function a(n){for(var e=[],t=0;t<n;t++)e.push(u());return e}function i(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=void 0,r=new Promise(function(r){t=setTimeout(function(){return r(e)},n)});return r[b]=function(){return clearTimeout(t)},r}function c(){var n,e=!0,r=void 0,o=void 0;return n={},t(n,h,!0),t(n,"isRunning",function(){return e}),t(n,"result",function(){return r}),t(n,"error",function(){return o}),t(n,"setRunning",function(n){return e=n}),t(n,"setResult",function(n){return r=n}),t(n,"setError",function(n){return o=n}),n}function f(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++n}}function l(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:t,next:n,"throw":e,"return":_};return r&&(o[y]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function s(n,e,t){"undefined"==typeof window?console.log("redux-saga "+n+": "+e+"\n"+(t&&t.stack||t)):console[n](e,t)}function d(n){return function(e){var t=Object.defineProperty(e,m,{value:!0});return n(t)}}Object.defineProperty(e,"__esModule",{value:!0});var v=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},p="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};e.check=r,e.remove=o,e.deferred=u,e.arrayOfDeffered=a,e.delay=i,e.createMockTask=c,e.autoInc=f,e.makeIterator=l,e.log=s,e.wrapSagaDispatch=d;var g=e.sym=function(n){return"@@redux-saga/"+n},h=e.TASK=g("TASK"),y=e.HELPER=g("HELPER"),b=(e.MATCH=g("MATCH"),e.CANCEL=g("cancelPromise")),m=e.SAGA_ACTION=g("SAGA_ACTION"),E=e.konst=function(n){return function(){return n}},k=(e.kTrue=E(!0),e.kFalse=E(!1),e.noop=function(){},e.ident=function(n){return n},e.is={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},array:Array.isArray,promise:function(n){return n&&k.func(n.then)},iterator:function(n){return n&&k.func(n.next)&&k.func(n.throw)},task:function(n){return n&&n[h]},observable:function(n){return n&&k.func(n.subscribe)},buffer:function(n){return n&&k.func(n.isEmpty)&&k.func(n.take)&&k.func(n.put)},pattern:function(n){return n&&("string"==typeof n||"symbol"===("undefined"==typeof n?"undefined":p(n))||k.func(n)||k.array(n))},channel:function(n){return n&&k.func(n.take)&&k.func(n.close)},helper:function(n){return n&&n[y]}}),O=(e.uid=f(),function(n){throw n}),_=function(n){return{value:n,done:!0}};e.internalErr=function(n){return new 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")}},function(n,e,t){"use strict";function r(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments[1],t=new Array(n),r=0,o=0,i=0,l=function(e){t[o]=e,o=(o+1)%n,r++},s=function(){if(0!=r){var e=t[i];return t[i]=null,r--,i=(i+1)%n,e}},d=function(){for(var n=[];r;)n.push(s());return n};return{isEmpty:function(){return 0==r},put:function(s){if(r<n)l(s);else{var v=void 0;switch(e){case a:throw new Error(u);case c:t[o]=s,o=(o+1)%n,i=o;break;case f:v=2*n,t=d(),r=t.length,o=t.length,i=0,t.length=v,n=v,l(s)}}},take:s,flush:d}}Object.defineProperty(e,"__esModule",{value:!0}),e.buffers=e.BUFFER_OVERFLOW=void 0;var o=t(1),u=e.BUFFER_OVERFLOW="Channel's Buffer overflow!",a=1,i=2,c=3,f=4,l={isEmpty:o.kTrue,put:o.noop,take:o.noop};e.buffers={none:function(){return l},fixed:function(n){return r(n,a)},dropping:function(n){return r(n,i)},sliding:function(n){return r(n,c)},expanding:function(n){return r(n,f)}}},function(n,e,t){"use strict";function r(){function n(n){return t.push(n),function(){return(0,c.remove)(t,n)}}function e(n){for(var e=t.slice(),r=0,o=e.length;r<o;r++)e[r](n)}var t=[];return{subscribe:n,emit:e}}function o(){function n(){if(a&&i.length)throw(0,c.internalErr)("Cannot have a closed channel with pending takers");if(i.length&&!u.isEmpty())throw(0,c.internalErr)("Cannot have pending takers with non empty buffer")}function e(e){if(n(),(0,c.check)(e,c.is.notUndef,p),!a){if(!i.length)return u.put(e);for(var t=0;t<i.length;t++){var r=i[t];if(!r[c.MATCH]||r[c.MATCH](e))return i.splice(t,1),r(e)}}}function t(e){n(),(0,c.check)(e,c.is.func,"channel.take's callback must be a function"),a&&u.isEmpty()?e(s):u.isEmpty()?(i.push(e),e.cancel=function(){return(0,c.remove)(i,e)}):e(u.take())}function r(e){return n(),(0,c.check)(e,c.is.func,"channel.flush' callback must be a function"),a&&u.isEmpty()?void e(s):void e(u.flush())}function o(){if(n(),!a&&(a=!0,i.length)){var e=i;i=[];for(var t=0,r=e.length;t<r;t++)e[t](s)}}var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f.buffers.fixed(),a=!1,i=[];return(0,c.check)(u,c.is.buffer,v),{take:t,put:e,flush:r,close:o,get __takers__(){return i},get __closed__(){return a}}}function u(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.buffers.none(),t=arguments[2];arguments.length>2&&(0,c.check)(t,c.is.func,"Invalid match function passed to eventChannel");var r=o(e),u=n(function(n){d(n)?r.close():t&&!t(n)||r.put(n)});if(!c.is.func(u))throw new Error("in eventChannel: subscribe should return a function to unsubscribe");return{take:r.take,flush:r.flush,close:function(){r.__closed__||(r.close(),u())}}}function a(n){var e=u(n);return i({},e,{take:function(n,t){arguments.length>1&&((0,c.check)(t,c.is.func,"channel.take's matcher argument must be a function"),n[c.MATCH]=t),e.take(n)}})}Object.defineProperty(e,"__esModule",{value:!0}),e.UNDEFINED_INPUT_ERROR=e.INVALID_BUFFER=e.isEnd=e.END=void 0;var i=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n};e.emitter=r,e.channel=o,e.eventChannel=u,e.stdChannel=a;var c=t(1),f=t(2),l="@@redux-saga/CHANNEL_END",s=e.END={type:l},d=e.isEnd=function(n){return n&&n.type===l},v=e.INVALID_BUFFER="invalid buffer passed to channel factory function",p=e.UNDEFINED_INPUT_ERROR="Saga was provided with an undefined action"},function(n,e,t){"use strict";function r(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function o(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";if(arguments.length&&(0,k.check)(arguments[0],k.is.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),k.is.pattern(n))return M(_,{pattern:n});if(k.is.channel(n))return M(_,{channel:n});throw new Error("take(patternOrChannel): argument "+String(n)+" is not valid channel or a valid pattern")}function u(){var n=o.apply(void 0,arguments);return n[_].maybe=!0,n}function a(n,e){return arguments.length>1?((0,k.check)(n,k.is.notUndef,"put(channel, action): argument channel is undefined"),(0,k.check)(n,k.is.channel,"put(channel, action): argument "+n+" is not a valid channel"),(0,k.check)(e,k.is.notUndef,"put(channel, action): argument action is undefined")):((0,k.check)(n,k.is.notUndef,"put(action): argument action is undefined"),e=n,n=null),M(A,{channel:n,action:e})}function i(n){return M(j,n)}function c(n,e,t){(0,k.check)(e,k.is.notUndef,n+": argument fn is undefined");var r=null;if(k.is.array(e)){var o=e,u=E(o,2);r=u[0],e=u[1]}else if(e.fn){var a=e;r=a.context,e=a.fn}return(0,k.check)(e,k.is.func,n+": argument "+e+" is not a function"),{context:r,fn:e,args:t}}function f(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return M(C,c("call",n,t))}function l(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return M(C,c("apply",{context:n,fn:e},t))}function s(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return M(w,c("cps",n,t))}function d(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return M(P,c("fork",n,t))}function v(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];var o=d.apply(void 0,[n].concat(t));return o[P].detached=!0,o}function p(n){if((0,k.check)(n,k.is.notUndef,"join(task): argument task is undefined"),!I(n))throw new Error("join(task): argument "+n+" is not a valid Task object \n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)");return M(N,n)}function g(n){if((0,k.check)(n,k.is.notUndef,"cancel(task): argument task is undefined"),!I(n))throw new Error("cancel(task): argument "+n+" is not a valid Task object \n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)");return M(S,n)}function h(n){for(var e=arguments.length,t=Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return 0===arguments.length?n=k.ident:((0,k.check)(n,k.is.notUndef,"select(selector,[...]): argument selector is undefined"),(0,k.check)(n,k.is.func,"select(selector,[...]): argument "+n+" is not a function")),M(T,{selector:n,args:t})}function y(n,e){return(0,k.check)(n,k.is.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&((0,k.check)(e,k.is.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),(0,k.check)(e,k.is.notUndef,"actionChannel(pattern, buffer): argument "+e+" is not a valid buffer")),M(R,{pattern:n,buffer:e})}function b(){return M(x,{})}function m(n){return(0,k.check)(n,k.is.channel,"flush(channel): argument "+n+" is not valid channel"),M(U,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.asEffect=void 0;var E=function(){function n(n,e){var t=[],r=!0,o=!1,u=void 0;try{for(var a,i=n[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(c){o=!0,u=c}finally{try{!r&&i.return&&i.return()}finally{if(o)throw u}}return t}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return n(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.take=o,e.takem=u,e.put=a,e.race=i,e.call=f,e.apply=l,e.cps=s,e.fork=d,e.spawn=v,e.join=p,e.cancel=g,e.select=h,e.actionChannel=y,e.cancelled=b,e.flush=m;var k=t(1),O=(0,k.sym)("IO"),_="TAKE",A="PUT",j="RACE",C="CALL",w="CPS",P="FORK",N="JOIN",S="CANCEL",T="SELECT",R="ACTION_CHANNEL",x="CANCELLED",U="FLUSH",M=function(n,e){var t;return t={},r(t,O,!0),r(t,n,e),t};a.sync=function(){var n=a.apply(void 0,arguments);return n[A].sync=!0,n};var I=function(n){return n[k.TASK]};e.asEffect={take:function(n){return n&&n[O]&&n[_]},put:function(n){return n&&n[O]&&n[A]},race:function(n){return n&&n[O]&&n[j]},call:function(n){return n&&n[O]&&n[C]},cps:function(n){return n&&n[O]&&n[w]},fork:function(n){return n&&n[O]&&n[P]},join:function(n){return n&&n[O]&&n[N]},cancel:function(n){return n&&n[O]&&n[S]},select:function(n){return n&&n[O]&&n[T]},actionChannel:function(n){return n&&n[O]&&n[R]},cancelled:function(n){return n&&n[O]&&n[x]},flush:function(n){return n&&n[O]&&n[U]}}},function(n,e,t){"use strict";function r(n,e){for(var t in e){var r=e[t];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,t,r)}return n}function o(n){if(Array.isArray(n)){for(var e=0,t=Array(n.length);e<n.length;e++)t[e]=n[e];return t}return Array.from(n)}function u(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function a(n){return("*"===n?E.wildcard:s.is.array(n)?E.array:s.is.func(n)?E.predicate:E.default)(n)}function i(n,e,t){function r(n){u(),t(n,!0)}function o(n){a.push(n),n.cont=function(o,u){c||((0,s.remove)(a,n),n.cont=s.noop,u?r(o):(n===e&&(i=o),a.length||(c=!0,t(i))))}}function u(){c||(c=!0,a.forEach(function(n){n.cont=s.noop,n.cancel()}),a=[])}var a=[],i=void 0,c=!1;return o(e),{addTask:o,cancelAll:u,abort:r,getTasks:function(){return a},taskNames:function(){return a.map(function(n){return n.name})}}}function c(n){var e=n.context,t=n.fn,r=n.args;if(s.is.iterator(t))return t;var o=void 0,u=void 0;try{o=t.apply(e,r)}catch(a){u=a}return s.is.iterator(o)?o:u?(0,s.makeIterator)(function(){throw u}):(0,s.makeIterator)(function(){var n=void 0,e={done:!1,value:o},t=function(n){return{done:!0,value:n}};return function(r){return n?t(r):(n=!0,e)}}())}function f(n){return{fn:n}}function l(n){function e(){Z.isRunning&&!Z.isCancelled&&(Z.isCancelled=!0,E(m))}function t(){n._isRunning&&!n._isCancelled&&(n._isCancelled=!0,$.cancelAll(),k(m))}function E(e,t){if(!Z.isRunning)throw new Error("Trying to resume an already finished generator");try{var r=void 0;t?r=n.throw(e):e===m?(Z.isCancelled=!0,E.cancel(),r=s.is.func(n.return)?n.return(m):{done:!0,value:m}):r=e===b?s.is.func(n.return)?n.return():{done:!0}:n.next(e),r.done?(Z.isMainRunning=!1,Z.cont&&Z.cont(r.value)):O(r.value,G,"",E)}catch(o){Z.isCancelled&&Q("error","uncaught at "+B,o.message),Z.isMainRunning=!1,Z.cont(o,!0)}}function k(e,t){n._isRunning=!1,X.close(),t?(e instanceof Error&&(e.sagaStack="at "+B+" \n "+(e.sagaStack||e.stack)),Y.cont||(Q("error","uncaught",e.sagaStack||e.stack),e instanceof Error&&z&&z(e)),n._error=e,n._isAborted=!0,n._deferredEnd&&n._deferredEnd.reject(e)):(e===m&&h&&Q("info",B+" has been cancelled",""),n._result=e,n._deferredEnd&&n._deferredEnd.resolve(e)),Y.cont&&Y.cont(e,t),Y.joiners.forEach(function(n){return n.cb(e,t)}),Y.joiners=null}function O(n,e){function t(n,e){a||(a=!0,o.cancel=s.noop,W&&(e?W.effectRejected(u,n):W.effectResolved(u,n)),o(n,e))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments[3],u=(0,s.uid)();W&&W.effectTriggered({effectId:u,parentEffectId:e,label:r,effect:n});var a=void 0;t.cancel=s.noop,o.cancel=function(){if(!a){a=!0;try{t.cancel()}catch(n){Q("error","uncaught at "+B,n.message)}t.cancel=s.noop,W&&W.effectCancelled(u)}};var i=void 0;return s.is.promise(n)?_(n,t):s.is.helper(n)?N(f(n),u,t):s.is.iterator(n)?A(n,u,B,t):s.is.array(n)?R(n,u,t):s.is.notUndef(i=v.asEffect.take(n))?j(i,t):s.is.notUndef(i=v.asEffect.put(n))?C(i,t):s.is.notUndef(i=v.asEffect.race(n))?x(i,u,t):s.is.notUndef(i=v.asEffect.call(n))?w(i,u,t):s.is.notUndef(i=v.asEffect.cps(n))?P(i,t):s.is.notUndef(i=v.asEffect.fork(n))?N(i,u,t):s.is.notUndef(i=v.asEffect.join(n))?S(i,t):s.is.notUndef(i=v.asEffect.cancel(n))?T(i,t):s.is.notUndef(i=v.asEffect.select(n))?U(i,t):s.is.notUndef(i=v.asEffect.actionChannel(n))?M(i,t):s.is.notUndef(i=v.asEffect.flush(n))?L(i,t):s.is.notUndef(i=v.asEffect.cancelled(n))?I(i,t):t(n)}function _(n,e){var t=n[s.CANCEL];"function"==typeof t&&(e.cancel=t),n.then(e,function(n){return e(n,!0)})}function A(n,e,t,r){l(n,q,H,F,K,e,t,r)}function j(n,e){var t=n.channel,r=n.pattern,o=n.maybe;t=t||X;var u=function(n){return n instanceof Error?e(n,!0):e((0,p.isEnd)(n)&&!o?b:n)};try{t.take(u,a(r))}catch(i){return e(i,!0)}e.cancel=u.cancel}function C(n,e){var t=n.channel,r=n.action,o=n.sync;(0,d.asap)(function(){var n=void 0;try{n=(t?t.put:H)(r)}catch(u){if(t||o)return e(u,!0);Q("error","uncaught at "+B,u.stack||u.message||u)}return o&&s.is.promise(n)?void _(n,e):e(n)})}function w(n,e,t){var r=n.context,o=n.fn,u=n.args,a=void 0;try{a=o.apply(r,u)}catch(i){return t(i,!0)}return s.is.promise(a)?_(a,t):s.is.iterator(a)?A(a,e,o.name,t):t(a)}function P(n,e){var t=n.context,r=n.fn,o=n.args;try{!function(){var n=function(n,t){return s.is.undef(n)?e(t):e(n,!0)};r.apply(t,o.concat(n)),n.cancel&&(e.cancel=function(){return n.cancel()})}()}catch(u){return e(u,!0)}}function N(n,e,t){var r=n.context,o=n.fn,u=n.args,a=n.detached,i=c({context:r,fn:o,args:u});try{(0,d.suspend)();var f=l(i,q,H,F,K,e,o.name,a?null:s.noop);a?t(f):i._isRunning?($.addTask(f),t(f)):i._error?$.abort(i._error):t(f)}finally{(0,d.flush)()}}function S(n,e){n.isRunning()?!function(){var t={task:Y,cb:e};e.cancel=function(){return(0,s.remove)(n.joiners,t)},n.joiners.push(t)}():n.isAborted()?e(n.error(),!0):e(n.result())}function T(n,e){n.isRunning()&&n.cancel(),e()}function R(n,e,t){function r(){o===a.length&&(u=!0,t(a))}if(!n.length)return t([]);var o=0,u=void 0,a=Array(n.length),i=n.map(function(n,e){var i=function(n,i){u||(i||(0,p.isEnd)(n)||n===b||n===m?(t.cancel(),t(n,i)):(a[e]=n,o++,r()))};return i.cancel=s.noop,i});t.cancel=function(){u||(u=!0,i.forEach(function(n){return n.cancel()}))},n.forEach(function(n,t){return O(n,e,t,i[t])})}function x(n,e,t){var r=void 0,o=Object.keys(n),a={};o.forEach(function(n){var e=function(e,o){r||(o?(t.cancel(),t(e,!0)):(0,p.isEnd)(e)||e===b||e===m||(t.cancel(),r=!0,t(u({},n,e))))};e.cancel=s.noop,a[n]=e}),t.cancel=function(){r||(r=!0,o.forEach(function(n){return a[n].cancel()}))},o.forEach(function(t){r||O(n[t],e,t,a[t])})}function U(n,e){var t=n.selector,r=n.args;try{var u=t.apply(void 0,[F()].concat(o(r)));e(u)}catch(a){e(a,!0)}}function M(n,e){var t=n.pattern,r=n.buffer,o=a(t);o.pattern=t,e((0,p.eventChannel)(q,r||g.buffers.fixed(),o))}function I(n,e){e(!!Z.isCancelled)}function L(n,e){n.flush(e)}function D(n,e,o,a){var i,c,f;return o._deferredEnd=null,c={},u(c,s.TASK,!0),u(c,"id",n),u(c,"name",e),i="done",f={},f[i]=f[i]||{},f[i].get=function(){if(o._deferredEnd)return o._deferredEnd.promise;var n=(0,s.deferred)();return o._deferredEnd=n,o._isRunning||(o._error?n.reject(o._error):n.resolve(o._result)),n.promise},u(c,"cont",a),u(c,"joiners",[]),u(c,"cancel",t),u(c,"isRunning",function(){return o._isRunning}),u(c,"isCancelled",function(){return o._isCancelled}),u(c,"isAborted",function(){return o._isAborted}),u(c,"result",function(){return o._result}),u(c,"error",function(){return o._error}),r(c,f),c}var q=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return s.noop},H=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.noop,F=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.noop,K=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},G=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,B=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"anonymous",V=arguments[7];(0,s.check)(n,s.is.iterator,y);var W=K.sagaMonitor,J=K.logger,z=K.onError,Q=J||s.log,X=(0,p.stdChannel)(q);E.cancel=s.noop;var Y=D(G,B,n,V),Z={name:B,cancel:e,isRunning:!0},$=i(B,Z,k);return V&&(V.cancel=t),n._isRunning=!0,E(),Y}Object.defineProperty(e,"__esModule",{value:!0}),e.TASK_CANCEL=e.CHANNEL_END=e.NOT_ITERATOR_ERROR=void 0,e.default=l;var s=t(1),d=t(6),v=t(4),p=t(3),g=t(2),h=!1,y=e.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",b=e.CHANNEL_END={toString:function(){return"@@redux-saga/CHANNEL_END"}},m=e.TASK_CANCEL={toString:function(){return"@@redux-saga/TASK_CANCEL"}},E={wildcard:function(){return s.kTrue},"default":function(n){return function(e){return e.type===n}},array:function(n){return function(e){return n.some(function(n){return n===e.type})}},predicate:function(n){return function(e){return n(e)}}}},function(n,e){"use strict";function t(n){try{o(),n()}finally{u()}}function r(n){i?a.push(n):t(n)}function o(){i++}function u(){i--,!i&&a.length&&t(a.shift())}Object.defineProperty(e,"__esModule",{value:!0}),e.asap=r,e.suspend=o,e.flush=u;var a=[],i=0},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(4);Object.defineProperty(e,"take",{enumerable:!0,get:function(){return r.take}}),Object.defineProperty(e,"takem",{enumerable:!0,get:function(){return r.takem}}),Object.defineProperty(e,"put",{enumerable:!0,get:function(){return r.put}}),Object.defineProperty(e,"race",{enumerable:!0,get:function(){return r.race}}),Object.defineProperty(e,"call",{enumerable:!0,get:function(){return r.call}}),Object.defineProperty(e,"apply",{enumerable:!0,get:function(){return r.apply}}),Object.defineProperty(e,"cps",{enumerable:!0,get:function(){return r.cps}}),Object.defineProperty(e,"fork",{enumerable:!0,get:function(){return r.fork}}),Object.defineProperty(e,"spawn",{enumerable:!0,get:function(){return r.spawn}}),Object.defineProperty(e,"join",{enumerable:!0,get:function(){return r.join}}),Object.defineProperty(e,"cancel",{enumerable:!0,get:function(){return r.cancel}}),Object.defineProperty(e,"select",{enumerable:!0,get:function(){return r.select}}),Object.defineProperty(e,"actionChannel",{enumerable:!0,get:function(){return r.actionChannel}}),Object.defineProperty(e,"cancelled",{enumerable:!0,get:function(){return r.cancelled}}),Object.defineProperty(e,"flush",{enumerable:!0,get:function(){return r.flush}})},function(n,e,t){"use strict";function r(n){return n&&n.__esModule?n:{"default":n}}function o(n){if(Array.isArray(n)){for(var e=0,t=Array(n.length);e<n.length;e++)t[e]=n[e];return t}return Array.from(n)}function u(){function n(n){function u(n,t,r){return(0,c.default)(n.apply(void 0,o(t)),d.subscribe,v,i,e,r,n.name)}var i=n.getState,s=n.dispatch;t=u;var d=(0,l.emitter)(),v=(0,a.wrapSagaDispatch)(s);return function(n){return function(e){r&&r.actionDispatched(e);var t=n(e);return e[a.SAGA_ACTION]?d.emit(e):(0,f.asap)(function(){return d.emit(e)}),t}}}var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=void 0,r=e.sagaMonitor;if(a.is.func(e))throw new Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(e.logger&&!a.is.func(e.logger))throw new Error("`options.logger` passed to the Saga middleware is not a function!");if(e.onerror&&!a.is.func(e.onerror))throw new Error("`options.onerror` passed to the Saga middleware is not a function!");return n.run=function(n){for(var e=arguments.length,o=Array(e>1?e-1:0),u=1;u<e;u++)o[u-1]=arguments[u];(0,a.check)(t,a.is.notUndef,"Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware"),(0,a.check)(n,a.is.func,"sagaMiddleware.run(saga, ...args): saga argument must be a Generator function!");var i=(0,a.uid)();r&&r.effectTriggered({effectId:i,root:!0,parentEffectId:0,effect:{root:!0,saga:n,args:o}});var c=t(n,o,i);return r&&r.effectResolved(i,c),c},n}Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var a=t(1),i=t(5),c=r(i),f=t(6),l=t(3)},function(n,e,t){"use strict";function r(n){return n&&n.__esModule?n:{"default":n}}function o(n,e){var t=e.subscribe,r=e.dispatch,o=e.getState,a=e.sagaMonitor,c=e.logger;(0,u.check)(n,u.is.iterator,"runSaga must be called on an iterator");var f=(0,u.uid)();a&&(r=(0,u.wrapSagaDispatch)(r),a.effectTriggered({effectId:f,root:!0,parentEffectId:0,effect:{root:!0,saga:n,args:[]}}));var l=(0,i.default)(n,t,r,o,{sagaMonitor:a,logger:c},f,n.name);return a&&a.effectResolved(f,l),l}Object.defineProperty(e,"__esModule",{value:!0}),e.runSaga=o;var u=t(1),a=t(5),i=r(a)},function(n,e,t){"use strict";function r(n,e){function t(e,t){if(u===p)return v;if(t)throw u=p,t;o&&o(e);var r=n[u](),a=c(r,3),i=a[0],f=a[1],l=a[2];return u=i,o=l,u===p?v:f}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iterator",o=void 0,u=e;return(0,l.makeIterator)(t,function(n){return t(null,n)},r,!0)}function o(n){return Array.isArray(n)?String(n.map(function(n){return String(n)})):String(n)}function u(n,e){for(var t=arguments.length,u=Array(t>2?t-2:0),a=2;a<t;a++)u[a-2]=arguments[a];var i={done:!1,value:(0,s.take)(n)},c=function(n){return{done:!1,value:s.fork.apply(void 0,[e].concat(u,[n]))}},l=void 0,d=function(n){return l=n};return r({q1:function(){return["q2",i,d]},q2:function(){return l===f.END?[p]:["q1",c(l)]}},"q1","takeEvery("+o(n)+", "+e.name+")")}function a(n,e){for(var t=arguments.length,u=Array(t>2?t-2:0),a=2;a<t;a++)u[a-2]=arguments[a];var i={done:!1,value:(0,s.take)(n)},c=function(n){return{done:!1,value:s.fork.apply(void 0,[e].concat(u,[n]))}},l=function(n){return{done:!1,value:(0,s.cancel)(n)}},d=void 0,v=void 0,g=function(n){return d=n},h=function(n){return v=n};return r({q1:function(){return["q2",i,h]},q2:function(){return v===f.END?[p]:d?["q3",l(d)]:["q1",c(v),g]},q3:function(){return["q1",c(v),g]}},"q1","takeLatest("+o(n)+", "+e.name+")")}function i(n,e,t){for(var u=arguments.length,a=Array(u>3?u-3:0),i=3;i<u;i++)a[i-3]=arguments[i];var c=void 0,v=void 0,g={done:!1,value:(0,s.actionChannel)(e,d.buffers.sliding(1))},h=function(){return{done:!1,value:(0,s.take)(v,e)}},y=function(n){return{done:!1,value:s.fork.apply(void 0,[t].concat(a,[n]))}},b={done:!1,value:(0,s.call)(l.delay,n)},m=function(n){return c=n},E=function(n){return v=n};return r({q1:function(){return["q2",g,E]},q2:function(){return["q3",h(),m]},q3:function(){return c===f.END?[p]:["q4",y(c)]},q4:function(){return["q2",b]}},"q1","throttle("+o(e)+", "+t.name+")")}Object.defineProperty(e,"__esModule",{value:!0});var c=function(){function n(n,e){var t=[],r=!0,o=!1,u=void 0;try{for(var a,i=n[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(c){o=!0,u=c}finally{try{!r&&i.return&&i.return()}finally{if(o)throw u}}return t}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return n(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.takeEvery=u,e.takeLatest=a,e.throttle=i;var f=t(3),l=t(1),s=t(4),d=t(2),v={done:!0,value:void 0},p={}},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(1);Object.defineProperty(e,"TASK",{enumerable:!0,get:function(){return r.TASK}}),Object.defineProperty(e,"SAGA_ACTION",{enumerable:!0,get:function(){return r.SAGA_ACTION}}),Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return r.noop}}),Object.defineProperty(e,"is",{enumerable:!0,get:function(){return r.is}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return r.deferred}}),Object.defineProperty(e,"arrayOfDeffered",{enumerable:!0,get:function(){return r.arrayOfDeffered}}),Object.defineProperty(e,"createMockTask",{enumerable:!0,get:function(){return r.createMockTask}});var o=t(4);Object.defineProperty(e,"CHANNEL_END",{enumerable:!0,get:function(){return o.CHANNEL_END}}),Object.defineProperty(e,"asEffect",{enumerable:!0,get:function(){return o.asEffect}})}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.effects=n.CANCEL=n.delay=n.throttle=n.takeLatest=n.takeEvery=n.buffers=n.channel=n.eventChannel=n.END=n.runSaga=void 0;var a=t(10);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return a.runSaga}});var u=t(2);Object.defineProperty(n,"END",{enumerable:!0,get:function(){return u.END}}),Object.defineProperty(n,"eventChannel",{enumerable:!0,get:function(){return u.eventChannel}}),Object.defineProperty(n,"channel",{enumerable:!0,get:function(){return u.channel}});var i=t(3);Object.defineProperty(n,"buffers",{enumerable:!0,get:function(){return i.buffers}});var c=t(6);Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return c.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return c.takeLatest}}),Object.defineProperty(n,"throttle",{enumerable:!0,get:function(){return c.throttle}});var f=t(1);Object.defineProperty(n,"delay",{enumerable:!0,get:function(){return f.delay}}),Object.defineProperty(n,"CANCEL",{enumerable:!0,get:function(){return f.CANCEL}});var l=t(9),s=o(l),d=t(8),p=r(d),v=t(11),h=r(v);n.default=s.default,n.effects=p,n.utils=h},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n,t){if(!n(e))throw d("error","uncaught at check",t),new Error(t)}function a(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=h({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function i(e){for(var n=[],t=0;t<e;t++)n.push(u());return n}function c(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=void 0,r=new Promise(function(r){t=setTimeout(function(){return r(n)},e)});return r[k]=function(){return clearTimeout(t)},r}function f(){var e,n=!0,t=void 0,o=void 0;return e={},r(e,b,!0),r(e,"isRunning",function(){return n}),r(e,"result",function(){return t}),r(e,"error",function(){return o}),r(e,"setRunning",function(e){return n=e}),r(e,"setResult",function(e){return t=e}),r(e,"setError",function(e){return o=e}),e}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++e}}function s(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:t,next:e,"throw":n,"return":C};return r&&(o[m]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function d(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"undefined"==typeof window?console.log("redux-saga "+e+": "+n+"\n"+(t&&t.stack||t)):console[e](n,t)}function p(e,n){return function(){return _&&d("warn",n),e.apply(void 0,arguments)}}function v(e){return function(n){var t=Object.defineProperty(n,E,{value:!0});return e(t)}}Object.defineProperty(n,"__esModule",{value:!0});var h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n.check=o,n.remove=a,n.deferred=u,n.arrayOfDeffered=i,n.delay=c,n.createMockTask=f,n.autoInc=l,n.makeIterator=s,n.log=d,n.deprecate=p,n.wrapSagaDispatch=v;var y=n.sym=function(e){return"@@redux-saga/"+e},b=n.TASK=y("TASK"),m=n.HELPER=y("HELPER"),k=(n.MATCH=y("MATCH"),n.CANCEL=y("cancelPromise")),E=n.SAGA_ACTION=y("SAGA_ACTION"),O=n.konst=function(e){return function(){return e}},_=(n.kTrue=O(!0),n.kFalse=O(!1),n.noop=function(){},n.ident=function(e){return e},n.isDev=!1),j=n.is={undef:function(e){return null===e||void 0===e},notUndef:function(e){return null!==e&&void 0!==e},func:function(e){return"function"==typeof e},number:function(e){return"number"==typeof e},array:Array.isArray,promise:function(e){return e&&j.func(e.then)},iterator:function(e){return e&&j.func(e.next)&&j.func(e.throw)},task:function(e){return e&&e[b]},observable:function(e){return e&&j.func(e.subscribe)},buffer:function(e){return e&&j.func(e.isEmpty)&&j.func(e.take)&&j.func(e.put)},pattern:function(e){return e&&("string"==typeof e||"symbol"===("undefined"==typeof e?"undefined":g(e))||j.func(e)||j.array(e))},channel:function(e){return e&&j.func(e.take)&&j.func(e.close)},helper:function(e){return e&&e[m]}},A=(n.uid=l(),function(e){throw e}),C=function(e){return{value:e,done:!0}};n.internalErr=function(e){return new 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: "+e+"\n")}},function(e,n,t){"use strict";function r(){function e(e){return t.push(e),function(){return(0,c.remove)(t,e)}}function n(e){for(var n=t.slice(),r=0,o=n.length;r<o;r++)n[r](e)}var t=[];return{subscribe:e,emit:n}}function o(){function e(){if(u&&i.length)throw(0,c.internalErr)("Cannot have a closed channel with pending takers");if(i.length&&!a.isEmpty())throw(0,c.internalErr)("Cannot have pending takers with non empty buffer")}function n(n){if(e(),(0,c.check)(n,c.is.notUndef,h),!u){if(!i.length)return a.put(n);for(var t=0;t<i.length;t++){var r=i[t];if(!r[c.MATCH]||r[c.MATCH](n))return i.splice(t,1),r(n)}}}function t(n){e(),(0,c.check)(n,c.is.func,"channel.take's callback must be a function"),u&&a.isEmpty()?n(d):a.isEmpty()?(i.push(n),n.cancel=function(){return(0,c.remove)(i,n)}):n(a.take())}function r(n){return e(),(0,c.check)(n,c.is.func,"channel.flush' callback must be a function"),u&&a.isEmpty()?void n(d):void n(a.flush())}function o(){if(e(),!u&&(u=!0,i.length)){var n=i;i=[];for(var t=0,r=n.length;t<r;t++)n[t](d)}}var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f.buffers.fixed(),u=!1,i=[];return(0,c.check)(a,c.is.buffer,v),{take:t,put:n,flush:r,close:o,get __takers__(){return i},get __closed__(){return u}}}function a(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.buffers.none(),t=arguments[2];arguments.length>2&&(0,c.check)(t,c.is.func,"Invalid match function passed to eventChannel");var r=o(n),a=e(function(e){return p(e)?void r.close():void(t&&!t(e)||r.put(e))});if(!c.is.func(a))throw new Error("in eventChannel: subscribe should return a function to unsubscribe");return{take:r.take,flush:r.flush,close:function(){r.__closed__||(r.close(),a())}}}function u(e){var n=a(function(n){return e(function(e){return e[c.SAGA_ACTION]?void n(e):void(0,l.asap)(function(){return n(e)})})});return i({},n,{take:function(e,t){arguments.length>1&&((0,c.check)(t,c.is.func,"channel.take's matcher argument must be a function"),e[c.MATCH]=t),n.take(e)}})}Object.defineProperty(n,"__esModule",{value:!0}),n.UNDEFINED_INPUT_ERROR=n.INVALID_BUFFER=n.isEnd=n.END=void 0;var i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};n.emitter=r,n.channel=o,n.eventChannel=a,n.stdChannel=u;var c=t(1),f=t(3),l=t(7),s="@@redux-saga/CHANNEL_END",d=n.END={type:s},p=n.isEnd=function(e){return e&&e.type===s},v=n.INVALID_BUFFER="invalid buffer passed to channel factory function",h=n.UNDEFINED_INPUT_ERROR="Saga was provided with an undefined action"},function(e,n,t){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,n=arguments[1],t=new Array(e),r=0,o=0,i=0,l=function(n){t[o]=n,o=(o+1)%e,r++},s=function(){if(0!=r){var n=t[i];return t[i]=null,r--,i=(i+1)%e,n}},d=function(){for(var e=[];r;)e.push(s());return e};return{isEmpty:function(){return 0==r},put:function(s){if(r<e)l(s);else{var p=void 0;switch(n){case u:throw new Error(a);case c:t[o]=s,o=(o+1)%e,i=o;break;case f:p=2*e,t=d(),r=t.length,o=t.length,i=0,t.length=p,e=p,l(s)}}},take:s,flush:d}}Object.defineProperty(n,"__esModule",{value:!0}),n.buffers=n.BUFFER_OVERFLOW=void 0;var o=t(1),a=n.BUFFER_OVERFLOW="Channel's Buffer overflow!",u=1,i=2,c=3,f=4,l={isEmpty:o.kTrue,put:o.noop,take:o.noop};n.buffers={none:function(){return l},fixed:function(e){return r(e,u)},dropping:function(e){return r(e,i)},sliding:function(e){return r(e,c)},expanding:function(e){return r(e,f)}}},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";if(arguments.length&&(0,_.check)(arguments[0],_.is.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),_.is.pattern(e))return H(C,{pattern:e});if(_.is.channel(e))return H(C,{channel:e});throw new Error("take(patternOrChannel): argument "+String(e)+" is not valid channel or a valid pattern")}function a(e,n){return arguments.length>1?((0,_.check)(e,_.is.notUndef,"put(channel, action): argument channel is undefined"),(0,_.check)(e,_.is.channel,"put(channel, action): argument "+e+" is not a valid channel"),(0,_.check)(n,_.is.notUndef,"put(channel, action): argument action is undefined")):((0,_.check)(e,_.is.notUndef,"put(action): argument action is undefined"),n=e,e=null),H(w,{channel:e,action:n})}function u(e){return H(P,e)}function i(e,n,t){(0,_.check)(n,_.is.notUndef,e+": argument fn is undefined");var r=null;if(_.is.array(n)){var o=n,a=O(o,2);r=a[0],n=a[1]}else if(n.fn){var u=n;r=u.context,n=u.fn}return(0,_.check)(n,_.is.func,e+": argument "+n+" is not a function"),{context:r,fn:n,args:t}}function c(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return H(T,i("call",e,t))}function f(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return H(T,i("apply",{context:e,fn:n},t))}function l(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return H(N,i("cps",e,t))}function s(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return H(S,i("fork",e,t))}function d(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=s.apply(void 0,[e].concat(t));return o[S].detached=!0,o}function p(e){if((0,_.check)(e,_.is.notUndef,"join(task): argument task is undefined"),!q(e))throw new Error("join(task): argument "+e+" is not a valid Task object \n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)");return H(R,e)}function v(e){if((0,_.check)(e,_.is.notUndef,"cancel(task): argument task is undefined"),!q(e))throw new Error("cancel(task): argument "+e+" is not a valid Task object \n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)");return H(x,e)}function h(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return 0===arguments.length?e=_.ident:((0,_.check)(e,_.is.notUndef,"select(selector,[...]): argument selector is undefined"),(0,_.check)(e,_.is.func,"select(selector,[...]): argument "+e+" is not a function")),H(L,{selector:e,args:t})}function g(e,n){return(0,_.check)(e,_.is.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&((0,_.check)(n,_.is.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),(0,_.check)(n,_.is.notUndef,"actionChannel(pattern, buffer): argument "+n+" is not a valid buffer")),H(U,{pattern:e,buffer:n})}function y(){return H(M,{})}function b(e){return(0,_.check)(e,_.is.channel,"flush(channel): argument "+e+" is not valid channel"),H(I,e)}function m(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];return s.apply(void 0,[j.takeEveryHelper,e,n].concat(r))}function k(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];return s.apply(void 0,[j.takeLatestHelper,e,n].concat(r))}function E(e,n,t){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];return s.apply(void 0,[j.throttleHelper,e,n,t].concat(o))}Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.takem=void 0;var O=function(){function e(e,n){var t=[],r=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(r=(u=i.next()).done)&&(t.push(u.value),!n||t.length!==n);r=!0);}catch(c){o=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(o)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.take=o,n.put=a,n.race=u,n.call=c,n.apply=f,n.cps=l,n.fork=s,n.spawn=d,n.join=p,n.cancel=v,n.select=h,n.actionChannel=g,n.cancelled=y,n.flush=b,n.takeEvery=m,n.takeLatest=k,n.throttle=E;var _=t(1),j=t(6),A=(0,_.sym)("IO"),C="TAKE",w="PUT",P="RACE",T="CALL",N="CPS",S="FORK",R="JOIN",x="CANCEL",L="SELECT",U="ACTION_CHANNEL",M="CANCELLED",I="FLUSH",D=function(e,n){return e+" has been deprecated in favor of "+n+", please update your code"},H=function(e,n){var t;return t={},r(t,A,!0),r(t,e,n),t};o.maybe=function(){var e=o.apply(void 0,arguments);return e[C].maybe=!0,e};n.takem=(0,_.deprecate)(o.maybe,D("takem","take.maybe"));a.resolve=function(){var e=a.apply(void 0,arguments);return e[w].resolve=!0,e},a.sync=(0,_.deprecate)(a.resolve,D("put.sync","put.resolve"));var q=function(e){return e[_.TASK]},F=function(e){return function(n){return n&&n[A]&&n[e]}};n.asEffect={take:F(C),put:F(w),race:F(P),call:F(T),cps:F(N),fork:F(S),join:F(R),cancel:F(x),select:F(L),actionChannel:F(U),cancelled:F(M),flush:F(I)}},function(e,n,t){"use strict";function r(e,n){for(var t in n){var r=n[t];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,t,r)}return e}function o(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(e){return("*"===e?b.wildcard:l.is.array(e)?b.array:l.is.func(e)?b.predicate:b.default)(e)}function i(e,n,t){function r(e){a(),t(e,!0)}function o(e){u.push(e),e.cont=function(o,a){c||((0,l.remove)(u,e),e.cont=l.noop,a?r(o):(e===n&&(i=o),u.length||(c=!0,t(i))))}}function a(){c||(c=!0,u.forEach(function(e){e.cont=l.noop,e.cancel()}),u=[])}var u=[],i=void 0,c=!1;return o(n),{addTask:o,cancelAll:a,abort:r,getTasks:function(){return u},taskNames:function(){return u.map(function(e){return e.name})}}}function c(e){var n=e.context,t=e.fn,r=e.args;if(l.is.iterator(t))return t;var o=void 0,a=void 0;try{o=t.apply(n,r)}catch(u){a=u}return l.is.iterator(o)?o:a?(0,l.makeIterator)(function(){throw a}):(0,l.makeIterator)(function(){var e=void 0,n={done:!1,value:o},t=function(e){return{done:!0,value:e}};return function(r){return e?t(r):(e=!0,n)}}())}function f(e){function n(){Y.isRunning&&!Y.isCancelled&&(Y.isCancelled=!0,b(y))}function t(){e._isRunning&&!e._isCancelled&&(e._isCancelled=!0,Z.cancelAll(),k(y))}function b(n,t){if(!Y.isRunning)throw new Error("Trying to resume an already finished generator");try{var r=void 0;t?r=e.throw(n):n===y?(Y.isCancelled=!0,b.cancel(),r=l.is.func(e.return)?e.return(y):{done:!0,value:y}):r=n===g?l.is.func(e.return)?e.return():{done:!0}:e.next(n),r.done?(Y.isMainRunning=!1,Y.cont&&Y.cont(r.value)):E(r.value,K,"",b)}catch(o){Y.isCancelled&&z("error","uncaught at "+G,o.message),Y.isMainRunning=!1,Y.cont(o,!0)}}function k(n,t){e._isRunning=!1,Q.close(),t?(n instanceof Error&&(n.sagaStack="at "+G+" \n "+(n.sagaStack||n.stack)),X.cont||(z("error","uncaught",n.sagaStack||n.stack),n instanceof Error&&J&&J(n)),e._error=n,e._isAborted=!0,e._deferredEnd&&e._deferredEnd.reject(n)):(n===y&&l.isDev&&z("info",G+" has been cancelled",""),e._result=n,e._deferredEnd&&e._deferredEnd.resolve(n)),X.cont&&X.cont(n,t),X.joiners.forEach(function(e){return e.cb(n,t)}),X.joiners=null}function E(e,n){function t(e,n){u||(u=!0,o.cancel=l.noop,V&&(n?V.effectRejected(a,e):V.effectResolved(a,e)),o(e,n))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments[3],a=(0,l.uid)();V&&V.effectTriggered({effectId:a,parentEffectId:n,label:r,effect:e});var u=void 0;t.cancel=l.noop,o.cancel=function(){if(!u){u=!0;try{t.cancel()}catch(e){z("error","uncaught at "+G,e.message)}t.cancel=l.noop,V&&V.effectCancelled(a)}};var i=void 0;return l.is.promise(e)?O(e,t):l.is.helper(e)?P(m(e),a,t):l.is.iterator(e)?_(e,a,G,t):l.is.array(e)?S(e,a,t):l.is.notUndef(i=d.asEffect.take(e))?j(i,t):l.is.notUndef(i=d.asEffect.put(e))?A(i,t):l.is.notUndef(i=d.asEffect.race(e))?R(i,a,t):l.is.notUndef(i=d.asEffect.call(e))?C(i,a,t):l.is.notUndef(i=d.asEffect.cps(e))?w(i,t):l.is.notUndef(i=d.asEffect.fork(e))?P(i,a,t):l.is.notUndef(i=d.asEffect.join(e))?T(i,t):l.is.notUndef(i=d.asEffect.cancel(e))?N(i,t):l.is.notUndef(i=d.asEffect.select(e))?x(i,t):l.is.notUndef(i=d.asEffect.actionChannel(e))?L(i,t):l.is.notUndef(i=d.asEffect.flush(e))?M(i,t):l.is.notUndef(i=d.asEffect.cancelled(e))?U(i,t):t(e)}function O(e,n){var t=e[l.CANCEL];"function"==typeof t&&(n.cancel=t),e.then(n,function(e){return n(e,!0)})}function _(e,n,t,r){f(e,D,H,q,F,n,t,r)}function j(e,n){var t=e.channel,r=e.pattern,o=e.maybe;t=t||Q;var a=function(e){return e instanceof Error?n(e,!0):n((0,p.isEnd)(e)&&!o?g:e)};try{t.take(a,u(r))}catch(i){return n(i,!0)}n.cancel=a.cancel}function A(e,n){var t=e.channel,r=e.action,o=e.resolve;(0,s.asap)(function(){var e=void 0;try{e=(t?t.put:H)(r)}catch(a){if(t||o)return n(a,!0);z("error","uncaught at "+G,a.stack||a.message||a)}return o&&l.is.promise(e)?void O(e,n):n(e)})}function C(e,n,t){var r=e.context,o=e.fn,a=e.args,u=void 0;try{u=o.apply(r,a)}catch(i){return t(i,!0)}return l.is.promise(u)?O(u,t):l.is.iterator(u)?_(u,n,o.name,t):t(u)}function w(e,n){var t=e.context,r=e.fn,o=e.args;try{!function(){var e=function(e,t){return l.is.undef(e)?n(t):n(e,!0)};r.apply(t,o.concat(e)),e.cancel&&(n.cancel=function(){return e.cancel()})}()}catch(a){return n(a,!0)}}function P(e,n,t){var r=e.context,o=e.fn,a=e.args,u=e.detached,i=c({context:r,fn:o,args:a});try{(0,s.suspend)();var d=f(i,D,H,q,F,n,o.name,u?null:l.noop);u?t(d):i._isRunning?(Z.addTask(d),t(d)):i._error?Z.abort(i._error):t(d)}finally{(0,s.flush)()}}function T(e,n){e.isRunning()?!function(){var t={task:X,cb:n};n.cancel=function(){return(0,l.remove)(e.joiners,t)},e.joiners.push(t)}():e.isAborted()?n(e.error(),!0):n(e.result())}function N(e,n){e.isRunning()&&e.cancel(),n()}function S(e,n,t){function r(){o===u.length&&(a=!0,t(u))}if(!e.length)return t([]);var o=0,a=void 0,u=Array(e.length),i=e.map(function(e,n){var i=function(e,i){a||(i||(0,p.isEnd)(e)||e===g||e===y?(t.cancel(),t(e,i)):(u[n]=e,o++,r()))};return i.cancel=l.noop,i});t.cancel=function(){a||(a=!0,i.forEach(function(e){return e.cancel()}))},e.forEach(function(e,t){return E(e,n,t,i[t])})}function R(e,n,t){var r=void 0,o=Object.keys(e),u={};o.forEach(function(e){var n=function(n,o){r||(o?(t.cancel(),t(n,!0)):(0,p.isEnd)(n)||n===g||n===y||(t.cancel(),r=!0,t(a({},e,n))))};n.cancel=l.noop,u[e]=n}),t.cancel=function(){r||(r=!0,o.forEach(function(e){return u[e].cancel()}))},o.forEach(function(t){r||E(e[t],n,t,u[t])})}function x(e,n){var t=e.selector,r=e.args;try{var a=t.apply(void 0,[q()].concat(o(r)));n(a)}catch(u){n(u,!0)}}function L(e,n){var t=e.pattern,r=e.buffer,o=u(t);o.pattern=t,n((0,p.eventChannel)(D,r||v.buffers.fixed(),o))}function U(e,n){n(!!Y.isCancelled)}function M(e,n){e.flush(n)}function I(e,n,o,u){var i,c,f;return o._deferredEnd=null,c={},a(c,l.TASK,!0),a(c,"id",e),a(c,"name",n),i="done",f={},f[i]=f[i]||{},f[i].get=function(){if(o._deferredEnd)return o._deferredEnd.promise;var e=(0,l.deferred)();return o._deferredEnd=e,o._isRunning||(o._error?e.reject(o._error):e.resolve(o._result)),e.promise},a(c,"cont",u),a(c,"joiners",[]),a(c,"cancel",t),a(c,"isRunning",function(){return o._isRunning}),a(c,"isCancelled",function(){return o._isCancelled}),a(c,"isAborted",function(){return o._isAborted}),a(c,"result",function(){return o._result}),a(c,"error",function(){return o._error}),r(c,f),c}var D=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return l.noop},H=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.noop,q=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.noop,F=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},K=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,G=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"anonymous",B=arguments[7];(0,l.check)(e,l.is.iterator,h);var V=F.sagaMonitor,W=F.logger,J=F.onError,z=W||l.log,Q=(0,p.stdChannel)(D);b.cancel=l.noop;var X=I(K,G,e,B),Y={name:G,cancel:n,isRunning:!0},Z=i(G,Y,k);return B&&(B.cancel=t),e._isRunning=!0,b(),X}Object.defineProperty(n,"__esModule",{value:!0}),n.TASK_CANCEL=n.CHANNEL_END=n.NOT_ITERATOR_ERROR=void 0,n.default=f;var l=t(1),s=t(7),d=t(4),p=t(2),v=t(3),h=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",g=n.CHANNEL_END={toString:function(){return"@@redux-saga/CHANNEL_END"}},y=n.TASK_CANCEL={toString:function(){return"@@redux-saga/TASK_CANCEL"}},b={wildcard:function(){return l.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},m=function(e){return{fn:e}}},function(e,n,t){"use strict";function r(e,n){function t(n,t){if(a===v)return p;if(t)throw a=v,t;o&&o(n);var r=e[a](),u=c(r,3),i=u[0],f=u[1],l=u[2];return a=i,o=l,a===v?p:f}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iterator",o=void 0,a=n;return(0,l.makeIterator)(t,function(e){return t(null,e)},r,!0)}function o(e){return l.is.channel(e)?"channel":Array.isArray(e)?String(e.map(function(e){return String(e)})):String(e)}function a(e,n){for(var t=arguments.length,a=Array(t>2?t-2:0),u=2;u<t;u++)a[u-2]=arguments[u];var i={done:!1,value:(0,s.take)(e)},c=function(e){return{done:!1,value:s.fork.apply(void 0,[n].concat(a,[e]))}},l=void 0,d=function(e){return l=e};return r({q1:function(){return["q2",i,d]},q2:function(){return l===f.END?[v]:["q1",c(l)]}},"q1","takeEvery("+o(e)+", "+n.name+")")}function u(e,n){for(var t=arguments.length,a=Array(t>2?t-2:0),u=2;u<t;u++)a[u-2]=arguments[u];var i={done:!1,value:(0,s.take)(e)},c=function(e){return{done:!1,value:s.fork.apply(void 0,[n].concat(a,[e]))}},l=function(e){return{done:!1,value:(0,s.cancel)(e)}},d=void 0,p=void 0,h=function(e){return d=e},g=function(e){return p=e};return r({q1:function(){return["q2",i,g]},q2:function(){return p===f.END?[v]:d?["q3",l(d)]:["q1",c(p),h]},q3:function(){return["q1",c(p),h]}},"q1","takeLatest("+o(e)+", "+n.name+")")}function i(e,n,t){for(var a=arguments.length,u=Array(a>3?a-3:0),i=3;i<a;i++)u[i-3]=arguments[i];var c=void 0,p=void 0,h={done:!1,value:(0,s.actionChannel)(n,d.buffers.sliding(1))},g=function(){return{done:!1,value:(0,s.take)(p,n)}},y=function(e){return{done:!1,value:s.fork.apply(void 0,[t].concat(u,[e]))}},b={done:!1,value:(0,s.call)(l.delay,e)},m=function(e){return c=e},k=function(e){return p=e};return r({q1:function(){return["q2",h,k]},q2:function(){return["q3",g(),m]},q3:function(){return c===f.END?[v]:["q4",y(c)]},q4:function(){return["q2",b]}},"q1","throttle("+o(n)+", "+t.name+")")}Object.defineProperty(n,"__esModule",{value:!0}),n.throttle=n.takeLatest=n.takeEvery=void 0;var c=function(){function e(e,n){var t=[],r=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(r=(u=i.next()).done)&&(t.push(u.value),!n||t.length!==n);r=!0);}catch(c){o=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(o)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.takeEveryHelper=a,n.takeLatestHelper=u,n.throttleHelper=i;var f=t(2),l=t(1),s=t(4),d=t(3),p={done:!0,value:void 0},v={},h=function(e){return"import "+e+" from 'redux-saga' has been deprecated in favor of import "+e+" from 'redux-saga/effects'.\nThe latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.\nTherefore yield "+e+" will return task descriptor to your saga and execute next lines of code."};n.takeEvery=(0,l.deprecate)(a,h("takeEvery")),n.takeLatest=(0,l.deprecate)(u,h("takeLatest")),n.throttle=(0,l.deprecate)(i,h("throttle"))},function(e,n){"use strict";function t(e){try{o(),e()}finally{a()}}function r(e){i?u.push(e):t(e)}function o(){i++}function a(){i--,!i&&u.length&&t(u.shift())}Object.defineProperty(n,"__esModule",{value:!0}),n.asap=r,n.suspend=o,n.flush=a;var u=[],i=0},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(4);Object.defineProperty(n,"take",{enumerable:!0,get:function(){return r.take}}),Object.defineProperty(n,"takem",{enumerable:!0,get:function(){return r.takem}}),Object.defineProperty(n,"put",{enumerable:!0,get:function(){return r.put}}),Object.defineProperty(n,"race",{enumerable:!0,get:function(){return r.race}}),Object.defineProperty(n,"call",{enumerable:!0,get:function(){return r.call}}),Object.defineProperty(n,"apply",{enumerable:!0,get:function(){return r.apply}}),Object.defineProperty(n,"cps",{enumerable:!0,get:function(){return r.cps}}),Object.defineProperty(n,"fork",{enumerable:!0,get:function(){return r.fork}}),Object.defineProperty(n,"spawn",{enumerable:!0,get:function(){return r.spawn}}),Object.defineProperty(n,"join",{enumerable:!0,get:function(){return r.join}}),Object.defineProperty(n,"cancel",{enumerable:!0,get:function(){return r.cancel}}),Object.defineProperty(n,"select",{enumerable:!0,get:function(){return r.select}}),Object.defineProperty(n,"actionChannel",{enumerable:!0,get:function(){return r.actionChannel}}),Object.defineProperty(n,"cancelled",{enumerable:!0,get:function(){return r.cancelled}}),Object.defineProperty(n,"flush",{enumerable:!0,get:function(){return r.flush}}),Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return r.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return r.takeLatest}}),Object.defineProperty(n,"throttle",{enumerable:!0,get:function(){return r.throttle}})},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function a(){function e(e){function a(e,t,r){return(0,c.default)(e.apply(void 0,o(t)),s.subscribe,d,i,n,r,e.name)}var i=e.getState,l=e.dispatch;t=a;var s=(0,f.emitter)(),d=(0,u.wrapSagaDispatch)(l);return function(e){return function(n){r&&r.actionDispatched(n);var t=e(n);return s.emit(n),t}}}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=void 0,r=n.sagaMonitor;if(r&&(r.effectTriggered=r.effectTriggered||u.noop,r.effectResolved=r.effectResolved||u.noop,r.effectRejected=r.effectRejected||u.noop,r.effectCancelled=r.effectCancelled||u.noop,r.actionDispatched=r.actionDispatched||u.noop),u.is.func(n))throw new Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(n.logger&&!u.is.func(n.logger))throw new Error("`options.logger` passed to the Saga middleware is not a function!");if(n.onerror&&(u.isDev&&(0,u.log)("warn","`options.onerror` is deprecated. Use `options.onError` instead."),n.onError=n.onerror,delete n.onerror),n.onError&&!u.is.func(n.onError))throw new Error("`options.onError` passed to the Saga middleware is not a function!");return e.run=function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];(0,u.check)(t,u.is.notUndef,"Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware"),(0,u.check)(e,u.is.func,"sagaMiddleware.run(saga, ...args): saga argument must be a Generator function!");var i=(0,u.uid)();r&&r.effectTriggered({effectId:i,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:o}});var c=t(e,o,i);return r&&r.effectResolved(i,c),c},e}Object.defineProperty(n,"__esModule",{value:!0}),n.default=a;var u=t(1),i=t(5),c=r(i),f=t(2)},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,n){var t=n.subscribe,r=n.dispatch,o=n.getState,u=n.sagaMonitor,c=n.logger;(0,a.check)(e,a.is.iterator,"runSaga must be called on an iterator");var f=(0,a.uid)();u&&(r=(0,a.wrapSagaDispatch)(r),u.effectTriggered({effectId:f,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:[]}}));var l=(0,i.default)(e,t,r,o,{sagaMonitor:u,logger:c},f,e.name);return u&&u.effectResolved(f,l),l}Object.defineProperty(n,"__esModule",{value:!0}),n.runSaga=o;var a=t(1),u=t(5),i=r(u)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(1);Object.defineProperty(n,"TASK",{enumerable:!0,get:function(){return r.TASK}}),Object.defineProperty(n,"SAGA_ACTION",{enumerable:!0,get:function(){return r.SAGA_ACTION}}),Object.defineProperty(n,"noop",{enumerable:!0,get:function(){return r.noop}}),Object.defineProperty(n,"is",{enumerable:!0,get:function(){return r.is}}),Object.defineProperty(n,"deferred",{enumerable:!0,get:function(){return r.deferred}}),Object.defineProperty(n,"arrayOfDeffered",{enumerable:!0,get:function(){return r.arrayOfDeffered}}),Object.defineProperty(n,"createMockTask",{enumerable:!0,get:function(){return r.createMockTask}});var o=t(4);Object.defineProperty(n,"asEffect",{enumerable:!0,get:function(){return o.asEffect}});var a=t(2);Object.defineProperty(n,"CHANNEL_END",{enumerable:!0,get:function(){return a.CHANNEL_END}})}])});

@@ -0,0 +0,0 @@ import {Action} from "redux";

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

export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush } from './internal/io';
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, takeEvery, takeLatest, throttle } from './internal/io';
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; };
import { is, check, remove, MATCH, internalErr } from './utils';
import { is, check, remove, MATCH, internalErr, SAGA_ACTION } from './utils';
import { buffers } from './buffers';
import { asap } from './scheduler';

@@ -143,5 +144,8 @@ var CHANNEL_END_TYPE = '@@redux-saga/CHANNEL_END';

chan.close();
} else if (!matcher || matcher(input)) {
chan.put(input);
return;
}
if (matcher && !matcher(input)) {
return;
}
chan.put(input);
});

@@ -166,3 +170,13 @@

export function stdChannel(subscribe) {
var chan = eventChannel(subscribe);
var chan = eventChannel(function (cb) {
return subscribe(function (input) {
if (input[SAGA_ACTION]) {
cb(input);
return;
}
asap(function () {
return cb(input);
});
});
});

@@ -169,0 +183,0 @@ return _extends({}, chan, {

@@ -5,3 +5,4 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import { sym, is, ident, check, TASK } from './utils';
import { sym, is, ident, check, TASK, deprecate } from './utils';
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers';

@@ -22,2 +23,6 @@ var IO = sym('IO');

var deprecationWarning = function deprecationWarning(deprecated, preferred) {
return deprecated + ' has been deprecated in favor of ' + preferred + ', please update your code';
};
var effect = function effect(type, payload) {

@@ -44,8 +49,10 @@ var _ref;

export function takem() {
take.maybe = function () {
var eff = take.apply(undefined, arguments);
eff[TAKE].maybe = true;
return eff;
}
};
export var takem = deprecate(take.maybe, deprecationWarning('takem', 'take.maybe'));
export function put(channel, action) {

@@ -64,8 +71,10 @@ if (arguments.length > 1) {

put.sync = function () {
put.resolve = function () {
var eff = put.apply(undefined, arguments);
eff[PUT].sync = true;
eff[PUT].resolve = true;
return eff;
};
put.sync = deprecate(put.resolve, deprecationWarning('put.sync', 'put.resolve'));
export function race(effects) {

@@ -193,39 +202,45 @@ return effect(RACE, effects);

export function takeEvery(patternOrChannel, worker) {
for (var _len6 = arguments.length, args = Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
args[_key6 - 2] = arguments[_key6];
}
return fork.apply(undefined, [takeEveryHelper, patternOrChannel, worker].concat(args));
}
export function takeLatest(patternOrChannel, worker) {
for (var _len7 = arguments.length, args = Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
args[_key7 - 2] = arguments[_key7];
}
return fork.apply(undefined, [takeLatestHelper, patternOrChannel, worker].concat(args));
}
export function throttle(ms, pattern, worker) {
for (var _len8 = arguments.length, args = Array(_len8 > 3 ? _len8 - 3 : 0), _key8 = 3; _key8 < _len8; _key8++) {
args[_key8 - 3] = arguments[_key8];
}
return fork.apply(undefined, [throttleHelper, ms, pattern, worker].concat(args));
}
var createAsEffectType = function createAsEffectType(type) {
return function (effect) {
return effect && effect[IO] && effect[type];
};
};
export var asEffect = {
take: function take(effect) {
return effect && effect[IO] && effect[TAKE];
},
put: function put(effect) {
return effect && effect[IO] && effect[PUT];
},
race: function race(effect) {
return effect && effect[IO] && effect[RACE];
},
call: function call(effect) {
return effect && effect[IO] && effect[CALL];
},
cps: function cps(effect) {
return effect && effect[IO] && effect[CPS];
},
fork: function fork(effect) {
return effect && effect[IO] && effect[FORK];
},
join: function join(effect) {
return effect && effect[IO] && effect[JOIN];
},
cancel: function cancel(effect) {
return effect && effect[IO] && effect[CANCEL];
},
select: function select(effect) {
return effect && effect[IO] && effect[SELECT];
},
actionChannel: function actionChannel(effect) {
return effect && effect[IO] && effect[ACTION_CHANNEL];
},
cancelled: function cancelled(effect) {
return effect && effect[IO] && effect[CANCELLED];
},
flush: function flush(effect) {
return effect && effect[IO] && effect[FLUSH];
}
take: createAsEffectType(TAKE),
put: createAsEffectType(PUT),
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)
};
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
import { is, check, uid as nextSagaId, wrapSagaDispatch, SAGA_ACTION } from './utils';
import { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log } from './utils';
import proc from './proc';
import { asap } from './scheduler';
import { emitter } from './channel';

@@ -14,3 +13,12 @@

// monitors are expected to have a certain interface, let's fill-in any missing ones
if (sagaMonitor) {
sagaMonitor.effectTriggered = sagaMonitor.effectTriggered || noop;
sagaMonitor.effectResolved = sagaMonitor.effectResolved || noop;
sagaMonitor.effectRejected = sagaMonitor.effectRejected || noop;
sagaMonitor.effectCancelled = sagaMonitor.effectCancelled || noop;
sagaMonitor.actionDispatched = sagaMonitor.actionDispatched || noop;
}
if (is.func(options)) {

@@ -28,6 +36,12 @@ if (process.env.NODE_ENV === 'production') {

if (options.onerror && !is.func(options.onerror)) {
throw new Error('`options.onerror` passed to the Saga middleware is not a function!');
if (options.onerror) {
if (isDev) log('warn', '`options.onerror` is deprecated. Use `options.onError` instead.');
options.onError = options.onerror;
delete options.onerror;
}
if (options.onError && !is.func(options.onError)) {
throw new Error('`options.onError` passed to the Saga middleware is not a function!');
}
function sagaMiddleware(_ref) {

@@ -51,11 +65,3 @@ var getState = _ref.getState,

var result = next(action); // hit reducers
if (action[SAGA_ACTION]) {
// Saga actions are already scheduled with asap in proc/runPutEffect
sagaEmitter.emit(action);
} else {
asap(function () {
return sagaEmitter.emit(action);
});
}
sagaEmitter.emit(action);
return result;

@@ -62,0 +68,0 @@ };

@@ -7,3 +7,3 @@ function _defineEnumerableProperties(obj, descs) { for (var key in descs) { var desc = descs[key]; desc.configurable = desc.enumerable = true; if ("value" in desc) desc.writable = true; Object.defineProperty(obj, key, desc); } return obj; }

import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, makeIterator } from './utils';
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, makeIterator, isDev } from './utils';
import { asap, suspend, flush } from './scheduler';

@@ -14,4 +14,2 @@ import { asEffect } from './io';

var isDev = process.env.NODE_ENV === 'development';
export var NOT_ITERATOR_ERROR = 'proc first argument (Saga function result) must be an iterator';

@@ -178,7 +176,5 @@

function wrapHelper(helper) {
return {
fn: helper
};
}
var wrapHelper = function wrapHelper(helper) {
return { fn: helper };
};

@@ -232,5 +228,5 @@ export default function proc(iterator) {

cancel all pending tasks (including the main task), then end the current task.
Cancellation propagates down to the whole execution tree holded by this Parent task
Cancellation propagates down to the whole execution tree holded by this Parent task
It's also propagated to all joiners of this task and their execution tree/joiners
Cancellation is noop for terminated/Cancelled tasks tasks
Cancellation is noop for terminated/Cancelled tasks tasks
**/

@@ -285,3 +281,3 @@ function cancel() {

We can get this value here
- By cancelling the parent task manually
- By cancelling the parent task manually
- By joining a Cancelled task

@@ -411,8 +407,8 @@ **/

it allows this generator to propagate cancellation downward.
ATTENTION! effect runners must setup the cancel logic by setting cb.cancel = [cancelMethod]
ATTENTION! effect runners must setup the cancel logic by setting cb.cancel = [cancelMethod]
And the setup must occur before calling the callback
This is a sort of inversion of control: called async functions are responsible
This is a sort of inversion of control: called async functions are responsible
of completing the flow by calling the provided continuation; while caller functions
are responsible for aborting the current flow by calling the attached cancel function
Library users can attach their own cancellation logic to promises by defining a
Library users can attach their own cancellation logic to promises by defining a
promise[CANCEL] method in their returned promises

@@ -465,3 +461,3 @@ ATTENTION! calling cancel must have no effect on an already completed or cancelled effect

action = _ref3.action,
sync = _ref3.sync;
resolve = _ref3.resolve;

@@ -478,8 +474,8 @@ /**

} catch (error) {
// If we have a channel or `put.sync` was used then bubble up the error.
if (channel || sync) return cb(error, true);
// If we have a channel or `put.resolve` was used then bubble up the error.
if (channel || resolve) return cb(error, true);
log('error', 'uncaught at ' + name, error.stack || error.message || error);
}
if (sync && is.promise(result)) {
if (resolve && is.promise(result)) {
resolvePromise(result, cb);

@@ -486,0 +482,0 @@ } else {

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
import { END } from './channel';
import { makeIterator, delay } from './utils';
import { makeIterator, delay, is, deprecate } from './utils';
import { take, fork, cancel, actionChannel, call } from './io';

@@ -45,13 +45,15 @@ import { buffers } from './buffers';

function safeName(pattern) {
if (Array.isArray(pattern)) {
return String(pattern.map(function (entry) {
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(pattern);
return String(patternOrChannel);
}
}
export function takeEvery(pattern, worker) {
export function takeEveryHelper(patternOrChannel, worker) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {

@@ -61,3 +63,3 @@ args[_key - 2] = arguments[_key];

var yTake = { done: false, value: take(pattern) };
var yTake = { done: false, value: take(patternOrChannel) };
var yFork = function yFork(ac) {

@@ -79,6 +81,6 @@ return { done: false, value: fork.apply(undefined, [worker].concat(args, [ac])) };

}
}, 'q1', 'takeEvery(' + safeName(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeEvery(' + safeName(patternOrChannel) + ', ' + worker.name + ')');
}
export function takeLatest(pattern, worker) {
export function takeLatestHelper(patternOrChannel, worker) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {

@@ -88,3 +90,3 @@ args[_key2 - 2] = arguments[_key2];

var yTake = { done: false, value: take(pattern) };
var yTake = { done: false, value: take(patternOrChannel) };
var yFork = function yFork(ac) {

@@ -116,6 +118,6 @@ return { done: false, value: fork.apply(undefined, [worker].concat(args, [ac])) };

}
}, 'q1', 'takeLatest(' + safeName(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeLatest(' + safeName(patternOrChannel) + ', ' + worker.name + ')');
}
export function throttle(delayLength, pattern, worker) {
export function throttleHelper(delayLength, pattern, worker) {
for (var _len3 = arguments.length, args = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {

@@ -158,2 +160,9 @@ args[_key3 - 3] = arguments[_key3];

}, 'q1', 'throttle(' + safeName(pattern) + ', ' + worker.name + ')');
}
}
var deprecationWarning = function deprecationWarning(helperName) {
return 'import ' + helperName + ' from \'redux-saga\' has been deprecated in favor of import ' + helperName + ' from \'redux-saga/effects\'.\nThe latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.\nTherefore yield ' + helperName + ' will return task descriptor to your saga and execute next lines of code.';
};
export var takeEvery = deprecate(takeEveryHelper, deprecationWarning('takeEvery'));
export var takeLatest = deprecate(takeLatestHelper, deprecationWarning('takeLatest'));
export var throttle = deprecate(throttleHelper, deprecationWarning('throttle'));

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

@@ -27,2 +27,4 @@ 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 isDev = process.env.NODE_ENV === 'development';
export function check(value, predicate, error) {

@@ -180,3 +182,5 @@ if (!predicate(value)) {

**/
export function log(level, message, error) {
export function log(level, message) {
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
/*eslint-disable no-console*/

@@ -190,2 +194,9 @@ if (typeof window === 'undefined') {

export function deprecate(fn, deprecationWarning) {
return function () {
if (isDev) log('warn', deprecationWarning);
return fn.apply(undefined, arguments);
};
}
export var internalErr = function internalErr(err) {

@@ -192,0 +203,0 @@ return new 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: ' + err + '\n');

export { TASK, SAGA_ACTION, noop, is, deferred, arrayOfDeffered, createMockTask } from './internal/utils';
export { CHANNEL_END, asEffect } from './internal/io';
export { asEffect } from './internal/io';
export { CHANNEL_END } from './internal/channel';

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

import {Middleware} from "redux";
import {Action, Middleware} from "redux";
import {Effect, Pattern} from "./effects";

@@ -23,2 +23,3 @@ import {Task, Buffer, Channel, Predicate} from "./types";

label: string;
root?: boolean;
effect: Effect;

@@ -30,2 +31,3 @@ }): void;

effectCancelled(effectId: number): void;
actionDispatched<A extends Action>(action: A): void;
}

@@ -81,25 +83,60 @@

type HelperFunc0<A> = (action?: A) => any;
type HelperFunc1<A, T1> = (arg1: T1, action?: A) => any;
type HelperFunc2<A, T1, T2> = (arg1: T1, arg2: T2, action?: A) => any;
type HelperFunc3<A, T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3,
action?: A) => any;
type HelperFunc4<A, T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4,
action?: A) => any;
type HelperFuncRest<A, T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5,
...rest: any[]) => any;
interface TakeHelper {
<A>(pattern: Pattern<A>, worker: (action?: A) => any): SagaIterator;
<A>(pattern: Pattern<A>, worker: HelperFunc0<A>): SagaIterator;
<A, T1>(pattern: Pattern<A>,
worker: (arg1: T1, action?: A) => any, arg1: T1): SagaIterator;
worker: HelperFunc1<A, T1>, arg1: T1): SagaIterator;
<A, T1, T2>(pattern: Pattern<A>,
worker: (arg1: T1, arg2: T2, action?: A) => any,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): SagaIterator;
<A, T1, T2, T3>(pattern: Pattern<A>,
worker: (arg1: T1, arg2: T2, arg3: T3, action?: A) => any,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SagaIterator;
<A, T1, T2, T3, T4>(pattern: Pattern<A>,
worker: (arg1: T1, arg2: T2, arg3: T3, arg4: T4,
action?: A) => any,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SagaIterator;
<A>(pattern: Pattern<A>,
worker: (...args: any[]) => any, ...args: any[]): SagaIterator;
<A, T1, T2, T3, T4, T5>(pattern: Pattern<A>,
worker: HelperFuncRest<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5,
...rest: any[]): SagaIterator;
}
interface ThrottleHelper {
<A>(ms: number, pattern: Pattern<A>, worker: HelperFunc0<A>): SagaIterator;
<A, T1>(ms: number,
pattern: Pattern<A>,
worker: HelperFunc1<A, T1>, arg1: T1): SagaIterator;
<A, T1, T2>(ms: number,
pattern: Pattern<A>,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): SagaIterator;
<A, T1, T2, T3>(ms: number,
pattern: Pattern<A>,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SagaIterator;
<A, T1, T2, T3, T4>(ms: number,
pattern: Pattern<A>,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SagaIterator;
<A, T1, T2, T3, T4, T5>(ms: number,
pattern: Pattern<A>,
worker: HelperFuncRest<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5,
...rest: any[]): SagaIterator;
}
export const takeEvery: TakeHelper;
export const takeLatest: TakeHelper;
export const throttle: ThrottleHelper;
export function delay(ms: number): Promise<boolean>;

@@ -113,2 +150,1 @@ export function delay<T>(ms: number, val: T): Promise<T>;

export {effects, utils};

@@ -98,2 +98,20 @@ 'use strict';

}
});
Object.defineProperty(exports, 'takeEvery', {
enumerable: true,
get: function get() {
return _io.takeEvery;
}
});
Object.defineProperty(exports, 'takeLatest', {
enumerable: true,
get: function get() {
return _io.takeLatest;
}
});
Object.defineProperty(exports, 'throttle', {
enumerable: true,
get: function get() {
return _io.throttle;
}
});

@@ -19,2 +19,4 @@ 'use strict';

var _scheduler = require('./scheduler');
var CHANNEL_END_TYPE = '@@redux-saga/CHANNEL_END';

@@ -157,5 +159,8 @@ var END = exports.END = { type: CHANNEL_END_TYPE };

chan.close();
} else if (!matcher || matcher(input)) {
chan.put(input);
return;
}
if (matcher && !matcher(input)) {
return;
}
chan.put(input);
});

@@ -180,3 +185,13 @@

function stdChannel(subscribe) {
var chan = eventChannel(subscribe);
var chan = eventChannel(function (cb) {
return subscribe(function (input) {
if (input[_utils.SAGA_ACTION]) {
cb(input);
return;
}
(0, _scheduler.asap)(function () {
return cb(input);
});
});
});

@@ -183,0 +198,0 @@ return _extends({}, chan, {

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

});
exports.asEffect = undefined;
exports.asEffect = exports.takem = undefined;

@@ -12,3 +12,2 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

exports.take = take;
exports.takem = takem;
exports.put = put;

@@ -27,5 +26,10 @@ exports.race = race;

exports.flush = flush;
exports.takeEvery = takeEvery;
exports.takeLatest = takeLatest;
exports.throttle = throttle;
var _utils = require('./utils');
var _sagaHelpers = require('./sagaHelpers');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -47,2 +51,6 @@

var deprecationWarning = function deprecationWarning(deprecated, preferred) {
return deprecated + ' has been deprecated in favor of ' + preferred + ', please update your code';
};
var effect = function effect(type, payload) {

@@ -69,8 +77,10 @@ var _ref;

function takem() {
take.maybe = function () {
var eff = take.apply(undefined, arguments);
eff[TAKE].maybe = true;
return eff;
}
};
var takem = exports.takem = (0, _utils.deprecate)(take.maybe, deprecationWarning('takem', 'take.maybe'));
function put(channel, action) {

@@ -89,8 +99,10 @@ if (arguments.length > 1) {

put.sync = function () {
put.resolve = function () {
var eff = put.apply(undefined, arguments);
eff[PUT].sync = true;
eff[PUT].resolve = true;
return eff;
};
put.sync = (0, _utils.deprecate)(put.resolve, deprecationWarning('put.sync', 'put.resolve'));
function race(effects) {

@@ -218,39 +230,45 @@ return effect(RACE, effects);

function takeEvery(patternOrChannel, worker) {
for (var _len6 = arguments.length, args = Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
args[_key6 - 2] = arguments[_key6];
}
return fork.apply(undefined, [_sagaHelpers.takeEveryHelper, patternOrChannel, worker].concat(args));
}
function takeLatest(patternOrChannel, worker) {
for (var _len7 = arguments.length, args = Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
args[_key7 - 2] = arguments[_key7];
}
return fork.apply(undefined, [_sagaHelpers.takeLatestHelper, patternOrChannel, worker].concat(args));
}
function throttle(ms, pattern, worker) {
for (var _len8 = arguments.length, args = Array(_len8 > 3 ? _len8 - 3 : 0), _key8 = 3; _key8 < _len8; _key8++) {
args[_key8 - 3] = arguments[_key8];
}
return fork.apply(undefined, [_sagaHelpers.throttleHelper, ms, pattern, worker].concat(args));
}
var createAsEffectType = function createAsEffectType(type) {
return function (effect) {
return effect && effect[IO] && effect[type];
};
};
var asEffect = exports.asEffect = {
take: function take(effect) {
return effect && effect[IO] && effect[TAKE];
},
put: function put(effect) {
return effect && effect[IO] && effect[PUT];
},
race: function race(effect) {
return effect && effect[IO] && effect[RACE];
},
call: function call(effect) {
return effect && effect[IO] && effect[CALL];
},
cps: function cps(effect) {
return effect && effect[IO] && effect[CPS];
},
fork: function fork(effect) {
return effect && effect[IO] && effect[FORK];
},
join: function join(effect) {
return effect && effect[IO] && effect[JOIN];
},
cancel: function cancel(effect) {
return effect && effect[IO] && effect[CANCEL];
},
select: function select(effect) {
return effect && effect[IO] && effect[SELECT];
},
actionChannel: function actionChannel(effect) {
return effect && effect[IO] && effect[ACTION_CHANNEL];
},
cancelled: function cancelled(effect) {
return effect && effect[IO] && effect[CANCELLED];
},
flush: function flush(effect) {
return effect && effect[IO] && effect[FLUSH];
}
take: createAsEffectType(TAKE),
put: createAsEffectType(PUT),
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)
};

@@ -14,4 +14,2 @@ 'use strict';

var _scheduler = require('./scheduler');
var _channel = require('./channel');

@@ -29,3 +27,12 @@

// monitors are expected to have a certain interface, let's fill-in any missing ones
if (sagaMonitor) {
sagaMonitor.effectTriggered = sagaMonitor.effectTriggered || _utils.noop;
sagaMonitor.effectResolved = sagaMonitor.effectResolved || _utils.noop;
sagaMonitor.effectRejected = sagaMonitor.effectRejected || _utils.noop;
sagaMonitor.effectCancelled = sagaMonitor.effectCancelled || _utils.noop;
sagaMonitor.actionDispatched = sagaMonitor.actionDispatched || _utils.noop;
}
if (_utils.is.func(options)) {

@@ -43,6 +50,12 @@ if (process.env.NODE_ENV === 'production') {

if (options.onerror && !_utils.is.func(options.onerror)) {
throw new Error('`options.onerror` passed to the Saga middleware is not a function!');
if (options.onerror) {
if (_utils.isDev) (0, _utils.log)('warn', '`options.onerror` is deprecated. Use `options.onError` instead.');
options.onError = options.onerror;
delete options.onerror;
}
if (options.onError && !_utils.is.func(options.onError)) {
throw new Error('`options.onError` passed to the Saga middleware is not a function!');
}
function sagaMiddleware(_ref) {

@@ -66,11 +79,3 @@ var getState = _ref.getState,

var result = next(action); // hit reducers
if (action[_utils.SAGA_ACTION]) {
// Saga actions are already scheduled with asap in proc/runPutEffect
sagaEmitter.emit(action);
} else {
(0, _scheduler.asap)(function () {
return sagaEmitter.emit(action);
});
}
sagaEmitter.emit(action);
return result;

@@ -77,0 +82,0 @@ };

@@ -25,4 +25,2 @@ 'use strict';

var isDev = process.env.NODE_ENV === 'development';
var NOT_ITERATOR_ERROR = exports.NOT_ITERATOR_ERROR = 'proc first argument (Saga function result) must be an iterator';

@@ -189,7 +187,5 @@

function wrapHelper(helper) {
return {
fn: helper
};
}
var wrapHelper = function wrapHelper(helper) {
return { fn: helper };
};

@@ -243,5 +239,5 @@ function proc(iterator) {

cancel all pending tasks (including the main task), then end the current task.
Cancellation propagates down to the whole execution tree holded by this Parent task
Cancellation propagates down to the whole execution tree holded by this Parent task
It's also propagated to all joiners of this task and their execution tree/joiners
Cancellation is noop for terminated/Cancelled tasks tasks
Cancellation is noop for terminated/Cancelled tasks tasks
**/

@@ -296,3 +292,3 @@ function cancel() {

We can get this value here
- By cancelling the parent task manually
- By cancelling the parent task manually
- By joining a Cancelled task

@@ -339,3 +335,3 @@ **/

if (!isErr) {
if (result === TASK_CANCEL && isDev) {
if (result === TASK_CANCEL && _utils.isDev) {
log('info', name + ' has been cancelled', '');

@@ -423,8 +419,8 @@ }

it allows this generator to propagate cancellation downward.
ATTENTION! effect runners must setup the cancel logic by setting cb.cancel = [cancelMethod]
ATTENTION! effect runners must setup the cancel logic by setting cb.cancel = [cancelMethod]
And the setup must occur before calling the callback
This is a sort of inversion of control: called async functions are responsible
This is a sort of inversion of control: called async functions are responsible
of completing the flow by calling the provided continuation; while caller functions
are responsible for aborting the current flow by calling the attached cancel function
Library users can attach their own cancellation logic to promises by defining a
Library users can attach their own cancellation logic to promises by defining a
promise[CANCEL] method in their returned promises

@@ -477,3 +473,3 @@ ATTENTION! calling cancel must have no effect on an already completed or cancelled effect

action = _ref3.action,
sync = _ref3.sync;
resolve = _ref3.resolve;

@@ -490,8 +486,8 @@ /**

} catch (error) {
// If we have a channel or `put.sync` was used then bubble up the error.
if (channel || sync) return cb(error, true);
// If we have a channel or `put.resolve` was used then bubble up the error.
if (channel || resolve) return cb(error, true);
log('error', 'uncaught at ' + name, error.stack || error.message || error);
}
if (sync && _utils.is.promise(result)) {
if (resolve && _utils.is.promise(result)) {
resolvePromise(result, cb);

@@ -498,0 +494,0 @@ } else {

@@ -6,8 +6,9 @@ 'use strict';

});
exports.throttle = exports.takeLatest = exports.takeEvery = undefined;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
exports.takeEvery = takeEvery;
exports.takeLatest = takeLatest;
exports.throttle = throttle;
exports.takeEveryHelper = takeEveryHelper;
exports.takeLatestHelper = takeLatestHelper;
exports.throttleHelper = throttleHelper;

@@ -59,13 +60,15 @@ var _channel = require('./channel');

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

@@ -75,3 +78,3 @@ args[_key - 2] = arguments[_key];

var yTake = { done: false, value: (0, _io.take)(pattern) };
var yTake = { done: false, value: (0, _io.take)(patternOrChannel) };
var yFork = function yFork(ac) {

@@ -93,6 +96,6 @@ return { done: false, value: _io.fork.apply(undefined, [worker].concat(args, [ac])) };

}
}, 'q1', 'takeEvery(' + safeName(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeEvery(' + safeName(patternOrChannel) + ', ' + worker.name + ')');
}
function takeLatest(pattern, worker) {
function takeLatestHelper(patternOrChannel, worker) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {

@@ -102,3 +105,3 @@ args[_key2 - 2] = arguments[_key2];

var yTake = { done: false, value: (0, _io.take)(pattern) };
var yTake = { done: false, value: (0, _io.take)(patternOrChannel) };
var yFork = function yFork(ac) {

@@ -130,6 +133,6 @@ return { done: false, value: _io.fork.apply(undefined, [worker].concat(args, [ac])) };

}
}, 'q1', 'takeLatest(' + safeName(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeLatest(' + safeName(patternOrChannel) + ', ' + worker.name + ')');
}
function throttle(delayLength, pattern, worker) {
function throttleHelper(delayLength, pattern, worker) {
for (var _len3 = arguments.length, args = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {

@@ -172,2 +175,9 @@ args[_key3 - 3] = arguments[_key3];

}, 'q1', 'throttle(' + safeName(pattern) + ', ' + worker.name + ')');
}
}
var deprecationWarning = function deprecationWarning(helperName) {
return 'import ' + helperName + ' from \'redux-saga\' has been deprecated in favor of import ' + helperName + ' from \'redux-saga/effects\'.\nThe latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.\nTherefore yield ' + helperName + ' will return task descriptor to your saga and execute next lines of code.';
};
var takeEvery = exports.takeEvery = (0, _utils.deprecate)(takeEveryHelper, deprecationWarning('takeEvery'));
var takeLatest = exports.takeLatest = (0, _utils.deprecate)(takeLatestHelper, deprecationWarning('takeLatest'));
var throttle = exports.throttle = (0, _utils.deprecate)(throttleHelper, deprecationWarning('throttle'));

@@ -0,0 +0,0 @@ "use strict";

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

exports.log = log;
exports.deprecate = deprecate;
exports.wrapSagaDispatch = wrapSagaDispatch;

@@ -45,2 +46,4 @@

var isDev = exports.isDev = process.env.NODE_ENV === 'development';
function check(value, predicate, error) {

@@ -198,3 +201,5 @@ if (!predicate(value)) {

**/
function log(level, message, error) {
function log(level, message) {
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
/*eslint-disable no-console*/

@@ -208,2 +213,9 @@ if (typeof window === 'undefined') {

function deprecate(fn, deprecationWarning) {
return function () {
if (isDev) log('warn', deprecationWarning);
return fn.apply(undefined, arguments);
};
}
var internalErr = exports.internalErr = function internalErr(err) {

@@ -210,0 +222,0 @@ return new 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: ' + err + '\n');

@@ -54,13 +54,16 @@ 'use strict';

Object.defineProperty(exports, 'CHANNEL_END', {
Object.defineProperty(exports, 'asEffect', {
enumerable: true,
get: function get() {
return _io.CHANNEL_END;
return _io.asEffect;
}
});
Object.defineProperty(exports, 'asEffect', {
var _channel = require('./internal/channel');
Object.defineProperty(exports, 'CHANNEL_END', {
enumerable: true,
get: function get() {
return _io.asEffect;
return _channel.CHANNEL_END;
}
});
{
"name": "redux-saga",
"version": "0.13.0",
"version": "0.14.0",
"description": "Saga middleware for Redux to handle Side Effects",

@@ -64,2 +64,3 @@ "main": "lib/index.js",

"isomorphic-fetch": "^2.2.0",
"lolex": "^1.5.2",
"react": "^15.0.0",

@@ -66,0 +67,0 @@ "react-dom": "^15.0.0",

@@ -5,22 +5,10 @@ # redux-saga

Redux アプリケーションのための副作用ミドルウェア(非同期 Action)。`redux-thunk` ミドルウェアによって処理される Thunk(サンク) を送り出す代わりに、
副作用を伴うすべてのロジックを1箇所にまとめる **Saga(サガ、サーガ)** を用意します。
`redux-saga` は React/Redux アプリケーションにおける副作用(データ通信などの非同期処理、ブラウザキャッシュへのアクセスのようなピュアではない処理)をより簡単で優れたものにするためのライブラリです。
これはアプリケーションロジックが2箇所に存在することを意味しています:
Saga はアプリケーションの中で副作用を個別に実行する独立したスレッドのような動作イメージです。 `redux-saga` は Redux ミドルウェアとして実装されているため、スレッドはメインアプリケーションからのアクションに応じて起動、一時停止、中断が可能で、Redux アプリケーションのステート全体にアクセスでき、Redux アクションをディスパッチすることもできます。
- Reducer は Action ごとの状態遷移を処理する責任を持つ
- Saga は複雑で非同期的な操作のオーケストレーションに責任を持つ
ES6 の Generator 関数を使うことで読み書きしやすく、テストも容易な非同期フローを実現しています(もし馴染みがないようであれば[リンク集](http://yelouafi.github.io/redux-saga/docs/ExternalResources.html)を参考にしてみてください)。それにより非同期フローが普通の同期的な JavaScript のコードのように見えます(`async`/`await` と似ていますが Generator 関数にしかないすごい機能があるんです)。
Saga は Generator 関数を使って作成されます。もし馴染みがないようであれば[リンク集](http://yelouafi.github.io/redux-saga/docs/ExternalResources.html)を参考にしてみてください。
これまで `redux-thunk` を使ってデータ通信を行っているかもしれませんが、 `redux-thunk` とは異なりコールバック地獄に陥ることなく、非同期フローを簡単にテスト可能にし、アクションをピュアに保ちます。
Action Creator を呼び出すたびに実行される Thunk とは異なり、Saga が実行されるのはアプリケーション起動時の1回だけです(ただし、最初に起動する Saga が他の Saga を動的に起動することがあります)。それらはバックグラウンドで実行されるプロセスのように見えます。Saga は Store に送り出される Action を監視して、その Action にもとづいて何をするか決定します: AJAX リクエストのような非同期呼び出しの開始、他の Action の送出、 他の Saga の動的な起動など。
`redux-saga` では上記のようなタスクを **作用(Effects)** を生成することによって実現します。作用は `redux-saga` ミドルウェアによって実行される手順が含まれた単純な JavaScript のオブジェクトです。例えるなら、Redux の Action が Store によって実行される手順が含まれているオブジェクトであることに似ています。`redux-saga` は、非同期関数を呼び出したり、Store に Action を送り出したり、バックグラウンドのタスクを起動したり、特定の条件を満たす Action を待ち受けたり、様々なタスクに応じた **作用を生成する関数(Effect Creator)** を提供します。
Generator によって `redux-saga` で非同期コードをシンプルな同期スタイルで書き下すことができます。`async/await` 関数によってできることに似ていますが、Generator は `async` 関数では困難ないくつかのことを可能にします。
Saga がプレーンなオブジェクトを生成するということは、イテレータを回すことで生成されるオブジェクトを単純に同値チェックすればよいだけになり、Generator 内部のすべてのロジックをテストしやすくします。
さらに `redux-saga` で開始したタスクは手動・自動(他の作用と競争させてたり)を問わずいつでもキャンセル可能です。
# はじめよう

@@ -57,4 +45,3 @@

```javascript
import { takeEvery, takeLatest } from 'redux-saga'
import { call, put } from 'redux-saga/effects'
import { call, put, takeEvery, takeLatest } from 'redux-saga/effects'
import Api from '...'

@@ -77,3 +64,3 @@

function* mySaga() {
yield* takeEvery("USER_FETCH_REQUESTED", fetchUser);
yield takeEvery("USER_FETCH_REQUESTED", fetchUser);
}

@@ -89,4 +76,6 @@

function* mySaga() {
yield* takeLatest("USER_FETCH_REQUESTED", fetchUser);
yield takeLatest("USER_FETCH_REQUESTED", fetchUser);
}
export default mySaga;
```

@@ -122,3 +111,3 @@

- [イントロダクション](http://yelouafi.github.io/redux-saga/docs/introduction/index.html)
- [イントロダクション](http://yelouafi.github.io/redux-saga/docs/introduction/BeginnerTutorial.html)
- [基本コンセプト](http://yelouafi.github.io/redux-saga/docs/basics/index.html)

@@ -132,4 +121,7 @@ - [応用コンセプト](http://yelouafi.github.io/redux-saga/docs/advanced/index.html)

@superRaytin による[中国語のドキュメント](https://github.com/superRaytin/redux-saga-in-chinese)もあります。
# 翻訳
- [中国語(簡体字)](https://github.com/superRaytin/redux-saga-in-chinese)
- [中国語(繁体字)](https://github.com/neighborhood999/redux-saga)
- [日本語](https://github.com/yelouafi/redux-saga/blob/master/README_ja.md)

@@ -145,3 +137,3 @@ # ブラウザで umd ビルドを使用する

- [https://unpkg.com/redux-saga/dist/redux-saga.js](https://unpkg.com/redux-saga/dist/redux-saga.js)
- [https://unpkg.com/redux-saga/dist/redux-saga.js](https://unpkg.com/redux-saga/dist/redux-saga.js)
- [https://unpkg.com/redux-saga/dist/redux-saga.min.js](https://unpkg.com/redux-saga/dist/redux-saga.min.js)

@@ -218,3 +210,4 @@

# またテストはありません・・・
# サンプルのテストを実行
$ npm run test-async
```

@@ -221,0 +214,0 @@

@@ -0,0 +0,0 @@ # redux-saga

@@ -0,0 +0,0 @@ # redux-saga

@@ -20,3 +20,8 @@ # redux-saga

```
or
```sh
$ yarn add redux-saga
```
Alternatively, you may use the provided UMD builds directly in the `<script>` tag of an HTML page. See [this section](#using-umd-build-in-the-browser).

@@ -44,4 +49,3 @@

```javascript
import { takeEvery, takeLatest } from 'redux-saga'
import { call, put } from 'redux-saga/effects'
import { call, put, takeEvery, takeLatest } from 'redux-saga/effects'
import Api from '...'

@@ -64,3 +68,3 @@

function* mySaga() {
yield* takeEvery("USER_FETCH_REQUESTED", fetchUser);
yield takeEvery("USER_FETCH_REQUESTED", fetchUser);
}

@@ -76,3 +80,3 @@

function* mySaga() {
yield* takeLatest("USER_FETCH_REQUESTED", fetchUser);
yield takeLatest("USER_FETCH_REQUESTED", fetchUser);
}

@@ -123,2 +127,3 @@

- [Chinese Traditional](https://github.com/neighborhood999/redux-saga)
- [Japanese](https://github.com/yelouafi/redux-saga/blob/master/README_ja.md)

@@ -133,3 +138,3 @@ # Using umd build in the browser

- [https://unpkg.com/redux-saga/dist/redux-saga.js](https://unpkg.com/redux-saga/dist/redux-saga.js)
- [https://unpkg.com/redux-saga/dist/redux-saga.js](https://unpkg.com/redux-saga/dist/redux-saga.js)
- [https://unpkg.com/redux-saga/dist/redux-saga.min.js](https://unpkg.com/redux-saga/dist/redux-saga.min.js)

@@ -136,0 +141,0 @@

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

export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush } from './internal/io'
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, takeEvery, takeLatest, throttle } from './internal/io'

@@ -0,0 +0,0 @@ import middleware from './internal/middleware'

@@ -0,0 +0,0 @@ import { kTrue, noop } from './utils'

@@ -1,3 +0,4 @@

import { is, check, remove, MATCH, internalErr} from './utils'
import { is, check, remove, MATCH, internalErr, SAGA_ACTION} from './utils'
import {buffers} from './buffers'
import { asap } from './scheduler'

@@ -129,5 +130,8 @@ const CHANNEL_END_TYPE = '@@redux-saga/CHANNEL_END'

chan.close()
} else if(!matcher || matcher(input)) {
chan.put(input)
return
}
if(matcher && !matcher(input)) {
return
}
chan.put(input)
})

@@ -152,3 +156,9 @@

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

@@ -155,0 +165,0 @@ return {

@@ -1,17 +0,21 @@

import { sym, is, ident, check, TASK } from './utils'
import { sym, is, ident, check, TASK, deprecate } from './utils'
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers'
const IO = sym('IO')
const TAKE = 'TAKE'
const PUT = 'PUT'
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 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 CANCELLED = 'CANCELLED'
const FLUSH = 'FLUSH'
const deprecationWarning = (deprecated, preferred) =>
`${ deprecated } has been deprecated in favor of ${ preferred }, please update your code`
const effect = (type, payload) => ({[IO]: true, [type]: payload})

@@ -32,3 +36,3 @@

export function takem(...args) {
take.maybe = (...args) => {
const eff = take(...args)

@@ -39,2 +43,4 @@ eff[TAKE].maybe = true

export const takem = deprecate(take.maybe, deprecationWarning('takem', 'take.maybe'))
export function put(channel, action) {

@@ -53,8 +59,10 @@ if(arguments.length > 1) {

put.sync = (...args) => {
put.resolve = (...args) => {
const eff = put(...args)
eff[PUT].sync = true
eff[PUT].resolve = true
return eff
}
put.sync = deprecate(put.resolve, deprecationWarning('put.sync', 'put.resolve'))
export function race(effects) {

@@ -151,15 +159,29 @@ return effect(RACE, effects)

export function takeEvery(patternOrChannel, worker, ...args) {
return fork(takeEveryHelper, patternOrChannel, worker, ...args)
}
export function takeLatest(patternOrChannel, worker, ...args) {
return fork(takeLatestHelper, patternOrChannel, worker, ...args)
}
export function throttle(ms, pattern, worker, ...args) {
return fork(throttleHelper, ms, pattern, worker, ...args)
}
const createAsEffectType = type => effect => effect && effect[IO] && effect[type]
export const asEffect = {
take : effect => effect && effect[IO] && effect[TAKE],
put : effect => effect && effect[IO] && effect[PUT],
race : effect => effect && effect[IO] && effect[RACE],
call : effect => effect && effect[IO] && effect[CALL],
cps : effect => effect && effect[IO] && effect[CPS],
fork : effect => effect && effect[IO] && effect[FORK],
join : effect => effect && effect[IO] && effect[JOIN],
cancel : effect => effect && effect[IO] && effect[CANCEL],
select : effect => effect && effect[IO] && effect[SELECT],
actionChannel : effect => effect && effect[IO] && effect[ACTION_CHANNEL],
cancelled : effect => effect && effect[IO] && effect[CANCELLED],
flush : effect => effect && effect[IO] && effect[FLUSH]
take : createAsEffectType(TAKE),
put : createAsEffectType(PUT),
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)
}

@@ -1,4 +0,3 @@

import { is, check, uid as nextSagaId, wrapSagaDispatch, SAGA_ACTION } from './utils'
import { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log } from './utils'
import proc from './proc'
import { asap } from './scheduler'
import {emitter} from './channel'

@@ -11,2 +10,11 @@

// monitors are expected to have a certain interface, let's fill-in any missing ones
if(sagaMonitor) {
sagaMonitor.effectTriggered = sagaMonitor.effectTriggered || noop
sagaMonitor.effectResolved = sagaMonitor.effectResolved || noop
sagaMonitor.effectRejected = sagaMonitor.effectRejected || noop
sagaMonitor.effectCancelled = sagaMonitor.effectCancelled || noop
sagaMonitor.actionDispatched = sagaMonitor.actionDispatched || noop
}
if(is.func(options)) {

@@ -35,6 +43,12 @@ if (process.env.NODE_ENV === 'production') {

if(options.onerror && !is.func(options.onerror)) {
throw new Error('`options.onerror` passed to the Saga middleware is not a function!')
if(options.onerror) {
if(isDev) log('warn', '`options.onerror` is deprecated. Use `options.onError` instead.')
options.onError = options.onerror
delete options.onerror
}
if(options.onError && !is.func(options.onError)) {
throw new Error('`options.onError` passed to the Saga middleware is not a function!')
}
function sagaMiddleware({getState, dispatch}) {

@@ -62,9 +76,3 @@ runSagaDynamically = runSaga

const result = next(action) // hit reducers
if(action[SAGA_ACTION]) {
// Saga actions are already scheduled with asap in proc/runPutEffect
sagaEmitter.emit(action)
} else {
asap(() => sagaEmitter.emit(action))
}
sagaEmitter.emit(action)
return result

@@ -71,0 +79,0 @@ }

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

import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, makeIterator } from './utils'
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, makeIterator, isDev } from './utils'
import { asap, suspend, flush } from './scheduler'

@@ -7,4 +7,2 @@ import { asEffect } from './io'

const isDev = process.env.NODE_ENV === 'development'
export const NOT_ITERATOR_ERROR = 'proc first argument (Saga function result) must be an iterator'

@@ -137,7 +135,3 @@

function wrapHelper(helper) {
return {
fn: helper
}
}
const wrapHelper = (helper) => ({ fn: helper })

@@ -383,3 +377,2 @@ export default function proc(

// declarative effects

@@ -433,3 +426,3 @@ : is.array(effect) ? runParallelEffect(effect, effectId, currCb)

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

@@ -445,8 +438,8 @@ Schedule the put in case another saga is holding a lock.

} catch(error) {
// If we have a channel or `put.sync` was used then bubble up the error.
if (channel || sync) return cb(error, true)
// If we have a channel or `put.resolve` was used then bubble up the error.
if (channel || resolve) return cb(error, true)
log('error', `uncaught at ${name}`, error.stack || error.message || error)
}
if(sync && is.promise(result)) {
if(resolve && is.promise(result)) {
resolvePromise(result, cb)

@@ -453,0 +446,0 @@ } else {

@@ -0,0 +0,0 @@ import { is, check, uid as nextSagaId, wrapSagaDispatch } from './utils'

import { END } from './channel'
import { makeIterator, delay } from './utils'
import { makeIterator, delay, is, deprecate } from './utils'
import { take, fork, cancel, actionChannel, call } from './io'

@@ -37,12 +37,14 @@ import { buffers } from './buffers'

function safeName(pattern) {
if (Array.isArray(pattern)) {
return String(pattern.map(entry => String(entry)))
function safeName(patternOrChannel) {
if (is.channel(patternOrChannel)) {
return 'channel'
} else if (Array.isArray(patternOrChannel)) {
return String(patternOrChannel.map(entry => String(entry)))
} else {
return String(pattern)
return String(patternOrChannel)
}
}
export function takeEvery(pattern, worker, ...args) {
const yTake = {done: false, value: take(pattern)}
export function takeEveryHelper(patternOrChannel, worker, ...args) {
const yTake = {done: false, value: take(patternOrChannel)}
const yFork = ac => ({done: false, value: fork(worker, ...args, ac)})

@@ -55,7 +57,7 @@

q2() { return action === END ? [qEnd] : ['q1', yFork(action)] }
}, 'q1', `takeEvery(${safeName(pattern)}, ${worker.name})`)
}, 'q1', `takeEvery(${safeName(patternOrChannel)}, ${worker.name})`)
}
export function takeLatest(pattern, worker, ...args) {
const yTake = {done: false, value: take(pattern)}
export function takeLatestHelper(patternOrChannel, worker, ...args) {
const yTake = {done: false, value: take(patternOrChannel)}
const yFork = ac => ({done: false, value: fork(worker, ...args, ac)})

@@ -78,6 +80,6 @@ const yCancel = task => ({done: false, value: cancel(task)})

}
}, 'q1', `takeLatest(${safeName(pattern)}, ${worker.name})`)
}, 'q1', `takeLatest(${safeName(patternOrChannel)}, ${worker.name})`)
}
export function throttle(delayLength, pattern, worker, ...args) {
export function throttleHelper(delayLength, pattern, worker, ...args) {
let action, channel

@@ -89,3 +91,3 @@

const yDelay = {done: false, value: call(delay, delayLength)}
const setAction = ac => action = ac

@@ -101,1 +103,9 @@ const setChannel = ch => channel = ch

}
const deprecationWarning = (helperName) =>
`import ${helperName} from 'redux-saga' has been deprecated in favor of import ${helperName} from 'redux-saga/effects'.
The latter will not work with yield*, as helper effects are wrapped automatically for you in fork effect.
Therefore yield ${helperName} will return task descriptor to your saga and execute next lines of code.`
export const takeEvery = deprecate(takeEveryHelper, deprecationWarning('takeEvery'))
export const takeLatest = deprecate(takeLatestHelper, deprecationWarning('takeLatest'))
export const throttle = deprecate(throttleHelper, deprecationWarning('throttle'))

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

@@ -13,2 +13,4 @@ export const sym = id => `@@redux-saga/${id}`

export const isDev = process.env.NODE_ENV === 'development'
export function check(value, predicate, error) {

@@ -114,3 +116,3 @@ if(!predicate(value)) {

**/
export function log(level, message, error) {
export function log(level, message, error = '') {
/*eslint-disable no-console*/

@@ -124,2 +126,9 @@ if(typeof window === 'undefined') {

export function deprecate(fn, deprecationWarning) {
return (...args) => {
if (isDev) log('warn', deprecationWarning)
return fn(...args)
}
}
export const internalErr = err => new Error(`

@@ -126,0 +135,0 @@ redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug

export { TASK, SAGA_ACTION, noop, is, deferred, arrayOfDeffered, createMockTask } from './internal/utils'
export { CHANNEL_END, asEffect } from './internal/io'
export { asEffect } from './internal/io'
export { CHANNEL_END } from './internal/channel'

@@ -0,0 +0,0 @@ export type Predicate<T> = (arg: T) => boolean;

@@ -0,0 +0,0 @@ import {

module.exports = require('./lib/utils')

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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