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

redux-saga

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-saga - npm Package Compare versions

Comparing version 1.0.0-beta.0 to 1.0.0-beta.1

es/internal/error-utils.js

2

dist/redux-saga.min.js

@@ -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={})}(this,function(n){"use strict";function t(n){return(t="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})(n)}function r(){return(r=Object.assign||function(n){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e])}return n}).apply(this,arguments)}function e(n,t){return Q.notUndef(n)&&J.call(n,t)}function o(n,t){var r=n.indexOf(t);0>r||n.splice(r,1)}function u(n){var t=!1;return function(){t||(t=!0,n())}}function c(n){void 0===n&&(n={});var t=r({},n),e=new Promise(function(n,r){t.resolve=n,t.reject=r});return t.promise=e,t}function i(n,t){void 0===t&&(t=!0);var r,e=new Promise(function(e){r=setTimeout(function(){return e(t)},n)});return e[q]=function(){return clearTimeout(r)},e}function a(n,t,r){void 0===t&&(t=Z),void 0===r&&(r="iterator");var e={name:r,next:n,throw:t,return:$};return"undefined"!=typeof Symbol&&(e[Symbol.iterator]=function(){return e}),e}function f(n,t){void 0===n&&(n=10);var r=Array(n),e=0,o=0,u=0,c=function(t){r[o]=t,o=(o+1)%n,e++},i=function(){if(0!=e){var t=r[u];return r[u]=null,e--,u=(u+1)%n,t}},a=function(){for(var n=[];e;)n.push(i());return n};return{isEmpty:function(){return 0==e},put:function(i){if(n>e)c(i);else{var f;switch(t){case en:throw Error(rn);case on:r[o]=i,u=o=(o+1)%n;break;case un:f=2*n,r=a(),e=r.length,o=r.length,u=0,r.length=f,n=f,c(i)}}},take:i,flush:a}}function l(n){dn.push(n),vn||(s(),v())}function s(){vn++}function d(){vn--}function v(){d();for(var n;!vn&&void 0!==(n=dn.shift());)!function(n){try{s(),n()}finally{d()}}(n)}function p(n){var t="*"===n?bn:Q.string(n)?hn:Q.array(n)?pn:Q.stringableFunc(n)?hn:Q.func(n)?gn:Q.symbol(n)?yn:null;if(null===t)throw Error("invalid pattern: "+n);return t(n)}function g(n){function t(){if(r&&e.length)throw nn("Cannot have a closed channel with pending takers");if(e.length&&!n.isEmpty())throw nn("Cannot have pending takers with non empty buffer")}void 0===n&&(n=ln());var r=!1,e=[];return{take:function(u){t(),r&&n.isEmpty()?u(mn):n.isEmpty()?(e.push(u),u.cancel=function(){return o(e,u)}):u(n.take())},put:function(o){if(t(),!r){if(!e.length)return n.put(o);var u=e[0];e.splice(0,1),u(o)}},flush:function(e){t(),e(r&&n.isEmpty()?mn:n.flush())},close:function(){if(t(),!r&&(r=!0,e.length)){var n=e;e=[];for(var o=0,u=n.length;u>o;o++)(0,n[o])(mn)}}}}function h(){var n,t=!1,r=[],e=r,c=function(){e===r&&(e=r.slice())},i=function(){t=!0;for(var n=r=e,o=0;n.length>o;o++)(0,n[o])(mn);e=[]};return n={},n[D]=!0,n.put=function(n){if(!t)if(En(n))i();else for(var o=r=e,u=0;o.length>u;u++){var c=o[u];c[P](n)&&(c.cancel(),c(n))}},n.take=function(n,r){void 0===r&&(r=bn),t?n(mn):(n[P]=r,c(),e.push(n),n.cancel=u(function(){c(),o(e,n)}))},n.close=i,n}function y(){var n=h(),t=n.put;return n.put=function(n){n[F]?t(n):l(function(){return t(n)})},n}function b(n){return Q.channel(n)?"channel":Q.stringableFunc(n)?n+"":Q.func(n)?n.name:n+""}function m(n,t,r){function e(t,r){if(u===jn)return kn;if(r)throw u=jn,r;o&&o(t);var e=n[u]();return u=e[0],o=e[2],u===jn?kn:e[1]}var o,u=t;return a(e,function(n){return e(null,n)},r)}function E(n,t){if(void 0===n&&(n="*"),Q.pattern(n))return Un(On,{pattern:n});if(Q.multicast(n)&&Q.notUndef(t)&&Q.pattern(t))return Un(On,{channel:n,pattern:t});if(Q.channel(n))return Un(On,{channel:n});throw Error("take(patternOrChannel): argument "+n+" is not valid channel or a valid pattern")}function C(n,t){return Q.undef(t)&&(t=n,n=null),Un(Sn,{channel:n,action:t})}function A(n){return Un(_n,n)}function k(n,t,r){var e=null;if(Q.array(t)){var o=t;e=o[0],t=o[1]}else if(t.fn){var u=t;e=u.context,t=u.fn}return e&&Q.string(t)&&Q.func(e[t])&&(t=e[t]),{context:e,fn:t,args:r}}function j(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];return Un(xn,k(0,n,r))}function O(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];return Un(Rn,k(0,n,r))}function S(){for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];return t.length>1?A(t.map(function(n){return S(n)})):Un(Nn,t[0])}function _(){for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(t.length>1)return A(t.map(function(n){return _(n)}));var e=t[0];return Un(qn,e||U)}function w(n,t){return Un(Mn,{pattern:n,buffer:t})}function x(n,t,e,u,i,f,d,h,y){function b(){n._isRunning&&!n._isCancelled&&(n._isCancelled=!0,I.cancelAll(),E(Bn))}function m(t,r){if(!M.isRunning)throw Error("Trying to resume an already finished generator");try{var e;r?e=n.throw(t):t===Bn?(M.isCancelled=!0,m.cancel(),e=Q.func(n.return)?n.return(Bn):{done:!0,value:Bn}):e=t===zn?Q.func(n.return)?n.return():{done:!0}:n.next(t),e.done?(M.isMainRunning=!1,M.cont&&M.cont(e.value)):A(e.value,d,"",m)}catch(n){M.isCancelled&&R(n),M.isMainRunning=!1,M.cont(n,!0)}}function E(t,r){n._isRunning=!1,r?(t instanceof Error&&Object.defineProperty(t,"sagaStack",{value:"at "+h+" \n "+(t.sagaStack||t.stack),configurable:!0}),L.cont||(t instanceof Error&&_?_(t):R(t)),n._error=t,n._isAborted=!0,n._deferredEnd&&n._deferredEnd.reject(t)):(n._result=t,n._deferredEnd&&n._deferredEnd.resolve(t)),L.cont&&L.cont(t,r),L.joiners.forEach(function(n){return n.cb(t,r)}),L.joiners=null}function C(n,c,i,d){void 0===i&&(i="");var y;return Q.promise(n)?k(n,d):Q.iterator(n)?j(n,c,h,d):(y=Gn.take(n))?function(n,r){var e=n.channel,o=void 0===e?t:e,u=n.pattern,c=n.maybe,i=function(n){n instanceof Error?r(n,!0):r(!En(n)||c?n:zn)};try{o.take(i,Q.notUndef(u)?p(u):null)}catch(n){return void r(n,!0)}r.cancel=i.cancel}(y,d):(y=Gn.put(n))?function(n,t){var r=n.channel,o=n.action,u=n.resolve;l(function(){var n;try{n=(r?r.put:e)(o)}catch(n){return R(n),void t(n,!0)}u&&Q.promise(n)?k(n,t):t(n)})}(y,d):(y=Gn.all(n))?function(n,t,e){var o=Object.keys(n);if(!o.length)return void e(Q.array(n)?[]:{});var u,c=0,i={},a={};o.forEach(function(t){var f=function(a,f){u||(f||En(a)||a===zn||a===Bn?(e.cancel(),e(a,f)):(i[t]=a,++c===o.length&&(u=!0,e(Q.array(n)?W.from(r({},i,{length:o.length})):i))))};f.cancel=B,a[t]=f}),e.cancel=function(){u||(u=!0,o.forEach(function(n){return a[n].cancel()}))},o.forEach(function(r){return A(n[r],t,r,a[r])})}(y,c,d):(y=Gn.race(n))?function(n,t,e){var o,u=Object.keys(n),c={};u.forEach(function(t){var i=function(c,i){if(!o)if(i)e.cancel(),e(c,!0);else if(!En(c)&&c!==zn&&c!==Bn){var a;e.cancel(),o=!0;var f=(a={},a[t]=c,a);e(Q.array(n)?[].slice.call(r({},f,{length:u.length})):f)}};i.cancel=B,c[t]=i}),e.cancel=function(){o||(o=!0,u.forEach(function(n){return c[n].cancel()}))},u.forEach(function(r){o||A(n[r],t,r,c[r])})}(y,c,d):(y=Gn.call(n))?function(n,t,r){var e,o=n.context,u=n.fn,c=n.args;try{e=u.apply(o,c)}catch(n){return void r(n,!0)}return Q.promise(e)?k(e,r):Q.iterator(e)?j(e,t,u.name,r):r(e)}(y,c,d):(y=Gn.cps(n))?function(n,t){var r=n.context,e=n.fn,o=n.args;try{var u=function(n,r){return Q.undef(n)?t(r):t(n,!0)};e.apply(r,o.concat(u)),u.cancel&&(t.cancel=function(){return u.cancel()})}catch(n){return void t(n,!0)}}(y,d):(y=Gn.fork(n))?function(n,r,o){var c=n.fn,i=n.detached,l=function(n){var t=n.context,r=n.fn,e=n.args;if(Q.iterator(r))return r;var o,u;try{o=r.apply(t,e)}catch(n){u=n}return Q.iterator(o)?o:a(u?function(){throw u}:function(){var n,t={done:!1,value:o};return function(r){return n?function(n){return{done:!0,value:r}}():(n=!0,t)}}())}({context:n.context,fn:c,args:n.args});try{s();var d=x(l,t,e,u,N,f,r,c.name,i?null:B);i?o(d):l._isRunning?(I.addTask(d),o(d)):l._error?I.abort(l._error):o(d)}finally{v()}}(y,c,d):(y=Gn.join(n))?function(n,t){if(n.isRunning()){var r={task:L,cb:t};t.cancel=function(){return o(n.joiners,r)},n.joiners.push(r)}else n.isAborted()?t(n.error(),!0):t(n.result())}(y,d):(y=Gn.cancel(n))?function(n,t){n===U&&(n=L);n.isRunning()&&n.cancel();t()}(y,d):(y=Gn.select(n))?function(n,t){var r=n.selector,e=n.args;try{var o=r.apply(void 0,[u()].concat(e));t(o)}catch(n){t(n,!0)}}(y,d):(y=Gn.actionChannel(n))?function(n,r){var e=n.pattern,o=g(n.buffer),u=p(e);t.take(function n(r){En(r)||t.take(n,u),o.put(r)},u),r(o)}(y,d):(y=Gn.flush(n))?function(n,t){n.flush(t)}(y,d):(y=Gn.cancelled(n))?function(n,t){t(!!M.isCancelled)}(0,d):(y=Gn.getContext(n))?function(n,t){t(N[n])}(y,d):(y=Gn.setContext(n))?function(n,t){V.assign(N,n),t()}(y,d):d(n)}function A(n,t,r,e){function o(n,t){c||(c=!0,e.cancel=B,S&&(t?S.effectRejected(u,n):S.effectResolved(u,n)),e(n,t))}void 0===r&&(r="");var u=Y();S&&S.effectTriggered({effectId:u,parentEffectId:t,label:r,effect:n});var c;o.cancel=B,e.cancel=function(){if(!c){c=!0;try{o.cancel()}catch(n){R(n)}o.cancel=B,S&&S.effectCancelled(u)}},Q.func(w)?w(function(n){return C(n,u,r,o)})(n):C(n,u,r,o)}function k(n,t){var r=n[q];Q.func(r)?t.cancel=r:Q.func(n.abort)&&(t.cancel=function(){return n.abort()}),n.then(t,function(n){return t(n,!0)})}function j(n,r,o,c){x(n,t,e,u,N,f,r,o,c)}void 0===e&&(e=B),void 0===u&&(u=B),void 0===i&&(i={}),void 0===f&&(f={}),void 0===d&&(d=0),void 0===h&&(h="anonymous");var O=f,S=O.sagaMonitor,_=O.onError,w=O.middleware,T=O.logger||function(n,t,r){void 0===r&&(r=""),"undefined"==typeof window?console.log("redux-saga "+n+": "+t+"\n"+(r&&r.stack||r)):console[n](t,r)},R=function(n){var t=n.sagaStack;!t&&n.stack&&(t=-1!==n.stack.split("\n")[0].indexOf(n.message)?n.stack:"Error: "+n.message+"\n"+n.stack),T("error","uncaught at "+h,t||n.message||n)},N=Object.create(i);m.cancel=B;var L=function(n,t,r,e){var o;return r._deferredEnd=null,o={},o[H]=!0,o.id=n,o.name=t,o.toPromise=function(){if(r._deferredEnd)return r._deferredEnd.promise;var n=c();return r._deferredEnd=n,r._isRunning||(r._isAborted?n.reject(r._error):n.resolve(r._result)),n.promise},o.cont=e,o.joiners=[],o.cancel=b,o.isRunning=function(){return r._isRunning},o.isCancelled=function(){return r._isCancelled},o.isAborted=function(){return r._isAborted},o.result=function(){return r._result},o.error=function(){return r._error},o.setContext=function(n){V.assign(N,n)},o}(d,h,n,y),M={name:h,cancel:function(){M.isRunning&&!M.isCancelled&&(M.isCancelled=!0,m(Bn))},isRunning:!0},I=function(n,t,r){function e(n){c(),r(n,!0)}function u(n){a.push(n),n.cont=function(u,c){f||(o(a,n),n.cont=B,c?e(u):(n===t&&(i=u),a.length||(f=!0,r(i))))}}function c(){f||(f=!0,a.forEach(function(n){n.cont=B,n.cancel()}),a=[])}var i,a=[],f=!1;return u(t),{addTask:u,cancelAll:c,abort:e,getTasks:function(){return a},taskNames:function(){return a.map(function(n){return n.name})}}}(0,M,E);return y&&(y.cancel=b),n._isRunning=!0,m(),L}function T(n,t){for(var r=arguments.length,e=Array(r>2?r-2:0),o=2;r>o;o++)e[o-2]=arguments[o];var u=t.apply(void 0,e),c=n.channel,i=void 0===c?y():c,a=n.dispatch,f=n.getState,l=n.context,s=n.sagaMonitor,d=n.logger,v=n.effectMiddlewares,p=n.onError,g=Y();s&&(s.effectTriggered=s.effectTriggered||B,s.effectResolved=s.effectResolved||B,s.effectRejected=s.effectRejected||B,s.effectCancelled=s.effectCancelled||B,s.actionDispatched=s.actionDispatched||B,s.effectTriggered({effectId:g,root:!0,parentEffectId:0,effect:{root:!0,saga:t,args:e}}));var h=v&&function(){for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];return 0===t.length?function(n){return n}:1===t.length?t[0]:t.reduce(function(n,t){return function(){return n(t.apply(void 0,arguments))}})}.apply(void 0,v),b=x(u,i,tn(a),f,l,{sagaMonitor:s,logger:d,onError:p,middleware:h},g,t.name);return s&&s.effectResolved(g,b),b}var R,N=function(n){return n="@@redux-saga/"+n,"function"==typeof Symbol?Symbol(n):n},q=N("CANCEL_PROMISE"),L=N("CHANNEL_END"),M=N("CHANNEL_END"),I=N("IO"),P=N("MATCH"),D=N("MULTICAST"),F=N("SAGA_ACTION"),U=N("SELF_CANCELLATION"),H=N("TASK"),K=N("TASK_CANCEL"),G=function(n){return function(){return n}},z=G(!0),B=function(){},X=function(n){return n},J=Object.prototype.hasOwnProperty,Q={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&&!Q.array(n)&&"object"===t(n)},promise:function(n){return n&&Q.func(n.then)},iterator:function(n){return n&&Q.func(n.next)&&Q.func(n.throw)},iterable:function(n){return n&&Q.func(Symbol)?Q.func(n[Symbol.iterator]):Q.array(n)},task:function(n){return n&&n[H]},observable:function(n){return n&&Q.func(n.subscribe)},buffer:function(n){return n&&Q.func(n.isEmpty)&&Q.func(n.take)&&Q.func(n.put)},pattern:function(n){return n&&(Q.string(n)||Q.symbol(n)||Q.func(n)||Q.array(n))},channel:function(n){return n&&Q.func(n.take)&&Q.func(n.close)},stringableFunc:function(n){return Q.func(n)&&e(n,"toString")},symbol:function(n){return"symbol"===t(n)},multicast:function(n){return Q.channel(n)&&n[D]}},V={assign:function(n,t){for(var r in t)e(t,r)&&(n[r]=t[r])}},W={from:function(n){var t=Array(n.length);for(var r in n)e(n,r)&&(t[r]=n[r]);return t}},Y=function(n){return void 0===n&&(n=0),function(){return++n}}(),Z=function(n){throw n},$=function(n){return{value:n,done:!0}},nn=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")},tn=function(n){return function(t){return n(Object.defineProperty(t,F,{value:!0}))}},rn="Channel's Buffer overflow!",en=1,on=3,un=4,cn={isEmpty:z,put:B,take:B},an=function(){return cn},fn=function(n){return f(n,on)},ln=function(n){return f(n,un)},sn=Object.freeze({none:an,fixed:function(n){return f(n,en)},dropping:function(n){return f(n,2)},sliding:fn,expanding:ln}),dn=[],vn=0,pn=function(n){return function(t){return n.some(function(n){return p(n)(t)})}},gn=function(n){return function(t){return n(t)}},hn=function(n){return function(t){return t.type===n+""}},yn=function(n){return function(t){return t.type===n}},bn=function(){return z},mn={type:M},En=function(n){return n&&n.type===M},Cn="object"==typeof global&&global&&global.Object===Object&&global,An="object"==typeof self&&self&&self.Object===Object&&self,kn=(Cn||An||Function("return this")(),Function.prototype.toString.call(Object),function(n){var t,r=n.Symbol;"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable"}(R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),{done:!0,value:void 0}),jn={},On="TAKE",Sn="PUT",_n="ALL",wn="RACE",xn="CALL",Tn="CPS",Rn="FORK",Nn="JOIN",qn="CANCEL",Ln="SELECT",Mn="ACTION_CHANNEL",In="CANCELLED",Pn="FLUSH",Dn="GET_CONTEXT",Fn="SET_CONTEXT",Un=function(n,t){var r;return r={},r[I]=!0,r[n]=t,r},Hn=function(n){return n[Rn].detached=!0,n},Kn=function(n){return function(t){return t&&t[I]&&t[n]}},Gn={take:Kn(On),put:Kn(Sn),all:Kn(_n),race:Kn(wn),call:Kn(xn),cps:Kn(Tn),fork:Kn(Rn),join:Kn(Nn),cancel:Kn(qn),select:Kn(Ln),actionChannel:Kn(Mn),cancelled:Kn(In),flush:Kn(Pn),getContext:Kn(Dn),setContext:Kn(Fn)},zn={toString:function(){return L}},Bn={toString:function(){return K}},Xn=Object.freeze({take:E,takeMaybe:function(){var n=E.apply(void 0,arguments);return n[On].maybe=!0,n},put:C,putResolve:function(){var n=C.apply(void 0,arguments);return n[Sn].resolve=!0,n},all:A,race:function(n){return Un(wn,n)},call:j,apply:function(n,t,r){return void 0===r&&(r=[]),Un(xn,k(0,{context:n,fn:t},r))},cps:function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];return Un(Tn,k(0,n,r))},fork:O,spawn:function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];return Hn(O.apply(void 0,[n].concat(r)))},join:S,cancel:_,select:function(n){void 0===n&&(n=X);for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];return Un(Ln,{selector:n,args:r})},actionChannel:w,cancelled:function(){return Un(In,{})},flush:function(n){return Un(Pn,n)},getContext:function(n){return Un(Dn,n)},setContext:function(n){return Un(Fn,n)},takeEvery:function(n,t){for(var r=arguments.length,e=Array(r>2?r-2:0),o=2;r>o;o++)e[o-2]=arguments[o];return O.apply(void 0,[function(n,t){for(var r=arguments.length,e=Array(r>2?r-2:0),o=2;r>o;o++)e[o-2]=arguments[o];var u,c={done:!1,value:E(n)};return m({q1:function(){return["q2",c,function(n){return u=n}]},q2:function(){return u===mn?[jn]:["q1",{done:!1,value:O.apply(void 0,[t].concat(e,[u]))}]}},"q1","takeEvery("+b(n)+", "+t.name+")")},n,t].concat(e))},takeLatest:function(n,t){for(var r=arguments.length,e=Array(r>2?r-2:0),o=2;r>o;o++)e[o-2]=arguments[o];return O.apply(void 0,[function(n,t){for(var r=arguments.length,e=Array(r>2?r-2:0),o=2;r>o;o++)e[o-2]=arguments[o];var u,c,i={done:!1,value:E(n)},a=function(n){return{done:!1,value:O.apply(void 0,[t].concat(e,[n]))}},f=function(n){return u=n};return m({q1:function(){return["q2",i,function(n){return c=n}]},q2:function(){return c===mn?[jn]:u?["q3",function(n){return{done:!1,value:_(n)}}(u)]:["q1",a(c),f]},q3:function(){return["q1",a(c),f]}},"q1","takeLatest("+b(n)+", "+t.name+")")},n,t].concat(e))},throttle:function(n,t,r){for(var e=arguments.length,o=Array(e>3?e-3:0),u=3;e>u;u++)o[u-3]=arguments[u];return O.apply(void 0,[function(n,t,r){for(var e=arguments.length,o=Array(e>3?e-3:0),u=3;e>u;u++)o[u-3]=arguments[u];var c,a,f={done:!1,value:w(t,fn(1))},l={done:!1,value:j(i,n)};return m({q1:function(){return["q2",f,function(n){return a=n}]},q2:function(){return["q3",{done:!1,value:E(a)},function(n){return c=n}]},q3:function(){return c===mn?[jn]:["q4",{done:!1,value:O.apply(void 0,[r].concat(o,[c]))}]},q4:function(){return["q2",l]}},"q1","throttle("+b(t)+", "+r.name+")")},n,t,r].concat(o))}}),Jn=Object.freeze({noop:B,is:Q,deferred:c,arrayOfDeferred:function(n){for(var t=[],r=0;n>r;r++)t.push(c());return t},createMockTask:function(){var n,t,r,e=!0;return n={},n[H]=!0,n.isRunning=function(){return e},n.result=function(){return t},n.error=function(){return r},n.setRunning=function(n){return e=n},n.setResult=function(n){return t=n},n.setError=function(n){return r=n},n},cloneableGenerator:function n(t){return function(){for(var r=arguments.length,e=Array(r),o=0;r>o;o++)e[o]=arguments[o];var u=[],c=t.apply(void 0,e);return{next:function(n){return u.push(n),c.next(n)},clone:function(){var r=n(t).apply(void 0,e);return u.forEach(function(n){return r.next(n)}),r},return:function(n){return c.return(n)},throw:function(n){return c.throw(n)}}}},SAGA_ACTION:F,TASK:H,asEffect:Gn,CHANNEL_END:zn});n.default=function(n){function t(n){var r=n.getState,e=n.dispatch,l=y();return l.put=(u.emitter||X)(l.put),t.run=T.bind(null,{context:o,channel:l,dispatch:e,getState:r,sagaMonitor:c,logger:i,onError:a,effectMiddlewares:f}),function(n){return function(t){c&&c.actionDispatched&&c.actionDispatched(t);var r=n(t);return l.put(t),r}}}void 0===n&&(n={});var r=n,e=r.context,o=void 0===e?{}:e,u=function(n,t){if(null==n)return{};var r,e,o={},u=Object.keys(n);for(e=0;u.length>e;e++)0>t.indexOf(r=u[e])&&(o[r]=n[r]);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(n);for(e=0;c.length>e;e++)0>t.indexOf(r=c[e])&&Object.prototype.propertyIsEnumerable.call(n,r)&&(o[r]=n[r])}return o}(r,["context"]),c=u.sagaMonitor,i=u.logger,a=u.onError,f=u.effectMiddlewares;return t.run=function(){throw Error("Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware")},t.setContext=function(n){V.assign(o,n)},t},n.effects=Xn,n.utils=Jn,n.buffers=sn,n.runSaga=T,n.END=mn,n.eventChannel=function(n,t){void 0===t&&(t=an());var r,e=!1,o=g(t),c=function(){Q.func(r)&&r(),o.close()};if(r=n(function(n){if(En(n))return c(),void(e=!0);o.put(n)}),!Q.func(r))throw Error("in eventChannel: subscribe should return a function to unsubscribe");return r=u(r),e&&r(),{take:o.take,flush:o.flush,close:c}},n.channel=g,n.multicastChannel=h,n.stdChannel=y,n.CANCEL=q,n.delay=i,n.detach=Hn,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={})}(this,function(n){"use strict";function q(){return(q=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}var t=function(n){return"@@redux-saga/"+n},e=function(n){return n=t(n),"function"==typeof Symbol?Symbol(n):n},m=e("CANCEL_PROMISE"),r=e("CHANNEL_END"),o=e("CHANNEL_END"),u=e("IO"),i=e("MATCH"),f=e("MULTICAST"),c=e("SAGA_ACTION"),L=e("SELF_CANCELLATION"),E=e("TASK"),a=e("TASK_CANCEL"),l=function(n){return n=t(n),"function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for(n):n}("LOCATION"),s=function(n){return function(){return n}},d=s(!0),I=function(){},v=function(n){return n};var p=Object.prototype.hasOwnProperty;function g(n,t){return M.notUndef(n)&&p.call(n,t)}var M={undef:function(n){return null==n},notUndef:function(n){return null!=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&&!M.array(n)&&"object"==typeof n},promise:function(n){return n&&M.func(n.then)},iterator:function(n){return n&&M.func(n.next)&&M.func(n.throw)},iterable:function(n){return n&&M.func(Symbol)?M.func(n[Symbol.iterator]):M.array(n)},task:function(n){return n&&n[E]},observable:function(n){return n&&M.func(n.subscribe)},buffer:function(n){return n&&M.func(n.isEmpty)&&M.func(n.take)&&M.func(n.put)},pattern:function(n){return n&&(M.string(n)||M.symbol(n)||M.func(n)||M.array(n))},channel:function(n){return n&&M.func(n.take)&&M.func(n.close)},stringableFunc:function(n){return M.func(n)&&g(n,"toString")},symbol:function(n){return!!n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype},multicast:function(n){return M.channel(n)&&n[f]}},P={assign:function(n,t){for(var e in t)g(t,e)&&(n[e]=t[e])}};function D(n,t){var e=n.indexOf(t);e<0||n.splice(e,1)}var F={from:function(n){var t=Array(n.length);for(var e in n)g(n,e)&&(t[e]=n[e]);return t}};function h(n){var t=!1;return function(){t||(t=!0,n())}}function U(n){void 0===n&&(n={});var e=q({},n),t=new Promise(function(n,t){e.resolve=n,e.reject=t});return e.promise=t,e}function y(t,e){var r;void 0===e&&(e=!0);var n=new Promise(function(n){r=setTimeout(function(){return n(e)},t)});return n[m]=function(){return clearTimeout(r)},n}var H=function(n){return void 0===n&&(n=0),function(){return++n}}(),b=function(n){throw n},A=function(n){return{value:n,done:!0}};function G(n,t,e){void 0===t&&(t=b),void 0===e&&(e="iterator");var r={meta:{name:e},next:n,throw:t,return:A,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(r[Symbol.iterator]=function(){return r}),r}function K(n,t,e){void 0===e&&(e=""),"undefined"==typeof window?console.log("redux-saga "+n+": "+t+"\n"+(e&&e.stack||e)):console[n](t,e)}var C=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")},k=function(t){return function(n){return t(Object.defineProperty(n,c,{value:!0}))}},S="Channel's Buffer overflow!",j=1,O=3,w=4,_={isEmpty:d,put:I,take:I};function x(e,r){void 0===e&&(e=10);var o=Array(e),u=0,c=0,a=0,i=function(n){o[c]=n,c=(c+1)%e,u++},t=function(){if(0!=u){var n=o[a];return o[a]=null,u--,a=(a+1)%e,n}},f=function(){for(var n=[];u;)n.push(t());return n};return{isEmpty:function(){return 0==u},put:function(n){var t;if(u<e)i(n);else switch(r){case j:throw Error(S);case O:o[c]=n,a=c=(c+1)%e;break;case w:t=2*e,o=f(),c=u=o.length,a=0,e=o.length=t,i(n)}},take:t,flush:f}}var T=function(){return _},N=function(n){return x(n,O)},R=function(n){return x(n,w)},z=Object.freeze({none:T,fixed:function(n){return x(n,j)},dropping:function(n){return x(n,2)},sliding:N,expanding:R}),B=[],X=0;function J(n){try{V(),n()}finally{W()}}function Q(n){B.push(n),X||(V(),Y())}function V(){X++}function W(){X--}function Y(){var n;for(W();!X&&void 0!==(n=B.shift());)J(n)}var Z=function(n){return function(t){return n.some(function(n){return rn(n)(t)})}},$=function(t){return function(n){return t(n)}},nn=function(t){return function(n){return n.type===t+""}},tn=function(t){return function(n){return n.type===t}},en=function(){return d};function rn(n){var t="*"===n?en:M.string(n)?nn:M.array(n)?Z:M.stringableFunc(n)?nn:M.func(n)?$:M.symbol(n)?tn:null;if(null===t)throw Error("invalid pattern: "+n);return t(n)}var on={type:o},un=function(n){return n&&n.type===o};function cn(e){void 0===e&&(e=R());var r=!1,o=[];function u(){if(r&&o.length)throw C("Cannot have a closed channel with pending takers");if(o.length&&!e.isEmpty())throw C("Cannot have pending takers with non empty buffer")}return{take:function(n){u(),r&&e.isEmpty()?n(on):e.isEmpty()?(o.push(n),n.cancel=function(){return D(o,n)}):n(e.take())},put:function(n){if(u(),!r){if(!o.length)return e.put(n);var t=o[0];o.splice(0,1),t(n)}},flush:function(n){u(),r&&e.isEmpty()?n(on):n(e.flush())},close:function(){if(u(),!r&&(r=!0,o.length)){var n=o;o=[];for(var t=0,e=n.length;t<e;t++)(0,n[t])(on)}}}}function an(){var n,o=!1,u=[],c=u,e=function(){c===u&&(c=u.slice())},a=function(){o=!0;for(var n=u=c,t=0;t<n.length;t++){(0,n[t])(on)}c=[]};return(n={})[f]=!0,n.put=function(n){if(!o)if(un(n))a();else for(var t=u=c,e=0;e<t.length;e++){var r=t[e];r[i](n)&&(r.cancel(),r(n))}},n.take=function(n,t){void 0===t&&(t=matchers.wildcard),o?n(on):(n[i]=t,e(),c.push(n),n.cancel=h(function(){e(),D(c,n)}))},n.close=a,n}function fn(){var n=an(),t=n.put;return n.put=function(n){n[c]?t(n):Q(function(){return t(n)})},n}var ln,sn="object"==typeof global&&global&&global.Object===Object&&global,dn="object"==typeof self&&self&&self.Object===Object&&self;sn||dn||Function("return this")(),Function.prototype.toString.call(Object);ln="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var vn,pn;"function"==typeof(pn=ln.Symbol)?pn.observable?vn=pn.observable:(vn=pn("observable"),pn.observable=vn):vn="@@observable";function gn(n,t){return n+"?"+t}function hn(n){return n[l]}function yn(n){var t=n.name,e=n.location;return e?t+" "+gn(e.fileName,e.lineNumber):t}var bn=function(n,e){return void 0===e&&(e=function(n){return n}),n.reduce(function(n,t){return n.concat(e(t))},[])};function mn(n){var t,e,r,o=n[0],u=n.slice(1),c=o.effect?(t=hn(o.effect))?t.code+" "+gn(t.fileName,t.lineNumber):"":null;return["The above error occurred in task "+yn(o.meta)+(c?" \n when executing effect "+c:"")].concat(u.map(function(n){return" created by "+yn(n.meta)}),[(e=n,r=bn(e,function(n){return n.cancelledTasks}),r.length?["Tasks cancelled due to error:"].concat(r).join("\n"):"")]).join("\n")}var En={done:!0,value:void 0},An={};function Cn(n){return M.channel(n)?"channel":M.stringableFunc(n)?n+"":M.func(n)?n.name:n+""}function kn(r,n,t){var o,u=n;function e(n,t){if(u===An)return En;if(t)throw u=An,t;o&&o(n);var e=r[u]();return o=e[2],(u=e[0])===An?En:e[1]}return G(e,function(n){return e(null,n)},t)}function Sn(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];var u,c={done:!1,value:Bn(n)},a=function(n){return u=n};return kn({q1:function(){return["q2",c,a]},q2:function(){return u===on?[An]:["q1",(n=u,{done:!1,value:Wn.apply(void 0,[t].concat(r,[n]))})];var n}},"q1","takeEvery("+Cn(n)+", "+t.name+")")}function jn(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];var u,c,a={done:!1,value:Bn(n)},i=function(n){return{done:!1,value:Wn.apply(void 0,[t].concat(r,[n]))}},f=function(n){return u=n},l=function(n){return c=n};return kn({q1:function(){return["q2",a,l]},q2:function(){return c===on?[An]:u?["q3",(n=u,{done:!1,value:Yn(n)})]:["q1",i(c),f];var n},q3:function(){return["q1",i(c),f]}},"q1","takeLatest("+Cn(n)+", "+t.name+")")}function On(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];var u,c={done:!1,value:Bn(n)},a=function(n){return u=n};return kn({q1:function(){return["q2",c,a]},q2:function(){return u===on?[An]:["q1",(n=u,{done:!1,value:Vn.apply(void 0,[t].concat(r,[n]))})];var n}},"q1","takeLeading("+Cn(n)+", "+t.name+")")}function wn(n,t,e){for(var r=arguments.length,o=Array(3<r?r-3:0),u=3;u<r;u++)o[u-3]=arguments[u];var c,a,i={done:!1,value:Zn(t,N(1))},f={done:!1,value:$n(n)},l=function(n){return c=n},s=function(n){return a=n};return kn({q1:function(){return["q2",i,s]},q2:function(){return["q3",{done:!1,value:Bn(a)},l]},q3:function(){return c===on?[An]:["q4",(n=c,{done:!1,value:Wn.apply(void 0,[e].concat(o,[n]))})];var n},q4:function(){return["q2",f]}},"q1","throttle("+Cn(t)+", "+e.name+")")}var _n="TAKE",xn="PUT",Tn="ALL",Nn="RACE",Rn="CALL",qn="CPS",Ln="FORK",In="JOIN",Mn="CANCEL",Pn="SELECT",Dn="ACTION_CHANNEL",Fn="CANCELLED",Un="FLUSH",Hn="GET_CONTEXT",Gn="SET_CONTEXT",Kn=function(n,t){var e;return(e={})[u]=!0,e[n]=t,e},zn=function(n){return n[Ln].detached=!0,n};function Bn(n,t){if(void 0===n&&(n="*"),M.pattern(n))return Kn(_n,{pattern:n});if(M.multicast(n)&&M.notUndef(t)&&M.pattern(t))return Kn(_n,{channel:n,pattern:t});if(M.channel(n))return Kn(_n,{channel:n});throw Error("take(patternOrChannel): argument "+n+" is not valid channel or a valid pattern")}function Xn(n,t){return M.undef(t)&&(t=n,n=null),Kn(xn,{channel:n,action:t})}function Jn(n){return Kn(Tn,n)}function Qn(n,t,e){var r=null;if(M.array(t)){r=t[0],t=t[1]}else if(t.fn){r=t.context,t=t.fn}return r&&M.string(t)&&M.func(r[t])&&(t=r[t]),{context:r,fn:t,args:e}}function Vn(n){for(var t=arguments.length,e=Array(1<t?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return Kn(Rn,Qn(0,n,e))}function Wn(n){for(var t=arguments.length,e=Array(1<t?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return Kn(Ln,Qn(0,n,e))}function Yn(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];if(1<t.length)return Jn(t.map(function(n){return Yn(n)}));var r=t[0];return Kn(Mn,r||L)}function Zn(n,t){return Kn(Dn,{pattern:n,buffer:t})}var $n=Vn.bind(null,y),nt=function(t){return function(n){return n&&n[u]&&n[t]}},tt={take:nt(_n),put:nt(xn),all:nt(Tn),race:nt(Nn),call:nt(Rn),cps:nt(qn),fork:nt(Ln),join:nt(In),cancel:nt(Mn),select:nt(Pn),actionChannel:nt(Dn),cancelled:nt(Fn),flush:nt(Un),getContext:nt(Hn),setContext:nt(Gn)};function et(n){return{name:n.name||"anonymous",location:hn(n)}}var rt={toString:function(){return r}},ot={toString:function(){return a}};function ut(o,A,C,k,n,S,r,j,t){void 0===C&&(C=I),void 0===k&&(k=I),void 0===n&&(n={}),void 0===S&&(S={}),void 0===r&&(r=0);var a=S.sagaMonitor,u=S.onError,i=S.middleware,e=S.logger||K,f=function(n){e("error",n),n.sagaStack&&e("error",n.sagaStack)},O=Object.create(n),l=null,c=[];h.cancel=I;var s,d,v,p,g,w=(s=r,d=j,p=t,(g={})[E]=!((v=o)._deferredEnd=null),g.id=s,g.meta=d,g.toPromise=function(){if(v._deferredEnd)return v._deferredEnd.promise;var n=U();return v._deferredEnd=n,v._isRunning||(v._isAborted?n.reject(v._error):n.resolve(v._result)),n.promise},g.cont=p,g.joiners=[],g.cancel=Yn,g.isRunning=function(){return v._isRunning},g.isCancelled=function(){return v._isCancelled},g.isAborted=function(){return v._isAborted},g.result=function(){return v._result},g.error=function(){return v._error},g.setContext=function(n){P.assign(O,n)},g),_={meta:j,cancel:function(){_.isRunning&&!_.isCancelled&&(_.isCancelled=!0,h(ot))},isRunning:!0},x=function(r,t,o){var u,c=[],a=!1;function i(n){t(),e(),o(n,!0)}function n(e){c.push(e),e.cont=function(n,t){a||(D(c,e),e.cont=I,t?i(n):(e===r&&(u=n),c.length||(a=!0,o(u))))}}function e(){a||(a=!0,c.forEach(function(n){n.cont=I,n.cancel()}),c=[])}return n(r),{addTask:n,cancelAll:e,abort:i,getTasks:function(){return c},getTaskNames:function(){return c.map(function(n){return n.meta.name})}}}(_,function(){c.push.apply(c,x.getTaskNames())},y);return t&&(t.cancel=function(){o._isRunning&&!o._isCancelled&&(o._isCancelled=!0,x.cancelAll(),y(ot))}),o._isRunning=!0,h(),w;function h(n,t){if(!_.isRunning)throw Error("Trying to resume an already finished generator");try{var e;t?e=o.throw(n):n===ot?(_.isCancelled=!0,h.cancel(),e=M.func(o.return)?o.return(ot):{done:!0,value:ot}):e=n===rt?M.func(o.return)?o.return():{done:!0}:o.next(n),e.done?(_.isMainRunning=!1,_.cont&&_.cont(e.value)):T(e.value,r,"",h)}catch(n){_.isCancelled&&f(n),_.isMainRunning=!1,_.cont(n,!0)}}function y(t,e){var n,r;o._isRunning=!1,e?(r={meta:j,effect:l,cancelledTasks:c},"object"==typeof(n=t)&&(void 0===n.sagaStack&&Object.defineProperty(n,"sagaStack",{value:[],writable:!0,enumerable:!1}),n.sagaStack.push(r)),w.cont||(t.sagaStack&&(t.sagaStack=mn(t.sagaStack)),t instanceof Error&&u?u(t):f(t)),o._error=t,o._isAborted=!0,o._deferredEnd&&o._deferredEnd.reject(t)):(o._result=t,o._deferredEnd&&o._deferredEnd.resolve(t)),w.cont&&w.cont(t,e),w.joiners.forEach(function(n){return n.cb(t,e)}),w.joiners=null}function b(n,t,e){var r,o,u,c,a,i,f,l,s,d,v,p,g,h,y,b,m,E;return M.promise(n)?N(n,e):M.iterator(n)?R(n,t,j,e):(r=tt.take(n))?function(n,t){var e=n.channel,r=void 0===e?A:e,o=n.pattern,u=n.maybe,c=function(n){n instanceof Error?t(n,!0):!un(n)||u?t(n):t(rt)};try{r.take(c,M.notUndef(o)?rn(o):null)}catch(n){return void t(n,!0)}t.cancel=c.cancel}(r,e):(r=tt.put(n))?(y=e,b=(h=r).channel,m=h.action,E=h.resolve,void Q(function(){var n;try{n=(b?b.put:C)(m)}catch(n){return void y(n,!0)}E&&M.promise(n)?N(n,y):y(n)})):(r=tt.all(n))?function(r,t,o){var u=Object.keys(r);if(!u.length)return void o(M.array(r)?[]:{});var c,a=0,i={},f={};u.forEach(function(e){var n=function(n,t){c||(t||un(n)||n===rt||n===ot?(o.cancel(),o(n,t)):(i[e]=n,++a===u.length&&(c=!0,o(M.array(r)?F.from(q({},i,{length:u.length})):i))))};n.cancel=I,f[e]=n}),o.cancel=function(){c||(c=!0,u.forEach(function(n){return f[n].cancel()}))},u.forEach(function(n){return T(r[n],t,n,f[n])})}(r,t,e):(r=tt.race(n))?(s=t,d=e,g={},(p=Object.keys(l=r)).forEach(function(o){var n=function(n,t){if(!v)if(t)d.cancel(),d(n,!0);else if(!un(n)&&n!==rt&&n!==ot){var e;d.cancel(),v=!0;var r=((e={})[o]=n,e);d(M.array(l)?[].slice.call(q({},r,{length:p.length})):r)}};n.cancel=I,g[o]=n}),d.cancel=function(){v||(v=!0,p.forEach(function(n){return g[n].cancel()}))},void p.forEach(function(n){v||T(l[n],s,n,g[n])})):(r=tt.call(n))?function(n,t,e){var r,o=n.context,u=n.fn,c=n.args;try{r=u.apply(o,c)}catch(n){return void e(n,!0)}return M.promise(r)?N(r,e):M.iterator(r)?R(r,t,et(u),e):e(r)}(r,t,e):(r=tt.cps(n))?function(n,e){var t=n.context,r=n.fn,o=n.args;try{var u=function(n,t){return M.undef(n)?e(t):e(n,!0)};r.apply(t,o.concat(u)),u.cancel&&(e.cancel=function(){return u.cancel()})}catch(n){return void e(n,!0)}}(r,e):(r=tt.fork(n))?function(n,t,e){var r=n.fn,o=n.detached,u=function(n){var t,e,r,o,u=n.context,c=n.fn,a=n.args;if(M.iterator(c))return c;try{t=c.apply(u,a)}catch(n){e=n}return M.iterator(t)?t:G(e?function(){throw e}:(o={done:!1,value:t},function(n){return r?{done:!0,value:n}:(r=!0,o)}))}({context:n.context,fn:r,args:n.args}),c=(a=u,i=r,a.isSagaIterator?{name:a.meta.name}:et(i));var a,i;try{V();var f=ut(u,A,C,k,O,S,t,c,o?null:I);o?e(f):u._isRunning?(x.addTask(f),e(f)):u._error?x.abort(u._error):e(f)}finally{Y()}}(r,t,e):(r=tt.join(n))?function(n,t){if(n.isRunning()){var e={task:w,cb:t};t.cancel=function(){return D(n.joiners,e)},n.joiners.push(e)}else n.isAborted()?t(n.error(),!0):t(n.result())}(r,e):(r=tt.cancel(n))?function(n,t){n===L&&(n=w);n.isRunning()&&n.cancel();t()}(r,e):(r=tt.select(n))?function(n,t){var e=n.selector,r=n.args;try{var o=e.apply(void 0,[k()].concat(r));t(o)}catch(n){t(n,!0)}}(r,e):(r=tt.actionChannel(n))?(c=e,a=(u=r).pattern,i=cn(u.buffer),f=rn(a),A.take(function n(t){un(t)||A.take(n,f),i.put(t)},f),void c(i)):(r=tt.flush(n))?void r.flush(e):(r=tt.cancelled(n))?void e(!!_.isCancelled):(r=tt.getContext(n))?void e(O[r]):(r=tt.setContext(n))?(o=e,P.assign(O,r),void o()):e(n)}function T(e,n,t,r){void 0===t&&(t="");var o,u=H();function c(n,t){o||(o=!0,r.cancel=I,a&&(t?a.effectRejected(u,n):a.effectResolved(u,n)),t&&(l=e),r(n,t))}a&&a.effectTriggered({effectId:u,parentEffectId:n,label:t,effect:e}),c.cancel=I,r.cancel=function(){if(!o){o=!0;try{c.cancel()}catch(n){f(n)}c.cancel=I,a&&a.effectCancelled(u)}},M.func(i)?i(function(n){return b(n,u,c)})(e):b(e,u,c)}function N(n,t){var e=n[m];M.func(e)?t.cancel=e:M.func(n.abort)&&(t.cancel=function(){return n.abort()}),n.then(t,function(n){return t(n,!0)})}function R(n,t,e,r){ut(n,A,C,k,O,S,t,e,r)}}function ct(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];var u=t.apply(void 0,r),c=n.channel,a=void 0===c?fn():c,i=n.dispatch,f=n.getState,l=n.context,s=n.sagaMonitor,d=n.logger,v=n.effectMiddlewares,p=n.onError,g=H();s&&(s.effectTriggered=s.effectTriggered||I,s.effectResolved=s.effectResolved||I,s.effectRejected=s.effectRejected||I,s.effectCancelled=s.effectCancelled||I,s.actionDispatched=s.actionDispatched||I,s.effectTriggered({effectId:g,root:!0,parentEffectId:0,effect:{root:!0,saga:t,args:r}}));var h=v&&function(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];return 0===t.length?function(n){return n}:1===t.length?t[0]:t.reduce(function(n,t){return function(){return n(t.apply(void 0,arguments))}})}.apply(void 0,v),y=ut(u,a,k(i),f,l,{sagaMonitor:s,logger:d,onError:p,middleware:h},g,et(t));return s&&s.effectResolved(g,y),y}var at=Object.freeze({take:Bn,takeMaybe:function(){var n=Bn.apply(void 0,arguments);return n[_n].maybe=!0,n},put:Xn,putResolve:function(){var n=Xn.apply(void 0,arguments);return n[xn].resolve=!0,n},all:Jn,race:function(n){return Kn(Nn,n)},call:Vn,apply:function(n,t,e){return void 0===e&&(e=[]),Kn(Rn,Qn(0,{context:n,fn:t},e))},cps:function(n){for(var t=arguments.length,e=Array(1<t?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return Kn(qn,Qn(0,n,e))},fork:Wn,spawn:function(n){for(var t=arguments.length,e=Array(1<t?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return zn(Wn.apply(void 0,[n].concat(e)))},join:function t(){for(var n=arguments.length,e=Array(n),r=0;r<n;r++)e[r]=arguments[r];return 1<e.length?Jn(e.map(function(n){return t(n)})):Kn(In,e[0])},cancel:Yn,select:function(n){void 0===n&&(n=v);for(var t=arguments.length,e=Array(1<t?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return Kn(Pn,{selector:n,args:e})},actionChannel:Zn,cancelled:function(){return Kn(Fn,{})},flush:function(n){return Kn(Un,n)},getContext:function(n){return Kn(Hn,n)},setContext:function(n){return Kn(Gn,n)},takeEvery:function(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return Wn.apply(void 0,[Sn,n,t].concat(r))},takeLatest:function(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return Wn.apply(void 0,[jn,n,t].concat(r))},takeLeading:function(n,t){for(var e=arguments.length,r=Array(2<e?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return Wn.apply(void 0,[On,n,t].concat(r))},throttle:function(n,t,e){for(var r=arguments.length,o=Array(3<r?r-3:0),u=3;u<r;u++)o[u-3]=arguments[u];return Wn.apply(void 0,[wn,n,t,e].concat(o))},delay:$n}),it=Object.freeze({delay:y,noop:I,is:M,deferred:U,arrayOfDeferred:function(n){for(var t=[],e=0;e<n;e++)t.push(U());return t},createMockTask:function(){var n,t,e,r=!0;return(n={})[E]=!0,n.isRunning=function(){return r},n.result=function(){return t},n.error=function(){return e},n.setRunning=function(n){return r=n},n.setResult=function(n){return t=n},n.setError=function(n){return e=n},n},cloneableGenerator:function u(c){return function(){for(var n=arguments.length,e=Array(n),t=0;t<n;t++)e[t]=arguments[t];var r=[],o=c.apply(void 0,e);return{next:function(n){return r.push(n),o.next(n)},clone:function(){var t=u(c).apply(void 0,e);return r.forEach(function(n){return t.next(n)}),t},return:function(n){return o.return(n)},throw:function(n){return o.throw(n)}}}},SAGA_ACTION:c,TASK:E,asEffect:tt,CHANNEL_END:rt});n.default=function(n){void 0===n&&(n={});var t=n.context,o=void 0===t?{}:t,u=function(n,t){if(null==n)return{};var e,r,o={},u=Object.keys(n);for(r=0;r<u.length;r++)t.indexOf(e=u[r])<0&&(o[e]=n[e]);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(n);for(r=0;r<c.length;r++)t.indexOf(e=c[r])<0&&Object.prototype.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}(n,["context"]),c=u.sagaMonitor,a=u.logger,i=u.onError,f=u.effectMiddlewares;function l(n){var t=n.getState,e=n.dispatch,r=fn();return r.put=(u.emitter||v)(r.put),l.run=ct.bind(null,{context:o,channel:r,dispatch:e,getState:t,sagaMonitor:c,logger:a,onError:i,effectMiddlewares:f}),function(e){return function(n){c&&c.actionDispatched&&c.actionDispatched(n);var t=e(n);return r.put(n),t}}}return l.run=function(){throw Error("Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware")},l.setContext=function(n){P.assign(o,n)},l},n.effects=at,n.utils=it,n.buffers=z,n.runSaga=ct,n.END=on,n.eventChannel=function(n,t){void 0===t&&(t=T());var e,r=!1,o=cn(t),u=function(){M.func(e)&&e(),o.close()};if(e=n(function(n){if(un(n))return u(),void(r=!0);o.put(n)}),!M.func(e))throw Error("in eventChannel: subscribe should return a function to unsubscribe");return e=h(e),r&&e(),{take:o.take,flush:o.flush,close:u}},n.channel=cn,n.multicastChannel=an,n.stdChannel=fn,n.CANCEL=m,n.SAGA_LOCATION=l,n.detach=zn,Object.defineProperty(n,"__esModule",{value:!0})});
import {Action} from "redux";
import {END, Channel, Task, Buffer, Predicate} from "./index";
import {
END, TakeableChannel, PuttableChannel, FlushableChannel,
Task, Buffer, Predicate,
} from "./index";
import {GuardPredicate} from "./utils";
type ActionType = string | number | symbol;
export type ActionType = string | number | symbol;
type StringableActionCreator<A extends Action> = {
export type StringableActionCreator<A extends Action = Action> = {
(...args: any[]): A;

@@ -11,14 +15,24 @@ toString(): string;

type SubPattern =
ActionType |
Predicate<Action> |
StringableActionCreator<Action>;
export type SubPattern<T> =
| Predicate<T>
| StringableActionCreator
| ActionType;
export type Pattern =
SubPattern |
SubPattern[];
export type Pattern<T> =
| SubPattern<T>
| SubPattern<T>[];
export type ActionSubPattern<Guard extends Action = Action> =
| GuardPredicate<Guard, Action>
| StringableActionCreator<Guard>
| Predicate<Action>
| ActionType
export type ActionPattern<Guard extends Action = Action> =
| ActionSubPattern<Guard>
| ActionSubPattern<Guard>[];
export interface TakeEffectDescriptor {
pattern: Pattern;
pattern: ActionPattern;
maybe?: boolean;

@@ -28,3 +42,4 @@ }

export interface ChannelTakeEffectDescriptor<T> {
channel: Channel<T>;
channel: TakeableChannel<T>;
pattern?: Pattern<T>;
maybe?: boolean;

@@ -42,4 +57,4 @@ }

export interface Take {
<A extends Action>(pattern?: Pattern): TakeEffect;
<T>(channel: Channel<T>): ChannelTakeEffect<T>;
<A extends Action>(pattern?: ActionPattern<A>): TakeEffect;
<T>(channel: TakeableChannel<T>, multicastPattern?: Pattern<T>): ChannelTakeEffect<T>;
}

@@ -59,3 +74,3 @@

action: T;
channel: Channel<T>;
channel: PuttableChannel<T>;
resolve?: boolean;

@@ -74,3 +89,3 @@ }

<A extends Action>(action: A): PutEffect<A>;
<T>(channel: Channel<T>, action: T | END): ChannelPutEffect<T | END>;
<T>(channel: PuttableChannel<T>, action: T | END): ChannelPutEffect<T>;
}

@@ -112,4 +127,6 @@

export function race(effects: Effect[]): RaceEffect;
export function race(effects: {[key: string]: Effect}): RaceEffect;
export function race<T>(effects: T[]): GenericRaceEffect<T>;
export function race<T>(effects: {[key: string]: T}): GenericRaceEffect<T>;

@@ -128,12 +145,12 @@

type Func0 = () => any;
type Func1<T1> = (arg1: T1) => any;
type Func2<T1, T2> = (arg1: T1, arg2: T2) => any;
type Func3<T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3) => any;
type Func4<T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => any;
type Func5<T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5) => any;
type Func6Rest<T1, T2, T3, T4, T5, T6> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5, arg6: T6,
...rest: any[]) => any;
type Func0<R> = () => R;
type Func1<R, T1> = (arg1: T1) => R;
type Func2<R, T1, T2> = (arg1: T1, arg2: T2) => R;
type Func3<R, T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3) => R;
type Func4<R, T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R;
type Func5<R, T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5) => R;
type Func6Rest<R, T1, T2, T3, T4, T5, T6> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5, arg6: T6,
...rest: any[]) => R;

@@ -148,43 +165,43 @@ export type CallEffectFn<F extends Function> =

interface CallEffectFactory<R> {
(fn: CallEffectFn<Func0>): R;
<T1>(fn: CallEffectFn<Func1<T1>>,
arg1: T1): R;
<T1, T2>(fn: CallEffectFn<Func2<T1, T2>>,
arg1: T1, arg2: T2): R;
<T1, T2, T3>(fn: CallEffectFn<Func3<T1, T2, T3>>,
arg1: T1, arg2: T2, arg3: T3): R;
<T1, T2, T3, T4>(fn: CallEffectFn<Func4<T1, T2, T3, T4>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): R;
<T1, T2, T3, T4, T5>(fn: CallEffectFn<Func5<T1, T2, T3, T4, T5>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): R;
<T1, T2, T3, T4, T5, T6>(fn: CallEffectFn<Func6Rest<T1, T2, T3, T4, T5, T6>>,
arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5, arg6: T6, ...rest: any[]): R;
<C extends {[P in N]: Func0}, N extends string>(
fn: CallEffectNamedFn<C, N>): R;
<C extends {[P in N]: Func1<T1>}, N extends string, T1>(
interface CallEffectFactory<Effect> {
<C extends {[P in N]: Func0<R>}, N extends string, R>(
fn: CallEffectNamedFn<C, N>): Effect;
<C extends {[P in N]: Func1<R, T1>}, N extends string, R, T1>(
fn: CallEffectNamedFn<C, N>,
arg1: T1): R;
<C extends {[P in N]: Func2<T1, T2>}, N extends string, T1, T2>(
arg1: T1): Effect;
<C extends {[P in N]: Func2<R, T1, T2>}, N extends string, R, T1, T2>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2): R;
<C extends {[P in N]: Func3<T1, T2, T3>}, N extends string,
T1, T2, T3>(
arg1: T1, arg2: T2): Effect;
<C extends {[P in N]: Func3<R, T1, T2, T3>}, N extends string,
R, T1, T2, T3>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3): R;
<C extends {[P in N]: Func4<T1, T2, T3, T4>}, N extends string,
T1, T2, T3, T4>(
arg1: T1, arg2: T2, arg3: T3): Effect;
<C extends {[P in N]: Func4<R, T1, T2, T3, T4>}, N extends string,
R, T1, T2, T3, T4>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): R;
<C extends {[P in N]: Func5<T1, T2, T3, T4, T5>}, N extends string,
T1, T2, T3, T4, T5>(
arg1: T1, arg2: T2, arg3: T3, arg4: T4): Effect;
<C extends {[P in N]: Func5<R, T1, T2, T3, T4, T5>}, N extends string,
R, T1, T2, T3, T4, T5>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): R;
<C extends {[P in N]: Func6Rest<T1, T2, T3, T4, T5, T6>}, N extends string,
T1, T2, T3, T4, T5, T6>(
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): Effect;
<C extends {[P in N]: Func6Rest<R, T1, T2, T3, T4, T5, T6>}, N extends string,
R, T1, T2, T3, T4, T5, T6>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): R;
...rest: any[]): Effect;
<R>(fn: CallEffectFn<Func0<R>>): Effect;
<R, T1>(fn: CallEffectFn<Func1<R, T1>>,
arg1: T1): Effect;
<R, T1, T2>(fn: CallEffectFn<Func2<R, T1, T2>>,
arg1: T1, arg2: T2): Effect;
<R, T1, T2, T3>(fn: CallEffectFn<Func3<R, T1, T2, T3>>,
arg1: T1, arg2: T2, arg3: T3): Effect;
<R, T1, T2, T3, T4>(fn: CallEffectFn<Func4<R, T1, T2, T3, T4>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): Effect;
<R, T1, T2, T3, T4, T5>(fn: CallEffectFn<Func5<R, T1, T2, T3, T4, T5>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): Effect;
<R, T1, T2, T3, T4, T5, T6>(fn: CallEffectFn<Func6Rest<R, T1, T2, T3, T4, T5, T6>>,
arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5, arg6: T6, ...rest: any[]): Effect;
}

@@ -194,57 +211,57 @@

export function apply(context: any, fn: Func0): CallEffect;
export function apply<T1>(context: any, fn: Func1<T1>,
args: [T1]): CallEffect;
export function apply<T1, T2>(context: any, fn: Func2<T1, T2>,
args: [T1, T2]): CallEffect;
export function apply<T1, T2, T3>(context: any, fn: Func3<T1, T2, T3>,
args: [T1, T2, T3]): CallEffect;
export function apply<T1, T2, T3, T4>(context: any,
fn: Func4<T1, T2, T3, T4>,
args: [T1, T2, T3, T4]): CallEffect;
export function apply<T1, T2, T3, T4, T5>(
context: any, fn: Func5<T1, T2, T3, T4, T5>, args: [T1, T2, T3, T4, T5],
): CallEffect;
export function apply<T1, T2, T3, T4, T5, T6, AA extends any[] & {
0: T1; 1: T2; 2: T3; 3: T4; 4: T5; 5: T6;
}>(
context: any, fn: Func6Rest<T1, T2, T3, T4, T5, T6>, args: AA,
): CallEffect;
export function apply<C extends {[P in N]: Func0},
N extends string>(
export function apply<C extends {[P in N]: Func0<R>},
N extends string, R>(
context: C, fn: N): CallEffect;
export function apply<C extends {[P in N]: Func1<T1>},
export function apply<C extends {[P in N]: Func1<R, T1>},
N extends string,
T1>(
R, T1>(
context: C, fn: N,
args: [T1]): CallEffect;
export function apply<C extends {[P in N]: Func2<T1, T2>},
export function apply<C extends {[P in N]: Func2<R, T1, T2>},
N extends string,
T1, T2>(
R, T1, T2>(
context: C, fn: N,
args: [T1, T2]): CallEffect;
export function apply<C extends {[P in N]: Func3<T1, T2, T3>},
export function apply<C extends {[P in N]: Func3<R, T1, T2, T3>},
N extends string,
T1, T2, T3>(
R, T1, T2, T3>(
context: C, fn: N,
args: [T1, T2, T3]): CallEffect;
export function apply<C extends {[P in N]: Func4<T1, T2, T3, T4>},
export function apply<C extends {[P in N]: Func4<R, T1, T2, T3, T4>},
N extends string,
T1, T2, T3, T4>(
R, T1, T2, T3, T4>(
context: C, fn: N,
args: [T1, T2, T3, T4]): CallEffect;
export function apply<C extends {[P in N]: Func5<T1, T2, T3, T4, T5>},
export function apply<C extends {[P in N]: Func5<R, T1, T2, T3, T4, T5>},
N extends string,
T1, T2, T3, T4, T5>(
R, T1, T2, T3, T4, T5>(
context: C, fn: N,
args: [T1, T2, T3, T4, T5]): CallEffect;
export function apply<C extends {[P in N]: Func6Rest<T1, T2, T3, T4, T5, T6>},
export function apply<C extends {[P in N]: Func6Rest<R, T1, T2, T3, T4, T5, T6>},
N extends string,
T1, T2, T3, T4, T5, T6, AA extends any[] & {
0: T1; 1: T2; 2: T3; 3: T4; 4: T5; 5: T6;
}>(
R, T1, T2, T3, T4, T5, T6>(
context: C, fn: N,
args: AA): CallEffect;
args: any[] & {
0: T1; 1: T2; 2: T3; 3: T4; 4: T5; 5: T6;
}): CallEffect;
export function apply<R>(context: any, fn: Func0<R>): CallEffect;
export function apply<R, T1>(context: any, fn: Func1<R, T1>,
args: [T1]): CallEffect;
export function apply<R, T1, T2>(context: any, fn: Func2<R, T1, T2>,
args: [T1, T2]): CallEffect;
export function apply<R, T1, T2, T3>(context: any, fn: Func3<R, T1, T2, T3>,
args: [T1, T2, T3]): CallEffect;
export function apply<R, T1, T2, T3, T4>(context: any,
fn: Func4<R, T1, T2, T3, T4>,
args: [T1, T2, T3, T4]): CallEffect;
export function apply<R, T1, T2, T3, T4, T5>(
context: any, fn: Func5<R, T1, T2, T3, T4, T5>, args: [T1, T2, T3, T4, T5],
): CallEffect;
export function apply<R, T1, T2, T3, T4, T5, T6>(
context: any, fn: Func6Rest<R, T1, T2, T3, T4, T5, T6>, args: any[] & {
0: T1; 1: T2; 2: T3; 3: T4; 4: T5; 5: T6;
},
): CallEffect;

@@ -256,54 +273,54 @@

type CpsCallback = {
(error: any, result: any): void;
interface CpsCallback<R> {
(error: any, result: R): void;
cancel?(): void;
};
}
export function cps(fn: CallEffectFn<Func1<CpsCallback>>): CpsEffect;
export function cps<T1>(fn: CallEffectFn<Func2<T1, CpsCallback>>,
arg1: T1): CpsEffect;
export function cps<T1, T2>(fn: CallEffectFn<Func3<T1, T2, CpsCallback>>,
arg1: T1, arg2: T2): CpsEffect;
export function cps<T1, T2, T3>(
fn: CallEffectFn<Func4<T1, T2, T3, CpsCallback>>,
arg1: T1, arg2: T2, arg3: T3): CpsEffect;
export function cps<T1, T2, T3, T4>(
fn: CallEffectFn<Func5<T1, T2, T3, T4, CpsCallback>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): CpsEffect;
export function cps<T1, T2, T3, T4, T5>(
fn: CallEffectFn<Func6Rest<T1, T2, T3, T4, T5, any>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5,
...rest: any[]): CpsEffect;
export function cps<C extends {[P in N]: Func1<CpsCallback>},
N extends string>(
export function cps<C extends {[P in N]: Func1<void, CpsCallback<R>>},
N extends string, R>(
fn: CallEffectNamedFn<C, N>): CpsEffect;
export function cps<C extends {[P in N]: Func2<T1, CpsCallback>},
export function cps<C extends {[P in N]: Func2<void, T1, CpsCallback<R>>},
N extends string,
T1>(
R, T1>(
fn: CallEffectNamedFn<C, N>,
arg1: T1): CpsEffect;
export function cps<C extends {[P in N]: Func3<T1, T2, CpsCallback>},
export function cps<C extends {[P in N]: Func3<void, T1, T2, CpsCallback<R>>},
N extends string,
T1, T2>(
R, T1, T2>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2): CpsEffect;
export function cps<C extends {[P in N]: Func4<T1, T2, T3, CpsCallback>},
export function cps<C extends {[P in N]: Func4<void, T1, T2, T3, CpsCallback<R>>},
N extends string,
T1, T2, T3>(
R, T1, T2, T3>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3): CpsEffect;
export function cps<C extends {[P in N]: Func5<T1, T2, T3, T4, CpsCallback>},
export function cps<C extends {[P in N]: Func5<void, T1, T2, T3, T4, CpsCallback<R>>},
N extends string,
T1, T2, T3, T4>(
R, T1, T2, T3, T4>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): CpsEffect;
export function cps<C extends {[P in N]:
Func6Rest<T1, T2, T3, T4, T5, CpsCallback>},
Func6Rest<void, T1, T2, T3, T4, T5, CpsCallback<R>>},
N extends string,
T1, T2, T3, T4, T5>(
R, T1, T2, T3, T4, T5>(
fn: CallEffectNamedFn<C, N>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, ...rest: any[]): CpsEffect;
export function cps<R>(fn: CallEffectFn<Func1<void, CpsCallback<R>>>): CpsEffect;
export function cps<R, T1>(fn: CallEffectFn<Func2<void, T1, CpsCallback<R>>>,
arg1: T1): CpsEffect;
export function cps<R, T1, T2>(fn: CallEffectFn<Func3<void, T1, T2, CpsCallback<R>>>,
arg1: T1, arg2: T2): CpsEffect;
export function cps<R, T1, T2, T3>(
fn: CallEffectFn<Func4<void, T1, T2, T3, CpsCallback<R>>>,
arg1: T1, arg2: T2, arg3: T3): CpsEffect;
export function cps<R, T1, T2, T3, T4>(
fn: CallEffectFn<Func5<void, T1, T2, T3, T4, CpsCallback<R>>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): CpsEffect;
export function cps<R, T1, T2, T3, T4, T5>(
fn: CallEffectFn<Func6Rest<void, T1, T2, T3, T4, T5, any>>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5,
...rest: any[]): CpsEffect;
export interface ForkEffectDescriptor extends CallEffectDescriptor {

@@ -329,3 +346,3 @@ detached?: boolean;

export function join(task1: Task, task2: Task,
...tasks: Task[]): JoinEffect[];
...tasks: Task[]): GenericAllEffect<JoinEffect>;

@@ -342,3 +359,3 @@

export function cancel(task: Task): CancelEffect;
export function cancel(...tasks: Task[]): CancelEffect[];
export function cancel(...tasks: Task[]): GenericAllEffect<CancelEffect>;

@@ -356,15 +373,15 @@

export function select(): SelectEffect;
export function select<S>(selector: Func1<S>): SelectEffect;
export function select<S, T1>(selector: Func2<S, T1>,
arg1: T1): SelectEffect;
export function select<S, T1, T2>(selector: Func3<S, T1, T2>,
arg1: T1, arg2: T2): SelectEffect;
export function select<S, T1, T2, T3>(
selector: Func4<S, T1, T2, T3>,
export function select<S, R>(selector: Func1<R, S>): SelectEffect;
export function select<S, R, T1>(selector: Func2<R, S, T1>,
arg1: T1): SelectEffect;
export function select<S, R, T1, T2>(selector: Func3<R, S, T1, T2>,
arg1: T1, arg2: T2): SelectEffect;
export function select<S, R, T1, T2, T3>(
selector: Func4<R, S, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SelectEffect;
export function select<S, T1, T2, T3, T4>(
selector: Func5<S, T1, T2, T3, T4>,
export function select<S, R, T1, T2, T3, T4>(
selector: Func5<R, S, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SelectEffect;
export function select<S, T1, T2, T3, T4, T5>(
selector: Func6Rest<S, T1, T2, T3, T4, T5>,
export function select<S, R, T1, T2, T3, T4, T5>(
selector: Func6Rest<R, S, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5,

@@ -375,3 +392,3 @@ ...rest: any[]): SelectEffect;

export interface ActionChannelEffectDescriptor {
pattern: Pattern;
pattern: ActionPattern;
buffer?: Buffer<Action>;

@@ -385,3 +402,3 @@ }

export function actionChannel(
pattern: Pattern, buffer?: Buffer<Action>,
pattern: ActionPattern, buffer?: Buffer<Action>,
): ActionChannelEffect;

@@ -399,3 +416,3 @@

export type FlushEffectDescriptor<T> = Channel<T>;
export type FlushEffectDescriptor<T> = FlushableChannel<T>;

@@ -406,3 +423,3 @@ export interface FlushEffect<T> {

export function flush<T>(channel: Channel<T>): FlushEffect<T>;
export function flush<T>(channel: FlushableChannel<T>): FlushEffect<T>;

@@ -461,55 +478,28 @@

export function takeEvery<A extends Action>(
pattern: Pattern,
worker: HelperFunc0<A>): ForkEffect;
export function takeEvery<A, T1>(
pattern: Pattern,
worker: HelperFunc1<A, T1>,
arg1: T1): ForkEffect;
export function takeEvery<A, T1, T2>(
pattern: Pattern,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): ForkEffect;
export function takeEvery<A, T1, T2, T3>(
pattern: Pattern,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): ForkEffect;
export function takeEvery<A, T1, T2, T3, T4>(
pattern: Pattern,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): ForkEffect;
export function takeEvery<A, T1, T2, T3, T4, T5>(
pattern: Pattern,
worker: HelperFunc5<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): ForkEffect;
export function takeEvery<A, T1, T2, T3, T4, T5, T6>(
pattern: Pattern,
worker: HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): ForkEffect;
export function takeEvery<T>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc0<T>): ForkEffect;
export function takeEvery<T, T1>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc1<T, T1>,
arg1: T1): ForkEffect;
export function takeEvery<T, T1, T2>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc2<T, T1, T2>,
arg1: T1, arg2: T2): ForkEffect;
export function takeEvery<T, T1, T2, T3>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc3<T, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): ForkEffect;
export function takeEvery<T, T1, T2, T3, T4>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc4<T, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): ForkEffect;
export function takeEvery<T, T1, T2, T3, T4, T5>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc5<T, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): ForkEffect;
export function takeEvery<T, T1, T2, T3, T4, T5, T6>(
channel: Channel<T>,
channel: TakeableChannel<T>,
worker: HelperFunc6Rest<T, T1, T2, T3, T4, T5, T6>,

@@ -519,33 +509,65 @@ arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,

export function takeEvery<A extends Action>(
pattern: ActionPattern<A>,
worker: HelperFunc0<A>): ForkEffect;
export function takeEvery<A extends Action, T1>(
pattern: ActionPattern<A>,
worker: HelperFunc1<A, T1>,
arg1: T1): ForkEffect;
export function takeEvery<A extends Action, T1, T2>(
pattern: ActionPattern<A>,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): ForkEffect;
export function takeEvery<A extends Action, T1, T2, T3>(
pattern: ActionPattern<A>,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): ForkEffect;
export function takeEvery<A extends Action, T1, T2, T3, T4>(
pattern: ActionPattern<A>,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): ForkEffect;
export function takeEvery<A extends Action, T1, T2, T3, T4, T5>(
pattern: ActionPattern<A>,
worker: HelperFunc5<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): ForkEffect;
export function takeEvery<A extends Action, T1, T2, T3, T4, T5, T6>(
pattern: ActionPattern<A>,
worker: HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): ForkEffect;
export const takeLatest: typeof takeEvery;
export const takeLeading: typeof takeEvery;
export function throttle<A extends Action>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc0<A>): ForkEffect;
export function throttle<A extends Action, T1>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc1<A, T1>,
arg1: T1): ForkEffect;
export function throttle<A extends Action, T1, T2>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): ForkEffect;
export function throttle<A extends Action, T1, T2, T3>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): ForkEffect;
export function throttle<A extends Action, T1, T2, T3, T4>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): ForkEffect;
export function throttle<A extends Action, T1, T2, T3, T4, T5>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc5<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): ForkEffect;
export function throttle<A extends Action, T1, T2, T3, T4, T5, T6>(
ms: number, pattern: Pattern,
ms: number, pattern: ActionPattern<A>,
worker: HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): ForkEffect;
export function delay<T>(ms: number, val?: T): CallEffect;

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

export { take, takeMaybe, put, putResolve, all, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, getContext, setContext, takeEvery, takeLatest, throttle } from './internal/io';
export { take, takeMaybe, put, putResolve, all, race, call, apply, cps, fork, spawn, join, cancel, select, actionChannel, cancelled, flush, getContext, setContext, takeEvery, takeLatest, takeLeading, throttle, delay } from './internal/io';

@@ -5,4 +5,3 @@ import middleware from './internal/middleware';

export { END, eventChannel, channel, multicastChannel, stdChannel } from './internal/channel';
export { CANCEL } from './internal/symbols';
export { delay } from './internal/utils';
export { CANCEL, SAGA_LOCATION } from './internal/symbols';
export { detach } from './internal/io';

@@ -9,0 +8,0 @@ import * as effects from './effects';

import { IO, SELF_CANCELLATION } from './symbols';
import { is, identity, check, createSetContextWarning } from './utils';
import { takeEveryHelper, takeLatestHelper, throttleHelper } from './sagaHelpers';
import { delay as delayUtil, is, identity, check, createSetContextWarning } from './utils';
import { takeEveryHelper, takeLatestHelper, takeLeadingHelper, throttleHelper } from './sagaHelpers';
var TAKE = 'TAKE';

@@ -295,5 +295,12 @@ var PUT = 'PUT';

}
export function takeLeading(patternOrChannel, worker) {
for (var _len10 = arguments.length, args = new Array(_len10 > 2 ? _len10 - 2 : 0), _key10 = 2; _key10 < _len10; _key10++) {
args[_key10 - 2] = arguments[_key10];
}
return fork.apply(void 0, [takeLeadingHelper, patternOrChannel, worker].concat(args));
}
export function throttle(ms, pattern, worker) {
for (var _len10 = arguments.length, args = new Array(_len10 > 3 ? _len10 - 3 : 0), _key10 = 3; _key10 < _len10; _key10++) {
args[_key10 - 3] = arguments[_key10];
for (var _len11 = arguments.length, args = new Array(_len11 > 3 ? _len11 - 3 : 0), _key11 = 3; _key11 < _len11; _key11++) {
args[_key11 - 3] = arguments[_key11];
}

@@ -303,2 +310,5 @@

}
export var delay =
/*#__PURE__*/
call.bind(null, delayUtil);

@@ -305,0 +315,0 @@ var createAsEffectType = function createAsEffectType(type) {

@@ -5,6 +5,23 @@ function _extends() { _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; }; return _extends.apply(this, arguments); }

import { noop, is, log as _log, check, deferred, uid as nextEffectId, array, remove, object, makeIterator, createSetContextWarning } from './utils';
import { getLocation, addSagaStack, sagaStackToString } from './error-utils';
import { asap, suspend, flush } from './scheduler';
import { asEffect } from './io';
import { channel, isEnd } from './channel';
import matcher from './matcher'; // TODO: check if this hacky toString stuff is needed
import matcher from './matcher';
export function getMetaInfo(fn) {
return {
name: fn.name || 'anonymous',
location: getLocation(fn)
};
}
function getIteratorMetaInfo(iterator, fn) {
if (iterator.isSagaIterator) {
return {
name: iterator.meta.name
};
}
return getMetaInfo(fn);
} // TODO: check if this hacky toString stuff is needed
// also check again whats the difference between CHANNEL_END and CHANNEL_END_TYPE

@@ -14,2 +31,3 @@ // maybe this could become MAYBE_END

export var CHANNEL_END = {

@@ -41,3 +59,3 @@ toString: function toString() {

function forkQueue(name, mainTask, cb) {
function forkQueue(mainTask, onAbort, cb) {
var tasks = [],

@@ -48,3 +66,14 @@ result,

var getTasks = function getTasks() {
return tasks;
};
var getTaskNames = function getTaskNames() {
return tasks.map(function (t) {
return t.meta.name;
});
};
function abort(err) {
onAbort();
cancelAll();

@@ -98,10 +127,4 @@ cb(err, true);

abort: abort,
getTasks: function getTasks() {
return tasks;
},
taskNames: function taskNames() {
return tasks.map(function (t) {
return t.name;
});
}
getTasks: getTasks,
getTaskNames: getTaskNames
};

@@ -162,3 +185,3 @@ }

export default function proc(iterator, stdChannel, dispatch, getState, parentContext, options, parentEffectId, name, cont) {
export default function proc(iterator, stdChannel, dispatch, getState, parentContext, options, parentEffectId, meta, cont) {
if (dispatch === void 0) {

@@ -184,6 +207,2 @@ dispatch = noop;

if (name === void 0) {
name = 'anonymous';
}
var _options = options,

@@ -197,12 +216,12 @@ sagaMonitor = _options.sagaMonitor,

var logError = function logError(err) {
var message = err.sagaStack;
log('error', err);
if (!message && err.stack) {
message = err.stack.split('\n')[0].indexOf(err.message) !== -1 ? err.stack : "Error: " + err.message + "\n" + err.stack;
if (err.sagaStack) {
log('error', err.sagaStack);
}
log('error', "uncaught at " + name, message || err.message || err);
};
var taskContext = Object.create(parentContext);
var crashedEffect = null;
var cancelledDueToErrorTasks = [];
/**

@@ -220,9 +239,11 @@ Tracks the current effect cancellation

var task = newTask(parentEffectId, name, iterator, cont);
var task = newTask(parentEffectId, meta, iterator, cont);
var mainTask = {
name: name,
meta: meta,
cancel: cancelMain,
isRunning: true
};
var taskQueue = forkQueue(name, mainTask, end);
var taskQueue = forkQueue(mainTask, function onAbort() {
cancelledDueToErrorTasks.push.apply(cancelledDueToErrorTasks, taskQueue.getTaskNames());
}, end);
/**

@@ -349,10 +370,13 @@ cancellation of the main task. We'll simply resume the Generator with a Cancel

} else {
if (result instanceof Error) {
Object.defineProperty(result, 'sagaStack', {
value: "at " + name + " \n " + (result.sagaStack || result.stack),
configurable: true
});
}
addSagaStack(result, {
meta: meta,
effect: crashedEffect,
cancelledTasks: cancelledDueToErrorTasks
});
if (!task.cont) {
if (result.sagaStack) {
result.sagaStack = sagaStackToString(result.sagaStack);
}
if (result instanceof Error && onError) {

@@ -378,7 +402,3 @@ onError(result);

function runEffect(effect, effectId, label, currCb) {
if (label === void 0) {
label = '';
}
function runEffect(effect, effectId, currCb) {
/**

@@ -399,3 +419,3 @@ each effect runner must attach its own logic of cancellation to the provided callback

return (// Non declarative effect
is.promise(effect) ? resolvePromise(effect, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb) // declarative effects
is.promise(effect) ? resolvePromise(effect, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, meta, currCb) // declarative effects
: (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) :

@@ -439,2 +459,6 @@ /* anything else returned as is */

if (isErr) {
crashedEffect = effect;
}
cb(res, isErr);

@@ -476,3 +500,3 @@ } // tracks down the current cancel

middleware(function (eff) {
return runEffect(eff, effectId, label, currCb);
return runEffect(eff, effectId, currCb);
})(effect);

@@ -482,3 +506,3 @@ return;

runEffect(effect, effectId, label, currCb);
runEffect(effect, effectId, currCb);
}

@@ -502,4 +526,4 @@

function resolveIterator(iterator, effectId, name, cb) {
proc(iterator, stdChannel, dispatch, getState, taskContext, options, effectId, name, cb);
function resolveIterator(iterator, effectId, meta, cb) {
proc(iterator, stdChannel, dispatch, getState, taskContext, options, effectId, meta, cb);
}

@@ -553,5 +577,2 @@

} catch (error) {
logError(error); // TODO: should such error here be passed to `onError`?
// or is it already if we dropped error swallowing
cb(error, true);

@@ -583,3 +604,3 @@ return;

return is.promise(result) ? resolvePromise(result, cb) : is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb) : cb(result);
return is.promise(result) ? resolvePromise(result, cb) : is.iterator(result) ? resolveIterator(result, effectId, getMetaInfo(fn), cb) : cb(result);
}

@@ -623,2 +644,3 @@

});
var meta = getIteratorMetaInfo(taskIterator, fn);

@@ -628,3 +650,3 @@ try {

var _task = proc(taskIterator, stdChannel, dispatch, getState, taskContext, options, effectId, fn.name, detached ? null : noop);
var _task = proc(taskIterator, stdChannel, dispatch, getState, taskContext, options, effectId, meta, detached ? null : noop);

@@ -831,7 +853,7 @@ if (detached) {

function newTask(id, name, iterator, cont) {
function newTask(id, meta, iterator, cont) {
var _ref9;
iterator._deferredEnd = null;
return _ref9 = {}, _ref9[TASK] = true, _ref9.id = id, _ref9.name = name, _ref9.toPromise = function toPromise() {
return _ref9 = {}, _ref9[TASK] = true, _ref9.id = id, _ref9.meta = meta, _ref9.toPromise = function toPromise() {
if (iterator._deferredEnd) {

@@ -838,0 +860,0 @@ return iterator._deferredEnd.promise;

import { compose } from 'redux';
import { is, check, uid as nextSagaId, wrapSagaDispatch, noop } from './utils';
import proc from './proc';
import proc, { getMetaInfo } from './proc';
import { stdChannel } from './channel';

@@ -66,3 +66,3 @@ var RUN_SAGA_SIGNATURE = 'runSaga(options, saga, ...args)';

middleware: middleware
}, effectId, saga.name);
}, effectId, getMetaInfo(saga));

@@ -69,0 +69,0 @@ if (sagaMonitor) {

import takeEveryHelper from './takeEvery';
import takeLatestHelper from './takeLatest';
import takeLeadingHelper from './takeLeading';
import throttleHelper from './throttle';
export { takeEveryHelper, takeLatestHelper, throttleHelper };
export { takeEveryHelper, takeLatestHelper, takeLeadingHelper, throttleHelper };
import fsmIterator, { qEnd, safeName } from './fsmIterator';
import { take, fork, actionChannel, call } from '../io';
import { take, fork, actionChannel, delay } from '../io';
import { END } from '../channel';
import * as buffers from '../buffers';
import { delay } from '../utils';
export default function throttle(delayLength, pattern, worker) {

@@ -33,3 +32,3 @@ for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {

done: false,
value: call(delay, delayLength)
value: delay(delayLength)
};

@@ -36,0 +35,0 @@

@@ -1,35 +0,47 @@

var sym = function sym(id) {
id = "@@redux-saga/" + id;
var createName = function createName(name) {
return "@@redux-saga/" + name;
};
var createSymbol = function createSymbol(id) {
id = createName(id);
return typeof Symbol === 'function' ? Symbol(id) : id;
};
var createGlobalSymbol = function createGlobalSymbol(id) {
id = createName(id);
return typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for(id) : id;
};
export var CANCEL =
/*#__PURE__*/
sym('CANCEL_PROMISE');
createSymbol('CANCEL_PROMISE');
export var CHANNEL_END =
/*#__PURE__*/
sym('CHANNEL_END');
createSymbol('CHANNEL_END');
export var CHANNEL_END_TYPE =
/*#__PURE__*/
sym('CHANNEL_END');
createSymbol('CHANNEL_END');
export var IO =
/*#__PURE__*/
sym('IO');
createSymbol('IO');
export var MATCH =
/*#__PURE__*/
sym('MATCH');
createSymbol('MATCH');
export var MULTICAST =
/*#__PURE__*/
sym('MULTICAST');
createSymbol('MULTICAST');
export var SAGA_ACTION =
/*#__PURE__*/
sym('SAGA_ACTION');
createSymbol('SAGA_ACTION');
export var SELF_CANCELLATION =
/*#__PURE__*/
sym('SELF_CANCELLATION');
createSymbol('SELF_CANCELLATION');
export var TASK =
/*#__PURE__*/
sym('TASK');
createSymbol('TASK');
export var TASK_CANCEL =
/*#__PURE__*/
sym('TASK_CANCEL');
createSymbol('TASK_CANCEL');
export var SAGA_LOCATION =
/*#__PURE__*/
createGlobalSymbol('LOCATION');
function _extends() { _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; }; return _extends.apply(this, arguments); }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { CANCEL, MULTICAST, SAGA_ACTION, TASK } from './symbols';

@@ -48,3 +46,3 @@ export var konst = function konst(v) {

object: function object(obj) {
return obj && !is.array(obj) && _typeof(obj) === 'object';
return obj && !is.array(obj) && typeof obj === 'object';
},

@@ -79,3 +77,3 @@ promise: function promise(p) {

symbol: function symbol(sym) {
return _typeof(sym) === 'symbol';
return Boolean(sym) && typeof Symbol === 'function' && sym.constructor === Symbol && sym !== Symbol.prototype;
},

@@ -222,6 +220,9 @@ multicast: function multicast(ch) {

var iterator = {
name: name,
meta: {
name: name
},
next: next,
throw: thro,
return: kReturn
return: kReturn,
isSagaIterator: true
};

@@ -228,0 +229,0 @@

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

export { noop, is, deferred, arrayOfDeferred, createMockTask, cloneableGenerator } from './internal/utils';
export { delay, noop, is, deferred, arrayOfDeferred, createMockTask, cloneableGenerator } from './internal/utils';
export { SAGA_ACTION, TASK } from './internal/symbols';
export { asEffect } from './internal/io';
export { CHANNEL_END } from './internal/proc';
import {Action, Middleware} from "redux";
import {Effect, ForkEffect, Pattern} from "./effects";
import {Effect, ForkEffect} from "./effects";
export {Effect, Pattern};
export {Effect};

@@ -10,3 +10,3 @@ /**

*/
export type SagaIterator = IterableIterator<Effect|Effect[]>;
export type SagaIterator = IterableIterator<Effect>;

@@ -42,3 +42,8 @@ type Saga0 = () => Iterator<any>;

export interface SagaMiddleware<C> extends Middleware {
export interface EffectMiddleware {
(next: (effect: any) => void): (effect: any) => void;
}
export interface SagaMiddleware<C = {}> extends Middleware {
run(saga: Saga0): Task;

@@ -68,3 +73,3 @@ run<T1>(saga: Saga1<T1>,

export interface SagaMiddlewareOptions<C extends object> {
export interface SagaMiddlewareOptions<C extends object = {}> {
context?: C;

@@ -74,2 +79,3 @@ sagaMonitor?: Monitor;

onError?(error: Error): void;
effectMiddlewares?: EffectMiddleware[];
emitter?(emit: Emit<Action>): Emit<any>;

@@ -82,13 +88,10 @@ }

type Unsubscribe = () => void;
type Subscribe<T> = (cb: (input: T | END) => void) => Unsubscribe;
export interface RunSagaOptions<A, S> {
context?: object;
subscribe?: Subscribe<A>;
channel?: PredicateTakeableChannel<A>;
dispatch?(input: A): any;
getState?(): S;
context?: object;
sagaMonitor?: Monitor;
logger?: Logger;
effectMiddlewares?: EffectMiddleware[];
onError?(error: Error): void;

@@ -98,26 +101,26 @@ }

export function runSaga<A, S>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga0): Task;
export function runSaga<A, S, T1>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga1<T1>,
arg1: T1): Task;
export function runSaga<A, S, T1, T2>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga2<T1, T2>,
arg1: T1, arg2: T2): Task;
export function runSaga<A, S, T1, T2, T3>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga3<T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): Task;
export function runSaga<A, S, T1, T2, T3, T4>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga4<T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): Task;
export function runSaga<A, S, T1, T2, T3, T4, T5>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga5<T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): Task;
export function runSaga<A, S, T1, T2, T3, T4, T5, T6>(
storeInterface: RunSagaOptions<A, S>,
options: RunSagaOptions<A, S>,
saga: Saga6Rest<T1, T2, T3, T4, T5, T6>,

@@ -127,9 +130,3 @@ arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,

/**
* @deprecated
*/
export function runSaga<A, S>(iterator: Iterator<any>,
options: RunSagaOptions<A, S>): Task;
export const CANCEL: string;

@@ -145,6 +142,5 @@

isCancelled(): boolean;
result(): any | undefined;
result<T>(): T | undefined;
result<T = any>(): T | undefined;
error(): any | undefined;
done: Promise<any>;
toPromise<T = any>(): Promise<T>;
cancel(): void;

@@ -158,9 +154,21 @@ setContext<C extends object>(props: Partial<C>): void;

take(): T | undefined;
flush(): void;
flush(): T[];
}
export interface TakeableChannel<T> {
take(cb: (message: T | END) => void): void;
}
export interface PuttableChannel<T> {
put(message: T | END): void;
}
export interface FlushableChannel<T> {
flush(cb: (items: T[] | END) => void): void;
}
export interface Channel<T> {
take(cb: (message: T | END) => void): void;
put(message: T | END): void;
flush(): void;
flush(cb: (items: T[] | END) => void): void;
close(): void;

@@ -171,16 +179,27 @@ }

export function eventChannel<T>(subscribe: Subscribe<T>, buffer?: Buffer<T>,
matcher?: Predicate<T>): Channel<T>;
export interface EventChannel<T> {
take(cb: (message: T | END) => void): void;
flush(cb: (items: T[] | END) => void): void;
close(): void;
}
export const buffers: {
none<T>(): Buffer<T>;
fixed<T>(limit?: number): Buffer<T>;
dropping<T>(limit?: number): Buffer<T>;
sliding<T>(limit?: number): Buffer<T>;
expanding<T>(limit?: number): Buffer<T>;
};
export type Unsubscribe = () => void;
export type Subscribe<T> = (cb: (input: T | END) => void) => Unsubscribe;
export function delay(ms: number): Promise<true>;
export function delay<T>(ms: number, val: T): Promise<T>;
export function eventChannel<T>(subscribe: Subscribe<T>,
buffer?: Buffer<T>): EventChannel<T>;
export interface PredicateTakeableChannel<T> {
take(cb: (message: T | END) => void, matcher?: Predicate<T>): void;
}
export interface MulticastChannel<T> {
take(cb: (message: T | END) => void, matcher?: Predicate<T>): void;
put(message: T | END): void;
close(): void;
}
export function multicastChannel<T>(): MulticastChannel<T>;
export function stdChannel<T>(): MulticastChannel<T>;
export function detach(forkEffect: ForkEffect): ForkEffect;

@@ -193,115 +212,8 @@

type HelperFunc0<A> = (action: A) => any;
type HelperFunc1<A, T1> = (arg1: T1, action: A) => any;
type HelperFunc2<A, T1, T2> = (arg1: T1, arg2: T2, action: A) => any;
type HelperFunc3<A, T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3,
action: A) => any;
type HelperFunc4<A, T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4,
action: A) => any;
type HelperFunc5<A, T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5,
action: A) => any;
type HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6> = (
arg1: T1, arg2: T2, arg3: T3,
arg4: T4, arg5: T5, arg6: T6,
arg7: any, ...rest: any[]) => any;
/**
* @deprecated
*/
export function takeEvery<A extends Action>(
pattern: Pattern,
worker: HelperFunc0<A>): SagaIterator;
export function takeEvery<A, T1>(
pattern: Pattern,
worker: HelperFunc1<A, T1>,
arg1: T1): SagaIterator;
export function takeEvery<A, T1, T2>(
pattern: Pattern,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): SagaIterator;
export function takeEvery<A, T1, T2, T3>(
pattern: Pattern,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SagaIterator;
export function takeEvery<A, T1, T2, T3, T4>(
pattern: Pattern,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SagaIterator;
export function takeEvery<A, T1, T2, T3, T4, T5>(
pattern: Pattern,
worker: HelperFunc5<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): SagaIterator;
export function takeEvery<A, T1, T2, T3, T4, T5, T6>(
pattern: Pattern,
worker: HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): SagaIterator;
export function takeEvery<T>(
channel: Channel<T>,
worker: HelperFunc0<T>): SagaIterator;
export function takeEvery<T, T1>(
channel: Channel<T>,
worker: HelperFunc1<T, T1>,
arg1: T1): SagaIterator;
export function takeEvery<T, T1, T2>(
channel: Channel<T>,
worker: HelperFunc2<T, T1, T2>,
arg1: T1, arg2: T2): SagaIterator;
export function takeEvery<T, T1, T2, T3>(
channel: Channel<T>,
worker: HelperFunc3<T, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SagaIterator;
export function takeEvery<T, T1, T2, T3, T4>(
channel: Channel<T>,
worker: HelperFunc4<T, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SagaIterator;
export function takeEvery<T, T1, T2, T3, T4, T5>(
channel: Channel<T>,
worker: HelperFunc5<T, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): SagaIterator;
export function takeEvery<T, T1, T2, T3, T4, T5, T6>(
channel: Channel<T>,
worker: HelperFunc6Rest<T, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): SagaIterator;
/**
* @deprecated
*/
export const takeLatest: typeof takeEvery;
/**
* @deprecated
*/
export function throttle<A extends Action>(
ms: number, pattern: Pattern,
worker: HelperFunc0<A>): SagaIterator;
export function throttle<A extends Action, T1>(
ms: number, pattern: Pattern,
worker: HelperFunc1<A, T1>,
arg1: T1): SagaIterator;
export function throttle<A extends Action, T1, T2>(
ms: number, pattern: Pattern,
worker: HelperFunc2<A, T1, T2>,
arg1: T1, arg2: T2): SagaIterator;
export function throttle<A extends Action, T1, T2, T3>(
ms: number, pattern: Pattern,
worker: HelperFunc3<A, T1, T2, T3>,
arg1: T1, arg2: T2, arg3: T3): SagaIterator;
export function throttle<A extends Action, T1, T2, T3, T4>(
ms: number, pattern: Pattern,
worker: HelperFunc4<A, T1, T2, T3, T4>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4): SagaIterator;
export function throttle<A extends Action, T1, T2, T3, T4, T5>(
ms: number, pattern: Pattern,
worker: HelperFunc5<A, T1, T2, T3, T4, T5>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): SagaIterator;
export function throttle<A extends Action, T1, T2, T3, T4, T5, T6>(
ms: number, pattern: Pattern,
worker: HelperFunc6Rest<A, T1, T2, T3, T4, T5, T6>,
arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6,
...rest: any[]): SagaIterator;
export const buffers: {
none<T>(): Buffer<T>;
fixed<T>(limit?: number): Buffer<T>;
dropping<T>(limit?: number): Buffer<T>;
sliding<T>(limit?: number): Buffer<T>;
expanding<T>(limit?: number): Buffer<T>;
};
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "take", {

@@ -130,2 +132,8 @@ enumerable: true,

});
Object.defineProperty(exports, "takeLeading", {
enumerable: true,
get: function get() {
return _io.takeLeading;
}
});
Object.defineProperty(exports, "throttle", {

@@ -137,2 +145,8 @@ enumerable: true,

});
Object.defineProperty(exports, "delay", {
enumerable: true,
get: function get() {
return _io.delay;
}
});

@@ -139,0 +153,0 @@ var _io =

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "runSaga", {

@@ -46,6 +48,6 @@ enumerable: true,

});
Object.defineProperty(exports, "delay", {
Object.defineProperty(exports, "SAGA_LOCATION", {
enumerable: true,
get: function get() {
return _utils.delay;
return _symbols.SAGA_LOCATION;
}

@@ -79,6 +81,2 @@ });

var _utils =
/*#__PURE__*/
require("./internal/utils");
var _io =

@@ -112,3 +110,3 @@ /*#__PURE__*/

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -115,0 +113,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.expanding = exports.sliding = exports.dropping = exports.fixed = exports.none = void 0;

@@ -5,0 +7,0 @@

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.channel = channel;

@@ -34,3 +36,3 @@ exports.eventChannel = eventChannel;

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -37,0 +39,0 @@ var END = {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.take = take;

@@ -23,4 +25,5 @@ exports.put = put;

exports.takeLatest = takeLatest;
exports.takeLeading = takeLeading;
exports.throttle = throttle;
exports.asEffect = exports.putResolve = exports.takeMaybe = exports.detach = void 0;
exports.asEffect = exports.delay = exports.putResolve = exports.takeMaybe = exports.detach = void 0;

@@ -351,5 +354,13 @@ var _symbols =

function takeLeading(patternOrChannel, worker) {
for (var _len10 = arguments.length, args = new Array(_len10 > 2 ? _len10 - 2 : 0), _key10 = 2; _key10 < _len10; _key10++) {
args[_key10 - 2] = arguments[_key10];
}
return fork.apply(void 0, [_sagaHelpers.takeLeadingHelper, patternOrChannel, worker].concat(args));
}
function throttle(ms, pattern, worker) {
for (var _len10 = arguments.length, args = new Array(_len10 > 3 ? _len10 - 3 : 0), _key10 = 3; _key10 < _len10; _key10++) {
args[_key10 - 3] = arguments[_key10];
for (var _len11 = arguments.length, args = new Array(_len11 > 3 ? _len11 - 3 : 0), _key11 = 3; _key11 < _len11; _key11++) {
args[_key11 - 3] = arguments[_key11];
}

@@ -360,2 +371,7 @@

var delay =
/*#__PURE__*/
call.bind(null, _utils.delay);
exports.delay = delay;
var createAsEffectType = function createAsEffectType(type) {

@@ -362,0 +378,0 @@ return function (effect) {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = matcher;

@@ -5,0 +7,0 @@ exports.wildcard = exports.symbol = exports.string = exports.predicate = exports.array = void 0;

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = sagaMiddlewareFactory;

@@ -5,0 +7,0 @@

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getMetaInfo = getMetaInfo;
exports.default = proc;

@@ -15,2 +18,6 @@ exports.TASK_CANCEL = exports.CHANNEL_END = void 0;

var _errorUtils =
/*#__PURE__*/
require("./error-utils");
var _scheduler =

@@ -38,6 +45,23 @@ /*#__PURE__*/

// TODO: check if this hacky toString stuff is needed
function getMetaInfo(fn) {
return {
name: fn.name || 'anonymous',
location: (0, _errorUtils.getLocation)(fn)
};
}
function getIteratorMetaInfo(iterator, fn) {
if (iterator.isSagaIterator) {
return {
name: iterator.meta.name
};
}
return getMetaInfo(fn);
} // TODO: check if this hacky toString stuff is needed
// also check again whats the difference between CHANNEL_END and CHANNEL_END_TYPE
// maybe this could become MAYBE_END
// I guess this gets exported so takeMaybe result can be checked
var CHANNEL_END = {

@@ -72,3 +96,3 @@ toString: function toString() {

function forkQueue(name, mainTask, cb) {
function forkQueue(mainTask, onAbort, cb) {
var tasks = [],

@@ -79,3 +103,14 @@ result,

var getTasks = function getTasks() {
return tasks;
};
var getTaskNames = function getTaskNames() {
return tasks.map(function (t) {
return t.meta.name;
});
};
function abort(err) {
onAbort();
cancelAll();

@@ -129,10 +164,4 @@ cb(err, true);

abort: abort,
getTasks: function getTasks() {
return tasks;
},
taskNames: function taskNames() {
return tasks.map(function (t) {
return t.name;
});
}
getTasks: getTasks,
getTaskNames: getTaskNames
};

@@ -193,3 +222,3 @@ }

function proc(iterator, stdChannel, dispatch, getState, parentContext, options, parentEffectId, name, cont) {
function proc(iterator, stdChannel, dispatch, getState, parentContext, options, parentEffectId, meta, cont) {
if (dispatch === void 0) {

@@ -215,6 +244,2 @@ dispatch = _utils.noop;

if (name === void 0) {
name = 'anonymous';
}
var _options = options,

@@ -228,12 +253,12 @@ sagaMonitor = _options.sagaMonitor,

var logError = function logError(err) {
var message = err.sagaStack;
log('error', err);
if (!message && err.stack) {
message = err.stack.split('\n')[0].indexOf(err.message) !== -1 ? err.stack : "Error: " + err.message + "\n" + err.stack;
if (err.sagaStack) {
log('error', err.sagaStack);
}
log('error', "uncaught at " + name, message || err.message || err);
};
var taskContext = Object.create(parentContext);
var crashedEffect = null;
var cancelledDueToErrorTasks = [];
/**

@@ -251,9 +276,11 @@ Tracks the current effect cancellation

var task = newTask(parentEffectId, name, iterator, cont);
var task = newTask(parentEffectId, meta, iterator, cont);
var mainTask = {
name: name,
meta: meta,
cancel: cancelMain,
isRunning: true
};
var taskQueue = forkQueue(name, mainTask, end);
var taskQueue = forkQueue(mainTask, function onAbort() {
cancelledDueToErrorTasks.push.apply(cancelledDueToErrorTasks, taskQueue.getTaskNames());
}, end);
/**

@@ -380,10 +407,13 @@ cancellation of the main task. We'll simply resume the Generator with a Cancel

} else {
if (result instanceof Error) {
Object.defineProperty(result, 'sagaStack', {
value: "at " + name + " \n " + (result.sagaStack || result.stack),
configurable: true
});
}
(0, _errorUtils.addSagaStack)(result, {
meta: meta,
effect: crashedEffect,
cancelledTasks: cancelledDueToErrorTasks
});
if (!task.cont) {
if (result.sagaStack) {
result.sagaStack = (0, _errorUtils.sagaStackToString)(result.sagaStack);
}
if (result instanceof Error && onError) {

@@ -409,7 +439,3 @@ onError(result);

function runEffect(effect, effectId, label, currCb) {
if (label === void 0) {
label = '';
}
function runEffect(effect, effectId, currCb) {
/**

@@ -430,3 +456,3 @@ each effect runner must attach its own logic of cancellation to the provided callback

return (// Non declarative effect
_utils.is.promise(effect) ? resolvePromise(effect, currCb) : _utils.is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb) // declarative effects
_utils.is.promise(effect) ? resolvePromise(effect, currCb) : _utils.is.iterator(effect) ? resolveIterator(effect, effectId, meta, currCb) // declarative effects
: (data = _io.asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = _io.asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = _io.asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = _io.asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = _io.asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = _io.asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = _io.asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = _io.asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = _io.asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = _io.asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = _io.asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = _io.asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = _io.asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = _io.asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = _io.asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) :

@@ -470,2 +496,6 @@ /* anything else returned as is */

if (isErr) {
crashedEffect = effect;
}
cb(res, isErr);

@@ -507,3 +537,3 @@ } // tracks down the current cancel

middleware(function (eff) {
return runEffect(eff, effectId, label, currCb);
return runEffect(eff, effectId, currCb);
})(effect);

@@ -513,3 +543,3 @@ return;

runEffect(effect, effectId, label, currCb);
runEffect(effect, effectId, currCb);
}

@@ -533,4 +563,4 @@

function resolveIterator(iterator, effectId, name, cb) {
proc(iterator, stdChannel, dispatch, getState, taskContext, options, effectId, name, cb);
function resolveIterator(iterator, effectId, meta, cb) {
proc(iterator, stdChannel, dispatch, getState, taskContext, options, effectId, meta, cb);
}

@@ -584,5 +614,2 @@

} catch (error) {
logError(error); // TODO: should such error here be passed to `onError`?
// or is it already if we dropped error swallowing
cb(error, true);

@@ -614,3 +641,3 @@ return;

return _utils.is.promise(result) ? resolvePromise(result, cb) : _utils.is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb) : cb(result);
return _utils.is.promise(result) ? resolvePromise(result, cb) : _utils.is.iterator(result) ? resolveIterator(result, effectId, getMetaInfo(fn), cb) : cb(result);
}

@@ -654,2 +681,3 @@

});
var meta = getIteratorMetaInfo(taskIterator, fn);

@@ -659,3 +687,3 @@ try {

var _task = proc(taskIterator, stdChannel, dispatch, getState, taskContext, options, effectId, fn.name, detached ? null : _utils.noop);
var _task = proc(taskIterator, stdChannel, dispatch, getState, taskContext, options, effectId, meta, detached ? null : _utils.noop);

@@ -863,7 +891,7 @@ if (detached) {

function newTask(id, name, iterator, cont) {
function newTask(id, meta, iterator, cont) {
var _ref9;
iterator._deferredEnd = null;
return _ref9 = {}, _ref9[_symbols.TASK] = true, _ref9.id = id, _ref9.name = name, _ref9.toPromise = function toPromise() {
return _ref9 = {}, _ref9[_symbols.TASK] = true, _ref9.id = id, _ref9.meta = meta, _ref9.toPromise = function toPromise() {
if (iterator._deferredEnd) {

@@ -870,0 +898,0 @@ return iterator._deferredEnd.promise;

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.runSaga = runSaga;

@@ -16,3 +18,3 @@

/*#__PURE__*/
_interopRequireDefault(
_interopRequireWildcard(
/*#__PURE__*/

@@ -25,3 +27,3 @@ require("./proc"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -91,3 +93,3 @@ var RUN_SAGA_SIGNATURE = 'runSaga(options, saga, ...args)';

middleware: middleware
}, effectId, saga.name);
}, effectId, (0, _proc.getMetaInfo)(saga));

@@ -94,0 +96,0 @@ if (sagaMonitor) {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.safeName = safeName;

@@ -5,0 +7,0 @@ exports.default = fsmIterator;

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "takeEveryHelper", {

@@ -16,2 +18,8 @@ enumerable: true,

});
Object.defineProperty(exports, "takeLeadingHelper", {
enumerable: true,
get: function get() {
return _takeLeading.default;
}
});
Object.defineProperty(exports, "throttleHelper", {

@@ -36,2 +44,8 @@ enumerable: true,

var _takeLeading =
/*#__PURE__*/
_interopRequireDefault(
/*#__PURE__*/
require("./takeLeading"));
var _throttle =

@@ -38,0 +52,0 @@ /*#__PURE__*/

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = takeEvery;

@@ -20,3 +22,3 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -23,0 +25,0 @@ function takeEvery(patternOrChannel, worker) {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = takeLatest;

@@ -20,3 +22,3 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -23,0 +25,0 @@ function takeLatest(patternOrChannel, worker) {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = throttle;

@@ -26,8 +28,4 @@

var _utils =
/*#__PURE__*/
require("../utils");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function throttle(delayLength, pattern, worker) {

@@ -60,3 +58,3 @@ for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {

done: false,
value: (0, _io.call)(_utils.delay, delayLength)
value: (0, _io.delay)(delayLength)
};

@@ -63,0 +61,0 @@

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.asap = asap;

@@ -5,0 +7,0 @@ exports.suspend = suspend;

"use strict";
exports.__esModule = true;
exports.TASK_CANCEL = exports.TASK = exports.SELF_CANCELLATION = exports.SAGA_ACTION = exports.MULTICAST = exports.MATCH = exports.IO = exports.CHANNEL_END_TYPE = exports.CHANNEL_END = exports.CANCEL = void 0;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SAGA_LOCATION = exports.TASK_CANCEL = exports.TASK = exports.SELF_CANCELLATION = exports.SAGA_ACTION = exports.MULTICAST = exports.MATCH = exports.IO = exports.CHANNEL_END_TYPE = exports.CHANNEL_END = exports.CANCEL = void 0;
var sym = function sym(id) {
id = "@@redux-saga/" + id;
var createName = function createName(name) {
return "@@redux-saga/" + name;
};
var createSymbol = function createSymbol(id) {
id = createName(id);
return typeof Symbol === 'function' ? Symbol(id) : id;
};
var createGlobalSymbol = function createGlobalSymbol(id) {
id = createName(id);
return typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for(id) : id;
};
var CANCEL =
/*#__PURE__*/
sym('CANCEL_PROMISE');
createSymbol('CANCEL_PROMISE');
exports.CANCEL = CANCEL;
var CHANNEL_END =
/*#__PURE__*/
sym('CHANNEL_END');
createSymbol('CHANNEL_END');
exports.CHANNEL_END = CHANNEL_END;
var CHANNEL_END_TYPE =
/*#__PURE__*/
sym('CHANNEL_END');
createSymbol('CHANNEL_END');
exports.CHANNEL_END_TYPE = CHANNEL_END_TYPE;
var IO =
/*#__PURE__*/
sym('IO');
createSymbol('IO');
exports.IO = IO;
var MATCH =
/*#__PURE__*/
sym('MATCH');
createSymbol('MATCH');
exports.MATCH = MATCH;
var MULTICAST =
/*#__PURE__*/
sym('MULTICAST');
createSymbol('MULTICAST');
exports.MULTICAST = MULTICAST;
var SAGA_ACTION =
/*#__PURE__*/
sym('SAGA_ACTION');
createSymbol('SAGA_ACTION');
exports.SAGA_ACTION = SAGA_ACTION;
var SELF_CANCELLATION =
/*#__PURE__*/
sym('SELF_CANCELLATION');
createSymbol('SELF_CANCELLATION');
exports.SELF_CANCELLATION = SELF_CANCELLATION;
var TASK =
/*#__PURE__*/
sym('TASK');
createSymbol('TASK');
exports.TASK = TASK;
var TASK_CANCEL =
/*#__PURE__*/
sym('TASK_CANCEL');
exports.TASK_CANCEL = TASK_CANCEL;
createSymbol('TASK_CANCEL');
exports.TASK_CANCEL = TASK_CANCEL;
var SAGA_LOCATION =
/*#__PURE__*/
createGlobalSymbol('LOCATION');
exports.SAGA_LOCATION = SAGA_LOCATION;
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.check = check;

@@ -24,4 +26,2 @@ exports.hasOwn = hasOwn;

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var konst = function konst(v) {

@@ -83,3 +83,3 @@ return function () {

object: function object(obj) {
return obj && !is.array(obj) && _typeof(obj) === 'object';
return obj && !is.array(obj) && typeof obj === 'object';
},

@@ -114,3 +114,3 @@ promise: function promise(p) {

symbol: function symbol(sym) {
return _typeof(sym) === 'symbol';
return Boolean(sym) && typeof Symbol === 'function' && sym.constructor === Symbol && sym !== Symbol.prototype;
},

@@ -270,6 +270,9 @@ multicast: function multicast(ch) {

var iterator = {
name: name,
meta: {
name: name
},
next: next,
throw: thro,
return: kReturn
return: kReturn,
isSagaIterator: true
};

@@ -276,0 +279,0 @@

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "delay", {
enumerable: true,
get: function get() {
return _utils.delay;
}
});
Object.defineProperty(exports, "noop", {

@@ -5,0 +13,0 @@ enumerable: true,

{
"name": "redux-saga",
"version": "1.0.0-beta.0",
"version": "1.0.0-beta.1",
"description": "Saga middleware for Redux to handle Side Effects",

@@ -18,6 +18,3 @@ "main": "lib/index.js",

"scripts": {
"lint": "eslint src test",
"test": "run-s test-**",
"check": "run-s lint test",
"test-src": "cross-env BABEL_ENV=cjs babel-node test/index.js | tap-spec",
"test": "cross-env NODE_ENV=test babel-node test/index.js | tap-spec",
"prebundlesize": "npm run build:umd:prod",

@@ -31,19 +28,5 @@ "bundlesize": "bundlesize",

"build": "npm run clean && run-p build:**",
"counter": "cross-env BABEL_ENV=cjs node examples/counter/server.js",
"cancellable-counter": "cross-env BABEL_ENV=cjs node examples/cancellable-counter/server.js",
"test-counter": "cross-env BABEL_ENV=cjs babel-node examples/counter/test/sagas.js | tap-spec",
"shop": "cross-env BABEL_ENV=cjs node examples/shopping-cart/server.js",
"test-shop": "cross-env BABEL_ENV=cjs babel-node examples/shopping-cart/test/sagas.js | tap-spec",
"async": "cross-env BABEL_ENV=cjs node examples/async/server.js",
"test-async": "cross-env BABEL_ENV=cjs babel-node examples/async/test/sagas.js | tap-spec",
"real-world": "npm --prefix examples/real-world install examples/real-world && cross-env BABEL_ENV=cjs node --require babel-register examples/real-world/server.js",
"docs:clean": "rimraf _book",
"docs:prepare": "gitbook install",
"docs:build": "npm run docs:prepare && gitbook build -g redux-saga/redux-saga",
"docs:watch": "npm run docs:prepare && gitbook serve",
"docs:publish": "npm run docs:clean && npm run docs:build && cp CNAME _book && cd _book && git init && git commit --allow-empty -m 'update book' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update book' && git push git@github.com:redux-saga/redux-saga gh-pages --force",
"precommit": "lint-staged",
"prepare": "npm run build",
"prepush": "npm run check",
"prerelease": "npm run check && npm run prepare",
"prepush": "npm run test",
"prerelease": "npm run test && npm run prepare",
"release:patch": "npm run prerelease && npm version patch && npm publish && git push --follow-tags",

@@ -53,6 +36,3 @@ "release:minor": "npm run prerelease && npm version minor && npm publish && git push --follow-tags",

},
"repository": {
"type": "git",
"url": "git+https://github.com/redux-saga/redux-saga.git"
},
"repository": "https://github.com/redux-saga/redux-saga/tree/master/packages/core",
"keywords": [

@@ -69,3 +49,3 @@ "javascript",

"path": "./dist/redux-saga.min.js",
"maxSize": "7 Kb"
"maxSize": "7.5 Kb"
}

@@ -83,22 +63,16 @@ ],

"dependencies": {
"redux": "^3.5.1"
"redux": ">=0.10 <5"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.31",
"@babel/core": "7.0.0-beta.31",
"@babel/node": "7.0.0-beta.31",
"@babel/polyfill": "7.0.0-beta.31",
"@babel/preset-env": "7.0.0-beta.31",
"@babel/preset-react": "7.0.0-beta.31",
"@babel/preset-stage-2": "7.0.0-beta.31",
"babel-eslint": "^8.0.1",
"babel-loader": "8.0.0-beta.0",
"babel-plugin-annotate-pure-calls": "Andarist/babel-plugin-annotate-pure-calls#babel7",
"@babel/cli": "7.0.0-beta.39",
"@babel/core": "7.0.0-beta.39",
"@babel/node": "7.0.0-beta.39",
"@babel/polyfill": "7.0.0-beta.39",
"@babel/preset-env": "7.0.0-beta.39",
"@babel/preset-react": "7.0.0-beta.39",
"@babel/preset-stage-2": "7.0.0-beta.39",
"babel-plugin-annotate-pure-calls": "babel7",
"bundlesize": "^0.11.0",
"cross-env": "^1.0.8",
"eslint": "^2.8.0",
"express": "^4.13.3",
"gitbook-cli": "2.3.0",
"husky": "^0.13.3",
"isomorphic-fetch": "^2.2.0",
"lint-staged": "^3.4.2",

@@ -109,8 +83,5 @@ "lolex": "^1.5.2",

"prettier": "^1.4.1",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"react-redux": "^4.4.5",
"rimraf": "^2.4.3",
"rollup": "^0.50.0",
"rollup-plugin-babel": "4.0.0-beta.0",
"rollup-plugin-babel": "4.0.0-beta.1",
"rollup-plugin-node-resolve": "^3.0.0",

@@ -121,7 +92,4 @@ "rollup-plugin-replace": "^1.1.1",

"tape": "^4.2.2",
"typescript": "^2.2.1",
"typings-tester": "^0.2.2",
"webpack": "^3.8.1",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.19.1"
"typescript": "~2.6.0",
"typings-tester": "^0.2.2"
},

@@ -128,0 +96,0 @@ "typings": "./index.d.ts",

import {
Pattern, Effect,
Pattern, ActionPattern, Effect,
TakeEffectDescriptor, ChannelTakeEffectDescriptor,

@@ -14,9 +14,11 @@ PutEffectDescriptor, ChannelPutEffectDescriptor,

export function delay(ms: number): Promise<true>;
export function delay<T>(ms: number, val: T): Promise<T>;
export const TASK: string;
export const SAGA_ACTION: symbol;
export const TASK: string | symbol;
export const SAGA_ACTION: string | symbol;
export function noop(): void;
export type GuardPredicate<T> = (arg: any) => arg is T;
export type GuardPredicate<G extends T, T = any> = (arg: T) => arg is G;

@@ -37,3 +39,3 @@ export const is: {

buffer: GuardPredicate<Buffer<any>>;
pattern: GuardPredicate<Pattern>;
pattern: GuardPredicate<Pattern<any> | ActionPattern>;
channel: GuardPredicate<Channel<any>>;

@@ -52,3 +54,3 @@ helper: GuardPredicate<SagaIterator>;

export function arrayOfDeffered<T>(length: number): Deferred<T>[];
export function arrayOfDeferred<T>(length: number): Deferred<T>[];

@@ -55,0 +57,0 @@ interface MockTask extends Task {

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc