@ngxs/store 3.7.3-dev.master-90fdd58 → 3.7.3-dev.master-8ecbd7f

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 (44) hide show
  1. package/bundles/ngxs-store-internals-testing.umd.js +63 -0
  2. package/bundles/ngxs-store-internals-testing.umd.js.map +1 -1
  3. package/bundles/ngxs-store-internals-testing.umd.min.js +2 -2
  4. package/bundles/ngxs-store-internals-testing.umd.min.js.map +1 -1
  5. package/bundles/ngxs-store.umd.js +101 -63
  6. package/bundles/ngxs-store.umd.js.map +1 -1
  7. package/bundles/ngxs-store.umd.min.js +1 -1
  8. package/bundles/ngxs-store.umd.min.js.map +1 -1
  9. package/esm2015/internals/testing/index.js +2 -1
  10. package/esm2015/internals/testing/ngxs-store-internals-testing.js +2 -2
  11. package/esm2015/internals/testing/skip-console-logging.js +62 -0
  12. package/esm2015/ngxs-store.js +12 -13
  13. package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
  14. package/esm2015/src/execution/noop-ngxs-execution-strategy.js +4 -2
  15. package/esm2015/src/execution/symbols.js +26 -3
  16. package/esm2015/src/internal/state-operations.js +18 -5
  17. package/esm2015/src/module.js +4 -5
  18. package/esm2015/src/symbols.js +4 -1
  19. package/esm5/internals/testing/index.js +2 -1
  20. package/esm5/internals/testing/ngxs-store-internals-testing.js +2 -2
  21. package/esm5/internals/testing/skip-console-logging.js +62 -0
  22. package/esm5/ngxs-store.js +12 -13
  23. package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
  24. package/esm5/src/execution/noop-ngxs-execution-strategy.js +4 -2
  25. package/esm5/src/execution/symbols.js +26 -3
  26. package/esm5/src/internal/state-operations.js +18 -5
  27. package/esm5/src/module.js +4 -5
  28. package/esm5/src/symbols.js +4 -1
  29. package/fesm2015/ngxs-store-internals-testing.js +63 -1
  30. package/fesm2015/ngxs-store-internals-testing.js.map +1 -1
  31. package/fesm2015/ngxs-store.js +75 -37
  32. package/fesm2015/ngxs-store.js.map +1 -1
  33. package/fesm5/ngxs-store-internals-testing.js +63 -1
  34. package/fesm5/ngxs-store-internals-testing.js.map +1 -1
  35. package/fesm5/ngxs-store.js +88 -50
  36. package/fesm5/ngxs-store.js.map +1 -1
  37. package/internals/testing/index.d.ts +1 -0
  38. package/internals/testing/ngxs-store-internals-testing.metadata.json +1 -1
  39. package/internals/testing/skip-console-logging.d.ts +1 -0
  40. package/ngxs-store.d.ts +11 -12
  41. package/ngxs-store.metadata.json +1 -1
  42. package/package.json +1 -1
  43. package/src/execution/symbols.d.ts +5 -1
  44. package/src/symbols.d.ts +3 -0
@@ -249,6 +249,68 @@ function freshPlatform(fn) {
249
249
  });
250
250
  }
251
251
 
