bruce-models 4.2.4 → 4.2.6

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;
@@ -9277,7 +9275,9 @@ var Tileset;
9277
9275
  if (!viaCdnCacheToken) {
9278
9276
  viaCdnCacheToken = 0;
9279
9277
  }
9280
- 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);
9281
9281
  }
9282
9282
  return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9283
9283
  }
@@ -9419,10 +9419,13 @@ var Tileset;
9419
9419
  */
9420
9420
  function IsAccessAllowed(params) {
9421
9421
  return __awaiter(this, void 0, void 0, function* () {
9422
- let { tilesetId, sourceAccountId, getters, forAccountId, req } = params;
9422
+ let { tilesetId, sourceAccountId, getters, forAccountId, checkFreeOption, req } = params;
9423
9423
  if (!forAccountId) {
9424
9424
  forAccountId = ENVIRONMENT.PARAMS.accountId;
9425
9425
  }
9426
+ if (checkFreeOption == null) {
9427
+ checkFreeOption = true;
9428
+ }
9426
9429
  // Null source account id means it's a tileset from within the same account.
9427
9430
  // We also don't want to bother looking for records if we're loading in our own account.
9428
9431
  if (forAccountId == sourceAccountId || !sourceAccountId) {
@@ -9454,7 +9457,7 @@ var Tileset;
9454
9457
  }
9455
9458
  // If not allowed we'll check if this is a CC3D tileset and if it's set as the selected "free" one.
9456
9459
  // This is a placeholder feature until a marketplace system is made.
9457
- if (String(sourceAccountId).toLowerCase().trim() == "cc3d") {
9460
+ if (String(sourceAccountId).toLowerCase().trim() == "cc3d" && checkFreeOption) {
9458
9461
  const settings = (yield Account.GetAppSettings({
9459
9462
  accountId: forAccountId,
9460
9463
  appId: Account.EAppId.Navigator,
@@ -13242,7 +13245,7 @@ var DataSource;
13242
13245
  })(DataSource || (DataSource = {}));
13243
13246
 
13244
13247
  // This is updated with the package.json version on build.
13245
- const VERSION = "4.2.4";
13248
+ const VERSION = "4.2.6";
13246
13249
 
13247
13250
  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 };
13248
13251
  //# sourceMappingURL=bruce-models.es5.js.map