@ngxs/store 3.7.5 → 3.7.6-dev.master-95e4742

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.
Files changed (71) hide show
  1. package/bundles/ngxs-store-operators.umd.js +13 -12
  2. package/bundles/ngxs-store-operators.umd.js.map +1 -1
  3. package/bundles/ngxs-store-operators.umd.min.js +1 -1
  4. package/bundles/ngxs-store-operators.umd.min.js.map +1 -1
  5. package/bundles/ngxs-store.umd.js +611 -485
  6. package/bundles/ngxs-store.umd.js.map +1 -1
  7. package/bundles/ngxs-store.umd.min.js +1 -1
  8. package/bundles/ngxs-store.umd.min.js.map +1 -1
  9. package/esm2015/ngxs-store.js +6 -5
  10. package/esm2015/operators/append.js +3 -3
  11. package/esm2015/operators/compose.js +1 -1
  12. package/esm2015/operators/iif.js +1 -1
  13. package/esm2015/operators/index.js +1 -1
  14. package/esm2015/operators/insert-item.js +3 -3
  15. package/esm2015/operators/patch.js +4 -5
  16. package/esm2015/operators/update-item.js +7 -5
  17. package/esm2015/operators/utils.js +1 -1
  18. package/esm2015/src/actions-stream.js +16 -6
  19. package/esm2015/src/internal/dispatcher.js +14 -36
  20. package/esm2015/src/internal/error-handler.js +118 -0
  21. package/esm2015/src/internal/internals.js +2 -27
  22. package/esm2015/src/internal/lifecycle-state-manager.js +85 -38
  23. package/esm2015/src/internal/state-context-factory.js +1 -12
  24. package/esm2015/src/internal/state-factory.js +4 -4
  25. package/esm2015/src/operators/of-action.js +7 -1
  26. package/esm2015/src/public_api.js +1 -1
  27. package/esm5/ngxs-store.js +6 -5
  28. package/esm5/operators/append.js +3 -3
  29. package/esm5/operators/compose.js +1 -1
  30. package/esm5/operators/iif.js +1 -1
  31. package/esm5/operators/index.js +1 -1
  32. package/esm5/operators/insert-item.js +3 -3
  33. package/esm5/operators/patch.js +4 -5
  34. package/esm5/operators/update-item.js +7 -5
  35. package/esm5/operators/utils.js +1 -1
  36. package/esm5/src/actions-stream.js +22 -7
  37. package/esm5/src/internal/dispatcher.js +13 -37
  38. package/esm5/src/internal/error-handler.js +125 -0
  39. package/esm5/src/internal/internals.js +2 -27
  40. package/esm5/src/internal/lifecycle-state-manager.js +97 -50
  41. package/esm5/src/internal/state-context-factory.js +1 -12
  42. package/esm5/src/internal/state-factory.js +4 -4
  43. package/esm5/src/operators/of-action.js +7 -1
  44. package/esm5/src/public_api.js +1 -1
  45. package/fesm2015/ngxs-store-operators.js +13 -12
  46. package/fesm2015/ngxs-store-operators.js.map +1 -1
  47. package/fesm2015/ngxs-store.js +459 -343
  48. package/fesm2015/ngxs-store.js.map +1 -1
  49. package/fesm5/ngxs-store-operators.js +13 -12
  50. package/fesm5/ngxs-store-operators.js.map +1 -1
  51. package/fesm5/ngxs-store.js +608 -483
  52. package/fesm5/ngxs-store.js.map +1 -1
  53. package/ngxs-store.d.ts +6 -5
  54. package/ngxs-store.metadata.json +1 -1
  55. package/operators/append.d.ts +2 -2
  56. package/operators/compose.d.ts +2 -1
  57. package/operators/iif.d.ts +2 -2
  58. package/operators/index.d.ts +1 -1
  59. package/operators/insert-item.d.ts +2 -2
  60. package/operators/ngxs-store-operators.metadata.json +1 -1
  61. package/operators/patch.d.ts +2 -6
  62. package/operators/update-item.d.ts +2 -2
  63. package/operators/utils.d.ts +2 -1
  64. package/package.json +3 -3
  65. package/src/actions-stream.d.ts +4 -2
  66. package/src/internal/dispatcher.d.ts +3 -4
  67. package/src/internal/error-handler.d.ts +23 -0
  68. package/src/internal/internals.d.ts +1 -6
  69. package/src/internal/lifecycle-state-manager.d.ts +16 -15
  70. package/src/operators/of-action.d.ts +20 -7
  71. package/src/public_api.d.ts +1 -1
@@ -730,156 +730,6 @@
730
730
  NgxsExecutionStrategy.prototype.leave = function (func) { };
731
731
  }
732
732
 
