bruce-models 1.2.9 → 1.3.1

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.
@@ -58,6 +58,7 @@ var Api;
58
58
  ECacheKey["AccessToken"] = "accesstoken";
59
59
  ECacheKey["UserGroup"] = "usergroup";
60
60
  ECacheKey["Account"] = "account";
61
+ ECacheKey["DatabaseRegion"] = "databaseregion";
61
62
  ECacheKey["CustomForm"] = "customform";
62
63
  ECacheKey["ImportedFile"] = "importedfile";
63
64
  })(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
@@ -637,6 +638,10 @@ var Account;
637
638
  return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
638
639
  }
639
640
  Account.GetListCacheKey = GetListCacheKey;
641
+ function GetDbRegionListCacheKey() {
642
+ return Api.ECacheKey.DatabaseRegion;
643
+ }
644
+ Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
640
645
  let EDbRegion;
641
646
  (function (EDbRegion) {
642
647
  EDbRegion["USA"] = "US";
@@ -653,24 +658,6 @@ var Account;
653
658
  EStarterContent["Default"] = "default";
654
659
  EStarterContent["None"] = "none";
655
660
  })(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
656
- Account.DbRegions = [
657
- {
658
- name: "North California, USA",
659
- value: EDbRegion.USA
660
- },
661
- {
662
- name: "Paris, France",
663
- value: EDbRegion.Paris
664
- },
665
- {
666
- name: "Singapore",
667
- value: EDbRegion.Singapore
668
- },
669
- {
670
- name: "Sydney, Australia",
671
- value: EDbRegion.Australia
672
- }
673
- ];
674
661
  function Get(api, id, reqParams) {
675
662
  return __awaiter(this, void 0, void 0, function* () {
676
663
  const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
@@ -774,6 +761,26 @@ var Account;
774
761
  });
775
762
  }
776
763
  Account.Create = Create;
764
+ function GetDbRegions(api, reqParams) {
765
+ return __awaiter(this, void 0, void 0, function* () {
766
+ const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
767
+ if (cacheData) {
768
+ return cacheData;
769
+ }
770
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
771
+ try {
772
+ const data = yield api.GET("config/regions", Api.PrepReqParams(reqParams));
773
+ res(data.regions);
774
+ }
775
+ catch (e) {
776
+ rej(e);
777
+ }
778
+ }));
779
+ api.Cache.Set(GetDbRegionListCacheKey(), prom, Api.DEFAULT_CACHE_DURATION);
780
+ return prom;
781
+ });
782
+ }
783
+ Account.GetDbRegions = GetDbRegions;
777
784
  })(Account || (Account = {}));
778
785
 
779
786
  var MessageBroker;