@ngrx/store-devtools 12.5.1 → 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 +228 -216
- package/bundles/ngrx-store-devtools.umd.js.map +1 -1
- package/esm2015/ngrx-store-devtools.js +1 -5
- package/esm2015/src/devtools-dispatcher.js +7 -5
- package/esm2015/src/devtools.js +20 -27
- package/esm2015/src/extension.js +16 -19
- package/esm2015/src/instrument.js +9 -5
- package/fesm2015/ngrx-store-devtools.js +178 -187
- 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/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- 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,7 +2,30 @@
|
|
|
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
|
|
@@ -19,11 +42,11 @@
|
|
|
19
42
|
}
|
|
20
43
|
return StoreDevtoolsConfig;
|
|
21
44
|
}());
|
|
22
|
-
var STORE_DEVTOOLS_CONFIG = new
|
|
45
|
+
var STORE_DEVTOOLS_CONFIG = new i0.InjectionToken('@ngrx/store-devtools Options');
|
|
23
46
|
/**
|
|
24
47
|
* Used to provide a `StoreDevtoolsConfig` for the store-devtools.
|
|
25
48
|
*/
|
|
26
|
-
var INITIAL_OPTIONS = new
|
|
49
|
+
var INITIAL_OPTIONS = new i0.InjectionToken('@ngrx/store-devtools Initial Config');
|
|
27
50
|
function noMonitor() {
|
|
28
51
|
return null;
|
|
29
52
|
}
|
|
@@ -291,10 +314,16 @@
|
|
|
291
314
|
r[k] = a[j];
|
|
292
315
|
return r;
|
|
293
316
|
}
|
|
294
|
-
function __spreadArray(to, from) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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));
|
|
298
327
|
}
|
|
299
328
|
function __await(v) {
|
|
300
329
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -488,18 +517,6 @@
|
|
|
488
517
|
return PauseRecording;
|
|
489
518
|
}());
|
|
490
519
|
|
|
491
|
-
var DevtoolsDispatcher = /** @class */ (function (_super) {
|
|
492
|
-
__extends(DevtoolsDispatcher, _super);
|
|
493
|
-
function DevtoolsDispatcher() {
|
|
494
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
495
|
-
}
|
|
496
|
-
return DevtoolsDispatcher;
|
|
497
|
-
}(store.ActionsSubject));
|
|
498
|
-
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
499
|
-
DevtoolsDispatcher.decorators = [
|
|
500
|
-
{ type: core.Injectable }
|
|
501
|
-
];
|
|
502
|
-
|
|
503
520
|
function difference(first, second) {
|
|
504
521
|
return first.filter(function (item) { return second.indexOf(item) < 0; });
|
|
505
522
|
}
|
|
@@ -605,163 +622,7 @@
|
|
|
605
622
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
606
623
|
}
|
|
607
624
|
|
|
608
|
-
var
|
|
609
|
-
START: 'START',
|
|
610
|
-
DISPATCH: 'DISPATCH',
|
|
611
|
-
STOP: 'STOP',
|
|
612
|
-
ACTION: 'ACTION',
|
|
613
|
-
};
|
|
614
|
-
var REDUX_DEVTOOLS_EXTENSION = new core.InjectionToken('@ngrx/store-devtools Redux Devtools Extension');
|
|
615
|
-
var DevtoolsExtension = /** @class */ (function () {
|
|
616
|
-
function DevtoolsExtension(devtoolsExtension, config, dispatcher) {
|
|
617
|
-
this.config = config;
|
|
618
|
-
this.dispatcher = dispatcher;
|
|
619
|
-
this.devtoolsExtension = devtoolsExtension;
|
|
620
|
-
this.createActionStreams();
|
|
621
|
-
}
|
|
622
|
-
DevtoolsExtension.prototype.notify = function (action, state) {
|
|
623
|
-
var _this = this;
|
|
624
|
-
if (!this.devtoolsExtension) {
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
// Check to see if the action requires a full update of the liftedState.
|
|
628
|
-
// If it is a simple action generated by the user's app and the recording
|
|
629
|
-
// is not locked/paused, only send the action and the current state (fast).
|
|
630
|
-
//
|
|
631
|
-
// A full liftedState update (slow: serializes the entire liftedState) is
|
|
632
|
-
// only required when:
|
|
633
|
-
// a) redux-devtools-extension fires the @@Init action (ignored by
|
|
634
|
-
// @ngrx/store-devtools)
|
|
635
|
-
// b) an action is generated by an @ngrx module (e.g. @ngrx/effects/init
|
|
636
|
-
// or @ngrx/store/update-reducers)
|
|
637
|
-
// c) the state has been recomputed due to time-traveling
|
|
638
|
-
// d) any action that is not a PerformAction to err on the side of
|
|
639
|
-
// caution.
|
|
640
|
-
if (action.type === PERFORM_ACTION) {
|
|
641
|
-
if (state.isLocked || state.isPaused) {
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
var currentState = unliftState(state);
|
|
645
|
-
if (shouldFilterActions(this.config) &&
|
|
646
|
-
isActionFiltered(currentState, action, this.config.predicate, this.config.actionsSafelist, this.config.actionsBlocklist)) {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
var sanitizedState_1 = this.config.stateSanitizer
|
|
650
|
-
? sanitizeState(this.config.stateSanitizer, currentState, state.currentStateIndex)
|
|
651
|
-
: currentState;
|
|
652
|
-
var sanitizedAction_1 = this.config.actionSanitizer
|
|
653
|
-
? sanitizeAction(this.config.actionSanitizer, action, state.nextActionId)
|
|
654
|
-
: action;
|
|
655
|
-
this.sendToReduxDevtools(function () { return _this.extensionConnection.send(sanitizedAction_1, sanitizedState_1); });
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
// Requires full state update
|
|
659
|
-
var sanitizedLiftedState_1 = Object.assign(Object.assign({}, state), { stagedActionIds: state.stagedActionIds, actionsById: this.config.actionSanitizer
|
|
660
|
-
? sanitizeActions(this.config.actionSanitizer, state.actionsById)
|
|
661
|
-
: state.actionsById, computedStates: this.config.stateSanitizer
|
|
662
|
-
? sanitizeStates(this.config.stateSanitizer, state.computedStates)
|
|
663
|
-
: state.computedStates });
|
|
664
|
-
this.sendToReduxDevtools(function () { return _this.devtoolsExtension.send(null, sanitizedLiftedState_1, _this.getExtensionConfig(_this.config)); });
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
DevtoolsExtension.prototype.createChangesObservable = function () {
|
|
668
|
-
var _this = this;
|
|
669
|
-
if (!this.devtoolsExtension) {
|
|
670
|
-
return rxjs.EMPTY;
|
|
671
|
-
}
|
|
672
|
-
return new rxjs.Observable(function (subscriber) {
|
|
673
|
-
var connection = _this.devtoolsExtension.connect(_this.getExtensionConfig(_this.config));
|
|
674
|
-
_this.extensionConnection = connection;
|
|
675
|
-
connection.init();
|
|
676
|
-
connection.subscribe(function (change) { return subscriber.next(change); });
|
|
677
|
-
return connection.unsubscribe;
|
|
678
|
-
});
|
|
679
|
-
};
|
|
680
|
-
DevtoolsExtension.prototype.createActionStreams = function () {
|
|
681
|
-
var _this = this;
|
|
682
|
-
// Listens to all changes
|
|
683
|
-
var changes$ = this.createChangesObservable().pipe(operators.share());
|
|
684
|
-
// Listen for the start action
|
|
685
|
-
var start$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.START; }));
|
|
686
|
-
// Listen for the stop action
|
|
687
|
-
var stop$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.STOP; }));
|
|
688
|
-
// Listen for lifted actions
|
|
689
|
-
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) {
|
|
690
|
-
if (action.type === IMPORT_STATE) {
|
|
691
|
-
// State imports may happen in two situations:
|
|
692
|
-
// 1. Explicitly by user
|
|
693
|
-
// 2. User activated the "persist state accross reloads" option
|
|
694
|
-
// and now the state is imported during reload.
|
|
695
|
-
// Because of option 2, we need to give possible
|
|
696
|
-
// lazy loaded reducers time to instantiate.
|
|
697
|
-
// As soon as there is no UPDATE action within 1 second,
|
|
698
|
-
// it is assumed that all reducers are loaded.
|
|
699
|
-
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));
|
|
700
|
-
}
|
|
701
|
-
else {
|
|
702
|
-
return rxjs.of(action);
|
|
703
|
-
}
|
|
704
|
-
}));
|
|
705
|
-
// Listen for unlifted actions
|
|
706
|
-
var actions$ = changes$.pipe(operators.filter(function (change) { return change.type === ExtensionActionTypes.ACTION; }), operators.map(function (change) { return _this.unwrapAction(change.payload); }));
|
|
707
|
-
var actionsUntilStop$ = actions$.pipe(operators.takeUntil(stop$));
|
|
708
|
-
var liftedUntilStop$ = liftedActions$.pipe(operators.takeUntil(stop$));
|
|
709
|
-
this.start$ = start$.pipe(operators.takeUntil(stop$));
|
|
710
|
-
// Only take the action sources between the start/stop events
|
|
711
|
-
this.actions$ = this.start$.pipe(operators.switchMap(function () { return actionsUntilStop$; }));
|
|
712
|
-
this.liftedActions$ = this.start$.pipe(operators.switchMap(function () { return liftedUntilStop$; }));
|
|
713
|
-
};
|
|
714
|
-
DevtoolsExtension.prototype.unwrapAction = function (action) {
|
|
715
|
-
return typeof action === 'string' ? eval("(" + action + ")") : action;
|
|
716
|
-
};
|
|
717
|
-
DevtoolsExtension.prototype.getExtensionConfig = function (config) {
|
|
718
|
-
var _a;
|
|
719
|
-
var extensionOptions = {
|
|
720
|
-
name: config.name,
|
|
721
|
-
features: config.features,
|
|
722
|
-
serialize: config.serialize,
|
|
723
|
-
autoPause: (_a = config.autoPause) !== null && _a !== void 0 ? _a : false,
|
|
724
|
-
// The action/state sanitizers are not added to the config
|
|
725
|
-
// because sanitation is done in this class already.
|
|
726
|
-
// It is done before sending it to the devtools extension for consistency:
|
|
727
|
-
// - If we call extensionConnection.send(...),
|
|
728
|
-
// the extension would call the sanitizers.
|
|
729
|
-
// - If we call devtoolsExtension.send(...) (aka full state update),
|
|
730
|
-
// the extension would NOT call the sanitizers, so we have to do it ourselves.
|
|
731
|
-
};
|
|
732
|
-
if (config.maxAge !== false /* support === 0 */) {
|
|
733
|
-
extensionOptions.maxAge = config.maxAge;
|
|
734
|
-
}
|
|
735
|
-
return extensionOptions;
|
|
736
|
-
};
|
|
737
|
-
DevtoolsExtension.prototype.sendToReduxDevtools = function (send) {
|
|
738
|
-
try {
|
|
739
|
-
send();
|
|
740
|
-
}
|
|
741
|
-
catch (err) {
|
|
742
|
-
console.warn('@ngrx/store-devtools: something went wrong inside the redux devtools', err);
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
return DevtoolsExtension;
|
|
746
|
-
}());
|
|
747
|
-
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
748
|
-
DevtoolsExtension.decorators = [
|
|
749
|
-
{ type: core.Injectable }
|
|
750
|
-
];
|
|
751
|
-
/**
|
|
752
|
-
* @type {function(): !Array<(null|{
|
|
753
|
-
* type: ?,
|
|
754
|
-
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
755
|
-
* })>}
|
|
756
|
-
* @nocollapse
|
|
757
|
-
*/
|
|
758
|
-
DevtoolsExtension.ctorParameters = function () { return [
|
|
759
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [REDUX_DEVTOOLS_EXTENSION,] }] },
|
|
760
|
-
{ type: StoreDevtoolsConfig, decorators: [{ type: core.Inject, args: [STORE_DEVTOOLS_CONFIG,] }] },
|
|
761
|
-
{ type: DevtoolsDispatcher }
|
|
762
|
-
]; };
|
|
763
|
-
|
|
764
|
-
var INIT_ACTION = { type: store.INIT };
|
|
625
|
+
var INIT_ACTION = { type: i2.INIT };
|
|
765
626
|
var RECOMPUTE = '@ngrx/store-devtools/recompute';
|
|
766
627
|
var RECOMPUTE_ACTION = { type: RECOMPUTE };
|
|
767
628
|
/**
|
|
@@ -1038,7 +899,7 @@
|
|
|
1038
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);
|
|
1039
900
|
break;
|
|
1040
901
|
}
|
|
1041
|
-
case
|
|
902
|
+
case i2.INIT: {
|
|
1042
903
|
// Always recompute states on hot reload and init.
|
|
1043
904
|
minInvalidatedStateIndex = 0;
|
|
1044
905
|
if (options.maxAge && stagedActionIds.length > options.maxAge) {
|
|
@@ -1050,7 +911,7 @@
|
|
|
1050
911
|
}
|
|
1051
912
|
break;
|
|
1052
913
|
}
|
|
1053
|
-
case
|
|
914
|
+
case i2.UPDATE: {
|
|
1054
915
|
var stateHasErrors = computedStates.filter(function (state) { return state.error; }).length > 0;
|
|
1055
916
|
if (stateHasErrors) {
|
|
1056
917
|
// Recompute all states
|
|
@@ -1112,6 +973,172 @@
|
|
|
1112
973
|
}; };
|
|
1113
974
|
}
|
|
1114
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
|
+
|
|
1115
1142
|
var StoreDevtools = /** @class */ (function () {
|
|
1116
1143
|
function StoreDevtools(dispatcher, actions$, reducers$, extension, scannedActions, errorHandler, initialState, config) {
|
|
1117
1144
|
var _this = this;
|
|
@@ -1199,29 +1226,21 @@
|
|
|
1199
1226
|
};
|
|
1200
1227
|
return StoreDevtools;
|
|
1201
1228
|
}());
|
|
1202
|
-
/** @type {
|
|
1203
|
-
StoreDevtools
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
{ type: store.ActionsSubject },
|
|
1216
|
-
{ type: store.ReducerObservable },
|
|
1217
|
-
{ type: DevtoolsExtension },
|
|
1218
|
-
{ type: store.ScannedActionsSubject },
|
|
1219
|
-
{ type: core.ErrorHandler },
|
|
1220
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [store.INITIAL_STATE,] }] },
|
|
1221
|
-
{ type: StoreDevtoolsConfig, decorators: [{ type: core.Inject, args: [STORE_DEVTOOLS_CONFIG,] }] }
|
|
1222
|
-
]; };
|
|
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
|
+
} });
|
|
1223
1242
|
|
|
1224
|
-
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');
|
|
1225
1244
|
function createIsExtensionOrMonitorPresent(extension, config) {
|
|
1226
1245
|
return Boolean(extension) || config.monitor !== noMonitor;
|
|
1227
1246
|
}
|
|
@@ -1268,12 +1287,12 @@
|
|
|
1268
1287
|
useFactory: createConfig,
|
|
1269
1288
|
},
|
|
1270
1289
|
{
|
|
1271
|
-
provide:
|
|
1290
|
+
provide: i2.StateObservable,
|
|
1272
1291
|
deps: [StoreDevtools],
|
|
1273
1292
|
useFactory: createStateObservable,
|
|
1274
1293
|
},
|
|
1275
1294
|
{
|
|
1276
|
-
provide:
|
|
1295
|
+
provide: i2.ReducerManagerDispatcher,
|
|
1277
1296
|
useExisting: DevtoolsDispatcher,
|
|
1278
1297
|
},
|
|
1279
1298
|
],
|
|
@@ -1281,10 +1300,13 @@
|
|
|
1281
1300
|
};
|
|
1282
1301
|
return StoreDevtoolsModule;
|
|
1283
1302
|
}());
|
|
1284
|
-
/** @
|
|
1285
|
-
StoreDevtoolsModule
|
|
1286
|
-
|
|
1287
|
-
|
|
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
|
+
}] });
|
|
1288
1310
|
|
|
1289
1311
|
/**
|
|
1290
1312
|
* DO NOT EDIT
|
|
@@ -1301,16 +1323,6 @@
|
|
|
1301
1323
|
exports.StoreDevtools = StoreDevtools;
|
|
1302
1324
|
exports.StoreDevtoolsConfig = StoreDevtoolsConfig;
|
|
1303
1325
|
exports.StoreDevtoolsModule = StoreDevtoolsModule;
|
|
1304
|
-
exports.ɵa = IS_EXTENSION_OR_MONITOR_PRESENT;
|
|
1305
|
-
exports.ɵb = createIsExtensionOrMonitorPresent;
|
|
1306
|
-
exports.ɵc = createReduxDevtoolsExtension;
|
|
1307
|
-
exports.ɵd = createStateObservable;
|
|
1308
|
-
exports.ɵe = STORE_DEVTOOLS_CONFIG;
|
|
1309
|
-
exports.ɵf = noMonitor;
|
|
1310
|
-
exports.ɵg = createConfig;
|
|
1311
|
-
exports.ɵh = REDUX_DEVTOOLS_EXTENSION;
|
|
1312
|
-
exports.ɵi = DevtoolsExtension;
|
|
1313
|
-
exports.ɵj = DevtoolsDispatcher;
|
|
1314
1326
|
|
|
1315
1327
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1316
1328
|
|