Skip to content

Commit cd4ed14

Browse files
committed
ADD: Implement async actions
2 parents a8d752a + 4f7ad2a commit cd4ed14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1459
-602
lines changed

.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": ["standard-with-typescript", "plugin:react/recommended"],
8+
"parserOptions": {
9+
"ecmaVersion": "latest",
10+
"sourceType": "module"
11+
},
12+
"plugins": ["react", "immutable"],
13+
"rules": {
14+
"immutable/no-mutation": "error",
15+
"no-console": "error"
16+
},
17+
"ignorePatterns": ["node_modules/*", "dist/*", "/src/tests/*"] // Add the files or folders you want to exclude here
18+
}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ src
33
tsconfig.json
44
.babelrc
55
yarn.lock
6+
.eslintrc.json

dist/contexts/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/// <reference types="react" />
2-
import { GXContextType } from "./types.js";
2+
import { type GXContextType } from './types.js';
33
declare const GXContext: import("react").Context<GXContextType>;
44
export default GXContext;

dist/contexts/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/contexts/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/contexts/types.d.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
/// <reference types="react" />
2-
import IBuilderCase from "../interfaces/builderCase.js";
3-
import { GXAction } from "../providers/types.js";
2+
import type IBuilderCase from '../interfaces/builderCase.js';
3+
import { type GXAction } from '../providers/types.js';
44
/**
55
* Type that represents a signal
66
*/
7-
export type GXSignalType<T = any> = {
7+
export interface GXSignalType<T = any> {
88
name: string;
99
state: T;
10-
actions?: GXActionType<T>[];
11-
operations?: GXOperationType<T>[];
12-
asyncActions?: GXAsyncActionType<T>[];
13-
};
10+
actions?: Array<GXActionType<T>>;
11+
operations?: Array<GXOperationType<T>>;
12+
asyncActions?: Array<GXAsyncActionType<T>>;
13+
}
1414
/**
1515
* Type that represents Actions
1616
*/
17-
export type GXActionType<T, P = any> = {
17+
export interface GXActionType<T, P = any> {
1818
type: string;
1919
handler: (state: T, payload: P) => T;
20-
};
20+
}
2121
/**
2222
* Type that represents operations
2323
*/
24-
export type GXOperationType<T, P = any, Q = any> = {
24+
export interface GXOperationType<T, P = any, Q = any> {
2525
type: string;
2626
handler: (state: T, payload: P) => Q;
27-
};
27+
}
2828
/**
2929
* Type that represents async actions
3030
*/
31-
export type GXAsyncActionType<T, P = any> = {
31+
export interface GXAsyncActionType<T, P = any> {
3232
type: string;
3333
steps: IBuilderCase<T, P>;
34-
};
34+
}
3535
/**
3636
* Type of dispatched action
3737
*/
38-
export type DispatchedActionType = {
38+
export interface DispatchedActionType {
3939
type: string;
4040
payload: any;
41-
};
41+
}
4242
/**
4343
* Type of the signals context
4444
*/
45-
export type GXContextType = {
45+
export interface GXContextType {
4646
signals: GXSignalType[];
4747
dispatch: React.Dispatch<GXAction>;
4848
asyncDispatch: (action: GXAction) => any;
49-
};
49+
}

dist/helpers/createAsyncAction.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CreateAsyncActionProp, CreateAsyncActionReturnType } from "./types.js";
1+
import { type CreateAsyncActionProp, type CreateAsyncActionReturnType } from './types.js';
22
/**
33
* This function create an async action with different statuses
44
* @param handler Function that perform asynchronous task

dist/helpers/createAsyncAction.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/helpers/createAsyncAction.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/helpers/createSignal.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CreateSignalOptionType } from "./types.js";
2-
import { GXActionType, GXAsyncActionType, GXOperationType } from "../contexts/types.js";
1+
import { type CreateSignalOptionType } from './types.js';
2+
import { type GXActionType, type GXAsyncActionType, type GXOperationType } from '../contexts/types.js';
33
/**
44
* Create a signal with a state and actions for managing this state
55
* @param options

0 commit comments

Comments
 (0)