bruce-models 6.7.7 → 6.7.8

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.
@@ -12056,18 +12056,29 @@ var Account;
12056
12056
  */
12057
12057
  function Get(params) {
12058
12058
  return __awaiter(this, void 0, void 0, function* () {
12059
- let { api, accountId: id, req: reqParams } = params;
12059
+ let { api, accountId: id, req: reqParams, expand, appId } = params;
12060
12060
  if (!api) {
12061
12061
  api = ENVIRONMENT.Api().GetGuardianApi();
12062
12062
  }
12063
- const cacheKey = GetCacheKey(api.GetSessionId(), id);
12063
+ const expandParam = (expand === null || expand === void 0 ? void 0 : expand.length) ? expand.join(",") : undefined;
12064
+ const cacheKey = GetCacheKey(api.GetSessionId(), id, appId, expandParam);
12064
12065
  const cache = api.GetCacheItem(cacheKey, reqParams);
12065
12066
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12066
12067
  return cache.data;
12067
12068
  }
12068
12069
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
12069
12070
  try {
12070
- const data = yield api.GET(`accountbyid/${id}`, reqParams);
12071
+ let url = `accountbyid/${id}`;
12072
+ let added = false;
12073
+ if (expandParam) {
12074
+ url += (added ? "&" : "?") + `Expand=${expandParam}`;
12075
+ added = true;
12076
+ }
12077
+ if (appId) {
12078
+ url += (added ? "&" : "?") + `App=${encodeURIComponent(appId)}`;
12079
+ added = true;
12080
+ }
12081
+ const data = yield api.GET(url, reqParams);
12071
12082
  // Update the cache by subdomain as well in case it's different to the ID.
12072
12083
  if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
12073
12084
  api.SetCacheItem({
@@ -12095,6 +12106,7 @@ var Account;
12095
12106
  Account.Get = Get;
12096
12107
  /**
12097
12108
  * Returns a client account record by subdomain or ID.
12109
+ * @deprecated use Get() as both will check against ID and subdomain.
12098
12110
  * @param params
12099
12111
  * @returns
12100
12112
  */
@@ -12304,16 +12316,22 @@ var Account;
12304
12316
  * @param sessionId
12305
12317
  * @param accountId
12306
12318
  * @param appSettingsId
12319
+ * @param expandParam Comma delimited list of expand params.
12307
12320
  * @returns
12308
12321
  */
12309
- function GetCacheKey(sessionId, accountId, appSettingsId) {
12322
+ function GetCacheKey(sessionId, accountId, appSettingsId, expandParam) {
12310
12323
  if (!sessionId) {
12311
12324
  sessionId = "anonymous";
12312
12325
  }
12326
+ let cacheKey = [Api.ECacheKey.Account + Api.ECacheKey.Id + accountId];
12327
+ if (expandParam) {
12328
+ cacheKey.push(Api.ECacheKey.Id + expandParam);
12329
+ }
12313
12330
  if (appSettingsId) {
12314
- return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId + Api.ECacheKey.Session + Api.ECacheKey.Id + sessionId;
12331
+ cacheKey.push(Api.ECacheKey + appSettingsId);
12315
12332
  }
12316
- return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey.Session + Api.ECacheKey.Id + sessionId;
12333
+ cacheKey.push(Api.ECacheKey.Session + Api.ECacheKey.Id + sessionId);
12334
+ return cacheKey.join("");
12317
12335
  }
12318
12336
  Account.GetCacheKey = GetCacheKey;
12319
12337
  /**
@@ -16459,7 +16477,7 @@ var Tracking;
16459
16477
  })(Tracking || (Tracking = {}));
16460
16478
 
16461
16479
  // This is updated with the package.json version on build.
16462
- const VERSION = "6.7.7";
16480
+ const VERSION = "6.7.8";
16463
16481
 
16464
16482
  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 };
16465
16483
  //# sourceMappingURL=bruce-models.es5.js.map