bruce-models 1.3.9 → 1.4.0

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.
@@ -5861,11 +5861,19 @@
5861
5861
  if (cacheData) {
5862
5862
  return cacheData;
5863
5863
  }
5864
- const req = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5865
- api.Cache.Set(GetCacheKey(id, accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
5866
- return {
5867
- user: req
5868
- };
5864
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5865
+ try {
5866
+ const data = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5867
+ res({
5868
+ user: data
5869
+ });
5870
+ }
5871
+ catch (e) {
5872
+ rej(e);
5873
+ }
5874
+ }));
5875
+ api.Cache.Set(GetCacheKey(id, accountId), prom, exports.Api.DEFAULT_CACHE_DURATION);
5876
+ return prom;
5869
5877
  });
5870
5878
  }
5871
5879
  User.Get = Get;
@@ -6006,11 +6014,19 @@
6006
6014
  if (cacheData) {
6007
6015
  return cacheData;
6008
6016
  }
6009
- const req = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6010
- api.Cache.Set(GetEmailCacheKey(email, accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
6011
- return {
6012
- user: req
6013
- };
6017
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6018
+ try {
6019
+ const data = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6020
+ res({
6021
+ user: data
6022
+ });
6023
+ }
6024
+ catch (e) {
6025
+ rej(e);
6026
+ }
6027
+ }));
6028
+ api.Cache.Set(GetEmailCacheKey(email, accountId), prom, exports.Api.DEFAULT_CACHE_DURATION);
6029
+ return prom;
6014
6030
  });
6015
6031
  }
6016
6032
  LoginUser.GetByEmail = GetByEmail;
@@ -6041,7 +6057,9 @@
6041
6057
  req.then((data) => {
6042
6058
  const users = data.users;
6043
6059
  for (let i = 0; i < users.length; i++) {
6044
- api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
6060
+ api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
6061
+ user: users[i]
6062
+ });
6045
6063
  }
6046
6064
  });
6047
6065
  if (!exclusive) {
@@ -6183,7 +6201,7 @@
6183
6201
  try {
6184
6202
  const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
6185
6203
  res({
6186
- tokens: data.Items
6204
+ users: data.Items
6187
6205
  });
6188
6206
  }
6189
6207
  catch (e) {
@@ -6193,7 +6211,9 @@
6193
6211
  req.then((data) => {
6194
6212
  const users = data.tokens;
6195
6213
  for (let i = 0; i < users.length; i++) {
6196
- api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
6214
+ api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
6215
+ user: users[i]
6216
+ });
6197
6217
  }
6198
6218
  });
6199
6219
  api.Cache.Set(GetListCacheKey(accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
@@ -6225,7 +6245,7 @@
6225
6245
  data = yield api.POST("accessToken", data, reqParams);
6226
6246
  api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
6227
6247
  return {
6228
- token: data
6248
+ user: data
6229
6249
  };
6230
6250
  });
6231
6251
  }