bruce-models 7.1.109 → 7.1.111

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.
@@ -17574,6 +17574,34 @@ function parseObject$3(data) {
17574
17574
 
17575
17575
  var OntologyDocument;
17576
17576
  (function (OntologyDocument) {
17577
+ let ESummaryStatus;
17578
+ (function (ESummaryStatus) {
17579
+ // No summary is linked.
17580
+ ESummaryStatus["None"] = "none";
17581
+ // Produced from the PDF's current Version, so it can stand in for the PDF.
17582
+ ESummaryStatus["Current"] = "current";
17583
+ // Produced from another or an unknown Version. Keep it for review, but read the PDF instead.
17584
+ ESummaryStatus["Outdated"] = "outdated";
17585
+ })(ESummaryStatus = OntologyDocument.ESummaryStatus || (OntologyDocument.ESummaryStatus = {}));
17586
+ /**
17587
+ * Returns whether the record's summary may be used in place of its PDF.
17588
+ * It is only current while its file exists and it was produced from the PDF's current Version.
17589
+ * An unknown version counts as outdated, so a replaced PDF never passes its old summary off as current.
17590
+ * @param record Record as returned by the API, including its nested ClientFile and SummaryClientFile.
17591
+ */
17592
+ function GetSummaryStatus(record) {
17593
+ var _a;
17594
+ if (!(record === null || record === void 0 ? void 0 : record["SummaryClientFile.ID"])) {
17595
+ return ESummaryStatus.None;
17596
+ }
17597
+ const sourceVersion = record.SummarySourceVersion;
17598
+ const currentVersion = (_a = record.ClientFile) === null || _a === void 0 ? void 0 : _a.Version;
17599
+ if (!record.SummaryClientFile || sourceVersion == null || currentVersion == null) {
17600
+ return ESummaryStatus.Outdated;
17601
+ }
17602
+ return Number(sourceVersion) === Number(currentVersion) ? ESummaryStatus.Current : ESummaryStatus.Outdated;
17603
+ }
17604
+ OntologyDocument.GetSummaryStatus = GetSummaryStatus;
17577
17605
  function GetListByOntologyId(params) {
17578
17606
  return __awaiter(this, void 0, void 0, function* () {
17579
17607
  let { api, ontologyId, req: reqParams } = params;
@@ -17642,6 +17670,44 @@ var OntologyDocument;
17642
17670
  });
17643
17671
  }
17644
17672
  OntologyDocument.GetListByClientFileId = GetListByClientFileId;
17673
+ /**
17674
+ * Returns the documents that use the given ClientFile as their summary.
17675
+ * GetListByClientFileId() only matches documents made of the file, so check both before deleting a file.
17676
+ */
17677
+ function GetListBySummaryClientFileId(params) {
17678
+ return __awaiter(this, void 0, void 0, function* () {
17679
+ let { api, clientFileId, req: reqParams } = params;
17680
+ if (!clientFileId) {
17681
+ throw ("Client file ID is required.");
17682
+ }
17683
+ if (!api) {
17684
+ api = ENVIRONMENT.Api().GetBruceApi();
17685
+ }
17686
+ const key = GetSummaryListCacheKey(clientFileId);
17687
+ const cache = api.GetCacheItem(key, reqParams);
17688
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
17689
+ return cache.data;
17690
+ }
17691
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
17692
+ try {
17693
+ const data = yield api.GET(`ontology/documents?summary_client_file_id=${encodeURIComponent(clientFileId)}`, Api.PrepReqParams(reqParams));
17694
+ res({
17695
+ ontologyDocuments: ParseListResponse(data)
17696
+ });
17697
+ }
17698
+ catch (e) {
17699
+ rej(e);
17700
+ }
17701
+ }));
17702
+ api.SetCacheItem({
17703
+ key,
17704
+ value: req,
17705
+ req: reqParams
17706
+ });
17707
+ return req;
17708
+ });
17709
+ }
17710
+ OntologyDocument.GetListBySummaryClientFileId = GetListBySummaryClientFileId;
17645
17711
  function Update(params) {
17646
17712
  return __awaiter(this, void 0, void 0, function* () {
17647
17713
  let { api, ontologyDocument: data, req: reqParams } = params;
@@ -17655,7 +17721,8 @@ var OntologyDocument;
17655
17721
  if (data.ID) {
17656
17722
  api.Cache.Remove(GetCacheKey(data.ID));
17657
17723
  }
17658
- api.Cache.RemoveByStartsWith(GetListCacheKey(data["Ontology.ID"]));
17724
+ // A save can move a document in or out of any list, eg: by linking a different summary file.
17725
+ api.Cache.RemoveByStartsWith(GetListCacheKeyPrefix());
17659
17726
  return {
17660
17727
  ontologyDocument: ParseResponse(res)
17661
17728
  };
@@ -17673,7 +17740,8 @@ var OntologyDocument;
17673
17740
  }
17674
17741
  yield api.DELETE(`ontology/document/${documentId}`, Api.PrepReqParams(reqParams));
17675
17742
  api.Cache.Remove(GetCacheKey(documentId));
17676
- api.Cache.RemoveByStartsWith(GetListCacheKey(documentId));
17743
+ // Only the document ID is known here, not the lists it was part of.
17744
+ api.Cache.RemoveByStartsWith(GetListCacheKeyPrefix());
17677
17745
  });
17678
17746
  }
17679
17747
  OntologyDocument.Delete = Delete;
@@ -17700,9 +17768,18 @@ var OntologyDocument;
17700
17768
  }
17701
17769
  OntologyDocument.GetCacheKey = GetCacheKey;
17702
17770
  function GetListCacheKey(id) {
17703
- return Api.ECacheKey.Ontology + ":documents:" + id;
17771
+ return GetListCacheKeyPrefix() + id;
17704
17772
  }
17705
17773
  OntologyDocument.GetListCacheKey = GetListCacheKey;
17774
+ function GetSummaryListCacheKey(clientFileId) {
17775
+ return GetListCacheKeyPrefix() + "summary:" + clientFileId;
17776
+ }
17777
+ OntologyDocument.GetSummaryListCacheKey = GetSummaryListCacheKey;
17778
+ // Shared by every document list cache key.
17779
+ function GetListCacheKeyPrefix() {
17780
+ return Api.ECacheKey.Ontology + ":documents:";
17781
+ }
17782
+ OntologyDocument.GetListCacheKeyPrefix = GetListCacheKeyPrefix;
17706
17783
  })(OntologyDocument || (OntologyDocument = {}));
17707
17784
  function parseObject$4(data) {
17708
17785
  if (data == null || data == undefined) {
@@ -24956,7 +25033,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
24956
25033
  }
24957
25034
 
24958
25035
  // This is updated with the package.json version on build.
24959
- const VERSION = "7.1.109";
25036
+ const VERSION = "7.1.111";
24960
25037
 
24961
25038
  export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, RequestLane, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeSource, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, WorkflowItem, WorkflowSchedule, WorkflowType, WorkflowItemType };
24962
25039
  //# sourceMappingURL=bruce-models.es5.js.map