733
- /**
734
- * @fileoverview added by tsickle
735
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
736
- */
737
- /**
738
- * Returns the type from an action instance/class.
739
- * @ignore
740
- * @param {?} action
741
- * @return {?}
742
- */
743
- function getActionTypeFromInstance(action) {
744
- if (action.constructor && action.constructor.type) {
745
- return action.constructor.type;
746
- }
747
- else {
748
- return action.type;
749
- }
750
- }
751
- /**
752
- * Matches a action
753
- * @ignore
754
- * @param {?} action1
755
- * @return {?}
756
- */
757
- function actionMatcher(action1) {
758
- /** @type {?} */
759
- var type1 = getActionTypeFromInstance(action1);
760
- return (/**
761
- * @param {?} action2
762
- * @return {?}
763
- */
764
- function (action2) {
765
- return type1 === getActionTypeFromInstance(action2);
766
- });
767
- }
768
- /**
769
- * Set a deeply nested value. Example:
770
- *
771
- * setValue({ foo: { bar: { eat: false } } },
772
- * 'foo.bar.eat', true) //=> { foo: { bar: { eat: true } } }
773
- *
774
- * While it traverses it also creates new objects from top down.
775
- *
776
- * @ignore
777
- * @type {?}
778
- */
779
- var setValue = (/**
780
- * @param {?} obj
781
- * @param {?} prop
782
- * @param {?} val
783
- * @return {?}
784
- */
785
- function (obj, prop, val) {
786
- obj = __assign({}, obj);
787
- /** @type {?} */
788
- var split = prop.split('.');
789
- /** @type {?} */
790
- var lastIndex = split.length - 1;
791
- split.reduce((/**
792
- * @param {?} acc
793
- * @param {?} part
794
- * @param {?} index
795
- * @return {?}
796
- */
797
- function (acc, part, index) {
798
- if (index === lastIndex) {
799
- acc[part] = val;
800
- }
801
- else {
802
- acc[part] = Array.isArray(acc[part]) ? acc[part].slice() : __assign({}, acc[part]);
803
- }
804
- return acc && acc[part];
805
- }), obj);
806
- return obj;
807
- });
808
- /**
809
- * Get a deeply nested value. Example:
810
- *
811
- * getValue({ foo: bar: [] }, 'foo.bar') //=> []
812
- *
813
- * @ignore
814
- * @type {?}
815
- */
816
- var getValue = (/**
817
- * @param {?} obj
818
- * @param {?} prop
819
- * @return {?}
820
- */
821
- function (obj, prop) {
822
- return prop.split('.').reduce((/**
823
- * @param {?} acc
824
- * @param {?} part
825
- * @return {?}
826
- */
827
- function (acc, part) { return acc && acc[part]; }), obj);
828
- });
829
- /**
830
- * Simple object check.
831
- *
832
- * isObject({a:1}) //=> true
833
- * isObject(1) //=> false
834
- *
835
- * @ignore
836
- * @type {?}
837
- */
838
- var isObject = (/**
839
- * @param {?} item
840
- * @return {?}
841
- */
842
- function (item) {
843
- return item && typeof item === 'object' && !Array.isArray(item);
844
- });
845
- /**
846
- * Deep merge two objects.
847
- *
848
- * mergeDeep({a:1, b:{x: 1, y:2}}, {b:{x: 3}, c:4}) //=> {a:1, b:{x:3, y:2}, c:4}
849
- *
850
- * \@param base base object onto which `sources` will be applied
851
- * @type {?}
852
- */
853
- var mergeDeep = (/**
854
- * @param {?} base
855
- * @param {...?} sources
856
- * @return {?}
857
- */
858
- function (base) {
859
- var sources = [];
860
- for (var _i = 1; _i < arguments.length; _i++) {
861
- sources[_i - 1] = arguments[_i];
862
- }
863
- var _a, _b;
864
- if (!sources.length)
865
- return base;
866
- /** @type {?} */
867
- var source = sources.shift();
868
- if (isObject(base) && isObject(source)) {
869
- for (var key in source) {
870
- if (isObject(source[key])) {
871
- if (!base[key])
872
- Object.assign(base, (_a = {}, _a[key] = {}, _a));
873
- mergeDeep(base[key], source[key]);
874
- }
875
- else {
876
- Object.assign(base, (_b = {}, _b[key] = source[key], _b));
877
- }
878
- }
879
- }
880
- return mergeDeep.apply(void 0, __spread([base], sources));
881
- });
882
-
883
733
  /**
884
734
  * @fileoverview added by tsickle
885
735
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1004,17 +854,6 @@
1004
854
  /** @type {?} */
1005
855
  StatesAndDefaults.prototype.states;
1006
856
  }
1007
- /**
1008
- * @record
1009
- * @template T
1010
- */
1011
- function RootStateDiff() { }
1012
- if (false) {
1013
- /** @type {?} */
1014
- RootStateDiff.prototype.currentAppState;
1015
- /** @type {?} */
1016
- RootStateDiff.prototype.newAppState;
1017
- }
1018
857
  /**
1019
858
  * Ensures metadata is attached to the class and returns it.
1020
859
  *
@@ -1356,22 +1195,159 @@
1356
1195
  * @param {?} obj
1357
1196
  * @return {?}
1358
1197
  */
