bruce-models 1.4.6 → 1.4.8

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.
@@ -3382,29 +3382,21 @@ var EntitySource;
3382
3382
  }
3383
3383
  EntitySource.GetCacheKey = GetCacheKey;
3384
3384
  function Get(params) {
3385
+ var _a;
3385
3386
  return __awaiter(this, void 0, void 0, function* () {
3386
3387
  const { api, sourceId, sourceKey, req: reqParams } = params;
3387
3388
  if (!sourceId || !sourceKey) {
3388
3389
  throw ("Source ID and Source Key are required.");
3389
3390
  }
3390
- const key = GetCacheKey(sourceId, sourceKey);
3391
- const cacheData = api.GetCacheItem(key, reqParams);
3392
- if (cacheData) {
3393
- return cacheData;
3394
- }
3395
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3396
- try {
3397
- const data = yield api.GET(`entitysource/${sourceId}/${sourceKey}`, Api.PrepReqParams(reqParams));
3398
- res({
3399
- source: data
3400
- });
3401
- }
3402
- catch (e) {
3403
- rej(e);
3404
- }
3405
- }));
3406
- api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3407
- return prom;
3391
+ const res = yield GetListByKeys({
3392
+ api: api,
3393
+ sourceId: sourceId,
3394
+ sourceKeys: [sourceKey],
3395
+ req: reqParams
3396
+ });
3397
+ return {
3398
+ source: ((_a = res.sources) === null || _a === void 0 ? void 0 : _a.length) ? res.sources[0] : null
3399
+ };
3408
3400
  });
3409
3401
  }
3410
3402
  EntitySource.Get = Get;
@@ -3485,6 +3477,21 @@ var EntitySource;
3485
3477
  });
3486
3478
  }
3487
3479
  EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
3480
+ function CreateLink(params) {
3481
+ return __awaiter(this, void 0, void 0, function* () {
3482
+ const { source } = params;
3483
+ if (!source["Entity.ID"] || !source["Source.ID"] || !source["SourceRecord.Key"]) {
3484
+ throw ("Entity ID, Source ID and Source Key are required.");
3485
+ }
3486
+ const res = yield params.api.POST("entitysource", source);
3487
+ const cacheKey = GetCacheKey(source["Source.ID"], source["SourceRecord.Key"]);
3488
+ params.api.Cache.Remove(cacheKey);
3489
+ return {
3490
+ source: res
3491
+ };
3492
+ });
3493
+ }
3494
+ EntitySource.CreateLink = CreateLink;
3488
3495
  })(EntitySource || (EntitySource = {}));
3489
3496
 
3490
3497
  /**
@@ -5112,6 +5119,7 @@ var MenuItem;
5112
5119
  EType["PointCloud"] = "PointCloudTileset";
5113
5120
  EType["EntitiesLoaded"] = "LoadedEntities";
5114
5121
  EType["EntitiesIds"] = "EntitiesIds";
5122
+ EType["Relations"] = "Relations";
5115
5123
  })(EType = MenuItem.EType || (MenuItem.EType = {}));
5116
5124
  function CreateFromEntityId(entityId, typeId, styleId) {
5117
5125
  return {