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.
@@ -63,6 +63,7 @@
63
63
  ECacheKey["AccessToken"] = "accesstoken";
64
64
  ECacheKey["UserGroup"] = "usergroup";
65
65
  ECacheKey["Account"] = "account";
66
+ ECacheKey["DatabaseRegion"] = "databaseregion";
66
67
  ECacheKey["CustomForm"] = "customform";
67
68
  ECacheKey["ImportedFile"] = "importedfile";
68
69
  })(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
@@ -626,6 +627,10 @@
626
627
  return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid;
627
628
  }
628
629
  Account.GetListCacheKey = GetListCacheKey;
630
+ function GetDbRegionListCacheKey() {
631
+ return exports.Api.ECacheKey.DatabaseRegion;
632
+ }
633
+ Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
629
634
  let EDbRegion;
630
635
  (function (EDbRegion) {
631
636
  EDbRegion["USA"] = "US";
@@ -642,24 +647,6 @@
642
647
  EStarterContent["Default"] = "default";
643
648
  EStarterContent["None"] = "none";
644
649
  })(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
645
- Account.DbRegions = [
646
- {
647
- name: "North California, USA",
648
- value: EDbRegion.USA
649
- },
650
- {
651
- name: "Paris, France",
652
- value: EDbRegion.Paris
653
- },
654
- {
655
- name: "Singapore",
656
- value: EDbRegion.Singapore
657
- },
658
- {
659
- name: "Sydney, Australia",
660
- value: EDbRegion.Australia
661
- }
662
- ];
663
650
  function Get(api, id, reqParams) {
664
651
  return __awaiter(this, void 0, void 0, function* () {
665
652
  const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
@@ -763,6 +750,26 @@
763
750
  });
764
751
  }
765
752
  Account.Create = Create;
753
+ function GetDbRegions(api, reqParams) {
754
+ return __awaiter(this, void 0, void 0, function* () {
755
+ const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
756
+ if (cacheData) {
757
+ return cacheData;
758
+ }
759
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
760
+ try {
761
+ const data = yield api.GET("config/regions", exports.Api.PrepReqParams(reqParams));
762
+ res(data.regions);
763
+ }
764
+ catch (e) {
765
+ rej(e);
766
+ }
767
+ }));
768
+ api.Cache.Set(GetDbRegionListCacheKey(), prom, exports.Api.DEFAULT_CACHE_DURATION);
769
+ return prom;
770
+ });
771
+ }
772
+ Account.GetDbRegions = GetDbRegions;
766
773
  })(exports.Account || (exports.Account = {}));
767
774
 
768
775
  (function (MessageBroker) {