@eui/core 16.2.7 → 16.2.8-snapshot-1701314048651

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.
@@ -1,13 +1,13 @@
1
1
  import * as i1 from '@eui/base';
2
- import { LogLevel, ConsoleAppender, Logger, mergeAll, getI18nLoaderConfig, LoggerMock, EuiLazyService, getI18nServiceConfigFromBase, getI18nState, getLastAddedModule, getBrowserDefaultLanguage, UxEuLanguages, getActiveLang, initialAppState, initialUserState, initialNotificationsState, initialI18nState, initialLocaleState, xhr, getApiQueue, getApiQueueItem, EuiService, getUserRights, getUserState, UxPublishErrorFeedbackEvent, UxClearErrorFeedbackEvent, getLocaleServiceConfigFromBase, getLocaleState, transformToUxHttpResponse } from '@eui/base';
2
+ import { LogLevel, ConsoleAppender, Logger, LoggerMock, mergeAll, getI18nLoaderConfig, EuiLazyService, getI18nServiceConfigFromBase, getI18nState, getLastAddedModule, getBrowserDefaultLanguage, UxEuLanguages, getActiveLang, initialAppState, initialUserState, initialNotificationsState, initialI18nState, initialLocaleState, xhr, getApiQueue, getApiQueueItem, EuiService, getUserRights, getUserState, UxPublishErrorFeedbackEvent, UxClearErrorFeedbackEvent, getLocaleServiceConfigFromBase, getLocaleState, transformToUxHttpResponse } from '@eui/base';
3
3
  export * from '@eui/base';
4
4
  import * as i0 from '@angular/core';
5
- import { InjectionToken, Injectable, Inject, Optional, Injector, NgModule, PLATFORM_ID, APP_INITIALIZER, SkipSelf, ErrorHandler, LOCALE_ID } from '@angular/core';
5
+ import { InjectionToken, Injectable, Inject, Injector, NgModule, Optional, PLATFORM_ID, APP_INITIALIZER, SkipSelf, ErrorHandler, LOCALE_ID } from '@angular/core';
6
6
  import * as extendProxy from 'extend';
7
- import * as i1$2 from '@ngrx/effects';
7
+ import * as i1$3 from '@ngrx/effects';
8
8
  import { createEffect, ofType } from '@ngrx/effects';
9
- import { forkJoin, of, BehaviorSubject, defer, firstValueFrom, merge, fromEvent, throwError, Observable, Subject, from } from 'rxjs';
10
- import { map, catchError, switchMap, tap, filter, take, distinctUntilChanged, mapTo, mergeMap, debounceTime, concatMap, takeUntil, finalize } from 'rxjs/operators';
9
+ import { throwError, forkJoin, of, BehaviorSubject, defer, firstValueFrom, merge, fromEvent, Observable, Subject, from } from 'rxjs';
10
+ import { debounceTime, distinctUntilChanged, map, catchError, switchMap, tap, filter, take, mapTo, mergeMap, concatMap, takeUntil, finalize } from 'rxjs/operators';
11
11
  import * as i2 from '@ngx-translate/core';
12
12
  import { TranslateLoader } from '@ngx-translate/core';
13
13
  import { DOCUMENT, isPlatformBrowser, LOCATION_INITIALIZED, getLocaleId, registerLocaleData } from '@angular/common';
@@ -15,9 +15,9 @@ import * as i2$1 from '@angular/router';
15
15
  import { NavigationEnd } from '@angular/router';
16
16
  import isEqual from 'lodash-es/isEqual';
17
17
  import get from 'lodash-es/get';
18
- import * as i1$1 from '@angular/common/http';
18
+ import * as i1$2 from '@angular/common/http';
19
19
  import { HttpErrorResponse, HttpResponse, HttpHeaders, HttpEventType } from '@angular/common/http';
20
- import * as i1$3 from '@ngrx/store';
20
+ import * as i1$1 from '@ngrx/store';
21
21
  import { createSelector } from '@ngrx/store';
22
22
  import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
23
23
  import { MomentDateAdapter } from '@angular/material-moment-adapter';
@@ -320,6 +320,258 @@ class UpdateLocaleStateAction {
320
320
  }
321
321
  }
322
322
 
