bruce-models 7.1.2 → 7.1.4

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.
@@ -2127,7 +2127,25 @@
2127
2127
  let EType;
2128
2128
  (function (EType) {
2129
2129
  EType["SVG"] = "SVG";
2130
+ EType["PDF"] = "PDF";
2130
2131
  })(EType = AnnDocument.EType || (AnnDocument.EType = {}));
2132
+ /**
2133
+ * Known status values for document hotspots.
2134
+ */
2135
+ let EHotspotStatus;
2136
+ (function (EHotspotStatus) {
2137
+ EHotspotStatus["Suggested"] = "Suggested";
2138
+ })(EHotspotStatus = AnnDocument.EHotspotStatus || (AnnDocument.EHotspotStatus = {}));
2139
+ /**
2140
+ * Known extraction sources for document hotspots.
2141
+ */
2142
+ let EHotspotSource;
2143
+ (function (EHotspotSource) {
2144
+ EHotspotSource["TextExtraction"] = "TextExtraction";
2145
+ EHotspotSource["SVGTextExtraction"] = "SVGTextExtraction";
2146
+ EHotspotSource["PDFTextExtraction"] = "PDFTextExtraction";
2147
+ EHotspotSource["OCR"] = "OCR";
2148
+ })(EHotspotSource = AnnDocument.EHotspotSource || (AnnDocument.EHotspotSource = {}));
2131
2149
  /**
2132
2150
  * Returns an annotated document by ID.
2133
2151
  * @param params
@@ -2220,6 +2238,25 @@
2220
2238
  });
2221
2239
  }
2222
2240
  AnnDocument.GetList = GetList;
2241
+ /**
2242
+ * Suggests hotspots by scraping pages in a document view and matching by pattern.
2243
+ */
2244
+ function SuggestHotspots(params) {
2245
+ return __awaiter(this, void 0, void 0, function* () {
2246
+ let { api, docId, body, req: reqParams } = params;
2247
+ if (!docId) {
2248
+ throw ("Doc ID is required.");
2249
+ }
2250
+ if (!api) {
2251
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
2252
+ }
2253
+ if (!body) {
2254
+ body = {};
2255
+ }
2256
+ return api.POST(`documentView/${docId}/suggestHotspots`, body, exports.Api.PrepReqParams(reqParams));
2257
+ });
2258
+ }
2259
+ AnnDocument.SuggestHotspots = SuggestHotspots;
2223
2260
  /**
2224
2261
  * Returns cache identifier for an annotated document by ID.
2225
2262
  * Example: {
@@ -3411,6 +3448,26 @@
3411
3448
  });
3412
3449
  }
3413
3450
  EntityType.Count = Count;
3451
+ /**
3452
+ * Suggests additional Data Schema attributes for the specified Entity Type.
3453
+ * This calls: POST v1/entityType/{entityType_id}/DataSchema/Suggest
3454
+ */
3455
+ function SuggestDataSchemaByPrompt(params) {
3456
+ return __awaiter(this, void 0, void 0, function* () {
3457
+ let { api, entityTypeId, body, req } = params;
3458
+ if (!entityTypeId) {
3459
+ throw ("Type ID is required.");
3460
+ }
3461
+ if (!(body === null || body === void 0 ? void 0 : body.Prompt)) {
3462
+ throw ("Prompt is required.");
3463
+ }
3464
+ if (!api) {
3465
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
3466
+ }
3467
+ return api.POST(`v1/entityType/${entityTypeId}/DataSchema/Suggest`, body, exports.Api.PrepReqParams(req));
3468
+ });
3469
+ }
3470
+ EntityType.SuggestDataSchemaByPrompt = SuggestDataSchemaByPrompt;
3414
3471
  /**
3415
3472
  * Returns cache identifier for an entity type.
3416
3473
  * Example: {
@@ -13793,11 +13850,15 @@
13793
13850
  */
13794
13851
  function GetByCode(params) {
13795
13852
  return __awaiter(this, void 0, void 0, function* () {
13796
- let { api, code, req } = params;
13853
+ let { api, code, req, expand } = params;
13797
13854
  if (!api) {
13798
13855
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
13799
13856
  }
13800
- const invite = yield api.GET(`v3/accountInvite?InviteCode=${code}`, exports.Api.PrepReqParams(req));
13857
+ let url = `v3/accountInvite?InviteCode=${code}`;
13858
+ if (expand) {
13859
+ url += "&Expand=" + expand;
13860
+ }
13861
+ const invite = yield api.GET(url, exports.Api.PrepReqParams(req));
13801
13862
  return {
13802
13863
  invite: invite
13803
13864
  };
@@ -14866,6 +14927,29 @@
14866
14927
  });
14867
14928
  }
14868
14929
  DataLab.Get = Get;