1359
- function isObject$1(obj) {
1198
+ function isObject(obj) {
1360
1199
  return (typeof obj === 'object' && obj !== null) || typeof obj === 'function';
1361
1200
  }
1201
+
1362
1202
  /**
1363
- * @template T
1364
- * @param {?} mappedStore
1365
- * @param {?} diff
1203
+ * @fileoverview added by tsickle
1204
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1205
+ */
1206
+ /**
1207
+ * Returns the type from an action instance/class.
1208
+ * @ignore
1209
+ * @param {?} action
1366
1210
  * @return {?}
1367
1211
  */
1368
- function getStateDiffChanges(mappedStore, diff) {
1369
- /** @type {?} */
1370
- var previousValue = getValue(diff.currentAppState, mappedStore.path);
1212
+ function getActionTypeFromInstance(action) {
1213
+ if (action.constructor && action.constructor.type) {
1214
+ return action.constructor.type;
1215
+ }
1216
+ else {
1217
+ return action.type;
1218
+ }
1219
+ }
1220
+ /**
1221
+ * Matches a action
1222
+ * @ignore
1223
+ * @param {?} action1
1224
+ * @return {?}
1225
+ */
1226
+ function actionMatcher(action1) {
1371
1227
  /** @type {?} */
1372
- var currentValue = getValue(diff.newAppState, mappedStore.path);
1373
- return new NgxsSimpleChange(previousValue, currentValue, !mappedStore.isInitialised);
1228
+ var type1 = getActionTypeFromInstance(action1);
1229
+ return (/**
1230
+ * @param {?} action2
1231
+ * @return {?}
1232
+ */
1233
+ function (action2) {
1234
+ return type1 === getActionTypeFromInstance(action2);
1235
+ });
1374
1236
  }
1237
+ /**
1238
+ * Set a deeply nested value. Example:
1239
+ *
1240
+ * setValue({ foo: { bar: { eat: false } } },
1241
+ * 'foo.bar.eat', true) //=> { foo: { bar: { eat: true } } }
1242
+ *
1243
+ * While it traverses it also creates new objects from top down.
1244
+ *
1245
+ * @ignore
1246
+ * @type {?}
1247
+ */
1248
+ var setValue = (/**
1249
+ * @param {?} obj
1250
+ * @param {?} prop
1251
+ * @param {?} val
1252
+ * @return {?}
1253
+ */
1254
+ function (obj, prop, val) {
1255
+ obj = __assign({}, obj);
1256
+ /** @type {?} */
1257
+ var split = prop.split('.');
1258
+ /** @type {?} */
1259
+ var lastIndex = split.length - 1;
1260
+ split.reduce((/**
1261
+ * @param {?} acc
1262
+ * @param {?} part
1263
+ * @param {?} index
1264
+ * @return {?}
1265
+ */
1266
+ function (acc, part, index) {
1267
+ if (index === lastIndex) {
1268
+ acc[part] = val;
1269
+ }
1270
+ else {
1271
+ acc[part] = Array.isArray(acc[part]) ? acc[part].slice() : __assign({}, acc[part]);
1272
+ }
1273
+ return acc && acc[part];
1274
+ }), obj);
1275
+ return obj;
1276
+ });
1277
+ /**
1278
+ * Get a deeply nested value. Example:
1279
+ *
1280
+ * getValue({ foo: bar: [] }, 'foo.bar') //=> []
1281
+ *
1282
+ * @ignore
1283
+ * @type {?}
1284
+ */
1285
+ var getValue = (/**
1286
+ * @param {?} obj
1287
+ * @param {?} prop
1288
+ * @return {?}
1289
+ */
1290
+ function (obj, prop) {
1291
+ return prop.split('.').reduce((/**
1292
+ * @param {?} acc
1293
+ * @param {?} part
1294
+ * @return {?}
1295
+ */
1296
+ function (acc, part) { return acc && acc[part]; }), obj);
1297
+ });
1298
+ /**
1299
+ * Simple object check.
1300
+ *
1301
+ * isObject({a:1}) //=> true
1302
+ * isObject(1) //=> false
1303
+ *
1304
+ * @ignore
1305
+ * @type {?}
1306
+ */
1307
+ var isObject$1 = (/**
1308
+ * @param {?} item
1309
+ * @return {?}
1310
+ */
1311
+ function (item) {
1312
+ return item && typeof item === 'object' && !Array.isArray(item);
1313
+ });
1314
+ /**
1315
+ * Deep merge two objects.
1316
+ *
1317
+ * mergeDeep({a:1, b:{x: 1, y:2}}, {b:{x: 3}, c:4}) //=> {a:1, b:{x:3, y:2}, c:4}
1318
+ *
1319
+ * \@param base base object onto which `sources` will be applied
1320
+ * @type {?}
1321
+ */
1322
+ var mergeDeep = (/**
1323
+ * @param {?} base
1324
+ * @param {...?} sources
1325
+ * @return {?}
1326
+ */
1327
+ function (base) {
1328
+ var sources = [];
1329
+ for (var _i = 1; _i < arguments.length; _i++) {
1330
+ sources[_i - 1] = arguments[_i];
1331
+ }
1332
+ var _a, _b;
1333
+ if (!sources.length)
1334
+ return base;
1335
+ /** @type {?} */
1336
+ var source = sources.shift();
1337
+ if (isObject$1(base) && isObject$1(source)) {
1338
+ for (var key in source) {
1339
+ if (isObject$1(source[key])) {
1340
+ if (!base[key])
1341
+ Object.assign(base, (_a = {}, _a[key] = {}, _a));
1342
+ mergeDeep(base[key], source[key]);
1343
+ }
1344
+ else {
1345
+ Object.assign(base, (_b = {}, _b[key] = source[key], _b));
1346
+ }
1347
+ }
1348
+ }
1349
+ return mergeDeep.apply(void 0, __spread([base], sources));
1350
+ });
1375
1351
 
1376
1352
  /**
1377
1353
  * @fileoverview added by tsickle
@@ -1392,6 +1368,7 @@
1392
1368
  * RxJS operator for selecting out specific actions.
1393
1369
  *
1394
1370
  * This will grab actions that have just been dispatched as well as actions that have completed
1371
+ * @template T
1395
1372
  * @param {...?} allowedTypes
1396
1373
  * @return {?}
1397
1374
  */
@@ -1406,6 +1383,7 @@
1406
1383
  * RxJS operator for selecting out specific actions.
1407
1384
  *
1408
1385
  * This will ONLY grab actions that have just been dispatched
1386
+ * @template T
1409
1387
  * @param {...?} allowedTypes
1410
1388
  * @return {?}
1411
1389
  */
@@ -1420,6 +1398,7 @@
1420
1398
  * RxJS operator for selecting out specific actions.
1421
1399
  *
1422
1400
  * This will ONLY grab actions that have just been successfully completed
1401
+ * @template T
1423
1402
  * @param {...?} allowedTypes
1424
1403
  * @return {?}
1425
1404
  */
@@ -1434,6 +1413,7 @@
1434
1413
  * RxJS operator for selecting out specific actions.
1435
1414
  *
1436
1415
  * This will ONLY grab actions that have just been canceled
1416
+ * @template T
1437
1417
  * @param {...?} allowedTypes
1438
1418
  * @return {?}
1439
1419
  */
@@ -1448,6 +1428,7 @@
1448
1428
  * RxJS operator for selecting out specific actions.
1449
1429
  *
1450
1430
  * This will ONLY grab actions that have just been completed
1431
+ * @template T
1451
1432
  * @param {...?} allowedTypes
1452
1433
  * @return {?}
1453
1434
  */
@@ -1468,6 +1449,7 @@
1468
1449
  * RxJS operator for selecting out specific actions.
1469
1450
  *
1470
1451
  * This will ONLY grab actions that have just thrown an error
1452
+ * @template T
1471
1453
  * @param {...?} allowedTypes
1472
1454
  * @return {?}
1473
1455
  */
@@ -1804,6 +1786,15 @@
1804
1786
  function InternalActions() {
1805
1787
  return _super !== null && _super.apply(this, arguments) || this;
1806
1788
  }
1789
+ /**
1790
+ * @return {?}
1791
+ */
1792
+ InternalActions.prototype.ngOnDestroy = /**
1793
+ * @return {?}
1794
+ */
1795
+ function () {
1796
+ this.complete();
1797
+ };
1807
1798
  InternalActions.decorators = [
1808
1799
  { type: core.Injectable }
1809
1800
  ];
@@ -1816,18 +1807,22 @@
1816
1807
  */
1817
1808
  var Actions = /** @class */ (function (_super) {
1818
1809
  __extends(Actions, _super);
1819
- // This has to be `Observable<ActionContext>` in the v4. Because `InternalActions`
1820
- // is a `Subject<ActionContext>`. Leave it as `any` to avoid breaking changes
1821
1810
  function Actions(internalActions$, internalExecutionStrategy) {
1822
- return _super.call(this, (/**
1811
+ var _this = this;
1812
+ /** @type {?} */
1813
+ var sharedInternalActions$ = internalActions$.pipe(leaveNgxs(internalExecutionStrategy),
1814
+ // The `InternalActions` subject emits outside of the Angular zone.
1815
+ // We have to re-enter the Angular zone for any incoming consumer.
1816
+ // The `share()` operator reduces the number of change detections.
1817
+ // This would call leave only once for any stream emission across all active subscribers.
1818
+ operators.share());
1819
+ _this = _super.call(this, (/**
1823
1820
  * @param {?} observer
1824
1821
  * @return {?}
1825
1822
  */
1826
1823
  function (observer) {
1827
1824
  /** @type {?} */
1828
- var childSubscription = internalActions$
1829
- .pipe(leaveNgxs(internalExecutionStrategy))
1830
- .subscribe({
1825
+ var childSubscription = sharedInternalActions$.subscribe({
1831
1826
  next: (/**
1832
1827
  * @param {?} ctx
1833
1828
  * @return {?}
@@ -1845,6 +1840,7 @@
1845
1840
  });
1846
1841
  observer.add(childSubscription);
1847
1842
  })) || this;
1843
+ return _this;
1848
1844
  }
1849
1845
  Actions.decorators = [
1850
1846
  { type: core.Injectable }
@@ -1911,6 +1907,126 @@
1911
1907
  })]));
1912
1908
  }); });
1913
1909
 
1910
+ /**
1911
+ * @fileoverview added by tsickle
1912
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1913
+ */
1914
+ /**
1915
+ * This operator is used for piping the observable result
1916
+ * from the `dispatch()`. It has a "smart" error handling
1917
+ * strategy that allows us to decide whether we propagate
1918
+ * errors to Angular's `ErrorHandler` or enable users to
1919
+ * handle them manually. We consider following cases:
1920
+ * 1) `store.dispatch()` (no subscribe) -> call `handleError()`
1921
+ * 2) `store.dispatch().subscribe()` (no error callback) -> call `handleError()`
1922
+ * 3) `store.dispatch().subscribe({ error: ... })` -> don't call `handleError()`
1923
+ * 4) `toPromise()` without `catch` -> do `handleError()`
1924
+ * 5) `toPromise()` with `catch` -> don't `handleError()`
1925
+ * @template T
1926
+ * @param {?} internalErrorReporter
1927
+ * @param {?} ngxsExecutionStrategy
1928
+ * @return {?}
1929
+ */
1930
+ function ngxsErrorHandler(internalErrorReporter, ngxsExecutionStrategy) {
1931
+ return (/**
1932
+ * @param {?} source
1933
+ * @return {?}
1934
+ */
1935
+ function (source) {
1936
+ /** @type {?} */
1937
+ var subscribed = false;
1938
+ source.subscribe({
1939
+ error: (/**
1940
+ * @param {?} error
1941
+ * @return {?}
1942
+ */
1943
+ function (error) {
1944
+ // Do not trigger change detection for a microtask. This depends on the execution
1945
+ // strategy being used, but the default `DispatchOutsideZoneNgxsExecutionStrategy`
1946
+ // leaves the Angular zone.
1947
+ ngxsExecutionStrategy.enter((/**
1948
+ * @return {?}
1949
+ */
1950
+ function () {
1951
+ return Promise.resolve().then((/**
1952
+ * @return {?}
1953
+ */
1954
+ function () {
1955
+ if (!subscribed) {
1956
+ ngxsExecutionStrategy.leave((/**
1957
+ * @return {?}
1958
+ */
1959
+ function () {
1960
+ return internalErrorReporter.reportErrorSafely(error);
1961
+ }));
1962
+ }
1963
+ }));
1964
+ }));
1965
+ })
1966
+ });
1967
+ return new rxjs.Observable((/**
1968
+ * @param {?} subscriber
1969
+ * @return {?}
1970
+ */
1971
+ function (subscriber) {
1972
+ subscribed = true;
1973
+ return source.pipe(leaveNgxs(ngxsExecutionStrategy)).subscribe(subscriber);
1974
+ }));
1975
+ });
1976
+ }
1977
+ var InternalErrorReporter = /** @class */ (function () {
1978
+ function InternalErrorReporter(_injector) {
1979
+ this._injector = _injector;
1980
+ /**
1981
+ * Will be set lazily to be backward compatible.
1982
+ */
1983
+ this._errorHandler = (/** @type {?} */ (null));
1984
+ }
1985
+ /**
1986
+ * @param {?} error
1987
+ * @return {?}
1988
+ */
1989
+ InternalErrorReporter.prototype.reportErrorSafely = /**
1990
+ * @param {?} error
1991
+ * @return {?}
1992
+ */
1993
+ function (error) {
1994
+ if (this._errorHandler === null) {
1995
+ this._errorHandler = this._injector.get(core.ErrorHandler);
1996
+ }
1997
+ // The `try-catch` is used to avoid handling the error twice. Suppose we call
1998
+ // `handleError` which re-throws the error internally. The re-thrown error will
1999
+ // be caught by zone.js which will then get to the `zone.onError.emit()` and the
2000
+ // `onError` subscriber will call `handleError` again.
2001
+ try {
2002
+ this._errorHandler.handleError(error);
2003
+ }
2004
+ catch (_a) { }
2005
+ };
2006
+ InternalErrorReporter.decorators = [
2007
+ { type: core.Injectable, args: [{ providedIn: 'root' },] }
2008
+ ];
2009
+ /** @nocollapse */
2010
+ InternalErrorReporter.ctorParameters = function () { return [
2011
+ { type: core.Injector }
2012
+ ]; };
2013
+ /** @nocollapse */ InternalErrorReporter.ngInjectableDef = core.defineInjectable({ factory: function InternalErrorReporter_Factory() { return new InternalErrorReporter(core.inject(core.INJECTOR)); }, token: InternalErrorReporter, providedIn: "root" });
2014
+ return InternalErrorReporter;
2015
+ }());
2016
+ if (false) {
2017
+ /**
2018
+ * Will be set lazily to be backward compatible.
2019
+ * @type {?}
2020
+ * @private
2021
+ */
2022
+ InternalErrorReporter.prototype._errorHandler;
2023
+ /**
2024
+ * @type {?}
2025
+ * @private
2026
+ */
2027
+ InternalErrorReporter.prototype._injector;
2028
+ }
2029
+
1914
2030
  /**
1915
2031
  * @fileoverview added by tsickle
1916
2032
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -2043,13 +2159,13 @@
2043
2159
  return InternalDispatchedActionResults;
2044
2160
  }(rxjs.Subject));
2045
2161
  var InternalDispatcher = /** @class */ (function () {
2046
- function InternalDispatcher(_injector, _actions, _actionResults, _pluginManager, _stateStream, _ngxsExecutionStrategy) {
2047
- this._injector = _injector;
2162
+ function InternalDispatcher(_actions, _actionResults, _pluginManager, _stateStream, _ngxsExecutionStrategy, _internalErrorReporter) {
2048
2163
  this._actions = _actions;
2049
2164
  this._actionResults = _actionResults;
2050
2165
  this._pluginManager = _pluginManager;
2051
2166
  this._stateStream = _stateStream;
2052
2167
  this._ngxsExecutionStrategy = _ngxsExecutionStrategy;
2168
+ this._internalErrorReporter = _internalErrorReporter;
2053
2169
  }
2054
2170
  /**
2055
2171
  * Dispatches event(s).
@@ -2073,26 +2189,7 @@
2073
2189
  function () {
2074
2190
  return _this.dispatchByEvents(actionOrActions);
2075
2191
  }));
2076
- result.subscribe({
2077
- error: (/**
2078
- * @param {?} error
2079
- * @return {?}
2080
- */
2081
- function (error) {
2082
- return _this._ngxsExecutionStrategy.leave((/**
2083
- * @return {?}
2084
- */
2085
- function () {
2086
- try {
2087
- // Retrieve lazily to avoid cyclic dependency exception
2088
- _this._errorHandler = _this._errorHandler || _this._injector.get(core.ErrorHandler);
2089
- _this._errorHandler.handleError(error);
2090
- }
2091
- catch (_a) { }
2092
- }));
2093
- })
2094
- });
2095
- return result.pipe(leaveNgxs(this._ngxsExecutionStrategy));
2192
+ return result.pipe(ngxsErrorHandler(this._internalErrorReporter, this._ngxsExecutionStrategy));
2096
2193
  };
2097
2194
  /**
2098
2195
  * @private
@@ -2217,26 +2314,16 @@
2217
2314
  ];
2218
2315
  /** @nocollapse */
2219
2316
  InternalDispatcher.ctorParameters = function () { return [
2220
- { type: core.Injector },
2221
2317
  { type: InternalActions },
2222
2318
  { type: InternalDispatchedActionResults },
2223
2319
  { type: PluginManager },
2224
2320
  { type: StateStream },
2225
- { type: InternalNgxsExecutionStrategy }
2321
+ { type: InternalNgxsExecutionStrategy },
2322
+ { type: InternalErrorReporter }
2226
2323
  ]; };
2227
2324
  return InternalDispatcher;
2228
2325
  }());
2229
2326
  if (false) {
2230
- /**
2231
- * @type {?}
2232
- * @private
2233
- */
2234
- InternalDispatcher.prototype._errorHandler;
2235
- /**
2236
- * @type {?}
2237
- * @private
2238
- */
2239
- InternalDispatcher.prototype._injector;
2240
2327
  /**
2241
2328
  * @type {?}
2242
2329
  * @private
@@ -2262,6 +2349,11 @@
2262
2349
  * @private
2263
2350
  */
2264
2351
  InternalDispatcher.prototype._ngxsExecutionStrategy;
2352
+ /**
2353
+ * @type {?}
2354
+ * @private
2355
+ */
2356
+ InternalDispatcher.prototype._internalErrorReporter;
2265
2357
  }
2266
2358
 
2267
2359
  /**
@@ -2503,16 +2595,6 @@
2503
2595
  function setStateValue(currentAppState, newValue) {
2504
2596
  /** @type {?} */
2505
2597
  var newAppState = setValue(currentAppState, mappedStore.path, newValue);
2506
- /** @type {?} */
2507
- var instance = mappedStore.instance;
2508
- if (instance.ngxsOnChanges) {
2509
- /** @type {?} */
2510
- var change = getStateDiffChanges(mappedStore, {
2511
- currentAppState: currentAppState,
2512
- newAppState: newAppState
2513
- });
2514
- instance.ngxsOnChanges(change);
2515
- }
2516
2598
  root.setState(newAppState);
2517
2599
  return newAppState;
2518
2600
  // In doing this refactoring I noticed that there is a 'bug' where the
@@ -2826,7 +2908,7 @@
2826
2908
  if (Array.isArray(defaults)) {
2827
2909
  value = defaults.slice();
2828
2910
  }
2829
- else if (isObject$1(defaults)) {
2911
+ else if (isObject(defaults)) {
2830
2912
  value = __assign({}, defaults);
2831
2913
  }
2832
2914
  else if (defaults === undefined) {
@@ -3041,7 +3123,7 @@
3041
3123
  if (result instanceof Promise) {
3042
3124
  result = rxjs.from(result);
3043
3125
  }
3044
- if (result instanceof rxjs.Observable) {
3126
+ if (rxjs.isObservable(result)) {
3045
3127
  // If this observable has been completed w/o emitting
3046
3128
  // any value then we wouldn't want to complete the whole chain
3047
3129
  // of actions. Since if any observable completes then
@@ -3058,7 +3140,7 @@
3058
3140
  if (value instanceof Promise) {
3059
3141
  return rxjs.from(value);
3060
3142
  }
3061
- if (value instanceof rxjs.Observable) {
3143
+ if (rxjs.isObservable(value)) {
3062
3144
  return value;
3063
3145
  }
3064
3146
  return rxjs.of(value);
@@ -3151,289 +3233,120 @@
3151
3233
  */
3152
3234
  StateFactory.prototype.addRuntimeInfoToMeta = /**
3153
3235
  * @private
3154
- * @param {?} meta
3155
- * @param {?} path
3156
- * @return {?}
3157
- */
3158
- function (meta, path) {
3159
- this.statePaths[(/** @type {?} */ (meta.name))] = path;
3160
- // TODO: v4 - we plan to get rid of the path property because it is non-deterministic
3161
- // we can do this when we get rid of the incorrectly exposed getStoreMetadata
3162
- // We will need to come up with an alternative in v4 because this is used by many plugins
3163
- meta.path = path;
3164
- };
3165
- /**
3166
- * @description
3167
- * the method checks if the state has already been added to the tree
3168
- * and completed the life cycle
3169
- * @param name
3170
- * @param path
3171
- */
3172
- /**
3173
- * \@description
3174
- * the method checks if the state has already been added to the tree
3175
- * and completed the life cycle
3176
- * @private
3177
- * @param {?} name
3178
- * @param {?} path
3179
- * @return {?}
3180
- */
3181
- StateFactory.prototype.hasBeenMountedAndBootstrapped = /**
3182
- * \@description
3183
- * the method checks if the state has already been added to the tree
3184
- * and completed the life cycle
3185
- * @private
3186
- * @param {?} name
3187
- * @param {?} path
3188
- * @return {?}
3189
- */
3190
- function (name, path) {
3191
- /** @type {?} */
3192
- var valueIsBootstrappedInInitialState = getValue(this._initialState, path) !== undefined;
3193
- return this.statesByName[name] && valueIsBootstrappedInInitialState;
3194
- };
3195
- StateFactory.decorators = [
3196
- { type: core.Injectable }
3197
- ];
3198
- /** @nocollapse */
3199
- StateFactory.ctorParameters = function () { return [
3200
- { type: core.Injector },
3201
- { type: NgxsConfig },
3202
- { type: StateFactory, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
3203
- { type: InternalActions },
3204
- { type: InternalDispatchedActionResults },
3205
- { type: StateContextFactory },
3206
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [internals.INITIAL_STATE_TOKEN,] }] }
3207
- ]; };
3208
- return StateFactory;
3209
- }());
3210
- if (false) {
3211
- /**
3212
- * @type {?}
3213
- * @private
3214
- */
3215
- StateFactory.prototype._actionsSubscription;
3216
- /**
3217
- * @type {?}
3218
- * @private
3219
- */
3220
- StateFactory.prototype._states;
3221
- /**
3222
- * @type {?}
3223
- * @private
3224
- */
3225
- StateFactory.prototype._statesByName;
3226
- /**
3227
- * @type {?}
3228
- * @private
3229
- */
3230
- StateFactory.prototype._statePaths;
3231
- /** @type {?} */
3232
- StateFactory.prototype.getRuntimeSelectorContext;
3233
- /**
3234
- * @type {?}
3235
- * @private
3236
- */
3237
- StateFactory.prototype._injector;
3238
- /**
3239
- * @type {?}
3240
- * @private
3241
- */
3242
- StateFactory.prototype._config;
3243
- /**
3244
- * @type {?}
3245
- * @private
3246
- */
3247
- StateFactory.prototype._parentFactory;
3248
- /**
3249
- * @type {?}
3250
- * @private
3251
- */
3252
- StateFactory.prototype._actions;
3253
- /**
3254
- * @type {?}
3255
- * @private
3256
- */
3257
- StateFactory.prototype._actionResults;
3258
- /**
3259
- * @type {?}
3260
- * @private
3261
- */
3262
- StateFactory.prototype._stateContextFactory;
3263
- /**
3264
- * @type {?}
3265
- * @private
3266
- */
3267
- StateFactory.prototype._initialState;
3268
- }
3269
-
3270
- /**
3271
- * @fileoverview added by tsickle
3272
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3273
- */
3274
- var LifecycleStateManager = /** @class */ (function () {
3275
- function LifecycleStateManager(internalStateOperations, stateContextFactory, bootstrapper) {
3276
- this.internalStateOperations = internalStateOperations;
3277
- this.stateContextFactory = stateContextFactory;
3278
- this.bootstrapper = bootstrapper;
3279
- }
3280
- /**
3281
- * @template T
3282
- * @param {?} action
3283
- * @param {?} results
3284
- * @return {?}
3285
- */
3286
- LifecycleStateManager.prototype.ngxsBootstrap = /**
3287
- * @template T
3288
- * @param {?} action
3289
- * @param {?} results
3290
- * @return {?}
3291
- */
3292
- function (action, results) {
3293
- var _this = this;
3294
- this.internalStateOperations
3295
- .getRootStateOperations()
3296
- .dispatch(action)
3297
- .pipe(operators.filter((/**
3298
- * @return {?}
3299
- */
3300
- function () { return !!results; })), operators.tap((/**
3301
- * @return {?}
3302
- */
3303
- function () { return _this.invokeInit((/** @type {?} */ (results)).states); })), operators.mergeMap((/**
3304
- * @return {?}
3305
- */
3306
- function () { return _this.bootstrapper.appBootstrapped$; })), operators.filter((/**
3307
- * @param {?} appBootstrapped
3308
- * @return {?}
3309
- */
3310
- function (appBootstrapped) { return !!appBootstrapped; })))
3311
- .subscribe((/**
3312
- * @return {?}
3313
- */
3314
- function () { return _this.invokeBootstrap((/** @type {?} */ (results)).states); }));
3315
- };
3316
- /**
3317
- * Invoke the init function on the states.
3318
- */
3319
- /**
3320
- * Invoke the init function on the states.
3321
- * @param {?} mappedStores
3322
- * @return {?}
3323
- */
3324
- LifecycleStateManager.prototype.invokeInit = /**
3325
- * Invoke the init function on the states.
3326
- * @param {?} mappedStores
3327
- * @return {?}
3328
- */
3329
- function (mappedStores) {
3330
- var e_1, _a;
3331
- try {
3332
- for (var mappedStores_1 = __values(mappedStores), mappedStores_1_1 = mappedStores_1.next(); !mappedStores_1_1.done; mappedStores_1_1 = mappedStores_1.next()) {
3333
- var mappedStore = mappedStores_1_1.value;
3334
- /** @type {?} */
3335
- var instance = mappedStore.instance;
3336
- if (instance.ngxsOnChanges) {
3337
- /** @type {?} */
3338
- var currentAppState = {};
3339
- /** @type {?} */
3340
- var newAppState = this.internalStateOperations
3341
- .getRootStateOperations()
3342
- .getState();
3343
- /** @type {?} */
3344
- var firstDiffChange = getStateDiffChanges(mappedStore, {
3345
- currentAppState: currentAppState,
3346
- newAppState: newAppState
3347
- });
3348
- instance.ngxsOnChanges(firstDiffChange);
3349
- }
3350
- if (instance.ngxsOnInit) {
3351
- instance.ngxsOnInit(this.getStateContext(mappedStore));
3352
- }
3353
- mappedStore.isInitialised = true;
3354
- }
3355
- }
3356
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3357
- finally {
3358
- try {
3359
- if (mappedStores_1_1 && !mappedStores_1_1.done && (_a = mappedStores_1.return)) _a.call(mappedStores_1);
3360
- }
3361
- finally { if (e_1) throw e_1.error; }
3362
- }
3363
- };
3364
- /**
3365
- * Invoke the bootstrap function on the states.
3366
- */
3367
- /**
3368
- * Invoke the bootstrap function on the states.
3369
- * @param {?} mappedStores
3370
- * @return {?}
3371
- */
3372
- LifecycleStateManager.prototype.invokeBootstrap = /**
3373
- * Invoke the bootstrap function on the states.
3374
- * @param {?} mappedStores
3375
- * @return {?}
3376
- */
3377
- function (mappedStores) {
3378
- var e_2, _a;
3379
- try {
3380
- for (var mappedStores_2 = __values(mappedStores), mappedStores_2_1 = mappedStores_2.next(); !mappedStores_2_1.done; mappedStores_2_1 = mappedStores_2.next()) {
3381
- var mappedStore = mappedStores_2_1.value;
3382
- /** @type {?} */
3383
- var instance = mappedStore.instance;
3384
- if (instance.ngxsAfterBootstrap) {
3385
- instance.ngxsAfterBootstrap(this.getStateContext(mappedStore));
3386
- }
3387
- }
3388
- }
3389
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3390
- finally {
3391
- try {
3392
- if (mappedStores_2_1 && !mappedStores_2_1.done && (_a = mappedStores_2.return)) _a.call(mappedStores_2);
3393
- }
3394
- finally { if (e_2) throw e_2.error; }
3395
- }
3236
+ * @param {?} meta
3237
+ * @param {?} path
3238
+ * @return {?}
3239
+ */
3240
+ function (meta, path) {
3241
+ this.statePaths[(/** @type {?} */ (meta.name))] = path;
3242
+ // TODO: v4 - we plan to get rid of the path property because it is non-deterministic
3243
+ // we can do this when we get rid of the incorrectly exposed getStoreMetadata
3244
+ // We will need to come up with an alternative in v4 because this is used by many plugins
3245
+ meta.path = path;
3396
3246
  };
3397
3247
  /**
3248
+ * @description
3249
+ * the method checks if the state has already been added to the tree
3250
+ * and completed the life cycle
3251
+ * @param name
3252
+ * @param path
3253
+ */
3254
+ /**
3255
+ * \@description
3256
+ * the method checks if the state has already been added to the tree
3257
+ * and completed the life cycle
3398
3258
  * @private
3399
- * @param {?} mappedStore
3259
+ * @param {?} name
3260
+ * @param {?} path
3400
3261
  * @return {?}
3401
3262
  */
3402
- LifecycleStateManager.prototype.getStateContext = /**
3263
+ StateFactory.prototype.hasBeenMountedAndBootstrapped = /**
3264
+ * \@description
3265
+ * the method checks if the state has already been added to the tree
3266
+ * and completed the life cycle
3403
3267
  * @private
3404
- * @param {?} mappedStore
3268
+ * @param {?} name
3269
+ * @param {?} path
3405
3270
  * @return {?}
3406
3271
  */
3407
- function (mappedStore) {
3408
- return this.stateContextFactory.createStateContext(mappedStore);
3272
+ function (name, path) {
3273
+ /** @type {?} */
3274
+ var valueIsBootstrappedInInitialState = getValue(this._initialState, path) !== undefined;
3275
+ return this.statesByName[name] && valueIsBootstrappedInInitialState;
3409
3276
  };
3410
- LifecycleStateManager.decorators = [
3277
+ StateFactory.decorators = [
3411
3278
  { type: core.Injectable }
3412
3279
  ];
3413
3280
  /** @nocollapse */
3414
- LifecycleStateManager.ctorParameters = function () { return [
3415
- { type: InternalStateOperations },
3281
+ StateFactory.ctorParameters = function () { return [
3282
+ { type: core.Injector },
3283
+ { type: NgxsConfig },
3284
+ { type: StateFactory, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
3285
+ { type: InternalActions },
3286
+ { type: InternalDispatchedActionResults },
3416
3287
  { type: StateContextFactory },
3417
- { type: internals.NgxsBootstrapper }
3288
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [internals.INITIAL_STATE_TOKEN,] }] }
3418
3289
  ]; };
3419
- return LifecycleStateManager;
3290
+ return StateFactory;
3420
3291
  }());
3421
3292
  if (false) {
3422
3293
  /**
3423
3294
  * @type {?}
3424
3295
  * @private
3425
3296
  */
3426
- LifecycleStateManager.prototype.internalStateOperations;
3297
+ StateFactory.prototype._actionsSubscription;
3298
+ /**
3299
+ * @type {?}
3300
+ * @private
3301
+ */
3302
+ StateFactory.prototype._states;
3303
+ /**
3304
+ * @type {?}
3305
+ * @private
3306
+ */
3307
+ StateFactory.prototype._statesByName;
3308
+ /**
3309
+ * @type {?}
3310
+ * @private
3311
+ */
3312
+ StateFactory.prototype._statePaths;
3313
+ /** @type {?} */
3314
+ StateFactory.prototype.getRuntimeSelectorContext;
3315
+ /**
3316
+ * @type {?}
3317
+ * @private
3318
+ */
3319
+ StateFactory.prototype._injector;
3320
+ /**
3321
+ * @type {?}
3322
+ * @private
3323
+ */
3324
+ StateFactory.prototype._config;
3325
+ /**
3326
+ * @type {?}
3327
+ * @private
3328
+ */
3329
+ StateFactory.prototype._parentFactory;
3330
+ /**
3331
+ * @type {?}
3332
+ * @private
3333
+ */
3334
+ StateFactory.prototype._actions;
3335
+ /**
3336
+ * @type {?}
3337
+ * @private
3338
+ */
3339
+ StateFactory.prototype._actionResults;
3427
3340
  /**
3428
3341
  * @type {?}
3429
3342
  * @private
3430
3343
  */
3431
- LifecycleStateManager.prototype.stateContextFactory;
3344
+ StateFactory.prototype._stateContextFactory;
3432
3345
  /**
3433
3346
  * @type {?}
3434
3347
  * @private
3435
3348
  */
3436
- LifecycleStateManager.prototype.bootstrapper;
3349
+ StateFactory.prototype._initialState;
3437
3350
  }
3438
3351
 
3439
3352
  /**
@@ -3890,6 +3803,218 @@
3890
3803
  Store.prototype._stateFactory;
3891
3804
  }
3892
3805
 
3806
+ /**
3807
+ * @fileoverview added by tsickle
3808
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3809
+ */
3810
+ var LifecycleStateManager = /** @class */ (function () {
3811
+ function LifecycleStateManager(_store, _internalErrorReporter, _internalStateOperations, _stateContextFactory, _bootstrapper) {
3812
+ this._store = _store;
3813
+ this._internalErrorReporter = _internalErrorReporter;
3814
+ this._internalStateOperations = _internalStateOperations;
3815
+ this._stateContextFactory = _stateContextFactory;
3816
+ this._bootstrapper = _bootstrapper;
3817
+ this._destroy$ = new rxjs.Subject();
3818
+ }
3819
+ /**
3820
+ * @return {?}
3821
+ */
3822
+ LifecycleStateManager.prototype.ngOnDestroy = /**
3823
+ * @return {?}
3824
+ */
3825
+ function () {
3826
+ this._destroy$.next();
3827
+ };
3828
+ /**
3829
+ * @template T
3830
+ * @param {?} action
3831
+ * @param {?} results
3832
+ * @return {?}
3833
+ */
3834
+ LifecycleStateManager.prototype.ngxsBootstrap = /**
3835
+ * @template T
3836
+ * @param {?} action
3837
+ * @param {?} results
3838
+ * @return {?}
3839
+ */
3840
+ function (action, results) {
3841
+ var _this = this;
3842
+ this._internalStateOperations
3843
+ .getRootStateOperations()
3844
+ .dispatch(action)
3845
+ .pipe(operators.filter((/**
3846
+ * @return {?}
3847
+ */
3848
+ function () { return !!results; })), operators.tap((/**
3849
+ * @return {?}
3850
+ */
3851
+ function () { return _this._invokeInitOnStates((/** @type {?} */ (results)).states); })), operators.mergeMap((/**
3852
+ * @return {?}
3853
+ */
3854
+ function () { return _this._bootstrapper.appBootstrapped$; })), operators.filter((/**
3855
+ * @param {?} appBootstrapped
3856
+ * @return {?}
3857
+ */
3858
+ function (appBootstrapped) { return !!appBootstrapped; })), operators.catchError((/**
3859
+ * @param {?} error
3860
+ * @return {?}
3861
+ */
3862
+ function (error) {
3863
+ // The `SafeSubscriber` (which is used by most RxJS operators) re-throws
3864
+ // errors asynchronously (`setTimeout(() => { throw error })`). This might
3865
+ // break existing user's code or unit tests. We catch the error manually to
3866
+ // be backward compatible with the old behavior.
3867
+ _this._internalErrorReporter.reportErrorSafely(error);
3868
+ return rxjs.EMPTY;
3869
+ })), operators.takeUntil(this._destroy$))
3870
+ .subscribe((/**
3871
+ * @return {?}
3872
+ */
3873
+ function () { return _this._invokeBootstrapOnStates((/** @type {?} */ (results)).states); }));
3874
+ };
3875
+ /**
3876
+ * @private
3877
+ * @param {?} mappedStores
3878
+ * @return {?}
3879
+ */
3880
+ LifecycleStateManager.prototype._invokeInitOnStates = /**
3881
+ * @private
3882
+ * @param {?} mappedStores
3883
+ * @return {?}
3884
+ */
3885
+ function (mappedStores) {
3886
+ var e_1, _a;
3887
+ var _loop_1 = function (mappedStore) {
3888
+ /** @type {?} */
3889
+ var instance = mappedStore.instance;
3890
+ if (instance.ngxsOnChanges) {
3891
+ this_1._store
3892
+ .select((/**
3893
+ * @param {?} state
3894
+ * @return {?}
3895
+ */
3896
+ function (state) { return getValue(state, mappedStore.path); }))
3897
+ .pipe(operators.startWith(undefined), operators.pairwise(), operators.takeUntil(this_1._destroy$))
3898
+ .subscribe((/**
3899
+ * @param {?} __0
3900
+ * @return {?}
3901
+ */
3902
+ function (_a) {
3903
+ var _b = __read(_a, 2), previousValue = _b[0], currentValue = _b[1];
3904
+ /** @type {?} */
3905
+ var change = new NgxsSimpleChange(previousValue, currentValue, !mappedStore.isInitialised);
3906
+ (/** @type {?} */ (instance.ngxsOnChanges))(change);
3907
+ }));
3908
+ }
3909
+ if (instance.ngxsOnInit) {
3910
+ instance.ngxsOnInit(this_1._getStateContext(mappedStore));
3911
+ }
3912
+ mappedStore.isInitialised = true;
3913
+ };
3914
+ var this_1 = this;
3915
+ try {
3916
+ for (var mappedStores_1 = __values(mappedStores), mappedStores_1_1 = mappedStores_1.next(); !mappedStores_1_1.done; mappedStores_1_1 = mappedStores_1.next()) {
3917
+ var mappedStore = mappedStores_1_1.value;
3918
+ _loop_1(mappedStore);
3919
+ }
3920
+ }
3921
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3922
+ finally {
3923
+ try {
3924
+ if (mappedStores_1_1 && !mappedStores_1_1.done && (_a = mappedStores_1.return)) _a.call(mappedStores_1);
3925
+ }
3926
+ finally { if (e_1) throw e_1.error; }
3927
+ }
3928
+ };
3929
+ /**
3930
+ * @private
3931
+ * @param {?} mappedStores
3932
+ * @return {?}
3933
+ */
3934
+ LifecycleStateManager.prototype._invokeBootstrapOnStates = /**
3935
+ * @private
3936
+ * @param {?} mappedStores
3937
+ * @return {?}
3938
+ */
3939
+ function (mappedStores) {
3940
+ var e_2, _a;
3941
+ try {
3942
+ for (var mappedStores_2 = __values(mappedStores), mappedStores_2_1 = mappedStores_2.next(); !mappedStores_2_1.done; mappedStores_2_1 = mappedStores_2.next()) {
3943
+ var mappedStore = mappedStores_2_1.value;
3944
+ /** @type {?} */
3945
+ var instance = mappedStore.instance;
3946
+ if (instance.ngxsAfterBootstrap) {
3947
+ instance.ngxsAfterBootstrap(this._getStateContext(mappedStore));
3948
+ }
3949
+ }
3950
+ }
3951
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3952
+ finally {
3953
+ try {
3954
+ if (mappedStores_2_1 && !mappedStores_2_1.done && (_a = mappedStores_2.return)) _a.call(mappedStores_2);
3955
+ }
3956
+ finally { if (e_2) throw e_2.error; }
3957
+ }
3958
+ };
3959
+ /**
3960
+ * @private
3961
+ * @param {?} mappedStore
3962
+ * @return {?}
3963
+ */
3964
+ LifecycleStateManager.prototype._getStateContext = /**
3965
+ * @private
3966
+ * @param {?} mappedStore
3967
+ * @return {?}
3968
+ */
3969
+ function (mappedStore) {
3970
+ return this._stateContextFactory.createStateContext(mappedStore);
3971
+ };
3972
+ LifecycleStateManager.decorators = [
3973
+ { type: core.Injectable }
3974
+ ];
3975
+ /** @nocollapse */
3976
+ LifecycleStateManager.ctorParameters = function () { return [
3977
+ { type: Store },
3978
+ { type: InternalErrorReporter },
3979
+ { type: InternalStateOperations },
3980
+ { type: StateContextFactory },
3981
+ { type: internals.NgxsBootstrapper }
3982
+ ]; };
3983
+ return LifecycleStateManager;
3984
+ }());
3985
+ if (false) {
3986
+ /**
3987
+ * @type {?}
3988
+ * @private
3989
+ */
3990
+ LifecycleStateManager.prototype._destroy$;
3991
+ /**
3992
+ * @type {?}
3993
+ * @private
3994
+ */
3995
+ LifecycleStateManager.prototype._store;
3996
+ /**
3997
+ * @type {?}
3998
+ * @private
3999
+ */
4000
+ LifecycleStateManager.prototype._internalErrorReporter;
4001
+ /**
4002
+ * @type {?}
4003
+ * @private
4004
+ */
4005
+ LifecycleStateManager.prototype._internalStateOperations;
4006
+ /**
4007
+ * @type {?}
4008
+ * @private
4009
+ */
4010
+ LifecycleStateManager.prototype._stateContextFactory;
4011
+ /**
4012
+ * @type {?}
4013
+ * @private
4014
+ */
4015
+ LifecycleStateManager.prototype._bootstrapper;
4016
+ }
4017
+
3893
4018
  /**
3894
4019
  * @fileoverview added by tsickle
3895
4020
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -4739,13 +4864,14 @@
4739
4864
  exports.ɵo = InternalStateOperations;
4740
4865
  exports.ɵp = PluginManager;
4741
4866
  exports.ɵq = InternalNgxsExecutionStrategy;
4742
- exports.ɵr = SelectFactory;
4743
- exports.ɵt = ensureStoreMetadata;
4744
- exports.ɵu = getStoreMetadata;
4745
- exports.ɵv = ensureSelectorMetadata;
4746
- exports.ɵw = getSelectorMetadata;
4747
- exports.ɵx = LifecycleStateManager;
4748
- exports.ɵy = NgxsFeatureModule;
4867
+ exports.ɵr = InternalErrorReporter;
4868
+ exports.ɵs = SelectFactory;
4869
+ exports.ɵu = ensureStoreMetadata;
4870
+ exports.ɵv = getStoreMetadata;
4871
+ exports.ɵw = ensureSelectorMetadata;
4872
+ exports.ɵx = getSelectorMetadata;
4873
+ exports.ɵy = LifecycleStateManager;
4874
+ exports.ɵz = NgxsFeatureModule;
4749
4875
 
4750
4876
  Object.defineProperty(exports, '__esModule', { value: true });
4751
4877