bruce-models 0.3.1 → 0.3.2

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.
@@ -2268,6 +2268,10 @@
2268
2268
  return exports.Api.ECacheKey.Lod + exports.Api.ECacheKey.Id + url;
2269
2269
  }
2270
2270
  EntityLod.GetCacheKey = GetCacheKey;
2271
+ function GetTypeListKey(typeId, group) {
2272
+ return exports.Api.ECacheKey.Lod + exports.Api.ECacheKey.EntityType + typeId + exports.Api.ECacheKey.Id + group;
2273
+ }
2274
+ EntityLod.GetTypeListKey = GetTypeListKey;
2271
2275
  function GetUrl(api, entityId, categoryId, level, strict) {
2272
2276
  if (!entityId) {
2273
2277
  throw ("Entity ID is required.");
@@ -2341,6 +2345,51 @@
2341
2345
  });
2342
2346
  }
2343
2347
  EntityLod.GetLods = GetLods;
2348
+ /**
2349
+ * Returns lods for a specified entity type.
2350
+ * @param api
2351
+ * @param typeId
2352
+ * @param group default is "DEFAULT".
2353
+ */
2354
+ function GetTypeLods(api, typeId, group) {
2355
+ return __awaiter(this, void 0, void 0, function () {
2356
+ var cacheData, url, req, prom;
2357
+ var _this = this;
2358
+ return __generator(this, function (_a) {
2359
+ if (!group) {
2360
+ group = "DEFAULT";
2361
+ }
2362
+ cacheData = api.Cache.Get(GetTypeListKey(typeId, group));
2363
+ if (cacheData) {
2364
+ return [2 /*return*/, cacheData];
2365
+ }
2366
+ url = "entityType/" + typeId + "/lods?includeClientFiles=yes" + (group ? "&group=" + group : "");
2367
+ req = api.GET(url, exports.Api.PrepReqParams());
2368
+ prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
2369
+ var data, e_2;
2370
+ return __generator(this, function (_a) {
2371
+ switch (_a.label) {
2372
+ case 0:
2373
+ _a.trys.push([0, 2, , 3]);
2374
+ return [4 /*yield*/, req];
2375
+ case 1:
2376
+ data = _a.sent();
2377
+ res(data.Items);
2378
+ return [3 /*break*/, 3];
2379
+ case 2:
2380
+ e_2 = _a.sent();
2381
+ rej(e_2);
2382
+ return [3 /*break*/, 3];
2383
+ case 3: return [2 /*return*/];
2384
+ }
2385
+ });
2386
+ }); });
2387
+ api.Cache.Set(GetTypeListKey(typeId, group), prom, exports.Api.DEFAULT_CACHE_DURATION);
2388
+ return [2 /*return*/, prom];
2389
+ });
2390
+ });
2391
+ }
2392
+ EntityLod.GetTypeLods = GetTypeLods;
2344
2393
  })(exports.EntityLod || (exports.EntityLod = {}));
2345
2394
 
2346
2395
  (function (EntityRelationType) {