redux-saga
Advanced tools
Comparing version 0.9.2 to 0.9.3
@@ -559,2 +559,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var name = arguments.length <= 6 || arguments[6] === undefined ? 'anonymous' : arguments[6]; | ||
var forked = arguments[7]; | ||
@@ -597,3 +598,3 @@ (0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
**/ | ||
var task = newTask(parentEffectId, name, iterator, deferredEnd.promise); | ||
var task = newTask(parentEffectId, name, iterator, deferredEnd.promise, forked); | ||
@@ -647,3 +648,5 @@ /** | ||
} else { | ||
throw error; | ||
console.error(name + ': uncaught', error); | ||
//if(!forked) | ||
// throw error | ||
} | ||
@@ -786,3 +789,9 @@ } | ||
var result = fn.apply(context, args); | ||
var result = undefined; | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args); | ||
} catch (error) { | ||
return cb(error); | ||
} | ||
return _utils.is.promise(result) ? resolvePromise(result, cb) : _utils.is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb) : cb(null, result); | ||
@@ -798,3 +807,9 @@ } | ||
// by setting cancel field on the cb | ||
fn.apply(context, args.concat(cb)); | ||
// catch synchronous failures; see #152 | ||
try { | ||
fn.apply(context, args.concat(cb)); | ||
} catch (error) { | ||
return cb(error); | ||
} | ||
} | ||
@@ -808,2 +823,3 @@ | ||
var result = undefined, | ||
error = undefined, | ||
_iterator = undefined; | ||
@@ -813,4 +829,10 @@ | ||
// (generator is a function that returns an iterator) | ||
result = fn.apply(context, args); | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args); | ||
} catch (err) { | ||
error = error; | ||
} | ||
// A generator function: i.e. returns an iterator | ||
@@ -822,4 +844,5 @@ if (_utils.is.iterator(result)) { | ||
//simple effect: wrap in a generator | ||
// do not bubble up synchronous failures, instead create a failed task. See #152 | ||
else { | ||
_iterator = regeneratorRuntime.mark(function _callee() { | ||
_iterator = (error ? regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -829,15 +852,28 @@ while (1) { | ||
case 0: | ||
_context.next = 2; | ||
throw error; | ||
case 1: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
}) : regeneratorRuntime.mark(function _callee2() { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return result; | ||
case 2: | ||
return _context.abrupt('return', _context.sent); | ||
return _context2.abrupt('return', _context2.sent); | ||
case 3: | ||
case 'end': | ||
return _context.stop(); | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})(); | ||
}, _callee2, this); | ||
}))(); | ||
} | ||
@@ -994,5 +1030,5 @@ | ||
return iterator._isRunning; | ||
}), _defineProperty(_ref6, 'getResult', function getResult() { | ||
}), _defineProperty(_ref6, 'result', function result() { | ||
return iterator._result; | ||
}), _defineProperty(_ref6, 'getError', function getError() { | ||
}), _defineProperty(_ref6, 'error', function error() { | ||
return iterator._error; | ||
@@ -999,0 +1035,0 @@ }), _ref6; |
@@ -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 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}}])}); | ||
!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:E.is.array(e)?x.array:E.is.func(e)?x.predicate:x.default)(e)}function a(e){if(arguments.length>0&&E.is.undef(e))throw new Error(_);return j(C,E.is.undef(e)?"*":e)}function o(e){return j(b,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 a=e;t=a.context,e=a.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(!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=E.ident:(0,E.check)(e,E.is.func,R),j(I,{selector:e,args:t})}var m=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 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=(0,E.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 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)}}},P=function(e){return e[E.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){t(u,!0),u instanceof v.default?c.isDev&&console.warn(M+": uncaught",u):console.error(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,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[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,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)}};G.push(t),n.cancel=function(){return(0,c.remove)(G,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=void 0;try{i=a.apply(r,o)}catch(f){return t(f)}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;try{r.apply(t,u.concat(n))}catch(a){return n(a)}}function C(e,n,t){var r=e.context,u=e.fn,a=e.args,o=void 0,f=void 0,s=void 0;try{o=u.apply(r,a)}catch(l){f=f}s=c.is.iterator(o)?o:(f?regeneratorRuntime.mark(function d(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw f;case 1:case"end":return e.stop()}},d,this)}):regeneratorRuntime.mark(function v(){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()}},v,this)}))(),t(null,i(s,S,I,j,x,n,u.name,!0))}function b(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(){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(E,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[m](e)}),o(a,"isRunning",function(){return t._isRunning}),o(a,"result",function(){return t._result}),o(a,"error",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],U=arguments[7];(0,c.check)(e,c.is.iterator,g);var D=p(M),G=[],F=(0,c.deferred)(),K=S(function(e){if(void 0===e)throw D;for(var n=0;n<G.length;n++){var t=G[n];t.match(e)&&(G=[],t.resolve(e))}});n.cancel=c.noop;var J=N(P,M,e,F.promise,U);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=(0,c.sym)("@@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,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}}])}); |
@@ -50,2 +50,3 @@ 'use strict'; | ||
var name = arguments.length <= 6 || arguments[6] === undefined ? 'anonymous' : arguments[6]; | ||
var forked = arguments[7]; | ||
@@ -88,3 +89,3 @@ (0, _utils.check)(iterator, _utils.is.iterator, NOT_ITERATOR_ERROR); | ||
**/ | ||
var task = newTask(parentEffectId, name, iterator, deferredEnd.promise); | ||
var task = newTask(parentEffectId, name, iterator, deferredEnd.promise, forked); | ||
@@ -138,3 +139,5 @@ /** | ||
} else { | ||
throw error; | ||
console.error(name + ': uncaught', error); | ||
//if(!forked) | ||
// throw error | ||
} | ||
@@ -277,3 +280,9 @@ } | ||
var result = fn.apply(context, args); | ||
var result = undefined; | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args); | ||
} catch (error) { | ||
return cb(error); | ||
} | ||
return _utils.is.promise(result) ? resolvePromise(result, cb) : _utils.is.iterator(result) ? resolveIterator(result, effectId, fn.name, cb) : cb(null, result); | ||
@@ -289,3 +298,9 @@ } | ||
// by setting cancel field on the cb | ||
fn.apply(context, args.concat(cb)); | ||
// catch synchronous failures; see #152 | ||
try { | ||
fn.apply(context, args.concat(cb)); | ||
} catch (error) { | ||
return cb(error); | ||
} | ||
} | ||
@@ -299,2 +314,3 @@ | ||
var result = undefined, | ||
error = undefined, | ||
_iterator = undefined; | ||
@@ -304,4 +320,10 @@ | ||
// (generator is a function that returns an iterator) | ||
result = fn.apply(context, args); | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args); | ||
} catch (err) { | ||
error = error; | ||
} | ||
// A generator function: i.e. returns an iterator | ||
@@ -313,4 +335,5 @@ if (_utils.is.iterator(result)) { | ||
//simple effect: wrap in a generator | ||
// do not bubble up synchronous failures, instead create a failed task. See #152 | ||
else { | ||
_iterator = regeneratorRuntime.mark(function _callee() { | ||
_iterator = (error ? regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -320,15 +343,28 @@ while (1) { | ||
case 0: | ||
_context.next = 2; | ||
throw error; | ||
case 1: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
}) : regeneratorRuntime.mark(function _callee2() { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return result; | ||
case 2: | ||
return _context.abrupt('return', _context.sent); | ||
return _context2.abrupt('return', _context2.sent); | ||
case 3: | ||
case 'end': | ||
return _context.stop(); | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})(); | ||
}, _callee2, this); | ||
}))(); | ||
} | ||
@@ -485,5 +521,5 @@ | ||
return iterator._isRunning; | ||
}), _defineProperty(_ref6, 'getResult', function getResult() { | ||
}), _defineProperty(_ref6, 'result', function result() { | ||
return iterator._result; | ||
}), _defineProperty(_ref6, 'getError', function getError() { | ||
}), _defineProperty(_ref6, 'error', function error() { | ||
return iterator._error; | ||
@@ -490,0 +526,0 @@ }), _ref6; |
{ | ||
"name": "redux-saga", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Saga middleware for Redux to handle Side Effects", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -29,3 +29,4 @@ import { sym, noop, is, isDev, check, remove, deferred, autoInc, asap, TASK } from './utils' | ||
parentEffectId = 0, | ||
name = 'anonymous' | ||
name = 'anonymous', | ||
forked | ||
) { | ||
@@ -72,3 +73,3 @@ | ||
const task = newTask( | ||
parentEffectId, name, iterator, deferredEnd.promise | ||
parentEffectId, name, iterator, deferredEnd.promise, forked | ||
) | ||
@@ -107,2 +108,3 @@ | ||
try { | ||
@@ -125,3 +127,5 @@ // calling iterator.throw on a generator that doesnt defined a correponding try/Catch | ||
} else { | ||
throw error | ||
console.error(`${name}: uncaught`, error ) | ||
//if(!forked) | ||
// throw error | ||
} | ||
@@ -271,3 +275,9 @@ } | ||
function runCallEffect({context, fn, args}, effectId, cb) { | ||
const result = fn.apply(context, args) | ||
let result | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args) | ||
} catch(error) { | ||
return cb(error) | ||
} | ||
return ( | ||
@@ -283,12 +293,24 @@ is.promise(result) ? resolvePromise(result, cb) | ||
// by setting cancel field on the cb | ||
fn.apply(context, args.concat(cb)) | ||
// catch synchronous failures; see #152 | ||
try { | ||
fn.apply(context, args.concat(cb)) | ||
} catch(error) { | ||
return cb(error) | ||
} | ||
} | ||
function runForkEffect({context, fn, args}, effectId, cb) { | ||
let result, _iterator | ||
let result, error, _iterator | ||
// we run the function, next we'll check if this is a generator function | ||
// (generator is a function that returns an iterator) | ||
result = fn.apply(context, args) | ||
// catch synchronous failures; see #152 | ||
try { | ||
result = fn.apply(context, args) | ||
} catch(err) { | ||
error = error | ||
} | ||
// A generator function: i.e. returns an iterator | ||
@@ -300,6 +322,8 @@ if( is.iterator(result) ) { | ||
//simple effect: wrap in a generator | ||
// do not bubble up synchronous failures, instead create a failed task. See #152 | ||
else { | ||
_iterator = function*() { | ||
return (yield result) | ||
}() | ||
_iterator = (error ? | ||
function*() { throw error } | ||
: function*() { return (yield result) } | ||
)() | ||
} | ||
@@ -456,4 +480,4 @@ | ||
isRunning: () => iterator._isRunning, | ||
getResult: () => iterator._result, | ||
getError: () => iterator._error | ||
result: () => iterator._result, | ||
error: () => iterator._error | ||
} | ||
@@ -460,0 +484,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
222017
3190