bruce-models 6.7.1 → 6.7.3

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.
@@ -4239,6 +4239,7 @@ var Entity;
4239
4239
  * @returns
4240
4240
  */
4241
4241
  function CalculateName(params) {
4242
+ var _a, _b;
4242
4243
  const { entity, type, defaultToId = true } = params;
4243
4244
  const attrStr = type.DisplayNameAttributePath;
4244
4245
  if (attrStr) {
@@ -4247,7 +4248,7 @@ var Entity;
4247
4248
  const pathStr = attrPaths[i];
4248
4249
  const path = PathUtils.Parse(pathStr);
4249
4250
  const name = Entity.GetValue({
4250
- entity: entity,
4251
+ entity: entity || {},
4251
4252
  path
4252
4253
  });
4253
4254
  if (name && typeof name != "object") {
@@ -4255,6 +4256,9 @@ var Entity;
4255
4256
  }
4256
4257
  }
4257
4258
  }
4259
+ if (((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) && ((_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.Name) !== "Unnamed Entity") {
4260
+ return entity.Bruce.Name;
4261
+ }
4258
4262
  return defaultToId ? entity.Bruce.ID : null;
4259
4263
  }
4260
4264
  Entity.CalculateName = CalculateName;
@@ -13003,21 +13007,21 @@ var User;
13003
13007
  */
13004
13008
  function GetSettings(params) {
13005
13009
  return __awaiter(this, void 0, void 0, function* () {
13006
- let { api, userId, appId, req } = params;
13010
+ let { api, userId, appId, req, accountId } = params;
13007
13011
  if (!userId || !appId) {
13008
13012
  throw ("UserId and appId are required.");
13009
13013
  }
13010
13014
  if (!api) {
13011
13015
  api = ENVIRONMENT.Api().GetGuardianApi();
13012
13016
  }
13013
- const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId);
13017
+ const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId);
13014
13018
  const cache = api.GetCacheItem(cacheKey, req);
13015
13019
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13016
13020
  return cache.data;
13017
13021
  }
13018
13022
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13019
13023
  try {
13020
- const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
13024
+ const data = yield api.GET(`user/${userId}/application/${appId}/settings${accountId ? "?Account=" + accountId : ""}`);
13021
13025
  const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
13022
13026
  res({
13023
13027
  settings: settings
@@ -13054,21 +13058,24 @@ var User;
13054
13058
  */
13055
13059
  function UpdateSettings(params) {
13056
13060
  return __awaiter(this, void 0, void 0, function* () {
13057
- let { api, accId, userId, appId, settings, req, override } = params;
13061
+ let { api, accId, accountId, userId, appId, settings, req, override } = params;
13058
13062
  if (!userId || !appId) {
13059
13063
  throw ("UserId and appId are required.");
13060
13064
  }
13061
13065
  if (!api) {
13062
13066
  api = ENVIRONMENT.Api().GetGuardianApi();
13063
13067
  }
13068
+ if (!accountId) {
13069
+ accountId = accId;
13070
+ }
13064
13071
  const postBody = {
13065
13072
  Settings: settings == null ? {} : settings,
13066
13073
  Application: appId,
13067
- ClientAccountID: accId,
13074
+ ClientAccountID: accountId,
13068
13075
  UserID: userId
13069
13076
  };
13070
13077
  const prom = api.POST(`user/${userId}/application/${appId}/settings?Override=${override ? "true" : "false"}`, postBody, req);
13071
- api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId));
13078
+ api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId));
13072
13079
  return prom;
13073
13080
  });
13074
13081
  }
@@ -13560,11 +13567,11 @@ var User;
13560
13567
  * @param appId
13561
13568
  * @returns
13562
13569
  */
13563
- function GetSettingsCacheKey(sessionId, userId, appId) {
13570
+ function GetSettingsCacheKey(sessionId, userId, appId, accountId) {
13564
13571
  if (!sessionId) {
13565
13572
  sessionId = "anonymous";
13566
13573
  }
13567
- return Api.ECacheKey.User + Api.ECacheKey.UserSettings + userId + Api.ECacheKey.Id + appId;
13574
+ return Api.ECacheKey.User + Api.ECacheKey.UserSettings + userId + Api.ECacheKey.Id + appId + (accountId ? Api.ECacheKey.Id + accountId : "");
13568
13575
  }
13569
13576
  User$$1.GetSettingsCacheKey = GetSettingsCacheKey;
13570
13577
  })(User || (User = {}));
@@ -16416,7 +16423,7 @@ var Tracking;
16416
16423
  })(Tracking || (Tracking = {}));
16417
16424
 
16418
16425
  // This is updated with the package.json version on build.
16419
- const VERSION = "6.7.1";
16426
+ const VERSION = "6.7.3";
16420
16427
 
16421
16428
  export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking };
16422
16429
  //# sourceMappingURL=bruce-models.es5.js.map