bruce-models 4.0.3 → 4.0.4

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.
@@ -7928,7 +7928,7 @@
7928
7928
  * @returns
7929
7929
  */
7930
7930
  function GetFileUrl(params) {
7931
- let { api, tilesetId, file } = params;
7931
+ let { api, tilesetId, file, cacheToken, legacy, viaCdn } = params;
7932
7932
  if (!tilesetId) {
7933
7933
  throw ("Tileset ID is required.");
7934
7934
  }
@@ -7938,7 +7938,23 @@
7938
7938
  if (!file) {
7939
7939
  file = "";
7940
7940
  }
7941
- return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/files/${file}`;
7941
+ let url = null;
7942
+ const cdnBaseUrl = viaCdn ? api.GetCdnBaseUrl() : null;
7943
+ if (cdnBaseUrl) {
7944
+ url = `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
7945
+ const urlParams = new URLSearchParams();
7946
+ if (cacheToken != null) {
7947
+ urlParams.append("cacheToken", String(cacheToken));
7948
+ }
7949
+ url = api.ConstructCdnUrl(url, urlParams);
7950
+ }
7951
+ else {
7952
+ url = api.GetBaseUrl() + `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
7953
+ if (cacheToken != null) {
7954
+ url += `?cacheToken=${cacheToken}`;
7955
+ }
7956
+ }
7957
+ return url;
7942
7958
  }
7943
7959
  Tileset.GetFileUrl = GetFileUrl;
7944
7960
  /**
@@ -7963,6 +7979,7 @@
7963
7979
  /**
7964
7980
  * Returns file url for a file + tileset.
7965
7981
  * @param params
7982
+ * @deprecated Use GetFileUrl instead.
7966
7983
  * @returns
7967
7984
  */
7968
7985
  function GetPublicFileUrl(params) {
@@ -7983,9 +8000,7 @@
7983
8000
  }
7984
8001
  return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
7985
8002
  }
7986
- else {
7987
- return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
7988
- }
8003
+ return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
7989
8004
  }
7990
8005
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
7991
8006
  /**
@@ -11388,7 +11403,7 @@
11388
11403
  })(exports.DataSource || (exports.DataSource = {}));
11389
11404
 
11390
11405
  // This is updated with the package.json version on build.
11391
- const VERSION = "4.0.3";
11406
+ const VERSION = "4.0.4";
11392
11407
 
11393
11408
  exports.VERSION = VERSION;
11394
11409
  exports.AbstractApi = AbstractApi;