@ngrx/store-devtools 12.3.0 → 13.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ngrx-store-devtools.umd.js +232 -201
- package/bundles/ngrx-store-devtools.umd.js.map +1 -1
- package/esm2015/ngrx-store-devtools.js +1 -5
- package/esm2015/src/config.js +5 -2
- package/esm2015/src/devtools-dispatcher.js +7 -4
- package/esm2015/src/devtools.js +20 -20
- package/esm2015/src/extension.js +16 -12
- package/esm2015/src/instrument.js +9 -4
- package/fesm2015/ngrx-store-devtools.js +182 -172
- package/fesm2015/ngrx-store-devtools.js.map +1 -1
- package/ngrx-store-devtools.d.ts +1 -4
- package/package.json +4 -5
- package/schematics-core/index.js +2 -1
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +7 -1
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/src/config.d.ts +8 -2
- package/src/devtools-dispatcher.d.ts +3 -0
- package/src/devtools.d.ts +3 -0
- package/src/extension.d.ts +3 -0
- package/src/instrument.d.ts +4 -0
- package/ngrx-store-devtools.metadata.json +0 -1
|
@@ -2,10 +2,36 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ngrx/store'), require('rxjs'), require('rxjs/operators')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@ngrx/store-devtools', ['exports', '@angular/core', '@ngrx/store', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ngrx = global.ngrx || {}, global.ngrx['store-devtools'] = {}), global.ng.core, global.ngrx.store, global.rxjs, global.rxjs.operators));
|
|
5
|
-
}(this, (function (exports,
|
|
5
|
+
}(this, (function (exports, i0, i2, rxjs, operators) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return e[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n['default'] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
6
29
|
|
|
7
30
|
/**
|
|
8
|
-
*
|
|
31
|
+
* Chrome extension documentation
|
|
32
|
+
* @see https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md
|
|
33
|
+
* Firefox extension documentation
|
|
34
|
+
* @see https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md
|
|
9
35
|
*/
|
|
10
36
|
var StoreDevtoolsConfig = /** @class */ (function () {
|
|
11
37
|
function StoreDevtoolsConfig() {
|
|
@@ -16,11 +42,11 @@
|
|
|
16
42
|
}
|
|
17
43
|
return StoreDevtoolsConfig;
|
|
18
44
|
}());
|
|
19
|
-
var STORE_DEVTOOLS_CONFIG = new
|
|
45
|
+
var STORE_DEVTOOLS_CONFIG = new i0.InjectionToken('@ngrx/store-devtools Options');
|
|
20
46
|
/**
|
|
21
47
|
* Used to provide a `StoreDevtoolsConfig` for the store-devtools.
|
|
22
48
|
*/
|
|
23
|
-
var INITIAL_OPTIONS = new
|
|
49
|
+
var INITIAL_OPTIONS = new i0.InjectionToken('@ngrx/store-devtools Initial Config');
|
|
24
50
|
function noMonitor() {
|
|
25
51
|
return null;
|
|
26
52
|
}
|
|
@@ -288,10 +314,16 @@
|
|
|
288
314
|
r[k] = a[j];
|
|
289
315
|
return r;
|
|
290
316
|
}
|
|
291
|
-
function __spreadArray(to, from) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
317
|
+
function __spreadArray(to, from, pack) {
|
|
318
|
+
if (pack || arguments.length === 2)
|
|
319
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
320
|
+
if (ar || !(i in from)) {
|
|
321
|
+
if (!ar)
|
|
322
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
323
|
+
ar[i] = from[i];
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
295
327
|
}
|
|
296
328
|
function __await(v) {
|
|
297
329
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -485,17 +517,6 @@
|
|
|
485
517
|
return PauseRecording;
|
|
486
518
|
}());
|
|
487
519
|
|
|
488
|
-
var DevtoolsDispatcher = /** @class */ (function (_super) {
|
|
489
|
-
__extends(DevtoolsDispatcher, _super);
|
|
490
|
-
function DevtoolsDispatcher() {
|
|
491
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
492
|
-
}
|
|
493
|
-
return DevtoolsDispatcher;
|
|
494
|
-
}(store.ActionsSubject));
|
|
495
|
-
DevtoolsDispatcher.decorators = [
|
|
496
|
-
{ type: core.Injectable }
|
|
497
|
-
];
|
|
498
|
-
|
|
499
520
|
function difference(first, second) {
|
|
500
521
|
return first.filter(function (item) { return second.indexOf(item) < 0; });
|
|
501
522
|
}
|
|
@@ -601,156 +622,7 @@
|
|
|
601
622
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
602
623
|
}
|
|
603
624
|
|
|
604
|
-
var
|
|
605
|
-
START: 'START',
|
|
606
|
-
DISPATCH: 'DISPATCH',
|
|
607
|
-
STOP: 'STOP',
|
|
608
|
-
ACTION: 'ACTION',
|
|
609
|
-
};
|
|
610
|
-
var REDUX_DEVTOOLS_EXTENSION = new core.InjectionToken('@ngrx/store-devtools Redux Devtools Extension');
|
|
611
|
-
var DevtoolsExtension = /** @class */ (function () {
|
|
612
|
-
function DevtoolsExtension(devtoolsExtension, config, dispatcher) {
|
|
613
|
-
this.config = config;
|
|
614
|
-
this.dispatcher = dispatcher;
|
|
615
|
-
this.devtoolsExtension = devtoolsExtension;
|
|
616
|
-
this.createActionStreams();
|
|
617
|
-
}
|
|
618
|
-
DevtoolsExtension.prototype.notify = function (action, state) {
|
|
619
|
-
var _this = this;
|
|
620
|
-
if (!this.devtoolsExtension) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
// Check to see if the action requires a full update of the liftedState.
|
|
624
|
-
// If it is a simple action generated by the user's app and the recording
|
|
625
|
-
// is not locked/paused, only send the action and the current state (fast).
|
|
626
|
-
//
|
|
627
|
-
// A full liftedState update (slow: serializes the entire liftedState) is
|
|
628
|
-
// only required when:
|
|
629
|
-
// a) redux-devtools-extension fires the @@Init action (ignored by
|
|
630
|
-
// @ngrx/store-devtools)
|
|
631
|
-
// b) an action is generated by an @ngrx module (e.g. @ngrx/effects/init
|
|
632
|
-
// or @ngrx/store/update-reducers)
|
|
633
|
-
// c) the state has been recomputed due to time-traveling
|
|
634
|
-
// d) any action that is not a PerformAction to err on the side of
|
|
635
|
-
// caution.
|
|
636
|
-
if (action.type === PERFORM_ACTION) {
|
|
637
|
-
if (state.isLocked || state.isPaused) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
var currentState = unliftState(state);
|
|
641
|
-
if (shouldFilterActions(this.config) &&
|
|
642
|
-
isActionFiltered(currentState, action, this.config.predicate, this.config.actionsSafelist, this.config.actionsBlocklist)) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
var sanitizedState_1 = this.config.stateSanitizer
|
|
646
|
-
? sanitizeState(this.config.stateSanitizer, currentState, state.currentStateIndex)
|
|
647
|
-
: currentState;
|
|
648
|
-
var sanitizedAction_1 = this.config.actionSanitizer
|
|
649
|
-
? sanitizeAction(this.config.actionSanitizer, action, state.nextActionId)
|
|
650
|
-
: action;
|
|
651
|
-
this.sendToReduxDevtools(function () { return _this.extensionConnection.send(sanitizedAction_1, sanitizedState_1); });
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
// Requires full state update
|
|
655
|
-
var sanitizedLiftedState_1 = Object.assign(Object.assign({}, state), { stagedActionIds: state.stagedActionIds, actionsById: this.config.actionSanitizer
|
|
656
|
-
? sanitizeActions(this.config.actionSanitizer, state.actionsById)
|
|
657
|
-
: state.actionsById, computedStates: this.config.stateSanitizer
|
|
658
|
-
? sanitizeStates(this.config.stateSanitizer, state.computedStates)
|
|
659
|
-
: state.computedStates });
|
|
660
|
-
this.sendToReduxDevtools(function () { return _this.devtoolsExtension.send(null, sanitizedLiftedState_1, _this.getExtensionConfig(_this.config)); });
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
DevtoolsExtension.prototype.createChangesObservable = function () {
|
|
664
|
-
var _this = this;
|
|
665
|
-
if (!this.devtoolsExtension) {
|
|
666
|
-
return rxjs.EMPTY;
|
|
667
|
-
}
|
|
668
|
-
return new rxjs.Observable(function (subscriber) {
|
|
669
|
-
var connection = _this.devtoolsExtension.connect(_this.getExtensionConfig(_this.config));
|
|
670
|
-
_this.extensionConnection = connection;
|
|
671
|
-
connection.init();
|
|
672
|
-
connection.subscribe(function (change) { return subscriber.next(change); });
|
|
673
|
-
return connection.unsubscribe;
|
|
674
|
-
});
|
|
675
|
-
};
|
|
676
|
-
DevtoolsExtension.prototype.createActionStreams = function () {
|
|
677
|
-
var _this = this;
|
|
678
|
-
// Listens to all changes
|
|
679
|
-
var changes$ = this.createChangesObservable().pipe(operators.share());
|
|
680
|
-
// Listen for the start action
|
|
681
|
-
var start$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.START; }));
|
|
682
|
-
// Listen for the stop action
|
|
683
|
-
var stop$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.STOP; }));
|
|
684
|
-
// Listen for lifted actions
|
|
685
|
-
var liftedActions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.DISPATCH; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }), operators.concatMap(function (action) {
|
|
686
|
-
if (action.type === IMPORT_STATE) {
|
|
687
|
-
// State imports may happen in two situations:
|
|
688
|
-
// 1. Explicitly by user
|
|
689
|
-
// 2. User activated the "persist state accross reloads" option
|
|
690
|
-
// and now the state is imported during reload.
|
|
691
|
-
// Because of option 2, we need to give possible
|
|
692
|
-
// lazy loaded reducers time to instantiate.
|
|
693
|
-
// As soon as there is no UPDATE action within 1 second,
|
|
694
|
-
// it is assumed that all reducers are loaded.
|
|
695
|
-
return _this.dispatcher.pipe(operators.filter(function (action) { return action.type === store.UPDATE; }), operators.timeout(1000), operators.debounceTime(1000), operators.map(function () { return action; }), operators.catchError(function () { return rxjs.of(action); }), operators.take(1));
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
return rxjs.of(action);
|
|
699
|
-
}
|
|
700
|
-
}));
|
|
701
|
-
// Listen for unlifted actions
|
|
702
|
-
var actions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.ACTION; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
703
|
-
var actionsUntilStop$ = actions$.pipe(operators.takeUntil(stop$));
|
|
704
|
-
var liftedUntilStop$ = liftedActions$.pipe(operators.takeUntil(stop$));
|
|
705
|
-
this.start$ = start$.pipe(operators.takeUntil(stop$));
|
|
706
|
-
// Only take the action sources between the start/stop events
|
|
707
|
-
this.actions$ = this.start$.pipe(operators.switchMap(function () { return actionsUntilStop$; }));
|
|
708
|
-
this.liftedActions$ = this.start$.pipe(operators.switchMap(function () { return liftedUntilStop$; }));
|
|
709
|
-
};
|
|
710
|
-
DevtoolsExtension.prototype.unwrapAction = function (action) {
|
|
711
|
-
return typeof action === 'string' ? eval("(" + action + ")") : action;
|
|
712
|
-
};
|
|
713
|
-
DevtoolsExtension.prototype.getExtensionConfig = function (config) {
|
|
714
|
-
var _a;
|
|
715
|
-
var extensionOptions = {
|
|
716
|
-
name: config.name,
|
|
717
|
-
features: config.features,
|
|
718
|
-
serialize: config.serialize,
|
|
719
|
-
autoPause: (_a = config.autoPause) !== null && _a !== void 0 ? _a : false,
|
|
720
|
-
// The action/state sanitizers are not added to the config
|
|
721
|
-
// because sanitation is done in this class already.
|
|
722
|
-
// It is done before sending it to the devtools extension for consistency:
|
|
723
|
-
// - If we call extensionConnection.send(...),
|
|
724
|
-
// the extension would call the sanitizers.
|
|
725
|
-
// - If we call devtoolsExtension.send(...) (aka full state update),
|
|
726
|
-
// the extension would NOT call the sanitizers, so we have to do it ourselves.
|
|
727
|
-
};
|
|
728
|
-
if (config.maxAge !== false /* support === 0 */) {
|
|
729
|
-
extensionOptions.maxAge = config.maxAge;
|
|
730
|
-
}
|
|
731
|
-
return extensionOptions;
|
|
732
|
-
};
|
|
733
|
-
DevtoolsExtension.prototype.sendToReduxDevtools = function (send) {
|
|
734
|
-
try {
|
|
735
|
-
send();
|
|
736
|
-
}
|
|
737
|
-
catch (err) {
|
|
738
|
-
console.warn('@ngrx/store-devtools: something went wrong inside the redux devtools', err);
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
return DevtoolsExtension;
|
|
742
|
-
}());
|
|
743
|
-
DevtoolsExtension.decorators = [
|
|
744
|
-
{ type: core.Injectable }
|
|
745
|
-
];
|
|
746
|
-
/** @nocollapse */
|
|
747
|
-
DevtoolsExtension.ctorParameters = function () { return [
|
|
748
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [REDUX_DEVTOOLS_EXTENSION,] }] },
|
|
749
|
-
{ type: StoreDevtoolsConfig, decorators: [{ type: core.Inject, args: [STORE_DEVTOOLS_CONFIG,] }] },
|
|
750
|
-
{ type: DevtoolsDispatcher }
|
|
751
|
-
]; };
|
|
752
|
-
|
|
753
|
-
var INIT_ACTION = { type: store.INIT };
|
|
625
|
+
var INIT_ACTION = { type: i2.INIT };
|
|
754
626
|
var RECOMPUTE = '@ngrx/store-devtools/recompute';
|
|
755
627
|
var RECOMPUTE_ACTION = { type: RECOMPUTE };
|
|
756
628
|
/**
|
|
@@ -1027,7 +899,7 @@
|
|
|
1027
899
|
(_a = liftedAction.nextLiftedState, monitorState = _a.monitorState, actionsById = _a.actionsById, nextActionId = _a.nextActionId, stagedActionIds = _a.stagedActionIds, skippedActionIds = _a.skippedActionIds, committedState = _a.committedState, currentStateIndex = _a.currentStateIndex, computedStates = _a.computedStates, isLocked = _a.isLocked, isPaused = _a.isPaused);
|
|
1028
900
|
break;
|
|
1029
901
|
}
|
|
1030
|
-
case
|
|
902
|
+
case i2.INIT: {
|
|
1031
903
|
// Always recompute states on hot reload and init.
|
|
1032
904
|
minInvalidatedStateIndex = 0;
|
|
1033
905
|
if (options.maxAge && stagedActionIds.length > options.maxAge) {
|
|
@@ -1039,7 +911,7 @@
|
|
|
1039
911
|
}
|
|
1040
912
|
break;
|
|
1041
913
|
}
|
|
1042
|
-
case
|
|
914
|
+
case i2.UPDATE: {
|
|
1043
915
|
var stateHasErrors = computedStates.filter(function (state) { return state.error; }).length > 0;
|
|
1044
916
|
if (stateHasErrors) {
|
|
1045
917
|
// Recompute all states
|
|
@@ -1101,6 +973,172 @@
|
|
|
1101
973
|
}; };
|
|
1102
974
|
}
|
|
1103
975
|
|
|
976
|
+
var DevtoolsDispatcher = /** @class */ (function (_super) {
|
|
977
|
+
__extends(DevtoolsDispatcher, _super);
|
|
978
|
+
function DevtoolsDispatcher() {
|
|
979
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
980
|
+
}
|
|
981
|
+
return DevtoolsDispatcher;
|
|
982
|
+
}(i2.ActionsSubject));
|
|
983
|
+
/** @nocollapse */ DevtoolsDispatcher.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsDispatcher, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
984
|
+
/** @nocollapse */ DevtoolsDispatcher.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsDispatcher });
|
|
985
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsDispatcher, decorators: [{
|
|
986
|
+
type: i0.Injectable
|
|
987
|
+
}] });
|
|
988
|
+
|
|
989
|
+
var ExtensionActionTypes = {
|
|
990
|
+
START: 'START',
|
|
991
|
+
DISPATCH: 'DISPATCH',
|
|
992
|
+
STOP: 'STOP',
|
|
993
|
+
ACTION: 'ACTION',
|
|
994
|
+
};
|
|
995
|
+
var REDUX_DEVTOOLS_EXTENSION = new i0.InjectionToken('@ngrx/store-devtools Redux Devtools Extension');
|
|
996
|
+
var DevtoolsExtension = /** @class */ (function () {
|
|
997
|
+
function DevtoolsExtension(devtoolsExtension, config, dispatcher) {
|
|
998
|
+
this.config = config;
|
|
999
|
+
this.dispatcher = dispatcher;
|
|
1000
|
+
this.devtoolsExtension = devtoolsExtension;
|
|
1001
|
+
this.createActionStreams();
|
|
1002
|
+
}
|
|
1003
|
+
DevtoolsExtension.prototype.notify = function (action, state) {
|
|
1004
|
+
var _this = this;
|
|
1005
|
+
if (!this.devtoolsExtension) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
// Check to see if the action requires a full update of the liftedState.
|
|
1009
|
+
// If it is a simple action generated by the user's app and the recording
|
|
1010
|
+
// is not locked/paused, only send the action and the current state (fast).
|
|
1011
|
+
//
|
|
1012
|
+
// A full liftedState update (slow: serializes the entire liftedState) is
|
|
1013
|
+
// only required when:
|
|
1014
|
+
// a) redux-devtools-extension fires the @@Init action (ignored by
|
|
1015
|
+
// @ngrx/store-devtools)
|
|
1016
|
+
// b) an action is generated by an @ngrx module (e.g. @ngrx/effects/init
|
|
1017
|
+
// or @ngrx/store/update-reducers)
|
|
1018
|
+
// c) the state has been recomputed due to time-traveling
|
|
1019
|
+
// d) any action that is not a PerformAction to err on the side of
|
|
1020
|
+
// caution.
|
|
1021
|
+
if (action.type === PERFORM_ACTION) {
|
|
1022
|
+
if (state.isLocked || state.isPaused) {
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
var currentState = unliftState(state);
|
|
1026
|
+
if (shouldFilterActions(this.config) &&
|
|
1027
|
+
isActionFiltered(currentState, action, this.config.predicate, this.config.actionsSafelist, this.config.actionsBlocklist)) {
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
var sanitizedState_1 = this.config.stateSanitizer
|
|
1031
|
+
? sanitizeState(this.config.stateSanitizer, currentState, state.currentStateIndex)
|
|
1032
|
+
: currentState;
|
|
1033
|
+
var sanitizedAction_1 = this.config.actionSanitizer
|
|
1034
|
+
? sanitizeAction(this.config.actionSanitizer, action, state.nextActionId)
|
|
1035
|
+
: action;
|
|
1036
|
+
this.sendToReduxDevtools(function () { return _this.extensionConnection.send(sanitizedAction_1, sanitizedState_1); });
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
// Requires full state update
|
|
1040
|
+
var sanitizedLiftedState_1 = Object.assign(Object.assign({}, state), { stagedActionIds: state.stagedActionIds, actionsById: this.config.actionSanitizer
|
|
1041
|
+
? sanitizeActions(this.config.actionSanitizer, state.actionsById)
|
|
1042
|
+
: state.actionsById, computedStates: this.config.stateSanitizer
|
|
1043
|
+
? sanitizeStates(this.config.stateSanitizer, state.computedStates)
|
|
1044
|
+
: state.computedStates });
|
|
1045
|
+
this.sendToReduxDevtools(function () { return _this.devtoolsExtension.send(null, sanitizedLiftedState_1, _this.getExtensionConfig(_this.config)); });
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
DevtoolsExtension.prototype.createChangesObservable = function () {
|
|
1049
|
+
var _this = this;
|
|
1050
|
+
if (!this.devtoolsExtension) {
|
|
1051
|
+
return rxjs.EMPTY;
|
|
1052
|
+
}
|
|
1053
|
+
return new rxjs.Observable(function (subscriber) {
|
|
1054
|
+
var connection = _this.devtoolsExtension.connect(_this.getExtensionConfig(_this.config));
|
|
1055
|
+
_this.extensionConnection = connection;
|
|
1056
|
+
connection.init();
|
|
1057
|
+
connection.subscribe(function (change) { return subscriber.next(change); });
|
|
1058
|
+
return connection.unsubscribe;
|
|
1059
|
+
});
|
|
1060
|
+
};
|
|
1061
|
+
DevtoolsExtension.prototype.createActionStreams = function () {
|
|
1062
|
+
var _this = this;
|
|
1063
|
+
// Listens to all changes
|
|
1064
|
+
var changes$ = this.createChangesObservable().pipe(operators.share());
|
|
1065
|
+
// Listen for the start action
|
|
1066
|
+
var start$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.START; }));
|
|
1067
|
+
// Listen for the stop action
|
|
1068
|
+
var stop$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.STOP; }));
|
|
1069
|
+
// Listen for lifted actions
|
|
1070
|
+
var liftedActions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.DISPATCH; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }), operators.concatMap(function (action) {
|
|
1071
|
+
if (action.type === IMPORT_STATE) {
|
|
1072
|
+
// State imports may happen in two situations:
|
|
1073
|
+
// 1. Explicitly by user
|
|
1074
|
+
// 2. User activated the "persist state accross reloads" option
|
|
1075
|
+
// and now the state is imported during reload.
|
|
1076
|
+
// Because of option 2, we need to give possible
|
|
1077
|
+
// lazy loaded reducers time to instantiate.
|
|
1078
|
+
// As soon as there is no UPDATE action within 1 second,
|
|
1079
|
+
// it is assumed that all reducers are loaded.
|
|
1080
|
+
return _this.dispatcher.pipe(operators.filter(function (action) { return action.type === i2.UPDATE; }), operators.timeout(1000), operators.debounceTime(1000), operators.map(function () { return action; }), operators.catchError(function () { return rxjs.of(action); }), operators.take(1));
|
|
1081
|
+
}
|
|
1082
|
+
else {
|
|
1083
|
+
return rxjs.of(action);
|
|
1084
|
+
}
|
|
1085
|
+
}));
|
|
1086
|
+
// Listen for unlifted actions
|
|
1087
|
+
var actions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.ACTION; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
1088
|
+
var actionsUntilStop$ = actions$.pipe(operators.takeUntil(stop$));
|
|
1089
|
+
var liftedUntilStop$ = liftedActions$.pipe(operators.takeUntil(stop$));
|
|
1090
|
+
this.start$ = start$.pipe(operators.takeUntil(stop$));
|
|
1091
|
+
// Only take the action sources between the start/stop events
|
|
1092
|
+
this.actions$ = this.start$.pipe(operators.switchMap(function () { return actionsUntilStop$; }));
|
|
1093
|
+
this.liftedActions$ = this.start$.pipe(operators.switchMap(function () { return liftedUntilStop$; }));
|
|
1094
|
+
};
|
|
1095
|
+
DevtoolsExtension.prototype.unwrapAction = function (action) {
|
|
1096
|
+
return typeof action === 'string' ? eval("(" + action + ")") : action;
|
|
1097
|
+
};
|
|
1098
|
+
DevtoolsExtension.prototype.getExtensionConfig = function (config) {
|
|
1099
|
+
var _a;
|
|
1100
|
+
var extensionOptions = {
|
|
1101
|
+
name: config.name,
|
|
1102
|
+
features: config.features,
|
|
1103
|
+
serialize: config.serialize,
|
|
1104
|
+
autoPause: (_a = config.autoPause) !== null && _a !== void 0 ? _a : false,
|
|
1105
|
+
// The action/state sanitizers are not added to the config
|
|
1106
|
+
// because sanitation is done in this class already.
|
|
1107
|
+
// It is done before sending it to the devtools extension for consistency:
|
|
1108
|
+
// - If we call extensionConnection.send(...),
|
|
1109
|
+
// the extension would call the sanitizers.
|
|
1110
|
+
// - If we call devtoolsExtension.send(...) (aka full state update),
|
|
1111
|
+
// the extension would NOT call the sanitizers, so we have to do it ourselves.
|
|
1112
|
+
};
|
|
1113
|
+
if (config.maxAge !== false /* support === 0 */) {
|
|
1114
|
+
extensionOptions.maxAge = config.maxAge;
|
|
1115
|
+
}
|
|
1116
|
+
return extensionOptions;
|
|
1117
|
+
};
|
|
1118
|
+
DevtoolsExtension.prototype.sendToReduxDevtools = function (send) {
|
|
1119
|
+
try {
|
|
1120
|
+
send();
|
|
1121
|
+
}
|
|
1122
|
+
catch (err) {
|
|
1123
|
+
console.warn('@ngrx/store-devtools: something went wrong inside the redux devtools', err);
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
return DevtoolsExtension;
|
|
1127
|
+
}());
|
|
1128
|
+
/** @nocollapse */ DevtoolsExtension.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsExtension, deps: [{ token: REDUX_DEVTOOLS_EXTENSION }, { token: STORE_DEVTOOLS_CONFIG }, { token: DevtoolsDispatcher }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1129
|
+
/** @nocollapse */ DevtoolsExtension.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsExtension });
|
|
1130
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: DevtoolsExtension, decorators: [{
|
|
1131
|
+
type: i0.Injectable
|
|
1132
|
+
}], ctorParameters: function () {
|
|
1133
|
+
return [{ type: undefined, decorators: [{
|
|
1134
|
+
type: i0.Inject,
|
|
1135
|
+
args: [REDUX_DEVTOOLS_EXTENSION]
|
|
1136
|
+
}] }, { type: StoreDevtoolsConfig, decorators: [{
|
|
1137
|
+
type: i0.Inject,
|
|
1138
|
+
args: [STORE_DEVTOOLS_CONFIG]
|
|
1139
|
+
}] }, { type: DevtoolsDispatcher }];
|
|
1140
|
+
} });
|
|
1141
|
+
|
|
1104
1142
|
var StoreDevtools = /** @class */ (function () {
|
|
1105
1143
|
function StoreDevtools(dispatcher, actions$, reducers$, extension, scannedActions, errorHandler, initialState, config) {
|
|
1106
1144
|
var _this = this;
|
|
@@ -1188,22 +1226,21 @@
|
|
|
1188
1226
|
};
|
|
1189
1227
|
return StoreDevtools;
|
|
1190
1228
|
}());
|
|
1191
|
-
StoreDevtools
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
]; };
|
|
1229
|
+
/** @nocollapse */ StoreDevtools.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtools, deps: [{ token: DevtoolsDispatcher }, { token: i2__namespace.ActionsSubject }, { token: i2__namespace.ReducerObservable }, { token: DevtoolsExtension }, { token: i2__namespace.ScannedActionsSubject }, { token: i0__namespace.ErrorHandler }, { token: i2.INITIAL_STATE }, { token: STORE_DEVTOOLS_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1230
|
+
/** @nocollapse */ StoreDevtools.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtools });
|
|
1231
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtools, decorators: [{
|
|
1232
|
+
type: i0.Injectable
|
|
1233
|
+
}], ctorParameters: function () {
|
|
1234
|
+
return [{ type: DevtoolsDispatcher }, { type: i2__namespace.ActionsSubject }, { type: i2__namespace.ReducerObservable }, { type: DevtoolsExtension }, { type: i2__namespace.ScannedActionsSubject }, { type: i0__namespace.ErrorHandler }, { type: undefined, decorators: [{
|
|
1235
|
+
type: i0.Inject,
|
|
1236
|
+
args: [i2.INITIAL_STATE]
|
|
1237
|
+
}] }, { type: StoreDevtoolsConfig, decorators: [{
|
|
1238
|
+
type: i0.Inject,
|
|
1239
|
+
args: [STORE_DEVTOOLS_CONFIG]
|
|
1240
|
+
}] }];
|
|
1241
|
+
} });
|
|
1205
1242
|
|
|
1206
|
-
var IS_EXTENSION_OR_MONITOR_PRESENT = new
|
|
1243
|
+
var IS_EXTENSION_OR_MONITOR_PRESENT = new i0.InjectionToken('@ngrx/store-devtools Is Devtools Extension or Monitor Present');
|
|
1207
1244
|
function createIsExtensionOrMonitorPresent(extension, config) {
|
|
1208
1245
|
return Boolean(extension) || config.monitor !== noMonitor;
|
|
1209
1246
|
}
|
|
@@ -1250,12 +1287,12 @@
|
|
|
1250
1287
|
useFactory: createConfig,
|
|
1251
1288
|
},
|
|
1252
1289
|
{
|
|
1253
|
-
provide:
|
|
1290
|
+
provide: i2.StateObservable,
|
|
1254
1291
|
deps: [StoreDevtools],
|
|
1255
1292
|
useFactory: createStateObservable,
|
|
1256
1293
|
},
|
|
1257
1294
|
{
|
|
1258
|
-
provide:
|
|
1295
|
+
provide: i2.ReducerManagerDispatcher,
|
|
1259
1296
|
useExisting: DevtoolsDispatcher,
|
|
1260
1297
|
},
|
|
1261
1298
|
],
|
|
@@ -1263,9 +1300,13 @@
|
|
|
1263
1300
|
};
|
|
1264
1301
|
return StoreDevtoolsModule;
|
|
1265
1302
|
}());
|
|
1266
|
-
StoreDevtoolsModule
|
|
1267
|
-
|
|
1268
|
-
|
|
1303
|
+
/** @nocollapse */ StoreDevtoolsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtoolsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1304
|
+
/** @nocollapse */ StoreDevtoolsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtoolsModule });
|
|
1305
|
+
/** @nocollapse */ StoreDevtoolsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtoolsModule });
|
|
1306
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: StoreDevtoolsModule, decorators: [{
|
|
1307
|
+
type: i0.NgModule,
|
|
1308
|
+
args: [{}]
|
|
1309
|
+
}] });
|
|
1269
1310
|
|
|
1270
1311
|
/**
|
|
1271
1312
|
* DO NOT EDIT
|
|
@@ -1282,16 +1323,6 @@
|
|
|
1282
1323
|
exports.StoreDevtools = StoreDevtools;
|
|
1283
1324
|
exports.StoreDevtoolsConfig = StoreDevtoolsConfig;
|
|
1284
1325
|
exports.StoreDevtoolsModule = StoreDevtoolsModule;
|
|
1285
|
-
exports.ɵa = IS_EXTENSION_OR_MONITOR_PRESENT;
|
|
1286
|
-
exports.ɵb = createIsExtensionOrMonitorPresent;
|
|
1287
|
-
exports.ɵc = createReduxDevtoolsExtension;
|
|
1288
|
-
exports.ɵd = createStateObservable;
|
|
1289
|
-
exports.ɵe = STORE_DEVTOOLS_CONFIG;
|
|
1290
|
-
exports.ɵf = noMonitor;
|
|
1291
|
-
exports.ɵg = createConfig;
|
|
1292
|
-
exports.ɵh = REDUX_DEVTOOLS_EXTENSION;
|
|
1293
|
-
exports.ɵi = DevtoolsExtension;
|
|
1294
|
-
exports.ɵj = DevtoolsDispatcher;
|
|
1295
1326
|
|
|
1296
1327
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1297
1328
|
|