252
+ /**
253
+ * @fileoverview added by tsickle
254
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
255
+ */
256
+ /// <reference types="jest" />
257
+ /// <reference types="jest" />
258
+ /**
259
+ * @template T
260
+ * @param {?} fn
261
+ * @return {?}
262
+ */
263
+ function skipConsoleLogging(fn) {
264
+ /** @type {?} */
265
+ var consoleSpies = [
266
+ jest.spyOn(console, 'log').mockImplementation((/**
267
+ * @return {?}
268
+ */
269
+ function () { })),
270
+ jest.spyOn(console, 'warn').mockImplementation((/**
271
+ * @return {?}
272
+ */
273
+ function () { })),
274
+ jest.spyOn(console, 'error').mockImplementation((/**
275
+ * @return {?}
276
+ */
277
+ function () { })),
278
+ jest.spyOn(console, 'info').mockImplementation((/**
279
+ * @return {?}
280
+ */
281
+ function () { }))
282
+ ];
283
+ /**
284
+ * @return {?}
285
+ */
286
+ function restoreSpies() {
287
+ consoleSpies.forEach((/**
288
+ * @param {?} spy
289
+ * @return {?}
290
+ */
291
+ function (spy) { return spy.mockRestore(); }));
292
+ }
293
+ /** @type {?} */
294
+ var restoreSpyAsync = false;
295
+ try {
296
+ /** @type {?} */
297
+ var returnValue = fn();
298
+ if (returnValue instanceof Promise) {
299
+ restoreSpyAsync = true;
300
+ return (/** @type {?} */ (returnValue.finally((/**
301
+ * @return {?}
302
+ */
303
+ function () { return restoreSpies(); }))));
304
+ }
305
+ return returnValue;
306
+ }
307
+ finally {
308
+ if (!restoreSpyAsync) {
309
+ restoreSpies();
310
+ }
311
+ }
312
+ }
313
+
252
314
  /**
253
315
  * @fileoverview added by tsickle
254
316
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -259,5 +321,5 @@ function freshPlatform(fn) {
259
321
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
260
322
  */
261
323
 
