@yuuvis/client-core 2.1.33 → 2.2.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.
@@ -75,7 +75,8 @@ const SystemType = {
75
75
  DOCUMENT: 'system:document',
76
76
  FOLDER: 'system:folder',
77
77
  AUDIT: 'system:audit',
78
- SOT: 'system:secondray'
78
+ RELATIONSHIP: 'system:relationship',
79
+ SOT: 'system:secondary'
79
80
  };
80
81
  const SystemResult = {
81
82
  DELETE: 'system:deletionResult'
@@ -96,6 +97,10 @@ const RetentionField = {
96
97
  RETENTION_START: 'system:rmStartOfRetention',
97
98
  DESTRUCTION_DATE: 'system:rmDestructionDate'
98
99
  };
100
+ const RelationshipTypeField = {
101
+ SOURCE_ID: 'system:sourceId',
102
+ TARGET_ID: 'system:targetId'
103
+ };
99
104
  const BaseObjectTypeField = {
100
105
  OBJECT_TYPE_ID: 'system:objectTypeId',
101
106
  VERSION_NUMBER: 'system:versionNumber',
@@ -1257,6 +1262,7 @@ class SystemService {
1257
1262
  this.#logger = inject(Logger);
1258
1263
  this.#STORAGE_KEY = 'yuv.core.system.definition';
1259
1264
  this.#STORAGE_KEY_AUTH_DATA = 'yuv.core.auth.data';
1265
+ this.#STORAGE_KEY_FORMS = 'yuv.core.forms__';
1260
1266
  // cached icons to avoid backend calls (session cache)
1261
1267
  this.#iconCache = {};
1262
1268
  this.#resolvedClassificationsCache = {};
@@ -1270,6 +1276,7 @@ class SystemService {
1270
1276
  #logger;
1271
1277
  #STORAGE_KEY;
1272
1278
  #STORAGE_KEY_AUTH_DATA;
1279
+ #STORAGE_KEY_FORMS;
1273
1280
  // cached icons to avoid backend calls (session cache)
1274
1281
  #iconCache;
1275
1282
  #resolvedClassificationsCache;
@@ -1492,9 +1499,11 @@ class SystemService {
1492
1499
  }
1493
1500
  else {
1494
1501
  const iconUri = this.getObjectTypeIconUri(objectTypeId, fallback);
1495
- return this.#backend.get(iconUri, ApiBase.none, {
1502
+ return this.#backend
1503
+ .get(iconUri, ApiBase.none, {
1496
1504
  responseType: 'text'
1497
- }).pipe(tap((icon) => (this.#iconCache[objectTypeId] = { uri: iconUri, icon })));
1505
+ })
1506
+ .pipe(tap((icon) => (this.#iconCache[objectTypeId] = { uri: iconUri, icon })));
1498
1507
  }
1499
1508
  }
1500
1509
  /**
@@ -1554,6 +1563,7 @@ class SystemService {
1554
1563
  * @param user The user to load the system definition for
1555
1564
  */
1556
1565
  getSystemDefinition(authData) {
1566
+ this.#clearObjectTypeFormCache();
1557
1567
  // TODO: Supposed to return 304 if nothing changes
1558
1568
  return this.#fetchSystemDefinition(authData);
1559
1569
  // TODO: remove when 304 is there???
@@ -1661,14 +1671,14 @@ class SystemService {
1661
1671
  isFolder: false,
1662
1672
  fields: this.#resolveObjectTypeFields(std, propertiesQA, objectTypesQA)
1663
1673
  }));
1664
- const relationships = schemaResponse.typeRelationshipDefinition.map((std) => ({
1674
+ const relationships = (schemaResponse.typeRelationshipDefinition || []).map((std) => ({
1665
1675
  id: std.id,
1666
1676
  description: std.description,
1667
1677
  baseId: std.baseId,
1668
1678
  fields: this.#resolveObjectTypeFields(std, propertiesQA, objectTypesQA),
1669
1679
  // allowedSourceType
1670
- allowedSourceTypes: std.allowedSourceType.map(t => t.objectTypeReference),
1671
- allowedTargetTypes: std.allowedTargetType.map(t => t.objectTypeReference)
1680
+ allowedSourceTypes: std.allowedSourceType.map((t) => t.objectTypeReference),
1681
+ allowedTargetTypes: std.allowedTargetType.map((t) => t.objectTypeReference)
1672
1682
  }));
1673
1683
  this.system = {
1674
1684
  version: schemaResponse.version,
@@ -1755,7 +1765,23 @@ class SystemService {
1755
1765
  * @returns Form model
1756
1766
  */
1757
1767
  getObjectTypeForm(objectTypeId, situation) {
1758
- return this.#backend.get(Utils.buildUri(`/dms/forms/${objectTypeId}`, { situation }));
1768
+ return this.#appCache
1769
+ .getItem(`${this.#STORAGE_KEY_FORMS}${objectTypeId}_${situation}`)
1770
+ .pipe(switchMap((res) => (res ? of(res) : this.#fetchObjectTypeForm(objectTypeId, situation))));
1771
+ }
1772
+ #fetchObjectTypeForm(objectTypeId, situation) {
1773
+ return this.#backend.get(Utils.buildUri(`/dms/forms/${objectTypeId}`, { situation })).pipe(
1774
+ // add form to cache
1775
+ tap((res) => this.#appCache.setItem(`${this.#STORAGE_KEY_FORMS}${objectTypeId}_${situation}`, res).subscribe()));
1776
+ }
1777
+ #clearObjectTypeFormCache() {
1778
+ // reset cache of object forms
1779
+ return this.#appCache
1780
+ .getStorageKeys()
1781
+ .pipe(tap((keys) => {
1782
+ forkJoin(keys.filter((key) => key.startsWith(this.#STORAGE_KEY_FORMS)).map((key) => this.#appCache.removeItem(key).pipe(catchError(() => of(null))))).subscribe();
1783
+ }))
1784
+ .subscribe();
1759
1785
  }
1760
1786
  /**
1761
1787
  * Check whether or not the model has at least one form element. Recursive.
@@ -5219,5 +5245,5 @@ const provideYuvClientCore = (options = { translations: [] }) => {
5219
5245
  * Generated bundle index. Do not edit.
5220
5246
  */
5221
5247
 
5222
- export { AFO_STATE, AdministrationRoles, ApiBase, AppCacheService, AuditField, AuditService, AuthService, BackendService, BaseObjectTypeField, BpmService, CORE_CONFIG, CUSTOM_CONFIG, CatalogService, Classification, ClassificationPrefix, ClientDefaultsObjectTypeField, ClipboardService, ColumnConfigSkipFields, ConfigService, ConnectionService, ContentStreamAllowed, ContentStreamField, CoreConfig, DeviceScreenOrientation, DeviceService, Direction, DmsObject, DmsService, EventService, FileSizePipe, IdmService, InternalFieldType, KeysPipe, LocaleCurrencyPipe, LocaleDatePipe, LocaleDecimalPipe, LocaleNumberPipe, LocalePercentPipe, Logger, LoginStateName, NativeNotificationService, NotificationService, ObjectConfigService, ObjectFormControl, ObjectFormControlWrapper, ObjectFormGroup, ObjectTag, ObjectTypeClassification, ObjectTypePropertyClassification, Operator, OperatorLabel, ParentField, PendingChangesGuard, PendingChangesService, PredictionService, ProcessAction, RetentionField, RetentionService, SafeHtmlPipe, SafeUrlPipe, SearchService, SearchUtils, SecondaryObjectTypeClassification, SessionStorageService, Situation, Sort, SystemResult, SystemSOT, SystemService, SystemType, TENANT_HEADER, ToastService, UploadService, UserRoles, UserService, UserStorageService, Utils, YUV_USER, YuvError, YuvEventType, YuvUser, init_moduleFnc, provideUser, provideYuvClientCore };
5248
+ export { AFO_STATE, AdministrationRoles, ApiBase, AppCacheService, AuditField, AuditService, AuthService, BackendService, BaseObjectTypeField, BpmService, CORE_CONFIG, CUSTOM_CONFIG, CatalogService, Classification, ClassificationPrefix, ClientDefaultsObjectTypeField, ClipboardService, ColumnConfigSkipFields, ConfigService, ConnectionService, ContentStreamAllowed, ContentStreamField, CoreConfig, DeviceScreenOrientation, DeviceService, Direction, DmsObject, DmsService, EventService, FileSizePipe, IdmService, InternalFieldType, KeysPipe, LocaleCurrencyPipe, LocaleDatePipe, LocaleDecimalPipe, LocaleNumberPipe, LocalePercentPipe, Logger, LoginStateName, NativeNotificationService, NotificationService, ObjectConfigService, ObjectFormControl, ObjectFormControlWrapper, ObjectFormGroup, ObjectTag, ObjectTypeClassification, ObjectTypePropertyClassification, Operator, OperatorLabel, ParentField, PendingChangesGuard, PendingChangesService, PredictionService, ProcessAction, RelationshipTypeField, RetentionField, RetentionService, SafeHtmlPipe, SafeUrlPipe, SearchService, SearchUtils, SecondaryObjectTypeClassification, SessionStorageService, Situation, Sort, SystemResult, SystemSOT, SystemService, SystemType, TENANT_HEADER, ToastService, UploadService, UserRoles, UserService, UserStorageService, Utils, YUV_USER, YuvError, YuvEventType, YuvUser, init_moduleFnc, provideUser, provideYuvClientCore };
5223
5249
  //# sourceMappingURL=yuuvis-client-core.mjs.map