mindee 4.3.1 → 4.3.3
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.
- package/CHANGELOG.md +15 -0
- package/package.json +5 -4
- package/src/cli.js +52 -16
- package/src/client.d.ts +35 -6
- package/src/client.js +47 -16
- package/src/http/apiSettings.d.ts +15 -0
- package/src/http/{mindeeApi.js → apiSettings.js} +10 -13
- package/src/http/baseEndpoint.d.ts +27 -0
- package/src/http/baseEndpoint.js +65 -0
- package/src/http/endpoint.d.ts +27 -38
- package/src/http/endpoint.js +46 -60
- package/src/http/error.d.ts +11 -11
- package/src/http/error.js +29 -29
- package/src/http/index.d.ts +3 -2
- package/src/http/index.js +5 -5
- package/src/input/base.d.ts +7 -6
- package/src/input/base.js +1 -4
- package/src/parsing/common/apiResponse.d.ts +1 -1
- package/src/parsing/common/apiResponse.js +1 -1
- package/src/parsing/common/asyncPredictResponse.d.ts +4 -4
- package/src/parsing/common/asyncPredictResponse.js +8 -8
- package/src/parsing/common/extras/cropperExtra.js +1 -1
- package/src/parsing/common/feedback/feedbackResponse.d.ts +15 -0
- package/src/parsing/common/feedback/feedbackResponse.js +19 -0
- package/src/parsing/common/index.d.ts +1 -0
- package/src/parsing/common/index.js +3 -1
- package/src/parsing/common/inference.js +9 -5
- package/src/parsing/common/orientation.d.ts +1 -4
- package/src/parsing/common/orientation.js +1 -4
- package/src/parsing/common/page.d.ts +2 -3
- package/src/parsing/common/page.js +2 -3
- package/src/parsing/common/predictResponse.d.ts +3 -3
- package/src/parsing/common/predictResponse.js +5 -5
- package/src/parsing/custom/listField.d.ts +6 -3
- package/src/parsing/custom/listField.js +3 -0
- package/src/parsing/standard/amount.d.ts +4 -6
- package/src/parsing/standard/amount.js +1 -4
- package/src/parsing/standard/base.d.ts +9 -4
- package/src/parsing/standard/base.js +2 -4
- package/src/parsing/standard/companyRegistration.d.ts +3 -2
- package/src/parsing/standard/date.d.ts +4 -6
- package/src/parsing/standard/date.js +1 -4
- package/src/parsing/standard/field.d.ts +4 -15
- package/src/parsing/standard/field.js +2 -6
- package/src/parsing/standard/index.d.ts +1 -1
- package/src/parsing/standard/locale.d.ts +1 -3
- package/src/parsing/standard/locale.js +1 -3
- package/src/parsing/standard/paymentDetails.d.ts +11 -8
- package/src/parsing/standard/paymentDetails.js +1 -8
- package/src/parsing/standard/tax.d.ts +8 -12
- package/src/parsing/standard/tax.js +1 -7
- package/src/product/financialDocument/financialDocumentV1Document.js +2 -2
- package/src/product/invoice/invoiceV4Document.d.ts +33 -32
- package/src/product/invoice/invoiceV4Document.js +89 -104
- package/src/product/invoice/invoiceV4LineItem.d.ts +16 -16
- package/src/product/invoice/invoiceV4LineItem.js +58 -60
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +2 -2
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -2
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.d.ts +1 -1
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.js +1 -1
- package/src/product/us/w9/w9V1.d.ts +1 -1
- package/src/product/us/w9/w9V1.js +1 -1
- package/src/product/us/w9/w9V1Document.d.ts +1 -1
- package/src/product/us/w9/w9V1Document.js +1 -1
- package/src/product/us/w9/w9V1Page.d.ts +1 -1
- package/src/product/us/w9/w9V1Page.js +1 -1
- package/src/http/mindeeApi.d.ts +0 -20
|
@@ -17,9 +17,8 @@ export declare class Page<T extends Prediction> {
|
|
|
17
17
|
/** Potential `Extras` fields sent back along with the prediction. */
|
|
18
18
|
extras?: Extras;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param httpResponse raw http response.
|
|
20
|
+
* @param predictionType constructor signature for an inference.
|
|
21
|
+
* @param rawPrediction raw http response.
|
|
23
22
|
* @param pageId the page's index (identifier).
|
|
24
23
|
* @param orientation the page's orientation.
|
|
25
24
|
*/
|
|
@@ -11,9 +11,8 @@ const orientation_1 = require("./orientation");
|
|
|
11
11
|
*/
|
|
12
12
|
class Page {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param httpResponse raw http response.
|
|
14
|
+
* @param predictionType constructor signature for an inference.
|
|
15
|
+
* @param rawPrediction raw http response.
|
|
17
16
|
* @param pageId the page's index (identifier).
|
|
18
17
|
* @param orientation the page's orientation.
|
|
19
18
|
*/
|
|
@@ -4,14 +4,14 @@ import { Document, Inference, StringDict } from ".";
|
|
|
4
4
|
*
|
|
5
5
|
* @category API Response
|
|
6
6
|
* @category Synchronous
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
8
|
export declare class PredictResponse<T extends Inference> extends ApiResponse {
|
|
9
9
|
/** A document prediction response. */
|
|
10
10
|
document: Document<T>;
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
* @param inferenceClass constructor signature for an inference.
|
|
14
|
-
* @param
|
|
14
|
+
* @param serverResponse raw http response.
|
|
15
15
|
*/
|
|
16
|
-
constructor(inferenceClass: new (
|
|
16
|
+
constructor(inferenceClass: new (serverResponse: StringDict) => T, serverResponse: StringDict);
|
|
17
17
|
}
|
|
@@ -7,16 +7,16 @@ const _1 = require(".");
|
|
|
7
7
|
*
|
|
8
8
|
* @category API Response
|
|
9
9
|
* @category Synchronous
|
|
10
|
-
*/
|
|
10
|
+
*/
|
|
11
11
|
class PredictResponse extends apiResponse_1.ApiResponse {
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @param inferenceClass constructor signature for an inference.
|
|
15
|
-
* @param
|
|
15
|
+
* @param serverResponse raw http response.
|
|
16
16
|
*/
|
|
17
|
-
constructor(inferenceClass,
|
|
18
|
-
super(
|
|
19
|
-
this.document = new _1.Document(inferenceClass,
|
|
17
|
+
constructor(inferenceClass, serverResponse) {
|
|
18
|
+
super(serverResponse);
|
|
19
|
+
this.document = new _1.Document(inferenceClass, serverResponse["document"]);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.PredictResponse = PredictResponse;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseFieldConstructor } from "../standard";
|
|
2
2
|
import { Polygon } from "../../geometry";
|
|
3
3
|
import { StringDict } from "../common";
|
|
4
4
|
export declare class ListFieldValue {
|
|
5
5
|
/** Extracted content of the prediction */
|
|
6
|
-
content: string
|
|
6
|
+
content: string;
|
|
7
7
|
/**
|
|
8
8
|
* The confidence score of the prediction.
|
|
9
9
|
* Note: Score is calculated on **word selection**, not its textual content (OCR).
|
|
@@ -32,7 +32,10 @@ export declare class ListField {
|
|
|
32
32
|
reconstructed: boolean;
|
|
33
33
|
/** The document page on which the information was found. */
|
|
34
34
|
pageId: number;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
37
|
+
*/
|
|
38
|
+
constructor({ prediction, reconstructed, pageId, }: BaseFieldConstructor);
|
|
36
39
|
contentsList(): Array<string | number>;
|
|
37
40
|
contentsString(separator?: string): string;
|
|
38
41
|
/**
|
|
@@ -30,6 +30,9 @@ class ListFieldValue {
|
|
|
30
30
|
}
|
|
31
31
|
exports.ListFieldValue = ListFieldValue;
|
|
32
32
|
class ListField {
|
|
33
|
+
/**
|
|
34
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
35
|
+
*/
|
|
33
36
|
constructor({ prediction = {}, reconstructed = false, pageId, }) {
|
|
34
37
|
this.values = [];
|
|
35
38
|
this.confidence = prediction["confidence"];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Field
|
|
1
|
+
import { Field } from "./field";
|
|
2
|
+
import { BaseFieldConstructor } from "./base";
|
|
2
3
|
export declare function floatToString(value: number): string;
|
|
3
4
|
/**
|
|
4
5
|
* A field containing an amount value.
|
|
@@ -7,12 +8,9 @@ export declare class AmountField extends Field {
|
|
|
7
8
|
/** The value. */
|
|
8
9
|
value?: number;
|
|
9
10
|
/**
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
12
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
13
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
11
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
14
12
|
*/
|
|
15
|
-
constructor({ prediction, valueKey, reconstructed, pageId, }:
|
|
13
|
+
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
16
14
|
/**
|
|
17
15
|
* Default string representation.
|
|
18
16
|
*/
|
|
@@ -15,10 +15,7 @@ exports.floatToString = floatToString;
|
|
|
15
15
|
*/
|
|
16
16
|
class AmountField extends field_1.Field {
|
|
17
17
|
/**
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
20
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
21
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
18
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
22
19
|
*/
|
|
23
20
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId = undefined, }) {
|
|
24
21
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
|
+
/**
|
|
3
|
+
* @property {object} prediction - Prediction object from HTTP response.
|
|
4
|
+
* @property {string} valueKey - Key to use in the prediction dict.
|
|
5
|
+
* @property {boolean} reconstructed - Is the object reconstructed (not extracted by the API).
|
|
6
|
+
* @property {number} pageId - Page ID for multi-page document.
|
|
7
|
+
*/
|
|
2
8
|
export interface BaseFieldConstructor {
|
|
3
9
|
prediction: StringDict;
|
|
4
10
|
valueKey?: string;
|
|
@@ -13,17 +19,16 @@ export declare class BaseField {
|
|
|
13
19
|
value?: string | number;
|
|
14
20
|
/** `true` when the field was reconstructed or computed using other fields. */
|
|
15
21
|
reconstructed: boolean;
|
|
22
|
+
/** Page ID for multi-page document. */
|
|
16
23
|
pageId?: number;
|
|
17
24
|
/**
|
|
18
|
-
* @param {
|
|
19
|
-
* @param valueKey - Key to use in the prediction dict
|
|
20
|
-
* @param reconstructed - Is the object reconstructed (not extracted by the API)
|
|
25
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
21
26
|
*/
|
|
22
27
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
23
28
|
compare(other: BaseField): boolean;
|
|
24
29
|
/**
|
|
25
30
|
* @param {BaseField[]} array - Array of Fields
|
|
26
|
-
* @returns {
|
|
31
|
+
* @returns {number} Sum of all the Fields values in the array
|
|
27
32
|
*/
|
|
28
33
|
static arraySum(array: BaseField[]): number;
|
|
29
34
|
/**
|
|
@@ -6,9 +6,7 @@ exports.BaseField = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
class BaseField {
|
|
8
8
|
/**
|
|
9
|
-
* @param {
|
|
10
|
-
* @param valueKey - Key to use in the prediction dict
|
|
11
|
-
* @param reconstructed - Is the object reconstructed (not extracted by the API)
|
|
9
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
12
10
|
*/
|
|
13
11
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId = undefined, }) {
|
|
14
12
|
/** The value. */
|
|
@@ -34,7 +32,7 @@ class BaseField {
|
|
|
34
32
|
}
|
|
35
33
|
/**
|
|
36
34
|
* @param {BaseField[]} array - Array of Fields
|
|
37
|
-
* @returns {
|
|
35
|
+
* @returns {number} Sum of all the Fields values in the array
|
|
38
36
|
*/
|
|
39
37
|
static arraySum(array) {
|
|
40
38
|
let total = 0.0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Field
|
|
1
|
+
import { Field } from "./field";
|
|
2
|
+
import { BaseFieldConstructor } from "./base";
|
|
2
3
|
/**
|
|
3
4
|
* A company registration item.
|
|
4
5
|
*/
|
|
@@ -7,5 +8,5 @@ export declare class CompanyRegistrationField extends Field {
|
|
|
7
8
|
value?: string;
|
|
8
9
|
/** Type of company registration. */
|
|
9
10
|
type: string;
|
|
10
|
-
constructor({ prediction, valueKey, reconstructed, pageId, }:
|
|
11
|
+
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
11
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Field
|
|
1
|
+
import { Field } from "./field";
|
|
2
|
+
import { BaseFieldConstructor } from "./base";
|
|
2
3
|
/**
|
|
3
4
|
* A field containing a date value.
|
|
4
5
|
*/
|
|
@@ -8,11 +9,8 @@ export declare class DateField extends Field {
|
|
|
8
9
|
/** Date as a standard JavaScript `Date` object. */
|
|
9
10
|
dateObject?: Date;
|
|
10
11
|
/**
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
13
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
14
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
12
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
15
13
|
*/
|
|
16
|
-
constructor({ prediction, valueKey, reconstructed, pageId, }:
|
|
14
|
+
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
17
15
|
static compareDates(date1: Date, date2: Date): boolean;
|
|
18
16
|
}
|
|
@@ -7,10 +7,7 @@ const field_1 = require("./field");
|
|
|
7
7
|
*/
|
|
8
8
|
class DateField extends field_1.Field {
|
|
9
9
|
/**
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
12
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
13
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
10
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
14
11
|
*/
|
|
15
12
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId, }) {
|
|
16
13
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { BaseField } from "./base";
|
|
1
|
+
import { BaseField, BaseFieldConstructor } from "./base";
|
|
2
2
|
import { Polygon, BoundingBox } from "../../geometry";
|
|
3
|
-
import { StringDict } from "../common";
|
|
4
|
-
export interface FieldConstructor {
|
|
5
|
-
prediction: StringDict;
|
|
6
|
-
valueKey?: string;
|
|
7
|
-
reconstructed?: boolean;
|
|
8
|
-
pageId?: number | undefined;
|
|
9
|
-
}
|
|
10
3
|
/**
|
|
11
4
|
* A basic field with position and page information.
|
|
12
5
|
*/
|
|
@@ -24,13 +17,9 @@ export declare class Field extends BaseField {
|
|
|
24
17
|
/** The confidence score of the prediction. */
|
|
25
18
|
confidence: number;
|
|
26
19
|
/**
|
|
27
|
-
* @param
|
|
28
|
-
* @param valueKey - Key to use in the prediction dict
|
|
29
|
-
* @param reconstructed - Does the object is reconstructed (not extracted by the API)
|
|
30
|
-
* @param pageId - Page ID for multi-page document
|
|
31
|
-
* @param extraFields - Extra fields to get from the prediction and to set as attribute of the Field
|
|
20
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
32
21
|
*/
|
|
33
|
-
constructor({ prediction, valueKey, reconstructed, pageId, }:
|
|
22
|
+
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
34
23
|
/**
|
|
35
24
|
@param array1 first Array of Fields
|
|
36
25
|
@param array2 second Array of Fields
|
|
@@ -40,7 +29,7 @@ export declare class Field extends BaseField {
|
|
|
40
29
|
static compareArrays(array1: Field[], array2: Field[], attr?: string): boolean;
|
|
41
30
|
/**
|
|
42
31
|
* @param {Field[]} array - Array of Fields
|
|
43
|
-
* @returns {
|
|
32
|
+
* @returns {number} product of all the fields probability
|
|
44
33
|
*/
|
|
45
34
|
static arrayConfidence(array: Field[]): number;
|
|
46
35
|
}
|
|
@@ -8,11 +8,7 @@ const geometry_1 = require("../../geometry");
|
|
|
8
8
|
*/
|
|
9
9
|
class Field extends base_1.BaseField {
|
|
10
10
|
/**
|
|
11
|
-
* @param
|
|
12
|
-
* @param valueKey - Key to use in the prediction dict
|
|
13
|
-
* @param reconstructed - Does the object is reconstructed (not extracted by the API)
|
|
14
|
-
* @param pageId - Page ID for multi-page document
|
|
15
|
-
* @param extraFields - Extra fields to get from the prediction and to set as attribute of the Field
|
|
11
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
16
12
|
*/
|
|
17
13
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId, }) {
|
|
18
14
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -46,7 +42,7 @@ class Field extends base_1.BaseField {
|
|
|
46
42
|
}
|
|
47
43
|
/**
|
|
48
44
|
* @param {Field[]} array - Array of Fields
|
|
49
|
-
* @returns {
|
|
45
|
+
* @returns {number} product of all the fields probability
|
|
50
46
|
*/
|
|
51
47
|
static arrayConfidence(array) {
|
|
52
48
|
let total = 1.0;
|
|
@@ -9,4 +9,4 @@ export { Word } from "./word";
|
|
|
9
9
|
export { CompanyRegistrationField } from "./companyRegistration";
|
|
10
10
|
export { PositionField } from "./position";
|
|
11
11
|
export { StringField } from "./text";
|
|
12
|
-
export { Field
|
|
12
|
+
export { Field } from "./field";
|
|
@@ -14,9 +14,7 @@ export declare class LocaleField extends BaseField {
|
|
|
14
14
|
/** ISO 4217 currency code */
|
|
15
15
|
currency?: string;
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
19
|
-
* @param {boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
17
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
20
18
|
*/
|
|
21
19
|
constructor({ prediction, reconstructed, pageId, }: BaseFieldConstructor);
|
|
22
20
|
/**
|
|
@@ -7,9 +7,7 @@ const base_1 = require("./base");
|
|
|
7
7
|
*/
|
|
8
8
|
class LocaleField extends base_1.BaseField {
|
|
9
9
|
/**
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {String} valueKey - Key to use in the prediction dict
|
|
12
|
-
* @param {boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
10
|
+
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
13
11
|
*/
|
|
14
12
|
constructor({ prediction = {}, reconstructed = false, pageId = undefined, }) {
|
|
15
13
|
const valueKey = prediction["value"] !== undefined ? "value" : "language";
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
2
|
import { Field } from "./field";
|
|
3
|
+
/**
|
|
4
|
+
* @property {StringDict} constructor.prediction - Prediction object from HTTP response
|
|
5
|
+
* @property {string} constructor.valueKey - Key to use in the prediction dict to get the iban.
|
|
6
|
+
* @property {string} constructor.accountNumberKey - Key to use to get the account number in the prediction dict.
|
|
7
|
+
* @property {string} constructor.ibanKey - Key to use to get the IBAN in the prediction dict.
|
|
8
|
+
* @property {string} constructor.routingNumberKey - Key to use to get the routing number in the prediction dict.
|
|
9
|
+
* @property {string} constructor.swiftKey - Key to use to get the SWIFT in the prediction dict.
|
|
10
|
+
* @property {boolean} constructor.reconstructed - Is the object reconstructed (not extracted by the API).
|
|
11
|
+
* @property {number} constructor.pageId - Page ID for multi-page document.
|
|
12
|
+
*/
|
|
3
13
|
interface PaymentDetailsConstructor {
|
|
4
14
|
prediction: StringDict;
|
|
5
15
|
valueKey?: string;
|
|
@@ -26,14 +36,7 @@ export declare class PaymentDetailsField extends Field {
|
|
|
26
36
|
/** The bank's SWIFT Business Identifier Code (BIC). */
|
|
27
37
|
swift: string | undefined;
|
|
28
38
|
/**
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {String} valueKey - Key to use in the prediction dict to get the iban
|
|
31
|
-
* @param {String} accountNumberKey - Key to use to get the account number in the prediction dict
|
|
32
|
-
* @param {String} ibanKey - Key to use to get the IBAN in the prediction dict
|
|
33
|
-
* @param {String} routingNumberKey - Key to use to get the routing number in the prediction dict
|
|
34
|
-
* @param {String} swiftKey - Key to use to get the SWIFT in the prediction dict
|
|
35
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
36
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
39
|
+
* @param {PaymentDetailsConstructor} constructor Constructor parameters.
|
|
37
40
|
*/
|
|
38
41
|
constructor({ prediction, valueKey, accountNumberKey, ibanKey, routingNumberKey, swiftKey, reconstructed, pageId, }: PaymentDetailsConstructor);
|
|
39
42
|
/**
|
|
@@ -13,14 +13,7 @@ const field_1 = require("./field");
|
|
|
13
13
|
*/
|
|
14
14
|
class PaymentDetailsField extends field_1.Field {
|
|
15
15
|
/**
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {String} valueKey - Key to use in the prediction dict to get the iban
|
|
18
|
-
* @param {String} accountNumberKey - Key to use to get the account number in the prediction dict
|
|
19
|
-
* @param {String} ibanKey - Key to use to get the IBAN in the prediction dict
|
|
20
|
-
* @param {String} routingNumberKey - Key to use to get the routing number in the prediction dict
|
|
21
|
-
* @param {String} swiftKey - Key to use to get the SWIFT in the prediction dict
|
|
22
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
23
|
-
* @param {Integer} pageId - Page ID for multi-page document
|
|
16
|
+
* @param {PaymentDetailsConstructor} constructor Constructor parameters.
|
|
24
17
|
*/
|
|
25
18
|
constructor({ prediction = {}, valueKey = "iban", accountNumberKey = "account_number", ibanKey = "iban", routingNumberKey = "routing_number", swiftKey = "swift", reconstructed = false, pageId = undefined, }) {
|
|
26
19
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
2
|
import { Field } from "./field";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { BaseFieldConstructor } from "./base";
|
|
4
|
+
/**
|
|
5
|
+
* @property {string} constructor.rateKey - Key to use to get the tax rate in the prediction dict.
|
|
6
|
+
* @property {string} constructor.codeKey - Key to use to get the tax code in the prediction dict.
|
|
7
|
+
* @property {string} constructor.baseKey - Key to use to get the base tax in the prediction dict.
|
|
8
|
+
*/
|
|
9
|
+
interface TaxConstructor extends BaseFieldConstructor {
|
|
6
10
|
rateKey?: string;
|
|
7
11
|
codeKey?: string;
|
|
8
12
|
baseKey?: string;
|
|
9
|
-
reconstructed?: boolean;
|
|
10
|
-
pageId?: number;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Represent a single tax line.
|
|
@@ -25,13 +27,7 @@ export declare class TaxField extends Field {
|
|
|
25
27
|
/** The document page on which the information was found. */
|
|
26
28
|
pageId: number;
|
|
27
29
|
/**
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {String} valueKey - Key to use in the prediction dict to get the tax value
|
|
30
|
-
* @param {String} rateKey - Key to use to get the tax rate in the prediction dict
|
|
31
|
-
* @param {String} codeKey - Key to use to get the tax code in the prediction dict
|
|
32
|
-
* @param {String} baseKey - Key to use to get the base tax in the prediction dict
|
|
33
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
34
|
-
* @param {Integer} pageNumber - Page ID for multi-page document
|
|
30
|
+
* @param {TaxConstructor} constructor Constructor parameters.
|
|
35
31
|
*/
|
|
36
32
|
constructor({ prediction, valueKey, rateKey, codeKey, baseKey, reconstructed, pageId, }: TaxConstructor);
|
|
37
33
|
/**
|
|
@@ -14,13 +14,7 @@ const amount_1 = require("./amount");
|
|
|
14
14
|
*/
|
|
15
15
|
class TaxField extends field_1.Field {
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {String} valueKey - Key to use in the prediction dict to get the tax value
|
|
19
|
-
* @param {String} rateKey - Key to use to get the tax rate in the prediction dict
|
|
20
|
-
* @param {String} codeKey - Key to use to get the tax code in the prediction dict
|
|
21
|
-
* @param {String} baseKey - Key to use to get the base tax in the prediction dict
|
|
22
|
-
* @param {Boolean} reconstructed - Is the object reconstructed (not extracted by the API)
|
|
23
|
-
* @param {Integer} pageNumber - Page ID for multi-page document
|
|
17
|
+
* @param {TaxConstructor} constructor Constructor parameters.
|
|
24
18
|
*/
|
|
25
19
|
constructor({ prediction = {}, valueKey = "value", rateKey = "rate", codeKey = "code", baseKey = "base", reconstructed = false, pageId = undefined, }) {
|
|
26
20
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -141,11 +141,11 @@ class FinancialDocumentV1Document {
|
|
|
141
141
|
:Total Amount: ${this.totalAmount}
|
|
142
142
|
:Taxes: ${this.taxes}
|
|
143
143
|
:Supplier Payment Details: ${supplierPaymentDetails}
|
|
144
|
-
:Supplier
|
|
144
|
+
:Supplier Name: ${this.supplierName}
|
|
145
145
|
:Supplier Company Registrations: ${supplierCompanyRegistrations}
|
|
146
146
|
:Supplier Address: ${this.supplierAddress}
|
|
147
147
|
:Supplier Phone Number: ${this.supplierPhoneNumber}
|
|
148
|
-
:Customer
|
|
148
|
+
:Customer Name: ${this.customerName}
|
|
149
149
|
:Customer Company Registrations: ${customerCompanyRegistrations}
|
|
150
150
|
:Customer Address: ${this.customerAddress}
|
|
151
151
|
:Document Type: ${this.documentType}
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
-
import { ClassificationField, Taxes, PaymentDetailsField, LocaleField, AmountField, StringField, DateField, CompanyRegistrationField } from "../../parsing/standard";
|
|
3
2
|
import { InvoiceV4LineItem } from "./invoiceV4LineItem";
|
|
3
|
+
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
4
4
|
/**
|
|
5
5
|
* Document data for Invoice, API version 4.
|
|
6
6
|
*/
|
|
7
7
|
export declare class InvoiceV4Document implements Prediction {
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/** The
|
|
15
|
-
totalAmount: AmountField;
|
|
16
|
-
/** The creation date of the invoice. */
|
|
8
|
+
/** The address of the customer. */
|
|
9
|
+
customerAddress: StringField;
|
|
10
|
+
/** List of company registrations associated to the customer. */
|
|
11
|
+
customerCompanyRegistrations: CompanyRegistrationField[];
|
|
12
|
+
/** The name of the customer or client. */
|
|
13
|
+
customerName: StringField;
|
|
14
|
+
/** The date the purchase was made. */
|
|
17
15
|
date: DateField;
|
|
18
|
-
/**
|
|
16
|
+
/** One of: 'INVOICE', 'CREDIT NOTE'. */
|
|
17
|
+
documentType: ClassificationField;
|
|
18
|
+
/** The date on which the payment is due. */
|
|
19
19
|
dueDate: DateField;
|
|
20
|
-
/** The
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/** The
|
|
25
|
-
|
|
26
|
-
/**
|
|
20
|
+
/** The invoice number or identifier. */
|
|
21
|
+
invoiceNumber: StringField;
|
|
22
|
+
/** List of line item details. */
|
|
23
|
+
lineItems: InvoiceV4LineItem[];
|
|
24
|
+
/** The locale detected on the document. */
|
|
25
|
+
locale: LocaleField;
|
|
26
|
+
/** List of Reference numbers, including PO number. */
|
|
27
|
+
referenceNumbers: StringField[];
|
|
28
|
+
/** The address of the supplier or merchant. */
|
|
27
29
|
supplierAddress: StringField;
|
|
28
|
-
/**
|
|
29
|
-
supplierPaymentDetails: PaymentDetailsField[];
|
|
30
|
-
/** The supplier company registration information. */
|
|
30
|
+
/** List of company registrations associated to the supplier. */
|
|
31
31
|
supplierCompanyRegistrations: CompanyRegistrationField[];
|
|
32
|
-
/** The
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
customerAddress: StringField;
|
|
38
|
-
/** The company registration information for the customer. */
|
|
39
|
-
customerCompanyRegistrations: CompanyRegistrationField[];
|
|
40
|
-
/** The list of the taxes. */
|
|
32
|
+
/** The name of the supplier or merchant. */
|
|
33
|
+
supplierName: StringField;
|
|
34
|
+
/** List of payment details associated to the supplier. */
|
|
35
|
+
supplierPaymentDetails: PaymentDetailsField[];
|
|
36
|
+
/** List of tax line details. */
|
|
41
37
|
taxes: Taxes;
|
|
42
|
-
/**
|
|
43
|
-
|
|
38
|
+
/** The total amount paid: includes taxes, tips, fees, and other charges. */
|
|
39
|
+
totalAmount: AmountField;
|
|
40
|
+
/** The net amount paid: does not include taxes, fees, and discounts. */
|
|
41
|
+
totalNet: AmountField;
|
|
44
42
|
constructor(rawPrediction: StringDict, pageId?: number);
|
|
43
|
+
/**
|
|
44
|
+
* Default string representation.
|
|
45
|
+
*/
|
|
45
46
|
toString(): string;
|
|
46
47
|
}
|