bruce-models 7.1.127 → 7.1.128

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.
@@ -23622,9 +23622,10 @@
23622
23622
  * @param accountId
23623
23623
  * @param exclusive
23624
23624
  * @param search
23625
+ * @param expand
23625
23626
  * @returns
23626
23627
  */
23627
- function GetListCacheKey(sessionId, accountId, exclusive, search) {
23628
+ function GetListCacheKey(sessionId, accountId, exclusive, search, expand) {
23628
23629
  if (!exclusive) {
23629
23630
  exclusive = false;
23630
23631
  }
@@ -23637,7 +23638,10 @@
23637
23638
  if (!accountId) {
23638
23639
  accountId = "";
23639
23640
  }
23640
- return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + exclusive + exports.Api.ECacheKey.Id + search + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
23641
+ if (!expand) {
23642
+ expand = "";
23643
+ }
23644
+ return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + exclusive + exports.Api.ECacheKey.Id + search + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId + exports.Api.ECacheKey.Id + expand;
23641
23645
  }
23642
23646
  LoginUser.GetListCacheKey = GetListCacheKey;
23643
23647
  /**
@@ -23664,15 +23668,16 @@
23664
23668
  */
23665
23669
  function GetList(params) {
23666
23670
  return __awaiter(this, void 0, void 0, function* () {
23667
- let { api, accountId, exclusive, req: reqParams, search } = params;
23671
+ let { api, accountId, exclusive, req: reqParams, search, expandLastAccess } = params;
23668
23672
  if (!api) {
23669
23673
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
23670
23674
  }
23671
23675
  if (!exclusive) {
23672
23676
  exclusive = false;
23673
23677
  }
23678
+ const expand = GetListExpand(expandLastAccess);
23674
23679
  const sessionId = api.GetSessionId();
23675
- const cacheKey = GetListCacheKey(sessionId, accountId, exclusive, search);
23680
+ const cacheKey = GetListCacheKey(sessionId, accountId, exclusive, search, expand);
23676
23681
  const cache = exclusive ? null : api.GetCacheItem(cacheKey, reqParams);
23677
23682
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
23678
23683
  return cache.data;
@@ -23689,6 +23694,9 @@
23689
23694
  if (exclusive) {
23690
23695
  urlParams.append("allExcludingClientAccount", "true");
23691
23696
  }
23697
+ if (expand) {
23698
+ urlParams.append("Expand", expand);
23699
+ }
23692
23700
  const data = yield api.GET(`v3/users?${urlParams.toString()}`, reqParams);
23693
23701
  res({
23694
23702
  users: data.Items
@@ -23864,16 +23872,20 @@
23864
23872
  * }
23865
23873
  * @param sessionId
23866
23874
  * @param accountId
23875
+ * @param expand
23867
23876
  * @returns
23868
23877
  */
23869
- function GetListCacheKey(sessionId, accountId) {
23878
+ function GetListCacheKey(sessionId, accountId, expand) {
23870
23879
  if (!sessionId) {
23871
23880
  sessionId = "anonymous";
23872
23881
  }
23873
23882
  if (!accountId) {
23874
23883
  accountId = "";
23875
23884
  }
23876
- return exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
23885
+ if (!expand) {
23886
+ expand = "";
23887
+ }
23888
+ return exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId + exports.Api.ECacheKey.Id + expand;
23877
23889
  }
23878
23890
  AccessToken.GetListCacheKey = GetListCacheKey;
23879
23891
  /**
@@ -23883,18 +23895,26 @@
23883
23895
  */
23884
23896
  function GetList(params) {
23885
23897
  return __awaiter(this, void 0, void 0, function* () {
23886
- let { api, accountId, req: reqParams } = params;
23898
+ let { api, accountId, expandLastAccess, req: reqParams } = params;
23899
+ if (!accountId) {
23900
+ throw ("Account ID is required.");
23901
+ }
23887
23902
  if (!api) {
23888
23903
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
23889
23904
  }
23890
- const cacheKey = GetListCacheKey(api.GetSessionId(), accountId);
23905
+ const expand = GetListExpand(expandLastAccess);
23906
+ const cacheKey = GetListCacheKey(api.GetSessionId(), accountId, expand);
23891
23907
  const cache = api.GetCacheItem(cacheKey, reqParams);
23892
23908
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
23893
23909
  return cache.data;
23894
23910
  }
23895
23911
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23896
23912
  try {
23897
- const data = yield api.GET(`v3/account/${accountId}/accessTokens`, reqParams);
23913
+ let url = `v3/account/${accountId}/accessTokens`;
23914
+ if (expand) {
23915
+ url += "?Expand=" + expand;
23916
+ }
23917
+ const data = yield api.GET(url, reqParams);
23898
23918
  res({
23899
23919
  users: data.Items
23900
23920
  });
@@ -23957,6 +23977,16 @@
23957
23977
  }
23958
23978
  AccessToken.Create = Create;
23959
23979
  })(AccessToken = User.AccessToken || (User.AccessToken = {}));
23980
+ /**
23981
+ * Builds the Expand value for a user list, or undefined to leave Guardian's default.
23982
+ * An explicit Expand replaces the default permission expansion, so it is asked for again.
23983
+ */
23984
+ function GetListExpand(expandLastAccess) {
23985
+ if (!expandLastAccess) {
23986
+ return undefined;
23987
+ }
23988
+ return "permission,lastAccess";
23989
+ }
23960
23990
  /**
23961
23991
  * Updates the password for a user by supplying the existing and new password.
23962
23992
  * @param params
@@ -25476,7 +25506,7 @@
25476
25506
  }
25477
25507
 
25478
25508
  // This is updated with the package.json version on build.
25479
- const VERSION = "7.1.127";
25509
+ const VERSION = "7.1.128";
25480
25510
 
25481
25511
  exports.VERSION = VERSION;
25482
25512
  exports.AbstractApi = AbstractApi;