@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
|
@@ -223,388 +223,388 @@
|
|
|
223
223
|
return value;
|
|
224
224
|
}
|
|
225
225
|
|
|
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 {?} */
|
|
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 {?} */
|
|
301
301
|
var NGXS_DEVTOOLS_OPTIONS = new core.InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
302
302
|
|
|
303
|
-
/**
|
|
304
|
-
* @fileoverview added by tsickle
|
|
305
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
306
|
-
*/
|
|
307
|
-
/** @enum {string} */
|
|
308
|
-
var ReduxDevtoolsActionType = {
|
|
309
|
-
Dispatch: 'DISPATCH',
|
|
310
|
-
Action: 'ACTION',
|
|
311
|
-
};
|
|
312
|
-
/** @enum {string} */
|
|
313
|
-
var ReduxDevtoolsPayloadType = {
|
|
314
|
-
JumpToAction: 'JUMP_TO_ACTION',
|
|
315
|
-
JumpToState: 'JUMP_TO_STATE',
|
|
316
|
-
ToggleAction: 'TOGGLE_ACTION',
|
|
317
|
-
ImportState: 'IMPORT_STATE',
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* Adds support for the Redux Devtools extension:
|
|
321
|
-
* http://extension.remotedev.io/
|
|
322
|
-
*/
|
|
323
|
-
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
324
|
-
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
325
|
-
this._options = _options;
|
|
326
|
-
this._injector = _injector;
|
|
327
|
-
this._ngZone = _ngZone;
|
|
328
|
-
this.devtoolsExtension = null;
|
|
329
|
-
this.globalDevtools = core.ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || core.ɵglobal['devToolsExtension'];
|
|
330
|
-
this.unsubscribe = null;
|
|
331
|
-
this.connect();
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* @return {?}
|
|
335
|
-
*/
|
|
336
|
-
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
337
|
-
* @return {?}
|
|
338
|
-
*/
|
|
339
|
-
function () {
|
|
340
|
-
if (this.unsubscribe !== null) {
|
|
341
|
-
this.unsubscribe();
|
|
342
|
-
}
|
|
343
|
-
if (this.globalDevtools) {
|
|
344
|
-
this.globalDevtools.disconnect();
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
348
|
-
/**
|
|
349
|
-
* Lazy get the store for circular dependency issues
|
|
350
|
-
*/
|
|
351
|
-
get: /**
|
|
352
|
-
* Lazy get the store for circular dependency issues
|
|
353
|
-
* @private
|
|
354
|
-
* @return {?}
|
|
355
|
-
*/
|
|
356
|
-
function () {
|
|
357
|
-
return this._injector.get(store.Store);
|
|
358
|
-
},
|
|
359
|
-
enumerable: true,
|
|
360
|
-
configurable: true
|
|
361
|
-
});
|
|
362
|
-
/**
|
|
363
|
-
* Middleware handle function
|
|
364
|
-
*/
|
|
365
|
-
/**
|
|
366
|
-
* Middleware handle function
|
|
367
|
-
* @param {?} state
|
|
368
|
-
* @param {?} action
|
|
369
|
-
* @param {?} next
|
|
370
|
-
* @return {?}
|
|
371
|
-
*/
|
|
372
|
-
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
373
|
-
* Middleware handle function
|
|
374
|
-
* @param {?} state
|
|
375
|
-
* @param {?} action
|
|
376
|
-
* @param {?} next
|
|
377
|
-
* @return {?}
|
|
378
|
-
*/
|
|
379
|
-
function (state, action, next) {
|
|
380
|
-
var _this = this;
|
|
381
|
-
if (!this.devtoolsExtension || this._options.disabled) {
|
|
382
|
-
return next(state, action);
|
|
383
|
-
}
|
|
384
|
-
return next(state, action).pipe(operators.catchError((/**
|
|
385
|
-
* @param {?} error
|
|
386
|
-
* @return {?}
|
|
387
|
-
*/
|
|
388
|
-
function (error) {
|
|
389
|
-
/** @type {?} */
|
|
390
|
-
var newState = _this.store.snapshot();
|
|
391
|
-
_this.sendToDevTools(state, action, newState);
|
|
392
|
-
throw error;
|
|
393
|
-
})), operators.tap((/**
|
|
394
|
-
* @param {?} newState
|
|
395
|
-
* @return {?}
|
|
396
|
-
*/
|
|
397
|
-
function (newState) {
|
|
398
|
-
_this.sendToDevTools(state, action, newState);
|
|
399
|
-
})));
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* @private
|
|
403
|
-
* @param {?} state
|
|
404
|
-
* @param {?} action
|
|
405
|
-
* @param {?} newState
|
|
406
|
-
* @return {?}
|
|
407
|
-
*/
|
|
408
|
-
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
409
|
-
* @private
|
|
410
|
-
* @param {?} state
|
|
411
|
-
* @param {?} action
|
|
412
|
-
* @param {?} newState
|
|
413
|
-
* @return {?}
|
|
414
|
-
*/
|
|
415
|
-
function (state, action, newState) {
|
|
416
|
-
/** @type {?} */
|
|
417
|
-
var type = store.getActionTypeFromInstance(action);
|
|
418
|
-
// if init action, send initial state to dev tools
|
|
419
|
-
/** @type {?} */
|
|
420
|
-
var isInitAction = type === '@@INIT';
|
|
421
|
-
if (isInitAction) {
|
|
422
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
/**
|
|
429
|
-
* Handle the action from the dev tools subscription
|
|
430
|
-
*/
|
|
431
|
-
/**
|
|
432
|
-
* Handle the action from the dev tools subscription
|
|
433
|
-
* @param {?} action
|
|
434
|
-
* @return {?}
|
|
435
|
-
*/
|
|
436
|
-
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
437
|
-
* Handle the action from the dev tools subscription
|
|
438
|
-
* @param {?} action
|
|
439
|
-
* @return {?}
|
|
440
|
-
*/
|
|
441
|
-
function (action) {
|
|
442
|
-
var _this = this;
|
|
443
|
-
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
444
|
-
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
445
|
-
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
446
|
-
/** @type {?} */
|
|
447
|
-
var prevState = JSON.parse(action.state);
|
|
448
|
-
this.store.reset(prevState);
|
|
449
|
-
}
|
|
450
|
-
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
451
|
-
console.warn('Skip is not supported at this time.');
|
|
452
|
-
}
|
|
453
|
-
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
454
|
-
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
455
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
456
|
-
Object.keys(actionsById_1)
|
|
457
|
-
.filter((/**
|
|
458
|
-
* @param {?} actionId
|
|
459
|
-
* @return {?}
|
|
460
|
-
*/
|
|
461
|
-
function (actionId) { return actionId !== '0'; }))
|
|
462
|
-
.forEach((/**
|
|
463
|
-
* @param {?} actionId
|
|
464
|
-
* @return {?}
|
|
465
|
-
*/
|
|
466
|
-
function (actionId) {
|
|
467
|
-
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
468
|
-
}));
|
|
469
|
-
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
else if (action.type === "ACTION" /* Action */) {
|
|
473
|
-
/** @type {?} */
|
|
474
|
-
var actionPayload = JSON.parse(action.payload);
|
|
475
|
-
this.store.dispatch(actionPayload);
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
/**
|
|
479
|
-
* @private
|
|
480
|
-
* @return {?}
|
|
481
|
-
*/
|
|
482
|
-
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
483
|
-
* @private
|
|
484
|
-
* @return {?}
|
|
485
|
-
*/
|
|
486
|
-
function () {
|
|
487
|
-
var _this = this;
|
|
488
|
-
if (!this.globalDevtools || this._options.disabled) {
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
// The `connect` method adds `message` event listener since it communicates
|
|
492
|
-
// with an extension through `window.postMessage` and message events.
|
|
493
|
-
// We handle only 2 events; thus, we don't want to run many change detections
|
|
494
|
-
// because the extension sends events that we don't have to handle.
|
|
495
|
-
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
496
|
-
* @return {?}
|
|
497
|
-
*/
|
|
498
|
-
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
499
|
-
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
500
|
-
* @param {?} action
|
|
501
|
-
* @return {?}
|
|
502
|
-
*/
|
|
503
|
-
function (action) {
|
|
504
|
-
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
505
|
-
action.type === "ACTION" /* Action */) {
|
|
506
|
-
_this._ngZone.run((/**
|
|
507
|
-
* @return {?}
|
|
508
|
-
*/
|
|
509
|
-
function () {
|
|
510
|
-
_this.dispatched(action);
|
|
511
|
-
}));
|
|
512
|
-
}
|
|
513
|
-
}));
|
|
514
|
-
};
|
|
515
|
-
NgxsReduxDevtoolsPlugin.decorators = [
|
|
516
|
-
{ type: core.Injectable }
|
|
517
|
-
];
|
|
518
|
-
/** @nocollapse */
|
|
519
|
-
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
520
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
521
|
-
{ type: core.Injector },
|
|
522
|
-
{ type: core.NgZone }
|
|
523
|
-
]; };
|
|
524
|
-
return NgxsReduxDevtoolsPlugin;
|
|
525
|
-
}());
|
|
526
|
-
if (false) {
|
|
527
|
-
/**
|
|
528
|
-
* @type {?}
|
|
529
|
-
* @private
|
|
530
|
-
*/
|
|
531
|
-
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
532
|
-
/**
|
|
533
|
-
* @type {?}
|
|
534
|
-
* @private
|
|
535
|
-
*/
|
|
536
|
-
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
537
|
-
/**
|
|
538
|
-
* @type {?}
|
|
539
|
-
* @private
|
|
540
|
-
*/
|
|
541
|
-
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
542
|
-
/**
|
|
543
|
-
* @type {?}
|
|
544
|
-
* @private
|
|
545
|
-
*/
|
|
546
|
-
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
547
|
-
/**
|
|
548
|
-
* @type {?}
|
|
549
|
-
* @private
|
|
550
|
-
*/
|
|
551
|
-
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
552
|
-
/**
|
|
553
|
-
* @type {?}
|
|
554
|
-
* @private
|
|
555
|
-
*/
|
|
556
|
-
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
303
|
+
/**
|
|
304
|
+
* @fileoverview added by tsickle
|
|
305
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
306
|
+
*/
|
|
307
|
+
/** @enum {string} */
|
|
308
|
+
var ReduxDevtoolsActionType = {
|
|
309
|
+
Dispatch: 'DISPATCH',
|
|
310
|
+
Action: 'ACTION',
|
|
311
|
+
};
|
|
312
|
+
/** @enum {string} */
|
|
313
|
+
var ReduxDevtoolsPayloadType = {
|
|
314
|
+
JumpToAction: 'JUMP_TO_ACTION',
|
|
315
|
+
JumpToState: 'JUMP_TO_STATE',
|
|
316
|
+
ToggleAction: 'TOGGLE_ACTION',
|
|
317
|
+
ImportState: 'IMPORT_STATE',
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Adds support for the Redux Devtools extension:
|
|
321
|
+
* http://extension.remotedev.io/
|
|
322
|
+
*/
|
|
323
|
+
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
324
|
+
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
325
|
+
this._options = _options;
|
|
326
|
+
this._injector = _injector;
|
|
327
|
+
this._ngZone = _ngZone;
|
|
328
|
+
this.devtoolsExtension = null;
|
|
329
|
+
this.globalDevtools = core.ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || core.ɵglobal['devToolsExtension'];
|
|
330
|
+
this.unsubscribe = null;
|
|
331
|
+
this.connect();
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @return {?}
|
|
335
|
+
*/
|
|
336
|
+
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
337
|
+
* @return {?}
|
|
338
|
+
*/
|
|
339
|
+
function () {
|
|
340
|
+
if (this.unsubscribe !== null) {
|
|
341
|
+
this.unsubscribe();
|
|
342
|
+
}
|
|
343
|
+
if (this.globalDevtools) {
|
|
344
|
+
this.globalDevtools.disconnect();
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
348
|
+
/**
|
|
349
|
+
* Lazy get the store for circular dependency issues
|
|
350
|
+
*/
|
|
351
|
+
get: /**
|
|
352
|
+
* Lazy get the store for circular dependency issues
|
|
353
|
+
* @private
|
|
354
|
+
* @return {?}
|
|
355
|
+
*/
|
|
356
|
+
function () {
|
|
357
|
+
return this._injector.get(store.Store);
|
|
358
|
+
},
|
|
359
|
+
enumerable: true,
|
|
360
|
+
configurable: true
|
|
361
|
+
});
|
|
362
|
+
/**
|
|
363
|
+
* Middleware handle function
|
|
364
|
+
*/
|
|
365
|
+
/**
|
|
366
|
+
* Middleware handle function
|
|
367
|
+
* @param {?} state
|
|
368
|
+
* @param {?} action
|
|
369
|
+
* @param {?} next
|
|
370
|
+
* @return {?}
|
|
371
|
+
*/
|
|
372
|
+
NgxsReduxDevtoolsPlugin.prototype.handle = /**
|
|
373
|
+
* Middleware handle function
|
|
374
|
+
* @param {?} state
|
|
375
|
+
* @param {?} action
|
|
376
|
+
* @param {?} next
|
|
377
|
+
* @return {?}
|
|
378
|
+
*/
|
|
379
|
+
function (state, action, next) {
|
|
380
|
+
var _this = this;
|
|
381
|
+
if (!this.devtoolsExtension || this._options.disabled) {
|
|
382
|
+
return next(state, action);
|
|
383
|
+
}
|
|
384
|
+
return next(state, action).pipe(operators.catchError((/**
|
|
385
|
+
* @param {?} error
|
|
386
|
+
* @return {?}
|
|
387
|
+
*/
|
|
388
|
+
function (error) {
|
|
389
|
+
/** @type {?} */
|
|
390
|
+
var newState = _this.store.snapshot();
|
|
391
|
+
_this.sendToDevTools(state, action, newState);
|
|
392
|
+
throw error;
|
|
393
|
+
})), operators.tap((/**
|
|
394
|
+
* @param {?} newState
|
|
395
|
+
* @return {?}
|
|
396
|
+
*/
|
|
397
|
+
function (newState) {
|
|
398
|
+
_this.sendToDevTools(state, action, newState);
|
|
399
|
+
})));
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* @private
|
|
403
|
+
* @param {?} state
|
|
404
|
+
* @param {?} action
|
|
405
|
+
* @param {?} newState
|
|
406
|
+
* @return {?}
|
|
407
|
+
*/
|
|
408
|
+
NgxsReduxDevtoolsPlugin.prototype.sendToDevTools = /**
|
|
409
|
+
* @private
|
|
410
|
+
* @param {?} state
|
|
411
|
+
* @param {?} action
|
|
412
|
+
* @param {?} newState
|
|
413
|
+
* @return {?}
|
|
414
|
+
*/
|
|
415
|
+
function (state, action, newState) {
|
|
416
|
+
/** @type {?} */
|
|
417
|
+
var type = store.getActionTypeFromInstance(action);
|
|
418
|
+
// if init action, send initial state to dev tools
|
|
419
|
+
/** @type {?} */
|
|
420
|
+
var isInitAction = type === '@@INIT';
|
|
421
|
+
if (isInitAction) {
|
|
422
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
(/** @type {?} */ (this.devtoolsExtension)).send(__assign({}, action, { action: null, type: type }), newState);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Handle the action from the dev tools subscription
|
|
430
|
+
*/
|
|
431
|
+
/**
|
|
432
|
+
* Handle the action from the dev tools subscription
|
|
433
|
+
* @param {?} action
|
|
434
|
+
* @return {?}
|
|
435
|
+
*/
|
|
436
|
+
NgxsReduxDevtoolsPlugin.prototype.dispatched = /**
|
|
437
|
+
* Handle the action from the dev tools subscription
|
|
438
|
+
* @param {?} action
|
|
439
|
+
* @return {?}
|
|
440
|
+
*/
|
|
441
|
+
function (action) {
|
|
442
|
+
var _this = this;
|
|
443
|
+
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
444
|
+
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
445
|
+
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
446
|
+
/** @type {?} */
|
|
447
|
+
var prevState = JSON.parse(action.state);
|
|
448
|
+
this.store.reset(prevState);
|
|
449
|
+
}
|
|
450
|
+
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
451
|
+
console.warn('Skip is not supported at this time.');
|
|
452
|
+
}
|
|
453
|
+
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
454
|
+
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
455
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
456
|
+
Object.keys(actionsById_1)
|
|
457
|
+
.filter((/**
|
|
458
|
+
* @param {?} actionId
|
|
459
|
+
* @return {?}
|
|
460
|
+
*/
|
|
461
|
+
function (actionId) { return actionId !== '0'; }))
|
|
462
|
+
.forEach((/**
|
|
463
|
+
* @param {?} actionId
|
|
464
|
+
* @return {?}
|
|
465
|
+
*/
|
|
466
|
+
function (actionId) {
|
|
467
|
+
return (/** @type {?} */ (_this.devtoolsExtension)).send(actionsById_1[actionId], computedStates_1[actionId].state);
|
|
468
|
+
}));
|
|
469
|
+
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
else if (action.type === "ACTION" /* Action */) {
|
|
473
|
+
/** @type {?} */
|
|
474
|
+
var actionPayload = JSON.parse(action.payload);
|
|
475
|
+
this.store.dispatch(actionPayload);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* @private
|
|
480
|
+
* @return {?}
|
|
481
|
+
*/
|
|
482
|
+
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
483
|
+
* @private
|
|
484
|
+
* @return {?}
|
|
485
|
+
*/
|
|
486
|
+
function () {
|
|
487
|
+
var _this = this;
|
|
488
|
+
if (!this.globalDevtools || this._options.disabled) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
// The `connect` method adds `message` event listener since it communicates
|
|
492
|
+
// with an extension through `window.postMessage` and message events.
|
|
493
|
+
// We handle only 2 events; thus, we don't want to run many change detections
|
|
494
|
+
// because the extension sends events that we don't have to handle.
|
|
495
|
+
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
496
|
+
* @return {?}
|
|
497
|
+
*/
|
|
498
|
+
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
499
|
+
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
500
|
+
* @param {?} action
|
|
501
|
+
* @return {?}
|
|
502
|
+
*/
|
|
503
|
+
function (action) {
|
|
504
|
+
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
505
|
+
action.type === "ACTION" /* Action */) {
|
|
506
|
+
_this._ngZone.run((/**
|
|
507
|
+
* @return {?}
|
|
508
|
+
*/
|
|
509
|
+
function () {
|
|
510
|
+
_this.dispatched(action);
|
|
511
|
+
}));
|
|
512
|
+
}
|
|
513
|
+
}));
|
|
514
|
+
};
|
|
515
|
+
NgxsReduxDevtoolsPlugin.decorators = [
|
|
516
|
+
{ type: core.Injectable }
|
|
517
|
+
];
|
|
518
|
+
/** @nocollapse */
|
|
519
|
+
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
520
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
521
|
+
{ type: core.Injector },
|
|
522
|
+
{ type: core.NgZone }
|
|
523
|
+
]; };
|
|
524
|
+
return NgxsReduxDevtoolsPlugin;
|
|
525
|
+
}());
|
|
526
|
+
if (false) {
|
|
527
|
+
/**
|
|
528
|
+
* @type {?}
|
|
529
|
+
* @private
|
|
530
|
+
*/
|
|
531
|
+
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
532
|
+
/**
|
|
533
|
+
* @type {?}
|
|
534
|
+
* @private
|
|
535
|
+
*/
|
|
536
|
+
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
537
|
+
/**
|
|
538
|
+
* @type {?}
|
|
539
|
+
* @private
|
|
540
|
+
*/
|
|
541
|
+
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
542
|
+
/**
|
|
543
|
+
* @type {?}
|
|
544
|
+
* @private
|
|
545
|
+
*/
|
|
546
|
+
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
547
|
+
/**
|
|
548
|
+
* @type {?}
|
|
549
|
+
* @private
|
|
550
|
+
*/
|
|
551
|
+
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
552
|
+
/**
|
|
553
|
+
* @type {?}
|
|
554
|
+
* @private
|
|
555
|
+
*/
|
|
556
|
+
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
-
/**
|
|
560
|
-
* @fileoverview added by tsickle
|
|
561
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
562
|
-
*/
|
|
563
|
-
/**
|
|
564
|
-
* @param {?} options
|
|
565
|
-
* @return {?}
|
|
566
|
-
*/
|
|
567
|
-
function devtoolsOptionsFactory(options) {
|
|
568
|
-
return __assign({ name: 'NGXS' }, options);
|
|
569
|
-
}
|
|
570
|
-
/** @type {?} */
|
|
571
|
-
var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
|
|
572
|
-
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
573
|
-
function NgxsReduxDevtoolsPluginModule() {
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* @param {?=} options
|
|
577
|
-
* @return {?}
|
|
578
|
-
*/
|
|
579
|
-
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
580
|
-
* @param {?=} options
|
|
581
|
-
* @return {?}
|
|
582
|
-
*/
|
|
583
|
-
function (options) {
|
|
584
|
-
return {
|
|
585
|
-
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
586
|
-
providers: [
|
|
587
|
-
{
|
|
588
|
-
provide: store.NGXS_PLUGINS,
|
|
589
|
-
useClass: NgxsReduxDevtoolsPlugin,
|
|
590
|
-
multi: true
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
provide: USER_OPTIONS,
|
|
594
|
-
useValue: options
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
598
|
-
useFactory: devtoolsOptionsFactory,
|
|
599
|
-
deps: [USER_OPTIONS]
|
|
600
|
-
}
|
|
601
|
-
]
|
|
602
|
-
};
|
|
603
|
-
};
|
|
604
|
-
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
605
|
-
{ type: core.NgModule }
|
|
606
|
-
];
|
|
607
|
-
return NgxsReduxDevtoolsPluginModule;
|
|
559
|
+
/**
|
|
560
|
+
* @fileoverview added by tsickle
|
|
561
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
562
|
+
*/
|
|
563
|
+
/**
|
|
564
|
+
* @param {?} options
|
|
565
|
+
* @return {?}
|
|
566
|
+
*/
|
|
567
|
+
function devtoolsOptionsFactory(options) {
|
|
568
|
+
return __assign({ name: 'NGXS' }, options);
|
|
569
|
+
}
|
|
570
|
+
/** @type {?} */
|
|
571
|
+
var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
|
|
572
|
+
var NgxsReduxDevtoolsPluginModule = /** @class */ (function () {
|
|
573
|
+
function NgxsReduxDevtoolsPluginModule() {
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* @param {?=} options
|
|
577
|
+
* @return {?}
|
|
578
|
+
*/
|
|
579
|
+
NgxsReduxDevtoolsPluginModule.forRoot = /**
|
|
580
|
+
* @param {?=} options
|
|
581
|
+
* @return {?}
|
|
582
|
+
*/
|
|
583
|
+
function (options) {
|
|
584
|
+
return {
|
|
585
|
+
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
586
|
+
providers: [
|
|
587
|
+
{
|
|
588
|
+
provide: store.NGXS_PLUGINS,
|
|
589
|
+
useClass: NgxsReduxDevtoolsPlugin,
|
|
590
|
+
multi: true
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
provide: USER_OPTIONS,
|
|
594
|
+
useValue: options
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
598
|
+
useFactory: devtoolsOptionsFactory,
|
|
599
|
+
deps: [USER_OPTIONS]
|
|
600
|
+
}
|
|
601
|
+
]
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
605
|
+
{ type: core.NgModule }
|
|
606
|
+
];
|
|
607
|
+
return NgxsReduxDevtoolsPluginModule;
|
|
608
608
|
}());
|
|
609
609
|
|
|
610
610
|
exports.NGXS_DEVTOOLS_OPTIONS = NGXS_DEVTOOLS_OPTIONS;
|