323
+ const BASE_LOGGER_NAME_TOKEN = new InjectionToken('BASE_LOGGER_NAME');
324
+ const LOG_LEVEL_TOKEN = new InjectionToken('LOG_LEVEL');
325
+ const LOG_APPENDERS_TOKEN = new InjectionToken('LOG_APPENDERS');
326
+ /**
327
+ * Log service, responsible for getting or creating loggers. It itself acts as a base logger
328
+ */
329
+ class LogService extends Logger {
330
+ constructor(name, level, appenders) {
331
+ super(name, level, appenders);
332
+ this.name = name;
333
+ this.level = level;
334
+ this.appenders = appenders;
335
+ /** the list of persistent loggers */
336
+ this.loggers = {};
337
+ }
338
+ /**
339
+ * Gets a logger by name. If the logger does not exist, it is created
340
+ *
341
+ * @param loggerName logger name
342
+ * @param persist optional parameter. Set it to true if you want to reuse the logger. By default, it is set to false
343
+ * @returns the logger
344
+ */
345
+ getLogger(loggerName, persist = false) {
346
+ // create the logger, if necessary
347
+ const logger = (persist && this.loggers[loggerName]) || new Logger(loggerName, this.level, this.appenders);
348
+ // if the logger is persistent, add it to the list of persistent loggers
349
+ if (persist) {
350
+ this.loggers[loggerName] = logger;
351
+ }
352
+ return logger;
353
+ }
354
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService, deps: [{ token: BASE_LOGGER_NAME_TOKEN }, { token: LOG_LEVEL_TOKEN }, { token: LOG_APPENDERS_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
355
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService }); }
356
+ }
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService, decorators: [{
358
+ type: Injectable
359
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
360
+ type: Inject,
361
+ args: [BASE_LOGGER_NAME_TOKEN]
362
+ }] }, { type: i1.LogLevel, decorators: [{
363
+ type: Inject,
364
+ args: [LOG_LEVEL_TOKEN]
365
+ }] }, { type: undefined, decorators: [{
366
+ type: Inject,
367
+ args: [LOG_APPENDERS_TOKEN]
368
+ }] }]; } });
369
+
370
+ class LogServiceMock extends LoggerMock {
371
+ getLogger() {
372
+ return new LoggerMock();
373
+ }
374
+ }
375
+
376
+ const LOG_INSTANCES = {};
377
+ /**
378
+ * Helper function to check if the log config is defined.
379
+ * Does not check only for empty object, because the config can have other (non-log) parameters
380
+ * @params config log configuration
381
+ * @returns true/false
382
+ */
383
+ function isLogConfigDefined(config) {
384
+ return config && ('baseLoggerName' in config || 'logLevel' in config || 'logAppenders' in config);
385
+ }
386
+ /**
387
+ * Helper function to provide a list of log appenders from a log configuration
388
+ *
389
+ * @params config log configuration
390
+ * @returns an array of log appenders
391
+ */
392
+ function getLogAppendersConfig(config = DEFAULT_LOG_CONFIG, injector = null) {
393
+ config = Object.assign({}, DEFAULT_LOG_CONFIG, config);
394
+ config.logAppenders = config.logAppenders || [];
395
+ config.logAppenders = Array.isArray(config.logAppenders) ? config.logAppenders : [config.logAppenders];
396
+ return config.logAppenders.map((logAppender) => {
397
+ const appenderType = typeof logAppender === 'object' ? logAppender.type : logAppender;
398
+ const appenderParams = typeof logAppender === 'object' ? logAppender : undefined;
399
+ return new appenderType(appenderParams, injector);
400
+ });
401
+ }
402
+ /**
403
+ * Helper function to provide an instance of LogService from a configuration
404
+ *
405
+ * @params config log configuration
406
+ * @returns an instance of log service
407
+ */
408
+ function logServiceFactory(config = DEFAULT_LOG_CONFIG, injector = null) {
409
+ // add the default values to config
410
+ config = Object.assign({}, DEFAULT_LOG_CONFIG, config);
411
+ // extract parameters from config
412
+ const logLevel = config.logLevel;
413
+ const logAppenders = getLogAppendersConfig(config, injector);
414
+ // return an instance of LogService
415
+ return new LogService(config.baseLoggerName, logLevel, logAppenders);
416
+ }
417
+ function euiLogServiceFactory(injector, rootBaseLoggerName, rootConfig, childBaseLoggerName = null, childConfig = {}) {
418
+ // determine if the configuration is for non-root modules
419
+ const forChild = isLogConfigDefined(childConfig);
420
+ const baseLoggerName = forChild ? childBaseLoggerName : rootBaseLoggerName;
421
+ // create the proper configuration
422
+ const config = Object.assign({ baseLoggerName }, forChild ? Object.assign({}, rootConfig, childConfig) : rootConfig);
423
+ // re-use the log service or create a new instance
424
+ const logService = LOG_INSTANCES[baseLoggerName] || logServiceFactory(config, injector);
425
+ LOG_INSTANCES[baseLoggerName] = logService;
426
+ return logService;
427
+ }
428
+
429
+ const LOG_MODULE_CONFIG_TOKEN = new InjectionToken('LOG_CONFIG');
430
+ /**
431
+ * Log Module
432
+ */
433
+ class LogModule {
434
+ /** method called in your root module to provide the LogService */
435
+ static forRoot(config = DEFAULT_LOG_CONFIG) {
436
+ return {
437
+ ngModule: LogModule,
438
+ providers: [
439
+ { provide: LOG_MODULE_CONFIG_TOKEN, useValue: config },
440
+ { provide: LogService, useFactory: logServiceFactory, deps: [LOG_MODULE_CONFIG_TOKEN, Injector] },
441
+ ],
442
+ };
443
+ }
444
+ /** method called in your other (non root, lazy loaded) modules to import a different instance of LogService */
445
+ static forChild(config = DEFAULT_LOG_CONFIG) {
446
+ return {
447
+ ngModule: LogModule,
448
+ providers: [
449
+ { provide: LOG_MODULE_CONFIG_TOKEN, useValue: config },
450
+ { provide: LogService, useFactory: logServiceFactory, deps: [LOG_MODULE_CONFIG_TOKEN, Injector] },
451
+ ],
452
+ };
453
+ }
454
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
455
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LogModule }); }
456
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule }); }
457
+ }
458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule, decorators: [{
459
+ type: NgModule
460
+ }] });
461
+
462
+ var BrowserStorageType;
463
+ (function (BrowserStorageType) {
464
+ BrowserStorageType[BrowserStorageType["local"] = 0] = "local";
465
+ BrowserStorageType[BrowserStorageType["session"] = 1] = "session";
466
+ })(BrowserStorageType || (BrowserStorageType = {}));
467
+ // todo should stay here but all the store directory should be moved upper level
468
+ // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
469
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
470
+ class StoreService {
471
+ constructor(store, logService) {
472
+ this.store = store;
473
+ this.logService = logService;
474
+ /**
475
+ * autoSave handlers to call before saving in local Storage
476
+ */
477
+ this._autoSaveHandlers = {};
478
+ /** storage instance e.g. localStorage, sessionStorage */
479
+ this._storage = localStorage;
480
+ }
481
+ // use init with just version info, to update to user state, UserService.updateState
482
+ // initializeStore(version?: string, userDetails?: BaseUserDetails) {
483
+ // this.dispatch(new InitStoreAction({ version, userDetails }));
484
+ // }
485
+ init(version, storageType) {
486
+ this.dispatch(new InitStoreAction({ version }));
487
+ this._storage = storageType === BrowserStorageType.session ? sessionStorage : localStorage;
488
+ }
489
+ addAutoSaveHandler(stateSlice, handler) {
490
+ if (!this.store) {
491
+ if (this.logService) {
492
+ this.logService.warn('StoreService.addAutoSaveHandler() not available without NGRX');
493
+ }
494
+ return;
495
+ }
496
+ this._autoSaveHandlers[stateSlice] = handler;
497
+ }
498
+ handleAutoSave() {
499
+ if (!this.store) {
500
+ return;
501
+ }
502
+ this.store.pipe(debounceTime(1000), distinctUntilChanged()).subscribe((state) => {
503
+ this.saveState(state);
504
+ });
505
+ }
506
+ /**
507
+ * Proxy to NGRX store.dispatch()
508
+ * that allows to intercept if the store is present
509
+ */
510
+ // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
511
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
512
+ dispatch(action) {
513
+ if (this.store) {
514
+ return this.store.dispatch(action);
515
+ }
516
+ }
517
+ // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
518
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
519
+ dispatchAction(state, actionKey, reducer) {
520
+ if (this.store) {
521
+ this.store.addReducer(actionKey, reducer);
522
+ return this.store.dispatch({ type: actionKey, payload: state });
523
+ }
524
+ }
525
+ /**
526
+ * Proxy to NGRX store.select()
527
+ * that allows to intercept if the store is present
528
+ */
529
+ // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
530
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
531
+ select(key) {
532
+ if (!this.store) {
533
+ return throwError(() => new Error('NGRX Store not configured'));
534
+ }
535
+ return this.store.select(key);
536
+ }
537
+ /**
538
+ * filters and save the state with the Browser storage
539
+ * @param state type of CoreState
540
+ */
541
+ saveState(state) {
542
+ let stateToSave = {
543
+ app: state.app,
544
+ };
545
+ if (state.user) {
546
+ const { userId, preferences } = state.user;
547
+ stateToSave.user = { userId, preferences };
548
+ }
549
+ Object.keys(this._autoSaveHandlers).forEach((sliceState) => {
550
+ const handler = this._autoSaveHandlers[sliceState];
551
+ stateToSave = Object.assign(stateToSave, { [sliceState]: handler(state[sliceState]) });
552
+ });
553
+ try {
554
+ const serializedState = JSON.stringify(stateToSave);
555
+ this._storage.setItem('state', serializedState);
556
+ }
557
+ catch (err) {
558
+ // Ignore write errors.
559
+ }
560
+ }
561
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, deps: [{ token: i1$1.Store, optional: true }, { token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
562
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, providedIn: 'root' }); }
563
+ }
564
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, decorators: [{
565
+ type: Injectable,
566
+ args: [{
567
+ providedIn: 'root',
568
+ }]
569
+ }], ctorParameters: function () { return [{ type: i1$1.Store, decorators: [{
570
+ type: Optional
571
+ }] }, { type: LogService, decorators: [{
572
+ type: Optional
573
+ }] }]; } });
574
+
323
575
  class I18nResourceImpl {
324
576
  /**
325
577
  * Resource constructor
@@ -368,53 +620,6 @@ class I18nResourceImpl {
368
620
  }
369
621
  }
370
622
 
371
- const BASE_LOGGER_NAME_TOKEN = new InjectionToken('BASE_LOGGER_NAME');
372
- const LOG_LEVEL_TOKEN = new InjectionToken('LOG_LEVEL');
373
- const LOG_APPENDERS_TOKEN = new InjectionToken('LOG_APPENDERS');
374
- /**
375
- * Log service, responsible for getting or creating loggers. It itself acts as a base logger
376
- */
377
- class LogService extends Logger {
378
- constructor(name, level, appenders) {
379
- super(name, level, appenders);
380
- this.name = name;
381
- this.level = level;
382
- this.appenders = appenders;
383
- /** the list of persistent loggers */
384
- this.loggers = {};
385
- }
386
- /**
387
- * Gets a logger by name. If the logger does not exist, it is created
388
- *
389
- * @param loggerName logger name
390
- * @param persist optional parameter. Set it to true if you want to reuse the logger. By default, it is set to false
391
- * @returns the logger
392
- */
393
- getLogger(loggerName, persist = false) {
394
- // create the logger, if necessary
395
- const logger = (persist && this.loggers[loggerName]) || new Logger(loggerName, this.level, this.appenders);
396
- // if the logger is persistent, add it to the list of persistent loggers
397
- if (persist) {
398
- this.loggers[loggerName] = logger;
399
- }
400
- return logger;
401
- }
402
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService, deps: [{ token: BASE_LOGGER_NAME_TOKEN }, { token: LOG_LEVEL_TOKEN }, { token: LOG_APPENDERS_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
403
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService }); }
404
- }
405
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogService, decorators: [{
406
- type: Injectable
407
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
408
- type: Inject,
409
- args: [BASE_LOGGER_NAME_TOKEN]
410
- }] }, { type: i1.LogLevel, decorators: [{
411
- type: Inject,
412
- args: [LOG_LEVEL_TOKEN]
413
- }] }, { type: undefined, decorators: [{
414
- type: Inject,
415
- args: [LOG_APPENDERS_TOKEN]
416
- }] }]; } });
417
-
418
623
  class I18nLoader {
419
624
  constructor(http, logService, euiAppConfig) {
420
625
  this.http = http;
@@ -595,12 +800,12 @@ class I18nLoader {
595
800
  }
596
801
  return undefined;
597
802
  }
598
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: I18nLoader, deps: [{ token: i1$1.HttpClient }, { token: LogService, optional: true }, { token: CONFIG_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
803
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: I18nLoader, deps: [{ token: i1$2.HttpClient }, { token: LogService, optional: true }, { token: CONFIG_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
599
804
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: I18nLoader }); }
600
805
  }
601
806
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: I18nLoader, decorators: [{
602
807
  type: Injectable
603
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: LogService, decorators: [{
808
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: LogService, decorators: [{
604
809
  type: Optional
605
810
  }] }, { type: undefined, decorators: [{
606
811
  type: Inject,
@@ -613,98 +818,6 @@ const translateConfig = {
613
818
  },
614
819
  };
615
820
 
616
- class LogServiceMock extends LoggerMock {
617
- getLogger() {
618
- return new LoggerMock();
619
- }
620
- }
621
-
622
- const LOG_INSTANCES = {};
623
- /**
624
- * Helper function to check if the log config is defined.
625
- * Does not check only for empty object, because the config can have other (non-log) parameters
626
- * @params config log configuration
627
- * @returns true/false
628
- */
629
- function isLogConfigDefined(config) {
630
- return config && ('baseLoggerName' in config || 'logLevel' in config || 'logAppenders' in config);
631
- }
632
- /**
633
- * Helper function to provide a list of log appenders from a log configuration
634
- *
635
- * @params config log configuration
636
- * @returns an array of log appenders
637
- */
638
- function getLogAppendersConfig(config = DEFAULT_LOG_CONFIG, injector = null) {
639
- config = Object.assign({}, DEFAULT_LOG_CONFIG, config);
640
- config.logAppenders = config.logAppenders || [];
641
- config.logAppenders = Array.isArray(config.logAppenders) ? config.logAppenders : [config.logAppenders];
642
- return config.logAppenders.map((logAppender) => {
643
- const appenderType = typeof logAppender === 'object' ? logAppender.type : logAppender;
644
- const appenderParams = typeof logAppender === 'object' ? logAppender : undefined;
645
- return new appenderType(appenderParams, injector);
646
- });
647
- }
648
- /**
649
- * Helper function to provide an instance of LogService from a configuration
650
- *
651
- * @params config log configuration
652
- * @returns an instance of log service
653
- */
654
- function logServiceFactory(config = DEFAULT_LOG_CONFIG, injector = null) {
655
- // add the default values to config
656
- config = Object.assign({}, DEFAULT_LOG_CONFIG, config);
657
- // extract parameters from config
658
- const logLevel = config.logLevel;
659
- const logAppenders = getLogAppendersConfig(config, injector);
660
- // return an instance of LogService
661
- return new LogService(config.baseLoggerName, logLevel, logAppenders);
662
- }
663
- function euiLogServiceFactory(injector, rootBaseLoggerName, rootConfig, childBaseLoggerName = null, childConfig = {}) {
664
- // determine if the configuration is for non-root modules
665
- const forChild = isLogConfigDefined(childConfig);
666
- const baseLoggerName = forChild ? childBaseLoggerName : rootBaseLoggerName;
667
- // create the proper configuration
668
- const config = Object.assign({ baseLoggerName }, forChild ? Object.assign({}, rootConfig, childConfig) : rootConfig);
669
- // re-use the log service or create a new instance
670
- const logService = LOG_INSTANCES[baseLoggerName] || logServiceFactory(config, injector);
671
- LOG_INSTANCES[baseLoggerName] = logService;
672
- return logService;
673
- }
674
-
675
- const LOG_MODULE_CONFIG_TOKEN = new InjectionToken('LOG_CONFIG');
676
- /**
677
- * Log Module
678
- */
679
- class LogModule {
680
- /** method called in your root module to provide the LogService */
681
- static forRoot(config = DEFAULT_LOG_CONFIG) {
682
- return {
683
- ngModule: LogModule,
684
- providers: [
685
- { provide: LOG_MODULE_CONFIG_TOKEN, useValue: config },
686
- { provide: LogService, useFactory: logServiceFactory, deps: [LOG_MODULE_CONFIG_TOKEN, Injector] },
687
- ],
688
- };
689
- }
690
- /** method called in your other (non root, lazy loaded) modules to import a different instance of LogService */
691
- static forChild(config = DEFAULT_LOG_CONFIG) {
692
- return {
693
- ngModule: LogModule,
694
- providers: [
695
- { provide: LOG_MODULE_CONFIG_TOKEN, useValue: config },
696
- { provide: LogService, useFactory: logServiceFactory, deps: [LOG_MODULE_CONFIG_TOKEN, Injector] },
697
- ],
698
- };
699
- }
700
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
701
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LogModule }); }
702
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule }); }
703
- }
704
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogModule, decorators: [{
705
- type: NgModule
706
- }] });
707
-
708
821
  class I18nService extends EuiLazyService {
709
822
  constructor(baseGlobalConfig, translateService, logService, store, document) {
710
823
  super({ activeLang: 'en' });
@@ -1615,7 +1728,7 @@ class UxAppShellService {
1615
1728
  }
1616
1729
  });
