@yuuvis/client-core 2.0.7 → 2.0.9

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.
@@ -867,31 +867,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImpo
867
867
  }] });
868
868
 
869
869
  /**
870
- * Set up the default logger.
871
- * The default logger doesn't actually log anything;
872
- * but, it provides the Dependency-Injection (DI) token that the rest of the
873
- * application can use for dependency resolution. Each platform can then override
874
- * this with a platform-specific logger implementation.
875
- *
876
870
  * @ignore
877
871
  */
878
872
  class Logger {
879
- error(...args) {
880
- // ... the default logger does no work.
873
+ constructor(config) {
874
+ this.config = config;
875
+ this.styles = {
876
+ info: 'color:blue',
877
+ debug: 'background: orange',
878
+ warn: 'background: rgba(255,0,0,.2);color: red',
879
+ error: 'background: red; color: #fff'
880
+ };
881
+ }
882
+ apply(fn, args) {
883
+ args = [`%c${fn}:`, 'font-family: monospace; font-size: 10px; padding: 2px 4px;' + this.styles[fn], ...args];
884
+ return this.shouldLog(fn) ? console && console[fn] && console[fn](...args) : null;
881
885
  }
882
886
  debug(...args) {
883
- // ... the default logger does no work.
887
+ this.apply('debug', args);
888
+ }
889
+ error(...args) {
890
+ this.apply('error', args);
884
891
  }
885
892
  info(...args) {
886
- // ... the default logger does no work.
893
+ this.apply('info', args);
887
894
  }
888
895
  log(...args) {
889
- // ... the default logger does no work.
896
+ this.apply('log', args);
890
897
  }
891
898
  warn(...args) {
892
- // ... the default logger does no work.
899
+ this.apply('warn', args);
900
+ }
901
+ shouldLog(level) {
902
+ let should = false;
903
+ const cfg = this.config.get('core.logging');
904
+ if (!cfg || !cfg.level)
905
+ return false;
906
+ switch (cfg.level) {
907
+ case 'debug': {
908
+ should = true;
909
+ break;
910
+ }
911
+ case 'error': {
912
+ should = ['error'].includes(level);
913
+ break;
914
+ }
915
+ case 'warn': {
916
+ should = ['warn', 'error'].includes(level);
917
+ break;
918
+ }
919
+ case 'info': {
920
+ should = ['info', 'warn', 'error'].includes(level);
921
+ break;
922
+ }
923
+ default: {
924
+ }
925
+ }
926
+ return should;
893
927
  }
928
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: Logger, deps: [{ token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
929
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: Logger, providedIn: 'root' }); }
894
930
  }
931
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: Logger, decorators: [{
932
+ type: Injectable,
933
+ args: [{
934
+ providedIn: 'root'
935
+ }]
936
+ }], ctorParameters: () => [{ type: ConfigService }] });
895
937
 
896
938
  /**
897
939
  * Service for http communication with the yuuvis Momentum backend. Apps
@@ -2557,7 +2599,12 @@ class ObjectConfigService {
2557
2599
  const b = bucket ? this.#objectConfigs.buckets.find((b) => b.id === bucket) : undefined;
2558
2600
  const otr = b ? b.configs : this.#objectConfigs.main;
2559
2601
  const oc = otr[type.id];
2560
- return oc || this.#getRegisteredDefaults(bucket)[type.id];
2602
+ // return oc || this.#getRegisteredDefaults(bucket)[type.id];
2603
+ // override icons by APP_SCHEMA-icons: temporary solution. Todo: remove when handling of custom svg-icons is clear!
2604
+ const result = oc || this.#getRegisteredDefaults(bucket)[type.id];
2605
+ if (result.icon)
2606
+ result.icon = type.icon ? { svg: type.icon } : undefined;
2607
+ return result;
2561
2608
  }
2562
2609
  saveObjectConfig(type, config, bucket) {
2563
2610
  if (!this.#objectConfigs)
@@ -5097,80 +5144,10 @@ EoxTranslateJsonLoader = __decorate([
5097
5144
  CoreConfig])
5098
5145
  ], EoxTranslateJsonLoader);
5099
5146
 
5100
- /**
5101
- * @ignore
5102
- */
5103
- class LoggerConsoleService {
5104
- constructor(config) {
5105
- this.config = config;
5106
- this.styles = {
5107
- info: 'color:blue',
5108
- debug: 'background: orange',
5109
- warn: 'background: rgba(255,0,0,.2);color: red',
5110
- error: 'background: red; color: #fff'
5111
- };
5112
- }
5113
- apply(fn, args) {
5114
- args = [`%c${fn}:`, 'font-family: monospace; font-size: 10px; padding: 2px 4px;' + this.styles[fn], ...args];
5115
- return this.shouldLog(fn) ? console && console[fn] && console[fn](...args) : null;
5116
- }
5117
- debug(...args) {
5118
- this.apply('debug', args);
5119
- }
5120
- error(...args) {
5121
- this.apply('error', args);
5122
- }
5123
- info(...args) {
5124
- this.apply('info', args);
5125
- }
5126
- log(...args) {
5127
- this.apply('log', args);
5128
- }
5129
- warn(...args) {
5130
- this.apply('warn', args);
5131
- }
5132
- shouldLog(level) {
5133
- let should = false;
5134
- const cfg = this.config.get('core.logging');
5135
- if (!cfg || !cfg.level)
5136
- return false;
5137
- switch (cfg.level) {
5138
- case 'debug': {
5139
- should = true;
5140
- break;
5141
- }
5142
- case 'error': {
5143
- should = ['error'].includes(level);
5144
- break;
5145
- }
5146
- case 'warn': {
5147
- should = ['warn', 'error'].includes(level);
5148
- break;
5149
- }
5150
- case 'info': {
5151
- should = ['info', 'warn', 'error'].includes(level);
5152
- break;
5153
- }
5154
- default: {
5155
- }
5156
- }
5157
- return should;
5158
- }
5159
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: LoggerConsoleService, deps: [{ token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
5160
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: LoggerConsoleService, providedIn: 'root' }); }
5161
- }
5162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: LoggerConsoleService, decorators: [{
5163
- type: Injectable,
5164
- args: [{
5165
- providedIn: 'root'
5166
- }]
5167
- }], ctorParameters: () => [{ type: ConfigService }] });
5168
-
5169
5147
  const provideYuvClientCore = (options = { translations: [] }) => {
5170
5148
  return [
5171
5149
  importProvidersFrom(TranslateModule.forRoot()),
5172
5150
  provideHttpClient(withInterceptors([AuthInterceptorFnc, OfflineInterceptorFnc])),
5173
- { provide: Logger, useClass: LoggerConsoleService },
5174
5151
  { provide: CORE_CONFIG, useClass: CoreConfig, deps: [CUSTOM_CONFIG] },
5175
5152
  provideAppInitializer(init_moduleFnc),
5176
5153
  /**