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.
@@ -4190,6 +4190,7 @@
4190
4190
  * @returns
4191
4191
  */
4192
4192
  function CalculateName(params) {
4193
+ var _a, _b;
4193
4194
  const { entity, type, defaultToId = true } = params;
4194
4195
  const attrStr = type.DisplayNameAttributePath;
4195
4196
  if (attrStr) {
@@ -4198,7 +4199,7 @@
4198
4199
  const pathStr = attrPaths[i];
4199
4200
  const path = exports.PathUtils.Parse(pathStr);
4200
4201
  const name = Entity.GetValue({
4201
- entity: entity,
4202
+ entity: entity || {},
4202
4203
  path
4203
4204
  });
4204
4205
  if (name && typeof name != "object") {
@@ -4206,6 +4207,9 @@
4206
4207
  }
4207
4208
  }
4208
4209
  }
4210
+ 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") {
4211
+ return entity.Bruce.Name;
4212
+ }
4209
4213
  return defaultToId ? entity.Bruce.ID : null;
4210
4214
  }
4211
4215
  Entity.CalculateName = CalculateName;
@@ -12757,21 +12761,21 @@
12757
12761
  */
12758
12762
  function GetSettings(params) {
12759
12763
  return __awaiter(this, void 0, void 0, function* () {
12760
- let { api, userId, appId, req } = params;
12764
+ let { api, userId, appId, req, accountId } = params;
12761
12765
  if (!userId || !appId) {
12762
12766
  throw ("UserId and appId are required.");
12763
12767
  }
12764
12768
  if (!api) {
12765
12769
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12766
12770
  }
12767
- const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId);
12771
+ const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId);
12768
12772
  const cache = api.GetCacheItem(cacheKey, req);
12769
12773
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12770
12774
  return cache.data;
12771
12775
  }
12772
12776
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
12773
12777
  try {
12774
- const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
12778
+ const data = yield api.GET(`user/${userId}/application/${appId}/settings${accountId ? "?Account=" + accountId : ""}`);
12775
12779
  const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
12776
12780
  res({
12777
12781
  settings: settings
@@ -12808,21 +12812,24 @@
12808
12812
  */
12809
12813
  function UpdateSettings(params) {
12810
12814
  return __awaiter(this, void 0, void 0, function* () {
12811
- let { api, accId, userId, appId, settings, req, override } = params;
12815
+ let { api, accId, accountId, userId, appId, settings, req, override } = params;
12812
12816
  if (!userId || !appId) {
12813
12817
  throw ("UserId and appId are required.");
12814
12818
  }
12815
12819
  if (!api) {
12816
12820
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12817
12821
  }
12822
+ if (!accountId) {
12823
+ accountId = accId;
12824
+ }
12818
12825
  const postBody = {
12819
12826
  Settings: settings == null ? {} : settings,
12820
12827
  Application: appId,
12821
- ClientAccountID: accId,
12828
+ ClientAccountID: accountId,
12822
12829
  UserID: userId
12823
12830
  };
12824
12831
  const prom = api.POST(`user/${userId}/application/${appId}/settings?Override=${override ? "true" : "false"}`, postBody, req);
12825
- api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId));
12832
+ api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId));
12826
12833
  return prom;
12827
12834
  });
12828
12835
  }
@@ -13314,11 +13321,11 @@
13314
13321
  * @param appId
13315
13322
  * @returns
13316
13323
  */
13317
- function GetSettingsCacheKey(sessionId, userId, appId) {
13324
+ function GetSettingsCacheKey(sessionId, userId, appId, accountId) {
13318
13325
  if (!sessionId) {
13319
13326
  sessionId = "anonymous";
13320
13327
  }
13321
- return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserSettings + userId + exports.Api.ECacheKey.Id + appId;
13328
+ return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserSettings + userId + exports.Api.ECacheKey.Id + appId + (accountId ? exports.Api.ECacheKey.Id + accountId : "");
13322
13329
  }
13323
13330
  User.GetSettingsCacheKey = GetSettingsCacheKey;
13324
13331
  })(exports.User || (exports.User = {}));
@@ -16101,7 +16108,7 @@
16101
16108
  })(exports.Tracking || (exports.Tracking = {}));
16102
16109
 
16103
16110
  // This is updated with the package.json version on build.
16104
- const VERSION = "6.7.1";
16111
+ const VERSION = "6.7.3";
16105
16112
 
16106
16113
  exports.VERSION = VERSION;
16107
16114
  exports.AbstractApi = AbstractApi;