@yuuvis/client-core 3.4.1 → 3.5.0

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.
@@ -8,8 +8,8 @@ import { inject, Injectable, InjectionToken, NgZone, DOCUMENT, Inject, signal, D
8
8
  import { tap, finalize, shareReplay, catchError, map, switchMap, first, filter, scan, delay } from 'rxjs/operators';
9
9
  import { EMPTY, Subject, of, forkJoin, Observable, tap as tap$1, catchError as catchError$1, ReplaySubject, BehaviorSubject, map as map$1, throwError, switchMap as switchMap$1, merge, fromEvent, filter as filter$1, debounceTime, isObservable } from 'rxjs';
10
10
  import { StorageMap } from '@ngx-pwa/local-storage';
11
- import { __decorate, __param, __metadata } from 'tslib';
12
11
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
12
+ import { __decorate, __param } from 'tslib';
13
13
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
14
14
  import { registerLocaleData, DecimalPipe, PercentPipe, CurrencyPipe } from '@angular/common';
15
15
  import localeAr from '@angular/common/locales/ar';
@@ -1736,7 +1736,7 @@ class SystemService {
1736
1736
  const propertiesQA = {};
1737
1737
  const orgTypeFields = [BaseObjectTypeField.MODIFIED_BY, BaseObjectTypeField.CREATED_BY];
1738
1738
  schemaResponse.propertyDefinition.forEach((propDef) => {
1739
- // p.classifications = p.classification;
1739
+ propDef.classifications = propDef.classification;
1740
1740
  // TODO: Remove once schema supports organization classification for base params
1741
1741
  // map certain fields to organization type (fake it until you make it ;-)
1742
1742
  if (orgTypeFields.includes(propDef.id)) {
@@ -2745,7 +2745,7 @@ class AuditService {
2745
2745
  */
2746
2746
  getAuditEntries(id, options = {}) {
2747
2747
  const auditActions = this.getAuditActions(!!options.allActions, options?.skipActions);
2748
- const q = {
2748
+ const query = {
2749
2749
  size: this.DEFAULT_RES_SIZE,
2750
2750
  types: [SystemType.AUDIT],
2751
2751
  filters: [
@@ -2767,7 +2767,7 @@ class AuditService {
2767
2767
  }
2768
2768
  ]
2769
2769
  };
2770
- return this.#fetchAudits(q);
2770
+ return this.#fetchAudits(query);
2771
2771
  }
2772
2772
  /**
2773
2773
  * Get an array of action codes that are provided by the service. Based on
@@ -2776,8 +2776,10 @@ class AuditService {
2776
2776
  * @param skipActions codes of actions that should not be fetched
2777
2777
  */
2778
2778
  getAuditActions(allActions, skipActions) {
2779
- const actions = allActions || this.#userService.isAdvancedUser ? [...this.userAuditActions, ...this.adminAuditActions] : this.userAuditActions;
2780
- return actions.filter((a) => !skipActions || !skipActions.includes(a));
2779
+ const actions = allActions || this.#userService.isAdvancedUser
2780
+ ? [...this.userAuditActions, ...this.adminAuditActions]
2781
+ : this.userAuditActions;
2782
+ return actions.filter((action) => !skipActions?.includes(action));
2781
2783
  }
2782
2784
  /**
2783
2785
  * Get a certain page for a former audits query.
@@ -2785,32 +2787,37 @@ class AuditService {
2785
2787
  * @param page The page to load
2786
2788
  */
2787
2789
  getPage(auditsResult, page) {
2788
- const q = auditsResult.query;
2789
- q.from = (page - 1) * (q.size || this.DEFAULT_RES_SIZE);
2790
- return this.#fetchAudits(q);
2791
- }
2792
- #fetchAudits(q) {
2793
- return this.#searchService.searchRaw(q).pipe(map((res) => ({
2794
- query: q,
2795
- items: res.objects.map((o) => ({
2796
- action: o.properties[AuditField.ACTION].value,
2797
- actionGroup: this.#getActionGroup(o.properties[AuditField.ACTION].value),
2798
- detail: o.properties[AuditField.DETAIL].value,
2799
- subaction: o.properties[AuditField.SUBACTION] ? o.properties[AuditField.SUBACTION].value : null,
2800
- version: o.properties[AuditField.VERSION].value,
2801
- creationDate: o.properties[AuditField.CREATION_DATE].value,
2802
- createdBy: {
2803
- id: o.properties[AuditField.CREATED_BY].value,
2804
- title: o.properties[AuditField.CREATED_BY].title
2805
- }
2806
- })),
2790
+ const query = auditsResult.query;
2791
+ query.from = (page - 1) * (query.size || this.DEFAULT_RES_SIZE);
2792
+ return this.#fetchAudits(query);
2793
+ }
2794
+ #fetchAudits(query) {
2795
+ return this.#searchService.searchRaw(query).pipe(map((res) => ({
2796
+ query,
2797
+ items: res.objects.map((object) => {
2798
+ const prop = (field) => object.properties[field];
2799
+ const action = (prop(AuditField.ACTION)?.value ?? null);
2800
+ const createdBy = prop(AuditField.CREATED_BY);
2801
+ return {
2802
+ action,
2803
+ actionGroup: this.#getActionGroup(action),
2804
+ detail: prop(AuditField.DETAIL)?.value ?? null,
2805
+ subaction: prop(AuditField.SUBACTION)?.value ?? null,
2806
+ version: prop(AuditField.VERSION)?.value ?? null,
2807
+ creationDate: prop(AuditField.CREATION_DATE)?.value ?? null,
2808
+ createdBy: {
2809
+ id: createdBy?.value ?? null,
2810
+ title: createdBy?.title ?? null
2811
+ }
2812
+ };
2813
+ }),
2807
2814
  hasMoreItems: res.hasMoreItems,
2808
- page: !q.from ? 1 : q.from / q.size + 1
2815
+ page: !query.from ? 1 : query.from / query.size + 1
2809
2816
  })));
2810
2817
  }
2811
2818
  #getActionGroup(action) {
2812
2819
  try {
2813
- return parseInt(`${action}`.substr(0, 1));
2820
+ return parseInt(`${action}`.substring(0, 1));
2814
2821
  }
2815
2822
  catch {
2816
2823
  return -1;
@@ -2834,22 +2841,6 @@ const CUSTOM_CONFIG = new InjectionToken('CUSTOM_CONFIG', {
2834
2841
  });
2835
2842
  const CORE_CONFIG = new InjectionToken('CORE_CONFIG');
2836
2843
 
2837
- /**
2838
- * @ignore
2839
- */
2840
- let CoreConfig = class CoreConfig {
2841
- constructor(__config) {
2842
- this.main = ['assets/_yuuvis/config/main.json'];
2843
- this.translations = ['assets/_yuuvis/i18n/'];
2844
- this.environment = { production: true };
2845
- Object.assign(this, __config);
2846
- }
2847
- };
2848
- CoreConfig = __decorate([
2849
- __param(0, Inject(CUSTOM_CONFIG)),
2850
- __metadata("design:paramtypes", [CoreConfig])
2851
- ], CoreConfig);
2852
-
2853
2844
  /**
2854
2845
  * Service managing the configuarions for object types.
2855
2846
  * Configuration means that you can pick certain fields
@@ -3122,6 +3113,21 @@ const provideUser = (user) => {
3122
3113
  return { provide: YUV_USER, useValue: user };
3123
3114
  };
3124
3115
 
3116
+ /**
3117
+ * @ignore
3118
+ */
3119
+ let CoreConfig = class CoreConfig {
3120
+ constructor(__config) {
3121
+ this.main = ['assets/_yuuvis/config/main.json'];
3122
+ this.translations = ['assets/_yuuvis/i18n/'];
3123
+ this.environment = { production: true };
3124
+ Object.assign(this, __config);
3125
+ }
3126
+ };
3127
+ CoreConfig = __decorate([
3128
+ __param(0, Inject(CUSTOM_CONFIG))
3129
+ ], CoreConfig);
3130
+
3125
3131
  /**
3126
3132
  * Service handling authentication related issues.
3127
3133
  */