@ngxs/store 3.7.4-dev.master-a63a5af → 3.7.4-dev.master-c961545

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 (48) hide show
  1. package/bundles/ngxs-store-internals.umd.js +0 -241
  2. package/bundles/ngxs-store-internals.umd.js.map +1 -1
  3. package/bundles/ngxs-store-internals.umd.min.js +1 -1
  4. package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
  5. package/bundles/ngxs-store.umd.js +30 -112
  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/index.js +1 -2
  10. package/esm2015/internals/ngxs-store-internals.js +2 -2
  11. package/esm2015/ngxs-store.js +5 -4
  12. package/esm2015/src/decorators/select/select-factory.js +2 -6
  13. package/esm2015/src/decorators/select/select.js +11 -39
  14. package/esm2015/src/decorators/select/symbols.js +11 -55
  15. package/esm2015/src/internal/state-operations.js +3 -12
  16. package/esm2015/src/module.js +3 -1
  17. package/esm2015/src/modules/ngxs-root.module.js +5 -8
  18. package/esm2015/src/symbols.js +4 -3
  19. package/esm5/internals/index.js +1 -2
  20. package/esm5/internals/ngxs-store-internals.js +2 -2
  21. package/esm5/ngxs-store.js +5 -4
  22. package/esm5/src/decorators/select/select-factory.js +2 -6
  23. package/esm5/src/decorators/select/select.js +5 -40
  24. package/esm5/src/decorators/select/symbols.js +11 -55
  25. package/esm5/src/internal/state-operations.js +3 -12
  26. package/esm5/src/module.js +3 -1
  27. package/esm5/src/modules/ngxs-root.module.js +4 -7
  28. package/esm5/src/symbols.js +4 -3
  29. package/fesm2015/ngxs-store-internals.js +2 -240
  30. package/fesm2015/ngxs-store-internals.js.map +1 -1
  31. package/fesm2015/ngxs-store.js +32 -108
  32. package/fesm2015/ngxs-store.js.map +1 -1
  33. package/fesm5/ngxs-store-internals.js +2 -240
  34. package/fesm5/ngxs-store-internals.js.map +1 -1
  35. package/fesm5/ngxs-store.js +25 -108
  36. package/fesm5/ngxs-store.js.map +1 -1
  37. package/internals/index.d.ts +0 -1
  38. package/internals/ngxs-store-internals.metadata.json +1 -1
  39. package/ngxs-store.d.ts +5 -4
  40. package/ngxs-store.metadata.json +1 -1
  41. package/package.json +1 -1
  42. package/src/decorators/select/select.d.ts +1 -0
  43. package/src/decorators/select/symbols.d.ts +2 -6
  44. package/src/modules/ngxs-root.module.d.ts +2 -2
  45. package/src/symbols.d.ts +3 -2
  46. package/esm2015/internals/decorator-injector-adapter.js +0 -242
  47. package/esm5/internals/decorator-injector-adapter.js +0 -242
  48. package/internals/decorator-injector-adapter.d.ts +0 -15
@@ -1,4 +1,4 @@
1
- import { Injectable, InjectionToken, ɵglobal, ɵɵdirectiveInject, INJECTOR } from '@angular/core';
1
+ import { Injectable, InjectionToken } from '@angular/core';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
 
4
4
  /**
@@ -203,244 +203,6 @@ var NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFacto
203
203
  */
204
204
  var NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
205
205
 
