1 | import { Action, PreloadedState, Reducer, Store, StoreEnhancer } from 'redux';
|
2 | export declare const ActionTypes: {
|
3 | readonly PERFORM_ACTION: "PERFORM_ACTION";
|
4 | readonly RESET: "RESET";
|
5 | readonly ROLLBACK: "ROLLBACK";
|
6 | readonly COMMIT: "COMMIT";
|
7 | readonly SWEEP: "SWEEP";
|
8 | readonly TOGGLE_ACTION: "TOGGLE_ACTION";
|
9 | readonly SET_ACTIONS_ACTIVE: "SET_ACTIONS_ACTIVE";
|
10 | readonly JUMP_TO_STATE: "JUMP_TO_STATE";
|
11 | readonly JUMP_TO_ACTION: "JUMP_TO_ACTION";
|
12 | readonly REORDER_ACTION: "REORDER_ACTION";
|
13 | readonly IMPORT_STATE: "IMPORT_STATE";
|
14 | readonly LOCK_CHANGES: "LOCK_CHANGES";
|
15 | readonly PAUSE_RECORDING: "PAUSE_RECORDING";
|
16 | };
|
17 | export interface PerformAction<A extends Action<unknown>> {
|
18 | type: typeof ActionTypes.PERFORM_ACTION;
|
19 | action: A;
|
20 | timestamp: number;
|
21 | stack: string | undefined;
|
22 | }
|
23 | interface ResetAction {
|
24 | type: typeof ActionTypes.RESET;
|
25 | timestamp: number;
|
26 | }
|
27 | interface RollbackAction {
|
28 | type: typeof ActionTypes.ROLLBACK;
|
29 | timestamp: number;
|
30 | }
|
31 | interface CommitAction {
|
32 | type: typeof ActionTypes.COMMIT;
|
33 | timestamp: number;
|
34 | }
|
35 | interface SweepAction {
|
36 | type: typeof ActionTypes.SWEEP;
|
37 | }
|
38 | interface ToggleAction {
|
39 | type: typeof ActionTypes.TOGGLE_ACTION;
|
40 | id: number;
|
41 | }
|
42 | interface SetActionsActiveAction {
|
43 | type: typeof ActionTypes.SET_ACTIONS_ACTIVE;
|
44 | start: number;
|
45 | end: number;
|
46 | active: boolean;
|
47 | }
|
48 | interface ReorderAction {
|
49 | type: typeof ActionTypes.REORDER_ACTION;
|
50 | actionId: number;
|
51 | beforeActionId: number;
|
52 | }
|
53 | interface JumpToStateAction {
|
54 | type: typeof ActionTypes.JUMP_TO_STATE;
|
55 | index: number;
|
56 | }
|
57 | interface JumpToActionAction {
|
58 | type: typeof ActionTypes.JUMP_TO_ACTION;
|
59 | actionId: number;
|
60 | }
|
61 | interface ImportStateAction<S, A extends Action<unknown>, MonitorState> {
|
62 | type: typeof ActionTypes.IMPORT_STATE;
|
63 | nextLiftedState: LiftedState<S, A, MonitorState> | readonly A[];
|
64 | preloadedState?: S;
|
65 | noRecompute: boolean | undefined;
|
66 | }
|
67 | interface LockChangesAction {
|
68 | type: typeof ActionTypes.LOCK_CHANGES;
|
69 | status: boolean;
|
70 | }
|
71 | interface PauseRecordingAction {
|
72 | type: typeof ActionTypes.PAUSE_RECORDING;
|
73 | status: boolean;
|
74 | }
|
75 | export declare type LiftedAction<S, A extends Action<unknown>, MonitorState> = PerformAction<A> | ResetAction | RollbackAction | CommitAction | SweepAction | ToggleAction | SetActionsActiveAction | ReorderAction | JumpToStateAction | JumpToActionAction | ImportStateAction<S, A, MonitorState> | LockChangesAction | PauseRecordingAction;
|
76 |
|
77 |
|
78 |
|
79 | export declare const ActionCreators: {
|
80 | performAction<A extends Action<unknown>>(action: A, trace?: boolean | ((action: A) => string | undefined) | undefined, traceLimit?: number | undefined, toExcludeFromTrace?: Function | undefined): {
|
81 | type: "PERFORM_ACTION";
|
82 | action: A;
|
83 | timestamp: number;
|
84 | stack: string | undefined;
|
85 | };
|
86 | reset(): ResetAction;
|
87 | rollback(): RollbackAction;
|
88 | commit(): CommitAction;
|
89 | sweep(): SweepAction;
|
90 | toggleAction(id: number): ToggleAction;
|
91 | setActionsActive(start: number, end: number, active?: boolean): SetActionsActiveAction;
|
92 | reorderAction(actionId: number, beforeActionId: number): ReorderAction;
|
93 | jumpToState(index: number): JumpToStateAction;
|
94 | jumpToAction(actionId: number): JumpToActionAction;
|
95 | importState<S, A_1 extends Action<unknown>, MonitorState = null>(nextLiftedState: LiftedState<S, A_1, MonitorState> | readonly A_1[], noRecompute?: boolean | undefined): ImportStateAction<S, A_1, MonitorState>;
|
96 | lockChanges(status: boolean): LockChangesAction;
|
97 | pauseRecording(status: boolean): PauseRecordingAction;
|
98 | };
|
99 | export declare const INIT_ACTION: {
|
100 | type: string;
|
101 | };
|
102 | /**
|
103 | * Lifts an app's action into an action on the lifted store.
|
104 | */
|
105 | export declare function liftAction<A extends Action<unknown>>(action: A, trace?: ((action: A) => string | undefined) | boolean, traceLimit?: number, toExcludeFromTrace?: Function): {
|
106 | type: "PERFORM_ACTION";
|
107 | action: A;
|
108 | timestamp: number;
|
109 | stack: string | undefined;
|
110 | };
|
111 | export interface LiftedState<S, A extends Action<unknown>, MonitorState> {
|
112 | monitorState: MonitorState;
|
113 | nextActionId: number;
|
114 | actionsById: {
|
115 | [actionId: number]: PerformAction<A>;
|
116 | };
|
117 | stagedActionIds: number[];
|
118 | skippedActionIds: number[];
|
119 | committedState: S;
|
120 | currentStateIndex: number;
|
121 | computedStates: {
|
122 | state: S;
|
123 | error?: string;
|
124 | }[];
|
125 | isLocked: boolean;
|
126 | isPaused: boolean;
|
127 | }
|
128 | /**
|
129 | * Creates a history state reducer from an app's reducer.
|
130 | */
|
131 | export declare function liftReducerWith<S, A extends Action<unknown>, MonitorState, MonitorAction extends Action<unknown>>(reducer: Reducer<S, A>, initialCommittedState: PreloadedState<S> | undefined, monitorReducer: Reducer<MonitorState, MonitorAction>, options: Options<S, A, MonitorState, MonitorAction>): Reducer<LiftedState<S, A, MonitorState>, LiftedAction<S, A, MonitorState>>;
|
132 | /**
|
133 | * Provides an app's view into the state of the lifted store.
|
134 | */
|
135 | export declare function unliftState<S, A extends Action<unknown>, MonitorState, NextStateExt>(liftedState: LiftedState<S, A, MonitorState> & NextStateExt): S & NextStateExt;
|
136 | export declare type LiftedReducer<S, A extends Action<unknown>, MonitorState> = Reducer<LiftedState<S, A, MonitorState>, LiftedAction<S, A, MonitorState>>;
|
137 | export declare type LiftedStore<S, A extends Action<unknown>, MonitorState> = Store<LiftedState<S, A, MonitorState>, LiftedAction<S, A, MonitorState>>;
|
138 | export declare type InstrumentExt<S, A extends Action<unknown>, MonitorState> = {
|
139 | liftedStore: LiftedStore<S, A, MonitorState>;
|
140 | };
|
141 | export declare type EnhancedStore<S, A extends Action<unknown>, MonitorState> = Store<S, A> & InstrumentExt<S, A, MonitorState>;
|
142 | /**
|
143 | * Provides an app's view into the lifted store.
|
144 | */
|
145 | export declare function unliftStore<S, A extends Action<unknown>, MonitorState, MonitorAction extends Action<unknown>, NextExt, NextStateExt>(liftedStore: Store<LiftedState<S, A, MonitorState> & NextStateExt, LiftedAction<S, A, MonitorState>> & NextExt, liftReducer: (r: Reducer<S, A>) => LiftedReducer<S, A, MonitorState>, options: Options<S, A, MonitorState, MonitorAction>): Store<S & NextStateExt, A> & NextExt & {
|
146 | liftedStore: Store<LiftedState<S, A, MonitorState> & NextStateExt, LiftedAction<S, A, MonitorState>>;
|
147 | };
|
148 | export interface Options<S, A extends Action<unknown>, MonitorState, MonitorAction extends Action<unknown>> {
|
149 | maxAge?: number | ((currentLiftedAction: LiftedAction<S, A, MonitorState>, previousLiftedState: LiftedState<S, A, MonitorState> | undefined) => number);
|
150 | shouldCatchErrors?: boolean;
|
151 | shouldRecordChanges?: boolean;
|
152 | pauseActionType?: unknown;
|
153 | shouldStartLocked?: boolean;
|
154 | shouldHotReload?: boolean;
|
155 | trace?: boolean | ((action: A) => string | undefined);
|
156 | traceLimit?: number;
|
157 | shouldIncludeCallstack?: boolean;
|
158 | }
|
159 | /**
|
160 | * Redux instrumentation store enhancer.
|
161 | */
|
162 | export default function instrument<OptionsS, OptionsA extends Action<unknown>, MonitorState = null, MonitorAction extends Action<unknown> = never>(monitorReducer?: Reducer<MonitorState, MonitorAction>, options?: Options<OptionsS, OptionsA, MonitorState, MonitorAction>): StoreEnhancer<InstrumentExt<any, any, MonitorState>>;
|
163 | export {};
|
164 |
|
\ | No newline at end of file |