bruce-models 3.3.2 → 3.3.3

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
@@ -10624,7 +10682,7 @@ var DataSource;
10624
10682
  DataSource.GetList = GetList;
10625
10683
  })(DataSource || (DataSource = {}));
10626
10684
 
10627
- const VERSION = "3.3.2";
10685
+ const VERSION = "3.3.3";
10628
10686
 
10629
10687
  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
10688
  //# sourceMappingURL=bruce-models.es5.js.map