@ngxs/store 3.8.2 → 18.0.0-dev.master-f4c2c19
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/README.md +1 -1
- package/{esm2015/index.js → esm2022/index.mjs} +2 -2
- package/esm2022/internals/custom-rxjs-subjects.mjs +92 -0
- package/esm2022/internals/index.mjs +10 -0
- package/esm2022/internals/initial-state.mjs +18 -0
- package/esm2022/internals/internal-tokens.mjs +6 -0
- package/esm2022/internals/memoize.mjs +45 -0
- package/esm2022/internals/metadata.mjs +57 -0
- package/esm2022/internals/ngxs-app-bootstrapped-state.mjs +19 -0
- package/esm2022/internals/state-stream.mjs +32 -0
- package/esm2022/internals/state-token.mjs +17 -0
- package/esm2022/internals/symbols.mjs +11 -0
- package/esm2022/internals/testing/fresh-platform.mjs +72 -0
- package/{esm2015/internals/testing/helpers/ngxs-test.component.js → esm2022/internals/testing/helpers/ngxs-test.component.mjs} +4 -4
- package/esm2022/internals/testing/helpers/ngxs-test.module.mjs +20 -0
- package/{esm2015/internals/testing/index.js → esm2022/internals/testing/index.mjs} +2 -2
- package/esm2022/internals/testing/ngxs.setup.mjs +48 -0
- package/{esm2015/internals/testing/skip-console-logging.js → esm2022/internals/testing/skip-console-logging.mjs} +1 -1
- package/esm2022/internals/testing/symbol.mjs +2 -0
- package/esm2022/operators/append.mjs +20 -0
- package/esm2022/operators/iif.mjs +38 -0
- package/esm2022/operators/insert-item.mjs +29 -0
- package/esm2022/operators/patch.mjs +21 -0
- package/esm2022/operators/remove-item.mjs +22 -0
- package/esm2022/operators/update-item.mjs +40 -0
- package/esm2022/plugins/actions.mjs +16 -0
- package/esm2022/plugins/index.mjs +4 -0
- package/esm2022/plugins/ngxs-store-plugins.mjs +5 -0
- package/esm2022/plugins/symbols.mjs +6 -0
- package/esm2022/plugins/utils.mjs +51 -0
- package/esm2022/src/actions/symbols.mjs +2 -0
- package/esm2022/src/actions-stream.mjs +52 -0
- package/esm2022/src/configs/messages.config.mjs +48 -0
- package/esm2022/src/decorators/action.mjs +31 -0
- package/esm2022/src/decorators/select/select-factory.mjs +29 -0
- package/esm2022/src/decorators/select/select.mjs +29 -0
- package/esm2022/src/decorators/select/symbols.mjs +29 -0
- package/esm2022/src/decorators/selector/selector.mjs +29 -0
- package/esm2022/src/decorators/selector/symbols.mjs +2 -0
- package/esm2022/src/decorators/selector-options.mjs +21 -0
- package/esm2022/src/decorators/state.mjs +35 -0
- package/esm2022/src/dev-features/ngxs-development.module.mjs +28 -0
- package/esm2022/src/dev-features/ngxs-unhandled-actions-logger.mjs +45 -0
- package/esm2022/src/dev-features/symbols.mjs +7 -0
- package/esm2022/src/execution/dispatch-outside-zone-ngxs-execution-strategy.mjs +55 -0
- package/{esm2015/src/execution/internal-ngxs-execution-strategy.js → esm2022/src/execution/internal-ngxs-execution-strategy.mjs} +6 -6
- package/{esm2015/src/execution/noop-ngxs-execution-strategy.js → esm2022/src/execution/noop-ngxs-execution-strategy.mjs} +4 -4
- package/esm2022/src/execution/symbols.mjs +29 -0
- package/esm2022/src/internal/dispatcher.mjs +106 -0
- package/esm2022/src/internal/fallback-subscriber.mjs +29 -0
- package/esm2022/src/internal/internals.mjs +206 -0
- package/esm2022/src/internal/lifecycle-state-manager.mjs +86 -0
- package/esm2022/src/internal/state-context-factory.mjs +71 -0
- package/esm2022/src/internal/state-factory.mjs +311 -0
- package/esm2022/src/internal/state-operations.mjs +63 -0
- package/esm2022/src/internal/state-operators.mjs +20 -0
- package/esm2022/src/internal/unhandled-rxjs-error-callback.mjs +39 -0
- package/esm2022/src/ivy/ivy-enabled-in-dev-mode.mjs +25 -0
- package/esm2022/src/module.mjs +27 -0
- package/esm2022/src/modules/ngxs-feature.module.mjs +18 -0
- package/esm2022/src/modules/ngxs-root.module.mjs +18 -0
- package/esm2022/src/ngxs-unhandled-error-handler.mjs +29 -0
- package/esm2022/src/operators/of-action.mjs +104 -0
- package/esm2022/src/plugin-manager.mjs +37 -0
- package/esm2022/src/plugin_api.mjs +2 -0
- package/{esm2015/src/private_api.js → esm2022/src/private_api.mjs} +2 -1
- package/esm2022/src/public_api.mjs +20 -0
- package/esm2022/src/selectors/create-model-selector.mjs +30 -0
- package/esm2022/src/selectors/create-pick-selector.mjs +16 -0
- package/esm2022/src/selectors/create-property-selectors.mjs +20 -0
- package/esm2022/src/selectors/create-selector.mjs +9 -0
- package/esm2022/src/selectors/private_api.mjs +2 -0
- package/esm2022/src/selectors/selector-checks.util.mjs +18 -0
- package/esm2022/src/selectors/selector-metadata.mjs +35 -0
- package/esm2022/src/selectors/selector-models.mjs +2 -0
- package/esm2022/src/selectors/selector-types.util.mjs +2 -0
- package/esm2022/src/selectors/selector-utils.mjs +95 -0
- package/esm2022/src/standalone-features/feature-providers.mjs +20 -0
- package/esm2022/src/standalone-features/index.mjs +5 -0
- package/esm2022/src/standalone-features/initializers.mjs +89 -0
- package/esm2022/src/standalone-features/plugin.mjs +20 -0
- package/esm2022/src/standalone-features/preboot.mjs +32 -0
- package/esm2022/src/standalone-features/provide-states.mjs +26 -0
- package/esm2022/src/standalone-features/provide-store.mjs +26 -0
- package/esm2022/src/standalone-features/root-providers.mjs +47 -0
- package/esm2022/src/store.mjs +117 -0
- package/esm2022/src/symbols.mjs +87 -0
- package/esm2022/src/utils/compose.mjs +26 -0
- package/esm2022/src/utils/create-dispatch-map.mjs +11 -0
- package/esm2022/src/utils/create-select-map.mjs +13 -0
- package/esm2022/src/utils/dispatch.mjs +7 -0
- package/{esm2015/src/utils/freeze.js → esm2022/src/utils/freeze.mjs} +1 -1
- package/esm2022/src/utils/public_api.mjs +5 -0
- package/esm2022/src/utils/select.mjs +19 -0
- package/esm2022/src/utils/store-validators.mjs +25 -0
- package/{fesm2015/ngxs-store-internals-testing.js → fesm2022/ngxs-store-internals-testing.mjs} +84 -81
- package/fesm2022/ngxs-store-internals-testing.mjs.map +1 -0
- package/fesm2022/ngxs-store-internals.mjs +296 -0
- package/fesm2022/ngxs-store-internals.mjs.map +1 -0
- package/{fesm2015/ngxs-store-operators.js → fesm2022/ngxs-store-operators.mjs} +3 -3
- package/fesm2022/ngxs-store-operators.mjs.map +1 -0
- package/fesm2022/ngxs-store-plugins.mjs +80 -0
- package/fesm2022/ngxs-store-plugins.mjs.map +1 -0
- package/{fesm2015/ngxs-store.js → fesm2022/ngxs-store.mjs} +1319 -1265
- package/fesm2022/ngxs-store.mjs.map +1 -0
- package/index.d.ts +1 -1
- package/{src/internal → internals}/custom-rxjs-subjects.d.ts +2 -2
- package/internals/index.d.ts +8 -4
- package/internals/initial-state.d.ts +5 -5
- package/internals/memoize.d.ts +1 -1
- package/internals/metadata.d.ts +25 -0
- package/internals/ngxs-app-bootstrapped-state.d.ts +8 -0
- package/internals/state-stream.d.ts +15 -0
- package/internals/state-token.d.ts +7 -0
- package/internals/symbols.d.ts +84 -3
- package/internals/testing/helpers/ngxs-test.component.d.ts +1 -1
- package/internals/testing/index.d.ts +2 -2
- package/internals/testing/symbol.d.ts +2 -2
- package/operators/patch.d.ts +2 -2
- package/operators/types.d.ts +5 -5
- package/operators/utils.d.ts +1 -1
- package/package.json +44 -13
- package/{src/actions → plugins}/actions.d.ts +3 -3
- package/plugins/index.d.ts +3 -0
- package/plugins/symbols.d.ts +13 -0
- package/{src/utils → plugins}/utils.d.ts +0 -17
- package/schematics/collection.json +36 -0
- package/schematics/src/actions/actions.factory.d.ts +3 -0
- package/schematics/src/actions/actions.factory.js +24 -0
- package/schematics/src/actions/actions.factory.js.map +1 -0
- package/schematics/src/actions/files/__name__.actions.ts__template__ +4 -0
- package/schematics/src/actions/schema.json +35 -0
- package/schematics/src/ng-add/add-declaration.d.ts +4 -0
- package/schematics/src/ng-add/add-declaration.js +109 -0
- package/schematics/src/ng-add/add-declaration.js.map +1 -0
- package/schematics/src/ng-add/ng-add.factory.d.ts +9 -0
- package/schematics/src/ng-add/ng-add.factory.js +89 -0
- package/schematics/src/ng-add/ng-add.factory.js.map +1 -0
- package/schematics/src/ng-add/schema.json +72 -0
- package/schematics/src/starter-kit/files/store/auth/auth.actions.ts__template__ +6 -0
- package/schematics/src/starter-kit/files/store/auth/auth.state.spec.ts__template__ +55 -0
- package/schematics/src/starter-kit/files/store/auth/auth.state.ts__template__ +47 -0
- package/schematics/src/starter-kit/files/store/dashboard/index.ts__template__ +4 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.actions.ts__template__ +10 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.spec.ts__template__ +92 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.ts__template__ +62 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.actions.ts__template__ +6 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.spec.ts__template__ +61 -0
- package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.ts__template__ +42 -0
- package/schematics/src/starter-kit/files/store/store.config.ts__template__ +39 -0
- package/schematics/src/starter-kit/files/store/store.module.ts__template__ +22 -0
- package/schematics/src/starter-kit/schema.json +22 -0
- package/schematics/src/starter-kit/starter-kit.factory.d.ts +3 -0
- package/schematics/src/starter-kit/starter-kit.factory.js +21 -0
- package/schematics/src/starter-kit/starter-kit.factory.js.map +1 -0
- package/schematics/src/state/files/__name__.state.spec.ts__template__ +25 -0
- package/schematics/src/state/files/__name__.state.ts__template__ +22 -0
- package/schematics/src/state/schema.json +44 -0
- package/schematics/src/state/state.factory.d.ts +3 -0
- package/schematics/src/state/state.factory.js +29 -0
- package/schematics/src/state/state.factory.js.map +1 -0
- package/schematics/src/store/files/__name__.actions.ts__template__ +4 -0
- package/schematics/src/store/files/__name__.state.spec.ts__template__ +26 -0
- package/schematics/src/store/files/__name__.state.ts__template__ +29 -0
- package/schematics/src/store/schema.json +44 -0
- package/schematics/src/store/store.factory.d.ts +3 -0
- package/schematics/src/store/store.factory.js +29 -0
- package/schematics/src/store/store.factory.js.map +1 -0
- package/schematics/src/utils/common/lib.config.d.ts +10 -0
- package/schematics/src/utils/common/lib.config.js +15 -0
- package/schematics/src/utils/common/lib.config.js.map +1 -0
- package/schematics/src/utils/common/project-files.config.d.ts +3 -0
- package/schematics/src/utils/common/project-files.config.js +7 -0
- package/schematics/src/utils/common/project-files.config.js.map +1 -0
- package/schematics/src/utils/common/properties.d.ts +1 -0
- package/schematics/src/utils/common/properties.js +8 -0
- package/schematics/src/utils/common/properties.js.map +1 -0
- package/schematics/src/utils/config.d.ts +119 -0
- package/schematics/src/utils/config.js +21 -0
- package/schematics/src/utils/config.js.map +1 -0
- package/schematics/src/utils/generate-utils.d.ts +4 -0
- package/schematics/src/utils/generate-utils.js +14 -0
- package/schematics/src/utils/generate-utils.js.map +1 -0
- package/schematics/src/utils/interfaces/package.interface.d.ts +7 -0
- package/schematics/src/utils/interfaces/package.interface.js +3 -0
- package/schematics/src/utils/interfaces/package.interface.js.map +1 -0
- package/schematics/src/utils/ng-utils/README.md +1 -0
- package/schematics/src/utils/ng-utils/ast-utils.d.ts +99 -0
- package/schematics/src/utils/ng-utils/ast-utils.js +517 -0
- package/schematics/src/utils/ng-utils/ast-utils.js.map +1 -0
- package/schematics/src/utils/ng-utils/ng-ast-utils.d.ts +5 -0
- package/schematics/src/utils/ng-utils/ng-ast-utils.js +67 -0
- package/schematics/src/utils/ng-utils/ng-ast-utils.js.map +1 -0
- package/schematics/src/utils/ng-utils/project.d.ts +2 -0
- package/schematics/src/utils/ng-utils/project.js +27 -0
- package/schematics/src/utils/ng-utils/project.js.map +1 -0
- package/schematics/src/utils/ng-utils/standalone/app_config.d.ts +16 -0
- package/schematics/src/utils/ng-utils/standalone/app_config.js +84 -0
- package/schematics/src/utils/ng-utils/standalone/app_config.js.map +1 -0
- package/schematics/src/utils/ng-utils/standalone/code_block.d.ts +46 -0
- package/schematics/src/utils/ng-utils/standalone/code_block.js +73 -0
- package/schematics/src/utils/ng-utils/standalone/code_block.js.map +1 -0
- package/schematics/src/utils/ng-utils/standalone/index.d.ts +1 -0
- package/schematics/src/utils/ng-utils/standalone/index.js +7 -0
- package/schematics/src/utils/ng-utils/standalone/index.js.map +1 -0
- package/schematics/src/utils/ng-utils/standalone/rules.d.ts +38 -0
- package/schematics/src/utils/ng-utils/standalone/rules.js +195 -0
- package/schematics/src/utils/ng-utils/standalone/rules.js.map +1 -0
- package/schematics/src/utils/ng-utils/standalone/util.d.ts +28 -0
- package/schematics/src/utils/ng-utils/standalone/util.js +138 -0
- package/schematics/src/utils/ng-utils/standalone/util.js.map +1 -0
- package/schematics/src/utils/normalize-options.d.ts +11 -0
- package/schematics/src/utils/normalize-options.js +27 -0
- package/schematics/src/utils/normalize-options.js.map +1 -0
- package/schematics/src/utils/project.d.ts +19 -0
- package/schematics/src/utils/project.js +46 -0
- package/schematics/src/utils/project.js.map +1 -0
- package/schematics/src/utils/versions.json +3 -0
- package/src/actions/symbols.d.ts +3 -17
- package/src/actions-stream.d.ts +2 -2
- package/src/configs/messages.config.d.ts +3 -1
- package/src/decorators/action.d.ts +28 -3
- package/src/decorators/select/select.d.ts +3 -0
- package/src/decorators/select/symbols.d.ts +2 -3
- package/src/decorators/selector/selector.d.ts +2 -3
- package/src/decorators/selector/symbols.d.ts +73 -4
- package/src/decorators/selector-options.d.ts +2 -2
- package/src/decorators/state.d.ts +2 -3
- package/src/dev-features/ngxs-development.module.d.ts +1 -0
- package/src/execution/symbols.d.ts +8 -2
- package/src/internal/dispatcher.d.ts +5 -5
- package/src/internal/fallback-subscriber.d.ts +3 -0
- package/src/internal/internals.d.ts +13 -69
- package/src/internal/lifecycle-state-manager.d.ts +6 -6
- package/src/internal/state-factory.d.ts +8 -6
- package/src/internal/state-operations.d.ts +2 -2
- package/src/internal/unhandled-rxjs-error-callback.d.ts +2 -0
- package/src/module.d.ts +3 -14
- package/src/modules/ngxs-feature.module.d.ts +2 -9
- package/src/modules/ngxs-root.module.d.ts +2 -9
- package/src/ngxs-unhandled-error-handler.d.ts +16 -0
- package/src/operators/of-action.d.ts +3 -3
- package/src/plugin-manager.d.ts +1 -1
- package/src/plugin_api.d.ts +1 -5
- package/src/private_api.d.ts +1 -0
- package/src/public_api.d.ts +11 -8
- package/src/selectors/create-model-selector.d.ts +2 -2
- package/src/selectors/create-pick-selector.d.ts +1 -1
- package/src/selectors/create-property-selectors.d.ts +3 -3
- package/src/selectors/create-selector.d.ts +10 -10
- package/src/selectors/private_api.d.ts +7 -0
- package/src/selectors/selector-checks.util.d.ts +2 -2
- package/src/selectors/selector-metadata.d.ts +4 -4
- package/src/selectors/selector-models.d.ts +4 -4
- package/src/selectors/selector-types.util.d.ts +6 -7
- package/src/selectors/selector-utils.d.ts +3 -3
- package/src/standalone-features/feature-providers.d.ts +7 -0
- package/src/standalone-features/index.d.ts +4 -0
- package/src/standalone-features/initializers.d.ts +29 -0
- package/src/standalone-features/plugin.d.ts +17 -0
- package/src/standalone-features/preboot.d.ts +26 -0
- package/src/standalone-features/provide-states.d.ts +18 -0
- package/src/standalone-features/provide-store.d.ts +22 -0
- package/src/standalone-features/root-providers.d.ts +8 -0
- package/src/store.d.ts +13 -15
- package/src/symbols.d.ts +12 -54
- package/src/utils/compose.d.ts +1 -1
- package/src/utils/create-dispatch-map.d.ts +4 -0
- package/src/utils/create-select-map.d.ts +4 -0
- package/src/utils/dispatch.d.ts +2 -0
- package/src/utils/public_api.d.ts +4 -0
- package/src/utils/select.d.ts +16 -0
- package/src/utils/store-validators.d.ts +4 -3
- package/bundles/ngxs-store-internals-testing.umd.js +0 -684
- package/bundles/ngxs-store-internals-testing.umd.js.map +0 -1
- package/bundles/ngxs-store-internals.umd.js +0 -141
- package/bundles/ngxs-store-internals.umd.js.map +0 -1
- package/bundles/ngxs-store-operators.umd.js +0 -224
- package/bundles/ngxs-store-operators.umd.js.map +0 -1
- package/bundles/ngxs-store.umd.js +0 -3076
- package/bundles/ngxs-store.umd.js.map +0 -1
- package/esm2015/internals/index.js +0 -5
- package/esm2015/internals/initial-state.js +0 -17
- package/esm2015/internals/internal-tokens.js +0 -5
- package/esm2015/internals/memoize.js +0 -45
- package/esm2015/internals/ngxs-bootstrapper.js +0 -29
- package/esm2015/internals/src/symbols.js +0 -2
- package/esm2015/internals/symbols.js +0 -2
- package/esm2015/internals/testing/fresh-platform.js +0 -70
- package/esm2015/internals/testing/helpers/ngxs-test.module.js +0 -21
- package/esm2015/internals/testing/ngxs.setup.js +0 -46
- package/esm2015/internals/testing/symbol.js +0 -2
- package/esm2015/operators/append.js +0 -20
- package/esm2015/operators/iif.js +0 -38
- package/esm2015/operators/insert-item.js +0 -29
- package/esm2015/operators/patch.js +0 -21
- package/esm2015/operators/remove-item.js +0 -22
- package/esm2015/operators/update-item.js +0 -40
- package/esm2015/src/actions/actions.js +0 -16
- package/esm2015/src/actions/symbols.js +0 -2
- package/esm2015/src/actions-stream.js +0 -52
- package/esm2015/src/configs/messages.config.js +0 -36
- package/esm2015/src/decorators/action.js +0 -33
- package/esm2015/src/decorators/select/select-factory.js +0 -29
- package/esm2015/src/decorators/select/select.js +0 -26
- package/esm2015/src/decorators/select/symbols.js +0 -29
- package/esm2015/src/decorators/selector/selector.js +0 -32
- package/esm2015/src/decorators/selector/symbols.js +0 -2
- package/esm2015/src/decorators/selector-options.js +0 -21
- package/esm2015/src/decorators/state.js +0 -36
- package/esm2015/src/dev-features/ngxs-development.module.js +0 -22
- package/esm2015/src/dev-features/ngxs-unhandled-actions-logger.js +0 -46
- package/esm2015/src/dev-features/symbols.js +0 -6
- package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +0 -57
- package/esm2015/src/execution/symbols.js +0 -23
- package/esm2015/src/internal/custom-rxjs-subjects.js +0 -92
- package/esm2015/src/internal/dispatcher.js +0 -104
- package/esm2015/src/internal/error-handler.js +0 -64
- package/esm2015/src/internal/internals.js +0 -248
- package/esm2015/src/internal/lifecycle-state-manager.js +0 -79
- package/esm2015/src/internal/state-context-factory.js +0 -68
- package/esm2015/src/internal/state-factory.js +0 -288
- package/esm2015/src/internal/state-operations.js +0 -63
- package/esm2015/src/internal/state-operators.js +0 -20
- package/esm2015/src/internal/state-stream.js +0 -25
- package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +0 -25
- package/esm2015/src/module.js +0 -88
- package/esm2015/src/modules/ngxs-feature.module.js +0 -45
- package/esm2015/src/modules/ngxs-root.module.js +0 -41
- package/esm2015/src/operators/of-action.js +0 -102
- package/esm2015/src/plugin-manager.js +0 -37
- package/esm2015/src/plugin_api.js +0 -6
- package/esm2015/src/public_api.js +0 -27
- package/esm2015/src/public_to_deprecate.js +0 -14
- package/esm2015/src/selectors/create-model-selector.js +0 -30
- package/esm2015/src/selectors/create-pick-selector.js +0 -16
- package/esm2015/src/selectors/create-property-selectors.js +0 -20
- package/esm2015/src/selectors/create-selector.js +0 -9
- package/esm2015/src/selectors/selector-checks.util.js +0 -18
- package/esm2015/src/selectors/selector-metadata.js +0 -30
- package/esm2015/src/selectors/selector-models.js +0 -2
- package/esm2015/src/selectors/selector-types.util.js +0 -2
- package/esm2015/src/selectors/selector-utils.js +0 -74
- package/esm2015/src/state-token/state-token.js +0 -17
- package/esm2015/src/state-token/symbols.js +0 -2
- package/esm2015/src/store.js +0 -107
- package/esm2015/src/symbols.js +0 -58
- package/esm2015/src/utils/compose.js +0 -26
- package/esm2015/src/utils/store-validators.js +0 -25
- package/esm2015/src/utils/utils.js +0 -92
- package/fesm2015/ngxs-store-internals-testing.js.map +0 -1
- package/fesm2015/ngxs-store-internals.js +0 -101
- package/fesm2015/ngxs-store-internals.js.map +0 -1
- package/fesm2015/ngxs-store-operators.js.map +0 -1
- package/fesm2015/ngxs-store.js.map +0 -1
- package/internals/ngxs-bootstrapper.d.ts +0 -16
- package/internals/ngxs-store-internals.d.ts +0 -5
- package/internals/package.json +0 -10
- package/internals/src/symbols.d.ts +0 -7
- package/internals/testing/ngxs-store-internals-testing.d.ts +0 -5
- package/internals/testing/package.json +0 -10
- package/ngxs-store.d.ts +0 -5
- package/operators/ngxs-store-operators.d.ts +0 -5
- package/operators/package.json +0 -10
- package/src/internal/error-handler.d.ts +0 -26
- package/src/internal/state-stream.d.ts +0 -14
- package/src/public_to_deprecate.d.ts +0 -21
- package/src/state-token/state-token.d.ts +0 -7
- package/src/state-token/symbols.d.ts +0 -5
- /package/{esm2015/internals/ngxs-store-internals.js → esm2022/internals/ngxs-store-internals.mjs} +0 -0
- /package/{esm2015/internals/testing/ngxs-store-internals-testing.js → esm2022/internals/testing/ngxs-store-internals-testing.mjs} +0 -0
- /package/{esm2015/ngxs-store.js → esm2022/ngxs-store.mjs} +0 -0
- /package/{esm2015/operators/compose.js → esm2022/operators/compose.mjs} +0 -0
- /package/{esm2015/operators/index.js → esm2022/operators/index.mjs} +0 -0
- /package/{esm2015/operators/ngxs-store-operators.js → esm2022/operators/ngxs-store-operators.mjs} +0 -0
- /package/{esm2015/operators/types.js → esm2022/operators/types.mjs} +0 -0
- /package/{esm2015/operators/utils.js → esm2022/operators/utils.mjs} +0 -0
- /package/{esm2015/src/operators/leave-ngxs.js → esm2022/src/operators/leave-ngxs.mjs} +0 -0
- /package/{esm2015/src/selectors/index.js → esm2022/src/selectors/index.mjs} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { <% if (isStandalone) { %> provideStore, <% } else { %> NgxsModule, <% } %> Store } from '@ngxs/store';
|
|
2
|
+
import { 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(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
<% if (isStandalone) { %> providers: [provideStore([AuthState])]
|
|
12
|
+
<% } else { %> imports: [NgxsModule.forRoot([AuthState])] <% } %>
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
store = TestBed.inject(Store);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('Should be correct dispatch and value is empty', () => {
|
|
19
|
+
// Arrange
|
|
20
|
+
const Authentication: AuthenticationStateModel = {
|
|
21
|
+
id: '',
|
|
22
|
+
firstName: '',
|
|
23
|
+
lastName: '',
|
|
24
|
+
fullName: '',
|
|
25
|
+
email: '',
|
|
26
|
+
roles: []
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Act
|
|
30
|
+
store.dispatch(new SetAuthData(Authentication));
|
|
31
|
+
const actual = store.selectSnapshot<AuthenticationStateModel>(AuthState.getAuthData);
|
|
32
|
+
|
|
33
|
+
// Assert
|
|
34
|
+
expect(actual).toEqual(Authentication);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('Should be correct dispatch and next value is correct completed', () => {
|
|
38
|
+
// Arrange
|
|
39
|
+
const authentication: AuthenticationStateModel = {
|
|
40
|
+
id: '12',
|
|
41
|
+
firstName: 'Adam',
|
|
42
|
+
lastName: 'Gordon',
|
|
43
|
+
fullName: 'Adam Gordon',
|
|
44
|
+
email: 'agordon@google.com',
|
|
45
|
+
roles: ['ADMIN']
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Act
|
|
49
|
+
store.dispatch(new SetAuthData(authentication));
|
|
50
|
+
const actual = store.selectSnapshot<AuthenticationStateModel>(AuthState.getAuthData);
|
|
51
|
+
|
|
52
|
+
// Assert
|
|
53
|
+
expect(actual).toEqual(authentication);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
3
|
+
import { SetAuthData } from './auth.actions';
|
|
4
|
+
|
|
5
|
+
export interface AuthenticationStateModel {
|
|
6
|
+
id: string;
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
fullName: string;
|
|
10
|
+
email: string;
|
|
11
|
+
roles: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@State<AuthenticationStateModel>({
|
|
15
|
+
name: 'authState',
|
|
16
|
+
defaults: {
|
|
17
|
+
id: '',
|
|
18
|
+
firstName: '',
|
|
19
|
+
lastName: '',
|
|
20
|
+
fullName: '',
|
|
21
|
+
email: '',
|
|
22
|
+
roles: []
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
@Injectable()
|
|
26
|
+
export class AuthState {
|
|
27
|
+
@Selector()
|
|
28
|
+
static getAuthData(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
29
|
+
return AuthState.getInstanceState(state);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private static setInstanceState(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
33
|
+
return { ...state };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private static getInstanceState(state: AuthenticationStateModel): AuthenticationStateModel {
|
|
37
|
+
return { ...state };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Action(SetAuthData)
|
|
41
|
+
setAuthData(
|
|
42
|
+
{ setState }: StateContext<AuthenticationStateModel>,
|
|
43
|
+
{ payload }: SetAuthData
|
|
44
|
+
) {
|
|
45
|
+
setState(AuthState.setInstanceState(payload));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DictionaryStateModel } from './dictionary.state';
|
|
2
|
+
|
|
3
|
+
export class SetDictionaryData {
|
|
4
|
+
static readonly type = '[Dictionary] Set dictionary data action';
|
|
5
|
+
constructor(readonly payload: DictionaryStateModel) {}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class DictionaryReset {
|
|
9
|
+
static readonly type = '[Dictionary] Reset dictionary action';
|
|
10
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { <% if (isStandalone) { %> provideStore, <% } else { %> NgxsModule, <% } %> Store } from '@ngxs/store';
|
|
2
|
+
import { 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(() => {
|
|
31
|
+
TestBed.configureTestingModule({
|
|
32
|
+
<% if (isStandalone) { %> providers: [provideStore([DictionaryState])]
|
|
33
|
+
<% } else { %> imports: [NgxsModule.forRoot([DictionaryState])] <% } %>
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
store = TestBed.inject(Store);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('Should be correct dispatch and dictionary is empty', () => {
|
|
40
|
+
// Arrange
|
|
41
|
+
const dictionary: DictionaryStateModel = {
|
|
42
|
+
content: [],
|
|
43
|
+
page: 0,
|
|
44
|
+
size: 0,
|
|
45
|
+
totalPages: 0,
|
|
46
|
+
totalElements: 0
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Act
|
|
50
|
+
store.dispatch(new SetDictionaryData(dictionary));
|
|
51
|
+
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
52
|
+
|
|
53
|
+
// Assert
|
|
54
|
+
expect(actual).toEqual(dictionary);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('Should be state is filled DictionaryStateModel', () => {
|
|
58
|
+
// Arrange
|
|
59
|
+
const dictionary: DictionaryStateModel = {
|
|
60
|
+
content: data,
|
|
61
|
+
page: 0,
|
|
62
|
+
size: 20,
|
|
63
|
+
totalPages: 2,
|
|
64
|
+
totalElements: 1
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Act
|
|
68
|
+
store.dispatch(new SetDictionaryData(dictionary));
|
|
69
|
+
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
70
|
+
|
|
71
|
+
// Assert
|
|
72
|
+
expect(actual).toEqual(dictionary);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should be reset state', function () {
|
|
76
|
+
// Arrange
|
|
77
|
+
const dictionary: DictionaryStateModel = {
|
|
78
|
+
content: [],
|
|
79
|
+
page: 0,
|
|
80
|
+
size: 0,
|
|
81
|
+
totalPages: 0,
|
|
82
|
+
totalElements: 0
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Act
|
|
86
|
+
store.dispatch(new DictionaryReset());
|
|
87
|
+
const actual = store.selectSnapshot(DictionaryState.getDictionaryState);
|
|
88
|
+
|
|
89
|
+
// Assert
|
|
90
|
+
expect(actual).toEqual(dictionary);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
3
|
+
import { DictionaryReset, SetDictionaryData } from './dictionary.actions';
|
|
4
|
+
|
|
5
|
+
export interface DictionaryStateModel {
|
|
6
|
+
content: any[];
|
|
7
|
+
page: number;
|
|
8
|
+
size: number;
|
|
9
|
+
totalPages: number;
|
|
10
|
+
totalElements: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@State<DictionaryStateModel>({
|
|
14
|
+
name: 'dictionary',
|
|
15
|
+
defaults: {
|
|
16
|
+
content: [],
|
|
17
|
+
page: 0,
|
|
18
|
+
size: 0,
|
|
19
|
+
totalPages: 0,
|
|
20
|
+
totalElements: 0
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
@Injectable()
|
|
24
|
+
export class DictionaryState {
|
|
25
|
+
@Selector()
|
|
26
|
+
static getDictionaryState(state: DictionaryStateModel): DictionaryStateModel {
|
|
27
|
+
return DictionaryState.getInstanceState(state);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Selector()
|
|
31
|
+
static getDictionaryContent(state: DictionaryStateModel) {
|
|
32
|
+
return state.content;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private static setInstanceState(state: DictionaryStateModel): DictionaryStateModel {
|
|
36
|
+
return { ...state };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private static getInstanceState(state: DictionaryStateModel): DictionaryStateModel {
|
|
40
|
+
return { ...state };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Action(SetDictionaryData)
|
|
44
|
+
setTasks(
|
|
45
|
+
{ setState }: StateContext<DictionaryStateModel>,
|
|
46
|
+
{ payload }: SetDictionaryData
|
|
47
|
+
) {
|
|
48
|
+
setState(DictionaryState.setInstanceState(payload));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Action(DictionaryReset)
|
|
52
|
+
resetTasks({ setState }: StateContext<DictionaryStateModel>) {
|
|
53
|
+
const initialState = {
|
|
54
|
+
content: [],
|
|
55
|
+
page: 0,
|
|
56
|
+
size: 0,
|
|
57
|
+
totalPages: 0,
|
|
58
|
+
totalElements: 0
|
|
59
|
+
};
|
|
60
|
+
setState(initialState);
|
|
61
|
+
}
|
|
62
|
+
}
|
package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.spec.ts__template__
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { <% if (isStandalone) { %> provideStore, <% } else { %> NgxsModule, <% } %> Store } from '@ngxs/store';
|
|
2
|
+
import { 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(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
<% if (isStandalone) { %> providers: [provideStore([UserState])]
|
|
12
|
+
<% } else { %> imports: [NgxsModule.forRoot([UserState])] <% } %>
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
store = TestBed.inject(Store);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('Should be state is UserStateModel', () => {
|
|
19
|
+
// Arrange
|
|
20
|
+
const user: UserStateModel = {
|
|
21
|
+
userId: '',
|
|
22
|
+
departmentCode: '',
|
|
23
|
+
departmentName: '',
|
|
24
|
+
email: '',
|
|
25
|
+
firstName: '',
|
|
26
|
+
lastName: '',
|
|
27
|
+
fullName: '',
|
|
28
|
+
positionId: '',
|
|
29
|
+
positionName: ''
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Act
|
|
33
|
+
store.dispatch(new SetUser(user));
|
|
34
|
+
const actual = store.selectSnapshot(({ user }) => user);
|
|
35
|
+
|
|
36
|
+
// Assert
|
|
37
|
+
expect(actual).toEqual(user);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('Should be state is filled UserStateModel', () => {
|
|
41
|
+
// Arrange
|
|
42
|
+
const user: UserStateModel = {
|
|
43
|
+
userId: '12',
|
|
44
|
+
departmentCode: '2392',
|
|
45
|
+
departmentName: 'Main office',
|
|
46
|
+
email: 'agordon@google.com',
|
|
47
|
+
firstName: 'Adam',
|
|
48
|
+
lastName: 'Gordon',
|
|
49
|
+
fullName: 'Adam Gordon',
|
|
50
|
+
positionId: '102003',
|
|
51
|
+
positionName: 'admin'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Act
|
|
55
|
+
store.dispatch(new SetUser(user));
|
|
56
|
+
const actual = store.selectSnapshot<UserStateModel>(({ user }) => user);
|
|
57
|
+
|
|
58
|
+
// Assert
|
|
59
|
+
expect(actual).toEqual(user);
|
|
60
|
+
});
|
|
61
|
+
});
|
package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.ts__template__
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Action, Selector, State, StateContext } from '@ngxs/store';
|
|
3
|
+
import { SetUser } from './user.actions';
|
|
4
|
+
|
|
5
|
+
export interface UserStateModel {
|
|
6
|
+
userId: string;
|
|
7
|
+
email: string;
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
fullName: string;
|
|
11
|
+
positionId: string;
|
|
12
|
+
positionName: string;
|
|
13
|
+
departmentCode: string;
|
|
14
|
+
departmentName: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@State<UserStateModel>({
|
|
18
|
+
name: 'user',
|
|
19
|
+
defaults: {
|
|
20
|
+
userId: '',
|
|
21
|
+
email: '',
|
|
22
|
+
firstName: '',
|
|
23
|
+
lastName: '',
|
|
24
|
+
fullName: '',
|
|
25
|
+
positionId: '',
|
|
26
|
+
positionName: '',
|
|
27
|
+
departmentCode: '',
|
|
28
|
+
departmentName: ''
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
@Injectable()
|
|
32
|
+
export class UserState {
|
|
33
|
+
@Selector()
|
|
34
|
+
static getUser(state: UserStateModel): UserStateModel {
|
|
35
|
+
return state;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Action(SetUser)
|
|
39
|
+
setUser(ctx: StateContext<UserStateModel>, { payload }: SetUser) {
|
|
40
|
+
ctx.setState(payload);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NgxsConfig } from '@ngxs/store';
|
|
2
|
+
import { NgxsDevtoolsOptions } from '@ngxs/devtools-plugin';
|
|
3
|
+
import { NgxsLoggerPluginOptions } from '@ngxs/logger-plugin';
|
|
4
|
+
|
|
5
|
+
import { AuthState } from './auth/auth.state';
|
|
6
|
+
import { DashboardStates } from './dashboard';
|
|
7
|
+
|
|
8
|
+
export const STATES_MODULES = [AuthState, ...DashboardStates];
|
|
9
|
+
|
|
10
|
+
export const OPTIONS_CONFIG: Partial<NgxsConfig> = {
|
|
11
|
+
/**
|
|
12
|
+
* Run in development mode. This will add additional debugging features:
|
|
13
|
+
* - Object.freeze on the state and actions to guarantee immutability
|
|
14
|
+
* todo: you need set production mode
|
|
15
|
+
* import { environment } from '@env';
|
|
16
|
+
* developmentMode: !environment.production
|
|
17
|
+
*/
|
|
18
|
+
developmentMode: true
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const DEVTOOLS_REDUX_CONFIG: NgxsDevtoolsOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
24
|
+
* todo: you need set production mode
|
|
25
|
+
* import { environment } from '@env';
|
|
26
|
+
* disabled: environment.production
|
|
27
|
+
*/
|
|
28
|
+
disabled: false
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const LOGGER_CONFIG: NgxsLoggerPluginOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* Disable the logger. Useful for prod mode..
|
|
34
|
+
* todo: you need set production mode
|
|
35
|
+
* import { environment } from '@env';
|
|
36
|
+
* disabled: environment.production
|
|
37
|
+
*/
|
|
38
|
+
disabled: false
|
|
39
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NgxsModule } from '@ngxs/store';
|
|
4
|
+
import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin';
|
|
5
|
+
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
|
|
6
|
+
import {
|
|
7
|
+
DEVTOOLS_REDUX_CONFIG,
|
|
8
|
+
LOGGER_CONFIG,
|
|
9
|
+
OPTIONS_CONFIG,
|
|
10
|
+
STATES_MODULES
|
|
11
|
+
} from './store.config';
|
|
12
|
+
|
|
13
|
+
@NgModule({
|
|
14
|
+
imports: [
|
|
15
|
+
CommonModule,
|
|
16
|
+
NgxsModule.forRoot(STATES_MODULES, OPTIONS_CONFIG),
|
|
17
|
+
NgxsReduxDevtoolsPluginModule.forRoot(DEVTOOLS_REDUX_CONFIG),
|
|
18
|
+
NgxsLoggerPluginModule.forRoot(LOGGER_CONFIG)
|
|
19
|
+
],
|
|
20
|
+
exports: [NgxsModule]
|
|
21
|
+
})
|
|
22
|
+
export class NgxsStoreModule {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsNgxsStarterKit",
|
|
4
|
+
"title": "Ngxs Starter Kit Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The path to create the starter kit. Relative to the specified (or default) project."
|
|
10
|
+
},
|
|
11
|
+
"spec": {
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"description": "Specifies if a spec file is generated.",
|
|
14
|
+
"default": true
|
|
15
|
+
},
|
|
16
|
+
"standalone": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Explicitly set whether should generate standalone APIs for the generated starter kit."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["path"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.starterKit = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const generate_utils_1 = require("../utils/generate-utils");
|
|
6
|
+
const ng_ast_utils_1 = require("../utils/ng-utils/ng-ast-utils");
|
|
7
|
+
const project_1 = require("../utils/ng-utils/project");
|
|
8
|
+
const normalize_options_1 = require("../utils/normalize-options");
|
|
9
|
+
function starterKit(options) {
|
|
10
|
+
return (host) => {
|
|
11
|
+
let isStandalone = options.standalone;
|
|
12
|
+
if (typeof isStandalone !== 'boolean') {
|
|
13
|
+
const mainFile = (0, project_1.getProjectMainFile)(host, options.project);
|
|
14
|
+
isStandalone = !!mainFile && (0, ng_ast_utils_1.isStandaloneApp)(host, mainFile);
|
|
15
|
+
}
|
|
16
|
+
const normalizedPath = (0, normalize_options_1.normalizePath)(options.path);
|
|
17
|
+
return (0, generate_utils_1.generateFiles)((0, schematics_1.url)('./files'), normalizedPath, Object.assign(Object.assign({}, options), { isStandalone }), options.spec);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.starterKit = starterKit;
|
|
21
|
+
//# sourceMappingURL=starter-kit.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starter-kit.factory.js","sourceRoot":"","sources":["../../../../../packages/store/schematics/src/starter-kit/starter-kit.factory.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAC7D,4DAAwD;AACxD,iEAAiE;AACjE,uDAA+D;AAC/D,kEAA2D;AAG3D,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,OAAO,YAAY,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,YAAY,GAAG,CAAC,CAAC,QAAQ,IAAI,IAAA,8BAAe,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,iCAAa,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEnD,OAAO,IAAA,8BAAa,EAClB,IAAA,gBAAG,EAAC,SAAS,CAAC,EACd,cAAc,kCACT,OAAO,KAAE,YAAY,KAC1B,OAAO,CAAC,IAAI,CACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAjBD,gCAiBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
import { <% if (isStandalone) { %> provideStore, <% } else { %> NgxsModule, <% } %> Store } from '@ngxs/store';
|
|
3
|
+
import { <%= classify(name) %>State, <%= classify(name) %>StateModel } from './<%= dasherize(name) %>.state';
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %> state', () => {
|
|
6
|
+
let store: Store;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({
|
|
10
|
+
<% if (isStandalone) { %> providers: [provideStore([<%= classify(name) %>State])]
|
|
11
|
+
<% } else { %> imports: [NgxsModule.forRoot([<%= classify(name) %>State])] <% } %>
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
store = TestBed.inject(Store);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should create an empty state', () => {
|
|
18
|
+
const actual = store.selectSnapshot(<%= classify(name) %>State.getState);
|
|
19
|
+
const expected: <%= classify(name) %>StateModel = {
|
|
20
|
+
items: []
|
|
21
|
+
};
|
|
22
|
+
expect(actual).toEqual(expected);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { State, Selector } from '@ngxs/store';
|
|
3
|
+
|
|
4
|
+
export interface <%= classify(name) %>StateModel {
|
|
5
|
+
items: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@State<<%= classify(name) %>StateModel>({
|
|
9
|
+
name: '<%= camelize(name) %>',
|
|
10
|
+
defaults: {
|
|
11
|
+
items: []
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
@Injectable()
|
|
15
|
+
export class <%= classify(name) %>State {
|
|
16
|
+
|
|
17
|
+
@Selector()
|
|
18
|
+
static getState(state: <%= classify(name) %>StateModel) {
|
|
19
|
+
return state;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsNgxsState",
|
|
4
|
+
"title": "Ngxs State Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "The name of the state.",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the state?",
|
|
15
|
+
"x-priority": "important"
|
|
16
|
+
},
|
|
17
|
+
"path": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "path",
|
|
20
|
+
"description": "The path to create the state. Relative to the specified (or default) project."
|
|
21
|
+
},
|
|
22
|
+
"spec": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"description": "Specifies if a spec file is generated.",
|
|
25
|
+
"default": true
|
|
26
|
+
},
|
|
27
|
+
"flat": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"default": false,
|
|
30
|
+
"description": "Flag to indicate if a dir is created."
|
|
31
|
+
},
|
|
32
|
+
"project": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The name of the project.",
|
|
35
|
+
"aliases": ["p"],
|
|
36
|
+
"x-dropdown": "projects"
|
|
37
|
+
},
|
|
38
|
+
"standalone": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Explicitly set whether should generate standalone APIs for the generated state."
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["name"]
|
|
44
|
+
}
|