bruce-models 7.1.36 → 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.
@@ -1926,7 +1926,8 @@
1926
1926
  parentId: params.parentId,
1927
1927
  search: params.search,
1928
1928
  withTilesets: params.withTilesets,
1929
- rootEntityId: params.rootEntityId
1929
+ rootEntityId: params.rootEntityId,
1930
+ entityTypeId: params.entityTypeId
1930
1931
  });
1931
1932
  assemblies.push(...result.assemblies);
1932
1933
  }
@@ -1960,10 +1961,10 @@
1960
1961
  for (let i = 0; i < params.ids.length; i++) {
1961
1962
  urlParams.append("ID", String(params.ids[i]));
1962
1963
  }
1963
- if (params.pageIndex != null) {
1964
+ if (params.pageIndex == null) {
1964
1965
  urlParams.append("PageIndex", String(0));
1965
1966
  }
1966
- if (params.pageSize != null) {
1967
+ if (params.pageSize == null) {
1967
1968
  urlParams.append("PageSize", String(params.ids.length));
1968
1969
  }
1969
1970
  }
@@ -1971,13 +1972,18 @@
1971
1972
  for (let i = 0; i < params.rootEntityId.length; i++) {
1972
1973
  urlParams.append("RootEntityID", params.rootEntityId[i]);
1973
1974
  }
1974
- if (params.pageIndex != null) {
1975
+ if (params.pageIndex == null) {
1975
1976
  urlParams.append("PageIndex", String(0));
1976
1977
  }
1977
- if (params.pageSize != null) {
1978
+ if (params.pageSize == null) {
1978
1979
  urlParams.append("PageSize", String(params.rootEntityId.length));
1979
1980
  }
1980
1981
  }
1982
+ if (params.entityTypeId != null) {
1983
+ for (let i = 0; i < params.entityTypeId.length; i++) {
1984
+ urlParams.append("EntityTypeID", params.entityTypeId[i]);
1985
+ }
1986
+ }
1981
1987
  url += "?" + urlParams.toString();
1982
1988
  const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
1983
1989
  const result = {};
@@ -2222,6 +2228,31 @@
2222
2228
  EHotspotSource["OCR"] = "OCR";
2223
2229
  EHotspotSource["AIImage"] = "AIImage";
2224
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;
2225
2256
  /**
2226
2257
  * Returns an annotated document by ID.
2227
2258
  * @param params
@@ -2317,6 +2348,32 @@
2317
2348
  });
2318
2349
  }
2319
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;
2320
2377
  /**
2321
2378
  * Suggests hotspots by scraping pages in a document view and matching by pattern.
2322
2379
  */
@@ -2402,6 +2459,13 @@
2402
2459
  return exports.Api.ECacheKey.AnnDocument + type + entityId + expandSettings + pageIndex + "_" + pageSize + "_" + search;
2403
2460
  }
2404
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
+ }
2405
2469
  })(exports.AnnDocument || (exports.AnnDocument = {}));
2406
2470
 
2407
2471
  (function (CustomForm) {
@@ -5000,7 +5064,7 @@
5000
5064
  if (!analysis) {
5001
5065
  entities = data.Items;
5002
5066
  }
5003
- totalCount = data.TotalCount;
5067
+ totalCount = data.Count ? data.Count : data.TotalCount;
5004
5068
  imports = data.Imports;
5005
5069
  sources = data.Source;
5006
5070
  entityTypeSources = data["EntityType.Source"];
@@ -5077,7 +5141,7 @@
5077
5141
  });
5078
5142
  }
5079
5143
  }
5080
- totalCount = data.TotalCount;
5144
+ totalCount = data.Count ? data.Count : data.TotalCount;
5081
5145
  imports = data.Imports;
5082
5146
  nextPage = data.NextPage;
5083
5147
  nextPageUrl = data.NextPageURL;
@@ -5104,7 +5168,7 @@
5104
5168
  nextPageUrl = data.NextPageURL;
5105
5169
  return {
5106
5170
  entities: data.Items,
5107
- totalCount: data.TotalCount,
5171
+ totalCount: data.Count ? data.Count : data.TotalCount,
5108
5172
  imports: data.Imports,
5109
5173
  nextPage: data.NextPage,
5110
5174
  nextPageUrl: data.NextPageURL,
@@ -17910,7 +17974,7 @@
17910
17974
  })(exports.ChangeSet || (exports.ChangeSet = {}));
17911
17975
 
17912
17976
  // This is updated with the package.json version on build.
17913
- const VERSION = "7.1.36";
17977
+ const VERSION = "7.1.38";
17914
17978
 
17915
17979
  exports.VERSION = VERSION;
17916
17980
  exports.AbstractApi = AbstractApi;