@ngxs/store 3.7.3 → 3.7.4-dev.master-327646e

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 (270) hide show
  1. package/README.md +16 -16
  2. package/bundles/ngxs-store-internals-testing.umd.js +318 -215
  3. package/bundles/ngxs-store-internals-testing.umd.js.map +1 -1
  4. package/bundles/ngxs-store-internals-testing.umd.min.js +1 -1
  5. package/bundles/ngxs-store-internals-testing.umd.min.js.map +1 -1
  6. package/bundles/ngxs-store-internals.umd.js +398 -211
  7. package/bundles/ngxs-store-internals.umd.js.map +1 -1
  8. package/bundles/ngxs-store-internals.umd.min.js +1 -1
  9. package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
  10. package/bundles/ngxs-store-operators.umd.js +311 -310
  11. package/bundles/ngxs-store-operators.umd.js.map +1 -1
  12. package/bundles/ngxs-store-operators.umd.min.js +1 -1
  13. package/bundles/ngxs-store-operators.umd.min.js.map +1 -1
  14. package/bundles/ngxs-store.umd.js +4496 -4519
  15. package/bundles/ngxs-store.umd.js.map +1 -1
  16. package/bundles/ngxs-store.umd.min.js +1 -1
  17. package/bundles/ngxs-store.umd.min.js.map +1 -1
  18. package/esm2015/index.js +13 -13
  19. package/esm2015/internals/angular.js +20 -40
  20. package/esm2015/internals/decorator-injector-adapter.js +204 -0
  21. package/esm2015/internals/index.js +11 -10
  22. package/esm2015/internals/initial-state.js +34 -34
  23. package/esm2015/internals/internal-tokens.js +16 -16
  24. package/esm2015/internals/memoize.js +70 -70
  25. package/esm2015/internals/ngxs-bootstrapper.js +41 -41
  26. package/esm2015/internals/ngxs-store-internals.js +9 -9
  27. package/esm2015/internals/src/symbols.js +14 -14
  28. package/esm2015/internals/symbols.js +14 -14
  29. package/esm2015/internals/testing/fresh-platform.js +110 -71
  30. package/esm2015/internals/testing/helpers/ngxs-test.component.js +22 -22
  31. package/esm2015/internals/testing/helpers/ngxs-test.module.js +24 -24
  32. package/esm2015/internals/testing/index.js +8 -7
  33. package/esm2015/internals/testing/ngxs-store-internals-testing.js +9 -9
  34. package/esm2015/internals/testing/ngxs.setup.js +76 -76
  35. package/esm2015/internals/testing/skip-console-logging.js +62 -0
  36. package/esm2015/internals/testing/symbol.js +29 -29
  37. package/esm2015/ngxs-store.js +23 -27
  38. package/esm2015/operators/append.js +31 -31
  39. package/esm2015/operators/compose.js +24 -24
  40. package/esm2015/operators/iif.js +56 -56
  41. package/esm2015/operators/index.js +18 -18
  42. package/esm2015/operators/insert-item.js +41 -41
  43. package/esm2015/operators/internals.js +5 -5
  44. package/esm2015/operators/ngxs-store-operators.js +8 -8
  45. package/esm2015/operators/patch.js +38 -39
  46. package/esm2015/operators/remove-item.js +34 -34
  47. package/esm2015/operators/update-item.js +54 -52
  48. package/esm2015/operators/utils.js +50 -50
  49. package/esm2015/src/actions/actions.js +39 -39
  50. package/esm2015/src/actions/symbols.js +39 -39
  51. package/esm2015/src/actions-stream.js +138 -140
  52. package/esm2015/src/configs/messages.config.js +79 -87
  53. package/esm2015/src/decorators/action.js +48 -44
  54. package/esm2015/src/decorators/select/select-factory.js +49 -46
  55. package/esm2015/src/decorators/select/select.js +81 -45
  56. package/esm2015/src/decorators/select/symbols.js +94 -50
  57. package/esm2015/src/decorators/selector/selector.js +59 -55
  58. package/esm2015/src/decorators/selector/symbols.js +5 -5
  59. package/esm2015/src/decorators/selector-options.js +34 -34
  60. package/esm2015/src/decorators/state.js +83 -75
  61. package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +103 -96
  62. package/esm2015/src/execution/internal-ngxs-execution-strategy.js +45 -45
  63. package/esm2015/src/execution/noop-ngxs-execution-strategy.js +29 -27
  64. package/esm2015/src/execution/symbols.js +52 -29
  65. package/esm2015/src/internal/dispatcher.js +217 -217
  66. package/esm2015/src/internal/internals.js +493 -489
  67. package/esm2015/src/internal/lifecycle-state-manager.js +129 -129
  68. package/esm2015/src/internal/state-context-factory.js +138 -138
  69. package/esm2015/src/internal/state-factory.js +449 -429
  70. package/esm2015/src/internal/state-operations.js +133 -125
  71. package/esm2015/src/internal/state-operators.js +33 -33
  72. package/esm2015/src/internal/state-stream.js +30 -21
  73. package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +28 -40
  74. package/esm2015/src/module.js +157 -172
  75. package/esm2015/src/modules/ngxs-feature.module.js +63 -63
  76. package/esm2015/src/modules/ngxs-root.module.js +52 -52
  77. package/esm2015/src/operators/leave-ngxs.js +58 -58
  78. package/esm2015/src/operators/of-action.js +197 -191
  79. package/esm2015/src/plugin-manager.js +70 -70
  80. package/esm2015/src/plugin_api.js +10 -10
  81. package/esm2015/src/public_api.js +29 -29
  82. package/esm2015/src/public_to_deprecate.js +64 -64
  83. package/esm2015/src/state-token/state-token.js +45 -45
  84. package/esm2015/src/state-token/symbols.js +5 -5
  85. package/esm2015/src/store.js +190 -174
  86. package/esm2015/src/symbols.js +220 -221
  87. package/esm2015/src/utils/compose.js +44 -44
  88. package/esm2015/src/utils/freeze.js +35 -35
  89. package/esm2015/src/utils/selector-utils.js +221 -221
  90. package/esm2015/src/utils/store-validators.js +60 -65
  91. package/esm2015/src/utils/utils.js +143 -143
  92. package/esm5/index.js +13 -13
  93. package/esm5/internals/angular.js +20 -40
  94. package/esm5/internals/decorator-injector-adapter.js +204 -0
  95. package/esm5/internals/index.js +11 -10
  96. package/esm5/internals/initial-state.js +45 -45
  97. package/esm5/internals/internal-tokens.js +16 -16
  98. package/esm5/internals/memoize.js +71 -71
  99. package/esm5/internals/ngxs-bootstrapper.js +56 -56
  100. package/esm5/internals/ngxs-store-internals.js +9 -9
  101. package/esm5/internals/src/symbols.js +14 -14
  102. package/esm5/internals/symbols.js +14 -14
  103. package/esm5/internals/testing/fresh-platform.js +121 -81
  104. package/esm5/internals/testing/helpers/ngxs-test.component.js +32 -32
  105. package/esm5/internals/testing/helpers/ngxs-test.module.js +32 -32
  106. package/esm5/internals/testing/index.js +8 -7
  107. package/esm5/internals/testing/ngxs-store-internals-testing.js +9 -9
  108. package/esm5/internals/testing/ngxs.setup.js +98 -98
  109. package/esm5/internals/testing/skip-console-logging.js +62 -0
  110. package/esm5/internals/testing/symbol.js +29 -29
  111. package/esm5/ngxs-store.js +23 -27
  112. package/esm5/operators/append.js +31 -31
  113. package/esm5/operators/compose.js +28 -28
  114. package/esm5/operators/iif.js +56 -56
  115. package/esm5/operators/index.js +18 -18
  116. package/esm5/operators/insert-item.js +41 -41
  117. package/esm5/operators/internals.js +5 -5
  118. package/esm5/operators/ngxs-store-operators.js +8 -8
  119. package/esm5/operators/patch.js +39 -40
  120. package/esm5/operators/remove-item.js +34 -34
  121. package/esm5/operators/update-item.js +54 -52
  122. package/esm5/operators/utils.js +50 -50
  123. package/esm5/src/actions/actions.js +62 -62
  124. package/esm5/src/actions/symbols.js +39 -39
  125. package/esm5/src/actions-stream.js +184 -186
  126. package/esm5/src/configs/messages.config.js +79 -104
  127. package/esm5/src/decorators/action.js +60 -56
  128. package/esm5/src/decorators/select/select-factory.js +50 -47
  129. package/esm5/src/decorators/select/select.js +87 -50
  130. package/esm5/src/decorators/select/symbols.js +95 -51
  131. package/esm5/src/decorators/selector/selector.js +59 -55
  132. package/esm5/src/decorators/selector/symbols.js +5 -5
  133. package/esm5/src/decorators/selector-options.js +34 -34
  134. package/esm5/src/decorators/state.js +84 -76
  135. package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +123 -121
  136. package/esm5/src/execution/internal-ngxs-execution-strategy.js +54 -54
  137. package/esm5/src/execution/noop-ngxs-execution-strategy.js +43 -41
  138. package/esm5/src/execution/symbols.js +52 -29
  139. package/esm5/src/internal/dispatcher.js +253 -253
  140. package/esm5/src/internal/internals.js +495 -491
  141. package/esm5/src/internal/lifecycle-state-manager.js +177 -177
  142. package/esm5/src/internal/state-context-factory.js +146 -146
  143. package/esm5/src/internal/state-factory.js +575 -563
  144. package/esm5/src/internal/state-operations.js +143 -139
  145. package/esm5/src/internal/state-operators.js +34 -34
  146. package/esm5/src/internal/state-stream.js +37 -25
  147. package/esm5/src/ivy/ivy-enabled-in-dev-mode.js +28 -40
  148. package/esm5/src/module.js +200 -215
  149. package/esm5/src/modules/ngxs-feature.module.js +65 -65
  150. package/esm5/src/modules/ngxs-root.module.js +47 -47
  151. package/esm5/src/operators/leave-ngxs.js +58 -58
  152. package/esm5/src/operators/of-action.js +223 -217
  153. package/esm5/src/plugin-manager.js +82 -82
  154. package/esm5/src/plugin_api.js +10 -10
  155. package/esm5/src/public_api.js +29 -29
  156. package/esm5/src/public_to_deprecate.js +64 -64
  157. package/esm5/src/state-token/state-token.js +57 -57
  158. package/esm5/src/state-token/symbols.js +5 -5
  159. package/esm5/src/store.js +241 -225
  160. package/esm5/src/symbols.js +229 -230
  161. package/esm5/src/utils/compose.js +55 -55
  162. package/esm5/src/utils/freeze.js +35 -35
  163. package/esm5/src/utils/selector-utils.js +230 -230
  164. package/esm5/src/utils/store-validators.js +78 -86
  165. package/esm5/src/utils/utils.js +151 -151
  166. package/fesm2015/ngxs-store-internals-testing.js +278 -177
  167. package/fesm2015/ngxs-store-internals-testing.js.map +1 -1
  168. package/fesm2015/ngxs-store-internals.js +378 -194
  169. package/fesm2015/ngxs-store-internals.js.map +1 -1
  170. package/fesm2015/ngxs-store-operators.js +313 -312
  171. package/fesm2015/ngxs-store-operators.js.map +1 -1
  172. package/fesm2015/ngxs-store.js +3999 -3979
  173. package/fesm2015/ngxs-store.js.map +1 -1
  174. package/fesm5/ngxs-store-internals-testing.js +325 -223
  175. package/fesm5/ngxs-store-internals-testing.js.map +1 -1
  176. package/fesm5/ngxs-store-internals.js +403 -219
  177. package/fesm5/ngxs-store-internals.js.map +1 -1
  178. package/fesm5/ngxs-store-operators.js +317 -316
  179. package/fesm5/ngxs-store-operators.js.map +1 -1
  180. package/fesm5/ngxs-store.js +4494 -4512
  181. package/fesm5/ngxs-store.js.map +1 -1
  182. package/index.d.ts +8 -8
  183. package/internals/angular.d.ts +1 -3
  184. package/internals/decorator-injector-adapter.d.ts +15 -0
  185. package/internals/index.d.ts +7 -6
  186. package/internals/initial-state.d.ts +8 -8
  187. package/internals/internal-tokens.d.ts +9 -9
  188. package/internals/memoize.d.ts +9 -9
  189. package/internals/ngxs-bootstrapper.d.ts +13 -13
  190. package/internals/ngxs-store-internals.d.ts +4 -4
  191. package/internals/ngxs-store-internals.metadata.json +1 -1
  192. package/internals/src/symbols.d.ts +7 -7
  193. package/internals/symbols.d.ts +7 -7
  194. package/internals/testing/fresh-platform.d.ts +1 -1
  195. package/internals/testing/helpers/ngxs-test.component.d.ts +5 -5
  196. package/internals/testing/helpers/ngxs-test.module.d.ts +4 -4
  197. package/internals/testing/index.d.ts +4 -3
  198. package/internals/testing/ngxs-store-internals-testing.d.ts +4 -4
  199. package/internals/testing/ngxs-store-internals-testing.metadata.json +1 -1
  200. package/internals/testing/ngxs.setup.d.ts +7 -7
  201. package/internals/testing/skip-console-logging.d.ts +1 -0
  202. package/internals/testing/symbol.d.ts +14 -14
  203. package/ngxs-store.d.ts +19 -23
  204. package/ngxs-store.metadata.json +1 -1
  205. package/operators/append.d.ts +6 -6
  206. package/operators/compose.d.ts +3 -2
  207. package/operators/iif.d.ts +11 -11
  208. package/operators/index.d.ts +13 -13
  209. package/operators/insert-item.d.ts +7 -7
  210. package/operators/internals.d.ts +2 -2
  211. package/operators/ngxs-store-operators.d.ts +4 -4
  212. package/operators/ngxs-store-operators.metadata.json +1 -1
  213. package/operators/patch.d.ts +6 -10
  214. package/operators/remove-item.d.ts +7 -7
  215. package/operators/update-item.d.ts +10 -10
  216. package/operators/utils.d.ts +10 -9
  217. package/package.json +3 -3
  218. package/src/actions/actions.d.ts +15 -15
  219. package/src/actions/symbols.d.ts +21 -21
  220. package/src/actions-stream.d.ts +49 -49
  221. package/src/configs/messages.config.d.ts +11 -30
  222. package/src/decorators/action.d.ts +5 -5
  223. package/src/decorators/select/select-factory.d.ts +13 -14
  224. package/src/decorators/select/select.d.ts +4 -4
  225. package/src/decorators/select/symbols.d.ts +14 -10
  226. package/src/decorators/selector/selector.d.ts +5 -5
  227. package/src/decorators/selector/symbols.d.ts +4 -4
  228. package/src/decorators/selector-options.d.ts +5 -5
  229. package/src/decorators/state.d.ts +6 -6
  230. package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +11 -12
  231. package/src/execution/internal-ngxs-execution-strategy.d.ts +7 -7
  232. package/src/execution/noop-ngxs-execution-strategy.d.ts +5 -5
  233. package/src/execution/symbols.d.ts +10 -6
  234. package/src/internal/dispatcher.d.ts +32 -32
  235. package/src/internal/internals.d.ts +166 -167
  236. package/src/internal/lifecycle-state-manager.d.ts +20 -20
  237. package/src/internal/state-context-factory.d.ts +15 -15
  238. package/src/internal/state-factory.d.ts +57 -58
  239. package/src/internal/state-operations.d.ts +19 -21
  240. package/src/internal/state-operators.d.ts +2 -2
  241. package/src/internal/state-stream.d.ts +11 -9
  242. package/src/ivy/ivy-enabled-in-dev-mode.d.ts +6 -14
  243. package/src/module.d.ts +23 -23
  244. package/src/modules/ngxs-feature.module.d.ts +13 -13
  245. package/src/modules/ngxs-root.module.d.ts +13 -13
  246. package/src/operators/leave-ngxs.d.ts +7 -7
  247. package/src/operators/of-action.d.ts +56 -43
  248. package/src/plugin-manager.d.ts +10 -10
  249. package/src/plugin_api.d.ts +5 -5
  250. package/src/public_api.d.ts +17 -17
  251. package/src/public_to_deprecate.d.ts +21 -21
  252. package/src/state-token/state-token.d.ts +7 -7
  253. package/src/state-token/symbols.d.ts +5 -5
  254. package/src/store.d.ts +59 -53
  255. package/src/symbols.d.ts +138 -137
  256. package/src/utils/compose.d.ts +23 -23
  257. package/src/utils/freeze.d.ts +5 -5
  258. package/src/utils/selector-utils.d.ts +23 -23
  259. package/src/utils/store-validators.d.ts +7 -8
  260. package/src/utils/utils.d.ts +46 -46
  261. package/types/index.d.ts +2 -2
  262. package/esm2015/src/host-environment/host-environment.js +0 -31
  263. package/esm2015/src/internal/config-validator.js +0 -67
  264. package/esm2015/src/ivy/ensure-state-class-is-injectable.js +0 -34
  265. package/esm5/src/host-environment/host-environment.js +0 -29
  266. package/esm5/src/internal/config-validator.js +0 -76
  267. package/esm5/src/ivy/ensure-state-class-is-injectable.js +0 -34
  268. package/src/host-environment/host-environment.d.ts +0 -6
  269. package/src/internal/config-validator.d.ts +0 -10
  270. package/src/ivy/ensure-state-class-is-injectable.d.ts +0 -6
