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.
@@ -1430,8 +1430,8 @@
1430
1430
  env: this.env
1431
1431
  });
1432
1432
  }
1433
- const { account } = yield exports.Account.Get({
1434
- accountId: this.accountId,
1433
+ const { account } = yield exports.Account.GetBySubdomain({
1434
+ subdomain: this.accountId,
1435
1435
  api: guardian
1436
1436
  });
1437
1437
  // Precalculated URLs exist.
@@ -1575,13 +1575,16 @@
1575
1575
  if (!this.cdnBaseUrl) {
1576
1576
  return null;
1577
1577
  }
1578
- let cdnUrl = this.cdnBaseUrl + url;
1579
- if (!urlParams) {
1580
- urlParams = new URLSearchParams();
1578
+ const tmp = new URL(this.cdnBaseUrl);
1579
+ if (urlParams && urlParams instanceof URLSearchParams) {
1580
+ urlParams.forEach((value, key) => {
1581
+ tmp.searchParams.append(key, value);
1582
+ });
1581
1583
  }
1582
- urlParams.set("accountId", this.accountId);
1583
- cdnUrl += "?" + urlParams.toString();
1584
- return cdnUrl;
1584
+ if (url) {
1585
+ tmp.pathname += url;
1586
+ }
1587
+ return tmp.toString();
1585
1588
  }
1586
1589
  /**
1587
1590
  * Warning: This will cancel the init process.
@@ -1912,9 +1915,7 @@
1912
1915
  this.bruce[key] = new exports.BruceApi.Api({
1913
1916
  accountId,
1914
1917
  env,
1915
- // We'll load regional config if the accountId matches the default accountId.
1916
- // We'll also load if it no default is known.
1917
- loadConfig: loadConfig != null ? loadConfig : (this.accountId == accountId || !this.accountId),
1918
+ loadConfig: loadConfig != null ? true : loadConfig,
1918
1919
  loadWebSocket: loadWebSocket,
1919
1920
  guardian: this.GetGuardianApi({
1920
1921
  env
@@ -1937,10 +1938,7 @@
1937
1938
  getApi: (accountId, env) => {
1938
1939
  return this.GetBruceApi({
1939
1940
  accountId,
1940
- env,
1941
- // We'll load regional config if the accountId matches the default accountId.
1942
- // We'll also load if it no default is known.
1943
- loadConfig: this.accountId == accountId || !this.accountId
1941
+ env
1944
1942
  });
1945
1943
  }
1946
1944
  };
@@ -3789,18 +3787,18 @@
3789
3787
  }
3790
3788
  let totalCount;
3791
3789
  let entities = [];
3792
- if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
3790
+ if (analysis || expandRelations || (viaCdn && api.GetCdnBaseUrl())) {
3793
3791
  let url;
3794
3792
  if (analysis) {
3795
3793
  url = new URL(api.GetBaseUrl() + "entities/summary");
3796
3794
  }
3797
- else if (viaCdn && api.EntityCdnUrl) {
3798
- url = new URL(api.EntityCdnUrl);
3795
+ else if (viaCdn && api.GetCdnBaseUrl()) {
3796
+ url = new URL(api.ConstructCdnUrl("entities"));
3799
3797
  }
3800
3798
  else {
3801
3799
  url = new URL(api.GetBaseUrl() + "entities");
3802
3800
  }
3803
- const urlParams = new URLSearchParams(url.search);
3801
+ const urlParams = url.searchParams;
3804
3802
  urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
3805
3803
  if (body.SortOrder) {
3806
3804
  urlParams.set("SortOrder", body.SortOrder);
@@ -3847,7 +3845,7 @@
3847
3845
  if (schemaId) {
3848
3846
  urlParams.set("schema", schemaId);
3849
3847
  }
3850
- const urlStr = url.toString() + "?" + urlParams.toString();
3848
+ const urlStr = url.toString();
3851
3849
  const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
3852
3850
  if (!analysis) {
3853
3851
  entities = data.Items;
@@ -3856,7 +3854,7 @@
3856
3854
  }
3857
3855
  else {
3858
3856
  const url = new URL(api.GetBaseUrl() + (analysis ? "entities/summary" : "entities"));
3859
- const urlParams = new URLSearchParams(url.search);
3857
+ const urlParams = url.searchParams;
3860
3858
  if (expandRelations) {
3861
3859
  urlParams.append("$expand", "relation");
3862
3860
  }
@@ -3866,7 +3864,7 @@
3866
3864
  if (schemaId) {
3867
3865
  urlParams.set("schema", schemaId);
3868
3866
  }
3869
- const urlStr = url.toString() + "?" + urlParams.toString();
3867
+ const urlStr = url.toString();
3870
3868
  const data = yield api.post(urlStr, body, exports.Api.PrepReqParams(reqParams));
3871
3869
  if (!analysis) {
3872
3870
  entities = data.Items;
@@ -9100,7 +9098,9 @@
9100
9098
  if (!viaCdnCacheToken) {
9101
9099
  viaCdnCacheToken = 0;
9102
9100
  }
9103
- return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
9101
+ const urlParams = new URLSearchParams();
9102
+ urlParams.append("cacheToken", String(viaCdnCacheToken));
9103
+ return api.ConstructCdnUrl(`tileset/file/${tilesetId}/${file}`, urlParams);
9104
9104
  }
9105
9105
  return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9106
9106
  }
@@ -9242,10 +9242,13 @@
9242
9242
  */
9243
9243
  function IsAccessAllowed(params) {
9244
9244
  return __awaiter(this, void 0, void 0, function* () {
9245
- let { tilesetId, sourceAccountId, getters, forAccountId, req } = params;
9245
+ let { tilesetId, sourceAccountId, getters, forAccountId, checkFreeOption, req } = params;
9246
9246
  if (!forAccountId) {
9247
9247
  forAccountId = exports.ENVIRONMENT.PARAMS.accountId;
9248
9248
  }
9249
+ if (checkFreeOption == null) {
9250
+ checkFreeOption = true;
9251
+ }
9249
9252
  // Null source account id means it's a tileset from within the same account.
9250
9253
  // We also don't want to bother looking for records if we're loading in our own account.
9251
9254
  if (forAccountId == sourceAccountId || !sourceAccountId) {
@@ -9277,7 +9280,7 @@
9277
9280
  }
9278
9281
  // If not allowed we'll check if this is a CC3D tileset and if it's set as the selected "free" one.
9279
9282
  // This is a placeholder feature until a marketplace system is made.
9280
- if (String(sourceAccountId).toLowerCase().trim() == "cc3d") {
9283
+ if (String(sourceAccountId).toLowerCase().trim() == "cc3d" && checkFreeOption) {
9281
9284
  const settings = (yield exports.Account.GetAppSettings({
9282
9285
  accountId: forAccountId,
9283
9286
  appId: exports.Account.EAppId.Navigator,
@@ -12976,7 +12979,7 @@
12976
12979
  })(exports.DataSource || (exports.DataSource = {}));
12977
12980
 
12978
12981
  // This is updated with the package.json version on build.
12979
- const VERSION = "4.2.4";
12982
+ const VERSION = "4.2.6";
12980
12983
 
12981
12984
  exports.VERSION = VERSION;
12982
12985
  exports.AbstractApi = AbstractApi;