206
- /**
207
- * @fileoverview added by tsickle
208
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
209
- */
210
- // Angular doesn't export `NG_FACTORY_DEF`.
211
- /** @type {?} */
212
- var NG_FACTORY_DEF = 'ɵfac';
213
- // A `Symbol` which is used to save the `Injector` onto the class instance.
214
- /** @type {?} */
215
- var InjectorInstance = Symbol('InjectorInstance');
216
- // A `Symbol` which is used to determine if factory has been decorated previously or not.
217
- /** @type {?} */
218
- var FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
219
- // A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
220
- // be retrieved within the `constructor` since it's set after the `factory()` is called.
221
- /** @type {?} */
222
- var InjectorNotifier = Symbol('InjectorNotifier');
223
- /**
224
- * @record
225
- */
226
- function PrototypeWithInjectorNotifier() { }
227
- if (false) {
228
- /* Skipping unnamed member:
229
- [InjectorNotifier]?: ReplaySubject<boolean>;*/
230
- }
231
- /**
232
- * @param {?} target
233
- * @return {?}
234
- */
235
- function ensureInjectorNotifierIsCaptured(target) {
236
- if (target[InjectorNotifier]) {
237
- return (/** @type {?} */ (target[InjectorNotifier]));
238
- }
239
- else {
240
- /** @type {?} */
241
- var injectorNotifier$_1 = new ReplaySubject(1);
242
- Object.defineProperty(target, InjectorNotifier, {
243
- get: (/**
244
- * @return {?}
245
- */
246
- function () { return injectorNotifier$_1; })
247
- });
248
- return injectorNotifier$_1;
249
- }
250
- }
251
- // eslint-disable-next-line @typescript-eslint/ban-types
252
- /**
253
- * @param {?} target
254
- * @return {?}
255
- */
256
- function ensureLocalInjectorCaptured(target) {
257
- if (FactoryHasBeenDecorated in target.constructor.prototype) {
258
- return;
259
- }
260
- /** @type {?} */
261
- var constructor = target.constructor;
262
- // The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.
263
- // We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit
264
- // tests that are being run in `SyncTestZoneSpec`.
265
- // Given the following example:
266
- // @Component()
267
- // class BaseComponent {}
268
- // @Component()
269
- // class MainComponent extends BaseComponent {
270
- // @Select(AnimalsState) animals$: Observable<string[]>;
271
- // }
272
- // In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.
273
- // If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define
274
- // an original factory for the `MainComponent`.
275
- // Note: the factory is defined statically in the code in AOT mode.
276
- // AppComponent.ɵfac = function AppComponent_Factory(t) {
277
- // return new (t || AppComponent)();
278
- // };
279
- // __decorate([Select], AppComponent.prototype, 'animals$', void 0);
280
- /** @type {?} */
281
- var isJitModeOrIsAngularInTestMode = isAngularInTestMode() || !!(ɵglobal.ng && ɵglobal.ng.ɵcompilerFacade);
282
- // If we're in development mode AND we're running unit tests or there's a compiler facade exposed,
283
- // then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.
284
- if (ngDevMode && isJitModeOrIsAngularInTestMode) {
285
- patchObjectDefineProperty();
286
- }
287
- else {
288
- decorateFactory(constructor);
289
- }
290
- target.constructor.prototype[FactoryHasBeenDecorated] = true;
291
- }
292
- /**
293
- * @template T
294
- * @param {?} instance
295
- * @param {?} token
296
- * @return {?}
297
- */
298
- function localInject(instance, token) {
299
- /** @type {?} */
300
- var injector = instance[InjectorInstance];
301
- return injector ? injector.get(token) : null;
302
- }
303
- /**
304
- * @param {?} constructor
305
- * @return {?}
306
- */
307
- function decorateFactory(constructor) {
308
- /** @type {?} */
309
- var factory = constructor[NG_FACTORY_DEF];
310
- if (typeof factory !== 'function') {
311
- return;
312
- }
313
- // Let's try to get any definition.
314
- // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
315
- // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
316
- /** @type {?} */
317
- var def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
318
- /** @type {?} */
319
- var decoratedFactory = (/**
320
- * @return {?}
321
- */
322
- function () {
323
- /** @type {?} */
324
- var instance = factory();
325
- // Caretaker note: `inject()` won't work here.
326
- // We can use the `directiveInject` only during the component
327
- // construction, since Angular captures the currently active injector.
328
- // We're not able to use this function inside the getter (when the `selectorId` property is
329
- // requested for the first time), since the currently active injector will be null.
330
- instance[InjectorInstance] = ɵɵdirectiveInject(
331
- // We're using `INJECTOR` token except of the `Injector` class since the compiler
332
- // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
333
- // Caretaker note: that this is the same way of getting the injector.
334
- INJECTOR);
335
- // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
336
- /** @type {?} */
337
- var injectorNotifier$ = instance[InjectorNotifier];
338
- if (injectorNotifier$) {
339
- injectorNotifier$.next(true);
340
- injectorNotifier$.complete();
341
- }
342
- return instance;
343
- });
344
- // If we've found any definition then it's enough to override the `def.factory` since Angular
345
- // code uses the `def.factory` and then fallbacks to `ɵfac`.
346
- if (def) {
347
- def.factory = decoratedFactory;
348
- }
349
- // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
350
- // still uses the `ɵfac`.
351
- Object.defineProperty(constructor, NG_FACTORY_DEF, {
352
- get: (/**
353
- * @return {?}
354
- */
355
- function () { return decoratedFactory; })
356
- });
357
- }
358
- // Note: this function will be tree-shaken in production.
359
- var ɵ0 = /**
360
- * @return {?}
361
- */
362
- function () {
363
- /** @type {?} */
364
- var objectDefinePropertyPatched = false;
365
- return (/**
366
- * @return {?}
367
- */
368
- function () {
369
- if (objectDefinePropertyPatched) {
370
- return;
371
- }
372
- /** @type {?} */
373
- var defineProperty = Object.defineProperty;
374
- // We should not be patching globals, but there's no other way to know when it's appropriate
375
- // to decorate the original factory. There're different edge cases, e.g., when the class extends
376
- // another class, the factory will be defined for the base class but not for the child class.
377
- // The patching will be done only during the development and in JIT mode.
378
- Object.defineProperty = (/**
379
- * @template T
380
- * @param {?} object
381
- * @param {?} propertyKey
382
- * @param {?} attributes
383
- * @return {?}
384
- */
385
- function (object, propertyKey, attributes) {
386
- // Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.
387
- // We only want to intercept `ɵfac` key.
388
- // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
389
- // implementation and then decorate the factory.
390
- // // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39
391
- if (propertyKey !== NG_FACTORY_DEF ||
392
- // We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.
393
- (propertyKey === NG_FACTORY_DEF && !attributes.configurable)) {
394
- return (/** @type {?} */ (defineProperty.call(this, object, propertyKey, attributes)));
395
- }
396
- else {
397
- // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
398
- // implementation and then decorate the factory.
399
- defineProperty.call(this, object, propertyKey, attributes);
400
- decorateFactory((/** @type {?} */ (((/** @type {?} */ (object))))));
401
- return object;
402
- }
403
- });
404
- objectDefinePropertyPatched = true;
405
- });
406
- };
407
- /** @type {?} */
408
- var patchObjectDefineProperty = ((ɵ0))();
409
- /**
410
- * @record
411
- */
412
- function Definition() { }
413
- if (false) {
414
- /** @type {?} */
415
- Definition.prototype.factory;
416
- }
417
- /**
418
- * @record
419
- */
420
- function ConstructorWithDefinitionAndFactory() { }
421
- if (false) {
422
- /** @type {?|undefined} */
423
- ConstructorWithDefinitionAndFactory.prototype.ɵprov;
424
- /** @type {?|undefined} */
425
- ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
426
- /** @type {?|undefined} */
427
- ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
428
- /** @type {?|undefined} */
429
- ConstructorWithDefinitionAndFactory.prototype.ɵdir;
430
- /* Skipping unnamed member:
431
- [NG_FACTORY_DEF]?: Factory;*/
432
- }
433
- /**
434
- * @record
435
- */
436
- function PrivateInstance() { }
437
- if (false) {
438
- /* Skipping unnamed member:
439
- [InjectorInstance]?: Injector;*/
440
- /* Skipping unnamed member:
441
- [InjectorNotifier]?: ReplaySubject<boolean>;*/
442
- }
443
-
444
206
  /**
445
207
  * @fileoverview added by tsickle
446
208
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -451,5 +213,5 @@ if (false) {
451
213
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
452
214
  */
