UNPKG

mindee

Version:

Mindee Client Library for Node.js

25 lines (24 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GeneratedV1 = void 0; const common_1 = require("../../../src/parsing/common"); const generatedV1Document_1 = require("./generatedV1Document"); const generatedV1Page_1 = require("./generatedV1Page"); /** * Generated API V1 inference results. */ class GeneratedV1 extends common_1.Inference { constructor(rawPrediction) { super(rawPrediction); /** The endpoint's name. Note: placeholder for custom APIs. */ this.endpointName = "custom"; /** The endpoint's version. Note: placeholder for custom APIs. */ this.endpointVersion = "1"; /** The document's pages. */ this.pages = []; this.prediction = new generatedV1Document_1.GeneratedV1Document(rawPrediction["prediction"]); this.pages = rawPrediction["pages"].length > 0 && Object.keys(rawPrediction["pages"][0]["prediction"]).length > 0 ? rawPrediction["pages"].map((page) => new common_1.Page(generatedV1Page_1.GeneratedV1Page, page, page["id"])) : []; } } exports.GeneratedV1 = GeneratedV1;