14930
+ /**
14931
+ * Suggests a DataLab query from natural language prompt.
14932
+ * This calls: POST entities/datalab/suggestDataLabQueryByPrompt
14933
+ */
14934
+ function SuggestDataLabQueryByPrompt(params) {
14935
+ var _a, _b, _c;
14936
+ return __awaiter(this, void 0, void 0, function* () {
14937
+ let { api, body, req } = params;
14938
+ if (!(body === null || body === void 0 ? void 0 : body.Prompt)) {
14939
+ throw new Error("Prompt is required.");
14940
+ }
14941
+ if (!api) {
14942
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
14943
+ }
14944
+ const res = yield api.POST("entities/datalab/suggestDataLabQueryByPrompt", body, req ? exports.Api.PrepReqParams(req) : undefined);
14945
+ const raw = res;
14946
+ return {
14947
+ query: (_c = (_b = (_a = raw === null || raw === void 0 ? void 0 : raw.Query) !== null && _a !== void 0 ? _a : raw === null || raw === void 0 ? void 0 : raw.SuggestedQuery) !== null && _b !== void 0 ? _b : raw === null || raw === void 0 ? void 0 : raw.DataLabQuery) !== null && _c !== void 0 ? _c : raw,
14948
+ warnings: raw === null || raw === void 0 ? void 0 : raw.Warnings
14949
+ };
14950
+ });
14951
+ }
14952
+ DataLab.SuggestDataLabQueryByPrompt = SuggestDataLabQueryByPrompt;
14869
14953
  /**
14870
14954
  * Runs a DataLab query.
14871
14955
  * @param params
@@ -15098,6 +15182,7 @@
15098
15182
  })(exports.ImportCsv || (exports.ImportCsv = {}));
15099
15183
 
15100
15184
  (function (ImportJson) {
15185
+ const IMPORT_ONTOLOGY_ENDPOINT = "import/json/ontology";
15101
15186
  function ImportEntities(params) {
15102
15187
  return __awaiter(this, void 0, void 0, function* () {
15103
15188
  let { api, fileImport, req: reqParams } = params;
@@ -15108,6 +15193,71 @@
15108
15193
  });
15109
15194
  }
15110
15195
  ImportJson.ImportEntities = ImportEntities;
15196
+ /**
15197
+ * Starts JSON ontology import.
15198
+ * Endpoint: POST import/json/ontology
15199
+ */
15200
+ function ImportOntology(params) {
15201
+ return __awaiter(this, void 0, void 0, function* () {
15202
+ let { api, ontologyImport, req: reqParams } = params;
15203
+ if (!api) {
15204
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
15205
+ }
15206
+ const res = yield api.POST(IMPORT_ONTOLOGY_ENDPOINT, ontologyImport, reqParams ? exports.Api.PrepReqParams(reqParams) : undefined);
15207
+ return ParseImportOntologyResponse(res);
15208
+ });
15209
+ }
15210
+ ImportJson.ImportOntology = ImportOntology;
15211
+ /**
15212
+ * Normalizes response from ImportOntology.
15213
+ * Supports both direct response payloads and wrapper shapes.
15214
+ */
15215
+ function ParseImportOntologyResponse(response) {
15216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15217
+ const parsed = parseObject(response);
15218
+ const parsedResult = (_c = (_b = parseObject((_a = parsed === null || parsed === void 0 ? void 0 : parsed.Result) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.ImportResult)) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.Result) !== null && _c !== void 0 ? _c : parsed === null || parsed === void 0 ? void 0 : parsed.ImportResult;
15219
+ const pendingActionId = (_j = (_h = (_g = (_e = (_d = parsed === null || parsed === void 0 ? void 0 : parsed.PendingActionID) !== null && _d !== void 0 ? _d : parsed === null || parsed === void 0 ? void 0 : parsed["PendingAction.ID"]) !== null && _e !== void 0 ? _e : (_f = parsed === null || parsed === void 0 ? void 0 : parsed.PendingAction) === null || _f === void 0 ? void 0 : _f.ID) !== null && _g !== void 0 ? _g : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.PendingActionID) !== null && _h !== void 0 ? _h : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult["PendingAction.ID"]) !== null && _j !== void 0 ? _j : (_k = parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.PendingAction) === null || _k === void 0 ? void 0 : _k.ID;
15220
+ return {
15221
+ pendingActionId: pendingActionId,
15222
+ warnings: (_l = parsed === null || parsed === void 0 ? void 0 : parsed.Warnings) !== null && _l !== void 0 ? _l : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Warnings,
15223
+ errors: (_m = parsed === null || parsed === void 0 ? void 0 : parsed.Errors) !== null && _m !== void 0 ? _m : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Errors,
15224
+ raw: parsed
15225
+ };
15226
+ }
15227
+ ImportJson.ParseImportOntologyResponse = ParseImportOntologyResponse;
15228
+ /**
15229
+ * Parses pending-action result payload produced by ontology import.
15230
+ */
15231
+ function ParseOntologyImportResult(paResult) {
15232
+ var _a, _b, _c, _d;
15233
+ const parsed = parseObject(paResult);
15234
+ if (!parsed) {
15235
+ return {
15236
+ raw: null
15237
+ };
15238
+ }
15239
+ const rawResult = (_d = (_c = (_b = parseObject((_a = parsed === null || parsed === void 0 ? void 0 : parsed.Result) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.ImportResult)) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.Result) !== null && _c !== void 0 ? _c : parsed === null || parsed === void 0 ? void 0 : parsed.ImportResult) !== null && _d !== void 0 ? _d : parsed;
15240
+ return {
15241
+ warnings: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Warnings,
15242
+ errors: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Errors,
15243
+ raw: rawResult
15244
+ };
15245
+ }
15246
+ ImportJson.ParseOntologyImportResult = ParseOntologyImportResult;
15247
+ function parseObject(data) {
15248
+ if (data == null || data == undefined) {
15249
+ return null;
15250
+ }
15251
+ if (typeof data == "string") {
15252
+ try {
15253
+ return JSON.parse(data);
15254
+ }
15255
+ catch (_a) {
15256
+ return null;
15257
+ }
15258
+ }
15259
+ return data;
15260
+ }
15111
15261
  })(exports.ImportJson || (exports.ImportJson = {}));
15112
15262
 
15113
15263
  (function (ImportGeoJson) {
@@ -16650,7 +16800,7 @@
16650
16800
  })(exports.ChangeSet || (exports.ChangeSet = {}));
16651
16801
 
16652
16802
  // This is updated with the package.json version on build.
16653
- const VERSION = "7.1.2";
16803
+ const VERSION = "7.1.4";
16654
16804
 
16655
16805
  exports.VERSION = VERSION;
16656
16806
  exports.AbstractApi = AbstractApi;