@ngxs/devtools-plugin 3.7.6-dev.master-1bdb8c0 → 3.7.6-dev.master-dcdd391
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/ngxs-devtools-plugin.umd.js +69 -515
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/esm2015/index.js +2 -6
- package/esm2015/ngxs-devtools-plugin.js +2 -7
- package/esm2015/src/devtools.module.js +8 -17
- package/esm2015/src/devtools.plugin.js +23 -129
- package/esm2015/src/public_api.js +2 -6
- package/esm2015/src/symbols.js +1 -103
- package/fesm2015/ngxs-devtools-plugin.js +32 -257
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/ngxs-devtools-plugin.d.ts +1 -1
- package/package.json +3 -6
- package/src/devtools.module.d.ts +5 -1
- package/src/devtools.plugin.d.ts +4 -1
- package/src/symbols.d.ts +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js +0 -16
- package/bundles/ngxs-devtools-plugin.umd.min.js.map +0 -1
- package/esm5/index.js +0 -9
- package/esm5/ngxs-devtools-plugin.js +0 -10
- package/esm5/src/devtools.module.js +0 -57
- package/esm5/src/devtools.plugin.js +0 -271
- package/esm5/src/public_api.js +0 -8
- package/esm5/src/symbols.js +0 -105
- package/fesm5/ngxs-devtools-plugin.js +0 -442
- package/fesm5/ngxs-devtools-plugin.js.map +0 -1
- package/ngxs-devtools-plugin.metadata.json +0 -1
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
import { __assign } from 'tslib';
|
|
2
|
-
import { InjectionToken, ɵglobal, Injectable, Inject, Injector, NgZone, NgModule } from '@angular/core';
|
|
3
|
-
import { Store, getActionTypeFromInstance, NGXS_PLUGINS } from '@ngxs/store';
|
|
4
|
-
import { catchError, tap } from 'rxjs/operators';
|
|
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
|
-
* If more than one action is dispatched in the indicated interval, all new actions will be collected
|
|
71
|
-
* and sent at once. It is the joint between performance and speed. When set to 0, all actions will be
|
|
72
|
-
* sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).
|
|
73
|
-
* Default is 500 ms.
|
|
74
|
-
* @type {?|undefined}
|
|
75
|
-
*/
|
|
76
|
-
NgxsDevtoolsOptions.prototype.latency;
|
|
77
|
-
/**
|
|
78
|
-
* string or array of strings as regex - actions types to be hidden in the monitors (while passed to the reducers).
|
|
79
|
-
* If actionsWhitelist specified, actionsBlacklist is ignored.
|
|
80
|
-
* @type {?|undefined}
|
|
81
|
-
*/
|
|
82
|
-
NgxsDevtoolsOptions.prototype.actionsBlacklist;
|
|
83
|
-
/**
|
|
84
|
-
* string or array of strings as regex - actions types to be shown in the monitors (while passed to the reducers).
|
|
85
|
-
* If actionsWhitelist specified, actionsBlacklist is ignored.
|
|
86
|
-
* @type {?|undefined}
|
|
87
|
-
*/
|
|
88
|
-
NgxsDevtoolsOptions.prototype.actionsWhitelist;
|
|
89
|
-
/**
|
|
90
|
-
* called for every action before sending, takes state and action object, and returns true in case it allows
|
|
91
|
-
* sending the current data to the monitor. Use it as a more advanced version of
|
|
92
|
-
* actionsBlacklist/actionsWhitelist parameters
|
|
93
|
-
* @type {?|undefined}
|
|
94
|
-
*/
|
|
95
|
-
NgxsDevtoolsOptions.prototype.predicate;
|
|
96
|
-
/**
|
|
97
|
-
* Reformat actions before sending to dev tools
|
|
98
|
-
* @type {?|undefined}
|
|
99
|
-
*/
|
|
100
|
-
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
101
|
-
/**
|
|
102
|
-
* Reformat state before sending to devtools
|
|
103
|
-
* @type {?|undefined}
|
|
104
|
-
*/
|
|
105
|
-
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
106
|
-
}
|
|
107
|
-
/** @type {?} */
|
|
108
|
-
var NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @fileoverview added by tsickle
|
|
112
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
113
|
-
*/
|
|
114
|
-
/** @enum {string} */
|
|
115
|
-
var ReduxDevtoolsActionType = {
|
|
116
|
-
Dispatch: 'DISPATCH',
|
|
117
|
-
Action: 'ACTION',
|
|
118
|
-
};
|
|
119
|
-
/** @enum {string} */
|
|
120
|
-
var ReduxDevtoolsPayloadType = {
|
|
121
|
-
JumpToAction: 'JUMP_TO_ACTION',
|
|
122
|
-
JumpToState: 'JUMP_TO_STATE',
|
|
123
|
-
ToggleAction: 'TOGGLE_ACTION',
|
|
124
|
-
ImportState: 'IMPORT_STATE',
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Adds support for the Redux Devtools extension:
|
|
128
|
-
* http://extension.remotedev.io/
|
|
129
|
-
*/
|
|
130
|
-
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
131
|
-
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
132
|
-
this._options = _options;
|
|
133
|
-
this._injector = _injector;
|
|
134
|
-
this._ngZone = _ngZone;
|
|
135
|
-
this.devtoolsExtension = null;
|
|
136
|
-
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
137
|
-
this.unsubscribe = null;
|
|
138
|
-
this.connect();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* @return {?}
|
|
142
|
-
*/
|
|
143
|
-
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
144
|
-
* @return {?}
|
|
145
|
-
*/
|
|
146
|
-
function () {
|
|
147
|
-
if (this.unsubscribe !== null) {
|
|
148
|
-
this.unsubscribe();
|
|
149
|
-
}
|
|
150
|
-
if (this.globalDevtools) {
|
|
151
|
-
this.globalDevtools.disconnect();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
155
|
-
/**
|
|
156
|
-
* Lazy get the store for circular dependency issues
|
|
157
|
-
*/
|
|
158
|
-
get: /**
|
|
159
|
-
* Lazy get the store for circular dependency issues
|
|
160
|
-
* @private
|
|
161
|
-
* @return {?}
|
|
162
|
-
*/
|
|
163
|
-
function () {
|
|
164
|
-
return this._injector.get(Store);
|
|
165
|
-
},
|
|
166
|
-
enumerable: true,
|
|
167
|
-
configurable: true
|
|
168
|
-
});
|
|
169
|
-
/**
|
|
170
|
-
* Middleware handle function
|
|
171
|
-
*/
|
|
172
|
-
/**
|
|
173
|
-
* Middleware handle function
|
|
174
|
-
* @param {?} state
|
|
175
|
-
* @param {?} action
|
|
176
|
-
* @param {?} next
|
|
177
|
-
* @return {?}
|
|
178
|
-
*/
|
|
179
|
-
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
180
|
-
* Middleware handle function
|
|
181
|
-
* @param {?} state
|
|
182
|
-
* @param {?} action
|
|
183
|
-
* @param {?} next
|
|
184
|
-
* @return {?}
|
|
185
|
-
*/
|
|
186
|
-
function (state, action, next) {
|
|
187
|
-
var _this = this;
|
|
188
|
-
if (!this.devtoolsExtension || this._options.disabled) {
|
|
189
|
-
return next(state, action);
|
|
190
|
-
}
|
|
191
|
-
return next(state, action).pipe(catchError((/**
|
|
192
|
-
* @param {?} error
|
|
193
|
-
* @return {?}
|
|
194
|
-
*/
|
|
195
|
-
function (error) {
|
|
196
|
-
/** @type {?} */
|
|
197
|
-
var newState = _this.store.snapshot();
|
|
198
|
-
_this.sendToDevTools(state, action, newState);
|
|
199
|
-
throw error;
|
|
200
|
-
})), tap((/**
|
|
201
|
-
* @param {?} newState
|
|
202
|
-
* @return {?}
|
|
203
|
-
*/
|
|
204
|
-
function (newState) {
|
|
205
|
-
_this.sendToDevTools(state, action, newState);
|
|
206
|
-
})));
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* @private
|
|
210
|
-
* @param {?} state
|
|
211
|
-
* @param {?} action
|
|
212
|
-
* @param {?} newState
|
|
213
|
-
* @return {?}
|
|
214
|
-
*/
|
|
215
|
-
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
216
|
-
* @private
|
|
217
|
-
* @param {?} state
|
|
218
|
-
* @param {?} action
|
|
219
|
-
* @param {?} newState
|
|
220
|
-
* @return {?}
|
|
221
|
-
*/
|
|
222
|
-
function (state, action, newState) {
|
|
223
|
-
/** @type {?} */
|
|
224
|
-
var type = getActionTypeFromInstance(action);
|
|
225
|
-
// if init action, send initial state to dev tools
|
|
226
|
-
/** @type {?} */
|
|
227
|
-
var isInitAction = type === '@@INIT';
|
|
228
|
-
if (isInitAction) {
|
|
229
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Handle the action from the dev tools subscription
|
|
237
|
-
*/
|
|
238
|
-
/**
|
|
239
|
-
* Handle the action from the dev tools subscription
|
|
240
|
-
* @param {?} action
|
|
241
|
-
* @return {?}
|
|
242
|
-
*/
|
|
243
|
-
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
244
|
-
* Handle the action from the dev tools subscription
|
|
245
|
-
* @param {?} action
|
|
246
|
-
* @return {?}
|
|
247
|
-
*/
|
|
248
|
-
function (action) {
|
|
249
|
-
var _this = this;
|
|
250
|
-
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
251
|
-
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
252
|
-
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
253
|
-
/** @type {?} */
|
|
254
|
-
var prevState = JSON.parse(action.state);
|
|
255
|
-
// This makes the DevTools and Router plugins friends with each other.
|
|
256
|
-
// We're checking for the `router` state to exist, and it also should
|
|
257
|
-
// have the `trigger` property, so we're sure that this is our router
|
|
258
|
-
// state (coming from `@ngxs/router-plugin`). This enables a time-traveling
|
|
259
|
-
// feature since it doesn't only restore the state but also allows the `RouterState`
|
|
260
|
-
// to navigate back when the action is jumped.
|
|
261
|
-
if (prevState.router && prevState.router.trigger) {
|
|
262
|
-
prevState.router.trigger = 'devtools';
|
|
263
|
-
}
|
|
264
|
-
this.store.reset(prevState);
|
|
265
|
-
}
|
|
266
|
-
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
267
|
-
console.warn('Skip is not supported at this time.');
|
|
268
|
-
}
|
|
269
|
-
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
270
|
-
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
271
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
272
|
-
Object.keys(actionsById_1)
|
|
273
|
-
.filter((/**
|
|
274
|
-
* @param {?} actionId
|
|
275
|
-
* @return {?}
|
|
276
|
-
*/
|
|
277
|
-
function (actionId) { return actionId !== '0'; }))
|
|
278
|
-
.forEach((/**
|
|
279
|
-
* @param {?} actionId
|
|
280
|
-
* @return {?}
|
|
281
|
-
*/
|
|
282
|
-
function (actionId) {
|
|
283
|
-
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
284
|
-
}));
|
|
285
|
-
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
else if (action.type === "ACTION" /* Action */) {
|
|
289
|
-
/** @type {?} */
|
|
290
|
-
var actionPayload = JSON.parse(action.payload);
|
|
291
|
-
this.store.dispatch(actionPayload);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* @private
|
|
296
|
-
* @return {?}
|
|
297
|
-
*/
|
|
298
|
-
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
299
|
-
* @private
|
|
300
|
-
* @return {?}
|
|
301
|
-
*/
|
|
302
|
-
function () {
|
|
303
|
-
var _this = this;
|
|
304
|
-
if (!this.globalDevtools || this._options.disabled) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
// The `connect` method adds `message` event listener since it communicates
|
|
308
|
-
// with an extension through `window.postMessage` and message events.
|
|
309
|
-
// We handle only 2 events; thus, we don't want to run many change detections
|
|
310
|
-
// because the extension sends events that we don't have to handle.
|
|
311
|
-
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
312
|
-
* @return {?}
|
|
313
|
-
*/
|
|
314
|
-
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
315
|
-
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
316
|
-
* @param {?} action
|
|
317
|
-
* @return {?}
|
|
318
|
-
*/
|
|
319
|
-
function (action) {
|
|
320
|
-
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
321
|
-
action.type === "ACTION" /* Action */) {
|
|
322
|
-
_this._ngZone.run((/**
|
|
323
|
-
* @return {?}
|
|
324
|
-
*/
|
|
325
|
-
function () {
|
|
326
|
-
_this.dispatched(action);
|
|
327
|
-
}));
|
|
328
|
-
}
|
|
329
|
-
}));
|
|
330
|
-
};
|
|
331
|
-
NgxsReduxDevtoolsPlugin.decorators = [
|
|
332
|
-
{ type: Injectable }
|
|
333
|
-
];
|
|
334
|
-
/** @nocollapse */
|
|
335
|
-
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
336
|
-
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
337
|
-
{ type: Injector },
|
|
338
|
-
{ type: NgZone }
|
|
339
|
-
]; };
|
|
340
|
-
return NgxsReduxDevtoolsPlugin;
|
|
341
|
-
}());
|
|
342
|
-
if (false) {
|
|
343
|
-
/**
|
|
344
|
-
* @type {?}
|
|
345
|
-
* @private
|
|
346
|
-
*/
|
|
347
|
-
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
348
|
-
/**
|
|
349
|
-
* @type {?}
|
|
350
|
-
* @private
|
|
351
|
-
*/
|
|
352
|
-
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
353
|
-
/**
|
|
354
|
-
* @type {?}
|
|
355
|
-
* @private
|
|
356
|
-
*/
|
|
357
|
-
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
358
|
-
/**
|
|
359
|
-
* @type {?}
|
|
360
|
-
* @private
|
|
361
|
-
*/
|
|
362
|
-
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
363
|
-
/**
|
|
364
|
-
* @type {?}
|
|
365
|
-
* @private
|
|
366
|
-
*/
|
|
367
|
-
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
368
|
-
/**
|
|
369
|
-
* @type {?}
|
|
370
|
-
* @private
|
|
371
|
-
*/
|
|
372
|
-
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* @fileoverview added by tsickle
|
|
377
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
378
|
-
*/
|
|
379
|
-
/**
|
|
380
|
-
* @param {?} options
|
|
381
|
-
* @return {?}
|
|
382
|
-
*/
|
|
383
|
-
function devtoolsOptionsFactory(options) {
|
|
384
|
-
return __assign({ name: 'NGXS' }, options);
|
|
385
|
-
}
|
|
386
|
-
/** @type {?} */
|
|
387
|
-
var USER_OPTIONS = new InjectionToken('USER_OPTIONS');
|
|
388
|
-
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
389
|
-
function NgxsReduxDevtoolsPluginModule() {
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* @param {?=} options
|
|
393
|
-
* @return {?}
|
|
394
|
-
*/
|
|
395
|
-
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
396
|
-
* @param {?=} options
|
|
397
|
-
* @return {?}
|
|
398
|
-
*/
|
|
399
|
-
function (options) {
|
|
400
|
-
return {
|
|
401
|
-
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
402
|
-
providers: [
|
|
403
|
-
{
|
|
404
|
-
provide: NGXS_PLUGINS,
|
|
405
|
-
useClass: NgxsReduxDevtoolsPlugin,
|
|
406
|
-
multi: true
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
provide: USER_OPTIONS,
|
|
410
|
-
useValue: options
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
414
|
-
useFactory: devtoolsOptionsFactory,
|
|
415
|
-
deps: [USER_OPTIONS]
|
|
416
|
-
}
|
|
417
|
-
]
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
421
|
-
{ type: NgModule }
|
|
422
|
-
];
|
|
423
|
-
return NgxsReduxDevtoolsPluginModule;
|
|
424
|
-
}());
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* @fileoverview added by tsickle
|
|
428
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
429
|
-
*/
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* @fileoverview added by tsickle
|
|
433
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @fileoverview added by tsickle
|
|
438
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
439
|
-
*/
|
|
440
|
-
|
|
441
|
-
export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule, devtoolsOptionsFactory as ɵa, USER_OPTIONS as ɵb };
|
|
442
|
-
//# sourceMappingURL=ngxs-devtools-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Interface for the redux-devtools-extension API.\n */\nexport interface NgxsDevtoolsExtension {\n init(state: any): void;\n send(action: any, state?: any): void;\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\n}\n\nexport interface NgxsDevtoolsAction {\n type: string;\n payload: any;\n state: any;\n id: number;\n source: string;\n}\n\nexport interface NgxsDevtoolsOptions {\n /**\n * The name of the extension\n */\n name?: string;\n\n /**\n * Whether the dev tools is enabled or note. Useful for setting during production.\n */\n disabled?: boolean;\n\n /**\n * Max number of entiries to keep.\n */\n maxAge?: number;\n\n /**\n * If more than one action is dispatched in the indicated interval, all new actions will be collected\n * and sent at once. It is the joint between performance and speed. When set to 0, all actions will be\n * sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).\n * Default is 500 ms.\n */\n latency?: number;\n\n /**\n * string or array of strings as regex - actions types to be hidden in the monitors (while passed to the reducers).\n * If actionsWhitelist specified, actionsBlacklist is ignored.\n */\n actionsBlacklist?: string | string[];\n\n /**\n * string or array of strings as regex - actions types to be shown in the monitors (while passed to the reducers).\n * If actionsWhitelist specified, actionsBlacklist is ignored.\n */\n actionsWhitelist?: string | string[];\n\n\n /**\n * called for every action before sending, takes state and action object, and returns true in case it allows\n * sending the current data to the monitor. Use it as a more advanced version of\n * actionsBlacklist/actionsWhitelist parameters\n */\n predicate?: (state: any, action: any) => boolean;\n\n /**\n * Reformat actions before sending to dev tools\n */\n actionSanitizer?: (action: any) => void;\n\n /**\n * Reformat state before sending to devtools\n */\n stateSanitizer?: (state: any) => void;\n}\n\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\nimport { tap, catchError } from 'rxjs/operators';\n\nimport {\n NGXS_DEVTOOLS_OPTIONS,\n NgxsDevtoolsAction,\n NgxsDevtoolsExtension,\n NgxsDevtoolsOptions\n} from './symbols';\n\nconst enum ReduxDevtoolsActionType {\n Dispatch = 'DISPATCH',\n Action = 'ACTION'\n}\n\nconst enum ReduxDevtoolsPayloadType {\n JumpToAction = 'JUMP_TO_ACTION',\n JumpToState = 'JUMP_TO_STATE',\n ToggleAction = 'TOGGLE_ACTION',\n ImportState = 'IMPORT_STATE'\n}\n\n/**\n * Adds support for the Redux Devtools extension:\n * http://extension.remotedev.io/\n */\n@Injectable()\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\n private readonly globalDevtools =\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\n\n private unsubscribe: VoidFunction | null = null;\n\n constructor(\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\n private _injector: Injector,\n private _ngZone: NgZone\n ) {\n this.connect();\n }\n\n ngOnDestroy(): void {\n if (this.unsubscribe !== null) {\n this.unsubscribe();\n }\n if (this.globalDevtools) {\n this.globalDevtools.disconnect();\n }\n }\n\n /**\n * Lazy get the store for circular dependency issues\n */\n private get store(): Store {\n return this._injector.get<Store>(Store);\n }\n\n /**\n * Middleware handle function\n */\n handle(state: any, action: any, next: NgxsNextPluginFn) {\n if (!this.devtoolsExtension || this._options.disabled) {\n return next(state, action);\n }\n\n return next(state, action).pipe(\n catchError(error => {\n const newState = this.store.snapshot();\n this.sendToDevTools(state, action, newState);\n throw error;\n }),\n tap(newState => {\n this.sendToDevTools(state, action, newState);\n })\n );\n }\n\n private sendToDevTools(state: any, action: any, newState: any) {\n const type = getActionTypeFromInstance(action);\n // if init action, send initial state to dev tools\n const isInitAction = type === '@@INIT';\n if (isInitAction) {\n this.devtoolsExtension!.init(state);\n } else {\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\n }\n }\n\n /**\n * Handle the action from the dev tools subscription\n */\n dispatched(action: NgxsDevtoolsAction) {\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\n if (\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\n ) {\n const prevState = JSON.parse(action.state);\n // This makes the DevTools and Router plugins friends with each other.\n // We're checking for the `router` state to exist, and it also should\n // have the `trigger` property, so we're sure that this is our router\n // state (coming from `@ngxs/router-plugin`). This enables a time-traveling\n // feature since it doesn't only restore the state but also allows the `RouterState`\n // to navigate back when the action is jumped.\n if (prevState.router && prevState.router.trigger) {\n prevState.router.trigger = 'devtools';\n }\n this.store.reset(prevState);\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\n console.warn('Skip is not supported at this time.');\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\n const {\n actionsById,\n computedStates,\n currentStateIndex\n } = action.payload.nextLiftedState;\n this.devtoolsExtension!.init(computedStates[0].state);\n Object.keys(actionsById)\n .filter(actionId => actionId !== '0')\n .forEach(actionId =>\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\n );\n this.store.reset(computedStates[currentStateIndex].state);\n }\n } else if (action.type === ReduxDevtoolsActionType.Action) {\n const actionPayload = JSON.parse(action.payload);\n this.store.dispatch(actionPayload);\n }\n }\n\n private connect(): void {\n if (!this.globalDevtools || this._options.disabled) {\n return;\n }\n\n // The `connect` method adds `message` event listener since it communicates\n // with an extension through `window.postMessage` and message events.\n // We handle only 2 events; thus, we don't want to run many change detections\n // because the extension sends events that we don't have to handle.\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\n );\n\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\n if (\n action.type === ReduxDevtoolsActionType.Dispatch ||\n action.type === ReduxDevtoolsActionType.Action\n ) {\n this._ngZone.run(() => {\n this.dispatched(action);\n });\n }\n });\n }\n}\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\n\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\n\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\n return {\n name: 'NGXS',\n ...options\n };\n}\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsReduxDevtoolsPluginModule {\n static forRoot(\n options?: NgxsDevtoolsOptions\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\n return {\n ngModule: NgxsReduxDevtoolsPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsReduxDevtoolsPlugin,\n multi: true\n },\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_DEVTOOLS_OPTIONS,\n useFactory: devtoolsOptionsFactory,\n deps: [USER_OPTIONS]\n }\n ]\n };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B,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,UAAU,EAAE,sBAAsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;gBAxBF,QAAQ;;IAyBT,oCAAC;CAzBD;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"function","parameters":["options"],"value":{"name":"NGXS"}},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":32},"arguments":["USER_OPTIONS"]},"NgxsReduxDevtoolsPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":15,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":24,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"reference","name":"options"}},{"provide":{"__symbolic":"reference","name":"NGXS_DEVTOOLS_OPTIONS"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","name":"ɵb"}]}]}}}},"NgxsReduxDevtoolsPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":27,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":36,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_DEVTOOLS_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"NgxsDevtoolsOptions"},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":37,"character":23},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":38,"character":21}]}],"ngOnDestroy":[{"__symbolic":"method"}],"handle":[{"__symbolic":"method"}],"sendToDevTools":[{"__symbolic":"method"}],"dispatched":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}]}},"NgxsDevtoolsExtension":{"__symbolic":"interface"},"NgxsDevtoolsAction":{"__symbolic":"interface"},"NgxsDevtoolsOptions":{"__symbolic":"interface"},"NGXS_DEVTOOLS_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":74,"character":41},"arguments":["NGXS_DEVTOOLS_OPTIONS"]}},"origins":{"ɵa":"./src/devtools.module","ɵb":"./src/devtools.module","NgxsReduxDevtoolsPluginModule":"./src/devtools.module","NgxsReduxDevtoolsPlugin":"./src/devtools.plugin","NgxsDevtoolsExtension":"./src/symbols","NgxsDevtoolsAction":"./src/symbols","NgxsDevtoolsOptions":"./src/symbols","NGXS_DEVTOOLS_OPTIONS":"./src/symbols"},"importAs":"@ngxs/devtools-plugin"}
|