bruce-models 2.5.9 → 2.6.1

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.
@@ -3881,6 +3881,9 @@
3881
3881
  * it should be passed to any method that wants to communicate with this particular api.
3882
3882
  */
3883
3883
  class Api$$1 extends AbstractApi {
3884
+ get AccountId() {
3885
+ return this.accountId;
3886
+ }
3884
3887
  get MessageBroker() {
3885
3888
  return this.messageBroker;
3886
3889
  }
@@ -3995,6 +3998,17 @@
3995
3998
  if (this.TilesetCdnUrl) {
3996
3999
  this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
3997
4000
  }
4001
+ // TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
4002
+ // Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
4003
+ if (this.TilesetCdnUrl) {
4004
+ try {
4005
+ const url = new URL(this.TilesetCdnUrl);
4006
+ this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
4007
+ }
4008
+ catch (e) {
4009
+ console.error(e);
4010
+ }
4011
+ }
3998
4012
  }
3999
4013
  }
4000
4014
  }
@@ -4022,6 +4036,13 @@
4022
4036
  GetBaseUrl() {
4023
4037
  return this.baseUrl;
4024
4038
  }
4039
+ /**
4040
+ * Warning: Wait the "Loading" promise before using this url.
4041
+ * @returns
4042
+ */
4043
+ GetCdnBaseUrl() {
4044
+ return this.cdnBaseUrl;
4045
+ }
4025
4046
  /**
4026
4047
  * Warning: This will cancel the init process.
4027
4048
  * The init process loads a region specific endpoint.
@@ -8974,7 +8995,7 @@
8974
8995
  }
8975
8996
  Tileset.GetSrcFileUrl = GetSrcFileUrl;
8976
8997
  function GetPublicFileUrl(params) {
8977
- let { api, tilesetId, file } = params;
8998
+ let { api, tilesetId, file, viaCdn, viaCdnCacheToken } = params;
8978
8999
  if (!api) {
8979
9000
  api = exports.ENVIRONMENT.Api().GetBruceApi();
8980
9001
  }
@@ -8984,7 +9005,16 @@
8984
9005
  if (!file) {
8985
9006
  file = "";
8986
9007
  }
8987
- return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9008
+ const cdnBaseUrl = viaCdn ? api.GetCdnBaseUrl() : null;
9009
+ if (cdnBaseUrl) {
9010
+ if (!viaCdnCacheToken) {
9011
+ viaCdnCacheToken = 0;
9012
+ }
9013
+ return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
9014
+ }
9015
+ else {
9016
+ return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9017
+ }
8988
9018
  }
8989
9019
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
8990
9020
  function Generate(params) {
@@ -11516,7 +11546,7 @@
11516
11546
  Plugin.GetRunFunction = GetRunFunction;
11517
11547
  })(exports.Plugin || (exports.Plugin = {}));
11518
11548
 
11519
- const VERSION$1 = "2.5.2";
11549
+ const VERSION$1 = "2.6.1";
11520
11550
 
11521
11551
  exports.VERSION = VERSION$1;
11522
11552
  exports.AbstractApi = AbstractApi;