redux-saga
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -129,8 +129,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.ident = ident; | ||
@@ -144,3 +143,7 @@ exports.check = check; | ||
exports.warnDeprecated = warnDeprecated; | ||
var TASK = exports.TASK = Symbol('TASK'); | ||
var sym = exports.sym = function sym(id) { | ||
return '@@redux-saga/' + id; | ||
}; | ||
var TASK = exports.TASK = sym('TASK'); | ||
var kTrue = exports.kTrue = function kTrue() { | ||
@@ -175,7 +178,4 @@ return true; | ||
iterator: function iterator(it) { | ||
return it && is.func(it.next) && is.func(it[Symbol.iterator]); | ||
return it && is.func(it.next) && is.func(it.throw); | ||
}, | ||
throw: function _throw(it) { | ||
return it && is.func(it.throw); | ||
}, | ||
task: function task(it) { | ||
@@ -272,2 +272,4 @@ return it && it[TASK]; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -277,5 +279,2 @@ value: true | ||
exports.asEffect = exports.SELECT_ARG_ERROR = exports.INVALID_PATTERN = exports.CANCEL_ARG_ERROR = exports.JOIN_ARG_ERROR = exports.FORK_ARG_ERROR = exports.CALL_FUNCTION_ARG_ERROR = undefined; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.matcher = matcher; | ||
@@ -304,3 +303,3 @@ exports.take = take; | ||
var IO = Symbol('IO'); | ||
var IO = (0, _utils.sym)('IO'); | ||
var TAKE = 'TAKE'; | ||
@@ -550,3 +549,3 @@ var PUT = 'PUT'; | ||
var CANCEL = exports.CANCEL = Symbol('@@redux-saga/cancelPromise'); | ||
var CANCEL = exports.CANCEL = (0, _utils.sym)('@@redux-saga/cancelPromise'); | ||
var PARALLEL_AUTO_CANCEL = exports.PARALLEL_AUTO_CANCEL = 'PARALLEL_AUTO_CANCEL'; | ||
@@ -568,3 +567,2 @@ var RACE_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = 'RACE_AUTO_CANCEL'; | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -576,3 +574,3 @@ | ||
var deferredInputs = []; | ||
var canThrow = _utils.is.throw(iterator); | ||
// Promise to be resolved/rejected when this generator terminates (or throws) | ||
@@ -641,5 +639,4 @@ var deferredEnd = (0, _utils.deferred)(); | ||
try { | ||
if (error && !canThrow) throw error; | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
var result = error ? iterator.throw(error) : iterator.next(arg); | ||
@@ -1195,3 +1192,3 @@ if (!result.done) { | ||
**/ | ||
var IO = Symbol('IO'); | ||
var IO = (0, _utils.sym)('IO'); | ||
function storeIO(store) { | ||
@@ -1226,3 +1223,2 @@ | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -1239,8 +1235,7 @@ | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.takeEvery = takeEvery; | ||
@@ -1259,4 +1254,2 @@ exports.takeLatest = takeLatest; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var resume = function resume(fnOrValue, arg) { | ||
@@ -1268,4 +1261,2 @@ return _utils.is.func(fnOrValue) ? fnOrValue(arg) : fnOrValue; | ||
function fsmIterator(fsm, nextState) { | ||
var _iterator; | ||
var aborted = undefined, | ||
@@ -1296,7 +1287,8 @@ updateState = undefined; | ||
var iterator = (_iterator = {}, _defineProperty(_iterator, Symbol.iterator, function () { | ||
return iterator; | ||
}), _defineProperty(_iterator, 'next', next), _defineProperty(_iterator, 'throw', function _throw(error) { | ||
return next(null, error); | ||
}), _iterator); | ||
var iterator = { | ||
next: next, | ||
throw: function _throw(error) { | ||
return next(null, error); | ||
} | ||
}; | ||
return iterator; | ||
@@ -1303,0 +1295,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var u=t[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,n),u.loaded=!0,u.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.effects=n.takeLatest=n.takeEvery=n.storeIO=n.runSaga=n.isCancelError=n.SagaCancellationException=void 0;var o=t(9);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return o.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return o.storeIO}});var a=t(10);Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return a.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return a.takeLatest}});var i=t(8),c=u(i),f=t(2),s=u(f),l=t(7),d=r(l),v=t(12),g=r(v);n.default=c.default;var p=n.SagaCancellationException=s.default;n.isCancelError=function(e){return e instanceof p};n.effects=d,n.utils=g},function(e,n,t){(function(e){"use strict";function t(e){return e}function r(e,n,t){if(!n(e))throw new Error(t)}function u(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=s({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function a(e){for(var n=[],t=0;e>t;t++)n.push(o());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}function f(e){d&&console.warn("DEPRECATION WARNING",e)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};n.ident=t,n.check=r,n.remove=u,n.deferred=o,n.arrayOfDeffered=a,n.autoInc=i,n.asap=c,n.warnDeprecated=f;var l=n.TASK=Symbol("TASK"),d=(n.kTrue=function(){return!0},n.noop=function(){},n.isDev="undefined"!=typeof e&&e.env&&!1),v=n.is={undef:function(e){return null===e||void 0===e},notUndef:function(e){return null!==e&&void 0!==e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&v.func(e.then)},iterator:function(e){return e&&v.func(e.next)&&v.func(e[Symbol.iterator])},"throw":function(e){return e&&v.func(e.throw)},task:function(e){return e&&e[l]}}}).call(n,t(13))},function(e,n){"use strict";function t(e,n,t){var r="SagaCancellationException; type: "+e+", saga: "+n+", origin: "+t;this.name="SagaCancellationException",this.message=r,this.type=e,this.saga=n,this.origin=t,this.stack=(new Error).stack}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t,t.prototype=Object.create(Error.prototype),t.prototype.constructor=t},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(e){return("*"===e?P.wildcard:E.is.array(e)?P.array:E.is.func(e)?P.predicate:P.default)(e)}function o(e){if(arguments.length>0&&E.is.undef(e))throw new Error(_);return j(b,E.is.undef(e)?"*":e)}function a(e){return j(C,e)}function i(e){return j(T,e)}function c(e,n){(0,E.check)(e,E.is.notUndef,h);var t=null;if(E.is.array(e)){var r=e,u=m(r,2);t=u[0],e=u[1]}else if(e.fn){var o=e;t=o.context,e=o.fn}return(0,E.check)(e,E.is.func,h),{context:t,fn:e,args:n}}function f(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(w,c(e,t))}function s(e,n){var t=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return j(w,c({context:e,fn:n},t))}function l(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(k,c(e,t))}function d(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(L,c(e,t))}function v(e){if(!x(e))throw new Error(y);return j(N,e)}function g(e){if(!x(e))throw new Error(A);return j(S,e)}function p(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return 0===arguments.length?e=E.ident:(0,E.check)(e,E.is.func,R),j(I,{selector:e,args:t})}Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.SELECT_ARG_ERROR=n.INVALID_PATTERN=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0;var m=function(){function e(e,n){var t=[],r=!0,u=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!n||t.length!==n);r=!0);}catch(c){u=!0,o=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw o}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.matcher=u,n.take=o,n.put=a,n.race=i,n.call=f,n.apply=s,n.cps=l,n.fork=d,n.join=v,n.cancel=g,n.select=p;var E=t(1),h=n.CALL_FUNCTION_ARG_ERROR="call/cps/fork first argument must be a function, an array [context, function] or an object {context, fn}",y=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),A=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",_=n.INVALID_PATTERN="Invalid pattern passed to `take` (HINT: check if you didn't mispell a constant)",R=n.SELECT_ARG_ERROR="select first argument must be a function",O=Symbol("IO"),b="TAKE",C="PUT",T="RACE",w="CALL",k="CPS",L="FORK",N="JOIN",S="CANCEL",I="SELECT",j=function(e,n){var t;return t={},r(t,O,!0),r(t,e,n),t},P={wildcard:function(){return E.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},x=function(e){return e[E.TASK]};n.asEffect={take:function(e){return e&&e[O]&&e[b]},put:function(e){return e&&e[O]&&e[C]},race:function(e){return e&&e[O]&&e[T]},call:function(e){return e&&e[O]&&e[w]},cps:function(e){return e&&e[O]&&e[k]},fork:function(e){return e&&e[O]&&e[L]},join:function(e){return e&&e[O]&&e[N]},cancel:function(e){return e&&e[O]&&e[S]},select:function(e){return e&&e[O]&&e[I]}}},function(e,n){"use strict";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n,r,u){var o;return o={},t(o,a,!0),t(o,"type",i),t(o,"effectId",e),t(o,"parentEffectId",n),t(o,"label",r),t(o,"effect",u),o}function u(e,n){var r;return r={},t(r,a,!0),t(r,"type",c),t(r,"effectId",e),t(r,"result",n),r}function o(e,n){var r;return r={},t(r,a,!0),t(r,"type",f),t(r,"effectId",e),t(r,"error",n),r}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=u,n.effectRejected=o;var a=n.MONITOR_ACTION="MONITOR_ACTION",i=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",c=n.EFFECT_RESOLVED="EFFECT_RESOLVED",f=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function o(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){function n(u,o){if(!e._isRunning)throw new Error("Trying to resume an already finished generator");try{if(u&&!G)throw u;var a=u?e.throw(u):e.next(o);a.done?t(a.value):r(a.value,x,"",n)}catch(u){if(t(u,!0),!(u instanceof v.default))throw u;c.isDev&&console.warn(M+": uncaught",u)}}function t(n,t){e._isRunning=!1,t?(e._error=n,F.reject(n)):(e._result=n,F.resolve(n)),K()}function r(e,n){function t(e,n){i||(i=!0,o.cancel=c.noop,P(e?l.effectRejected(a,e):l.effectResolved(a,n)),o(e,n))}var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],o=arguments[3],a=A();P(l.effectTriggered(a,n,r,e));var i=void 0;t.cancel=c.noop,o.cancel=function(e){if(!i){i=!0;try{t.cancel(e)}catch(n){}t.cancel=c.noop,o(e),P(l.effectRejected(a,e))}};var v=void 0;return c.is.promise(e)?u(e,t):c.is.iterator(e)?s(e,a,M,t):c.is.array(e)?w(e,a,t):c.is.notUndef(v=f.asEffect.take(e))?d(v,t):c.is.notUndef(v=f.asEffect.put(e))?_(v,t):c.is.notUndef(v=f.asEffect.race(e))?k(v,a,t):c.is.notUndef(v=f.asEffect.call(e))?R(v,a,t):c.is.notUndef(v=f.asEffect.cps(e))?O(v,t):c.is.notUndef(v=f.asEffect.fork(e))?b(v,a,t):c.is.notUndef(v=f.asEffect.join(e))?C(v,t):c.is.notUndef(v=f.asEffect.cancel(e))?T(v,t):c.is.notUndef(v=f.asEffect.select(e))?L(v,t):t(null,e)}function u(e,n){var t=e[m];"function"==typeof t&&(n.cancel=t),e.then(function(e){return n(null,e)},function(e){return n(e)})}function s(e,n,t,r){u(i(e,S,I,j,P,n,t).done,r)}function d(e,n){var t={match:(0,f.matcher)(e),pattern:e,resolve:function(e){return n(null,e)}};D.push(t),n.cancel=function(){return(0,c.remove)(D,t)}}function _(e,n){(0,c.asap)(function(){return n(null,I(e))})}function R(e,n,t){var r=e.context,o=e.fn,a=e.args,i=o.apply(r,a);return c.is.promise(i)?u(i,t):c.is.iterator(i)?s(i,n,o.name,t):t(null,i)}function O(e,n){var t=e.context,r=e.fn,u=e.args;r.apply(t,u.concat(n))}function b(e,n,t){var r=e.context,u=e.fn,o=e.args,a=void 0,f=void 0;a=u.apply(r,o),f=c.is.iterator(a)?a:regeneratorRuntime.mark(function s(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a;case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},s,this)})(),t(null,i(f,S,I,j,P,n,u.name,!0))}function C(e,n){u(e.done,n)}function T(e,n){e.done[m](new v.default(y,M,M)),n()}function w(e,n,t){function u(){o===i.length&&(a=!0,t(null,i))}if(!e.length)return void t(null,[]);var o=0,a=void 0,i=Array(e.length),f=e.map(function(e,n){var r=function(e,r){if(!a)if(e){try{t.cancel(new v.default(E,M,M))}catch(e){}t(e)}else i[n]=r,o++,u()};return r.cancel=c.noop,r});t.cancel=function(e){a||(a=!0,f.forEach(function(n){return n.cancel(e)}))},e.forEach(function(e,t){return r(e,n,t,f[t])})}function k(e,n,t){var u=void 0,o=Object.keys(e),i={};o.forEach(function(e){var n=function(n,r){if(!u)if(n){try{t.cancel(new v.default(h,M,M))}catch(n){}t(a({},e,n))}else{try{t.cancel(new v.default(h,M,M))}catch(n){}u=!0,t(null,a({},e,r))}};n.cancel=c.noop,i[e]=n}),t.cancel=function(e){u||(u=!0,o.forEach(function(n){return i[n].cancel(e)}))},o.forEach(function(t){return r(e[t],n,t,i[t])})}function L(e,n){var t=e.selector,r=e.args;try{var u=t.apply(void 0,[j()].concat(o(r)));n(null,u)}catch(a){n(a)}}function N(e,n,t,r,u){var o;return o={},a(o,c.TASK,!0),a(o,"id",e),a(o,"name",n),a(o,"done",r),a(o,"forked",u),a(o,"cancel",function(e){e instanceof v.default||(e=new v.default(y,n,e)),r[m](e)}),a(o,"isRunning",function(){return t._isRunning}),a(o,"getResult",function(){return t._result}),a(o,"getError",function(){return t._error}),o}var S=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],I=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],j=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],P=arguments.length<=4||void 0===arguments[4]?c.noop:arguments[4],x=arguments.length<=5||void 0===arguments[5]?0:arguments[5],M=arguments.length<=6||void 0===arguments[6]?"anonymous":arguments[6];(0,c.check)(e,c.is.iterator,g);var U=p(M),D=[],G=c.is.throw(e),F=(0,c.deferred)(),K=S(function(e){if(void 0===e)throw U;for(var n=0;n<D.length;n++){var t=D[n];t.match(e)&&(D=[],t.resolve(e))}});n.cancel=c.noop;var J=N(x,M,e,F.promise);return J.done[m]=function(e){var t=e.type,r=e.origin;n.cancel(new v.default(t,M,r))},e._isRunning=!0,n(),J}Object.defineProperty(n,"__esModule",{value:!0}),n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.CANCEL=n.undefindInputError=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=t(1),f=t(3),s=t(4),l=u(s),d=t(2),v=r(d),g=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.undefindInputError=function(e){return"\n "+e+" saga was provided with an undefined input action\n Hints :\n - check that your Action Creator returns a non undefined value\n - if the Saga was started using runSaga, check that your subscribe source provides the action to its listeners\n"},m=n.CANCEL=Symbol("@@redux-saga/cancelPromise"),E=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",h=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",y=n.MANUAL_CANCEL="MANUAL_CANCEL",A=(0,c.autoInc)()},function(e,n,t){"use strict";function r(){function e(e){return t.push(e),function(){return(0,u.remove)(t,e)}}function n(e){t.slice().forEach(function(n){return n(e)})}var t=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r;var u=t(1)},function(e,n,t){"use strict";var r=t(3);e.exports={take:r.take,put:r.put,race:r.race,call:r.call,apply:r.apply,cps:r.cps,fork:r.fork,join:r.join,cancel:r.cancel,select:r.select}},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(){function e(e){function n(e){for(var n=arguments.length,t=Array(n>1?n-1:0),u=1;n>u;u++)t[u-1]=arguments[u];return(0,i.default)(e.apply(void 0,[d].concat(t)),c.subscribe,a,r,l,0,e.name)}var r=e.getState,a=e.dispatch,c=(0,f.default)(),l=o.isDev?function(e){return(0,o.asap)(function(){return a(e)})}:void 0,d=function(){return(0,o.warnDeprecated)(p),r()};return u=n,t.forEach(n),function(e){return function(n){var t=e(n);return n[s.MONITOR_ACTION]||c.emit(n),t}}}for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];var u=void 0;return t.forEach(function(e,n){return(0,o.check)(e,o.is.func,v("createSagaMiddleware",n,e))}),e.run=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];if(!u)throw new Error(g);(0,o.check)(e,o.is.func,v("sagaMiddleware.run",0,e));var a=u.apply(void 0,[e].concat(t));return a.done.catch(function(e){if(!(e instanceof d.default))throw e}),a},e}Object.defineProperty(n,"__esModule",{value:!0}),n.GET_STATE_DEPRECATED_WARNING=n.RUN_SAGA_DYNAMIC_ERROR=n.sagaArgError=void 0,n.default=u;var o=t(1),a=t(5),i=r(a),c=t(6),f=r(c),s=t(4),l=t(2),d=r(l),v=n.sagaArgError=function(e,n,t){return"\n "+e+" can only be called on Generator functions\n Argument "+t+" at position "+n+" is not function!\n"},g=n.RUN_SAGA_DYNAMIC_ERROR="Before running a Saga dynamically using middleware.run, you must mount the Saga middleware on the Store using applyMiddleware",p=n.GET_STATE_DEPRECATED_WARNING="\n Using the 'getState' param of Sagas to access the state is deprecated since 0.9.1\n To access the Store's state use 'yield select()' instead\n For more infos see http://yelouafi.github.io/redux-saga/docs/api/index.html#selectselector-args\n"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if((0,a.warnDeprecated)("storeIO is deprecated, to run Saga dynamically, use 'run' method of the middleware"),e[d])return e[d];var n=(0,s.default)(),t=e.dispatch;return e.dispatch=function(e){var r=t(e);return n.emit(e),r},e[d]={subscribe:n.subscribe,dispatch:e.dispatch,getState:e.getState},e[d]}function o(e,n){var t=n.subscribe,r=n.dispatch,u=n.getState,o=arguments.length<=2||void 0===arguments[2]?a.noop:arguments[2];return(0,a.check)(e,a.is.iterator,l),(0,c.default)(e,t,r,u,o)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=u,n.runSaga=o;var a=t(1),i=t(5),c=r(i),f=t(6),s=r(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=Symbol("IO")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){function t(t,r){if(o)return g;if(r){if(o=!0,!(r instanceof d.default))throw r;return g}a&&a(t);var u=c(e[n],3),i=u[0],f=u[1],s=u[2];return a=s,n=v(f,t),v(i,t)}var r,o=void 0,a=void 0,i=(r={},u(r,Symbol.iterator,function(){return i}),u(r,"next",t),u(r,"throw",function(e){return t(null,e)}),r);return i}function a(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),u=2;t>u;u++)r[u-2]=arguments[u];var a={done:!1,value:(0,s.take)(e)},i=function(e){return{done:!1,value:s.fork.apply(void 0,[n].concat(r,[e]))}};return o({take:[a,"fork"],fork:[i,"take"]},"take")}function i(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),u=2;t>u;u++)r[u-2]=arguments[u];var a={done:!1,value:(0,s.take)(e)},i=function(){return{done:!1,value:s.fork.apply(void 0,[n].concat(r,[d]))}},c=function(){return{done:!1,value:(0,s.cancel)(l)}},f=function(){return l?"cancel":"fork"},l=void 0,d=void 0;return o({take:[a,f,function(e){return d=e}],cancel:[c,"fork"],fork:[i,"take",function(e){return l=e}]},"take")}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(e,n){var t=[],r=!0,u=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!n||t.length!==n);r=!0);}catch(c){u=!0,o=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw o}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();n.takeEvery=a,n.takeLatest=i;var f=t(1),s=t(3),l=t(2),d=r(l),v=function(e,n){return f.is.func(e)?e(n):e},g={done:!0}},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(){var e,n=!0,t=void 0,u=void 0;return e={},r(e,o.TASK,!0),r(e,"isRunning",function(){return n}),r(e,"getResult",function(){return t}),r(e,"getError",function(){return u}),r(e,"setRunning",function(e){return n=e}),r(e,"setResult",function(e){return t=e}),r(e,"setError",function(e){return u=e}),e}Object.defineProperty(n,"__esModule",{value:!0}),n.createMockTask=u;var o=t(1)},function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}var u=t(1),o=t(3),a=t(5),i=t(11),c=t(4),f=r(c);e.exports={TASK:u.TASK,noop:u.noop,is:u.is,asEffect:o.asEffect,deferred:u.deferred,arrayOfDeffered:u.arrayOfDeffered,asap:u.asap,CANCEL:a.CANCEL,RACE_AUTO_CANCEL:a.RACE_AUTO_CANCEL,PARALLEL_AUTO_CANCEL:a.PARALLEL_AUTO_CANCEL,MANUAL_CANCEL:a.MANUAL_CANCEL,createMockTask:i.createMockTask,monitorActions:f}},function(e,n){function t(){f=!1,a.length?c=a.concat(c):s=-1,c.length&&r()}function r(){if(!f){var e=setTimeout(t);f=!0;for(var n=c.length;n;){for(a=c,c=[];++s<n;)a&&a[s].run();s=-1,n=c.length}a=null,f=!1,clearTimeout(e)}}function u(e,n){this.fun=e,this.array=n}function o(){}var a,i=e.exports={},c=[],f=!1,s=-1;i.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];c.push(new u(e,n)),1!==c.length||f||setTimeout(r,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=o,i.addListener=o,i.once=o,i.off=o,i.removeListener=o,i.removeAllListeners=o,i.emit=o,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ReduxSaga=n():e.ReduxSaga=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var u=t[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,n),u.loaded=!0,u.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.effects=n.takeLatest=n.takeEvery=n.storeIO=n.runSaga=n.isCancelError=n.SagaCancellationException=void 0;var a=t(9);Object.defineProperty(n,"runSaga",{enumerable:!0,get:function(){return a.runSaga}}),Object.defineProperty(n,"storeIO",{enumerable:!0,get:function(){return a.storeIO}});var o=t(10);Object.defineProperty(n,"takeEvery",{enumerable:!0,get:function(){return o.takeEvery}}),Object.defineProperty(n,"takeLatest",{enumerable:!0,get:function(){return o.takeLatest}});var i=t(8),c=u(i),f=t(2),s=u(f),l=t(7),d=r(l),v=t(12),g=r(v);n.default=c.default;var p=n.SagaCancellationException=s.default;n.isCancelError=function(e){return e instanceof p};n.effects=d,n.utils=g},function(e,n,t){(function(e){"use strict";function t(e){return e}function r(e,n,t){if(!n(e))throw new Error(t)}function u(e,n){var t=e.indexOf(n);t>=0&&e.splice(t,1)}function a(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=s({},e),t=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.promise=t,n}function o(e){for(var n=[],t=0;e>t;t++)n.push(a());return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return function(){return++e}}function c(e){return Promise.resolve(1).then(function(){return e()})}function f(e){v&&console.warn("DEPRECATION WARNING",e)}var s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};Object.defineProperty(n,"__esModule",{value:!0}),n.ident=t,n.check=r,n.remove=u,n.deferred=a,n.arrayOfDeffered=o,n.autoInc=i,n.asap=c,n.warnDeprecated=f;var l=n.sym=function(e){return"@@redux-saga/"+e},d=n.TASK=l("TASK"),v=(n.kTrue=function(){return!0},n.noop=function(){},n.isDev="undefined"!=typeof e&&e.env&&!1),g=n.is={undef:function(e){return null===e||void 0===e},notUndef:function(e){return null!==e&&void 0!==e},func:function(e){return"function"==typeof e},array:Array.isArray,promise:function(e){return e&&g.func(e.then)},iterator:function(e){return e&&g.func(e.next)&&g.func(e.throw)},task:function(e){return e&&e[d]}}}).call(n,t(13))},function(e,n){"use strict";function t(e,n,t){var r="SagaCancellationException; type: "+e+", saga: "+n+", origin: "+t;this.name="SagaCancellationException",this.message=r,this.type=e,this.saga=n,this.origin=t,this.stack=(new Error).stack}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t,t.prototype=Object.create(Error.prototype),t.prototype.constructor=t},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(e){return("*"===e?x.wildcard:m.is.array(e)?x.array:m.is.func(e)?x.predicate:x.default)(e)}function a(e){if(arguments.length>0&&m.is.undef(e))throw new Error(_);return j(C,m.is.undef(e)?"*":e)}function o(e){return j(b,e)}function i(e){return j(T,e)}function c(e,n){(0,m.check)(e,m.is.notUndef,h);var t=null;if(m.is.array(e)){var r=e,u=E(r,2);t=u[0],e=u[1]}else if(e.fn){var a=e;t=a.context,e=a.fn}return(0,m.check)(e,m.is.func,h),{context:t,fn:e,args:n}}function f(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(w,c(e,t))}function s(e,n){var t=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];return j(w,c({context:e,fn:n},t))}function l(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(k,c(e,t))}function d(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return j(L,c(e,t))}function v(e){if(!P(e))throw new Error(y);return j(N,e)}function g(e){if(!P(e))throw new Error(A);return j(S,e)}function p(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];return 0===arguments.length?e=m.ident:(0,m.check)(e,m.is.func,R),j(I,{selector:e,args:t})}var E=function(){function e(e,n){var t=[],r=!0,u=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){u=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(n,"__esModule",{value:!0}),n.asEffect=n.SELECT_ARG_ERROR=n.INVALID_PATTERN=n.CANCEL_ARG_ERROR=n.JOIN_ARG_ERROR=n.FORK_ARG_ERROR=n.CALL_FUNCTION_ARG_ERROR=void 0,n.matcher=u,n.take=a,n.put=o,n.race=i,n.call=f,n.apply=s,n.cps=l,n.fork=d,n.join=v,n.cancel=g,n.select=p;var m=t(1),h=n.CALL_FUNCTION_ARG_ERROR="call/cps/fork first argument must be a function, an array [context, function] or an object {context, fn}",y=(n.FORK_ARG_ERROR="fork first argument must be a generator function or an iterator",n.JOIN_ARG_ERROR="join argument must be a valid task (a result of a fork)"),A=n.CANCEL_ARG_ERROR="cancel argument must be a valid task (a result of a fork)",_=n.INVALID_PATTERN="Invalid pattern passed to `take` (HINT: check if you didn't mispell a constant)",R=n.SELECT_ARG_ERROR="select first argument must be a function",O=(0,m.sym)("IO"),C="TAKE",b="PUT",T="RACE",w="CALL",k="CPS",L="FORK",N="JOIN",S="CANCEL",I="SELECT",j=function(e,n){var t;return t={},r(t,O,!0),r(t,e,n),t},x={wildcard:function(){return m.kTrue},"default":function(e){return function(n){return n.type===e}},array:function(e){return function(n){return e.some(function(e){return e===n.type})}},predicate:function(e){return function(n){return e(n)}}},P=function(e){return e[m.TASK]};n.asEffect={take:function(e){return e&&e[O]&&e[C]},put:function(e){return e&&e[O]&&e[b]},race:function(e){return e&&e[O]&&e[T]},call:function(e){return e&&e[O]&&e[w]},cps:function(e){return e&&e[O]&&e[k]},fork:function(e){return e&&e[O]&&e[L]},join:function(e){return e&&e[O]&&e[N]},cancel:function(e){return e&&e[O]&&e[S]},select:function(e){return e&&e[O]&&e[I]}}},function(e,n){"use strict";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n,r,u){var a;return a={},t(a,o,!0),t(a,"type",i),t(a,"effectId",e),t(a,"parentEffectId",n),t(a,"label",r),t(a,"effect",u),a}function u(e,n){var r;return r={},t(r,o,!0),t(r,"type",c),t(r,"effectId",e),t(r,"result",n),r}function a(e,n){var r;return r={},t(r,o,!0),t(r,"type",f),t(r,"effectId",e),t(r,"error",n),r}Object.defineProperty(n,"__esModule",{value:!0}),n.effectTriggered=r,n.effectResolved=u,n.effectRejected=a;var o=n.MONITOR_ACTION="MONITOR_ACTION",i=n.EFFECT_TRIGGERED="EFFECT_TRIGGERED",c=n.EFFECT_RESOLVED="EFFECT_RESOLVED",f=n.EFFECT_REJECTED="EFFECT_REJECTED"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}function a(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){function n(u,a){if(!e._isRunning)throw new Error("Trying to resume an already finished generator");try{var o=u?e.throw(u):e.next(a);o.done?t(o.value):r(o.value,P,"",n)}catch(u){if(t(u,!0),!(u instanceof v.default))throw u;c.isDev&&console.warn(M+": uncaught",u)}}function t(n,t){e._isRunning=!1,t?(e._error=n,G.reject(n)):(e._result=n,G.resolve(n)),F()}function r(e,n){function t(e,n){i||(i=!0,a.cancel=c.noop,x(e?l.effectRejected(o,e):l.effectResolved(o,n)),a(e,n))}var r=arguments.length<=2||void 0===arguments[2]?"":arguments[2],a=arguments[3],o=A();x(l.effectTriggered(o,n,r,e));var i=void 0;t.cancel=c.noop,a.cancel=function(e){if(!i){i=!0;try{t.cancel(e)}catch(n){}t.cancel=c.noop,a(e),x(l.effectRejected(o,e))}};var v=void 0;return c.is.promise(e)?u(e,t):c.is.iterator(e)?s(e,o,M,t):c.is.array(e)?w(e,o,t):c.is.notUndef(v=f.asEffect.take(e))?d(v,t):c.is.notUndef(v=f.asEffect.put(e))?_(v,t):c.is.notUndef(v=f.asEffect.race(e))?k(v,o,t):c.is.notUndef(v=f.asEffect.call(e))?R(v,o,t):c.is.notUndef(v=f.asEffect.cps(e))?O(v,t):c.is.notUndef(v=f.asEffect.fork(e))?C(v,o,t):c.is.notUndef(v=f.asEffect.join(e))?b(v,t):c.is.notUndef(v=f.asEffect.cancel(e))?T(v,t):c.is.notUndef(v=f.asEffect.select(e))?L(v,t):t(null,e)}function u(e,n){var t=e[E];"function"==typeof t&&(n.cancel=t),e.then(function(e){return n(null,e)},function(e){return n(e)})}function s(e,n,t,r){u(i(e,S,I,j,x,n,t).done,r)}function d(e,n){var t={match:(0,f.matcher)(e),pattern:e,resolve:function(e){return n(null,e)}};D.push(t),n.cancel=function(){return(0,c.remove)(D,t)}}function _(e,n){(0,c.asap)(function(){return n(null,I(e))})}function R(e,n,t){var r=e.context,a=e.fn,o=e.args,i=a.apply(r,o);return c.is.promise(i)?u(i,t):c.is.iterator(i)?s(i,n,a.name,t):t(null,i)}function O(e,n){var t=e.context,r=e.fn,u=e.args;r.apply(t,u.concat(n))}function C(e,n,t){var r=e.context,u=e.fn,a=e.args,o=void 0,f=void 0;o=u.apply(r,a),f=c.is.iterator(o)?o:regeneratorRuntime.mark(function s(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o;case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},s,this)})(),t(null,i(f,S,I,j,x,n,u.name,!0))}function b(e,n){u(e.done,n)}function T(e,n){e.done[E](new v.default(y,M,M)),n()}function w(e,n,t){function u(){a===i.length&&(o=!0,t(null,i))}if(!e.length)return void t(null,[]);var a=0,o=void 0,i=Array(e.length),f=e.map(function(e,n){var r=function(e,r){if(!o)if(e){try{t.cancel(new v.default(m,M,M))}catch(e){}t(e)}else i[n]=r,a++,u()};return r.cancel=c.noop,r});t.cancel=function(e){o||(o=!0,f.forEach(function(n){return n.cancel(e)}))},e.forEach(function(e,t){return r(e,n,t,f[t])})}function k(e,n,t){var u=void 0,a=Object.keys(e),i={};a.forEach(function(e){var n=function(n,r){if(!u)if(n){try{t.cancel(new v.default(h,M,M))}catch(n){}t(o({},e,n))}else{try{t.cancel(new v.default(h,M,M))}catch(n){}u=!0,t(null,o({},e,r))}};n.cancel=c.noop,i[e]=n}),t.cancel=function(e){u||(u=!0,a.forEach(function(n){return i[n].cancel(e)}))},a.forEach(function(t){return r(e[t],n,t,i[t])})}function L(e,n){var t=e.selector,r=e.args;try{var u=t.apply(void 0,[j()].concat(a(r)));n(null,u)}catch(o){n(o)}}function N(e,n,t,r,u){var a;return a={},o(a,c.TASK,!0),o(a,"id",e),o(a,"name",n),o(a,"done",r),o(a,"forked",u),o(a,"cancel",function(e){e instanceof v.default||(e=new v.default(y,n,e)),r[E](e)}),o(a,"isRunning",function(){return t._isRunning}),o(a,"getResult",function(){return t._result}),o(a,"getError",function(){return t._error}),a}var S=arguments.length<=1||void 0===arguments[1]?function(){return c.noop}:arguments[1],I=arguments.length<=2||void 0===arguments[2]?c.noop:arguments[2],j=arguments.length<=3||void 0===arguments[3]?c.noop:arguments[3],x=arguments.length<=4||void 0===arguments[4]?c.noop:arguments[4],P=arguments.length<=5||void 0===arguments[5]?0:arguments[5],M=arguments.length<=6||void 0===arguments[6]?"anonymous":arguments[6];(0,c.check)(e,c.is.iterator,g);var U=p(M),D=[],G=(0,c.deferred)(),F=S(function(e){if(void 0===e)throw U;for(var n=0;n<D.length;n++){var t=D[n];t.match(e)&&(D=[],t.resolve(e))}});n.cancel=c.noop;var K=N(P,M,e,G.promise);return K.done[E]=function(e){var t=e.type,r=e.origin;n.cancel(new v.default(t,M,r))},e._isRunning=!0,n(),K}Object.defineProperty(n,"__esModule",{value:!0}),n.MANUAL_CANCEL=n.RACE_AUTO_CANCEL=n.PARALLEL_AUTO_CANCEL=n.CANCEL=n.undefindInputError=n.NOT_ITERATOR_ERROR=void 0,n.default=i;var c=t(1),f=t(3),s=t(4),l=u(s),d=t(2),v=r(d),g=n.NOT_ITERATOR_ERROR="proc first argument (Saga function result) must be an iterator",p=n.undefindInputError=function(e){return"\n "+e+" saga was provided with an undefined input action\n Hints :\n - check that your Action Creator returns a non undefined value\n - if the Saga was started using runSaga, check that your subscribe source provides the action to its listeners\n"},E=n.CANCEL=(0,c.sym)("@@redux-saga/cancelPromise"),m=n.PARALLEL_AUTO_CANCEL="PARALLEL_AUTO_CANCEL",h=n.RACE_AUTO_CANCEL="RACE_AUTO_CANCEL",y=n.MANUAL_CANCEL="MANUAL_CANCEL",A=(0,c.autoInc)()},function(e,n,t){"use strict";function r(){function e(e){return t.push(e),function(){return(0,u.remove)(t,e)}}function n(e){t.slice().forEach(function(n){return n(e)})}var t=[];return{subscribe:e,emit:n}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r;var u=t(1)},function(e,n,t){"use strict";var r=t(3);e.exports={take:r.take,put:r.put,race:r.race,call:r.call,apply:r.apply,cps:r.cps,fork:r.fork,join:r.join,cancel:r.cancel,select:r.select}},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(){function e(e){function n(e){for(var n=arguments.length,t=Array(n>1?n-1:0),u=1;n>u;u++)t[u-1]=arguments[u];return(0,i.default)(e.apply(void 0,[d].concat(t)),c.subscribe,o,r,l,0,e.name)}var r=e.getState,o=e.dispatch,c=(0,f.default)(),l=a.isDev?function(e){return(0,a.asap)(function(){return o(e)})}:void 0,d=function(){return(0,a.warnDeprecated)(p),r()};return u=n,t.forEach(n),function(e){return function(n){var t=e(n);return n[s.MONITOR_ACTION]||c.emit(n),t}}}for(var n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];var u=void 0;return t.forEach(function(e,n){return(0,a.check)(e,a.is.func,v("createSagaMiddleware",n,e))}),e.run=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];if(!u)throw new Error(g);(0,a.check)(e,a.is.func,v("sagaMiddleware.run",0,e));var o=u.apply(void 0,[e].concat(t));return o.done.catch(function(e){if(!(e instanceof d.default))throw e}),o},e}Object.defineProperty(n,"__esModule",{value:!0}),n.GET_STATE_DEPRECATED_WARNING=n.RUN_SAGA_DYNAMIC_ERROR=n.sagaArgError=void 0,n.default=u;var a=t(1),o=t(5),i=r(o),c=t(6),f=r(c),s=t(4),l=t(2),d=r(l),v=n.sagaArgError=function(e,n,t){return"\n "+e+" can only be called on Generator functions\n Argument "+t+" at position "+n+" is not function!\n"},g=n.RUN_SAGA_DYNAMIC_ERROR="Before running a Saga dynamically using middleware.run, you must mount the Saga middleware on the Store using applyMiddleware",p=n.GET_STATE_DEPRECATED_WARNING="\n Using the 'getState' param of Sagas to access the state is deprecated since 0.9.1\n To access the Store's state use 'yield select()' instead\n For more infos see http://yelouafi.github.io/redux-saga/docs/api/index.html#selectselector-args\n"},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){if((0,o.warnDeprecated)("storeIO is deprecated, to run Saga dynamically, use 'run' method of the middleware"),e[d])return e[d];var n=(0,s.default)(),t=e.dispatch;return e.dispatch=function(e){var r=t(e);return n.emit(e),r},e[d]={subscribe:n.subscribe,dispatch:e.dispatch,getState:e.getState},e[d]}function a(e,n){var t=n.subscribe,r=n.dispatch,u=n.getState,a=arguments.length<=2||void 0===arguments[2]?o.noop:arguments[2];return(0,o.check)(e,o.is.iterator,l),(0,c.default)(e,t,r,u,a)}Object.defineProperty(n,"__esModule",{value:!0}),n.NOT_ITERATOR_ERROR=void 0,n.storeIO=u,n.runSaga=a;var o=t(1),i=t(5),c=r(i),f=t(6),s=r(f),l=n.NOT_ITERATOR_ERROR="runSaga must be called on an iterator",d=(0,o.sym)("IO")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e,n){function t(t,a){if(r)return v;if(a){if(r=!0,!(a instanceof l.default))throw a;return v}u&&u(t);var o=i(e[n],3),c=o[0],f=o[1],s=o[2];return u=s,n=d(f,t),d(c,t)}var r=void 0,u=void 0,a={next:t,"throw":function(e){return t(null,e)}};return a}function a(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),a=2;t>a;a++)r[a-2]=arguments[a];var o={done:!1,value:(0,f.take)(e)},i=function(e){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[e]))}};return u({take:[o,"fork"],fork:[i,"take"]},"take")}function o(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),a=2;t>a;a++)r[a-2]=arguments[a];var o={done:!1,value:(0,f.take)(e)},i=function(){return{done:!1,value:f.fork.apply(void 0,[n].concat(r,[d]))}},c=function(){return{done:!1,value:(0,f.cancel)(l)}},s=function(){return l?"cancel":"fork"},l=void 0,d=void 0;return u({take:[o,s,function(e){return d=e}],cancel:[c,"fork"],fork:[i,"take",function(e){return l=e}]},"take")}var i=function(){function e(e,n){var t=[],r=!0,u=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(c){u=!0,a=c}finally{try{!r&&i.return&&i.return()}finally{if(u)throw a}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(n,"__esModule",{value:!0}),n.takeEvery=a,n.takeLatest=o;var c=t(1),f=t(3),s=t(2),l=r(s),d=function(e,n){return c.is.func(e)?e(n):e},v={done:!0}},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function u(){var e,n=!0,t=void 0,u=void 0;return e={},r(e,a.TASK,!0),r(e,"isRunning",function(){return n}),r(e,"getResult",function(){return t}),r(e,"getError",function(){return u}),r(e,"setRunning",function(e){return n=e}),r(e,"setResult",function(e){return t=e}),r(e,"setError",function(e){return u=e}),e}Object.defineProperty(n,"__esModule",{value:!0}),n.createMockTask=u;var a=t(1)},function(e,n,t){"use strict";function r(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n}var u=t(1),a=t(3),o=t(5),i=t(11),c=t(4),f=r(c);e.exports={TASK:u.TASK,noop:u.noop,is:u.is,asEffect:a.asEffect,deferred:u.deferred,arrayOfDeffered:u.arrayOfDeffered,asap:u.asap,CANCEL:o.CANCEL,RACE_AUTO_CANCEL:o.RACE_AUTO_CANCEL,PARALLEL_AUTO_CANCEL:o.PARALLEL_AUTO_CANCEL,MANUAL_CANCEL:o.MANUAL_CANCEL,createMockTask:i.createMockTask,monitorActions:f}},function(e,n){function t(){f=!1,o.length?c=o.concat(c):s=-1,c.length&&r()}function r(){if(!f){var e=setTimeout(t);f=!0;for(var n=c.length;n;){for(o=c,c=[];++s<n;)o&&o[s].run();s=-1,n=c.length}o=null,f=!1,clearTimeout(e)}}function u(e,n){this.fun=e,this.array=n}function a(){}var o,i=e.exports={},c=[],f=!1,s=-1;i.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];c.push(new u(e,n)),1!==c.length||f||setTimeout(r,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=a,i.addListener=a,i.once=a,i.off=a,i.removeListener=a,i.removeAllListeners=a,i.emit=a,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}); |
"use strict"; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -7,5 +9,2 @@ value: true | ||
exports.asEffect = exports.SELECT_ARG_ERROR = exports.INVALID_PATTERN = exports.CANCEL_ARG_ERROR = exports.JOIN_ARG_ERROR = exports.FORK_ARG_ERROR = exports.CALL_FUNCTION_ARG_ERROR = undefined; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.matcher = matcher; | ||
@@ -34,3 +33,3 @@ exports.take = take; | ||
var IO = Symbol('IO'); | ||
var IO = (0, _utils.sym)('IO'); | ||
var TAKE = 'TAKE'; | ||
@@ -37,0 +36,0 @@ var PUT = 'PUT'; |
@@ -34,3 +34,3 @@ 'use strict'; | ||
var CANCEL = exports.CANCEL = Symbol('@@redux-saga/cancelPromise'); | ||
var CANCEL = exports.CANCEL = (0, _utils.sym)('@@redux-saga/cancelPromise'); | ||
var PARALLEL_AUTO_CANCEL = exports.PARALLEL_AUTO_CANCEL = 'PARALLEL_AUTO_CANCEL'; | ||
@@ -52,3 +52,2 @@ var RACE_AUTO_CANCEL = exports.RACE_AUTO_CANCEL = 'RACE_AUTO_CANCEL'; | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -60,3 +59,3 @@ | ||
var deferredInputs = []; | ||
var canThrow = _utils.is.throw(iterator); | ||
// Promise to be resolved/rejected when this generator terminates (or throws) | ||
@@ -125,5 +124,4 @@ var deferredEnd = (0, _utils.deferred)(); | ||
try { | ||
if (error && !canThrow) throw error; | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
var result = error ? iterator.throw(error) : iterator.next(arg); | ||
@@ -130,0 +128,0 @@ if (!result.done) { |
@@ -32,3 +32,3 @@ 'use strict'; | ||
**/ | ||
var IO = Symbol('IO'); | ||
var IO = (0, _utils.sym)('IO'); | ||
function storeIO(store) { | ||
@@ -63,3 +63,2 @@ | ||
(0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
@@ -66,0 +65,0 @@ |
'use strict'; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.takeEvery = takeEvery; | ||
@@ -22,4 +21,2 @@ exports.takeLatest = takeLatest; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var resume = function resume(fnOrValue, arg) { | ||
@@ -31,4 +28,2 @@ return _utils.is.func(fnOrValue) ? fnOrValue(arg) : fnOrValue; | ||
function fsmIterator(fsm, nextState) { | ||
var _iterator; | ||
var aborted = undefined, | ||
@@ -59,7 +54,8 @@ updateState = undefined; | ||
var iterator = (_iterator = {}, _defineProperty(_iterator, Symbol.iterator, function () { | ||
return iterator; | ||
}), _defineProperty(_iterator, 'next', next), _defineProperty(_iterator, 'throw', function _throw(error) { | ||
return next(null, error); | ||
}), _iterator); | ||
var iterator = { | ||
next: next, | ||
throw: function _throw(error) { | ||
return next(null, error); | ||
} | ||
}; | ||
return iterator; | ||
@@ -66,0 +62,0 @@ } |
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.ident = ident; | ||
@@ -17,3 +16,7 @@ exports.check = check; | ||
exports.warnDeprecated = warnDeprecated; | ||
var TASK = exports.TASK = Symbol('TASK'); | ||
var sym = exports.sym = function sym(id) { | ||
return '@@redux-saga/' + id; | ||
}; | ||
var TASK = exports.TASK = sym('TASK'); | ||
var kTrue = exports.kTrue = function kTrue() { | ||
@@ -48,7 +51,4 @@ return true; | ||
iterator: function iterator(it) { | ||
return it && is.func(it.next) && is.func(it[Symbol.iterator]); | ||
return it && is.func(it.next) && is.func(it.throw); | ||
}, | ||
throw: function _throw(it) { | ||
return it && is.func(it.throw); | ||
}, | ||
task: function task(it) { | ||
@@ -55,0 +55,0 @@ return it && it[TASK]; |
{ | ||
"name": "redux-saga", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Saga middleware for Redux to handle Side Effects", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -10,5 +10,5 @@ # redux-saga | ||
This means the logic of the application lives in 2 places: | ||
This means application logic lives in 2 places: | ||
- Reducers are responsible for handling state transitions between actions | ||
- Reducers are responsible for handling state transitions between actions. | ||
@@ -20,7 +20,7 @@ - Sagas are responsible for orchestrating complex/asynchronous operations. | ||
Unlike Thunks which get invoked on every action by Action Creators. Sagas are fired only | ||
Unlike Thunks which get invoked on every action by Action Creators, Sagas are fired only | ||
once at the start of the application (but startup Sagas may fire other Sagas dynamically). | ||
They can be seen as Processes running in the background. Sagas watch the actions dispatched | ||
to the Store, then decide what to do based on dispatched actions : Either making an asynchronous | ||
call (like an AJAX request), dispatching other actions to the Store or even starting other | ||
to the Store, then decide what to do based on dispatched actions: Either making an asynchronous | ||
call (like an AJAX request), dispatching other actions to the Store, or even starting other | ||
Sagas dynamically. | ||
@@ -37,5 +37,5 @@ | ||
synchronous style. Just like you can do with `async/await` functions. But Generators | ||
allows some things that aren't possible with `async` functions. | ||
allow some things that aren't possible with `async` functions. | ||
The fact that Sagas yield plain Objects make it easy to test all the logic inside your Generator | ||
The fact that Sagas yield plain Objects makes it easy to test all the logic inside your Generator | ||
by simply iterating over the yielded Objects and doing simple equality tests. | ||
@@ -42,0 +42,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { is, kTrue, ident, check, TASK } from './utils' | ||
import { sym, is, kTrue, ident, check, TASK } from './utils' | ||
@@ -12,3 +12,3 @@ | ||
const IO = Symbol('IO') | ||
const IO = sym('IO') | ||
const TAKE = 'TAKE' | ||
@@ -15,0 +15,0 @@ const PUT = 'PUT' |
@@ -1,2 +0,2 @@ | ||
import { noop, is, isDev, check, remove, deferred, autoInc, asap, TASK } from './utils' | ||
import { sym, noop, is, isDev, check, remove, deferred, autoInc, asap, TASK } from './utils' | ||
import { asEffect, matcher } from './io' | ||
@@ -15,3 +15,3 @@ import * as monitorActions from './monitorActions' | ||
export const CANCEL = Symbol('@@redux-saga/cancelPromise') | ||
export const CANCEL = sym('@@redux-saga/cancelPromise') | ||
export const PARALLEL_AUTO_CANCEL = 'PARALLEL_AUTO_CANCEL' | ||
@@ -39,3 +39,3 @@ export const RACE_AUTO_CANCEL = 'RACE_AUTO_CANCEL' | ||
let deferredInputs = [] | ||
const canThrow = is.throw(iterator) | ||
// Promise to be resolved/rejected when this generator terminates (or throws) | ||
@@ -108,6 +108,4 @@ const deferredEnd = deferred() | ||
try { | ||
if(error && !canThrow) | ||
throw error | ||
// calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
// will throw an exception and jump to the catch block below | ||
const result = error ? iterator.throw(error) : iterator.next(arg) | ||
@@ -114,0 +112,0 @@ if(!result.done) { |
@@ -1,2 +0,2 @@ | ||
import { is, check, noop, warnDeprecated } from './utils' | ||
import { sym, is, check, noop, warnDeprecated } from './utils' | ||
import proc from './proc' | ||
@@ -15,3 +15,3 @@ import emitter from './emitter' | ||
**/ | ||
const IO = Symbol('IO') | ||
const IO = sym('IO') | ||
export function storeIO(store) { | ||
@@ -18,0 +18,0 @@ |
@@ -32,3 +32,2 @@ import { is } from './utils' | ||
const iterator = { | ||
[Symbol.iterator]: () => iterator, | ||
next, | ||
@@ -35,0 +34,0 @@ throw: error => next(null, error) |
@@ -1,2 +0,4 @@ | ||
export const TASK = Symbol('TASK') | ||
export const sym = id => `@@redux-saga/${id}` | ||
export const TASK = sym('TASK') | ||
export const kTrue = () => true | ||
@@ -21,4 +23,3 @@ export const noop = () => {} | ||
promise : p => p && is.func(p.then), | ||
iterator : it => it && is.func(it.next) && is.func(it[Symbol.iterator]) , | ||
throw : it => it && is.func(it.throw), | ||
iterator : it => it && is.func(it.next) && is.func(it.throw), | ||
task : it => it && it[TASK] | ||
@@ -25,0 +26,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219125
3103