bruce-models 6.4.6 → 6.4.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.
@@ -8353,20 +8353,20 @@ var Style;
8353
8353
  */
8354
8354
  function Get(params) {
8355
8355
  return __awaiter(this, void 0, void 0, function* () {
8356
- let { api, styleId: id, req: reqParams } = params;
8357
- if (!id) {
8358
- throw ("Style ID is required.");
8356
+ let { api, styleId, req: reqParams } = params;
8357
+ if (!styleId) {
8358
+ throw ("styleId is required.");
8359
8359
  }
8360
8360
  if (!api) {
8361
8361
  api = ENVIRONMENT.Api().GetBruceApi();
8362
8362
  }
8363
- const cache = api.GetCacheItem(GetCacheKey(id), reqParams);
8363
+ const cache = api.GetCacheItem(GetCacheKey(styleId), reqParams);
8364
8364
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8365
8365
  return cache.data;
8366
8366
  }
8367
8367
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
8368
8368
  try {
8369
- const data = yield api.GET(`ui.entityDisplaySetting/${id}`, Api.PrepReqParams(reqParams));
8369
+ const data = yield api.GET(`ui.entityDisplaySetting/${styleId}`, Api.PrepReqParams(reqParams));
8370
8370
  res({
8371
8371
  style: data
8372
8372
  });
@@ -8376,7 +8376,7 @@ var Style;
8376
8376
  }
8377
8377
  }));
8378
8378
  api.SetCacheItem({
8379
- key: GetCacheKey(id),
8379
+ key: GetCacheKey(styleId),
8380
8380
  value: prom,
8381
8381
  req: reqParams
8382
8382
  });
@@ -12712,6 +12712,41 @@ var User;
12712
12712
  // Access token. Used to gain access to related permissions.
12713
12713
  EType["AccessToken"] = "ACCESS_TOKEN";
12714
12714
  })(EType = User$$1.EType || (User$$1.EType = {}));
12715
+ /**
12716
+ * Returns an array of User Group IDs for the User that have been loaded.
12717
+ * Note, this does not perform an API lookup if the User instance hasn't loaded the specific account's details.
12718
+ * @param params
12719
+ * @returns
12720
+ */
12721
+ function UnpackRelatedUserGroupIDs(params) {
12722
+ var _a, _b;
12723
+ const { user, accountId } = params;
12724
+ if (!user || !accountId) {
12725
+ throw ("User and accountId are required.");
12726
+ }
12727
+ let accessPerms = user.AccessPermissions;
12728
+ if (!accessPerms || !Array.isArray(accessPerms) || accessPerms.length === 0) {
12729
+ return [];
12730
+ }
12731
+ for (const perm of accessPerms) {
12732
+ if (!perm || perm["ClientAccount.ID"] !== accountId) {
12733
+ continue;
12734
+ }
12735
+ else if ((_a = perm["UserGroup.ID"]) === null || _a === void 0 ? void 0 : _a.length) {
12736
+ return perm["UserGroup.ID"];
12737
+ }
12738
+ else if ((_b = perm.UserGroups) === null || _b === void 0 ? void 0 : _b.length) {
12739
+ if (typeof perm.UserGroups[0] === "string") {
12740
+ return perm.UserGroups;
12741
+ }
12742
+ else if (typeof perm.UserGroups[0] === "object") {
12743
+ return perm.UserGroups.map(group => group.ID);
12744
+ }
12745
+ }
12746
+ }
12747
+ return [];
12748
+ }
12749
+ User$$1.UnpackRelatedUserGroupIDs = UnpackRelatedUserGroupIDs;
12715
12750
  /**
12716
12751
  * Gets a user record.
12717
12752
  * @param params
@@ -14670,8 +14705,8 @@ var DataLab;
14670
14705
  function Get(params) {
14671
14706
  return __awaiter(this, void 0, void 0, function* () {
14672
14707
  let { api, queryId, req } = params;
14673
- if (!queryId || queryId <= 0) {
14674
- throw new Error("queryId is required.");
14708
+ if (!queryId) {
14709
+ throw new Error("queryId must be provided.");
14675
14710
  }
14676
14711
  if (!api) {
14677
14712
  api = ENVIRONMENT.Api().GetBruceApi();
@@ -16029,7 +16064,7 @@ var Tracking;
16029
16064
  })(Tracking || (Tracking = {}));
16030
16065
 
16031
16066
  // This is updated with the package.json version on build.
16032
- const VERSION = "6.4.6";
16067
+ const VERSION = "6.4.8";
16033
16068
 
16034
16069
  export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking };
16035
16070
  //# sourceMappingURL=bruce-models.es5.js.map