@ngxs/store 3.7.4-dev.master-65e4a9a → 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 +32 -105
- 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/internal/dispatcher.js +8 -6
- 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/internal/dispatcher.js +8 -6
- 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 +34 -101
- 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 +27 -101
- 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
|
@@ -206,253 +206,12 @@
|
|
|
206
206
|
*/
|
|
207
207
|
var NGXS_STATE_FACTORY = new core.InjectionToken('Internals.StateFactory');
|
|
208
208
|
|
|
209
|
-
/**
|
|
210
|
-
* @fileoverview added by tsickle
|
|
211
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
212
|
-
*/
|
|
213
|
-
// Angular doesn't export `NG_FACTORY_DEF`.
|
|
214
|
-
/** @type {?} */
|
|
215
|
-
var NG_FACTORY_DEF = 'ɵfac';
|
|
216
|
-
// A `Symbol` which is used to save the `Injector` onto the class instance.
|
|
217
|
-
/** @type {?} */
|
|
218
|
-
var InjectorInstance = Symbol('InjectorInstance');
|
|
219
|
-
// A `Symbol` which is used to determine if factory has been decorated previously or not.
|
|
220
|
-
/** @type {?} */
|
|
221
|
-
var FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
|
|
222
|
-
// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
|
|
223
|
-
// be retrieved within the `constructor` since it's set after the `factory()` is called.
|
|
224
|
-
/** @type {?} */
|
|
225
|
-
var InjectorNotifier = Symbol('InjectorNotifier');
|
|
226
|
-
/**
|
|
227
|
-
* @record
|
|
228
|
-
*/
|
|
229
|
-
function PrototypeWithInjectorNotifier() { }
|
|
230
|
-
if (false) {
|
|
231
|
-
/* Skipping unnamed member:
|
|
232
|
-
[InjectorNotifier]?: ReplaySubject<boolean>;*/
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @param {?} target
|
|
236
|
-
* @return {?}
|
|
237
|
-
*/
|
|
238
|
-
function ensureInjectorNotifierIsCaptured(target) {
|
|
239
|
-
if (target[InjectorNotifier]) {
|
|
240
|
-
return (/** @type {?} */ (target[InjectorNotifier]));
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
/** @type {?} */
|
|
244
|
-
var injectorNotifier$_1 = new rxjs.ReplaySubject(1);
|
|
245
|
-
Object.defineProperty(target, InjectorNotifier, {
|
|
246
|
-
get: (/**
|
|
247
|
-
* @return {?}
|
|
248
|
-
*/
|
|
249
|
-
function () { return injectorNotifier$_1; })
|
|
250
|
-
});
|
|
251
|
-
return injectorNotifier$_1;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
255
|
-
/**
|
|
256
|
-
* @param {?} target
|
|
257
|
-
* @return {?}
|
|
258
|
-
*/
|
|
259
|
-
function ensureLocalInjectorCaptured(target) {
|
|
260
|
-
if (FactoryHasBeenDecorated in target.constructor.prototype) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
/** @type {?} */
|
|
264
|
-
var constructor = target.constructor;
|
|
265
|
-
// The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.
|
|
266
|
-
// We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit
|
|
267
|
-
// tests that are being run in `SyncTestZoneSpec`.
|
|
268
|
-
// Given the following example:
|
|
269
|
-
// @Component()
|
|
270
|
-
// class BaseComponent {}
|
|
271
|
-
// @Component()
|
|
272
|
-
// class MainComponent extends BaseComponent {
|
|
273
|
-
// @Select(AnimalsState) animals$: Observable<string[]>;
|
|
274
|
-
// }
|
|
275
|
-
// In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.
|
|
276
|
-
// If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define
|
|
277
|
-
// an original factory for the `MainComponent`.
|
|
278
|
-
// Note: the factory is defined statically in the code in AOT mode.
|
|
279
|
-
// AppComponent.ɵfac = function AppComponent_Factory(t) {
|
|
280
|
-
// return new (t || AppComponent)();
|
|
281
|
-
// };
|
|
282
|
-
// __decorate([Select], AppComponent.prototype, 'animals$', void 0);
|
|
283
|
-
/** @type {?} */
|
|
284
|
-
var isJitModeOrIsAngularInTestMode = isAngularInTestMode() || !!(core.ɵglobal.ng && core.ɵglobal.ng.ɵcompilerFacade);
|
|
285
|
-
// If we're in development mode AND we're running unit tests or there's a compiler facade exposed,
|
|
286
|
-
// then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.
|
|
287
|
-
if (ngDevMode && isJitModeOrIsAngularInTestMode) {
|
|
288
|
-
patchObjectDefineProperty();
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
decorateFactory(constructor);
|
|
292
|
-
}
|
|
293
|
-
target.constructor.prototype[FactoryHasBeenDecorated] = true;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* @template T
|
|
297
|
-
* @param {?} instance
|
|
298
|
-
* @param {?} token
|
|
299
|
-
* @return {?}
|
|
300
|
-
*/
|
|
301
|
-
function localInject(instance, token) {
|
|
302
|
-
/** @type {?} */
|
|
303
|
-
var injector = instance[InjectorInstance];
|
|
304
|
-
return injector ? injector.get(token) : null;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* @param {?} constructor
|
|
308
|
-
* @return {?}
|
|
309
|
-
*/
|
|
310
|
-
function decorateFactory(constructor) {
|
|
311
|
-
/** @type {?} */
|
|
312
|
-
var factory = constructor[NG_FACTORY_DEF];
|
|
313
|
-
if (typeof factory !== 'function') {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
// Let's try to get any definition.
|
|
317
|
-
// Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
|
|
318
|
-
// Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
|
|
319
|
-
/** @type {?} */
|
|
320
|
-
var def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
|
|
321
|
-
/** @type {?} */
|
|
322
|
-
var decoratedFactory = (/**
|
|
323
|
-
* @return {?}
|
|
324
|
-
*/
|
|
325
|
-
function () {
|
|
326
|
-
/** @type {?} */
|
|
327
|
-
var instance = factory();
|
|
328
|
-
// Caretaker note: `inject()` won't work here.
|
|
329
|
-
// We can use the `directiveInject` only during the component
|
|
330
|
-
// construction, since Angular captures the currently active injector.
|
|
331
|
-
// We're not able to use this function inside the getter (when the `selectorId` property is
|
|
332
|
-
// requested for the first time), since the currently active injector will be null.
|
|
333
|
-
instance[InjectorInstance] = core.ɵɵdirectiveInject(
|
|
334
|
-
// We're using `INJECTOR` token except of the `Injector` class since the compiler
|
|
335
|
-
// throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
|
|
336
|
-
// Caretaker note: that this is the same way of getting the injector.
|
|
337
|
-
core.INJECTOR);
|
|
338
|
-
// Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
|
|
339
|
-
/** @type {?} */
|
|
340
|
-
var injectorNotifier$ = instance[InjectorNotifier];
|
|
341
|
-
if (injectorNotifier$) {
|
|
342
|
-
injectorNotifier$.next(true);
|
|
343
|
-
injectorNotifier$.complete();
|
|
344
|
-
}
|
|
345
|
-
return instance;
|
|
346
|
-
});
|
|
347
|
-
// If we've found any definition then it's enough to override the `def.factory` since Angular
|
|
348
|
-
// code uses the `def.factory` and then fallbacks to `ɵfac`.
|
|
349
|
-
if (def) {
|
|
350
|
-
def.factory = decoratedFactory;
|
|
351
|
-
}
|
|
352
|
-
// `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
|
|
353
|
-
// still uses the `ɵfac`.
|
|
354
|
-
Object.defineProperty(constructor, NG_FACTORY_DEF, {
|
|
355
|
-
get: (/**
|
|
356
|
-
* @return {?}
|
|
357
|
-
*/
|
|
358
|
-
function () { return decoratedFactory; })
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
// Note: this function will be tree-shaken in production.
|
|
362
|
-
var ɵ0 = /**
|
|
363
|
-
* @return {?}
|
|
364
|
-
*/
|
|
365
|
-
function () {
|
|
366
|
-
/** @type {?} */
|
|
367
|
-
var objectDefinePropertyPatched = false;
|
|
368
|
-
return (/**
|
|
369
|
-
* @return {?}
|
|
370
|
-
*/
|
|
371
|
-
function () {
|
|
372
|
-
if (objectDefinePropertyPatched) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
/** @type {?} */
|
|
376
|
-
var defineProperty = Object.defineProperty;
|
|
377
|
-
// We should not be patching globals, but there's no other way to know when it's appropriate
|
|
378
|
-
// to decorate the original factory. There're different edge cases, e.g., when the class extends
|
|
379
|
-
// another class, the factory will be defined for the base class but not for the child class.
|
|
380
|
-
// The patching will be done only during the development and in JIT mode.
|
|
381
|
-
Object.defineProperty = (/**
|
|
382
|
-
* @template T
|
|
383
|
-
* @param {?} object
|
|
384
|
-
* @param {?} propertyKey
|
|
385
|
-
* @param {?} attributes
|
|
386
|
-
* @return {?}
|
|
387
|
-
*/
|
|
388
|
-
function (object, propertyKey, attributes) {
|
|
389
|
-
// Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.
|
|
390
|
-
// We only want to intercept `ɵfac` key.
|
|
391
|
-
// If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
|
|
392
|
-
// implementation and then decorate the factory.
|
|
393
|
-
// // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39
|
|
394
|
-
if (propertyKey !== NG_FACTORY_DEF ||
|
|
395
|
-
// We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.
|
|
396
|
-
(propertyKey === NG_FACTORY_DEF && !attributes.configurable)) {
|
|
397
|
-
return (/** @type {?} */ (defineProperty.call(this, object, propertyKey, attributes)));
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
// If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
|
|
401
|
-
// implementation and then decorate the factory.
|
|
402
|
-
defineProperty.call(this, object, propertyKey, attributes);
|
|
403
|
-
decorateFactory((/** @type {?} */ (((/** @type {?} */ (object))))));
|
|
404
|
-
return object;
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
objectDefinePropertyPatched = true;
|
|
408
|
-
});
|
|
409
|
-
};
|
|
410
|
-
/** @type {?} */
|
|
411
|
-
var patchObjectDefineProperty = ((ɵ0))();
|
|
412
|
-
/**
|
|
413
|
-
* @record
|
|
414
|
-
*/
|
|
415
|
-
function Definition() { }
|
|
416
|
-
if (false) {
|
|
417
|
-
/** @type {?} */
|
|
418
|
-
Definition.prototype.factory;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* @record
|
|
422
|
-
*/
|
|
423
|
-
function ConstructorWithDefinitionAndFactory() { }
|
|
424
|
-
if (false) {
|
|
425
|
-
/** @type {?|undefined} */
|
|
426
|
-
ConstructorWithDefinitionAndFactory.prototype.ɵprov;
|
|
427
|
-
/** @type {?|undefined} */
|
|
428
|
-
ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
|
|
429
|
-
/** @type {?|undefined} */
|
|
430
|
-
ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
|
|
431
|
-
/** @type {?|undefined} */
|
|
432
|
-
ConstructorWithDefinitionAndFactory.prototype.ɵdir;
|
|
433
|
-
/* Skipping unnamed member:
|
|
434
|
-
[NG_FACTORY_DEF]?: Factory;*/
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* @record
|
|
438
|
-
*/
|
|
439
|
-
function PrivateInstance() { }
|
|
440
|
-
if (false) {
|
|
441
|
-
/* Skipping unnamed member:
|
|
442
|
-
[InjectorInstance]?: Injector;*/
|
|
443
|
-
/* Skipping unnamed member:
|
|
444
|
-
[InjectorNotifier]?: ReplaySubject<boolean>;*/
|
|
445
|
-
}
|
|
446
|
-
|
|
447
209
|
exports.INITIAL_STATE_TOKEN = INITIAL_STATE_TOKEN;
|
|
448
210
|
exports.InitialState = InitialState;
|
|
449
211
|
exports.NGXS_STATE_CONTEXT_FACTORY = NGXS_STATE_CONTEXT_FACTORY;
|
|
450
212
|
exports.NGXS_STATE_FACTORY = NGXS_STATE_FACTORY;
|
|
451
213
|
exports.NgxsBootstrapper = NgxsBootstrapper;
|
|
452
|
-
exports.ensureInjectorNotifierIsCaptured = ensureInjectorNotifierIsCaptured;
|
|
453
|
-
exports.ensureLocalInjectorCaptured = ensureLocalInjectorCaptured;
|
|
454
214
|
exports.isAngularInTestMode = isAngularInTestMode;
|
|
455
|
-
exports.localInject = localInject;
|
|
456
215
|
exports.memoize = memoize;
|
|
457
216
|
|
|
458
217
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-store-internals.umd.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":["ReplaySubject","Injectable","InjectionToken","ɵglobal","ɵɵdirectiveInject","INJECTOR"],"mappings":";;;;;;;;;;;;;IAKA,SAAgB,mBAAmB;;;;;;;QAOjC,QACE,OAAO,SAAS,KAAK,WAAW;YAChC,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,IAAI,KAAK,WAAW;YAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;KACH;;;;;;AClBD;QAGA;;;;YAKU,eAAU,GAAG,IAAIA,kBAAa,CAAU,CAAC,CAAC,CAAC;SAcpD;QAZC,sBAAI,8CAAgB;;;;YAApB;gBACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;aACvC;;;WAAA;;;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ular.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":["ReplaySubject","Injectable","InjectionToken"],"mappings":";;;;;;;;;;;;;IAKA,SAAgB,mBAAmB;;;;;;;QAOjC,QACE,OAAO,SAAS,KAAK,WAAW;YAChC,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,IAAI,KAAK,WAAW;YAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;KACH;;;;;;AClBD;QAGA;;;;YAKU,eAAU,GAAG,IAAIA,kBAAa,CAAU,CAAC,CAAC,CAAC;SAcpD;QAZC,sBAAI,8CAAgB;;;;YAApB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,CAAC;YACrB,OAAO,UAAU,CAAC;SACnB;QACD,oBAAM,QAAQ,IAAE,KAAK;;;QAAG;;YAEtB,QAAQ,GAAG,IAAI,CAAC;YAChB,UAAU,GAAG,IAAI,CAAC;SACnB,CAAA,CAAC;QACF,0BAAO,QAAQ,GAAM;KACtB;;;;;;ICpDD;AAGA,QAAa,mBAAmB,GAAG,IAAIC,mBAAc,CAAM,qBAAqB,CAAC;AAEjF;QAAA;SAYC;;;;;QATe,gBAAG;;;;QAAjB,UAAkB,KAAkB;YAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;;;;QAEa,gBAAG;;;QAAjB;;gBACQ,KAAK,GAAgB,IAAI,CAAC,KAAK;YACrC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;SACd;QAVc,kBAAK,GAAgB,EAAE,CAAC;QAWzC,mBAAC;KAZD,IAYC;;;;;;QAXC,mBAAuC;;;;;;;ICNzC;;;;AAKA,QAAa,0BAA0B,GAAwB,IAAIA,mBAAc,CAC/E,+BAA+B,CAChC;;;;;AAKD,QAAa,kBAAkB,GAAwB,IAAIA,mBAAc,CACvE,wBAAwB,CACzB;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("rxjs")):"function"==typeof define&&define.amd?define("@ngxs/store/internals",["exports","@angular/core","rxjs"],n):n(((e=e||self).ngxs=e.ngxs||{},e.ngxs.store=e.ngxs.store||{},e.ngxs.store.internals={}),e.ng.core,e.rxjs)}(this,(function(e,n,t){"use strict";var r=function(){function e(){this.bootstrap$=new t.ReplaySubject(1)}return Object.defineProperty(e.prototype,"appBootstrapped$",{get:function(){return this.bootstrap$.asObservable()},enumerable:!0,configurable:!0}),e.prototype.bootstrap=function(){this.bootstrap$.next(!0),this.bootstrap$.complete()},e.decorators=[{type:n.Injectable}],e}();function o(e,n){return e===n}var u=new n.InjectionToken("INITIAL_STATE_TOKEN"),i=function(){function e(){}return e.set=function(e){this.value=e},e.pop=function(){var e=this.value;return this.value={},e},e.value={},e}();var s=new n.InjectionToken("Internals.StateContextFactory"),a=new n.InjectionToken("Internals.StateFactory");e.INITIAL_STATE_TOKEN=u,e.InitialState=i,e.NGXS_STATE_CONTEXT_FACTORY=s,e.NGXS_STATE_FACTORY=a,e.NgxsBootstrapper=r,e.isAngularInTestMode=function(){return"undefined"!=typeof __karma__||"undefined"!=typeof jasmine||"undefined"!=typeof jest||"undefined"!=typeof Mocha},e.memoize=function(e,n){void 0===n&&(n=o);var t=null,r=null;function u(){return function(e,n,t){if(null===n||null===t||n.length!==t.length)return!1;for(var r=n.length,o=0;o<r;o++)if(!e(n[o],t[o]))return!1;return!0}(n,t,arguments)||(r=e.apply(null,arguments)),t=arguments,r}return u.reset=function(){t=null,r=null},u},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=ngxs-store-internals.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"names":["isAngularInTestMode","__karma__","jasmine","jest","Mocha","NgxsBootstrapper","this","bootstrap$","ReplaySubject","Object","defineProperty","prototype","asObservable","bootstrap","next","complete","Injectable","defaultEqualityCheck","a","b","INITIAL_STATE_TOKEN","InjectionToken","InitialState","set","state","value","pop","NGXS_STATE_CONTEXT_FACTORY","NGXS_STATE_FACTORY","NG_FACTORY_DEF","InjectorInstance","Symbol","FactoryHasBeenDecorated","InjectorNotifier","decorateFactory","constructor","factory","def","ɵprov","ɵpipe","ɵcmp","ɵdir","decoratedFactory","instance","ɵɵdirectiveInject","INJECTOR","injectorNotifier$","get","objectDefinePropertyPatched","patchObjectDefineProperty","object","propertyKey","attributes","configurable","call","target","injectorNotifier$_1","isJitModeOrIsAngularInTestMode","ɵglobal","ng","ɵcompilerFacade","ngDevMode","token","injector","func","equalityCheck","lastArgs","lastResult","memoized","prev","length","i","areArgumentsShallowlyEqual","arguments","apply","reset"],"mappings":"iXAKA,SAAgBA,IAOd,MACuB,oBAAdC,WACY,oBAAZC,SACS,oBAATC,MACU,oBAAVC,MChBX,IAAAC,EAAA,WAGA,SAAAA,IAKUC,KAAAC,WAAa,IAAIC,EAAAA,cAAuB,GAclD,OAZEC,OAAAC,eAAIL,EAAAM,UAAA,mBAAgB,KAApB,WACE,OAAOL,KAAKC,WAAWK,gDAOzBP,EAAAM,UAAAE,UAAA,WACEP,KAAKC,WAAWO,MAAK,GACrBR,KAAKC,WAAWQ,gCAjBnBC,EAAAA,aAmBDX,EAtBA,GCAA,SAASY,EAAqBC,EAAQC,GACpC,OAAOD,IAAMC,ECEf,IAAaC,EAAsB,IAAIC,EAAAA,eAAoB,uBAE3DC,EAAA,WAAA,SAAAA,KAYA,OATgBA,EAAAC,IAAd,SAAkBC,GAChBlB,KAAKmB,MAAQD,GAGDF,EAAAI,IAAd,eACQF,EAAqBlB,KAAKmB,MAEhC,OADAnB,KAAKmB,MAAQ,GACND,GATMF,EAAAG,MAAqB,GAWtCH,EAZA,GCAA,IAAaK,EAAkD,IAAIN,EAAAA,eACjE,iCAMWO,EAA0C,IAAIP,EAAAA,eACzD,0BCIIQ,EAAiB,OAGjBC,EAAkCC,OAAO,oBAGzCC,EAAyCD,OAAO,2BAIhDE,EAAkCF,OAAO,oBAsE/C,SAASG,EAAgBC,OACjBC,EAAUD,EAAYN,GAE5B,GAAuB,mBAAZO,EAAX,KAOMC,EAAMF,EAAYG,OAASH,EAAYI,OAASJ,EAAYK,MAAQL,EAAYM,KAEhFC,EAAgB,eACdC,EAAWP,IAMjBO,EAASb,GAAoBc,EAAAA,kBAI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AKC,OACXC,EAAI,EAAGA,EAAID,EAAQC,IAC1B,IAAKN,EAAcI,EAAKE,GAAIzD,EAAKyD,IAC/B,OAAO,EAIX,OAAO,EAiBAC,CAA2BP,EAAeC,EAAUO,aAEvDN,EAAa,EAAiBO,MAAM,KAAMD,YAG5CP,EAAWO,UACJN,EAOT,OALA,EAAgBQ,MAAK,WAEnBT,EAAW,KACXC,EAAa,MAEf","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"]}
|
|
1
|
+
{"version":3,"sources":["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/angular.ts"],"names":["NgxsBootstrapper","this","bootstrap$","ReplaySubject","Object","defineProperty","prototype","asObservable","bootstrap","next","complete","Injectable","defaultEqualityCheck","a","b","INITIAL_STATE_TOKEN","InjectionToken","InitialState","set","state","value","pop","NGXS_STATE_CONTEXT_FACTORY","NGXS_STATE_FACTORY","__karma__","jasmine","jest","Mocha","func","equalityCheck","lastArgs","lastResult","memoized","prev","length","i","areArgumentsShallowlyEqual","arguments","apply","reset"],"mappings":"iXAAA,IAAAA,EAAA,WAGA,SAAAA,IAKUC,KAAAC,WAAa,IAAIC,EAAAA,cAAuB,GAclD,OAZEC,OAAAC,eAAIL,EAAAM,UAAA,mBAAgB,KAApB,WACE,OAAOL,KAAKC,WAAWK,gDAOzBP,EAAAM,UAAAE,UAAA,WACEP,KAAKC,WAAWO,MAAK,GACrBR,KAAKC,WAAWQ,gCAjBnBC,EAAAA,aAmBDX,EAtBA,GCAA,SAASY,EAAqBC,EAAQC,GACpC,OAAOD,IAAMC,ECEf,IAAaC,EAAsB,IAAIC,EAAAA,eAAoB,uBAE3DC,EAAA,WAAA,SAAAA,KAYA,OATgBA,EAAAC,IAAd,SAAkBC,GAChBlB,KAAKmB,MAAQD,GAGDF,EAAAI,IAAd,eACQF,EAAqBlB,KAAKmB,MAEhC,OADAnB,KAAKmB,MAAQ,GACND,GATMF,EAAAG,MAAqB,GAWtCH,EAZA,GCAA,IAAaK,EAAkD,IAAIN,EAAAA,eACjE,iCAMWO,EAA0C,IAAIP,EAAAA,eACzD,oKCRF,WAOE,MACuB,oBAAdQ,WACY,oBAAZC,SACS,oBAATC,MACU,oBAAVC,iBHcX,SACEC,EACAC,QAAA,IAAAA,IAAAA,EAAAjB,OAEIkB,EAA8B,KAC9BC,EAAkB,KAEtB,SAASC,IAOP,OAxCJ,SACEH,EACAI,EACAxB,GAEA,GAAa,OAATwB,GAA0B,OAATxB,GAAiBwB,EAAKC,SAAWzB,EAAKyB,OACzD,OAAO,EAKT,QADMA,EAASD,EAAKC,OACXC,EAAI,EAAGA,EAAID,EAAQC,IAC1B,IAAKN,EAAcI,EAAKE,GAAI1B,EAAK0B,IAC/B,OAAO,EAIX,OAAO,EAiBAC,CAA2BP,EAAeC,EAAUO,aAEvDN,EAAa,EAAiBO,MAAM,KAAMD,YAG5CP,EAAWO,UACJN,EAOT,OALA,EAAgBQ,MAAK,WAEnBT,EAAW,KACXC,EAAa,MAEf","sourcesContent":["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","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"]}
|
|
@@ -2134,12 +2134,14 @@
|
|
|
2134
2134
|
*/
|
|
2135
2135
|
function (action) {
|
|
2136
2136
|
var _this = this;
|
|
2137
|
-
|
|
2138
|
-
var type = getActionTypeFromInstance(action);
|
|
2139
|
-
if (!type) {
|
|
2137
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2140
2138
|
/** @type {?} */
|
|
2141
|
-
var
|
|
2142
|
-
|
|
2139
|
+
var type = getActionTypeFromInstance(action);
|
|
2140
|
+
if (!type) {
|
|
2141
|
+
/** @type {?} */
|
|
2142
|
+
var error = new Error("This action doesn't have a type property: " + action.constructor.name);
|
|
2143
|
+
return rxjs.throwError(error);
|
|
2144
|
+
}
|
|
2143
2145
|
}
|
|
2144
2146
|
/** @type {?} */
|
|
2145
2147
|
var prevState = this._stateStream.getValue();
|
|
@@ -3925,14 +3927,13 @@
|
|
|
3925
3927
|
SelectFactory.store = null;
|
|
3926
3928
|
SelectFactory.config = null;
|
|
3927
3929
|
SelectFactory.decorators = [
|
|
3928
|
-
{ type: core.Injectable
|
|
3930
|
+
{ type: core.Injectable }
|
|
3929
3931
|
];
|
|
3930
3932
|
/** @nocollapse */
|
|
3931
3933
|
SelectFactory.ctorParameters = function () { return [
|
|
3932
3934
|
{ type: Store },
|
|
3933
3935
|
{ type: NgxsConfig }
|
|
3934
3936
|
]; };
|
|
3935
|
-
/** @nocollapse */ SelectFactory.ngInjectableDef = core.defineInjectable({ factory: function SelectFactory_Factory() { return new SelectFactory(core.inject(Store), core.inject(NgxsConfig)); }, token: SelectFactory, providedIn: "root" });
|
|
3936
3937
|
return SelectFactory;
|
|
3937
3938
|
}());
|
|
3938
3939
|
if (false) {
|
|
@@ -4005,11 +4006,8 @@
|
|
|
4005
4006
|
* @ignore
|
|
4006
4007
|
*/
|
|
4007
4008
|
var NgxsRootModule = /** @class */ (function () {
|
|
4008
|
-
function NgxsRootModule(factory, internalStateOperations, _store,
|
|
4009
|
+
function NgxsRootModule(factory, internalStateOperations, _store, _select, states, lifecycleStateManager) {
|
|
4009
4010
|
if (states === void 0) { states = []; }
|
|
4010
|
-
// If the user is running View Engine then we create the `SelectFactory` instance,
|
|
4011
|
-
// otherwise it'll be tree-shaken away in Ivy.
|
|
4012
|
-
!core.ɵivyEnabled && injector.get(SelectFactory);
|
|
4013
4011
|
// Add stores to the state graph and return their defaults
|
|
4014
4012
|
/** @type {?} */
|
|
4015
4013
|
var results = factory.addAndReturnDefaults(states);
|
|
@@ -4027,7 +4025,7 @@
|
|
|
4027
4025
|
{ type: StateFactory },
|
|
4028
4026
|
{ type: InternalStateOperations },
|
|
4029
4027
|
{ type: Store },
|
|
4030
|
-
{ type:
|
|
4028
|
+
{ type: SelectFactory },
|
|
4031
4029
|
{ type: Array, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ROOT_STATE_TOKEN,] }] },
|
|
4032
4030
|
{ type: LifecycleStateManager }
|
|
4033
4031
|
]; };
|
|
@@ -4134,6 +4132,7 @@
|
|
|
4134
4132
|
InternalNgxsExecutionStrategy,
|
|
4135
4133
|
Store,
|
|
4136
4134
|
StateStream,
|
|
4135
|
+
SelectFactory,
|
|
4137
4136
|
PluginManager
|
|
4138
4137
|
], states, NgxsModule.ngxsTokenProviders(states, options))
|
|
4139
4138
|
};
|
|
@@ -4412,37 +4411,30 @@
|
|
|
4412
4411
|
/**
|
|
4413
4412
|
* @template T
|
|
4414
4413
|
* @param {?} selector
|
|
4415
|
-
* @param {?} store
|
|
4416
4414
|
* @return {?}
|
|
4417
4415
|
*/
|
|
4418
|
-
function createSelectObservable(selector
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
: createSelectObservableViewEngine(selector);
|
|
4416
|
+
function createSelectObservable(selector) {
|
|
4417
|
+
if (!SelectFactory.store) {
|
|
4418
|
+
throwSelectFactoryNotConnectedError();
|
|
4419
|
+
}
|
|
4420
|
+
return (/** @type {?} */ (SelectFactory.store)).select(selector);
|
|
4424
4421
|
}
|
|
4425
4422
|
/**
|
|
4426
|
-
* @param {?} config
|
|
4427
4423
|
* @param {?} name
|
|
4428
4424
|
* @param {?=} rawSelector
|
|
4429
4425
|
* @param {?=} paths
|
|
4430
4426
|
* @return {?}
|
|
4431
4427
|
*/
|
|
4432
|
-
function createSelectorFn(
|
|
4428
|
+
function createSelectorFn(name, rawSelector, paths) {
|
|
4433
4429
|
if (paths === void 0) { paths = []; }
|
|
4434
|
-
rawSelector = rawSelector
|
|
4435
|
-
if (typeof rawSelector
|
|
4436
|
-
return rawSelector;
|
|
4437
|
-
}
|
|
4438
|
-
else {
|
|
4430
|
+
rawSelector = !rawSelector ? removeDollarAtTheEnd(name) : rawSelector;
|
|
4431
|
+
if (typeof rawSelector === 'string') {
|
|
4439
4432
|
/** @type {?} */
|
|
4440
4433
|
var propsArray = paths.length
|
|
4441
4434
|
? __spread([rawSelector], paths) : rawSelector.split('.');
|
|
4442
|
-
return
|
|
4443
|
-
? createSelectorFnIvy(propsArray, config)
|
|
4444
|
-
: createSelectorFnViewEngine(propsArray);
|
|
4435
|
+
return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
|
|
4445
4436
|
}
|
|
4437
|
+
return rawSelector;
|
|
4446
4438
|
}
|
|
4447
4439
|
/**
|
|
4448
4440
|
* \@example If `foo$` => make it just `foo`
|
|
@@ -4456,42 +4448,6 @@
|
|
|
4456
4448
|
var dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE;
|
|
4457
4449
|
return dollarAtTheEnd ? name.slice(0, lastCharIndex) : name;
|
|
4458
4450
|
}
|
|
4459
|
-
/**
|
|
4460
|
-
* @template T
|
|
4461
|
-
* @param {?} selector
|
|
4462
|
-
* @param {?} store
|
|
4463
|
-
* @return {?}
|
|
4464
|
-
*/
|
|
4465
|
-
function createSelectObservableIvy(selector, store) {
|
|
4466
|
-
return ngDevMode && !store ? throwSelectFactoryNotConnectedError() : (/** @type {?} */ (store)).select(selector);
|
|
4467
|
-
}
|
|
4468
|
-
/**
|
|
4469
|
-
* @template T
|
|
4470
|
-
* @param {?} selector
|
|
4471
|
-
* @return {?}
|
|
4472
|
-
*/
|
|
4473
|
-
function createSelectObservableViewEngine(selector) {
|
|
4474
|
-
return SelectFactory.store
|
|
4475
|
-
? SelectFactory.store.select(selector)
|
|
4476
|
-
: throwSelectFactoryNotConnectedError();
|
|
4477
|
-
}
|
|
4478
|
-
/**
|
|
4479
|
-
* @param {?} propsArray
|
|
4480
|
-
* @param {?} config
|
|
4481
|
-
* @return {?}
|
|
4482
|
-
*/
|
|
4483
|
-
function createSelectorFnIvy(propsArray, config) {
|
|
4484
|
-
return ngDevMode && !config
|
|
4485
|
-
? throwSelectFactoryNotConnectedError()
|
|
4486
|
-
: propGetter(propsArray, (/** @type {?} */ (config)));
|
|
4487
|
-
}
|
|
4488
|
-
/**
|
|
4489
|
-
* @param {?} propsArray
|
|
4490
|
-
* @return {?}
|
|
4491
|
-
*/
|
|
4492
|
-
function createSelectorFnViewEngine(propsArray) {
|
|
4493
|
-
return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
|
|
4494
|
-
}
|
|
4495
4451
|
|
|
4496
4452
|
/**
|
|
4497
4453
|
* @fileoverview added by tsickle
|
|
@@ -4499,6 +4455,7 @@
|
|
|
4499
4455
|
*/
|
|
4500
4456
|
/**
|
|
4501
4457
|
* Decorator for selecting a slice of state from the store.
|
|
4458
|
+
* @deprecated
|
|
4502
4459
|
* @template T
|
|
4503
4460
|
* @param {?=} rawSelector
|
|
4504
4461
|
* @param {...?} paths
|
|
@@ -4516,17 +4473,13 @@
|
|
|
4516
4473
|
*/
|
|
4517
4474
|
function (target, key) {
|
|
4518
4475
|
var _a;
|
|
4476
|
+
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 ");
|
|
4519
4477
|
/** @type {?} */
|
|
4520
4478
|
var name = key.toString();
|
|
4521
4479
|
/** @type {?} */
|
|
4522
4480
|
var selectorId = "__" + name + "__selector";
|
|
4523
4481
|
/** @type {?} */
|
|
4524
|
-
var selector =
|
|
4525
|
-
/** @type {?} */
|
|
4526
|
-
var injectorNotifier$ = null;
|
|
4527
|
-
if (core.ɵivyEnabled) {
|
|
4528
|
-
injectorNotifier$ = internals.ensureInjectorNotifierIsCaptured(target);
|
|
4529
|
-
}
|
|
4482
|
+
var selector = createSelectorFn(name, rawSelector, paths);
|
|
4530
4483
|
Object.defineProperties(target, (_a = {},
|
|
4531
4484
|
_a[selectorId] = {
|
|
4532
4485
|
writable: true,
|
|
@@ -4540,37 +4493,10 @@
|
|
|
4540
4493
|
* @return {?}
|
|
4541
4494
|
*/
|
|
4542
4495
|
function () {
|
|
4543
|
-
|
|
4544
|
-
if (this[selectorId]) {
|
|
4545
|
-
return this[selectorId];
|
|
4546
|
-
}
|
|
4547
|
-
// The `localInject` will be tree-shaken away in apps that
|
|
4548
|
-
// still use the View Engine.
|
|
4549
|
-
if (core.ɵivyEnabled) {
|
|
4550
|
-
this[selectorId] = (/** @type {?} */ (injectorNotifier$)).pipe(operators.mergeMap((/**
|
|
4551
|
-
* @return {?}
|
|
4552
|
-
*/
|
|
4553
|
-
function () {
|
|
4554
|
-
/** @type {?} */
|
|
4555
|
-
var store = internals.localInject(_this, Store);
|
|
4556
|
-
/** @type {?} */
|
|
4557
|
-
var config = internals.localInject(_this, NgxsConfig);
|
|
4558
|
-
selector = selector || createSelectorFn(config, name, rawSelector, paths);
|
|
4559
|
-
return createSelectObservable(selector, store);
|
|
4560
|
-
})));
|
|
4561
|
-
}
|
|
4562
|
-
else {
|
|
4563
|
-
selector = selector || createSelectorFn(null, name, rawSelector, paths);
|
|
4564
|
-
this[selectorId] = createSelectObservable(selector, null);
|
|
4565
|
-
}
|
|
4566
|
-
return this[selectorId];
|
|
4496
|
+
return this[selectorId] || (this[selectorId] = createSelectObservable(selector));
|
|
4567
4497
|
}
|
|
4568
4498
|
},
|
|
4569
4499
|
_a));
|
|
4570
|
-
// Keep this `if` guard here so the below stuff will be tree-shaken away in apps that still use the View Engine.
|
|
4571
|
-
if (core.ɵivyEnabled) {
|
|
4572
|
-
internals.ensureLocalInjectorCaptured(target);
|
|
4573
|
-
}
|
|
4574
4500
|
});
|
|
4575
4501
|
}
|
|
4576
4502
|
|
|
@@ -4826,12 +4752,13 @@
|
|
|
4826
4752
|
exports.ɵo = InternalStateOperations;
|
|
4827
4753
|
exports.ɵp = PluginManager;
|
|
4828
4754
|
exports.ɵq = InternalNgxsExecutionStrategy;
|
|
4829
|
-
exports.ɵ
|
|
4830
|
-
exports.ɵt =
|
|
4831
|
-
exports.ɵu =
|
|
4832
|
-
exports.ɵv =
|
|
4833
|
-
exports.ɵw =
|
|
4834
|
-
exports.ɵx =
|
|
4755
|
+
exports.ɵr = SelectFactory;
|
|
4756
|
+
exports.ɵt = ensureStoreMetadata;
|
|
4757
|
+
exports.ɵu = getStoreMetadata;
|
|
4758
|
+
exports.ɵv = ensureSelectorMetadata;
|
|
4759
|
+
exports.ɵw = getSelectorMetadata;
|
|
4760
|
+
exports.ɵx = LifecycleStateManager;
|
|
4761
|
+
exports.ɵy = NgxsFeatureModule;
|
|
4835
4762
|
|
|
4836
4763
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4837
4764
|
|