Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mindee

Package Overview
Dependencies
Maintainers
7
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mindee - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

8

CHANGELOG.md
# CHANGELOG
## v4.0.2 - 2023-08-24
### Changes
* :recycle: updated technical documentation
### Fixes
* :bug: fix url source document not being sent properly
## v4.0.1 - 2023-08-22

@@ -4,0 +12,0 @@ ### Fixes

2

package.json
{
"name": "mindee",
"version": "4.0.1",
"version": "4.0.2",
"description": "Mindee Client Library for Node.js",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -7,6 +7,7 @@ /// <reference types="node" />

import { Inference, AsyncPredictResponse, StringDict, PredictResponse } from "./parsing/common";
/**
* Options relating to predictions.
*/
export interface PredictOptions {
endpointName?: string;
accountName?: string;
endpointVersion?: string;
/** A custom endpoint. */
endpoint?: Endpoint;

@@ -25,14 +26,7 @@ /**

cropper?: boolean;
pageOptions?: PageOptions;
}
export interface CustomConfigParams {
/** Your organization's username on the API Builder. */
accountName: string;
/** The "API name" field in the "Settings" page of the API Builder. */
endpointName: string;
/**
* If set, locks the version of the model to use.
* If not set, use the latest version of the model.
* If set, remove pages from the document as specified.
* This is done before sending the file to the server and is useful to avoid page limitations.
*/
version?: string;
pageOptions?: PageOptions;
}

@@ -48,9 +42,12 @@ export interface ClientOptions {

/**
* Mindee Client
* Mindee Client class that centralizes most basic operations.
*
* @category Client
*/
export declare class Client {
#private;
/** Key of the API. */
protected apiKey: string;
/**
* @param options
* @param options options for the initialization of a client.
*/

@@ -60,4 +57,10 @@ constructor({ apiKey, throwOnError, debug }?: ClientOptions);

* Send a document to a synchronous endpoint and parse the predictions.
* @param productClass
* @param params
*
* @param productClass product class to use for calling the API and parsing the response.
* @param inputSource document to parse.
* @param params parameters relating to prediction options.
*
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
* @category Synchronous
* @returns a `Promise` containing parsing results.
*/

@@ -67,14 +70,37 @@ parse<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, params?: PredictOptions): Promise<PredictResponse<T>>;

* Send the document to an asynchronous endpoint and return its ID in the queue.
* @param productClass
* @param params
* @param productClass product class to use for calling the API and parsing the response.
* @param params parameters relating to prediction options.
* @category Asynchronous
*
* @returns a `Promise` containing the job (queue) corresponding to a document.
*/
enqueue<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, params?: PredictOptions): Promise<AsyncPredictResponse<T>>;
/**
* Polls a queue and returns its status as well as the prediction results if the parsing is done.
*
* @param productClass product class to use for calling the API and parsing the response.
* @param queueId id of the queue to poll.
* @param params parameters relating to prediction options.
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
* @category Asynchronous
*
* @returns a `Promise` containing a `Job`, which also contains a `Document` if the
* parsing is complete.
*/
parseQueued<T extends Inference>(productClass: new (httpResponse: StringDict) => T, queueId: string, params?: PredictOptions): Promise<AsyncPredictResponse<T>>;
/**
* Forces boolean coercion on truthy/falsy parameters.
* @param param input parameter to check.
* @returns a strict boolean value.
*/
protected getBooleanParam(param?: boolean): boolean;
/**
* Creates a custom endpoint with the given values. Raises an error if the endpoint is invalid.
* @param productClass Class of the product
* @param endpointName Name of a custom Endpoint
* @param accountName Name of the account tied to the active Endpoint
* @param version Version of a custom Endpoint
* @param productClass product class to use for calling the API and parsing the response.
* @param endpointName Name of the custom Endpoint.
* @param accountName Name of the account tied to the Endpoint.
* @param version Version of the custom Endpoint.
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
*
* @returns a new endpoint
*/

@@ -89,4 +115,4 @@ createEndpoint(endpointName: string, accountName: string, endpointVersion?: string): Endpoint;

* Load an input document from a base64 encoded string.
* @param inputString
* @param filename
* @param inputString input content, as a string.
* @param filename file name.
*/

@@ -96,4 +122,4 @@ docFromBase64(inputString: string, filename: string): InputSource;

* Load an input document from a `stream.Readable` object.
* @param inputStream
* @param filename
* @param inputStream input content, as a readable stream.
* @param filename file name.
*/

@@ -103,4 +129,4 @@ docFromStream(inputStream: Readable, filename: string): InputSource;

* Load an input document from a bytes string.
* @param inputBytes
* @param filename
* @param inputBytes input content, as readable bytes.
* @param filename file name.
*/

@@ -110,3 +136,3 @@ docFromBytes(inputBytes: string, filename: string): InputSource;

* Load an input document from a URL.
* @param url
* @param url input url. Must be HTTPS.
*/

@@ -116,6 +142,6 @@ docFromUrl(url: string): InputSource;

* Load an input document from a Buffer.
* @param buffer
* @param filename
* @param buffer input content, as a buffer.
* @param filename file name.
*/
docFromBuffer(buffer: Buffer, filename: string): InputSource;
}

@@ -18,7 +18,9 @@ "use strict";

