bruce-models 7.1.37 → 7.1.38

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.
@@ -2255,6 +2255,31 @@ var AnnDocument;
2255
2255
  EHotspotSource["OCR"] = "OCR";
2256
2256
  EHotspotSource["AIImage"] = "AIImage";
2257
2257
  })(EHotspotSource = AnnDocument.EHotspotSource || (AnnDocument.EHotspotSource = {}));
2258
+ /**
2259
+ * Uploads a PDF and creates a new annotated document.
2260
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2261
+ */
2262
+ function UploadPDF(params) {
2263
+ return __awaiter(this, void 0, void 0, function* () {
2264
+ let { api, file, detectHotspots, req } = params;
2265
+ if (!api) {
2266
+ api = ENVIRONMENT.Api().GetBruceApi();
2267
+ }
2268
+ if (!file) {
2269
+ throw ("File is required.");
2270
+ }
2271
+ req = Api.PrepReqParams(req);
2272
+ if (detectHotspots) {
2273
+ req.formData = AddDetectHotspotsFormParam(req.formData);
2274
+ }
2275
+ const data = yield api.UPLOAD("documentView/new/uploadPDF", file, req);
2276
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AnnDocument);
2277
+ return {
2278
+ document: data
2279
+ };
2280
+ });
2281
+ }
2282
+ AnnDocument.UploadPDF = UploadPDF;
2258
2283
  /**
2259
2284
  * Returns an annotated document by ID.
2260
2285
  * @param params
@@ -2350,6 +2375,32 @@ var AnnDocument;
2350
2375
  });
2351
2376
  }
2352
2377
  AnnDocument.GetList = GetList;
2378
+ /**
2379
+ * Creates or updates an annotated document.
2380
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2381
+ */
2382
+ function Update(params) {
2383
+ return __awaiter(this, void 0, void 0, function* () {
2384
+ let { api, document, detectHotspots, req: reqParams } = params;
2385
+ if (!api) {
2386
+ api = ENVIRONMENT.Api().GetBruceApi();
2387
+ }
2388
+ if (!document) {
2389
+ throw ("Document is required.");
2390
+ }
2391
+ const docId = document.ID || 0;
2392
+ let url = `documentView/${docId}`;
2393
+ if (detectHotspots) {
2394
+ url += "?DetectHotspots=true";
2395
+ }
2396
+ const data = yield api.POST(url, document, Api.PrepReqParams(reqParams));
2397
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AnnDocument);
2398
+ return {
2399
+ document: data
2400
+ };
2401
+ });
2402
+ }
2403
+ AnnDocument.Update = Update;
2353
2404
  /**
2354
2405
  * Suggests hotspots by scraping pages in a document view and matching by pattern.
2355
2406
  */
@@ -2435,6 +2486,13 @@ var AnnDocument;
2435
2486
  return Api.ECacheKey.AnnDocument + type + entityId + expandSettings + pageIndex + "_" + pageSize + "_" + search;
2436
2487
  }
2437
2488
  AnnDocument.GetListCacheKey = GetListCacheKey;
2489
+ function AddDetectHotspotsFormParam(formData) {
2490
+ if (typeof FormData !== "undefined" && formData instanceof FormData) {
2491
+ formData.set("DetectHotspots", "true");
2492
+ return formData;
2493
+ }
2494
+ return Object.assign(Object.assign({}, formData), { DetectHotspots: "true" });
2495
+ }
2438
2496
  })(AnnDocument || (AnnDocument = {}));
2439
2497
 
2440
2498
  /**
@@ -5055,7 +5113,7 @@ var Entity;
5055
5113
  if (!analysis) {
5056
5114
  entities = data.Items;
5057
5115
  }
5058
- totalCount = data.TotalCount;
5116
+ totalCount = data.Count ? data.Count : data.TotalCount;
5059
5117
  imports = data.Imports;
5060
5118
  sources = data.Source;
5061
5119
  entityTypeSources = data["EntityType.Source"];
@@ -5132,7 +5190,7 @@ var Entity;
5132
5190
  });
5133
5191
  }
5134
5192
  }
5135
- totalCount = data.TotalCount;
5193
+ totalCount = data.Count ? data.Count : data.TotalCount;
5136
5194
  imports = data.Imports;
5137
5195
  nextPage = data.NextPage;
5138
5196
  nextPageUrl = data.NextPageURL;
@@ -5159,7 +5217,7 @@ var Entity;
5159
5217
  nextPageUrl = data.NextPageURL;
5160
5218
  return {
5161
5219
  entities: data.Items,
5162
- totalCount: data.TotalCount,
5220
+ totalCount: data.Count ? data.Count : data.TotalCount,
5163
5221
  imports: data.Imports,
5164
5222
  nextPage: data.NextPage,
5165
5223
  nextPageUrl: data.NextPageURL,
@@ -18251,7 +18309,7 @@ var ChangeSet;
18251
18309
  })(ChangeSet || (ChangeSet = {}));
18252
18310
 
18253
18311
  // This is updated with the package.json version on build.
18254
- const VERSION = "7.1.37";
18312
+ const VERSION = "7.1.38";
18255
18313
 
18256
18314
  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, EntityTypeTrigger, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, DashboardView, 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, DataTransform, DataLabGroup, DataFeed, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportLcc, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
18257
18315
  //# sourceMappingURL=bruce-models.es5.js.map