@ngxs/devtools-plugin 3.7.3-dev.master-10b0883 → 3.7.4
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/README.md +3 -3
- package/bundles/ngxs-devtools-plugin.umd.js +378 -378
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js.map +1 -1
- package/esm2015/index.js +9 -9
- package/esm2015/ngxs-devtools-plugin.js +9 -9
- package/esm2015/src/devtools.module.js +48 -48
- package/esm2015/src/devtools.plugin.js +220 -220
- package/esm2015/src/public_api.js +8 -8
- package/esm2015/src/symbols.js +78 -78
- package/esm5/index.js +9 -9
- package/esm5/ngxs-devtools-plugin.js +9 -9
- package/esm5/src/devtools.module.js +57 -57
- package/esm5/src/devtools.plugin.js +262 -262
- package/esm5/src/public_api.js +8 -8
- package/esm5/src/symbols.js +78 -78
- package/fesm2015/ngxs-devtools-plugin.js +340 -340
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/fesm5/ngxs-devtools-plugin.js +387 -387
- package/fesm5/ngxs-devtools-plugin.js.map +1 -1
- package/index.d.ts +4 -4
- package/ngxs-devtools-plugin.d.ts +5 -5
- package/package.json +3 -3
- package/src/devtools.module.d.ts +13 -13
- package/src/devtools.plugin.d.ts +31 -31
- package/src/public_api.d.ts +3 -3
- package/src/symbols.d.ts +39 -39
|
@@ -3,403 +3,403 @@ import { InjectionToken, ɵglobal, Injectable, Inject, Injector, NgZone, NgModul
|
|
|
3
3
|
import { Store, getActionTypeFromInstance, NGXS_PLUGINS } from '@ngxs/store';
|
|
4
4
|
import { catchError, tap } from 'rxjs/operators';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview added by tsickle
|
|
8
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Interface for the redux-devtools-extension API.
|
|
12
|
-
* @record
|
|
13
|
-
*/
|
|
14
|
-
function NgxsDevtoolsExtension() { }
|
|
15
|
-
if (false) {
|
|
16
|
-
/**
|
|
17
|
-
* @param {?} state
|
|
18
|
-
* @return {?}
|
|
19
|
-
*/
|
|
20
|
-
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
21
|
-
/**
|
|
22
|
-
* @param {?} action
|
|
23
|
-
* @param {?=} state
|
|
24
|
-
* @return {?}
|
|
25
|
-
*/
|
|
26
|
-
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
27
|
-
/**
|
|
28
|
-
* @param {?} fn
|
|
29
|
-
* @return {?}
|
|
30
|
-
*/
|
|
31
|
-
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @record
|
|
35
|
-
*/
|
|
36
|
-
function NgxsDevtoolsAction() { }
|
|
37
|
-
if (false) {
|
|
38
|
-
/** @type {?} */
|
|
39
|
-
NgxsDevtoolsAction.prototype.type;
|
|
40
|
-
/** @type {?} */
|
|
41
|
-
NgxsDevtoolsAction.prototype.payload;
|
|
42
|
-
/** @type {?} */
|
|
43
|
-
NgxsDevtoolsAction.prototype.state;
|
|
44
|
-
/** @type {?} */
|
|
45
|
-
NgxsDevtoolsAction.prototype.id;
|
|
46
|
-
/** @type {?} */
|
|
47
|
-
NgxsDevtoolsAction.prototype.source;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @record
|
|
51
|
-
*/
|
|
52
|
-
function NgxsDevtoolsOptions() { }
|
|
53
|
-
if (false) {
|
|
54
|
-
/**
|
|
55
|
-
* The name of the extension
|
|
56
|
-
* @type {?|undefined}
|
|
57
|
-
*/
|
|
58
|
-
NgxsDevtoolsOptions.prototype.name;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
61
|
-
* @type {?|undefined}
|
|
62
|
-
*/
|
|
63
|
-
NgxsDevtoolsOptions.prototype.disabled;
|
|
64
|
-
/**
|
|
65
|
-
* Max number of entiries to keep.
|
|
66
|
-
* @type {?|undefined}
|
|
67
|
-
*/
|
|
68
|
-
NgxsDevtoolsOptions.prototype.maxAge;
|
|
69
|
-
/**
|
|
70
|
-
* Reformat actions before sending to dev tools
|
|
71
|
-
* @type {?|undefined}
|
|
72
|
-
*/
|
|
73
|
-
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
74
|
-
/**
|
|
75
|
-
* Reformat state before sending to devtools
|
|
76
|
-
* @type {?|undefined}
|
|
77
|
-
*/
|
|
78
|
-
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
79
|
-
}
|
|
80
|
-
/** @type {?} */
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview added by tsickle
|
|
8
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Interface for the redux-devtools-extension API.
|
|
12
|
+
* @record
|
|
13
|
+
*/
|
|
14
|
+
function NgxsDevtoolsExtension() { }
|
|
15
|
+
if (false) {
|
|
16
|
+
/**
|
|
17
|
+
* @param {?} state
|
|
18
|
+
* @return {?}
|
|
19
|
+
*/
|
|
20
|
+
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
21
|
+
/**
|
|
22
|
+
* @param {?} action
|
|
23
|
+
* @param {?=} state
|
|
24
|
+
* @return {?}
|
|
25
|
+
*/
|
|
26
|
+
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
27
|
+
/**
|
|
28
|
+
* @param {?} fn
|
|
29
|
+
* @return {?}
|
|
30
|
+
*/
|
|
31
|
+
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @record
|
|
35
|
+
*/
|
|
36
|
+
function NgxsDevtoolsAction() { }
|
|
37
|
+
if (false) {
|
|
38
|
+
/** @type {?} */
|
|
39
|
+
NgxsDevtoolsAction.prototype.type;
|
|
40
|
+
/** @type {?} */
|
|
41
|
+
NgxsDevtoolsAction.prototype.payload;
|
|
42
|
+
/** @type {?} */
|
|
43
|
+
NgxsDevtoolsAction.prototype.state;
|
|
44
|
+
/** @type {?} */
|
|
45
|
+
NgxsDevtoolsAction.prototype.id;
|
|
46
|
+
/** @type {?} */
|
|
47
|
+
NgxsDevtoolsAction.prototype.source;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @record
|
|
51
|
+
*/
|
|
52
|
+
function NgxsDevtoolsOptions() { }
|
|
53
|
+
if (false) {
|
|
54
|
+
/**
|
|
55
|
+
* The name of the extension
|
|
56
|
+
* @type {?|undefined}
|
|
57
|
+
*/
|
|
58
|
+
NgxsDevtoolsOptions.prototype.name;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
61
|
+
* @type {?|undefined}
|
|
62
|
+
*/
|
|
63
|
+
NgxsDevtoolsOptions.prototype.disabled;
|
|
64
|
+
/**
|
|
65
|
+
* Max number of entiries to keep.
|
|
66
|
+
* @type {?|undefined}
|
|
67
|
+
*/
|
|
68
|
+
NgxsDevtoolsOptions.prototype.maxAge;
|
|
69
|
+
/**
|
|
70
|
+
* Reformat actions before sending to dev tools
|
|
71
|
+
* @type {?|undefined}
|
|
72
|
+
*/
|
|
73
|
+
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
74
|
+
/**
|
|
75
|
+
* Reformat state before sending to devtools
|
|
76
|
+
* @type {?|undefined}
|
|
77
|
+
*/
|
|
78
|
+
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
79
|
+
}
|
|
80
|
+
/** @type {?} */
|
|
81
81
|
var NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* @fileoverview added by tsickle
|
|
85
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
86
|
-
*/
|
|
87
|
-
/** @enum {string} */
|
|
88
|
-
var ReduxDevtoolsActionType = {
|
|
89
|
-
Dispatch: 'DISPATCH',
|
|
90
|
-
Action: 'ACTION',
|
|
91
|
-
};
|
|
92
|
-
/** @enum {string} */
|
|
93
|
-
var ReduxDevtoolsPayloadType = {
|
|
94
|
-
JumpToAction: 'JUMP_TO_ACTION',
|
|
95
|
-
JumpToState: 'JUMP_TO_STATE',
|
|
96
|
-
ToggleAction: 'TOGGLE_ACTION',
|
|
97
|
-
ImportState: 'IMPORT_STATE',
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Adds support for the Redux Devtools extension:
|
|
101
|
-
* http://extension.remotedev.io/
|
|
102
|
-
*/
|
|
103
|
-
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
104
|
-
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
105
|
-
this._options = _options;
|
|
106
|
-
this._injector = _injector;
|
|
107
|
-
this._ngZone = _ngZone;
|
|
108
|
-
this.devtoolsExtension = null;
|
|
109
|
-
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
110
|
-
this.unsubscribe = null;
|
|
111
|
-
this.connect();
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @return {?}
|
|
115
|
-
*/
|
|
116
|
-
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
117
|
-
* @return {?}
|
|
118
|
-
*/
|
|
119
|
-
function () {
|
|
120
|
-
if (this.unsubscribe !== null) {
|
|
121
|
-
this.unsubscribe();
|
|
122
|
-
}
|
|
123
|
-
if (this.globalDevtools) {
|
|
124
|
-
this.globalDevtools.disconnect();
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
128
|
-
/**
|
|
129
|
-
* Lazy get the store for circular dependency issues
|
|
130
|
-
*/
|
|
131
|
-
get: /**
|
|
132
|
-
* Lazy get the store for circular dependency issues
|
|
133
|
-
* @private
|
|
134
|
-
* @return {?}
|
|
135
|
-
*/
|
|
136
|
-
function () {
|
|
137
|
-
return this._injector.get(Store);
|
|
138
|
-
},
|
|
139
|
-
enumerable: true,
|
|
140
|
-
configurable: true
|
|
141
|
-
});
|
|
142
|
-
/**
|
|
143
|
-
* Middleware handle function
|
|
144
|
-
*/
|
|
145
|
-
/**
|
|
146
|
-
* Middleware handle function
|
|
147
|
-
* @param {?} state
|
|
148
|
-
* @param {?} action
|
|
149
|
-
* @param {?} next
|
|
150
|
-
* @return {?}
|
|
151
|
-
*/
|
|
152
|
-
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
153
|
-
* Middleware handle function
|
|
154
|
-
* @param {?} state
|
|
155
|
-
* @param {?} action
|
|
156
|
-
* @param {?} next
|
|
157
|
-
* @return {?}
|
|
158
|
-
*/
|
|
159
|
-
function (state, action, next) {
|
|
160
|
-
var _this = this;
|
|
161
|
-
if (!this.devtoolsExtension || this._options.disabled) {
|
|
162
|
-
return next(state, action);
|
|
163
|
-
}
|
|
164
|
-
return next(state, action).pipe(catchError((/**
|
|
165
|
-
* @param {?} error
|
|
166
|
-
* @return {?}
|
|
167
|
-
*/
|
|
168
|
-
function (error) {
|
|
169
|
-
/** @type {?} */
|
|
170
|
-
var newState = _this.store.snapshot();
|
|
171
|
-
_this.sendToDevTools(state, action, newState);
|
|
172
|
-
throw error;
|
|
173
|
-
})), tap((/**
|
|
174
|
-
* @param {?} newState
|
|
175
|
-
* @return {?}
|
|
176
|
-
*/
|
|
177
|
-
function (newState) {
|
|
178
|
-
_this.sendToDevTools(state, action, newState);
|
|
179
|
-
})));
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* @private
|
|
183
|
-
* @param {?} state
|
|
184
|
-
* @param {?} action
|
|
185
|
-
* @param {?} newState
|
|
186
|
-
* @return {?}
|
|
187
|
-
*/
|
|
188
|
-
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
189
|
-
* @private
|
|
190
|
-
* @param {?} state
|
|
191
|
-
* @param {?} action
|
|
192
|
-
* @param {?} newState
|
|
193
|
-
* @return {?}
|
|
194
|
-
*/
|
|
195
|
-
function (state, action, newState) {
|
|
196
|
-
/** @type {?} */
|
|
197
|
-
var type = getActionTypeFromInstance(action);
|
|
198
|
-
// if init action, send initial state to dev tools
|
|
199
|
-
/** @type {?} */
|
|
200
|
-
var isInitAction = type === '@@INIT';
|
|
201
|
-
if (isInitAction) {
|
|
202
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* Handle the action from the dev tools subscription
|
|
210
|
-
*/
|
|
211
|
-
/**
|
|
212
|
-
* Handle the action from the dev tools subscription
|
|
213
|
-
* @param {?} action
|
|
214
|
-
* @return {?}
|
|
215
|
-
*/
|
|
216
|
-
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
217
|
-
* Handle the action from the dev tools subscription
|
|
218
|
-
* @param {?} action
|
|
219
|
-
* @return {?}
|
|
220
|
-
*/
|
|
221
|
-
function (action) {
|
|
222
|
-
var _this = this;
|
|
223
|
-
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
224
|
-
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
225
|
-
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
226
|
-
/** @type {?} */
|
|
227
|
-
var prevState = JSON.parse(action.state);
|
|
228
|
-
this.store.reset(prevState);
|
|
229
|
-
}
|
|
230
|
-
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
231
|
-
console.warn('Skip is not supported at this time.');
|
|
232
|
-
}
|
|
233
|
-
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
234
|
-
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
235
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
236
|
-
Object.keys(actionsById_1)
|
|
237
|
-
.filter((/**
|
|
238
|
-
* @param {?} actionId
|
|
239
|
-
* @return {?}
|
|
240
|
-
*/
|
|
241
|
-
function (actionId) { return actionId !== '0'; }))
|
|
242
|
-
.forEach((/**
|
|
243
|
-
* @param {?} actionId
|
|
244
|
-
* @return {?}
|
|
245
|
-
*/
|
|
246
|
-
function (actionId) {
|
|
247
|
-
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
248
|
-
}));
|
|
249
|
-
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
else if (action.type === "ACTION" /* Action */) {
|
|
253
|
-
/** @type {?} */
|
|
254
|
-
var actionPayload = JSON.parse(action.payload);
|
|
255
|
-
this.store.dispatch(actionPayload);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
/**
|
|
259
|
-
* @private
|
|
260
|
-
* @return {?}
|
|
261
|
-
*/
|
|
262
|
-
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
263
|
-
* @private
|
|
264
|
-
* @return {?}
|
|
265
|
-
*/
|
|
266
|
-
function () {
|
|
267
|
-
var _this = this;
|
|
268
|
-
if (!this.globalDevtools || this._options.disabled) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
// The `connect` method adds `message` event listener since it communicates
|
|
272
|
-
// with an extension through `window.postMessage` and message events.
|
|
273
|
-
// We handle only 2 events; thus, we don't want to run many change detections
|
|
274
|
-
// because the extension sends events that we don't have to handle.
|
|
275
|
-
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
276
|
-
* @return {?}
|
|
277
|
-
*/
|
|
278
|
-
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
279
|
-
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
280
|
-
* @param {?} action
|
|
281
|
-
* @return {?}
|
|
282
|
-
*/
|
|
283
|
-
function (action) {
|
|
284
|
-
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
285
|
-
action.type === "ACTION" /* Action */) {
|
|
286
|
-
_this._ngZone.run((/**
|
|
287
|
-
* @return {?}
|
|
288
|
-
*/
|
|
289
|
-
function () {
|
|
290
|
-
_this.dispatched(action);
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
}));
|
|
294
|
-
};
|
|
295
|
-
NgxsReduxDevtoolsPlugin.decorators = [
|
|
296
|
-
{ type: Injectable }
|
|
297
|
-
];
|
|
298
|
-
/** @nocollapse */
|
|
299
|
-
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
300
|
-
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
301
|
-
{ type: Injector },
|
|
302
|
-
{ type: NgZone }
|
|
303
|
-
]; };
|
|
304
|
-
return NgxsReduxDevtoolsPlugin;
|
|
305
|
-
}());
|
|
306
|
-
if (false) {
|
|
307
|
-
/**
|
|
308
|
-
* @type {?}
|
|
309
|
-
* @private
|
|
310
|
-
*/
|
|
311
|
-
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
312
|
-
/**
|
|
313
|
-
* @type {?}
|
|
314
|
-
* @private
|
|
315
|
-
*/
|
|
316
|
-
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
317
|
-
/**
|
|
318
|
-
* @type {?}
|
|
319
|
-
* @private
|
|
320
|
-
*/
|
|
321
|
-
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
322
|
-
/**
|
|
323
|
-
* @type {?}
|
|
324
|
-
* @private
|
|
325
|
-
*/
|
|
326
|
-
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
327
|
-
/**
|
|
328
|
-
* @type {?}
|
|
329
|
-
* @private
|
|
330
|
-
*/
|
|
331
|
-
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
332
|
-
/**
|
|
333
|
-
* @type {?}
|
|
334
|
-
* @private
|
|
335
|
-
*/
|
|
336
|
-
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
83
|
+
/**
|
|
84
|
+
* @fileoverview added by tsickle
|
|
85
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
86
|
+
*/
|
|
87
|
+
/** @enum {string} */
|
|
88
|
+
var ReduxDevtoolsActionType = {
|
|
89
|
+
Dispatch: 'DISPATCH',
|
|
90
|
+
Action: 'ACTION',
|
|
91
|
+
};
|
|
92
|
+
/** @enum {string} */
|
|
93
|
+
var ReduxDevtoolsPayloadType = {
|
|
94
|
+
JumpToAction: 'JUMP_TO_ACTION',
|
|
95
|
+
JumpToState: 'JUMP_TO_STATE',
|
|
96
|
+
ToggleAction: 'TOGGLE_ACTION',
|
|
97
|
+
ImportState: 'IMPORT_STATE',
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Adds support for the Redux Devtools extension:
|
|
101
|
+
* http://extension.remotedev.io/
|
|
102
|
+
*/
|
|
103
|
+
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
104
|
+
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
105
|
+
this._options = _options;
|
|
106
|
+
this._injector = _injector;
|
|
107
|
+
this._ngZone = _ngZone;
|
|
108
|
+
this.devtoolsExtension = null;
|
|
109
|
+
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
110
|
+
this.unsubscribe = null;
|
|
111
|
+
this.connect();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @return {?}
|
|
115
|
+
*/
|
|
116
|
+
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
117
|
+
* @return {?}
|
|
118
|
+
*/
|
|
119
|
+
function () {
|
|
120
|
+
if (this.unsubscribe !== null) {
|
|
121
|
+
this.unsubscribe();
|
|
122
|
+
}
|
|
123
|
+
if (this.globalDevtools) {
|
|
124
|
+
this.globalDevtools.disconnect();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
128
|
+
/**
|
|
129
|
+
* Lazy get the store for circular dependency issues
|
|
130
|
+
*/
|
|
131
|
+
get: /**
|
|
132
|
+
* Lazy get the store for circular dependency issues
|
|
133
|
+
* @private
|
|
134
|
+
* @return {?}
|
|
135
|
+
*/
|
|
136
|
+
function () {
|
|
137
|
+
return this._injector.get(Store);
|
|
138
|
+
},
|
|
139
|
+
enumerable: true,
|
|
140
|
+
configurable: true
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Middleware handle function
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* Middleware handle function
|
|
147
|
+
* @param {?} state
|
|
148
|
+
* @param {?} action
|
|
149
|
+
* @param {?} next
|
|
150
|
+
* @return {?}
|
|
151
|
+
*/
|
|
152
|
+
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
153
|
+
* Middleware handle function
|
|
154
|
+
* @param {?} state
|
|
155
|
+
* @param {?} action
|
|
156
|
+
* @param {?} next
|
|
157
|
+
* @return {?}
|
|
158
|
+
*/
|
|
159
|
+
function (state, action, next) {
|
|
160
|
+
var _this = this;
|
|
161
|
+
if (!this.devtoolsExtension || this._options.disabled) {
|
|
162
|
+
return next(state, action);
|
|
163
|
+
}
|
|
164
|
+
return next(state, action).pipe(catchError((/**
|
|
165
|
+
* @param {?} error
|
|
166
|
+
* @return {?}
|
|
167
|
+
*/
|
|
168
|
+
function (error) {
|
|
169
|
+
/** @type {?} */
|
|
170
|
+
var newState = _this.store.snapshot();
|
|
171
|
+
_this.sendToDevTools(state, action, newState);
|
|
172
|
+
throw error;
|
|
173
|
+
})), tap((/**
|
|
174
|
+
* @param {?} newState
|
|
175
|
+
* @return {?}
|
|
176
|
+
*/
|
|
177
|
+
function (newState) {
|
|
178
|
+
_this.sendToDevTools(state, action, newState);
|
|
179
|
+
})));
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @private
|
|
183
|
+
* @param {?} state
|
|
184
|
+
* @param {?} action
|
|
185
|
+
* @param {?} newState
|
|
186
|
+
* @return {?}
|
|
187
|
+
*/
|
|
188
|
+
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
189
|
+
* @private
|
|
190
|
+
* @param {?} state
|
|
191
|
+
* @param {?} action
|
|
192
|
+
* @param {?} newState
|
|
193
|
+
* @return {?}
|
|
194
|
+
*/
|
|
195
|
+
function (state, action, newState) {
|
|
196
|
+
/** @type {?} */
|
|
197
|
+
var type = getActionTypeFromInstance(action);
|
|
198
|
+
// if init action, send initial state to dev tools
|
|
199
|
+
/** @type {?} */
|
|
200
|
+
var isInitAction = type === '@@INIT';
|
|
201
|
+
if (isInitAction) {
|
|
202
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Handle the action from the dev tools subscription
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* Handle the action from the dev tools subscription
|
|
213
|
+
* @param {?} action
|
|
214
|
+
* @return {?}
|
|
215
|
+
*/
|
|
216
|
+
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
217
|
+
* Handle the action from the dev tools subscription
|
|
218
|
+
* @param {?} action
|
|
219
|
+
* @return {?}
|
|
220
|
+
*/
|
|
221
|
+
function (action) {
|
|
222
|
+
var _this = this;
|
|
223
|
+
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
224
|
+
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
225
|
+
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
226
|
+
/** @type {?} */
|
|
227
|
+
var prevState = JSON.parse(action.state);
|
|
228
|
+
this.store.reset(prevState);
|
|
229
|
+
}
|
|
230
|
+
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
231
|
+
console.warn('Skip is not supported at this time.');
|
|
232
|
+
}
|
|
233
|
+
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
234
|
+
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
235
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
236
|
+
Object.keys(actionsById_1)
|
|
237
|
+
.filter((/**
|
|
238
|
+
* @param {?} actionId
|
|
239
|
+
* @return {?}
|
|
240
|
+
*/
|
|
241
|
+
function (actionId) { return actionId !== '0'; }))
|
|
242
|
+
.forEach((/**
|
|
243
|
+
* @param {?} actionId
|
|
244
|
+
* @return {?}
|
|
245
|
+
*/
|
|
246
|
+
function (actionId) {
|
|
247
|
+
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
248
|
+
}));
|
|
249
|
+
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else if (action.type === "ACTION" /* Action */) {
|
|
253
|
+
/** @type {?} */
|
|
254
|
+
var actionPayload = JSON.parse(action.payload);
|
|
255
|
+
this.store.dispatch(actionPayload);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
* @return {?}
|
|
261
|
+
*/
|
|
262
|
+
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
263
|
+
* @private
|
|
264
|
+
* @return {?}
|
|
265
|
+
*/
|
|
266
|
+
function () {
|
|
267
|
+
var _this = this;
|
|
268
|
+
if (!this.globalDevtools || this._options.disabled) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// The `connect` method adds `message` event listener since it communicates
|
|
272
|
+
// with an extension through `window.postMessage` and message events.
|
|
273
|
+
// We handle only 2 events; thus, we don't want to run many change detections
|
|
274
|
+
// because the extension sends events that we don't have to handle.
|
|
275
|
+
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
276
|
+
* @return {?}
|
|
277
|
+
*/
|
|
278
|
+
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
279
|
+
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
280
|
+
* @param {?} action
|
|
281
|
+
* @return {?}
|
|
282
|
+
*/
|
|
283
|
+
function (action) {
|
|
284
|
+
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
285
|
+
action.type === "ACTION" /* Action */) {
|
|
286
|
+
_this._ngZone.run((/**
|
|
287
|
+
* @return {?}
|
|
288
|
+
*/
|
|
289
|
+
function () {
|
|
290
|
+
_this.dispatched(action);
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
}));
|
|
294
|
+
};
|
|
295
|
+
NgxsReduxDevtoolsPlugin.decorators = [
|
|
296
|
+
{ type: Injectable }
|
|
297
|
+
];
|
|
298
|
+
/** @nocollapse */
|
|
299
|
+
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
300
|
+
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
301
|
+
{ type: Injector },
|
|
302
|
+
{ type: NgZone }
|
|
303
|
+
]; };
|
|
304
|
+
return NgxsReduxDevtoolsPlugin;
|
|
305
|
+
}());
|
|
306
|
+
if (false) {
|
|
307
|
+
/**
|
|
308
|
+
* @type {?}
|
|
309
|
+
* @private
|
|
310
|
+
*/
|
|
311
|
+
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
312
|
+
/**
|
|
313
|
+
* @type {?}
|
|
314
|
+
* @private
|
|
315
|
+
*/
|
|
316
|
+
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
317
|
+
/**
|
|
318
|
+
* @type {?}
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
322
|
+
/**
|
|
323
|
+
* @type {?}
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
327
|
+
/**
|
|
328
|
+
* @type {?}
|
|
329
|
+
* @private
|
|
330
|
+
*/
|
|
331
|
+
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
332
|
+
/**
|
|
333
|
+
* @type {?}
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
/**
|
|
340
|
-
* @fileoverview added by tsickle
|
|
341
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
342
|
-
*/
|
|
343
|
-
/**
|
|
344
|
-
* @param {?} options
|
|
345
|
-
* @return {?}
|
|
346
|
-
*/
|
|
347
|
-
function devtoolsOptionsFactory(options) {
|
|
348
|
-
return __assign({ name: 'NGXS' }, options);
|
|
349
|
-
}
|
|
350
|
-
/** @type {?} */
|
|
351
|
-
var USER_OPTIONS = new InjectionToken('USER_OPTIONS');
|
|
352
|
-
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
353
|
-
function NgxsReduxDevtoolsPluginModule() {
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* @param {?=} options
|
|
357
|
-
* @return {?}
|
|
358
|
-
*/
|
|
359
|
-
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
360
|
-
* @param {?=} options
|
|
361
|
-
* @return {?}
|
|
362
|
-
*/
|
|
363
|
-
function (options) {
|
|
364
|
-
return {
|
|
365
|
-
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
366
|
-
providers: [
|
|
367
|
-
{
|
|
368
|
-
provide: NGXS_PLUGINS,
|
|
369
|
-
useClass: NgxsReduxDevtoolsPlugin,
|
|
370
|
-
multi: true
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
provide: USER_OPTIONS,
|
|
374
|
-
useValue: options
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
378
|
-
useFactory: devtoolsOptionsFactory,
|
|
379
|
-
deps: [USER_OPTIONS]
|
|
380
|
-
}
|
|
381
|
-
]
|
|
382
|
-
};
|
|
383
|
-
};
|
|
384
|
-
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
385
|
-
{ type: NgModule }
|
|
386
|
-
];
|
|
387
|
-
return NgxsReduxDevtoolsPluginModule;
|
|
339
|
+
/**
|
|
340
|
+
* @fileoverview added by tsickle
|
|
341
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
342
|
+
*/
|
|
343
|
+
/**
|
|
344
|
+
* @param {?} options
|
|
345
|
+
* @return {?}
|
|
346
|
+
*/
|
|
347
|
+
function devtoolsOptionsFactory(options) {
|
|
348
|
+
return __assign({ name: 'NGXS' }, options);
|
|
349
|
+
}
|
|
350
|
+
/** @type {?} */
|
|
351
|
+
var USER_OPTIONS = new InjectionToken('USER_OPTIONS');
|
|
352
|
+
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
353
|
+
function NgxsReduxDevtoolsPluginModule() {
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* @param {?=} options
|
|
357
|
+
* @return {?}
|
|
358
|
+
*/
|
|
359
|
+
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
360
|
+
* @param {?=} options
|
|
361
|
+
* @return {?}
|
|
362
|
+
*/
|
|
363
|
+
function (options) {
|
|
364
|
+
return {
|
|
365
|
+
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
366
|
+
providers: [
|
|
367
|
+
{
|
|
368
|
+
provide: NGXS_PLUGINS,
|
|
369
|
+
useClass: NgxsReduxDevtoolsPlugin,
|
|
370
|
+
multi: true
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
provide: USER_OPTIONS,
|
|
374
|
+
useValue: options
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
378
|
+
useFactory: devtoolsOptionsFactory,
|
|
379
|
+
deps: [USER_OPTIONS]
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
385
|
+
{ type: NgModule }
|
|
386
|
+
];
|
|
387
|
+
return NgxsReduxDevtoolsPluginModule;
|
|
388
388
|
}());
|
|
389
389
|
|
|
390
|
-
/**
|
|
391
|
-
* @fileoverview added by tsickle
|
|
392
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
390
|
+
/**
|
|
391
|
+
* @fileoverview added by tsickle
|
|
392
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
393
393
|
*/
|
|
394
394
|
|
|
395
|
-
/**
|
|
396
|
-
* @fileoverview added by tsickle
|
|
397
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
395
|
+
/**
|
|
396
|
+
* @fileoverview added by tsickle
|
|
397
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
398
398
|
*/
|
|
399
399
|
|
|
400
|
-
/**
|
|
401
|
-
* @fileoverview added by tsickle
|
|
402
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
400
|
+
/**
|
|
401
|
+
* @fileoverview added by tsickle
|
|
402
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
403
403
|
*/
|
|
404
404
|
|
|
405
405
|
export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule, devtoolsOptionsFactory as ɵa, USER_OPTIONS as ɵb };
|