bruce-models 3.5.2 → 3.5.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.
@@ -39,6 +39,7 @@
39
39
  let ECacheKey;
40
40
  (function (ECacheKey) {
41
41
  ECacheKey["Id"] = ":";
42
+ ECacheKey["ListId"] = "::";
42
43
  ECacheKey["Entity"] = "entity";
43
44
  ECacheKey["EntityType"] = "entitytype";
44
45
  ECacheKey["ProjectView"] = "projectview";
@@ -7932,36 +7933,15 @@
7932
7933
  })(exports.ProjectViewBookmark || (exports.ProjectViewBookmark = {}));
7933
7934
 
7934
7935
  (function (ProjectView) {
7935
- /**
7936
- * Returns cache identifier for a project view.
7937
- * Example: {
7938
- * const api: BruceApi.Api = ...;
7939
- * const key = GetCacheKey("abc");
7940
- * api.Cache.Remove(key);
7941
- * }
7942
- * @param viewId
7943
- * @returns
7944
- */
7945
- function GetCacheKey(viewId) {
7946
- return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.Id}${viewId}`;
7947
- }
7948
- ProjectView.GetCacheKey = GetCacheKey;
7949
- /**
7950
- * Returns cache identifier for a list of project views.
7951
- * Example: {
7952
- * const api: BruceApi.Api = ...;
7953
- * const key = GetListCacheKey();
7954
- * api.Cache.Remove(key);
7955
- * }
7956
- * @returns
7957
- */
7958
- function GetListCacheKey() {
7959
- return exports.Api.ECacheKey.ProjectView;
7960
- }
7961
- ProjectView.GetListCacheKey = GetListCacheKey;
7962
7936
  // This is the expected default version for the DataVersion value.
7963
7937
  // This value should NOT be changed without looking at our API and seeing what the default value is.
7964
7938
  ProjectView.DEFAULT_DATA_VERSION = 2;
7939
+ // Our Cesium web navigator.
7940
+ ProjectView.TYPE_WEB_3D_NAVIGATOR = "WEB_3D_NAVIGATOR";
7941
+ // Our (currently WIP) 2D web navigator.
7942
+ ProjectView.TYPE_WEB_2D_NAVIGATOR = "WEB_2D_NAVIGATOR";
7943
+ // Defaulting to 3D navigator for backwards compatibility.
7944
+ ProjectView.DEFAULT_TYPE = ProjectView.TYPE_WEB_3D_NAVIGATOR;
7965
7945
  /**
7966
7946
  * Gets a project view record.
7967
7947
  * @param params
@@ -8008,11 +7988,11 @@
8008
7988
  */
8009
7989
  function GetList(params) {
8010
7990
  return __awaiter(this, void 0, void 0, function* () {
8011
- let { api, req: reqParams } = params;
7991
+ let { api, req: reqParams, type } = params;
8012
7992
  if (!api) {
8013
7993
  api = exports.ENVIRONMENT.Api().GetBruceApi();
8014
7994
  }
8015
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
7995
+ const cache = yield api.GetCacheItem(GetListCacheKey(type), reqParams);
8016
7996
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8017
7997
  return cache.data;
8018
7998
  }
@@ -8028,7 +8008,7 @@
8028
8008
  }
8029
8009
  }));
8030
8010
  yield api.SetCacheItem({
8031
- key: GetListCacheKey(),
8011
+ key: GetListCacheKey(type),
8032
8012
  value: prom,
8033
8013
  req: reqParams
8034
8014
  });
@@ -8051,7 +8031,7 @@
8051
8031
  }
8052
8032
  yield api.DELETE(`ui.view/${viewId}`, exports.Api.PrepReqParams(reqParams));
8053
8033
  api.Cache.Remove(GetCacheKey(viewId));
8054
- api.Cache.Remove(GetListCacheKey());
8034
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
8055
8035
  });
8056
8036
  }
8057
8037
  ProjectView.Delete = Delete;
@@ -8088,13 +8068,44 @@
8088
8068
  data = yield api.PUT(`ui.view/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
8089
8069
  }
8090
8070
  api.Cache.Remove(GetCacheKey(data.ID));
8091
- api.Cache.Remove(GetListCacheKey());
8071
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
8092
8072
  return {
8093
8073
  view: data
8094
8074
  };
8095
8075
  });
