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.
@@ -2320,6 +2320,10 @@ var EntityLod;
2320
2320
  return Api.ECacheKey.Lod + Api.ECacheKey.Id + url;
2321
2321
  }
2322
2322
  EntityLod.GetCacheKey = GetCacheKey;
2323
+ function GetTypeListKey(typeId, group) {
2324
+ return Api.ECacheKey.Lod + Api.ECacheKey.EntityType + typeId + Api.ECacheKey.Id + group;
2325
+ }
2326
+ EntityLod.GetTypeListKey = GetTypeListKey;
2323
2327
  function GetUrl(api, entityId, categoryId, level, strict) {
2324
2328
  if (!entityId) {
2325
2329
  throw ("Entity ID is required.");
@@ -2393,6 +2397,51 @@ var EntityLod;
2393
2397
  });
2394
2398
  }
2395
2399
  EntityLod.GetLods = GetLods;
2400
+ /**
2401
+ * Returns lods for a specified entity type.
2402
+ * @param api
2403
+ * @param typeId
2404
+ * @param group default is "DEFAULT".
2405
+ */
2406
+ function GetTypeLods(api, typeId, group) {
2407
+ return __awaiter(this, void 0, void 0, function () {
2408
+ var cacheData, url, req, prom;
2409
+ var _this = this;
2410
+ return __generator(this, function (_a) {
2411
+ if (!group) {
2412
+ group = "DEFAULT";
2413
+ }
2414
+ cacheData = api.Cache.Get(GetTypeListKey(typeId, group));
2415
+ if (cacheData) {
2416
+ return [2 /*return*/, cacheData];
2417
+ }
2418
+ url = "entityType/" + typeId + "/lods?includeClientFiles=yes" + (group ? "&group=" + group : "");
2419
+ req = api.GET(url, Api.PrepReqParams());
2420
+ prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
2421
+ var data, e_2;
2422
+ return __generator(this, function (_a) {
2423
+ switch (_a.label) {
2424
+ case 0:
2425
+ _a.trys.push([0, 2, , 3]);
2426
+ return [4 /*yield*/, req];
2427
+ case 1:
2428
+ data = _a.sent();
2429
+ res(data.Items);
2430
+ return [3 /*break*/, 3];
2431
+ case 2:
2432
+ e_2 = _a.sent();
2433
+ rej(e_2);
2434
+ return [3 /*break*/, 3];
2435
+ case 3: return [2 /*return*/];
2436
+ }
2437
+ });
2438
+ }); });
2439
+ api.Cache.Set(GetTypeListKey(typeId, group), prom, Api.DEFAULT_CACHE_DURATION);
2440
+ return [2 /*return*/, prom];
2441
+ });
2442
+ });
2443
+ }
2444
+ EntityLod.GetTypeLods = GetTypeLods;
2396
2445
  })(EntityLod || (EntityLod = {}));
2397
2446
 
2398
2447
  /**