@ngxs/store 3.7.4-dev.master-a63a5af → 3.7.4-dev.master-2826e05
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ngxs-store-internals.umd.js +0 -241
- package/bundles/ngxs-store-internals.umd.js.map +1 -1
- package/bundles/ngxs-store-internals.umd.min.js +1 -1
- package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
- package/bundles/ngxs-store.umd.js +25 -100
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.min.js +1 -1
- package/bundles/ngxs-store.umd.min.js.map +1 -1
- package/esm2015/internals/index.js +1 -2
- package/esm2015/internals/ngxs-store-internals.js +2 -2
- package/esm2015/ngxs-store.js +5 -4
- package/esm2015/src/decorators/select/select-factory.js +2 -6
- package/esm2015/src/decorators/select/select.js +11 -39
- package/esm2015/src/decorators/select/symbols.js +11 -55
- package/esm2015/src/module.js +3 -1
- package/esm2015/src/modules/ngxs-root.module.js +5 -8
- package/esm5/internals/index.js +1 -2
- package/esm5/internals/ngxs-store-internals.js +2 -2
- package/esm5/ngxs-store.js +5 -4
- package/esm5/src/decorators/select/select-factory.js +2 -6
- package/esm5/src/decorators/select/select.js +5 -40
- package/esm5/src/decorators/select/symbols.js +11 -55
- package/esm5/src/module.js +3 -1
- package/esm5/src/modules/ngxs-root.module.js +4 -7
- package/fesm2015/ngxs-store-internals.js +2 -240
- package/fesm2015/ngxs-store-internals.js.map +1 -1
- package/fesm2015/ngxs-store.js +27 -96
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store-internals.js +2 -240
- package/fesm5/ngxs-store-internals.js.map +1 -1
- package/fesm5/ngxs-store.js +20 -96
- package/fesm5/ngxs-store.js.map +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/ngxs-store-internals.metadata.json +1 -1
- package/ngxs-store.d.ts +5 -4
- package/ngxs-store.metadata.json +1 -1
- package/package.json +1 -1
- package/src/decorators/select/select.d.ts +1 -0
- package/src/decorators/select/symbols.d.ts +2 -6
- package/src/modules/ngxs-root.module.d.ts +2 -2
- package/esm2015/internals/decorator-injector-adapter.js +0 -242
- package/esm5/internals/decorator-injector-adapter.js +0 -242
- package/internals/decorator-injector-adapter.d.ts +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable, InjectionToken
|
|
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,
|
|
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;YAC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ources":["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,OA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OAAO,UAAU,CAAC;KACnB;IACD,oBAAM,QAAQ,IAAE,KAAK;;;IAAG;;QAEtB,QAAQ,GAAG,IAAI,CAAC;QAChB,UAAU,GAAG,IAAI,CAAC;KACnB,CAAA,CAAC;IACF,0BAAO,QAAQ,GAAM;CACtB;;;;;;ACpDD;AAGA,IAAa,mBAAmB,GAAG,IAAI,cAAc,CAAM,qBAAqB,CAAC;AAEjF;IAAA;KAYC;;;;;IATe,gBAAG;;;;IAAjB,UAAkB,KAAkB;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACpB;;;;IAEa,gBAAG;;;IAAjB;;YACQ,KAAK,GAAgB,IAAI,CAAC,KAAK;QACrC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;KACd;IAVc,kBAAK,GAAgB,EAAE,CAAC;IAWzC,mBAAC;CAZD,IAYC;;;;;;IAXC,mBAAuC;;;;;;;ACNzC;;;;AAKA,IAAa,0BAA0B,GAAwB,IAAI,cAAc,CAC/E,+BAA+B,CAChC;;;;;AAKD,IAAa,kBAAkB,GAAwB,IAAI,cAAc,CACvE,wBAAwB,CACzB;;;;;;;;;;;;;;"}
|
package/fesm5/ngxs-store.js
CHANGED
|
@@ -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
|
|
3
|
+
import { isAngularInTestMode, 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';
|
|
@@ -3709,14 +3709,13 @@ var SelectFactory = /** @class */ (function () {
|
|
|
3709
3709
|
SelectFactory.store = null;
|
|
3710
3710
|
SelectFactory.config = null;
|
|
3711
3711
|
SelectFactory.decorators = [
|
|
3712
|
-
{ type: Injectable
|
|
3712
|
+
{ type: Injectable }
|
|
3713
3713
|
];
|
|
3714
3714
|
/** @nocollapse */
|
|
3715
3715
|
SelectFactory.ctorParameters = function () { return [
|
|
3716
3716
|
{ type: Store },
|
|
3717
3717
|
{ type: NgxsConfig }
|
|
3718
3718
|
]; };
|
|
3719
|
-
/** @nocollapse */ SelectFactory.ngInjectableDef = defineInjectable({ factory: function SelectFactory_Factory() { return new SelectFactory(inject(Store), inject(NgxsConfig)); }, token: SelectFactory, providedIn: "root" });
|
|
3720
3719
|
return SelectFactory;
|
|
3721
3720
|
}());
|
|
3722
3721
|
if (false) {
|
|
@@ -3789,11 +3788,8 @@ if (false) {
|
|
|
3789
3788
|
* @ignore
|
|
3790
3789
|
*/
|
|
3791
3790
|
var NgxsRootModule = /** @class */ (function () {
|
|
3792
|
-
function NgxsRootModule(factory, internalStateOperations, _store,
|
|
3791
|
+
function NgxsRootModule(factory, internalStateOperations, _store, _select, states, lifecycleStateManager) {
|
|
3793
3792
|
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
3793
|
// Add stores to the state graph and return their defaults
|
|
3798
3794
|
/** @type {?} */
|
|
3799
3795
|
var results = factory.addAndReturnDefaults(states);
|
|
@@ -3811,7 +3807,7 @@ var NgxsRootModule = /** @class */ (function () {
|
|
|
3811
3807
|
{ type: StateFactory },
|
|
3812
3808
|
{ type: InternalStateOperations },
|
|
3813
3809
|
{ type: Store },
|
|
3814
|
-
{ type:
|
|
3810
|
+
{ type: SelectFactory },
|
|
3815
3811
|
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [ROOT_STATE_TOKEN,] }] },
|
|
3816
3812
|
{ type: LifecycleStateManager }
|
|
3817
3813
|
]; };
|
|
@@ -3918,6 +3914,7 @@ var NgxsModule = /** @class */ (function () {
|
|
|
3918
3914
|
InternalNgxsExecutionStrategy,
|
|
3919
3915
|
Store,
|
|
3920
3916
|
StateStream,
|
|
3917
|
+
SelectFactory,
|
|
3921
3918
|
PluginManager
|
|
3922
3919
|
], states, NgxsModule.ngxsTokenProviders(states, options))
|
|
3923
3920
|
};
|
|
@@ -4196,37 +4193,30 @@ var DOLLAR_CHAR_CODE = 36;
|
|
|
4196
4193
|
/**
|
|
4197
4194
|
* @template T
|
|
4198
4195
|
* @param {?} selector
|
|
4199
|
-
* @param {?} store
|
|
4200
4196
|
* @return {?}
|
|
4201
4197
|
*/
|
|
4202
|
-
function createSelectObservable(selector
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
: createSelectObservableViewEngine(selector);
|
|
4198
|
+
function createSelectObservable(selector) {
|
|
4199
|
+
if (!SelectFactory.store) {
|
|
4200
|
+
throwSelectFactoryNotConnectedError();
|
|
4201
|
+
}
|
|
4202
|
+
return (/** @type {?} */ (SelectFactory.store)).select(selector);
|
|
4208
4203
|
}
|
|
4209
4204
|
/**
|
|
4210
|
-
* @param {?} config
|
|
4211
4205
|
* @param {?} name
|
|
4212
4206
|
* @param {?=} rawSelector
|
|
4213
4207
|
* @param {?=} paths
|
|
4214
4208
|
* @return {?}
|
|
4215
4209
|
*/
|
|
4216
|
-
function createSelectorFn(
|
|
4210
|
+
function createSelectorFn(name, rawSelector, paths) {
|
|
4217
4211
|
if (paths === void 0) { paths = []; }
|
|
4218
|
-
rawSelector = rawSelector
|
|
4219
|
-
if (typeof rawSelector
|
|
4220
|
-
return rawSelector;
|
|
4221
|
-
}
|
|
4222
|
-
else {
|
|
4212
|
+
rawSelector = !rawSelector ? removeDollarAtTheEnd(name) : rawSelector;
|
|
4213
|
+
if (typeof rawSelector === 'string') {
|
|
4223
4214
|
/** @type {?} */
|
|
4224
4215
|
var propsArray = paths.length
|
|
4225
4216
|
? __spread([rawSelector], paths) : rawSelector.split('.');
|
|
4226
|
-
return
|
|
4227
|
-
? createSelectorFnIvy(propsArray, config)
|
|
4228
|
-
: createSelectorFnViewEngine(propsArray);
|
|
4217
|
+
return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
|
|
4229
4218
|
}
|
|
4219
|
+
return rawSelector;
|
|
4230
4220
|
}
|
|
4231
4221
|
/**
|
|
4232
4222
|
* \@example If `foo$` => make it just `foo`
|
|
@@ -4240,42 +4230,6 @@ function removeDollarAtTheEnd(name) {
|
|
|
4240
4230
|
var dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE;
|
|
4241
4231
|
return dollarAtTheEnd ? name.slice(0, lastCharIndex) : name;
|
|
4242
4232
|
}
|
|
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
4233
|
|
|
4280
4234
|
/**
|
|
4281
4235
|
* @fileoverview added by tsickle
|
|
@@ -4283,6 +4237,7 @@ function createSelectorFnViewEngine(propsArray) {
|
|
|
4283
4237
|
*/
|
|
4284
4238
|
/**
|
|
4285
4239
|
* Decorator for selecting a slice of state from the store.
|
|
4240
|
+
* @deprecated
|
|
4286
4241
|
* @template T
|
|
4287
4242
|
* @param {?=} rawSelector
|
|
4288
4243
|
* @param {...?} paths
|
|
@@ -4300,17 +4255,13 @@ function Select(rawSelector) {
|
|
|
4300
4255
|
*/
|
|
4301
4256
|
function (target, key) {
|
|
4302
4257
|
var _a;
|
|
4258
|
+
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
4259
|
/** @type {?} */
|
|
4304
4260
|
var name = key.toString();
|
|
4305
4261
|
/** @type {?} */
|
|
4306
4262
|
var selectorId = "__" + name + "__selector";
|
|
4307
4263
|
/** @type {?} */
|
|
4308
|
-
var selector =
|
|
4309
|
-
/** @type {?} */
|
|
4310
|
-
var injectorNotifier$ = null;
|
|
4311
|
-
if (ɵivyEnabled) {
|
|
4312
|
-
injectorNotifier$ = ensureInjectorNotifierIsCaptured(target);
|
|
4313
|
-
}
|
|
4264
|
+
var selector = createSelectorFn(name, rawSelector, paths);
|
|
4314
4265
|
Object.defineProperties(target, (_a = {},
|
|
4315
4266
|
_a[selectorId] = {
|
|
4316
4267
|
writable: true,
|
|
@@ -4324,37 +4275,10 @@ function Select(rawSelector) {
|
|
|
4324
4275
|
* @return {?}
|
|
4325
4276
|
*/
|
|
4326
4277
|
function () {
|
|
4327
|
-
|
|
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];
|
|
4278
|
+
return this[selectorId] || (this[selectorId] = createSelectObservable(selector));
|
|
4351
4279
|
}
|
|
4352
4280
|
},
|
|
4353
4281
|
_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
4282
|
});
|
|
4359
4283
|
}
|
|
4360
4284
|
|
|
@@ -4583,5 +4507,5 @@ if (false) {
|
|
|
4583
4507
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4584
4508
|
*/
|
|
4585
4509
|
|
|
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
|
|
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, 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
4511
|
//# sourceMappingURL=ngxs-store.js.map
|