bruce-models 4.0.3 → 4.0.5

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.
@@ -4981,21 +4981,50 @@ var EntityAttachmentType;
4981
4981
  EType["Photo"] = "photo";
4982
4982
  EType["Document"] = "document";
4983
4983
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
4984
+ /**
4985
+ * Gets an attachment type record by ID.
4986
+ * @param params
4987
+ * @returns
4988
+ */
4989
+ function Get(params) {
4990
+ return __awaiter(this, void 0, void 0, function* () {
4991
+ let { api, attachmentTypeId, req: reqParams } = params;
4992
+ if (!api) {
4993
+ api = ENVIRONMENT.Api().GetBruceApi();
4994
+ }
4995
+ if (!attachmentTypeId) {
4996
+ throw ("Type ID is required.");
4997
+ }
4998
+ reqParams = Api.PrepReqParams(reqParams);
4999
+ const cacheData = api.GetCacheItem(GetCacheKey(attachmentTypeId), reqParams);
5000
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
5001
+ return cacheData.data;
5002
+ }
5003
+ const prom = api.GET(`entityAttachmentType/${attachmentTypeId}`, Api.PrepReqParams(reqParams));
5004
+ api.SetCacheItem({
5005
+ key: GetCacheKey(attachmentTypeId),
5006
+ value: prom,
5007
+ req: reqParams
5008
+ });
5009
+ return prom;
5010
+ });
5011
+ }
5012
+ EntityAttachmentType.Get = Get;
4984
5013
  /**
4985
5014
  * Deletes an attachment type.
4986
5015
  * @param params
4987
5016
  */
4988
5017
  function Delete(params) {
4989
5018
  return __awaiter(this, void 0, void 0, function* () {
4990
- let { api, attachmentTypeId: id, req: reqParams } = params;
5019
+ let { api, attachmentTypeId, req: reqParams } = params;
4991
5020
  if (!api) {
4992
5021
  api = ENVIRONMENT.Api().GetBruceApi();
4993
5022
  }
4994
- if (!id) {
5023
+ if (!attachmentTypeId) {
4995
5024
  throw ("Type ID is required.");
4996
5025
  }
4997
- yield api.DELETE(`entityAttachmentType/${id}`, Api.PrepReqParams(reqParams));
4998
- api.Cache.Remove(GetCacheKey(id));
5026
+ yield api.DELETE(`entityAttachmentType/${attachmentTypeId}`, Api.PrepReqParams(reqParams));
5027
+ api.Cache.Remove(GetCacheKey(attachmentTypeId));
4999
5028
  api.Cache.Remove(GetListCacheKey());
5000
5029
  });
5001
5030
  }
@@ -5030,7 +5059,7 @@ var EntityAttachmentType;
5030
5059
  */
5031
5060
  function GetList(params) {
5032
5061
  return __awaiter(this, void 0, void 0, function* () {
5033
- let { api, reqParams } = params;
5062
+ let { api, req: reqParams } = params;
5034
5063
  if (!api) {
5035
5064
  api = ENVIRONMENT.Api().GetBruceApi();
5036
5065
  }
@@ -8091,7 +8120,7 @@ var Tileset;
8091
8120
  * @returns
8092
8121
  */
8093
8122
  function GetFileUrl(params) {
8094
- let { api, tilesetId, file } = params;
8123
+ let { api, tilesetId, file, cacheToken, legacy, viaCdn } = params;
8095
8124
  if (!tilesetId) {
8096
8125
  throw ("Tileset ID is required.");
8097
8126
  }
@@ -8101,7 +8130,23 @@ var Tileset;
8101
8130
  if (!file) {
8102
8131
  file = "";
8103
8132
  }
8104
- return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/files/${file}`;
8133
+ let url = null;
8134
+ const cdnBaseUrl = viaCdn ? api.GetCdnBaseUrl() : null;
8135
+ if (cdnBaseUrl) {
8136
+ url = `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
8137
+ const urlParams = new URLSearchParams();
8138
+ if (cacheToken != null) {
8139
+ urlParams.append("cacheToken", String(cacheToken));
8140
+ }
8141
+ url = api.ConstructCdnUrl(url, urlParams);
8142
+ }
8143
+ else {
8144
+ url = api.GetBaseUrl() + `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
8145
+ if (cacheToken != null) {
8146
+ url += `?cacheToken=${cacheToken}`;
8147
+ }
8148
+ }
8149
+ return url;
8105
8150
  }
8106
8151
  Tileset.GetFileUrl = GetFileUrl;
8107
8152
  /**
@@ -8126,6 +8171,7 @@ var Tileset;
8126
8171
  /**
8127
8172
  * Returns file url for a file + tileset.
8128
8173
  * @param params
8174
+ * @deprecated Use GetFileUrl instead.
8129
8175
  * @returns
8130
8176
  */
8131
8177
  function GetPublicFileUrl(params) {
@@ -8146,9 +8192,7 @@ var Tileset;
8146
8192
  }
8147
8193
  return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
8148
8194
  }
8149
- else {
8150
- return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
8151
- }
8195
+ return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
8152
8196
  }
8153
8197
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
8154
8198
  /**
@@ -11647,7 +11691,7 @@ var DataSource;
11647
11691
  })(DataSource || (DataSource = {}));
11648
11692
 
11649
11693
  // This is updated with the package.json version on build.
11650
- const VERSION = "4.0.3";
11694
+ const VERSION = "4.0.5";
11651
11695
 
11652
11696
  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, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
11653
11697
  //# sourceMappingURL=bruce-models.es5.js.map