mindee 3.4.1 → 3.6.0
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 +28 -0
- package/package.json +3 -3
- package/src/cli.js +27 -11
- package/src/client.js +13 -1
- package/src/documents/documentConfig.d.ts +2 -2
- package/src/documents/documentConfig.js +4 -4
- package/src/documents/eu/licensePlate/licensePlateV1.d.ts +1 -1
- package/src/documents/eu/licensePlate/licensePlateV1.js +1 -1
- package/src/documents/financialDocument/financialDocumentV0.d.ts +28 -0
- package/src/documents/financialDocument/financialDocumentV0.js +140 -0
- package/src/documents/financialDocument/financialDocumentV1.d.ts +44 -15
- package/src/documents/financialDocument/financialDocumentV1.js +154 -110
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +4 -3
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +1 -0
- package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +3 -3
- package/src/documents/fr/carteVitale/carteVitaleV1.js +3 -3
- package/src/documents/fr/idCard/idCardV1.d.ts +1 -1
- package/src/documents/index.d.ts +4 -0
- package/src/documents/index.js +10 -1
- package/src/documents/invoice/invoiceV4.d.ts +1 -0
- package/src/documents/invoice/invoiceV4.js +85 -86
- package/src/documents/invoiceSplitter/invoiceSplitterV1.d.ts +14 -0
- package/src/documents/invoiceSplitter/invoiceSplitterV1.js +46 -0
- package/src/documents/mindeeVision/mindeeVisionV1.d.ts +8 -0
- package/src/documents/mindeeVision/mindeeVisionV1.js +29 -0
- package/src/documents/passport/passportV1.d.ts +5 -5
- package/src/documents/proofOfAddress/proofOfAddressV1.d.ts +24 -0
- package/src/documents/proofOfAddress/proofOfAddressV1.js +78 -0
- package/src/documents/receipt/receiptV4.d.ts +4 -5
- package/src/documents/receipt/receiptV4.js +55 -66
- package/src/documents/us/bankCheck/bankCheckV1.d.ts +3 -3
- package/src/fields/tax.d.ts +5 -1
- package/src/fields/tax.js +10 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/documents/receipt/tax.d.ts +0 -25
- package/src/documents/receipt/tax.js +0 -40
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _FinancialDocumentV1_instances, _FinancialDocumentV1_initFromApiPrediction, _FinancialDocumentV1_checklist, _FinancialDocumentV1_taxesMatchTotalIncl;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.FinancialDocumentV1 = void 0;
|
|
10
4
|
const document_1 = require("../document");
|
|
11
|
-
const invoiceV3_1 = require("../invoice/invoiceV3");
|
|
12
|
-
const receiptV3_1 = require("../receipt/receiptV3");
|
|
13
5
|
const fields_1 = require("../../fields");
|
|
6
|
+
const invoiceLineItem_1 = require("../invoice/invoiceLineItem");
|
|
7
|
+
/**
|
|
8
|
+
* Financial Document.
|
|
9
|
+
*/
|
|
14
10
|
class FinancialDocumentV1 extends document_1.Document {
|
|
15
11
|
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, fullText = undefined, pageId = undefined, }) {
|
|
16
12
|
super({
|
|
@@ -20,118 +16,166 @@ class FinancialDocumentV1 extends document_1.Document {
|
|
|
20
16
|
fullText: fullText,
|
|
21
17
|
extras: extras,
|
|
22
18
|
});
|
|
23
|
-
|
|
19
|
+
/** List of Reference numbers including PO number. */
|
|
20
|
+
this.referenceNumbers = [];
|
|
21
|
+
/** The payment information. */
|
|
22
|
+
this.supplierPaymentDetails = [];
|
|
23
|
+
/** The supplier company registration information. */
|
|
24
|
+
this.supplierCompanyRegistrations = [];
|
|
25
|
+
/** The company registration information for the customer. */
|
|
26
|
+
this.customerCompanyRegistrations = [];
|
|
27
|
+
/** The list of the taxes. */
|
|
24
28
|
this.taxes = [];
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
toString() {
|
|
32
|
-
const outStr = `-----Financial document-----
|
|
33
|
-
Filename: ${this.filename}
|
|
34
|
-
Total amount: ${this.totalIncl.value}
|
|
35
|
-
Date: ${this.date.value}
|
|
36
|
-
Supplier: ${this.supplier.value}
|
|
37
|
-
Total taxes: ${this.totalTax.value}
|
|
38
|
-
----------------------
|
|
39
|
-
`;
|
|
40
|
-
return FinancialDocumentV1.cleanOutString(outStr);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.FinancialDocumentV1 = FinancialDocumentV1;
|
|
44
|
-
_FinancialDocumentV1_instances = new WeakSet(), _FinancialDocumentV1_initFromApiPrediction = function _FinancialDocumentV1_initFromApiPrediction(prediction, inputFile, pageNumber, orientation, extras) {
|
|
45
|
-
if (Object.keys(prediction).includes("invoice_number")) {
|
|
46
|
-
const invoice = new invoiceV3_1.InvoiceV3({
|
|
47
|
-
prediction: prediction,
|
|
48
|
-
inputSource: inputFile,
|
|
49
|
-
pageId: pageNumber,
|
|
50
|
-
orientation: orientation,
|
|
51
|
-
extras: extras,
|
|
29
|
+
/** Line items details. */
|
|
30
|
+
this.lineItems = [];
|
|
31
|
+
this.locale = new fields_1.Locale({
|
|
32
|
+
prediction: prediction.locale,
|
|
33
|
+
valueKey: "language",
|
|
52
34
|
});
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.date = invoice.date;
|
|
57
|
-
this.invoiceNumber = invoice.invoiceNumber;
|
|
58
|
-
this.dueDate = invoice.dueDate;
|
|
59
|
-
this.taxes = invoice.taxes;
|
|
60
|
-
this.supplier = invoice.supplier;
|
|
61
|
-
this.supplierAddress = invoice.supplierAddress;
|
|
62
|
-
this.paymentDetails = invoice.paymentDetails;
|
|
63
|
-
this.companyRegistration = invoice.customerCompanyRegistration;
|
|
64
|
-
this.orientation = invoice.orientation;
|
|
65
|
-
this.totalTax = invoice.totalTax;
|
|
66
|
-
this.time = new fields_1.TextField({
|
|
67
|
-
prediction: { value: undefined, confidence: 0.0 },
|
|
35
|
+
this.documentType = new fields_1.BaseField({
|
|
36
|
+
prediction: prediction.document_type,
|
|
37
|
+
valueKey: "value",
|
|
68
38
|
});
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const receipt = new receiptV3_1.ReceiptV3({
|
|
75
|
-
prediction: prediction,
|
|
76
|
-
inputSource: inputFile,
|
|
77
|
-
pageId: pageNumber,
|
|
78
|
-
orientation: orientation,
|
|
79
|
-
extras: extras,
|
|
39
|
+
this.referenceNumbers = prediction.reference_numbers.map(function (prediction) {
|
|
40
|
+
return new fields_1.TextField({
|
|
41
|
+
prediction: prediction,
|
|
42
|
+
pageId: pageId,
|
|
43
|
+
});
|
|
80
44
|
});
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
45
|
+
this.totalAmount = new fields_1.Amount({
|
|
46
|
+
prediction: prediction.total_amount,
|
|
47
|
+
valueKey: "value",
|
|
48
|
+
pageId: pageId,
|
|
49
|
+
});
|
|
50
|
+
this.totalTax = new fields_1.Amount({
|
|
51
|
+
prediction: prediction.total_tax,
|
|
52
|
+
valueKey: "value",
|
|
53
|
+
pageId: pageId,
|
|
54
|
+
});
|
|
55
|
+
this.totalNet = new fields_1.Amount({
|
|
56
|
+
prediction: prediction.total_net,
|
|
57
|
+
valueKey: "value",
|
|
58
|
+
pageId: pageId,
|
|
59
|
+
});
|
|
60
|
+
this.date = new fields_1.DateField({
|
|
61
|
+
prediction: prediction.date,
|
|
62
|
+
pageId,
|
|
63
|
+
});
|
|
64
|
+
this.dueDate = new fields_1.DateField({
|
|
65
|
+
prediction: prediction.due_date,
|
|
66
|
+
pageId: pageId,
|
|
91
67
|
});
|
|
92
|
-
this.time = receipt.time;
|
|
93
|
-
this.totalTax = receipt.totalTax;
|
|
94
68
|
this.invoiceNumber = new fields_1.TextField({
|
|
95
|
-
prediction:
|
|
69
|
+
prediction: prediction.invoice_number,
|
|
70
|
+
pageId: pageId,
|
|
71
|
+
});
|
|
72
|
+
this.supplierName = new fields_1.TextField({
|
|
73
|
+
prediction: prediction.supplier_name,
|
|
74
|
+
pageId: pageId,
|
|
75
|
+
});
|
|
76
|
+
this.supplierAddress = new fields_1.TextField({
|
|
77
|
+
prediction: prediction.supplier_address,
|
|
78
|
+
pageId: pageId,
|
|
96
79
|
});
|
|
80
|
+
this.supplierCompanyRegistrations =
|
|
81
|
+
prediction.supplier_company_registrations.map(function (prediction) {
|
|
82
|
+
return new fields_1.CompanyRegistration({
|
|
83
|
+
prediction: prediction,
|
|
84
|
+
pageId: pageId,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
97
87
|
this.customerName = new fields_1.TextField({
|
|
98
|
-
prediction:
|
|
88
|
+
prediction: prediction.customer_name,
|
|
89
|
+
pageId: pageId,
|
|
99
90
|
});
|
|
100
91
|
this.customerAddress = new fields_1.TextField({
|
|
101
|
-
prediction:
|
|
92
|
+
prediction: prediction.customer_address,
|
|
93
|
+
pageId: pageId,
|
|
94
|
+
});
|
|
95
|
+
prediction.customer_company_registrations.map((prediction) => this.customerCompanyRegistrations.push(new fields_1.CompanyRegistration({
|
|
96
|
+
prediction: prediction,
|
|
97
|
+
pageId: pageId,
|
|
98
|
+
})));
|
|
99
|
+
prediction.supplier_payment_details.map((prediction) => this.supplierPaymentDetails.push(new fields_1.PaymentDetails({
|
|
100
|
+
prediction: prediction,
|
|
101
|
+
pageId: pageId,
|
|
102
|
+
})));
|
|
103
|
+
prediction.line_items.map((prediction) => this.lineItems.push(new invoiceLineItem_1.InvoiceLineItem({
|
|
104
|
+
prediction: prediction,
|
|
105
|
+
})));
|
|
106
|
+
this.tip = new fields_1.Amount({
|
|
107
|
+
prediction: prediction.tip,
|
|
108
|
+
valueKey: "value",
|
|
109
|
+
pageId: pageId,
|
|
110
|
+
});
|
|
111
|
+
this.category = new fields_1.TextField({
|
|
112
|
+
prediction: prediction.category,
|
|
113
|
+
pageId: pageId,
|
|
114
|
+
});
|
|
115
|
+
this.subCategory = new fields_1.TextField({
|
|
116
|
+
prediction: prediction.subcategory,
|
|
117
|
+
pageId: pageId,
|
|
102
118
|
});
|
|
119
|
+
this.time = new fields_1.TextField({
|
|
120
|
+
prediction: prediction.time,
|
|
121
|
+
pageId: pageId,
|
|
122
|
+
});
|
|
123
|
+
prediction.taxes.map((taxPrediction) => this.taxes.push(new fields_1.TaxField({
|
|
124
|
+
prediction: taxPrediction,
|
|
125
|
+
pageId: pageId,
|
|
126
|
+
valueKey: "value",
|
|
127
|
+
rateKey: "rate",
|
|
128
|
+
codeKey: "code",
|
|
129
|
+
baseKey: "base",
|
|
130
|
+
})));
|
|
103
131
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
toString() {
|
|
133
|
+
const taxes = this.taxes.map((item) => item.toString()).join("\n ");
|
|
134
|
+
const referenceNumbers = this.referenceNumbers
|
|
135
|
+
.map((item) => item.toString())
|
|
136
|
+
.join(", ");
|
|
137
|
+
const paymentDetails = this.supplierPaymentDetails
|
|
138
|
+
.map((item) => item.toString())
|
|
139
|
+
.join("\n ");
|
|
140
|
+
const customerCompanyRegistration = this.customerCompanyRegistrations
|
|
141
|
+
.map((item) => item.toString())
|
|
142
|
+
.join("; ");
|
|
143
|
+
const supplierCompanyRegistration = this.supplierCompanyRegistrations
|
|
144
|
+
.map((item) => item.toString())
|
|
145
|
+
.join("; ");
|
|
146
|
+
let lineItems = "";
|
|
147
|
+
if (this.lineItems.length > 0) {
|
|
148
|
+
lineItems =
|
|
149
|
+
"\n Code | QTY | Price | Amount | Tax (Rate) | Description\n ";
|
|
150
|
+
lineItems += this.lineItems.map((item) => item.toString()).join("\n ");
|
|
151
|
+
}
|
|
152
|
+
const outStr = `----- Financial Document V1 -----
|
|
153
|
+
Filename: ${this.filename}
|
|
154
|
+
Document type: ${this.documentType}
|
|
155
|
+
Category: ${this.category}
|
|
156
|
+
Subcategory: ${this.subCategory}
|
|
157
|
+
Locale: ${this.locale}
|
|
158
|
+
Invoice number: ${this.invoiceNumber}
|
|
159
|
+
Reference numbers: ${referenceNumbers}
|
|
160
|
+
Date: ${this.date}
|
|
161
|
+
Due date: ${this.dueDate}
|
|
162
|
+
Time: ${this.time}
|
|
163
|
+
Supplier name: ${this.supplierName}
|
|
164
|
+
Supplier address: ${this.supplierAddress}
|
|
165
|
+
Supplier company registrations: ${supplierCompanyRegistration}
|
|
166
|
+
Supplier payment details: ${paymentDetails}
|
|
167
|
+
Customer name: ${this.customerName}
|
|
168
|
+
Customer address: ${this.customerAddress}
|
|
169
|
+
Customer company registrations: ${customerCompanyRegistration}
|
|
170
|
+
Tip: ${this.tip}
|
|
171
|
+
Taxes: ${taxes}
|
|
172
|
+
Total tax: ${this.totalTax}
|
|
173
|
+
Total net: ${this.totalNet}
|
|
174
|
+
Total amount: ${this.totalAmount}
|
|
175
|
+
Line Items: ${lineItems}
|
|
176
|
+
----------------------
|
|
177
|
+
`;
|
|
178
|
+
return FinancialDocumentV1.cleanOutString(outStr);
|
|
135
179
|
}
|
|
136
|
-
|
|
137
|
-
|
|
180
|
+
}
|
|
181
|
+
exports.FinancialDocumentV1 = FinancialDocumentV1;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
2
|
import { TextField } from "../../../fields";
|
|
3
|
+
/** French bank account information (RIB) */
|
|
3
4
|
export declare class BankAccountDetailsV1 extends Document {
|
|
4
|
-
/** The IBAN
|
|
5
|
+
/** The account's IBAN. */
|
|
5
6
|
iban: TextField;
|
|
6
|
-
/** The account holder name. */
|
|
7
|
+
/** The account holder's name. */
|
|
7
8
|
accountHolderName: TextField;
|
|
8
|
-
/** The SWIFT
|
|
9
|
+
/** The bank's SWIFT code. */
|
|
9
10
|
swift: TextField;
|
|
10
11
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
11
12
|
toString(): string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BankAccountDetailsV1 = void 0;
|
|
4
4
|
const document_1 = require("../../document");
|
|
5
5
|
const fields_1 = require("../../../fields");
|
|
6
|
+
/** French bank account information (RIB) */
|
|
6
7
|
class BankAccountDetailsV1 extends document_1.Document {
|
|
7
8
|
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
9
|
super({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
2
|
import { TextField, DateField } from "../../../fields";
|
|
3
3
|
export declare class CarteVitaleV1 extends Document {
|
|
4
|
-
/**
|
|
4
|
+
/** List of given (first) names of the cardholder. */
|
|
5
5
|
givenNames: TextField[];
|
|
6
6
|
/** The surname of the person. */
|
|
7
7
|
surname: TextField;
|
|
8
|
-
/** The
|
|
9
|
-
|
|
8
|
+
/** The social security number of the cardholder. */
|
|
9
|
+
socialSecurity: TextField;
|
|
10
10
|
/** The issuance date of the card. */
|
|
11
11
|
issuanceDate: DateField;
|
|
12
12
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
@@ -11,9 +11,9 @@ class CarteVitaleV1 extends document_1.Document {
|
|
|
11
11
|
orientation: orientation,
|
|
12
12
|
extras: extras,
|
|
13
13
|
});
|
|
14
|
-
/**
|
|
14
|
+
/** List of given (first) names of the cardholder. */
|
|
15
15
|
this.givenNames = [];
|
|
16
|
-
this.
|
|
16
|
+
this.socialSecurity = new fields_1.TextField({
|
|
17
17
|
prediction: prediction.social_security,
|
|
18
18
|
pageId: pageId,
|
|
19
19
|
});
|
|
@@ -35,7 +35,7 @@ class CarteVitaleV1 extends document_1.Document {
|
|
|
35
35
|
Filename: ${this.filename}
|
|
36
36
|
Given names: ${this.givenNames.map((name) => name.value).join(" ")}
|
|
37
37
|
Surname: ${this.surname}
|
|
38
|
-
|
|
38
|
+
Social Security Number: ${this.socialSecurity}
|
|
39
39
|
Issuance date: ${this.issuanceDate}
|
|
40
40
|
----------------------
|
|
41
41
|
`;
|
|
@@ -3,7 +3,7 @@ import { TextField, DateField, BaseField } from "../../../fields";
|
|
|
3
3
|
export declare class IdCardV1 extends Document {
|
|
4
4
|
/** The authority which has issued the card. */
|
|
5
5
|
authority: TextField;
|
|
6
|
-
/** Indicates if it is the recto, the verso or
|
|
6
|
+
/** Indicates if it is the recto side, the verso side or both. */
|
|
7
7
|
documentSide: BaseField;
|
|
8
8
|
/** The id number of the card. */
|
|
9
9
|
idNumber: TextField;
|
package/src/documents/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export { InvoiceV3 } from "./invoice/invoiceV3";
|
|
2
2
|
export { InvoiceV4 } from "./invoice/invoiceV4";
|
|
3
|
+
export { InvoiceSplitterV1, PageGroup, } from "./invoiceSplitter/invoiceSplitterV1";
|
|
3
4
|
export { ReceiptV3 } from "./receipt/receiptV3";
|
|
4
5
|
export { ReceiptV4 } from "./receipt/receiptV4";
|
|
5
6
|
export { PassportV1 } from "./passport/passportV1";
|
|
7
|
+
export { FinancialDocumentV0 } from "./financialDocument/financialDocumentV0";
|
|
6
8
|
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
7
9
|
export { CustomV1 } from "./custom/customV1";
|
|
8
10
|
export { CropperV1 } from "./cropper/cropperV1";
|
|
11
|
+
export { MindeeVisionV1 } from "./mindeeVision/mindeeVisionV1";
|
|
12
|
+
export { ProofOfAddressV1 } from "./proofOfAddress/proofOfAddressV1";
|
|
9
13
|
export { ShippingContainerV1 } from "./shipping_container/shippingContainerV1";
|
|
10
14
|
export { Document, DocumentConstructorProps, DocumentSig } from "./document";
|
|
11
15
|
export * as fr from "./fr";
|
package/src/documents/index.js
CHANGED
|
@@ -23,23 +23,32 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.eu = exports.us = exports.fr = exports.Document = exports.ShippingContainerV1 = exports.CropperV1 = exports.CustomV1 = exports.FinancialDocumentV1 = exports.PassportV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.InvoiceV4 = exports.InvoiceV3 = void 0;
|
|
26
|
+
exports.eu = exports.us = exports.fr = exports.Document = exports.ShippingContainerV1 = exports.ProofOfAddressV1 = exports.MindeeVisionV1 = exports.CropperV1 = exports.CustomV1 = exports.FinancialDocumentV1 = exports.FinancialDocumentV0 = exports.PassportV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PageGroup = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InvoiceV3 = void 0;
|
|
27
27
|
var invoiceV3_1 = require("./invoice/invoiceV3");
|
|
28
28
|
Object.defineProperty(exports, "InvoiceV3", { enumerable: true, get: function () { return invoiceV3_1.InvoiceV3; } });
|
|
29
29
|
var invoiceV4_1 = require("./invoice/invoiceV4");
|
|
30
30
|
Object.defineProperty(exports, "InvoiceV4", { enumerable: true, get: function () { return invoiceV4_1.InvoiceV4; } });
|
|
31
|
+
var invoiceSplitterV1_1 = require("./invoiceSplitter/invoiceSplitterV1");
|
|
32
|
+
Object.defineProperty(exports, "InvoiceSplitterV1", { enumerable: true, get: function () { return invoiceSplitterV1_1.InvoiceSplitterV1; } });
|
|
33
|
+
Object.defineProperty(exports, "PageGroup", { enumerable: true, get: function () { return invoiceSplitterV1_1.PageGroup; } });
|
|
31
34
|
var receiptV3_1 = require("./receipt/receiptV3");
|
|
32
35
|
Object.defineProperty(exports, "ReceiptV3", { enumerable: true, get: function () { return receiptV3_1.ReceiptV3; } });
|
|
33
36
|
var receiptV4_1 = require("./receipt/receiptV4");
|
|
34
37
|
Object.defineProperty(exports, "ReceiptV4", { enumerable: true, get: function () { return receiptV4_1.ReceiptV4; } });
|
|
35
38
|
var passportV1_1 = require("./passport/passportV1");
|
|
36
39
|
Object.defineProperty(exports, "PassportV1", { enumerable: true, get: function () { return passportV1_1.PassportV1; } });
|
|
40
|
+
var financialDocumentV0_1 = require("./financialDocument/financialDocumentV0");
|
|
41
|
+
Object.defineProperty(exports, "FinancialDocumentV0", { enumerable: true, get: function () { return financialDocumentV0_1.FinancialDocumentV0; } });
|
|
37
42
|
var financialDocumentV1_1 = require("./financialDocument/financialDocumentV1");
|
|
38
43
|
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return financialDocumentV1_1.FinancialDocumentV1; } });
|
|
39
44
|
var customV1_1 = require("./custom/customV1");
|
|
40
45
|
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return customV1_1.CustomV1; } });
|
|
41
46
|
var cropperV1_1 = require("./cropper/cropperV1");
|
|
42
47
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
48
|
+
var mindeeVisionV1_1 = require("./mindeeVision/mindeeVisionV1");
|
|
49
|
+
Object.defineProperty(exports, "MindeeVisionV1", { enumerable: true, get: function () { return mindeeVisionV1_1.MindeeVisionV1; } });
|
|
50
|
+
var proofOfAddressV1_1 = require("./proofOfAddress/proofOfAddressV1");
|
|
51
|
+
Object.defineProperty(exports, "ProofOfAddressV1", { enumerable: true, get: function () { return proofOfAddressV1_1.ProofOfAddressV1; } });
|
|
43
52
|
var shippingContainerV1_1 = require("./shipping_container/shippingContainerV1");
|
|
44
53
|
Object.defineProperty(exports, "ShippingContainerV1", { enumerable: true, get: function () { return shippingContainerV1_1.ShippingContainerV1; } });
|
|
45
54
|
var document_1 = require("./document");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../document";
|
|
2
2
|
import { TaxField, PaymentDetails, Locale, Amount, TextField, DateField, CompanyRegistration, BaseField } from "../../fields";
|
|
3
3
|
import { InvoiceLineItem } from "./invoiceLineItem";
|
|
4
|
+
/** Invoice V4 */
|
|
4
5
|
export declare class InvoiceV4 extends Document {
|
|
5
6
|
#private;
|
|
6
7
|
/** Locale information. */
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
5
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
6
|
};
|
|
7
|
-
var _InvoiceV4_instances,
|
|
7
|
+
var _InvoiceV4_instances, _InvoiceV4_checklist, _InvoiceV4_reconstruct;
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.InvoiceV4 = void 0;
|
|
10
10
|
const document_1 = require("../document");
|
|
@@ -12,6 +12,7 @@ const fields_1 = require("../../fields");
|
|
|
12
12
|
const invoiceLineItem_1 = require("./invoiceLineItem");
|
|
13
13
|
const checks_1 = require("./checks");
|
|
14
14
|
const reconstruction_1 = require("./reconstruction");
|
|
15
|
+
/** Invoice V4 */
|
|
15
16
|
class InvoiceV4 extends document_1.Document {
|
|
16
17
|
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, fullText = undefined, pageId = undefined, }) {
|
|
17
18
|
super({
|
|
@@ -34,7 +35,88 @@ class InvoiceV4 extends document_1.Document {
|
|
|
34
35
|
this.taxes = [];
|
|
35
36
|
/** Line items details. */
|
|
36
37
|
this.lineItems = [];
|
|
37
|
-
|
|
38
|
+
this.locale = new fields_1.Locale({
|
|
39
|
+
prediction: prediction.locale,
|
|
40
|
+
valueKey: "language",
|
|
41
|
+
});
|
|
42
|
+
this.documentType = new fields_1.BaseField({
|
|
43
|
+
prediction: prediction.document_type,
|
|
44
|
+
valueKey: "value",
|
|
45
|
+
});
|
|
46
|
+
this.referenceNumbers = prediction.reference_numbers.map(function (prediction) {
|
|
47
|
+
return new fields_1.TextField({
|
|
48
|
+
prediction: prediction,
|
|
49
|
+
pageId: pageId,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
this.totalAmount = new fields_1.Amount({
|
|
53
|
+
prediction: prediction.total_amount,
|
|
54
|
+
valueKey: "value",
|
|
55
|
+
pageId: pageId,
|
|
56
|
+
});
|
|
57
|
+
this.totalTax = new fields_1.Amount({
|
|
58
|
+
prediction: { value: undefined, confidence: 0.0 },
|
|
59
|
+
valueKey: "value",
|
|
60
|
+
pageId: pageId,
|
|
61
|
+
});
|
|
62
|
+
this.totalNet = new fields_1.Amount({
|
|
63
|
+
prediction: prediction.total_net,
|
|
64
|
+
valueKey: "value",
|
|
65
|
+
pageId: pageId,
|
|
66
|
+
});
|
|
67
|
+
this.date = new fields_1.DateField({
|
|
68
|
+
prediction: prediction.date,
|
|
69
|
+
pageId,
|
|
70
|
+
});
|
|
71
|
+
prediction.taxes.map((prediction) => this.taxes.push(new fields_1.TaxField({
|
|
72
|
+
prediction: prediction,
|
|
73
|
+
pageId: pageId,
|
|
74
|
+
valueKey: "value",
|
|
75
|
+
rateKey: "rate",
|
|
76
|
+
codeKey: "code",
|
|
77
|
+
})));
|
|
78
|
+
this.supplierCompanyRegistrations =
|
|
79
|
+
prediction.supplier_company_registrations.map(function (prediction) {
|
|
80
|
+
return new fields_1.CompanyRegistration({
|
|
81
|
+
prediction: prediction,
|
|
82
|
+
pageId: pageId,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
this.dueDate = new fields_1.DateField({
|
|
86
|
+
prediction: prediction.due_date,
|
|
87
|
+
pageId: pageId,
|
|
88
|
+
});
|
|
89
|
+
this.invoiceNumber = new fields_1.TextField({
|
|
90
|
+
prediction: prediction.invoice_number,
|
|
91
|
+
pageId: pageId,
|
|
92
|
+
});
|
|
93
|
+
this.supplierName = new fields_1.TextField({
|
|
94
|
+
prediction: prediction.supplier_name,
|
|
95
|
+
pageId: pageId,
|
|
96
|
+
});
|
|
97
|
+
this.supplierAddress = new fields_1.TextField({
|
|
98
|
+
prediction: prediction.supplier_address,
|
|
99
|
+
pageId: pageId,
|
|
100
|
+
});
|
|
101
|
+
this.customerName = new fields_1.TextField({
|
|
102
|
+
prediction: prediction.customer_name,
|
|
103
|
+
pageId: pageId,
|
|
104
|
+
});
|
|
105
|
+
this.customerAddress = new fields_1.TextField({
|
|
106
|
+
prediction: prediction.customer_address,
|
|
107
|
+
pageId: pageId,
|
|
108
|
+
});
|
|
109
|
+
prediction.customer_company_registrations.map((prediction) => this.customerCompanyRegistrations.push(new fields_1.CompanyRegistration({
|
|
110
|
+
prediction: prediction,
|
|
111
|
+
pageId: pageId,
|
|
112
|
+
})));
|
|
113
|
+
prediction.supplier_payment_details.map((prediction) => this.supplierPaymentDetails.push(new fields_1.PaymentDetails({
|
|
114
|
+
prediction: prediction,
|
|
115
|
+
pageId: pageId,
|
|
116
|
+
})));
|
|
117
|
+
prediction.line_items.map((prediction) => this.lineItems.push(new invoiceLineItem_1.InvoiceLineItem({
|
|
118
|
+
prediction: prediction,
|
|
119
|
+
})));
|
|
38
120
|
__classPrivateFieldGet(this, _InvoiceV4_instances, "m", _InvoiceV4_checklist).call(this);
|
|
39
121
|
__classPrivateFieldGet(this, _InvoiceV4_instances, "m", _InvoiceV4_reconstruct).call(this);
|
|
40
122
|
}
|
|
@@ -83,90 +165,7 @@ Total amount including taxes: ${this.totalAmount}
|
|
|
83
165
|
}
|
|
84
166
|
}
|
|
85
167
|
exports.InvoiceV4 = InvoiceV4;
|
|
86
|
-
_InvoiceV4_instances = new WeakSet(),
|
|
87
|
-
this.locale = new fields_1.Locale({
|
|
88
|
-
prediction: apiPrediction.locale,
|
|
89
|
-
valueKey: "language",
|
|
90
|
-
});
|
|
91
|
-
this.documentType = new fields_1.BaseField({
|
|
92
|
-
prediction: apiPrediction.document_type,
|
|
93
|
-
valueKey: "value",
|
|
94
|
-
});
|
|
95
|
-
this.referenceNumbers = apiPrediction.reference_numbers.map(function (prediction) {
|
|
96
|
-
return new fields_1.TextField({
|
|
97
|
-
prediction: prediction,
|
|
98
|
-
pageId: pageId,
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
this.totalAmount = new fields_1.Amount({
|
|
102
|
-
prediction: apiPrediction.total_amount,
|
|
103
|
-
valueKey: "value",
|
|
104
|
-
pageId: pageId,
|
|
105
|
-
});
|
|
106
|
-
this.totalTax = new fields_1.Amount({
|
|
107
|
-
prediction: { value: undefined, confidence: 0.0 },
|
|
108
|
-
valueKey: "value",
|
|
109
|
-
pageId: pageId,
|
|
110
|
-
});
|
|
111
|
-
this.totalNet = new fields_1.Amount({
|
|
112
|
-
prediction: apiPrediction.total_net,
|
|
113
|
-
valueKey: "value",
|
|
114
|
-
pageId: pageId,
|
|
115
|
-
});
|
|
116
|
-
this.date = new fields_1.DateField({
|
|
117
|
-
prediction: apiPrediction.date,
|
|
118
|
-
pageId,
|
|
119
|
-
});
|
|
120
|
-
apiPrediction.taxes.map((prediction) => this.taxes.push(new fields_1.TaxField({
|
|
121
|
-
prediction: prediction,
|
|
122
|
-
pageId: pageId,
|
|
123
|
-
valueKey: "value",
|
|
124
|
-
rateKey: "rate",
|
|
125
|
-
codeKey: "code",
|
|
126
|
-
})));
|
|
127
|
-
this.supplierCompanyRegistrations =
|
|
128
|
-
apiPrediction.supplier_company_registrations.map(function (prediction) {
|
|
129
|
-
return new fields_1.CompanyRegistration({
|
|
130
|
-
prediction: prediction,
|
|
131
|
-
pageId: pageId,
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
this.dueDate = new fields_1.DateField({
|
|
135
|
-
prediction: apiPrediction.due_date,
|
|
136
|
-
pageId: pageId,
|
|
137
|
-
});
|
|
138
|
-
this.invoiceNumber = new fields_1.TextField({
|
|
139
|
-
prediction: apiPrediction.invoice_number,
|
|
140
|
-
pageId: pageId,
|
|
141
|
-
});
|
|
142
|
-
this.supplierName = new fields_1.TextField({
|
|
143
|
-
prediction: apiPrediction.supplier_name,
|
|
144
|
-
pageId: pageId,
|
|
145
|
-
});
|
|
146
|
-
this.supplierAddress = new fields_1.TextField({
|
|
147
|
-
prediction: apiPrediction.supplier_address,
|
|
148
|
-
pageId: pageId,
|
|
149
|
-
});
|
|
150
|
-
this.customerName = new fields_1.TextField({
|
|
151
|
-
prediction: apiPrediction.customer_name,
|
|
152
|
-
pageId: pageId,
|
|
153
|
-
});
|
|
154
|
-
this.customerAddress = new fields_1.TextField({
|
|
155
|
-
prediction: apiPrediction.customer_address,
|
|
156
|
-
pageId: pageId,
|
|
157
|
-
});
|
|
158
|
-
apiPrediction.customer_company_registrations.map((prediction) => this.customerCompanyRegistrations.push(new fields_1.CompanyRegistration({
|
|
159
|
-
prediction: prediction,
|
|
160
|
-
pageId: pageId,
|
|
161
|
-
})));
|
|
162
|
-
apiPrediction.supplier_payment_details.map((prediction) => this.supplierPaymentDetails.push(new fields_1.PaymentDetails({
|
|
163
|
-
prediction: prediction,
|
|
164
|
-
pageId: pageId,
|
|
165
|
-
})));
|
|
166
|
-
apiPrediction.line_items.map((prediction) => this.lineItems.push(new invoiceLineItem_1.InvoiceLineItem({
|
|
167
|
-
prediction: prediction,
|
|
168
|
-
})));
|
|
169
|
-
}, _InvoiceV4_checklist = function _InvoiceV4_checklist() {
|
|
168
|
+
_InvoiceV4_instances = new WeakSet(), _InvoiceV4_checklist = function _InvoiceV4_checklist() {
|
|
170
169
|
this.checklist = {
|
|
171
170
|
taxesMatchTotalIncl: (0, checks_1.taxesMatchTotalIncl)(this),
|
|
172
171
|
taxesMatchTotalExcl: (0, checks_1.taxesMatchTotalExcl)(this),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
+
export declare class PageGroup {
|
|
3
|
+
pageIndexes: number[];
|
|
4
|
+
constructor(prediction: {
|
|
5
|
+
[index: string]: number[];
|
|
6
|
+
});
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
9
|
+
export declare class InvoiceSplitterV1 extends Document {
|
|
10
|
+
/** List of page indexes that belong to the same invoice in the PDF. */
|
|
11
|
+
invoicePageGroups: PageGroup[];
|
|
12
|
+
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|