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.
@@ -2968,10 +2968,14 @@ var EntityType;
2968
2968
  if (!data.Name) {
2969
2969
  data.Name = data.ID;
2970
2970
  }
2971
+ // Will not append if we're not updating schema (not specified).
2971
2972
  appendInternalAttrSchema(data);
2972
2973
  const res = yield api.POST(`entitytype/${data.ID}`, data, Api.PrepReqParams(reqParams));
2973
2974
  api.Cache.RemoveByStartsWith(GetCacheKey(data.ID));
2974
2975
  api.Cache.RemoveByStartsWith(GetListCacheKey());
2976
+ // Useful to append afterwards as newly created Entity Types may have it missing.
2977
+ // This makes our UI apps not have to check for default attribute existence.
2978
+ appendInternalAttrSchema(res);
2975
2979
  return {
2976
2980
  entityType: res
2977
2981
  };
@@ -3116,6 +3120,16 @@ function appendInternalAttrSchema(type) {
3116
3120
  bruce.Structure = [];
3117
3121
  }
3118
3122
  // Append any missing internal attributes.
3123
+ if (!bruce.Structure.find(x => x.Key == "ID")) {
3124
+ bruce.Structure.push({
3125
+ Key: "ID",
3126
+ Name: "ID",
3127
+ Description: "Unique identifier for the Entity.",
3128
+ Type: EntityAttribute.EType.String,
3129
+ IsIndexed: true,
3130
+ IsImportant: true
3131
+ });
3132
+ }
3119
3133
  if (!bruce.Structure.find(x => x.Key == "Location")) {
3120
3134
  bruce.Structure.push({
3121
3135
  Key: "Location",
@@ -12808,14 +12822,14 @@ var User;
12808
12822
  */
12809
12823
  function Get(params) {
12810
12824
  return __awaiter(this, void 0, void 0, function* () {
12811
- let { api, userId: id, accountId, req: reqParams } = params;
12825
+ let { api, userId: id, accountId, req: reqParams, expand } = params;
12812
12826
  if (!id) {
12813
- throw ("ID is required.");
12827
+ id = "anonymous";
12814
12828
  }
12815
12829
  if (!api) {
12816
12830
  api = ENVIRONMENT.Api().GetGuardianApi();
12817
12831
  }
12818
- const cacheKey = GetCacheKey(api.GetSessionId(), id, accountId);
12832
+ const cacheKey = GetCacheKey(api.GetSessionId(), id, accountId, expand);
12819
12833
  const cache = api.GetCacheItem(cacheKey, reqParams);
12820
12834
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12821
12835
  return cache.data;
@@ -12826,6 +12840,9 @@ var User;
12826
12840
  if (accountId) {
12827
12841
  urlParams.append("clientAccountID", accountId);
12828
12842
  }
12843
+ if (expand) {
12844
+ urlParams.append("expand", expand);
12845
+ }
12829
12846
  let url = `user/${id}`;
12830
12847
  if (urlParams.toString().length) {
12831
12848
  url += "?" + urlParams.toString();
@@ -13008,6 +13025,11 @@ var User;
13008
13025
  if (!username) {
13009
13026
  throw ("Username is required.");
13010
13027
  }
13028
+ else if (typeof username == "string" && username.toLowerCase() === "anonymous") {
13029
+ return {
13030
+ isAvailable: false
13031
+ };
13032
+ }
13011
13033
  if (!api) {
13012
13034
  api = ENVIRONMENT.Api().GetGuardianApi();
13013
13035
  }
@@ -13424,15 +13446,22 @@ var User;
13424
13446
  * @param sessionId
13425
13447
  * @param userId
13426
13448
  * @param accountId
13449
+ * @param expand
13427
13450
  * @returns
13428
13451
  */
13429
- function GetCacheKey(sessionId, userId, accountId) {
13452
+ function GetCacheKey(sessionId, userId, accountId, expand) {
13430
13453
  if (!accountId) {
13431
13454
  accountId = "";
13432
13455
  }
13433
13456
  if (!sessionId) {
13434
13457
  sessionId = "anonymous";
13435
13458
  }
13459
+ if (!userId) {
13460
+ userId = "anonymous";
13461
+ }
13462
+ if (!expand) {
13463
+ expand = "";
13464
+ }
13436
13465
  return Api.ECacheKey.User + Api.ECacheKey.Id + userId + Api.ECacheKey.Id + accountId + Api.ECacheKey.Session + Api.ECacheKey.Id + sessionId;
13437
13466
  }
13438
13467
  User$$1.GetCacheKey = GetCacheKey;
@@ -16149,7 +16178,7 @@ var Tracking;
16149
16178
  })(Tracking || (Tracking = {}));
16150
16179
 
16151
16180
  // This is updated with the package.json version on build.
16152
- const VERSION = "6.5.1";
16181
+ const VERSION = "6.5.3";
16153
16182
 
16154
16183
  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, 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 };
16155
16184
  //# sourceMappingURL=bruce-models.es5.js.map