bruce-models 4.2.3 → 4.2.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.
@@ -1449,8 +1449,8 @@ var BruceApi;
1449
1449
  env: this.env
1450
1450
  });
1451
1451
  }
1452
- const { account } = yield Account.Get({
1453
- accountId: this.accountId,
1452
+ const { account } = yield Account.GetBySubdomain({
1453
+ subdomain: this.accountId,
1454
1454
  api: guardian
1455
1455
  });
1456
1456
  // Precalculated URLs exist.
@@ -1594,13 +1594,16 @@ var BruceApi;
1594
1594
  if (!this.cdnBaseUrl) {
1595
1595
  return null;
1596
1596
  }
1597
- let cdnUrl = this.cdnBaseUrl + url;
1598
- if (!urlParams) {
1599
- urlParams = new URLSearchParams();
1597
+ const tmp = new URL(this.cdnBaseUrl);
1598
+ if (urlParams && urlParams instanceof URLSearchParams) {
1599
+ urlParams.forEach((value, key) => {
1600
+ tmp.searchParams.append(key, value);
1601
+ });
1600
1602
  }
1601
- urlParams.set("accountId", this.accountId);
1602
- cdnUrl += "?" + urlParams.toString();
1603
- return cdnUrl;
1603
+ if (url) {
1604
+ tmp.pathname += url;
1605
+ }
1606
+ return tmp.toString();
1604
1607
  }
1605
1608
  /**
1606
1609
  * Warning: This will cancel the init process.
@@ -1937,9 +1940,7 @@ class ApiGetters {
1937
1940
  this.bruce[key] = new BruceApi.Api({
1938
1941
  accountId,
1939
1942
  env,
1940
- // We'll load regional config if the accountId matches the default accountId.
1941
- // We'll also load if it no default is known.
1942
- loadConfig: loadConfig != null ? loadConfig : (this.accountId == accountId || !this.accountId),
1943
+ loadConfig: loadConfig != null ? true : loadConfig,
1943
1944
  loadWebSocket: loadWebSocket,
1944
1945
  guardian: this.GetGuardianApi({
1945
1946
  env
@@ -1962,10 +1963,7 @@ class ApiGetters {
1962
1963
  getApi: (accountId, env) => {
1963
1964
  return this.GetBruceApi({
1964
1965
  accountId,
1965
- env,
1966
- // We'll load regional config if the accountId matches the default accountId.
1967
- // We'll also load if it no default is known.
1968
- loadConfig: this.accountId == accountId || !this.accountId
1966
+ env
1969
1967
  });
1970
1968
  }
1971
1969
  };
@@ -3843,18 +3841,18 @@ var Entity;
3843
3841
  }
3844
3842
  let totalCount;
3845
3843
  let entities = [];
3846
- if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
3844
+ if (analysis || expandRelations || (viaCdn && api.GetCdnBaseUrl())) {
3847
3845
  let url;
3848
3846
  if (analysis) {
3849
3847
  url = new URL(api.GetBaseUrl() + "entities/summary");
3850
3848
  }
3851
- else if (viaCdn && api.EntityCdnUrl) {
3852
- url = new URL(api.EntityCdnUrl);
3849
+ else if (viaCdn && api.GetCdnBaseUrl()) {
3850
+ url = new URL(api.ConstructCdnUrl("entities"));
3853
3851
  }
3854
3852
  else {
3855
3853
  url = new URL(api.GetBaseUrl() + "entities");
3856
3854
  }
3857
- const urlParams = new URLSearchParams(url.search);
3855
+ const urlParams = url.searchParams;
3858
3856
  urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
3859
3857
  if (body.SortOrder) {
3860
3858
  urlParams.set("SortOrder", body.SortOrder);
@@ -3901,7 +3899,7 @@ var Entity;
3901
3899
  if (schemaId) {
3902
3900
  urlParams.set("schema", schemaId);
3903
3901
  }
3904
- const urlStr = url.toString() + "?" + urlParams.toString();
3902
+ const urlStr = url.toString();
3905
3903
  const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
3906
3904
  if (!analysis) {
3907
3905
  entities = data.Items;
@@ -3910,7 +3908,7 @@ var Entity;
3910
3908
  }
3911
3909
  else {
3912
3910
  const url = new URL(api.GetBaseUrl() + (analysis ? "entities/summary" : "entities"));
3913
- const urlParams = new URLSearchParams(url.search);
3911
+ const urlParams = url.searchParams;
3914
3912
  if (expandRelations) {
3915
3913
  urlParams.append("$expand", "relation");
3916
3914
  }
@@ -3920,7 +3918,7 @@ var Entity;
3920
3918
  if (schemaId) {
3921
3919
  urlParams.set("schema", schemaId);
3922
3920
  }
3923
- const urlStr = url.toString() + "?" + urlParams.toString();
3921
+ const urlStr = url.toString();
3924
3922
  const data = yield api.post(urlStr, body, Api.PrepReqParams(reqParams));
3925
3923
  if (!analysis) {
3926
3924
  entities = data.Items;
@@ -4667,22 +4665,39 @@ var Bounds;
4667
4665
  minLongitude: null
4668
4666
  };
4669
4667
  const points = [];
4670
- if (entity.location) {
4671
- points.push(entity.location);
4668
+ const location = Entity.GetValue({
4669
+ entity: entity,
4670
+ path: ["location"]
4671
+ });
4672
+ if (location) {
4673
+ points.push(location);
4672
4674
  }
4673
- if (entity.geometry) {
4674
- if (entity.geometry.Point) {
4675
- points.push(...Geometry.ParsePoints(entity.geometry.Point));
4675
+ const geometry = Entity.GetValue({
4676
+ entity: entity,
4677
+ path: ["geometry"]
4678
+ });
4679
+ const processGeometry = (geometry, depth = 0) => {
4680
+ if (!geometry || depth > 5) {
4681
+ return;
4676
4682
  }
4677
- if (entity.geometry.LineString) {
4678
- points.push(...Geometry.ParsePoints(entity.geometry.LineString));
4683
+ if (geometry.Point) {
4684
+ points.push(...Geometry.ParsePoints(geometry.Point));
4679
4685
  }
4680
- if (entity.geometry.Polygon) {
4681
- for (const ring of entity.geometry.Polygon) {
4686
+ if (geometry.LineString) {
4687
+ points.push(...Geometry.ParsePoints(geometry.LineString));
4688
+ }
4689
+ if (geometry.Polygon) {
4690
+ for (const ring of geometry.Polygon) {
4682
4691
  points.push(...Geometry.ParsePoints(ring.LinearRing));
4683
4692
  }
4684
4693
  }
4685
- }
4694
+ if (geometry.MultiGeometry) {
4695
+ for (const multiGeometry of geometry.MultiGeometry) {
4696
+ processGeometry(multiGeometry, depth + 1);
4697
+ }
4698
+ }
4699
+ };
4700
+ processGeometry(geometry);
4686
4701
  for (const point of points) {
4687
4702
  if (bounds.maxLatitude == null || point.latitude > bounds.maxLatitude) {
4688
4703
  bounds.maxLatitude = point.latitude;
@@ -9260,7 +9275,9 @@ var Tileset;
9260
9275
  if (!viaCdnCacheToken) {
9261
9276
  viaCdnCacheToken = 0;
9262
9277
  }
9263
- return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
9278
+ const urlParams = new URLSearchParams();
9279
+ urlParams.append("cacheToken", String(viaCdnCacheToken));
9280
+ return api.ConstructCdnUrl(`tileset/file/${tilesetId}/${file}`, urlParams);
9264
9281
  }
9265
9282
  return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9266
9283
  }
@@ -13225,7 +13242,7 @@ var DataSource;
13225
13242
  })(DataSource || (DataSource = {}));
13226
13243
 
13227
13244
  // This is updated with the package.json version on build.
13228
- const VERSION = "4.2.3";
13245
+ const VERSION = "4.2.5";
13229
13246
 
13230
13247
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, 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, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
13231
13248
  //# sourceMappingURL=bruce-models.es5.js.map