8096
8076
  }
8097
8077
  ProjectView.Update = Update;
8078
+ /**
8079
+ * Returns cache identifier for a project view.
8080
+ * Example: {
8081
+ * const api: BruceApi.Api = ...;
8082
+ * const key = GetCacheKey("abc");
8083
+ * api.Cache.Remove(key);
8084
+ * }
8085
+ * @param viewId
8086
+ * @returns
8087
+ */
8088
+ function GetCacheKey(viewId) {
8089
+ return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.Id}${viewId}`;
8090
+ }
8091
+ ProjectView.GetCacheKey = GetCacheKey;
8092
+ /**
8093
+ * Returns cache identifier for a list of project views.
8094
+ * Example: {
8095
+ * const api: BruceApi.Api = ...;
8096
+ * const key = GetListCacheKey();
8097
+ * api.Cache.Remove(key);
8098
+ * }
8099
+ * @param type optional filter for the type of project view.
8100
+ * @returns
8101
+ */
8102
+ function GetListCacheKey(type) {
8103
+ if (type) {
8104
+ return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.ListId}${type}`;
8105
+ }
8106
+ return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.ListId}`;
8107
+ }
8108
+ ProjectView.GetListCacheKey = GetListCacheKey;
8098
8109
  })(exports.ProjectView || (exports.ProjectView = {}));
8099
8110
 
8100
8111
  function getTemplateSettings(apiGetter, reqParams) {
@@ -8585,6 +8596,8 @@
8585
8596
  (function (EPerm) {
8586
8597
  // Provides full access to a specific client account.
8587
8598
  EPerm["ADMIN"] = "ADMIN";
8599
+ // Exactly like ADMIN except with no user and organization management.
8600
+ EPerm["POWER"] = "POWER";
8588
8601
  // Provides read-only access to a specific client account.
8589
8602
  EPerm["ADMIN_VIEW"] = "ADMIN_VIEW";
8590
8603
  // Provides login access to a specific client account.
@@ -8712,7 +8725,7 @@
8712
8725
  /**
8713
8726
  * Returns if a permission is enabled for a session.
8714
8727
  * This check is case-insensitive.
8715
- * Please use 'IsAccountAdmin' and 'IsSuperAdmin' when needed as they cover all account-level perms.
8728
+ * Please use 'IsAccountAdmin', 'IsSuperAdmin', and 'IsPowerUser' when needed as they cover all account-level perms.
8716
8729
  * @param params
8717
8730
  * @returns
8718
8731
  */
@@ -8774,6 +8787,21 @@
8774
8787
  });
8775
8788
  }
8776
8789
  Session.IsAccountAdmin = IsAccountAdmin;
8790
+ /**
8791
+ * Returns if a session is a power user.
8792
+ * Power users are account admins without the ability to manage users and organizations.
8793
+ * Please use 'IsSuperAdmin' when needed as it covers all perms.
8794
+ * @param params
8795
+ * @returns
8796
+ */
8797
+ function IsPowerUser(params) {
8798
+ return IsPermEnabled({
8799
+ perm: exports.Permission.EPerm.POWER,
8800
+ accountId: params.accountId,
8801
+ session: params.session,
8802
+ });
8803
+ }
8804
+ Session.IsPowerUser = IsPowerUser;
8777
8805
  /**
8778
8806
  * Returns if a session is a super admin.
8779
8807
  * @param params
@@ -10587,7 +10615,7 @@
10587
10615
  })(exports.DataSource || (exports.DataSource = {}));
10588
10616
 
10589
10617
  // This is updated with the package.json version on build.
10590
- const VERSION = "3.5.2";
10618
+ const VERSION = "3.5.4";
10591
10619
 
10592
10620
  exports.VERSION = VERSION;
10593
10621
  exports.AbstractApi = AbstractApi;