@ngrx/store-devtools 6.0.1 → 7.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/store-devtools.umd.js +807 -604
- package/bundles/store-devtools.umd.js.map +1 -1
- package/bundles/store-devtools.umd.min.js +2 -2
- package/bundles/store-devtools.umd.min.js.map +1 -1
- package/esm2015/index.js +3 -3
- package/esm2015/public_api.js +3 -3
- package/esm2015/src/actions.js +72 -24
- package/esm2015/src/config.js +89 -5
- package/esm2015/src/devtools-dispatcher.js +13 -0
- package/esm2015/src/devtools.js +56 -45
- package/esm2015/src/extension.js +96 -78
- package/esm2015/src/index.js +3 -2
- package/esm2015/src/instrument.js +9 -48
- package/esm2015/src/reducer.js +190 -106
- package/esm2015/src/utils.js +56 -3
- package/esm2015/store-devtools.js +5 -5
- package/esm5/index.js +1 -1
- package/esm5/src/actions.js +19 -1
- package/esm5/src/config.js +40 -1
- package/esm5/src/devtools-dispatcher.js +34 -0
- package/esm5/src/devtools.js +39 -38
- package/esm5/src/extension.js +69 -32
- package/esm5/src/index.js +2 -1
- package/esm5/src/instrument.js +16 -33
- package/esm5/src/reducer.js +259 -194
- package/esm5/src/utils.js +50 -14
- package/esm5/store-devtools.js +5 -5
- package/fesm2015/store-devtools.js +425 -201
- package/fesm2015/store-devtools.js.map +1 -1
- package/fesm5/store-devtools.js +509 -307
- package/fesm5/store-devtools.js.map +1 -1
- package/migrations/6_0_0/index.js +3 -3
- package/package.json +4 -3
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.d.ts +4 -0
- package/schematics/ng-add/index.js +119 -0
- package/schematics/ng-add/schema.d.ts +8 -0
- package/schematics/ng-add/schema.js +13 -0
- package/schematics/ng-add/schema.json +34 -0
- package/schematics-core/index.d.ts +6 -6
- package/schematics-core/index.js +5 -3
- package/schematics-core/utility/ast-utils.js +13 -11
- package/schematics-core/utility/change.js +1 -1
- package/schematics-core/utility/config.js +1 -1
- package/schematics-core/utility/find-module.js +2 -2
- package/schematics-core/utility/ngrx-utils.d.ts +1 -1
- package/schematics-core/utility/ngrx-utils.js +12 -12
- package/schematics-core/utility/package.js +1 -1
- package/schematics-core/utility/parse-name.js +1 -1
- package/schematics-core/utility/project.d.ts +12 -0
- package/schematics-core/utility/project.js +12 -3
- package/schematics-core/utility/route-utils.js +1 -1
- package/schematics-core/utility/strings.js +1 -1
- package/schematics-core/utility/update.js +1 -1
- package/src/actions.d.ts +24 -12
- package/src/config.d.ts +15 -1
- package/src/devtools-dispatcher.d.ts +3 -0
- package/src/devtools.d.ts +3 -2
- package/src/extension.d.ts +10 -10
- package/src/index.d.ts +1 -1
- package/src/instrument.d.ts +1 -4
- package/src/reducer.d.ts +8 -2
- package/src/utils.d.ts +13 -1
- package/store-devtools.d.ts +4 -4
- package/store-devtools.metadata.json +1 -1
|
@@ -1,385 +1,555 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license NgRx
|
|
2
|
+
* @license NgRx 7.0.0-beta.0
|
|
3
3
|
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ngrx/store'), require('rxjs'), require('rxjs/operators')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define('@ngrx/store-devtools', ['exports', '@angular/core', '@ngrx/store', 'rxjs', 'rxjs/operators'], factory) :
|
|
9
|
+
(factory((global.ngrx = global.ngrx || {}, global.ngrx.storeDevtools = {}),global.ng.core,global['@ngrx/store'],global.rxjs,global.rxjs.operators));
|
|
10
10
|
}(this, (function (exports,core,store,rxjs,operators) { 'use strict';
|
|
11
11
|
|
|
12
|
-
var StoreDevtoolsConfig = /** @class */ (function () {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return StoreDevtoolsConfig;
|
|
16
|
-
}());
|
|
17
|
-
var STORE_DEVTOOLS_CONFIG = new core.InjectionToken('@ngrx/devtools Options');
|
|
18
|
-
var INITIAL_OPTIONS = new core.InjectionToken('@ngrx/devtools Initial Config');
|
|
19
|
-
|
|
20
|
-
var PERFORM_ACTION = 'PERFORM_ACTION';
|
|
21
|
-
var REFRESH = 'REFRESH';
|
|
22
|
-
var RESET = 'RESET';
|
|
23
|
-
var ROLLBACK = 'ROLLBACK';
|
|
24
|
-
var COMMIT = 'COMMIT';
|
|
25
|
-
var SWEEP = 'SWEEP';
|
|
26
|
-
var TOGGLE_ACTION = 'TOGGLE_ACTION';
|
|
27
|
-
var SET_ACTIONS_ACTIVE = 'SET_ACTIONS_ACTIVE';
|
|
28
|
-
var JUMP_TO_STATE = 'JUMP_TO_STATE';
|
|
29
|
-
var JUMP_TO_ACTION = 'JUMP_TO_ACTION';
|
|
30
|
-
var IMPORT_STATE = 'IMPORT_STATE';
|
|
31
|
-
var PerformAction = /** @class */ (function () {
|
|
32
|
-
function PerformAction(action, timestamp) {
|
|
33
|
-
this.action = action;
|
|
34
|
-
this.timestamp = timestamp;
|
|
35
|
-
this.type = PERFORM_ACTION;
|
|
36
|
-
if (typeof action.type === 'undefined') {
|
|
37
|
-
throw new Error('Actions may not have an undefined "type" property. ' +
|
|
38
|
-
'Have you misspelled a constant?');
|
|
12
|
+
var StoreDevtoolsConfig = /** @class */ (function () {
|
|
13
|
+
function StoreDevtoolsConfig() {
|
|
39
14
|
}
|
|
15
|
+
return StoreDevtoolsConfig;
|
|
16
|
+
}());
|
|
17
|
+
var STORE_DEVTOOLS_CONFIG = new core.InjectionToken('@ngrx/devtools Options');
|
|
18
|
+
var INITIAL_OPTIONS = new core.InjectionToken('@ngrx/devtools Initial Config');
|
|
19
|
+
function noMonitor() {
|
|
20
|
+
return null;
|
|
40
21
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
22
|
+
var DEFAULT_NAME = 'NgRx Store DevTools';
|
|
23
|
+
function createConfig(_options) {
|
|
24
|
+
var DEFAULT_OPTIONS = {
|
|
25
|
+
maxAge: false,
|
|
26
|
+
monitor: noMonitor,
|
|
27
|
+
actionSanitizer: undefined,
|
|
28
|
+
stateSanitizer: undefined,
|
|
29
|
+
name: DEFAULT_NAME,
|
|
30
|
+
serialize: false,
|
|
31
|
+
logOnly: false,
|
|
32
|
+
// Add all features explicitely. This prevent buggy behavior for
|
|
33
|
+
// options like "lock" which might otherwise not show up.
|
|
34
|
+
features: {
|
|
35
|
+
pause: true,
|
|
36
|
+
lock: true,
|
|
37
|
+
persist: true,
|
|
38
|
+
export: true,
|
|
39
|
+
import: 'custom',
|
|
40
|
+
jump: true,
|
|
41
|
+
skip: true,
|
|
42
|
+
reorder: true,
|
|
43
|
+
dispatch: true,
|
|
44
|
+
test: true,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
var options = typeof _options === 'function' ? _options() : _options;
|
|
48
|
+
var logOnly = options.logOnly
|
|
49
|
+
? { pause: true, export: true, test: true }
|
|
50
|
+
: false;
|
|
51
|
+
var features = options.features || logOnly || DEFAULT_OPTIONS.features;
|
|
52
|
+
var config = Object.assign({}, DEFAULT_OPTIONS, { features: features }, options);
|
|
53
|
+
if (config.maxAge && config.maxAge < 2) {
|
|
54
|
+
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + config.maxAge);
|
|
55
|
+
}
|
|
56
|
+
return config;
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
|
|
59
|
+
var PERFORM_ACTION = 'PERFORM_ACTION';
|
|
60
|
+
var REFRESH = 'REFRESH';
|
|
61
|
+
var RESET = 'RESET';
|
|
62
|
+
var ROLLBACK = 'ROLLBACK';
|
|
63
|
+
var COMMIT = 'COMMIT';
|
|
64
|
+
var SWEEP = 'SWEEP';
|
|
65
|
+
var TOGGLE_ACTION = 'TOGGLE_ACTION';
|
|
66
|
+
var SET_ACTIONS_ACTIVE = 'SET_ACTIONS_ACTIVE';
|
|
67
|
+
var JUMP_TO_STATE = 'JUMP_TO_STATE';
|
|
68
|
+
var JUMP_TO_ACTION = 'JUMP_TO_ACTION';
|
|
69
|
+
var IMPORT_STATE = 'IMPORT_STATE';
|
|
70
|
+
var LOCK_CHANGES = 'LOCK_CHANGES';
|
|
71
|
+
var PAUSE_RECORDING = 'PAUSE_RECORDING';
|
|
72
|
+
var PerformAction = /** @class */ (function () {
|
|
73
|
+
function PerformAction(action, timestamp) {
|
|
74
|
+
this.action = action;
|
|
75
|
+
this.timestamp = timestamp;
|
|
76
|
+
this.type = PERFORM_ACTION;
|
|
77
|
+
if (typeof action.type === 'undefined') {
|
|
78
|
+
throw new Error('Actions may not have an undefined "type" property. ' +
|
|
79
|
+
'Have you misspelled a constant?');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return PerformAction;
|
|
83
|
+
}());
|
|
84
|
+
var Refresh = /** @class */ (function () {
|
|
85
|
+
function Refresh() {
|
|
86
|
+
this.type = REFRESH;
|
|
87
|
+
}
|
|
88
|
+
return Refresh;
|
|
89
|
+
}());
|
|
90
|
+
var Reset = /** @class */ (function () {
|
|
91
|
+
function Reset(timestamp) {
|
|
92
|
+
this.timestamp = timestamp;
|
|
93
|
+
this.type = RESET;
|
|
94
|
+
}
|
|
95
|
+
return Reset;
|
|
96
|
+
}());
|
|
97
|
+
var Rollback = /** @class */ (function () {
|
|
98
|
+
function Rollback(timestamp) {
|
|
99
|
+
this.timestamp = timestamp;
|
|
100
|
+
this.type = ROLLBACK;
|
|
101
|
+
}
|
|
102
|
+
return Rollback;
|
|
103
|
+
}());
|
|
104
|
+
var Commit = /** @class */ (function () {
|
|
105
|
+
function Commit(timestamp) {
|
|
106
|
+
this.timestamp = timestamp;
|
|
107
|
+
this.type = COMMIT;
|
|
108
|
+
}
|
|
109
|
+
return Commit;
|
|
110
|
+
}());
|
|
111
|
+
var Sweep = /** @class */ (function () {
|
|
112
|
+
function Sweep() {
|
|
113
|
+
this.type = SWEEP;
|
|
114
|
+
}
|
|
115
|
+
return Sweep;
|
|
116
|
+
}());
|
|
117
|
+
var ToggleAction = /** @class */ (function () {
|
|
118
|
+
function ToggleAction(id) {
|
|
119
|
+
this.id = id;
|
|
120
|
+
this.type = TOGGLE_ACTION;
|
|
121
|
+
}
|
|
122
|
+
return ToggleAction;
|
|
123
|
+
}());
|
|
124
|
+
var JumpToState = /** @class */ (function () {
|
|
125
|
+
function JumpToState(index) {
|
|
126
|
+
this.index = index;
|
|
127
|
+
this.type = JUMP_TO_STATE;
|
|
128
|
+
}
|
|
129
|
+
return JumpToState;
|
|
130
|
+
}());
|
|
131
|
+
var JumpToAction = /** @class */ (function () {
|
|
132
|
+
function JumpToAction(actionId) {
|
|
133
|
+
this.actionId = actionId;
|
|
134
|
+
this.type = JUMP_TO_ACTION;
|
|
135
|
+
}
|
|
136
|
+
return JumpToAction;
|
|
137
|
+
}());
|
|
138
|
+
var ImportState = /** @class */ (function () {
|
|
139
|
+
function ImportState(nextLiftedState) {
|
|
140
|
+
this.nextLiftedState = nextLiftedState;
|
|
141
|
+
this.type = IMPORT_STATE;
|
|
142
|
+
}
|
|
143
|
+
return ImportState;
|
|
144
|
+
}());
|
|
145
|
+
var LockChanges = /** @class */ (function () {
|
|
146
|
+
function LockChanges(status) {
|
|
147
|
+
this.status = status;
|
|
148
|
+
this.type = LOCK_CHANGES;
|
|
149
|
+
}
|
|
150
|
+
return LockChanges;
|
|
151
|
+
}());
|
|
152
|
+
var PauseRecording = /** @class */ (function () {
|
|
153
|
+
function PauseRecording(status) {
|
|
154
|
+
this.status = status;
|
|
155
|
+
this.type = PAUSE_RECORDING;
|
|
156
|
+
}
|
|
157
|
+
return PauseRecording;
|
|
158
|
+
}());
|
|
159
|
+
|
|
160
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
161
|
+
__assign = Object.assign || function(t) {
|
|
162
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
163
|
+
s = arguments[i];
|
|
164
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
165
|
+
t[p] = s[p];
|
|
166
|
+
}
|
|
167
|
+
return t;
|
|
168
|
+
};
|
|
169
|
+
return __assign.apply(this, arguments);
|
|
170
|
+
};
|
|
171
|
+
function difference(first, second) {
|
|
172
|
+
return first.filter(function (item) { return second.indexOf(item) < 0; });
|
|
60
173
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Provides an app's view into the state of the lifted store.
|
|
176
|
+
*/
|
|
177
|
+
function unliftState(liftedState) {
|
|
178
|
+
var computedStates = liftedState.computedStates, currentStateIndex = liftedState.currentStateIndex;
|
|
179
|
+
var state = computedStates[currentStateIndex].state;
|
|
180
|
+
return state;
|
|
67
181
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Lifts an app's action into an action on the lifted store.
|
|
184
|
+
*/
|
|
185
|
+
function liftAction(action) {
|
|
186
|
+
return new PerformAction(action, +Date.now());
|
|
73
187
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Sanitizes given actions with given function.
|
|
190
|
+
*/
|
|
191
|
+
function sanitizeActions(actionSanitizer, actions) {
|
|
192
|
+
return Object.keys(actions).reduce(function (sanitizedActions, actionIdx) {
|
|
193
|
+
var idx = Number(actionIdx);
|
|
194
|
+
sanitizedActions[idx] = sanitizeAction(actionSanitizer, actions[idx], idx);
|
|
195
|
+
return sanitizedActions;
|
|
196
|
+
}, {});
|
|
80
197
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
this.type = JUMP_TO_STATE;
|
|
198
|
+
/**
|
|
199
|
+
* Sanitizes given action with given function.
|
|
200
|
+
*/
|
|
201
|
+
function sanitizeAction(actionSanitizer, action, actionIdx) {
|
|
202
|
+
return __assign({}, action, { action: actionSanitizer(action.action, actionIdx) });
|
|
87
203
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Sanitizes given states with given function.
|
|
206
|
+
*/
|
|
207
|
+
function sanitizeStates(stateSanitizer, states) {
|
|
208
|
+
return states.map(function (computedState, idx) { return ({
|
|
209
|
+
state: sanitizeState(stateSanitizer, computedState.state, idx),
|
|
210
|
+
error: computedState.error,
|
|
211
|
+
}); });
|
|
94
212
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
this.type = IMPORT_STATE;
|
|
213
|
+
/**
|
|
214
|
+
* Sanitizes given state with given function.
|
|
215
|
+
*/
|
|
216
|
+
function sanitizeState(stateSanitizer, state, stateIdx) {
|
|
217
|
+
return stateSanitizer(state, stateIdx);
|
|
101
218
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
s = arguments[i];
|
|
108
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
109
|
-
t[p] = s[p];
|
|
219
|
+
/**
|
|
220
|
+
* Read the config and tell if actions should be filtered
|
|
221
|
+
*/
|
|
222
|
+
function shouldFilterActions(config) {
|
|
223
|
+
return config.predicate || config.actionsWhitelist || config.actionsBlacklist;
|
|
110
224
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return new PerformAction(action, +Date.now());
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Sanitizes given actions with given function.
|
|
133
|
-
*/
|
|
134
|
-
function sanitizeActions(actionSanitizer, actions) {
|
|
135
|
-
return Object.keys(actions).reduce(function (sanitizedActions, actionIdx) {
|
|
136
|
-
var idx = Number(actionIdx);
|
|
137
|
-
sanitizedActions[idx] = sanitizeAction(actionSanitizer, actions[idx], idx);
|
|
138
|
-
return sanitizedActions;
|
|
139
|
-
}, {});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Sanitizes given action with given function.
|
|
143
|
-
*/
|
|
144
|
-
function sanitizeAction(actionSanitizer, action, actionIdx) {
|
|
145
|
-
return __assign$1({}, action, { action: actionSanitizer(action.action, actionIdx) });
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Sanitizes given states with given function.
|
|
149
|
-
*/
|
|
150
|
-
function sanitizeStates(stateSanitizer, states) {
|
|
151
|
-
return states.map(function (computedState, idx) {
|
|
152
|
-
return ({
|
|
153
|
-
state: sanitizeState(stateSanitizer, computedState.state, idx),
|
|
154
|
-
error: computedState.error,
|
|
225
|
+
/**
|
|
226
|
+
* Return a full filtered lifted state
|
|
227
|
+
*/
|
|
228
|
+
function filterLiftedState(liftedState, predicate, whitelist, blacklist) {
|
|
229
|
+
var filteredStagedActionIds = [];
|
|
230
|
+
var filteredActionsById = {};
|
|
231
|
+
var filteredComputedStates = [];
|
|
232
|
+
liftedState.stagedActionIds.forEach(function (id, idx) {
|
|
233
|
+
var liftedAction = liftedState.actionsById[id];
|
|
234
|
+
if (!liftedAction)
|
|
235
|
+
return;
|
|
236
|
+
if (idx &&
|
|
237
|
+
isActionFiltered(liftedState.computedStates[idx], liftedAction, predicate, whitelist, blacklist)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
filteredActionsById[id] = liftedAction;
|
|
241
|
+
filteredStagedActionIds.push(id);
|
|
242
|
+
filteredComputedStates.push(liftedState.computedStates[idx]);
|
|
155
243
|
});
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Sanitizes given state with given function.
|
|
160
|
-
*/
|
|
161
|
-
function sanitizeState(stateSanitizer, state, stateIdx) {
|
|
162
|
-
return stateSanitizer(state, stateIdx);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
var __assign = (undefined && undefined.__assign) || Object.assign || function(t) {
|
|
166
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
167
|
-
s = arguments[i];
|
|
168
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
169
|
-
t[p] = s[p];
|
|
244
|
+
return __assign({}, liftedState, { stagedActionIds: filteredStagedActionIds, actionsById: filteredActionsById, computedStates: filteredComputedStates });
|
|
170
245
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
};
|
|
179
|
-
var REDUX_DEVTOOLS_EXTENSION = new core.InjectionToken('Redux Devtools Extension');
|
|
180
|
-
var DevtoolsExtension = /** @class */ (function () {
|
|
181
|
-
function DevtoolsExtension(devtoolsExtension, config) {
|
|
182
|
-
this.config = config;
|
|
183
|
-
this.instanceId = "ngrx-store-" + Date.now();
|
|
184
|
-
this.devtoolsExtension = devtoolsExtension;
|
|
185
|
-
this.createActionStreams();
|
|
246
|
+
/**
|
|
247
|
+
* Return true is the action should be ignored
|
|
248
|
+
*/
|
|
249
|
+
function isActionFiltered(state, action, predicate, whitelist, blacklist) {
|
|
250
|
+
return ((predicate && !predicate(state, action.action)) ||
|
|
251
|
+
(whitelist && !action.action.type.match(whitelist.join('|'))) ||
|
|
252
|
+
(blacklist && action.action.type.match(blacklist.join('|'))));
|
|
186
253
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var sanitizedState = this.config.stateSanitizer
|
|
207
|
-
? sanitizeState(this.config.stateSanitizer, currentState, state.currentStateIndex)
|
|
208
|
-
: currentState;
|
|
209
|
-
var sanitizedAction = this.config.actionSanitizer
|
|
210
|
-
? sanitizeAction(this.config.actionSanitizer, action, state.nextActionId)
|
|
211
|
-
: action;
|
|
212
|
-
this.extensionConnection.send(sanitizedAction, sanitizedState);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
// Requires full state update
|
|
216
|
-
var sanitizedLiftedState = __assign({}, state, { actionsById: this.config.actionSanitizer
|
|
217
|
-
? sanitizeActions(this.config.actionSanitizer, state.actionsById)
|
|
218
|
-
: state.actionsById, computedStates: this.config.stateSanitizer
|
|
219
|
-
? sanitizeStates(this.config.stateSanitizer, state.computedStates)
|
|
220
|
-
: state.computedStates });
|
|
221
|
-
this.devtoolsExtension.send(null, sanitizedLiftedState, this.getExtensionConfig(this.instanceId, this.config), this.instanceId);
|
|
222
|
-
}
|
|
254
|
+
|
|
255
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
256
|
+
var extendStatics = function (d, b) {
|
|
257
|
+
extendStatics = Object.setPrototypeOf ||
|
|
258
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
259
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
260
|
+
return extendStatics(d, b);
|
|
261
|
+
};
|
|
262
|
+
return function (d, b) {
|
|
263
|
+
extendStatics(d, b);
|
|
264
|
+
function __() { this.constructor = d; }
|
|
265
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
266
|
+
};
|
|
267
|
+
})();
|
|
268
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
269
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
270
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
271
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
272
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
223
273
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return
|
|
274
|
+
var DevtoolsDispatcher = /** @class */ (function (_super) {
|
|
275
|
+
__extends(DevtoolsDispatcher, _super);
|
|
276
|
+
function DevtoolsDispatcher() {
|
|
277
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
228
278
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
279
|
+
DevtoolsDispatcher = __decorate([
|
|
280
|
+
core.Injectable()
|
|
281
|
+
], DevtoolsDispatcher);
|
|
282
|
+
return DevtoolsDispatcher;
|
|
283
|
+
}(store.ActionsSubject));
|
|
284
|
+
|
|
285
|
+
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
286
|
+
__assign$1 = Object.assign || function(t) {
|
|
287
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
288
|
+
s = arguments[i];
|
|
289
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
290
|
+
t[p] = s[p];
|
|
291
|
+
}
|
|
292
|
+
return t;
|
|
293
|
+
};
|
|
294
|
+
return __assign$1.apply(this, arguments);
|
|
236
295
|
};
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
var start$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.START; }));
|
|
243
|
-
// Listen for the stop action
|
|
244
|
-
var stop$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.STOP; }));
|
|
245
|
-
// Listen for lifted actions
|
|
246
|
-
var liftedActions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.DISPATCH; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
247
|
-
// Listen for unlifted actions
|
|
248
|
-
var actions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.ACTION; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
249
|
-
var actionsUntilStop$ = actions$.pipe(operators.takeUntil(stop$));
|
|
250
|
-
var liftedUntilStop$ = liftedActions$.pipe(operators.takeUntil(stop$));
|
|
251
|
-
this.start$ = start$.pipe(operators.takeUntil(stop$));
|
|
252
|
-
// Only take the action sources between the start/stop events
|
|
253
|
-
this.actions$ = this.start$.pipe(operators.switchMap(function () { return actionsUntilStop$; }));
|
|
254
|
-
this.liftedActions$ = this.start$.pipe(operators.switchMap(function () { return liftedUntilStop$; }));
|
|
296
|
+
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
297
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
298
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
299
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
300
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
255
301
|
};
|
|
256
|
-
|
|
257
|
-
|
|
302
|
+
var __metadata = (undefined && undefined.__metadata) || function (k, v) {
|
|
303
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
258
304
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
305
|
+
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
|
306
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
307
|
+
};
|
|
308
|
+
var ExtensionActionTypes = {
|
|
309
|
+
START: 'START',
|
|
310
|
+
DISPATCH: 'DISPATCH',
|
|
311
|
+
STOP: 'STOP',
|
|
312
|
+
ACTION: 'ACTION',
|
|
313
|
+
};
|
|
314
|
+
var REDUX_DEVTOOLS_EXTENSION = new core.InjectionToken('Redux Devtools Extension');
|
|
315
|
+
var DevtoolsExtension = /** @class */ (function () {
|
|
316
|
+
function DevtoolsExtension(devtoolsExtension, config, dispatcher) {
|
|
317
|
+
this.config = config;
|
|
318
|
+
this.dispatcher = dispatcher;
|
|
319
|
+
this.devtoolsExtension = devtoolsExtension;
|
|
320
|
+
this.createActionStreams();
|
|
321
|
+
}
|
|
322
|
+
DevtoolsExtension.prototype.notify = function (action, state) {
|
|
323
|
+
if (!this.devtoolsExtension) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// Check to see if the action requires a full update of the liftedState.
|
|
327
|
+
// If it is a simple action generated by the user's app and the recording
|
|
328
|
+
// is not locked/paused, only send the action and the current state (fast).
|
|
329
|
+
//
|
|
330
|
+
// A full liftedState update (slow: serializes the entire liftedState) is
|
|
331
|
+
// only required when:
|
|
332
|
+
// a) redux-devtools-extension fires the @@Init action (ignored by
|
|
333
|
+
// @ngrx/store-devtools)
|
|
334
|
+
// b) an action is generated by an @ngrx module (e.g. @ngrx/effects/init
|
|
335
|
+
// or @ngrx/store/update-reducers)
|
|
336
|
+
// c) the state has been recomputed due to time-traveling
|
|
337
|
+
// d) any action that is not a PerformAction to err on the side of
|
|
338
|
+
// caution.
|
|
339
|
+
if (action.type === PERFORM_ACTION) {
|
|
340
|
+
if (state.isLocked || state.isPaused) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
var currentState = unliftState(state);
|
|
344
|
+
if (shouldFilterActions(this.config) &&
|
|
345
|
+
isActionFiltered(currentState, action, this.config.predicate, this.config.actionsWhitelist, this.config.actionsBlacklist)) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
var sanitizedState = this.config.stateSanitizer
|
|
349
|
+
? sanitizeState(this.config.stateSanitizer, currentState, state.currentStateIndex)
|
|
350
|
+
: currentState;
|
|
351
|
+
var sanitizedAction = this.config.actionSanitizer
|
|
352
|
+
? sanitizeAction(this.config.actionSanitizer, action, state.nextActionId)
|
|
353
|
+
: action;
|
|
354
|
+
this.extensionConnection.send(sanitizedAction, sanitizedState);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
// Requires full state update
|
|
358
|
+
var sanitizedLiftedState = __assign$1({}, state, { stagedActionIds: state.stagedActionIds, actionsById: this.config.actionSanitizer
|
|
359
|
+
? sanitizeActions(this.config.actionSanitizer, state.actionsById)
|
|
360
|
+
: state.actionsById, computedStates: this.config.stateSanitizer
|
|
361
|
+
? sanitizeStates(this.config.stateSanitizer, state.computedStates)
|
|
362
|
+
: state.computedStates });
|
|
363
|
+
this.devtoolsExtension.send(null, sanitizedLiftedState, this.getExtensionConfig(this.config));
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
DevtoolsExtension.prototype.createChangesObservable = function () {
|
|
367
|
+
var _this = this;
|
|
368
|
+
if (!this.devtoolsExtension) {
|
|
369
|
+
return rxjs.empty();
|
|
370
|
+
}
|
|
371
|
+
return new rxjs.Observable(function (subscriber) {
|
|
372
|
+
var connection = _this.devtoolsExtension.connect(_this.getExtensionConfig(_this.config));
|
|
373
|
+
_this.extensionConnection = connection;
|
|
374
|
+
connection.init();
|
|
375
|
+
connection.subscribe(function (change) { return subscriber.next(change); });
|
|
376
|
+
return connection.unsubscribe;
|
|
377
|
+
});
|
|
265
378
|
};
|
|
266
|
-
|
|
267
|
-
|
|
379
|
+
DevtoolsExtension.prototype.createActionStreams = function () {
|
|
380
|
+
var _this = this;
|
|
381
|
+
// Listens to all changes
|
|
382
|
+
var changes$ = this.createChangesObservable().pipe(operators.share());
|
|
383
|
+
// Listen for the start action
|
|
384
|
+
var start$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.START; }));
|
|
385
|
+
// Listen for the stop action
|
|
386
|
+
var stop$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.STOP; }));
|
|
387
|
+
// Listen for lifted actions
|
|
388
|
+
var liftedActions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.DISPATCH; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }), operators.concatMap(function (action) {
|
|
389
|
+
if (action.type === IMPORT_STATE) {
|
|
390
|
+
// State imports may happen in two situations:
|
|
391
|
+
// 1. Explicitly by user
|
|
392
|
+
// 2. User activated the "persist state accross reloads" option
|
|
393
|
+
// and now the state is imported during reload.
|
|
394
|
+
// Because of option 2, we need to give possible
|
|
395
|
+
// lazy loaded reducers time to instantiate.
|
|
396
|
+
// As soon as there is no UPDATE action within 1 second,
|
|
397
|
+
// it is assumed that all reducers are loaded.
|
|
398
|
+
return _this.dispatcher.pipe(operators.filter(function (action) { return action.type === store.UPDATE; }), operators.timeout(1000), operators.debounceTime(1000), operators.map(function () { return action; }), operators.catchError(function () { return rxjs.of(action); }), operators.take(1));
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
return rxjs.of(action);
|
|
402
|
+
}
|
|
403
|
+
}));
|
|
404
|
+
// Listen for unlifted actions
|
|
405
|
+
var actions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.ACTION; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
406
|
+
var actionsUntilStop$ = actions$.pipe(operators.takeUntil(stop$));
|
|
407
|
+
var liftedUntilStop$ = liftedActions$.pipe(operators.takeUntil(stop$));
|
|
408
|
+
this.start$ = start$.pipe(operators.takeUntil(stop$));
|
|
409
|
+
// Only take the action sources between the start/stop events
|
|
410
|
+
this.actions$ = this.start$.pipe(operators.switchMap(function () { return actionsUntilStop$; }));
|
|
411
|
+
this.liftedActions$ = this.start$.pipe(operators.switchMap(function () { return liftedUntilStop$; }));
|
|
412
|
+
};
|
|
413
|
+
DevtoolsExtension.prototype.unwrapAction = function (action) {
|
|
414
|
+
return typeof action === 'string' ? eval("(" + action + ")") : action;
|
|
415
|
+
};
|
|
416
|
+
DevtoolsExtension.prototype.getExtensionConfig = function (config) {
|
|
417
|
+
var extensionOptions = {
|
|
418
|
+
name: config.name,
|
|
419
|
+
features: config.features,
|
|
420
|
+
serialize: config.serialize,
|
|
421
|
+
};
|
|
422
|
+
if (config.maxAge !== false /* support === 0 */) {
|
|
423
|
+
extensionOptions.maxAge = config.maxAge;
|
|
424
|
+
}
|
|
425
|
+
return extensionOptions;
|
|
426
|
+
};
|
|
427
|
+
DevtoolsExtension = __decorate$1([
|
|
428
|
+
core.Injectable(),
|
|
429
|
+
__param(0, core.Inject(REDUX_DEVTOOLS_EXTENSION)),
|
|
430
|
+
__param(1, core.Inject(STORE_DEVTOOLS_CONFIG)),
|
|
431
|
+
__metadata("design:paramtypes", [Object, StoreDevtoolsConfig,
|
|
432
|
+
DevtoolsDispatcher])
|
|
433
|
+
], DevtoolsExtension);
|
|
434
|
+
return DevtoolsExtension;
|
|
435
|
+
}());
|
|
436
|
+
|
|
437
|
+
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
438
|
+
__assign$2 = Object.assign || function(t) {
|
|
439
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
440
|
+
s = arguments[i];
|
|
441
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
442
|
+
t[p] = s[p];
|
|
443
|
+
}
|
|
444
|
+
return t;
|
|
445
|
+
};
|
|
446
|
+
return __assign$2.apply(this, arguments);
|
|
447
|
+
};
|
|
448
|
+
var __read = (undefined && undefined.__read) || function (o, n) {
|
|
449
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
450
|
+
if (!m) return o;
|
|
451
|
+
var i = m.call(o), r, ar = [], e;
|
|
452
|
+
try {
|
|
453
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
268
454
|
}
|
|
269
|
-
|
|
455
|
+
catch (error) { e = { error: error }; }
|
|
456
|
+
finally {
|
|
457
|
+
try {
|
|
458
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
459
|
+
}
|
|
460
|
+
finally { if (e) throw e.error; }
|
|
461
|
+
}
|
|
462
|
+
return ar;
|
|
270
463
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
var __read$1 = (undefined && undefined.__read) || function (o, n) {
|
|
291
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
292
|
-
if (!m) return o;
|
|
293
|
-
var i = m.call(o), r, ar = [], e;
|
|
294
|
-
try {
|
|
295
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
296
|
-
}
|
|
297
|
-
catch (error) { e = { error: error }; }
|
|
298
|
-
finally {
|
|
464
|
+
var __spread = (undefined && undefined.__spread) || function () {
|
|
465
|
+
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
466
|
+
return ar;
|
|
467
|
+
};
|
|
468
|
+
var INIT_ACTION = { type: store.INIT };
|
|
469
|
+
var RECOMPUTE = '@ngrx/store-devtools/recompute';
|
|
470
|
+
var RECOMPUTE_ACTION = { type: RECOMPUTE };
|
|
471
|
+
/**
|
|
472
|
+
* Computes the next entry in the log by applying an action.
|
|
473
|
+
*/
|
|
474
|
+
function computeNextEntry(reducer, action, state, error, errorHandler) {
|
|
475
|
+
if (error) {
|
|
476
|
+
return {
|
|
477
|
+
state: state,
|
|
478
|
+
error: 'Interrupted by an error up the chain',
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
var nextState = state;
|
|
482
|
+
var nextError;
|
|
299
483
|
try {
|
|
300
|
-
|
|
484
|
+
nextState = reducer(state, action);
|
|
485
|
+
}
|
|
486
|
+
catch (err) {
|
|
487
|
+
nextError = err.toString();
|
|
488
|
+
errorHandler.handleError(err.stack || err);
|
|
301
489
|
}
|
|
302
|
-
finally { if (e) throw e.error; }
|
|
303
|
-
}
|
|
304
|
-
return ar;
|
|
305
|
-
};
|
|
306
|
-
var __spread = (undefined && undefined.__spread) || function () {
|
|
307
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i]));
|
|
308
|
-
return ar;
|
|
309
|
-
};
|
|
310
|
-
var INIT_ACTION = { type: store.INIT };
|
|
311
|
-
/**
|
|
312
|
-
* Computes the next entry in the log by applying an action.
|
|
313
|
-
*/
|
|
314
|
-
function computeNextEntry(reducer, action, state, error, errorHandler) {
|
|
315
|
-
if (error) {
|
|
316
490
|
return {
|
|
317
|
-
state:
|
|
318
|
-
error:
|
|
491
|
+
state: nextState,
|
|
492
|
+
error: nextError,
|
|
319
493
|
};
|
|
320
494
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Runs the reducer on invalidated actions to get a fresh computation log.
|
|
497
|
+
*/
|
|
498
|
+
function recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler, isPaused) {
|
|
499
|
+
// Optimization: exit early and return the same reference
|
|
500
|
+
// if we know nothing could have changed.
|
|
501
|
+
if (minInvalidatedStateIndex >= computedStates.length &&
|
|
502
|
+
computedStates.length === stagedActionIds.length) {
|
|
503
|
+
return computedStates;
|
|
504
|
+
}
|
|
505
|
+
var nextComputedStates = computedStates.slice(0, minInvalidatedStateIndex);
|
|
506
|
+
// If the recording is paused, recompute all states up until the pause state,
|
|
507
|
+
// else recompute all states.
|
|
508
|
+
var lastIncludedActionId = stagedActionIds.length - (isPaused ? 1 : 0);
|
|
509
|
+
for (var i = minInvalidatedStateIndex; i < lastIncludedActionId; i++) {
|
|
510
|
+
var actionId = stagedActionIds[i];
|
|
511
|
+
var action = actionsById[actionId].action;
|
|
512
|
+
var previousEntry = nextComputedStates[i - 1];
|
|
513
|
+
var previousState = previousEntry ? previousEntry.state : committedState;
|
|
514
|
+
var previousError = previousEntry ? previousEntry.error : undefined;
|
|
515
|
+
var shouldSkip = skippedActionIds.indexOf(actionId) > -1;
|
|
516
|
+
var entry = shouldSkip
|
|
517
|
+
? previousEntry
|
|
518
|
+
: computeNextEntry(reducer, action, previousState, previousError, errorHandler);
|
|
519
|
+
nextComputedStates.push(entry);
|
|
520
|
+
}
|
|
521
|
+
// If the recording is paused, the last state will not be recomputed,
|
|
522
|
+
// because it's essentially not part of the state history.
|
|
523
|
+
if (isPaused) {
|
|
524
|
+
nextComputedStates.push(computedStates[computedStates.length - 1]);
|
|
525
|
+
}
|
|
526
|
+
return nextComputedStates;
|
|
344
527
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
:
|
|
356
|
-
|
|
528
|
+
function liftInitialState(initialCommittedState, monitorReducer) {
|
|
529
|
+
return {
|
|
530
|
+
monitorState: monitorReducer(undefined, {}),
|
|
531
|
+
nextActionId: 1,
|
|
532
|
+
actionsById: { 0: liftAction(INIT_ACTION) },
|
|
533
|
+
stagedActionIds: [0],
|
|
534
|
+
skippedActionIds: [],
|
|
535
|
+
committedState: initialCommittedState,
|
|
536
|
+
currentStateIndex: 0,
|
|
537
|
+
computedStates: [],
|
|
538
|
+
isLocked: false,
|
|
539
|
+
isPaused: false,
|
|
540
|
+
};
|
|
357
541
|
}
|
|
358
|
-
return nextComputedStates;
|
|
359
|
-
}
|
|
360
|
-
function liftInitialState(initialCommittedState, monitorReducer) {
|
|
361
|
-
return {
|
|
362
|
-
monitorState: monitorReducer(undefined, {}),
|
|
363
|
-
nextActionId: 1,
|
|
364
|
-
actionsById: { 0: liftAction(INIT_ACTION) },
|
|
365
|
-
stagedActionIds: [0],
|
|
366
|
-
skippedActionIds: [],
|
|
367
|
-
committedState: initialCommittedState,
|
|
368
|
-
currentStateIndex: 0,
|
|
369
|
-
computedStates: [],
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Creates a history state reducer from an app's reducer.
|
|
374
|
-
*/
|
|
375
|
-
function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler, monitorReducer, options) {
|
|
376
|
-
if (options === void 0) { options = {}; }
|
|
377
542
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
543
|
+
* Creates a history state reducer from an app's reducer.
|
|
544
|
+
*/
|
|
545
|
+
function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler, monitorReducer, options) {
|
|
546
|
+
if (options === void 0) { options = {}; }
|
|
547
|
+
/**
|
|
548
|
+
* Manages how the history actions modify the history state.
|
|
549
|
+
*/
|
|
550
|
+
return function (reducer) { return function (liftedState, liftedAction) {
|
|
551
|
+
var _a;
|
|
552
|
+
var _b = liftedState || initialLiftedState, monitorState = _b.monitorState, actionsById = _b.actionsById, nextActionId = _b.nextActionId, stagedActionIds = _b.stagedActionIds, skippedActionIds = _b.skippedActionIds, committedState = _b.committedState, currentStateIndex = _b.currentStateIndex, computedStates = _b.computedStates, isLocked = _b.isLocked, isPaused = _b.isPaused;
|
|
383
553
|
if (!liftedState) {
|
|
384
554
|
// Prevent mutating initialLiftedState
|
|
385
555
|
actionsById = Object.create(actionsById);
|
|
@@ -406,11 +576,50 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
406
576
|
currentStateIndex =
|
|
407
577
|
currentStateIndex > excess ? currentStateIndex - excess : 0;
|
|
408
578
|
}
|
|
579
|
+
function commitChanges() {
|
|
580
|
+
// Consider the last committed state the new starting point.
|
|
581
|
+
// Squash any staged actions into a single committed state.
|
|
582
|
+
actionsById = { 0: liftAction(INIT_ACTION) };
|
|
583
|
+
nextActionId = 1;
|
|
584
|
+
stagedActionIds = [0];
|
|
585
|
+
skippedActionIds = [];
|
|
586
|
+
committedState = computedStates[currentStateIndex].state;
|
|
587
|
+
currentStateIndex = 0;
|
|
588
|
+
computedStates = [];
|
|
589
|
+
}
|
|
409
590
|
// By default, aggressively recompute every state whatever happens.
|
|
410
591
|
// This has O(n) performance, so we'll override this to a sensible
|
|
411
592
|
// value whenever we feel like we don't have to recompute the states.
|
|
412
593
|
var minInvalidatedStateIndex = 0;
|
|
413
594
|
switch (liftedAction.type) {
|
|
595
|
+
case LOCK_CHANGES: {
|
|
596
|
+
isLocked = liftedAction.status;
|
|
597
|
+
minInvalidatedStateIndex = Infinity;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
case PAUSE_RECORDING: {
|
|
601
|
+
isPaused = liftedAction.status;
|
|
602
|
+
if (isPaused) {
|
|
603
|
+
// Add a pause action to signal the devtools-user the recording is paused.
|
|
604
|
+
// The corresponding state will be overwritten on each update to always contain
|
|
605
|
+
// the latest state (see Actions.PERFORM_ACTION).
|
|
606
|
+
stagedActionIds = __spread(stagedActionIds, [nextActionId]);
|
|
607
|
+
actionsById[nextActionId] = new PerformAction({
|
|
608
|
+
type: '@ngrx/devtools/pause',
|
|
609
|
+
}, +Date.now());
|
|
610
|
+
nextActionId++;
|
|
611
|
+
minInvalidatedStateIndex = stagedActionIds.length - 1;
|
|
612
|
+
computedStates = computedStates.concat(computedStates[computedStates.length - 1]);
|
|
613
|
+
if (currentStateIndex === stagedActionIds.length - 2) {
|
|
614
|
+
currentStateIndex++;
|
|
615
|
+
}
|
|
616
|
+
minInvalidatedStateIndex = Infinity;
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
commitChanges();
|
|
620
|
+
}
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
414
623
|
case RESET: {
|
|
415
624
|
// Get back to the state the store was created with.
|
|
416
625
|
actionsById = { 0: liftAction(INIT_ACTION) };
|
|
@@ -423,15 +632,7 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
423
632
|
break;
|
|
424
633
|
}
|
|
425
634
|
case COMMIT: {
|
|
426
|
-
|
|
427
|
-
// Squash any staged actions into a single committed state.
|
|
428
|
-
actionsById = { 0: liftAction(INIT_ACTION) };
|
|
429
|
-
nextActionId = 1;
|
|
430
|
-
stagedActionIds = [0];
|
|
431
|
-
skippedActionIds = [];
|
|
432
|
-
committedState = computedStates[currentStateIndex].state;
|
|
433
|
-
currentStateIndex = 0;
|
|
434
|
-
computedStates = [];
|
|
635
|
+
commitChanges();
|
|
435
636
|
break;
|
|
436
637
|
}
|
|
437
638
|
case ROLLBACK: {
|
|
@@ -502,6 +703,22 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
502
703
|
break;
|
|
503
704
|
}
|
|
504
705
|
case PERFORM_ACTION: {
|
|
706
|
+
// Ignore action and return state as is if recording is locked
|
|
707
|
+
if (isLocked) {
|
|
708
|
+
return liftedState || initialLiftedState;
|
|
709
|
+
}
|
|
710
|
+
if (isPaused) {
|
|
711
|
+
// If recording is paused, overwrite the last state
|
|
712
|
+
// (corresponds to the pause action) and keep everything else as is.
|
|
713
|
+
// This way, the app gets the new current state while the devtools
|
|
714
|
+
// do not record another action.
|
|
715
|
+
var lastState = computedStates[computedStates.length - 1];
|
|
716
|
+
computedStates = __spread(computedStates.slice(0, -1), [
|
|
717
|
+
computeNextEntry(reducer, liftedAction.action, lastState.state, lastState.error, errorHandler),
|
|
718
|
+
]);
|
|
719
|
+
minInvalidatedStateIndex = Infinity;
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
505
722
|
// Auto-commit as new actions come in.
|
|
506
723
|
if (options.maxAge && stagedActionIds.length === options.maxAge) {
|
|
507
724
|
commitExcessActions(1);
|
|
@@ -520,7 +737,9 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
520
737
|
}
|
|
521
738
|
case IMPORT_STATE: {
|
|
522
739
|
// Completely replace everything.
|
|
523
|
-
(
|
|
740
|
+
(_a = liftedAction.nextLiftedState, monitorState = _a.monitorState, actionsById = _a.actionsById, nextActionId = _a.nextActionId, stagedActionIds = _a.stagedActionIds, skippedActionIds = _a.skippedActionIds, committedState = _a.committedState, currentStateIndex = _a.currentStateIndex, computedStates = _a.computedStates, isLocked = _a.isLocked,
|
|
741
|
+
// prettier-ignore
|
|
742
|
+
isPaused = _a.isPaused);
|
|
524
743
|
break;
|
|
525
744
|
}
|
|
526
745
|
case store.INIT: {
|
|
@@ -528,7 +747,7 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
528
747
|
minInvalidatedStateIndex = 0;
|
|
529
748
|
if (options.maxAge && stagedActionIds.length > options.maxAge) {
|
|
530
749
|
// States must be recomputed before committing excess.
|
|
531
|
-
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler);
|
|
750
|
+
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler, isPaused);
|
|
532
751
|
commitExcessActions(stagedActionIds.length - options.maxAge);
|
|
533
752
|
// Avoid double computation.
|
|
534
753
|
minInvalidatedStateIndex = Infinity;
|
|
@@ -542,28 +761,29 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
542
761
|
minInvalidatedStateIndex = 0;
|
|
543
762
|
if (options.maxAge && stagedActionIds.length > options.maxAge) {
|
|
544
763
|
// States must be recomputed before committing excess.
|
|
545
|
-
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler);
|
|
764
|
+
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler, isPaused);
|
|
546
765
|
commitExcessActions(stagedActionIds.length - options.maxAge);
|
|
547
766
|
// Avoid double computation.
|
|
548
767
|
minInvalidatedStateIndex = Infinity;
|
|
549
768
|
}
|
|
550
769
|
}
|
|
551
770
|
else {
|
|
552
|
-
|
|
553
|
-
|
|
771
|
+
// If not paused/locked, add a new action to signal devtools-user
|
|
772
|
+
// that there was a reducer update.
|
|
773
|
+
if (!isPaused && !isLocked) {
|
|
774
|
+
if (currentStateIndex === stagedActionIds.length - 1) {
|
|
775
|
+
currentStateIndex++;
|
|
776
|
+
}
|
|
777
|
+
// Add a new action to only recompute state
|
|
778
|
+
var actionId = nextActionId++;
|
|
779
|
+
actionsById[actionId] = new PerformAction(liftedAction, +Date.now());
|
|
780
|
+
stagedActionIds = __spread(stagedActionIds, [actionId]);
|
|
781
|
+
minInvalidatedStateIndex = stagedActionIds.length - 1;
|
|
782
|
+
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler, isPaused);
|
|
554
783
|
}
|
|
555
|
-
// Add a new action to only recompute state
|
|
556
|
-
var actionId = nextActionId++;
|
|
557
|
-
actionsById[actionId] = new PerformAction(liftedAction, +Date.now());
|
|
558
|
-
stagedActionIds = __spread(stagedActionIds, [actionId]);
|
|
559
|
-
minInvalidatedStateIndex = stagedActionIds.length - 1;
|
|
560
|
-
// States must be recomputed before committing excess.
|
|
561
|
-
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler);
|
|
562
784
|
// Recompute state history with latest reducer and update action
|
|
563
|
-
computedStates = computedStates.map(function (cmp) {
|
|
564
|
-
|
|
565
|
-
});
|
|
566
|
-
currentStateIndex = minInvalidatedStateIndex;
|
|
785
|
+
computedStates = computedStates.map(function (cmp) { return (__assign$2({}, cmp, { state: reducer(cmp.state, RECOMPUTE_ACTION) })); });
|
|
786
|
+
currentStateIndex = stagedActionIds.length - 1;
|
|
567
787
|
if (options.maxAge && stagedActionIds.length > options.maxAge) {
|
|
568
788
|
commitExcessActions(stagedActionIds.length - options.maxAge);
|
|
569
789
|
}
|
|
@@ -579,7 +799,7 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
579
799
|
break;
|
|
580
800
|
}
|
|
581
801
|
}
|
|
582
|
-
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler);
|
|
802
|
+
computedStates = recomputeStates(computedStates, minInvalidatedStateIndex, reducer, committedState, actionsById, stagedActionIds, skippedActionIds, errorHandler, isPaused);
|
|
583
803
|
monitorState = monitorReducer(monitorState, liftedAction);
|
|
584
804
|
return {
|
|
585
805
|
monitorState: monitorState,
|
|
@@ -590,255 +810,238 @@ function liftReducerWith(initialCommittedState, initialLiftedState, errorHandler
|
|
|
590
810
|
committedState: committedState,
|
|
591
811
|
currentStateIndex: currentStateIndex,
|
|
592
812
|
computedStates: computedStates,
|
|
813
|
+
isLocked: isLocked,
|
|
814
|
+
isPaused: isPaused,
|
|
593
815
|
};
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
};
|
|
597
|
-
}
|
|
816
|
+
}; };
|
|
817
|
+
}
|
|
598
818
|
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
extendStatics(d, b);
|
|
605
|
-
function __() { this.constructor = d; }
|
|
606
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
819
|
+
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
820
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
821
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
822
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
823
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
607
824
|
};
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
825
|
+
var __metadata$1 = (undefined && undefined.__metadata) || function (k, v) {
|
|
826
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
827
|
+
};
|
|
828
|
+
var __param$1 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
|
829
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
830
|
+
};
|
|
831
|
+
var __read$1 = (undefined && undefined.__read) || function (o, n) {
|
|
832
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
833
|
+
if (!m) return o;
|
|
834
|
+
var i = m.call(o), r, ar = [], e;
|
|
618
835
|
try {
|
|
619
|
-
|
|
836
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
620
837
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
var DevtoolsDispatcher = /** @class */ (function (_super) {
|
|
626
|
-
__extends(DevtoolsDispatcher, _super);
|
|
627
|
-
function DevtoolsDispatcher() {
|
|
628
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
629
|
-
}
|
|
630
|
-
DevtoolsDispatcher.decorators = [
|
|
631
|
-
{ type: core.Injectable }
|
|
632
|
-
];
|
|
633
|
-
return DevtoolsDispatcher;
|
|
634
|
-
}(store.ActionsSubject));
|
|
635
|
-
var StoreDevtools = /** @class */ (function () {
|
|
636
|
-
function StoreDevtools(dispatcher, actions$, reducers$, extension, scannedActions, errorHandler, initialState, config) {
|
|
637
|
-
var _this = this;
|
|
638
|
-
var liftedInitialState = liftInitialState(initialState, config.monitor);
|
|
639
|
-
var liftReducer = liftReducerWith(initialState, liftedInitialState, errorHandler, config.monitor, config);
|
|
640
|
-
var liftedAction$ = rxjs.merge(rxjs.merge(actions$.asObservable().pipe(operators.skip(1)), extension.actions$).pipe(operators.map(liftAction)), dispatcher, extension.liftedActions$).pipe(operators.observeOn(rxjs.queueScheduler));
|
|
641
|
-
var liftedReducer$ = reducers$.pipe(operators.map(liftReducer));
|
|
642
|
-
var liftedStateSubject = new rxjs.ReplaySubject(1);
|
|
643
|
-
var liftedStateSubscription = liftedAction$
|
|
644
|
-
.pipe(operators.withLatestFrom(liftedReducer$), operators.scan(function (_a, _b) {
|
|
645
|
-
var liftedState = _a.state;
|
|
646
|
-
var _c = __read(_b, 2), action = _c[0], reducer = _c[1];
|
|
647
|
-
var reducedLiftedState = reducer(liftedState, action);
|
|
648
|
-
// // Extension should be sent the sanitized lifted state
|
|
649
|
-
extension.notify(action, reducedLiftedState);
|
|
650
|
-
return { state: reducedLiftedState, action: action };
|
|
651
|
-
}, { state: liftedInitialState, action: null }))
|
|
652
|
-
.subscribe(function (_a) {
|
|
653
|
-
var state = _a.state, action = _a.action;
|
|
654
|
-
liftedStateSubject.next(state);
|
|
655
|
-
if (action.type === PERFORM_ACTION) {
|
|
656
|
-
var unliftedAction = action.action;
|
|
657
|
-
scannedActions.next(unliftedAction);
|
|
838
|
+
catch (error) { e = { error: error }; }
|
|
839
|
+
finally {
|
|
840
|
+
try {
|
|
841
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
658
842
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
});
|
|
663
|
-
var liftedState$ = liftedStateSubject.asObservable();
|
|
664
|
-
var state$ = liftedState$.pipe(operators.map(unliftState));
|
|
665
|
-
this.extensionStartSubscription = extensionStartSubscription;
|
|
666
|
-
this.stateSubscription = liftedStateSubscription;
|
|
667
|
-
this.dispatcher = dispatcher;
|
|
668
|
-
this.liftedState = liftedState$;
|
|
669
|
-
this.state = state$;
|
|
670
|
-
}
|
|
671
|
-
StoreDevtools.prototype.dispatch = function (action) {
|
|
672
|
-
this.dispatcher.next(action);
|
|
673
|
-
};
|
|
674
|
-
StoreDevtools.prototype.next = function (action) {
|
|
675
|
-
this.dispatcher.next(action);
|
|
676
|
-
};
|
|
677
|
-
StoreDevtools.prototype.error = function (error) { };
|
|
678
|
-
StoreDevtools.prototype.complete = function () { };
|
|
679
|
-
StoreDevtools.prototype.performAction = function (action) {
|
|
680
|
-
this.dispatch(new PerformAction(action, +Date.now()));
|
|
681
|
-
};
|
|
682
|
-
StoreDevtools.prototype.refresh = function () {
|
|
683
|
-
this.dispatch(new Refresh());
|
|
684
|
-
};
|
|
685
|
-
StoreDevtools.prototype.reset = function () {
|
|
686
|
-
this.dispatch(new Reset(+Date.now()));
|
|
687
|
-
};
|
|
688
|
-
StoreDevtools.prototype.rollback = function () {
|
|
689
|
-
this.dispatch(new Rollback(+Date.now()));
|
|
690
|
-
};
|
|
691
|
-
StoreDevtools.prototype.commit = function () {
|
|
692
|
-
this.dispatch(new Commit(+Date.now()));
|
|
693
|
-
};
|
|
694
|
-
StoreDevtools.prototype.sweep = function () {
|
|
695
|
-
this.dispatch(new Sweep());
|
|
696
|
-
};
|
|
697
|
-
StoreDevtools.prototype.toggleAction = function (id) {
|
|
698
|
-
this.dispatch(new ToggleAction(id));
|
|
699
|
-
};
|
|
700
|
-
StoreDevtools.prototype.jumpToAction = function (actionId) {
|
|
701
|
-
this.dispatch(new JumpToAction(actionId));
|
|
702
|
-
};
|
|
703
|
-
StoreDevtools.prototype.jumpToState = function (index) {
|
|
704
|
-
this.dispatch(new JumpToState(index));
|
|
705
|
-
};
|
|
706
|
-
StoreDevtools.prototype.importState = function (nextLiftedState) {
|
|
707
|
-
this.dispatch(new ImportState(nextLiftedState));
|
|
843
|
+
finally { if (e) throw e.error; }
|
|
844
|
+
}
|
|
845
|
+
return ar;
|
|
708
846
|
};
|
|
709
|
-
StoreDevtools
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
847
|
+
var StoreDevtools = /** @class */ (function () {
|
|
848
|
+
function StoreDevtools(dispatcher, actions$, reducers$, extension, scannedActions, errorHandler, initialState, config) {
|
|
849
|
+
var _this = this;
|
|
850
|
+
var liftedInitialState = liftInitialState(initialState, config.monitor);
|
|
851
|
+
var liftReducer = liftReducerWith(initialState, liftedInitialState, errorHandler, config.monitor, config);
|
|
852
|
+
var liftedAction$ = rxjs.merge(rxjs.merge(actions$.asObservable().pipe(operators.skip(1)), extension.actions$).pipe(operators.map(liftAction)), dispatcher, extension.liftedActions$).pipe(operators.observeOn(rxjs.queueScheduler));
|
|
853
|
+
var liftedReducer$ = reducers$.pipe(operators.map(liftReducer));
|
|
854
|
+
var liftedStateSubject = new rxjs.ReplaySubject(1);
|
|
855
|
+
var liftedStateSubscription = liftedAction$
|
|
856
|
+
.pipe(operators.withLatestFrom(liftedReducer$), operators.scan(function (_a, _b) {
|
|
857
|
+
var liftedState = _a.state;
|
|
858
|
+
var _c = __read$1(_b, 2), action = _c[0], reducer = _c[1];
|
|
859
|
+
var reducedLiftedState = reducer(liftedState, action);
|
|
860
|
+
// On full state update
|
|
861
|
+
// If we have actions filters, we must filter completly our lifted state to be sync with the extension
|
|
862
|
+
if (action.type !== PERFORM_ACTION && shouldFilterActions(config)) {
|
|
863
|
+
reducedLiftedState = filterLiftedState(reducedLiftedState, config.predicate, config.actionsWhitelist, config.actionsBlacklist);
|
|
864
|
+
}
|
|
865
|
+
// Extension should be sent the sanitized lifted state
|
|
866
|
+
extension.notify(action, reducedLiftedState);
|
|
867
|
+
return { state: reducedLiftedState, action: action };
|
|
868
|
+
}, { state: liftedInitialState, action: null }))
|
|
869
|
+
.subscribe(function (_a) {
|
|
870
|
+
var state = _a.state, action = _a.action;
|
|
871
|
+
liftedStateSubject.next(state);
|
|
872
|
+
if (action.type === PERFORM_ACTION) {
|
|
873
|
+
var unliftedAction = action.action;
|
|
874
|
+
scannedActions.next(unliftedAction);
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
var extensionStartSubscription = extension.start$.subscribe(function () {
|
|
878
|
+
_this.refresh();
|
|
879
|
+
});
|
|
880
|
+
var liftedState$ = liftedStateSubject.asObservable();
|
|
881
|
+
var state$ = liftedState$.pipe(operators.map(unliftState));
|
|
882
|
+
this.extensionStartSubscription = extensionStartSubscription;
|
|
883
|
+
this.stateSubscription = liftedStateSubscription;
|
|
884
|
+
this.dispatcher = dispatcher;
|
|
885
|
+
this.liftedState = liftedState$;
|
|
886
|
+
this.state = state$;
|
|
887
|
+
}
|
|
888
|
+
StoreDevtools.prototype.dispatch = function (action) {
|
|
889
|
+
this.dispatcher.next(action);
|
|
890
|
+
};
|
|
891
|
+
StoreDevtools.prototype.next = function (action) {
|
|
892
|
+
this.dispatcher.next(action);
|
|
893
|
+
};
|
|
894
|
+
StoreDevtools.prototype.error = function (error) { };
|
|
895
|
+
StoreDevtools.prototype.complete = function () { };
|
|
896
|
+
StoreDevtools.prototype.performAction = function (action) {
|
|
897
|
+
this.dispatch(new PerformAction(action, +Date.now()));
|
|
898
|
+
};
|
|
899
|
+
StoreDevtools.prototype.refresh = function () {
|
|
900
|
+
this.dispatch(new Refresh());
|
|
901
|
+
};
|
|
902
|
+
StoreDevtools.prototype.reset = function () {
|
|
903
|
+
this.dispatch(new Reset(+Date.now()));
|
|
904
|
+
};
|
|
905
|
+
StoreDevtools.prototype.rollback = function () {
|
|
906
|
+
this.dispatch(new Rollback(+Date.now()));
|
|
907
|
+
};
|
|
908
|
+
StoreDevtools.prototype.commit = function () {
|
|
909
|
+
this.dispatch(new Commit(+Date.now()));
|
|
910
|
+
};
|
|
911
|
+
StoreDevtools.prototype.sweep = function () {
|
|
912
|
+
this.dispatch(new Sweep());
|
|
913
|
+
};
|
|
914
|
+
StoreDevtools.prototype.toggleAction = function (id) {
|
|
915
|
+
this.dispatch(new ToggleAction(id));
|
|
916
|
+
};
|
|
917
|
+
StoreDevtools.prototype.jumpToAction = function (actionId) {
|
|
918
|
+
this.dispatch(new JumpToAction(actionId));
|
|
919
|
+
};
|
|
920
|
+
StoreDevtools.prototype.jumpToState = function (index) {
|
|
921
|
+
this.dispatch(new JumpToState(index));
|
|
922
|
+
};
|
|
923
|
+
StoreDevtools.prototype.importState = function (nextLiftedState) {
|
|
924
|
+
this.dispatch(new ImportState(nextLiftedState));
|
|
925
|
+
};
|
|
926
|
+
StoreDevtools.prototype.lockChanges = function (status) {
|
|
927
|
+
this.dispatch(new LockChanges(status));
|
|
928
|
+
};
|
|
929
|
+
StoreDevtools.prototype.pauseRecording = function (status) {
|
|
930
|
+
this.dispatch(new PauseRecording(status));
|
|
931
|
+
};
|
|
932
|
+
StoreDevtools = __decorate$2([
|
|
933
|
+
core.Injectable(),
|
|
934
|
+
__param$1(6, core.Inject(store.INITIAL_STATE)),
|
|
935
|
+
__param$1(7, core.Inject(STORE_DEVTOOLS_CONFIG)),
|
|
936
|
+
__metadata$1("design:paramtypes", [DevtoolsDispatcher,
|
|
937
|
+
store.ActionsSubject,
|
|
938
|
+
store.ReducerObservable,
|
|
939
|
+
DevtoolsExtension,
|
|
940
|
+
store.ScannedActionsSubject,
|
|
941
|
+
core.ErrorHandler, Object, StoreDevtoolsConfig])
|
|
942
|
+
], StoreDevtools);
|
|
943
|
+
return StoreDevtools;
|
|
944
|
+
}());
|
|
725
945
|
|
|
726
|
-
var
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
var extensionKey = '__REDUX_DEVTOOLS_EXTENSION__';
|
|
732
|
-
if (typeof window === 'object' &&
|
|
733
|
-
typeof window[extensionKey] !== 'undefined') {
|
|
734
|
-
return window[extensionKey];
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
return null;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
function createStateObservable(devtools) {
|
|
741
|
-
return devtools.state;
|
|
742
|
-
}
|
|
743
|
-
function noMonitor() {
|
|
744
|
-
return null;
|
|
745
|
-
}
|
|
746
|
-
var DEFAULT_NAME = 'NgRx Store DevTools';
|
|
747
|
-
function createConfig(_options) {
|
|
748
|
-
var DEFAULT_OPTIONS = {
|
|
749
|
-
maxAge: false,
|
|
750
|
-
monitor: noMonitor,
|
|
751
|
-
actionSanitizer: undefined,
|
|
752
|
-
stateSanitizer: undefined,
|
|
753
|
-
name: DEFAULT_NAME,
|
|
754
|
-
serialize: false,
|
|
755
|
-
logOnly: false,
|
|
756
|
-
features: false,
|
|
946
|
+
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
947
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
948
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
949
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
950
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
757
951
|
};
|
|
758
|
-
var
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
: false;
|
|
762
|
-
var features = options.features || logOnly;
|
|
763
|
-
var config = Object.assign({}, DEFAULT_OPTIONS, { features: features }, options);
|
|
764
|
-
if (config.maxAge && config.maxAge < 2) {
|
|
765
|
-
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + config.maxAge);
|
|
952
|
+
var IS_EXTENSION_OR_MONITOR_PRESENT = new core.InjectionToken('Is Devtools Extension or Monitor Present');
|
|
953
|
+
function createIsExtensionOrMonitorPresent(extension, config) {
|
|
954
|
+
return Boolean(extension) || config.monitor !== noMonitor;
|
|
766
955
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
956
|
+
function createReduxDevtoolsExtension() {
|
|
957
|
+
var extensionKey = '__REDUX_DEVTOOLS_EXTENSION__';
|
|
958
|
+
if (typeof window === 'object' &&
|
|
959
|
+
typeof window[extensionKey] !== 'undefined') {
|
|
960
|
+
return window[extensionKey];
|
|
961
|
+
}
|
|
962
|
+
else {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
771
965
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
966
|
+
function createStateObservable(devtools) {
|
|
967
|
+
return devtools.state;
|
|
968
|
+
}
|
|
969
|
+
var StoreDevtoolsModule = /** @class */ (function () {
|
|
970
|
+
function StoreDevtoolsModule() {
|
|
971
|
+
}
|
|
972
|
+
StoreDevtoolsModule_1 = StoreDevtoolsModule;
|
|
973
|
+
StoreDevtoolsModule.instrument = function (options) {
|
|
974
|
+
if (options === void 0) { options = {}; }
|
|
975
|
+
return {
|
|
976
|
+
ngModule: StoreDevtoolsModule_1,
|
|
977
|
+
providers: [
|
|
978
|
+
DevtoolsExtension,
|
|
979
|
+
DevtoolsDispatcher,
|
|
980
|
+
StoreDevtools,
|
|
981
|
+
{
|
|
982
|
+
provide: INITIAL_OPTIONS,
|
|
983
|
+
useValue: options,
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
provide: IS_EXTENSION_OR_MONITOR_PRESENT,
|
|
987
|
+
deps: [REDUX_DEVTOOLS_EXTENSION, STORE_DEVTOOLS_CONFIG],
|
|
988
|
+
useFactory: createIsExtensionOrMonitorPresent,
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
provide: REDUX_DEVTOOLS_EXTENSION,
|
|
992
|
+
useFactory: createReduxDevtoolsExtension,
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
provide: STORE_DEVTOOLS_CONFIG,
|
|
996
|
+
deps: [INITIAL_OPTIONS],
|
|
997
|
+
useFactory: createConfig,
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
provide: store.StateObservable,
|
|
1001
|
+
deps: [StoreDevtools],
|
|
1002
|
+
useFactory: createStateObservable,
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
provide: store.ReducerManagerDispatcher,
|
|
1006
|
+
useExisting: DevtoolsDispatcher,
|
|
1007
|
+
},
|
|
1008
|
+
],
|
|
1009
|
+
};
|
|
808
1010
|
};
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}());
|
|
1011
|
+
var StoreDevtoolsModule_1;
|
|
1012
|
+
StoreDevtoolsModule = StoreDevtoolsModule_1 = __decorate$3([
|
|
1013
|
+
core.NgModule({})
|
|
1014
|
+
], StoreDevtoolsModule);
|
|
1015
|
+
return StoreDevtoolsModule;
|
|
1016
|
+
}());
|
|
815
1017
|
|
|
816
|
-
/**
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1018
|
+
/**
|
|
1019
|
+
* DO NOT EDIT
|
|
1020
|
+
*
|
|
1021
|
+
* This file is automatically generated at build
|
|
1022
|
+
*/
|
|
821
1023
|
|
|
822
|
-
/**
|
|
823
|
-
|
|
824
|
-
|
|
1024
|
+
/**
|
|
1025
|
+
* Generated bundle index. Do not edit.
|
|
1026
|
+
*/
|
|
825
1027
|
|
|
826
|
-
exports.ɵ
|
|
827
|
-
exports.ɵ
|
|
828
|
-
exports.ɵ
|
|
829
|
-
exports.ɵ
|
|
830
|
-
exports.ɵ
|
|
831
|
-
exports.ɵ
|
|
832
|
-
exports.ɵ
|
|
833
|
-
exports.ɵ
|
|
834
|
-
exports.ɵ
|
|
835
|
-
exports.ɵ
|
|
836
|
-
exports.ɵ
|
|
837
|
-
exports.StoreDevtoolsModule = StoreDevtoolsModule;
|
|
838
|
-
exports.
|
|
839
|
-
exports.
|
|
1028
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_f = INITIAL_OPTIONS;
|
|
1029
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_e = STORE_DEVTOOLS_CONFIG;
|
|
1030
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_h = createConfig;
|
|
1031
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_g = noMonitor;
|
|
1032
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_k = DevtoolsDispatcher;
|
|
1033
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_j = DevtoolsExtension;
|
|
1034
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_i = REDUX_DEVTOOLS_EXTENSION;
|
|
1035
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_a = IS_EXTENSION_OR_MONITOR_PRESENT;
|
|
1036
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_b = createIsExtensionOrMonitorPresent;
|
|
1037
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_c = createReduxDevtoolsExtension;
|
|
1038
|
+
exports.ɵngrx_modules_store_devtools_store_devtools_d = createStateObservable;
|
|
1039
|
+
exports.StoreDevtoolsModule = StoreDevtoolsModule;
|
|
1040
|
+
exports.RECOMPUTE = RECOMPUTE;
|
|
1041
|
+
exports.StoreDevtools = StoreDevtools;
|
|
1042
|
+
exports.StoreDevtoolsConfig = StoreDevtoolsConfig;
|
|
840
1043
|
|
|
841
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1044
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
842
1045
|
|
|
843
1046
|
})));
|
|
844
1047
|
//# sourceMappingURL=store-devtools.umd.js.map
|