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.
@@ -3289,29 +3289,21 @@
3289
3289
  }
3290
3290
  EntitySource.GetCacheKey = GetCacheKey;
3291
3291
  function Get(params) {
3292
+ var _a;
3292
3293
  return __awaiter(this, void 0, void 0, function* () {
3293
3294
  const { api, sourceId, sourceKey, req: reqParams } = params;
3294
3295
  if (!sourceId || !sourceKey) {
3295
3296
  throw ("Source ID and Source Key are required.");
3296
3297
  }
3297
- const key = GetCacheKey(sourceId, sourceKey);
3298
- const cacheData = api.GetCacheItem(key, reqParams);
3299
- if (cacheData) {
3300
- return cacheData;
3301
- }
3302
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3303
- try {
3304
- const data = yield api.GET(`entitysource/${sourceId}/${sourceKey}`, exports.Api.PrepReqParams(reqParams));
3305
- res({
3306
- source: data
3307
- });
3308
- }
3309
- catch (e) {
3310
- rej(e);
3311
- }
3312
- }));
3313
- api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
3314
- return prom;
3298
+ const res = yield GetListByKeys({
3299
+ api: api,
3300
+ sourceId: sourceId,
3301
+ sourceKeys: [sourceKey],
3302
+ req: reqParams
3303
+ });
3304
+ return {
3305
+ source: ((_a = res.sources) === null || _a === void 0 ? void 0 : _a.length) ? res.sources[0] : null
3306
+ };
3315
3307
  });
3316
3308
  }
3317
3309
  EntitySource.Get = Get;
@@ -3392,6 +3384,21 @@
3392
3384
  });
3393
3385
  }
3394
3386
  EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
3387
+ function CreateLink(params) {
3388
+ return __awaiter(this, void 0, void 0, function* () {
3389
+ const { source } = params;
3390
+ if (!source["Entity.ID"] || !source["Source.ID"] || !source["SourceRecord.Key"]) {
3391
+ throw ("Entity ID, Source ID and Source Key are required.");
3392
+ }
3393
+ const res = yield params.api.POST("entitysource", source);
3394
+ const cacheKey = GetCacheKey(source["Source.ID"], source["SourceRecord.Key"]);
3395
+ params.api.Cache.Remove(cacheKey);
3396
+ return {
3397
+ source: res
3398
+ };
3399
+ });
3400
+ }
3401
+ EntitySource.CreateLink = CreateLink;
3395
3402
  })(exports.EntitySource || (exports.EntitySource = {}));
3396
3403
 
3397
3404
  (function (EntityTag) {
@@ -4963,6 +4970,7 @@
4963
4970
  EType["PointCloud"] = "PointCloudTileset";
4964
4971
  EType["EntitiesLoaded"] = "LoadedEntities";
4965
4972
  EType["EntitiesIds"] = "EntitiesIds";
4973
+ EType["Relations"] = "Relations";
4966
4974
  })(EType = MenuItem.EType || (MenuItem.EType = {}));
4967
4975
  function CreateFromEntityId(entityId, typeId, styleId) {
4968
4976
  return {