bruce-models 3.3.2 → 3.3.4

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.
@@ -883,19 +883,77 @@ var Account;
883
883
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
884
884
  return cache.data;
885
885
  }
886
- const req = yield api.GET(`account/${id}`, reqParams);
887
- const resData = {
888
- account: req
889
- };
886
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
887
+ try {
888
+ const data = yield api.GET(`accountbyid/${id}`, reqParams);
889
+ // Update the cache by subdomain as well in case it's different to the ID.
890
+ if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
891
+ yield api.SetCacheItem({
892
+ key: data.Subdomain,
893
+ value: prom,
894
+ req: reqParams
895
+ });
896
+ }
897
+ res({
898
+ account: data
899
+ });
900
+ }
901
+ catch (e) {
902
+ rej(e);
903
+ }
904
+ }));
890
905
  yield api.SetCacheItem({
891
906
  key: GetCacheKey(id),
892
- value: resData,
907
+ value: prom,
893
908
  req: reqParams
894
909
  });
895
- return resData;
910
+ return prom;
896
911
  });
897
912
  }
898
913
  Account.Get = Get;
914
+ /**
915
+ * Returns a client account record by subdomain or ID.
916
+ * @param params
917
+ * @returns
918
+ */
919
+ function GetBySubdomain(params) {
920
+ return __awaiter(this, void 0, void 0, function* () {
921
+ let { api, subdomain, req: reqParams } = params;
922
+ if (!api) {
923
+ api = ENVIRONMENT.Api().GetGuardianApi();
924
+ }
925
+ const cache = yield api.GetCacheItem(GetCacheKey(subdomain), reqParams);
926
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
927
+ return cache.data;
928
+ }
929
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
930
+ try {
931
+ const data = yield api.GET(`account/${subdomain}`, reqParams);
932
+ // Update the cache by ID as well in case it's different to the subdomain.
933
+ if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
934
+ yield api.SetCacheItem({
935
+ key: data.ID,
936
+ value: prom,
937
+ req: reqParams
938
+ });
939
+ }
940
+ res({
941
+ account: data
942
+ });
943
+ }
944
+ catch (e) {
945
+ rej(e);
946
+ }
947
+ }));
948
+ yield api.SetCacheItem({
949
+ key: GetCacheKey(subdomain),
950
+ value: prom,
951
+ req: reqParams
952
+ });
953
+ return prom;
954
+ });
955
+ }
956
+ Account.GetBySubdomain = GetBySubdomain;
899
957
  /**
900
958
  * Gets a list of client accounts related to the current session user.
901
959
  * @param params
@@ -1703,6 +1761,9 @@ class ApiGetters {
1703
1761
  for (const key in this.bruce) {
1704
1762
  this.bruce[key].SetSessionId(sessionId);
1705
1763
  }
1764
+ for (const key in this.guardian) {
1765
+ this.guardian[key].SetSessionId(sessionId);
1766
+ }
1706
1767
  for (const key in this.global) {
1707
1768
  this.global[key].SetSessionId(sessionId);
1708
1769
  }
@@ -10624,7 +10685,7 @@ var DataSource;
10624
10685
  DataSource.GetList = GetList;
10625
10686
  })(DataSource || (DataSource = {}));
10626
10687
 
10627
- const VERSION = "3.3.2";
10688
+ const VERSION = "3.3.4";
10628
10689
 
10629
10690
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
10630
10691
  //# sourceMappingURL=bruce-models.es5.js.map