bruce-models 0.2.6 → 0.2.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.
@@ -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;
@@ -5210,6 +5238,9 @@ var User;
5210
5238
  case 1:
5211
5239
  res = _a.sent();
5212
5240
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + res.ID);
5241
+ if (data.Email) {
5242
+ api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.UserEmail + data.Email);
5243
+ }
5213
5244
  return [2 /*return*/, res];
5214
5245
  }
5215
5246
  });
@@ -5560,7 +5591,25 @@ var Account;
5560
5591
  EDbRegion["Paris"] = "EU";
5561
5592
  EDbRegion["Singapore"] = "SE";
5562
5593
  EDbRegion["Australia"] = "AU";
5563
- })(EDbRegion || (EDbRegion = {}));
5594
+ })(EDbRegion = Account$$1.EDbRegion || (Account$$1.EDbRegion = {}));
5595
+ Account$$1.DbRegions = [
5596
+ {
5597
+ name: "North California, USA",
5598
+ value: EDbRegion.USA
5599
+ },
5600
+ {
5601
+ name: "Paris, France",
5602
+ value: EDbRegion.Paris
5603
+ },
5604
+ {
5605
+ name: "Singapore",
5606
+ value: EDbRegion.Singapore
5607
+ },
5608
+ {
5609
+ name: "Sydney, Australia",
5610
+ value: EDbRegion.Australia
5611
+ }
5612
+ ];
5564
5613
  function Get(api, id) {
5565
5614
  return __awaiter(this, void 0, void 0, function () {
5566
5615
  var cacheData, req;