@@ -1,235 +1,419 @@
1
- import { getPlatform, COMPILER_OPTIONS, Injectable, InjectionToken } from '@angular/core';
1
+ import { Injectable, InjectionToken, ɵɵdirectiveInject, INJECTOR, ɵglobal } from '@angular/core';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
 
4
- /**
5
- * @fileoverview added by tsickle
6
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
- */
8
- /**
9
- * @param {?} a
10
- * @param {?} b
11
- * @return {?}
12
- */
13
- function defaultEqualityCheck(a, b) {
14
- return a === b;
15
- }
16
- /**
17
- * @param {?} equalityCheck
18
- * @param {?} prev
19
- * @param {?} next
20
- * @return {?}
21
- */
22
- function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
23
- if (prev === null || next === null || prev.length !== next.length) {
24
- return false;
25
- }
26
- // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
27
- /** @type {?} */
28
- var length = prev.length;
29
- for (var i = 0; i < length; i++) {
30
- if (!equalityCheck(prev[i], next[i])) {
31
- return false;
32
- }
33
- }
34
- return true;
35
- }
36
- /**
37
- * Memoize a function on its last inputs only.
38
- * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
39
- *
40
- * @ignore
41
- * @template T
42
- * @param {?} func
43
- * @param {?=} equalityCheck
44
- * @return {?}
45
- */
46
- function memoize(func, equalityCheck) {
47
- if (equalityCheck === void 0) { equalityCheck = defaultEqualityCheck; }
48
- /** @type {?} */
49
- var lastArgs = null;
50
- /** @type {?} */
51
- var lastResult = null;
52
- // we reference arguments instead of spreading them for performance reasons
53
- /**
54
- * @return {?}
55
- */
56
- function memoized() {
57
- if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
58
- // apply arguments instead of spreading for performance.
59
- lastResult = ((/** @type {?} */ (func))).apply(null, arguments);
60
- }
61
- lastArgs = arguments;
62
- return lastResult;
63
- }
64
- ((/** @type {?} */ (memoized))).reset = (/**
65
- * @return {?}
66
- */
67
- function () {
68
- // The hidden (for now) ability to reset the memoization
69
- lastArgs = null;
70
- lastResult = null;
71
- });
72
- return (/** @type {?} */ (memoized));
4
+ /**
5
+ * @fileoverview added by tsickle
6
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
+ */
8
+ /**
9
+ * @return {?}
10
+ */
11
+ function isAngularInTestMode() {
12
+ // This is safe to check for these properties in the following way since `typeof` does not
13
+ // throw an exception if the value does not exist in the scope.
14
+ // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).
15
+ // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into
16
+ // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.
17
+ // this will return undefined `global.jest`, but `jest` will not equal undefined.
18
+ return (typeof __karma__ !== 'undefined' ||
19
+ typeof jasmine !== 'undefined' ||
20
+ typeof jest !== 'undefined' ||
21
+ typeof Mocha !== 'undefined');
73
22
  }
