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.
@@ -111,6 +111,7 @@
111
111
  ECacheKey["Style"] = "style";
112
112
  ECacheKey["PublishTileset"] = "publishtileset";
113
113
  ECacheKey["User"] = "user";
114
+ ECacheKey["UserEmail"] = "useremail";
114
115
  ECacheKey["AccessToken"] = "accesstoken";
115
116
  ECacheKey["UserGroup"] = "usergroup";
116
117
  ECacheKey["Account"] = "account";
@@ -4830,6 +4831,10 @@
4830
4831
  return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + userId + exports.Api.ECacheKey.Id + accountId;
4831
4832
  }
4832
4833
  User.GetCacheKey = GetCacheKey;
4834
+ function GetEmailCacheKey(email, accountId) {
4835
+ return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserEmail + email + exports.Api.ECacheKey.Id + accountId;
4836
+ }
4837
+ User.GetEmailCacheKey = GetEmailCacheKey;
4833
4838
  var EType;
4834
4839
  (function (EType) {
4835
4840
  EType["User"] = "LOGIN_USER";
@@ -4921,6 +4926,29 @@
4921
4926
  return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
4922
4927
  }
4923
4928
  LoginUser.GetListCacheKey = GetListCacheKey;
4929
+ function GetByEmail(api, email, accountId) {
4930
+ return __awaiter(this, void 0, void 0, function () {
4931
+ var cacheData, req;
4932
+ return __generator(this, function (_a) {
4933
+ switch (_a.label) {
4934
+ case 0:
4935
+ if (!email) {
4936
+ throw ("Email is required.");
4937
+ }
4938
+ cacheData = api.Cache.Get(GetEmailCacheKey(email, accountId));
4939
+ if (cacheData) {
4940
+ return [2 /*return*/, cacheData];
4941
+ }
4942
+ return [4 /*yield*/, api.GET("userByEmail/" + email + (accountId ? "?clientAccountID=" + accountId : ""))];
4943
+ case 1:
4944
+ req = _a.sent();
4945
+ api.Cache.Set(GetEmailCacheKey(email, accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
4946
+ return [2 /*return*/, req];
4947
+ }
4948
+ });
4949
+ });
4950
+ }
4951
+ LoginUser.GetByEmail = GetByEmail;
4924
4952
  function GetList(api, accountId, exclusive) {
4925
4953
  return __awaiter(this, void 0, void 0, function () {
4926
4954
  var cacheData, req;
@@ -5029,6 +5057,9 @@
5029
5057
  case 1:
5030
5058
  res = _a.sent();
5031
5059
  api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + res.ID);
5060
+ if (data.Email) {
5061
+ api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserEmail + data.Email);
5062
+ }
5032
5063
  return [2 /*return*/, res];
5033
5064
  }
5034
5065
  });
@@ -5371,7 +5402,25 @@
5371
5402
  EDbRegion["Paris"] = "EU";
5372
5403
  EDbRegion["Singapore"] = "SE";
5373
5404
  EDbRegion["Australia"] = "AU";
5374
- })(EDbRegion || (EDbRegion = {}));
5405
+ })(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
5406
+ Account.DbRegions = [
5407
+ {
5408
+ name: "North California, USA",
5409
+ value: EDbRegion.USA
5410
+ },
5411
+ {
5412
+ name: "Paris, France",
5413
+ value: EDbRegion.Paris
5414
+ },
5415
+ {
5416
+ name: "Singapore",
5417
+ value: EDbRegion.Singapore
5418
+ },
5419
+ {
5420
+ name: "Sydney, Australia",
5421
+ value: EDbRegion.Australia
5422
+ }
5423
+ ];
5375
5424
  function Get(api, id) {
5376
5425
  return __awaiter(this, void 0, void 0, function () {
5377
5426
  var cacheData, req;