@ngxs/devtools-plugin 3.6.2-dev.master-8e14fe1 → 3.7.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/README.md +3 -3
- package/bundles/ngxs-devtools-plugin.umd.js +330 -325
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js +11 -11
- 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 +162 -162
- 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 +198 -198
- package/esm5/src/public_api.js +8 -8
- package/esm5/src/symbols.js +78 -78
- package/fesm2015/ngxs-devtools-plugin.js +282 -282
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/fesm5/ngxs-devtools-plugin.js +323 -323
- 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 +5 -5
- package/src/devtools.module.d.ts +13 -13
- package/src/devtools.plugin.d.ts +27 -27
- package/src/public_api.d.ts +3 -3
- package/src/symbols.d.ts +40 -40
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
}(this, function (exports, core, store, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
10
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
11
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
Copyright (c) Microsoft Corporation.
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
16
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
10
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
+
purpose with or without fee is hereby granted.
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
21
|
/* global Reflect, Promise */
|
|
22
22
|
|
|
@@ -109,8 +109,13 @@
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function __createBinding(o, m, k, k2) {
|
|
113
|
+
if (k2 === undefined) k2 = k;
|
|
114
|
+
o[k2] = m[k];
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
function __exportStar(m, exports) {
|
|
113
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
118
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
function __values(o) {
|
|
@@ -218,324 +223,324 @@
|
|
|
218
223
|
return value;
|
|
219
224
|
}
|
|
220
225
|
|
|
221
|
-
/**
|
|
222
|
-
* @fileoverview added by tsickle
|
|
223
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
224
|
-
*/
|
|
225
|
-
/**
|
|
226
|
-
* Interface for the redux-devtools-extension API.
|
|
227
|
-
* @record
|
|
228
|
-
*/
|
|
229
|
-
function NgxsDevtoolsExtension() { }
|
|
230
|
-
if (false) {
|
|
231
|
-
/**
|
|
232
|
-
* @param {?} state
|
|
233
|
-
* @return {?}
|
|
234
|
-
*/
|
|
235
|
-
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
236
|
-
/**
|
|
237
|
-
* @param {?} action
|
|
238
|
-
* @param {?=} state
|
|
239
|
-
* @return {?}
|
|
240
|
-
*/
|
|
241
|
-
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
242
|
-
/**
|
|
243
|
-
* @param {?} fn
|
|
244
|
-
* @return {?}
|
|
245
|
-
*/
|
|
246
|
-
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* @record
|
|
250
|
-
*/
|
|
251
|
-
function NgxsDevtoolsAction() { }
|
|
252
|
-
if (false) {
|
|
253
|
-
/** @type {?} */
|
|
254
|
-
NgxsDevtoolsAction.prototype.type;
|
|
255
|
-
/** @type {?} */
|
|
256
|
-
NgxsDevtoolsAction.prototype.payload;
|
|
257
|
-
/** @type {?} */
|
|
258
|
-
NgxsDevtoolsAction.prototype.state;
|
|
259
|
-
/** @type {?} */
|
|
260
|
-
NgxsDevtoolsAction.prototype.id;
|
|
261
|
-
/** @type {?} */
|
|
262
|
-
NgxsDevtoolsAction.prototype.source;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* @record
|
|
266
|
-
*/
|
|
267
|
-
function NgxsDevtoolsOptions() { }
|
|
268
|
-
if (false) {
|
|
269
|
-
/**
|
|
270
|
-
* The name of the extension
|
|
271
|
-
* @type {?|undefined}
|
|
272
|
-
*/
|
|
273
|
-
NgxsDevtoolsOptions.prototype.name;
|
|
274
|
-
/**
|
|
275
|
-
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
276
|
-
* @type {?|undefined}
|
|
277
|
-
*/
|
|
278
|
-
NgxsDevtoolsOptions.prototype.disabled;
|
|
279
|
-
/**
|
|
280
|
-
* Max number of entiries to keep.
|
|
281
|
-
* @type {?|undefined}
|
|
282
|
-
*/
|
|
283
|
-
NgxsDevtoolsOptions.prototype.maxAge;
|
|
284
|
-
/**
|
|
285
|
-
* Reformat actions before sending to dev tools
|
|
286
|
-
* @type {?|undefined}
|
|
287
|
-
*/
|
|
288
|
-
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
289
|
-
/**
|
|
290
|
-
* Reformat state before sending to devtools
|
|
291
|
-
* @type {?|undefined}
|
|
292
|
-
*/
|
|
293
|
-
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
294
|
-
}
|
|
295
|
-
/** @type {?} */
|
|
226
|
+
/**
|
|
227
|
+
* @fileoverview added by tsickle
|
|
228
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* Interface for the redux-devtools-extension API.
|
|
232
|
+
* @record
|
|
233
|
+
*/
|
|
234
|
+
function NgxsDevtoolsExtension() { }
|
|
235
|
+
if (false) {
|
|
236
|
+
/**
|
|
237
|
+
* @param {?} state
|
|
238
|
+
* @return {?}
|
|
239
|
+
*/
|
|
240
|
+
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
241
|
+
/**
|
|
242
|
+
* @param {?} action
|
|
243
|
+
* @param {?=} state
|
|
244
|
+
* @return {?}
|
|
245
|
+
*/
|
|
246
|
+
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
247
|
+
/**
|
|
248
|
+
* @param {?} fn
|
|
249
|
+
* @return {?}
|
|
250
|
+
*/
|
|
251
|
+
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* @record
|
|
255
|
+
*/
|
|
256
|
+
function NgxsDevtoolsAction() { }
|
|
257
|
+
if (false) {
|
|
258
|
+
/** @type {?} */
|
|
259
|
+
NgxsDevtoolsAction.prototype.type;
|
|
260
|
+
/** @type {?} */
|
|
261
|
+
NgxsDevtoolsAction.prototype.payload;
|
|
262
|
+
/** @type {?} */
|
|
263
|
+
NgxsDevtoolsAction.prototype.state;
|
|
264
|
+
/** @type {?} */
|
|
265
|
+
NgxsDevtoolsAction.prototype.id;
|
|
266
|
+
/** @type {?} */
|
|
267
|
+
NgxsDevtoolsAction.prototype.source;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @record
|
|
271
|
+
*/
|
|
272
|
+
function NgxsDevtoolsOptions() { }
|
|
273
|
+
if (false) {
|
|
274
|
+
/**
|
|
275
|
+
* The name of the extension
|
|
276
|
+
* @type {?|undefined}
|
|
277
|
+
*/
|
|
278
|
+
NgxsDevtoolsOptions.prototype.name;
|
|
279
|
+
/**
|
|
280
|
+
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
281
|
+
* @type {?|undefined}
|
|
282
|
+
*/
|
|
283
|
+
NgxsDevtoolsOptions.prototype.disabled;
|
|
284
|
+
/**
|
|
285
|
+
* Max number of entiries to keep.
|
|
286
|
+
* @type {?|undefined}
|
|
287
|
+
*/
|
|
288
|
+
NgxsDevtoolsOptions.prototype.maxAge;
|
|
289
|
+
/**
|
|
290
|
+
* Reformat actions before sending to dev tools
|
|
291
|
+
* @type {?|undefined}
|
|
292
|
+
*/
|
|
293
|
+
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
294
|
+
/**
|
|
295
|
+
* Reformat state before sending to devtools
|
|
296
|
+
* @type {?|undefined}
|
|
297
|
+
*/
|
|
298
|
+
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
299
|
+
}
|
|
300
|
+
/** @type {?} */
|
|
296
301
|
var NGXS_DEVTOOLS_OPTIONS = new core.InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
297
302
|
|
|
298
|
-
/**
|
|
299
|
-
* @fileoverview added by tsickle
|
|
300
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
301
|
-
*/
|
|
302
|
-
/**
|
|
303
|
-
* Adds support for the Redux Devtools extension:
|
|
304
|
-
* http://extension.remotedev.io/
|
|
305
|
-
*/
|
|
306
|
-
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
307
|
-
function NgxsReduxDevtoolsPlugin(_options, _injector) {
|
|
308
|
-
var _this = this;
|
|
309
|
-
this._options = _options;
|
|
310
|
-
this._injector = _injector;
|
|
311
|
-
this.devtoolsExtension = null;
|
|
312
|
-
this.windowObj = typeof window !== 'undefined' ? window : {};
|
|
313
|
-
/** @type {?} */
|
|
314
|
-
var globalDevtools = this.windowObj['__REDUX_DEVTOOLS_EXTENSION__'] || this.windowObj['devToolsExtension'];
|
|
315
|
-
if (globalDevtools) {
|
|
316
|
-
this.devtoolsExtension = (/** @type {?} */ (globalDevtools.connect(_options)));
|
|
317
|
-
this.devtoolsExtension.subscribe((/**
|
|
318
|
-
* @param {?} a
|
|
319
|
-
* @return {?}
|
|
320
|
-
*/
|
|
321
|
-
function (a) { return _this.dispatched(a); }));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
325
|
-
/**
|
|
326
|
-
* Lazy get the store for circular dependency issues
|
|
327
|
-
*/
|
|
328
|
-
get: /**
|
|
329
|
-
* Lazy get the store for circular dependency issues
|
|
330
|
-
* @private
|
|
331
|
-
* @return {?}
|
|
332
|
-
*/
|
|
333
|
-
function () {
|
|
334
|
-
return this._injector.get(store.Store);
|
|
335
|
-
},
|
|
336
|
-
enumerable: true,
|
|
337
|
-
configurable: true
|
|
338
|
-
});
|
|
339
|
-
/**
|
|
340
|
-
* Middleware handle function
|
|
341
|
-
*/
|
|
342
|
-
/**
|
|
343
|
-
* Middleware handle function
|
|
344
|
-
* @param {?} state
|
|
345
|
-
* @param {?} action
|
|
346
|
-
* @param {?} next
|
|
347
|
-
* @return {?}
|
|
348
|
-
*/
|
|
349
|
-
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
350
|
-
* Middleware handle function
|
|
351
|
-
* @param {?} state
|
|
352
|
-
* @param {?} action
|
|
353
|
-
* @param {?} next
|
|
354
|
-
* @return {?}
|
|
355
|
-
*/
|
|
356
|
-
function (state, action, next) {
|
|
357
|
-
var _this = this;
|
|
358
|
-
/** @type {?} */
|
|
359
|
-
var isDisabled = this._options && this._options.disabled;
|
|
360
|
-
if (!this.devtoolsExtension || isDisabled) {
|
|
361
|
-
return next(state, action);
|
|
362
|
-
}
|
|
363
|
-
return next(state, action).pipe(operators.catchError((/**
|
|
364
|
-
* @param {?} error
|
|
365
|
-
* @return {?}
|
|
366
|
-
*/
|
|
367
|
-
function (error) {
|
|
368
|
-
/** @type {?} */
|
|
369
|
-
var newState = _this.store.snapshot();
|
|
370
|
-
_this.sendToDevTools(state, action, newState);
|
|
371
|
-
throw error;
|
|
372
|
-
})), operators.tap((/**
|
|
373
|
-
* @param {?} newState
|
|
374
|
-
* @return {?}
|
|
375
|
-
*/
|
|
376
|
-
function (newState) {
|
|
377
|
-
_this.sendToDevTools(state, action, newState);
|
|
378
|
-
})));
|
|
379
|
-
};
|
|
380
|
-
/**
|
|
381
|
-
* @private
|
|
382
|
-
* @param {?} state
|
|
383
|
-
* @param {?} action
|
|
384
|
-
* @param {?} newState
|
|
385
|
-
* @return {?}
|
|
386
|
-
*/
|
|
387
|
-
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
388
|
-
* @private
|
|
389
|
-
* @param {?} state
|
|
390
|
-
* @param {?} action
|
|
391
|
-
* @param {?} newState
|
|
392
|
-
* @return {?}
|
|
393
|
-
*/
|
|
394
|
-
function (state, action, newState) {
|
|
395
|
-
/** @type {?} */
|
|
396
|
-
var type = store.getActionTypeFromInstance(action);
|
|
397
|
-
// if init action, send initial state to dev tools
|
|
398
|
-
/** @type {?} */
|
|
399
|
-
var isInitAction = type === '@@INIT';
|
|
400
|
-
if (isInitAction) {
|
|
401
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { type: type }), newState);
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
/**
|
|
408
|
-
* Handle the action from the dev tools subscription
|
|
409
|
-
*/
|
|
410
|
-
/**
|
|
411
|
-
* Handle the action from the dev tools subscription
|
|
412
|
-
* @param {?} action
|
|
413
|
-
* @return {?}
|
|
414
|
-
*/
|
|
415
|
-
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
416
|
-
* Handle the action from the dev tools subscription
|
|
417
|
-
* @param {?} action
|
|
418
|
-
* @return {?}
|
|
419
|
-
*/
|
|
420
|
-
function (action) {
|
|
421
|
-
var _this = this;
|
|
422
|
-
if (action.type === 'DISPATCH') {
|
|
423
|
-
if (action.payload.type === 'JUMP_TO_ACTION' ||
|
|
424
|
-
action.payload.type === 'JUMP_TO_STATE') {
|
|
425
|
-
/** @type {?} */
|
|
426
|
-
var prevState = JSON.parse(action.state);
|
|
427
|
-
this.store.reset(prevState);
|
|
428
|
-
}
|
|
429
|
-
else if (action.payload.type === 'TOGGLE_ACTION') {
|
|
430
|
-
console.warn('Skip is not supported at this time.');
|
|
431
|
-
}
|
|
432
|
-
else if (action.payload.type === 'IMPORT_STATE') {
|
|
433
|
-
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
434
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
435
|
-
Object.keys(actionsById_1)
|
|
436
|
-
.filter((/**
|
|
437
|
-
* @param {?} actionId
|
|
438
|
-
* @return {?}
|
|
439
|
-
*/
|
|
440
|
-
function (actionId) { return actionId !== '0'; }))
|
|
441
|
-
.forEach((/**
|
|
442
|
-
* @param {?} actionId
|
|
443
|
-
* @return {?}
|
|
444
|
-
*/
|
|
445
|
-
function (actionId) {
|
|
446
|
-
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
447
|
-
}));
|
|
448
|
-
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
else if (action.type === 'ACTION') {
|
|
452
|
-
/** @type {?} */
|
|
453
|
-
var actionPayload = JSON.parse(action.payload);
|
|
454
|
-
this.store.dispatch(actionPayload);
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
NgxsReduxDevtoolsPlugin.decorators = [
|
|
458
|
-
{ type: core.Injectable }
|
|
459
|
-
];
|
|
460
|
-
/** @nocollapse */
|
|
461
|
-
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
462
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
463
|
-
{ type: core.Injector }
|
|
464
|
-
]; };
|
|
465
|
-
return NgxsReduxDevtoolsPlugin;
|
|
466
|
-
}());
|
|
467
|
-
if (false) {
|
|
468
|
-
/**
|
|
469
|
-
* @type {?}
|
|
470
|
-
* @private
|
|
471
|
-
*/
|
|
472
|
-
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
473
|
-
/**
|
|
474
|
-
* @type {?}
|
|
475
|
-
* @private
|
|
476
|
-
*/
|
|
477
|
-
NgxsReduxDevtoolsPlugin.prototype.windowObj;
|
|
478
|
-
/**
|
|
479
|
-
* @type {?}
|
|
480
|
-
* @private
|
|
481
|
-
*/
|
|
482
|
-
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
483
|
-
/**
|
|
484
|
-
* @type {?}
|
|
485
|
-
* @private
|
|
486
|
-
*/
|
|
487
|
-
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
303
|
+
/**
|
|
304
|
+
* @fileoverview added by tsickle
|
|
305
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
306
|
+
*/
|
|
307
|
+
/**
|
|
308
|
+
* Adds support for the Redux Devtools extension:
|
|
309
|
+
* http://extension.remotedev.io/
|
|
310
|
+
*/
|
|
311
|
+
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
312
|
+
function NgxsReduxDevtoolsPlugin(_options, _injector) {
|
|
313
|
+
var _this = this;
|
|
314
|
+
this._options = _options;
|
|
315
|
+
this._injector = _injector;
|
|
316
|
+
this.devtoolsExtension = null;
|
|
317
|
+
this.windowObj = typeof window !== 'undefined' ? window : {};
|
|
318
|
+
/** @type {?} */
|
|
319
|
+
var globalDevtools = this.windowObj['__REDUX_DEVTOOLS_EXTENSION__'] || this.windowObj['devToolsExtension'];
|
|
320
|
+
if (globalDevtools) {
|
|
321
|
+
this.devtoolsExtension = (/** @type {?} */ (globalDevtools.connect(_options)));
|
|
322
|
+
this.devtoolsExtension.subscribe((/**
|
|
323
|
+
* @param {?} a
|
|
324
|
+
* @return {?}
|
|
325
|
+
*/
|
|
326
|
+
function (a) { return _this.dispatched(a); }));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
330
|
+
/**
|
|
331
|
+
* Lazy get the store for circular dependency issues
|
|
332
|
+
*/
|
|
333
|
+
get: /**
|
|
334
|
+
* Lazy get the store for circular dependency issues
|
|
335
|
+
* @private
|
|
336
|
+
* @return {?}
|
|
337
|
+
*/
|
|
338
|
+
function () {
|
|
339
|
+
return this._injector.get(store.Store);
|
|
340
|
+
},
|
|
341
|
+
enumerable: true,
|
|
342
|
+
configurable: true
|
|
343
|
+
});
|
|
344
|
+
/**
|
|
345
|
+
* Middleware handle function
|
|
346
|
+
*/
|
|
347
|
+
/**
|
|
348
|
+
* Middleware handle function
|
|
349
|
+
* @param {?} state
|
|
350
|
+
* @param {?} action
|
|
351
|
+
* @param {?} next
|
|
352
|
+
* @return {?}
|
|
353
|
+
*/
|
|
354
|
+
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
355
|
+
* Middleware handle function
|
|
356
|
+
* @param {?} state
|
|
357
|
+
* @param {?} action
|
|
358
|
+
* @param {?} next
|
|
359
|
+
* @return {?}
|
|
360
|
+
*/
|
|
361
|
+
function (state, action, next) {
|
|
362
|
+
var _this = this;
|
|
363
|
+
/** @type {?} */
|
|
364
|
+
var isDisabled = this._options && this._options.disabled;
|
|
365
|
+
if (!this.devtoolsExtension || isDisabled) {
|
|
366
|
+
return next(state, action);
|
|
367
|
+
}
|
|
368
|
+
return next(state, action).pipe(operators.catchError((/**
|
|
369
|
+
* @param {?} error
|
|
370
|
+
* @return {?}
|
|
371
|
+
*/
|
|
372
|
+
function (error) {
|
|
373
|
+
/** @type {?} */
|
|
374
|
+
var newState = _this.store.snapshot();
|
|
375
|
+
_this.sendToDevTools(state, action, newState);
|
|
376
|
+
throw error;
|
|
377
|
+
})), operators.tap((/**
|
|
378
|
+
* @param {?} newState
|
|
379
|
+
* @return {?}
|
|
380
|
+
*/
|
|
381
|
+
function (newState) {
|
|
382
|
+
_this.sendToDevTools(state, action, newState);
|
|
383
|
+
})));
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* @private
|
|
387
|
+
* @param {?} state
|
|
388
|
+
* @param {?} action
|
|
389
|
+
* @param {?} newState
|
|
390
|
+
* @return {?}
|
|
391
|
+
*/
|
|
392
|
+
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
393
|
+
* @private
|
|
394
|
+
* @param {?} state
|
|
395
|
+
* @param {?} action
|
|
396
|
+
* @param {?} newState
|
|
397
|
+
* @return {?}
|
|
398
|
+
*/
|
|
399
|
+
function (state, action, newState) {
|
|
400
|
+
/** @type {?} */
|
|
401
|
+
var type = store.getActionTypeFromInstance(action);
|
|
402
|
+
// if init action, send initial state to dev tools
|
|
403
|
+
/** @type {?} */
|
|
404
|
+
var isInitAction = type === '@@INIT';
|
|
405
|
+
if (isInitAction) {
|
|
406
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Handle the action from the dev tools subscription
|
|
414
|
+
*/
|
|
415
|
+
/**
|
|
416
|
+
* Handle the action from the dev tools subscription
|
|
417
|
+
* @param {?} action
|
|
418
|
+
* @return {?}
|
|
419
|
+
*/
|
|
420
|
+
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
421
|
+
* Handle the action from the dev tools subscription
|
|
422
|
+
* @param {?} action
|
|
423
|
+
* @return {?}
|
|
424
|
+
*/
|
|
425
|
+
function (action) {
|
|
426
|
+
var _this = this;
|
|
427
|
+
if (action.type === 'DISPATCH') {
|
|
428
|
+
if (action.payload.type === 'JUMP_TO_ACTION' ||
|
|
429
|
+
action.payload.type === 'JUMP_TO_STATE') {
|
|
430
|
+
/** @type {?} */
|
|
431
|
+
var prevState = JSON.parse(action.state);
|
|
432
|
+
this.store.reset(prevState);
|
|
433
|
+
}
|
|
434
|
+
else if (action.payload.type === 'TOGGLE_ACTION') {
|
|
435
|
+
console.warn('Skip is not supported at this time.');
|
|
436
|
+
}
|
|
437
|
+
else if (action.payload.type === 'IMPORT_STATE') {
|
|
438
|
+
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
439
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
440
|
+
Object.keys(actionsById_1)
|
|
441
|
+
.filter((/**
|
|
442
|
+
* @param {?} actionId
|
|
443
|
+
* @return {?}
|
|
444
|
+
*/
|
|
445
|
+
function (actionId) { return actionId !== '0'; }))
|
|
446
|
+
.forEach((/**
|
|
447
|
+
* @param {?} actionId
|
|
448
|
+
* @return {?}
|
|
449
|
+
*/
|
|
450
|
+
function (actionId) {
|
|
451
|
+
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
452
|
+
}));
|
|
453
|
+
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else if (action.type === 'ACTION') {
|
|
457
|
+
/** @type {?} */
|
|
458
|
+
var actionPayload = JSON.parse(action.payload);
|
|
459
|
+
this.store.dispatch(actionPayload);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
NgxsReduxDevtoolsPlugin.decorators = [
|
|
463
|
+
{ type: core.Injectable }
|
|
464
|
+
];
|
|
465
|
+
/** @nocollapse */
|
|
466
|
+
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
467
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
468
|
+
{ type: core.Injector }
|
|
469
|
+
]; };
|
|
470
|
+
return NgxsReduxDevtoolsPlugin;
|
|
471
|
+
}());
|
|
472
|
+
if (false) {
|
|
473
|
+
/**
|
|
474
|
+
* @type {?}
|
|
475
|
+
* @private
|
|
476
|
+
*/
|
|
477
|
+
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
478
|
+
/**
|
|
479
|
+
* @type {?}
|
|
480
|
+
* @private
|
|
481
|
+
*/
|
|
482
|
+
NgxsReduxDevtoolsPlugin.prototype.windowObj;
|
|
483
|
+
/**
|
|
484
|
+
* @type {?}
|
|
485
|
+
* @private
|
|
486
|
+
*/
|
|
487
|
+
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
488
|
+
/**
|
|
489
|
+
* @type {?}
|
|
490
|
+
* @private
|
|
491
|
+
*/
|
|
492
|
+
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
488
493
|
}
|
|
489
494
|
|
|
490
|
-
/**
|
|
491
|
-
* @fileoverview added by tsickle
|
|
492
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
493
|
-
*/
|
|
494
|
-
/**
|
|
495
|
-
* @param {?} options
|
|
496
|
-
* @return {?}
|
|
497
|
-
*/
|
|
498
|
-
function devtoolsOptionsFactory(options) {
|
|
499
|
-
return __assign({ name: 'NGXS' }, options);
|
|
500
|
-
}
|
|
501
|
-
/** @type {?} */
|
|
502
|
-
var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
|
|
503
|
-
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
504
|
-
function NgxsReduxDevtoolsPluginModule() {
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* @param {?=} options
|
|
508
|
-
* @return {?}
|
|
509
|
-
*/
|
|
510
|
-
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
511
|
-
* @param {?=} options
|
|
512
|
-
* @return {?}
|
|
513
|
-
*/
|
|
514
|
-
function (options) {
|
|
515
|
-
return {
|
|
516
|
-
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
517
|
-
providers: [
|
|
518
|
-
{
|
|
519
|
-
provide: store.NGXS_PLUGINS,
|
|
520
|
-
useClass: NgxsReduxDevtoolsPlugin,
|
|
521
|
-
multi: true
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
provide: USER_OPTIONS,
|
|
525
|
-
useValue: options
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
529
|
-
useFactory: devtoolsOptionsFactory,
|
|
530
|
-
deps: [USER_OPTIONS]
|
|
531
|
-
}
|
|
532
|
-
]
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
536
|
-
{ type: core.NgModule }
|
|
537
|
-
];
|
|
538
|
-
return NgxsReduxDevtoolsPluginModule;
|
|
495
|
+
/**
|
|
496
|
+
* @fileoverview added by tsickle
|
|
497
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
498
|
+
*/
|
|
499
|
+
/**
|
|
500
|
+
* @param {?} options
|
|
501
|
+
* @return {?}
|
|
502
|
+
*/
|
|
503
|
+
function devtoolsOptionsFactory(options) {
|
|
504
|
+
return __assign({ name: 'NGXS' }, options);
|
|
505
|
+
}
|
|
506
|
+
/** @type {?} */
|
|
507
|
+
var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
|
|
508
|
+
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
509
|
+
function NgxsReduxDevtoolsPluginModule() {
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* @param {?=} options
|
|
513
|
+
* @return {?}
|
|
514
|
+
*/
|
|
515
|
+
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
516
|
+
* @param {?=} options
|
|
517
|
+
* @return {?}
|
|
518
|
+
*/
|
|
519
|
+
function (options) {
|
|
520
|
+
return {
|
|
521
|
+
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
522
|
+
providers: [
|
|
523
|
+
{
|
|
524
|
+
provide: store.NGXS_PLUGINS,
|
|
525
|
+
useClass: NgxsReduxDevtoolsPlugin,
|
|
526
|
+
multi: true
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
provide: USER_OPTIONS,
|
|
530
|
+
useValue: options
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
534
|
+
useFactory: devtoolsOptionsFactory,
|
|
535
|
+
deps: [USER_OPTIONS]
|
|
536
|
+
}
|
|
537
|
+
]
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
541
|
+
{ type: core.NgModule }
|
|
542
|
+
];
|
|
543
|
+
return NgxsReduxDevtoolsPluginModule;
|
|
539
544
|
}());
|
|
540
545
|
|
|
541
546
|
exports.NGXS_DEVTOOLS_OPTIONS = NGXS_DEVTOOLS_OPTIONS;
|