mindee 3.3.0 → 3.4.1
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 +14 -0
- package/README.md +6 -1
- package/package.json +19 -19
- package/src/api/index.d.ts +1 -1
- package/src/api/response.d.ts +3 -0
- package/src/client.d.ts +4 -4
- package/src/client.js +1 -1
- package/src/documents/{custom.d.ts → custom/customV1.d.ts} +4 -4
- package/src/documents/{custom.js → custom/customV1.js} +2 -2
- package/src/{fields/apiBuilder.d.ts → documents/custom/fields.d.ts} +8 -6
- package/src/{fields/apiBuilder.js → documents/custom/fields.js} +1 -1
- package/src/documents/document.d.ts +5 -5
- package/src/documents/eu/licensePlate/licensePlateV1.d.ts +2 -2
- package/src/documents/eu/licensePlate/licensePlateV1.js +3 -2
- package/src/documents/financialDocument/financialDocumentV1.d.ts +9 -9
- package/src/documents/financialDocument/financialDocumentV1.js +5 -5
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +4 -4
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +3 -3
- package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +4 -4
- package/src/documents/fr/carteVitale/carteVitaleV1.js +4 -3
- package/src/documents/fr/idCard/idCardV1.d.ts +9 -9
- package/src/documents/fr/idCard/idCardV1.js +8 -8
- package/src/documents/index.d.ts +1 -1
- package/src/documents/index.js +2 -2
- package/src/documents/invoice/invoiceLineItem.d.ts +2 -2
- package/src/documents/invoice/invoiceLineItem.js +2 -2
- package/src/documents/invoice/invoiceV3.d.ts +7 -7
- package/src/documents/invoice/invoiceV3.js +21 -21
- package/src/documents/invoice/invoiceV4.d.ts +8 -8
- package/src/documents/invoice/invoiceV4.js +18 -6
- package/src/documents/invoice/reconstruction.js +5 -4
- package/src/documents/passport/passportV1.d.ts +11 -11
- package/src/documents/passport/passportV1.js +16 -14
- package/src/documents/receipt/receiptV3.d.ts +4 -4
- package/src/documents/receipt/receiptV3.js +6 -7
- package/src/documents/receipt/receiptV4.d.ts +8 -4
- package/src/documents/receipt/receiptV4.js +14 -5
- package/src/documents/receipt/tax.d.ts +3 -3
- package/src/documents/receipt/tax.js +7 -7
- package/src/documents/shipping_container/shippingContainerV1.d.ts +4 -4
- package/src/documents/shipping_container/shippingContainerV1.js +4 -3
- package/src/documents/us/bankCheck/bankCheckV1.d.ts +5 -5
- package/src/documents/us/bankCheck/bankCheckV1.js +4 -4
- package/src/fields/amount.d.ts +1 -1
- package/src/fields/amount.js +7 -4
- package/src/fields/base.d.ts +27 -0
- package/src/fields/base.js +53 -0
- package/src/fields/companyRegistration.d.ts +3 -1
- package/src/fields/date.d.ts +4 -1
- package/src/fields/date.js +16 -8
- package/src/fields/field.d.ts +8 -38
- package/src/fields/field.js +6 -53
- package/src/fields/fullText.d.ts +3 -3
- package/src/fields/fullText.js +4 -4
- package/src/fields/index.d.ts +3 -3
- package/src/fields/index.js +5 -8
- package/src/fields/locale.d.ts +13 -9
- package/src/fields/locale.js +4 -3
- package/src/fields/orientation.d.ts +3 -1
- package/src/fields/orientation.js +2 -2
- package/src/fields/paymentDetails.d.ts +4 -1
- package/src/fields/paymentDetails.js +26 -23
- package/src/fields/position.d.ts +2 -2
- package/src/fields/tax.d.ts +4 -3
- package/src/fields/tax.js +2 -2
- package/src/fields/text.d.ts +13 -0
- package/src/fields/text.js +10 -0
- package/src/geometry.d.ts +4 -5
- package/src/index.d.ts +4 -3
- package/src/index.js +5 -1
- package/src/inputs/sources.d.ts +4 -4
- package/src/inputs/sources.js +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v3.4.1 - 2023-01-05
|
|
4
|
+
### Changes
|
|
5
|
+
* :label: Added typing information, get rid of `any` type in various places
|
|
6
|
+
* :recycle: Use a specific `TextField` class for fields we know are textual
|
|
7
|
+
* :arrow_up: update dependencies
|
|
8
|
+
|
|
9
|
+
### Fixes
|
|
10
|
+
* :bug: Expose various class and type definitions to improve developer experience
|
|
11
|
+
|
|
12
|
+
## v3.4.0 - 2023-01-04
|
|
13
|
+
### Changes
|
|
14
|
+
* :sparkles: Support Receipt V4.1
|
|
15
|
+
* :sparkles: Support Invoice V4.1
|
|
16
|
+
|
|
3
17
|
## v3.3.0 - 2022-12-01
|
|
4
18
|
### Changes
|
|
5
19
|
* :sparkles: Add Invoice V4 with line items
|
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
|
+
[](https://github.com/mindee/mindee-api-nodejs)
|
|
3
|
+
[](https://www.npmjs.com/package/mindee)
|
|
4
|
+
[](https://www.npmjs.com/package/mindee)
|
|
5
|
+
|
|
1
6
|
# Mindee API Helper Library for Node.js
|
|
2
7
|
Quickly and easily connect to Mindee's API services using Node.js.
|
|
3
8
|
|
|
@@ -27,7 +32,7 @@ const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });
|
|
|
27
32
|
// Load a file from disk and parse it
|
|
28
33
|
const apiResponse = mindeeClient
|
|
29
34
|
.docFromPath("/path/to/the/file.ext")
|
|
30
|
-
.parse(mindee.
|
|
35
|
+
.parse(mindee.InvoiceV4);
|
|
31
36
|
```
|
|
32
37
|
|
|
33
38
|
#### Region-Specific Documents
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "bin/mindee.js",
|
|
@@ -38,27 +38,27 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://mindee.com/",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/chai": "^4.3.
|
|
41
|
+
"@types/chai": "^4.3.4",
|
|
42
42
|
"@types/mocha": "^9.1.1",
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
45
|
-
"@typescript-eslint/parser": "^5.
|
|
46
|
-
"chai": "^4.3.
|
|
47
|
-
"eslint": "^8.
|
|
48
|
-
"eslint-config-prettier": "^8.
|
|
49
|
-
"eslint-plugin-prettier": "^4.1
|
|
50
|
-
"jsdoc": "^3.6.
|
|
51
|
-
"mocha": "^10.
|
|
52
|
-
"prettier": "^2.
|
|
53
|
-
"ts-node": "^10.
|
|
54
|
-
"typescript": "^4.
|
|
43
|
+
"@types/node": "^18.11.18",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
45
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
46
|
+
"chai": "^4.3.7",
|
|
47
|
+
"eslint": "^8.31.0",
|
|
48
|
+
"eslint-config-prettier": "^8.6.0",
|
|
49
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
50
|
+
"jsdoc": "^3.6.11",
|
|
51
|
+
"mocha": "^10.1.0",
|
|
52
|
+
"prettier": "^2.8.1",
|
|
53
|
+
"ts-node": "^10.9.1",
|
|
54
|
+
"typescript": "^4.9.4"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"commander": "
|
|
58
|
-
"file-type": "
|
|
59
|
-
"form-data": "
|
|
60
|
-
"mrz": "
|
|
61
|
-
"pdf-lib": "
|
|
57
|
+
"commander": "~9.4.1",
|
|
58
|
+
"file-type": "~16.5.4",
|
|
59
|
+
"form-data": "~3.0.1",
|
|
60
|
+
"mrz": "~3.2.1",
|
|
61
|
+
"pdf-lib": "~1.17.1"
|
|
62
62
|
},
|
|
63
63
|
"keywords": [
|
|
64
64
|
"typescript",
|
package/src/api/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Response } from "./response";
|
|
1
|
+
export { Response, ResponseSig } from "./response";
|
|
2
2
|
export { Endpoint, CustomEndpoint, StandardEndpoint, predictResponse, STANDARD_API_OWNER, API_KEY_ENVVAR_NAME, } from "./endpoint";
|
package/src/api/response.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export interface ResponseProps {
|
|
|
7
7
|
input: InputSource;
|
|
8
8
|
error: boolean;
|
|
9
9
|
}
|
|
10
|
+
export type ResponseSig<DocType extends Document> = {
|
|
11
|
+
new (documentClass: DocumentSig<DocType>, params: ResponseProps): Response<DocType>;
|
|
12
|
+
};
|
|
10
13
|
/**
|
|
11
14
|
* Base class for all responses.
|
|
12
15
|
*/
|
package/src/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { Readable } from "stream";
|
|
3
4
|
import { InputSource, PageOptions } from "./inputs";
|
|
4
5
|
import { Response } from "./api";
|
|
5
6
|
import { Document, DocumentSig } from "./documents";
|
|
6
7
|
import { DocumentConfig } from "./documents/documentConfig";
|
|
7
|
-
|
|
8
|
-
declare type DocConfigs = Map<string[], DocumentConfig<any>>;
|
|
8
|
+
type DocConfigs = Map<string[], DocumentConfig<any>>;
|
|
9
9
|
export interface PredictOptions {
|
|
10
10
|
/**
|
|
11
11
|
* For custom endpoints, the "API name" field in the "Settings" page of the API Builder.
|
|
@@ -100,11 +100,11 @@ export declare class Client {
|
|
|
100
100
|
*/
|
|
101
101
|
docFromBase64(inputString: string, filename: string): DocumentClient;
|
|
102
102
|
/**
|
|
103
|
-
* Load an input document from a `
|
|
103
|
+
* Load an input document from a `stream.Readable` object.
|
|
104
104
|
* @param inputStream
|
|
105
105
|
* @param filename
|
|
106
106
|
*/
|
|
107
|
-
docFromStream(inputStream:
|
|
107
|
+
docFromStream(inputStream: Readable, filename: string): DocumentClient;
|
|
108
108
|
/**
|
|
109
109
|
* Load an input document from a bytes string.
|
|
110
110
|
* @param inputBytes
|
package/src/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Document, DocumentConstructorProps } from "
|
|
2
|
-
import { ClassificationField, ListField } from "
|
|
3
|
-
import {
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
+
import { ClassificationField, ListField } from "./fields";
|
|
3
|
+
import { StringDict } from "../../fields";
|
|
4
4
|
export declare class CustomV1 extends Document {
|
|
5
5
|
fields: Map<string, ListField>;
|
|
6
6
|
classifications: Map<string, ClassificationField>;
|
|
7
7
|
constructor({ inputSource, prediction, extras, orientation, pageId, documentType, }: DocumentConstructorProps);
|
|
8
|
-
protected setField(fieldName: string, apiPrediction:
|
|
8
|
+
protected setField(fieldName: string, apiPrediction: StringDict, pageId: number | undefined): void;
|
|
9
9
|
toString(): string;
|
|
10
10
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CustomV1 = void 0;
|
|
4
|
-
const document_1 = require("
|
|
5
|
-
const fields_1 = require("
|
|
4
|
+
const document_1 = require("../document");
|
|
5
|
+
const fields_1 = require("./fields");
|
|
6
6
|
class CustomV1 extends document_1.Document {
|
|
7
7
|
constructor({ inputSource, prediction, extras = undefined, orientation = undefined, pageId, documentType, }) {
|
|
8
8
|
super({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { StringDict } from "../../fields/base";
|
|
2
|
+
import { FieldConstructor } from "../../fields/field";
|
|
3
|
+
import { Polygon } from "../../geometry";
|
|
3
4
|
export declare class ClassificationField {
|
|
4
5
|
/** The value for the classification. */
|
|
5
6
|
value: string;
|
|
@@ -9,12 +10,13 @@ export declare class ClassificationField {
|
|
|
9
10
|
*/
|
|
10
11
|
confidence: number;
|
|
11
12
|
constructor({ prediction }: {
|
|
12
|
-
prediction:
|
|
13
|
+
prediction: StringDict;
|
|
13
14
|
});
|
|
14
15
|
toString(): string;
|
|
15
16
|
}
|
|
16
17
|
export declare class ListFieldValue {
|
|
17
|
-
content
|
|
18
|
+
/** Extracted content of the prediction */
|
|
19
|
+
content: string | number;
|
|
18
20
|
/**
|
|
19
21
|
* The confidence score of the prediction.
|
|
20
22
|
* Note: Score is calculated on **word selection**, not its textual content (OCR).
|
|
@@ -30,7 +32,7 @@ export declare class ListFieldValue {
|
|
|
30
32
|
* the word in the document.
|
|
31
33
|
*/
|
|
32
34
|
polygon: Polygon;
|
|
33
|
-
constructor(prediction:
|
|
35
|
+
constructor(prediction: StringDict);
|
|
34
36
|
toString(): string;
|
|
35
37
|
}
|
|
36
38
|
export declare class ListField {
|
|
@@ -41,7 +43,7 @@ export declare class ListField {
|
|
|
41
43
|
/** The document page on which the information was found. */
|
|
42
44
|
pageId: number;
|
|
43
45
|
constructor({ prediction, reconstructed, pageId }: FieldConstructor);
|
|
44
|
-
contentsList(): Array<
|
|
46
|
+
contentsList(): Array<string | number>;
|
|
45
47
|
contentsString(separator?: string): string;
|
|
46
48
|
toString(): string;
|
|
47
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ListField = exports.ListFieldValue = exports.ClassificationField = void 0;
|
|
4
|
-
const geometry_1 = require("
|
|
4
|
+
const geometry_1 = require("../../geometry");
|
|
5
5
|
class ClassificationField {
|
|
6
6
|
constructor({ prediction }) {
|
|
7
7
|
this.value = prediction["value"];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { InputSource } from "../inputs";
|
|
2
|
-
import { PositionField, FullText, OrientationField,
|
|
3
|
-
export
|
|
2
|
+
import { PositionField, FullText, OrientationField, StringDict } from "../fields";
|
|
3
|
+
export type DocumentSig<DocType extends Document> = {
|
|
4
4
|
new ({ prediction, orientation, extras, inputSource, pageId, fullText, documentType, }: DocumentConstructorProps): DocType;
|
|
5
5
|
};
|
|
6
6
|
export interface DocumentConstructorProps extends BaseDocumentConstructorProps {
|
|
7
7
|
/** JSON parsed prediction from HTTP response */
|
|
8
|
-
prediction:
|
|
8
|
+
prediction: StringDict;
|
|
9
9
|
}
|
|
10
10
|
interface BaseDocumentConstructorProps {
|
|
11
11
|
/** Orientation JSON for page-level document */
|
|
12
|
-
orientation?:
|
|
12
|
+
orientation?: StringDict;
|
|
13
13
|
/** Extras JSON */
|
|
14
|
-
extras?:
|
|
14
|
+
extras?: StringDict;
|
|
15
15
|
/** input file given to parse the document */
|
|
16
16
|
inputSource?: InputSource;
|
|
17
17
|
/** Page ID for page-level document */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import {
|
|
2
|
+
import { TextField } from "../../../fields";
|
|
3
3
|
export declare class LicensePlateV1 extends Document {
|
|
4
4
|
/** A list of license plates values. */
|
|
5
|
-
licensePlates:
|
|
5
|
+
licensePlates: TextField[];
|
|
6
6
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
7
7
|
toString(): string;
|
|
8
8
|
}
|
|
@@ -13,14 +13,15 @@ class LicensePlateV1 extends document_1.Document {
|
|
|
13
13
|
});
|
|
14
14
|
/** A list of license plates values. */
|
|
15
15
|
this.licensePlates = [];
|
|
16
|
-
prediction.license_plates.map((prediction) => this.licensePlates.push(new fields_1.
|
|
16
|
+
prediction.license_plates.map((prediction) => this.licensePlates.push(new fields_1.TextField({
|
|
17
17
|
prediction: prediction,
|
|
18
18
|
pageId: pageId,
|
|
19
19
|
})));
|
|
20
20
|
}
|
|
21
21
|
toString() {
|
|
22
22
|
const outStr = `----- EU License plate V1 -----
|
|
23
|
-
|
|
23
|
+
Filename: ${this.filename}
|
|
24
|
+
License plates: ${this.licensePlates.map((plate) => plate.value).join(", ")}
|
|
24
25
|
----------------------
|
|
25
26
|
`;
|
|
26
27
|
return LicensePlateV1.cleanOutString(outStr);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
-
import { TaxField,
|
|
2
|
+
import { TaxField, TextField, Amount, Locale, DateField as Date, CompanyRegistration } from "../../fields";
|
|
3
3
|
export declare class FinancialDocumentV1 extends Document {
|
|
4
4
|
#private;
|
|
5
5
|
pageId: number | undefined;
|
|
@@ -7,18 +7,18 @@ export declare class FinancialDocumentV1 extends Document {
|
|
|
7
7
|
totalIncl: Amount;
|
|
8
8
|
date: Date;
|
|
9
9
|
dueDate: Date;
|
|
10
|
-
category:
|
|
11
|
-
time:
|
|
10
|
+
category: TextField;
|
|
11
|
+
time: TextField;
|
|
12
12
|
taxes: TaxField[];
|
|
13
13
|
totalTax: Amount;
|
|
14
14
|
totalExcl: Amount;
|
|
15
|
-
supplier:
|
|
16
|
-
supplierAddress:
|
|
17
|
-
invoiceNumber:
|
|
15
|
+
supplier: TextField;
|
|
16
|
+
supplierAddress: TextField;
|
|
17
|
+
invoiceNumber: TextField;
|
|
18
18
|
companyRegistration: CompanyRegistration[];
|
|
19
|
-
customerName:
|
|
20
|
-
customerAddress:
|
|
21
|
-
paymentDetails:
|
|
19
|
+
customerName: TextField;
|
|
20
|
+
customerAddress: TextField;
|
|
21
|
+
paymentDetails: TextField[];
|
|
22
22
|
customerCompanyRegistration: CompanyRegistration[];
|
|
23
23
|
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
24
24
|
toString(): string;
|
|
@@ -63,7 +63,7 @@ _FinancialDocumentV1_instances = new WeakSet(), _FinancialDocumentV1_initFromApi
|
|
|
63
63
|
this.companyRegistration = invoice.customerCompanyRegistration;
|
|
64
64
|
this.orientation = invoice.orientation;
|
|
65
65
|
this.totalTax = invoice.totalTax;
|
|
66
|
-
this.time = new fields_1.
|
|
66
|
+
this.time = new fields_1.TextField({
|
|
67
67
|
prediction: { value: undefined, confidence: 0.0 },
|
|
68
68
|
});
|
|
69
69
|
this.customerName = invoice.customerName;
|
|
@@ -86,18 +86,18 @@ _FinancialDocumentV1_instances = new WeakSet(), _FinancialDocumentV1_initFromApi
|
|
|
86
86
|
this.totalIncl = receipt.totalIncl;
|
|
87
87
|
this.totalExcl = receipt.totalExcl;
|
|
88
88
|
this.supplier = receipt.merchantName;
|
|
89
|
-
this.supplierAddress = new fields_1.
|
|
89
|
+
this.supplierAddress = new fields_1.TextField({
|
|
90
90
|
prediction: { value: undefined, confidence: 0.0 },
|
|
91
91
|
});
|
|
92
92
|
this.time = receipt.time;
|
|
93
93
|
this.totalTax = receipt.totalTax;
|
|
94
|
-
this.invoiceNumber = new fields_1.
|
|
94
|
+
this.invoiceNumber = new fields_1.TextField({
|
|
95
95
|
prediction: { value: undefined, confidence: 0.0 },
|
|
96
96
|
});
|
|
97
|
-
this.customerName = new fields_1.
|
|
97
|
+
this.customerName = new fields_1.TextField({
|
|
98
98
|
prediction: { value: undefined, confidence: 0.0 },
|
|
99
99
|
});
|
|
100
|
-
this.customerAddress = new fields_1.
|
|
100
|
+
this.customerAddress = new fields_1.TextField({
|
|
101
101
|
prediction: { value: undefined, confidence: 0.0 },
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import {
|
|
2
|
+
import { TextField } from "../../../fields";
|
|
3
3
|
export declare class BankAccountDetailsV1 extends Document {
|
|
4
4
|
/** The IBAN number. */
|
|
5
|
-
iban:
|
|
5
|
+
iban: TextField;
|
|
6
6
|
/** The account holder name. */
|
|
7
|
-
accountHolderName:
|
|
7
|
+
accountHolderName: TextField;
|
|
8
8
|
/** The SWIFT value. */
|
|
9
|
-
swift:
|
|
9
|
+
swift: TextField;
|
|
10
10
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
11
11
|
toString(): string;
|
|
12
12
|
}
|
|
@@ -11,15 +11,15 @@ class BankAccountDetailsV1 extends document_1.Document {
|
|
|
11
11
|
orientation: orientation,
|
|
12
12
|
extras: extras,
|
|
13
13
|
});
|
|
14
|
-
this.iban = new fields_1.
|
|
14
|
+
this.iban = new fields_1.TextField({
|
|
15
15
|
prediction: prediction.iban,
|
|
16
16
|
pageId: pageId,
|
|
17
17
|
});
|
|
18
|
-
this.accountHolderName = new fields_1.
|
|
18
|
+
this.accountHolderName = new fields_1.TextField({
|
|
19
19
|
prediction: prediction.account_holder_name,
|
|
20
20
|
pageId: pageId,
|
|
21
21
|
});
|
|
22
|
-
this.swift = new fields_1.
|
|
22
|
+
this.swift = new fields_1.TextField({
|
|
23
23
|
prediction: prediction.swift,
|
|
24
24
|
pageId: pageId,
|
|
25
25
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import {
|
|
2
|
+
import { TextField, DateField } from "../../../fields";
|
|
3
3
|
export declare class CarteVitaleV1 extends Document {
|
|
4
4
|
/** The list of the names of the person. */
|
|
5
|
-
givenNames:
|
|
5
|
+
givenNames: TextField[];
|
|
6
6
|
/** The surname of the person. */
|
|
7
|
-
surname:
|
|
7
|
+
surname: TextField;
|
|
8
8
|
/** The ID number of the card. */
|
|
9
|
-
idNumber:
|
|
9
|
+
idNumber: TextField;
|
|
10
10
|
/** The issuance date of the card. */
|
|
11
11
|
issuanceDate: DateField;
|
|
12
12
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
@@ -13,7 +13,7 @@ class CarteVitaleV1 extends document_1.Document {
|
|
|
13
13
|
});
|
|
14
14
|
/** The list of the names of the person. */
|
|
15
15
|
this.givenNames = [];
|
|
16
|
-
this.idNumber = new fields_1.
|
|
16
|
+
this.idNumber = new fields_1.TextField({
|
|
17
17
|
prediction: prediction.social_security,
|
|
18
18
|
pageId: pageId,
|
|
19
19
|
});
|
|
@@ -21,17 +21,18 @@ class CarteVitaleV1 extends document_1.Document {
|
|
|
21
21
|
prediction: prediction.issuance_date,
|
|
22
22
|
pageId: pageId,
|
|
23
23
|
});
|
|
24
|
-
this.surname = new fields_1.
|
|
24
|
+
this.surname = new fields_1.TextField({
|
|
25
25
|
prediction: prediction.surname,
|
|
26
26
|
pageId: pageId,
|
|
27
27
|
});
|
|
28
|
-
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.
|
|
28
|
+
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.TextField({
|
|
29
29
|
prediction: prediction,
|
|
30
30
|
pageId: pageId,
|
|
31
31
|
})));
|
|
32
32
|
}
|
|
33
33
|
toString() {
|
|
34
34
|
const outStr = `----- FR Carte Vitale V1 -----
|
|
35
|
+
Filename: ${this.filename}
|
|
35
36
|
Given names: ${this.givenNames.map((name) => name.value).join(" ")}
|
|
36
37
|
Surname: ${this.surname}
|
|
37
38
|
ID Number: ${this.idNumber}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import {
|
|
2
|
+
import { TextField, DateField, BaseField } from "../../../fields";
|
|
3
3
|
export declare class IdCardV1 extends Document {
|
|
4
4
|
/** The authority which has issued the card. */
|
|
5
|
-
authority:
|
|
5
|
+
authority: TextField;
|
|
6
6
|
/** Indicates if it is the recto, the verso or the both of it. */
|
|
7
7
|
documentSide: BaseField;
|
|
8
8
|
/** The id number of the card. */
|
|
9
|
-
idNumber:
|
|
9
|
+
idNumber: TextField;
|
|
10
10
|
/** The birth date of the person. */
|
|
11
11
|
birthDate: DateField;
|
|
12
12
|
/** The expiry date of the card. */
|
|
13
13
|
expiryDate: DateField;
|
|
14
14
|
/** The birth place of the person. */
|
|
15
|
-
birthPlace:
|
|
15
|
+
birthPlace: TextField;
|
|
16
16
|
/** The gender of the person. */
|
|
17
|
-
gender:
|
|
17
|
+
gender: TextField;
|
|
18
18
|
/** The first mrz value. */
|
|
19
|
-
mrz1:
|
|
19
|
+
mrz1: TextField;
|
|
20
20
|
/** The second mrz value. */
|
|
21
|
-
mrz2:
|
|
21
|
+
mrz2: TextField;
|
|
22
22
|
/** The surname of the person. */
|
|
23
|
-
surname:
|
|
23
|
+
surname: TextField;
|
|
24
24
|
/** The list of the names of the person. */
|
|
25
|
-
givenNames:
|
|
25
|
+
givenNames: TextField[];
|
|
26
26
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
27
27
|
toString(): string;
|
|
28
28
|
}
|
|
@@ -13,14 +13,14 @@ class IdCardV1 extends document_1.Document {
|
|
|
13
13
|
});
|
|
14
14
|
/** The list of the names of the person. */
|
|
15
15
|
this.givenNames = [];
|
|
16
|
-
this.authority = new fields_1.
|
|
16
|
+
this.authority = new fields_1.TextField({
|
|
17
17
|
prediction: prediction.authority,
|
|
18
18
|
pageId: pageId,
|
|
19
19
|
});
|
|
20
20
|
this.documentSide = new fields_1.BaseField({
|
|
21
21
|
prediction: prediction.document_side,
|
|
22
22
|
});
|
|
23
|
-
this.idNumber = new fields_1.
|
|
23
|
+
this.idNumber = new fields_1.TextField({
|
|
24
24
|
prediction: prediction.id_number,
|
|
25
25
|
pageId: pageId,
|
|
26
26
|
});
|
|
@@ -32,27 +32,27 @@ class IdCardV1 extends document_1.Document {
|
|
|
32
32
|
prediction: prediction.expiry_date,
|
|
33
33
|
pageId: pageId,
|
|
34
34
|
});
|
|
35
|
-
this.birthPlace = new fields_1.
|
|
35
|
+
this.birthPlace = new fields_1.TextField({
|
|
36
36
|
prediction: prediction.birth_place,
|
|
37
37
|
pageId: pageId,
|
|
38
38
|
});
|
|
39
|
-
this.gender = new fields_1.
|
|
39
|
+
this.gender = new fields_1.TextField({
|
|
40
40
|
prediction: prediction.gender,
|
|
41
41
|
pageId: pageId,
|
|
42
42
|
});
|
|
43
|
-
this.surname = new fields_1.
|
|
43
|
+
this.surname = new fields_1.TextField({
|
|
44
44
|
prediction: prediction.surname,
|
|
45
45
|
pageId: pageId,
|
|
46
46
|
});
|
|
47
|
-
this.mrz1 = new fields_1.
|
|
47
|
+
this.mrz1 = new fields_1.TextField({
|
|
48
48
|
prediction: prediction.mrz1,
|
|
49
49
|
pageId: pageId,
|
|
50
50
|
});
|
|
51
|
-
this.mrz2 = new fields_1.
|
|
51
|
+
this.mrz2 = new fields_1.TextField({
|
|
52
52
|
prediction: prediction.mrz2,
|
|
53
53
|
pageId: pageId,
|
|
54
54
|
});
|
|
55
|
-
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.
|
|
55
|
+
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.TextField({
|
|
56
56
|
prediction: prediction,
|
|
57
57
|
pageId: pageId,
|
|
58
58
|
})));
|
package/src/documents/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { ReceiptV3 } from "./receipt/receiptV3";
|
|
|
4
4
|
export { ReceiptV4 } from "./receipt/receiptV4";
|
|
5
5
|
export { PassportV1 } from "./passport/passportV1";
|
|
6
6
|
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
7
|
-
export { CustomV1 } from "./custom";
|
|
7
|
+
export { CustomV1 } from "./custom/customV1";
|
|
8
8
|
export { CropperV1 } from "./cropper/cropperV1";
|
|
9
9
|
export { ShippingContainerV1 } from "./shipping_container/shippingContainerV1";
|
|
10
10
|
export { Document, DocumentConstructorProps, DocumentSig } from "./document";
|
package/src/documents/index.js
CHANGED
|
@@ -36,8 +36,8 @@ var passportV1_1 = require("./passport/passportV1");
|
|
|
36
36
|
Object.defineProperty(exports, "PassportV1", { enumerable: true, get: function () { return passportV1_1.PassportV1; } });
|
|
37
37
|
var financialDocumentV1_1 = require("./financialDocument/financialDocumentV1");
|
|
38
38
|
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return financialDocumentV1_1.FinancialDocumentV1; } });
|
|
39
|
-
var
|
|
40
|
-
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return
|
|
39
|
+
var customV1_1 = require("./custom/customV1");
|
|
40
|
+
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return customV1_1.CustomV1; } });
|
|
41
41
|
var cropperV1_1 = require("./cropper/cropperV1");
|
|
42
42
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
43
43
|
var shippingContainerV1_1 = require("./shipping_container/shippingContainerV1");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StringDict } from "../../fields";
|
|
2
2
|
import { Polygon } from "../../geometry";
|
|
3
3
|
export declare class InvoiceLineItem {
|
|
4
4
|
/** The product code referring to the item. */
|
|
@@ -24,6 +24,6 @@ export declare class InvoiceLineItem {
|
|
|
24
24
|
* the field in the document.
|
|
25
25
|
*/
|
|
26
26
|
polygon: Polygon;
|
|
27
|
-
constructor({ prediction }:
|
|
27
|
+
constructor({ prediction }: StringDict);
|
|
28
28
|
toString(): string;
|
|
29
29
|
}
|
|
@@ -45,7 +45,7 @@ class InvoiceLineItem {
|
|
|
45
45
|
const unitPrice = this.unitPrice !== null ? (0, amount_1.floatToString)(this.unitPrice) : "";
|
|
46
46
|
const totalAmount = this.totalAmount !== null ? (0, amount_1.floatToString)(this.totalAmount) : "";
|
|
47
47
|
let tax = this.taxAmount !== null ? (0, amount_1.floatToString)(this.taxAmount) : "";
|
|
48
|
-
tax += this.taxRate !== null ? ` (${this.taxRate}
|
|
48
|
+
tax += this.taxRate !== null ? ` (${(0, amount_1.floatToString)(this.taxRate)}%)` : "";
|
|
49
49
|
let description = this.description ?? "";
|
|
50
50
|
if (description.length > 32) {
|
|
51
51
|
description = this.description.substring(0, 32) + "...";
|
|
@@ -58,7 +58,7 @@ class InvoiceLineItem {
|
|
|
58
58
|
" | " +
|
|
59
59
|
totalAmount.padEnd(8) +
|
|
60
60
|
" | " +
|
|
61
|
-
tax.padEnd(
|
|
61
|
+
tax.padEnd(16) +
|
|
62
62
|
" | " +
|
|
63
63
|
description);
|
|
64
64
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
-
import { BaseField, TaxField, PaymentDetails, Locale, Amount,
|
|
2
|
+
import { BaseField, TaxField, PaymentDetails, Locale, Amount, TextField, DateField, CompanyRegistration } from "../../fields";
|
|
3
3
|
export declare class InvoiceV3 extends Document {
|
|
4
4
|
#private;
|
|
5
5
|
/** Total amount with the tax amount of the purchase. */
|
|
@@ -13,23 +13,23 @@ export declare class InvoiceV3 extends Document {
|
|
|
13
13
|
/** The due date of the invoice. */
|
|
14
14
|
dueDate: DateField;
|
|
15
15
|
/** The created time of the invoice */
|
|
16
|
-
time:
|
|
16
|
+
time: TextField;
|
|
17
17
|
/** The total tax. */
|
|
18
18
|
totalTax: Amount;
|
|
19
19
|
/** The total amount without the tax value. Same as totalExcl. */
|
|
20
20
|
totalNet: Amount;
|
|
21
21
|
/** The supplier name. */
|
|
22
|
-
supplier:
|
|
22
|
+
supplier: TextField;
|
|
23
23
|
/** The supplier address. */
|
|
24
|
-
supplierAddress:
|
|
24
|
+
supplierAddress: TextField;
|
|
25
25
|
/** The invoice number. */
|
|
26
|
-
invoiceNumber:
|
|
26
|
+
invoiceNumber: TextField;
|
|
27
27
|
/** The company regitration information. */
|
|
28
28
|
companyRegistration: CompanyRegistration[];
|
|
29
29
|
/** The name of the customer. */
|
|
30
|
-
customerName:
|
|
30
|
+
customerName: TextField;
|
|
31
31
|
/** The address of the customer. */
|
|
32
|
-
customerAddress:
|
|
32
|
+
customerAddress: TextField;
|
|
33
33
|
/** The list of the taxes. */
|
|
34
34
|
taxes: TaxField[];
|
|
35
35
|
/** The payment information. */
|