1617
1730
  }
1618
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UxAppShellService, deps: [{ token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: i1$1.HttpClient }, { token: PLATFORM_ID }, { token: i2$1.Router }, { token: StoreService }, { token: I18nService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1731
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UxAppShellService, deps: [{ token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: i1$2.HttpClient }, { token: PLATFORM_ID }, { token: i2$1.Router }, { token: StoreService }, { token: I18nService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1619
1732
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UxAppShellService, providedIn: 'root' }); }
1620
1733
  }
1621
1734
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UxAppShellService, decorators: [{
@@ -1628,7 +1741,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1628
1741
  }, {
1629
1742
  type: Inject,
1630
1743
  args: [GLOBAL_CONFIG_TOKEN]
1631
- }] }, { type: i1$1.HttpClient }, { type: undefined, decorators: [{
1744
+ }] }, { type: i1$2.HttpClient }, { type: undefined, decorators: [{
1632
1745
  type: Inject,
1633
1746
  args: [PLATFORM_ID]
1634
1747
  }] }, { type: i2$1.Router }, { type: StoreService }, { type: I18nService, decorators: [{
@@ -1670,12 +1783,12 @@ class CoreAppEffects {
1670
1783
  }
1671
1784
  })), { dispatch: false });
1672
1785
  }
1673
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CoreAppEffects, deps: [{ token: i1$2.Actions }, { token: SHOW_CONNECTION_STATUS_TOKEN }, { token: i2.TranslateService }, { token: UxAppShellService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1786
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CoreAppEffects, deps: [{ token: i1$3.Actions }, { token: SHOW_CONNECTION_STATUS_TOKEN }, { token: i2.TranslateService }, { token: UxAppShellService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1674
1787
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CoreAppEffects }); }
1675
1788
  }
