bruce-models 5.9.5 → 5.9.7

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.
@@ -1756,21 +1756,26 @@ var Assembly;
1756
1756
  */
1757
1757
  function Get(params) {
1758
1758
  return __awaiter(this, void 0, void 0, function* () {
1759
- let { api, assemblyId, req: reqParams } = params;
1759
+ let { api, assemblyId, req: reqParams, expand } = params;
1760
1760
  if (!api) {
1761
1761
  api = ENVIRONMENT.Api().GetBruceApi();
1762
1762
  }
1763
+ if (expand == null) {
1764
+ expand = true;
1765
+ }
1763
1766
  if (!assemblyId) {
1764
1767
  throw ("Assembly ID is required.");
1765
1768
  }
1766
- const key = GetCacheKey(assemblyId);
1769
+ const key = GetCacheKey(assemblyId, expand);
1767
1770
  const cache = api.GetCacheItem(key, reqParams);
1768
1771
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
1769
1772
  return cache.data;
1770
1773
  }
1771
1774
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1772
1775
  try {
1773
- const data = yield api.GET(`v3/assembly/${assemblyId}`, Api.PrepReqParams(reqParams));
1776
+ let url = `v3/assembly/${assemblyId}`;
1777
+ url += "?Expand=" + (expand ? "true" : "false");
1778
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
1774
1779
  res({
1775
1780
  assembly: data
1776
1781
  });
@@ -1857,7 +1862,7 @@ var Assembly;
1857
1862
  }
1858
1863
  const url = `v3/assembly/${data.ID}`;
1859
1864
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
1860
- api.Cache.Remove(GetCacheKey(data.ID));
1865
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Assembly + Api.ECacheKey.Id + data.ID);
1861
1866
  return {
1862
1867
  assembly: res
1863
1868
  };
@@ -1878,7 +1883,7 @@ var Assembly;
1878
1883
  api = ENVIRONMENT.Api().GetBruceApi();
1879
1884
  }
1880
1885
  yield api.DELETE(`v3/assembly/${assemblyId}`, Api.PrepReqParams(reqParams));
1881
- api.Cache.Remove(GetCacheKey(assemblyId));
1886
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Assembly + Api.ECacheKey.Id + assemblyId);
1882
1887
  });
1883
1888
  }
1884
1889
  Assembly.Delete = Delete;
@@ -1934,8 +1939,8 @@ var Assembly;
1934
1939
  * @param assemblyId
1935
1940
  * @returns
1936
1941
  */
1937
- function GetCacheKey(assemblyId) {
1938
- return `${Api.ECacheKey.Assembly}${Api.ECacheKey.Id}${assemblyId}`;
1942
+ function GetCacheKey(assemblyId, expand) {
1943
+ return `${Api.ECacheKey.Assembly}${Api.ECacheKey.Id}${assemblyId}${String(Boolean(expand))}`;
1939
1944
  }
1940
1945
  Assembly.GetCacheKey = GetCacheKey;
1941
1946
  })(Assembly || (Assembly = {}));
@@ -4076,7 +4081,7 @@ var Entity;
4076
4081
  OrderBy: filter.orderBy,
4077
4082
  Filter: requestFilter,
4078
4083
  LODType: filter.lodCategoryId,
4079
- BruceEntityType: filter.entityTypeId,
4084
+ BruceEntityType: (!filter.entityTypeId ? null : filter.entityTypeId),
4080
4085
  PageIndex: filter.pageIndex,
4081
4086
  PageSize: filter.pageSize,
4082
4087
  historicKey: historicKey,
@@ -4128,7 +4133,7 @@ var Entity;
4128
4133
  urlParams.set("LODType", body.LODType);
4129
4134
  }
4130
4135
  if (body.BruceEntityType) {
4131
- urlParams.set("BruceEntityType", body.BruceEntityType);
4136
+ urlParams.set("BruceEntityType", typeof body.BruceEntityType == "string" ? body.BruceEntityType : body.BruceEntityType.join(","));
4132
4137
  }
4133
4138
  if (body.PageIndex) {
4134
4139
  urlParams.set("PageIndex", String(body.PageIndex));
@@ -4227,7 +4232,7 @@ var Entity;
4227
4232
  expandLocation,
4228
4233
  expandImports,
4229
4234
  expandSources,
4230
- entityTypeId: filter.entityTypeId,
4235
+ entityTypeId: typeof filter.entityTypeId == "string" ? filter.entityTypeId : filter.entityTypeId.join(","),
4231
4236
  historicFrom: historicFrom,
4232
4237
  historicKey: historicKey,
4233
4238
  historicTo: historicTo,
@@ -4246,12 +4251,40 @@ var Entity;
4246
4251
  nextPage = data.NextPage;
4247
4252
  nextPageUrl = data.NextPageURL;
4248
4253
  }
4254
+ // Callback to get the next page.
4255
+ let getNextPage;
4256
+ if (nextPage) {
4257
+ getNextPage = () => __awaiter(this, void 0, void 0, function* () {
4258
+ let urlStr = null;
4259
+ if (nextPageUrl.startsWith("http")) {
4260
+ urlStr = nextPageUrl;
4261
+ }
4262
+ else {
4263
+ urlStr = api.ConstructUrl({
4264
+ cdn: false,
4265
+ url: nextPageUrl
4266
+ });
4267
+ }
4268
+ const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
4269
+ // Update URL so we can re-use the same function instance.
4270
+ nextPageUrl = data.NextPageURL;
4271
+ return {
4272
+ entities: data.Items,
4273
+ totalCount: data.TotalCount,
4274
+ imports: data.Imports,
4275
+ nextPage: data.NextPage,
4276
+ nextPageUrl: data.NextPageURL,
4277
+ getNextPage: nextPageUrl ? getNextPage : null
4278
+ };
4279
+ });
4280
+ }
4249
4281
  return {
4250
4282
  entities,
4251
4283
  totalCount,
4252
4284
  imports,
4253
4285
  nextPage,
4254
- nextPageUrl
4286
+ nextPageUrl,
4287
+ getNextPage
4255
4288
  };
4256
4289
  });
4257
4290
  }
@@ -15616,7 +15649,7 @@ var Scenario;
15616
15649
  })(Scenario || (Scenario = {}));
15617
15650
 
15618
15651
  // This is updated with the package.json version on build.
15619
- const VERSION = "5.9.5";
15652
+ const VERSION = "5.9.7";
15620
15653
 
15621
15654
  export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario };
15622
15655
  //# sourceMappingURL=bruce-models.es5.js.map