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.
@@ -6064,11 +6064,19 @@ var User;
6064
6064
  if (cacheData) {
6065
6065
  return cacheData;
6066
6066
  }
6067
- const req = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6068
- api.Cache.Set(GetCacheKey(id, accountId), req, Api.DEFAULT_CACHE_DURATION);
6069
- return {
6070
- user: req
6071
- };
6067
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6068
+ try {
6069
+ const data = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6070
+ res({
6071
+ user: data
6072
+ });
6073
+ }
6074
+ catch (e) {
6075
+ rej(e);
6076
+ }
6077
+ }));
6078
+ api.Cache.Set(GetCacheKey(id, accountId), prom, Api.DEFAULT_CACHE_DURATION);
6079
+ return prom;
6072
6080
  });
6073
6081
  }
6074
6082
  User.Get = Get;
@@ -6209,11 +6217,19 @@ var User;
6209
6217
  if (cacheData) {
6210
6218
  return cacheData;
6211
6219
  }
6212
- const req = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6213
- api.Cache.Set(GetEmailCacheKey(email, accountId), req, Api.DEFAULT_CACHE_DURATION);
6214
- return {
6215
- user: req
6216
- };
6220
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6221
+ try {
6222
+ const data = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
6223
+ res({
6224
+ user: data
6225
+ });
6226
+ }
6227
+ catch (e) {
6228
+ rej(e);
6229
+ }
6230
+ }));
6231
+ api.Cache.Set(GetEmailCacheKey(email, accountId), prom, Api.DEFAULT_CACHE_DURATION);
6232
+ return prom;
6217
6233
  });
6218
6234
  }
6219
6235
  LoginUser.GetByEmail = GetByEmail;
@@ -6244,7 +6260,9 @@ var User;
6244
6260
  req.then((data) => {
6245
6261
  const users = data.users;
6246
6262
  for (let i = 0; i < users.length; i++) {
6247
- api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
6263
+ api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
6264
+ user: users[i]
6265
+ });
6248
6266
  }
6249
6267
  });
6250
6268
  if (!exclusive) {
@@ -6386,7 +6404,7 @@ var User;
6386
6404
  try {
6387
6405
  const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
6388
6406
  res({
6389
- tokens: data.Items
6407
+ users: data.Items
6390
6408
  });
6391
6409
  }
6392
6410
  catch (e) {
@@ -6396,7 +6414,9 @@ var User;
6396
6414
  req.then((data) => {
6397
6415
  const users = data.tokens;
6398
6416
  for (let i = 0; i < users.length; i++) {
6399
- api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
6417
+ api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
6418
+ user: users[i]
6419
+ });
6400
6420
  }
6401
6421
  });
6402
6422
  api.Cache.Set(GetListCacheKey(accountId), req, Api.DEFAULT_CACHE_DURATION);
@@ -6428,7 +6448,7 @@ var User;
6428
6448
  data = yield api.POST("accessToken", data, reqParams);
6429
6449
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
6430
6450
  return {
6431
- token: data
6451
+ user: data
6432
6452
  };
6433
6453
  });
6434
6454
  }