74
23
 
75
- /**
76
- * @fileoverview added by tsickle
77
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
78
- */
79
- /**
80
- * @return {?}
81
- */
82
- function _isAngularInTestMode() {
83
- /** @type {?} */
84
- var platformRef = getPlatform();
85
- if (!platformRef)
86
- return false;
87
- /** @type {?} */
88
- var compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
89
- if (!compilerOptions)
90
- return false;
91
- /** @type {?} */
92
- var isInTestMode = compilerOptions.some((/**
93
- * @param {?} item
94
- * @return {?}
95
- */
96
- function (item) {
97
- /** @type {?} */
98
- var providers = (item && item.providers) || [];
99
- return providers.some((/**
100
- * @param {?} provider
101
- * @return {?}
102
- */
103
- function (provider) {
104
- return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
105
- false);
106
- }));
107
- }));
108
- return isInTestMode;
109
- }
110
- /** @type {?} */
111
- var isAngularInTestMode = memoize(_isAngularInTestMode);
24
+ /**
25
+ * @fileoverview added by tsickle
26
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
27
+ */
28
+ var NgxsBootstrapper = /** @class */ (function () {
29
+ function NgxsBootstrapper() {
30
+ /**
31
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
32
+ */
33
+ this.bootstrap$ = new ReplaySubject(1);
34
+ }
35
+ Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
36
+ get: /**
37
+ * @return {?}
38
+ */
39
+ function () {
40
+ return this.bootstrap$.asObservable();
41
+ },
42
+ enumerable: true,
43
+ configurable: true
44
+ });
45
+ /**
46
+ * This event will be emitted after attaching `ComponentRef` of the root component
47
+ * to the tree of views, that's a signal that application has been fully rendered
48
+ */
49
+ /**
50
+ * This event will be emitted after attaching `ComponentRef` of the root component
51
+ * to the tree of views, that's a signal that application has been fully rendered
52
+ * @return {?}
53
+ */
54
+ NgxsBootstrapper.prototype.bootstrap = /**
55
+ * This event will be emitted after attaching `ComponentRef` of the root component
56
+ * to the tree of views, that's a signal that application has been fully rendered
57
+ * @return {?}
58
+ */
59
+ function () {
60
+ this.bootstrap$.next(true);
61
+ this.bootstrap$.complete();
62
+ };
63
+ NgxsBootstrapper.decorators = [
64
+ { type: Injectable }
65
+ ];
66
+ return NgxsBootstrapper;
67
+ }());
68
+ if (false) {
69
+ /**
70
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
71
+ * @type {?}
72
+ * @private
73
+ */
74
+ NgxsBootstrapper.prototype.bootstrap$;
75
+ }
112
76
 