1676
1789
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CoreAppEffects, decorators: [{
1677
1790
  type: Injectable
1678
- }], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: undefined, decorators: [{
1791
+ }], ctorParameters: function () { return [{ type: i1$3.Actions }, { type: undefined, decorators: [{
1679
1792
  type: Inject,
1680
1793
  args: [SHOW_CONNECTION_STATUS_TOKEN]
1681
1794
  }] }, { type: i2.TranslateService }, { type: UxAppShellService }]; } });
@@ -1915,119 +2028,6 @@ const cb = (reducer, storage) => (state, action) => {
1915
2028
  return reducer(state, action);
1916
2029
  };
1917
2030
 
1918
- var BrowserStorageType;
1919
- (function (BrowserStorageType) {
1920
- BrowserStorageType[BrowserStorageType["local"] = 0] = "local";
1921
- BrowserStorageType[BrowserStorageType["session"] = 1] = "session";
1922
- })(BrowserStorageType || (BrowserStorageType = {}));
1923
- // todo should stay here but all the store directory should be moved upper level
1924
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
1925
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1926
- class StoreService {
1927
- constructor(store, logService) {
1928
- this.store = store;
1929
- this.logService = logService;
1930
- /**
1931
- * autoSave handlers to call before saving in local Storage
1932
- */
1933
- this._autoSaveHandlers = {};
1934
- /** storage instance e.g. localStorage, sessionStorage */
1935
- this._storage = localStorage;
1936
- }
1937
- // use init with just version info, to update to user state, UserService.updateState
1938
- // initializeStore(version?: string, userDetails?: BaseUserDetails) {
1939
- // this.dispatch(new InitStoreAction({ version, userDetails }));
1940
- // }
1941
- init(version, storageType) {
1942
- this.dispatch(new InitStoreAction({ version }));
1943
- this._storage = storageType === BrowserStorageType.session ? sessionStorage : localStorage;
1944
- }
1945
- addAutoSaveHandler(stateSlice, handler) {
1946
- if (!this.store) {
1947
- if (this.logService) {
1948
- this.logService.warn('StoreService.addAutoSaveHandler() not available without NGRX');
1949
- }
1950
- return;
1951
- }
1952
- this._autoSaveHandlers[stateSlice] = handler;
1953
- }
1954
- handleAutoSave() {
1955
- if (!this.store) {
1956
- return;
1957
- }
1958
- this.store.pipe(debounceTime(1000), distinctUntilChanged()).subscribe((state) => {
1959
- this.saveState(state);
1960
- });
1961
- }
1962
- /**
1963
- * Proxy to NGRX store.dispatch()
1964
- * that allows to intercept if the store is present
1965
- */
1966
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
1967
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1968
- dispatch(action) {
1969
- if (this.store) {
1970
- return this.store.dispatch(action);
1971
- }
1972
- }
1973
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
1974
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1975
- dispatchAction(state, actionKey, reducer) {
1976
- if (this.store) {
1977
- this.store.addReducer(actionKey, reducer);
1978
- return this.store.dispatch({ type: actionKey, payload: state });
1979
- }
1980
- }
1981
- /**
1982
- * Proxy to NGRX store.select()
1983
- * that allows to intercept if the store is present
1984
- */
1985
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
1986
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1987
- select(key) {
1988
- if (!this.store) {
1989
- return throwError(() => new Error('NGRX Store not configured'));
1990
- }
1991
- return this.store.select(key);
1992
- }
1993
- /**
1994
- * filters and save the state with the Browser storage
1995
- * @param state type of CoreState
1996
- */
1997
- saveState(state) {
1998
- let stateToSave = {
1999
- app: state.app,
2000
- };
2001
- if (state.user) {
2002
- const { userId, preferences } = state.user;
2003
- stateToSave.user = { userId, preferences };
2004
- }
2005
- Object.keys(this._autoSaveHandlers).forEach((sliceState) => {
2006
- const handler = this._autoSaveHandlers[sliceState];
2007
- stateToSave = Object.assign(stateToSave, { [sliceState]: handler(state[sliceState]) });
2008
- });
2009
- try {
2010
- const serializedState = JSON.stringify(stateToSave);
2011
- this._storage.setItem('state', serializedState);
2012
- }
2013
- catch (err) {
2014
- // Ignore write errors.
2015
- }
2016
- }
2017
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, deps: [{ token: i1$3.Store, optional: true }, { token: LogService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
2018
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, providedIn: 'root' }); }
2019
- }
2020
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StoreService, decorators: [{
2021
- type: Injectable,
2022
- args: [{
2023
- providedIn: 'root',
2024
- }]
2025
- }], ctorParameters: function () { return [{ type: i1$3.Store, decorators: [{
2026
- type: Optional
2027
- }] }, { type: LogService, decorators: [{
2028
- type: Optional
2029
- }] }]; } });
2030
-
2031
2031
  class StoreServiceMock extends StoreService {
2032
2032
  constructor() {
2033
2033
  super(null, null);
@@ -2486,7 +2486,7 @@ class ApiQueueService {
2486
2486
  buildHttpRequest(id, item) {
2487
2487
  return this.http[item.method.toLowerCase()](item.uri, item.payload).pipe(tap(() => this.removeQueueItem(id)));
2488
2488
  }
2489
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiQueueService, deps: [{ token: StoreService }, { token: i1$1.HttpClient }, { token: LogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2489
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiQueueService, deps: [{ token: StoreService }, { token: i1$2.HttpClient }, { token: LogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2490
2490
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiQueueService, providedIn: 'root' }); }
2491
2491
  }
2492
2492
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiQueueService, decorators: [{
@@ -2494,7 +2494,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2494
2494
  args: [{
2495
2495
  providedIn: 'root',
2496
2496
  }]
2497
- }], ctorParameters: function () { return [{ type: StoreService }, { type: i1$1.HttpClient }, { type: LogService }]; } });
2497
+ }], ctorParameters: function () { return [{ type: StoreService }, { type: i1$2.HttpClient }, { type: LogService }]; } });
2498
2498
 
2499
2499
  class ApiQueueServiceMock extends ApiQueueService {
2500
2500
  constructor() {