@ngxs/store 3.7.6 → 3.8.0-dev.master-c341c15
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/ngxs-store-internals-testing.umd.js +409 -420
- package/bundles/ngxs-store-internals-testing.umd.js.map +1 -1
- package/bundles/ngxs-store-internals.umd.js +48 -117
- package/bundles/ngxs-store-internals.umd.js.map +1 -1
- package/bundles/ngxs-store-operators.umd.js +62 -402
- package/bundles/ngxs-store-operators.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.js +1296 -3219
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/esm2015/index.js +7 -7
- package/esm2015/internals/angular.js +1 -8
- package/esm2015/internals/index.js +2 -6
- package/esm2015/internals/initial-state.js +1 -21
- package/esm2015/internals/internal-tokens.js +4 -15
- package/esm2015/internals/memoize.js +8 -33
- package/esm2015/internals/ngxs-bootstrapper.js +7 -20
- package/esm2015/internals/ngxs-store-internals.js +2 -6
- package/esm2015/internals/src/symbols.js +2 -14
- package/esm2015/internals/symbols.js +2 -14
- package/esm2015/internals/testing/fresh-platform.js +13 -53
- package/esm2015/internals/testing/helpers/ngxs-test.component.js +11 -17
- package/esm2015/internals/testing/helpers/ngxs-test.module.js +13 -16
- package/esm2015/internals/testing/index.js +1 -5
- package/esm2015/internals/testing/ngxs-store-internals-testing.js +2 -6
- package/esm2015/internals/testing/ngxs.setup.js +1 -31
- package/esm2015/internals/testing/skip-console-logging.js +7 -42
- package/esm2015/internals/testing/symbol.js +2 -29
- package/esm2015/ngxs-store.js +2 -22
- package/esm2015/operators/append.js +7 -18
- package/esm2015/operators/compose.js +4 -22
- package/esm2015/operators/iif.js +12 -30
- package/esm2015/operators/index.js +2 -6
- package/esm2015/operators/insert-item.js +10 -22
- package/esm2015/operators/ngxs-store-operators.js +2 -6
- package/esm2015/operators/patch.js +5 -23
- package/esm2015/operators/remove-item.js +5 -17
- package/esm2015/operators/types.js +2 -0
- package/esm2015/operators/update-item.js +13 -25
- package/esm2015/operators/utils.js +1 -32
- package/esm2015/src/actions/actions.js +1 -18
- package/esm2015/src/actions/symbols.js +2 -39
- package/esm2015/src/actions-stream.js +20 -122
- package/esm2015/src/configs/messages.config.js +1 -44
- package/esm2015/src/decorators/action.js +3 -18
- package/esm2015/src/decorators/select/select-factory.js +10 -27
- package/esm2015/src/decorators/select/select.js +3 -22
- package/esm2015/src/decorators/select/symbols.js +4 -25
- package/esm2015/src/decorators/selector/selector.js +11 -38
- package/esm2015/src/decorators/selector/symbols.js +2 -5
- package/esm2015/src/decorators/selector-options.js +6 -19
- package/esm2015/src/decorators/state.js +5 -44
- package/esm2015/src/dev-features/ngxs-development.module.js +22 -0
- package/esm2015/src/dev-features/ngxs-unhandled-actions-logger.js +46 -0
- package/esm2015/src/dev-features/symbols.js +6 -0
- package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +10 -56
- package/esm2015/src/execution/internal-ngxs-execution-strategy.js +10 -32
- package/esm2015/src/execution/noop-ngxs-execution-strategy.js +7 -19
- package/esm2015/src/execution/symbols.js +3 -32
- package/esm2015/src/internal/custom-rxjs-subjects.js +81 -0
- package/esm2015/src/internal/dispatcher.js +26 -121
- package/esm2015/src/internal/error-handler.js +18 -72
- package/esm2015/src/internal/internals.js +24 -244
- package/esm2015/src/internal/lifecycle-state-manager.js +19 -117
- package/esm2015/src/internal/state-context-factory.js +8 -66
- package/esm2015/src/internal/state-factory.js +60 -227
- package/esm2015/src/internal/state-operations.js +19 -80
- package/esm2015/src/internal/state-operators.js +15 -28
- package/esm2015/src/internal/state-stream.js +9 -15
- package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +7 -17
- package/esm2015/src/module.js +12 -47
- package/esm2015/src/modules/ngxs-feature.module.js +18 -36
- package/esm2015/src/modules/ngxs-root.module.js +18 -26
- package/esm2015/src/operators/leave-ngxs.js +8 -43
- package/esm2015/src/operators/of-action.js +16 -105
- package/esm2015/src/plugin-manager.js +17 -50
- package/esm2015/src/plugin_api.js +1 -5
- package/esm2015/src/private_api.js +3 -0
- package/esm2015/src/public_api.js +7 -9
- package/esm2015/src/public_to_deprecate.js +1 -51
- package/esm2015/src/selectors/create-model-selector.js +28 -0
- package/esm2015/src/selectors/create-pick-selector.js +14 -0
- package/esm2015/src/selectors/create-property-selectors.js +18 -0
- package/esm2015/src/selectors/create-selector.js +9 -0
- package/esm2015/src/selectors/index.js +6 -0
- package/esm2015/src/selectors/selector-checks.util.js +18 -0
- package/esm2015/src/selectors/selector-metadata.js +30 -0
- package/esm2015/src/selectors/selector-models.js +2 -0
- package/esm2015/src/selectors/selector-types.util.js +2 -0
- package/esm2015/src/selectors/selector-utils.js +74 -0
- package/esm2015/src/state-token/state-token.js +4 -32
- package/esm2015/src/state-token/symbols.js +2 -5
- package/esm2015/src/store.js +24 -108
- package/esm2015/src/symbols.js +7 -177
- package/esm2015/src/utils/compose.js +5 -23
- package/esm2015/src/utils/freeze.js +5 -20
- package/esm2015/src/utils/store-validators.js +3 -36
- package/esm2015/src/utils/utils.js +13 -64
- package/fesm2015/ngxs-store-internals-testing.js +38 -159
- package/fesm2015/ngxs-store-internals-testing.js.map +1 -1
- package/fesm2015/ngxs-store-internals.js +18 -100
- package/fesm2015/ngxs-store-internals.js.map +1 -1
- package/fesm2015/ngxs-store-operators.js +54 -186
- package/fesm2015/ngxs-store-operators.js.map +1 -1
- package/fesm2015/ngxs-store.js +662 -2488
- package/fesm2015/ngxs-store.js.map +1 -1
- package/index.d.ts +4 -0
- package/internals/index.d.ts +1 -1
- package/internals/internal-tokens.d.ts +2 -8
- package/internals/ngxs-bootstrapper.d.ts +4 -1
- package/internals/ngxs-store-internals.d.ts +1 -0
- package/internals/package.json +2 -5
- package/internals/testing/helpers/ngxs-test.component.d.ts +3 -0
- package/internals/testing/helpers/ngxs-test.module.d.ts +6 -0
- package/internals/testing/ngxs-store-internals-testing.d.ts +1 -0
- package/internals/testing/package.json +2 -5
- package/ngxs-store.d.ts +1 -17
- package/operators/append.d.ts +2 -3
- package/operators/compose.d.ts +2 -2
- package/operators/iif.d.ts +3 -4
- package/operators/index.d.ts +3 -2
- package/operators/insert-item.d.ts +2 -3
- package/operators/ngxs-store-operators.d.ts +1 -0
- package/operators/package.json +2 -5
- package/operators/patch.d.ts +5 -8
- package/operators/remove-item.d.ts +3 -4
- package/operators/types.d.ts +56 -0
- package/operators/update-item.d.ts +3 -4
- package/operators/utils.d.ts +2 -3
- package/package.json +4 -7
- package/src/actions/actions.d.ts +2 -2
- package/src/actions-stream.d.ts +8 -22
- package/src/decorators/select/select-factory.d.ts +3 -0
- package/src/decorators/selector/selector.d.ts +7 -2
- package/src/decorators/state.d.ts +1 -1
- package/src/dev-features/ngxs-development.module.d.ts +9 -0
- package/src/dev-features/ngxs-unhandled-actions-logger.d.ts +17 -0
- package/src/dev-features/symbols.d.ts +8 -0
- package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +3 -0
- package/src/execution/internal-ngxs-execution-strategy.d.ts +3 -0
- package/src/execution/noop-ngxs-execution-strategy.d.ts +3 -0
- package/src/internal/custom-rxjs-subjects.d.ts +37 -0
- package/src/internal/dispatcher.d.ts +5 -0
- package/src/internal/error-handler.d.ts +4 -1
- package/src/internal/lifecycle-state-manager.d.ts +3 -0
- package/src/internal/state-context-factory.d.ts +3 -0
- package/src/internal/state-factory.d.ts +7 -4
- package/src/internal/state-operations.d.ts +3 -0
- package/src/internal/state-operators.d.ts +2 -2
- package/src/internal/state-stream.d.ts +5 -2
- package/src/module.d.ts +4 -0
- package/src/modules/ngxs-feature.module.d.ts +4 -0
- package/src/modules/ngxs-root.module.d.ts +4 -0
- package/src/operators/of-action.d.ts +20 -7
- package/src/plugin-manager.d.ts +4 -1
- package/src/private_api.d.ts +2 -0
- package/src/public_api.d.ts +8 -5
- package/src/selectors/create-model-selector.d.ts +10 -0
- package/src/selectors/create-pick-selector.d.ts +6 -0
- package/src/selectors/create-property-selectors.d.ts +5 -0
- package/src/selectors/create-selector.d.ts +19 -0
- package/src/selectors/index.d.ts +5 -0
- package/src/selectors/selector-checks.util.d.ts +9 -0
- package/src/selectors/selector-metadata.d.ts +7 -0
- package/src/selectors/selector-models.d.ts +10 -0
- package/src/selectors/selector-types.util.d.ts +7 -0
- package/src/selectors/selector-utils.d.ts +9 -0
- package/src/store.d.ts +3 -0
- package/src/symbols.d.ts +7 -3
- package/src/utils/utils.d.ts +1 -1
- package/bundles/ngxs-store-internals-testing.umd.min.js +0 -16
- package/bundles/ngxs-store-internals-testing.umd.min.js.map +0 -1
- package/bundles/ngxs-store-internals.umd.min.js +0 -2
- package/bundles/ngxs-store-internals.umd.min.js.map +0 -1
- package/bundles/ngxs-store-operators.umd.min.js +0 -16
- package/bundles/ngxs-store-operators.umd.min.js.map +0 -1
- package/bundles/ngxs-store.umd.min.js +0 -16
- package/bundles/ngxs-store.umd.min.js.map +0 -1
- package/esm2015/operators/internals.js +0 -5
- package/esm2015/src/utils/selector-utils.js +0 -221
- package/esm5/index.js +0 -13
- package/esm5/internals/angular.js +0 -20
- package/esm5/internals/index.js +0 -10
- package/esm5/internals/initial-state.js +0 -45
- package/esm5/internals/internal-tokens.js +0 -16
- package/esm5/internals/memoize.js +0 -71
- package/esm5/internals/ngxs-bootstrapper.js +0 -56
- package/esm5/internals/ngxs-store-internals.js +0 -9
- package/esm5/internals/src/symbols.js +0 -14
- package/esm5/internals/symbols.js +0 -14
- package/esm5/internals/testing/fresh-platform.js +0 -121
- package/esm5/internals/testing/helpers/ngxs-test.component.js +0 -32
- package/esm5/internals/testing/helpers/ngxs-test.module.js +0 -32
- package/esm5/internals/testing/index.js +0 -8
- package/esm5/internals/testing/ngxs-store-internals-testing.js +0 -9
- package/esm5/internals/testing/ngxs.setup.js +0 -98
- package/esm5/internals/testing/skip-console-logging.js +0 -62
- package/esm5/internals/testing/symbol.js +0 -29
- package/esm5/ngxs-store.js +0 -25
- package/esm5/operators/append.js +0 -31
- package/esm5/operators/compose.js +0 -28
- package/esm5/operators/iif.js +0 -56
- package/esm5/operators/index.js +0 -18
- package/esm5/operators/insert-item.js +0 -41
- package/esm5/operators/internals.js +0 -5
- package/esm5/operators/ngxs-store-operators.js +0 -9
- package/esm5/operators/patch.js +0 -40
- package/esm5/operators/remove-item.js +0 -34
- package/esm5/operators/update-item.js +0 -52
- package/esm5/operators/utils.js +0 -50
- package/esm5/src/actions/actions.js +0 -62
- package/esm5/src/actions/symbols.js +0 -39
- package/esm5/src/actions-stream.js +0 -203
- package/esm5/src/configs/messages.config.js +0 -79
- package/esm5/src/decorators/action.js +0 -60
- package/esm5/src/decorators/select/select-factory.js +0 -46
- package/esm5/src/decorators/select/select.js +0 -50
- package/esm5/src/decorators/select/symbols.js +0 -51
- package/esm5/src/decorators/selector/selector.js +0 -59
- package/esm5/src/decorators/selector/symbols.js +0 -5
- package/esm5/src/decorators/selector-options.js +0 -34
- package/esm5/src/decorators/state.js +0 -78
- package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +0 -123
- package/esm5/src/execution/internal-ngxs-execution-strategy.js +0 -54
- package/esm5/src/execution/noop-ngxs-execution-strategy.js +0 -43
- package/esm5/src/execution/symbols.js +0 -52
- package/esm5/src/internal/dispatcher.js +0 -231
- package/esm5/src/internal/error-handler.js +0 -125
- package/esm5/src/internal/internals.js +0 -470
- package/esm5/src/internal/lifecycle-state-manager.js +0 -224
- package/esm5/src/internal/state-context-factory.js +0 -135
- package/esm5/src/internal/state-factory.js +0 -583
- package/esm5/src/internal/state-operations.js +0 -134
- package/esm5/src/internal/state-operators.js +0 -34
- package/esm5/src/internal/state-stream.js +0 -37
- package/esm5/src/ivy/ivy-enabled-in-dev-mode.js +0 -28
- package/esm5/src/module.js +0 -202
- package/esm5/src/modules/ngxs-feature.module.js +0 -65
- package/esm5/src/modules/ngxs-root.module.js +0 -44
- package/esm5/src/operators/leave-ngxs.js +0 -58
- package/esm5/src/operators/of-action.js +0 -217
- package/esm5/src/plugin-manager.js +0 -82
- package/esm5/src/plugin_api.js +0 -10
- package/esm5/src/public_api.js +0 -29
- package/esm5/src/public_to_deprecate.js +0 -64
- package/esm5/src/state-token/state-token.js +0 -57
- package/esm5/src/state-token/symbols.js +0 -5
- package/esm5/src/store.js +0 -241
- package/esm5/src/symbols.js +0 -230
- package/esm5/src/utils/compose.js +0 -55
- package/esm5/src/utils/freeze.js +0 -35
- package/esm5/src/utils/selector-utils.js +0 -230
- package/esm5/src/utils/store-validators.js +0 -78
- package/esm5/src/utils/utils.js +0 -151
- package/fesm5/ngxs-store-internals-testing.js +0 -345
- package/fesm5/ngxs-store-internals-testing.js.map +0 -1
- package/fesm5/ngxs-store-internals.js +0 -217
- package/fesm5/ngxs-store-internals.js.map +0 -1
- package/fesm5/ngxs-store-operators.js +0 -340
- package/fesm5/ngxs-store-operators.js.map +0 -1
- package/fesm5/ngxs-store.js +0 -4619
- package/fesm5/ngxs-store.js.map +0 -1
- package/internals/ngxs-store-internals.metadata.json +0 -1
- package/internals/testing/ngxs-store-internals-testing.metadata.json +0 -1
- package/ngxs-store.metadata.json +0 -1
- package/operators/internals.d.ts +0 -2
- package/operators/ngxs-store-operators.metadata.json +0 -1
- package/src/utils/selector-utils.d.ts +0 -23
- package/types/index.d.ts +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
1
2
|
import { Component, NgModule, ApplicationRef, destroyPlatform, VERSION, createPlatform } from '@angular/core';
|
|
2
3
|
import { TestBed } from '@angular/core/testing';
|
|
3
4
|
import { DOCUMENT } from '@angular/common';
|
|
@@ -6,57 +7,38 @@ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@ang
|
|
|
6
7
|
import { NgxsModule, Store } from '@ngxs/store';
|
|
7
8
|
import { __awaiter } from 'tslib';
|
|
8
9
|
|
|
9
|
-
/**
|
|
10
|
-
* @fileoverview added by tsickle
|
|
11
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
12
|
-
*/
|
|
13
10
|
class NgxsTestComponent {
|
|
14
|
-
/**
|
|
15
|
-
* @return {?}
|
|
16
|
-
*/
|
|
17
11
|
ngOnInit() { }
|
|
18
|
-
/**
|
|
19
|
-
* @return {?}
|
|
20
|
-
*/
|
|
21
12
|
ngAfterViewInit() { }
|
|
22
13
|
}
|
|
23
|
-
NgxsTestComponent
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
/** @nocollapse */ NgxsTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
+
/** @nocollapse */ NgxsTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: NgxsTestComponent, selector: "app-root", ngImport: i0, template: '', isInline: true });
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestComponent, decorators: [{
|
|
17
|
+
type: Component,
|
|
18
|
+
args: [{
|
|
19
|
+
selector: 'app-root',
|
|
20
|
+
template: ''
|
|
21
|
+
}]
|
|
22
|
+
}] });
|
|
29
23
|
|
|
30
|
-
/**
|
|
31
|
-
* @fileoverview added by tsickle
|
|
32
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
33
|
-
*/
|
|
34
24
|
class NgxsTestModule {
|
|
35
|
-
/**
|
|
36
|
-
* @param {?} app
|
|
37
|
-
* @return {?}
|
|
38
|
-
*/
|
|
39
25
|
static ngDoBootstrap(app) {
|
|
40
26
|
app.bootstrap(NgxsTestComponent);
|
|
41
27
|
}
|
|
42
28
|
}
|
|
43
|
-
NgxsTestModule
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]
|
|
29
|
+
/** @nocollapse */ NgxsTestModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
30
|
+
/** @nocollapse */ NgxsTestModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestModule, declarations: [NgxsTestComponent], imports: [BrowserModule] });
|
|
31
|
+
/** @nocollapse */ NgxsTestModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestModule, imports: [[BrowserModule]] });
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsTestModule, decorators: [{
|
|
33
|
+
type: NgModule,
|
|
34
|
+
args: [{
|
|
35
|
+
imports: [BrowserModule],
|
|
36
|
+
declarations: [NgxsTestComponent],
|
|
37
|
+
entryComponents: [NgxsTestComponent]
|
|
38
|
+
}]
|
|
39
|
+
}] });
|
|
50
40
|
|
|
51
|
-
/**
|
|
52
|
-
* @fileoverview added by tsickle
|
|
53
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
54
|
-
*/
|
|
55
41
|
class NgxsTestBed {
|
|
56
|
-
/**
|
|
57
|
-
* @param {?} options
|
|
58
|
-
* @return {?}
|
|
59
|
-
*/
|
|
60
42
|
static configureTestingStates(options) {
|
|
61
43
|
this.resetTestBed();
|
|
62
44
|
if (options.before) {
|
|
@@ -71,80 +53,42 @@ class NgxsTestBed {
|
|
|
71
53
|
}).compileComponents();
|
|
72
54
|
NgxsTestBed.ngxsBootstrap();
|
|
73
55
|
return {
|
|
74
|
-
/**
|
|
75
|
-
* @return {?}
|
|
76
|
-
*/
|
|
77
56
|
get store() {
|
|
78
57
|
return TestBed.inject(Store);
|
|
79
58
|
},
|
|
80
|
-
/**
|
|
81
|
-
* @return {?}
|
|
82
|
-
*/
|
|
83
59
|
get getTestBed() {
|
|
84
60
|
return TestBed;
|
|
85
61
|
}
|
|
86
62
|
};
|
|
87
63
|
}
|
|
88
|
-
/**
|
|
89
|
-
* @private
|
|
90
|
-
* @return {?}
|
|
91
|
-
*/
|
|
92
64
|
static ngxsBootstrap() {
|
|
93
65
|
NgxsTestBed.createRootNode();
|
|
94
66
|
NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));
|
|
95
67
|
}
|
|
96
|
-
/**
|
|
97
|
-
* @private
|
|
98
|
-
* @return {?}
|
|
99
|
-
*/
|
|
100
68
|
static resetTestBed() {
|
|
101
69
|
TestBed.resetTestEnvironment();
|
|
102
70
|
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
|
103
71
|
}
|
|
104
|
-
/**
|
|
105
|
-
* @private
|
|
106
|
-
* @param {?=} selector
|
|
107
|
-
* @return {?}
|
|
108
|
-
*/
|
|
109
72
|
static createRootNode(selector = 'app-root') {
|
|
110
|
-
/** @type {?} */
|
|
111
73
|
const document = TestBed.inject(DOCUMENT);
|
|
112
|
-
/** @type {?} */
|
|
113
74
|
const adapter = new ɵBrowserDomAdapter();
|
|
114
|
-
/** @type {?} */
|
|
115
75
|
const root = adapter.createElement(selector);
|
|
116
76
|
document.body.appendChild(root);
|
|
117
77
|
}
|
|
118
78
|
}
|
|
119
79
|
|
|
120
|
-
/**
|
|
121
|
-
* @fileoverview added by tsickle
|
|
122
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
123
|
-
*/
|
|
124
|
-
/**
|
|
125
|
-
* @return {?}
|
|
126
|
-
*/
|
|
127
80
|
function createRootElement() {
|
|
128
|
-
/** @type {?} */
|
|
129
81
|
const document = TestBed.inject(DOCUMENT);
|
|
130
|
-
/** @type {?} */
|
|
131
82
|
const root = ɵgetDOM().createElement('app-root', document);
|
|
132
83
|
document.body.appendChild(root);
|
|
133
84
|
}
|
|
134
|
-
/**
|
|
135
|
-
* @return {?}
|
|
136
|
-
*/
|
|
137
85
|
function removeRootElement() {
|
|
138
|
-
|
|
139
|
-
const root = (/** @type {?} */ (document.getElementsByTagName('app-root').item(0)));
|
|
86
|
+
const root = document.getElementsByTagName('app-root').item(0);
|
|
140
87
|
try {
|
|
141
88
|
document.body.removeChild(root);
|
|
142
89
|
}
|
|
143
90
|
catch (_a) { }
|
|
144
91
|
}
|
|
145
|
-
/**
|
|
146
|
-
* @return {?}
|
|
147
|
-
*/
|
|
148
92
|
function destroyPlatformBeforeBootstrappingTheNewOne() {
|
|
149
93
|
destroyPlatform();
|
|
150
94
|
createRootElement();
|
|
@@ -152,64 +96,40 @@ function destroyPlatformBeforeBootstrappingTheNewOne() {
|
|
|
152
96
|
// As we create our custom platform via `bootstrapModule`
|
|
153
97
|
// we have to destroy it after assetions and revert
|
|
154
98
|
// the previous one
|
|
155
|
-
/**
|
|
156
|
-
* @return {?}
|
|
157
|
-
*/
|
|
158
99
|
function resetPlatformAfterBootstrapping() {
|
|
159
100
|
removeRootElement();
|
|
160
101
|
destroyPlatform();
|
|
161
|
-
/** @type {?} */
|
|
162
102
|
const version = +VERSION.major;
|
|
163
103
|
// https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa
|
|
164
104
|
if (version < 14) {
|
|
165
105
|
createPlatform(TestBed);
|
|
166
106
|
}
|
|
167
107
|
}
|
|
168
|
-
/**
|
|
169
|
-
* @param {?} fn
|
|
170
|
-
* @return {?}
|
|
171
|
-
*/
|
|
172
108
|
function freshPlatform(fn) {
|
|
173
|
-
/** @type {?} */
|
|
174
109
|
let resolve = null;
|
|
175
|
-
/** @type {?} */
|
|
176
110
|
let reject = null;
|
|
177
|
-
/** @type {?} */
|
|
178
111
|
let whenDoneIsCalledPromise = null;
|
|
179
|
-
/** @type {?} */
|
|
180
112
|
const hasDoneArgument = fn.length === 1;
|
|
181
113
|
if (hasDoneArgument) {
|
|
182
|
-
whenDoneIsCalledPromise = new Promise((
|
|
183
|
-
* @param {?} _resolve
|
|
184
|
-
* @param {?} _reject
|
|
185
|
-
* @return {?}
|
|
186
|
-
*/
|
|
187
|
-
(_resolve, _reject) => {
|
|
114
|
+
whenDoneIsCalledPromise = new Promise((_resolve, _reject) => {
|
|
188
115
|
resolve = _resolve;
|
|
189
116
|
reject = _reject;
|
|
190
|
-
})
|
|
117
|
+
});
|
|
191
118
|
}
|
|
192
|
-
return (
|
|
193
|
-
* @return {?}
|
|
194
|
-
*/
|
|
195
|
-
function testWithAFreshPlatform() {
|
|
119
|
+
return function testWithAFreshPlatform() {
|
|
196
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
197
121
|
try {
|
|
198
122
|
destroyPlatformBeforeBootstrappingTheNewOne();
|
|
199
123
|
if (hasDoneArgument) {
|
|
200
|
-
yield fn((
|
|
201
|
-
* @param {?=} error
|
|
202
|
-
* @return {?}
|
|
203
|
-
*/
|
|
204
|
-
(error) => {
|
|
124
|
+
yield fn((error) => {
|
|
205
125
|
if (error) {
|
|
206
|
-
|
|
126
|
+
reject(error);
|
|
207
127
|
}
|
|
208
128
|
else {
|
|
209
|
-
|
|
129
|
+
resolve();
|
|
210
130
|
}
|
|
211
|
-
})
|
|
212
|
-
yield
|
|
131
|
+
});
|
|
132
|
+
yield whenDoneIsCalledPromise;
|
|
213
133
|
}
|
|
214
134
|
else {
|
|
215
135
|
yield fn();
|
|
@@ -219,61 +139,26 @@ function freshPlatform(fn) {
|
|
|
219
139
|
resetPlatformAfterBootstrapping();
|
|
220
140
|
}
|
|
221
141
|
});
|
|
222
|
-
}
|
|
142
|
+
};
|
|
223
143
|
}
|
|
224
144
|
|
|
225
|
-
/**
|
|
226
|
-
* @fileoverview added by tsickle
|
|
227
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
228
|
-
*/
|
|
229
145
|
/// <reference types="jest" />
|
|
230
|
-
/// <reference types="jest" />
|
|
231
|
-
/**
|
|
232
|
-
* @template T
|
|
233
|
-
* @param {?} fn
|
|
234
|
-
* @return {?}
|
|
235
|
-
*/
|
|
236
146
|
function skipConsoleLogging(fn) {
|
|
237
|
-
/** @type {?} */
|
|
238
147
|
const consoleSpies = [
|
|
239
|
-
jest.spyOn(console, 'log').mockImplementation((
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
() => { })
|
|
243
|
-
jest.spyOn(console, 'warn').mockImplementation((/**
|
|
244
|
-
* @return {?}
|
|
245
|
-
*/
|
|
246
|
-
() => { })),
|
|
247
|
-
jest.spyOn(console, 'error').mockImplementation((/**
|
|
248
|
-
* @return {?}
|
|
249
|
-
*/
|
|
250
|
-
() => { })),
|
|
251
|
-
jest.spyOn(console, 'info').mockImplementation((/**
|
|
252
|
-
* @return {?}
|
|
253
|
-
*/
|
|
254
|
-
() => { }))
|
|
148
|
+
jest.spyOn(console, 'log').mockImplementation(() => { }),
|
|
149
|
+
jest.spyOn(console, 'warn').mockImplementation(() => { }),
|
|
150
|
+
jest.spyOn(console, 'error').mockImplementation(() => { }),
|
|
151
|
+
jest.spyOn(console, 'info').mockImplementation(() => { })
|
|
255
152
|
];
|
|
256
|
-
/**
|
|
257
|
-
* @return {?}
|
|
258
|
-
*/
|
|
259
153
|
function restoreSpies() {
|
|
260
|
-
consoleSpies.forEach((
|
|
261
|
-
* @param {?} spy
|
|
262
|
-
* @return {?}
|
|
263
|
-
*/
|
|
264
|
-
spy => spy.mockRestore()));
|
|
154
|
+
consoleSpies.forEach(spy => spy.mockRestore());
|
|
265
155
|
}
|
|
266
|
-
/** @type {?} */
|
|
267
156
|
let restoreSpyAsync = false;
|
|
268
157
|
try {
|
|
269
|
-
/** @type {?} */
|
|
270
158
|
const returnValue = fn();
|
|
271
159
|
if (returnValue instanceof Promise) {
|
|
272
160
|
restoreSpyAsync = true;
|
|
273
|
-
return
|
|
274
|
-
* @return {?}
|
|
275
|
-
*/
|
|
276
|
-
() => restoreSpies()))));
|
|
161
|
+
return returnValue.finally(() => restoreSpies());
|
|
277
162
|
}
|
|
278
163
|
return returnValue;
|
|
279
164
|
}
|
|
@@ -285,13 +170,7 @@ function skipConsoleLogging(fn) {
|
|
|
285
170
|
}
|
|
286
171
|
|
|
287
172
|
/**
|
|
288
|
-
*
|
|
289
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* @fileoverview added by tsickle
|
|
294
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
173
|
+
* Generated bundle index. Do not edit.
|
|
295
174
|
*/
|
|
296
175
|
|
|
297
176
|
export { NgxsTestBed, freshPlatform, skipConsoleLogging };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts","ng://@ngxs/store/internals/testing/skip-console-logging.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule],\n declarations: [NgxsTestComponent],\n entryComponents: [NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\n ...(options.imports || [])\n ]\n }).compileComponents();\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { VERSION, destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\n destroyPlatform();\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n const version = +VERSION.major;\n // https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa\n if (version < 14) {\n createPlatform(TestBed);\n }\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let resolve: VoidFunction | null = null;\n let reject: ((error: Error) => void) | null = null;\n let whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n destroyPlatformBeforeBootstrappingTheNewOne();\n\n if (hasDoneArgument) {\n await fn((error?: Error) => {\n if (error) {\n reject!(error);\n } else {\n resolve!();\n }\n });\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n","/// <reference types=\"jest\" />\n\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T> {\n const consoleSpies = [\n jest.spyOn(console, 'log').mockImplementation(() => {}),\n jest.spyOn(console, 'warn').mockImplementation(() => {}),\n jest.spyOn(console, 'error').mockImplementation(() => {}),\n jest.spyOn(console, 'info').mockImplementation(() => {})\n ];\n function restoreSpies() {\n consoleSpies.forEach(spy => spy.mockRestore());\n }\n let restoreSpyAsync = false;\n try {\n const returnValue = fn();\n if (returnValue instanceof Promise) {\n restoreSpyAsync = true;\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\n }\n return returnValue;\n } finally {\n if (!restoreSpyAsync) {\n restoreSpies();\n }\n }\n}\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,MAMa,iBAAiB;;;;IACrB,QAAQ,M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E;QACxB,IAAI,WAAW,YAAY,OAAO,EAAE;YAClC,eAAe,GAAG,IAAI,CAAC;YACvB,0BAAO,WAAW,CAAC,OAAO;;;YAAC,MAAM,YAAY,EAAE,EAAC,GAAkB;SACnE;QACD,OAAO,WAAW,CAAC;KACpB;YAAS;QACR,IAAI,CAAC,eAAe,EAAE;YACpB,YAAY,EAAE,CAAC;SAChB;KACF;CACF;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-store-internals-testing.js","sources":["../../../packages/store/internals/testing/src/helpers/ngxs-test.component.ts","../../../packages/store/internals/testing/src/helpers/ngxs-test.module.ts","../../../packages/store/internals/testing/src/ngxs.setup.ts","../../../packages/store/internals/testing/src/fresh-platform.ts","../../../packages/store/internals/testing/src/skip-console-logging.ts","../../../packages/store/internals/testing/src/ngxs-store-internals-testing.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule],\n declarations: [NgxsTestComponent],\n entryComponents: [NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\n ...(options.imports || [])\n ]\n }).compileComponents();\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { VERSION, destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\n destroyPlatform();\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n const version = +VERSION.major;\n // https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa\n if (version < 14) {\n createPlatform(TestBed);\n }\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let resolve: VoidFunction | null = null;\n let reject: ((error: Error) => void) | null = null;\n let whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n destroyPlatformBeforeBootstrappingTheNewOne();\n\n if (hasDoneArgument) {\n await fn((error?: Error) => {\n if (error) {\n reject!(error);\n } else {\n resolve!();\n }\n });\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n","/// <reference types=\"jest\" />\n\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T> {\n const consoleSpies = [\n jest.spyOn(console, 'log').mockImplementation(() => {}),\n jest.spyOn(console, 'warn').mockImplementation(() => {}),\n jest.spyOn(console, 'error').mockImplementation(() => {}),\n jest.spyOn(console, 'info').mockImplementation(() => {})\n ];\n function restoreSpies() {\n consoleSpies.forEach(spy => spy.mockRestore());\n }\n let restoreSpyAsync = false;\n try {\n const returnValue = fn();\n if (returnValue instanceof Promise) {\n restoreSpyAsync = true;\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\n }\n return returnValue;\n } finally {\n if (!restoreSpyAsync) {\n restoreSpies();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;MAMa,iBAAiB,CAAA;AACrB,IAAA,QAAQ,MAAW;AACnB,IAAA,eAAe,MAAW;;kIAFtB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAjB,mBAAA,iBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA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QAAA,OAAO,WAAW,CAAC;AACpB,KAAA;AAAS,YAAA;QACR,IAAI,CAAC,eAAe,EAAE;AACpB,YAAA,YAAY,EAAE,CAAC;AAChB,SAAA;AACF,KAAA;AACH;;ACzBA;;AAEG;;;;"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
1
2
|
import { Injectable, InjectionToken } from '@angular/core';
|
|
2
3
|
import { ReplaySubject } from 'rxjs';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview added by tsickle
|
|
6
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @return {?}
|
|
10
|
-
*/
|
|
11
5
|
function isAngularInTestMode() {
|
|
12
6
|
// This is safe to check for these properties in the following way since `typeof` does not
|
|
13
7
|
// throw an exception if the value does not exist in the scope.
|
|
@@ -21,10 +15,6 @@ function isAngularInTestMode() {
|
|
|
21
15
|
typeof Mocha !== 'undefined');
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
/**
|
|
25
|
-
* @fileoverview added by tsickle
|
|
26
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
27
|
-
*/
|
|
28
18
|
class NgxsBootstrapper {
|
|
29
19
|
constructor() {
|
|
30
20
|
/**
|
|
@@ -32,58 +22,32 @@ class NgxsBootstrapper {
|
|
|
32
22
|
*/
|
|
33
23
|
this.bootstrap$ = new ReplaySubject(1);
|
|
34
24
|
}
|
|
35
|
-
/**
|
|
36
|
-
* @return {?}
|
|
37
|
-
*/
|
|
38
25
|
get appBootstrapped$() {
|
|
39
26
|
return this.bootstrap$.asObservable();
|
|
40
27
|
}
|
|
41
28
|
/**
|
|
42
29
|
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
43
30
|
* to the tree of views, that's a signal that application has been fully rendered
|
|
44
|
-
* @return {?}
|
|
45
31
|
*/
|
|
46
32
|
bootstrap() {
|
|
47
33
|
this.bootstrap$.next(true);
|
|
48
34
|
this.bootstrap$.complete();
|
|
49
35
|
}
|
|
50
36
|
}
|
|
51
|
-
NgxsBootstrapper
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
57
|
-
* @type {?}
|
|
58
|
-
* @private
|
|
59
|
-
*/
|
|
60
|
-
NgxsBootstrapper.prototype.bootstrap$;
|
|
61
|
-
}
|
|
37
|
+
/** @nocollapse */ NgxsBootstrapper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsBootstrapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
|
+
/** @nocollapse */ NgxsBootstrapper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsBootstrapper });
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsBootstrapper, decorators: [{
|
|
40
|
+
type: Injectable
|
|
41
|
+
}] });
|
|
62
42
|
|
|
63
|
-
/**
|
|
64
|
-
* @fileoverview added by tsickle
|
|
65
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* @param {?} a
|
|
69
|
-
* @param {?} b
|
|
70
|
-
* @return {?}
|
|
71
|
-
*/
|
|
72
43
|
function defaultEqualityCheck(a, b) {
|
|
73
44
|
return a === b;
|
|
74
45
|
}
|
|
75
|
-
/**
|
|
76
|
-
* @param {?} equalityCheck
|
|
77
|
-
* @param {?} prev
|
|
78
|
-
* @param {?} next
|
|
79
|
-
* @return {?}
|
|
80
|
-
*/
|
|
81
46
|
function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
|
|
82
47
|
if (prev === null || next === null || prev.length !== next.length) {
|
|
83
48
|
return false;
|
|
84
49
|
}
|
|
85
50
|
// Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
|
|
86
|
-
/** @type {?} */
|
|
87
51
|
const length = prev.length;
|
|
88
52
|
for (let i = 0; i < length; i++) {
|
|
89
53
|
if (!equalityCheck(prev[i], next[i])) {
|
|
@@ -97,96 +61,50 @@ function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
|
|
|
97
61
|
* Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
|
|
98
62
|
*
|
|
99
63
|
* @ignore
|
|
100
|
-
* @template T
|
|
101
|
-
* @param {?} func
|
|
102
|
-
* @param {?=} equalityCheck
|
|
103
|
-
* @return {?}
|
|
104
64
|
*/
|
|
105
65
|
function memoize(func, equalityCheck = defaultEqualityCheck) {
|
|
106
|
-
/** @type {?} */
|
|
107
66
|
let lastArgs = null;
|
|
108
|
-
/** @type {?} */
|
|
109
67
|
let lastResult = null;
|
|
110
68
|
// we reference arguments instead of spreading them for performance reasons
|
|
111
|
-
/**
|
|
112
|
-
* @return {?}
|
|
113
|
-
*/
|
|
114
69
|
function memoized() {
|
|
70
|
+
// eslint-disable-next-line prefer-rest-params
|
|
115
71
|
if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
|
|
116
72
|
// apply arguments instead of spreading for performance.
|
|
117
|
-
|
|
73
|
+
// eslint-disable-next-line prefer-rest-params, prefer-spread
|
|
74
|
+
lastResult = func.apply(null, arguments);
|
|
118
75
|
}
|
|
76
|
+
// eslint-disable-next-line prefer-rest-params
|
|
119
77
|
lastArgs = arguments;
|
|
120
78
|
return lastResult;
|
|
121
79
|
}
|
|
122
|
-
|
|
123
|
-
* @return {?}
|
|
124
|
-
*/
|
|
125
|
-
function () {
|
|
80
|
+
memoized.reset = function () {
|
|
126
81
|
// The hidden (for now) ability to reset the memoization
|
|
127
82
|
lastArgs = null;
|
|
128
83
|
lastResult = null;
|
|
129
|
-
}
|
|
130
|
-
return
|
|
84
|
+
};
|
|
85
|
+
return memoized;
|
|
131
86
|
}
|
|
132
87
|
|
|
133
|
-
/**
|
|
134
|
-
* @fileoverview added by tsickle
|
|
135
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
136
|
-
*/
|
|
137
|
-
/** @type {?} */
|
|
138
88
|
const INITIAL_STATE_TOKEN = new InjectionToken('INITIAL_STATE_TOKEN');
|
|
139
89
|
class InitialState {
|
|
140
|
-
/**
|
|
141
|
-
* @param {?} state
|
|
142
|
-
* @return {?}
|
|
143
|
-
*/
|
|
144
90
|
static set(state) {
|
|
145
91
|
this.value = state;
|
|
146
92
|
}
|
|
147
|
-
/**
|
|
148
|
-
* @return {?}
|
|
149
|
-
*/
|
|
150
93
|
static pop() {
|
|
151
|
-
/** @type {?} */
|
|
152
94
|
const state = this.value;
|
|
153
95
|
this.value = {};
|
|
154
96
|
return state;
|
|
155
97
|
}
|
|
156
98
|
}
|
|
157
99
|
InitialState.value = {};
|
|
158
|
-
if (false) {
|
|
159
|
-
/**
|
|
160
|
-
* @type {?}
|
|
161
|
-
* @private
|
|
162
|
-
*/
|
|
163
|
-
InitialState.value;
|
|
164
|
-
}
|
|
165
100
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*/
|
|
170
|
-
/**
|
|
171
|
-
* @see StateContextFactory as it's referenced by this token to be accessed by plugins internally
|
|
172
|
-
* @type {?}
|
|
173
|
-
*/
|
|
174
|
-
const NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFactory');
|
|
175
|
-
/**
|
|
176
|
-
* @see StateFactory as it's referenced by this token to be accessed by plugins internally
|
|
177
|
-
* @type {?}
|
|
178
|
-
*/
|
|
179
|
-
const NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @fileoverview added by tsickle
|
|
183
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
184
|
-
*/
|
|
101
|
+
// These tokens are internal and can change at any point.
|
|
102
|
+
const ɵNGXS_STATE_FACTORY = new InjectionToken('ɵNGXS_STATE_FACTORY');
|
|
103
|
+
const ɵNGXS_STATE_CONTEXT_FACTORY = new InjectionToken('ɵNGXS_STATE_CONTEXT_FACTORY');
|
|
185
104
|
|
|
186
105
|
/**
|
|
187
|
-
*
|
|
188
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
106
|
+
* Generated bundle index. Do not edit.
|
|
189
107
|
*/
|
|
190
108
|
|
|
191
|
-
export { INITIAL_STATE_TOKEN, InitialState,
|
|
109
|
+
export { INITIAL_STATE_TOKEN, InitialState, NgxsBootstrapper, isAngularInTestMode, memoize, ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY };
|
|
192
110
|
//# sourceMappingURL=ngxs-store-internals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-store-internals.js","sources":["
|
|
1
|
+
{"version":3,"file":"ngxs-store-internals.js","sources":["../../../packages/store/internals/src/angular.ts","../../../packages/store/internals/src/ngxs-bootstrapper.ts","../../../packages/store/internals/src/memoize.ts","../../../packages/store/internals/src/initial-state.ts","../../../packages/store/internals/src/internal-tokens.ts","../../../packages/store/internals/src/ngxs-store-internals.ts"],"sourcesContent":["declare const __karma__: unknown;\ndeclare const jasmine: unknown;\ndeclare const jest: unknown;\ndeclare const Mocha: unknown;\n\nexport function isAngularInTestMode(): boolean {\n // This is safe to check for these properties in the following way since `typeof` does not\n // throw an exception if the value does not exist in the scope.\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\n return (\n typeof __karma__ !== 'undefined' ||\n typeof jasmine !== 'undefined' ||\n typeof jest !== 'undefined' ||\n typeof Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n // eslint-disable-next-line prefer-rest-params\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n // eslint-disable-next-line prefer-rest-params, prefer-spread\n lastResult = (<Function>func).apply(null, arguments);\n }\n // eslint-disable-next-line prefer-rest-params\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n// These tokens are internal and can change at any point.\n\nexport const ɵNGXS_STATE_FACTORY = new InjectionToken<any>('ɵNGXS_STATE_FACTORY');\n\nexport const ɵNGXS_STATE_CONTEXT_FACTORY = new InjectionToken<any>(\n 'ɵNGXS_STATE_CONTEXT_FACTORY'\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAKgB,mBAAmB,GAAA;;;;;;;AAOjC,IAAA,QACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,IAAI,KAAK,WAAW;AAC3B,QAAA,OAAO,KAAK,KAAK,WAAW,EAC5B;AACJ;;MCda,gBAAgB,CAAA;AAD7B,IAAA,WAAA,GAAA;AAEE;;AAEG;AACK,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;AAcpD,KAAA;AAZC,IAAA,IAAI,gBAAgB,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;KACvC;AAED;;;AAGG;IACH,SAAS,GAAA;AACP,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,QAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;iIAjBU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA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