113
- /**
114
- * @fileoverview added by tsickle
115
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
116
- */
117
- var NgxsBootstrapper = /** @class */ (function () {
118
- function NgxsBootstrapper() {
119
- /**
120
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
121
- */
122
- this.bootstrap$ = new ReplaySubject(1);
123
- }
124
- Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
125
- get: /**
126
- * @return {?}
127
- */
128
- function () {
129
- return this.bootstrap$.asObservable();
130
- },
131
- enumerable: true,
132
- configurable: true
133
- });
134
- /**
135
- * This event will be emitted after attaching `ComponentRef` of the root component
136
- * to the tree of views, that's a signal that application has been fully rendered
137
- */
138
- /**
139
- * This event will be emitted after attaching `ComponentRef` of the root component
140
- * to the tree of views, that's a signal that application has been fully rendered
141
- * @return {?}
142
- */
143
- NgxsBootstrapper.prototype.bootstrap = /**
144
- * This event will be emitted after attaching `ComponentRef` of the root component
145
- * to the tree of views, that's a signal that application has been fully rendered
146
- * @return {?}
147
- */
148
- function () {
149
- this.bootstrap$.next(true);
150
- this.bootstrap$.complete();
151
- };
152
- NgxsBootstrapper.decorators = [
153
- { type: Injectable }
154
- ];
155
- return NgxsBootstrapper;
156
- }());
157
- if (false) {
158
- /**
159
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
160
- * @type {?}
161
- * @private
162
- */
163
- NgxsBootstrapper.prototype.bootstrap$;
77
+ /**
78
+ * @fileoverview added by tsickle
79
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
80
+ */
81
+ /**
82
+ * @param {?} a
83
+ * @param {?} b
84
+ * @return {?}
85
+ */
86
+ function defaultEqualityCheck(a, b) {
87
+ return a === b;
88
+ }
89
+ /**
90
+ * @param {?} equalityCheck
91
+ * @param {?} prev
92
+ * @param {?} next
93
+ * @return {?}
94
+ */
95
+ function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
96
+ if (prev === null || next === null || prev.length !== next.length) {
97
+ return false;
98
+ }
99
+ // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
100
+ /** @type {?} */
101
+ var length = prev.length;
102
+ for (var i = 0; i < length; i++) {
103
+ if (!equalityCheck(prev[i], next[i])) {
104
+ return false;
105
+ }
106
+ }
107
+ return true;
108
+ }
109
+ /**
110
+ * Memoize a function on its last inputs only.
111
+ * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
112
+ *
113
+ * @ignore
114
+ * @template T
115
+ * @param {?} func
116
+ * @param {?=} equalityCheck
117
+ * @return {?}
118
+ */
119
+ function memoize(func, equalityCheck) {
120
+ if (equalityCheck === void 0) { equalityCheck = defaultEqualityCheck; }
121
+ /** @type {?} */
122
+ var lastArgs = null;
123
+ /** @type {?} */
124
+ var lastResult = null;
125
+ // we reference arguments instead of spreading them for performance reasons
126
+ /**
127
+ * @return {?}
128
+ */
129
+ function memoized() {
130
+ if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
131
+ // apply arguments instead of spreading for performance.
132
+ lastResult = ((/** @type {?} */ (func))).apply(null, arguments);
133
+ }
134
+ lastArgs = arguments;
135
+ return lastResult;
136
+ }
137
+ ((/** @type {?} */ (memoized))).reset = (/**
138
+ * @return {?}
139
+ */
140
+ function () {
141
+ // The hidden (for now) ability to reset the memoization
142
+ lastArgs = null;
143
+ lastResult = null;
144
+ });
145
+ return (/** @type {?} */ (memoized));
164
146
  }
