UNPKG

4.11 kBTypeScriptView Raw
1import { ActionReducer, Action } from '@ngrx/store';
2import { InjectionToken } from '@angular/core';
3export type ActionSanitizer = (action: Action, id: number) => Action;
4export type StateSanitizer = (state: any, index: number) => any;
5export type SerializationOptions = {
6 options?: boolean | any;
7 replacer?: (key: any, value: any) => {};
8 reviver?: (key: any, value: any) => {};
9 immutable?: any;
10 refs?: Array<any>;
11};
12export type Predicate = (state: any, action: Action) => boolean;
13/**
14 * Chrome extension documentation
15 * @see https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md#features
16 * Firefox extension documentation
17 * @see https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#features
18 */
19export interface DevToolsFeatureOptions {
20 /**
21 * Start/pause recording of dispatched actions
22 */
23 pause?: boolean;
24 /**
25 * Lock/unlock dispatching actions and side effects
26 */
27 lock?: boolean;
28 /**
29 * Persist states on page reloading
30 */
31 persist?: boolean;
32 /**
33 * Export history of actions in a file
34 */
35 export?: boolean;
36 /**
37 * Import history of actions from a file
38 */
39 import?: 'custom' | boolean;
40 /**
41 * Jump back and forth (time travelling)
42 */
43 jump?: boolean;
44 /**
45 * Skip (cancel) actions
46 */
47 skip?: boolean;
48 /**
49 * Drag and drop actions in the history list
50 */
51 reorder?: boolean;
52 /**
53 * Dispatch custom actions or action creators
54 */
55 dispatch?: boolean;
56 /**
57 * Generate tests for the selected actions
58 */
59 test?: boolean;
60}
61/**
62 * Chrome extension documentation
63 * @see https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md
64 * Firefox extension documentation
65 * @see https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md
66 */
67export declare class StoreDevtoolsConfig {
68 /**
69 * Maximum allowed actions to be stored in the history tree (default: `false`)
70 */
71 maxAge: number | false;
72 monitor?: ActionReducer<any, any>;
73 /**
74 * Function which takes `action` object and id number as arguments, and should return `action` object back.
75 */
76 actionSanitizer?: ActionSanitizer;
77 /**
78 * Function which takes `state` object and index as arguments, and should return `state` object back.
79 */
80 stateSanitizer?: StateSanitizer;
81 /**
82 * The instance name to be shown on the monitor page (default: `document.title`)
83 */
84 name?: string;
85 serialize?: boolean | SerializationOptions;
86 logOnly?: boolean;
87 features?: DevToolsFeatureOptions;
88 /**
89 * Action types to be hidden in the monitors. If `actionsSafelist` specified, `actionsBlocklist` is ignored.
90 */
91 actionsBlocklist?: string[];
92 /**
93 * Action types to be shown in the monitors
94 */
95 actionsSafelist?: string[];
96 /**
97 * Called for every action before sending, takes state and action object, and returns true in case it allows sending the current data to the monitor.
98 */
99 predicate?: Predicate;
100 /**
101 * Auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use.
102 */
103 autoPause?: boolean;
104 /**
105 * If set to true, will include stack trace for every dispatched action
106 */
107 trace?: boolean | (() => string);
108 /**
109 * Maximum stack trace frames to be stored (in case trace option was provided as true).
110 */
111 traceLimit?: number;
112}
113export declare const STORE_DEVTOOLS_CONFIG: InjectionToken<StoreDevtoolsConfig>;
114/**
115 * Used to provide a `StoreDevtoolsConfig` for the store-devtools.
116 */
117export declare const INITIAL_OPTIONS: InjectionToken<StoreDevtoolsConfig>;
118export type StoreDevtoolsOptions = Partial<StoreDevtoolsConfig> | (() => Partial<StoreDevtoolsConfig>);
119export declare function noMonitor(): null;
120export declare const DEFAULT_NAME = "NgRx Store DevTools";
121export declare function createConfig(optionsInput: StoreDevtoolsOptions): StoreDevtoolsConfig;
122
\No newline at end of file