Merged in feature/81-dev-dev01 (pull request #5)

auto-patch  81-dev-dev01-2023-12-05T22_45_26

* auto-patch  81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
Tony Volpe
2023-12-05 23:05:59 +00:00
parent ba16964e7a
commit 725d3043d5
1463 changed files with 142461 additions and 89421 deletions

View File

@@ -707,7 +707,6 @@ __webpack_require__.d(__webpack_exports__, {
;// CONCATENATED MODULE: ./node_modules/@wordpress/redux-routine/build-module/is-generator.js
/* eslint-disable jsdoc/valid-types */
/**
* Returns true if the given object is a generator, or false otherwise.
*
@@ -772,8 +771,8 @@ function isPlainObject(o) {
* External dependencies
*/
/* eslint-disable jsdoc/valid-types */
/* eslint-disable jsdoc/valid-types */
/**
* Returns true if the given object quacks like an action.
*
@@ -781,10 +780,10 @@ function isPlainObject(o) {
*
* @return {object is import('redux').AnyAction} Whether object is an action.
*/
function isAction(object) {
return isPlainObject(object) && typeof object.type === 'string';
}
/**
* Returns true if the given object quacks like an action and has a specific
* action type
@@ -794,7 +793,6 @@ function isAction(object) {
*
* @return {object is import('redux').AnyAction} Whether object is an action and is of specific type.
*/
function isActionOfType(object, expectedType) {
/* eslint-enable jsdoc/valid-types */
return isAction(object) && object.type === expectedType;
@@ -811,48 +809,41 @@ function isActionOfType(object, expectedType) {
* Internal dependencies
*/
/**
* Create a co-routine runtime.
*
* @param controls Object of control handlers.
* @param dispatch Unhandled action dispatch.
*/
function createRuntime(controls = {}, dispatch) {
const rungenControls = Object.entries(controls).map(([actionType, control]) => (value, next, iterate, yieldNext, yieldError) => {
if (!isActionOfType(value, actionType)) {
return false;
}
const routine = control(value);
if (isPromise(routine)) {
// Async control routine awaits resolution.
routine.then(yieldNext, yieldError);
} else {
yieldNext(routine);
}
return true;
});
const unhandledActionControl = (value, next) => {
if (!isAction(value)) {
return false;
}
dispatch(value);
next();
return true;
};
rungenControls.push(unhandledActionControl);
const rungenRuntime = (0,dist.create)(rungenControls);
return action => new Promise((resolve, reject) => rungenRuntime(action, result => {
if (isAction(result)) {
dispatch(result);
}
resolve(result);
}, reject));
}
@@ -863,6 +854,7 @@ function createRuntime(controls = {}, dispatch) {
*/
/**
* Creates a Redux middleware, given an object of controls where each key is an
* action type for which to act upon, the value a function which returns either
@@ -875,7 +867,6 @@ function createRuntime(controls = {}, dispatch) {
*
* @return {import('redux').Middleware} Co-routine runtime
*/
function createMiddleware(controls = {}) {
return store => {
const runtime = createRuntime(controls, store.dispatch);
@@ -883,7 +874,6 @@ function createMiddleware(controls = {}) {
if (!isGenerator(action)) {
return next(action);
}
return runtime(action);
};
};