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.
@@ -2228,6 +2228,31 @@
2228
2228
  EHotspotSource["OCR"] = "OCR";
2229
2229
  EHotspotSource["AIImage"] = "AIImage";
2230
2230
  })(EHotspotSource = AnnDocument.EHotspotSource || (AnnDocument.EHotspotSource = {}));
2231
+ /**
2232
+ * Uploads a PDF and creates a new annotated document.
2233
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2234
+ */
2235
+ function UploadPDF(params) {
2236
+ return __awaiter(this, void 0, void 0, function* () {
2237
+ let { api, file, detectHotspots, req } = params;
2238
+ if (!api) {
2239
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
2240
+ }
2241
+ if (!file) {
2242
+ throw ("File is required.");
2243
+ }
2244
+ req = exports.Api.PrepReqParams(req);
2245
+ if (detectHotspots) {
2246
+ req.formData = AddDetectHotspotsFormParam(req.formData);
2247
+ }
2248
+ const data = yield api.UPLOAD("documentView/new/uploadPDF", file, req);
2249
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AnnDocument);
2250
+ return {
2251
+ document: data
2252
+ };
2253
+ });
2254
+ }
2255
+ AnnDocument.UploadPDF = UploadPDF;
2231
2256
  /**
2232
2257
  * Returns an annotated document by ID.
2233
2258
  * @param params
@@ -2323,6 +2348,32 @@
2323
2348
  });
2324
2349
  }
2325
2350
  AnnDocument.GetList = GetList;
2351
+ /**
2352
+ * Creates or updates an annotated document.
2353
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2354
+ */
2355
+ function Update(params) {
2356
+ return __awaiter(this, void 0, void 0, function* () {
2357
+ let { api, document, detectHotspots, req: reqParams } = params;
2358
+ if (!api) {
2359
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
2360
+ }
2361
+ if (!document) {
2362
+ throw ("Document is required.");
2363
+ }
2364
+ const docId = document.ID || 0;
2365
+ let url = `documentView/${docId}`;
2366
+ if (detectHotspots) {
2367
+ url += "?DetectHotspots=true";
2368
+ }
2369
+ const data = yield api.POST(url, document, exports.Api.PrepReqParams(reqParams));
2370
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AnnDocument);
2371
+ return {
2372
+ document: data
2373
+ };
2374
+ });
2375
+ }
2376
+ AnnDocument.Update = Update;
2326
2377
  /**
2327
2378
  * Suggests hotspots by scraping pages in a document view and matching by pattern.
2328
2379
  */
@@ -2408,6 +2459,13 @@
2408
2459
  return exports.Api.ECacheKey.AnnDocument + type + entityId + expandSettings + pageIndex + "_" + pageSize + "_" + search;
2409
2460
  }
2410
2461
  AnnDocument.GetListCacheKey = GetListCacheKey;
2462
+ function AddDetectHotspotsFormParam(formData) {
2463
+ if (typeof FormData !== "undefined" && formData instanceof FormData) {
2464
+ formData.set("DetectHotspots", "true");
2465
+ return formData;
2466
+ }
2467
+ return Object.assign(Object.assign({}, formData), { DetectHotspots: "true" });
2468
+ }
2411
2469
  })(exports.AnnDocument || (exports.AnnDocument = {}));
2412
2470
 
2413
2471
  (function (CustomForm) {
@@ -5006,7 +5064,7 @@
5006
5064
  if (!analysis) {
5007
5065
  entities = data.Items;
5008
5066
  }
5009
- totalCount = data.TotalCount;
5067
+ totalCount = data.Count ? data.Count : data.TotalCount;
5010
5068
  imports = data.Imports;
5011
5069
  sources = data.Source;
5012
5070
  entityTypeSources = data["EntityType.Source"];
@@ -5083,7 +5141,7 @@
5083
5141
  });
5084
5142
  }
5085
5143
  }
5086
- totalCount = data.TotalCount;
5144
+ totalCount = data.Count ? data.Count : data.TotalCount;
5087
5145
  imports = data.Imports;
5088
5146
  nextPage = data.NextPage;
5089
5147
  nextPageUrl = data.NextPageURL;
@@ -5110,7 +5168,7 @@
5110
5168
  nextPageUrl = data.NextPageURL;
5111
5169
  return {
5112
5170
  entities: data.Items,
5113
- totalCount: data.TotalCount,
5171
+ totalCount: data.Count ? data.Count : data.TotalCount,
5114
5172
  imports: data.Imports,
5115
5173
  nextPage: data.NextPage,
5116
5174
  nextPageUrl: data.NextPageURL,
@@ -17916,7 +17974,7 @@
17916
17974
  })(exports.ChangeSet || (exports.ChangeSet = {}));
17917
17975
 
17918
17976
  // This is updated with the package.json version on build.
17919
- const VERSION = "7.1.37";
17977
+ const VERSION = "7.1.38";
17920
17978
 
17921
17979
  exports.VERSION = VERSION;
17922
17980
  exports.AbstractApi = AbstractApi;