262
- export { NgxsTestBed, freshPlatform };
324
+ export { NgxsTestBed, freshPlatform, skipConsoleLogging };
263
325
  //# sourceMappingURL=ngxs-store-internals-testing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule],\n declarations: [NgxsTestComponent],\n entryComponents: [NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\n ...(options.imports || [])\n ]\n }).compileComponents();\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\n destroyPlatform();\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n createPlatform(TestBed);\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let done: VoidFunction | null = null,\n whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>(resolve => {\n done = resolve;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n destroyPlatformBeforeBootstrappingTheNewOne();\n\n if (done !== null) {\n await fn(done);\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,AAEA;IAAA;KAOC;;;;IAFQ,oCAAQ;;;IAAf,eAA0B;;;;IACnB,2CAAe;;;IAAtB,eAAiC;;gBANlC,SAAS,SAAC;oBACT,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,EAAE;iBACb;;IAID,wBAAC;CAPD,IAOC;;;;;;ACTD,AAKA;IAAA;KASC;;;;;IAHe,4BAAa;;;;IAA3B,UAA4B,GAAmB;QAC7C,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;KAClC;;gBARF,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,eAAe,EAAE,CAAC,iBAAiB,CAAC;iBACrC;;IAKD,qBAAC;CATD,IASC;;;;;;;ICDD;KA4CC;;;;;IA3Ce,kCAAsB;;;;IAApC,UAAqC,OAA2B;QAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QAED,OAAO,CAAC,sBAAsB,CAAC;YAC7B,OAAO;gBAC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C;CACjC;;;;AAED,SAAS,iBAAiB;;QAClB,IAAI,sBAAY,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC;IACxE,IAAI;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;KACjC;IAAC,WAAM,GAAE;CACX;;;;AAED,SAAS,2CAA2C;IAClD,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,CAAC;CACrB;;;;;;;AAKD,SAAS,+BAA+B;IACtC,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;IAClB,cAAc,CAAC,OAAO,CAAC,CAAC;CACzB;;;;;AAED,SAAgB,aAAa,CAAC,EAA0C;;QAClE,IAAI,GAAwB,IAAI;;QAClC,uBAAuB,GAAyB,IAAI;;QAEhD,eAAe,GAAG,EAAE,CAAC,MAAM,KAAK,CAAC;IAEvC,IAAI,eAAe,EAAE;QACnB,uBAAuB,GAAG,IAAI,OAAO;;;;QAAO,UAAA,OAAO;YACjD,IAAI,GAAG,OAAO,CAAC;SAChB,EAAC,CAAC;KACJ;IAED;;;IAAO,SAAe,sBAAsB;;;;;;wBAExC,2CAA2C,EAAE,CAAC;8BAE1C,IAAI,KAAK,IAAI,CAAA,EAAb,wBAAa;wBACf,qBAAM,EAAE,CAAC,IAAI,CAAC,EAAA;;wBAAd,SAAc,CAAC;wBACf,wCAAM,uBAAuB,IAAC;;wBAA9B,SAA8B,CAAC;;4BAE/B,qBAAM,EAAE,EAAE,EAAA;;wBAAV,SAAU,CAAC;;;;wBAGb,+BAA+B,EAAE,CAAC;;;;;;KAErC,EAAC;CACH;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts","ng://@ngxs/store/internals/testing/skip-console-logging.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n template: ''\n})\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\n public ngOnInit(): void {}\n public ngAfterViewInit(): void {}\n}\n","import { ApplicationRef, NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\n\nimport { NgxsTestComponent } from './ngxs-test.component';\n\n@NgModule({\n imports: [BrowserModule],\n declarations: [NgxsTestComponent],\n entryComponents: [NgxsTestComponent]\n})\nexport class NgxsTestModule {\n public static ngDoBootstrap(app: ApplicationRef): void {\n app.bootstrap(NgxsTestComponent);\n }\n}\n","import { ApplicationRef } from '@angular/core';\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\nimport {\n BrowserDynamicTestingModule,\n platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\nimport { NgxsModule, Store } from '@ngxs/store';\n\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\n\nexport class NgxsTestBed {\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\n this.resetTestBed();\n\n if (options.before) {\n options.before();\n }\n\n TestBed.configureTestingModule({\n imports: [\n NgxsTestModule,\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\n ...(options.imports || [])\n ]\n }).compileComponents();\n\n NgxsTestBed.ngxsBootstrap();\n\n return {\n get store(): Store {\n return TestBed.inject(Store);\n },\n get getTestBed(): TestBedStatic {\n return TestBed;\n }\n };\n }\n\n private static ngxsBootstrap(): void {\n NgxsTestBed.createRootNode();\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\n }\n\n private static resetTestBed(): void {\n TestBed.resetTestEnvironment();\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n }\n\n private static createRootNode(selector = 'app-root'): void {\n const document = TestBed.inject(DOCUMENT);\n const adapter = new BrowserDomAdapter();\n const root = adapter.createElement(selector);\n document.body.appendChild(root);\n }\n}\n","import { TestBed } from '@angular/core/testing';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nimport { destroyPlatform, createPlatform } from '@angular/core';\n\nfunction createRootElement() {\n const document = TestBed.inject(DOCUMENT);\n const root = getDOM().createElement('app-root', document);\n document.body.appendChild(root);\n}\n\nfunction removeRootElement() {\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\n try {\n document.body.removeChild(root);\n } catch {}\n}\n\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\n destroyPlatform();\n createRootElement();\n}\n\n// As we create our custom platform via `bootstrapModule`\n// we have to destroy it after assetions and revert\n// the previous one\nfunction resetPlatformAfterBootstrapping() {\n removeRootElement();\n destroyPlatform();\n createPlatform(TestBed);\n}\n\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\n let done: VoidFunction | null = null,\n whenDoneIsCalledPromise: Promise<void> | null = null;\n\n const hasDoneArgument = fn.length === 1;\n\n if (hasDoneArgument) {\n whenDoneIsCalledPromise = new Promise<void>(resolve => {\n done = resolve;\n });\n }\n\n return async function testWithAFreshPlatform() {\n try {\n destroyPlatformBeforeBootstrappingTheNewOne();\n\n if (done !== null) {\n await fn(done);\n await whenDoneIsCalledPromise!;\n } else {\n await fn();\n }\n } finally {\n resetPlatformAfterBootstrapping();\n }\n };\n}\n","/// <reference types=\"jest\" />\n\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T> {\n const consoleSpies = [\n jest.spyOn(console, 'log').mockImplementation(() => {}),\n jest.spyOn(console, 'warn').mockImplementation(() => {}),\n jest.spyOn(console, 'error').mockImplementation(() => {}),\n jest.spyOn(console, 'info').mockImplementation(() => {})\n ];\n function restoreSpies() {\n consoleSpies.forEach(spy => spy.mockRestore());\n }\n let restoreSpyAsync = false;\n try {\n const returnValue = fn();\n if (returnValue instanceof Promise) {\n restoreSpyAsync = true;\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\n }\n return returnValue;\n } finally {\n if (!restoreSpyAsync) {\n restoreSpies();\n }\n }\n}\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,AAEA;IAAA;KAOC;;;;IAFQ,oCAAQ;;;IAAf,eAA0B;;;;IACnB,2CAAe;;;IAAtB,eAAiC;;gBANlC,SAAS,SAAC;oBACT,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,EAAE;iBACb;;IAID,wBAAC;CAPD,IAOC;;;;;;ACTD,AAKA;IAAA;KASC;;;;;IAHe,4BAAa;;;;IAA3B,UAA4B,GAAmB;QAC7C,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;KAClC;;gBARF,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,eAAe,EAAE,CAAC,iBAAiB,CAAC;iBACrC;;IAKD,qBAAC;CATD,IASC;;;;;;;ICDD;KA4CC;;;;;IA3Ce,kCAAsB;;;;IAApC,UAAqC,OAA2B;QAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QAED,OAAO,CAAC,sBAAsB,CAAC;YAC7B,OAAO;gBACL,cAAc;gBACd,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;gBAC/D,OAAO,CAAC,OAAO,IAAI,EAAE,EAC1B;SACF,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAEvB,WAAW,CAAC,aAAa,EAAE,CAAC;QAE5B,OAAO;;;;YACL,IAAI,K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QACnB,YAAY,CAAC,OAAO;;;;QAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,WAAW,EAAE,GAAA,EAAC,CAAC;KAChD;;QACG,eAAe,GAAG,KAAK;IAC3B,IAAI;;YACI,WAAW,GAAG,EAAE,EAAE;QACxB,IAAI,WAAW,YAAY,OAAO,EAAE;YAClC,eAAe,GAAG,IAAI,CAAC;YACvB,0BAAO,WAAW,CAAC,OAAO;;;YAAC,cAAM,OAAA,YAAY,EAAE,GAAA,EAAC,GAAkB;SACnE;QACD,OAAO,WAAW,CAAC;KACpB;YAAS;QACR,IAAI,CAAC,eAAe,EAAE;YACpB,YAAY,EAAE,CAAC;SAChB;KACF;CACF;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { __assign, __spread, __extends, __values } from 'tslib';
