@yuuvis/client-core 2.3.30 → 2.4.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.
@@ -408,8 +408,6 @@ var ClassificationPrefix;
408
408
  })(ClassificationPrefix || (ClassificationPrefix = {}));
409
409
 
410
410
  class Utils {
411
- static { this.DEFAULT_RANGE_TIME_V1 = 'T00:00:00.000Z'; }
412
- static { this.DEFAULT_RANGE_TIME_V2 = 'T23:59:59.000Z'; }
413
411
  static { this.DEFAULT_TIME_OFFSET_V2 = (60000 * 60 * 24) - 1; } // T+23:59:59:999
414
412
  static optionsToURLParams(options) {
415
413
  if (options) {
@@ -1362,10 +1360,28 @@ class SystemService {
1362
1360
  getRelationship(id, withLabel) {
1363
1361
  const relationship = this.system.relationships.find((r) => r.id === id);
1364
1362
  if (relationship && withLabel) {
1365
- relationship.label = this.getLocalizedResource(`${relationship.id}_label`) || relationship.id;
1363
+ relationship.label = this.getLocalizedLabel(relationship.id) || relationship.id;
1366
1364
  }
1367
1365
  return relationship;
1368
1366
  }
1367
+ /**
1368
+ * Get supported relationships for a given dms object
1369
+ * @param dmsObject DmsObject to get supported relationships for
1370
+ */
1371
+ getSupportedRelationships(dmsObject, withLabel) {
1372
+ // supported relationships are those where the given object's type (or one of its SOTs)
1373
+ // is the allowed source type of the relationship
1374
+ return (this.system?.relationships || [])
1375
+ .filter((rel) => {
1376
+ // check if the allowed source types include the object's type
1377
+ const supportsType = rel.allowedSourceTypes.includes(dmsObject.objectTypeId);
1378
+ // check if the allowed source types include one of the objects SOTs
1379
+ const sots = dmsObject.data[BaseObjectTypeField.SECONDARY_OBJECT_TYPE_IDS] || [];
1380
+ const supportsSOT = sots.some((sotId) => rel.allowedSourceTypes.includes(sotId));
1381
+ return supportsType || supportsSOT;
1382
+ })
1383
+ .map((rel) => (withLabel ? { ...rel, label: this.getLocalizedLabel(rel.id) || rel.id } : rel));
1384
+ }
1369
1385
  /**
1370
1386
  * Get the base document type all documents belong to
1371
1387
  * @param withLabel Whether or not to also add the types label
@@ -2179,12 +2195,12 @@ class SearchService {
2179
2195
  if (!Utils.isValidDate(date))
2180
2196
  return '';
2181
2197
  const isoDateString = date.toISOString();
2182
- const isoDateStringWithOffset = new Date(date.getTime() + offset).toISOString();
2198
+ // const isoDateStringWithOffset = new Date(date.getTime() + offset).toISOString();
2183
2199
  switch (range) {
2184
2200
  case 'start':
2185
2201
  return isoDateString;
2186
2202
  case 'end':
2187
- return isoDateStringWithOffset;
2203
+ return isoDateString;
2188
2204
  default:
2189
2205
  return isoDateString;
2190
2206
  }
@@ -2299,6 +2315,8 @@ var YuvEventType;
2299
2315
  YuvEventType["DMS_OBJECT_UPDATED"] = "yuv.dms.object.updated";
2300
2316
  YuvEventType["DMS_OBJECT_CONTENT_UPDATED"] = "yuv.dms.object.content.updated";
2301
2317
  YuvEventType["DMS_OBJECTS_MOVED"] = "yuv.dms.objects.moved";
2318
+ YuvEventType["RELATIONSHIP_CREATED"] = "yuv.dms.relationship.created";
2319
+ YuvEventType["RELATIONSHIP_DELETED"] = "yuv.dms.relationship.deleted";
2302
2320
  })(YuvEventType || (YuvEventType = {}));
2303
2321
 
2304
2322
  /**
@@ -4898,7 +4916,7 @@ class SearchUtils {
4898
4916
  const yesterday = new Date();
4899
4917
  yesterday.setDate(yesterday.getDate() - 1);
4900
4918
  start = yesterday;
4901
- end = yesterday;
4919
+ end = new Date(yesterday);
4902
4920
  break;
4903
4921
  }
4904
4922
  case 'thisWeek': {
@@ -4956,10 +4974,10 @@ class SearchUtils {
4956
4974
  break;
4957
4975
  }
4958
4976
  }
4959
- const startString = start?.toISOString().split('T')[0] + Utils.DEFAULT_RANGE_TIME_V1;
4960
- start = new Date(startString);
4961
- const endString = end?.toISOString().split('T')[0] + Utils.DEFAULT_RANGE_TIME_V2;
4962
- end = new Date(endString);
4977
+ if (start)
4978
+ start.setHours(0, 0, 0, 0);
4979
+ if (end)
4980
+ end.setHours(23, 59, 59, 999);
4963
4981
  return { start, end };
4964
4982
  }
4965
4983
  /**
@@ -4970,8 +4988,7 @@ class SearchUtils {
4970
4988
  static getMatchingDateRange(rangeValue) {
4971
4989
  return SearchUtils.dateRanges.find((dateRange) => {
4972
4990
  const { start, end } = SearchUtils.dateRangeStartEnd(dateRange);
4973
- return (rangeValue.firstValue.toISOString() === start.toISOString().split('T')[0] + Utils.DEFAULT_RANGE_TIME_V1 &&
4974
- rangeValue.secondValue.toISOString() === end.toISOString().split('T')[0] + Utils.DEFAULT_RANGE_TIME_V2);
4991
+ return rangeValue.firstValue.toISOString() === start.toISOString() && rangeValue.secondValue.toISOString() === end.toISOString();
4975
4992
  });
4976
4993
  }
4977
4994
  // Files size ranges