@ngxs/store 19.0.0-dev.master-2b2355c → 19.0.0-dev.master-7f34db4

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 (54) hide show
  1. package/fesm2022/ngxs-store-internals-testing.mjs +3 -5
  2. package/fesm2022/ngxs-store-internals-testing.mjs.map +1 -1
  3. package/fesm2022/ngxs-store.mjs +126 -173
  4. package/fesm2022/ngxs-store.mjs.map +1 -1
  5. package/index.d.ts +6 -42
  6. package/internals/testing/index.d.ts +1 -1
  7. package/package.json +5 -9
  8. package/schematics/src/actions/actions.factory.js +3 -3
  9. package/schematics/src/actions/actions.factory.js.map +1 -1
  10. package/schematics/src/ng-add/add-declaration.js +1 -1
  11. package/schematics/src/ng-add/add-declaration.js.map +1 -1
  12. package/schematics/src/ng-add/ng-add.factory.js +4 -4
  13. package/schematics/src/ng-add/ng-add.factory.js.map +1 -1
  14. package/schematics/src/starter-kit/starter-kit.factory.js +3 -3
  15. package/schematics/src/starter-kit/starter-kit.factory.js.map +1 -1
  16. package/schematics/src/state/state.factory.js +4 -4
  17. package/schematics/src/state/state.factory.js.map +1 -1
  18. package/schematics/src/store/store.factory.js +4 -4
  19. package/schematics/src/store/store.factory.js.map +1 -1
  20. package/schematics/src/utils/common/lib.config.js.map +1 -0
  21. package/schematics/src/utils/common/project-files.config.js +7 -0
  22. package/schematics/src/utils/common/project-files.config.js.map +1 -0
  23. package/schematics/src/utils/common/properties.js.map +1 -0
  24. package/schematics/src/utils/config.js.map +1 -0
  25. package/schematics/src/utils/generate-utils.js.map +1 -0
  26. package/schematics/src/utils/interfaces/package.interface.js +3 -0
  27. package/schematics/src/utils/interfaces/package.interface.js.map +1 -0
  28. package/schematics/src/utils/normalize-options.js.map +1 -0
  29. package/schematics/src/utils/project.js.map +1 -0
  30. package/schematics/src/utils/versions.json +3 -0
  31. package/migrations/migrations.json +0 -11
  32. package/migrations/src/19_1_0/__snapshots__/index.spec.ts.snap +0 -151
  33. package/migrations/src/19_1_0/index.js +0 -213
  34. package/migrations/src/19_1_0/index.js.map +0 -1
  35. package/migrations/src/19_1_0/index.spec.js +0 -220
  36. package/migrations/src/19_1_0/index.spec.js.map +0 -1
  37. package/schematics-utils/_testing/index.js +0 -18
  38. package/schematics-utils/_testing/index.js.map +0 -1
  39. package/schematics-utils/_testing/schematics.js +0 -70
  40. package/schematics-utils/_testing/schematics.js.map +0 -1
  41. package/schematics-utils/src/common/lib.config.js.map +0 -1
  42. package/schematics-utils/src/common/properties.js.map +0 -1
  43. package/schematics-utils/src/config.js.map +0 -1
  44. package/schematics-utils/src/file-utils.js +0 -26
  45. package/schematics-utils/src/file-utils.js.map +0 -1
  46. package/schematics-utils/src/generate-utils.js.map +0 -1
  47. package/schematics-utils/src/normalize-options.js.map +0 -1
  48. package/schematics-utils/src/project.js.map +0 -1
  49. /package/{schematics-utils/src → schematics/src/utils}/common/lib.config.js +0 -0
  50. /package/{schematics-utils/src → schematics/src/utils}/common/properties.js +0 -0
  51. /package/{schematics-utils/src → schematics/src/utils}/config.js +0 -0
  52. /package/{schematics-utils/src → schematics/src/utils}/generate-utils.js +0 -0
  53. /package/{schematics-utils/src → schematics/src/utils}/normalize-options.js +0 -0
  54. /package/{schematics-utils/src → schematics/src/utils}/project.js +0 -0
