@redux-saga/core
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,3 +11,3 @@ 'use strict'; | ||
var is = require('@redux-saga/is'); | ||
var __chunk_1 = require('./chunk-b4d357bd.js'); | ||
var __chunk_1 = require('./chunk-774a4f38.js'); | ||
var redux = require('redux'); | ||
@@ -347,5 +347,5 @@ var deferred = _interopDefault(require('@redux-saga/deferred')); | ||
} | ||
}, _ref.take = function take(cb, matcher$$1) { | ||
if (matcher$$1 === void 0) { | ||
matcher$$1 = wildcard; | ||
}, _ref.take = function take(cb, matcher) { | ||
if (matcher === void 0) { | ||
matcher = wildcard; | ||
} | ||
@@ -362,3 +362,3 @@ | ||
cb[symbols.MATCH] = matcher$$1; | ||
cb[symbols.MATCH] = matcher; | ||
ensureCanMutateNextTakers(); | ||
@@ -466,3 +466,3 @@ nextTakers.push(cb); | ||
function runPutEffect(env, _ref2, cb) { | ||
var channel$$1 = _ref2.channel, | ||
var channel = _ref2.channel, | ||
action = _ref2.action, | ||
@@ -480,3 +480,3 @@ resolve = _ref2.resolve; | ||
try { | ||
result = (channel$$1 ? channel$$1.put : env.dispatch)(action); | ||
result = (channel ? channel.put : env.dispatch)(action); | ||
} catch (error) { | ||
@@ -497,3 +497,3 @@ cb(error, true); | ||
var _ref3$channel = _ref3.channel, | ||
channel$$1 = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
channel = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
pattern = _ref3.pattern, | ||
@@ -517,3 +517,3 @@ maybe = _ref3.maybe; | ||
try { | ||
channel$$1.take(takeCb, is.notUndef(pattern) ? matcher(pattern) : null); | ||
channel.take(takeCb, is.notUndef(pattern) ? matcher(pattern) : null); | ||
} catch (err) { | ||
@@ -624,3 +624,3 @@ cb(err, true); | ||
cb.cancel = function () { | ||
__chunk_1.remove(taskToJoin.joiners, joiner); | ||
if (taskToJoin.isRunning()) __chunk_1.remove(taskToJoin.joiners, joiner); | ||
}; | ||
@@ -779,4 +779,4 @@ | ||
function runFlushEffect(env, channel$$1, cb) { | ||
channel$$1.flush(cb); | ||
function runFlushEffect(env, channel, cb) { | ||
channel.flush(cb); | ||
} | ||
@@ -1286,3 +1286,3 @@ | ||
var _ref$channel = _ref.channel, | ||
channel$$1 = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
channel = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
dispatch = _ref.dispatch, | ||
@@ -1367,3 +1367,3 @@ getState = _ref.getState, | ||
var env = { | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: __chunk_1.wrapSagaDispatch(dispatch), | ||
@@ -1397,3 +1397,3 @@ getState: getState, | ||
_ref2$channel = _ref2.channel, | ||
channel$$1 = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
channel = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
sagaMonitor = _ref2.sagaMonitor, | ||
@@ -1405,3 +1405,3 @@ options = _objectWithoutPropertiesLoose(_ref2, ["context", "channel", "sagaMonitor"]); | ||
{ | ||
__chunk_1.check(channel$$1, is.channel, 'options.channel passed to the Saga middleware is not a channel'); | ||
__chunk_1.check(channel, is.channel, 'options.channel passed to the Saga middleware is not a channel'); | ||
} | ||
@@ -1414,3 +1414,3 @@ | ||
context: context, | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: dispatch, | ||
@@ -1428,3 +1428,3 @@ getState: getState, | ||
channel$$1.put(action); | ||
channel.put(action); | ||
return result; | ||
@@ -1431,0 +1431,0 @@ }; |
@@ -5,5 +5,5 @@ import { CHANNEL_END_TYPE, MULTICAST, MATCH, SAGA_ACTION, CANCEL, SELF_CANCELLATION, TERMINATE, TASK, TASK_CANCEL, IO } from '@redux-saga/symbols'; | ||
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose'; | ||
import { string, array, stringableFunc, func, symbol, buffer, notUndef, promise, iterator, undef, object, channel } from '@redux-saga/is'; | ||
import { a as kTrue, b as expanding, c as check, d as none, e as once, f as remove, g as internalErr, h as TAKE, i as PUT, j as ALL, k as RACE, l as CALL, m as CPS, n as FORK, o as JOIN, p as CANCEL$1, q as SELECT, r as ACTION_CHANNEL, s as CANCELLED, t as FLUSH, u as GET_CONTEXT, v as SET_CONTEXT, w as getMetaInfo, x as noop, y as createAllStyleChildCallbacks, z as createEmptyArray, A as assignWithSymbols, B as makeIterator, C as shouldComplete, D as flatMap, E as getLocation, F as createSetContextWarning, G as asyncIteratorSymbol, H as shouldCancel, I as shouldTerminate, J as logError, K as wrapSagaDispatch, L as identity } from './chunk-e3ea3b33.js'; | ||
export { U as buffers, V as detach } from './chunk-e3ea3b33.js'; | ||
import { string as string$1, array as array$1, stringableFunc, func, symbol as symbol$1, buffer, notUndef, promise, iterator, undef, object, channel as channel$1 } from '@redux-saga/is'; | ||
import { a as kTrue, b as expanding, c as check, d as none, e as once, f as remove, g as internalErr, h as TAKE, i as PUT, j as ALL, k as RACE, l as CALL, m as CPS, n as FORK, o as JOIN, p as CANCEL$1, q as SELECT, r as ACTION_CHANNEL, s as CANCELLED$1, t as FLUSH, u as GET_CONTEXT, v as SET_CONTEXT, w as getMetaInfo, x as noop, y as createAllStyleChildCallbacks, z as createEmptyArray, A as assignWithSymbols, B as makeIterator, C as shouldComplete, D as flatMap, E as getLocation, F as createSetContextWarning, G as asyncIteratorSymbol, H as shouldCancel, I as shouldTerminate, J as logError, K as wrapSagaDispatch, L as identity } from './chunk-e922c950.js'; | ||
export { U as buffers, V as detach } from './chunk-e922c950.js'; | ||
import { compose } from 'redux'; | ||
@@ -92,3 +92,3 @@ import deferred from '@redux-saga/deferred'; | ||
var array$1 = function array$$1(patterns) { | ||
var array = function array(patterns) { | ||
return function (input) { | ||
@@ -105,3 +105,3 @@ return patterns.some(function (p) { | ||
}; | ||
var string$1 = function string$$1(pattern) { | ||
var string = function string(pattern) { | ||
return function (input) { | ||
@@ -111,3 +111,3 @@ return input.type === String(pattern); | ||
}; | ||
var symbol$1 = function symbol$$1(pattern) { | ||
var symbol = function symbol(pattern) { | ||
return function (input) { | ||
@@ -122,3 +122,3 @@ return input.type === pattern; | ||
// prettier-ignore | ||
var matcherCreator = pattern === '*' ? wildcard : string(pattern) ? string$1 : array(pattern) ? array$1 : stringableFunc(pattern) ? string$1 : func(pattern) ? predicate : symbol(pattern) ? symbol$1 : null; | ||
var matcherCreator = pattern === '*' ? wildcard : string$1(pattern) ? string : array$1(pattern) ? array : stringableFunc(pattern) ? string : func(pattern) ? predicate : symbol$1(pattern) ? symbol : null; | ||
@@ -141,5 +141,5 @@ if (matcherCreator === null) { | ||
var UNDEFINED_INPUT_ERROR = "Saga or channel was provided with an undefined action\nHints:\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"; | ||
function channel$1(buffer$$1) { | ||
if (buffer$$1 === void 0) { | ||
buffer$$1 = expanding(); | ||
function channel(buffer$1) { | ||
if (buffer$1 === void 0) { | ||
buffer$1 = expanding(); | ||
} | ||
@@ -151,3 +151,3 @@ | ||
if (process.env.NODE_ENV !== 'production') { | ||
check(buffer$$1, buffer, INVALID_BUFFER); | ||
check(buffer$1, buffer, INVALID_BUFFER); | ||
} | ||
@@ -160,3 +160,3 @@ | ||
if (takers.length && !buffer$$1.isEmpty()) { | ||
if (takers.length && !buffer$1.isEmpty()) { | ||
throw internalErr('Cannot have pending takers with non empty buffer'); | ||
@@ -177,3 +177,3 @@ } | ||
if (takers.length === 0) { | ||
return buffer$$1.put(input); | ||
return buffer$1.put(input); | ||
} | ||
@@ -191,6 +191,6 @@ | ||
if (closed && buffer$$1.isEmpty()) { | ||
if (closed && buffer$1.isEmpty()) { | ||
cb(END); | ||
} else if (!buffer$$1.isEmpty()) { | ||
cb(buffer$$1.take()); | ||
} else if (!buffer$1.isEmpty()) { | ||
cb(buffer$1.take()); | ||
} else { | ||
@@ -211,3 +211,3 @@ takers.push(cb); | ||
if (closed && buffer$$1.isEmpty()) { | ||
if (closed && buffer$1.isEmpty()) { | ||
cb(END); | ||
@@ -217,3 +217,3 @@ return; | ||
cb(buffer$$1.flush()); | ||
cb(buffer$1.flush()); | ||
} | ||
@@ -247,5 +247,5 @@ | ||
} | ||
function eventChannel(subscribe, buffer$$1) { | ||
if (buffer$$1 === void 0) { | ||
buffer$$1 = none(); | ||
function eventChannel(subscribe, buffer) { | ||
if (buffer === void 0) { | ||
buffer = none(); | ||
} | ||
@@ -255,3 +255,3 @@ | ||
var unsubscribe; | ||
var chan = channel$1(buffer$$1); | ||
var chan = channel(buffer); | ||
@@ -356,5 +356,5 @@ var close = function close() { | ||
} | ||
}, _ref.take = function take(cb, matcher$$1) { | ||
if (matcher$$1 === void 0) { | ||
matcher$$1 = wildcard; | ||
}, _ref.take = function take(cb, matcher) { | ||
if (matcher === void 0) { | ||
matcher = wildcard; | ||
} | ||
@@ -371,3 +371,3 @@ | ||
cb[MATCH] = matcher$$1; | ||
cb[MATCH] = matcher; | ||
ensureCanMutateNextTakers(); | ||
@@ -400,8 +400,8 @@ nextTakers.push(cb); | ||
var RUNNING = 0; | ||
var CANCELLED$1 = 1; | ||
var CANCELLED = 1; | ||
var ABORTED = 2; | ||
var DONE = 3; | ||
function resolvePromise(promise$$1, cb) { | ||
var cancelPromise = promise$$1[CANCEL]; | ||
function resolvePromise(promise, cb) { | ||
var cancelPromise = promise[CANCEL]; | ||
@@ -412,3 +412,3 @@ if (func(cancelPromise)) { | ||
promise$$1.then(cb, function (error) { | ||
promise.then(cb, function (error) { | ||
cb(error, true); | ||
@@ -425,6 +425,6 @@ }); | ||
function getIteratorMetaInfo(iterator$$1, fn) { | ||
if (iterator$$1.isSagaIterator) { | ||
function getIteratorMetaInfo(iterator, fn) { | ||
if (iterator.isSagaIterator) { | ||
return { | ||
name: iterator$$1.meta.name | ||
name: iterator.meta.name | ||
}; | ||
@@ -478,3 +478,3 @@ } | ||
function runPutEffect(env, _ref2, cb) { | ||
var channel$$1 = _ref2.channel, | ||
var channel = _ref2.channel, | ||
action = _ref2.action, | ||
@@ -492,3 +492,3 @@ resolve = _ref2.resolve; | ||
try { | ||
result = (channel$$1 ? channel$$1.put : env.dispatch)(action); | ||
result = (channel ? channel.put : env.dispatch)(action); | ||
} catch (error) { | ||
@@ -509,3 +509,3 @@ cb(error, true); | ||
var _ref3$channel = _ref3.channel, | ||
channel$$1 = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
channel = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
pattern = _ref3.pattern, | ||
@@ -529,3 +529,3 @@ maybe = _ref3.maybe; | ||
try { | ||
channel$$1.take(takeCb, notUndef(pattern) ? matcher(pattern) : null); | ||
channel.take(takeCb, notUndef(pattern) ? matcher(pattern) : null); | ||
} catch (err) { | ||
@@ -636,3 +636,3 @@ cb(err, true); | ||
cb.cancel = function () { | ||
remove(taskToJoin.joiners, joiner); | ||
if (taskToJoin.isRunning()) remove(taskToJoin.joiners, joiner); | ||
}; | ||
@@ -650,3 +650,3 @@ | ||
if (array(taskOrTasks)) { | ||
if (array$1(taskOrTasks)) { | ||
if (taskOrTasks.length === 0) { | ||
@@ -677,3 +677,3 @@ cb([]); | ||
cancelSingleTask(task); | ||
} else if (array(taskOrTasks)) { | ||
} else if (array$1(taskOrTasks)) { | ||
taskOrTasks.forEach(cancelSingleTask); | ||
@@ -693,3 +693,3 @@ } else { | ||
if (keys.length === 0) { | ||
cb(array(effects) ? [] : {}); | ||
cb(array$1(effects) ? [] : {}); | ||
return; | ||
@@ -708,3 +708,3 @@ } | ||
var keys = Object.keys(effects); | ||
var response = array(effects) ? createEmptyArray(keys.length) : {}; | ||
var response = array$1(effects) ? createEmptyArray(keys.length) : {}; | ||
var childCbs = {}; | ||
@@ -767,4 +767,4 @@ var completed = false; | ||
var pattern = _ref14.pattern, | ||
buffer$$1 = _ref14.buffer; | ||
var chan = channel$1(buffer$$1); | ||
buffer = _ref14.buffer; | ||
var chan = channel(buffer); | ||
var match = matcher(pattern); | ||
@@ -796,4 +796,4 @@ | ||
function runFlushEffect(env, channel$$1, cb) { | ||
channel$$1.flush(cb); | ||
function runFlushEffect(env, channel, cb) { | ||
channel.flush(cb); | ||
} | ||
@@ -812,3 +812,3 @@ | ||
var effectRunnerMap = (_effectRunnerMap = {}, _effectRunnerMap[TAKE] = runTakeEffect, _effectRunnerMap[PUT] = runPutEffect, _effectRunnerMap[ALL] = runAllEffect, _effectRunnerMap[RACE] = runRaceEffect, _effectRunnerMap[CALL] = runCallEffect, _effectRunnerMap[CPS] = runCPSEffect, _effectRunnerMap[FORK] = runForkEffect, _effectRunnerMap[JOIN] = runJoinEffect, _effectRunnerMap[CANCEL$1] = runCancelEffect, _effectRunnerMap[SELECT] = runSelectEffect, _effectRunnerMap[ACTION_CHANNEL] = runChannelEffect, _effectRunnerMap[CANCELLED] = runCancelledEffect, _effectRunnerMap[FLUSH] = runFlushEffect, _effectRunnerMap[GET_CONTEXT] = runGetContextEffect, _effectRunnerMap[SET_CONTEXT] = runSetContextEffect, _effectRunnerMap); | ||
var effectRunnerMap = (_effectRunnerMap = {}, _effectRunnerMap[TAKE] = runTakeEffect, _effectRunnerMap[PUT] = runPutEffect, _effectRunnerMap[ALL] = runAllEffect, _effectRunnerMap[RACE] = runRaceEffect, _effectRunnerMap[CALL] = runCallEffect, _effectRunnerMap[CPS] = runCPSEffect, _effectRunnerMap[FORK] = runForkEffect, _effectRunnerMap[JOIN] = runJoinEffect, _effectRunnerMap[CANCEL$1] = runCancelEffect, _effectRunnerMap[SELECT] = runSelectEffect, _effectRunnerMap[ACTION_CHANNEL] = runChannelEffect, _effectRunnerMap[CANCELLED$1] = runCancelledEffect, _effectRunnerMap[FLUSH] = runFlushEffect, _effectRunnerMap[GET_CONTEXT] = runGetContextEffect, _effectRunnerMap[SET_CONTEXT] = runSetContextEffect, _effectRunnerMap); | ||
@@ -999,3 +999,3 @@ /** | ||
// effects in the iterator's finally block will still be executed | ||
status = CANCELLED$1; | ||
status = CANCELLED; | ||
queue.cancelAll(); // Ending with a TASK_CANCEL will propagate the Cancellation to all joiners | ||
@@ -1012,4 +1012,4 @@ | ||
if (result === TASK_CANCEL) { | ||
status = CANCELLED$1; | ||
} else if (status !== CANCELLED$1) { | ||
status = CANCELLED; | ||
} else if (status !== CANCELLED) { | ||
status = DONE; | ||
@@ -1075,3 +1075,3 @@ } | ||
}, _task.isCancelled = function isCancelled() { | ||
return status === CANCELLED$1 || status === RUNNING && mainTask.status === CANCELLED$1; | ||
return status === CANCELLED || status === RUNNING && mainTask.status === CANCELLED; | ||
}, _task.isAborted = function isAborted() { | ||
@@ -1087,4 +1087,4 @@ return status === ABORTED; | ||
function proc(env, iterator$$1, parentContext, parentEffectId, meta, isRoot, cont) { | ||
if (process.env.NODE_ENV !== 'production' && iterator$$1[asyncIteratorSymbol]) { | ||
function proc(env, iterator$1, parentContext, parentEffectId, meta, isRoot, cont) { | ||
if (process.env.NODE_ENV !== 'production' && iterator$1[asyncIteratorSymbol]) { | ||
throw new Error("redux-saga doesn't support async generators, please use only regular ones"); | ||
@@ -1125,3 +1125,3 @@ } | ||
if (mainTask.status === RUNNING) { | ||
mainTask.status = CANCELLED$1; | ||
mainTask.status = CANCELLED; | ||
next(TASK_CANCEL); | ||
@@ -1156,3 +1156,3 @@ } | ||
if (isErr) { | ||
result = iterator$$1.throw(arg); // user handled the error, we can clear bookkept values | ||
result = iterator$1.throw(arg); // user handled the error, we can clear bookkept values | ||
@@ -1167,3 +1167,3 @@ clear(); | ||
**/ | ||
mainTask.status = CANCELLED$1; | ||
mainTask.status = CANCELLED; | ||
/** | ||
@@ -1179,3 +1179,3 @@ Cancels the current effect; this will propagate the cancellation down to any called tasks | ||
result = func(iterator$$1.return) ? iterator$$1.return(TASK_CANCEL) : { | ||
result = func(iterator$1.return) ? iterator$1.return(TASK_CANCEL) : { | ||
done: true, | ||
@@ -1186,7 +1186,7 @@ value: TASK_CANCEL | ||
// We get TERMINATE flag, i.e. by taking from a channel that ended using `take` (and not `takem` used to trap End of channels) | ||
result = func(iterator$$1.return) ? iterator$$1.return() : { | ||
result = func(iterator$1.return) ? iterator$1.return() : { | ||
done: true | ||
}; | ||
} else { | ||
result = iterator$$1.next(arg); | ||
result = iterator$1.next(arg); | ||
} | ||
@@ -1200,3 +1200,3 @@ | ||
**/ | ||
if (mainTask.status !== CANCELLED$1) { | ||
if (mainTask.status !== CANCELLED) { | ||
mainTask.status = DONE; | ||
@@ -1208,3 +1208,3 @@ } | ||
} catch (error) { | ||
if (mainTask.status === CANCELLED$1) { | ||
if (mainTask.status === CANCELLED) { | ||
throw error; | ||
@@ -1315,3 +1315,3 @@ } | ||
var _ref$channel = _ref.channel, | ||
channel$$1 = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
channel = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
dispatch = _ref.dispatch, | ||
@@ -1334,6 +1334,6 @@ getState = _ref.getState, | ||
var iterator$$1 = saga.apply(void 0, args); | ||
var iterator$1 = saga.apply(void 0, args); | ||
if (process.env.NODE_ENV !== 'production') { | ||
check(iterator$$1, iterator, NON_GENERATOR_ERR); | ||
check(iterator$1, iterator, NON_GENERATOR_ERR); | ||
} | ||
@@ -1369,3 +1369,3 @@ | ||
var MIDDLEWARE_TYPE_ERROR = 'effectMiddlewares must be an array of functions'; | ||
check(effectMiddlewares, array, MIDDLEWARE_TYPE_ERROR); | ||
check(effectMiddlewares, array$1, MIDDLEWARE_TYPE_ERROR); | ||
effectMiddlewares.forEach(function (effectMiddleware) { | ||
@@ -1398,3 +1398,3 @@ return check(effectMiddleware, func, MIDDLEWARE_TYPE_ERROR); | ||
var env = { | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: wrapSagaDispatch(dispatch), | ||
@@ -1407,3 +1407,3 @@ getState: getState, | ||
return immediately(function () { | ||
var task = proc(env, iterator$$1, context, effectId, getMetaInfo(saga), | ||
var task = proc(env, iterator$1, context, effectId, getMetaInfo(saga), | ||
/* isRoot */ | ||
@@ -1429,3 +1429,3 @@ true, noop); | ||
_ref2$channel = _ref2.channel, | ||
channel$$1 = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
channel = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
sagaMonitor = _ref2.sagaMonitor, | ||
@@ -1437,3 +1437,3 @@ options = _objectWithoutPropertiesLoose(_ref2, ["context", "channel", "sagaMonitor"]); | ||
if (process.env.NODE_ENV !== 'production') { | ||
check(channel$$1, channel, 'options.channel passed to the Saga middleware is not a channel'); | ||
check(channel, channel$1, 'options.channel passed to the Saga middleware is not a channel'); | ||
} | ||
@@ -1446,3 +1446,3 @@ | ||
context: context, | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: dispatch, | ||
@@ -1460,3 +1460,3 @@ getState: getState, | ||
channel$$1.put(action); | ||
channel.put(action); | ||
return result; | ||
@@ -1487,2 +1487,2 @@ }; | ||
export default sagaMiddlewareFactory; | ||
export { runSaga, END, isEnd, eventChannel, channel$1 as channel, multicastChannel, stdChannel }; | ||
export { runSaga, END, isEnd, eventChannel, channel, multicastChannel, stdChannel }; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var is = require('@redux-saga/is'); | ||
var __chunk_1 = require('./chunk-affbe8eb.js'); | ||
var __chunk_1 = require('./chunk-2fd513a6.js'); | ||
var redux = require('redux'); | ||
@@ -298,5 +298,5 @@ var deferred = _interopDefault(require('@redux-saga/deferred')); | ||
} | ||
}, _ref.take = function take(cb, matcher$$1) { | ||
if (matcher$$1 === void 0) { | ||
matcher$$1 = wildcard; | ||
}, _ref.take = function take(cb, matcher) { | ||
if (matcher === void 0) { | ||
matcher = wildcard; | ||
} | ||
@@ -309,3 +309,3 @@ | ||
cb[symbols.MATCH] = matcher$$1; | ||
cb[symbols.MATCH] = matcher; | ||
ensureCanMutateNextTakers(); | ||
@@ -413,3 +413,3 @@ nextTakers.push(cb); | ||
function runPutEffect(env, _ref2, cb) { | ||
var channel$$1 = _ref2.channel, | ||
var channel = _ref2.channel, | ||
action = _ref2.action, | ||
@@ -427,3 +427,3 @@ resolve = _ref2.resolve; | ||
try { | ||
result = (channel$$1 ? channel$$1.put : env.dispatch)(action); | ||
result = (channel ? channel.put : env.dispatch)(action); | ||
} catch (error) { | ||
@@ -444,3 +444,3 @@ cb(error, true); | ||
var _ref3$channel = _ref3.channel, | ||
channel$$1 = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
channel = _ref3$channel === void 0 ? env.channel : _ref3$channel, | ||
pattern = _ref3.pattern, | ||
@@ -464,3 +464,3 @@ maybe = _ref3.maybe; | ||
try { | ||
channel$$1.take(takeCb, is.notUndef(pattern) ? matcher(pattern) : null); | ||
channel.take(takeCb, is.notUndef(pattern) ? matcher(pattern) : null); | ||
} catch (err) { | ||
@@ -571,3 +571,3 @@ cb(err, true); | ||
cb.cancel = function () { | ||
__chunk_1.remove(taskToJoin.joiners, joiner); | ||
if (taskToJoin.isRunning()) __chunk_1.remove(taskToJoin.joiners, joiner); | ||
}; | ||
@@ -726,4 +726,4 @@ | ||
function runFlushEffect(env, channel$$1, cb) { | ||
channel$$1.flush(cb); | ||
function runFlushEffect(env, channel, cb) { | ||
channel.flush(cb); | ||
} | ||
@@ -1225,3 +1225,3 @@ | ||
var _ref$channel = _ref.channel, | ||
channel$$1 = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
channel = _ref$channel === void 0 ? stdChannel() : _ref$channel, | ||
dispatch = _ref.dispatch, | ||
@@ -1278,3 +1278,3 @@ getState = _ref.getState, | ||
var env = { | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: __chunk_1.wrapSagaDispatch(dispatch), | ||
@@ -1308,3 +1308,3 @@ getState: getState, | ||
_ref2$channel = _ref2.channel, | ||
channel$$1 = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
channel = _ref2$channel === void 0 ? stdChannel() : _ref2$channel, | ||
sagaMonitor = _ref2.sagaMonitor, | ||
@@ -1320,3 +1320,3 @@ options = _objectWithoutPropertiesLoose(_ref2, ["context", "channel", "sagaMonitor"]); | ||
context: context, | ||
channel: channel$$1, | ||
channel: channel, | ||
dispatch: dispatch, | ||
@@ -1334,3 +1334,3 @@ getState: getState, | ||
channel$$1.put(action); | ||
channel.put(action); | ||
return result; | ||
@@ -1337,0 +1337,0 @@ }; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var is = require('@redux-saga/is'); | ||
var __chunk_1 = require('./chunk-b4d357bd.js'); | ||
var __chunk_1 = require('./chunk-774a4f38.js'); | ||
require('@redux-saga/delay-p'); | ||
@@ -11,0 +11,0 @@ |
import '@redux-saga/symbols'; | ||
import '@babel/runtime/helpers/esm/extends'; | ||
import { channel, stringableFunc, func, notUndef } from '@redux-saga/is'; | ||
import { B as makeIterator, M as take, N as fork, O as cancel, P as call, Q as actionChannel, R as sliding, S as delay, T as race, c as check } from './chunk-e3ea3b33.js'; | ||
export { W as effectTypes, M as take, X as takeMaybe, Y as put, Z as putResolve, _ as all, T as race, P as call, $ as apply, a0 as cps, N as fork, a1 as spawn, a2 as join, O as cancel, a3 as select, Q as actionChannel, a4 as cancelled, a5 as flush, a6 as getContext, a7 as setContext, S as delay } from './chunk-e3ea3b33.js'; | ||
import { B as makeIterator, M as take, N as fork, O as cancel, P as call, Q as actionChannel, R as sliding, S as delay, T as race, c as check } from './chunk-e922c950.js'; | ||
export { W as effectTypes, M as take, X as takeMaybe, Y as put, Z as putResolve, _ as all, T as race, P as call, $ as apply, a0 as cps, N as fork, a1 as spawn, a2 as join, O as cancel, a3 as select, Q as actionChannel, a4 as cancelled, a5 as flush, a6 as getContext, a7 as setContext, S as delay } from './chunk-e922c950.js'; | ||
import '@redux-saga/delay-p'; | ||
@@ -207,3 +207,3 @@ | ||
var action, channel$$1; | ||
var action, channel; | ||
var yActionChannel = { | ||
@@ -217,3 +217,3 @@ done: false, | ||
done: false, | ||
value: take(channel$$1) | ||
value: take(channel) | ||
}; | ||
@@ -239,3 +239,3 @@ }; | ||
var setChannel = function setChannel(ch) { | ||
return channel$$1 = ch; | ||
return channel = ch; | ||
}; | ||
@@ -242,0 +242,0 @@ |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var is = require('@redux-saga/is'); | ||
var __chunk_1 = require('./chunk-affbe8eb.js'); | ||
var __chunk_1 = require('./chunk-2fd513a6.js'); | ||
require('@redux-saga/delay-p'); | ||
@@ -11,0 +11,0 @@ |
import { Action, AnyAction } from 'redux' | ||
import {Last, Reverse} from 'typescript-tuple' | ||
import { Last, Reverse } from 'typescript-tuple' | ||
@@ -16,2 +16,3 @@ import { | ||
StrictEffect, | ||
ActionMatchingPattern, | ||
} from '@redux-saga/types' | ||
@@ -76,2 +77,3 @@ | ||
*/ | ||
export function take(pattern?: ActionPattern): TakeEffect | ||
export function take<A extends Action>(pattern?: ActionPattern<A>): TakeEffect | ||
@@ -97,2 +99,3 @@ | ||
*/ | ||
export function takeMaybe(pattern?: ActionPattern): TakeEffect | ||
export function takeMaybe<A extends Action>(pattern?: ActionPattern<A>): TakeEffect | ||
@@ -179,2 +182,11 @@ | ||
*/ | ||
export function takeEvery<P extends ActionPattern>( | ||
pattern: P, | ||
worker: (action: ActionMatchingPattern<P>) => any, | ||
): ForkEffect | ||
export function takeEvery<P extends ActionPattern, Fn extends (...args: any[]) => any>( | ||
pattern: P, | ||
worker: Fn, | ||
...args: HelperWorkerParameters<ActionMatchingPattern<P>, Fn> | ||
): ForkEffect | ||
export function takeEvery<A extends Action>(pattern: ActionPattern<A>, worker: (action: A) => any): ForkEffect | ||
@@ -184,3 +196,3 @@ export function takeEvery<A extends Action, Fn extends (...args: any[]) => any>( | ||
worker: Fn, | ||
...args: AllButLast<Parameters<Fn>> | ||
...args: HelperWorkerParameters<A, Fn> | ||
): ForkEffect | ||
@@ -250,2 +262,11 @@ | ||
*/ | ||
export function takeLatest<P extends ActionPattern>( | ||
pattern: P, | ||
worker: (action: ActionMatchingPattern<P>) => any, | ||
): ForkEffect | ||
export function takeLatest<P extends ActionPattern, Fn extends (...args: any[]) => any>( | ||
pattern: P, | ||
worker: Fn, | ||
...args: HelperWorkerParameters<ActionMatchingPattern<P>, Fn> | ||
): ForkEffect | ||
export function takeLatest<A extends Action>(pattern: ActionPattern<A>, worker: (action: A) => any): ForkEffect | ||
@@ -314,2 +335,11 @@ export function takeLatest<A extends Action, Fn extends (...args: any[]) => any>( | ||
*/ | ||
export function takeLeading<P extends ActionPattern>( | ||
pattern: P, | ||
worker: (action: ActionMatchingPattern<P>) => any, | ||
): ForkEffect | ||
export function takeLeading<P extends ActionPattern, Fn extends (...args: any[]) => any>( | ||
pattern: P, | ||
worker: Fn, | ||
...args: HelperWorkerParameters<ActionMatchingPattern<P>, Fn> | ||
): ForkEffect | ||
export function takeLeading<A extends Action>(pattern: ActionPattern<A>, worker: (action: A) => any): ForkEffect | ||
@@ -532,5 +562,3 @@ export function takeLeading<A extends Action, Fn extends (...args: any[]) => any>( | ||
export type CpsFunctionParameters<Fn extends (...args: any[]) => any> = Last< | ||
Parameters<Fn> | ||
> extends CpsCallback<any> | ||
export type CpsFunctionParameters<Fn extends (...args: any[]) => any> = Last<Parameters<Fn>> extends CpsCallback<any> | ||
? AllButLast<Parameters<Fn>> | ||
@@ -1062,2 +1090,13 @@ : never | ||
*/ | ||
export function throttle<P extends ActionPattern>( | ||
ms: number, | ||
pattern: P, | ||
worker: (action: ActionMatchingPattern<P>) => any, | ||
): ForkEffect | ||
export function throttle<P extends ActionPattern, Fn extends (...args: any[]) => any>( | ||
ms: number, | ||
pattern: P, | ||
worker: Fn, | ||
...args: HelperWorkerParameters<ActionMatchingPattern<P>, Fn> | ||
): ForkEffect | ||
export function throttle<A extends Action>( | ||
@@ -1143,2 +1182,13 @@ ms: number, | ||
*/ | ||
export function debounce<P extends ActionPattern>( | ||
ms: number, | ||
pattern: P, | ||
worker: (action: ActionMatchingPattern<P>) => any, | ||
): ForkEffect | ||
export function debounce<P extends ActionPattern, Fn extends (...args: any[]) => any>( | ||
ms: number, | ||
pattern: P, | ||
worker: Fn, | ||
...args: HelperWorkerParameters<ActionMatchingPattern<P>, Fn> | ||
): ForkEffect | ||
export function debounce<A extends Action>( | ||
@@ -1290,8 +1340,8 @@ ms: number, | ||
/** | ||
* [H, ...T] -> T | ||
*/ | ||
* [H, ...T] -> T | ||
*/ | ||
export type Tail<L extends any[]> = ((...l: L) => any) extends ((h: any, ...t: infer T) => any) ? T : never | ||
/** | ||
* [...A, B] -> A | ||
*/ | ||
export type AllButLast<L extends any[]> = Reverse<Tail<Reverse<L>>> | ||
* [...A, B] -> A | ||
*/ | ||
export type AllButLast<L extends any[]> = Reverse<Tail<Reverse<L>>> |
{ | ||
"name": "@redux-saga/core", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Saga middleware for Redux to handle Side Effects", | ||
@@ -48,5 +48,5 @@ "main": "./dist/redux-saga-core.cjs.js", | ||
"@redux-saga/delay-p": "^1.0.1", | ||
"@redux-saga/is": "^1.0.1", | ||
"@redux-saga/is": "^1.0.2", | ||
"@redux-saga/symbols": "^1.0.1", | ||
"@redux-saga/types": "^1.0.0", | ||
"@redux-saga/types": "^1.0.2", | ||
"redux": ">=0.10 <5", | ||
@@ -77,3 +77,3 @@ "typescript-tuple": "^2.1.0" | ||
"typings": "./index.d.ts", | ||
"gitHead": "876ac7bb9d049e9a0c9526b4396b3fd0364d3181" | ||
"gitHead": "0668e9149c8aa847cbfad9f03883b6b5b2946042" | ||
} |
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
260905
8043
Updated@redux-saga/is@^1.0.2
Updated@redux-saga/types@^1.0.2