bruce-models 3.0.3 → 3.0.5

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.
@@ -2273,7 +2273,7 @@
2273
2273
  function GetList(params) {
2274
2274
  var _a;
2275
2275
  return __awaiter(this, void 0, void 0, function* () {
2276
- let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
2276
+ let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis } = params;
2277
2277
  if (!api) {
2278
2278
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2279
2279
  }
@@ -2306,9 +2306,14 @@
2306
2306
  PageIndex: filter.pageIndex,
2307
2307
  PageSize: filter.pageSize
2308
2308
  };
2309
+ let totalCount;
2309
2310
  let entities = [];
2310
- if (viaCdn && api.EntityCdnUrl) {
2311
- const url = new URL(api.EntityCdnUrl);
2311
+ if (analysis || (viaCdn && api.EntityCdnUrl)) {
2312
+ const url = new URL(
2313
+ // !analysis && viaCdn... for now because we have an inflexible CDN param in the lib.
2314
+ // Api CAN support this. TODO: Have a CDN base url instead of an EntityCDN base url.
2315
+ (!analysis && viaCdn && api.EntityCdnUrl) ? api.EntityCdnUrl :
2316
+ (api.GetBaseUrl() + (analysis ? "entities/summary" : "entities")));
2312
2317
  const urlParams = new URLSearchParams(url.search);
2313
2318
  urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
2314
2319
  if (body.SortOrder) {
@@ -2334,26 +2339,33 @@
2334
2339
  }
2335
2340
  const urlStr = url.toString() + "?" + urlParams.toString();
2336
2341
  const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
2337
- entities = data.Items;
2342
+ if (!analysis) {
2343
+ entities = data.Items;
2344
+ }
2345
+ totalCount = data.TotalCount;
2338
2346
  }
2339
2347
  else {
2340
- const data = yield api.POST("entities", body, exports.Api.PrepReqParams(reqParams));
2341
- entities = data.Items;
2342
- // Only caching when non-CDN.
2343
- for (let i = 0; i < entities.length; i++) {
2344
- const entity = entities[i];
2345
- const id = entity.Bruce.ID;
2346
- yield api.SetCacheItem({
2347
- key: GetCacheKey(id),
2348
- value: {
2349
- entity: entity
2350
- },
2351
- req: reqParams
2352
- });
2348
+ const data = yield api.POST(analysis ? "entities/summary" : "entities", body, exports.Api.PrepReqParams(reqParams));
2349
+ if (!analysis) {
2350
+ entities = data.Items;
2351
+ // Only caching when non-CDN.
2352
+ for (let i = 0; i < entities.length; i++) {
2353
+ const entity = entities[i];
2354
+ const id = entity.Bruce.ID;
2355
+ yield api.SetCacheItem({
2356
+ key: GetCacheKey(id),
2357
+ value: {
2358
+ entity: entity
2359
+ },
2360
+ req: reqParams
2361
+ });
2362
+ }
2353
2363
  }
2364
+ totalCount = data.TotalCount;
2354
2365
  }
2355
2366
  return {
2356
- entities
2367
+ entities,
2368
+ totalCount
2357
2369
  };
2358
2370
  });
2359
2371
  }
@@ -8893,7 +8905,7 @@
8893
8905
  DataSource.GetList = GetList;
8894
8906
  })(exports.DataSource || (exports.DataSource = {}));
8895
8907
 
8896
- const VERSION = "3.0.3";
8908
+ const VERSION = "3.0.5";
8897
8909
 
8898
8910
  exports.VERSION = VERSION;
8899
8911
  exports.AbstractApi = AbstractApi;