@@ -4,7 +4,7 @@ import { ɵgetDOM as _getDOM, BrowserModule, ɵBrowserDomAdapter as _BrowserDomA
4
4
  import * as i0 from '@angular/core';
5
5
  import { destroyPlatform, VERSION, createPlatform, Component, NgModule, ApplicationRef, provideEnvironmentInitializer, inject, DestroyRef, Injectable } from '@angular/core';
6
6
  import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
7
- import { NgxsModule, DispatchOutsideZoneNgxsExecutionStrategy, Store, Actions } from '@ngxs/store';
7
+ import { NgxsModule, Store, Actions } from '@ngxs/store';
8
8
  import { ReplaySubject, Subject, takeUntil } from 'rxjs';
9
9
 
10
10
  function createRootElement() {
@@ -150,9 +150,7 @@ class NgxsTestBed {
150
150
  skipConsoleLogging(() => TestBed.configureTestingModule({
151
151
  imports: [
152
152
  NgxsTestModule,
153
- NgxsModule.forRoot(options.states || [], options.ngxsOptions || {
154
- executionStrategy: DispatchOutsideZoneNgxsExecutionStrategy
155
- }),
153
+ NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),
156
154
  ...(options.imports || [])
157
155
  ]
158
156
  }).compileComponents());
@@ -194,7 +192,7 @@ class NgxsActionCollector {
194
192
  * {
195
193
  * providers: [
196
194
  * NgxsActionCollector.collectActions(),
197
- * provideStore([MyState], { executionStrategy: ... }),
195
+ * provideStore([MyState]),
198
196
  * ],
199
197
  * // ...
200
198
  * }
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals-testing.mjs","sources":["../../../packages/store/internals/testing/src/fresh-platform.ts","../../../packages/store/internals/testing/src/helpers/ngxs-test.component.ts","../../../packages/store/internals/testing/src/helpers/ngxs-test.module.ts","../../../packages/store/internals/testing/src/skip-console-logging.ts","../../../packages/store/internals/testing/src/ngxs.setup.ts","../../../packages/store/internals/testing/src/action-collector.ts","../../../packages/store/internals/testing/src/ngxs-store-internals-testing.ts"],"sourcesContent":["import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { VERSION, destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne(freshUrl: string) {\n destroyPlatform();\n resetLocationToUrl(freshUrl);\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n const version = +VERSION.major;\n // https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa\n if (version < 14) {\n createPlatform(TestBed);\n }\n}\n\nfunction resetLocationToUrl(freshUrl: string) {\n window.history.replaceState({}, 'Test', freshUrl);\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let resolve: VoidFunction | null = null;\n let reject: ((error: Error) => void) | null = null;\n let whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n const freshUrl = '/';\n destroyPlatformBeforeBootstrappingTheNewOne(freshUrl);\n\n if (hasDoneArgument) {\n await fn((error?: Error) => {\n if (error) {\n reject!(error);\n } else {\n resolve!();\n }\n });\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n","import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule, NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","export type ConsoleRecord = [string, any[]];\nexport type ConsoleRecorder = ConsoleRecord[];\n\nexport function loggedError(message: string): ConsoleRecord {\n return ['error', [expect.objectContaining({ message })]];\n}\n\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(\n fn: T,\n consoleRecorder: ConsoleRecorder = []\n): ReturnType<T> {\n const consoleSpies = [\n jest.spyOn(console, 'log').mockImplementation((...args) => {\n consoleRecorder.push(['log', args]);\n }),\n jest.spyOn(console, 'warn').mockImplementation((...args) => {\n consoleRecorder.push(['warn', args]);\n }),\n jest.spyOn(console, 'error').mockImplementation((...args) => {\n consoleRecorder.push(['error', args]);\n }),\n jest.spyOn(console, 'info').mockImplementation((...args) => {\n consoleRecorder.push(['info', args]);\n })\n ];\n function restoreSpies() {\n consoleSpies.forEach(spy => spy.mockRestore());\n }\n let restoreSpyAsync = false;\n try {\n const returnValue = fn();\n if (returnValue instanceof Promise) {\n restoreSpyAsync = true;\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\n }\n return returnValue;\n } finally {\n if (!restoreSpyAsync) {\n restoreSpies();\n }\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { DispatchOutsideZoneNgxsExecutionStrategy, NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\nimport { skipConsoleLogging } from './skip-console-logging';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n skipConsoleLogging(() =>\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(\n options.states || [],\n options.ngxsOptions || {\n executionStrategy: DispatchOutsideZoneNgxsExecutionStrategy\n }\n ),\n ...(options.imports || [])\n ]\n }).compileComponents()\n );\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {\n teardown: { destroyAfterEach: true }\n });\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import {\n DestroyRef,\n EnvironmentProviders,\n inject,\n Injectable,\n provideEnvironmentInitializer\n} from '@angular/core';\nimport { Actions, ActionStatus, type ActionContext } from '@ngxs/store';\nimport { ReplaySubject, Subject, takeUntil } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class NgxsActionCollector {\n /**\n * Including this in your providers will\n * set up the the action collector to start collecting actions\n * from before NGXS initializes\n * @example\n * // In your providers declaration for your tests:\n * {\n * providers: [\n * NgxsActionCollector.collectActions(),\n * provideStore([MyState], { executionStrategy: ... }),\n * ],\n * // ...\n * }\n * // and then in your test:\n * const actionCollector = TestBed.inject(NgxsActionCollector);\n * const actionsDispatched = actionCollector.dispatched;\n * const action = actionsDispatched.find(\n * (item) => item instanceof MyAction\n * );\n * expect(action).toBeDefined();\n * @returns An environment initializer that starts the collector immediately\n */\n static collectActions(): EnvironmentProviders {\n return provideEnvironmentInitializer(() => {\n inject(NgxsActionCollector).start();\n });\n }\n\n private _destroyed$ = new ReplaySubject<void>(1);\n private _stopped$ = new Subject<void>();\n private _started = false;\n\n readonly dispatched: any[] = [];\n readonly completed: any[] = [];\n readonly successful: any[] = [];\n readonly errored: any[] = [];\n readonly cancelled: any[] = [];\n\n private _actions$ = inject(Actions);\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this._destroyed$.next());\n }\n\n start() {\n if (this._started) {\n return;\n }\n this._started = true;\n this._actions$.pipe(takeUntil(this._destroyed$), takeUntil(this._stopped$)).subscribe({\n next: (ctx: ActionContext) => {\n switch (ctx?.status) {\n case ActionStatus.Dispatched:\n this.dispatched.push(ctx.action);\n break;\n case ActionStatus.Successful:\n this.successful.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n case ActionStatus.Errored:\n this.errored.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n case ActionStatus.Canceled:\n this.cancelled.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n default:\n break;\n }\n },\n complete: () => {\n this._started = false;\n },\n error: () => {\n this._started = false;\n }\n });\n }\n\n reset() {\n function clearArray(array: any[]) {\n array.splice(0, array.length);\n }\n clearArray(this.dispatched);\n clearArray(this.completed);\n clearArray(this.successful);\n clearArray(this.errored);\n clearArray(this.cancelled);\n }\n\n stop() {\n this._stopped$.next();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["getDOM","BrowserDomAdapter"],"mappings":";;;;;;;;;AAKA,SAAS,iBAAiB,GAAA;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IACzC,MAAM,IAAI,GAAGA,OAAM,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC;AACzD,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC;AAEA,SAAS,iBAAiB,GAAA;AACxB,IAAA,MAAM,IAAI,GAAY,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE;AACxE,IAAA,IAAI;AACF,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;;IAC/B,MAAM;AACV;AAEA,SAAS,2CAA2C,CAAC,QAAgB,EAAA;AACnE,IAAA,eAAe,EAAE;IACjB,kBAAkB,CAAC,QAAQ,CAAC;AAC5B,IAAA,iBAAiB,EAAE;AACrB;AAEA;AACA;AACA;AACA,SAAS,+BAA+B,GAAA;AACtC,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AA;AAAnB,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACVlC;;AAEG;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals-testing.mjs","sources":["../../../packages/store/internals/testing/src/fresh-platform.ts","../../../packages/store/internals/testing/src/helpers/ngxs-test.component.ts","../../../packages/store/internals/testing/src/helpers/ngxs-test.module.ts","../../../packages/store/internals/testing/src/skip-console-logging.ts","../../../packages/store/internals/testing/src/ngxs.setup.ts","../../../packages/store/internals/testing/src/action-collector.ts","../../../packages/store/internals/testing/src/ngxs-store-internals-testing.ts"],"sourcesContent":["import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { VERSION, destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne(freshUrl: string) {\n destroyPlatform();\n resetLocationToUrl(freshUrl);\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n const version = +VERSION.major;\n // https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa\n if (version < 14) {\n createPlatform(TestBed);\n }\n}\n\nfunction resetLocationToUrl(freshUrl: string) {\n window.history.replaceState({}, 'Test', freshUrl);\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let resolve: VoidFunction | null = null;\n let reject: ((error: Error) => void) | null = null;\n let whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n const freshUrl = '/';\n destroyPlatformBeforeBootstrappingTheNewOne(freshUrl);\n\n if (hasDoneArgument) {\n await fn((error?: Error) => {\n if (error) {\n reject!(error);\n } else {\n resolve!();\n }\n });\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n","import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule, NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","export type ConsoleRecord = [string, any[]];\nexport type ConsoleRecorder = ConsoleRecord[];\n\nexport function loggedError(message: string): ConsoleRecord {\n return ['error', [expect.objectContaining({ message })]];\n}\n\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(\n fn: T,\n consoleRecorder: ConsoleRecorder = []\n): ReturnType<T> {\n const consoleSpies = [\n jest.spyOn(console, 'log').mockImplementation((...args) => {\n consoleRecorder.push(['log', args]);\n }),\n jest.spyOn(console, 'warn').mockImplementation((...args) => {\n consoleRecorder.push(['warn', args]);\n }),\n jest.spyOn(console, 'error').mockImplementation((...args) => {\n consoleRecorder.push(['error', args]);\n }),\n jest.spyOn(console, 'info').mockImplementation((...args) => {\n consoleRecorder.push(['info', args]);\n })\n ];\n function restoreSpies() {\n consoleSpies.forEach(spy => spy.mockRestore());\n }\n let restoreSpyAsync = false;\n try {\n const returnValue = fn();\n if (returnValue instanceof Promise) {\n restoreSpyAsync = true;\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\n }\n return returnValue;\n } finally {\n if (!restoreSpyAsync) {\n restoreSpies();\n }\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\nimport { skipConsoleLogging } from './skip-console-logging';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n skipConsoleLogging(() =>\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\n ...(options.imports || [])\n ]\n }).compileComponents()\n );\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {\n teardown: { destroyAfterEach: true }\n });\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import {\n DestroyRef,\n EnvironmentProviders,\n inject,\n Injectable,\n provideEnvironmentInitializer\n} from '@angular/core';\nimport { Actions, ActionStatus, type ActionContext } from '@ngxs/store';\nimport { ReplaySubject, Subject, takeUntil } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class NgxsActionCollector {\n /**\n * Including this in your providers will\n * set up the the action collector to start collecting actions\n * from before NGXS initializes\n * @example\n * // In your providers declaration for your tests:\n * {\n * providers: [\n * NgxsActionCollector.collectActions(),\n * provideStore([MyState]),\n * ],\n * // ...\n * }\n * // and then in your test:\n * const actionCollector = TestBed.inject(NgxsActionCollector);\n * const actionsDispatched = actionCollector.dispatched;\n * const action = actionsDispatched.find(\n * (item) => item instanceof MyAction\n * );\n * expect(action).toBeDefined();\n * @returns An environment initializer that starts the collector immediately\n */\n static collectActions(): EnvironmentProviders {\n return provideEnvironmentInitializer(() => {\n inject(NgxsActionCollector).start();\n });\n }\n\n private _destroyed$ = new ReplaySubject<void>(1);\n private _stopped$ = new Subject<void>();\n private _started = false;\n\n readonly dispatched: any[] = [];\n readonly completed: any[] = [];\n readonly successful: any[] = [];\n readonly errored: any[] = [];\n readonly cancelled: any[] = [];\n\n private _actions$ = inject(Actions);\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this._destroyed$.next());\n }\n\n start() {\n if (this._started) {\n return;\n }\n this._started = true;\n this._actions$.pipe(takeUntil(this._destroyed$), takeUntil(this._stopped$)).subscribe({\n next: (ctx: ActionContext) => {\n switch (ctx?.status) {\n case ActionStatus.Dispatched:\n this.dispatched.push(ctx.action);\n break;\n case ActionStatus.Successful:\n this.successful.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n case ActionStatus.Errored:\n this.errored.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n case ActionStatus.Canceled:\n this.cancelled.push(ctx.action);\n this.completed.push(ctx.action);\n break;\n default:\n break;\n }\n },\n complete: () => {\n this._started = false;\n },\n error: () => {\n this._started = false;\n }\n });\n }\n\n reset() {\n function clearArray(array: any[]) {\n array.splice(0, array.length);\n }\n clearArray(this.dispatched);\n clearArray(this.completed);\n clearArray(this.successful);\n clearArray(this.errored);\n clearArray(this.cancelled);\n }\n\n stop() {\n this._stopped$.next();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["getDOM","BrowserDomAdapter"],"mappings":";;;;;;;;;AAKA,SAAS,iBAAiB,GAAA;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IACzC,MAAM,IAAI,GAAGA,OAAM,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC;AACzD,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC;AAEA,SAAS,iBAAiB,GAAA;AACxB,IAAA,MAAM,IAAI,GAAY,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE;AACxE,IAAA,IAAI;AACF,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;;IAC/B,MAAM;AACV;AAEA,SAAS,2CAA2C,CAAC,QAAgB,EAAA;AACnE,IAAA,eAAe,EAAE;IACjB,kBAAkB,CAAC,QAAQ,CAAC;AAC5B,IAAA,iBAAiB,EAAE;AACrB;AAEA;AACA;AACA;AACA,SAAS,+BAA+B,GAAA;AACtC,IAAA,iBAAiB,EAAE;AACnB,IAAA,eAAe,EAAE;AACjB,IAAA,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK;;AAE9B,IAAA,IAAI,OAAO,GAAG,EAAE,EAAE;QAChB,cAAc,CAAC,OAAO,CAAC;;AAE3B;AAEA,SAAS,kBAAkB,CAAC,QAAgB,EAAA;IAC1C,MAAM,C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,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACVlC;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Injectable, InjectionToken, DestroyRef, NgZone, Injector, runInInjectionContext, ErrorHandler, ɵisPromise as _isPromise, computed, makeEnvironmentProviders, provideEnvironmentInitializer, NgModule, APP_BOOTSTRAP_LISTENER, ApplicationRef, PendingTasks } from '@angular/core';
2
+ import { inject, Injectable, DestroyRef, NgZone, Injector, runInInjectionContext, InjectionToken, ErrorHandler, ɵisPromise as _isPromise, computed, makeEnvironmentProviders, provideEnvironmentInitializer, NgModule, APP_BOOTSTRAP_LISTENER, ApplicationRef, PendingTasks } from '@angular/core';
3
3
  import { config, Observable, Subject, share, forkJoin, map, throwError, shareReplay, filter, take, mergeMap, EMPTY, defaultIfEmpty, catchError, from, isObservable, takeUntil, finalize, distinctUntilChanged, startWith, skip, buffer, debounceTime } from 'rxjs';
4
4
  import { ɵwrapObserverCalls as _wrapObserverCalls, ɵOrderedSubject as _OrderedSubject, ɵStateStream as _StateStream, ɵof as _of, ɵhasOwnProperty as _hasOwnProperty, ɵmemoize as _memoize, ɵgetStoreMetadata as _getStoreMetadata, ɵgetSelectorMetadata as _getSelectorMetadata, ɵMETA_KEY as _META_KEY, ɵINITIAL_STATE_TOKEN as _INITIAL_STATE_TOKEN, ɵNgxsAppBootstrappedState as _NgxsAppBootstrappedState, ɵensureStoreMetadata as _ensureStoreMetadata, ɵMETA_OPTIONS_KEY as _META_OPTIONS_KEY, ɵensureSelectorMetadata as _ensureSelectorMetadata, ɵdefineProperty as _defineProperty, ɵNGXS_STATE_CONTEXT_FACTORY as _NGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY as _NGXS_STATE_FACTORY } from '@ngxs/store/internals';
5
5
  export { StateToken } from '@ngxs/store/internals';
@@ -118,88 +118,6 @@ function fallbackSubscriber(ngZone) {
118
118
  };
119
119
  }
120
120
 
121
- // The injection token is used to resolve a list of states provided at
122
- // the root level through either `NgxsModule.forRoot` or `provideStore`.
123
- const ROOT_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ROOT_STATE_TOKEN' : '');
124
- // The injection token is used to resolve a list of states provided at
125
- // the feature level through either `NgxsModule.forFeature` or `provideStates`.
126
- // The Array<Array> is used to overload the resolved value of the token because
127
- // it is a multi-provider token.
128
- const FEATURE_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'FEATURE_STATE_TOKEN' : '');
129
- // The injection token is used to resolve to options provided at the root
130
- // level through either `NgxsModule.forRoot` or `provideStore`.
131
- const NGXS_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_OPTIONS' : '');
132
- /**
133
- * The NGXS config settings.
134
- */
135
- class NgxsConfig {
136
- constructor() {
137
- this.compatibility = {
138
- strictContentSecurityPolicy: false
139
- };
140
- /**
141
- * Defining shared selector options
142
- */
143
- this.selectorOptions = {
144
- injectContainerState: false,
145
- suppressErrors: false
146
- };
147
- }
148
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
149
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => {
150
- const defaultConfig = new NgxsConfig();
151
- const config = inject(NGXS_OPTIONS);
152
- return {
153
- ...defaultConfig,
154
- ...config,
155
- selectorOptions: {
156
- ...defaultConfig.selectorOptions,
157
- ...config.selectorOptions
158
- }
159
- };
160
- } }); }
161
- }
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, decorators: [{
163
- type: Injectable,
164
- args: [{
165
- providedIn: 'root',
166
- useFactory: () => {
167
- const defaultConfig = new NgxsConfig();
168
- const config = inject(NGXS_OPTIONS);
169
- return {
170
- ...defaultConfig,
171
- ...config,
172
- selectorOptions: {
173
- ...defaultConfig.selectorOptions,
174
- ...config.selectorOptions
175
- }
176
- };
177
- }
178
- }]
179
- }] });
180
- /**
181
- * Represents a basic change from a previous to a new value for a single state instance.
182
- * Passed as a value in a NgxsSimpleChanges object to the ngxsOnChanges hook.
183
- */
184
- class NgxsSimpleChange {
185
- constructor(previousValue, currentValue, firstChange) {
186
- this.previousValue = previousValue;
187
- this.currentValue = currentValue;
188
- this.firstChange = firstChange;
189
- }
190
- }
191
-
192
- /**
193
- * The injection token is used internally to resolve an instance of the execution strategy.
194
- */
195
- const NGXS_EXECUTION_STRATEGY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_EXECUTION_STRATEGY' : '', {
196
- providedIn: 'root',
197
- // Since `executionStrategy` is a `Type<...>`, we should inject it to retrieve an
198
- // instance. This injection token essentially holds an instance of the
199
- // execution strategy class.
200
- factory: () => inject(inject(NGXS_OPTIONS).executionStrategy)
201
- });
202
-
203
121
  /**
204
122
  * Internal Action result stream that is emitted when an action is completed.
205
123
  * This is used as a method of returning the action result to the dispatcher
@@ -222,6 +140,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
222
140
  args: [{ providedIn: 'root' }]
223
141
  }], ctorParameters: () => [] });
224
142
 
143
+ class InternalNgxsExecutionStrategy {
144
+ constructor() {
145
+ this._ngZone = inject(NgZone);
146
+ }
147
+ enter(func) {
148
+ if (typeof ngServerMode !== 'undefined' && ngServerMode) {
149
+ return this._runInsideAngular(func);
150
+ }
151
+ return this._runOutsideAngular(func);
152
+ }
153
+ leave(func) {
154
+ return this._runInsideAngular(func);
155
+ }
156
+ _runInsideAngular(func) {
157
+ if (NgZone.isInAngularZone()) {
158
+ return func();
159
+ }
160
+ return this._ngZone.run(func);
161
+ }
162
+ _runOutsideAngular(func) {
163
+ if (NgZone.isInAngularZone()) {
164
+ return this._ngZone.runOutsideAngular(func);
165
+ }
166
+ return func();
167
+ }
168
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: InternalNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
169
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: InternalNgxsExecutionStrategy, providedIn: 'root' }); }
170
+ }
171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: InternalNgxsExecutionStrategy, decorators: [{
172
+ type: Injectable,
173
+ args: [{ providedIn: 'root' }]
174
+ }] });
175
+
225
176
  /**
226
177
  * Internal Action stream that is emitted anytime an action is dispatched.
227
178
  */
