New source found from dndbeyond.com
This commit is contained in:
Generated
Vendored
+29
-270
@@ -1,41 +1,20 @@
|
||||
import { TASK_CANCEL, TERMINATE, SAGA_LOCATION, SAGA_ACTION, IO, SELF_CANCELLATION } from '@redux-saga/symbols';
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import { array, notUndef, pattern, multicast, channel, undef, effect, task, func, buffer, string, object } from '@redux-saga/is';
|
||||
import delayP from '@redux-saga/delay-p';
|
||||
import * as is from '@redux-saga/is';
|
||||
import { TERMINATE, TASK_CANCEL, SAGA_LOCATION, SAGA_ACTION, IO, SELF_CANCELLATION } from '@redux-saga/symbols';
|
||||
|
||||
var konst = function konst(v) {
|
||||
return function () {
|
||||
return v;
|
||||
};
|
||||
};
|
||||
var kTrue =
|
||||
/*#__PURE__*/
|
||||
konst(true);
|
||||
|
||||
var kTrue = /*#__PURE__*/konst(true);
|
||||
var noop = function noop() {};
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && typeof Proxy !== 'undefined') {
|
||||
noop =
|
||||
/*#__PURE__*/
|
||||
new Proxy(noop, {
|
||||
set: function set() {
|
||||
throw internalErr('There was an attempt to assign a property to internal `noop` function.');
|
||||
}
|
||||
});
|
||||
}
|
||||
var identity = function identity(v) {
|
||||
return v;
|
||||
};
|
||||
var hasSymbol = typeof Symbol === 'function';
|
||||
var asyncIteratorSymbol = hasSymbol && Symbol.asyncIterator ? Symbol.asyncIterator : '@@asyncIterator';
|
||||
function check(value, predicate, error) {
|
||||
if (!predicate(value)) {
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
var assignWithSymbols = function assignWithSymbols(target, source) {
|
||||
_extends(target, source);
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
Object.getOwnPropertySymbols(source).forEach(function (s) {
|
||||
target[s] = source[s];
|
||||
@@ -44,12 +23,10 @@ var assignWithSymbols = function assignWithSymbols(target, source) {
|
||||
};
|
||||
var flatMap = function flatMap(mapper, arr) {
|
||||
var _ref;
|
||||
|
||||
return (_ref = []).concat.apply(_ref, arr.map(mapper));
|
||||
};
|
||||
function remove(array, item) {
|
||||
var index = array.indexOf(item);
|
||||
|
||||
if (index >= 0) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
@@ -60,32 +37,26 @@ function once(fn) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
|
||||
called = true;
|
||||
fn();
|
||||
};
|
||||
}
|
||||
|
||||
var kThrow = function kThrow(err) {
|
||||
throw err;
|
||||
};
|
||||
|
||||
var kReturn = function kReturn(value) {
|
||||
return {
|
||||
value: value,
|
||||
done: true
|
||||
};
|
||||
};
|
||||
|
||||
function makeIterator(next, thro, name) {
|
||||
if (thro === void 0) {
|
||||
thro = kThrow;
|
||||
}
|
||||
|
||||
if (name === void 0) {
|
||||
name = 'iterator';
|
||||
}
|
||||
|
||||
var iterator = {
|
||||
meta: {
|
||||
name: name
|
||||
@@ -95,41 +66,26 @@ function makeIterator(next, thro, name) {
|
||||
return: kReturn,
|
||||
isSagaIterator: true
|
||||
};
|
||||
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
iterator[Symbol.iterator] = function () {
|
||||
return iterator;
|
||||
};
|
||||
}
|
||||
|
||||
return iterator;
|
||||
}
|
||||
function logError(error, _ref2) {
|
||||
var sagaStack = _ref2.sagaStack;
|
||||
|
||||
/*eslint-disable no-console*/
|
||||
console.error(error);
|
||||
console.error(sagaStack);
|
||||
}
|
||||
var internalErr = function internalErr(err) {
|
||||
return new Error("\n redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n Error: " + err + "\n");
|
||||
};
|
||||
var createSetContextWarning = function createSetContextWarning(ctx, props) {
|
||||
return (ctx ? ctx + '.' : '') + "setContext(props): argument " + props + " is not a plain object";
|
||||
};
|
||||
var FROZEN_ACTION_ERROR = "You can't put (a.k.a. dispatch from saga) frozen actions.\nWe have to define a special non-enumerable property on those actions for scheduling purposes.\nOtherwise you wouldn't be able to communicate properly between sagas & other subscribers (action ordering would become far less predictable).\nIf you are using redux and you care about this behaviour (frozen actions),\nthen you might want to switch to freezing actions in a middleware rather than in action creator.\nExample implementation:\n\nconst freezeActions = store => next => action => next(Object.freeze(action))\n"; // creates empty, but not-holey array
|
||||
|
||||
// creates empty, but not-holey array
|
||||
var createEmptyArray = function createEmptyArray(n) {
|
||||
return Array.apply(null, new Array(n));
|
||||
};
|
||||
var wrapSagaDispatch = function wrapSagaDispatch(dispatch) {
|
||||
return function (action) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(action, function (ac) {
|
||||
return !Object.isFrozen(ac);
|
||||
}, FROZEN_ACTION_ERROR);
|
||||
}
|
||||
|
||||
return dispatch(Object.defineProperty(action, SAGA_ACTION, {
|
||||
value: true
|
||||
}));
|
||||
@@ -147,31 +103,21 @@ var shouldComplete = function shouldComplete(res) {
|
||||
function createAllStyleChildCallbacks(shape, parentCallback) {
|
||||
var keys = Object.keys(shape);
|
||||
var totalCount = keys.length;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(totalCount, function (c) {
|
||||
return c > 0;
|
||||
}, 'createAllStyleChildCallbacks: get an empty array or object');
|
||||
}
|
||||
|
||||
var completedCount = 0;
|
||||
var completed;
|
||||
var results = array(shape) ? createEmptyArray(totalCount) : {};
|
||||
var results = is.array(shape) ? createEmptyArray(totalCount) : {};
|
||||
var childCallbacks = {};
|
||||
|
||||
function checkEnd() {
|
||||
if (completedCount === totalCount) {
|
||||
completed = true;
|
||||
parentCallback(results);
|
||||
}
|
||||
}
|
||||
|
||||
keys.forEach(function (key) {
|
||||
var chCbAtKey = function chCbAtKey(res, isErr) {
|
||||
if (completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isErr || shouldComplete(res)) {
|
||||
parentCallback.cancel();
|
||||
parentCallback(res, isErr);
|
||||
@@ -181,11 +127,9 @@ function createAllStyleChildCallbacks(shape, parentCallback) {
|
||||
checkEnd();
|
||||
}
|
||||
};
|
||||
|
||||
chCbAtKey.cancel = noop;
|
||||
childCallbacks[key] = chCbAtKey;
|
||||
});
|
||||
|
||||
parentCallback.cancel = function () {
|
||||
if (!completed) {
|
||||
completed = true;
|
||||
@@ -194,7 +138,6 @@ function createAllStyleChildCallbacks(shape, parentCallback) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return childCallbacks;
|
||||
}
|
||||
function getMetaInfo(fn) {
|
||||
@@ -210,17 +153,14 @@ function compose() {
|
||||
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
funcs[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
if (funcs.length === 0) {
|
||||
return function (arg) {
|
||||
return arg;
|
||||
};
|
||||
}
|
||||
|
||||
if (funcs.length === 1) {
|
||||
return funcs[0];
|
||||
}
|
||||
|
||||
return funcs.reduce(function (a, b) {
|
||||
return function () {
|
||||
return a(b.apply(void 0, arguments));
|
||||
@@ -238,23 +178,19 @@ var zeroBuffer = {
|
||||
put: noop,
|
||||
take: noop
|
||||
};
|
||||
|
||||
function ringBuffer(limit, overflowAction) {
|
||||
if (limit === void 0) {
|
||||
limit = 10;
|
||||
}
|
||||
|
||||
var arr = new Array(limit);
|
||||
var length = 0;
|
||||
var pushIndex = 0;
|
||||
var popIndex = 0;
|
||||
|
||||
var push = function push(it) {
|
||||
arr[pushIndex] = it;
|
||||
pushIndex = (pushIndex + 1) % limit;
|
||||
length++;
|
||||
};
|
||||
|
||||
var take = function take() {
|
||||
if (length != 0) {
|
||||
var it = arr[popIndex];
|
||||
@@ -264,17 +200,13 @@ function ringBuffer(limit, overflowAction) {
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
||||
var flush = function flush() {
|
||||
var items = [];
|
||||
|
||||
while (length) {
|
||||
items.push(take());
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
return {
|
||||
isEmpty: function isEmpty() {
|
||||
return length == 0;
|
||||
@@ -284,17 +216,14 @@ function ringBuffer(limit, overflowAction) {
|
||||
push(it);
|
||||
} else {
|
||||
var doubledLimit;
|
||||
|
||||
switch (overflowAction) {
|
||||
case ON_OVERFLOW_THROW:
|
||||
throw new Error(BUFFER_OVERFLOW);
|
||||
|
||||
case ON_OVERFLOW_SLIDE:
|
||||
arr[pushIndex] = it;
|
||||
pushIndex = (pushIndex + 1) % limit;
|
||||
popIndex = pushIndex;
|
||||
break;
|
||||
|
||||
case ON_OVERFLOW_EXPAND:
|
||||
doubledLimit = 2 * limit;
|
||||
arr = flush();
|
||||
@@ -305,9 +234,7 @@ function ringBuffer(limit, overflowAction) {
|
||||
limit = doubledLimit;
|
||||
push(it);
|
||||
break;
|
||||
|
||||
default: // DROP
|
||||
|
||||
// DROP
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -315,7 +242,6 @@ function ringBuffer(limit, overflowAction) {
|
||||
flush: flush
|
||||
};
|
||||
}
|
||||
|
||||
var none = function none() {
|
||||
return zeroBuffer;
|
||||
};
|
||||
@@ -376,23 +302,11 @@ var effectTypes = /*#__PURE__*/Object.freeze({
|
||||
SET_CONTEXT: SET_CONTEXT
|
||||
});
|
||||
|
||||
var TEST_HINT = '\n(HINT: if you are getting these errors in tests, consider using createMockTask from @redux-saga/testing-utils)';
|
||||
|
||||
var makeEffect = function makeEffect(type, payload) {
|
||||
var _ref;
|
||||
|
||||
return _ref = {}, _ref[IO] = true, _ref.combinator = false, _ref.type = type, _ref.payload = payload, _ref;
|
||||
};
|
||||
|
||||
var isForkEffect = function isForkEffect(eff) {
|
||||
return effect(eff) && eff.type === FORK;
|
||||
};
|
||||
|
||||
var detach = function detach(eff) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(eff, isForkEffect, 'detach(eff): argument must be a fork effect');
|
||||
}
|
||||
|
||||
return makeEffect(FORK, _extends({}, eff.payload, {
|
||||
detached: true
|
||||
}));
|
||||
@@ -401,68 +315,44 @@ function take(patternOrChannel, multicastPattern) {
|
||||
if (patternOrChannel === void 0) {
|
||||
patternOrChannel = '*';
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && arguments.length) {
|
||||
check(arguments[0], notUndef, 'take(patternOrChannel): patternOrChannel is undefined');
|
||||
}
|
||||
|
||||
if (pattern(patternOrChannel)) {
|
||||
if (notUndef(multicastPattern)) {
|
||||
if (is.pattern(patternOrChannel)) {
|
||||
if (is.notUndef(multicastPattern)) {
|
||||
/* eslint-disable no-console */
|
||||
console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types");
|
||||
}
|
||||
|
||||
return makeEffect(TAKE, {
|
||||
pattern: patternOrChannel
|
||||
});
|
||||
}
|
||||
|
||||
if (multicast(patternOrChannel) && notUndef(multicastPattern) && pattern(multicastPattern)) {
|
||||
if (is.multicast(patternOrChannel) && is.notUndef(multicastPattern) && is.pattern(multicastPattern)) {
|
||||
return makeEffect(TAKE, {
|
||||
channel: patternOrChannel,
|
||||
pattern: multicastPattern
|
||||
});
|
||||
}
|
||||
|
||||
if (channel(patternOrChannel)) {
|
||||
if (notUndef(multicastPattern)) {
|
||||
if (is.channel(patternOrChannel)) {
|
||||
if (is.notUndef(multicastPattern)) {
|
||||
/* eslint-disable no-console */
|
||||
console.warn("take(channel) takes one argument but two were provided. Second argument is ignored.");
|
||||
}
|
||||
|
||||
return makeEffect(TAKE, {
|
||||
channel: patternOrChannel
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
throw new Error("take(patternOrChannel): argument " + patternOrChannel + " is not valid channel or a valid pattern");
|
||||
}
|
||||
}
|
||||
var takeMaybe = function takeMaybe() {
|
||||
var eff = take.apply(void 0, arguments);
|
||||
eff.payload.maybe = true;
|
||||
return eff;
|
||||
};
|
||||
function put(channel$1, action) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (arguments.length > 1) {
|
||||
check(channel$1, notUndef, 'put(channel, action): argument channel is undefined');
|
||||
check(channel$1, channel, "put(channel, action): argument " + channel$1 + " is not a valid channel");
|
||||
check(action, notUndef, 'put(channel, action): argument action is undefined');
|
||||
} else {
|
||||
check(channel$1, notUndef, 'put(action): argument action is undefined');
|
||||
}
|
||||
function put(channel, action) {
|
||||
if (is.undef(action)) {
|
||||
action = channel;
|
||||
// `undefined` instead of `null` to make default parameter work
|
||||
channel = undefined;
|
||||
}
|
||||
|
||||
if (undef(action)) {
|
||||
action = channel$1; // `undefined` instead of `null` to make default parameter work
|
||||
|
||||
channel$1 = undefined;
|
||||
}
|
||||
|
||||
return makeEffect(PUT, {
|
||||
channel: channel$1,
|
||||
channel: channel,
|
||||
action: action
|
||||
});
|
||||
}
|
||||
@@ -480,234 +370,103 @@ function race(effects) {
|
||||
var eff = makeEffect(RACE, effects);
|
||||
eff.combinator = true;
|
||||
return eff;
|
||||
} // this match getFnCallDescriptor logic
|
||||
|
||||
var validateFnDescriptor = function validateFnDescriptor(effectName, fnDescriptor) {
|
||||
check(fnDescriptor, notUndef, effectName + ": argument fn is undefined or null");
|
||||
|
||||
if (func(fnDescriptor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var context = null;
|
||||
var fn;
|
||||
|
||||
if (array(fnDescriptor)) {
|
||||
context = fnDescriptor[0];
|
||||
fn = fnDescriptor[1];
|
||||
check(fn, notUndef, effectName + ": argument of type [context, fn] has undefined or null `fn`");
|
||||
} else if (object(fnDescriptor)) {
|
||||
context = fnDescriptor.context;
|
||||
fn = fnDescriptor.fn;
|
||||
check(fn, notUndef, effectName + ": argument of type {context, fn} has undefined or null `fn`");
|
||||
} else {
|
||||
check(fnDescriptor, func, effectName + ": argument fn is not function");
|
||||
return;
|
||||
}
|
||||
|
||||
if (context && string(fn)) {
|
||||
check(context[fn], func, effectName + ": context arguments has no such method - \"" + fn + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
check(fn, func, effectName + ": unpacked fn argument (from [context, fn] or {context, fn}) is not a function");
|
||||
};
|
||||
|
||||
}
|
||||
function getFnCallDescriptor(fnDescriptor, args) {
|
||||
var context = null;
|
||||
var fn;
|
||||
|
||||
if (func(fnDescriptor)) {
|
||||
if (is.func(fnDescriptor)) {
|
||||
fn = fnDescriptor;
|
||||
} else {
|
||||
if (array(fnDescriptor)) {
|
||||
if (is.array(fnDescriptor)) {
|
||||
context = fnDescriptor[0];
|
||||
fn = fnDescriptor[1];
|
||||
} else {
|
||||
context = fnDescriptor.context;
|
||||
fn = fnDescriptor.fn;
|
||||
}
|
||||
|
||||
if (context && string(fn) && func(context[fn])) {
|
||||
if (context && is.string(fn) && is.func(context[fn])) {
|
||||
fn = context[fn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
context: context,
|
||||
fn: fn,
|
||||
args: args
|
||||
};
|
||||
}
|
||||
|
||||
var isNotDelayEffect = function isNotDelayEffect(fn) {
|
||||
return fn !== delay;
|
||||
};
|
||||
|
||||
function call(fnDescriptor) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var arg0 = typeof args[0] === 'number' ? args[0] : 'ms';
|
||||
check(fnDescriptor, isNotDelayEffect, "instead of writing `yield call(delay, " + arg0 + ")` where delay is an effect from `redux-saga/effects` you should write `yield delay(" + arg0 + ")`");
|
||||
validateFnDescriptor('call', fnDescriptor);
|
||||
}
|
||||
|
||||
return makeEffect(CALL, getFnCallDescriptor(fnDescriptor, args));
|
||||
}
|
||||
function apply(context, fn, args) {
|
||||
if (args === void 0) {
|
||||
args = [];
|
||||
}
|
||||
|
||||
var fnDescriptor = [context, fn];
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateFnDescriptor('apply', fnDescriptor);
|
||||
}
|
||||
|
||||
return makeEffect(CALL, getFnCallDescriptor([context, fn], args));
|
||||
}
|
||||
function cps(fnDescriptor) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateFnDescriptor('cps', fnDescriptor);
|
||||
}
|
||||
|
||||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
return makeEffect(CPS, getFnCallDescriptor(fnDescriptor, args));
|
||||
}
|
||||
function fork(fnDescriptor) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateFnDescriptor('fork', fnDescriptor);
|
||||
check(fnDescriptor, function (arg) {
|
||||
return !effect(arg);
|
||||
}, 'fork: argument must not be an effect');
|
||||
}
|
||||
|
||||
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
||||
args[_key3 - 1] = arguments[_key3];
|
||||
}
|
||||
|
||||
return makeEffect(FORK, getFnCallDescriptor(fnDescriptor, args));
|
||||
}
|
||||
function spawn(fnDescriptor) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateFnDescriptor('spawn', fnDescriptor);
|
||||
}
|
||||
|
||||
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
||||
args[_key4 - 1] = arguments[_key4];
|
||||
}
|
||||
|
||||
return detach(fork.apply(void 0, [fnDescriptor].concat(args)));
|
||||
}
|
||||
function join(taskOrTasks) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (arguments.length > 1) {
|
||||
throw new Error('join(...tasks) is not supported any more. Please use join([...tasks]) to join multiple tasks.');
|
||||
}
|
||||
|
||||
if (array(taskOrTasks)) {
|
||||
taskOrTasks.forEach(function (t) {
|
||||
check(t, task, "join([...tasks]): argument " + t + " is not a valid Task object " + TEST_HINT);
|
||||
});
|
||||
} else {
|
||||
check(taskOrTasks, task, "join(task): argument " + taskOrTasks + " is not a valid Task object " + TEST_HINT);
|
||||
}
|
||||
}
|
||||
|
||||
return makeEffect(JOIN, taskOrTasks);
|
||||
}
|
||||
function cancel(taskOrTasks) {
|
||||
if (taskOrTasks === void 0) {
|
||||
taskOrTasks = SELF_CANCELLATION;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (arguments.length > 1) {
|
||||
throw new Error('cancel(...tasks) is not supported any more. Please use cancel([...tasks]) to cancel multiple tasks.');
|
||||
}
|
||||
|
||||
if (array(taskOrTasks)) {
|
||||
taskOrTasks.forEach(function (t) {
|
||||
check(t, task, "cancel([...tasks]): argument " + t + " is not a valid Task object " + TEST_HINT);
|
||||
});
|
||||
} else if (taskOrTasks !== SELF_CANCELLATION && notUndef(taskOrTasks)) {
|
||||
check(taskOrTasks, task, "cancel(task): argument " + taskOrTasks + " is not a valid Task object " + TEST_HINT);
|
||||
}
|
||||
}
|
||||
|
||||
return makeEffect(CANCEL, taskOrTasks);
|
||||
}
|
||||
function select(selector) {
|
||||
if (selector === void 0) {
|
||||
selector = identity;
|
||||
}
|
||||
|
||||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
||||
args[_key5 - 1] = arguments[_key5];
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && arguments.length) {
|
||||
check(arguments[0], notUndef, 'select(selector, [...]): argument selector is undefined');
|
||||
check(selector, func, "select(selector, [...]): argument " + selector + " is not a function");
|
||||
}
|
||||
|
||||
return makeEffect(SELECT, {
|
||||
selector: selector,
|
||||
args: args
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
channel(pattern, [buffer]) => creates a proxy channel for store actions
|
||||
**/
|
||||
|
||||
function actionChannel(pattern$1, buffer$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(pattern$1, pattern, 'actionChannel(pattern,...): argument pattern is not valid');
|
||||
|
||||
if (arguments.length > 1) {
|
||||
check(buffer$1, notUndef, 'actionChannel(pattern, buffer): argument buffer is undefined');
|
||||
check(buffer$1, buffer, "actionChannel(pattern, buffer): argument " + buffer$1 + " is not a valid buffer");
|
||||
}
|
||||
}
|
||||
|
||||
function actionChannel(pattern, buffer) {
|
||||
return makeEffect(ACTION_CHANNEL, {
|
||||
pattern: pattern$1,
|
||||
buffer: buffer$1
|
||||
pattern: pattern,
|
||||
buffer: buffer
|
||||
});
|
||||
}
|
||||
function cancelled() {
|
||||
return makeEffect(CANCELLED, {});
|
||||
}
|
||||
function flush(channel$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(channel$1, channel, "flush(channel): argument " + channel$1 + " is not valid channel");
|
||||
}
|
||||
|
||||
return makeEffect(FLUSH, channel$1);
|
||||
function flush(channel) {
|
||||
return makeEffect(FLUSH, channel);
|
||||
}
|
||||
function getContext(prop) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(prop, string, "getContext(prop): argument " + prop + " is not a string");
|
||||
}
|
||||
|
||||
return makeEffect(GET_CONTEXT, prop);
|
||||
}
|
||||
function setContext(props) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(props, object, createSetContextWarning(null, props));
|
||||
}
|
||||
|
||||
return makeEffect(SET_CONTEXT, props);
|
||||
}
|
||||
var delay =
|
||||
/*#__PURE__*/
|
||||
call.bind(null, delayP);
|
||||
var delay = /*#__PURE__*/call.bind(null, delayP);
|
||||
|
||||
export { all as $, ALL as A, compose as B, CALL as C, logError as D, wrapSagaDispatch as E, FORK as F, GET_CONTEXT as G, identity as H, buffers as I, JOIN as J, detach as K, take as L, fork as M, cancel as N, call as O, PUT as P, delay as Q, RACE as R, SELECT as S, TAKE as T, actionChannel as U, sliding as V, race as W, effectTypes as X, takeMaybe as Y, put as Z, putResolve as _, CPS as a, apply as a0, cps as a1, spawn as a2, join as a3, select as a4, cancelled as a5, flush as a6, getContext as a7, setContext as a8, CANCEL as b, check as c, ACTION_CHANNEL as d, expanding as e, CANCELLED as f, FLUSH as g, SET_CONTEXT as h, internalErr as i, getMetaInfo as j, kTrue as k, createAllStyleChildCallbacks as l, createEmptyArray as m, none as n, once as o, assignWithSymbols as p, makeIterator as q, remove as r, shouldComplete as s, noop as t, flatMap as u, getLocation as v, createSetContextWarning as w, asyncIteratorSymbol as x, shouldCancel as y, shouldTerminate as z };
|
||||
export { join as $, ALL as A, buffers as B, CALL as C, detach as D, take as E, FORK as F, GET_CONTEXT as G, fork as H, cancel as I, JOIN as J, call as K, delay as L, actionChannel as M, sliding as N, race as O, PUT as P, effectTypes as Q, RACE as R, SELECT as S, TAKE as T, takeMaybe as U, put as V, putResolve as W, all as X, apply as Y, cps as Z, spawn as _, CPS as a, select as a0, cancelled as a1, flush as a2, getContext as a3, setContext as a4, CANCEL as b, ACTION_CHANNEL as c, CANCELLED as d, expanding as e, FLUSH as f, SET_CONTEXT as g, getMetaInfo as h, createAllStyleChildCallbacks as i, createEmptyArray as j, kTrue as k, assignWithSymbols as l, makeIterator as m, none as n, once as o, noop as p, getLocation as q, remove as r, shouldComplete as s, flatMap as t, shouldCancel as u, shouldTerminate as v, compose as w, wrapSagaDispatch as x, logError as y, identity as z };
|
||||
+139
-422
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+33
-103
@@ -1,8 +1,8 @@
|
||||
import { m as makeIterator, E as take, H as fork, I as cancel, K as call, L as delay, M as actionChannel, N as sliding, O as race } from '../../dist/io-dec07f91.esm.js';
|
||||
export { M as actionChannel, X as all, Y as apply, K as call, I as cancel, a1 as cancelled, Z as cps, L as delay, Q as effectTypes, a2 as flush, H as fork, a3 as getContext, $ as join, V as put, W as putResolve, O as race, a0 as select, a4 as setContext, _ as spawn, E as take, U as takeMaybe } from '../../dist/io-dec07f91.esm.js';
|
||||
import * as is from '@redux-saga/is';
|
||||
import '@babel/runtime/helpers/extends';
|
||||
import '@redux-saga/symbols';
|
||||
import '@babel/runtime/helpers/esm/extends';
|
||||
import { channel, stringableFunc, func, notUndef } from '@redux-saga/is';
|
||||
import { q as makeIterator, L as take, M as fork, N as cancel, O as call, Q as delay, U as actionChannel, V as sliding, W as race, c as check } from './io-22ea0cf9.js';
|
||||
export { U as actionChannel, $ as all, a0 as apply, O as call, N as cancel, a5 as cancelled, a1 as cps, Q as delay, X as effectTypes, a6 as flush, M as fork, a7 as getContext, a3 as join, Z as put, _ as putResolve, W as race, a4 as select, a8 as setContext, a2 as spawn, L as take, Y as takeMaybe } from './io-22ea0cf9.js';
|
||||
import '@redux-saga/delay-p';
|
||||
|
||||
var done = function done(value) {
|
||||
@@ -11,34 +11,28 @@ var done = function done(value) {
|
||||
value: value
|
||||
};
|
||||
};
|
||||
|
||||
var qEnd = {};
|
||||
function safeName(patternOrChannel) {
|
||||
if (channel(patternOrChannel)) {
|
||||
if (is.channel(patternOrChannel)) {
|
||||
return 'channel';
|
||||
}
|
||||
|
||||
if (stringableFunc(patternOrChannel)) {
|
||||
if (is.stringableFunc(patternOrChannel)) {
|
||||
return String(patternOrChannel);
|
||||
}
|
||||
|
||||
if (func(patternOrChannel)) {
|
||||
if (is.func(patternOrChannel)) {
|
||||
return patternOrChannel.name;
|
||||
}
|
||||
|
||||
return String(patternOrChannel);
|
||||
}
|
||||
function fsmIterator(fsm, startState, name) {
|
||||
var stateUpdater,
|
||||
errorState,
|
||||
effect,
|
||||
nextState = startState;
|
||||
|
||||
errorState,
|
||||
effect,
|
||||
nextState = startState;
|
||||
function next(arg, error) {
|
||||
if (nextState === qEnd) {
|
||||
return done(arg);
|
||||
}
|
||||
|
||||
if (error && !errorState) {
|
||||
nextState = qEnd;
|
||||
throw error;
|
||||
@@ -52,34 +46,29 @@ function fsmIterator(fsm, startState, name) {
|
||||
return nextState === qEnd ? done(arg) : effect;
|
||||
}
|
||||
}
|
||||
|
||||
return makeIterator(next, function (error) {
|
||||
return next(null, error);
|
||||
}, name);
|
||||
}
|
||||
|
||||
function takeEvery(patternOrChannel, worker) {
|
||||
function takeEvery$1(patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
var yTake = {
|
||||
done: false,
|
||||
value: take(patternOrChannel)
|
||||
};
|
||||
|
||||
var yFork = function yFork(ac) {
|
||||
return {
|
||||
done: false,
|
||||
value: fork.apply(void 0, [worker].concat(args, [ac]))
|
||||
};
|
||||
};
|
||||
|
||||
var action,
|
||||
setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
|
||||
setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
return fsmIterator({
|
||||
q1: function q1() {
|
||||
return {
|
||||
@@ -97,40 +86,33 @@ function takeEvery(patternOrChannel, worker) {
|
||||
}, 'q1', "takeEvery(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
||||
}
|
||||
|
||||
function takeLatest(patternOrChannel, worker) {
|
||||
function takeLatest$1(patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
var yTake = {
|
||||
done: false,
|
||||
value: take(patternOrChannel)
|
||||
};
|
||||
|
||||
var yFork = function yFork(ac) {
|
||||
return {
|
||||
done: false,
|
||||
value: fork.apply(void 0, [worker].concat(args, [ac]))
|
||||
};
|
||||
};
|
||||
|
||||
var yCancel = function yCancel(task) {
|
||||
return {
|
||||
done: false,
|
||||
value: cancel(task)
|
||||
};
|
||||
};
|
||||
|
||||
var task, action;
|
||||
|
||||
var setTask = function setTask(t) {
|
||||
return task = t;
|
||||
};
|
||||
|
||||
var setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
|
||||
return fsmIterator({
|
||||
q1: function q1() {
|
||||
return {
|
||||
@@ -159,29 +141,24 @@ function takeLatest(patternOrChannel, worker) {
|
||||
}, 'q1', "takeLatest(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
||||
}
|
||||
|
||||
function takeLeading(patternOrChannel, worker) {
|
||||
function takeLeading$1(patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
var yTake = {
|
||||
done: false,
|
||||
value: take(patternOrChannel)
|
||||
};
|
||||
|
||||
var yCall = function yCall(ac) {
|
||||
return {
|
||||
done: false,
|
||||
value: call.apply(void 0, [worker].concat(args, [ac]))
|
||||
};
|
||||
};
|
||||
|
||||
var action;
|
||||
|
||||
var setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
|
||||
return fsmIterator({
|
||||
q1: function q1() {
|
||||
return {
|
||||
@@ -199,46 +176,37 @@ function takeLeading(patternOrChannel, worker) {
|
||||
}, 'q1', "takeLeading(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
||||
}
|
||||
|
||||
function throttle(delayLength, patternOrChannel, worker) {
|
||||
function throttle$1(delayLength, patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
||||
args[_key - 3] = arguments[_key];
|
||||
}
|
||||
|
||||
var action, channel$1;
|
||||
|
||||
var action, channel;
|
||||
var yTake = function yTake() {
|
||||
return {
|
||||
done: false,
|
||||
value: take(channel$1)
|
||||
value: take(channel)
|
||||
};
|
||||
};
|
||||
|
||||
var yFork = function yFork(ac) {
|
||||
return {
|
||||
done: false,
|
||||
value: fork.apply(void 0, [worker].concat(args, [ac]))
|
||||
};
|
||||
};
|
||||
|
||||
var yDelay = {
|
||||
done: false,
|
||||
value: delay(delayLength)
|
||||
};
|
||||
|
||||
var setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
|
||||
var setChannel = function setChannel(ch) {
|
||||
return channel$1 = ch;
|
||||
return channel = ch;
|
||||
};
|
||||
|
||||
var needsChannel = !channel(patternOrChannel);
|
||||
|
||||
var needsChannel = !is.channel(patternOrChannel);
|
||||
if (!needsChannel) {
|
||||
setChannel(patternOrChannel);
|
||||
}
|
||||
|
||||
return fsmIterator({
|
||||
q1: function q1() {
|
||||
var yActionChannel = {
|
||||
@@ -273,13 +241,11 @@ function throttle(delayLength, patternOrChannel, worker) {
|
||||
}, needsChannel ? 'q1' : 'q2', "throttle(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
||||
}
|
||||
|
||||
function retry(maxTries, delayLength, fn) {
|
||||
function retry$1(maxTries, delayLength, fn) {
|
||||
var counter = maxTries;
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
||||
args[_key - 3] = arguments[_key];
|
||||
}
|
||||
|
||||
var yCall = {
|
||||
done: false,
|
||||
value: call.apply(void 0, [fn].concat(args))
|
||||
@@ -303,11 +269,9 @@ function retry(maxTries, delayLength, fn) {
|
||||
},
|
||||
q10: function q10(error) {
|
||||
counter -= 1;
|
||||
|
||||
if (counter <= 0) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return {
|
||||
nextState: 'q1',
|
||||
effect: yDelay
|
||||
@@ -320,7 +284,6 @@ function debounceHelper(delayLength, patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
||||
args[_key - 3] = arguments[_key];
|
||||
}
|
||||
|
||||
var action, raceOutput;
|
||||
var yTake = {
|
||||
done: false,
|
||||
@@ -333,29 +296,24 @@ function debounceHelper(delayLength, patternOrChannel, worker) {
|
||||
debounce: delay(delayLength)
|
||||
})
|
||||
};
|
||||
|
||||
var yFork = function yFork(ac) {
|
||||
return {
|
||||
done: false,
|
||||
value: fork.apply(void 0, [worker].concat(args, [ac]))
|
||||
};
|
||||
};
|
||||
|
||||
var yNoop = function yNoop(value) {
|
||||
return {
|
||||
done: false,
|
||||
value: value
|
||||
};
|
||||
};
|
||||
|
||||
var setAction = function setAction(ac) {
|
||||
return action = ac;
|
||||
};
|
||||
|
||||
var setRaceOutput = function setRaceOutput(ro) {
|
||||
return raceOutput = ro;
|
||||
};
|
||||
|
||||
return fsmIterator({
|
||||
q1: function q1() {
|
||||
return {
|
||||
@@ -384,69 +342,41 @@ function debounceHelper(delayLength, patternOrChannel, worker) {
|
||||
}, 'q1', "debounce(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
||||
}
|
||||
|
||||
var validateTakeEffect = function validateTakeEffect(fn, patternOrChannel, worker) {
|
||||
check(patternOrChannel, notUndef, fn.name + " requires a pattern or channel");
|
||||
check(worker, notUndef, fn.name + " requires a saga parameter");
|
||||
};
|
||||
|
||||
function takeEvery$1(patternOrChannel, worker) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateTakeEffect(takeEvery$1, patternOrChannel, worker);
|
||||
}
|
||||
|
||||
function takeEvery(patternOrChannel, worker) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
return fork.apply(void 0, [takeEvery, patternOrChannel, worker].concat(args));
|
||||
return fork.apply(void 0, [takeEvery$1, patternOrChannel, worker].concat(args));
|
||||
}
|
||||
function takeLatest$1(patternOrChannel, worker) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateTakeEffect(takeLatest$1, patternOrChannel, worker);
|
||||
}
|
||||
|
||||
function takeLatest(patternOrChannel, worker) {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return fork.apply(void 0, [takeLatest, patternOrChannel, worker].concat(args));
|
||||
return fork.apply(void 0, [takeLatest$1, patternOrChannel, worker].concat(args));
|
||||
}
|
||||
function takeLeading$1(patternOrChannel, worker) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
validateTakeEffect(takeLeading$1, patternOrChannel, worker);
|
||||
}
|
||||
|
||||
function takeLeading(patternOrChannel, worker) {
|
||||
for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
||||
args[_key3 - 2] = arguments[_key3];
|
||||
}
|
||||
|
||||
return fork.apply(void 0, [takeLeading, patternOrChannel, worker].concat(args));
|
||||
return fork.apply(void 0, [takeLeading$1, patternOrChannel, worker].concat(args));
|
||||
}
|
||||
function throttle$1(ms, patternOrChannel, worker) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
check(patternOrChannel, notUndef, "throttle requires a pattern or channel");
|
||||
check(worker, notUndef, 'throttle requires a saga parameter');
|
||||
}
|
||||
|
||||
function throttle(ms, patternOrChannel, worker) {
|
||||
for (var _len4 = arguments.length, args = new Array(_len4 > 3 ? _len4 - 3 : 0), _key4 = 3; _key4 < _len4; _key4++) {
|
||||
args[_key4 - 3] = arguments[_key4];
|
||||
}
|
||||
|
||||
return fork.apply(void 0, [throttle, ms, patternOrChannel, worker].concat(args));
|
||||
return fork.apply(void 0, [throttle$1, ms, patternOrChannel, worker].concat(args));
|
||||
}
|
||||
function retry$1(maxTries, delayLength, worker) {
|
||||
function retry(maxTries, delayLength, worker) {
|
||||
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
||||
args[_key5 - 3] = arguments[_key5];
|
||||
}
|
||||
|
||||
return call.apply(void 0, [retry, maxTries, delayLength, worker].concat(args));
|
||||
return call.apply(void 0, [retry$1, maxTries, delayLength, worker].concat(args));
|
||||
}
|
||||
function debounce(delayLength, pattern, worker) {
|
||||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
||||
args[_key6 - 3] = arguments[_key6];
|
||||
}
|
||||
|
||||
return fork.apply(void 0, [debounceHelper, delayLength, pattern, worker].concat(args));
|
||||
}
|
||||
|
||||
export { debounce, retry$1 as retry, takeEvery$1 as takeEvery, takeLatest$1 as takeLatest, takeLeading$1 as takeLeading, throttle$1 as throttle };
|
||||
export { debounce, retry, takeEvery, takeLatest, takeLeading, throttle };
|
||||
+1
-4
@@ -8,13 +8,10 @@ function deferred() {
|
||||
}
|
||||
function arrayOfDeferred(length) {
|
||||
var arr = [];
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
arr.push(deferred());
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
export default deferred;
|
||||
export { arrayOfDeferred };
|
||||
export { arrayOfDeferred, deferred as default };
|
||||
|
||||
+3
-3
@@ -40,8 +40,8 @@ var observable = function observable(ob) {
|
||||
var buffer = function buffer(buf) {
|
||||
return buf && func(buf.isEmpty) && func(buf.take) && func(buf.put);
|
||||
};
|
||||
var pattern = function pattern(pat) {
|
||||
return pat && (string(pat) || symbol(pat) || func(pat) || array(pat) && pat.every(pattern));
|
||||
var _pattern = function pattern(pat) {
|
||||
return pat && (string(pat) || symbol(pat) || func(pat) || array(pat) && pat.every(_pattern));
|
||||
};
|
||||
var channel = function channel(ch) {
|
||||
return ch && func(ch.take) && func(ch.close);
|
||||
@@ -59,4 +59,4 @@ var effect = function effect(eff) {
|
||||
return eff && eff[IO];
|
||||
};
|
||||
|
||||
export { array, buffer, channel, effect, func, iterable, iterator, multicast, notUndef, number, object, observable, pattern, promise, sagaAction, string, stringableFunc, symbol, task, undef };
|
||||
export { array, buffer, channel, effect, func, iterable, iterator, multicast, notUndef, number, object, observable, _pattern as pattern, promise, sagaAction, string, stringableFunc, symbol, task, undef };
|
||||
|
||||
+11
-34
@@ -1,39 +1,16 @@
|
||||
var createSymbol = function createSymbol(name) {
|
||||
return "@@redux-saga/" + name;
|
||||
};
|
||||
|
||||
var CANCEL =
|
||||
/*#__PURE__*/
|
||||
createSymbol('CANCEL_PROMISE');
|
||||
var CHANNEL_END_TYPE =
|
||||
/*#__PURE__*/
|
||||
createSymbol('CHANNEL_END');
|
||||
var IO =
|
||||
/*#__PURE__*/
|
||||
createSymbol('IO');
|
||||
var MATCH =
|
||||
/*#__PURE__*/
|
||||
createSymbol('MATCH');
|
||||
var MULTICAST =
|
||||
/*#__PURE__*/
|
||||
createSymbol('MULTICAST');
|
||||
var SAGA_ACTION =
|
||||
/*#__PURE__*/
|
||||
createSymbol('SAGA_ACTION');
|
||||
var SELF_CANCELLATION =
|
||||
/*#__PURE__*/
|
||||
createSymbol('SELF_CANCELLATION');
|
||||
var TASK =
|
||||
/*#__PURE__*/
|
||||
createSymbol('TASK');
|
||||
var TASK_CANCEL =
|
||||
/*#__PURE__*/
|
||||
createSymbol('TASK_CANCEL');
|
||||
var TERMINATE =
|
||||
/*#__PURE__*/
|
||||
createSymbol('TERMINATE');
|
||||
var SAGA_LOCATION =
|
||||
/*#__PURE__*/
|
||||
createSymbol('LOCATION');
|
||||
var CANCEL = /*#__PURE__*/createSymbol('CANCEL_PROMISE');
|
||||
var CHANNEL_END_TYPE = /*#__PURE__*/createSymbol('CHANNEL_END');
|
||||
var IO = /*#__PURE__*/createSymbol('IO');
|
||||
var MATCH = /*#__PURE__*/createSymbol('MATCH');
|
||||
var MULTICAST = /*#__PURE__*/createSymbol('MULTICAST');
|
||||
var SAGA_ACTION = /*#__PURE__*/createSymbol('SAGA_ACTION');
|
||||
var SELF_CANCELLATION = /*#__PURE__*/createSymbol('SELF_CANCELLATION');
|
||||
var TASK = /*#__PURE__*/createSymbol('TASK');
|
||||
var TASK_CANCEL = /*#__PURE__*/createSymbol('TASK_CANCEL');
|
||||
var TERMINATE = /*#__PURE__*/createSymbol('TERMINATE');
|
||||
var SAGA_LOCATION = /*#__PURE__*/createSymbol('LOCATION');
|
||||
|
||||
export { CANCEL, CHANNEL_END_TYPE, IO, MATCH, MULTICAST, SAGA_ACTION, SAGA_LOCATION, SELF_CANCELLATION, TASK, TASK_CANCEL, TERMINATE };
|
||||
|
||||
Reference in New Issue
Block a user