bruce-models 6.5.1 → 6.5.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.
@@ -2927,10 +2927,14 @@
2927
2927
  if (!data.Name) {
2928
2928
  data.Name = data.ID;
2929
2929
  }
2930
+ // Will not append if we're not updating schema (not specified).
2930
2931
  appendInternalAttrSchema(data);
2931
2932
  const res = yield api.POST(`entitytype/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
2932
2933
  api.Cache.RemoveByStartsWith(GetCacheKey(data.ID));
2933
2934
  api.Cache.RemoveByStartsWith(GetListCacheKey());
2935
+ // Useful to append afterwards as newly created Entity Types may have it missing.
2936
+ // This makes our UI apps not have to check for default attribute existence.
2937
+ appendInternalAttrSchema(res);
2934
2938
  return {
2935
2939
  entityType: res
2936
2940
  };
@@ -3075,6 +3079,16 @@
3075
3079
  bruce.Structure = [];
3076
3080
  }
3077
3081
  // Append any missing internal attributes.
3082
+ if (!bruce.Structure.find(x => x.Key == "ID")) {
3083
+ bruce.Structure.push({
3084
+ Key: "ID",
3085
+ Name: "ID",
3086
+ Description: "Unique identifier for the Entity.",
3087
+ Type: exports.EntityAttribute.EType.String,
3088
+ IsIndexed: true,
3089
+ IsImportant: true
3090
+ });
3091
+ }
3078
3092
  if (!bruce.Structure.find(x => x.Key == "Location")) {
3079
3093
  bruce.Structure.push({
3080
3094
  Key: "Location",
@@ -12562,14 +12576,14 @@
12562
12576
  */
12563
12577
  function Get(params) {
12564
12578
  return __awaiter(this, void 0, void 0, function* () {
12565
- let { api, userId: id, accountId, req: reqParams } = params;
12579
+ let { api, userId: id, accountId, req: reqParams, expand } = params;
12566
12580
  if (!id) {
12567
- throw ("ID is required.");
12581
+ id = "anonymous";
12568
12582
  }
12569
12583
  if (!api) {
12570
12584
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12571
12585
  }
12572
- const cacheKey = GetCacheKey(api.GetSessionId(), id, accountId);
12586
+ const cacheKey = GetCacheKey(api.GetSessionId(), id, accountId, expand);
12573
12587
  const cache = api.GetCacheItem(cacheKey, reqParams);
12574
12588
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12575
12589
  return cache.data;
@@ -12580,6 +12594,9 @@
12580
12594
  if (accountId) {
12581
12595
  urlParams.append("clientAccountID", accountId);
12582
12596
  }
12597
+ if (expand) {
12598
+ urlParams.append("expand", expand);
12599
+ }
12583
12600
  let url = `user/${id}`;
12584
12601
  if (urlParams.toString().length) {
12585
12602
  url += "?" + urlParams.toString();
@@ -12762,6 +12779,11 @@
12762
12779
  if (!username) {
12763
12780
  throw ("Username is required.");
12764
12781
  }
12782
+ else if (typeof username == "string" && username.toLowerCase() === "anonymous") {
12783
+ return {
12784
+ isAvailable: false
12785
+ };
12786
+ }
12765
12787
  if (!api) {
12766
12788
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12767
12789
  }
@@ -13178,15 +13200,22 @@
13178
13200
  * @param sessionId
13179
13201
  * @param userId
13180
13202
  * @param accountId
13203
+ * @param expand
13181
13204
  * @returns
13182
13205
  */
13183
- function GetCacheKey(sessionId, userId, accountId) {
13206
+ function GetCacheKey(sessionId, userId, accountId, expand) {
13184
13207
  if (!accountId) {
13185
13208
  accountId = "";
13186
13209
  }
13187
13210
  if (!sessionId) {
13188
13211
  sessionId = "anonymous";
13189
13212
  }
13213
+ if (!userId) {
13214
+ userId = "anonymous";
13215
+ }
13216
+ if (!expand) {
13217
+ expand = "";
13218
+ }
13190
13219
  return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + userId + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
13191
13220
  }
13192
13221
  User.GetCacheKey = GetCacheKey;
@@ -15835,7 +15864,7 @@
15835
15864
  })(exports.Tracking || (exports.Tracking = {}));
15836
15865
 
15837
15866
  // This is updated with the package.json version on build.
15838
- const VERSION = "6.5.1";
15867
+ const VERSION = "6.5.3";
15839
15868
 
15840
15869
  exports.VERSION = VERSION;
15841
15870
  exports.AbstractApi = AbstractApi;