bruce-models 7.1.3 → 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: {
@@ -14870,6 +14927,29 @@
14870
14927
  });
14871
14928
  }
14872
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;
14873
14953
  /**
14874
14954
  * Runs a DataLab query.
14875
14955
  * @param params
@@ -15102,6 +15182,7 @@
15102
15182
  })(exports.ImportCsv || (exports.ImportCsv = {}));
15103
15183
 
15104
15184
  (function (ImportJson) {
15185
+ const IMPORT_ONTOLOGY_ENDPOINT = "import/json/ontology";
15105
15186
  function ImportEntities(params) {
15106
15187
  return __awaiter(this, void 0, void 0, function* () {
15107
15188
  let { api, fileImport, req: reqParams } = params;
@@ -15112,6 +15193,71 @@
15112
15193
  });
15113
15194
  }
15114
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
+ }
15115
15261
  })(exports.ImportJson || (exports.ImportJson = {}));
15116
15262
 
15117
15263
  (function (ImportGeoJson) {
@@ -16654,7 +16800,7 @@
16654
16800
  })(exports.ChangeSet || (exports.ChangeSet = {}));
16655
16801
 
16656
16802
  // This is updated with the package.json version on build.
16657
- const VERSION = "7.1.3";
16803
+ const VERSION = "7.1.4";
16658
16804
 
16659
16805
  exports.VERSION = VERSION;
16660
16806
  exports.AbstractApi = AbstractApi;