2
- import { NgZone, Injectable, Inject, PLATFORM_ID, InjectionToken, Optional, SkipSelf, ErrorHandler, Injector, defineInjectable, inject, ɵivyEnabled, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core';
3
- import { memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
2
+ import { NgZone, Injectable, Inject, PLATFORM_ID, defineInjectable, inject, InjectionToken, INJECTOR, ɵglobal, Optional, SkipSelf, ErrorHandler, Injector, ɵivyEnabled, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core';
3
+ import { isAngularInTestMode, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
4
4
  import { isPlatformServer } from '@angular/common';
5
5
  import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from } from 'rxjs';
6
6
  import { filter, map, shareReplay, take, exhaustMap, mergeMap, defaultIfEmpty, catchError, takeUntil, tap, distinctUntilChanged } from 'rxjs/operators';
@@ -164,13 +164,14 @@ var DispatchOutsideZoneNgxsExecutionStrategy = /** @class */ (function () {
164
164
  return func();
165
165
  };
166
166
  DispatchOutsideZoneNgxsExecutionStrategy.decorators = [
167
- { type: Injectable }
167
+ { type: Injectable, args: [{ providedIn: 'root' },] }
168
168
  ];
169
169
  /** @nocollapse */
170
170
  DispatchOutsideZoneNgxsExecutionStrategy.ctorParameters = function () { return [
171
171
  { type: NgZone },
172
172
  { type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
173
173
  ]; };
174
+ /** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function DispatchOutsideZoneNgxsExecutionStrategy_Factory() { return new DispatchOutsideZoneNgxsExecutionStrategy(inject(NgZone), inject(PLATFORM_ID)); }, token: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: "root" });
174
175
  return DispatchOutsideZoneNgxsExecutionStrategy;
175
176
  }());
176
177
  if (false) {
@@ -254,6 +255,9 @@ if (false) {
254
255
  * Run in development mode. This will add additional debugging features:
255
256
  * - Object.freeze on the state and actions to guarantee immutability
256
257
  * (default: false)
258
+ *
259
+ * @deprecated This property is no longer necessary when the Ivy compiler is used.
260
+ * We'll determine the development mode through the `ngDevMode`. It's still essential with View Engine.
257
261
  * @type {?}
258
262
  */
259
263
  NgxsConfig.prototype.developmentMode;
@@ -422,11 +426,72 @@ if (false) {
422
426
  * @fileoverview added by tsickle
423
427
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
424
428
  */
429
+ var NoopNgxsExecutionStrategy = /** @class */ (function () {
430
+ function NoopNgxsExecutionStrategy() {
431
+ }
432
+ /**
433
+ * @template T
434
+ * @param {?} func
435
+ * @return {?}
436
+ */
437
+ NoopNgxsExecutionStrategy.prototype.enter = /**
438
+ * @template T
439
+ * @param {?} func
440
+ * @return {?}
441
+ */
442
+ function (func) {
443
+ return func();
444
+ };
445
+ /**
446
+ * @template T
447
+ * @param {?} func
448
+ * @return {?}
449
+ */
450
+ NoopNgxsExecutionStrategy.prototype.leave = /**
451
+ * @template T
452
+ * @param {?} func
453
+ * @return {?}
454
+ */
455
+ function (func) {
456
+ return func();
457
+ };
458
+ NoopNgxsExecutionStrategy.decorators = [
459
+ { type: Injectable, args: [{ providedIn: 'root' },] }
460
+ ];
461
+ /** @nocollapse */ NoopNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function NoopNgxsExecutionStrategy_Factory() { return new NoopNgxsExecutionStrategy(); }, token: NoopNgxsExecutionStrategy, providedIn: "root" });
462
+ return NoopNgxsExecutionStrategy;
463
+ }());
464
+
465
+ /**
466
+ * @fileoverview added by tsickle
467
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
468
+ */
469
+ /**
470
+ * The strategy that might be provided by users through `options.executionStrategy`.
471
+ * @type {?}
472
+ */
473
+ var USER_PROVIDED_NGXS_EXECUTION_STRATEGY = new InjectionToken('USER_PROVIDED_NGXS_EXECUTION_STRATEGY');
425
474
  /*
426
475
  * Internal execution strategy injection token
427
476
  */
428
477
  /** @type {?} */
429
- var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY');
478
+ var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY', {
479
+ providedIn: 'root',
480
+ factory: (/**
481
+ * @return {?}
482
+ */
483
+ function () {
484
+ /** @type {?} */
485
+ var injector = inject(INJECTOR);
486
+ /** @type {?} */
487
+ var executionStrategy = injector.get(USER_PROVIDED_NGXS_EXECUTION_STRATEGY);
488
+ return executionStrategy
489
+ ? injector.get(executionStrategy)
490
+ : injector.get(typeof ɵglobal.Zone !== 'undefined'
491
+ ? DispatchOutsideZoneNgxsExecutionStrategy
492
+ : NoopNgxsExecutionStrategy);
493
+ })
494
+ });
430
495
  /**
431
496
  * @record
432
497
  */
@@ -2043,9 +2108,22 @@ var InternalStateOperations = /** @class */ (function () {
2043
2108
  */
2044
2109
  function (actionOrActions) { return _this._dispatcher.dispatch(actionOrActions); })
2045
2110
  };
2046
- return this._config.developmentMode
2047
- ? ensureStateAndActionsAreImmutable(rootStateOperations)
2048
- : rootStateOperations;
2111
+ // We have to have that duplication since this will allow us to tree-shake `ensureStateAndActionsAreImmutable`
2112
+ // and `deepFreeze` in Ivy production build.
2113
+ // The below `if` condition checks 2 things:
2114
+ // 1) if we're in View Engine (`ngDevMode` is `undefined`)
2115
+ // 2) if we're running tests, we should fallback to `config.developmentMode` to be backwards-compatible
2116
+ if (typeof ngDevMode === 'undefined' || (ngDevMode && isAngularInTestMode())) {
2117
+ return this._config.developmentMode
2118
+ ? ensureStateAndActionsAreImmutable(rootStateOperations)
2119
+ : rootStateOperations;
2120
+ }
2121
+ else {
2122
+ // If we're in Ivy and not running tests, then tree-shake `ensureStateAndActionsAreImmutable` and `deepFreeze`.
2123
+ return ngDevMode
2124
+ ? ensureStateAndActionsAreImmutable(rootStateOperations)
2125
+ : rootStateOperations;
2126
+ }
2049
2127
  };
2050
2128
  /**
2051
2129
  * @param {?} results
@@ -2092,7 +2170,6 @@ if (false) {
2092
2170
  */
2093
2171
  InternalStateOperations.prototype._config;
2094
2172
  }
