@yuuvis/client-core 3.4.2 → 3.6.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';
@@ -299,30 +299,6 @@ class DmsObject {
299
299
  }
300
300
  this.sots = searchResultItem.fields.get(BaseObjectTypeField.SECONDARY_OBJECT_TYPE_IDS) || [];
301
301
  }
302
- // /**
303
- // * Get the value (state) of a certain tag
304
- // * @param name The tags name
305
- // * @returns The value of the tag or null if the tag does not exist
306
- // */
307
- // getTag(name: string): any {
308
- // const tags: unknown[][] = this.data[BaseObjectTypeField.TAGS] as unknown[][];
309
- // const tag: unknown[] | null = tags ? (tags.find((t: any) => t[0] === name) as unknown[]) : null;
310
- // return tag ? tag[1] : null;
311
- // }
312
- // getRetentionState(): RetentionState {
313
- // if (this.data[RetentionField.RETENTION_START]) {
314
- // const retentionStart = new Date(this.data[RetentionField.RETENTION_START] as string);
315
- // const retentionEnd = new Date(this.data[RetentionField.RETENTION_END] as string);
316
- // const today = new Date();
317
- // return retentionStart <= today && today <= retentionEnd
318
- // ? RetentionState.ACTIVE
319
- // : today < retentionStart
320
- // ? RetentionState.INACTIVE
321
- // : RetentionState.DESTRUCT;
322
- // } else {
323
- // return RetentionState.NONE;
324
- // }
325
- // }
326
302
  #generateData(fields) {
327
303
  const result = {};
328
304
  for (const [key, val] of fields.entries()) {
@@ -1736,7 +1712,7 @@ class SystemService {
1736
1712
  const propertiesQA = {};
1737
1713
  const orgTypeFields = [BaseObjectTypeField.MODIFIED_BY, BaseObjectTypeField.CREATED_BY];
1738
1714
  schemaResponse.propertyDefinition.forEach((propDef) => {
1739
- // p.classifications = p.classification;
1715
+ propDef.classifications = propDef.classification;
1740
1716
  // TODO: Remove once schema supports organization classification for base params
1741
1717
  // map certain fields to organization type (fake it until you make it ;-)
1742
1718
  if (orgTypeFields.includes(propDef.id)) {
@@ -2745,7 +2721,7 @@ class AuditService {
2745
2721
  */
2746
2722
  getAuditEntries(id, options = {}) {
2747
2723
  const auditActions = this.getAuditActions(!!options.allActions, options?.skipActions);
2748
- const q = {
2724
+ const query = {
2749
2725
  size: this.DEFAULT_RES_SIZE,
2750
2726
  types: [SystemType.AUDIT],
2751
2727
  filters: [
@@ -2767,7 +2743,7 @@ class AuditService {
2767
2743
  }
2768
2744
  ]
2769
2745
  };
2770
- return this.#fetchAudits(q);
2746
+ return this.#fetchAudits(query);
2771
2747
  }
2772
2748
  /**
2773
2749
  * Get an array of action codes that are provided by the service. Based on
@@ -2776,8 +2752,10 @@ class AuditService {
2776
2752
  * @param skipActions codes of actions that should not be fetched
2777
2753
  */
2778
2754
  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));
2755
+ const actions = allActions || this.#userService.isAdvancedUser
2756
+ ? [...this.userAuditActions, ...this.adminAuditActions]
2757
+ : this.userAuditActions;
2758
+ return actions.filter((action) => !skipActions?.includes(action));
2781
2759
  }
2782
2760
  /**
2783
2761
  * Get a certain page for a former audits query.
@@ -2785,32 +2763,37 @@ class AuditService {
2785
2763
  * @param page The page to load
2786
2764
  */
2787
2765
  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
- })),
2766
+ const query = auditsResult.query;
2767
+ query.from = (page - 1) * (query.size || this.DEFAULT_RES_SIZE);
2768
+ return this.#fetchAudits(query);
2769
+ }
2770
+ #fetchAudits(query) {
2771
+ return this.#searchService.searchRaw(query).pipe(map((res) => ({
2772
+ query,
2773
+ items: res.objects.map((object) => {
2774
+ const prop = (field) => object.properties[field];
2775
+ const action = (prop(AuditField.ACTION)?.value ?? null);
2776
+ const createdBy = prop(AuditField.CREATED_BY);
2777
+ return {
2778
+ action,
2779
+ actionGroup: this.#getActionGroup(action),
2780
+ detail: prop(AuditField.DETAIL)?.value ?? null,
2781
+ subaction: prop(AuditField.SUBACTION)?.value ?? null,
2782
+ version: prop(AuditField.VERSION)?.value ?? null,
2783
+ creationDate: prop(AuditField.CREATION_DATE)?.value ?? null,
2784
+ createdBy: {
2785
+ id: createdBy?.value ?? null,
2786
+ title: createdBy?.title ?? null
2787
+ }
2788
+ };
2789
+ }),
2807
2790
  hasMoreItems: res.hasMoreItems,
2808
- page: !q.from ? 1 : q.from / q.size + 1
2791
+ page: !query.from ? 1 : query.from / query.size + 1
2809
2792
  })));
2810
2793
  }
2811
2794
  #getActionGroup(action) {
2812
2795
  try {
2813
- return parseInt(`${action}`.substr(0, 1));
2796
+ return parseInt(`${action}`.substring(0, 1));
2814
2797
  }
2815
2798
  catch {
2816
2799
  return -1;
@@ -2834,22 +2817,6 @@ const CUSTOM_CONFIG = new InjectionToken('CUSTOM_CONFIG', {
2834
2817
  });
2835
2818
  const CORE_CONFIG = new InjectionToken('CORE_CONFIG');
2836
2819
 
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
2820
  /**
2854
2821
  * Service managing the configuarions for object types.
2855
2822
  * Configuration means that you can pick certain fields
@@ -3122,6 +3089,21 @@ const provideUser = (user) => {
3122
3089
  return { provide: YUV_USER, useValue: user };
3123
3090
  };
3124
3091
 
3092
+ /**
3093
+ * @ignore
3094
+ */
3095
+ let CoreConfig = class CoreConfig {
3096
+ constructor(__config) {
3097
+ this.main = ['assets/_yuuvis/config/main.json'];
3098
+ this.translations = ['assets/_yuuvis/i18n/'];
3099
+ this.environment = { production: true };
3100
+ Object.assign(this, __config);
3101
+ }
3102
+ };
3103
+ CoreConfig = __decorate([
3104
+ __param(0, Inject(CUSTOM_CONFIG))
3105
+ ], CoreConfig);
3106
+
3125
3107
  /**
3126
3108
  * Service handling authentication related issues.
3127
3109
  */