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