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.
@@ -3893,6 +3893,9 @@ var BruceApi;
3893
3893
  * it should be passed to any method that wants to communicate with this particular api.
3894
3894
  */
3895
3895
  class Api$$1 extends AbstractApi {
3896
+ get AccountId() {
3897
+ return this.accountId;
3898
+ }
3896
3899
  get MessageBroker() {
3897
3900
  return this.messageBroker;
3898
3901
  }
@@ -4007,6 +4010,17 @@ var BruceApi;
4007
4010
  if (this.TilesetCdnUrl) {
4008
4011
  this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
4009
4012
  }
4013
+ // TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
4014
+ // Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
4015
+ if (this.TilesetCdnUrl) {
4016
+ try {
4017
+ const url = new URL(this.TilesetCdnUrl);
4018
+ this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
4019
+ }
4020
+ catch (e) {
4021
+ console.error(e);
4022
+ }
4023
+ }
4010
4024
  }
4011
4025
  }
4012
4026
  }
@@ -4034,6 +4048,13 @@ var BruceApi;
4034
4048
  GetBaseUrl() {
4035
4049
  return this.baseUrl;
4036
4050
  }
4051
+ /**
4052
+ * Warning: Wait the "Loading" promise before using this url.
4053
+ * @returns
4054
+ */
4055
+ GetCdnBaseUrl() {
4056
+ return this.cdnBaseUrl;
4057
+ }
4037
4058
  /**
4038
4059
  * Warning: This will cancel the init process.
4039
4060
  * The init process loads a region specific endpoint.
@@ -9133,7 +9154,7 @@ var Tileset;
9133
9154
  }
9134
9155
  Tileset.GetSrcFileUrl = GetSrcFileUrl;
9135
9156
  function GetPublicFileUrl(params) {
9136
- let { api, tilesetId, file } = params;
9157
+ let { api, tilesetId, file, viaCdn, viaCdnCacheToken } = params;
9137
9158
  if (!api) {
9138
9159
  api = ENVIRONMENT.Api().GetBruceApi();
9139
9160
  }
@@ -9143,7 +9164,16 @@ var Tileset;
9143
9164
  if (!file) {
9144
9165
  file = "";
9145
9166
  }
9146
- return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9167
+ const cdnBaseUrl = viaCdn ? api.GetCdnBaseUrl() : null;
9168
+ if (cdnBaseUrl) {
9169
+ if (!viaCdnCacheToken) {
9170
+ viaCdnCacheToken = 0;
9171
+ }
9172
+ return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
9173
+ }
9174
+ else {
9175
+ return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
9176
+ }
9147
9177
  }
9148
9178
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
9149
9179
  function Generate(params) {
@@ -11750,7 +11780,7 @@ var Plugin;
11750
11780
  Plugin.GetRunFunction = GetRunFunction;
11751
11781
  })(Plugin || (Plugin = {}));
11752
11782
 
11753
- const VERSION$1 = "2.5.2";
11783
+ const VERSION$1 = "2.6.1";
11754
11784
 
11755
11785
  export { VERSION$1 as VERSION, AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, 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, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT };
11756
11786
  //# sourceMappingURL=bruce-models.es5.js.map