bruce-models 6.7.0 → 6.7.2

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.
@@ -10824,7 +10824,6 @@
10824
10824
  }
10825
10825
  yield api.DELETE(`ui.view/${viewId}/slide/${bookmarkId}`, exports.Api.PrepReqParams(reqParams));
10826
10826
  api.Cache.Remove(GetCacheKey(viewId, bookmarkId));
10827
- api.Cache.Remove(GetListCacheKey(viewId));
10828
10827
  });
10829
10828
  }
10830
10829
  ProjectViewBookmark.Delete = Delete;
@@ -10835,23 +10834,23 @@
10835
10834
  */
10836
10835
  function GetList(params) {
10837
10836
  return __awaiter(this, void 0, void 0, function* () {
10838
- let { api, viewId, req: reqParams } = params;
10837
+ let { api, viewId, req: reqParams, drafts } = params;
10839
10838
  if (!viewId) {
10840
10839
  throw ("View ID is required.");
10841
10840
  }
10842
10841
  if (!api) {
10843
10842
  api = exports.ENVIRONMENT.Api().GetBruceApi();
10844
10843
  }
10845
- const cache = api.GetCacheItem(GetListCacheKey(viewId), reqParams);
10846
- if (cache === null || cache === void 0 ? void 0 : cache.found) {
10847
- return cache.data;
10848
- }
10849
10844
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
10850
10845
  try {
10851
- const data = yield api.GET(`ui.view/${viewId}/slides`, exports.Api.PrepReqParams(reqParams));
10846
+ const query = new URLSearchParams();
10847
+ if (drafts) {
10848
+ query.set("Drafts", "true");
10849
+ }
10850
+ const url = `ui.view/${viewId}/slides?${query.toString()}`;
10851
+ const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
10852
10852
  const items = data.Items ? data.Items : [];
10853
10853
  // Cache individual items.
10854
- // Maybe better to load list cache when getting 1 slide and seeing if it's in there.
10855
10854
  // WARNING: Right now the data matches, in the future the list may contain a shortened result.
10856
10855
  for (let i = 0; i < items.length; i++) {
10857
10856
  const item = items[i];
@@ -10874,11 +10873,6 @@
10874
10873
  rej(e);
10875
10874
  }
10876
10875
  }));
10877
- api.SetCacheItem({
10878
- key: GetListCacheKey(viewId),
10879
- value: req,
10880
- req: reqParams
10881
- });
10882
10876
  return req;
10883
10877
  });
10884
10878
  }
@@ -10899,7 +10893,6 @@
10899
10893
  }
10900
10894
  const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, exports.Api.PrepReqParams(reqParams));
10901
10895
  api.Cache.Remove(GetCacheKey(viewId, data.ID));
10902
- api.Cache.Remove(GetListCacheKey(viewId));
10903
10896
  return {
10904
10897
  bookmark: res
10905
10898
  };
@@ -10921,7 +10914,6 @@
10921
10914
  "DisplayOrder.Start": 0
10922
10915
  };
10923
10916
  yield api.POST(`ui.view/${viewId}/slides/setOrder`, reqData, exports.Api.PrepReqParams(reqParams));
10924
- api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
10925
10917
  });
10926
10918
  }
10927
10919
  ProjectViewBookmark.SetOrder = SetOrder;
@@ -10940,20 +10932,6 @@
10940
10932
  return `${exports.Api.ECacheKey.ProjectViewBookmark}${exports.Api.ECacheKey.Id}${viewId}${exports.Api.ECacheKey.Id}${bookmarkId}`;
10941
10933
  }
10942
10934
  ProjectViewBookmark.GetCacheKey = GetCacheKey;