@@ -260,7 +211,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
260
211
  class Actions extends Observable {
261
212
  constructor() {
262
213
  const internalActions$ = inject(InternalActions);
263
- const internalExecutionStrategy = inject(NGXS_EXECUTION_STRATEGY);
214
+ const internalExecutionStrategy = inject(InternalNgxsExecutionStrategy);
264
215
  const sharedInternalActions$ = internalActions$.pipe(leaveNgxs(internalExecutionStrategy),
265
216
  // The `InternalActions` subject emits outside of the Angular zone.
266
217
  // We have to re-enter the Angular zone for any incoming consumer.
@@ -291,7 +242,7 @@ class InternalDispatcher {
291
242
  this._actionResults = inject(InternalDispatchedActionResults);
292
243
  this._pluginManager = inject(PluginManager);
293
244
  this._stateStream = inject(_StateStream);
294
- this._ngxsExecutionStrategy = inject(NGXS_EXECUTION_STRATEGY);
245
+ this._ngxsExecutionStrategy = inject(InternalNgxsExecutionStrategy);
295
246
  this._injector = inject(Injector);
296
247
  }
297
248
  /**
@@ -384,6 +335,77 @@ const compose = (injector, funcs) => (...args) => {
384
335
  return runInInjectionContext(injector, () => curr(...args, (...nextArgs) => compose(injector, funcs)(...nextArgs)));
385
336
  };
386
337
 
338
+ // The injection token is used to resolve a list of states provided at
339
+ // the root level through either `NgxsModule.forRoot` or `provideStore`.
340
+ const ROOT_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ROOT_STATE_TOKEN' : '');
341
+ // The injection token is used to resolve a list of states provided at
342
+ // the feature level through either `NgxsModule.forFeature` or `provideStates`.
343
+ // The Array<Array> is used to overload the resolved value of the token because
344
+ // it is a multi-provider token.
345
+ const FEATURE_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'FEATURE_STATE_TOKEN' : '');
346
+ // The injection token is used to resolve to options provided at the root
347
+ // level through either `NgxsModule.forRoot` or `provideStore`.
348
+ const NGXS_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_OPTIONS' : '');
349
+ /**
350
+ * The NGXS config settings.
351
+ */
352
+ class NgxsConfig {
353
+ constructor() {
354
+ this.compatibility = {
355
+ strictContentSecurityPolicy: false
356
+ };
357
+ /**
358
+ * Defining shared selector options
359
+ */
360
+ this.selectorOptions = {
361
+ injectContainerState: false,
362
+ suppressErrors: false
363
+ };
364
+ }
365
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
366
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => {
367
+ const defaultConfig = new NgxsConfig();
368
+ const config = inject(NGXS_OPTIONS);
369
+ return {
370
+ ...defaultConfig,
371
+ ...config,
372
+ selectorOptions: {
373
+ ...defaultConfig.selectorOptions,
374
+ ...config.selectorOptions
375
+ }
376
+ };
377
+ } }); }
378
+ }
379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsConfig, decorators: [{
380
+ type: Injectable,
381
+ args: [{
382
+ providedIn: 'root',
383
+ useFactory: () => {
384
+ const defaultConfig = new NgxsConfig();
385
+ const config = inject(NGXS_OPTIONS);
386
+ return {
387
+ ...defaultConfig,
388
+ ...config,
389
+ selectorOptions: {
390
+ ...defaultConfig.selectorOptions,
391
+ ...config.selectorOptions
392
+ }
393
+ };
394
+ }
395
+ }]
396
+ }] });
397
+ /**
398
+ * Represents a basic change from a previous to a new value for a single state instance.
399
+ * Passed as a value in a NgxsSimpleChanges object to the ngxsOnChanges hook.
400
+ */
401
+ class NgxsSimpleChange {
402
+ constructor(previousValue, currentValue, firstChange) {
403
+ this.previousValue = previousValue;
404
+ this.currentValue = currentValue;
405
+ this.firstChange = firstChange;
406
+ }
407
+ }
408
+
387
409
  /**
388
410
  * Object freeze code
389
411
  * https://github.com/jsdf/deep-freeze
@@ -801,11 +823,6 @@ function throwActionDecoratorError() {
801
823
  function throwSelectorDecoratorError() {
802
824
  throw new Error('Selectors only work on methods.');
803
825
  }
804
- function getZoneWarningMessage() {
805
- return ('Your application was bootstrapped with nooped zone and your execution strategy requires an actual NgZone!\n' +
806
- 'Please set the value of the executionStrategy property to NoopNgxsExecutionStrategy.\n' +
807
- 'NgxsModule.forRoot(states, { executionStrategy: NoopNgxsExecutionStrategy })');
808
- }
809
826
  function getUndecoratedStateWithInjectableWarningMessage(name) {
810
827
  return `'${name}' class should be decorated with @Injectable() right after the @State() decorator`;
811
828
  }
@@ -1424,7 +1441,7 @@ class Store {
1424
1441
  this._stateStream = inject(_StateStream);
1425
1442
  this._internalStateOperations = inject(InternalStateOperations);
1426
1443
  this._config = inject(NgxsConfig);
1427
- this._internalExecutionStrategy = inject(NGXS_EXECUTION_STRATEGY);
1444
+ this._internalExecutionStrategy = inject(InternalNgxsExecutionStrategy);
1428
1445
  this._stateFactory = inject(StateFactory);
1429
1446
  /**
1430
1447
  * This is a derived state stream that leaves NGXS execution strategy to emit state changes within the Angular zone,
@@ -1829,7 +1846,7 @@ function getFeatureProviders(states) {
1829
1846
  }
1830
1847
 
1831
1848
  class NgxsModule {
1832
- static forRoot(states = [], options) {
1849
+ static forRoot(states = [], options = {}) {
1833
1850
  return {
1834
1851
  ngModule: NgxsRootModule,
1835
1852
  providers: getRootProviders(states, options)
@@ -2050,68 +2067,6 @@ function Selector(selectors) {
2050
2067
  };
2051
2068
  }
2052
2069
 
2053
- class DispatchOutsideZoneNgxsExecutionStrategy {
2054
- constructor() {
2055
- this._ngZone = inject(NgZone);
2056
- if (typeof ngDevMode !== 'undefined' && ngDevMode) {
2057
- verifyZoneIsNotNooped(this._ngZone);
2058
- }
2059
- }
2060
- enter(func) {
2061
- if (typeof ngServerMode !== 'undefined' && ngServerMode) {
2062
- return this.runInsideAngular(func);
2063
- }
2064
- return this.runOutsideAngular(func);
2065
- }
2066
- leave(func) {
2067
- return this.runInsideAngular(func);
2068
- }
2069
- runInsideAngular(func) {
2070
- if (NgZone.isInAngularZone()) {
2071
- return func();
2072
- }
2073
- return this._ngZone.run(func);
2074
- }
2075
- runOutsideAngular(func) {
2076
- if (NgZone.isInAngularZone()) {
2077
- return this._ngZone.runOutsideAngular(func);
2078
- }
2079
- return func();
2080
- }
2081
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2082
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: 'root' }); }
2083
- }
2084
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, decorators: [{
2085
- type: Injectable,
2086
- args: [{ providedIn: 'root' }]
2087
- }], ctorParameters: () => [] });
2088
- // Caretaker note: this should exist as a separate function and not a class method,
2089
- // since class methods are not tree-shakable.
2090
- function verifyZoneIsNotNooped(ngZone) {
2091
- // `NoopNgZone` is not exposed publicly as it doesn't expect
2092
- // to be used outside of the core Angular code, thus we just have
2093
- // to check if the zone doesn't extend or instanceof `NgZone`.
2094
- if (ngZone instanceof NgZone) {
2095
- return;
2096
- }
2097
- console.warn(getZoneWarningMessage());
2098
- }
2099
-
2100
- class NoopNgxsExecutionStrategy {
2101
- enter(func) {
2102
- return func();
2103
- }
2104
- leave(func) {
2105
- return func();
2106
- }
2107
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NoopNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2108
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NoopNgxsExecutionStrategy, providedIn: 'root' }); }
2109
- }
2110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NoopNgxsExecutionStrategy, decorators: [{
2111
- type: Injectable,
2112
- args: [{ providedIn: 'root' }]
2113
- }] });
2114
-
2115
2070
  class NgxsDevelopmentModule {
2116
2071
  static forRoot(options) {
2117
2072
  return {
@@ -2307,30 +2262,28 @@ function withNgxsPendingTasks() {
2307
2262
  });
2308
2263
  }
2309
2264
 
2310
- /**
2311
- * This function provides global store providers and initializes the store.
2312
- *
2313
- * ```ts
2314
- * bootstrapApplication(AppComponent, {
2315
- * providers: [provideStore([CountriesState])]
2316
- * });
2317
- * ```
2318
- *
2319
- * The `provideStore` may be optionally called with a config before the list of features:
2320
- *
2321
- * ```ts
2322
- * provideStore([CountriesState], {
2323
- * developmentMode: !environment.production
2324
- * });
2325
- * ```
2326
- */
2327
- function provideStore(states = [], options, ...features) {
2265
+ function provideStore(states = [], ...optionsAndFeatures) {
2266
+ const features = [];
2267
+ // Options are empty by default (see `forRoot`).
2268
+ let options = {};
2269
+ if (optionsAndFeatures.length > 0) {
2270
+ if (isEnvironmentProvider(optionsAndFeatures[0])) {
2271
+ features.push(...optionsAndFeatures);
2272
+ }
2273
+ else {
2274
+ options = optionsAndFeatures[0];
2275
+ features.push(...optionsAndFeatures.slice(1));
2276
+ }
2277
+ }
2328
2278
  return makeEnvironmentProviders([
2329
2279
  ...getRootProviders(states, options),
2330
2280
  NGXS_ROOT_ENVIRONMENT_INITIALIZER,
2331
2281
  features
2332
2282
  ]);
2333
2283
  }
2284
+ function isEnvironmentProvider(target) {
2285
+ return !!target.ɵproviders;
2286
+ }
2334
2287
 
2335
2288
  /**
2336
2289
  * This version serves as a standalone alternative to `NgxsModule.forFeature`.
@@ -2448,5 +2401,5 @@ function ɵprovideNgxsInternalStateTokens() {
2448
2401
  * Generated bundle index. Do not edit.
2449
2402
  */
2450
2403
 
2451
- export { Action, Actions, DispatchOutsideZoneNgxsExecutionStrategy, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
2404
+ export { Action, Actions, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
2452
2405
  //# sourceMappingURL=ngxs-store.mjs.map