453
215
 
454
- export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, ensureInjectorNotifierIsCaptured, ensureLocalInjectorCaptured, isAngularInTestMode, localInject, memoize };
216
+ export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, isAngularInTestMode, memoize };
455
217
  //# sourceMappingURL=ngxs-store-internals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["declare const __karma__: unknown;\ndeclare const jasmine: unknown;\ndeclare const jest: unknown;\ndeclare const Mocha: unknown;\n\nexport function isAngularInTestMode(): boolean {\n // This is safe to check for these properties in the following way since `typeof` does not\n // throw an exception if the value does not exist in the scope.\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\n return (\n typeof __karma__ !== 'undefined' ||\n typeof jasmine !== 'undefined' ||\n typeof jest !== 'undefined' ||\n typeof Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵglobal,\n ɵɵdirectiveInject\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\nimport { isAngularInTestMode } from './angular';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n\n // The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.\n // We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit\n // tests that are being run in `SyncTestZoneSpec`.\n // Given the following example:\n // @Component()\n // class BaseComponent {}\n // @Component()\n // class MainComponent extends BaseComponent {\n // @Select(AnimalsState) animals$: Observable<string[]>;\n // }\n // In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.\n // If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define\n // an original factory for the `MainComponent`.\n\n // Note: the factory is defined statically in the code in AOT mode.\n // AppComponent.ɵfac = function AppComponent_Factory(t) {\n // return new (t || AppComponent)();\n // };\n // __decorate([Select], AppComponent.prototype, 'animals$', void 0);\n\n const isJitModeOrIsAngularInTestMode =\n isAngularInTestMode() || !!(ɵglobal.ng && ɵglobal.ng.ɵcompilerFacade);\n\n // If we're in development mode AND we're running unit tests or there's a compiler facade exposed,\n // then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.\n if (ngDevMode && isJitModeOrIsAngularInTestMode) {\n patchObjectDefineProperty();\n } else {\n decorateFactory(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\n// Note: this function will be tree-shaken in production.\nconst patchObjectDefineProperty = (() => {\n let objectDefinePropertyPatched = false;\n return () => {\n if (objectDefinePropertyPatched) {\n return;\n }\n const defineProperty = Object.defineProperty;\n // We should not be patching globals, but there's no other way to know when it's appropriate\n // to decorate the original factory. There're different edge cases, e.g., when the class extends\n // another class, the factory will be defined for the base class but not for the child class.\n // The patching will be done only during the development and in JIT mode.\n Object.defineProperty = function<T>(\n object: T,\n propertyKey: PropertyKey,\n attributes: PropertyDescriptor & ThisType<any>\n ) {\n // Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.\n // We only want to intercept `ɵfac` key.\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n // // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39\n if (\n propertyKey !== NG_FACTORY_DEF ||\n // We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.\n (propertyKey === NG_FACTORY_DEF && !attributes.configurable)\n ) {\n return defineProperty.call(this, object, propertyKey, attributes) as T;\n } else {\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n defineProperty.call(this, object, propertyKey, attributes);\n decorateFactory((object as unknown) as ConstructorWithDefinitionAndFactory);\n return object;\n }\n };\n objectDefinePropertyPatched = true;\n };\n})();\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKA,SAAgB,mBAAmB;;;;;;;IAOjC,QACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;CACH;;;;;;AClBD;IAGA;;;;QAKU,eAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;KAcpD;IAZC,sBAAI,8CAAgB;;;;QAApB;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;SACvC;;;OAAA;;;;;;;;;;IAMD,oCAAS;;;;;IAAT;QACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;gBAlBF,UAAU;;IAmBX,uBAAC;CAnBD,IAmBC;;;;;;;IAdC,sCAAmD;;;;;;;;;;;;ACRrD,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QACjE,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9C,IACE,WAAW,KAAK,cAAc;;iBAE7B,WAAW,KAAK,cAAc,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAC5D;gBACA,0BAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,GAAM;aACxE;iBAAM;;;gBAGL,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;gBAC3D,eAAe,wCAAE,MAAM,MAAoD,CAAC;gBAC5E,OAAO,MAAM,CAAC;aACf;SACF,CAAA,CAAC;QACF,2BAA2B,GAAG,IAAI,CAAC;KACpC,EAAC;CACH;;IArCK,yBAAyB,GAAG,QAqC9B;;;;AAQJ,yBAEC;;;IADC,6BAAwB;;;;;AAG1B,kDAUC;;;IARC,oDAAmB;;IAEnB,oDAAmB;;IAEnB,mDAAkB;;IAElB,mDAAkB;;;;;;;AAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts"],"sourcesContent":["declare const __karma__: unknown;\ndeclare const jasmine: unknown;\ndeclare const jest: unknown;\ndeclare const Mocha: unknown;\n\nexport function isAngularInTestMode(): boolean {\n // This is safe to check for these properties in the following way since `typeof` does not\n // throw an exception if the value does not exist in the scope.\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\n return (\n typeof __karma__ !== 'undefined' ||\n typeof jasmine !== 'undefined' ||\n typeof jest !== 'undefined' ||\n typeof Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n"],"names":[],"mappings":";;;;;;;;;;AAKA,SAAgB,mBAAmB;;;;;;;IAOjC,QACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;CACH;;;;;;AClBD;IAGA;;;;QAKU,eAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;KAcpD;IAZC,sBAAI,8CAAgB;;;;QAApB;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;SACvC;;;OAAA;;;;;;;;;;IAMD,oCAAS;;;;;IAAT;QACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;gBAlBF,UAAU;;IAmBX,uBAAC;CAnBD,IAmBC;;;;;;;IAdC,sCAAmD;;;;;;;;;;;;ACRrD,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QACjE,OAAO,KAAK,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;;;;ACNzC;;;;AAKA,IAAa,0BAA0B,GAAwB,IAAI,cAAc,CAC/E,+BAA+B,CAChC;;;;;AAKD,IAAa,kBAAkB,GAAwB,IAAI,cAAc,CACvE,wBAAwB,CACzB;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { __assign, __spread, __extends, __values } from 'tslib';
