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.
@@ -11830,18 +11830,29 @@
11830
11830
  */
11831
11831
  function Get(params) {
11832
11832
  return __awaiter(this, void 0, void 0, function* () {
11833
- let { api, accountId: id, req: reqParams } = params;
11833
+ let { api, accountId: id, req: reqParams, expand, appId } = params;
11834
11834
  if (!api) {
11835
11835
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
11836
11836
  }
11837
- const cacheKey = GetCacheKey(api.GetSessionId(), id);
11837
+ const expandParam = (expand === null || expand === void 0 ? void 0 : expand.length) ? expand.join(",") : undefined;
11838
+ const cacheKey = GetCacheKey(api.GetSessionId(), id, appId, expandParam);
11838
11839
  const cache = api.GetCacheItem(cacheKey, reqParams);
11839
11840
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11840
11841
  return cache.data;
11841
11842
  }
11842
11843
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
11843
11844
  try {
11844
- const data = yield api.GET(`accountbyid/${id}`, reqParams);
11845
+ let url = `accountbyid/${id}`;
11846
+ let added = false;
11847
+ if (expandParam) {
11848
+ url += (added ? "&" : "?") + `Expand=${expandParam}`;
11849
+ added = true;
11850
+ }
11851
+ if (appId) {
11852
+ url += (added ? "&" : "?") + `App=${encodeURIComponent(appId)}`;
11853
+ added = true;
11854
+ }
11855
+ const data = yield api.GET(url, reqParams);
11845
11856
  // Update the cache by subdomain as well in case it's different to the ID.
11846
11857
  if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
11847
11858
  api.SetCacheItem({
@@ -11869,6 +11880,7 @@
11869
11880
  Account.Get = Get;
11870
11881
  /**
11871
11882
  * Returns a client account record by subdomain or ID.
11883
+ * @deprecated use Get() as both will check against ID and subdomain.
11872
11884
  * @param params
11873
11885
  * @returns
11874
11886
  */
@@ -12078,16 +12090,22 @@
12078
12090
  * @param sessionId
12079
12091
  * @param accountId
12080
12092
  * @param appSettingsId
12093
+ * @param expandParam Comma delimited list of expand params.
12081
12094
  * @returns
12082
12095
  */
12083
- function GetCacheKey(sessionId, accountId, appSettingsId) {
12096
+ function GetCacheKey(sessionId, accountId, appSettingsId, expandParam) {
12084
12097
  if (!sessionId) {
12085
12098
  sessionId = "anonymous";
12086
12099
  }
12100
+ let cacheKey = [exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId];
12101
+ if (expandParam) {
12102
+ cacheKey.push(exports.Api.ECacheKey.Id + expandParam);
12103
+ }
12087
12104
  if (appSettingsId) {
12088
- return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
12105
+ cacheKey.push(exports.Api.ECacheKey + appSettingsId);
12089
12106
  }
12090
- return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
12107
+ cacheKey.push(exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId);
12108
+ return cacheKey.join("");
12091
12109
  }
12092
12110
  Account.GetCacheKey = GetCacheKey;
12093
12111
  /**
@@ -16144,7 +16162,7 @@
16144
16162
  })(exports.Tracking || (exports.Tracking = {}));
16145
16163
 
16146
16164
  // This is updated with the package.json version on build.
16147
- const VERSION = "6.7.7";
16165
+ const VERSION = "6.7.8";
16148
16166
 
16149
16167
  exports.VERSION = VERSION;
16150
16168
  exports.AbstractApi = AbstractApi;