165
147
 
166
- /**
167
- * @fileoverview added by tsickle
168
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
169
- */
170
- /** @type {?} */
171
- var INITIAL_STATE_TOKEN = new InjectionToken('INITIAL_STATE_TOKEN');
172
- var InitialState = /** @class */ (function () {
173
- function InitialState() {
174
- }
175
- /**
176
- * @param {?} state
177
- * @return {?}
178
- */
179
- InitialState.set = /**
180
- * @param {?} state
181
- * @return {?}
182
- */
183
- function (state) {
184
- this.value = state;
185
- };
186
- /**
187
- * @return {?}
188
- */
189
- InitialState.pop = /**
190
- * @return {?}
191
- */
192
- function () {
193
- /** @type {?} */
194
- var state = this.value;
195
- this.value = {};
196
- return state;
197
- };
198
- InitialState.value = {};
199
- return InitialState;
200
- }());
201
- if (false) {
202
- /**
203
- * @type {?}
204
- * @private
205
- */
206
- InitialState.value;
148
+ /**
149
+ * @fileoverview added by tsickle
150
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
151
+ */
152
+ /** @type {?} */
153
+ var INITIAL_STATE_TOKEN = new InjectionToken('INITIAL_STATE_TOKEN');
154
+ var InitialState = /** @class */ (function () {
155
+ function InitialState() {
156
+ }
157
+ /**
158
+ * @param {?} state
159
+ * @return {?}
160
+ */
161
+ InitialState.set = /**
162
+ * @param {?} state
163
+ * @return {?}
164
+ */
165
+ function (state) {
166
+ this.value = state;
167
+ };
168
+ /**
169
+ * @return {?}
170
+ */
171
+ InitialState.pop = /**
172
+ * @return {?}
173
+ */
174
+ function () {
175
+ /** @type {?} */
176
+ var state = this.value;
177
+ this.value = {};
178
+ return state;
179
+ };
180
+ InitialState.value = {};
181
+ return InitialState;
182
+ }());
183
+ if (false) {
184
+ /**
185
+ * @type {?}
186
+ * @private
187
+ */
188
+ InitialState.value;
207
189
  }
208
190
 
209
- /**
210
- * @fileoverview added by tsickle
211
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
212
- */
213
- /**
214
- * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally
215
- * @type {?}
216
- */
217
- var NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFactory');
218
- /**
219
- * @see StateFactory as it's referenced by this token to be accessed by plugins internally
220
- * @type {?}
221
- */
191
+ /**
192
+ * @fileoverview added by tsickle
193
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
194
+ */
195
+ /**
196
+ * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally
197
+ * @type {?}
198
+ */
199
+ var NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFactory');
200
+ /**
201
+ * @see StateFactory as it's referenced by this token to be accessed by plugins internally
202
+ * @type {?}
203
+ */
222
204
  var NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
223
205
 
224
- /**
225
- * @fileoverview added by tsickle
226
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
206
+ /**
207
+ * @fileoverview added by tsickle
208
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
209
+ */
210
+ // Angular doesn't export `NG_FACTORY_DEF`.
211
+ /** @type {?} */
212
+ var NG_FACTORY_DEF = 'ɵfac';
213
+ // A `Symbol` which is used to save the `Injector` onto the class instance.
214
+ /** @type {?} */
215
+ var InjectorInstance = Symbol('InjectorInstance');
216
+ // A `Symbol` which is used to determine if factory has been decorated previously or not.
217
+ /** @type {?} */
218
+ var FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
219
+ // A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
220
+ // be retrieved within the `constructor` since it's set after the `factory()` is called.
221
+ /** @type {?} */
222
+ var InjectorNotifier = Symbol('InjectorNotifier');
223
+ /**
224
+ * @record
225
+ */
226
+ function PrototypeWithInjectorNotifier() { }
227
+ if (false) {
228
+ /* Skipping unnamed member:
229
+ [InjectorNotifier]?: ReplaySubject<boolean>;*/
230
+ }
231
+ /**
232
+ * @param {?} target
233
+ * @return {?}
234
+ */
235
+ function ensureInjectorNotifierIsCaptured(target) {
236
+ if (target[InjectorNotifier]) {
237
+ return (/** @type {?} */ (target[InjectorNotifier]));
238
+ }
239
+ else {
240
+ /** @type {?} */
241
+ var injectorNotifier$_1 = new ReplaySubject(1);
242
+ Object.defineProperty(target, InjectorNotifier, {
243
+ get: (/**
244
+ * @return {?}
245
+ */
246
+ function () { return injectorNotifier$_1; })
247
+ });
248
+ return injectorNotifier$_1;
249
+ }
250
+ }
251
+ // eslint-disable-next-line @typescript-eslint/ban-types
252
+ /**
253
+ * @param {?} target
254
+ * @return {?}
255
+ */
256
+ function ensureLocalInjectorCaptured(target) {
257
+ if (FactoryHasBeenDecorated in target.constructor.prototype) {
258
+ return;
259
+ }
260
+ /** @type {?} */
261
+ var constructor = target.constructor;
262
+ // Means we're in AOT mode.
263
+ if (typeof constructor[NG_FACTORY_DEF] === 'function') {
264
+ decorateFactory(constructor);
265
+ }
266
+ else if (ngDevMode) {
267
+ // We're running in JIT mode and that means we're not able to get the compiled definition
268
+ // on the class inside the property decorator during the current message loop tick. We have
269
+ // to wait for the next message loop tick. Note that this is safe since this Promise will be
270
+ // resolved even before the `APP_INITIALIZER` is resolved.
271
+ // The below code also will be executed only in development mode, since it's never recommended
272
+ // to use the JIT compiler in production mode (by setting "aot: false").
273
+ decorateFactoryLater(constructor);
274
+ }
275
+ target.constructor.prototype[FactoryHasBeenDecorated] = true;
276
+ }
277
+ /**
278
+ * @template T
279
+ * @param {?} instance
280
+ * @param {?} token
281
+ * @return {?}
282
+ */
283
+ function localInject(instance, token) {
284
+ /** @type {?} */
285
+ var injector = instance[InjectorInstance];
286
+ return injector ? injector.get(token) : null;
287
+ }
288
+ /**
289
+ * @param {?} constructor
290
+ * @return {?}
291
+ */
292
+ function decorateFactory(constructor) {
293
+ /** @type {?} */
294
+ var factory = constructor[NG_FACTORY_DEF];
295
+ if (typeof factory !== 'function') {
296
+ return;
297
+ }
298
+ // Let's try to get any definition.
299
+ // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
300
+ // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
301
+ /** @type {?} */
302
+ var def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
303
+ /** @type {?} */
304
+ var decoratedFactory = (/**
305
+ * @return {?}
306
+ */
307
+ function () {
308
+ /** @type {?} */
309
+ var instance = factory();
310
+ // Caretaker note: `inject()` won't work here.
311
+ // We can use the `directiveInject` only during the component
312
+ // construction, since Angular captures the currently active injector.
313
+ // We're not able to use this function inside the getter (when the `selectorId` property is
314
+ // requested for the first time), since the currently active injector will be null.
315
+ instance[InjectorInstance] = ɵɵdirectiveInject(
316
+ // We're using `INJECTOR` token except of the `Injector` class since the compiler
317
+ // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
318
+ // Caretaker note: that this is the same way of getting the injector.
319
+ INJECTOR);
320
+ // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
321
+ /** @type {?} */
322
+ var injectorNotifier$ = instance[InjectorNotifier];
323
+ if (injectorNotifier$) {
324
+ injectorNotifier$.next(true);
325
+ injectorNotifier$.complete();
326
+ }
327
+ return instance;
328
+ });
329
+ // If we've found any definition then it's enough to override the `def.factory` since Angular
330
+ // code uses the `def.factory` and then fallbacks to `ɵfac`.
331
+ if (def) {
332
+ def.factory = decoratedFactory;
333
+ }
334
+ // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
335
+ // still uses the `ɵfac`.
336
+ Object.defineProperty(constructor, NG_FACTORY_DEF, {
337
+ get: (/**
338
+ * @return {?}
339
+ */
340
+ function () { return decoratedFactory; })
341
+ });
342
+ }
343
+ /**
344
+ * @param {?} constructor
345
+ * @return {?}
346
+ */
347
+ function decorateFactoryLater(constructor) {
348
+ // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.
349
+ // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws
350
+ // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call
351
+ // Promise.then from within a sync test`.
352
+ try {
353
+ Promise.resolve().then((/**
354
+ * @return {?}
355
+ */
356
+ function () {
357
+ decorateFactory(constructor);
358
+ }));
359
+ }
360
+ catch (_a) {
361
+ // This is kind of a "hack", but we try to be backwards-compatible,
362
+ // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.
363
+ ɵglobal.process &&
364
+ ɵglobal.process.nextTick &&
365
+ ɵglobal.process.nextTick((/**
366
+ * @return {?}
367
+ */
368
+ function () {
369
+ decorateFactory(constructor);
370
+ }));
371
+ }
372
+ }
373
+ /**
374
+ * @record
375
+ */
376
+ function Definition() { }
377
+ if (false) {
378
+ /** @type {?} */
379
+ Definition.prototype.factory;
380
+ }
381
+ /**
382
+ * @record
383
+ */
384
+ function ConstructorWithDefinitionAndFactory() { }
385
+ if (false) {
386
+ /** @type {?|undefined} */
387
+ ConstructorWithDefinitionAndFactory.prototype.ɵprov;
388
+ /** @type {?|undefined} */
389
+ ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
390
+ /** @type {?|undefined} */
391
+ ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
392
+ /** @type {?|undefined} */
393
+ ConstructorWithDefinitionAndFactory.prototype.ɵdir;
394
+ /* Skipping unnamed member:
395
+ [NG_FACTORY_DEF]?: Factory;*/
396
+ }
397
+ /**
398
+ * @record
399
+ */
400
+ function PrivateInstance() { }
401
+ if (false) {
402
+ /* Skipping unnamed member:
403
+ [InjectorInstance]?: Injector;*/
404
+ /* Skipping unnamed member:
405
+ [InjectorNotifier]?: ReplaySubject<boolean>;*/
406
+ }
407
+
408
+ /**
409
+ * @fileoverview added by tsickle
410
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
227
411
  */
228
412
 
229
- /**
230
- * @fileoverview added by tsickle
231
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
413
+ /**
414
+ * @fileoverview added by tsickle
415
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
232
416
  */
233
417
 
234
- export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, isAngularInTestMode, memoize };
418
+ export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, ensureInjectorNotifierIsCaptured, ensureLocalInjectorCaptured, isAngularInTestMode, localInject, memoize };
235
419
  //# sourceMappingURL=ngxs-store-internals.js.map