2
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';
3
+ import { memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState } 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, publishReplay, refCount, distinctUntilChanged } from 'rxjs/operators';
@@ -256,8 +256,9 @@ if (false) {
256
256
  * - Object.freeze on the state and actions to guarantee immutability
257
257
  * (default: false)
258
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.
259
+ * Note: this property will be accounted only in development mode when using the Ivy compiler.
260
+ * It makes sense to use it only during development to ensure there're no state mutations.
261
+ * When building for production, the Object.freeze will be tree-shaken away.
261
262
  * @type {?}
262
263
  */
263
264
  NgxsConfig.prototype.developmentMode;
@@ -2128,21 +2129,13 @@ var InternalStateOperations = /** @class */ (function () {
2128
2129
  */
2129
2130
  function (actionOrActions) { return _this._dispatcher.dispatch(actionOrActions); })
2130
2131
  };
2131
- // We have to have that duplication since this will allow us to tree-shake `ensureStateAndActionsAreImmutable`
2132
- // and `deepFreeze` in Ivy production build.
2133
- // The below `if` condition checks 2 things:
2134
- // 1) if we're in View Engine (`ngDevMode` is `undefined`)
2135
- // 2) if we're running tests, we should fallback to `config.developmentMode` to be backwards-compatible
2136
- if (typeof ngDevMode === 'undefined' || (ngDevMode && isAngularInTestMode())) {
2132
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
2137
2133
  return this._config.developmentMode
2138
2134
  ? ensureStateAndActionsAreImmutable(rootStateOperations)
2139
2135
  : rootStateOperations;
2140
2136
  }
2141
2137
  else {
2142
- // If we're in Ivy and not running tests, then tree-shake `ensureStateAndActionsAreImmutable` and `deepFreeze`.
2143
- return ngDevMode
2144
- ? ensureStateAndActionsAreImmutable(rootStateOperations)
2145
- : rootStateOperations;
2138
+ return rootStateOperations;
2146
2139
  }
2147
2140
  };