2095
- // We make it as a separate function and not the class method to tree-shake it in the future.
2096
2173
  /**
2097
2174
  * @param {?} root
2098
2175
  * @return {?}
@@ -3820,8 +3897,8 @@ var NgxsModule = /** @class */ (function () {
3820
3897
  function (states, options) {
3821
3898
  return [
3822
3899
  {
3823
- provide: NGXS_EXECUTION_STRATEGY,
3824
- useClass: options.executionStrategy || DispatchOutsideZoneNgxsExecutionStrategy
3900
+ provide: USER_PROVIDED_NGXS_EXECUTION_STRATEGY,
3901
+ useValue: options.executionStrategy
3825
3902
  },
3826
3903
  {
3827
3904
  provide: ROOT_STATE_TOKEN,
@@ -4396,45 +4473,6 @@ function Selector(selectors) {
4396
4473
  });
4397
4474
  }
4398
4475
 
4399
- /**
4400
- * @fileoverview added by tsickle
4401
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4402
- */
4403
- var NoopNgxsExecutionStrategy = /** @class */ (function () {
4404
- function NoopNgxsExecutionStrategy() {
4405
- }
4406
- /**
4407
- * @template T
4408
- * @param {?} func
4409
- * @return {?}
4410
- */
4411
- NoopNgxsExecutionStrategy.prototype.enter = /**
4412
- * @template T
4413
- * @param {?} func
4414
- * @return {?}
4415
- */
4416
- function (func) {
4417
- return func();
4418
- };
4419
- /**
4420
- * @template T
4421
- * @param {?} func
4422
- * @return {?}
4423
- */
4424
- NoopNgxsExecutionStrategy.prototype.leave = /**
4425
- * @template T
4426
- * @param {?} func
4427
- * @return {?}
4428
- */
4429
- function (func) {
4430
- return func();
4431
- };
4432
- NoopNgxsExecutionStrategy.decorators = [
4433
- { type: Injectable }
4434
- ];
4435
- return NoopNgxsExecutionStrategy;
4436
- }());
4437
-
4438
4476
  /**
4439
4477
  * @fileoverview added by tsickle
4440
4478
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -4507,5 +4545,5 @@ if (false) {
4507
4545
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4508
4546
  */
4509
4547
 
4510
- export { Action, Actions, InitState, NGXS_PLUGINS, NgxsModule, NgxsSimpleChange, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg, NGXS_EXECUTION_STRATEGY as ɵh, NgxsRootModule as ɵi, StateFactory as ɵj, InternalDispatchedActionResults as ɵk, InternalDispatcher as ɵl, StateContextFactory as ɵm, InternalStateOperations as ɵn, PluginManager as ɵo, InternalNgxsExecutionStrategy as ɵp, ensureStoreMetadata as ɵr, getStoreMetadata as ɵs, ensureSelectorMetadata as ɵt, getSelectorMetadata as ɵu, LifecycleStateManager as ɵv, NgxsFeatureModule as ɵw, DispatchOutsideZoneNgxsExecutionStrategy as ɵx };
4548
+ export { Action, Actions, InitState, NGXS_PLUGINS, NgxsModule, NgxsSimpleChange, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg, USER_PROVIDED_NGXS_EXECUTION_STRATEGY as ɵh, NGXS_EXECUTION_STRATEGY as ɵi, NgxsRootModule as ɵj, StateFactory as ɵk, InternalDispatchedActionResults as ɵl, InternalDispatcher as ɵm, StateContextFactory as ɵn, InternalStateOperations as ɵo, PluginManager as ɵp, InternalNgxsExecutionStrategy as ɵq, ensureStoreMetadata as ɵs, getStoreMetadata as ɵt, ensureSelectorMetadata as ɵu, getSelectorMetadata as ɵv, LifecycleStateManager as ɵw, NgxsFeatureModule as ɵx };
4511
4549
  //# sourceMappingURL=ngxs-store.js.map