bruce-models 0.2.6 → 0.2.7

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.
@@ -106,6 +106,7 @@ var Api;
106
106
  ECacheKey["Style"] = "style";
107
107
  ECacheKey["PublishTileset"] = "publishtileset";
108
108
  ECacheKey["User"] = "user";
109
+ ECacheKey["UserEmail"] = "useremail";
109
110
  ECacheKey["AccessToken"] = "accesstoken";
110
111
  ECacheKey["UserGroup"] = "usergroup";
111
112
  ECacheKey["Account"] = "account";
@@ -5011,6 +5012,10 @@ var User;
5011
5012
  return Api.ECacheKey.User + Api.ECacheKey.Id + userId + Api.ECacheKey.Id + accountId;
5012
5013
  }
5013
5014
  User.GetCacheKey = GetCacheKey;
5015
+ function GetEmailCacheKey(email, accountId) {
5016
+ return Api.ECacheKey.User + Api.ECacheKey.UserEmail + email + Api.ECacheKey.Id + accountId;
5017
+ }
5018
+ User.GetEmailCacheKey = GetEmailCacheKey;
5014
5019
  var EType;
5015
5020
  (function (EType) {
5016
5021
  EType["User"] = "LOGIN_USER";
@@ -5102,6 +5107,29 @@ var User;
5102
5107
  return Api.ECacheKey.User + Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
5103
5108
  }
5104
5109
  LoginUser.GetListCacheKey = GetListCacheKey;
5110
+ function GetByEmail(api, email, accountId) {
5111
+ return __awaiter(this, void 0, void 0, function () {
5112
+ var cacheData, req;
5113
+ return __generator(this, function (_a) {
5114
+ switch (_a.label) {
5115
+ case 0:
5116
+ if (!email) {
5117
+ throw ("Email is required.");
5118
+ }
5119
+ cacheData = api.Cache.Get(GetEmailCacheKey(email, accountId));
5120
+ if (cacheData) {
5121
+ return [2 /*return*/, cacheData];
5122
+ }
5123
+ return [4 /*yield*/, api.GET("userByEmail/" + email + (accountId ? "?clientAccountID=" + accountId : ""))];
5124
+ case 1:
5125
+ req = _a.sent();
5126
+ api.Cache.Set(GetEmailCacheKey(email, accountId), req, Api.DEFAULT_CACHE_DURATION);
5127
+ return [2 /*return*/, req];
5128
+ }
5129
+ });
5130
+ });
5131
+ }
5132
+ LoginUser.GetByEmail = GetByEmail;
5105
5133
  function GetList(api, accountId, exclusive) {
5106
5134
  return __awaiter(this, void 0, void 0, function () {
5107
5135
  var cacheData, req;