redux-saga
Advanced tools
Comparing version 0.14.7 to 0.14.8
@@ -1,1 +0,2 @@ | ||
!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(3);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(2);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 p("error","uncaught at check",t),new Error(t)}function a(e,n){return C.notUndef(e)&&j.call(e,n)}function u(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=g({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function c(e){for(var n=[],t=0;t<e;t++)n.push(i());return n}function f(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 l(){var e,n=!0,t=void 0,o=void 0;return e={},r(e,m,!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 s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++e}}function d(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:t,next:e,"throw":n,"return":S};return r&&(o[E]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function p(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 v(e,n){return function(){return _&&p("warn",n),e.apply(void 0,arguments)}}function h(e){return function(n){var t=Object.defineProperty(n,O,{value:!0});return e(t)}}Object.defineProperty(n,"__esModule",{value:!0});var g=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},y="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.hasOwn=a,n.remove=u,n.deferred=i,n.arrayOfDeffered=c,n.delay=f,n.createMockTask=l,n.autoInc=s,n.makeIterator=d,n.log=p,n.deprecate=v,n.wrapSagaDispatch=h;var b=n.sym=function(e){return"@@redux-saga/"+e},m=n.TASK=b("TASK"),E=n.HELPER=b("HELPER"),k=(n.MATCH=b("MATCH"),n.CANCEL=b("cancelPromise")),O=n.SAGA_ACTION=b("SAGA_ACTION"),A=(n.SELF_CANCELLATION=b("SELF_CANCELLATION"),n.konst=function(e){return function(){return e}}),_=(n.kTrue=A(!0),n.kFalse=A(!1),n.noop=function(){},n.ident=function(e){return e},n.isDev=!1),j=Object.prototype.hasOwnProperty,C=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&&C.func(e.then)},iterator:function(e){return e&&C.func(e.next)&&C.func(e.throw)},iterable:function(e){return e&&C.func(Symbol)?C.func(e[Symbol.iterator]):C.array(e)},task:function(e){return e&&e[m]},observable:function(e){return e&&C.func(e.subscribe)},buffer:function(e){return e&&C.func(e.isEmpty)&&C.func(e.take)&&C.func(e.put)},pattern:function(e){return e&&("string"==typeof e||"symbol"===("undefined"==typeof e?"undefined":y(e))||C.func(e)||C.array(e))},channel:function(e){return e&&C.func(e.take)&&C.func(e.close)},helper:function(e){return e&&e[E]},stringableFunc:function(e){return C.func(e)&&a(e,"toString")}},w=(n.uid=s(),function(e){throw e}),S=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(){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(){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(2),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(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,A.check)(arguments[0],A.is.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),A.is.pattern(e))return H(C,{pattern:e});if(A.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,A.check)(e,A.is.notUndef,"put(channel, action): argument channel is undefined"),(0,A.check)(e,A.is.channel,"put(channel, action): argument "+e+" is not a valid channel"),(0,A.check)(n,A.is.notUndef,"put(channel, action): argument action is undefined")):((0,A.check)(e,A.is.notUndef,"put(action): argument action is undefined"),n=e,e=null),H(w,{channel:e,action:n})}function u(e){return H(S,e)}function i(e,n,t){(0,A.check)(n,A.is.notUndef,e+": argument fn is undefined");var r=null;if(A.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,A.check)(n,A.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(P,i("call",e,t))}function f(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return H(P,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(T,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[T].detached=!0,o}function p(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];if(n.length>1)return n.map(function(e){return p(e)});var r=n[0];return(0,A.check)(r,A.is.notUndef,"join(task): argument task is undefined"),(0,A.check)(r,A.is.task,"join(task): argument "+r+" is not a valid Task object "+D),H(R,r)}function v(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];if(n.length>1)return n.map(function(e){return v(e)});var r=n[0];return 1===n.length&&((0,A.check)(r,A.is.notUndef,"cancel(task): argument task is undefined"),(0,A.check)(r,A.is.task,"cancel(task): argument "+r+" is not a valid Task object "+D)),H(L,r||A.SELF_CANCELLATION)}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=A.ident:((0,A.check)(e,A.is.notUndef,"select(selector,[...]): argument selector is undefined"),(0,A.check)(e,A.is.func,"select(selector,[...]): argument "+e+" is not a function")),H(x,{selector:e,args:t})}function g(e,n){return(0,A.check)(e,A.is.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&((0,A.check)(n,A.is.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),(0,A.check)(n,A.is.buffer,"actionChannel(pattern, buffer): argument "+n+" is not a valid buffer")),H(U,{pattern:e,buffer:n})}function y(){return H(I,{})}function b(e){return(0,A.check)(e,A.is.channel,"flush(channel): argument "+e+" is not valid channel"),H(M,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,[_.takeEveryHelper,e,n].concat(r))}function E(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,[_.takeLatestHelper,e,n].concat(r))}function k(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,[_.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=E,n.throttle=k;var A=t(1),_=t(6),j=(0,A.sym)("IO"),C="TAKE",w="PUT",S="RACE",P="CALL",N="CPS",T="FORK",R="JOIN",L="CANCEL",x="SELECT",U="ACTION_CHANNEL",I="CANCELLED",M="FLUSH",D="\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)",q=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,j,!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,A.deprecate)(o.maybe,q("takem","take.maybe"));a.resolve=function(){var e=a.apply(void 0,arguments);return e[w].resolve=!0,e},a.sync=(0,A.deprecate)(a.resolve,q("put.sync","put.resolve"));var F=function(e){return function(n){return n&&n[j]&&n[e]}};n.asEffect={take:F(C),put:F(w),race:F(S),call:F(P),cps:F(N),fork:F(T),join:F(R),cancel:F(L),select:F(x),actionChannel:F(U),cancelled:F(I),flush:F(M)}},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?m.wildcard:s.is.array(e)?m.array:s.is.stringableFunc(e)?m.default:s.is.func(e)?m.predicate:m.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,s.remove)(u,e),e.cont=s.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=s.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(s.is.iterator(t))return t;var o=void 0,a=void 0;try{o=t.apply(n,r)}catch(u){a=u}return s.is.iterator(o)?o:a?(0,s.makeIterator)(function(){throw a}):(0,s.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,l(b))}function t(){e._isRunning&&!e._isCancelled&&(e._isCancelled=!0,Z.cancelAll(),m(b))}function l(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===b?(Y.isCancelled=!0,l.cancel(),r=s.is.func(e.return)?e.return(b):{done:!0,value:b}):r=n===y?s.is.func(e.return)?e.return():{done:!0}:e.next(n),r.done?(Y.isMainRunning=!1,Y.cont&&Y.cont(r.value)):k(r.value,K,"",l)}catch(o){Y.isCancelled&&z("error","uncaught at "+G,o.message),Y.isMainRunning=!1,Y.cont(o,!0)}}function m(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===b&&s.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 k(e,n){function t(e,n){u||(u=!0,o.cancel=s.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,s.uid)();V&&V.effectTriggered({effectId:a,parentEffectId:n,label:r,effect:e});var u=void 0;t.cancel=s.noop,o.cancel=function(){if(!u){u=!0;try{t.cancel()}catch(e){z("error","uncaught at "+G,e.message)}t.cancel=s.noop,V&&V.effectCancelled(a)}};var i=void 0;return s.is.promise(e)?O(e,t):s.is.helper(e)?S(E(e),a,t):s.is.iterator(e)?A(e,a,G,t):s.is.array(e)?T(e,a,t):s.is.notUndef(i=p.asEffect.take(e))?_(i,t):s.is.notUndef(i=p.asEffect.put(e))?j(i,t):s.is.notUndef(i=p.asEffect.race(e))?R(i,a,t):s.is.notUndef(i=p.asEffect.call(e))?C(i,a,t):s.is.notUndef(i=p.asEffect.cps(e))?w(i,t):s.is.notUndef(i=p.asEffect.fork(e))?S(i,a,t):s.is.notUndef(i=p.asEffect.join(e))?P(i,t):s.is.notUndef(i=p.asEffect.cancel(e))?N(i,t):s.is.notUndef(i=p.asEffect.select(e))?L(i,t):s.is.notUndef(i=p.asEffect.actionChannel(e))?x(i,t):s.is.notUndef(i=p.asEffect.flush(e))?I(i,t):s.is.notUndef(i=p.asEffect.cancelled(e))?U(i,t):t(e)}function O(e,n){var t=e[s.CANCEL];"function"==typeof t&&(n.cancel=t),e.then(n,function(e){return n(e,!0)})}function A(e,n,t,r){f(e,D,q,H,F,n,t,r)}function _(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,v.isEnd)(e)&&!o?y:e)};try{t.take(a,u(r))}catch(i){return n(i,!0)}n.cancel=a.cancel}function j(e,n){var t=e.channel,r=e.action,o=e.resolve;(0,d.asap)(function(){var e=void 0;try{e=(t?t.put:q)(r)}catch(a){if(t||o)return n(a,!0);z("error","uncaught at "+G,a.stack||a.message||a)}return o&&s.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 s.is.promise(u)?O(u,t):s.is.iterator(u)?A(u,n,o.name,t):t(u)}function w(e,n){var t=e.context,r=e.fn,o=e.args;try{var a=function(e,t){return s.is.undef(e)?n(t):n(e,!0)};r.apply(t,o.concat(a)),a.cancel&&(n.cancel=function(){return a.cancel()})}catch(u){return n(u,!0)}}function S(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,d.suspend)();var l=f(i,D,q,H,F,n,o.name,u?null:s.noop);u?t(l):i._isRunning?(Z.addTask(l),t(l)):i._error?Z.abort(i._error):t(l)}finally{(0,d.flush)()}}function P(e,n){if(e.isRunning()){var t={task:X,cb:n};n.cancel=function(){return(0,s.remove)(e.joiners,t)},e.joiners.push(t)}else e.isAborted()?n(e.error(),!0):n(e.result())}function N(e,n){e===s.SELF_CANCELLATION&&(e=X),e.isRunning()&&e.cancel(),n()}function T(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,v.isEnd)(e)||e===y||e===b?(t.cancel(),t(e,i)):(u[n]=e,o++,r()))};return i.cancel=s.noop,i});t.cancel=function(){a||(a=!0,i.forEach(function(e){return e.cancel()}))},e.forEach(function(e,t){return k(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,v.isEnd)(n)||n===y||n===b||(t.cancel(),r=!0,t(a({},e,n))))};n.cancel=s.noop,u[e]=n}),t.cancel=function(){r||(r=!0,o.forEach(function(e){return u[e].cancel()}))},o.forEach(function(t){r||k(e[t],n,t,u[t])})}function L(e,n){var t=e.selector,r=e.args;try{var a=t.apply(void 0,[H()].concat(o(r)));n(a)}catch(u){n(u,!0)}}function x(e,n){var t=e.pattern,r=e.buffer,o=u(t);o.pattern=t,n((0,v.eventChannel)(D,r||h.buffers.fixed(),o))}function U(e,n){n(!!Y.isCancelled)}function I(e,n){e.flush(n)}function M(e,n,o,u){var i,c,f;return o._deferredEnd=null,c={},a(c,s.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,s.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 s.noop},q=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.noop,H=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.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,s.check)(e,s.is.iterator,g);var V=F.sagaMonitor,W=F.logger,J=F.onError,z=W||s.log,Q=(0,v.stdChannel)(D);l.cancel=s.noop;var X=M(K,G,e,B),Y={name:G,cancel:n,isRunning:!0},Z=i(G,Y,m);return B&&(B.cancel=t),e._isRunning=!0,l(),X}Object.defineProperty(n,"__esModule",{value:!0}),n.TASK_CANCEL=n.CHANNEL_END=n.NOT_ITERATOR_ERROR=void 0;var l="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.default=f;var s=t(1),d=t(7),p=t(4),v=t(3),h=t(2),g=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",y=n.CHANNEL_END={toString:function(){return"@@redux-saga/CHANNEL_END"}},b=n.TASK_CANCEL={toString:function(){return"@@redux-saga/TASK_CANCEL"}},m={wildcard:function(){return s.kTrue},"default":function(e){return function(n){return n.type===("symbol"===("undefined"==typeof e?"undefined":l(e))?e:String(e))}},array:function(e){return function(n){return e.some(function(e){return u(e)(n)})}},predicate:function(e){return function(n){return e(n)}}},E=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)}},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},E=function(e){return p=e};return r({q1:function(){return["q2",h,E]},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(3),l=t(1),s=t(4),d=t(2),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.push(e),c||(o(),u())}function o(){c++}function a(){c--}function u(){a();for(var e=void 0;!c&&void 0!==(e=i.shift());)t(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.asap=r,n.suspend=o,n.flush=u;var i=[],c=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)();s.emit=(n.emitter||u.ident)(s.emit);var 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!");if(n.emitter&&!u.is.func(n.emitter))throw new Error("`options.emitter` 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(3)},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,f=n.onError;(0,a.check)(e,a.is.iterator,"runSaga must be called on an iterator");var l=(0,a.uid)();u&&u.effectTriggered({effectId:l,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:[]}});var s=(0,i.default)(e,t,(0,a.wrapSagaDispatch)(r),o,{sagaMonitor:u,logger:c,onError:f},l,e.name);return u&&u.effectResolved(l,s),s}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(5);Object.defineProperty(n,"CHANNEL_END",{enumerable:!0,get:function(){return a.CHANNEL_END}})}])}); | ||
!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(3);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(2);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),g=r(v);n.default=s.default,n.effects=p,n.utils=g},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 p("error","uncaught at check",t),new Error(t)}function a(e,n){return _.notUndef(e)&&A.call(e,n)}function u(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function i(){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 c(e){for(var n=[],t=0;t<e;t++)n.push(i());return n}function f(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 l(){var e,n=!0,t=void 0,o=void 0;return e={},r(e,m,!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 s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++e}}function d(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],o={name:t,next:e,"throw":n,"return":S};return r&&(o[E]=!0),"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function p(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 v(e,n){return function(){return j&&p("warn",n),e.apply(void 0,arguments)}}function g(e){return function(n){var t=Object.defineProperty(n,O,{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},y="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.hasOwn=a,n.remove=u,n.deferred=i,n.arrayOfDeffered=c,n.delay=f,n.createMockTask=l,n.autoInc=s,n.makeIterator=d,n.log=p,n.deprecate=v,n.wrapSagaDispatch=g;var b=n.sym=function(e){return"@@redux-saga/"+e},m=n.TASK=b("TASK"),E=n.HELPER=b("HELPER"),k=(n.MATCH=b("MATCH"),n.CANCEL=b("cancelPromise")),O=n.SAGA_ACTION=b("SAGA_ACTION"),C=(n.SELF_CANCELLATION=b("SELF_CANCELLATION"),n.konst=function(e){return function(){return e}}),j=(n.kTrue=C(!0),n.kFalse=C(!1),n.noop=function(){},n.ident=function(e){return e},n.isDev=!1),A=Object.prototype.hasOwnProperty,_=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},string:function(e){return"string"==typeof e},array:Array.isArray,object:function(e){return e&&!_.array(e)&&"object"===("undefined"==typeof e?"undefined":y(e))},promise:function(e){return e&&_.func(e.then)},iterator:function(e){return e&&_.func(e.next)&&_.func(e.throw)},iterable:function(e){return e&&_.func(Symbol)?_.func(e[Symbol.iterator]):_.array(e)},task:function(e){return e&&e[m]},observable:function(e){return e&&_.func(e.subscribe)},buffer:function(e){return e&&_.func(e.isEmpty)&&_.func(e.take)&&_.func(e.put)},pattern:function(e){return e&&(_.string(e)||"symbol"===("undefined"==typeof e?"undefined":y(e))||_.func(e)||_.array(e))},channel:function(e){return e&&_.func(e.take)&&_.func(e.close)},helper:function(e){return e&&e[E]},stringableFunc:function(e){return _.func(e)&&a(e,"toString")}},w=(n.object={assign:function(e,n){for(var t in n)a(n,t)&&(e[t]=n[t])}},n.uid=s(),function(e){throw e}),S=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")},n.createSetContextWarning=function(e,n){return(e?e+".":"")+"setContext(props): argument "+n+" is not a plain object"}},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(){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,g),!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(2),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",g=n.UNDEFINED_INPUT_ERROR="Saga was provided with an undefined action"},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,A.check)(arguments[0],A.is.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),A.is.pattern(e))return B(S,{pattern:e});if(A.is.channel(e))return B(S,{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,A.check)(e,A.is.notUndef,"put(channel, action): argument channel is undefined"),(0,A.check)(e,A.is.channel,"put(channel, action): argument "+e+" is not a valid channel"),(0,A.check)(n,A.is.notUndef,"put(channel, action): argument action is undefined")):((0,A.check)(e,A.is.notUndef,"put(action): argument action is undefined"),n=e,e=null),B(P,{channel:e,action:n})}function u(e){return B(N,e)}function i(e,n,t){(0,A.check)(n,A.is.notUndef,e+": argument fn is undefined");var r=null;if(A.is.array(n)){var o=n,a=j(o,2);r=a[0],n=a[1]}else if(n.fn){var u=n;r=u.context,n=u.fn}return(0,A.check)(n,A.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 B(T,i("call",e,t))}function f(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return B(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 B(x,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 B(R,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[R].detached=!0,o}function p(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];if(n.length>1)return n.map(function(e){return p(e)});var r=n[0];return(0,A.check)(r,A.is.notUndef,"join(task): argument task is undefined"),(0,A.check)(r,A.is.task,"join(task): argument "+r+" is not a valid Task object "+K),B(L,r)}function v(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];if(n.length>1)return n.map(function(e){return v(e)});var r=n[0];return 1===n.length&&((0,A.check)(r,A.is.notUndef,"cancel(task): argument task is undefined"),(0,A.check)(r,A.is.task,"cancel(task): argument "+r+" is not a valid Task object "+K)),B(U,r||A.SELF_CANCELLATION)}function g(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=A.ident:((0,A.check)(e,A.is.notUndef,"select(selector,[...]): argument selector is undefined"),(0,A.check)(e,A.is.func,"select(selector,[...]): argument "+e+" is not a function")),B(I,{selector:e,args:t})}function h(e,n){return(0,A.check)(e,A.is.notUndef,"actionChannel(pattern,...): argument pattern is undefined"),arguments.length>1&&((0,A.check)(n,A.is.notUndef,"actionChannel(pattern, buffer): argument buffer is undefined"),(0,A.check)(n,A.is.buffer,"actionChannel(pattern, buffer): argument "+n+" is not a valid buffer")),B(M,{pattern:e,buffer:n})}function y(){return B(D,{})}function b(e){return(0,A.check)(e,A.is.channel,"flush(channel): argument "+e+" is not valid channel"),B(q,e)}function m(e){return(0,A.check)(e,A.is.string,"getContext(prop): argument "+e+" is not a string"),B(H,e)}function E(e){return(0,A.check)(e,A.is.object,(0,A.createSetContextWarning)(null,e)),B(F,e)}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,[_.takeEveryHelper,e,n].concat(r))}function O(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,[_.takeLatestHelper,e,n].concat(r))}function C(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,[_.throttleHelper,e,n,t].concat(o))}Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.takem=void 0;var j=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=g,n.actionChannel=h,n.cancelled=y,n.flush=b,n.getContext=m,n.setContext=E,n.takeEvery=k,n.takeLatest=O,n.throttle=C;var A=t(1),_=t(6),w=(0,A.sym)("IO"),S="TAKE",P="PUT",N="RACE",T="CALL",x="CPS",R="FORK",L="JOIN",U="CANCEL",I="SELECT",M="ACTION_CHANNEL",D="CANCELLED",q="FLUSH",H="GET_CONTEXT",F="SET_CONTEXT",K="\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)",G=function(e,n){return e+" has been deprecated in favor of "+n+", please update your code"},B=function(e,n){var t;return t={},r(t,w,!0),r(t,e,n),t};o.maybe=function(){var e=o.apply(void 0,arguments);return e[S].maybe=!0,e};n.takem=(0,A.deprecate)(o.maybe,G("takem","take.maybe"));a.resolve=function(){var e=a.apply(void 0,arguments);return e[P].resolve=!0,e},a.sync=(0,A.deprecate)(a.resolve,G("put.sync","put.resolve"));var W=function(e){return function(n){return n&&n[w]&&n[e]}};n.asEffect={take:W(S),put:W(P),race:W(N),call:W(T),cps:W(x),fork:W(R),join:W(L),cancel:W(U),select:W(I),actionChannel:W(M),cancelled:W(D),flush:W(q),getContext:W(H),setContext:W(F)}},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?m.wildcard:s.is.array(e)?m.array:s.is.stringableFunc(e)?m.default:s.is.func(e)?m.predicate:m.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,s.remove)(u,e),e.cont=s.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=s.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(s.is.iterator(t))return t;var o=void 0,a=void 0;try{o=t.apply(n,r)}catch(u){a=u}return s.is.iterator(o)?o:a?(0,s.makeIterator)(function(){throw a}):(0,s.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(){ne.isRunning&&!ne.isCancelled&&(ne.isCancelled=!0,l(b))}function t(){e._isRunning&&!e._isCancelled&&(e._isCancelled=!0,te.cancelAll(),m(b))}function l(n,t){if(!ne.isRunning)throw new Error("Trying to resume an already finished generator");try{var r=void 0;t?r=e.throw(n):n===b?(ne.isCancelled=!0,l.cancel(),r=s.is.func(e.return)?e.return(b):{done:!0,value:b}):r=n===y?s.is.func(e.return)?e.return():{done:!0}:e.next(n),r.done?(ne.isMainRunning=!1,ne.cont&&ne.cont(r.value)):k(r.value,W,"",l)}catch(o){ne.isCancelled&&Y("error","uncaught at "+V,o.message),ne.isMainRunning=!1,ne.cont(o,!0)}}function m(n,t){e._isRunning=!1,Z.close(),t?(n instanceof Error&&(n.sagaStack="at "+V+" \n "+(n.sagaStack||n.stack)),ee.cont||(Y("error","uncaught",n.sagaStack||n.stack),n instanceof Error&&Q&&Q(n)),e._error=n,e._isAborted=!0,e._deferredEnd&&e._deferredEnd.reject(n)):(n===b&&s.isDev&&Y("info",V+" has been cancelled",""),e._result=n,e._deferredEnd&&e._deferredEnd.resolve(n)),ee.cont&&ee.cont(n,t),ee.joiners.forEach(function(e){return e.cb(n,t)}),ee.joiners=null}function k(e,n){function t(e,n){u||(u=!0,o.cancel=s.noop,J&&(n?J.effectRejected(a,e):J.effectResolved(a,e)),o(e,n))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments[3],a=(0,s.uid)();J&&J.effectTriggered({effectId:a,parentEffectId:n,label:r,effect:e});var u=void 0;t.cancel=s.noop,o.cancel=function(){if(!u){u=!0;try{t.cancel()}catch(e){Y("error","uncaught at "+V,e.message)}t.cancel=s.noop,J&&J.effectCancelled(a)}};var i=void 0;return s.is.promise(e)?O(e,t):s.is.helper(e)?S(E(e),a,t):s.is.iterator(e)?C(e,a,V,t):s.is.array(e)?T(e,a,t):s.is.notUndef(i=p.asEffect.take(e))?j(i,t):s.is.notUndef(i=p.asEffect.put(e))?A(i,t):s.is.notUndef(i=p.asEffect.race(e))?x(i,a,t):s.is.notUndef(i=p.asEffect.call(e))?_(i,a,t):s.is.notUndef(i=p.asEffect.cps(e))?w(i,t):s.is.notUndef(i=p.asEffect.fork(e))?S(i,a,t):s.is.notUndef(i=p.asEffect.join(e))?P(i,t):s.is.notUndef(i=p.asEffect.cancel(e))?N(i,t):s.is.notUndef(i=p.asEffect.select(e))?R(i,t):s.is.notUndef(i=p.asEffect.actionChannel(e))?L(i,t):s.is.notUndef(i=p.asEffect.flush(e))?I(i,t):s.is.notUndef(i=p.asEffect.cancelled(e))?U(i,t):s.is.notUndef(i=p.asEffect.getContext(e))?M(i,t):s.is.notUndef(i=p.asEffect.setContext(e))?D(i,t):t(e)}function O(e,n){var t=e[s.CANCEL];"function"==typeof t&&(n.cancel=t),e.then(n,function(e){return n(e,!0)})}function C(e,n,t,r){f(e,H,F,K,$,B,n,t,r)}function j(e,n){var t=e.channel,r=e.pattern,o=e.maybe;t=t||Z;var a=function(e){return e instanceof Error?n(e,!0):n((0,v.isEnd)(e)&&!o?y: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,d.asap)(function(){var e=void 0;try{e=(t?t.put:F)(r)}catch(a){if(t||o)return n(a,!0);Y("error","uncaught at "+V,a.stack||a.message||a)}return o&&s.is.promise(e)?void O(e,n):n(e)})}function _(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 s.is.promise(u)?O(u,t):s.is.iterator(u)?C(u,n,o.name,t):t(u)}function w(e,n){var t=e.context,r=e.fn,o=e.args;try{var a=function(e,t){return s.is.undef(e)?n(t):n(e,!0)};r.apply(t,o.concat(a)),a.cancel&&(n.cancel=function(){return a.cancel()})}catch(u){return n(u,!0)}}function S(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,d.suspend)();var l=f(i,H,F,K,$,B,n,o.name,u?null:s.noop);u?t(l):i._isRunning?(te.addTask(l),t(l)):i._error?te.abort(i._error):t(l)}finally{(0,d.flush)()}}function P(e,n){if(e.isRunning()){var t={task:ee,cb:n};n.cancel=function(){return(0,s.remove)(e.joiners,t)},e.joiners.push(t)}else e.isAborted()?n(e.error(),!0):n(e.result())}function N(e,n){e===s.SELF_CANCELLATION&&(e=ee),e.isRunning()&&e.cancel(),n()}function T(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,v.isEnd)(e)||e===y||e===b?(t.cancel(),t(e,i)):(u[n]=e,o++,r()))};return i.cancel=s.noop,i});t.cancel=function(){a||(a=!0,i.forEach(function(e){return e.cancel()}))},e.forEach(function(e,t){return k(e,n,t,i[t])})}function x(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,v.isEnd)(n)||n===y||n===b||(t.cancel(),r=!0,t(a({},e,n))))};n.cancel=s.noop,u[e]=n}),t.cancel=function(){r||(r=!0,o.forEach(function(e){return u[e].cancel()}))},o.forEach(function(t){r||k(e[t],n,t,u[t])})}function R(e,n){var t=e.selector,r=e.args;try{var a=t.apply(void 0,[K()].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,v.eventChannel)(H,r||g.buffers.fixed(),o))}function U(e,n){n(!!ne.isCancelled)}function I(e,n){e.flush(n)}function M(e,n){n($[e])}function D(e,n){s.object.assign($,e),n()}function q(e,n,o,u){var i,c,f;return o._deferredEnd=null,c={},a(c,s.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,s.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}),a(c,"setContext",function(e){(0,s.check)(e,s.is.object,(0,s.createSetContextWarning)("task",e)),s.object.assign($,e)}),r(c,f),c}var H=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return s.noop},F=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.noop,K=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.noop,G=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},B=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},W=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,V=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"anonymous",X=arguments[8];(0,s.check)(e,s.is.iterator,h);var J=B.sagaMonitor,z=B.logger,Q=B.onError,Y=z||s.log,Z=(0,v.stdChannel)(H),$=Object.create(G);l.cancel=s.noop;var ee=q(W,V,e,X),ne={name:V,cancel:n,isRunning:!0},te=i(V,ne,m);return X&&(X.cancel=t),e._isRunning=!0,l(),ee}Object.defineProperty(n,"__esModule",{value:!0}),n.TASK_CANCEL=n.CHANNEL_END=n.NOT_ITERATOR_ERROR=void 0;var l="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.default=f;var s=t(1),d=t(7),p=t(4),v=t(3),g=t(2),h=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",y=n.CHANNEL_END={toString:function(){return"@@redux-saga/CHANNEL_END"}},b=n.TASK_CANCEL={toString:function(){return"@@redux-saga/TASK_CANCEL"}},m={wildcard:function(){return s.kTrue},"default":function(e){return function(n){return n.type===("symbol"===("undefined"==typeof e?"undefined":l(e))?e:String(e))}},array:function(e){return function(n){return e.some(function(e){return u(e)(n)})}},predicate:function(e){return function(n){return e(n)}}},E=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,g=function(e){return d=e},h=function(e){return p=e};return r({q1:function(){return["q2",i,h]},q2:function(){return p===f.END?[v]:d?["q3",l(d)]:["q1",c(p),g]},q3:function(){return["q1",c(p),g]}},"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,g={done:!1,value:(0,s.actionChannel)(n,d.buffers.sliding(1))},h=function(){return{done:!1,value:(0,s.take)(p)}},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},E=function(e){return p=e};return r({q1:function(){return["q2",g,E]},q2:function(){return["q3",h(),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(3),l=t(1),s=t(4),d=t(2),p={done:!0,value:void 0},v={},g=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,g("takeEvery")),n.takeLatest=(0,l.deprecate)(u,g("takeLatest")),n.throttle=(0,l.deprecate)(i,g("throttle"))},function(e,n){"use strict";function t(e){try{o(),e()}finally{a()}}function r(e){i.push(e),c||(o(),u())}function o(){c++}function a(){c--}function u(){a();for(var e=void 0;!c&&void 0!==(e=i.shift());)t(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.asap=r,n.suspend=o,n.flush=u;var i=[],c=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,"getContext",{enumerable:!0,get:function(){return r.getContext}}),Object.defineProperty(n,"setContext",{enumerable:!0,get:function(){return r.setContext}}),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(e,n){var t={};for(var r in e)n.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}function u(){function e(e){function n(e,n,a){return(0,f.default)(e.apply(void 0,o(n)),d.subscribe,p,t,r,u,a,e.name)}var t=e.getState,a=e.dispatch;c=n;var d=(0,l.emitter)();d.emit=(u.emitter||i.ident)(d.emit);var p=(0,i.wrapSagaDispatch)(a);return function(e){return function(n){s&&s.actionDispatched(n);var t=e(n);return d.emit(n),t}}}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.context,r=void 0===t?{}:t,u=a(n,["context"]),c=void 0,s=u.sagaMonitor;if(s&&(s.effectTriggered=s.effectTriggered||i.noop,s.effectResolved=s.effectResolved||i.noop,s.effectRejected=s.effectRejected||i.noop,s.effectCancelled=s.effectCancelled||i.noop,s.actionDispatched=s.actionDispatched||i.noop),i.is.func(u))throw new Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(u.logger&&!i.is.func(u.logger))throw new Error("`options.logger` passed to the Saga middleware is not a function!");if(u.onerror&&(i.isDev&&(0,i.log)("warn","`options.onerror` is deprecated. Use `options.onError` instead."),u.onError=u.onerror,delete u.onerror),u.onError&&!i.is.func(u.onError))throw new Error("`options.onError` passed to the Saga middleware is not a function!");if(u.emitter&&!i.is.func(u.emitter))throw new Error("`options.emitter` passed to the Saga middleware is not a function!");return e.run=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];(0,i.check)(c,i.is.notUndef,"Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware"),(0,i.check)(e,i.is.func,"sagaMiddleware.run(saga, ...args): saga argument must be a Generator function!");var o=(0,i.uid)();s&&s.effectTriggered({effectId:o,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:t}});var a=c(e,t,o);return s&&s.effectResolved(o,a),a},e.setContext=function(e){(0,i.check)(e,i.is.object,(0,i.createSetContextWarning)("sagaMiddleware",e)),i.object.assign(r,e)},e}Object.defineProperty(n,"__esModule",{value:!0}),n.default=u;var i=t(1),c=t(5),f=r(c),l=t(3)},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.context,c=n.sagaMonitor,f=n.logger,l=n.onError;(0,a.check)(e,a.is.iterator,"runSaga must be called on an iterator");var s=(0,a.uid)();c&&c.effectTriggered({effectId:s,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:[]}});var d=(0,i.default)(e,t,(0,a.wrapSagaDispatch)(r),o,u,{sagaMonitor:c,logger:f,onError:l},s,e.name);return c&&c.effectResolved(s,d),d}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(5);Object.defineProperty(n,"CHANNEL_END",{enumerable:!0,get:function(){return a.CHANNEL_END}})}])}); |
@@ -1,1 +0,1 @@ | ||
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, takeEvery, takeLatest, throttle } from './internal/io'; | ||
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, getContext, setContext, takeEvery, takeLatest, throttle } from './internal/io'; |
@@ -5,3 +5,3 @@ 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, deprecate, SELF_CANCELLATION } from './utils'; | ||
import { sym, is, ident, check, deprecate, createSetContextWarning, SELF_CANCELLATION } from './utils'; | ||
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers'; | ||
@@ -22,2 +22,4 @@ | ||
var FLUSH = 'FLUSH'; | ||
var GET_CONTEXT = 'GET_CONTEXT'; | ||
var SET_CONTEXT = 'SET_CONTEXT'; | ||
@@ -214,2 +216,12 @@ var TEST_HINT = '\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)'; | ||
export function getContext(prop) { | ||
check(prop, is.string, 'getContext(prop): argument ' + prop + ' is not a string'); | ||
return effect(GET_CONTEXT, prop); | ||
} | ||
export function setContext(props) { | ||
check(props, is.object, createSetContextWarning(null, props)); | ||
return effect(SET_CONTEXT, props); | ||
} | ||
export function takeEvery(patternOrChannel, worker) { | ||
@@ -257,3 +269,5 @@ for (var _len8 = arguments.length, args = Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) { | ||
cancelled: createAsEffectType(CANCELLED), | ||
flush: createAsEffectType(FLUSH) | ||
flush: createAsEffectType(FLUSH), | ||
getContext: createAsEffectType(GET_CONTEXT), | ||
setContext: createAsEffectType(SET_CONTEXT) | ||
}; |
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 { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log } from './utils'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
import { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log, object, createSetContextWarning } from './utils'; | ||
import proc from './proc'; | ||
@@ -9,4 +11,8 @@ import { emitter } from './channel'; | ||
export default function sagaMiddlewareFactory() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _ref$context = _ref.context, | ||
context = _ref$context === undefined ? {} : _ref$context, | ||
options = _objectWithoutProperties(_ref, ['context']); | ||
var runSagaDynamically = void 0; | ||
@@ -51,5 +57,5 @@ var sagaMonitor = options.sagaMonitor; | ||
function sagaMiddleware(_ref) { | ||
var getState = _ref.getState, | ||
dispatch = _ref.dispatch; | ||
function sagaMiddleware(_ref2) { | ||
var getState = _ref2.getState, | ||
dispatch = _ref2.dispatch; | ||
@@ -62,3 +68,3 @@ runSagaDynamically = runSaga; | ||
function runSaga(saga, args, sagaId) { | ||
return proc(saga.apply(undefined, _toConsumableArray(args)), sagaEmitter.subscribe, sagaDispatch, getState, options, sagaId, saga.name); | ||
return proc(saga.apply(undefined, _toConsumableArray(args)), sagaEmitter.subscribe, sagaDispatch, getState, context, options, sagaId, saga.name); | ||
} | ||
@@ -97,3 +103,8 @@ | ||
sagaMiddleware.setContext = function (props) { | ||
check(props, is.object, createSetContextWarning('sagaMiddleware', props)); | ||
object.assign(context, props); | ||
}; | ||
return sagaMiddleware; | ||
} |
@@ -9,3 +9,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, SELF_CANCELLATION, makeIterator, isDev } from './utils'; | ||
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, object, TASK, CANCEL, SELF_CANCELLATION, makeIterator, isDev, createSetContextWarning } from './utils'; | ||
import { asap, suspend, flush } from './scheduler'; | ||
@@ -187,6 +187,7 @@ import { asEffect } from './io'; | ||
var getState = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop; | ||
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
var parentEffectId = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; | ||
var name = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'anonymous'; | ||
var cont = arguments[7]; | ||
var parentContext = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; | ||
var parentEffectId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; | ||
var name = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'anonymous'; | ||
var cont = arguments[8]; | ||
@@ -201,2 +202,3 @@ check(iterator, is.iterator, NOT_ITERATOR_ERROR); | ||
var stdChannel = _stdChannel(subscribe); | ||
var taskContext = Object.create(parentContext); | ||
/** | ||
@@ -422,3 +424,3 @@ Tracks the current effect cancellation | ||
// declarative effects | ||
: is.array(effect) ? runParallelEffect(effect, effectId, currCb) : is.notUndef(data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : is.notUndef(data = asEffect.put(effect)) ? runPutEffect(data, currCb) : is.notUndef(data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : is.notUndef(data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : is.notUndef(data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : is.notUndef(data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : is.notUndef(data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : is.notUndef(data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : is.notUndef(data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : is.notUndef(data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : is.notUndef(data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : is.notUndef(data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : /* anything else returned as is */currCb(effect) | ||
: is.array(effect) ? runParallelEffect(effect, effectId, currCb) : is.notUndef(data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : is.notUndef(data = asEffect.put(effect)) ? runPutEffect(data, currCb) : is.notUndef(data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : is.notUndef(data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : is.notUndef(data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : is.notUndef(data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : is.notUndef(data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : is.notUndef(data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : is.notUndef(data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : is.notUndef(data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : is.notUndef(data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : is.notUndef(data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : is.notUndef(data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : is.notUndef(data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect) | ||
); | ||
@@ -438,3 +440,3 @@ } | ||
function resolveIterator(iterator, effectId, name, cb) { | ||
proc(iterator, subscribe, dispatch, getState, options, effectId, name, cb); | ||
proc(iterator, subscribe, dispatch, getState, taskContext, options, effectId, name, cb); | ||
} | ||
@@ -537,3 +539,3 @@ | ||
suspend(); | ||
var _task = proc(taskIterator, subscribe, dispatch, getState, options, effectId, fn.name, detached ? null : noop); | ||
var _task = proc(taskIterator, subscribe, dispatch, getState, taskContext, options, effectId, fn.name, detached ? null : noop); | ||
@@ -700,2 +702,11 @@ if (detached) { | ||
function runGetContextEffect(prop, cb) { | ||
cb(taskContext[prop]); | ||
} | ||
function runSetContextEffect(props, cb) { | ||
object.assign(taskContext, props); | ||
cb(); | ||
} | ||
function newTask(id, name, iterator, cont) { | ||
@@ -726,4 +737,7 @@ var _done, _ref9, _mutatorMap; | ||
return iterator._error; | ||
}), _defineProperty(_ref9, 'setContext', function setContext(props) { | ||
check(props, is.object, createSetContextWarning('task', props)); | ||
object.assign(taskContext, props); | ||
}), _defineEnumerableProperties(_ref9, _mutatorMap), _ref9; | ||
} | ||
} |
@@ -8,2 +8,3 @@ import { is, check, uid as nextSagaId, wrapSagaDispatch } from './utils'; | ||
getState = _ref.getState, | ||
context = _ref.context, | ||
sagaMonitor = _ref.sagaMonitor, | ||
@@ -20,3 +21,3 @@ logger = _ref.logger, | ||
} | ||
var task = proc(iterator, subscribe, wrapSagaDispatch(dispatch), getState, { sagaMonitor: sagaMonitor, logger: logger, onError: onError }, effectId, iterator.name); | ||
var task = proc(iterator, subscribe, wrapSagaDispatch(dispatch), getState, context, { sagaMonitor: sagaMonitor, logger: logger, onError: onError }, effectId, iterator.name); | ||
@@ -23,0 +24,0 @@ if (sagaMonitor) { |
@@ -55,3 +55,9 @@ 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; }; | ||
}, | ||
string: function string(s) { | ||
return typeof s === 'string'; | ||
}, | ||
array: Array.isArray, | ||
object: function object(obj) { | ||
return obj && !is.array(obj) && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; | ||
}, | ||
promise: function promise(p) { | ||
@@ -76,3 +82,3 @@ return p && is.func(p.then); | ||
pattern: function pattern(pat) { | ||
return pat && (typeof pat === 'string' || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat)); | ||
return pat && (is.string(pat) || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat)); | ||
}, | ||
@@ -90,2 +96,12 @@ channel: function channel(ch) { | ||
export var object = { | ||
assign: function assign(target, source) { | ||
for (var i in source) { | ||
if (hasOwn(source, i)) { | ||
target[i] = source[i]; | ||
} | ||
} | ||
} | ||
}; | ||
export function remove(array, item) { | ||
@@ -218,2 +234,6 @@ var index = array.indexOf(item); | ||
export var createSetContextWarning = function createSetContextWarning(ctx, props) { | ||
return (ctx ? ctx + '.' : '') + 'setContext(props): argument ' + props + ' is not a plain object'; | ||
}; | ||
export function wrapSagaDispatch(dispatch) { | ||
@@ -220,0 +240,0 @@ return function sagaDispatch(action) { |
@@ -99,2 +99,14 @@ 'use strict'; | ||
}); | ||
Object.defineProperty(exports, 'getContext', { | ||
enumerable: true, | ||
get: function get() { | ||
return _io.getContext; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'setContext', { | ||
enumerable: true, | ||
get: function get() { | ||
return _io.setContext; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'takeEvery', { | ||
@@ -101,0 +113,0 @@ enumerable: true, |
@@ -24,2 +24,4 @@ 'use strict'; | ||
exports.flush = flush; | ||
exports.getContext = getContext; | ||
exports.setContext = setContext; | ||
exports.takeEvery = takeEvery; | ||
@@ -48,2 +50,4 @@ exports.takeLatest = takeLatest; | ||
var FLUSH = 'FLUSH'; | ||
var GET_CONTEXT = 'GET_CONTEXT'; | ||
var SET_CONTEXT = 'SET_CONTEXT'; | ||
@@ -240,2 +244,12 @@ var TEST_HINT = '\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)'; | ||
function getContext(prop) { | ||
(0, _utils.check)(prop, _utils.is.string, 'getContext(prop): argument ' + prop + ' is not a string'); | ||
return effect(GET_CONTEXT, prop); | ||
} | ||
function setContext(props) { | ||
(0, _utils.check)(props, _utils.is.object, (0, _utils.createSetContextWarning)(null, props)); | ||
return effect(SET_CONTEXT, props); | ||
} | ||
function takeEvery(patternOrChannel, worker) { | ||
@@ -283,3 +297,5 @@ for (var _len8 = arguments.length, args = Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) { | ||
cancelled: createAsEffectType(CANCELLED), | ||
flush: createAsEffectType(FLUSH) | ||
flush: createAsEffectType(FLUSH), | ||
getContext: createAsEffectType(GET_CONTEXT), | ||
setContext: createAsEffectType(SET_CONTEXT) | ||
}; |
@@ -20,5 +20,11 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function sagaMiddlewareFactory() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var _ref$context = _ref.context, | ||
context = _ref$context === undefined ? {} : _ref$context, | ||
options = _objectWithoutProperties(_ref, ['context']); | ||
var runSagaDynamically = void 0; | ||
@@ -63,5 +69,5 @@ var sagaMonitor = options.sagaMonitor; | ||
function sagaMiddleware(_ref) { | ||
var getState = _ref.getState, | ||
dispatch = _ref.dispatch; | ||
function sagaMiddleware(_ref2) { | ||
var getState = _ref2.getState, | ||
dispatch = _ref2.dispatch; | ||
@@ -74,3 +80,3 @@ runSagaDynamically = runSaga; | ||
function runSaga(saga, args, sagaId) { | ||
return (0, _proc2.default)(saga.apply(undefined, _toConsumableArray(args)), sagaEmitter.subscribe, sagaDispatch, getState, options, sagaId, saga.name); | ||
return (0, _proc2.default)(saga.apply(undefined, _toConsumableArray(args)), sagaEmitter.subscribe, sagaDispatch, getState, context, options, sagaId, saga.name); | ||
} | ||
@@ -109,3 +115,8 @@ | ||
sagaMiddleware.setContext = function (props) { | ||
(0, _utils.check)(props, _utils.is.object, (0, _utils.createSetContextWarning)('sagaMiddleware', props)); | ||
_utils.object.assign(context, props); | ||
}; | ||
return sagaMiddleware; | ||
} |
@@ -199,6 +199,7 @@ 'use strict'; | ||
var getState = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _utils.noop; | ||
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
var parentEffectId = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; | ||
var name = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'anonymous'; | ||
var cont = arguments[7]; | ||
var parentContext = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; | ||
var parentEffectId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; | ||
var name = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'anonymous'; | ||
var cont = arguments[8]; | ||
@@ -213,2 +214,3 @@ (0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
var stdChannel = (0, _channel.stdChannel)(subscribe); | ||
var taskContext = Object.create(parentContext); | ||
/** | ||
@@ -434,3 +436,3 @@ Tracks the current effect cancellation | ||
// declarative effects | ||
: _utils.is.array(effect) ? runParallelEffect(effect, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.take(effect)) ? runTakeEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.put(effect)) ? runPutEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.cps(effect)) ? runCPSEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.join(effect)) ? runJoinEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.select(effect)) ? runSelectEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.flush(effect)) ? runFlushEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : /* anything else returned as is */currCb(effect) | ||
: _utils.is.array(effect) ? runParallelEffect(effect, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.take(effect)) ? runTakeEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.put(effect)) ? runPutEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.cps(effect)) ? runCPSEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : _utils.is.notUndef(data = _io.asEffect.join(effect)) ? runJoinEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.select(effect)) ? runSelectEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.flush(effect)) ? runFlushEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : _utils.is.notUndef(data = _io.asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect) | ||
); | ||
@@ -450,3 +452,3 @@ } | ||
function resolveIterator(iterator, effectId, name, cb) { | ||
proc(iterator, subscribe, dispatch, getState, options, effectId, name, cb); | ||
proc(iterator, subscribe, dispatch, getState, taskContext, options, effectId, name, cb); | ||
} | ||
@@ -549,3 +551,3 @@ | ||
(0, _scheduler.suspend)(); | ||
var _task = proc(taskIterator, subscribe, dispatch, getState, options, effectId, fn.name, detached ? null : _utils.noop); | ||
var _task = proc(taskIterator, subscribe, dispatch, getState, taskContext, options, effectId, fn.name, detached ? null : _utils.noop); | ||
@@ -712,2 +714,11 @@ if (detached) { | ||
function runGetContextEffect(prop, cb) { | ||
cb(taskContext[prop]); | ||
} | ||
function runSetContextEffect(props, cb) { | ||
_utils.object.assign(taskContext, props); | ||
cb(); | ||
} | ||
function newTask(id, name, iterator, cont) { | ||
@@ -738,4 +749,7 @@ var _done, _ref9, _mutatorMap; | ||
return iterator._error; | ||
}), _defineProperty(_ref9, 'setContext', function setContext(props) { | ||
(0, _utils.check)(props, _utils.is.object, (0, _utils.createSetContextWarning)('task', props)); | ||
_utils.object.assign(taskContext, props); | ||
}), _defineEnumerableProperties(_ref9, _mutatorMap), _ref9; | ||
} | ||
} |
@@ -20,2 +20,3 @@ 'use strict'; | ||
getState = _ref.getState, | ||
context = _ref.context, | ||
sagaMonitor = _ref.sagaMonitor, | ||
@@ -32,3 +33,3 @@ logger = _ref.logger, | ||
} | ||
var task = (0, _proc2.default)(iterator, subscribe, (0, _utils.wrapSagaDispatch)(dispatch), getState, { sagaMonitor: sagaMonitor, logger: logger, onError: onError }, effectId, iterator.name); | ||
var task = (0, _proc2.default)(iterator, subscribe, (0, _utils.wrapSagaDispatch)(dispatch), getState, context, { sagaMonitor: sagaMonitor, logger: logger, onError: onError }, effectId, iterator.name); | ||
@@ -35,0 +36,0 @@ if (sagaMonitor) { |
@@ -74,3 +74,9 @@ 'use strict'; | ||
}, | ||
string: function string(s) { | ||
return typeof s === 'string'; | ||
}, | ||
array: Array.isArray, | ||
object: function object(obj) { | ||
return obj && !is.array(obj) && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; | ||
}, | ||
promise: function promise(p) { | ||
@@ -95,3 +101,3 @@ return p && is.func(p.then); | ||
pattern: function pattern(pat) { | ||
return pat && (typeof pat === 'string' || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat)); | ||
return pat && (is.string(pat) || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat)); | ||
}, | ||
@@ -109,2 +115,12 @@ channel: function channel(ch) { | ||
var object = exports.object = { | ||
assign: function assign(target, source) { | ||
for (var i in source) { | ||
if (hasOwn(source, i)) { | ||
target[i] = source[i]; | ||
} | ||
} | ||
} | ||
}; | ||
function remove(array, item) { | ||
@@ -237,2 +253,6 @@ var index = array.indexOf(item); | ||
var createSetContextWarning = exports.createSetContextWarning = function createSetContextWarning(ctx, props) { | ||
return (ctx ? ctx + '.' : '') + 'setContext(props): argument ' + props + ' is not a plain object'; | ||
}; | ||
function wrapSagaDispatch(dispatch) { | ||
@@ -239,0 +259,0 @@ return function sagaDispatch(action) { |
{ | ||
"name": "redux-saga", | ||
"version": "0.14.7", | ||
"version": "0.14.8", | ||
"description": "Saga middleware for Redux to handle Side Effects", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -151,3 +151,3 @@ # redux-saga | ||
```sh | ||
$ git clone https://github.com/yelouafi/redux-saga.git | ||
$ git clone https://github.com/redux-saga/redux-saga.git | ||
$ cd redux-saga | ||
@@ -154,0 +154,0 @@ $ npm install |
@@ -1,1 +0,1 @@ | ||
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, takeEvery, takeLatest, throttle } from './internal/io' | ||
export { take, takem, put, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, getContext, setContext, takeEvery, takeLatest, throttle } from './internal/io' |
@@ -1,2 +0,2 @@ | ||
import { sym, is, ident, check, deprecate, SELF_CANCELLATION } from './utils' | ||
import { sym, is, ident, check, deprecate, createSetContextWarning, SELF_CANCELLATION } from './utils' | ||
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers' | ||
@@ -17,2 +17,4 @@ | ||
const FLUSH = 'FLUSH' | ||
const GET_CONTEXT = 'GET_CONTEXT' | ||
const SET_CONTEXT = 'SET_CONTEXT' | ||
@@ -161,2 +163,12 @@ const TEST_HINT = '\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)' | ||
export function getContext(prop) { | ||
check(prop, is.string, `getContext(prop): argument ${ prop } is not a string`) | ||
return effect(GET_CONTEXT, prop) | ||
} | ||
export function setContext(props) { | ||
check(props, is.object, createSetContextWarning(null, props)) | ||
return effect(SET_CONTEXT, props) | ||
} | ||
export function takeEvery(patternOrChannel, worker, ...args) { | ||
@@ -188,3 +200,5 @@ return fork(takeEveryHelper, patternOrChannel, worker, ...args) | ||
cancelled : createAsEffectType(CANCELLED), | ||
flush : createAsEffectType(FLUSH) | ||
flush : createAsEffectType(FLUSH), | ||
getContext : createAsEffectType(GET_CONTEXT), | ||
setContext : createAsEffectType(SET_CONTEXT) | ||
} |
@@ -1,2 +0,2 @@ | ||
import { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log } from './utils' | ||
import { noop, is, check, uid as nextSagaId, wrapSagaDispatch, isDev, log, object, createSetContextWarning } from './utils' | ||
import proc from './proc' | ||
@@ -6,3 +6,3 @@ import { emitter } from './channel' | ||
export default function sagaMiddlewareFactory(options = {}) { | ||
export default function sagaMiddlewareFactory({ context = {}, ...options } = {}) { | ||
let runSagaDynamically | ||
@@ -69,2 +69,3 @@ const {sagaMonitor} = options | ||
getState, | ||
context, | ||
options, | ||
@@ -101,3 +102,8 @@ sagaId, | ||
sagaMiddleware.setContext = (props) => { | ||
check(props, is.object, createSetContextWarning('sagaMiddleware', props)) | ||
object.assign(context, props) | ||
} | ||
return sagaMiddleware | ||
} |
@@ -1,2 +0,2 @@ | ||
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, TASK, CANCEL, SELF_CANCELLATION, makeIterator, isDev } from './utils' | ||
import { noop, kTrue, is, log as _log, check, deferred, uid as nextEffectId, remove, object, TASK, CANCEL, SELF_CANCELLATION, makeIterator, isDev, createSetContextWarning } from './utils' | ||
import { asap, suspend, flush } from './scheduler' | ||
@@ -142,2 +142,3 @@ import { asEffect } from './io' | ||
getState = noop, | ||
parentContext = {}, | ||
options = {}, | ||
@@ -153,2 +154,3 @@ parentEffectId = 0, | ||
const stdChannel = _stdChannel(subscribe) | ||
const taskContext = Object.create(parentContext) | ||
/** | ||
@@ -392,2 +394,4 @@ Tracks the current effect cancellation | ||
: (is.notUndef(data = asEffect.cancelled(effect))) ? runCancelledEffect(data, currCb) | ||
: (is.notUndef(data = asEffect.getContext(effect))) ? runGetContextEffect(data, currCb) | ||
: (is.notUndef(data = asEffect.setContext(effect))) ? runSetContextEffect(data, currCb) | ||
: /* anything else returned as is */ currCb(effect) | ||
@@ -409,3 +413,3 @@ ) | ||
function resolveIterator(iterator, effectId, name, cb) { | ||
proc(iterator, subscribe, dispatch, getState, options, effectId, name, cb) | ||
proc(iterator, subscribe, dispatch, getState, taskContext, options, effectId, name, cb) | ||
} | ||
@@ -489,3 +493,13 @@ | ||
suspend() | ||
const task = proc(taskIterator, subscribe, dispatch, getState, options, effectId, fn.name, (detached ? null : noop)) | ||
const task = proc( | ||
taskIterator, | ||
subscribe, | ||
dispatch, | ||
getState, | ||
taskContext, | ||
options, | ||
effectId, | ||
fn.name, | ||
(detached ? null : noop) | ||
) | ||
@@ -638,2 +652,11 @@ if(detached) { | ||
function runGetContextEffect(prop, cb) { | ||
cb(taskContext[prop]) | ||
} | ||
function runSetContextEffect(props, cb) { | ||
object.assign(taskContext, props) | ||
cb() | ||
} | ||
function newTask(id, name, iterator, cont) { | ||
@@ -664,5 +687,9 @@ iterator._deferredEnd = null | ||
result: () => iterator._result, | ||
error: () => iterator._error | ||
error: () => iterator._error, | ||
setContext(props) { | ||
check(props, is.object, createSetContextWarning('task', props)) | ||
object.assign(taskContext, props) | ||
} | ||
} | ||
} | ||
} |
@@ -10,2 +10,3 @@ import { is, check, uid as nextSagaId, wrapSagaDispatch } from './utils' | ||
getState, | ||
context, | ||
sagaMonitor, | ||
@@ -28,2 +29,3 @@ logger, | ||
getState, | ||
context, | ||
{sagaMonitor, logger, onError}, | ||
@@ -30,0 +32,0 @@ effectId, |
@@ -33,3 +33,5 @@ export const sym = id => `@@redux-saga/${id}` | ||
number : n => typeof n === 'number', | ||
string : s => typeof s === 'string', | ||
array : Array.isArray, | ||
object : obj => obj && !is.array(obj) && typeof obj === 'object', | ||
promise : p => p && is.func(p.then), | ||
@@ -41,3 +43,3 @@ iterator : it => it && is.func(it.next) && is.func(it.throw), | ||
buffer : buf => buf && is.func(buf.isEmpty) && is.func(buf.take) && is.func(buf.put), | ||
pattern : pat => pat && ((typeof pat === 'string') || (typeof pat === 'symbol') || is.func(pat) || is.array(pat)), | ||
pattern : pat => pat && (is.string(pat) || (typeof pat === 'symbol') || is.func(pat) || is.array(pat)), | ||
channel : ch => ch && is.func(ch.take) && is.func(ch.close), | ||
@@ -48,2 +50,12 @@ helper : it => it && it[HELPER], | ||
export const object = { | ||
assign(target, source) { | ||
for (let i in source) { | ||
if (hasOwn(source, i)) { | ||
target[i] = source[i] | ||
} | ||
} | ||
} | ||
} | ||
export function remove(array, item) { | ||
@@ -148,2 +160,4 @@ const index = array.indexOf(item) | ||
export const createSetContextWarning = (ctx, props) => `${ ctx ? ctx + '.' : '' }setContext(props): argument ${ props } is not a plain object` | ||
export function wrapSagaDispatch(dispatch) { | ||
@@ -150,0 +164,0 @@ return function sagaDispatch(action) { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
448539
7701