/**
* Mindee Client
* Mindee Client class that centralizes most basic operations.
*
* @category Client
*/
class Client {
/**
* @param options
* @param options options for the initialization of a client.
*/

@@ -41,4 +43,10 @@ constructor({ apiKey, throwOnError, debug } = {

* Send a document to a synchronous endpoint and parse the predictions.
* @param productClass
* @param params
*
* @param productClass product class to use for calling the API and parsing the response.
* @param inputSource document to parse.
* @param params parameters relating to prediction options.
*
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
* @category Synchronous
* @returns a `Promise` containing parsing results.
*/

@@ -65,4 +73,7 @@ async parse(productClass, inputSource, params = {

* Send the document to an asynchronous endpoint and return its ID in the queue.
* @param productClass
* @param params
* @param productClass product class to use for calling the API and parsing the response.
* @param params parameters relating to prediction options.
* @category Asynchronous
*
* @returns a `Promise` containing the job (queue) corresponding to a document.
*/

@@ -82,2 +93,14 @@ async enqueue(productClass, inputSource, params = {}) {

}
/**
* Polls a queue and returns its status as well as the prediction results if the parsing is done.
*
* @param productClass product class to use for calling the API and parsing the response.
* @param queueId id of the queue to poll.
* @param params parameters relating to prediction options.
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
* @category Asynchronous
*
* @returns a `Promise` containing a `Job`, which also contains a `Document` if the
* parsing is complete.
*/
async parseQueued(productClass, queueId, params = {}) {

@@ -88,2 +111,7 @@ const endpoint = params?.endpoint ?? __classPrivateFieldGet(this, _Client_instances, "m", _Client_initializeOTSEndpoint).call(this, productClass);

}
/**
* Forces boolean coercion on truthy/falsy parameters.
* @param param input parameter to check.
* @returns a strict boolean value.
*/
getBooleanParam(param) {

@@ -94,6 +122,9 @@ return param !== undefined ? param : false;

* Creates a custom endpoint with the given values. Raises an error if the endpoint is invalid.
* @param productClass Class of the product
* @param endpointName Name of a custom Endpoint
* @param accountName Name of the account tied to the active Endpoint
* @param version Version of a custom Endpoint
* @param productClass product class to use for calling the API and parsing the response.
* @param endpointName Name of the custom Endpoint.
* @param accountName Name of the account tied to the Endpoint.
* @param version Version of the custom Endpoint.
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
*
* @returns a new endpoint
*/

@@ -126,4 +157,4 @@ createEndpoint(endpointName, accountName, endpointVersion) {

* Load an input document from a base64 encoded string.
* @param inputString
* @param filename
* @param inputString input content, as a string.
* @param filename file name.
*/

@@ -138,4 +169,4 @@ docFromBase64(inputString, filename) {

* Load an input document from a `stream.Readable` object.
* @param inputStream
* @param filename
* @param inputStream input content, as a readable stream.
* @param filename file name.
*/

@@ -150,4 +181,4 @@ docFromStream(inputStream, filename) {

* Load an input document from a bytes string.
* @param inputBytes
* @param filename
* @param inputBytes input content, as readable bytes.
* @param filename file name.
*/

@@ -162,3 +193,3 @@ docFromBytes(inputBytes, filename) {

* Load an input document from a URL.
* @param url
* @param url input url. Must be HTTPS.
*/

@@ -172,4 +203,4 @@ docFromUrl(url) {

* Load an input document from a Buffer.
* @param buffer
* @param filename
* @param buffer input content, as a buffer.
* @param filename file name.
*/

@@ -176,0 +207,0 @@ docFromBuffer(buffer, filename) {

@@ -35,3 +35,3 @@ "use strict";

const statusCode = response.messageObj.statusCode;
if (statusCode === undefined || statusCode > 400) {
if (statusCode === undefined || statusCode >= 400) {
(0, error_1.handleError)(this.urlName, response, statusCode);

@@ -48,3 +48,3 @@ }

const statusCode = response.messageObj.statusCode;
if (statusCode === undefined || statusCode > 400) {
if (statusCode === undefined || statusCode >= 400) {
(0, error_1.handleError)(this.urlName, response, statusCode);

@@ -85,12 +85,10 @@ }

const form = new form_data_1.default();
if (input instanceof base_1.LocalInputSource) {
if (input.fileObject instanceof Buffer) {
form.append("document", input.fileObject, {
filename: input.filename,
});
}
else {
form.append("document", input.fileObject);
}
if (input instanceof base_1.LocalInputSource && input.fileObject instanceof Buffer) {
form.append("document", input.fileObject, {
filename: input.filename,
});
}
else {
form.append("document", input.fileObject);
}
if (includeWords) {

@@ -97,0 +95,0 @@ form.append("include_mvision", "true");

export * as product from "./product";
export { Client, CustomConfigParams, PredictOptions } from "./client";
export { Client, PredictOptions } from "./client";
export { AsyncPredictResponse, PredictResponse, Document, Page, } from "./parsing/common";
export { InputSource, PageOptionsOperation } from "./input";

@@ -12,2 +12,3 @@ /// <reference types="node" />

export declare abstract class InputSource {
fileObject: Buffer | string;
init(): Promise<void>;

@@ -14,0 +15,0 @@ }

@@ -55,2 +55,5 @@ "use strict";

class InputSource {
constructor() {
this.fileObject = "";
}
async init() {

@@ -57,0 +60,0 @@ throw new Error("not Implemented");

@@ -0,1 +1,2 @@

/** Options to pass to the `parse` method for cutting multi-page documents. */
export interface PageOptions {

@@ -17,5 +18,8 @@ /**

}
/** Operation to apply on the document, given the page indexes specified. */
export declare enum PageOptionsOperation {
/** Only keep pages matching the provided indexes. */
KeepOnly = "KEEP_ONLY",
/** Remove pages matching the provided indexes. */
Remove = "REMOVE"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageOptionsOperation = void 0;
/** Operation to apply on the document, given the page indexes specified. */
var PageOptionsOperation;
(function (PageOptionsOperation) {
/** Only keep pages matching the provided indexes. */
PageOptionsOperation["KeepOnly"] = "KEEP_ONLY";
/** Remove pages matching the provided indexes. */
PageOptionsOperation["Remove"] = "REMOVE";
})(PageOptionsOperation = exports.PageOptionsOperation || (exports.PageOptionsOperation = {}));

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { Buffer } from "buffer";
import { LocalInputSource } from "./base";
import { LocalInputSource, InputSource } from "./base";
interface PathInputProps {

@@ -47,5 +47,4 @@ inputPath: string;

}
export declare class UrlInput {
export declare class UrlInput extends InputSource {
private readonly url;
fileObject: string;
constructor({ url }: {

@@ -52,0 +51,0 @@ url: string;

@@ -109,4 +109,5 @@ "use strict";

//
class UrlInput {
class UrlInput extends base_1.InputSource {
constructor({ url }) {
super();
this.url = url;

@@ -113,0 +114,0 @@ }

import { StringDict } from "./stringDict";
/**
* Holds the information relating to an API HTTP request.
*
* @category API Response
*/
export declare class ApiRequest {
/** An object detailing the error. */
error: StringDict;
/** Target of the request. */
resources: string[];
/** Status of the request. Either "failure" or "success". */
status: "failure" | "success";
/** HTTP status code */
statusCode: number;
/** URL of the request. */
url: string;
constructor(serverResponse: StringDict);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiRequest = void 0;
/**
* Holds the information relating to an API HTTP request.
*
* @category API Response
*/
class ApiRequest {

@@ -5,0 +10,0 @@ constructor(serverResponse) {

import { ApiRequest } from "./apiRequest";
import { StringDict } from "./stringDict";
/** Base wrapper for API requests.
*
* @category API Response
*/
export declare abstract class ApiResponse {
/** Initial request sent to the API. */
apiRequest: ApiRequest;
/**
*
* @param serverResponse JSON response from the server.
*/
constructor(serverResponse: StringDict);
}

@@ -5,3 +5,11 @@ "use strict";

const apiRequest_1 = require("./apiRequest");
/** Base wrapper for API requests.
*
* @category API Response
*/
class ApiResponse {
/**
*
* @param serverResponse JSON response from the server.
*/
constructor(serverResponse) {

@@ -8,0 +16,0 @@ this.apiRequest = new apiRequest_1.ApiRequest(serverResponse["api_request"]);

@@ -5,10 +5,17 @@ import { ApiResponse } from "./apiResponse";

import { Document } from "./document";
/** Wrapper for asynchronous request queues. Holds information regarding a job (queue).
*
* @category API Response
* @category Asynchronous
*/
export declare class Job {
/** Timestamp noting the enqueueing of a document. */
issuedAt: Date;
/** Timestamp noting the availability of a prediction for an enqueued document. */
availableAt?: Date;
/** ID of the job. */
id: string;
/** Status of the job. */
status?: "waiting" | "processing" | "completed";
/**
* The time taken to process the job, in milliseconds.
*/
/** The time taken to process the job, in milliseconds. */
milliSecsTaken?: number;

@@ -18,6 +25,20 @@ constructor(jsonResponse: StringDict);

}
/** Wrapper for asynchronous jobs and parsing results.
*
* @category API Response
* @category Asynchronous
*/
export declare class AsyncPredictResponse<T extends Inference> extends ApiResponse {
/** Job for a queue. */
job: Job;
/** Prediction for an asynchronous request. Will not be available so long as the job is not
* `completed`.
*/
document?: Document<T>;
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
*/
constructor(inferenceClass: new (httpResponse: StringDict) => T, httpResponse: StringDict);
}

@@ -6,2 +6,7 @@ "use strict";

const document_1 = require("./document");
/** Wrapper for asynchronous request queues. Holds information regarding a job (queue).
*
* @category API Response
* @category Asynchronous
*/
class Job {

@@ -30,3 +35,13 @@ constructor(jsonResponse) {

exports.Job = Job;
/** Wrapper for asynchronous jobs and parsing results.
*
* @category API Response
* @category Asynchronous
*/
class AsyncPredictResponse extends apiResponse_1.ApiResponse {
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
*/
constructor(inferenceClass, httpResponse) {

@@ -33,0 +48,0 @@ super(httpResponse);

@@ -5,10 +5,27 @@ import { Extras } from "./extras/extras";

import { StringDict } from "./stringDict";
/**
* Document prediction wrapper class. Holds the results of a parsed document.
* @typeParam T an extension of an `Inference`. Mandatory in order to properly create an inference.
*/
export declare class Document<T extends Inference> {
/** File name as sent back by the server. */
filename: string;
/** Result of the base inference. */
inference: T;
/** Id of the document as sent back by the server. */
id: string;
/** Potential `Extras` fields sent back along the prediction. */
extras?: Extras;
/** Raw-text response for `allWords` parsing. */
ocr?: Ocr;
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
*/
constructor(inferenceClass: new (httpResponse: StringDict) => T, httpResponse: StringDict);
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,10 +6,19 @@ "use strict";

const extras_1 = require("./extras/extras");
/**
* Document prediction wrapper class. Holds the results of a parsed document.
* @typeParam T an extension of an `Inference`. Mandatory in order to properly create an inference.
*/
class Document {
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
*/
constructor(inferenceClass, httpResponse) {
this.id = httpResponse["id"] ?? "";
this.filename = httpResponse["name"] ?? "";
this.ocr = httpResponse["ocr"] ?? undefined;
this.id = httpResponse?.id ?? "";
this.filename = httpResponse?.name ?? "";
this.ocr = httpResponse?.ocr ?? undefined;
this.inference = new inferenceClass(httpResponse["inference"]);
// Note: this is a convoluted but functional way of being able to implement/use Extras fields
// as an extension of a Map object (like having an adapted toString() method, for instance)
// as an extension of a Map object (like having an adapted toString() method, for instance).
if (httpResponse["extras"] &&

@@ -27,2 +36,5 @@ Object.keys(httpResponse["extras"].length > 0)) {

}
/**
* Default string representation.
*/
toString() {

@@ -29,0 +41,0 @@ return `########\nDocument\n########

@@ -7,3 +7,6 @@ import { PositionField } from "../../standard";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -19,2 +19,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -21,0 +24,0 @@ const cropping = this.cropping

@@ -9,4 +9,7 @@ export declare abstract class ExtraField {

constructor(fields: Record<string, ExtraT>);
/**
* Default string representation.
*/
toString(): string;
}
export {};

@@ -12,2 +12,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -14,0 +17,0 @@ return (Object.entries(this)

@@ -6,14 +6,40 @@ import { StringDict } from "../common";

import { Product } from "./product";
/**
*
* @typeParam DocT an extension of a `Prediction`. Is generic by default to
* allow for easier optional `PageT` generic typing.
* @typeParam PageT an extension of a `DocT` (`Prediction`). Should only be set
* if a document's pages have specific implementation.
*/
export declare abstract class Inference<DocT extends Prediction = Prediction, PageT extends DocT = DocT> {
/** A boolean denoting whether a given inference result was rotated. */
isRotationApplied?: boolean;
/** Name and version of a given product. */
product: Product;
/** Wrapper for a document's pages prediction. */
pages: Page<PageT>[];
/** A document's top-level `Prediction`. */
prediction: DocT;
/** Extraneous fields relating to specific tools for some APIs. */
extras?: ExtraField[];
/** Name of a document's endpoint. Has a default value for OTS APIs. */
endpointName?: string;
/** A document's version. Has a default value for OTS APIs. */
endpointVersion?: string;
constructor(rawPrediction: StringDict);
/**
* Default string representation.
*/
toString(): string;
/**
* Takes in an input string and replaces line breaks with `\n`.
* @param outStr string to cleanup
* @returns cleaned out string
*/
static cleanOutString(outStr: string): string;
}
/**
* Factory to allow for static-like property access syntax in TypeScript.
* Used to retrieve endpoint data for standard products.
*/
export declare class InferenceFactory {

@@ -20,0 +46,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InferenceFactory = exports.Inference = void 0;
/**
*
* @typeParam DocT an extension of a `Prediction`. Is generic by default to
* allow for easier optional `PageT` generic typing.
* @typeParam PageT an extension of a `DocT` (`Prediction`). Should only be set
* if a document's pages have specific implementation.
*/
class Inference {
constructor(rawPrediction) {
/** Wrapper for a document's pages prediction. */
this.pages = [];
/** Extraneous fields relating to specific tools for some APIs. */
this.extras = [];
this.isRotationApplied = rawPrediction["is_rotation_applied"] ?? undefined;
this.product = rawPrediction["product"];
this.isRotationApplied = rawPrediction?.is_rotation_applied ?? undefined;
this.product = rawPrediction?.product;
}
/**
* Default string representation.
*/
toString() {

@@ -26,2 +38,7 @@ return `Inference

}
/**
* Takes in an input string and replaces line breaks with `\n`.
* @param outStr string to cleanup
* @returns cleaned out string
*/
static cleanOutString(outStr) {

@@ -33,2 +50,6 @@ const lines = / \n/gm;

exports.Inference = Inference;
/**
* Factory to allow for static-like property access syntax in TypeScript.
* Used to retrieve endpoint data for standard products.
*/
class InferenceFactory {

@@ -35,0 +56,0 @@ /**

@@ -7,3 +7,6 @@ import { StringDict } from "./stringDict";

constructor(rawPrediction: StringDict);
/**
* Default string representation.
*/
toString(): string;
}

@@ -13,2 +13,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -15,0 +18,0 @@ return this.pages.map((page) => page.toString()).join("\n") + "\n";

@@ -7,3 +7,6 @@ import { StringDict } from "./stringDict";

constructor(rawPrediction: StringDict);
/**
* Default string representation.
*/
toString(): string;
}

@@ -9,2 +9,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -11,0 +14,0 @@ return this.mVisionV1.toString();

@@ -15,3 +15,6 @@ import { Word } from "../standard";

getAllLines(): Word[][];
/**
* Default string representation.
*/
toString(): string;
}

@@ -35,2 +35,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -37,0 +40,0 @@ return this.getAllLines()

@@ -20,4 +20,7 @@ import { BaseField, BaseFieldConstructor } from "../standard";

constructor({ prediction, valueKey, reconstructed, pageId, }: OrientationFieldConstructor);
/**
* Default string representation.
*/
toString(): string;
}
export {};

@@ -23,2 +23,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -25,0 +28,0 @@ return `${this.value} degrees`;

@@ -5,9 +5,28 @@ import { Extras } from "./extras/extras";

import { StringDict } from "./stringDict";
/**
* Page prediction wrapper class. Holds the results of a parsed document's page.
* Holds a `Prediction` that's either a document-level Prediction, or inherits from one.
* @typeParam T an extension of an `Prediction`. Mandatory in order to properly create a page-level prediction.
*/
export declare class Page<T extends Prediction> {
/** The page's index (identifier). */
id: number;
/** The page's orientation */
orientation?: OrientationField;
/** A page-level prediction. Can either be specific to pages or identical to the document prediction. */
prediction: T;
/** Potential `Extras` fields sent back along with the prediction. */
extras?: Extras;
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
* @param pageId the page's index (identifier).
* @param orientation the page's orientation.
*/
constructor(predictionType: new (rawPrediction: StringDict, pageId: number) => T, rawPrediction: StringDict, pageId: number, orientation?: StringDict);
/**
* Default string representation.
*/
toString(): string;
}

@@ -7,3 +7,15 @@ "use strict";

const orientation_1 = require("./orientation");
/**
* Page prediction wrapper class. Holds the results of a parsed document's page.
* Holds a `Prediction` that's either a document-level Prediction, or inherits from one.
* @typeParam T an extension of an `Prediction`. Mandatory in order to properly create a page-level prediction.
*/
class Page {
/**
*
* @param inferenceClass constructor signature for an inference.
* @param httpResponse raw http response.
* @param pageId the page's index (identifier).
* @param orientation the page's orientation.
*/
constructor(predictionType, rawPrediction, pageId, orientation) {

@@ -33,2 +45,5 @@ if (pageId !== undefined && orientation !== undefined) {

}
/**
* Default string representation.
*/
toString() {

@@ -35,0 +50,0 @@ const title = `Page ${this.id}`;

import { ApiResponse } from "./apiResponse";
import { Document, Inference, StringDict } from ".";
/** Wrapper for synchronous prediction response.
*
* @category API Response
* @category Synchronous
*/
export declare class PredictResponse<T extends Inference> extends ApiResponse {
/** A document prediction response. */
document: Document<T>;
/**
*
* @param inferenceClass constructor signature for an inference.
* @param rawPrediction raw http response.
*/
constructor(inferenceClass: new (rawPrediction: StringDict) => T, rawPrediction: StringDict);
}

@@ -6,3 +6,13 @@ "use strict";

const _1 = require(".");
/** Wrapper for synchronous prediction response.
*
* @category API Response
* @category Synchronous
*/
class PredictResponse extends apiResponse_1.ApiResponse {
/**
*
* @param inferenceClass constructor signature for an inference.
* @param rawPrediction raw http response.
*/
constructor(inferenceClass, rawPrediction) {

@@ -9,0 +19,0 @@ super(rawPrediction);

@@ -15,3 +15,6 @@ import { StringDict } from "../common";

});
/**
* Default string representation.
*/
toString(): string;
}

@@ -10,2 +10,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -12,0 +15,0 @@ return `${this.value}`;

@@ -23,2 +23,5 @@ import { FieldConstructor } from "../standard";

constructor(prediction: StringDict);
/**
* Default string representation.
*/
toString(): string;

@@ -36,3 +39,6 @@ }

contentsString(separator?: string): string;
/**
* Default string representation.
*/
toString(): string;
}

@@ -24,2 +24,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -48,2 +51,5 @@ return `${this.content}`;

}
/**
* Default string representation.
*/
toString() {

@@ -50,0 +56,0 @@ return this.contentsString();

@@ -16,3 +16,6 @@ import { Field, FieldConstructor } from "./field";

constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
/**
* Default string representation.
*/
toString(): string;
}

@@ -33,2 +33,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -35,0 +38,0 @@ if (this.value !== undefined) {

@@ -29,3 +29,6 @@ import { StringDict } from "../common";

static arraySum(array: BaseField[]): number;
/**
* Default string representation.
*/
toString(): string;
}

@@ -50,2 +50,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -52,0 +55,0 @@ if (this.value !== undefined) {

@@ -22,3 +22,6 @@ import { BaseField, BaseFieldConstructor } from "./base";

constructor({ prediction, reconstructed, pageId, }: BaseFieldConstructor);
/**
* Default string representation.
*/
toString(): string;
}

@@ -25,2 +25,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -27,0 +30,0 @@ let outStr = "";

@@ -39,4 +39,7 @@ import { StringDict } from "../common";

constructor({ prediction, valueKey, accountNumberKey, ibanKey, routingNumberKey, swiftKey, reconstructed, pageId, }: PaymentDetailsConstructor);
/**
* Default string representation.
*/
toString(): string;
}
export {};

@@ -44,2 +44,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -46,0 +49,0 @@ let str = "";

@@ -23,3 +23,6 @@ import { StringDict } from "../common";

constructor({ prediction, pageId }: PositionFieldConstructor);
/**
* Default string representation.
*/
toString(): string;
}

@@ -15,2 +15,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -17,0 +20,0 @@ return `Polygon with ${this.polygon.length} points.`;

@@ -52,4 +52,7 @@ import { StringDict } from "../common";

init(prediction: StringDict[] | undefined, pageId: number | undefined): this;
/**
* Default string representation.
*/
toString(): string;
}
export {};

@@ -108,2 +108,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -110,0 +113,0 @@ let outStr = `

import { Inference, Page, StringDict } from "../../parsing/common";
import { CropperV1Document } from "./cropperV1Document";
/**
* Inference prediction for Cropper API, version 1.
*/
export declare class CropperV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: CropperV1Document;
/** The document's pages. */
pages: Page<CropperV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const cropperV1Document_1 = require("./cropperV1Document");
/**
* Inference prediction for Cropper API, version 1.
*/
class CropperV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "cropper";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new cropperV1Document_1.CropperV1Document(rawPrediction["prediction"]);

import { Prediction, StringDict } from "../../parsing/common";
import { PositionField } from "../../parsing/standard";
/**
* Document data for Cropper API, version 1.
*/
export declare class CropperV1Document implements Prediction {

@@ -7,3 +10,6 @@ /** A list of cropped positions. */

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,2 +6,5 @@ "use strict";

const standard_1 = require("../../parsing/standard");
/**
* Document data for Cropper API, version 1.
*/
class CropperV1Document {

@@ -19,2 +22,5 @@ constructor(rawPrediction, pageId) {

}
/**
* Default string representation.
*/
toString() {

@@ -21,0 +27,0 @@ const cropping = this.cropping

import { Inference, Page, StringDict } from "../../parsing/common";
import { CustomV1Document } from "./customV1Document";
import { CustomV1Page } from "./customV1Page";
/**
* Inference prediction for Custom builds.
*/
export declare class CustomV1 extends Inference {
/** The endpoint's name. Note: placeholder for custom APIs. */
endpointName: string;
/** The endpoint's version. Note: placeholder for custom APIs. */
endpointVersion: string;
/** The document-level prediction. */
prediction: CustomV1Document;
/** The document's pages. */
pages: Page<CustomV1Page>[];
constructor(rawPrediction: StringDict);
}

@@ -7,7 +7,13 @@ "use strict";

const customV1Page_1 = require("./customV1Page");
/**
* Inference prediction for Custom builds.
*/
class CustomV1 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 = [];

@@ -14,0 +20,0 @@ this.prediction = new customV1Document_1.CustomV1Document(rawPrediction["prediction"]);

import { StringDict, Prediction } from "../../parsing/common";
import { ClassificationField, ListField } from "../../parsing/custom";
/**
* Document data for Custom builds.
*/
export declare class CustomV1Document implements Prediction {
/** List of fields for a Custom build. */
fields: Map<string, ListField>;
/** List of classification fields for a Custom build. */
classifications: Map<string, ClassificationField>;
constructor(rawPrediction: StringDict, pageId?: number);
/**
* Sorts and sets fields between classification fields and regular fields.
* Note: Currently, two types of fields possible in a custom API response:
* fields having a list of values, and classification fields.
* @param fieldName name of the field.
* @param fieldValue value of the field.
* @param pageId page the field was found on.
*/
protected setField(fieldName: string, fieldValue: any, pageId?: number): void;
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,5 +6,10 @@ "use strict";

const custom_1 = require("../../parsing/custom");
/**
* Document data for Custom builds.
*/
class CustomV1Document {
constructor(rawPrediction, pageId) {
/** List of fields for a Custom build. */
this.fields = new Map();
/** List of classification fields for a Custom build. */
this.classifications = new Map();

@@ -15,5 +20,11 @@ Object.entries(rawPrediction).forEach(([fieldName, fieldValue]) => {

}
/**
* Sorts and sets fields between classification fields and regular fields.
* Note: Currently, two types of fields possible in a custom API response:
* fields having a list of values, and classification fields.
* @param fieldName name of the field.
* @param fieldValue value of the field.
* @param pageId page the field was found on.
*/
setField(fieldName, fieldValue, pageId) {
// Currently, two types of fields possible in a custom API response:
// fields having a list of values, and classification fields.
if (fieldValue && fieldValue["values"] !== undefined) {

@@ -34,2 +45,5 @@ // Only value lists have the 'values' attribute.

}
/**
* Default string representation.
*/
toString() {

@@ -36,0 +50,0 @@ let outStr = "";

import { StringDict, Prediction } from "../../parsing/common";
import { ListField } from "../../parsing/custom";
/**
* Page data for Custom builds.
*/
export declare class CustomV1Page implements Prediction {
/** List of page-specific fields for a Custom build. Cannot include Classification fields. */
fields: Map<string, ListField>;
constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,4 +6,8 @@ "use strict";

const custom_1 = require("../../parsing/custom");
/**
* Page data for Custom builds.
*/
class CustomV1Page {
constructor(rawPrediction, pageId) {
/** List of page-specific fields for a Custom build. Cannot include Classification fields. */
this.fields = new Map();

@@ -17,2 +21,5 @@ Object.entries(rawPrediction).forEach(([fieldName, fieldValue]) => {

}
/**
* Default string representation.
*/
toString() {

@@ -19,0 +26,0 @@ let outStr = "";

import { Inference, StringDict, Page } from "../../../parsing/common";
import { LicensePlateV1Document } from "./licensePlateV1Document";
/**
* Inference prediction for License Plate, API version 1.
*/
export declare class LicensePlateV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: LicensePlateV1Document;
/** The document's pages. */
pages: Page<LicensePlateV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const licensePlateV1Document_1 = require("./licensePlateV1Document");
/**
* Inference prediction for License Plate, API version 1.
*/
class LicensePlateV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "license_plates";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new licensePlateV1Document_1.LicensePlateV1Document(rawPrediction["prediction"]);

@@ -10,3 +10,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -19,2 +19,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -21,0 +24,0 @@ const licensePlates = this.licensePlates.join("\n ");

import { Inference, StringDict, Page } from "../../parsing/common";
import { FinancialDocumentV1Document } from "./financialDocumentV1Document";
/**
* Inference prediction for Financial Document, API version 1.
*/
export declare class FinancialDocumentV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: FinancialDocumentV1Document;
/** The document's pages. */
pages: Page<FinancialDocumentV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const financialDocumentV1Document_1 = require("./financialDocumentV1Document");
/**
* Inference prediction for Financial Document, API version 1.
*/
class FinancialDocumentV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "financial_document";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new financialDocumentV1Document_1.FinancialDocumentV1Document(rawPrediction["prediction"]);

@@ -55,3 +55,6 @@ import { Prediction, StringDict } from "../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -113,2 +113,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -115,0 +118,0 @@ const referenceNumbers = this.referenceNumbers.join("\n ");

import { Inference, StringDict, Page } from "../../../parsing/common";
import { BankAccountDetailsV1Document } from "./bankAccountDetailsV1Document";
/**
* Inference prediction for Bank Account Details, API version 1.
*/
export declare class BankAccountDetailsV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: BankAccountDetailsV1Document;
/** The document's pages. */
pages: Page<BankAccountDetailsV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const bankAccountDetailsV1Document_1 = require("./bankAccountDetailsV1Document");
/**
* Inference prediction for Bank Account Details, API version 1.
*/
class BankAccountDetailsV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "bank_account_details";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new bankAccountDetailsV1Document_1.BankAccountDetailsV1Document(rawPrediction["prediction"]);

@@ -14,3 +14,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -24,2 +24,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -26,0 +29,0 @@ const outStr = `:IBAN: ${this.iban}

import { Inference, StringDict, Page } from "../../../parsing/common";
import { BankAccountDetailsV2Document } from "./bankAccountDetailsV2Document";
/**
* Inference prediction for Bank Account Details, API version 2.
*/
export declare class BankAccountDetailsV2 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: BankAccountDetailsV2Document;
/** The document's pages. */
pages: Page<BankAccountDetailsV2Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const bankAccountDetailsV2Document_1 = require("./bankAccountDetailsV2Document");
/**
* Inference prediction for Bank Account Details, API version 2.
*/
class BankAccountDetailsV2 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "bank_account_details";
/** The endpoint's version. */
this.endpointVersion = "2";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new bankAccountDetailsV2Document_1.BankAccountDetailsV2Document(rawPrediction["prediction"]);

@@ -17,3 +17,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -29,2 +29,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -31,0 +34,0 @@ const outStr = `:Account Holder's Names: ${this.accountHoldersNames}

import { Inference, StringDict, Page } from "../../../parsing/common";
import { CarteVitaleV1Document } from "./carteVitaleV1Document";
/**
* Inference prediction for Carte Vitale, API version 1.
*/
export declare class CarteVitaleV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: CarteVitaleV1Document;
/** The document's pages. */
pages: Page<CarteVitaleV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const carteVitaleV1Document_1 = require("./carteVitaleV1Document");
/**
* Inference prediction for Carte Vitale, API version 1.
*/
class CarteVitaleV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "carte_vitale";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new carteVitaleV1Document_1.CarteVitaleV1Document(rawPrediction["prediction"]);

@@ -16,3 +16,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -31,2 +31,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -33,0 +36,0 @@ const givenNames = this.givenNames.join("\n ");

import { Inference, StringDict, Page } from "../../../parsing/common";
import { IdCardV1Document } from "./idCardV1Document";
import { IdCardV1Page } from "./idCardV1Page";
/**
* Inference prediction for Carte Nationale d'Identité, API version 1.
*/
export declare class IdCardV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: IdCardV1Document;
/** The document's pages. */
pages: Page<IdCardV1Page>[];
constructor(rawPrediction: StringDict);
}

@@ -7,7 +7,13 @@ "use strict";

const idCardV1Page_1 = require("./idCardV1Page");
/**
* Inference prediction for Carte Nationale d'Identité, API version 1.
*/
class IdCardV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "idcard_fr";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -14,0 +20,0 @@ this.prediction = new idCardV1Document_1.IdCardV1Document(rawPrediction["prediction"]);

@@ -28,3 +28,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -55,2 +55,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -57,0 +60,0 @@ const givenNames = this.givenNames.join("\n ");

import { Inference, StringDict, Page } from "../../parsing/common";
import { InvoiceV4Document } from "./invoiceV4Document";
/**
* Inference prediction for Invoice, API version 4.
*/
export declare class InvoiceV4 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: InvoiceV4Document;
/** The document's pages. */
pages: Page<InvoiceV4Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const invoiceV4Document_1 = require("./invoiceV4Document");
/**
* Inference prediction for Invoice, API version 4.
*/
class InvoiceV4 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "invoices";
/** The endpoint's version. */
this.endpointVersion = "4";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new invoiceV4Document_1.InvoiceV4Document(rawPrediction["prediction"]);

import { Prediction, StringDict } from "../../parsing/common";
import { ClassificationField, Taxes, PaymentDetailsField, LocaleField, AmountField, StringField, DateField, CompanyRegistrationField } from "../../parsing/standard";
import { InvoiceV4LineItem } from "./invoiceV4LineItem";
/** Invoice V4 */
/**
* Document data for Invoice, API version 4.
*/
export declare class InvoiceV4Document implements Prediction {

@@ -6,0 +8,0 @@ /** LocaleField information. */

@@ -7,3 +7,5 @@ "use strict";

const invoiceV4LineItem_1 = require("./invoiceV4LineItem");
/** Invoice V4 */
/**
* Document data for Invoice, API version 4.
*/
class InvoiceV4Document {

@@ -10,0 +12,0 @@ constructor(rawPrediction, pageId) {

import { Polygon } from "../../geometry";
import { StringDict } from "../../parsing/common";
/**
* List of line item details.
*/
export declare class InvoiceV4LineItem {

@@ -29,4 +32,10 @@ #private;

constructor(rawPrediction: StringDict);
/**
* Output in a format suitable for inclusion in an rST table.
*/
toTableLine(): string;
/**
* Default string representation.
*/
toString(): string;
}

@@ -11,2 +11,5 @@ "use strict";

const standard_1 = require("../../parsing/standard");
/**
* List of line item details.
*/
class InvoiceV4LineItem {

@@ -55,2 +58,5 @@ constructor(rawPrediction) {

}
/**
* Output in a format suitable for inclusion in an rST table.
*/
toTableLine() {

@@ -72,2 +78,5 @@ const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);

}
/**
* Default string representation.
*/
toString() {

@@ -74,0 +83,0 @@ const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);

import { Inference, StringDict, Page } from "../../parsing/common";
import { InvoiceSplitterV1Document } from "./invoiceSplitterV1Document";
/**
* Inference prediction for Invoice Splitter, API version 1.
*/
export declare class InvoiceSplitterV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: InvoiceSplitterV1Document;
/** The document's pages. */
pages: Page<InvoiceSplitterV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const invoiceSplitterV1Document_1 = require("./invoiceSplitterV1Document");
/**
* Inference prediction for Invoice Splitter, API version 1.
*/
class InvoiceSplitterV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "invoice_splitter";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new invoiceSplitterV1Document_1.InvoiceSplitterV1Document(rawPrediction["prediction"]);

import { Inference, StringDict } from "../../parsing/common";
import { PageGroup } from "./invoiceSplitterV1PageGroup";
/**
* Document data for Invoice Splitter, API version 1.
*/
export declare class InvoiceSplitterV1Document extends Inference {

@@ -7,3 +10,6 @@ /** List of page indexes that belong to the same invoice in the PDF. */

constructor(rawPrediction: StringDict);
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,2 +6,5 @@ "use strict";

const invoiceSplitterV1PageGroup_1 = require("./invoiceSplitterV1PageGroup");
/**
* Document data for Invoice Splitter, API version 1.
*/
class InvoiceSplitterV1Document extends common_1.Inference {

@@ -15,2 +18,5 @@ constructor(rawPrediction) {

}
/**
* Default string representation.
*/
toString() {

@@ -17,0 +23,0 @@ const invoicePageGroups = this.invoicePageGroups

import { StringDict } from "../../parsing/common";
/**
* Pages indexes in a group.
*/
export declare class PageGroup {
/** List of page indexes. */
pageIndexes: number[];
/** Confidence score. */
confidence: number;
constructor(prediction: StringDict);
/**
* Default string representation.
*/
toString(): string;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageGroup = void 0;
/**
* Pages indexes in a group.
*/
class PageGroup {
constructor(prediction) {
/** List of page indexes. */
this.pageIndexes = [];

@@ -10,2 +14,5 @@ this.pageIndexes = prediction.page_indexes;

}
/**
* Default string representation.
*/
toString() {

@@ -12,0 +19,0 @@ return `:Page indexes: ${this.pageIndexes.join(", ")}`;

import { Inference, StringDict, Page } from "../../parsing/common";
import { PassportV1Document } from "./passportV1Document";
/**
* Inference prediction for Passport, API version 1.
*/
export declare class PassportV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: PassportV1Document;
/** The document's pages. */
pages: Page<PassportV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const passportV1Document_1 = require("./passportV1Document");
/**
* Inference prediction for Passport, API version 1.
*/
class PassportV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "passport";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new passportV1Document_1.PassportV1Document(rawPrediction["prediction"]);

@@ -30,3 +30,6 @@ import { Prediction, StringDict } from "../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -59,2 +59,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -61,0 +64,0 @@ const givenNames = this.givenNames.join("\n ");

import { Inference, StringDict, Page } from "../../parsing/common";
import { ProofOfAddressV1Document } from "./proofOfAddressV1Document";
/**
* Inference prediction for Proof of Address, API version 1.
*/
export declare class ProofOfAddressV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: ProofOfAddressV1Document;
/** The document's pages. */
pages: Page<ProofOfAddressV1Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const proofOfAddressV1Document_1 = require("./proofOfAddressV1Document");
/**
* Inference prediction for Proof of Address, API version 1.
*/
class ProofOfAddressV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "proof_of_address";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new proofOfAddressV1Document_1.ProofOfAddressV1Document(rawPrediction["prediction"]);

@@ -26,3 +26,6 @@ import { Prediction, StringDict } from "../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -56,2 +56,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -58,0 +61,0 @@ const issuerCompanyRegistration = this.issuerCompanyRegistration.join("\n ");

import { Inference, StringDict, Page } from "../../parsing/common";
import { ReceiptV4Document } from "./receiptV4Document";
/**
* Inference prediction for Receipt, API version 4.
*/
export declare class ReceiptV4 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: ReceiptV4Document;
/** The document's pages. */
pages: Page<ReceiptV4Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,6 +6,11 @@ "use strict";

const receiptV4Document_1 = require("./receiptV4Document");
/**
* Inference prediction for Receipt, API version 4.
*/
class ReceiptV4 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "expense_receipts";
/** The endpoint's version. */
this.endpointVersion = "4";

@@ -12,0 +17,0 @@ this.prediction = new receiptV4Document_1.ReceiptV4Document(rawPrediction["prediction"]);

import { Prediction, StringDict } from "../../parsing/common";
import { ClassificationField, AmountField, DateField, StringField, LocaleField, TaxField } from "../../parsing/standard";
/**
* Document data for Receipt, API version 5.
*/
export declare class ReceiptV4Document implements Prediction {

@@ -29,3 +32,6 @@ /** Where the purchase was made, the language, and the currency. */

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -6,2 +6,5 @@ "use strict";

const standard_1 = require("../../parsing/standard");
/**
* Document data for Receipt, API version 5.
*/
class ReceiptV4Document {

@@ -52,2 +55,5 @@ constructor(rawPrediction, pageId) {

}
/**
* Default string representation.
*/
toString() {

@@ -54,0 +60,0 @@ const outStr = `:Locale: ${this.locale}

import { Inference, StringDict, Page } from "../../parsing/common";
import { ReceiptV5Document } from "./receiptV5Document";
/**
* Inference prediction for Receipt, API version 5.
*/
export declare class ReceiptV5 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: ReceiptV5Document;
/** The document's pages. */
pages: Page<ReceiptV5Document>[];
constructor(rawPrediction: StringDict);
}

@@ -6,7 +6,13 @@ "use strict";

const receiptV5Document_1 = require("./receiptV5Document");
/**
* Inference prediction for Receipt, API version 5.
*/
class ReceiptV5 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "expense_receipts";
/** The endpoint's version. */
this.endpointVersion = "5";
/** The document's pages. */
this.pages = [];

@@ -13,0 +19,0 @@ this.prediction = new receiptV5Document_1.ReceiptV5Document(rawPrediction["prediction"]);

@@ -41,3 +41,6 @@ import { Prediction, StringDict } from "../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -76,2 +76,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -78,0 +81,0 @@ const supplierCompanyRegistrations = this.supplierCompanyRegistrations.join("\n ");

import { Inference, StringDict, Page } from "../../../parsing/common";
import { BankCheckV1Document } from "./bankCheckV1Document";
import { BankCheckV1Page } from "./bankCheckV1Page";
/**
* Inference prediction for Bank Check, API version 1.
*/
export declare class BankCheckV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: BankCheckV1Document;
/** The document's pages. */
pages: Page<BankCheckV1Page>[];
constructor(rawPrediction: StringDict);
}

@@ -7,7 +7,13 @@ "use strict";

const bankCheckV1Page_1 = require("./bankCheckV1Page");
/**
* Inference prediction for Bank Check, API version 1.
*/
class BankCheckV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "bank_check";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -14,0 +20,0 @@ this.prediction = new bankCheckV1Document_1.BankCheckV1Document(rawPrediction["prediction"]);

@@ -20,3 +20,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -39,2 +39,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -41,0 +44,0 @@ const payees = this.payees.join("\n ");

import { Inference, StringDict, Page } from "../../../parsing/common";
import { DriverLicenseV1Document } from "./driverLicenseV1Document";
import { DriverLicenseV1Page } from "./driverLicenseV1Page";
/**
* Inference prediction for Driver License, API version 1.
*/
export declare class DriverLicenseV1 extends Inference {
/** The endpoint's name. */
endpointName: string;
/** The endpoint's version. */
endpointVersion: string;
/** The document-level prediction. */
prediction: DriverLicenseV1Document;
/** The document's pages. */
pages: Page<DriverLicenseV1Page>[];
constructor(rawPrediction: StringDict);
}

@@ -7,7 +7,13 @@ "use strict";

const driverLicenseV1Page_1 = require("./driverLicenseV1Page");
/**
* Inference prediction for Driver License, API version 1.
*/
class DriverLicenseV1 extends common_1.Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "us_driver_license";
/** The endpoint's version. */
this.endpointVersion = "1";
/** The document's pages. */
this.pages = [];

@@ -14,0 +20,0 @@ this.prediction = new driverLicenseV1Document_1.DriverLicenseV1Document(rawPrediction["prediction"]);

@@ -42,3 +42,6 @@ import { Prediction, StringDict } from "../../../parsing/common";

constructor(rawPrediction: StringDict, pageId?: number);
/**
* Default string representation.
*/
toString(): string;
}

@@ -80,2 +80,5 @@ "use strict";

}
/**
* Default string representation.
*/
toString() {

@@ -82,0 +85,0 @@ const outStr = `:State: ${this.state}

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc