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

redux-saga

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-saga - npm Package Compare versions

Comparing version 0.10.4 to 0.10.5

effects.d.ts

35

dist/redux-saga.js

@@ -165,2 +165,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.check = check;

@@ -239,3 +241,3 @@ exports.remove = remove;

pattern: function pattern(pat) {
return pat && (typeof pat === 'string' || is.func(pat) || is.array(pat));
return pat && (typeof pat === 'string' || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat));
}

@@ -573,5 +575,5 @@ };

(0, _utils.check)(channel, _utils.is.notUndef, 'take(channel, pattern): channel is undefined');
(0, _utils.check)(channel, _utils.is.take, 'take(channel, pattern): argument ' + channel + ' is not a valid channel (channel argument must have a take method)');
(0, _utils.check)(channel, _utils.is.take, 'take(channel, pattern): argument ' + String(channel) + ' is not a valid channel (channel argument must have a take method)');
(0, _utils.check)(pattern, _utils.is.notUndef, 'take(channel, pattern): pattern is undefined');
(0, _utils.check)(pattern, _utils.is.pattern, 'take(channel, pattern): argument ' + pattern + ' is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)');
(0, _utils.check)(pattern, _utils.is.pattern, 'take(channel, pattern): argument ' + String(pattern) + ' is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)');
} else if (arguments.length === 1) {

@@ -584,3 +586,3 @@ (0, _utils.check)(channel, _utils.is.notUndef, 'take(patternOrChannel): undefined argument');

} else {
throw new Error('take(patternOrChannel): argument ' + channel + ' is not valid channel or a valid pattern');
throw new Error('take(patternOrChannel): argument ' + String(channel) + ' is not valid channel or a valid pattern');
}

@@ -616,2 +618,8 @@ } else {

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

@@ -1256,2 +1264,3 @@ return effect(RACE, effects);

var action = _ref2.action;
var sync = _ref2.sync;

@@ -1272,3 +1281,3 @@ /*

if (_utils.is.promise(result)) {
if (sync && _utils.is.promise(result)) {
resolvePromise(result, cb);

@@ -1835,2 +1844,12 @@ } else {

function safeName(pattern) {
if (Array.isArray(pattern)) {
return String(pattern.map(function (entry) {
return String(entry);
}));
} else {
return String(pattern);
}
}
function takeEvery(pattern, worker) {

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

};
return fsmIterator({

@@ -1858,3 +1878,3 @@ q1: function q1() {

}
}, 'q1', 'takeEvery(' + String(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeEvery(' + safeName(pattern) + ', ' + worker.name + ')');
}

@@ -1883,2 +1903,3 @@

};
return fsmIterator({

@@ -1894,3 +1915,3 @@ q1: function q1() {

}
}, 'q1', 'takeLatest(' + String(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeLatest(' + safeName(pattern) + ', ' + worker.name + ')');
}

@@ -1897,0 +1918,0 @@

2

dist/redux-saga.min.js

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

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

@@ -51,5 +51,5 @@ 'use strict';

(0, _utils.check)(channel, _utils.is.notUndef, 'take(channel, pattern): channel is undefined');
(0, _utils.check)(channel, _utils.is.take, 'take(channel, pattern): argument ' + channel + ' is not a valid channel (channel argument must have a take method)');
(0, _utils.check)(channel, _utils.is.take, 'take(channel, pattern): argument ' + String(channel) + ' is not a valid channel (channel argument must have a take method)');
(0, _utils.check)(pattern, _utils.is.notUndef, 'take(channel, pattern): pattern is undefined');
(0, _utils.check)(pattern, _utils.is.pattern, 'take(channel, pattern): argument ' + pattern + ' is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)');
(0, _utils.check)(pattern, _utils.is.pattern, 'take(channel, pattern): argument ' + String(pattern) + ' is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)');
} else if (arguments.length === 1) {

@@ -62,3 +62,3 @@ (0, _utils.check)(channel, _utils.is.notUndef, 'take(patternOrChannel): undefined argument');

} else {
throw new Error('take(patternOrChannel): argument ' + channel + ' is not valid channel or a valid pattern');
throw new Error('take(patternOrChannel): argument ' + String(channel) + ' is not valid channel or a valid pattern');
}

@@ -94,2 +94,8 @@ } else {

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

@@ -96,0 +102,0 @@ return effect(RACE, effects);

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

var action = _ref2.action;
var sync = _ref2.sync;

@@ -429,3 +430,3 @@ /*

if (_utils.is.promise(result)) {
if (sync && _utils.is.promise(result)) {
resolvePromise(result, cb);

@@ -432,0 +433,0 @@ } else {

@@ -57,2 +57,12 @@ 'use strict';

function safeName(pattern) {
if (Array.isArray(pattern)) {
return String(pattern.map(function (entry) {
return String(entry);
}));
} else {
return String(pattern);
}
}
function takeEvery(pattern, worker) {

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

};
return fsmIterator({

@@ -80,3 +91,3 @@ q1: function q1() {

}
}, 'q1', 'takeEvery(' + String(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeEvery(' + safeName(pattern) + ', ' + worker.name + ')');
}

@@ -105,2 +116,3 @@

};
return fsmIterator({

@@ -116,3 +128,3 @@ q1: function q1() {

}
}, 'q1', 'takeLatest(' + String(pattern) + ', ' + worker.name + ')');
}, 'q1', 'takeLatest(' + safeName(pattern) + ', ' + worker.name + ')');
}

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

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.check = check;

@@ -83,3 +85,3 @@ exports.remove = remove;

pattern: function pattern(pat) {
return pat && (typeof pat === 'string' || is.func(pat) || is.array(pat));
return pat && (typeof pat === 'string' || (typeof pat === 'undefined' ? 'undefined' : _typeof(pat)) === 'symbol' || is.func(pat) || is.array(pat));
}

@@ -86,0 +88,0 @@ };

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

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

"async": "node examples/async/server.js",
"test-async": "babel-node examples/async/test/sagas.js | tap-spec",
"real-world": "npm --prefix examples/real-world install examples/real-world && node --require babel-register examples/real-world/server.js",

@@ -70,2 +71,4 @@ "docs:clean": "rimraf _book",

"tape": "^4.2.2",
"typescript": "^1.8.10",
"typescript-definition-tester": "0.0.4",
"webpack": "1.13.0",

@@ -75,2 +78,3 @@ "webpack-dev-middleware": "^1.4.0",

},
"typings": "./index.d.ts",
"npmName": "redux-saga",

@@ -77,0 +81,0 @@ "npmFileMap": [

# redux-saga
[![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
Redux アプリケーションのための「副作用」ミドルウェア(非同期 action)。`redux-thunk` ミドルウェアによって処理される thunk を送り出す代わりに
副作用を伴うすべてのロジックを1箇所にまとめる **Saga** を用意します。
Redux アプリケーションのための副作用ミドルウェア(非同期 Action)。`redux-thunk` ミドルウェアによって処理される Thunk(サンク) を送り出す代わりに、
副作用を伴うすべてのロジックを1箇所にまとめる **Saga(サガ、サーガ)** を用意します。
これはアプリケーションロジックが2箇所に存在することを意味しています:
- Reducer は action ごとの状態遷移を処理する責任を持つ
- Reducer は Action ごとの状態遷移を処理する責任を持つ
- Saga は複雑で非同期的な操作のオーケストレーションに責任を持つ
- Saga は複雑で非同期な操作のオーケストレーションに責任を持つ
Saga は Generator 関数を使って作成されます。もし馴染みがないようであれば[リンク集](http://yelouafi.github.io/redux-saga/docs/ExternalResources.html)を参考にしてみてください。
thunk とは異なり action creator によるすべての action に関与します。
Saga が起動するのはアプリケーションの起動時の1回だけです(ただし、Saga の起動によって他の Saga を起動することがあります)。それらはバックグラウンドで実行されるプロセスのように見えます。Saga は store に送り出される action を監視して、その action にもとづいて何をするか決定します: AJAX リクエストのような非同期呼び出しの作成、他の action の送出、 他の Saga の動的な起動など。
Action Creator を呼び出すたびに実行される Thunk とは異なり、Saga が実行されるのはアプリケーション起動時の1回だけです(ただし、最初に起動する Saga が他の Saga を動的に起動することがあります)。それらはバックグラウンドで実行されるプロセスのように見えます。Saga は Store に送り出される Action を監視して、その Action にもとづいて何をするか決定します: AJAX リクエストのような非同期呼び出しの開始、他の Action の送出、 他の Saga の動的な起動など。
`redux-saga` では上記のようなタスクを **作用** を生成することによって実現します。作用は Saga によって実行される手順が含まれた単純な JavaScript のオブジェクトです。例えるなら、Redux の action が store によって実行される手順が含まれているオブジェクトであることに似ています。`redux-saga` は非同期関数を呼び出したり、store に action を送り出したり、バックグラウンドのタスクを起動したり、特定の条件を満たす action を待ち受けたり、様々なタスクのために作用を作成する関数を提供します。
`redux-saga` では上記のようなタスクを **作用(Effects)** を生成することによって実現します。作用は `redux-saga` ミドルウェアによって実行される手順が含まれた単純な JavaScript のオブジェクトです。例えるなら、Redux の Action が Store によって実行される手順が含まれているオブジェクトであることに似ています。`redux-saga` は、非同期関数を呼び出したり、Store に Action を送り出したり、バックグラウンドのタスクを起動したり、特定の条件を満たす Action を待ち受けたり、様々なタスクに応じた **作用を生成する関数(Effect Creator)** を提供します。
Generator によって `redux-saga` で非同期コードをシンプルな同期スタイルで書き下すことができます。`async/await` 関数によってできることに似ていますが、Generator は `async` 関数では困難ないくつかのことを可能にします。
Saga がプレーンなオブジェクトを生成するということは、生成されたオブジェクトを単純に同値チェックすればよいだけになり、Generator のすべてのロジックをテストしやすくします。
Saga がプレーンなオブジェクトを生成するということは、イテレータを回すことで生成されるオブジェクトを単純に同値チェックすればよいだけになり、Generator 内部のすべてのロジックをテストしやすくします。

@@ -31,5 +29,5 @@ さらに `redux-saga` で開始したタスクは手動・自動(他の作用と競争させてたり)を問わずいつでもキャンセル可能です。

```sh
$ npm install --save redux-saga
```
npm install redux-saga
```

@@ -53,4 +51,4 @@ 別の方法として、UMD ビルドを HTML ページの `<script>` タグで直接使うこともできます。詳しくは[こちら](#ブラウザで-umd-ビルドを使用する).

コンポーネントはプレーンオブジェクトの action を store に送り出します。
`USER_FETCH_REQUESTED` action を監視して、ユーザデータ取得の API 呼び出しを実行する Saga を作ります。
コンポーネントはプレーンオブジェクトの Action を Store に送り出します。
`USER_FETCH_REQUESTED` Action を監視して、ユーザデータ取得の API 呼び出しを実行する Saga を作ります。

@@ -64,3 +62,3 @@ #### `sagas.js`

// Saga ワーカー : USER_FETCH_REQUESTED action によって呼び出される
// ワーカー Saga: USER_FETCH_REQUESTED Action によって起動する
function* fetchUser(action) {

@@ -71,3 +69,3 @@ try {

} catch (e) {
yield put({type: "USER_FETCH_FAILED",message: e.message});
yield put({type: "USER_FETCH_FAILED", message: e.message});
}

@@ -77,3 +75,3 @@ }

/*
USER_FETCH_REQUESTED action が送出されるたびに fetchUser を開始します。
USER_FETCH_REQUESTED Action が送出されるたびに fetchUser を起動します。
ユーザ情報の並列取得にも対応しています。

@@ -97,8 +95,9 @@ */

作成した Saga を実行するには `redux-saga` ミドルウェアを使って Redux の store と接続する必要があります。
定義した Saga を実行するには `redux-saga` ミドルウェアを使って Redux の Store と接続する必要があります。
#### `main.js`
```javascript
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from `redux-saga`
import createSagaMiddleware from 'redux-saga'

@@ -108,3 +107,6 @@ import reducer from './reducers'

const sagaMiddleware = createSagaMiddleware(mySaga)
// Saga ミドルウェアを作成する
const sagaMiddleware = createSagaMiddleware()
// Store にマウントする
const store = createStore(

@@ -115,2 +117,5 @@ reducer,

// Saga を起動する
sagaMiddleware.run(mySaga)
// アプリケーションのレンダリング

@@ -130,2 +135,5 @@ ```

@superRaytin による[中国語のドキュメント](https://github.com/superRaytin/redux-saga-in-chinese)もあります。
# ブラウザで umd ビルドを使用する

@@ -143,5 +151,4 @@

**重要!** ターゲットのブラウザが _es2015 の Generator_ をサポートしていない場合、有効な polyfill を提供しなければなりません。
例えば *babel* はそのうちの1つを提供しています:
[browser-polyfill.min.js](https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.25/browser-polyfill.min.js)
**重要!** ターゲットのブラウザが *ES2015 の Generator* をサポートしていない場合、[*babel*](https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.25/browser-polyfill.min.js) のような有効な polyfill
を提供しなければなりません。

@@ -158,8 +165,8 @@ polyfill は **redux-saga** の前にインポートされなければなりません。

```sh
$ git clone https://github.com/yelouafi/redux-saga.git
$ cd redux-saga
$ npm install
$ npm test
```
git clone https://github.com/yelouafi/redux-saga.git
cd redux-saga
npm install
npm test
```

@@ -174,3 +181,3 @@ 以下は Redux リポジトリから移植したサンプルです。

Vanilla JavaScript と UMD ビルドを使用したデモです。すべてのソースコードは `index.html` にインラインで埋め込まれています。
ES2015を使っていない素の JavaScript と UMD ビルドを使用したデモです。すべてのソースコードは `index.html` にインラインで埋め込まれています。

@@ -187,7 +194,7 @@ 単純に `index.html` をブラウザで開くだけでサンプルを実行できます。

```
npm run counter
```sh
$ npm run counter
// サンプルのテストを実行
npm run test-counter
# サンプルのテストを実行
$ npm run test-counter
```

@@ -197,15 +204,15 @@

このデモは低レベル API を使用します。 タスクキャンセルのデモです。
低レベル API を使ったタスクのキャンセルのデモです。
```sh
$ npm run cancellable-counter
```
npm run cancellable-counter
```
### ショッピングカートのサンプル
```
npm run shop
```sh
$ npm run shop
// サンプルのテストを実行
npm run test-shop
# サンプルのテストを実行
$ npm run test-shop
```

@@ -215,14 +222,14 @@

```
npm run async
```sh
$ npm run async
// またテストはありません・・・
# またテストはありません・・・
```
### real-world サンプル(webpack の hot reloading 付き)
### real-world サンプル(webpack による hot reloading 付き)
```
npm run real-world
```sh
$ npm run real-world
// またテストはありません・・・
# またテストはありません・・・
```

@@ -204,3 +204,4 @@ # redux-saga

# sorry, no tests yet
# test sample for the generators
$ npm run test-async
```

@@ -207,0 +208,0 @@

@@ -21,5 +21,5 @@ import { sym, is, ident, check, TASK } from './utils'

check(channel, is.notUndef, 'take(channel, pattern): channel is undefined')
check(channel, is.take, `take(channel, pattern): argument ${channel} is not a valid channel (channel argument must have a take method)`)
check(channel, is.take, `take(channel, pattern): argument ${String(channel)} is not a valid channel (channel argument must have a take method)`)
check(pattern, is.notUndef, 'take(channel, pattern): pattern is undefined')
check(pattern, is.pattern, `take(channel, pattern): argument ${pattern} is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)`)
check(pattern, is.pattern, `take(channel, pattern): argument ${String(pattern)} is not a valid pattern (pattern must be String | Function: a => boolean | Array<String>)`)
} else if(arguments.length === 1) {

@@ -32,3 +32,3 @@ check(channel, is.notUndef, 'take(patternOrChannel): undefined argument')

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

@@ -64,2 +64,8 @@ } else {

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

@@ -66,0 +72,0 @@ return effect(RACE, effects)

@@ -375,3 +375,3 @@ import { noop, kTrue, is, log, check, deferred, autoInc, remove, TASK, CANCEL, makeIterator } from './utils'

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

@@ -391,3 +391,3 @@ Use a reentrant lock `asap` to flatten all nested dispatches

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

@@ -394,0 +394,0 @@ } else {

@@ -35,2 +35,10 @@ import { END } from './channel'

function safeName(pattern) {
if (Array.isArray(pattern)) {
return String(pattern.map(entry => String(entry)))
} else {
return String(pattern)
}
}
export function takeEvery(pattern, worker, ...args) {

@@ -41,6 +49,7 @@ const yTake = {done: false, value: take(pattern)}

let action, setAction = ac => action = ac
return fsmIterator({
q1() { return ['q2', yTake, setAction] },
q2() { return action === END ? [qEnd] : ['q1', yFork(action)] }
}, 'q1', `takeEvery(${String(pattern)}, ${worker.name})`)
}, 'q1', `takeEvery(${safeName(pattern)}, ${worker.name})`)
}

@@ -53,5 +62,6 @@

let task, action
let task, action;
const setTask = t => task = t
const setAction = ac => action = ac
return fsmIterator({

@@ -67,3 +77,3 @@ q1() { return ['q2', yTake, setAction] },

}
}, 'q1', `takeLatest(${String(pattern)}, ${worker.name})`)
}, 'q1', `takeLatest(${safeName(pattern)}, ${worker.name})`)
}

@@ -31,3 +31,3 @@ export const sym = id => `@@redux-saga/${id}`

buffer : buf => buf && is.func(buf.isEmpty) && is.func(buf.take) && is.func(buf.put),
pattern : pat => pat && ((typeof pat === 'string') || is.func(pat) || is.array(pat))
pattern : pat => pat && ((typeof pat === 'string') || (typeof pat === 'symbol') || is.func(pat) || is.array(pat))
}

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

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