bruce-models 6.7.4 → 6.7.6

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.
@@ -10965,21 +10965,38 @@
10965
10965
  */
10966
10966
  function Get(params) {
10967
10967
  return __awaiter(this, void 0, void 0, function* () {
10968
- let { api, viewId, req: reqParams } = params;
10969
- if (!viewId) {
10970
- throw ("View ID is required.");
10968
+ let { api, viewId, bookmarkId, expand, req: reqParams } = params;
10969
+ if (!viewId && !bookmarkId) {
10970
+ throw ("View ID or Bookmark ID is required.");
10971
10971
  }
10972
10972
  if (!api) {
10973
10973
  api = exports.ENVIRONMENT.Api().GetBruceApi();
10974
10974
  }
10975
- const key = GetCacheKey(viewId);
10975
+ // Same thing but keeps cache keys consistent.
10976
+ if (expand === true) {
10977
+ expand = "*";
10978
+ }
10979
+ const key = GetCacheKey(viewId, bookmarkId, expand);
10976
10980
  const cache = api.GetCacheItem(key, reqParams);
10977
10981
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10978
10982
  return cache.data;
10979
10983
  }
10980
10984
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
10981
10985
  try {
10982
- const data = yield api.GET(`ui.view/${viewId}`, exports.Api.PrepReqParams(reqParams));
10986
+ let url = "ui.view/";
10987
+ if (viewId) {
10988
+ url += viewId;
10989
+ }
10990
+ let added = false;
10991
+ if (bookmarkId) {
10992
+ url += "?SlideID=" + encodeURIComponent(bookmarkId);
10993
+ added = true;
10994
+ }
10995
+ if (expand) {
10996
+ url += (added ? "&" : "?") + "Expand=" + encodeURIComponent(expand);
10997
+ added = true;
10998
+ }
10999
+ const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
10983
11000
  res({
10984
11001
  view: data
10985
11002
  });
@@ -11061,7 +11078,7 @@
11061
11078
  api = exports.ENVIRONMENT.Api().GetBruceApi();
11062
11079
  }
11063
11080
  yield api.DELETE(`ui.view/${viewId}`, exports.Api.PrepReqParams(reqParams));
11064
- api.Cache.Remove(GetCacheKey(viewId));
11081
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ProjectView);
11065
11082
  });
11066
11083
  }
11067
11084
  ProjectView.Delete = Delete;
@@ -11097,7 +11114,7 @@
11097
11114
  else {
11098
11115
  data = yield api.PUT(`ui.view/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
11099
11116
  }
11100
- api.Cache.Remove(GetCacheKey(data.ID));
11117
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ProjectView);
11101
11118
  return {
11102
11119
  view: data
11103
11120
  };
@@ -11111,11 +11128,13 @@
11111
11128
  * const key = GetCacheKey("abc");
11112
11129
  * api.Cache.Remove(key);
11113
11130
  * }
11114
- * @param viewId
11131
+ * @param viewId ID of the project view to get.
11132
+ * @param bookmarkId Optional bookmark ID related to the view we want to find.
11133
+ * @param expand Optional expand parameter.
11115
11134
  * @returns
11116
11135
  */
11117
- function GetCacheKey(viewId) {
11118
- return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.Id}${viewId}`;
11136
+ function GetCacheKey(viewId, bookmarkId, expand) {
11137
+ return `${exports.Api.ECacheKey.ProjectView}${exports.Api.ECacheKey.Id}${viewId || ""}${exports.Api.ECacheKey.ProjectViewBookmark}${bookmarkId || ""}${exports.Api.ECacheKey.Id}${expand ? (expand === true ? "true" : expand) : "false"}`;
11119
11138
  }
11120
11139
  ProjectView.GetCacheKey = GetCacheKey;
11121
11140
  })(exports.ProjectView || (exports.ProjectView = {}));
@@ -16118,7 +16137,7 @@
16118
16137
  })(exports.Tracking || (exports.Tracking = {}));
16119
16138
 
16120
16139
  // This is updated with the package.json version on build.
16121
- const VERSION = "6.7.4";
16140
+ const VERSION = "6.7.6";
16122
16141
 
16123
16142
  exports.VERSION = VERSION;
16124
16143
  exports.AbstractApi = AbstractApi;