= {
- [key: string]: (state: T, payload?: any) => any;
-};
+export type AsyncActionStatusesType = (typeof AsyncActionStatuses)[keyof typeof AsyncActionStatuses];
diff --git a/dist/helpers/types.js b/dist/helpers/types.js
index 11e638d..868b071 100644
--- a/dist/helpers/types.js
+++ b/dist/helpers/types.js
@@ -1,3 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsyncActionStatuses = void 0;
+exports.AsyncActionStatuses = {
+ PENDING: 'PENDING',
+ FULFILLED: 'FULFILLED',
+ REJECTED: 'REJECTED'
+};
//# sourceMappingURL=types.js.map
\ No newline at end of file
diff --git a/dist/helpers/types.js.map b/dist/helpers/types.js.map
index bc4cff3..45d4f6c 100644
--- a/dist/helpers/types.js.map
+++ b/dist/helpers/types.js.map
@@ -1 +1 @@
-{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/helpers/types.ts"],"names":[],"mappings":""}
\ No newline at end of file
+{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/helpers/types.ts"],"names":[],"mappings":";;;AAwDa,QAAA,mBAAmB,GAAG;IACjC,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAA"}
\ No newline at end of file
diff --git a/dist/hooks/types.d.ts b/dist/hooks/types.d.ts
index bbaef3b..fef325d 100644
--- a/dist/hooks/types.d.ts
+++ b/dist/hooks/types.d.ts
@@ -1,6 +1,7 @@
-export type Actions = {
- [key: string]: (payload?: any) => void;
-};
-export type Operations = {
- [key: string]: (payload?: any) => P;
-};
+import { type AsyncActionStatusesType } from '../helpers/types';
+export type Actions = Record void>;
+export type AsyncActions = Record Promise<{
+ data: T;
+ status: Omit;
+}>>;
+export type Operations = Record P>;
diff --git a/dist/hooks/useAction.d.ts b/dist/hooks/useAction.d.ts
index 13187f8..ac26b82 100644
--- a/dist/hooks/useAction.d.ts
+++ b/dist/hooks/useAction.d.ts
@@ -1,3 +1,3 @@
-import { Actions } from "./types.js";
+import { type Actions } from './types.js';
declare const useAction: (signalName: string, action: string) => any;
export default useAction;
diff --git a/dist/hooks/useAction.js b/dist/hooks/useAction.js
index 8ef4ac6..ebb1a01 100644
--- a/dist/hooks/useAction.js
+++ b/dist/hooks/useAction.js
@@ -5,10 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const useActions_js_1 = __importDefault(require("./useActions.js"));
const useAction = (signalName, action) => {
- if (!signalName || typeof signalName !== "string")
- throw new Error("Provide a signalName as a first argument of useAction");
- if (!action || typeof action !== "string")
- throw new Error("Provide an action as second argument of useAction");
+ if (!signalName || typeof signalName !== 'string') {
+ throw new Error('Provide a signalName as a first argument of useAction');
+ }
+ if (!action || typeof action !== 'string') {
+ throw new Error('Provide an action as second argument of useAction');
+ }
const actions = (0, useActions_js_1.default)(signalName, action);
return Object.values(actions)[0];
};
diff --git a/dist/hooks/useAction.js.map b/dist/hooks/useAction.js.map
index 7955ac0..7ca758f 100644
--- a/dist/hooks/useAction.js.map
+++ b/dist/hooks/useAction.js.map
@@ -1 +1 @@
-{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../src/hooks/useAction.ts"],"names":[],"mappings":";;;;;AACA,oEAAyC;AAEzC,MAAM,SAAS,GAAG,CAAc,UAAkB,EAAE,MAAc,EAAE,EAAE;IACpE,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAC/C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAE3E,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QACvC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,IAAA,uBAAU,EAAI,UAAU,EAAE,MAAM,CAAC,CAAC;IAElD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
\ No newline at end of file
+{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../src/hooks/useAction.ts"],"names":[],"mappings":";;;;;AACA,oEAAwC;AAExC,MAAM,SAAS,GAAG,CAAc,UAAkB,EAAE,MAAc,EAAE,EAAE;IACpE,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;KAAE;IAE/H,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;KAAE;IAEnH,MAAM,OAAO,GAAG,IAAA,uBAAU,EAAI,UAAU,EAAE,MAAM,CAAC,CAAA;IAEjD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA"}
\ No newline at end of file
diff --git a/dist/hooks/useActions.d.ts b/dist/hooks/useActions.d.ts
index 3ebd9fa..2108711 100644
--- a/dist/hooks/useActions.d.ts
+++ b/dist/hooks/useActions.d.ts
@@ -1,3 +1,3 @@
-import { Actions } from "./types.js";
+import { type Actions } from './types.js';
declare const useActions: (signalName: string, ...actions: string[]) => T;
export default useActions;
diff --git a/dist/hooks/useActions.js b/dist/hooks/useActions.js
index 4b3c6eb..5a825b9 100644
--- a/dist/hooks/useActions.js
+++ b/dist/hooks/useActions.js
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const index_js_1 = __importDefault(require("../contexts/index.js"));
const useActions = (signalName, ...actions) => {
- if (!signalName || typeof signalName !== "string")
- throw new Error("Provide a signalName as first argument of useActions");
+ if (!signalName || typeof signalName !== 'string') {
+ throw new Error('Provide a signalName as first argument of useActions');
+ }
// Get Global Context
const { signals, dispatch } = (0, react_1.useContext)(index_js_1.default);
// Some handlers
@@ -22,7 +23,7 @@ const useActions = (signalName, ...actions) => {
if (!actions || actions.length === 0)
return signal.actions;
const filteredActions = [];
- for (let action of actions) {
+ for (const action of actions) {
const actionName = `${signalName}/${action}`;
const retrievedAction = signal.actions.find((act) => act.type === actionName);
if (retrievedAction)
@@ -42,11 +43,12 @@ const useActions = (signalName, ...actions) => {
const formattedActions = {};
for (const action of nonFormattedActions) {
// Get action name
- const actionName = action.type.split("/")[1];
+ const actionName = action.type.split('/')[1];
formattedActions[actionName] = (payload) => {
dispatch({
type: action.type,
- payload,
+ isAsync: false,
+ payload
});
};
}
diff --git a/dist/hooks/useActions.js.map b/dist/hooks/useActions.js.map
index 8d5261f..61f46bf 100644
--- a/dist/hooks/useActions.js.map
+++ b/dist/hooks/useActions.js.map
@@ -1 +1 @@
-{"version":3,"file":"useActions.js","sourceRoot":"","sources":["../../src/hooks/useActions.ts"],"names":[],"mappings":";;;;;AAAA,iCAAmC;AACnC,oEAA6C;AAI7C,MAAM,UAAU,GAAG,CAAc,UAAkB,EAAE,GAAG,OAAiB,EAAE,EAAE;IAC3E,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAC/C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAE1E,qBAAqB;IACrB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAA,kBAAU,EAAC,kBAAS,CAAC,CAAC;IAEpD,gBAAgB;IAEhB;;;;OAIG;IACH,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAEpE,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,MAAM,CAAC,OAAO,CAAC;YAE5D,MAAM,eAAe,GAAwB,EAAE,CAAC;YAEhD,KAA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oB;QACpB,MAAM,gBAAgB,GAAG,EAAS,CAAA;QAElC,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE;YACxC,kBAAkB;YAClB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAE5C,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,OAAa,EAAE,EAAE;gBAC/C,QAAQ,CAAC;oBACP,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,OAAO,EAAE,KAAK;oBACd,OAAO;iBACR,CAAC,CAAA;YACJ,CAAC,CAAA;SACF;QAED,OAAO,gBAAgB,CAAA;IACzB,CAAC,CAAA;IAED,OAAO,mBAAmB,EAAE,CAAA;AAC9B,CAAC,CAAA;AAED,kBAAe,UAAU,CAAA"}
\ No newline at end of file
diff --git a/dist/hooks/useAsyncActions.d.ts b/dist/hooks/useAsyncActions.d.ts
new file mode 100644
index 0000000..af51506
--- /dev/null
+++ b/dist/hooks/useAsyncActions.d.ts
@@ -0,0 +1,3 @@
+import { type AsyncActions } from "./types";
+declare const useAsyncActions: >(signalName: string, ...actions: string[]) => P;
+export default useAsyncActions;
diff --git a/dist/hooks/useAsyncActions.js b/dist/hooks/useAsyncActions.js
new file mode 100644
index 0000000..3c5d7dd
--- /dev/null
+++ b/dist/hooks/useAsyncActions.js
@@ -0,0 +1,144 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const react_1 = require("react");
+const contexts_1 = __importDefault(require("../contexts"));
+const types_1 = require("../helpers/types");
+const useAsyncActions = (signalName, ...actions) => {
+ if (!signalName || typeof signalName !== "string") {
+ throw new Error("Provide a signalName as first argument of useAsyncActions");
+ }
+ // Get Global Context
+ const { signals, asyncDispatch } = (0, react_1.useContext)(contexts_1.default);
+ const asyncActionCallback = (0, react_1.useCallback)((action, payload) => __awaiter(void 0, void 0, void 0, function* () {
+ asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: types_1.AsyncActionStatuses.PENDING,
+ });
+ try {
+ const response = yield action.steps.asyncAction.handler(payload);
+ const data = asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: types_1.AsyncActionStatuses.FULFILLED,
+ payload: response,
+ });
+ return {
+ data,
+ status: types_1.AsyncActionStatuses.FULFILLED,
+ };
+ }
+ catch (error) {
+ const data = asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: types_1.AsyncActionStatuses.REJECTED,
+ payload: error,
+ });
+ return {
+ data,
+ error,
+ status: types_1.AsyncActionStatuses.REJECTED,
+ };
+ }
+ }), []);
+ // Some handlers
+ /**
+ * Get async actions of a signal
+ * @param signalName
+ * @returns
+ */
+ const handleGetAsyncActions = (signalName) => {
+ console.log("handleGetAsyncActions");
+ const signal = signals.find((signal) => signal.name === signalName);
+ if (signal) {
+ if (!actions || actions.length === 0)
+ return signal.asyncActions || [];
+ const filteredActions = [];
+ for (const action of actions) {
+ const actionName = `${signalName}/${action}`;
+ const retrievedAction = signal.asyncActions.find((act) => act.type === actionName);
+ if (retrievedAction)
+ filteredActions.push(retrievedAction);
+ else
+ throw new Error(`Async Action ${actionName} not found`);
+ }
+ return filteredActions;
+ }
+ else
+ throw new Error(`Signal ${signalName} not found`);
+ };
+ const asyncActions = (0, react_1.useMemo)(() => {
+ // Get actions
+ const nonFormattedActions = handleGetAsyncActions(signalName);
+ // Formatted actions
+ const formattedActions = nonFormattedActions.map((action) => {
+ // Get action name
+ const actionName = action.type.split("/")[1];
+ return [
+ actionName,
+ (payload) => __awaiter(void 0, void 0, void 0, function* () {
+ return asyncActionCallback(action, payload);
+ }),
+ ];
+ });
+ return Object.fromEntries(formattedActions);
+ // for (const action of nonFormattedActions) {
+ // // Get action name
+ // const actionName = action.type.split("/")[1];
+ // console.log("OUiiiiiiiiiii");
+ // formattedActions[actionName] = async (payload?: any) => {
+ // console.log("dedannnnnnnnnns");
+ // asyncDispatch({
+ // type: action.type,
+ // isAsync: true,
+ // status: AsyncActionStatuses.PENDING,
+ // });
+ // try {
+ // const response = await (
+ // action.steps as BuilderCase
+ // ).asyncAction.handler(payload);
+ // const data = asyncDispatch({
+ // type: action.type,
+ // isAsync: true,
+ // status: AsyncActionStatuses.FULFILLED,
+ // payload: response,
+ // });
+ // console.log("yoooooooooo");
+ // return {
+ // data,
+ // status: AsyncActionStatuses.FULFILLED,
+ // };
+ // } catch (error) {
+ // const data = asyncDispatch({
+ // type: action.type,
+ // isAsync: true,
+ // status: AsyncActionStatuses.REJECTED,
+ // payload: error,
+ // });
+ // return {
+ // data,
+ // error,
+ // status: AsyncActionStatuses.REJECTED,
+ // };
+ // }
+ // };
+ // }
+ // return formattedActions;
+ }, []);
+ return asyncActions;
+};
+exports.default = useAsyncActions;
+//# sourceMappingURL=useAsyncActions.js.map
\ No newline at end of file
diff --git a/dist/hooks/useAsyncActions.js.map b/dist/hooks/useAsyncActions.js.map
new file mode 100644
index 0000000..89402ad
--- /dev/null
+++ b/dist/hooks/useAsyncActions.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"useAsyncActions.js","sourceRoot":"","sources":["../../src/hooks/useAsyncActions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iCAA8E;AAE9E,2DAAoC;AAEpC,4CAAuD;AAGvD,MAAM,eAAe,GAAG,CACtB,UAAkB,EAClB,GAAG,OAAiB,EACpB,EAAE;IACF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AM,EAAE,OAAO,CAAC,CAAC;gBAC9C,CAAC,CAAA;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAE5C,8CAA8C;QAC9C,uBAAuB;QACvB,kDAAkD;QAElD,kCAAkC;QAElC,8DAA8D;QAC9D,sCAAsC;QACtC,sBAAsB;QACtB,2BAA2B;QAC3B,uBAAuB;QACvB,6CAA6C;QAC7C,UAAU;QAEV,YAAY;QACZ,iCAAiC;QACjC,2CAA2C;QAC3C,wCAAwC;QAExC,qCAAqC;QACrC,6BAA6B;QAC7B,yBAAyB;QACzB,iDAAiD;QACjD,6BAA6B;QAC7B,YAAY;QAEZ,oCAAoC;QAEpC,iBAAiB;QACjB,gBAAgB;QAChB,iDAAiD;QACjD,WAAW;QACX,wBAAwB;QACxB,qCAAqC;QACrC,6BAA6B;QAC7B,yBAAyB;QACzB,gDAAgD;QAChD,0BAA0B;QAC1B,YAAY;QAEZ,iBAAiB;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,gDAAgD;QAChD,WAAW;QACX,QAAQ;QACR,OAAO;QACP,IAAI;QAEJ,2BAA2B;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
\ No newline at end of file
diff --git a/dist/hooks/useDispatchAsyncAction.d.ts b/dist/hooks/useDispatchAsyncAction.d.ts
new file mode 100644
index 0000000..208cbae
--- /dev/null
+++ b/dist/hooks/useDispatchAsyncAction.d.ts
@@ -0,0 +1,2 @@
+import { GXAction } from "../providers/types";
+export default function useDispatchAsyncAction(): (action: GXAction) => any;
diff --git a/dist/hooks/useDispatchAsyncAction.js b/dist/hooks/useDispatchAsyncAction.js
new file mode 100644
index 0000000..37192bc
--- /dev/null
+++ b/dist/hooks/useDispatchAsyncAction.js
@@ -0,0 +1,53 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const react_1 = require("react");
+const contexts_1 = __importDefault(require("../contexts"));
+function useDispatchAsyncAction() {
+ // Global state
+ const { signals } = (0, react_1.useContext)(contexts_1.default);
+ // Some handlers
+ const asyncDispatch = (0, react_1.useCallback)((action) => {
+ const signalName = action.type.split("/")[0];
+ console.log(action.status);
+ const newState = signals.map(({ name, operations, actions, asyncActions, state: prevState }) => {
+ let state = prevState;
+ // Capture the target signal (a state and a bunch of async actions) from the array of signals.
+ // Capture the action from array of async actions (of the target signal).
+ // Run the async action and update the signal state.
+ if (name === signalName) {
+ if (action.isAsync) {
+ for (const { type, steps } of asyncActions) {
+ if (type === action.type) {
+ state = steps.cases
+ .find((c) => c.status === action.status)
+ .handler(state, action.payload);
+ break;
+ }
+ }
+ }
+ }
+ return {
+ name,
+ operations,
+ state,
+ actions,
+ asyncActions,
+ };
+ });
+ // Find the new state of the target signal
+ const signal = newState.find((signal) => signal.name === signalName);
+ // dispatch({
+ // type: action.type,
+ // isAsync: action.isAsync,
+ // status: action.status,
+ // payload: signal.state,
+ // });
+ return signal.state;
+ }, []);
+ return asyncDispatch;
+}
+exports.default = useDispatchAsyncAction;
+//# sourceMappingURL=useDispatchAsyncAction.js.map
\ No newline at end of file
diff --git a/dist/hooks/useDispatchAsyncAction.js.map b/dist/hooks/useDispatchAsyncAction.js.map
new file mode 100644
index 0000000..2ce96d8
--- /dev/null
+++ b/dist/hooks/useDispatchAsyncAction.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"useDispatchAsyncAction.js","sourceRoot":"","sources":["../../src/hooks/useDispatchAsyncAction.ts"],"names":[],"mappings":";;;;;AAAA,iCAAgD;AAChD,2DAAoC;AAIpC,SAAwB,sBAAsB;IAC5C,eAAe;IACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAU,EAAC,kBAAS,CAAC,CAAC;IAE1C,gBAAgB;IA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AK,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,aAAa,CAAC;AACvB,CAAC;AAtDD,yCAsDC"}
\ No newline at end of file
diff --git a/dist/hooks/useOperations.d.ts b/dist/hooks/useOperations.d.ts
index e7361e3..d3c26e8 100644
--- a/dist/hooks/useOperations.d.ts
+++ b/dist/hooks/useOperations.d.ts
@@ -1,3 +1,3 @@
-import { Operations } from "./types.js";
-declare const useOperations: >(signalName: string) => T;
+import { type Operations } from './types.js';
+declare const useOperations: (signalName: string) => T;
export default useOperations;
diff --git a/dist/hooks/useOperations.js b/dist/hooks/useOperations.js
index e4418b5..f637acb 100644
--- a/dist/hooks/useOperations.js
+++ b/dist/hooks/useOperations.js
@@ -8,8 +8,9 @@ const index_js_1 = __importDefault(require("../contexts/index.js"));
const useOperations = (signalName) => {
// Get Global Context
const { signals } = (0, react_1.useContext)(index_js_1.default);
- if (!signalName || typeof signalName !== "string")
- throw new Error("Provide a signalName as a first argument of useOperations");
+ if (!signalName || typeof signalName !== 'string') {
+ throw new Error('Provide a signalName as a first argument of useOperations');
+ }
const handleFormatOperations = () => {
const signal = signals.find((signal) => signal.name === signalName);
if (!signal)
@@ -20,7 +21,7 @@ const useOperations = (signalName) => {
const formattedOperations = {};
for (const operation of nonFormattedOperations) {
// Get action name
- const operationName = operation.type.split("/")[1];
+ const operationName = operation.type.split('/')[1];
formattedOperations[operationName] = (payload) => {
return operation.handler(signal.state, payload);
};
diff --git a/dist/hooks/useOperations.js.map b/dist/hooks/useOperations.js.map
index a223b5a..a38cc2a 100644
--- a/dist/hooks/useOperations.js.map
+++ b/dist/hooks/useOperations.js.map
@@ -1 +1 @@
-{"version":3,"file":"useOperations.js","sourceRoot":"","sources":["../../src/hooks/useOperations.ts"],"names":[],"mappings":";;;;;AAAA,iCAAmC;AACnC,oEAA6C;AAG7C,MAAM,aAAa,GAAG,CAAiB,UAAkB,EAAE,EAAE;IAC3D,qBAAqB;IACrB,MAAM,EAAE,OAAO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EL,6BAA6B;AAC7B,iEAAiE;AACjE,4BAA4B;AAC5B,gCAAgC;AAChC,KAAK;AAEL,qFAAqF;AACrF,6EAA6E;AAE7E,0FAA0F;AAC1F,4EAA4E;AAE5E,kBAAe,aAAa,CAAA"}
\ No newline at end of file
diff --git a/dist/hooks/useSignal.js.map b/dist/hooks/useSignal.js.map
index 82b4d16..a29cc3b 100644
--- a/dist/hooks/useSignal.js.map
+++ b/dist/hooks/useSignal.js.map
@@ -1 +1 @@
-{"version":3,"file":"useSignal.js","sourceRoot":"","sources":["../../src/hooks/useSignal.ts"],"names":[],"mappings":";;;;;AAAA,iCAA4C;AAC5C,oEAA6C;AAE7C,MAAM,SAAS,GAAG,CAAU,UAAkB,EAAE,EAAE;IAChD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAU,EAAC,kBAAS,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAE1D;;;;OAIG;IACH,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAK,EAAE;QACrD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAE1E,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAC,KAAK,CAAC;SACrB;QAED,kCAAkC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,UAAU,YAAY,CAAC,CAAC;IACpD,CAAC,CAAA;IAED,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
\ No newline at end of file
+{"version":3,"file":"useSignal.js","sourceRoot":"","sources":["../../src/hooks/useSignal.ts"],"names":[],"mappings":";;;;;AAAA,iCAA2C;AAC3C,oEAA4C;AAE5C,MAAM,SAAS,GAAG,CAAU,UAAkB,EAAE,EAAE;IAChD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAU,EAAC,kBAAS,CAAC,CAAA;IACzC,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzD;;;;OAIG;IACH,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAK,EAAE;QACrD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;QAEzE,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAC,KAAK,CAAA;SACpB;QAED,kCAAkC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,UAAU,YAAY,CAAC,CAAA;IACnD,CAAC,CAAA;IAED,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA"}
\ No newline at end of file
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 5adcfbc..1ff5554 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -1,9 +1,12 @@
-import createSignal from "./helpers/createSignal.js";
-import createStore from "./helpers/createStore.js";
-import GXProvider from "./providers/index.js";
-import useAction from "./hooks/useAction.js";
-import useActions from "./hooks/useActions.js";
-import useSignal from "./hooks/useSignal.js";
-import useOperations from "./hooks/useOperations.js";
+import GXProvider from './providers/index.js';
+import { AsyncActionStatuses } from './helpers/types.js';
+import createSignal from './helpers/createSignal.js';
+import createStore from './helpers/createStore.js';
+import createAsyncAction from './helpers/createAsyncAction.js';
+import useAction from './hooks/useAction.js';
+import useActions from './hooks/useActions.js';
+import useAsyncActions from './hooks/useAsyncActions.js';
+import useSignal from './hooks/useSignal.js';
+import useOperations from './hooks/useOperations.js';
export default GXProvider;
-export { createSignal, createStore, useAction, useActions, useSignal, useOperations, };
+export { createSignal, createStore, createAsyncAction, useAction, useActions, useAsyncActions, useSignal, useOperations, AsyncActionStatuses };
diff --git a/dist/index.js b/dist/index.js
index 8f1e20d..0833468 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -3,16 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-exports.useOperations = exports.useSignal = exports.useActions = exports.useAction = exports.createStore = exports.createSignal = void 0;
+exports.AsyncActionStatuses = exports.useOperations = exports.useSignal = exports.useAsyncActions = exports.useActions = exports.useAction = exports.createAsyncAction = exports.createStore = exports.createSignal = void 0;
+// Provider
+const index_js_1 = __importDefault(require("./providers/index.js"));
+// Constants
+const types_js_1 = require("./helpers/types.js");
+Object.defineProperty(exports, "AsyncActionStatuses", { enumerable: true, get: function () { return types_js_1.AsyncActionStatuses; } });
+// Helpers functions
const createSignal_js_1 = __importDefault(require("./helpers/createSignal.js"));
exports.createSignal = createSignal_js_1.default;
const createStore_js_1 = __importDefault(require("./helpers/createStore.js"));
exports.createStore = createStore_js_1.default;
-const index_js_1 = __importDefault(require("./providers/index.js"));
+const createAsyncAction_js_1 = __importDefault(require("./helpers/createAsyncAction.js"));
+exports.createAsyncAction = createAsyncAction_js_1.default;
+// Hooks
const useAction_js_1 = __importDefault(require("./hooks/useAction.js"));
exports.useAction = useAction_js_1.default;
const useActions_js_1 = __importDefault(require("./hooks/useActions.js"));
exports.useActions = useActions_js_1.default;
+const useAsyncActions_js_1 = __importDefault(require("./hooks/useAsyncActions.js"));
+exports.useAsyncActions = useAsyncActions_js_1.default;
const useSignal_js_1 = __importDefault(require("./hooks/useSignal.js"));
exports.useSignal = useSignal_js_1.default;
const useOperations_js_1 = __importDefault(require("./hooks/useOperations.js"));
diff --git a/dist/index.js.map b/dist/index.js.map
index 15c3f2f..07bef4d 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gFAAqD;AAYnD,uBAZK,yBAAY,CAYL;AAXd,8EAAmD;AAYjD,sBAZK,wBAAW,CAYL;AAXb,oEAA8C;AAE9C,wEAA6C;AAU3C,oBAVK,sBAAS,CAUL;AATX,0EAA+C;AAU7C,qBAVK,uBAAU,CAUL;AATZ,wEAA6C;AAU3C,oBAVK,sBAAS,CAUL;AATX,gFAAqD;AAUnD,wBAVK,0BAAa,CAUL;AARf,kBAAe,kBAAU,CAAC;AAW1B,uGAAuG"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,WAAW;AACX,oEAA6C;AAE7C,YAAY;AACZ,iDAAwD;AAyBtD,oGAzBO,8BAAmB,OAyBP;AAvBrB,oBAAoB;AACpB,gFAAoD;AAclD,uBAdK,yBAAY,CAcL;AAbd,8EAAkD;AAchD,sBAdK,wBAAW,CAcL;AAbb,0FAA8D;AAc5D,4BAdK,8BAAiB,CAcL;AAZnB,QAAQ;AACR,wEAA4C;AAY1C,oBAZK,sBAAS,CAYL;AAXX,0EAA8C;AAY5C,qBAZK,uBAAU,CAYL;AAXZ,oFAAwD;AAYtD,0BAZK,4BAAe,CAYL;AAXjB,wEAA4C;AAY1C,oBAZK,sBAAS,CAYL;AAXX,gFAAoD;AAYlD,wBAZK,0BAAa,CAYL;AAVf,kBAAe,kBAAU,CAAA;AAczB,uGAAuG"}
\ No newline at end of file
diff --git a/dist/interfaces/builder.d.ts b/dist/interfaces/builder.d.ts
new file mode 100644
index 0000000..27e9cfe
--- /dev/null
+++ b/dist/interfaces/builder.d.ts
@@ -0,0 +1,10 @@
+import { type CreateAsyncActionReturnType } from '../helpers/types.js';
+import type IBuilderCase from './builderCase.js';
+export default interface IBuilder {
+ use: (asyncAction: CreateAsyncActionReturnType) => IBuilderCase;
+}
+export declare class Builder implements IBuilder {
+ private readonly _builderCase;
+ constructor();
+ use(asyncAction: CreateAsyncActionReturnType): IBuilderCase;
+}
diff --git a/dist/interfaces/builder.js b/dist/interfaces/builder.js
new file mode 100644
index 0000000..e7f71c7
--- /dev/null
+++ b/dist/interfaces/builder.js
@@ -0,0 +1,15 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Builder = void 0;
+const builderCase_js_1 = require("./builderCase.js");
+class Builder {
+ constructor() {
+ this._builderCase = new builderCase_js_1.BuilderCase();
+ }
+ use(asyncAction) {
+ this._builderCase.asyncAction = asyncAction;
+ return this._builderCase;
+ }
+}
+exports.Builder = Builder;
+//# sourceMappingURL=builder.js.map
\ No newline at end of file
diff --git a/dist/interfaces/builder.js.map b/dist/interfaces/builder.js.map
new file mode 100644
index 0000000..d422a91
--- /dev/null
+++ b/dist/interfaces/builder.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/interfaces/builder.ts"],"names":[],"mappings":";;;AAEA,qDAA8C;AAM9C,MAAa,OAAO;IAGlB;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAW,EAAE,CAAA;IACvC,CAAC;IAED,GAAG,CAAE,WAAwC;QAC3C,IAAI,CAAC,YAAY,CAAC,WAAW,GAAG,WAAW,CAAA;QAE3C,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;CACF;AAZD,0BAYC"}
\ No newline at end of file
diff --git a/dist/interfaces/builderCase.d.ts b/dist/interfaces/builderCase.d.ts
new file mode 100644
index 0000000..87d37ea
--- /dev/null
+++ b/dist/interfaces/builderCase.d.ts
@@ -0,0 +1,68 @@
+import { type AsyncActionStatusesType, type CreateAsyncActionReturnType } from '../helpers/types.js';
+/**
+ * Interface for builder case
+ */
+export default interface IBuilderCase {
+ case: (status: AsyncActionStatusesType, handler: (state: T, payload?: P) => T) => IBuilderCase;
+ onPending: (handler: (state: T, payload?: P) => T) => IBuilderCase;
+ onFulfilled: (handler: (state: T, payload?: P) => T) => IBuilderCase;
+ onRejected: (handler: (state: T, payload?: P) => T) => IBuilderCase;
+}
+/**
+ * Builder case class for managing different cases of the asynchronous task
+ * @param _cases List of cases defined for a specific asynchronous task
+ */
+export declare class BuilderCase implements IBuilderCase {
+ private _cases;
+ private _asyncAction;
+ constructor();
+ /**
+ * Get the list of cases
+ */
+ get cases(): Array>;
+ /**
+ * Get the async action
+ */
+ get asyncAction(): CreateAsyncActionReturnType;
+ /**
+ * Update the async action
+ * @param asyncAction Async Action value
+ */
+ set asyncAction(asyncAction: CreateAsyncActionReturnType);
+ /**
+ * Update the cases
+ */
+ set cases(cases: Array>);
+ /**
+ * Method that add a new case into the _cases list and return a new case builder object
+ * @param status Status of the asynchronous task
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ case(status: AsyncActionStatusesType, handler: (state: T, payload?: P) => T): IBuilderCase;
+ /**
+ * Method that add a pending case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onPending(handler: (state: T, payload?: P) => T): IBuilderCase;
+ /**
+ * Method that add a fulfilled case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onFulfilled(handler: (state: T, payload?: P) => T): IBuilderCase;
+ /**
+ * Method that add a rejected case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ **/
+ onRejected(handler: (state: T, payload?: P) => T): IBuilderCase;
+}
+/**
+ * Case interface
+ */
+export interface Case {
+ status: AsyncActionStatusesType;
+ handler: (state: T, payload?: P) => T;
+}
diff --git a/dist/interfaces/builderCase.js b/dist/interfaces/builderCase.js
new file mode 100644
index 0000000..c7f97b9
--- /dev/null
+++ b/dist/interfaces/builderCase.js
@@ -0,0 +1,80 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.BuilderCase = void 0;
+const types_js_1 = require("../helpers/types.js");
+/**
+ * Builder case class for managing different cases of the asynchronous task
+ * @param _cases List of cases defined for a specific asynchronous task
+ */
+class BuilderCase {
+ constructor() {
+ this._cases = [];
+ this._asyncAction = undefined;
+ }
+ // Getters
+ /**
+ * Get the list of cases
+ */
+ get cases() {
+ return this._cases;
+ }
+ /**
+ * Get the async action
+ */
+ get asyncAction() {
+ return this._asyncAction;
+ }
+ // Setters
+ /**
+ * Update the async action
+ * @param asyncAction Async Action value
+ */
+ set asyncAction(asyncAction) {
+ this._asyncAction = asyncAction;
+ }
+ /**
+ * Update the cases
+ */
+ set cases(cases) {
+ this._cases = cases;
+ }
+ /**
+ * Method that add a new case into the _cases list and return a new case builder object
+ * @param status Status of the asynchronous task
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ case(status, handler) {
+ this._cases.push({
+ status,
+ handler
+ });
+ return this;
+ }
+ /**
+ * Method that add a pending case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onPending(handler) {
+ return this.case(types_js_1.AsyncActionStatuses.PENDING, handler);
+ }
+ /**
+ * Method that add a fulfilled case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onFulfilled(handler) {
+ return this.case(types_js_1.AsyncActionStatuses.FULFILLED, handler);
+ }
+ /**
+ * Method that add a rejected case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ **/
+ onRejected(handler) {
+ return this.case(types_js_1.AsyncActionStatuses.REJECTED, handler);
+ }
+}
+exports.BuilderCase = BuilderCase;
+//# sourceMappingURL=builderCase.js.map
\ No newline at end of file
diff --git a/dist/interfaces/builderCase.js.map b/dist/interfaces/builderCase.js.map
new file mode 100644
index 0000000..c566661
--- /dev/null
+++ b/dist/interfaces/builderCase.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"builderCase.js","sourceRoot":"","sources":["../../src/interfaces/builderCase.ts"],"names":[],"mappings":";;;AAAA,kDAI4B;AAkB5B;;;GAGG;AACH,MAAa,WAAW;IAItB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAA;IAC/B,CAAC;IAED,UAAU;IAEV;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED,UAAU;IAEV;;;OAGG;IACH,IAAI,WAAW,CAAE,WAAwC;QACvD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK,CAAE,KAAwB;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAED;;;;;OAKG;IACH,IAAI,CACF,MAA+B,EAC/B,OAAqC;QAErC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACf,MAAM;YACN,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAE,OAAqC;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,8BAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,OAAqC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,8BAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED;;;;QAII;IACJ,UAAU,CAAE,OAAqC;QAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,8BAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACzD,CAAC;CACF;AAtFD,kCAsFC"}
\ No newline at end of file
diff --git a/dist/providers/index.d.ts b/dist/providers/index.d.ts
index 18daece..74360e0 100644
--- a/dist/providers/index.d.ts
+++ b/dist/providers/index.d.ts
@@ -1,3 +1,3 @@
///
-import { GXProviderProps } from "./types.js";
+import { type GXProviderProps } from "./types.js";
export default function GXProvider({ children, store }: GXProviderProps): JSX.Element;
diff --git a/dist/providers/index.js b/dist/providers/index.js
index a6be43f..019670a 100644
--- a/dist/providers/index.js
+++ b/dist/providers/index.js
@@ -4,19 +4,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
-const react_1 = require("react");
+const react_1 = __importDefault(require("react"));
+const react_2 = require("react");
const index_js_1 = __importDefault(require("../contexts/index.js"));
const reducer_js_1 = __importDefault(require("./reducer.js"));
function GXProvider({ children, store }) {
// Global state that manage all signals
- const [signals, dispatch] = (0, react_1.useReducer)(reducer_js_1.default, store.getSignals());
+ const [signals, dispatch] = (0, react_2.useReducer)(reducer_js_1.default, store.getSignals());
+ // Wrap your dispatch function with useTransition
+ const [, startTransition] = (0, react_2.useTransition)();
+ // Your state management logic using useContext and useReducer
+ const syncDispatch = (action) => {
+ startTransition(() => {
+ dispatch(action);
+ });
+ };
+ const asyncDispatch = (0, react_2.useCallback)((action) => {
+ const signalName = action.type.split("/")[0];
+ console.log(action.status);
+ const newState = signals.map(({ name, operations, actions, asyncActions, state: prevState }) => {
+ let state = prevState;
+ // Capture the target signal (a state and a bunch of async actions) from the array of signals.
+ // Capture the action from array of async actions (of the target signal).
+ // Run the async action and update the signal state.
+ if (name === signalName) {
+ if (action.isAsync) {
+ for (const { type, steps } of asyncActions) {
+ if (type === action.type) {
+ state = steps.cases
+ .find((c) => c.status === action.status)
+ .handler(state, action.payload);
+ break;
+ }
+ }
+ }
+ }
+ return {
+ name,
+ operations,
+ state,
+ actions,
+ asyncActions,
+ };
+ });
+ // Find the new state of the target signal
+ const signal = newState.find((signal) => signal.name === signalName);
+ dispatch({
+ type: action.type,
+ isAsync: action.isAsync,
+ status: action.status,
+ payload: signal.state,
+ });
+ return signal.state;
+ }, []);
+ // Ref
+ const asyncActionRef = react_1.default.useRef(asyncDispatch);
// Context value
const contextValue = {
signals,
- dispatch,
+ dispatch: syncDispatch,
+ asyncDispatch: asyncActionRef.current,
};
- return ((0, jsx_runtime_1.jsx)(index_js_1.default.Provider, Object.assign({ value: contextValue }, { children: children })));
+ return ((0, jsx_runtime_1.jsx)(index_js_1.default.Provider, { value: contextValue, children: children }));
}
exports.default = GXProvider;
-;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/providers/index.js.map b/dist/providers/index.js.map
index a5d901b..a4d3b70 100644
--- a/dist/providers/index.js.map
+++ b/dist/providers/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAAmC;AACnC,oEAA6C;AAE7C,8DAAqC;AAErC,SAAwB,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAmB;IACrE,uCAAuC;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,IAAA,kBAAU,EAAC,oBAAS,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAEtE,gBAAgB;IAChB,MAAM,YAAY,GAAG;QACnB,OAAO;QACP,QAAQ;KACT,CAAC;IAEF,OAAO,CACL,uBAAC,kBAAS,CAAC,QAAQ,kBAAC,KAAK,EAAE,YAAY,gBAAG,QAAQ,IAAsB,CACzE,CAAC;AACJ,CAAC;AAbD,6BAaC;AAAA,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyC;AACzC,iCAA+D;AAC/D,oEAA6C;AAE7C,8DAAqC;AAGrC,SAAwB,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAmB;IACrE,uCAAuC;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,IAAA,kBAAU,EAAC,oBAAS,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAEtE,iDAAiD;IACjD,MAAM,CAAC,EAAE,eAAe,CAAC,GAAG,IAAA,qBAAa,GAAE,CAAC;IAE5C,8DAA8D;IAC9D,MAAM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M,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAErE,QAAQ,CAAC;YACP,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,KAAK;SACtB,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAGP,MAAM;IACN,MAAM,cAAc,GAAG,eAAK,CAAC,MAAM,CAA4B,aAAa,CAAC,CAAC;IAE9E,gBAAgB;IAChB,MAAM,YAAY,GAAG;QACnB,OAAO;QACP,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,cAAc,CAAC,OAAO;KACtC,CAAC;IAEF,OAAO,CACL,uBAAC,kBAAS,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,QAAQ,GAAsB,CACzE,CAAC;AACJ,CAAC;AA5ED,6BA4EC"}
\ No newline at end of file
diff --git a/dist/providers/reducer.d.ts b/dist/providers/reducer.d.ts
index eb27cc6..432290c 100644
--- a/dist/providers/reducer.d.ts
+++ b/dist/providers/reducer.d.ts
@@ -1,4 +1,4 @@
-import { GXSignalType } from "../contexts/types.js";
-import { GXAction } from "./types.js";
+import { type GXSignalType } from '../contexts/types.js';
+import { type GXAction } from './types.js';
declare const gxReducer: (signals: GXSignalType[], action: GXAction) => GXSignalType[];
export default gxReducer;
diff --git a/dist/providers/reducer.js b/dist/providers/reducer.js
index 95f2740..2954e2b 100644
--- a/dist/providers/reducer.js
+++ b/dist/providers/reducer.js
@@ -1,26 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const gxReducer = (signals, action) => {
- // Loop through all signals, make updates on states
+ const signalName = action.type.split('/')[0];
+ // Loop through all signals, make updates on targeted states
// and returns a new array of signals (immutability).
- return signals.map(({ name, operations, actions, state: prevState }) => {
+ return signals.map(({ name, operations, actions, asyncActions, state: prevState }) => {
let state = prevState;
// Capture the target signal (a state and a bunch of actions) from the array of signals.
// Capture the action from array of actions (of the target signal).
// Run the action and update the signal state.
- if (name === action.type.split("/")[0]) {
- for (let { type, handler } of actions) {
- if (type === action.type) {
- state = handler(prevState, action.payload);
- break;
+ if (name === signalName) {
+ if (!action.isAsync) {
+ for (const { type, handler } of actions) {
+ if (type === action.type) {
+ state = handler(prevState, action.payload);
+ break;
+ }
}
}
+ else {
+ state = action.payload;
+ }
}
return {
name,
operations,
state,
actions,
+ asyncActions
};
});
};
diff --git a/dist/providers/reducer.js.map b/dist/providers/reducer.js.map
index 310fbfd..ed5747e 100644
--- a/dist/providers/reducer.js.map
+++ b/dist/providers/reducer.js.map
@@ -1 +1 @@
-{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/providers/reducer.ts"],"names":[],"mappings":";;AAGA,MAAM,SAAS,GAAG,CAChB,OAAuB,EACvB,MAAgB,EACA,EAAE;IAClB,mDAAmD;IACnD,qDAAqD;IACrD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;QACrE,IAAI,KAAK,GAAG,SAAS,CAAC;QAEtB,wFAAwF;QACxF,mEAAmE;QACnE,8CAA8C;QAC9C,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;YACtC,KAAK,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE;gBACrC,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE;oBACxB,KAAK,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC3C,MAAM;iBACP;aACF;SACF;QAED,OAAO;YACL,IAAI;YACJ,UAAU;YACV,KAAK;YACL,OAAO;SACR,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
\ No newline at end of file
+{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/providers/reducer.ts"],"names":[],"mappings":";;AAGA,MAAM,SAAS,GAAG,CAChB,OAAuB,EACvB,MAAgB,EACA,EAAE;IAClB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5C,4DAA4D;IAC5D,qDAAqD;IACrD,OAAO,OAAO,CAAC,GAAG,CAChB,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;QAChE,IAAI,KAAK,GAAG,SAAS,CAAA;QAErB,wFAAwF;QACxF,mEAAmE;QACnE,8CAA8C;QAC9C,IAAI,IAAI,KAAK,UAAU,EAAE;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;gBACnB,KAAK,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE;oBACvC,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE;wBACxB,KAAK,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;wBAC1C,MAAK;qBACN;iBACF;aACF;iBAAM;gBACL,KAAK,GAAG,MAAM,CAAC,OAAO,CAAA;aACvB;SACF;QAED,OAAO;YACL,IAAI;YACJ,UAAU;YACV,KAAK;YACL,OAAO;YACP,YAAY;SACb,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA"}
\ No newline at end of file
diff --git a/dist/providers/types.d.ts b/dist/providers/types.d.ts
index dd63d14..617388d 100644
--- a/dist/providers/types.d.ts
+++ b/dist/providers/types.d.ts
@@ -1,10 +1,18 @@
///
-import { CreateStoreType } from '../helpers/types.js';
-export type GXProviderProps = {
+import { type AsyncActionStatusesType, type CreateStoreType } from '../helpers/types.js';
+/**
+ * Props of the GX Provider
+ */
+export interface GXProviderProps {
children: React.ReactElement;
store: CreateStoreType;
-};
-export type GXAction = {
+}
+/**
+ * Type of the actions
+ */
+export interface GXAction {
type: string;
- payload: any;
-};
+ isAsync: boolean;
+ status?: AsyncActionStatusesType;
+ payload?: any;
+}
diff --git a/package.json b/package.json
index 26dc140..7a31f12 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dilane3/gx",
- "version": "1.3.0",
+ "version": "1.4.0",
"private": false,
"license": "MIT",
"main": "dist/index.js",
@@ -28,9 +28,17 @@
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
+ "eslint": "^8.0.1",
+ "eslint-config-standard-with-typescript": "^39.0.0",
+ "eslint-plugin-immutable": "^1.0.0",
+ "eslint-plugin-import": "^2.25.2",
+ "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
+ "eslint-plugin-promise": "^6.0.0",
+ "eslint-plugin-react": "^7.33.2",
"react-dom": "^18.0.0",
"react-scripts": "^5.0.1",
- "typescript": "^4.4.2"
+ "typescript": "*"
},
"peerDependencies": {
"react": "^18.0.0"
@@ -38,7 +46,8 @@
"scripts": {
"build": "tsc",
"test": "react-scripts test",
- "deploy": "npm publish --access public"
+ "deploy": "npm publish --access public",
+ "lint": "npx eslint src --ext .ts,.tsx"
},
"keywords": [
"react",
diff --git a/src/contexts/index.ts b/src/contexts/index.ts
index e3299c4..256ce0f 100644
--- a/src/contexts/index.ts
+++ b/src/contexts/index.ts
@@ -1,9 +1,10 @@
-import { createContext } from "react";
-import { GXContextType } from "./types.js";
+import { createContext } from 'react'
+import { type GXContextType } from './types.js'
const GXContext = createContext({
signals: [],
dispatch: () => {},
-});
+ asyncDispatch: () => {}
+})
-export default GXContext;
+export default GXContext
diff --git a/src/contexts/types.ts b/src/contexts/types.ts
index e4dccbb..5374acb 100644
--- a/src/contexts/types.ts
+++ b/src/contexts/types.ts
@@ -1,47 +1,80 @@
-import { GXAction } from "../providers/types.js";
+import type IBuilderCase from '../interfaces/builderCase.js'
+import { type GXAction } from '../providers/types.js'
-export type GXSignalType = {
+/**
+ * Type that represents a signal
+ */
+export interface GXSignalType {
// Name of the signal
- name: string;
+ name: string
// State inside the signal
- state: T,
+ state: T
// Actions of the signal
- actions: GXActionType[],
+ actions?: Array>
- // Operation of the signal
- operations?: GXOperationType[]
+ // Operations of the signal
+ operations?: Array>
+
+ // Async actions of the signal
+ asyncActions?: Array>
}
-export type GXActionType = {
+/**
+ * Type that represents Actions
+ */
+export interface GXActionType {
// Represent the type of the action
- type: string,
+ type: string
// The handler function
handler: (state: T, payload: P) => T
}
-export type GXOperationType = {
+/**
+ * Type that represents operations
+ */
+export interface GXOperationType {
// Represent the type of the operation
- type: string,
+ type: string
// The handle function
handler: (state: T, payload: P) => Q
}
-export type DispatchedActionType = {
+/**
+ * Type that represents async actions
+ */
+export interface GXAsyncActionType {
+ // Represent the type of the operation
+ type: string
+
+ // List of cases
+ steps: IBuilderCase
+}
+
+/**
+ * Type of dispatched action
+ */
+export interface DispatchedActionType {
// The type of the action
- type: string,
+ type: string
// The payload of the action
payload: any
}
-export type GXContextType = {
+/**
+ * Type of the signals context
+ */
+export interface GXContextType {
// Signals
- signals: GXSignalType[],
+ signals: GXSignalType[]
// Dispatch
dispatch: React.Dispatch
-}
\ No newline at end of file
+
+ // Async Dispatch
+ asyncDispatch: (action: GXAction) => any
+}
diff --git a/src/helpers/createAsyncAction.ts b/src/helpers/createAsyncAction.ts
new file mode 100644
index 0000000..b28bfef
--- /dev/null
+++ b/src/helpers/createAsyncAction.ts
@@ -0,0 +1,23 @@
+import {
+ AsyncActionStatuses,
+ type CreateAsyncActionProp,
+ type CreateAsyncActionReturnType
+} from './types.js'
+
+/**
+ * This function create an async action with different statuses
+ * @param handler Function that perform asynchronous task
+ * @returns
+ */
+const createAsyncAction = (
+ handler: CreateAsyncActionProp
+): CreateAsyncActionReturnType => {
+ return {
+ pending: AsyncActionStatuses.PENDING,
+ fulfilled: AsyncActionStatuses.FULFILLED,
+ rejected: AsyncActionStatuses.REJECTED,
+ handler
+ }
+}
+
+export default createAsyncAction
diff --git a/src/helpers/createSignal.ts b/src/helpers/createSignal.ts
index 74faa4d..a5e6cc3 100644
--- a/src/helpers/createSignal.ts
+++ b/src/helpers/createSignal.ts
@@ -1,5 +1,10 @@
-import { CreateSignalOptionType } from "./types.js";
-import { GXActionType, GXOperationType } from "../contexts/types.js";
+import { type CreateSignalOptionType } from './types.js'
+import {
+ type GXActionType,
+ type GXAsyncActionType,
+ type GXOperationType
+} from '../contexts/types.js'
+import { Builder } from '../interfaces/builder.js'
/**
* Create a signal with a state and actions for managing this state
@@ -7,27 +12,42 @@ import { GXActionType, GXOperationType } from "../contexts/types.js";
* @returns
*/
const createSignal = (options: CreateSignalOptionType) => {
- const actions: GXActionType[] = [];
- const operations: GXOperationType[] = [];
+ const actions: Array> = []
+ const operations: Array> = []
+ const asyncActions: Array> = []
// Convert the actions object to an array
- const actionsTable = Object.entries(options.actions);
+ const actionsTable = Object.entries(options.actions || {})
- for (let action of actionsTable) {
+ for (const action of actionsTable) {
actions.push({
type: `${options.name}/${action[0]}`,
- handler: action[1],
- });
+ handler: action[1]
+ })
}
// Convert the operations object to an array
- const operationsTable = Object.entries(options.operations || {});
+ const operationsTable = Object.entries(options.operations || {})
- for (let operation of operationsTable) {
+ for (const operation of operationsTable) {
operations.push({
type: `${options.name}/${operation[0]}`,
- handler: operation[1],
- });
+ handler: operation[1]
+ })
+ }
+
+ // Convert the async Actions object to an array
+ const builder = new Builder()
+
+ const asyncActionsTable = Object.entries(
+ options.asyncActions ? options.asyncActions(builder) : {}
+ )
+
+ for (const action of asyncActionsTable) {
+ asyncActions.push({
+ type: `${options.name}/${action[0]}`,
+ steps: action[1]
+ })
}
// Create a signal
@@ -36,9 +56,10 @@ const createSignal = (options: CreateSignalOptionType) => {
state: options.state,
actions,
operations,
- };
+ asyncActions
+ }
- return signal;
-};
+ return signal
+}
-export default createSignal;
+export default createSignal
diff --git a/src/helpers/createStore.ts b/src/helpers/createStore.ts
index 1978c8f..495eb50 100644
--- a/src/helpers/createStore.ts
+++ b/src/helpers/createStore.ts
@@ -1,10 +1,15 @@
-import { GXSignalType } from "../contexts/types.js";
-import { CreateStoreType } from "./types.js";
+import { type GXSignalType } from '../contexts/types.js'
+import { type CreateStoreType } from './types.js'
+/**
+ * Function that create a store by collection a list of signals
+ * @param signals List of signals
+ * @returns
+ */
const createStore = (signals: GXSignalType[]): CreateStoreType => {
return {
- getSignals: () => signals,
- };
-};
+ getSignals: () => signals
+ }
+}
-export default createStore;
+export default createStore
diff --git a/src/helpers/types.ts b/src/helpers/types.ts
index 4475df0..433cb00 100644
--- a/src/helpers/types.ts
+++ b/src/helpers/types.ts
@@ -1,20 +1,64 @@
-import { GXSignalType } from "../contexts/types.js";
+import { type GXSignalType } from '../contexts/types.js'
+import { type Builder } from '../interfaces/builder.js'
+import type IBuilderCase from '../interfaces/builderCase.js'
-export type CreateSignalOptionType = {
- name: string;
- state: T;
- actions: Action;
- operations?: Operation;
+/**
+ * Type of the create signal option function
+ */
+export interface CreateSignalOptionType {
+ // Name of the signal
+ name: string
+
+ // State of the signal
+ state: T
+
+ // Actions of the signal
+ actions?: Action
+
+ // Operations of the signal
+ operations?: Operation
+
+ // Async actions of the signal
+ asyncActions?: AsyncAction
}
-export type CreateStoreType = {
+/**
+ * Type of the returned data of create store function
+ */
+export interface CreateStoreType {
+ // Function that return the list of signals
getSignals: () => GXSignalType[]
}
-export type Action = {
- [key: string]: (state: T, payload: any) => T
+/**
+ * Type of Action
+ */
+export type Action = Record T>
+
+/**
+ * Type of Operation
+ */
+export type Operation = Record any>
+
+/**
+ * Type of Async Action
+ */
+export type AsyncAction = (builder: Builder) => Record>
+
+export type CreateAsyncActionProp = (payload?: any) => Promise
+
+export interface CreateAsyncActionReturnType {
+ pending: AsyncActionStatusesType
+ fulfilled: AsyncActionStatusesType
+ rejected: AsyncActionStatusesType
+ handler: CreateAsyncActionProp
}
-export type Operation = {
- [key: string]: (state: T, payload?: any) => any
-}
\ No newline at end of file
+export const AsyncActionStatuses = {
+ PENDING: 'PENDING',
+ FULFILLED: 'FULFILLED',
+ REJECTED: 'REJECTED'
+} as const
+
+export type AsyncActionStatusesType =
+ (typeof AsyncActionStatuses)[keyof typeof AsyncActionStatuses]
diff --git a/src/hooks/types.ts b/src/hooks/types.ts
index 54e955a..bb37ebf 100644
--- a/src/hooks/types.ts
+++ b/src/hooks/types.ts
@@ -1,7 +1,10 @@
-export type Actions = {
- [key: string]: (payload?: any) => void
-}
+import { type AsyncActionStatusesType } from '../helpers/types'
-export type Operations = {
- [key: string]: (payload?: any) => P
-}
\ No newline at end of file
+export type Actions = Record void>
+
+export type AsyncActions = Record Promise<{
+ data: T
+ status: Omit
+}>>
+
+export type Operations = Record P>
diff --git a/src/hooks/useAction.ts b/src/hooks/useAction.ts
index d4545ef..73fbae3 100644
--- a/src/hooks/useAction.ts
+++ b/src/hooks/useAction.ts
@@ -1,16 +1,14 @@
-import { Actions } from "./types.js";
-import useActions from "./useActions.js";
+import { type Actions } from './types.js'
+import useActions from './useActions.js'
const useAction = (signalName: string, action: string) => {
- if (!signalName || typeof signalName !== "string")
- throw new Error("Provide a signalName as a first argument of useAction");
+ if (!signalName || typeof signalName !== 'string') { throw new Error('Provide a signalName as a first argument of useAction') }
- if (!action || typeof action !== "string")
- throw new Error("Provide an action as second argument of useAction");
+ if (!action || typeof action !== 'string') { throw new Error('Provide an action as second argument of useAction') }
- const actions = useActions(signalName, action);
+ const actions = useActions(signalName, action)
- return Object.values(actions)[0];
-};
+ return Object.values(actions)[0]
+}
-export default useAction;
+export default useAction
diff --git a/src/hooks/useActions.ts b/src/hooks/useActions.ts
index 1498c88..330b7d7 100644
--- a/src/hooks/useActions.ts
+++ b/src/hooks/useActions.ts
@@ -1,14 +1,18 @@
-import { useContext } from "react";
-import GXContext from "../contexts/index.js";
-import { GXActionType } from "../contexts/types.js";
-import { Actions } from "./types.js";
-
-const useActions = (signalName: string, ...actions: string[]) => {
- if (!signalName || typeof signalName !== "string")
- throw new Error("Provide a signalName as first argument of useActions");
+import { useContext } from 'react'
+import GXContext from '../contexts/index.js'
+import { type GXActionType } from '../contexts/types.js'
+import { type Actions } from './types.js'
+
+const useActions = (
+ signalName: string,
+ ...actions: string[]
+): T => {
+ if (!signalName || typeof signalName !== 'string') {
+ throw new Error('Provide a signalName as first argument of useActions')
+ }
// Get Global Context
- const { signals, dispatch } = useContext(GXContext);
+ const { signals, dispatch } = useContext(GXContext)
// Some handlers
@@ -18,51 +22,52 @@ const useActions = (signalName: string, ...actions: string[]) => {
* @returns
*/
const handleGetActions = (signalName: string) => {
- const signal = signals.find((signal) => signal.name === signalName);
+ const signal = signals.find((signal) => signal.name === signalName)
if (signal) {
- if (!actions || actions.length === 0) return signal.actions;
+ if (!actions || actions.length === 0) return signal.actions
- const filteredActions: GXActionType[] = [];
+ const filteredActions: Array> = []
- for (let action of actions) {
- const actionName = `${signalName}/${action}`;
+ for (const action of actions) {
+ const actionName = `${signalName}/${action}`
const retrievedAction = signal.actions.find(
(act) => act.type === actionName
- );
+ )
- if (retrievedAction) filteredActions.push(retrievedAction);
- else throw new Error(`Action ${actionName} not found`);
+ if (retrievedAction) filteredActions.push(retrievedAction)
+ else throw new Error(`Action ${actionName} not found`)
}
- return filteredActions;
- } else throw new Error(`Signal ${signalName} not found`);
- };
+ return filteredActions
+ } else throw new Error(`Signal ${signalName} not found`)
+ }
const handleFormatActions = (): T => {
// Get actions
- const nonFormattedActions = handleGetActions(signalName);
+ const nonFormattedActions = handleGetActions(signalName)
// Formatted actions
- const formattedActions = {} as any;
+ const formattedActions = {} as any
for (const action of nonFormattedActions) {
// Get action name
- const actionName = action.type.split("/")[1];
+ const actionName = action.type.split('/')[1]
formattedActions[actionName] = (payload?: any) => {
dispatch({
type: action.type,
- payload,
- });
- };
+ isAsync: false,
+ payload
+ })
+ }
}
- return formattedActions;
- };
+ return formattedActions
+ }
- return handleFormatActions();
-};
+ return handleFormatActions()
+}
-export default useActions;
+export default useActions
diff --git a/src/hooks/useAsyncActions.ts b/src/hooks/useAsyncActions.ts
new file mode 100644
index 0000000..d2bc3af
--- /dev/null
+++ b/src/hooks/useAsyncActions.ts
@@ -0,0 +1,125 @@
+import { useCallback, useContext, useEffect, useMemo, useState } from "react";
+import { type AsyncActions } from "./types";
+import GXContext from "../contexts";
+import { type GXAsyncActionType } from "../contexts/types";
+import { AsyncActionStatuses } from "../helpers/types";
+import { BuilderCase } from "../interfaces/builderCase";
+
+const useAsyncActions = >(
+ signalName: string,
+ ...actions: string[]
+) => {
+ if (!signalName || typeof signalName !== "string") {
+ throw new Error(
+ "Provide a signalName as first argument of useAsyncActions"
+ );
+ }
+
+ // Get Global Context
+ const { signals, asyncDispatch } = useContext(GXContext);
+
+ // Async action callback
+ const asyncActionCallback = useCallback(
+ async (action: GXAsyncActionType, payload?: any) => {
+ // Dispatch pending action
+ asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: AsyncActionStatuses.PENDING,
+ });
+
+ try {
+ // Execute async action
+ const response = await (
+ action.steps as BuilderCase
+ ).asyncAction.handler(payload);
+
+ // Dispatch fulfilled action
+ const data = asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: AsyncActionStatuses.FULFILLED,
+ payload: response,
+ });
+
+ return {
+ data,
+ status: AsyncActionStatuses.FULFILLED,
+ };
+ } catch (error) {
+ // Dispatch rejected action
+ const data = asyncDispatch({
+ type: action.type,
+ isAsync: true,
+ status: AsyncActionStatuses.REJECTED,
+ payload: error,
+ });
+
+ return {
+ data,
+ error,
+ status: AsyncActionStatuses.REJECTED,
+ };
+ }
+ },
+ []
+ );
+
+ // Some handlers
+
+ /**
+ * Get async actions of a signal
+ * @param signalName
+ * @returns
+ */
+ const handleGetAsyncActions = (signalName: string) => {
+ const signal = signals.find((signal) => signal.name === signalName);
+
+ if (signal) {
+ if (!actions || actions.length === 0) return signal.asyncActions || [];
+
+ const filteredActions: Array> = [];
+
+ for (const action of actions) {
+ const actionName = `${signalName}/${action}`;
+
+ const retrievedAction = signal.asyncActions.find(
+ (act) => act.type === actionName
+ );
+
+ if (retrievedAction) filteredActions.push(retrievedAction);
+ else throw new Error(`Async Action ${actionName} not found`);
+ }
+
+ return filteredActions;
+ } else throw new Error(`Signal ${signalName} not found`);
+ };
+
+ /**
+ * Format async actions
+ * @returns
+ */
+ const handleFormatAsyncActions = (): P => {
+ // Get actions
+ const nonFormattedActions = handleGetAsyncActions(signalName);
+
+ // Formatted actions
+ const formattedActions = nonFormattedActions.map((action) => {
+ // Get action name
+ const actionName = action.type.split("/")[1];
+
+ return [
+ actionName,
+ async (payload?: any) => {
+ return asyncActionCallback(action, payload);
+ },
+ ];
+ });
+
+ return Object.fromEntries(formattedActions);
+ };
+
+ return handleFormatAsyncActions();
+};
+
+export default useAsyncActions;
diff --git a/src/hooks/useOperations.ts b/src/hooks/useOperations.ts
index d1729d7..46e3203 100644
--- a/src/hooks/useOperations.ts
+++ b/src/hooks/useOperations.ts
@@ -1,43 +1,44 @@
-import { useContext } from "react";
-import GXContext from "../contexts/index.js";
-import { Operations } from "./types.js";
+import { useContext } from 'react'
+import GXContext from '../contexts/index.js'
+import { type Operations } from './types.js'
const useOperations = (signalName: string) => {
// Get Global Context
- const { signals } = useContext(GXContext);
+ const { signals } = useContext(GXContext)
- if (!signalName || typeof signalName !== "string")
+ if (!signalName || typeof signalName !== 'string') {
throw new Error(
- "Provide a signalName as a first argument of useOperations"
- );
+ 'Provide a signalName as a first argument of useOperations'
+ )
+ }
const handleFormatOperations = (): T => {
- const signal = signals.find((signal) => signal.name === signalName);
+ const signal = signals.find((signal) => signal.name === signalName)
- if (!signal) throw new Error(`Signal ${signalName} not found`);
+ if (!signal) throw new Error(`Signal ${signalName} not found`)
// Get actions
- const nonFormattedOperations = signal.operations;
+ const nonFormattedOperations = signal.operations
// Formatted actions
- const formattedOperations = {} as any;
+ const formattedOperations = {} as any
for (const operation of nonFormattedOperations) {
// Get action name
- const operationName = operation.type.split("/")[1];
+ const operationName = operation.type.split('/')[1]
formattedOperations[operationName] = (payload?: any) => {
- return operation.handler(signal.state, payload);
- };
+ return operation.handler(signal.state, payload)
+ }
}
// return formattedOperations;
- return formattedOperations;
- };
+ return formattedOperations
+ }
- return handleFormatOperations();
-};
+ return handleFormatOperations()
+}
// Définir un type générique pour représenter une fonction
// type FunctionType any> = T;
@@ -59,4 +60,4 @@ const useOperations = (signalName: string) => {
// // Utilisation d'une fonction auxiliaire pour extraire le type de retour d'une fonction
// type ReturnTypeFunc = T extends (...args: any[]) => infer R ? R : any;
-export default useOperations;
+export default useOperations
diff --git a/src/hooks/useSignal.ts b/src/hooks/useSignal.ts
index 1190652..a08676c 100644
--- a/src/hooks/useSignal.ts
+++ b/src/hooks/useSignal.ts
@@ -1,27 +1,27 @@
-import { useContext, useMemo } from "react";
-import GXContext from "../contexts/index.js";
+import { useContext, useMemo } from 'react'
+import GXContext from '../contexts/index.js'
const useSignal = (signalName: string) => {
- const { signals } = useContext(GXContext);
- const memoizedSignals = useMemo(() => signals, [signals]);
+ const { signals } = useContext(GXContext)
+ const memoizedSignals = useMemo(() => signals, [signals])
/**
* Get state of a signal base on its name
- * @param signalName
- * @returns
+ * @param signalName
+ * @returns
*/
const handleGetSignalState = (signalName: string): T => {
- const signal = memoizedSignals.find(signal => signal.name === signalName);
+ const signal = memoizedSignals.find(signal => signal.name === signalName)
if (signal) {
- return signal.state;
+ return signal.state
}
// Throw error if signal not found
- throw new Error(`Signal ${signalName} not found`);
+ throw new Error(`Signal ${signalName} not found`)
}
- return handleGetSignalState(signalName);
-};
+ return handleGetSignalState(signalName)
+}
-export default useSignal;
+export default useSignal
diff --git a/src/index.ts b/src/index.ts
index e0ce541..0abfe1a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,21 +1,33 @@
-import createSignal from "./helpers/createSignal.js";
-import createStore from "./helpers/createStore.js";
-import GXProvider from "./providers/index.js";
+// Provider
+import GXProvider from './providers/index.js'
-import useAction from "./hooks/useAction.js";
-import useActions from "./hooks/useActions.js";
-import useSignal from "./hooks/useSignal.js";
-import useOperations from "./hooks/useOperations.js";
+// Constants
+import { AsyncActionStatuses } from './helpers/types.js'
-export default GXProvider;
+// Helpers functions
+import createSignal from './helpers/createSignal.js'
+import createStore from './helpers/createStore.js'
+import createAsyncAction from './helpers/createAsyncAction.js'
+
+// Hooks
+import useAction from './hooks/useAction.js'
+import useActions from './hooks/useActions.js'
+import useAsyncActions from './hooks/useAsyncActions.js'
+import useSignal from './hooks/useSignal.js'
+import useOperations from './hooks/useOperations.js'
+
+export default GXProvider
export {
createSignal,
createStore,
+ createAsyncAction,
useAction,
useActions,
+ useAsyncActions,
useSignal,
useOperations,
-};
+ AsyncActionStatuses
+}
// "build": "tsc && npx babel dist --out-dir cjs --extensions '.js' --source-maps inline --copy-files",
diff --git a/src/interfaces/builder.ts b/src/interfaces/builder.ts
new file mode 100644
index 0000000..c944881
--- /dev/null
+++ b/src/interfaces/builder.ts
@@ -0,0 +1,34 @@
+import { type CreateAsyncActionReturnType } from "../helpers/types.js";
+import type IBuilderCase from "./builderCase.js";
+import { BuilderCase } from "./builderCase.js";
+
+export default interface IBuilder {
+ use: (asyncAction: CreateAsyncActionReturnType) => IBuilderCase;
+}
+
+/**
+ * @class Builder
+ * @implements IBuilder
+ * @description
+ * Builder class to initialize a new builder case instance and return it in order to
+ * chain the builder case methods, or onPending, onFulfilled, onRejected methods to define
+ * the async action steps.
+ */
+export class Builder implements IBuilder {
+ private readonly _builderCase: BuilderCase;
+
+ constructor() {
+ this._builderCase = new BuilderCase();
+ }
+
+ /**
+ * This method takes an async action object and assign it to the builder case instance
+ * @param asyncAction An async action object
+ * @returns IBuilderCase
+ */
+ use(asyncAction: CreateAsyncActionReturnType): IBuilderCase {
+ this._builderCase.asyncAction = asyncAction;
+
+ return this._builderCase;
+ }
+}
diff --git a/src/interfaces/builderCase.ts b/src/interfaces/builderCase.ts
new file mode 100644
index 0000000..5d47e03
--- /dev/null
+++ b/src/interfaces/builderCase.ts
@@ -0,0 +1,121 @@
+import {
+ AsyncActionStatuses,
+ type AsyncActionStatusesType,
+ type CreateAsyncActionReturnType
+} from '../helpers/types.js'
+
+/**
+ * Interface for builder case
+ */
+export default interface IBuilderCase {
+ case: (
+ status: AsyncActionStatusesType,
+ handler: (state: T, payload?: P) => T
+ ) => IBuilderCase
+
+ onPending: (handler: (state: T, payload?: P) => T) => IBuilderCase
+
+ onFulfilled: (handler: (state: T, payload?: P) => T) => IBuilderCase
+
+ onRejected: (handler: (state: T, payload?: P) => T) => IBuilderCase
+}
+
+/**
+ * Builder case class for managing different cases of the asynchronous task
+ * @param _cases List of cases defined for a specific asynchronous task
+ */
+export class BuilderCase implements IBuilderCase {
+ private _cases: Array>
+ private _asyncAction: CreateAsyncActionReturnType | undefined
+
+ constructor () {
+ this._cases = []
+ this._asyncAction = undefined
+ }
+
+ // Getters
+
+ /**
+ * Get the list of cases
+ */
+ get cases () {
+ return this._cases
+ }
+
+ /**
+ * Get the async action
+ */
+ get asyncAction () {
+ return this._asyncAction
+ }
+
+ // Setters
+
+ /**
+ * Update the async action
+ * @param asyncAction Async Action value
+ */
+ set asyncAction (asyncAction: CreateAsyncActionReturnType) {
+ this._asyncAction = asyncAction
+ }
+
+ /**
+ * Update the cases
+ */
+ set cases (cases: Array>) {
+ this._cases = cases
+ }
+
+ /**
+ * Method that add a new case into the _cases list and return a new case builder object
+ * @param status Status of the asynchronous task
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ case (
+ status: AsyncActionStatusesType,
+ handler: (state: T, payload?: P) => T
+ ): IBuilderCase {
+ this._cases.push({
+ status,
+ handler
+ })
+
+ return this
+ }
+
+ /**
+ * Method that add a pending case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onPending (handler: (state: T, payload?: P) => T): IBuilderCase {
+ return this.case(AsyncActionStatuses.PENDING, handler)
+ }
+
+ /**
+ * Method that add a fulfilled case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ */
+ onFulfilled (handler: (state: T, payload?: P) => T): IBuilderCase {
+ return this.case(AsyncActionStatuses.FULFILLED, handler)
+ }
+
+ /**
+ * Method that add a rejected case into the _cases list and return a new case builder object
+ * @param handler Function that is executed depending on the specific status
+ * @returns
+ **/
+ onRejected (handler: (state: T, payload?: P) => T): IBuilderCase {
+ return this.case(AsyncActionStatuses.REJECTED, handler)
+ }
+}
+
+/**
+ * Case interface
+ */
+export interface Case {
+ status: AsyncActionStatusesType
+ handler: (state: T, payload?: P) => T
+}
diff --git a/src/providers/index.tsx b/src/providers/index.tsx
index c679c6b..fcd892f 100644
--- a/src/providers/index.tsx
+++ b/src/providers/index.tsx
@@ -1,19 +1,78 @@
-import { useReducer } from "react";
+import React, { useEffect } from "react";
+import { useCallback, useReducer, useTransition } from "react";
import GXContext from "../contexts/index.js";
-import { GXProviderProps } from "./types.js";
+import { type GXAction, type GXProviderProps } from "./types.js";
import gxReducer from "./reducer.js";
+import { type BuilderCase } from "../interfaces/builderCase.js";
export default function GXProvider({ children, store }: GXProviderProps) {
// Global state that manage all signals
const [signals, dispatch] = useReducer(gxReducer, store.getSignals());
+ // Wrap your dispatch function with useTransition
+ const [, startTransition] = useTransition();
+
+ // Your state management logic using useContext and useReducer
+ const syncDispatch = (action: GXAction) => {
+ startTransition(() => {
+ dispatch(action);
+ });
+ };
+
+ const asyncDispatch = useCallback((action: GXAction) => {
+ const signalName = action.type.split("/")[0];
+
+ const newState = signals.map(
+ ({ name, operations, actions, asyncActions, state: prevState }) => {
+ let state = prevState;
+
+ // Capture the target signal (a state and a bunch of async actions) from the array of signals.
+ // Capture the action from array of async actions (of the target signal).
+ // Run the async action and update the signal state.
+ if (name === signalName) {
+ if (action.isAsync) {
+ for (const { type, steps } of asyncActions) {
+ if (type === action.type) {
+ state = (steps as BuilderCase).cases
+ .find((c) => c.status === action.status)
+ .handler(state, action.payload);
+ break;
+ }
+ }
+ }
+ }
+
+ return {
+ name,
+ operations,
+ state,
+ actions,
+ asyncActions,
+ };
+ }
+ );
+
+ // Find the new state of the target signal
+ const signal = newState.find((signal) => signal.name === signalName);
+
+ dispatch({
+ type: action.type,
+ isAsync: action.isAsync,
+ status: action.status,
+ payload: signal.state,
+ });
+
+ return signal.state;
+ }, []);
+
// Context value
const contextValue = {
signals,
- dispatch,
+ dispatch: syncDispatch,
+ asyncDispatch
};
return (
{children}
);
-};
+}
diff --git a/src/providers/reducer.ts b/src/providers/reducer.ts
index f1e0b47..2e074a9 100644
--- a/src/providers/reducer.ts
+++ b/src/providers/reducer.ts
@@ -1,36 +1,43 @@
-import { GXSignalType } from "../contexts/types.js";
-import { GXAction } from "./types.js";
+import { type GXSignalType } from '../contexts/types.js'
+import { type GXAction } from './types.js'
const gxReducer = (
signals: GXSignalType[],
action: GXAction
): GXSignalType[] => {
- const signalName = action.type.split("/")[0];
+ const signalName = action.type.split('/')[0]
// Loop through all signals, make updates on targeted states
// and returns a new array of signals (immutability).
- return signals.map(({ name, operations, actions, state: prevState }) => {
- let state = prevState;
+ return signals.map(
+ ({ name, operations, actions, asyncActions, state: prevState }) => {
+ let state = prevState
- // Capture the target signal (a state and a bunch of actions) from the array of signals.
- // Capture the action from array of actions (of the target signal).
- // Run the action and update the signal state.
- if (name === signalName) {
- for (let { type, handler } of actions) {
- if (type === action.type) {
- state = handler(prevState, action.payload);
- break;
+ // Capture the target signal (a state and a bunch of actions) from the array of signals.
+ // Capture the action from array of actions (of the target signal).
+ // Run the action and update the signal state.
+ if (name === signalName) {
+ if (!action.isAsync) {
+ for (const { type, handler } of actions) {
+ if (type === action.type) {
+ state = handler(prevState, action.payload)
+ break
+ }
+ }
+ } else {
+ state = action.payload
}
}
- }
- return {
- name,
- operations,
- state,
- actions,
- };
- });
-};
+ return {
+ name,
+ operations,
+ state,
+ actions,
+ asyncActions
+ }
+ }
+ )
+}
-export default gxReducer;
+export default gxReducer
diff --git a/src/providers/types.ts b/src/providers/types.ts
index 8830fac..234c71b 100644
--- a/src/providers/types.ts
+++ b/src/providers/types.ts
@@ -1,11 +1,28 @@
-import { CreateStoreType } from '../helpers/types.js';
+import { type AsyncActionStatusesType, type CreateStoreType } from '../helpers/types.js'
-export type GXProviderProps = {
- children: React.ReactElement,
+/**
+ * Props of the GX Provider
+ */
+export interface GXProviderProps {
+ // Children component of the GX Provider
+ children: React.ReactElement
+
+ // Collection of signals
store: CreateStoreType
}
-export type GXAction = {
- type: string;
- payload: any
-}
\ No newline at end of file
+/**
+ * Type of the actions
+ */
+export interface GXAction {
+ // Type of the action
+ type: string
+
+ // Nature of the action
+ isAsync: boolean
+
+ status?: AsyncActionStatusesType
+
+ // Payload of the action
+ payload?: any
+}
diff --git a/yarn.lock b/yarn.lock
index 947d91e..bc95aa5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@aashutoshrathi/word-wrap@^1.2.3":
+ version "1.2.6"
+ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
+ integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==
+
"@adobe/css-tools@^4.0.1":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.2.0.tgz#e1a84fca468f4b337816fcb7f0964beb620ba855"
@@ -1387,6 +1392,13 @@
resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-2.1.1.tgz#c9c61d9fe5ca5ac664e1153bb0aa0eba1c6d6308"
integrity sha512-jwx+WCqszn53YHOfvFMJJRd/B2GqkCBt+1MJSG6o5/s8+ytHMvDZXsJgUEWLk12UnLd7HYKac4BYU5i/Ron1Cw==
+"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.4.0":
+ version "4.4.0"
+ resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
+ integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
+ dependencies:
+ eslint-visitor-keys "^3.3.0"
+
"@eslint-community/eslint-utils@^4.2.0":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518"
@@ -1399,6 +1411,11 @@
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403"
integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==
+"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.0", "@eslint-community/regexpp@^4.6.1":
+ version "4.8.1"
+ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.1.tgz#8c4bb756cc2aa7eaf13cfa5e69c83afb3260c20c"
+ integrity sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==
+
"@eslint/eslintrc@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d"
@@ -1414,11 +1431,40 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"
+"@eslint/eslintrc@^2.1.2":
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396"
+ integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==
+ dependencies:
+ ajv "^6.12.4"
+ debug "^4.3.2"
+ espree "^9.6.0"
+ globals "^13.19.0"
+ ignore "^5.2.0"
+ import-fresh "^3.2.1"
+ js-yaml "^4.1.0"
+ minimatch "^3.1.2"
+ strip-json-comments "^3.1.1"
+
"@eslint/js@8.36.0":
version "8.36.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe"
integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==
+"@eslint/js@8.49.0":
+ version "8.49.0"
+ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.49.0.tgz#86f79756004a97fa4df866835093f1df3d03c333"
+ integrity sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==
+
+"@humanwhocodes/config-array@^0.11.11":
+ version "0.11.11"
+ resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844"
+ integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==
+ dependencies:
+ "@humanwhocodes/object-schema" "^1.2.1"
+ debug "^4.1.1"
+ minimatch "^3.0.5"
+
"@humanwhocodes/config-array@^0.11.8":
version "0.11.8"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"
@@ -2202,6 +2248,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
+"@types/json-schema@^7.0.12":
+ version "7.0.13"
+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85"
+ integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==
+
"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
@@ -2290,6 +2341,11 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91"
integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==
+"@types/semver@^7.5.0":
+ version "7.5.2"
+ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.2.tgz#31f6eec1ed7ec23f4f05608d3a2d381df041f564"
+ integrity sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==
+
"@types/serve-index@^1.9.1":
version "1.9.1"
resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.1.tgz#1b5e85370a192c01ec6cec4735cf2917337a6278"
@@ -2371,6 +2427,23 @@
semver "^7.3.7"
tsutils "^3.21.0"
+"@typescript-eslint/eslint-plugin@^6.4.0":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.2.tgz#f18cc75c9cceac8080a9dc2e7d166008c5207b9f"
+ integrity sha512-ooaHxlmSgZTM6CHYAFRlifqh1OAr3PAQEwi7lhYhaegbnXrnh7CDcHmc3+ihhbQC7H0i4JF0psI5ehzkF6Yl6Q==
+ dependencies:
+ "@eslint-community/regexpp" "^4.5.1"
+ "@typescript-eslint/scope-manager" "6.7.2"
+ "@typescript-eslint/type-utils" "6.7.2"
+ "@typescript-eslint/utils" "6.7.2"
+ "@typescript-eslint/visitor-keys" "6.7.2"
+ debug "^4.3.4"
+ graphemer "^1.4.0"
+ ignore "^5.2.4"
+ natural-compare "^1.4.0"
+ semver "^7.5.4"
+ ts-api-utils "^1.0.1"
+
"@typescript-eslint/experimental-utils@^5.0.0":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.54.1.tgz#a45609ce43fc6b24b4c4dde215446eaad7805223"
@@ -2388,6 +2461,17 @@
"@typescript-eslint/typescript-estree" "5.54.1"
debug "^4.3.4"
+"@typescript-eslint/parser@^6.4.0":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.2.tgz#e0ae93771441b9518e67d0660c79e3a105497af4"
+ integrity sha512-KA3E4ox0ws+SPyxQf9iSI25R6b4Ne78ORhNHeVKrPQnoYsb9UhieoiRoJgrzgEeKGOXhcY1i8YtOeCHHTDa6Fw==
+ dependencies:
+ "@typescript-eslint/scope-manager" "6.7.2"
+ "@typescript-eslint/types" "6.7.2"
+ "@typescript-eslint/typescript-estree" "6.7.2"
+ "@typescript-eslint/visitor-keys" "6.7.2"
+ debug "^4.3.4"
+
"@typescript-eslint/scope-manager@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz#6d864b4915741c608a58ce9912edf5a02bb58735"
@@ -2396,6 +2480,14 @@
"@typescript-eslint/types" "5.54.1"
"@typescript-eslint/visitor-keys" "5.54.1"
+"@typescript-eslint/scope-manager@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.2.tgz#cf59a2095d2f894770c94be489648ad1c78dc689"
+ integrity sha512-bgi6plgyZjEqapr7u2mhxGR6E8WCzKNUFWNh6fkpVe9+yzRZeYtDTbsIBzKbcxI+r1qVWt6VIoMSNZ4r2A+6Yw==
+ dependencies:
+ "@typescript-eslint/types" "6.7.2"
+ "@typescript-eslint/visitor-keys" "6.7.2"
+
"@typescript-eslint/type-utils@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz#4825918ec27e55da8bb99cd07ec2a8e5f50ab748"
@@ -2406,11 +2498,26 @@
debug "^4.3.4"
tsutils "^3.21.0"
+"@typescript-eslint/type-utils@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.2.tgz#ed921c9db87d72fa2939fee242d700561454f367"
+ integrity sha512-36F4fOYIROYRl0qj95dYKx6kybddLtsbmPIYNK0OBeXv2j9L5nZ17j9jmfy+bIDHKQgn2EZX+cofsqi8NPATBQ==
+ dependencies:
+ "@typescript-eslint/typescript-estree" "6.7.2"
+ "@typescript-eslint/utils" "6.7.2"
+ debug "^4.3.4"
+ ts-api-utils "^1.0.1"
+
"@typescript-eslint/types@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c"
integrity sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==
+"@typescript-eslint/types@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.2.tgz#75a615a6dbeca09cafd102fe7f465da1d8a3c066"
+ integrity sha512-flJYwMYgnUNDAN9/GAI3l8+wTmvTYdv64fcH8aoJK76Y+1FCZ08RtI5zDerM/FYT5DMkAc+19E4aLmd5KqdFyg==
+
"@typescript-eslint/typescript-estree@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz#df7b6ae05fd8fef724a87afa7e2f57fa4a599be1"
@@ -2424,6 +2531,19 @@
semver "^7.3.7"
tsutils "^3.21.0"
+"@typescript-eslint/typescript-estree@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.2.tgz#ce5883c23b581a5caf878af641e49dd0349238c7"
+ integrity sha512-kiJKVMLkoSciGyFU0TOY0fRxnp9qq1AzVOHNeN1+B9erKFCJ4Z8WdjAkKQPP+b1pWStGFqezMLltxO+308dJTQ==
+ dependencies:
+ "@typescript-eslint/types" "6.7.2"
+ "@typescript-eslint/visitor-keys" "6.7.2"
+ debug "^4.3.4"
+ globby "^11.1.0"
+ is-glob "^4.0.3"
+ semver "^7.5.4"
+ ts-api-utils "^1.0.1"
+
"@typescript-eslint/utils@5.54.1", "@typescript-eslint/utils@^5.43.0":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.54.1.tgz#7a3ee47409285387b9d4609ea7e1020d1797ec34"
@@ -2438,6 +2558,19 @@
eslint-utils "^3.0.0"
semver "^7.3.7"
+"@typescript-eslint/utils@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.2.tgz#b9ef0da6f04932167a9222cb4ac59cb187165ebf"
+ integrity sha512-ZCcBJug/TS6fXRTsoTkgnsvyWSiXwMNiPzBUani7hDidBdj1779qwM1FIAmpH4lvlOZNF3EScsxxuGifjpLSWQ==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.4.0"
+ "@types/json-schema" "^7.0.12"
+ "@types/semver" "^7.5.0"
+ "@typescript-eslint/scope-manager" "6.7.2"
+ "@typescript-eslint/types" "6.7.2"
+ "@typescript-eslint/typescript-estree" "6.7.2"
+ semver "^7.5.4"
+
"@typescript-eslint/visitor-keys@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz#d7a8a0f7181d6ac748f4d47b2306e0513b98bf8b"
@@ -2446,6 +2579,14 @@
"@typescript-eslint/types" "5.54.1"
eslint-visitor-keys "^3.3.0"
+"@typescript-eslint/visitor-keys@6.7.2":
+ version "6.7.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.2.tgz#4cb2bd786f1f459731b0ad1584c9f73e1c7a4d5c"
+ integrity sha512-uVw9VIMFBUTz8rIeaUT3fFe8xIUx8r4ywAdlQv1ifH+6acn/XF8Y6rwJ7XNmkNMDrTW+7+vxFFPIF40nJCVsMQ==
+ dependencies:
+ "@typescript-eslint/types" "6.7.2"
+ eslint-visitor-keys "^3.4.1"
+
"@webassemblyjs/ast@1.11.1":
version "1.11.1"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
@@ -2632,6 +2773,11 @@ acorn@^8.2.4, acorn@^8.5.0, acorn@^8.7.1, acorn@^8.8.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
+acorn@^8.9.0:
+ version "8.10.0"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5"
+ integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==
+
address@^1.0.1, address@^1.1.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/address/-/address-1.2.2.tgz#2b5248dac5485a6390532c6a517fda2e3faac89e"
@@ -2798,6 +2944,17 @@ array-union@^2.1.0:
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
+array.prototype.findlastindex@^1.2.2:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz#b37598438f97b579166940814e2c0493a4f50207"
+ integrity sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+ es-shim-unscopables "^1.0.0"
+ get-intrinsic "^1.2.1"
+
array.prototype.flat@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz#ffc6576a7ca3efc2f46a143b9d1dda9b4b3cf5e2"
@@ -2840,6 +2997,19 @@ array.prototype.tosorted@^1.1.1:
es-shim-unscopables "^1.0.0"
get-intrinsic "^1.1.3"
+arraybuffer.prototype.slice@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12"
+ integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==
+ dependencies:
+ array-buffer-byte-length "^1.0.0"
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+ get-intrinsic "^1.2.1"
+ is-array-buffer "^3.0.2"
+ is-shared-array-buffer "^1.0.2"
+
asap@~2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
@@ -2855,6 +3025,13 @@ async@^3.2.3:
resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c"
integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==
+asynciterator.prototype@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz#8c5df0514936cdd133604dfcc9d3fb93f09b2b62"
+ integrity sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==
+ dependencies:
+ has-symbols "^1.0.3"
+
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@@ -3152,6 +3329,13 @@ builtin-modules@^3.1.0:
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==
+builtins@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9"
+ integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==
+ dependencies:
+ semver "^7.0.0"
+
bytes@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
@@ -3799,6 +3983,15 @@ default-gateway@^6.0.3:
dependencies:
execa "^5.0.0"
+define-data-property@^1.0.1:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.0.tgz#0db13540704e1d8d479a0656cf781267531b9451"
+ integrity sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==
+ dependencies:
+ get-intrinsic "^1.2.1"
+ gopd "^1.0.1"
+ has-property-descriptors "^1.0.0"
+
define-lazy-prop@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
@@ -3812,6 +4005,15 @@ define-properties@^1.1.3, define-properties@^1.1.4:
has-property-descriptors "^1.0.0"
object-keys "^1.1.1"
+define-properties@^1.2.0, define-properties@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c"
+ integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==
+ dependencies:
+ define-data-property "^1.0.1"
+ has-property-descriptors "^1.0.0"
+ object-keys "^1.1.1"
+
defined@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.1.tgz#c0b9db27bfaffd95d6f61399419b893df0f91ebf"
@@ -4124,6 +4326,51 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4:
unbox-primitive "^1.0.2"
which-typed-array "^1.1.9"
+es-abstract@^1.22.1:
+ version "1.22.2"
+ resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.2.tgz#90f7282d91d0ad577f505e423e52d4c1d93c1b8a"
+ integrity sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==
+ dependencies:
+ array-buffer-byte-length "^1.0.0"
+ arraybuffer.prototype.slice "^1.0.2"
+ available-typed-arrays "^1.0.5"
+ call-bind "^1.0.2"
+ es-set-tostringtag "^2.0.1"
+ es-to-primitive "^1.2.1"
+ function.prototype.name "^1.1.6"
+ get-intrinsic "^1.2.1"
+ get-symbol-description "^1.0.0"
+ globalthis "^1.0.3"
+ gopd "^1.0.1"
+ has "^1.0.3"
+ has-property-descriptors "^1.0.0"
+ has-proto "^1.0.1"
+ has-symbols "^1.0.3"
+ internal-slot "^1.0.5"
+ is-array-buffer "^3.0.2"
+ is-callable "^1.2.7"
+ is-negative-zero "^2.0.2"
+ is-regex "^1.1.4"
+ is-shared-array-buffer "^1.0.2"
+ is-string "^1.0.7"
+ is-typed-array "^1.1.12"
+ is-weakref "^1.0.2"
+ object-inspect "^1.12.3"
+ object-keys "^1.1.1"
+ object.assign "^4.1.4"
+ regexp.prototype.flags "^1.5.1"
+ safe-array-concat "^1.0.1"
+ safe-regex-test "^1.0.0"
+ string.prototype.trim "^1.2.8"
+ string.prototype.trimend "^1.0.7"
+ string.prototype.trimstart "^1.0.7"
+ typed-array-buffer "^1.0.0"
+ typed-array-byte-length "^1.0.0"
+ typed-array-byte-offset "^1.0.0"
+ typed-array-length "^1.0.4"
+ unbox-primitive "^1.0.2"
+ which-typed-array "^1.1.11"
+
es-array-method-boxes-properly@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e"
@@ -4144,6 +4391,26 @@ es-get-iterator@^1.1.2:
isarray "^2.0.5"
stop-iteration-iterator "^1.0.0"
+es-iterator-helpers@^1.0.12:
+ version "1.0.15"
+ resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz#bd81d275ac766431d19305923707c3efd9f1ae40"
+ integrity sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==
+ dependencies:
+ asynciterator.prototype "^1.0.0"
+ call-bind "^1.0.2"
+ define-properties "^1.2.1"
+ es-abstract "^1.22.1"
+ es-set-tostringtag "^2.0.1"
+ function-bind "^1.1.1"
+ get-intrinsic "^1.2.1"
+ globalthis "^1.0.3"
+ has-property-descriptors "^1.0.0"
+ has-proto "^1.0.1"
+ has-symbols "^1.0.3"
+ internal-slot "^1.0.5"
+ iterator.prototype "^1.1.2"
+ safe-array-concat "^1.0.1"
+
es-module-lexer@^0.9.0:
version "0.9.3"
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
@@ -4231,6 +4498,19 @@ eslint-config-react-app@^7.0.1:
eslint-plugin-react-hooks "^4.3.0"
eslint-plugin-testing-library "^5.0.1"
+eslint-config-standard-with-typescript@^39.0.0:
+ version "39.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-39.0.0.tgz#310847a474298cd64a8664a1d5b5434fb30e37b9"
+ integrity sha512-CiV2LS4NUeeRmDTDf1ocUMpMxitSyW0g+Y/N7ecElwGj188GahbcQgqfBNyVsIXQxHlZVBlOjkbg3oUI0R3KBg==
+ dependencies:
+ "@typescript-eslint/parser" "^6.4.0"
+ eslint-config-standard "17.1.0"
+
+eslint-config-standard@17.1.0:
+ version "17.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz#40ffb8595d47a6b242e07cbfd49dc211ed128975"
+ integrity sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==
+
eslint-import-resolver-node@^0.3.7:
version "0.3.7"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7"
@@ -4247,6 +4527,21 @@ eslint-module-utils@^2.7.4:
dependencies:
debug "^3.2.7"
+eslint-module-utils@^2.8.0:
+ version "2.8.0"
+ resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49"
+ integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==
+ dependencies:
+ debug "^3.2.7"
+
+eslint-plugin-es-x@^7.1.0:
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz#5779d742ad31f8fd780b9481331481e142b72311"
+ integrity sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.1.2"
+ "@eslint-community/regexpp" "^4.6.0"
+
eslint-plugin-flowtype@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-8.0.3.tgz#e1557e37118f24734aa3122e7536a038d34a4912"
@@ -4255,6 +4550,34 @@ eslint-plugin-flowtype@^8.0.3:
lodash "^4.17.21"
string-natural-compare "^3.0.1"
+eslint-plugin-immutable@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-immutable/-/eslint-plugin-immutable-1.0.0.tgz#4fe5839836be9809e08bac00cb7ce10e4b8e4821"
+ integrity sha512-ybjqMiL+hgrkgdHfkZjhgJS+Pkwb/iVmPNzbgsMbb2EZKNp3LOYfyce70w0P69LPy6UZgMq3j9kCTQk2hu6/fw==
+
+eslint-plugin-import@^2.25.2:
+ version "2.28.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz#63b8b5b3c409bfc75ebaf8fb206b07ab435482c4"
+ integrity sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==
+ dependencies:
+ array-includes "^3.1.6"
+ array.prototype.findlastindex "^1.2.2"
+ array.prototype.flat "^1.3.1"
+ array.prototype.flatmap "^1.3.1"
+ debug "^3.2.7"
+ doctrine "^2.1.0"
+ eslint-import-resolver-node "^0.3.7"
+ eslint-module-utils "^2.8.0"
+ has "^1.0.3"
+ is-core-module "^2.13.0"
+ is-glob "^4.0.3"
+ minimatch "^3.1.2"
+ object.fromentries "^2.0.6"
+ object.groupby "^1.0.0"
+ object.values "^1.1.6"
+ semver "^6.3.1"
+ tsconfig-paths "^3.14.2"
+
eslint-plugin-import@^2.25.3:
version "2.27.5"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz#876a6d03f52608a3e5bb439c2550588e51dd6c65"
@@ -4305,6 +4628,26 @@ eslint-plugin-jsx-a11y@^6.5.1:
object.fromentries "^2.0.6"
semver "^6.3.0"
+"eslint-plugin-n@^15.0.0 || ^16.0.0 ":
+ version "16.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.1.0.tgz#73d24fe3e37d04519c1f9230bdbd3aa567c66799"
+ integrity sha512-3wv/TooBst0N4ND+pnvffHuz9gNPmk/NkLwAxOt2JykTl/hcuECe6yhTtLJcZjIxtZwN+GX92ACp/QTLpHA3Hg==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.4.0"
+ builtins "^5.0.1"
+ eslint-plugin-es-x "^7.1.0"
+ get-tsconfig "^4.7.0"
+ ignore "^5.2.4"
+ is-core-module "^2.12.1"
+ minimatch "^3.1.2"
+ resolve "^1.22.2"
+ semver "^7.5.3"
+
+eslint-plugin-promise@^6.0.0:
+ version "6.1.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz#269a3e2772f62875661220631bd4dafcb4083816"
+ integrity sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==
+
eslint-plugin-react-hooks@^4.3.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
@@ -4331,6 +4674,28 @@ eslint-plugin-react@^7.27.1:
semver "^6.3.0"
string.prototype.matchall "^4.0.8"
+eslint-plugin-react@^7.33.2:
+ version "7.33.2"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz#69ee09443ffc583927eafe86ffebb470ee737608"
+ integrity sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==
+ dependencies:
+ array-includes "^3.1.6"
+ array.prototype.flatmap "^1.3.1"
+ array.prototype.tosorted "^1.1.1"
+ doctrine "^2.1.0"
+ es-iterator-helpers "^1.0.12"
+ estraverse "^5.3.0"
+ jsx-ast-utils "^2.4.1 || ^3.0.0"
+ minimatch "^3.1.2"
+ object.entries "^1.1.6"
+ object.fromentries "^2.0.6"
+ object.hasown "^1.1.2"
+ object.values "^1.1.6"
+ prop-types "^15.8.1"
+ resolve "^2.0.0-next.4"
+ semver "^6.3.1"
+ string.prototype.matchall "^4.0.8"
+
eslint-plugin-testing-library@^5.0.1:
version "5.10.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.10.2.tgz#12f231ad9b52b6aef45c801fd00aa129a932e0c2"
@@ -4354,6 +4719,14 @@ eslint-scope@^7.1.1:
esrecurse "^4.3.0"
estraverse "^5.2.0"
+eslint-scope@^7.2.2:
+ version "7.2.2"
+ resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f"
+ integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==
+ dependencies:
+ esrecurse "^4.3.0"
+ estraverse "^5.2.0"
+
eslint-utils@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
@@ -4371,6 +4744,11 @@ eslint-visitor-keys@^3.3.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
+eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3:
+ version "3.4.3"
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
+ integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
+
eslint-webpack-plugin@^3.1.1:
version "3.2.0"
resolved "https://registry.yarnpkg.com/eslint-webpack-plugin/-/eslint-webpack-plugin-3.2.0.tgz#1978cdb9edc461e4b0195a20da950cf57988347c"
@@ -4382,6 +4760,49 @@ eslint-webpack-plugin@^3.1.1:
normalize-path "^3.0.0"
schema-utils "^4.0.0"
+eslint@^8.0.1:
+ version "8.49.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.49.0.tgz#09d80a89bdb4edee2efcf6964623af1054bf6d42"
+ integrity sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.2.0"
+ "@eslint-community/regexpp" "^4.6.1"
+ "@eslint/eslintrc" "^2.1.2"
+ "@eslint/js" "8.49.0"
+ "@humanwhocodes/config-array" "^0.11.11"
+ "@humanwhocodes/module-importer" "^1.0.1"
+ "@nodelib/fs.walk" "^1.2.8"
+ ajv "^6.12.4"
+ chalk "^4.0.0"
+ cross-spawn "^7.0.2"
+ debug "^4.3.2"
+ doctrine "^3.0.0"
+ escape-string-regexp "^4.0.0"
+ eslint-scope "^7.2.2"
+ eslint-visitor-keys "^3.4.3"
+ espree "^9.6.1"
+ esquery "^1.4.2"
+ esutils "^2.0.2"
+ fast-deep-equal "^3.1.3"
+ file-entry-cache "^6.0.1"
+ find-up "^5.0.0"
+ glob-parent "^6.0.2"
+ globals "^13.19.0"
+ graphemer "^1.4.0"
+ ignore "^5.2.0"
+ imurmurhash "^0.1.4"
+ is-glob "^4.0.0"
+ is-path-inside "^3.0.3"
+ js-yaml "^4.1.0"
+ json-stable-stringify-without-jsonify "^1.0.1"
+ levn "^0.4.1"
+ lodash.merge "^4.6.2"
+ minimatch "^3.1.2"
+ natural-compare "^1.4.0"
+ optionator "^0.9.3"
+ strip-ansi "^6.0.1"
+ text-table "^0.2.0"
+
eslint@^8.3.0:
version "8.36.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf"
@@ -4437,6 +4858,15 @@ espree@^9.5.0:
acorn-jsx "^5.3.2"
eslint-visitor-keys "^3.3.0"
+espree@^9.6.0, espree@^9.6.1:
+ version "9.6.1"
+ resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"
+ integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==
+ dependencies:
+ acorn "^8.9.0"
+ acorn-jsx "^5.3.2"
+ eslint-visitor-keys "^3.4.1"
+
esprima@^4.0.0, esprima@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
@@ -4817,7 +5247,17 @@ function.prototype.name@^1.1.5:
es-abstract "^1.19.0"
functions-have-names "^1.2.2"
-functions-have-names@^1.2.2:
+function.prototype.name@^1.1.6:
+ version "1.1.6"
+ resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd"
+ integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+ functions-have-names "^1.2.3"
+
+functions-have-names@^1.2.2, functions-have-names@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
@@ -4841,6 +5281,16 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@
has "^1.0.3"
has-symbols "^1.0.3"
+get-intrinsic@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82"
+ integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==
+ dependencies:
+ function-bind "^1.1.1"
+ has "^1.0.3"
+ has-proto "^1.0.1"
+ has-symbols "^1.0.3"
+
get-own-enumerable-property-symbols@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
@@ -4864,6 +5314,13 @@ get-symbol-description@^1.0.0:
call-bind "^1.0.2"
get-intrinsic "^1.1.1"
+get-tsconfig@^4.7.0:
+ version "4.7.2"
+ resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.2.tgz#0dcd6fb330391d46332f4c6c1bf89a6514c2ddce"
+ integrity sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==
+ dependencies:
+ resolve-pkg-maps "^1.0.0"
+
glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
@@ -4959,6 +5416,11 @@ grapheme-splitter@^1.0.4:
resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e"
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==
+graphemer@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
+ integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
+
gzip-size@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
@@ -5197,7 +5659,7 @@ identity-obj-proxy@^3.0.0:
dependencies:
harmony-reflect "^1.4.6"
-ignore@^5.2.0:
+ignore@^5.2.0, ignore@^5.2.4:
version "5.2.4"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324"
integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==
@@ -5297,6 +5759,13 @@ is-arrayish@^0.2.1:
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==
+is-async-function@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.0.0.tgz#8e4418efd3e5d3a6ebb0164c05ef5afb69aa9646"
+ integrity sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==
+ dependencies:
+ has-tostringtag "^1.0.0"
+
is-bigint@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3"
@@ -5331,6 +5800,13 @@ is-core-module@^2.11.0, is-core-module@^2.9.0:
dependencies:
has "^1.0.3"
+is-core-module@^2.12.1, is-core-module@^2.13.0:
+ version "2.13.0"
+ resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db"
+ integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==
+ dependencies:
+ has "^1.0.3"
+
is-date-object@^1.0.1, is-date-object@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f"
@@ -5348,6 +5824,13 @@ is-extglob@^2.1.1:
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
+is-finalizationregistry@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz#c8749b65f17c133313e661b1289b95ad3dbd62e6"
+ integrity sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==
+ dependencies:
+ call-bind "^1.0.2"
+
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
@@ -5358,6 +5841,13 @@ is-generator-fn@^2.0.0:
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==
+is-generator-function@^1.0.10:
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72"
+ integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
+ dependencies:
+ has-tostringtag "^1.0.0"
+
is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
version "4.0.3"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
@@ -5472,6 +5962,13 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.9:
gopd "^1.0.1"
has-tostringtag "^1.0.0"
+is-typed-array@^1.1.12:
+ version "1.1.12"
+ resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a"
+ integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==
+ dependencies:
+ which-typed-array "^1.1.11"
+
is-typedarray@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
@@ -5561,6 +6058,17 @@ istanbul-reports@^3.1.3:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"
+iterator.prototype@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0"
+ integrity sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==
+ dependencies:
+ define-properties "^1.2.1"
+ get-intrinsic "^1.2.1"
+ has-symbols "^1.0.3"
+ reflect.getprototypeof "^1.0.4"
+ set-function-name "^2.0.1"
+
jake@^10.8.5:
version "10.8.5"
resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.5.tgz#f2183d2c59382cb274226034543b9c03b8164c46"
@@ -6716,6 +7224,16 @@ object.getownpropertydescriptors@^2.1.0:
define-properties "^1.1.4"
es-abstract "^1.20.4"
+object.groupby@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.1.tgz#d41d9f3c8d6c778d9cbac86b4ee9f5af103152ee"
+ integrity sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+ get-intrinsic "^1.2.1"
+
object.hasown@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.2.tgz#f919e21fad4eb38a57bc6345b3afd496515c3f92"
@@ -6797,6 +7315,18 @@ optionator@^0.9.1:
type-check "^0.4.0"
word-wrap "^1.2.3"
+optionator@^0.9.3:
+ version "0.9.3"
+ resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64"
+ integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==
+ dependencies:
+ "@aashutoshrathi/word-wrap" "^1.2.3"
+ deep-is "^0.1.3"
+ fast-levenshtein "^2.0.6"
+ levn "^0.4.1"
+ prelude-ls "^1.2.1"
+ type-check "^0.4.0"
+
p-limit@^2.0.0, p-limit@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
@@ -7859,6 +8389,18 @@ redent@^3.0.0:
indent-string "^4.0.0"
strip-indent "^3.0.0"
+reflect.getprototypeof@^1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz#aaccbf41aca3821b87bb71d9dcbc7ad0ba50a3f3"
+ integrity sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+ get-intrinsic "^1.2.1"
+ globalthis "^1.0.3"
+ which-builtin-type "^1.1.3"
+
regenerate-unicode-properties@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c"
@@ -7897,6 +8439,15 @@ regexp.prototype.flags@^1.4.3:
define-properties "^1.1.3"
functions-have-names "^1.2.2"
+regexp.prototype.flags@^1.5.1:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e"
+ integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ set-function-name "^2.0.0"
+
regexpp@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
@@ -7969,6 +8520,11 @@ resolve-from@^5.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
+resolve-pkg-maps@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f"
+ integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==
+
resolve-url-loader@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-4.0.0.tgz#d50d4ddc746bb10468443167acf800dcd6c3ad57"
@@ -7994,6 +8550,15 @@ resolve@^1.1.7, resolve@^1.14.2, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"
+resolve@^1.22.2:
+ version "1.22.6"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.6.tgz#dd209739eca3aef739c626fea1b4f3c506195362"
+ integrity sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==
+ dependencies:
+ is-core-module "^2.13.0"
+ path-parse "^1.0.7"
+ supports-preserve-symlinks-flag "^1.0.0"
+
resolve@^2.0.0-next.4:
version "2.0.0-next.4"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.4.tgz#3d37a113d6429f496ec4752d2a2e58efb1fd4660"
@@ -8044,6 +8609,16 @@ run-parallel@^1.1.9:
dependencies:
queue-microtask "^1.2.2"
+safe-array-concat@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c"
+ integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==
+ dependencies:
+ call-bind "^1.0.2"
+ get-intrinsic "^1.2.1"
+ has-symbols "^1.0.3"
+ isarray "^2.0.5"
+
safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -8159,6 +8734,18 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
+semver@^6.3.1:
+ version "6.3.1"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
+ integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
+
+semver@^7.0.0, semver@^7.5.3, semver@^7.5.4:
+ version "7.5.4"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
+ integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
+ dependencies:
+ lru-cache "^6.0.0"
+
semver@^7.3.2, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8:
version "7.3.8"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
@@ -8222,6 +8809,15 @@ serve-static@1.15.0:
parseurl "~1.3.3"
send "0.18.0"
+set-function-name@^2.0.0, set-function-name@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a"
+ integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==
+ dependencies:
+ define-data-property "^1.0.1"
+ functions-have-names "^1.2.3"
+ has-property-descriptors "^1.0.0"
+
setprototypeof@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"
@@ -8456,6 +9052,15 @@ string.prototype.trim@^1.2.7:
define-properties "^1.1.4"
es-abstract "^1.20.4"
+string.prototype.trim@^1.2.8:
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd"
+ integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+
string.prototype.trimend@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533"
@@ -8465,6 +9070,15 @@ string.prototype.trimend@^1.0.6:
define-properties "^1.1.4"
es-abstract "^1.20.4"
+string.prototype.trimend@^1.0.7:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e"
+ integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+
string.prototype.trimstart@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4"
@@ -8474,6 +9088,15 @@ string.prototype.trimstart@^1.0.6:
define-properties "^1.1.4"
es-abstract "^1.20.4"
+string.prototype.trimstart@^1.0.7:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298"
+ integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.2.0"
+ es-abstract "^1.22.1"
+
string_decoder@^1.1.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
@@ -8790,7 +9413,12 @@ tryer@^1.0.1:
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==
-tsconfig-paths@^3.14.1:
+ts-api-utils@^1.0.1:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
+ integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==
+
+tsconfig-paths@^3.14.1, tsconfig-paths@^3.14.2:
version "3.14.2"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"
integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==
@@ -8859,6 +9487,36 @@ type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"
+typed-array-buffer@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60"
+ integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==
+ dependencies:
+ call-bind "^1.0.2"
+ get-intrinsic "^1.2.1"
+ is-typed-array "^1.1.10"
+
+typed-array-byte-length@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0"
+ integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==
+ dependencies:
+ call-bind "^1.0.2"
+ for-each "^0.3.3"
+ has-proto "^1.0.1"
+ is-typed-array "^1.1.10"
+
+typed-array-byte-offset@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b"
+ integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==
+ dependencies:
+ available-typed-arrays "^1.0.5"
+ call-bind "^1.0.2"
+ for-each "^0.3.3"
+ has-proto "^1.0.1"
+ is-typed-array "^1.1.10"
+
typed-array-length@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb"
@@ -8875,10 +9533,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
-typescript@^4.4.2:
- version "4.9.5"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
- integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
+typescript@*:
+ version "5.2.2"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
+ integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
unbox-primitive@^1.0.2:
version "1.0.2"
@@ -9228,6 +9886,24 @@ which-boxed-primitive@^1.0.2:
is-string "^1.0.5"
is-symbol "^1.0.3"
+which-builtin-type@^1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.1.3.tgz#b1b8443707cc58b6e9bf98d32110ff0c2cbd029b"
+ integrity sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==
+ dependencies:
+ function.prototype.name "^1.1.5"
+ has-tostringtag "^1.0.0"
+ is-async-function "^2.0.0"
+ is-date-object "^1.0.5"
+ is-finalizationregistry "^1.0.2"
+ is-generator-function "^1.0.10"
+ is-regex "^1.1.4"
+ is-weakref "^1.0.2"
+ isarray "^2.0.5"
+ which-boxed-primitive "^1.0.2"
+ which-collection "^1.0.1"
+ which-typed-array "^1.1.9"
+
which-collection@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906"
@@ -9238,6 +9914,17 @@ which-collection@^1.0.1:
is-weakmap "^2.0.1"
is-weakset "^2.0.1"
+which-typed-array@^1.1.11:
+ version "1.1.11"
+ resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a"
+ integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==
+ dependencies:
+ available-typed-arrays "^1.0.5"
+ call-bind "^1.0.2"
+ for-each "^0.3.3"
+ gopd "^1.0.1"
+ has-tostringtag "^1.0.0"
+
which-typed-array@^1.1.9:
version "1.1.9"
resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6"