@ngxs/store 3.8.2-dev.master-0fd1fe5 → 3.8.2
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 +684 -0
- package/bundles/ngxs-store-internals-testing.umd.js.map +1 -0
- package/bundles/ngxs-store-internals.umd.js +141 -0
- package/bundles/ngxs-store-internals.umd.js.map +1 -0
- package/bundles/ngxs-store-operators.umd.js +224 -0
- package/bundles/ngxs-store-operators.umd.js.map +1 -0
- package/bundles/ngxs-store.umd.js +3076 -0
- package/bundles/ngxs-store.umd.js.map +1 -0
- package/esm2015/internals/index.js +5 -0
- package/esm2015/internals/initial-state.js +17 -0
- package/esm2015/internals/internal-tokens.js +5 -0
- package/{esm2020/internals/ngxs-bootstrapper.mjs → esm2015/internals/ngxs-bootstrapper.js} +4 -4
- package/esm2015/internals/src/symbols.js +2 -0
- package/esm2015/internals/symbols.js +2 -0
- package/esm2015/internals/testing/fresh-platform.js +70 -0
- package/{esm2020/internals/testing/helpers/ngxs-test.component.mjs → esm2015/internals/testing/helpers/ngxs-test.component.js} +4 -4
- package/esm2015/internals/testing/helpers/ngxs-test.module.js +21 -0
- package/{esm2020/internals/testing/ngxs.setup.mjs → esm2015/internals/testing/ngxs.setup.js} +2 -4
- package/esm2015/internals/testing/symbol.js +2 -0
- package/esm2015/operators/patch.js +21 -0
- package/{esm2020/src/actions-stream.mjs → esm2015/src/actions-stream.js} +7 -7
- package/esm2015/src/configs/messages.config.js +36 -0
- package/{esm2020/src/decorators/select/select-factory.mjs → esm2015/src/decorators/select/select-factory.js} +4 -4
- package/esm2015/src/decorators/selector/selector.js +32 -0
- package/esm2015/src/decorators/state.js +36 -0
- package/{esm2020/src/dev-features/ngxs-development.module.mjs → esm2015/src/dev-features/ngxs-development.module.js} +5 -5
- package/{esm2020/src/dev-features/ngxs-unhandled-actions-logger.mjs → esm2015/src/dev-features/ngxs-unhandled-actions-logger.js} +4 -4
- package/{esm2020/src/execution/dispatch-outside-zone-ngxs-execution-strategy.mjs → esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js} +4 -4
- package/{esm2020/src/execution/internal-ngxs-execution-strategy.mjs → esm2015/src/execution/internal-ngxs-execution-strategy.js} +4 -4
- package/{esm2020/src/execution/noop-ngxs-execution-strategy.mjs → esm2015/src/execution/noop-ngxs-execution-strategy.js} +4 -4
- package/esm2015/src/execution/symbols.js +23 -0
- package/{esm2020/src/internal/dispatcher.mjs → esm2015/src/internal/dispatcher.js} +11 -11
- package/{esm2020/src/internal/error-handler.mjs → esm2015/src/internal/error-handler.js} +5 -5
- package/esm2015/src/internal/internals.js +248 -0
- package/esm2015/src/internal/lifecycle-state-manager.js +79 -0
- package/{esm2020/src/internal/state-context-factory.mjs → esm2015/src/internal/state-context-factory.js} +4 -4
- package/esm2015/src/internal/state-factory.js +288 -0
- package/{esm2020/src/internal/state-operations.mjs → esm2015/src/internal/state-operations.js} +5 -5
- package/esm2015/src/internal/state-operators.js +20 -0
- package/esm2015/src/internal/state-stream.js +25 -0
- package/{esm2020/src/ivy/ivy-enabled-in-dev-mode.mjs → esm2015/src/ivy/ivy-enabled-in-dev-mode.js} +2 -2
- package/esm2015/src/module.js +88 -0
- package/esm2015/src/modules/ngxs-feature.module.js +45 -0
- package/esm2015/src/modules/ngxs-root.module.js +41 -0
- package/{esm2020/src/operators/of-action.mjs → esm2015/src/operators/of-action.js} +10 -10
- package/{esm2020/src/plugin-manager.mjs → esm2015/src/plugin-manager.js} +4 -4
- package/esm2015/src/public_api.js +27 -0
- package/esm2015/src/selectors/create-property-selectors.js +20 -0
- package/esm2015/src/selectors/selector-metadata.js +30 -0
- package/esm2015/src/selectors/selector-types.util.js +2 -0
- package/{esm2020/src/store.mjs → esm2015/src/store.js} +5 -6
- package/esm2015/src/symbols.js +58 -0
- package/esm2015/src/utils/utils.js +92 -0
- package/fesm2015/{ngxs-store-internals-testing.mjs → ngxs-store-internals-testing.js} +13 -19
- package/fesm2015/ngxs-store-internals-testing.js.map +1 -0
- package/{fesm2020/ngxs-store-internals.mjs → fesm2015/ngxs-store-internals.js} +8 -21
- package/fesm2015/ngxs-store-internals.js.map +1 -0
- package/fesm2015/{ngxs-store-operators.mjs → ngxs-store-operators.js} +1 -1
- package/fesm2015/ngxs-store-operators.js.map +1 -0
- package/{fesm2020/ngxs-store.mjs → fesm2015/ngxs-store.js} +1029 -1192
- package/fesm2015/ngxs-store.js.map +1 -0
- package/internals/index.d.ts +1 -1
- package/internals/initial-state.d.ts +1 -1
- package/internals/ngxs-store-internals.d.ts +5 -0
- package/internals/package.json +10 -0
- package/internals/src/symbols.d.ts +1 -4
- package/internals/symbols.d.ts +1 -4
- package/internals/testing/helpers/ngxs-test.component.d.ts +1 -1
- package/internals/testing/ngxs-store-internals-testing.d.ts +5 -0
- package/internals/testing/package.json +10 -0
- package/internals/testing/symbol.d.ts +2 -2
- package/ngxs-store.d.ts +5 -0
- package/operators/ngxs-store-operators.d.ts +5 -0
- package/operators/package.json +10 -0
- package/package.json +11 -48
- package/src/configs/messages.config.d.ts +0 -2
- package/src/decorators/state.d.ts +2 -2
- package/src/execution/symbols.d.ts +2 -8
- package/src/internal/internals.d.ts +5 -5
- package/src/internal/lifecycle-state-manager.d.ts +1 -3
- package/src/module.d.ts +14 -3
- package/src/modules/ngxs-feature.module.d.ts +9 -2
- package/src/modules/ngxs-root.module.d.ts +9 -2
- package/src/public_api.d.ts +4 -5
- package/src/selectors/selector-types.util.d.ts +3 -3
- package/src/symbols.d.ts +8 -5
- package/esm2020/internals/index.mjs +0 -6
- package/esm2020/internals/initial-state.mjs +0 -18
- package/esm2020/internals/internal-tokens.mjs +0 -6
- package/esm2020/internals/src/symbols.mjs +0 -11
- package/esm2020/internals/symbols.mjs +0 -11
- package/esm2020/internals/testing/fresh-platform.mjs +0 -72
- package/esm2020/internals/testing/helpers/ngxs-test.module.mjs +0 -20
- package/esm2020/internals/testing/symbol.mjs +0 -2
- package/esm2020/operators/patch.mjs +0 -21
- package/esm2020/src/configs/messages.config.mjs +0 -48
- package/esm2020/src/decorators/selector/selector.mjs +0 -32
- package/esm2020/src/decorators/state.mjs +0 -36
- package/esm2020/src/execution/symbols.mjs +0 -27
- package/esm2020/src/internal/internals.mjs +0 -248
- package/esm2020/src/internal/lifecycle-state-manager.mjs +0 -97
- package/esm2020/src/internal/state-factory.mjs +0 -292
- package/esm2020/src/internal/state-operators.mjs +0 -20
- package/esm2020/src/internal/state-stream.mjs +0 -27
- package/esm2020/src/module.mjs +0 -27
- package/esm2020/src/modules/ngxs-feature.module.mjs +0 -18
- package/esm2020/src/modules/ngxs-root.module.mjs +0 -18
- package/esm2020/src/public_api.mjs +0 -28
- package/esm2020/src/selectors/create-property-selectors.mjs +0 -20
- package/esm2020/src/selectors/selector-metadata.mjs +0 -35
- package/esm2020/src/selectors/selector-types.util.mjs +0 -2
- package/esm2020/src/standalone-features/feature-providers.mjs +0 -20
- package/esm2020/src/standalone-features/index.mjs +0 -4
- package/esm2020/src/standalone-features/initializers.mjs +0 -86
- package/esm2020/src/standalone-features/plugin.mjs +0 -20
- package/esm2020/src/standalone-features/provide-states.mjs +0 -26
- package/esm2020/src/standalone-features/provide-store.mjs +0 -26
- package/esm2020/src/standalone-features/root-providers.mjs +0 -47
- package/esm2020/src/symbols.mjs +0 -65
- package/esm2020/src/utils/utils.mjs +0 -92
- package/fesm2015/ngxs-store-internals-testing.mjs.map +0 -1
- package/fesm2015/ngxs-store-internals.mjs +0 -114
- package/fesm2015/ngxs-store-internals.mjs.map +0 -1
- package/fesm2015/ngxs-store-operators.mjs.map +0 -1
- package/fesm2015/ngxs-store.mjs +0 -2454
- package/fesm2015/ngxs-store.mjs.map +0 -1
- package/fesm2020/ngxs-store-internals-testing.mjs +0 -180
- package/fesm2020/ngxs-store-internals-testing.mjs.map +0 -1
- package/fesm2020/ngxs-store-internals.mjs.map +0 -1
- package/fesm2020/ngxs-store-operators.mjs +0 -202
- package/fesm2020/ngxs-store-operators.mjs.map +0 -1
- package/fesm2020/ngxs-store.mjs.map +0 -1
- package/schematics/collection.json +0 -36
- package/schematics/src/actions/actions.factory.d.ts +0 -3
- package/schematics/src/actions/actions.factory.js +0 -22
- package/schematics/src/actions/actions.factory.js.map +0 -1
- package/schematics/src/actions/files/__name__.actions.ts__template__ +0 -4
- package/schematics/src/actions/schema.json +0 -28
- package/schematics/src/ng-add/add-declaration.d.ts +0 -4
- package/schematics/src/ng-add/add-declaration.js +0 -109
- package/schematics/src/ng-add/add-declaration.js.map +0 -1
- package/schematics/src/ng-add/ng-add.factory.d.ts +0 -9
- package/schematics/src/ng-add/ng-add.factory.js +0 -86
- package/schematics/src/ng-add/ng-add.factory.js.map +0 -1
- package/schematics/src/ng-add/schema.json +0 -72
- package/schematics/src/starter-kit/files/store/auth/auth.actions.ts__template__ +0 -7
- package/schematics/src/starter-kit/files/store/auth/auth.state.spec.ts__template__ +0 -46
- package/schematics/src/starter-kit/files/store/auth/auth.state.ts__template__ +0 -45
- package/schematics/src/starter-kit/files/store/dashboard/index.ts__template__ +0 -11
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.actions.ts__template__ +0 -13
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.spec.ts__template__ +0 -77
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.ts__template__ +0 -60
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.actions.ts__template__ +0 -6
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.spec.ts__template__ +0 -54
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.ts__template__ +0 -40
- package/schematics/src/starter-kit/files/store/store.config.ts__template__ +0 -38
- package/schematics/src/starter-kit/files/store/store.module.ts__template__ +0 -22
- package/schematics/src/starter-kit/schema.json +0 -18
- package/schematics/src/starter-kit/starter-kit.factory.d.ts +0 -3
- package/schematics/src/starter-kit/starter-kit.factory.js +0 -12
- package/schematics/src/starter-kit/starter-kit.factory.js.map +0 -1
- package/schematics/src/state/files/__name__.state.spec.ts__template__ +0 -22
- package/schematics/src/state/files/__name__.state.ts__template__ +0 -20
- package/schematics/src/state/schema.json +0 -33
- package/schematics/src/state/state.factory.d.ts +0 -3
- package/schematics/src/state/state.factory.js +0 -20
- package/schematics/src/state/state.factory.js.map +0 -1
- package/schematics/src/store/files/__name__.actions.ts__template__ +0 -4
- package/schematics/src/store/files/__name__.state.spec.ts__template__ +0 -24
- package/schematics/src/store/files/__name__.state.ts__template__ +0 -27
- package/schematics/src/store/schema.json +0 -33
- package/schematics/src/store/store.factory.d.ts +0 -3
- package/schematics/src/store/store.factory.js +0 -20
- package/schematics/src/store/store.factory.js.map +0 -1
- package/schematics/src/utils/common/lib.config.d.ts +0 -10
- package/schematics/src/utils/common/lib.config.js +0 -15
- package/schematics/src/utils/common/lib.config.js.map +0 -1
- package/schematics/src/utils/common/project-files.config.d.ts +0 -3
- package/schematics/src/utils/common/project-files.config.js +0 -7
- package/schematics/src/utils/common/project-files.config.js.map +0 -1
- package/schematics/src/utils/common/properties.d.ts +0 -1
- package/schematics/src/utils/common/properties.js +0 -8
- package/schematics/src/utils/common/properties.js.map +0 -1
- package/schematics/src/utils/config.d.ts +0 -119
- package/schematics/src/utils/config.js +0 -21
- package/schematics/src/utils/config.js.map +0 -1
- package/schematics/src/utils/generate-utils.d.ts +0 -4
- package/schematics/src/utils/generate-utils.js +0 -14
- package/schematics/src/utils/generate-utils.js.map +0 -1
- package/schematics/src/utils/interfaces/package.interface.d.ts +0 -7
- package/schematics/src/utils/interfaces/package.interface.js +0 -3
- package/schematics/src/utils/interfaces/package.interface.js.map +0 -1
- package/schematics/src/utils/ng-utils/README.md +0 -1
- package/schematics/src/utils/ng-utils/ast-utils.d.ts +0 -99
- package/schematics/src/utils/ng-utils/ast-utils.js +0 -517
- package/schematics/src/utils/ng-utils/ast-utils.js.map +0 -1
- package/schematics/src/utils/ng-utils/ng-ast-utils.d.ts +0 -5
- package/schematics/src/utils/ng-utils/ng-ast-utils.js +0 -67
- package/schematics/src/utils/ng-utils/ng-ast-utils.js.map +0 -1
- package/schematics/src/utils/ng-utils/project.d.ts +0 -2
- package/schematics/src/utils/ng-utils/project.js +0 -21
- package/schematics/src/utils/ng-utils/project.js.map +0 -1
- package/schematics/src/utils/ng-utils/standalone/app_config.d.ts +0 -16
- package/schematics/src/utils/ng-utils/standalone/app_config.js +0 -84
- package/schematics/src/utils/ng-utils/standalone/app_config.js.map +0 -1
- package/schematics/src/utils/ng-utils/standalone/code_block.d.ts +0 -46
- package/schematics/src/utils/ng-utils/standalone/code_block.js +0 -73
- package/schematics/src/utils/ng-utils/standalone/code_block.js.map +0 -1
- package/schematics/src/utils/ng-utils/standalone/index.d.ts +0 -1
- package/schematics/src/utils/ng-utils/standalone/index.js +0 -7
- package/schematics/src/utils/ng-utils/standalone/index.js.map +0 -1
- package/schematics/src/utils/ng-utils/standalone/rules.d.ts +0 -38
- package/schematics/src/utils/ng-utils/standalone/rules.js +0 -195
- package/schematics/src/utils/ng-utils/standalone/rules.js.map +0 -1
- package/schematics/src/utils/ng-utils/standalone/util.d.ts +0 -28
- package/schematics/src/utils/ng-utils/standalone/util.js +0 -138
- package/schematics/src/utils/ng-utils/standalone/util.js.map +0 -1
- package/schematics/src/utils/normalize-options.d.ts +0 -9
- package/schematics/src/utils/normalize-options.js +0 -24
- package/schematics/src/utils/normalize-options.js.map +0 -1
- package/schematics/src/utils/project.d.ts +0 -16
- package/schematics/src/utils/project.js +0 -40
- package/schematics/src/utils/project.js.map +0 -1
- package/schematics/src/utils/versions.json +0 -3
- package/src/standalone-features/feature-providers.d.ts +0 -7
- package/src/standalone-features/index.d.ts +0 -3
- package/src/standalone-features/initializers.d.ts +0 -29
- package/src/standalone-features/plugin.d.ts +0 -17
- package/src/standalone-features/provide-states.d.ts +0 -18
- package/src/standalone-features/provide-store.d.ts +0 -22
- package/src/standalone-features/root-providers.d.ts +0 -8
- /package/{esm2020/index.mjs → esm2015/index.js} +0 -0
- /package/{esm2020/internals/memoize.mjs → esm2015/internals/memoize.js} +0 -0
- /package/{esm2020/internals/ngxs-store-internals.mjs → esm2015/internals/ngxs-store-internals.js} +0 -0
- /package/{esm2020/internals/testing/index.mjs → esm2015/internals/testing/index.js} +0 -0
- /package/{esm2020/internals/testing/ngxs-store-internals-testing.mjs → esm2015/internals/testing/ngxs-store-internals-testing.js} +0 -0
- /package/{esm2020/internals/testing/skip-console-logging.mjs → esm2015/internals/testing/skip-console-logging.js} +0 -0
- /package/{esm2020/ngxs-store.mjs → esm2015/ngxs-store.js} +0 -0
- /package/{esm2020/operators/append.mjs → esm2015/operators/append.js} +0 -0
- /package/{esm2020/operators/compose.mjs → esm2015/operators/compose.js} +0 -0
- /package/{esm2020/operators/iif.mjs → esm2015/operators/iif.js} +0 -0
- /package/{esm2020/operators/index.mjs → esm2015/operators/index.js} +0 -0
- /package/{esm2020/operators/insert-item.mjs → esm2015/operators/insert-item.js} +0 -0
- /package/{esm2020/operators/ngxs-store-operators.mjs → esm2015/operators/ngxs-store-operators.js} +0 -0
- /package/{esm2020/operators/remove-item.mjs → esm2015/operators/remove-item.js} +0 -0
- /package/{esm2020/operators/types.mjs → esm2015/operators/types.js} +0 -0
- /package/{esm2020/operators/update-item.mjs → esm2015/operators/update-item.js} +0 -0
- /package/{esm2020/operators/utils.mjs → esm2015/operators/utils.js} +0 -0
- /package/{esm2020/src/actions/actions.mjs → esm2015/src/actions/actions.js} +0 -0
- /package/{esm2020/src/actions/symbols.mjs → esm2015/src/actions/symbols.js} +0 -0
- /package/{esm2020/src/decorators/action.mjs → esm2015/src/decorators/action.js} +0 -0
- /package/{esm2020/src/decorators/select/select.mjs → esm2015/src/decorators/select/select.js} +0 -0
- /package/{esm2020/src/decorators/select/symbols.mjs → esm2015/src/decorators/select/symbols.js} +0 -0
- /package/{esm2020/src/decorators/selector/symbols.mjs → esm2015/src/decorators/selector/symbols.js} +0 -0
- /package/{esm2020/src/decorators/selector-options.mjs → esm2015/src/decorators/selector-options.js} +0 -0
- /package/{esm2020/src/dev-features/symbols.mjs → esm2015/src/dev-features/symbols.js} +0 -0
- /package/{esm2020/src/internal/custom-rxjs-subjects.mjs → esm2015/src/internal/custom-rxjs-subjects.js} +0 -0
- /package/{esm2020/src/operators/leave-ngxs.mjs → esm2015/src/operators/leave-ngxs.js} +0 -0
- /package/{esm2020/src/plugin_api.mjs → esm2015/src/plugin_api.js} +0 -0
- /package/{esm2020/src/private_api.mjs → esm2015/src/private_api.js} +0 -0
- /package/{esm2020/src/public_to_deprecate.mjs → esm2015/src/public_to_deprecate.js} +0 -0
- /package/{esm2020/src/selectors/create-model-selector.mjs → esm2015/src/selectors/create-model-selector.js} +0 -0
- /package/{esm2020/src/selectors/create-pick-selector.mjs → esm2015/src/selectors/create-pick-selector.js} +0 -0
- /package/{esm2020/src/selectors/create-selector.mjs → esm2015/src/selectors/create-selector.js} +0 -0
- /package/{esm2020/src/selectors/index.mjs → esm2015/src/selectors/index.js} +0 -0
- /package/{esm2020/src/selectors/selector-checks.util.mjs → esm2015/src/selectors/selector-checks.util.js} +0 -0
- /package/{esm2020/src/selectors/selector-models.mjs → esm2015/src/selectors/selector-models.js} +0 -0
- /package/{esm2020/src/selectors/selector-utils.mjs → esm2015/src/selectors/selector-utils.js} +0 -0
- /package/{esm2020/src/state-token/state-token.mjs → esm2015/src/state-token/state-token.js} +0 -0
- /package/{esm2020/src/state-token/symbols.mjs → esm2015/src/state-token/symbols.js} +0 -0
- /package/{esm2020/src/utils/compose.mjs → esm2015/src/utils/compose.js} +0 -0
- /package/{esm2020/src/utils/freeze.mjs → esm2015/src/utils/freeze.js} +0 -0
- /package/{esm2020/src/utils/store-validators.mjs → esm2015/src/utils/store-validators.js} +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.addDeclarationToNonStandaloneApp = exports.addDeclarationToStandaloneApp = void 0;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const rules_1 = require("../utils/ng-utils/standalone/rules");
|
|
15
|
-
const util_1 = require("../utils/ng-utils/standalone/util");
|
|
16
|
-
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
17
|
-
const app_config_1 = require("../utils/ng-utils/standalone/app_config");
|
|
18
|
-
const lib_config_1 = require("../utils/common/lib.config");
|
|
19
|
-
function addDeclarationToStandaloneApp(options) {
|
|
20
|
-
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
var _a;
|
|
22
|
-
const mainFilePath = yield (0, util_1.getMainFilePath)(host, options.project);
|
|
23
|
-
const bootstrapCall = (0, util_1.findBootstrapApplicationCall)(host, mainFilePath);
|
|
24
|
-
const appConfigFilePath = ((_a = (0, app_config_1.findAppConfig)(bootstrapCall, host, mainFilePath)) === null || _a === void 0 ? void 0 : _a.filePath) || mainFilePath;
|
|
25
|
-
const plugins = options.plugins
|
|
26
|
-
.filter(p => pluginData.has(p))
|
|
27
|
-
.map((p) => [p, pluginData.get(p).standalone]);
|
|
28
|
-
const importPluginRules = plugins.map(([plugin, standaloneDeclaration]) => {
|
|
29
|
-
return importTree => {
|
|
30
|
-
const change = (0, ast_utils_1.insertImport)((0, util_1.getSourceFile)(host, appConfigFilePath), appConfigFilePath, standaloneDeclaration, plugin);
|
|
31
|
-
(0, util_1.applyChangesToFile)(importTree, appConfigFilePath, [change]);
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
const pluginDeclarations = plugins
|
|
35
|
-
.map(([, standaloneDeclaration]) => `${standaloneDeclaration}()`)
|
|
36
|
-
.join(',\n');
|
|
37
|
-
return (0, schematics_1.chain)([
|
|
38
|
-
...importPluginRules,
|
|
39
|
-
(0, rules_1.addRootProvider)(options.project, ({ code, external }) => code `${external('provideStore', '@ngxs/store')}(\n[],\n${pluginDeclarations})`)
|
|
40
|
-
]);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
exports.addDeclarationToStandaloneApp = addDeclarationToStandaloneApp;
|
|
44
|
-
function addDeclarationToNonStandaloneApp(options) {
|
|
45
|
-
const pluginRules = options.plugins
|
|
46
|
-
.map(p => { var _a; return [p, (_a = pluginData.get(p)) === null || _a === void 0 ? void 0 : _a.module]; })
|
|
47
|
-
.filter((v) => !!v[1])
|
|
48
|
-
.map(([plugin, moduleName]) => {
|
|
49
|
-
return (0, rules_1.addRootImport)(options.project, ({ code, external }) => code `${external(moduleName, plugin)}.forRoot()`);
|
|
50
|
-
});
|
|
51
|
-
const importPath = '@ngxs/store';
|
|
52
|
-
const moduleImportExtras = '.forRoot([], { developmentMode: /** !environment.production */ false, selectorOptions: { suppressErrors: false, injectContainerState: false } })';
|
|
53
|
-
return (0, schematics_1.chain)([
|
|
54
|
-
(0, rules_1.addRootImport)(options.project, ({ code, external }) => code `${external('NgxsModule', importPath)}${moduleImportExtras}`),
|
|
55
|
-
...pluginRules
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
exports.addDeclarationToNonStandaloneApp = addDeclarationToNonStandaloneApp;
|
|
59
|
-
const pluginData = new Map([
|
|
60
|
-
[
|
|
61
|
-
lib_config_1.LIBRARIES.DEVTOOLS,
|
|
62
|
-
{
|
|
63
|
-
module: 'NgxsReduxDevtoolsPluginModule',
|
|
64
|
-
standalone: 'withNgxsReduxDevtoolsPlugin'
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
[
|
|
68
|
-
lib_config_1.LIBRARIES.FORM,
|
|
69
|
-
{
|
|
70
|
-
module: 'NgxsFormPluginModule',
|
|
71
|
-
standalone: 'withNgxsFormPlugin'
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
[
|
|
75
|
-
lib_config_1.LIBRARIES.LOGGER,
|
|
76
|
-
{
|
|
77
|
-
module: 'NgxsLoggerPluginModule',
|
|
78
|
-
standalone: 'withNgxsLoggerPlugin'
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
lib_config_1.LIBRARIES.ROUTER,
|
|
83
|
-
{
|
|
84
|
-
module: 'NgxsRouterPluginModule',
|
|
85
|
-
standalone: 'withNgxsRouterPlugin'
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
lib_config_1.LIBRARIES.STORAGE,
|
|
90
|
-
{
|
|
91
|
-
module: 'NgxsStoragePluginModule',
|
|
92
|
-
standalone: 'withNgxsStoragePlugin'
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
[
|
|
96
|
-
lib_config_1.LIBRARIES.STORE,
|
|
97
|
-
{
|
|
98
|
-
standalone: 'provideStore'
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
[
|
|
102
|
-
lib_config_1.LIBRARIES.WEBSOCKET,
|
|
103
|
-
{
|
|
104
|
-
module: 'NgxsWebsocketPluginModule',
|
|
105
|
-
standalone: 'withNgxsWebSocketPlugin'
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
]);
|
|
109
|
-
//# sourceMappingURL=add-declaration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-declaration.js","sourceRoot":"","sources":["../../../../../packages/store/schematics/src/ng-add/add-declaration.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAyD;AACzD,8DAAo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AAC,CAAC;AACL,CAAC;AAvBD,4EAuBC;AAED,MAAM,UAAU,GAAoE,IAAI,GAAG,CAAC;IAC1F;QACE,sBAAS,CAAC,QAAQ;QAClB;YACE,MAAM,EAAE,+BAA+B;YACvC,UAAU,EAAE,6BAA6B;SAC1C;KACF;IACD;QACE,sBAAS,CAAC,IAAI;QACd;YACE,MAAM,EAAE,sBAAsB;YAC9B,UAAU,EAAE,oBAAoB;SACjC;KACF;IACD;QACE,sBAAS,CAAC,MAAM;QAChB;YACE,MAAM,EAAE,wBAAwB;YAChC,UAAU,EAAE,sBAAsB;SACnC;KACF;IACD;QACE,sBAAS,CAAC,MAAM;QAChB;YACE,MAAM,EAAE,wBAAwB;YAChC,UAAU,EAAE,sBAAsB;SACnC;KACF;IACD;QACE,sBAAS,CAAC,OAAO;QACjB;YACE,MAAM,EAAE,yBAAyB;YACjC,UAAU,EAAE,uBAAuB;SACpC;KACF;IACD;QACE,sBAAS,CAAC,KAAK;QACf;YACE,UAAU,EAAE,cAAc;SAC3B;KACF;IACD;QACE,sBAAS,CAAC,SAAS;QACnB;YACE,MAAM,EAAE,2BAA2B;YACnC,UAAU,EAAE,yBAAyB;SACtC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
import { LIBRARIES } from '../utils/common/lib.config';
|
|
3
|
-
import { NgxsPackageSchema } from './ng-add.schema';
|
|
4
|
-
export declare type NormalizedNgxsPackageSchema = {
|
|
5
|
-
skipInstall: boolean;
|
|
6
|
-
plugins: LIBRARIES[];
|
|
7
|
-
project: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function ngAdd(options: NgxsPackageSchema): Rule;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ngAdd = void 0;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
15
|
-
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
16
|
-
const lib_config_1 = require("../utils/common/lib.config");
|
|
17
|
-
const project_1 = require("../utils/ng-utils/project");
|
|
18
|
-
const ng_ast_utils_1 = require("../utils/ng-utils/ng-ast-utils");
|
|
19
|
-
const add_declaration_1 = require("./add-declaration");
|
|
20
|
-
const project_2 = require("../utils/project");
|
|
21
|
-
const versions = require('./../utils/versions.json');
|
|
22
|
-
function ngAdd(options) {
|
|
23
|
-
return (host) => {
|
|
24
|
-
const normalizedSchema = normalizeSchema(host, options);
|
|
25
|
-
return (0, schematics_1.chain)([
|
|
26
|
-
addNgxsPackageToPackageJson(normalizedSchema),
|
|
27
|
-
addDeclaration(normalizedSchema),
|
|
28
|
-
normalizedSchema.skipInstall ? (0, schematics_1.noop)() : runNpmPackageInstall()
|
|
29
|
-
]);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.ngAdd = ngAdd;
|
|
33
|
-
function addNgxsPackageToPackageJson(schema) {
|
|
34
|
-
return (host, context) => {
|
|
35
|
-
const ngxsStoreVersion = versions['@ngxs/store'];
|
|
36
|
-
if (!ngxsStoreVersion) {
|
|
37
|
-
throw new schematics_1.SchematicsException('Could not resolve the version of "@ngxs/store"');
|
|
38
|
-
}
|
|
39
|
-
schema.plugins.forEach(name => {
|
|
40
|
-
const packageExists = (0, dependencies_1.getPackageJsonDependency)(host, name);
|
|
41
|
-
if (packageExists === null) {
|
|
42
|
-
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
43
|
-
type: dependencies_1.NodeDependencyType.Default,
|
|
44
|
-
name,
|
|
45
|
-
version: ngxsStoreVersion
|
|
46
|
-
});
|
|
47
|
-
context.logger.info(`✅️ Added "${name}" into ${dependencies_1.NodeDependencyType.Default}`);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
context.logger.warn(`✅️ "${name}" already exists in the ${dependencies_1.NodeDependencyType.Default}`);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return host;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function runNpmPackageInstall() {
|
|
57
|
-
return (_, context) => {
|
|
58
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
59
|
-
context.logger.info(`🔍 Installing packages...`);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function addDeclaration(schema) {
|
|
63
|
-
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const mainFile = (0, project_1.getProjectMainFile)(host, schema.project);
|
|
65
|
-
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, mainFile);
|
|
66
|
-
if (isStandalone) {
|
|
67
|
-
return (0, add_declaration_1.addDeclarationToStandaloneApp)(schema);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return (0, add_declaration_1.addDeclarationToNonStandaloneApp)(schema);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function normalizeSchema(host, schema) {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
const projectName = (_a = (0, project_2.getProject)(host, schema.project)) === null || _a === void 0 ? void 0 : _a.name;
|
|
77
|
-
if (!projectName) {
|
|
78
|
-
throw new schematics_1.SchematicsException(`Project "${schema.project}" does not exist.`);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
skipInstall: !!schema.skipInstall,
|
|
82
|
-
plugins: (_b = Object.values(lib_config_1.LIBRARIES).filter(lib => { var _a; return (_a = schema.plugins) === null || _a === void 0 ? void 0 : _a.includes(lib); })) !== null && _b !== void 0 ? _b : [],
|
|
83
|
-
project: projectName
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=ng-add.factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ng-add.factory.js","sourceRoot":"","sources":["../../../../../packages/store/schematics/src/ng-add/ng-add.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAOoC;AACpC,4DAA0E;AAC1E,2EAIkD;AAElD,2DAAuD;AAGvD,uDAA+D;AAC/D,iEAAiE;AACjE,uDAG2B;AAC3B,8CAA8C;AAE9C,MAAM,QAAQ,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAQrD,SAAgB,KAAK,CAAC,OAA0B;IAC9C,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAExD,OAAO,IAAA,kBAAK,EAAC;YACX,2BAA2B,CAAC,gBAAgB,CAAC;YAC7C,cAAc,CAAC,gBAAgB,CAAC;YAChC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE;SAC/D,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAVD,sBAUC;AAED,SAAS,2BAA2B,CAAC,MAAmC;IACtE,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,gBAAgB,GAAW,QAAQ,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,CAAC,gBAAgB,EAAE;YACrB,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,CA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CAAC,CAAA,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,IAAU,EAAE,MAAyB;;IAC5D,MAAM,WAAW,GAAG,MAAA,IAAA,oBAAU,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,0CAAE,IAAI,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,gCAAmB,CAAC,YAAY,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;KAC9E;IACD,OAAO;QACL,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW;QACjC,OAAO,EAAE,MAAA,MAAM,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,WAAC,OAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,QAAQ,CAAC,GAAG,CAAC,CAAA,EAAA,CAAC,mCAAI,EAAE;QACpF,OAAO,EAAE,WAAW;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsNgxsNgAdd",
|
|
4
|
-
"title": "Ngxs NgAdd Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"skipInstall": {
|
|
8
|
-
"type": "boolean",
|
|
9
|
-
"description": "The flag for skipping packages installation.",
|
|
10
|
-
"default": false,
|
|
11
|
-
"x-prompt": "Do you want to skip packages installation?"
|
|
12
|
-
},
|
|
13
|
-
"plugins": {
|
|
14
|
-
"type": "array",
|
|
15
|
-
"description": "Additional plugins to be added to the workspace.",
|
|
16
|
-
"minItems": 0,
|
|
17
|
-
"maxItems": 7,
|
|
18
|
-
"items": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"enum": [
|
|
21
|
-
"@ngxs/devtools-plugin",
|
|
22
|
-
"@ngxs/form-plugin",
|
|
23
|
-
"@ngxs/hmr-plugin",
|
|
24
|
-
"@ngxs/logger-plugin",
|
|
25
|
-
"@ngxs/router-plugin",
|
|
26
|
-
"@ngxs/storage-plugin",
|
|
27
|
-
"@ngxs/websocket-plugin"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
"default": [],
|
|
31
|
-
"x-prompt": {
|
|
32
|
-
"message": "Choose any other @ngxs plugins you would like to add to the workspace.",
|
|
33
|
-
"type": "list",
|
|
34
|
-
"items": [
|
|
35
|
-
{
|
|
36
|
-
"value": "@ngxs/devtools-plugin",
|
|
37
|
-
"label": "Ngxs developer tools plugin"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"value": "@ngxs/form-plugin",
|
|
41
|
-
"label": "Ngxs form plugin"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"value": "@ngxs/hmr-plugin",
|
|
45
|
-
"label": "Ngxs HMR plugin"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"value": "@ngxs/logger-plugin",
|
|
49
|
-
"label": "Ngxs logger plugin"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"value": "@ngxs/router-plugin",
|
|
53
|
-
"label": "Ngxs router plugin"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"value": "@ngxs/storage-plugin",
|
|
57
|
-
"label": "Ngxs storage plugin"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"value": "@ngxs/websocket-plugin",
|
|
61
|
-
"label": "Ngxs websocket plugin"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"project": {
|
|
67
|
-
"type": "string",
|
|
68
|
-
"description": "The name of the project."
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"required": []
|
|
72
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { NgxsModule, Store } from '@ngxs/store';
|
|
2
|
-
import { async, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { AuthenticationStateModel, AuthState } from './auth.state';
|
|
4
|
-
import { SetAuthData } from './auth.actions';
|
|
5
|
-
|
|
6
|
-
describe('[TEST]: AuthStore', () => {
|
|
7
|
-
let store: Store;
|
|
8
|
-
|
|
9
|
-
beforeEach(async(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
imports: [NgxsModule.forRoot([AuthState])]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents()
|
|
14
|
-
.then();
|
|
15
|
-
store = TestBed.get(Store);
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
it('Should be correct dispatch and value is empty', () => {
|
|
19
|
-
const Authentication: AuthenticationStateModel = {
|
|
20
|
-
id: '',
|
|
21
|
-
firstName: '',
|
|
22
|
-
lastName: '',
|
|
23
|
-
fullName: '',
|
|
24
|
-
email: '',
|
|
25
|
-
roles: []
|
|
26
|
-
};
|
|
27
|
-
store.dispatch(new SetAuthData(Authentication));
|
|
28
|
-
const actual = store.selectSnapshot<AuthenticationStateModel>(AuthState.getAuthData);
|
|
29
|
-
expect(actual).toEqual(Authentication);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('Should be correct dispatch and next value is correct completed', () => {
|
|
33
|
-
const authentication: AuthenticationStateModel = {
|
|
34
|
-
id: '12',
|
|
35
|
-
firstName: 'Adam',
|
|
36
|
-
lastName: 'Gordon',
|
|
37
|
-
fullName: 'Adam Gordon',
|
|
38
|
-
email: 'agordon@google.com',
|
|
39
|
-
roles: ['ADMIN']
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
store.dispatch(new SetAuthData(authentication));
|
|
43
|
-
const actual = store.selectSnapshot<AuthenticationStateModel>(AuthState.getAuthData);
|
|
44
|
-
expect(actual).toEqual(authentication);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
2
|
-
import { SetAuthData } from './auth.actions';
|
|
3
|
-
|
|
4
|
-
export interface AuthenticationStateModel {
|
|
5
|
-
id: string;
|
|
6
|
-
firstName: string;
|
|
7
|
-
lastName: string;
|
|
8
|
-
fullName: string;
|
|
9
|
-
email: string;
|
|
10
|
-
roles: string[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@State<AuthenticationStateModel>({
|
|
14
|
-
name: 'authState',
|
|
15
|
-
defaults: {
|
|
16
|
-
id: '',
|
|
17
|
-
firstName: '',
|
|
18
|
-
lastName: '',
|
|
19
|
-
fullName: '',
|
|
20
|
-
email: '',
|
|
21
|
-
roles: []
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
export class AuthState {
|
|
25
|
-
@Selector()
|
|
26
|
-
public static getAuthData(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
27
|
-
return AuthState.getInstanceState(state);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
private static setInstanceState(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
31
|
-
return { ...state };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private static getInstanceState(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
35
|
-
return { ...state };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@Action(SetAuthData)
|
|
39
|
-
public setAuthData(
|
|
40
|
-
{ setState }: StateContext<AuthenticationStateModel>,
|
|
41
|
-
{ payload }: SetAuthData
|
|
42
|
-
) {
|
|
43
|
-
setState(AuthState.setInstanceState(payload));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { State } from '@ngxs/store';
|
|
2
|
-
import { DictionaryState } from './states/dictionary/dictionary.state';
|
|
3
|
-
import { UserState } from './states/user/user.state';
|
|
4
|
-
|
|
5
|
-
export const DashboardStates = [DictionaryState, UserState];
|
|
6
|
-
|
|
7
|
-
@State({
|
|
8
|
-
name: 'dashboardState',
|
|
9
|
-
children: DashboardStates
|
|
10
|
-
})
|
|
11
|
-
export class DashboardState {}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DictionaryStateModel } from './dictionary.state';
|
|
2
|
-
|
|
3
|
-
export class SetDictionaryData {
|
|
4
|
-
public static readonly type = '[Dictionary] Set dictionary data action';
|
|
5
|
-
|
|
6
|
-
constructor(public payload: DictionaryStateModel) {}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class DictionaryReset {
|
|
10
|
-
public static readonly type = '[Dictionary] Reset dictionary action';
|
|
11
|
-
|
|
12
|
-
constructor() {}
|
|
13
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { NgxsModule, Store } from '@ngxs/store';
|
|
2
|
-
import { async, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { DictionaryState, DictionaryStateModel } from './dictionary.state';
|
|
4
|
-
import { DictionaryReset, SetDictionaryData } from './dictionary.actions';
|
|
5
|
-
|
|
6
|
-
const data = [
|
|
7
|
-
{
|
|
8
|
-
id: '323',
|
|
9
|
-
departmentCode: '2392',
|
|
10
|
-
departmentName: 'Main office',
|
|
11
|
-
mainCuratorUserId: 'admin',
|
|
12
|
-
mainCuratorName: 'Adam Gordon',
|
|
13
|
-
backupCuratorUserId: 'manager',
|
|
14
|
-
backupCuratorName: 'Alexander Chester'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: '322',
|
|
18
|
-
departmentCode: '2999',
|
|
19
|
-
departmentName: 'New York office',
|
|
20
|
-
mainCuratorUserId: 'manager',
|
|
21
|
-
mainCuratorName: 'Alexander Chester',
|
|
22
|
-
backupCuratorUserId: 'manager',
|
|
23
|
-
backupCuratorName: 'Amanda Brian'
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
describe('[TEST]: Dictionary state', () => {
|
|
28
|
-
let store: Store;
|
|
29
|
-
|
|
30
|
-
beforeEach(async(() => {
|
|
31
|
-
TestBed.configureTestingModule({
|
|
32
|
-
imports: [NgxsModule.forRoot([DictionaryState])]
|
|
33
|
-
})
|
|
34
|
-
.compileComponents()
|
|
35
|
-
.then();
|
|
36
|
-
store = TestBed.get(Store);
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
it('Should be correct dispatch and dictionary is empty', () => {
|
|
40
|
-
const dictionary: DictionaryStateModel = {
|
|
41
|
-
content: [],
|
|
42
|
-
page: 0,
|
|
43
|
-
size: 0,
|
|
44
|
-
totalPages: 0,
|
|
45
|
-
totalElements: 0
|
|
46
|
-
};
|
|
47
|
-
store.dispatch(new SetDictionaryData(dictionary));
|
|
48
|
-
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
49
|
-
expect(actual).toEqual(dictionary);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('Should be state is filled DictionaryStateModel', () => {
|
|
53
|
-
const dictionary: DictionaryStateModel = {
|
|
54
|
-
content: data,
|
|
55
|
-
page: 0,
|
|
56
|
-
size: 20,
|
|
57
|
-
totalPages: 2,
|
|
58
|
-
totalElements: 1
|
|
59
|
-
};
|
|
60
|
-
store.dispatch(new SetDictionaryData(dictionary));
|
|
61
|
-
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
62
|
-
expect(actual).toEqual(dictionary);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should be reset state', function () {
|
|
66
|
-
const dictionary: DictionaryStateModel = {
|
|
67
|
-
content: [],
|
|
68
|
-
page: 0,
|
|
69
|
-
size: 0,
|
|
70
|
-
totalPages: 0,
|
|
71
|
-
totalElements: 0
|
|
72
|
-
};
|
|
73
|
-
store.dispatch(new DictionaryReset());
|
|
74
|
-
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
75
|
-
expect(actual).toEqual(dictionary);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
2
|
-
import { DictionaryReset, SetDictionaryData } from './dictionary.actions';
|
|
3
|
-
|
|
4
|
-
export interface DictionaryStateModel {
|
|
5
|
-
content: any[];
|
|
6
|
-
page: number;
|
|
7
|
-
size: number;
|
|
8
|
-
totalPages: number;
|
|
9
|
-
totalElements: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@State<DictionaryStateModel>({
|
|
13
|
-
name: 'dictionary',
|
|
14
|
-
defaults: {
|
|
15
|
-
content: [],
|
|
16
|
-
page: 0,
|
|
17
|
-
size: 0,
|
|
18
|
-
totalPages: 0,
|
|
19
|
-
totalElements: 0
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
export class DictionaryState {
|
|
23
|
-
@Selector()
|
|
24
|
-
public static getDictionaryState(state: DictionaryStateModel): DictionaryStateModel {
|
|
25
|
-
return DictionaryState.getInstanceState(state);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@Selector()
|
|
29
|
-
public static getDictionaryContent(state: DictionaryStateModel) {
|
|
30
|
-
return state.content;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private static setInstanceState(state: DictionaryStateModel): DictionaryStateModel {
|
|
34
|
-
return { ...state };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
private static getInstanceState(state: DictionaryStateModel): DictionaryStateModel {
|
|
38
|
-
return { ...state };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Action(SetDictionaryData)
|
|
42
|
-
public setTasks(
|
|
43
|
-
{ setState }: StateContext<DictionaryStateModel>,
|
|
44
|
-
{ payload }: SetDictionaryData
|
|
45
|
-
) {
|
|
46
|
-
setState(DictionaryState.setInstanceState(payload));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@Action(DictionaryReset)
|
|
50
|
-
public resetTasks({ setState }: StateContext<DictionaryStateModel>) {
|
|
51
|
-
const initialState = {
|
|
52
|
-
content: [],
|
|
53
|
-
page: 0,
|
|
54
|
-
size: 0,
|
|
55
|
-
totalPages: 0,
|
|
56
|
-
totalElements: 0
|
|
57
|
-
};
|
|
58
|
-
setState(initialState);
|
|
59
|
-
}
|
|
60
|
-
}
|
package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.spec.ts__template__
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { NgxsModule, Store } from '@ngxs/store';
|
|
2
|
-
import { async, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { UserStateModel, UserState } from './user.state';
|
|
4
|
-
import { SetUser } from './user.actions';
|
|
5
|
-
|
|
6
|
-
describe('[TEST]: User state', () => {
|
|
7
|
-
let store: Store;
|
|
8
|
-
|
|
9
|
-
beforeEach(async(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
imports: [NgxsModule.forRoot([UserState])]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents()
|
|
14
|
-
.then();
|
|
15
|
-
store = TestBed.get(Store);
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
it('Should be state is UserStateModel', () => {
|
|
19
|
-
const user: UserStateModel = {
|
|
20
|
-
userId: '',
|
|
21
|
-
departmentCode: '',
|
|
22
|
-
departmentName: '',
|
|
23
|
-
email: '',
|
|
24
|
-
firstName: '',
|
|
25
|
-
lastName: '',
|
|
26
|
-
fullName: '',
|
|
27
|
-
positionId: '',
|
|
28
|
-
positionName: ''
|
|
29
|
-
};
|
|
30
|
-
store.dispatch(new SetUser(user));
|
|
31
|
-
const actual = store.selectSnapshot(({ user }) => user);
|
|
32
|
-
|
|
33
|
-
expect(actual).toEqual(user);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('Should be state is filled UserStateModel', () => {
|
|
37
|
-
const user: UserStateModel = {
|
|
38
|
-
userId: '12',
|
|
39
|
-
departmentCode: '2392',
|
|
40
|
-
departmentName: 'Main office',
|
|
41
|
-
email: 'agordon@google.com',
|
|
42
|
-
firstName: 'Adam',
|
|
43
|
-
lastName: 'Gordon',
|
|
44
|
-
fullName: 'Adam Gordon',
|
|
45
|
-
positionId: '102003',
|
|
46
|
-
positionName: 'admin'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
store.dispatch(new SetUser(user));
|
|
50
|
-
const actual = store.selectSnapshot<UserStateModel>(({ user }) => user);
|
|
51
|
-
|
|
52
|
-
expect(actual).toEqual(user);
|
|
53
|
-
});
|
|
54
|
-
});
|
package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.ts__template__
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
2
|
-
import { SetUser } from './user.actions';
|
|
3
|
-
|
|
4
|
-
export interface UserStateModel {
|
|
5
|
-
userId: string;
|
|
6
|
-
email: string;
|
|
7
|
-
firstName: string;
|
|
8
|
-
lastName: string;
|
|
9
|
-
fullName: string;
|
|
10
|
-
positionId: string;
|
|
11
|
-
positionName: string;
|
|
12
|
-
departmentCode: string;
|
|
13
|
-
departmentName: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@State<UserStateModel>({
|
|
17
|
-
name: 'user',
|
|
18
|
-
defaults: {
|
|
19
|
-
userId: '',
|
|
20
|
-
email: '',
|
|
21
|
-
firstName: '',
|
|
22
|
-
lastName: '',
|
|
23
|
-
fullName: '',
|
|
24
|
-
positionId: '',
|
|
25
|
-
positionName: '',
|
|
26
|
-
departmentCode: '',
|
|
27
|
-
departmentName: ''
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
export class UserState {
|
|
31
|
-
@Selector()
|
|
32
|
-
public static getUser(state: UserStateModel): UserStateModel {
|
|
33
|
-
return state;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Action(SetUser)
|
|
37
|
-
public setUser(ctx: StateContext<UserStateModel>, { payload }: SetUser) {
|
|
38
|
-
ctx.setState(payload);
|
|
39
|
-
}
|
|
40
|
-
}
|