10943
- /**
10944
- * Returns cache identifier for a list of bookmarks.
10945
- * Example: {
10946
- * const api: BruceApi.Api = ...;
10947
- * const key = GetListCacheKey("abc");
10948
- * api.Cache.Remove(key);
10949
- * }
10950
- * @param viewId
10951
- * @returns
10952
- */
10953
- function GetListCacheKey(viewId) {
10954
- return `${exports.Api.ECacheKey.ProjectViewBookmark}${exports.Api.ECacheKey.Id}${viewId}`;
10955
- }
10956
- ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
10957
10935
  })(exports.ProjectViewBookmark || (exports.ProjectViewBookmark = {}));
10958
10936
 
10959
10937
  (function (ProjectView) {
@@ -12779,21 +12757,21 @@
12779
12757
  */
12780
12758
  function GetSettings(params) {
12781
12759
  return __awaiter(this, void 0, void 0, function* () {
12782
- let { api, userId, appId, req } = params;
12760
+ let { api, userId, appId, req, accountId } = params;
12783
12761
  if (!userId || !appId) {
12784
12762
  throw ("UserId and appId are required.");
12785
12763
  }
12786
12764
  if (!api) {
12787
12765
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12788
12766
  }
12789
- const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId);
12767
+ const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId);
12790
12768
  const cache = api.GetCacheItem(cacheKey, req);
12791
12769
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12792
12770
  return cache.data;
12793
12771
  }
12794
12772
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
12795
12773
  try {
12796
- const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
12774
+ const data = yield api.GET(`user/${userId}/application/${appId}/settings${accountId ? "?Account=" + accountId : ""}`);
12797
12775
  const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
12798
12776
  res({
12799
12777
  settings: settings
@@ -12830,21 +12808,24 @@
12830
12808
  */
12831
12809
  function UpdateSettings(params) {
12832
12810
  return __awaiter(this, void 0, void 0, function* () {
12833
- let { api, accId, userId, appId, settings, req, override } = params;
12811
+ let { api, accId, accountId, userId, appId, settings, req, override } = params;
12834
12812
  if (!userId || !appId) {
12835
12813
  throw ("UserId and appId are required.");
12836
12814
  }
12837
12815
  if (!api) {
12838
12816
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12839
12817
  }
12818
+ if (!accountId) {
12819
+ accountId = accId;
12820
+ }
12840
12821
  const postBody = {
12841
12822
  Settings: settings == null ? {} : settings,
12842
12823
  Application: appId,
12843
- ClientAccountID: accId,
12824
+ ClientAccountID: accountId,
12844
12825
  UserID: userId
12845
12826
  };
12846
12827
  const prom = api.POST(`user/${userId}/application/${appId}/settings?Override=${override ? "true" : "false"}`, postBody, req);
12847
- api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId));
12828
+ api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId, accountId));
12848
12829
  return prom;
12849
12830
  });
12850
12831
  }
@@ -13336,11 +13317,11 @@
13336
13317
  * @param appId
13337
13318
  * @returns
13338
13319
  */
13339
- function GetSettingsCacheKey(sessionId, userId, appId) {
13320
+ function GetSettingsCacheKey(sessionId, userId, appId, accountId) {
13340
13321
  if (!sessionId) {
13341
13322
  sessionId = "anonymous";
13342
13323
  }
13343
- return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserSettings + userId + exports.Api.ECacheKey.Id + appId;
13324
+ return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserSettings + userId + exports.Api.ECacheKey.Id + appId + (accountId ? exports.Api.ECacheKey.Id + accountId : "");
13344
13325
  }
13345
13326
  User.GetSettingsCacheKey = GetSettingsCacheKey;
13346
13327
  })(exports.User || (exports.User = {}));
@@ -16123,7 +16104,7 @@
16123
16104
  })(exports.Tracking || (exports.Tracking = {}));
16124
16105
 
16125
16106
  // This is updated with the package.json version on build.
16126
- const VERSION = "6.7.0";
16107
+ const VERSION = "6.7.2";
16127
16108
 
16128
16109
  exports.VERSION = VERSION;
16129
16110
  exports.AbstractApi = AbstractApi;