Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dist/helpers/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GXSignalType } from '../contexts/types.js';
import { type Builder } from '../interfaces/builder.js';
import type IBuilderCase from '../interfaces/builderCase.js';
import { type GXSignalType } from "../contexts/types.js";
import { type Builder } from "../interfaces/builder.js";
import type IBuilderCase from "../interfaces/builderCase.js";
/**
* Type of the create signal option function
*/
Expand Down Expand Up @@ -36,6 +36,10 @@ export interface CreateAsyncActionReturnType {
rejected: AsyncActionStatusesType;
handler: CreateAsyncActionProp;
}
export type AsyncActionReturn<T = null> = Promise<{
data: T;
status: AsyncActionStatusesType;
}>;
export declare const AsyncActionStatuses: {
readonly PENDING: "PENDING";
readonly FULFILLED: "FULFILLED";
Expand Down
6 changes: 3 additions & 3 deletions dist/helpers/types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/helpers/types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hooks/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { type AsyncActionStatusesType } from '../helpers/types';
export type Actions = Record<string, (payload?: any) => void>;
export type AsyncActions<T> = Record<string, (payload?: any) => Promise<{
data: T;
status: Omit<AsyncActionStatusesType, 'PENDING'>;
status: AsyncActionStatusesType;
}>>;
export type Operations<P = any> = Record<string, (payload?: any) => P>;
1 change: 1 addition & 0 deletions dist/hooks/useAllSignals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function useAllSignals(): import("../contexts/types").GXSignalType<any>[];
14 changes: 14 additions & 0 deletions dist/hooks/useAllSignals.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/hooks/useAllSignals.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hooks/useAsyncActions.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { type AsyncActions } from "./types";
declare const useAsyncActions: <T, P = AsyncActions<T>>(signalName: string, ...actions: string[]) => P;
declare const useAsyncActions: <T, P = AsyncActions<any>>(signalName: string, ...actions: string[]) => P;
export default useAsyncActions;
81 changes: 32 additions & 49 deletions dist/hooks/useAsyncActions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hooks/useAsyncActions.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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';
import GXProvider from "./providers/index.js";
import { AsyncActionStatuses } from "./helpers/types.js";
import { type AsyncActionReturn } 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 useAllSignals from "./hooks/useAllSignals.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 };
export { createSignal, createStore, createAsyncAction, useAction, useActions, useAsyncActions, useAllSignals, useSignal, useOperations, AsyncActionStatuses, AsyncActionReturn };
4 changes: 3 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions dist/interfaces/builder.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { type CreateAsyncActionReturnType } from '../helpers/types.js';
import type IBuilderCase from './builderCase.js';
import { type CreateAsyncActionReturnType } from "../helpers/types.js";
import type IBuilderCase from "./builderCase.js";
export default interface IBuilder<T, P = any> {
use: (asyncAction: CreateAsyncActionReturnType) => IBuilderCase<T, P>;
}
/**
* @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 declare class Builder<T, P = any> implements IBuilder<T, P> {
private readonly _builderCase;
constructor();
/**
* 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<T, P>;
}
Loading