@yuuvis/client-core 2.3.8 → 2.3.10

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.
@@ -3,7 +3,7 @@ import { TranslateService, TranslateLoader, MissingTranslationHandler, Translate
3
3
  export { TranslateDirective, TranslateLoader, TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
4
4
  import { HttpErrorResponse, HttpClient, HttpHeaders, HttpRequest, HttpParams, HttpResponse, HttpEventType, provideHttpClient, withInterceptors } from '@angular/common/http';
5
5
  import * as i0 from '@angular/core';
6
- import { inject, Injectable, InjectionToken, Inject, signal, Directive, Pipe, importProvidersFrom, provideAppInitializer } from '@angular/core';
6
+ import { inject, Injectable, InjectionToken, Inject, signal, Directive, Pipe, makeEnvironmentProviders, importProvidersFrom, provideAppInitializer } from '@angular/core';
7
7
  import { tap, finalize, shareReplay, catchError, map, switchMap, first, filter, scan, delay } from 'rxjs/operators';
8
8
  import { EMPTY, of, forkJoin, Observable, ReplaySubject, Subject, fromEvent, BehaviorSubject, tap as tap$1, map as map$1, merge, filter as filter$1, debounceTime, throwError, isObservable, switchMap as switchMap$1 } from 'rxjs';
9
9
  import { StorageMap } from '@ngx-pwa/local-storage';
@@ -1779,15 +1779,13 @@ class SystemService {
1779
1779
  #fetchObjectTypeForm(objectTypeId, situation) {
1780
1780
  return this.#backend.get(Utils.buildUri(`/dms/forms/${objectTypeId}`, { situation })).pipe(
1781
1781
  // add form to cache
1782
- tap((res) => this.#appCache.setItem(`${this.#STORAGE_KEY_FORMS}${objectTypeId}_${situation}`, res).subscribe()));
1782
+ switchMap((res) => this.#appCache.setItem(`${this.#STORAGE_KEY_FORMS}${objectTypeId}_${situation}`, res).pipe(map(() => res))));
1783
1783
  }
1784
1784
  #clearObjectTypeFormCache() {
1785
1785
  // reset cache of object forms
1786
1786
  return this.#appCache
1787
1787
  .getStorageKeys()
1788
- .pipe(tap((keys) => {
1789
- forkJoin(keys.filter((key) => key.startsWith(this.#STORAGE_KEY_FORMS)).map((key) => this.#appCache.removeItem(key).pipe(catchError(() => of(null))))).subscribe();
1790
- }))
1788
+ .pipe(switchMap((keys) => forkJoin(keys.filter((key) => key.startsWith(this.#STORAGE_KEY_FORMS)).map((key) => this.#appCache.removeItem(key).pipe(catchError(() => of(null)))))))
1791
1789
  .subscribe();
1792
1790
  }
1793
1791
  /**
@@ -3768,6 +3766,18 @@ class DmsService {
3768
3766
  }))
3769
3767
  .pipe(this.triggerEvent(YuvEventType.DMS_OBJECT_LOADED, '', silent));
3770
3768
  }
3769
+ /**
3770
+ * Get tags of a dms object.
3771
+ * @param objectData Data field of the dms object
3772
+ */
3773
+ getDmsObjectTags(objectData) {
3774
+ return (objectData[BaseObjectTypeField.TAGS] || []).map((row) => ({
3775
+ name: row[0],
3776
+ state: row[1],
3777
+ creationDate: new Date(row[2]),
3778
+ traceId: row[3]
3779
+ }));
3780
+ }
3771
3781
  /**
3772
3782
  * Updates a tag on a dms object.
3773
3783
  * @param id The ID of the object
@@ -3952,6 +3962,29 @@ class DmsService {
3952
3962
  #searchResultToDmsObject(resItem) {
3953
3963
  return new DmsObject(resItem);
3954
3964
  }
3965
+ /**
3966
+ * Transforms a plain data object to a DmsObject.
3967
+ * @param data The plain data object
3968
+ * @returns DmsObject
3969
+ */
3970
+ toDmsObject(data) {
3971
+ const fields = new Map();
3972
+ Object.keys(data).forEach((key) => fields.set(key, data[key]));
3973
+ const item = {
3974
+ content: {
3975
+ contentStreamId: data[ContentStreamField.ID],
3976
+ mimeType: data[ContentStreamField.MIME_TYPE],
3977
+ fileName: data[ContentStreamField.FILENAME],
3978
+ size: data[ContentStreamField.LENGTH],
3979
+ digest: data[ContentStreamField.DIGEST],
3980
+ repositoryId: data[ContentStreamField.REPOSITORY_ID],
3981
+ range: data[ContentStreamField.RANGE]
3982
+ },
3983
+ objectTypeId: data[BaseObjectTypeField.OBJECT_TYPE_ID],
3984
+ fields
3985
+ };
3986
+ return this.#searchResultToDmsObject(item);
3987
+ }
3955
3988
  batchUpdateTag(ids, tag, value) {
3956
3989
  return this.#backend.batch(ids.map((id) => ({
3957
3990
  method: 'POST',
@@ -5458,7 +5491,7 @@ EoxTranslateJsonLoader = __decorate([
5458
5491
  ], EoxTranslateJsonLoader);
5459
5492
 
5460
5493
  const provideYuvClientCore = (options = { translations: [] }) => {
5461
- return [
5494
+ return makeEnvironmentProviders([
5462
5495
  importProvidersFrom(TranslateModule.forRoot()),
5463
5496
  provideHttpClient(withInterceptors([AuthInterceptorFnc, OfflineInterceptorFnc])),
5464
5497
  { provide: CORE_CONFIG, useClass: CoreConfig, deps: [CUSTOM_CONFIG] },
@@ -5483,7 +5516,7 @@ const provideYuvClientCore = (options = { translations: [] }) => {
5483
5516
  translations: options.translations
5484
5517
  }
5485
5518
  }
5486
- ];
5519
+ ]);
5487
5520
  };
5488
5521
 
5489
5522
  /**