bruce-models 3.0.4 → 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.
@@ -2316,7 +2316,7 @@ var Entity;
2316
2316
  function GetList(params) {
2317
2317
  var _a;
2318
2318
  return __awaiter(this, void 0, void 0, function* () {
2319
- let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
2319
+ let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis } = params;
2320
2320
  if (!api) {
2321
2321
  api = ENVIRONMENT.Api().GetBruceApi();
2322
2322
  }
@@ -2349,9 +2349,14 @@ var Entity;
2349
2349
  PageIndex: filter.pageIndex,
2350
2350
  PageSize: filter.pageSize
2351
2351
  };
2352
+ let totalCount;
2352
2353
  let entities = [];
2353
- if (viaCdn && api.EntityCdnUrl) {
2354
- const url = new URL(api.EntityCdnUrl);
2354
+ if (analysis || (viaCdn && api.EntityCdnUrl)) {
2355
+ const url = new URL(
2356
+ // !analysis && viaCdn... for now because we have an inflexible CDN param in the lib.
2357
+ // Api CAN support this. TODO: Have a CDN base url instead of an EntityCDN base url.
2358
+ (!analysis && viaCdn && api.EntityCdnUrl) ? api.EntityCdnUrl :
2359
+ (api.GetBaseUrl() + (analysis ? "entities/summary" : "entities")));
2355
2360
  const urlParams = new URLSearchParams(url.search);
2356
2361
  urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
2357
2362
  if (body.SortOrder) {
@@ -2377,26 +2382,33 @@ var Entity;
2377
2382
  }
2378
2383
  const urlStr = url.toString() + "?" + urlParams.toString();
2379
2384
  const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
2380
- entities = data.Items;
2385
+ if (!analysis) {
2386
+ entities = data.Items;
2387
+ }
2388
+ totalCount = data.TotalCount;
2381
2389
  }
2382
2390
  else {
2383
- const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
2384
- entities = data.Items;
2385
- // Only caching when non-CDN.
2386
- for (let i = 0; i < entities.length; i++) {
2387
- const entity = entities[i];
2388
- const id = entity.Bruce.ID;
2389
- yield api.SetCacheItem({
2390
- key: GetCacheKey(id),
2391
- value: {
2392
- entity: entity
2393
- },
2394
- req: reqParams
2395
- });
2391
+ const data = yield api.POST(analysis ? "entities/summary" : "entities", body, Api.PrepReqParams(reqParams));
2392
+ if (!analysis) {
2393
+ entities = data.Items;
2394
+ // Only caching when non-CDN.
2395
+ for (let i = 0; i < entities.length; i++) {
2396
+ const entity = entities[i];
2397
+ const id = entity.Bruce.ID;
2398
+ yield api.SetCacheItem({
2399
+ key: GetCacheKey(id),
2400
+ value: {
2401
+ entity: entity
2402
+ },
2403
+ req: reqParams
2404
+ });
2405
+ }
2396
2406
  }
2407
+ totalCount = data.TotalCount;
2397
2408
  }
2398
2409
  return {
2399
- entities
2410
+ entities,
2411
+ totalCount
2400
2412
  };
2401
2413
  });
2402
2414
  }
@@ -9127,7 +9139,7 @@ var DataSource;
9127
9139
  DataSource.GetList = GetList;
9128
9140
  })(DataSource || (DataSource = {}));
9129
9141
 
9130
- const VERSION = "3.0.4";
9142
+ const VERSION = "3.0.5";
9131
9143
 
9132
9144
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
9133
9145
  //# sourceMappingURL=bruce-models.es5.js.map