2148
2141
  /**
@@ -3709,14 +3702,13 @@ var SelectFactory = /** @class */ (function () {
3709
3702
  SelectFactory.store = null;
3710
3703
  SelectFactory.config = null;
3711
3704
  SelectFactory.decorators = [
3712
- { type: Injectable, args: [{ providedIn: 'root' },] }
3705
+ { type: Injectable }
3713
3706
  ];
3714
3707
  /** @nocollapse */
3715
3708
  SelectFactory.ctorParameters = function () { return [
3716
3709
  { type: Store },
3717
3710
  { type: NgxsConfig }
3718
3711
  ]; };
3719
- /** @nocollapse */ SelectFactory.ngInjectableDef = defineInjectable({ factory: function SelectFactory_Factory() { return new SelectFactory(inject(Store), inject(NgxsConfig)); }, token: SelectFactory, providedIn: "root" });
3720
3712
  return SelectFactory;
3721
3713
  }());
3722
3714
  if (false) {
@@ -3789,11 +3781,8 @@ if (false) {
3789
3781
  * @ignore
3790
3782
  */
3791
3783
  var NgxsRootModule = /** @class */ (function () {
3792
- function NgxsRootModule(factory, internalStateOperations, _store, injector, states, lifecycleStateManager) {
3784
+ function NgxsRootModule(factory, internalStateOperations, _store, _select, states, lifecycleStateManager) {
3793
3785
  if (states === void 0) { states = []; }
3794
- // If the user is running View Engine then we create the `SelectFactory` instance,
3795
- // otherwise it'll be tree-shaken away in Ivy.
3796
- !ɵivyEnabled && injector.get(SelectFactory);
3797
3786
  // Add stores to the state graph and return their defaults
3798
3787
  /** @type {?} */
3799
3788
  var results = factory.addAndReturnDefaults(states);
@@ -3811,7 +3800,7 @@ var NgxsRootModule = /** @class */ (function () {
3811
3800
  { type: StateFactory },
3812
3801
  { type: InternalStateOperations },
3813
3802
  { type: Store },
3814
- { type: Injector },
3803
+ { type: SelectFactory },
3815
3804
  { type: Array, decorators: [{ type: Optional }, { type: Inject, args: [ROOT_STATE_TOKEN,] }] },
3816
3805
  { type: LifecycleStateManager }
3817
3806
  ]; };
@@ -3918,6 +3907,7 @@ var NgxsModule = /** @class */ (function () {
3918
3907
  InternalNgxsExecutionStrategy,
3919
3908
  Store,
3920
3909
  StateStream,
3910
+ SelectFactory,
3921
3911
  PluginManager
3922
3912
  ], states, NgxsModule.ngxsTokenProviders(states, options))
3923
3913
  };
@@ -4196,37 +4186,30 @@ var DOLLAR_CHAR_CODE = 36;
4196
4186
  /**
4197
4187
  * @template T
4198
4188
  * @param {?} selector
4199
- * @param {?} store
4200
4189
  * @return {?}
4201
4190
  */
4202
- function createSelectObservable(selector, store) {
4203
- // We're doing this stuff to tree-shake the `SelectFactory` when the user
4204
- // is running Ivy since NGXS will select the state from the provided `store` argument.
4205
- return ɵivyEnabled
4206
- ? createSelectObservableIvy(selector, store)
4207
- : createSelectObservableViewEngine(selector);
4191
+ function createSelectObservable(selector) {
4192
+ if (!SelectFactory.store) {
4193
+ throwSelectFactoryNotConnectedError();
4194
+ }
4195
+ return (/** @type {?} */ (SelectFactory.store)).select(selector);
4208
4196
  }
4209
4197
  /**
4210
- * @param {?} config
4211
4198
  * @param {?} name
4212
4199
  * @param {?=} rawSelector
4213
4200
  * @param {?=} paths
4214
4201
  * @return {?}
4215
4202
  */
4216
- function createSelectorFn(config, name, rawSelector, paths) {
4203
+ function createSelectorFn(name, rawSelector, paths) {
4217
4204
  if (paths === void 0) { paths = []; }
4218
- rawSelector = rawSelector || removeDollarAtTheEnd(name);
4219
- if (typeof rawSelector !== 'string') {
4220
- return rawSelector;
4221
- }
4222
- else {
4205
+ rawSelector = !rawSelector ? removeDollarAtTheEnd(name) : rawSelector;
4206
+ if (typeof rawSelector === 'string') {
4223
4207
  /** @type {?} */
4224
4208
  var propsArray = paths.length
4225
4209
  ? __spread([rawSelector], paths) : rawSelector.split('.');
4226
- return ɵivyEnabled
4227
- ? createSelectorFnIvy(propsArray, config)
4228
- : createSelectorFnViewEngine(propsArray);
4210
+ return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
4229
4211
  }
4212
+ return rawSelector;
4230
4213
  }
4231
4214
  /**
4232
4215
  * \@example If `foo$` => make it just `foo`
@@ -4240,42 +4223,6 @@ function removeDollarAtTheEnd(name) {
4240
4223
  var dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE;
4241
4224
  return dollarAtTheEnd ? name.slice(0, lastCharIndex) : name;
4242
4225
  }
4243
- /**
4244
- * @template T
4245
- * @param {?} selector
4246
- * @param {?} store
4247
- * @return {?}
4248
- */
4249
- function createSelectObservableIvy(selector, store) {
4250
- return ngDevMode && !store ? throwSelectFactoryNotConnectedError() : (/** @type {?} */ (store)).select(selector);
4251
- }
4252
- /**
4253
- * @template T
4254
- * @param {?} selector
4255
- * @return {?}
4256
- */
4257
- function createSelectObservableViewEngine(selector) {
4258
- return SelectFactory.store
4259
- ? SelectFactory.store.select(selector)
4260
- : throwSelectFactoryNotConnectedError();
4261
- }
4262
- /**
4263
- * @param {?} propsArray
4264
- * @param {?} config
4265
- * @return {?}
4266
- */
4267
- function createSelectorFnIvy(propsArray, config) {
4268
- return ngDevMode && !config
4269
- ? throwSelectFactoryNotConnectedError()
4270
- : propGetter(propsArray, (/** @type {?} */ (config)));
4271
- }
4272
- /**
4273
- * @param {?} propsArray
4274
- * @return {?}
4275
- */
4276
- function createSelectorFnViewEngine(propsArray) {
4277
- return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
4278
- }
4279
4226
 
4280
4227
  /**
4281
4228
  * @fileoverview added by tsickle
@@ -4283,6 +4230,7 @@ function createSelectorFnViewEngine(propsArray) {
4283
4230
  */
4284
4231
  /**
4285
4232
  * Decorator for selecting a slice of state from the store.
4233
+ * @deprecated
4286
4234
  * @template T
4287
4235
  * @param {?=} rawSelector
4288
4236
  * @param {...?} paths
@@ -4300,17 +4248,13 @@ function Select(rawSelector) {
4300
4248
  */
4301
4249
  function (target, key) {
4302
4250
  var _a;
4251
+ console.warn("\n The @Select decorator has been deprecated due to the following reasons:\n 1) Lack of type-safety (compare to 'store.select()')\n 2) Not compatible with server-side rendering because it uses a global 'Store' instance, which might change between renders\n 3) Not compatible with module federation\n Consider replacing it the with store.select.\n ");
4303
4252
  /** @type {?} */
4304
4253
  var name = key.toString();
4305
4254
  /** @type {?} */
4306
4255
  var selectorId = "__" + name + "__selector";
4307
4256
  /** @type {?} */
4308
- var selector = null;
4309
- /** @type {?} */
4310
- var injectorNotifier$ = null;
4311
- if (ɵivyEnabled) {
4312
- injectorNotifier$ = ensureInjectorNotifierIsCaptured(target);
4313
- }
4257
+ var selector = createSelectorFn(name, rawSelector, paths);
4314
4258
  Object.defineProperties(target, (_a = {},
4315
4259
  _a[selectorId] = {
4316
4260
  writable: true,
@@ -4324,37 +4268,10 @@ function Select(rawSelector) {
4324
4268
  * @return {?}
4325
4269
  */
4326
4270
  function () {
4327
- var _this = this;
4328
- if (this[selectorId]) {
4329
- return this[selectorId];
4330
- }
4331
- // The `localInject` will be tree-shaken away in apps that
4332
- // still use the View Engine.
4333
- if (ɵivyEnabled) {
4334
- this[selectorId] = (/** @type {?} */ (injectorNotifier$)).pipe(mergeMap((/**
4335
- * @return {?}
4336
- */
4337
- function () {
4338
- /** @type {?} */
4339
- var store = localInject(_this, Store);
4340
- /** @type {?} */
4341
- var config = localInject(_this, NgxsConfig);
4342
- selector = selector || createSelectorFn(config, name, rawSelector, paths);
4343
- return createSelectObservable(selector, store);
4344
- })));
4345
- }
4346
- else {
4347
- selector = selector || createSelectorFn(null, name, rawSelector, paths);
4348
- this[selectorId] = createSelectObservable(selector, null);
4349
- }
4350
- return this[selectorId];
4271
+ return this[selectorId] || (this[selectorId] = createSelectObservable(selector));
4351
4272
  }
4352
4273
  },
4353
4274
  _a));
4354
- // Keep this `if` guard here so the below stuff will be tree-shaken away in apps that still use the View Engine.
4355
- if (ɵivyEnabled) {
4356
- ensureLocalInjectorCaptured(target);
4357
- }
4358
4275
  });
4359
4276
  }
4360
4277
 
@@ -4583,5 +4500,5 @@ if (false) {
4583
4500
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4584
4501
  */
4585
4502
 
4586
- 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 };
4503
+ 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, SelectFactory as ɵr, ensureStoreMetadata as ɵt, getStoreMetadata as ɵu, ensureSelectorMetadata as ɵv, getSelectorMetadata as ɵw, LifecycleStateManager as ɵx, NgxsFeatureModule as ɵy };
4587
4504
  //# sourceMappingURL=ngxs-store.js.map