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.
@@ -11165,21 +11165,38 @@ var ProjectView;
11165
11165
  */
11166
11166
  function Get(params) {
11167
11167
  return __awaiter(this, void 0, void 0, function* () {
11168
- let { api, viewId, req: reqParams } = params;
11169
- if (!viewId) {
11170
- throw ("View ID is required.");
11168
+ let { api, viewId, bookmarkId, expand, req: reqParams } = params;
11169
+ if (!viewId && !bookmarkId) {
11170
+ throw ("View ID or Bookmark ID is required.");
11171
11171
  }
11172
11172
  if (!api) {
11173
11173
  api = ENVIRONMENT.Api().GetBruceApi();
11174
11174
  }
11175
- const key = GetCacheKey(viewId);
11175
+ // Same thing but keeps cache keys consistent.
11176
+ if (expand === true) {
11177
+ expand = "*";
11178
+ }
11179
+ const key = GetCacheKey(viewId, bookmarkId, expand);
11176
11180
  const cache = api.GetCacheItem(key, reqParams);
11177
11181
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11178
11182
  return cache.data;
11179
11183
  }
11180
11184
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
11181
11185
  try {
11182
- const data = yield api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
11186
+ let url = "ui.view/";
11187
+ if (viewId) {
11188
+ url += viewId;
11189
+ }
11190
+ let added = false;
11191
+ if (bookmarkId) {
11192
+ url += "?SlideID=" + encodeURIComponent(bookmarkId);
11193
+ added = true;
11194
+ }
11195
+ if (expand) {
11196
+ url += (added ? "&" : "?") + "Expand=" + encodeURIComponent(expand);
11197
+ added = true;
11198
+ }
11199
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
11183
11200
  res({
11184
11201
  view: data
11185
11202
  });
@@ -11261,7 +11278,7 @@ var ProjectView;
11261
11278
  api = ENVIRONMENT.Api().GetBruceApi();
11262
11279
  }
11263
11280
  yield api.DELETE(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
11264
- api.Cache.Remove(GetCacheKey(viewId));
11281
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.ProjectView);
11265
11282
  });
11266
11283
  }
11267
11284
  ProjectView.Delete = Delete;
@@ -11297,7 +11314,7 @@ var ProjectView;
11297
11314
  else {
11298
11315
  data = yield api.PUT(`ui.view/${data.ID}`, data, Api.PrepReqParams(reqParams));
11299
11316
  }
11300
- api.Cache.Remove(GetCacheKey(data.ID));
11317
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.ProjectView);
11301
11318
  return {
11302
11319
  view: data
11303
11320
  };
@@ -11311,11 +11328,13 @@ var ProjectView;
11311
11328
  * const key = GetCacheKey("abc");
11312
11329
  * api.Cache.Remove(key);
11313
11330
  * }
11314
- * @param viewId
11331
+ * @param viewId ID of the project view to get.
11332
+ * @param bookmarkId Optional bookmark ID related to the view we want to find.
11333
+ * @param expand Optional expand parameter.
11315
11334
  * @returns
11316
11335
  */
11317
- function GetCacheKey(viewId) {
11318
- return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.Id}${viewId}`;
11336
+ function GetCacheKey(viewId, bookmarkId, expand) {
11337
+ return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.Id}${viewId || ""}${Api.ECacheKey.ProjectViewBookmark}${bookmarkId || ""}${Api.ECacheKey.Id}${expand ? (expand === true ? "true" : expand) : "false"}`;
11319
11338
  }
11320
11339
  ProjectView.GetCacheKey = GetCacheKey;
11321
11340
  })(ProjectView || (ProjectView = {}));
@@ -16433,7 +16452,7 @@ var Tracking;
16433
16452
  })(Tracking || (Tracking = {}));
16434
16453
 
16435
16454
  // This is updated with the package.json version on build.
16436
- const VERSION = "6.7.4";
16455
+ const VERSION = "6.7.6";
16437
16456
 
16438
16457
  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, UserMfaMethod, 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 };
16439
16458
  //# sourceMappingURL=bruce-models.es5.js.map