@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.
Files changed (379) hide show
  1. package/README.md +1 -1
  2. package/{esm2015/index.js → esm2022/index.mjs} +2 -2
  3. package/esm2022/internals/custom-rxjs-subjects.mjs +92 -0
  4. package/esm2022/internals/index.mjs +10 -0
  5. package/esm2022/internals/initial-state.mjs +18 -0
  6. package/esm2022/internals/internal-tokens.mjs +6 -0
  7. package/esm2022/internals/memoize.mjs +45 -0
  8. package/esm2022/internals/metadata.mjs +57 -0
  9. package/esm2022/internals/ngxs-app-bootstrapped-state.mjs +19 -0
  10. package/esm2022/internals/state-stream.mjs +32 -0
  11. package/esm2022/internals/state-token.mjs +17 -0
  12. package/esm2022/internals/symbols.mjs +11 -0
  13. package/esm2022/internals/testing/fresh-platform.mjs +72 -0
  14. package/{esm2015/internals/testing/helpers/ngxs-test.component.js → esm2022/internals/testing/helpers/ngxs-test.component.mjs} +4 -4
  15. package/esm2022/internals/testing/helpers/ngxs-test.module.mjs +20 -0
  16. package/{esm2015/internals/testing/index.js → esm2022/internals/testing/index.mjs} +2 -2
  17. package/esm2022/internals/testing/ngxs.setup.mjs +48 -0
  18. package/{esm2015/internals/testing/skip-console-logging.js → esm2022/internals/testing/skip-console-logging.mjs} +1 -1
  19. package/esm2022/internals/testing/symbol.mjs +2 -0
  20. package/esm2022/operators/append.mjs +20 -0
  21. package/esm2022/operators/iif.mjs +38 -0
  22. package/esm2022/operators/insert-item.mjs +29 -0
  23. package/esm2022/operators/patch.mjs +21 -0
  24. package/esm2022/operators/remove-item.mjs +22 -0
  25. package/esm2022/operators/update-item.mjs +40 -0
  26. package/esm2022/plugins/actions.mjs +16 -0
  27. package/esm2022/plugins/index.mjs +4 -0
  28. package/esm2022/plugins/ngxs-store-plugins.mjs +5 -0
  29. package/esm2022/plugins/symbols.mjs +6 -0
  30. package/esm2022/plugins/utils.mjs +51 -0
  31. package/esm2022/src/actions/symbols.mjs +2 -0
  32. package/esm2022/src/actions-stream.mjs +52 -0
  33. package/esm2022/src/configs/messages.config.mjs +48 -0
  34. package/esm2022/src/decorators/action.mjs +31 -0
  35. package/esm2022/src/decorators/select/select-factory.mjs +29 -0
  36. package/esm2022/src/decorators/select/select.mjs +29 -0
  37. package/esm2022/src/decorators/select/symbols.mjs +29 -0
  38. package/esm2022/src/decorators/selector/selector.mjs +29 -0
  39. package/esm2022/src/decorators/selector/symbols.mjs +2 -0
  40. package/esm2022/src/decorators/selector-options.mjs +21 -0
  41. package/esm2022/src/decorators/state.mjs +35 -0
  42. package/esm2022/src/dev-features/ngxs-development.module.mjs +28 -0
  43. package/esm2022/src/dev-features/ngxs-unhandled-actions-logger.mjs +45 -0
  44. package/esm2022/src/dev-features/symbols.mjs +7 -0
  45. package/esm2022/src/execution/dispatch-outside-zone-ngxs-execution-strategy.mjs +55 -0
  46. package/{esm2015/src/execution/internal-ngxs-execution-strategy.js → esm2022/src/execution/internal-ngxs-execution-strategy.mjs} +6 -6
  47. package/{esm2015/src/execution/noop-ngxs-execution-strategy.js → esm2022/src/execution/noop-ngxs-execution-strategy.mjs} +4 -4
  48. package/esm2022/src/execution/symbols.mjs +29 -0
  49. package/esm2022/src/internal/dispatcher.mjs +106 -0
  50. package/esm2022/src/internal/fallback-subscriber.mjs +29 -0
  51. package/esm2022/src/internal/internals.mjs +206 -0
  52. package/esm2022/src/internal/lifecycle-state-manager.mjs +86 -0
  53. package/esm2022/src/internal/state-context-factory.mjs +71 -0
  54. package/esm2022/src/internal/state-factory.mjs +311 -0
  55. package/esm2022/src/internal/state-operations.mjs +63 -0
  56. package/esm2022/src/internal/state-operators.mjs +20 -0
  57. package/esm2022/src/internal/unhandled-rxjs-error-callback.mjs +39 -0
  58. package/esm2022/src/ivy/ivy-enabled-in-dev-mode.mjs +25 -0
  59. package/esm2022/src/module.mjs +27 -0
  60. package/esm2022/src/modules/ngxs-feature.module.mjs +18 -0
  61. package/esm2022/src/modules/ngxs-root.module.mjs +18 -0
  62. package/esm2022/src/ngxs-unhandled-error-handler.mjs +29 -0
  63. package/esm2022/src/operators/of-action.mjs +104 -0
  64. package/esm2022/src/plugin-manager.mjs +37 -0
  65. package/esm2022/src/plugin_api.mjs +2 -0
  66. package/{esm2015/src/private_api.js → esm2022/src/private_api.mjs} +2 -1
  67. package/esm2022/src/public_api.mjs +20 -0
  68. package/esm2022/src/selectors/create-model-selector.mjs +30 -0
  69. package/esm2022/src/selectors/create-pick-selector.mjs +16 -0
  70. package/esm2022/src/selectors/create-property-selectors.mjs +20 -0
  71. package/esm2022/src/selectors/create-selector.mjs +9 -0
  72. package/esm2022/src/selectors/private_api.mjs +2 -0
  73. package/esm2022/src/selectors/selector-checks.util.mjs +18 -0
  74. package/esm2022/src/selectors/selector-metadata.mjs +35 -0
  75. package/esm2022/src/selectors/selector-models.mjs +2 -0
  76. package/esm2022/src/selectors/selector-types.util.mjs +2 -0
  77. package/esm2022/src/selectors/selector-utils.mjs +95 -0
  78. package/esm2022/src/standalone-features/feature-providers.mjs +20 -0
  79. package/esm2022/src/standalone-features/index.mjs +5 -0
  80. package/esm2022/src/standalone-features/initializers.mjs +89 -0
  81. package/esm2022/src/standalone-features/plugin.mjs +20 -0
  82. package/esm2022/src/standalone-features/preboot.mjs +32 -0
  83. package/esm2022/src/standalone-features/provide-states.mjs +26 -0
  84. package/esm2022/src/standalone-features/provide-store.mjs +26 -0
  85. package/esm2022/src/standalone-features/root-providers.mjs +47 -0
  86. package/esm2022/src/store.mjs +117 -0
  87. package/esm2022/src/symbols.mjs +87 -0
  88. package/esm2022/src/utils/compose.mjs +26 -0
  89. package/esm2022/src/utils/create-dispatch-map.mjs +11 -0
  90. package/esm2022/src/utils/create-select-map.mjs +13 -0
  91. package/esm2022/src/utils/dispatch.mjs +7 -0
  92. package/{esm2015/src/utils/freeze.js → esm2022/src/utils/freeze.mjs} +1 -1
  93. package/esm2022/src/utils/public_api.mjs +5 -0
  94. package/esm2022/src/utils/select.mjs +19 -0
  95. package/esm2022/src/utils/store-validators.mjs +25 -0
  96. package/{fesm2015/ngxs-store-internals-testing.js → fesm2022/ngxs-store-internals-testing.mjs} +84 -81
  97. package/fesm2022/ngxs-store-internals-testing.mjs.map +1 -0
  98. package/fesm2022/ngxs-store-internals.mjs +296 -0
  99. package/fesm2022/ngxs-store-internals.mjs.map +1 -0
  100. package/{fesm2015/ngxs-store-operators.js → fesm2022/ngxs-store-operators.mjs} +3 -3
  101. package/fesm2022/ngxs-store-operators.mjs.map +1 -0
  102. package/fesm2022/ngxs-store-plugins.mjs +80 -0
  103. package/fesm2022/ngxs-store-plugins.mjs.map +1 -0
  104. package/{fesm2015/ngxs-store.js → fesm2022/ngxs-store.mjs} +1319 -1265
  105. package/fesm2022/ngxs-store.mjs.map +1 -0
  106. package/index.d.ts +1 -1
  107. package/{src/internal → internals}/custom-rxjs-subjects.d.ts +2 -2
  108. package/internals/index.d.ts +8 -4
  109. package/internals/initial-state.d.ts +5 -5
  110. package/internals/memoize.d.ts +1 -1
  111. package/internals/metadata.d.ts +25 -0
  112. package/internals/ngxs-app-bootstrapped-state.d.ts +8 -0
  113. package/internals/state-stream.d.ts +15 -0
  114. package/internals/state-token.d.ts +7 -0
  115. package/internals/symbols.d.ts +84 -3
  116. package/internals/testing/helpers/ngxs-test.component.d.ts +1 -1
  117. package/internals/testing/index.d.ts +2 -2
  118. package/internals/testing/symbol.d.ts +2 -2
  119. package/operators/patch.d.ts +2 -2
  120. package/operators/types.d.ts +5 -5
  121. package/operators/utils.d.ts +1 -1
  122. package/package.json +44 -13
  123. package/{src/actions → plugins}/actions.d.ts +3 -3
  124. package/plugins/index.d.ts +3 -0
  125. package/plugins/symbols.d.ts +13 -0
  126. package/{src/utils → plugins}/utils.d.ts +0 -17
  127. package/schematics/collection.json +36 -0
  128. package/schematics/src/actions/actions.factory.d.ts +3 -0
  129. package/schematics/src/actions/actions.factory.js +24 -0
  130. package/schematics/src/actions/actions.factory.js.map +1 -0
  131. package/schematics/src/actions/files/__name__.actions.ts__template__ +4 -0
  132. package/schematics/src/actions/schema.json +35 -0
  133. package/schematics/src/ng-add/add-declaration.d.ts +4 -0
  134. package/schematics/src/ng-add/add-declaration.js +109 -0
  135. package/schematics/src/ng-add/add-declaration.js.map +1 -0
  136. package/schematics/src/ng-add/ng-add.factory.d.ts +9 -0
  137. package/schematics/src/ng-add/ng-add.factory.js +89 -0
  138. package/schematics/src/ng-add/ng-add.factory.js.map +1 -0
  139. package/schematics/src/ng-add/schema.json +72 -0
  140. package/schematics/src/starter-kit/files/store/auth/auth.actions.ts__template__ +6 -0
  141. package/schematics/src/starter-kit/files/store/auth/auth.state.spec.ts__template__ +55 -0
  142. package/schematics/src/starter-kit/files/store/auth/auth.state.ts__template__ +47 -0
  143. package/schematics/src/starter-kit/files/store/dashboard/index.ts__template__ +4 -0
  144. package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.actions.ts__template__ +10 -0
  145. package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.spec.ts__template__ +92 -0
  146. package/schematics/src/starter-kit/files/store/dashboard/states/dictionary/dictionary.state.ts__template__ +62 -0
  147. package/schematics/src/starter-kit/files/store/dashboard/states/user/user.actions.ts__template__ +6 -0
  148. package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.spec.ts__template__ +61 -0
  149. package/schematics/src/starter-kit/files/store/dashboard/states/user/user.state.ts__template__ +42 -0
  150. package/schematics/src/starter-kit/files/store/store.config.ts__template__ +39 -0
  151. package/schematics/src/starter-kit/files/store/store.module.ts__template__ +22 -0
  152. package/schematics/src/starter-kit/schema.json +22 -0
  153. package/schematics/src/starter-kit/starter-kit.factory.d.ts +3 -0
  154. package/schematics/src/starter-kit/starter-kit.factory.js +21 -0
  155. package/schematics/src/starter-kit/starter-kit.factory.js.map +1 -0
  156. package/schematics/src/state/files/__name__.state.spec.ts__template__ +25 -0
  157. package/schematics/src/state/files/__name__.state.ts__template__ +22 -0
  158. package/schematics/src/state/schema.json +44 -0
  159. package/schematics/src/state/state.factory.d.ts +3 -0
  160. package/schematics/src/state/state.factory.js +29 -0
  161. package/schematics/src/state/state.factory.js.map +1 -0
  162. package/schematics/src/store/files/__name__.actions.ts__template__ +4 -0
  163. package/schematics/src/store/files/__name__.state.spec.ts__template__ +26 -0
  164. package/schematics/src/store/files/__name__.state.ts__template__ +29 -0
  165. package/schematics/src/store/schema.json +44 -0
  166. package/schematics/src/store/store.factory.d.ts +3 -0
  167. package/schematics/src/store/store.factory.js +29 -0
  168. package/schematics/src/store/store.factory.js.map +1 -0
  169. package/schematics/src/utils/common/lib.config.d.ts +10 -0
  170. package/schematics/src/utils/common/lib.config.js +15 -0
  171. package/schematics/src/utils/common/lib.config.js.map +1 -0
  172. package/schematics/src/utils/common/project-files.config.d.ts +3 -0
  173. package/schematics/src/utils/common/project-files.config.js +7 -0
  174. package/schematics/src/utils/common/project-files.config.js.map +1 -0
  175. package/schematics/src/utils/common/properties.d.ts +1 -0
  176. package/schematics/src/utils/common/properties.js +8 -0
  177. package/schematics/src/utils/common/properties.js.map +1 -0
  178. package/schematics/src/utils/config.d.ts +119 -0
  179. package/schematics/src/utils/config.js +21 -0
  180. package/schematics/src/utils/config.js.map +1 -0
  181. package/schematics/src/utils/generate-utils.d.ts +4 -0
  182. package/schematics/src/utils/generate-utils.js +14 -0
  183. package/schematics/src/utils/generate-utils.js.map +1 -0
  184. package/schematics/src/utils/interfaces/package.interface.d.ts +7 -0
  185. package/schematics/src/utils/interfaces/package.interface.js +3 -0
  186. package/schematics/src/utils/interfaces/package.interface.js.map +1 -0
  187. package/schematics/src/utils/ng-utils/README.md +1 -0
  188. package/schematics/src/utils/ng-utils/ast-utils.d.ts +99 -0
  189. package/schematics/src/utils/ng-utils/ast-utils.js +517 -0
  190. package/schematics/src/utils/ng-utils/ast-utils.js.map +1 -0
  191. package/schematics/src/utils/ng-utils/ng-ast-utils.d.ts +5 -0
  192. package/schematics/src/utils/ng-utils/ng-ast-utils.js +67 -0
  193. package/schematics/src/utils/ng-utils/ng-ast-utils.js.map +1 -0
  194. package/schematics/src/utils/ng-utils/project.d.ts +2 -0
  195. package/schematics/src/utils/ng-utils/project.js +27 -0
  196. package/schematics/src/utils/ng-utils/project.js.map +1 -0
  197. package/schematics/src/utils/ng-utils/standalone/app_config.d.ts +16 -0
  198. package/schematics/src/utils/ng-utils/standalone/app_config.js +84 -0
  199. package/schematics/src/utils/ng-utils/standalone/app_config.js.map +1 -0
  200. package/schematics/src/utils/ng-utils/standalone/code_block.d.ts +46 -0
  201. package/schematics/src/utils/ng-utils/standalone/code_block.js +73 -0
  202. package/schematics/src/utils/ng-utils/standalone/code_block.js.map +1 -0
  203. package/schematics/src/utils/ng-utils/standalone/index.d.ts +1 -0
  204. package/schematics/src/utils/ng-utils/standalone/index.js +7 -0
  205. package/schematics/src/utils/ng-utils/standalone/index.js.map +1 -0
  206. package/schematics/src/utils/ng-utils/standalone/rules.d.ts +38 -0
  207. package/schematics/src/utils/ng-utils/standalone/rules.js +195 -0
  208. package/schematics/src/utils/ng-utils/standalone/rules.js.map +1 -0
  209. package/schematics/src/utils/ng-utils/standalone/util.d.ts +28 -0
  210. package/schematics/src/utils/ng-utils/standalone/util.js +138 -0
  211. package/schematics/src/utils/ng-utils/standalone/util.js.map +1 -0
  212. package/schematics/src/utils/normalize-options.d.ts +11 -0
  213. package/schematics/src/utils/normalize-options.js +27 -0
  214. package/schematics/src/utils/normalize-options.js.map +1 -0
  215. package/schematics/src/utils/project.d.ts +19 -0
  216. package/schematics/src/utils/project.js +46 -0
  217. package/schematics/src/utils/project.js.map +1 -0
  218. package/schematics/src/utils/versions.json +3 -0
  219. package/src/actions/symbols.d.ts +3 -17
  220. package/src/actions-stream.d.ts +2 -2
  221. package/src/configs/messages.config.d.ts +3 -1
  222. package/src/decorators/action.d.ts +28 -3
  223. package/src/decorators/select/select.d.ts +3 -0
  224. package/src/decorators/select/symbols.d.ts +2 -3
  225. package/src/decorators/selector/selector.d.ts +2 -3
  226. package/src/decorators/selector/symbols.d.ts +73 -4
  227. package/src/decorators/selector-options.d.ts +2 -2
  228. package/src/decorators/state.d.ts +2 -3
  229. package/src/dev-features/ngxs-development.module.d.ts +1 -0
  230. package/src/execution/symbols.d.ts +8 -2
  231. package/src/internal/dispatcher.d.ts +5 -5
  232. package/src/internal/fallback-subscriber.d.ts +3 -0
  233. package/src/internal/internals.d.ts +13 -69
  234. package/src/internal/lifecycle-state-manager.d.ts +6 -6
  235. package/src/internal/state-factory.d.ts +8 -6
  236. package/src/internal/state-operations.d.ts +2 -2
  237. package/src/internal/unhandled-rxjs-error-callback.d.ts +2 -0
  238. package/src/module.d.ts +3 -14
  239. package/src/modules/ngxs-feature.module.d.ts +2 -9
  240. package/src/modules/ngxs-root.module.d.ts +2 -9
  241. package/src/ngxs-unhandled-error-handler.d.ts +16 -0
  242. package/src/operators/of-action.d.ts +3 -3
  243. package/src/plugin-manager.d.ts +1 -1
  244. package/src/plugin_api.d.ts +1 -5
  245. package/src/private_api.d.ts +1 -0
  246. package/src/public_api.d.ts +11 -8
  247. package/src/selectors/create-model-selector.d.ts +2 -2
  248. package/src/selectors/create-pick-selector.d.ts +1 -1
  249. package/src/selectors/create-property-selectors.d.ts +3 -3
  250. package/src/selectors/create-selector.d.ts +10 -10
  251. package/src/selectors/private_api.d.ts +7 -0
  252. package/src/selectors/selector-checks.util.d.ts +2 -2
  253. package/src/selectors/selector-metadata.d.ts +4 -4
  254. package/src/selectors/selector-models.d.ts +4 -4
  255. package/src/selectors/selector-types.util.d.ts +6 -7
  256. package/src/selectors/selector-utils.d.ts +3 -3
  257. package/src/standalone-features/feature-providers.d.ts +7 -0
  258. package/src/standalone-features/index.d.ts +4 -0
  259. package/src/standalone-features/initializers.d.ts +29 -0
  260. package/src/standalone-features/plugin.d.ts +17 -0
  261. package/src/standalone-features/preboot.d.ts +26 -0
  262. package/src/standalone-features/provide-states.d.ts +18 -0
  263. package/src/standalone-features/provide-store.d.ts +22 -0
  264. package/src/standalone-features/root-providers.d.ts +8 -0
  265. package/src/store.d.ts +13 -15
  266. package/src/symbols.d.ts +12 -54
  267. package/src/utils/compose.d.ts +1 -1
  268. package/src/utils/create-dispatch-map.d.ts +4 -0
  269. package/src/utils/create-select-map.d.ts +4 -0
  270. package/src/utils/dispatch.d.ts +2 -0
  271. package/src/utils/public_api.d.ts +4 -0
  272. package/src/utils/select.d.ts +16 -0
  273. package/src/utils/store-validators.d.ts +4 -3
  274. package/bundles/ngxs-store-internals-testing.umd.js +0 -684
  275. package/bundles/ngxs-store-internals-testing.umd.js.map +0 -1
  276. package/bundles/ngxs-store-internals.umd.js +0 -141
  277. package/bundles/ngxs-store-internals.umd.js.map +0 -1
  278. package/bundles/ngxs-store-operators.umd.js +0 -224
  279. package/bundles/ngxs-store-operators.umd.js.map +0 -1
  280. package/bundles/ngxs-store.umd.js +0 -3076
  281. package/bundles/ngxs-store.umd.js.map +0 -1
  282. package/esm2015/internals/index.js +0 -5
  283. package/esm2015/internals/initial-state.js +0 -17
  284. package/esm2015/internals/internal-tokens.js +0 -5
  285. package/esm2015/internals/memoize.js +0 -45
  286. package/esm2015/internals/ngxs-bootstrapper.js +0 -29
  287. package/esm2015/internals/src/symbols.js +0 -2
  288. package/esm2015/internals/symbols.js +0 -2
  289. package/esm2015/internals/testing/fresh-platform.js +0 -70
  290. package/esm2015/internals/testing/helpers/ngxs-test.module.js +0 -21
  291. package/esm2015/internals/testing/ngxs.setup.js +0 -46
  292. package/esm2015/internals/testing/symbol.js +0 -2
  293. package/esm2015/operators/append.js +0 -20
  294. package/esm2015/operators/iif.js +0 -38
  295. package/esm2015/operators/insert-item.js +0 -29
  296. package/esm2015/operators/patch.js +0 -21
  297. package/esm2015/operators/remove-item.js +0 -22
  298. package/esm2015/operators/update-item.js +0 -40
  299. package/esm2015/src/actions/actions.js +0 -16
  300. package/esm2015/src/actions/symbols.js +0 -2
  301. package/esm2015/src/actions-stream.js +0 -52
  302. package/esm2015/src/configs/messages.config.js +0 -36
  303. package/esm2015/src/decorators/action.js +0 -33
  304. package/esm2015/src/decorators/select/select-factory.js +0 -29
  305. package/esm2015/src/decorators/select/select.js +0 -26
  306. package/esm2015/src/decorators/select/symbols.js +0 -29
  307. package/esm2015/src/decorators/selector/selector.js +0 -32
  308. package/esm2015/src/decorators/selector/symbols.js +0 -2
  309. package/esm2015/src/decorators/selector-options.js +0 -21
  310. package/esm2015/src/decorators/state.js +0 -36
  311. package/esm2015/src/dev-features/ngxs-development.module.js +0 -22
  312. package/esm2015/src/dev-features/ngxs-unhandled-actions-logger.js +0 -46
  313. package/esm2015/src/dev-features/symbols.js +0 -6
  314. package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +0 -57
  315. package/esm2015/src/execution/symbols.js +0 -23
  316. package/esm2015/src/internal/custom-rxjs-subjects.js +0 -92
  317. package/esm2015/src/internal/dispatcher.js +0 -104
  318. package/esm2015/src/internal/error-handler.js +0 -64
  319. package/esm2015/src/internal/internals.js +0 -248
  320. package/esm2015/src/internal/lifecycle-state-manager.js +0 -79
  321. package/esm2015/src/internal/state-context-factory.js +0 -68
  322. package/esm2015/src/internal/state-factory.js +0 -288
  323. package/esm2015/src/internal/state-operations.js +0 -63
  324. package/esm2015/src/internal/state-operators.js +0 -20
  325. package/esm2015/src/internal/state-stream.js +0 -25
  326. package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +0 -25
  327. package/esm2015/src/module.js +0 -88
  328. package/esm2015/src/modules/ngxs-feature.module.js +0 -45
  329. package/esm2015/src/modules/ngxs-root.module.js +0 -41
  330. package/esm2015/src/operators/of-action.js +0 -102
  331. package/esm2015/src/plugin-manager.js +0 -37
  332. package/esm2015/src/plugin_api.js +0 -6
  333. package/esm2015/src/public_api.js +0 -27
  334. package/esm2015/src/public_to_deprecate.js +0 -14
  335. package/esm2015/src/selectors/create-model-selector.js +0 -30
  336. package/esm2015/src/selectors/create-pick-selector.js +0 -16
  337. package/esm2015/src/selectors/create-property-selectors.js +0 -20
  338. package/esm2015/src/selectors/create-selector.js +0 -9
  339. package/esm2015/src/selectors/selector-checks.util.js +0 -18
  340. package/esm2015/src/selectors/selector-metadata.js +0 -30
  341. package/esm2015/src/selectors/selector-models.js +0 -2
  342. package/esm2015/src/selectors/selector-types.util.js +0 -2
  343. package/esm2015/src/selectors/selector-utils.js +0 -74
  344. package/esm2015/src/state-token/state-token.js +0 -17
  345. package/esm2015/src/state-token/symbols.js +0 -2
  346. package/esm2015/src/store.js +0 -107
  347. package/esm2015/src/symbols.js +0 -58
  348. package/esm2015/src/utils/compose.js +0 -26
  349. package/esm2015/src/utils/store-validators.js +0 -25
  350. package/esm2015/src/utils/utils.js +0 -92
  351. package/fesm2015/ngxs-store-internals-testing.js.map +0 -1
  352. package/fesm2015/ngxs-store-internals.js +0 -101
  353. package/fesm2015/ngxs-store-internals.js.map +0 -1
  354. package/fesm2015/ngxs-store-operators.js.map +0 -1
  355. package/fesm2015/ngxs-store.js.map +0 -1
  356. package/internals/ngxs-bootstrapper.d.ts +0 -16
  357. package/internals/ngxs-store-internals.d.ts +0 -5
  358. package/internals/package.json +0 -10
  359. package/internals/src/symbols.d.ts +0 -7
  360. package/internals/testing/ngxs-store-internals-testing.d.ts +0 -5
  361. package/internals/testing/package.json +0 -10
  362. package/ngxs-store.d.ts +0 -5
  363. package/operators/ngxs-store-operators.d.ts +0 -5
  364. package/operators/package.json +0 -10
  365. package/src/internal/error-handler.d.ts +0 -26
  366. package/src/internal/state-stream.d.ts +0 -14
  367. package/src/public_to_deprecate.d.ts +0 -21
  368. package/src/state-token/state-token.d.ts +0 -7
  369. package/src/state-token/symbols.d.ts +0 -5
  370. /package/{esm2015/internals/ngxs-store-internals.js → esm2022/internals/ngxs-store-internals.mjs} +0 -0
  371. /package/{esm2015/internals/testing/ngxs-store-internals-testing.js → esm2022/internals/testing/ngxs-store-internals-testing.mjs} +0 -0
  372. /package/{esm2015/ngxs-store.js → esm2022/ngxs-store.mjs} +0 -0
  373. /package/{esm2015/operators/compose.js → esm2022/operators/compose.mjs} +0 -0
  374. /package/{esm2015/operators/index.js → esm2022/operators/index.mjs} +0 -0
  375. /package/{esm2015/operators/ngxs-store-operators.js → esm2022/operators/ngxs-store-operators.mjs} +0 -0
  376. /package/{esm2015/operators/types.js → esm2022/operators/types.mjs} +0 -0
  377. /package/{esm2015/operators/utils.js → esm2022/operators/utils.mjs} +0 -0
  378. /package/{esm2015/src/operators/leave-ngxs.js → esm2022/src/operators/leave-ngxs.mjs} +0 -0
  379. /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,6 @@
1
+ import { AuthenticationStateModel } from './auth.state';
2
+
3
+ export class SetAuthData {
4
+ static readonly type = '[Auth] Auth data';
5
+ constructor(readonly payload: AuthenticationStateModel) {}
6
+ }
@@ -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,4 @@
1
+ import { DictionaryState } from './states/dictionary/dictionary.state';
2
+ import { UserState } from './states/user/user.state';
3
+
4
+ export const DashboardStates = [DictionaryState, UserState];
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ import { UserStateModel } from './user.state';
2
+
3
+ export class SetUser {
4
+ static readonly type = '[SetUser] action';
5
+ constructor(readonly payload: UserStateModel) {}
6
+ }
@@ -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
+ });
@@ -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,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { StarterKitSchema } from './starter-kit.schema';
3
+ export declare function starterKit(options: StarterKitSchema): Rule;
@@ -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
+ }