mindee 4.3.2 → 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 +9 -0
- package/package.json +4 -3
- 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/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 +5 -2
- 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/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
|
@@ -1,67 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InvoiceV4Document = void 0;
|
|
4
|
-
const
|
|
5
|
-
const standard_1 = require("../../parsing/standard");
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
6
5
|
const invoiceV4LineItem_1 = require("./invoiceV4LineItem");
|
|
6
|
+
const standard_1 = require("../../parsing/standard");
|
|
7
7
|
/**
|
|
8
8
|
* Document data for Invoice, API version 4.
|
|
9
9
|
*/
|
|
10
10
|
class InvoiceV4Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
12
|
-
/** List of
|
|
13
|
-
this.referenceNumbers = [];
|
|
14
|
-
/** The payment information. */
|
|
15
|
-
this.supplierPaymentDetails = [];
|
|
16
|
-
/** The supplier company registration information. */
|
|
17
|
-
this.supplierCompanyRegistrations = [];
|
|
18
|
-
/** The company registration information for the customer. */
|
|
12
|
+
/** List of company registrations associated to the customer. */
|
|
19
13
|
this.customerCompanyRegistrations = [];
|
|
20
|
-
/**
|
|
14
|
+
/** List of line item details. */
|
|
21
15
|
this.lineItems = [];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
rawPrediction["reference_numbers"] &&
|
|
31
|
-
rawPrediction["reference_numbers"].map((prediction) => new standard_1.StringField({
|
|
32
|
-
prediction: prediction,
|
|
33
|
-
pageId: pageId,
|
|
34
|
-
}));
|
|
35
|
-
this.totalAmount = new standard_1.AmountField({
|
|
36
|
-
prediction: rawPrediction["total_amount"],
|
|
37
|
-
pageId: pageId,
|
|
38
|
-
});
|
|
39
|
-
this.totalTax = new standard_1.AmountField({
|
|
40
|
-
prediction: rawPrediction["taxes"] && rawPrediction["taxes"].length > 0
|
|
41
|
-
? {
|
|
42
|
-
value: rawPrediction["taxes"].reduce((acc, tax) => {
|
|
43
|
-
return tax.value !== undefined ? acc + tax.value : acc;
|
|
44
|
-
}, 0),
|
|
45
|
-
confidence: 1,
|
|
46
|
-
}
|
|
47
|
-
: { value: undefined, confidence: 0.0 },
|
|
16
|
+
/** List of Reference numbers, including PO number. */
|
|
17
|
+
this.referenceNumbers = [];
|
|
18
|
+
/** List of company registrations associated to the supplier. */
|
|
19
|
+
this.supplierCompanyRegistrations = [];
|
|
20
|
+
/** List of payment details associated to the supplier. */
|
|
21
|
+
this.supplierPaymentDetails = [];
|
|
22
|
+
this.customerAddress = new standard_1.StringField({
|
|
23
|
+
prediction: rawPrediction["customer_address"],
|
|
48
24
|
pageId: pageId,
|
|
49
25
|
});
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
rawPrediction["customer_company_registrations"] &&
|
|
27
|
+
rawPrediction["customer_company_registrations"].map((itemPrediction) => this.customerCompanyRegistrations.push(new standard_1.CompanyRegistrationField({
|
|
28
|
+
prediction: itemPrediction,
|
|
29
|
+
pageId: pageId,
|
|
30
|
+
})));
|
|
31
|
+
this.customerName = new standard_1.StringField({
|
|
32
|
+
prediction: rawPrediction["customer_name"],
|
|
52
33
|
pageId: pageId,
|
|
53
34
|
});
|
|
54
35
|
this.date = new standard_1.DateField({
|
|
55
36
|
prediction: rawPrediction["date"],
|
|
56
|
-
pageId,
|
|
37
|
+
pageId: pageId,
|
|
38
|
+
});
|
|
39
|
+
this.documentType = new standard_1.ClassificationField({
|
|
40
|
+
prediction: rawPrediction["document_type"],
|
|
57
41
|
});
|
|
58
|
-
this.taxes = new standard_1.Taxes().init(rawPrediction["taxes"], pageId);
|
|
59
|
-
this.supplierCompanyRegistrations =
|
|
60
|
-
rawPrediction["supplier_company_registrations"] &&
|
|
61
|
-
rawPrediction["supplier_company_registrations"].map((prediction) => new standard_1.CompanyRegistrationField({
|
|
62
|
-
prediction: prediction,
|
|
63
|
-
pageId: pageId,
|
|
64
|
-
}));
|
|
65
42
|
this.dueDate = new standard_1.DateField({
|
|
66
43
|
prediction: rawPrediction["due_date"],
|
|
67
44
|
pageId: pageId,
|
|
@@ -70,79 +47,87 @@ class InvoiceV4Document {
|
|
|
70
47
|
prediction: rawPrediction["invoice_number"],
|
|
71
48
|
pageId: pageId,
|
|
72
49
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
50
|
+
rawPrediction["line_items"] &&
|
|
51
|
+
rawPrediction["line_items"].map((itemPrediction) => this.lineItems.push(new invoiceV4LineItem_1.InvoiceV4LineItem({
|
|
52
|
+
prediction: itemPrediction,
|
|
53
|
+
pageId: pageId,
|
|
54
|
+
})));
|
|
55
|
+
this.locale = new standard_1.LocaleField({
|
|
56
|
+
prediction: rawPrediction["locale"],
|
|
76
57
|
});
|
|
58
|
+
rawPrediction["reference_numbers"] &&
|
|
59
|
+
rawPrediction["reference_numbers"].map((itemPrediction) => this.referenceNumbers.push(new standard_1.StringField({
|
|
60
|
+
prediction: itemPrediction,
|
|
61
|
+
pageId: pageId,
|
|
62
|
+
})));
|
|
77
63
|
this.supplierAddress = new standard_1.StringField({
|
|
78
64
|
prediction: rawPrediction["supplier_address"],
|
|
79
65
|
pageId: pageId,
|
|
80
66
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
this.customerAddress = new standard_1.StringField({
|
|
86
|
-
prediction: rawPrediction["customer_address"],
|
|
87
|
-
pageId: pageId,
|
|
88
|
-
});
|
|
89
|
-
rawPrediction["customer_company_registrations"] &&
|
|
90
|
-
rawPrediction["customer_company_registrations"].forEach((prediction) => this.customerCompanyRegistrations.push(new standard_1.CompanyRegistrationField({
|
|
91
|
-
prediction: prediction,
|
|
67
|
+
rawPrediction["supplier_company_registrations"] &&
|
|
68
|
+
rawPrediction["supplier_company_registrations"].map((itemPrediction) => this.supplierCompanyRegistrations.push(new standard_1.CompanyRegistrationField({
|
|
69
|
+
prediction: itemPrediction,
|
|
92
70
|
pageId: pageId,
|
|
93
71
|
})));
|
|
72
|
+
this.supplierName = new standard_1.StringField({
|
|
73
|
+
prediction: rawPrediction["supplier_name"],
|
|
74
|
+
pageId: pageId,
|
|
75
|
+
});
|
|
94
76
|
rawPrediction["supplier_payment_details"] &&
|
|
95
|
-
rawPrediction["supplier_payment_details"].
|
|
96
|
-
prediction:
|
|
77
|
+
rawPrediction["supplier_payment_details"].map((itemPrediction) => this.supplierPaymentDetails.push(new standard_1.PaymentDetailsField({
|
|
78
|
+
prediction: itemPrediction,
|
|
97
79
|
pageId: pageId,
|
|
98
80
|
})));
|
|
99
|
-
rawPrediction["
|
|
100
|
-
|
|
81
|
+
this.taxes = new standard_1.Taxes().init(rawPrediction["taxes"], pageId);
|
|
82
|
+
this.totalAmount = new standard_1.AmountField({
|
|
83
|
+
prediction: rawPrediction["total_amount"],
|
|
84
|
+
pageId: pageId,
|
|
85
|
+
});
|
|
86
|
+
this.totalNet = new standard_1.AmountField({
|
|
87
|
+
prediction: rawPrediction["total_net"],
|
|
88
|
+
pageId: pageId,
|
|
89
|
+
});
|
|
101
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Default string representation.
|
|
93
|
+
*/
|
|
102
94
|
toString() {
|
|
103
|
-
const referenceNumbers = this.referenceNumbers
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
lineItems += (0, summaryHelper_1.lineSeparator)([22, 9, 9, 10, 18, 38], "=") + "\n ";
|
|
121
|
-
lineItems += this.lineItems
|
|
122
|
-
.map((item) => item.toTableLine() +
|
|
123
|
-
"\n" +
|
|
124
|
-
(0, summaryHelper_1.lineSeparator)([22, 9, 9, 10, 18, 38], "-"))
|
|
125
|
-
.join("\n ");
|
|
95
|
+
const referenceNumbers = this.referenceNumbers.join("\n ");
|
|
96
|
+
const supplierPaymentDetails = this.supplierPaymentDetails.join("\n ");
|
|
97
|
+
const supplierCompanyRegistrations = this.supplierCompanyRegistrations.join("\n ");
|
|
98
|
+
const customerCompanyRegistrations = this.customerCompanyRegistrations.join("\n ");
|
|
99
|
+
let lineItemsSummary = "";
|
|
100
|
+
if (this.lineItems && this.lineItems.length > 0) {
|
|
101
|
+
const lineItemsColSizes = [38, 14, 10, 12, 14, 14, 12];
|
|
102
|
+
lineItemsSummary += "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-") + "\n ";
|
|
103
|
+
lineItemsSummary += "| Description ";
|
|
104
|
+
lineItemsSummary += "| Product code ";
|
|
105
|
+
lineItemsSummary += "| Quantity ";
|
|
106
|
+
lineItemsSummary += "| Tax Amount ";
|
|
107
|
+
lineItemsSummary += "| Tax Rate (%) ";
|
|
108
|
+
lineItemsSummary += "| Total Amount ";
|
|
109
|
+
lineItemsSummary += "| Unit Price ";
|
|
110
|
+
lineItemsSummary += "|\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "=");
|
|
111
|
+
lineItemsSummary += this.lineItems.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-")).join("");
|
|
126
112
|
}
|
|
127
113
|
const outStr = `:Locale: ${this.locale}
|
|
128
|
-
:
|
|
129
|
-
:
|
|
130
|
-
:
|
|
131
|
-
:
|
|
132
|
-
:
|
|
133
|
-
:
|
|
134
|
-
:Supplier address: ${this.supplierAddress}
|
|
135
|
-
:Supplier company registrations: ${companyRegistration}
|
|
136
|
-
:Supplier payment details: ${paymentDetails}
|
|
137
|
-
:Customer name: ${this.customerName}
|
|
138
|
-
:Customer address: ${this.customerAddress}
|
|
139
|
-
:Customer company registrations: ${customerCompanyRegistration}
|
|
114
|
+
:Invoice Number: ${this.invoiceNumber}
|
|
115
|
+
:Reference Numbers: ${referenceNumbers}
|
|
116
|
+
:Purchase Date: ${this.date}
|
|
117
|
+
:Due Date: ${this.dueDate}
|
|
118
|
+
:Total Net: ${this.totalNet}
|
|
119
|
+
:Total Amount: ${this.totalAmount}
|
|
140
120
|
:Taxes: ${this.taxes}
|
|
141
|
-
:
|
|
142
|
-
:
|
|
143
|
-
:
|
|
144
|
-
:
|
|
145
|
-
|
|
121
|
+
:Supplier Payment Details: ${supplierPaymentDetails}
|
|
122
|
+
:Supplier Name: ${this.supplierName}
|
|
123
|
+
:Supplier Company Registrations: ${supplierCompanyRegistrations}
|
|
124
|
+
:Supplier Address: ${this.supplierAddress}
|
|
125
|
+
:Customer Name: ${this.customerName}
|
|
126
|
+
:Customer Company Registrations: ${customerCompanyRegistrations}
|
|
127
|
+
:Customer Address: ${this.customerAddress}
|
|
128
|
+
:Document Type: ${this.documentType}
|
|
129
|
+
:Line Items: ${lineItemsSummary}`.trimEnd();
|
|
130
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
146
131
|
}
|
|
147
132
|
}
|
|
148
133
|
exports.InvoiceV4Document = InvoiceV4Document;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Polygon } from "../../geometry";
|
|
2
1
|
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
3
|
/**
|
|
4
4
|
* List of line item details.
|
|
5
5
|
*/
|
|
6
6
|
export declare class InvoiceV4LineItem {
|
|
7
7
|
#private;
|
|
8
|
-
/** The product code referring to the item. */
|
|
9
|
-
productCode: string;
|
|
10
8
|
/** The item description. */
|
|
11
|
-
description: string;
|
|
12
|
-
/** The item
|
|
9
|
+
description: string | undefined;
|
|
10
|
+
/** The product code referring to the item. */
|
|
11
|
+
productCode: string | undefined;
|
|
12
|
+
/** The item quantity */
|
|
13
13
|
quantity: number | undefined;
|
|
14
|
-
/** The item unit price. */
|
|
15
|
-
unitPrice: number | undefined;
|
|
16
|
-
/** The item total amount. */
|
|
17
|
-
totalAmount: number | undefined;
|
|
18
|
-
/** The item tax rate in percentage. */
|
|
19
|
-
taxRate: number | undefined;
|
|
20
14
|
/** The item tax amount. */
|
|
21
15
|
taxAmount: number | undefined;
|
|
16
|
+
/** The item tax rate in percentage. */
|
|
17
|
+
taxRate: number | undefined;
|
|
18
|
+
/** The item total amount. */
|
|
19
|
+
totalAmount: number | undefined;
|
|
20
|
+
/** The item unit price. */
|
|
21
|
+
unitPrice: number | undefined;
|
|
22
22
|
/** Confidence score */
|
|
23
23
|
confidence: number;
|
|
24
24
|
/** The document page on which the information was found. */
|
|
@@ -28,13 +28,13 @@ export declare class InvoiceV4LineItem {
|
|
|
28
28
|
* the field in the document.
|
|
29
29
|
*/
|
|
30
30
|
polygon: Polygon;
|
|
31
|
-
constructor(
|
|
32
|
-
/**
|
|
33
|
-
* Output in a format suitable for inclusion in an rST table.
|
|
34
|
-
*/
|
|
35
|
-
toTableLine(): string;
|
|
31
|
+
constructor({ prediction }: StringDict);
|
|
36
32
|
/**
|
|
37
33
|
* Default string representation.
|
|
38
34
|
*/
|
|
39
35
|
toString(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Output in a format suitable for inclusion in an rST table.
|
|
38
|
+
*/
|
|
39
|
+
toTableLine(): string;
|
|
40
40
|
}
|
|
@@ -12,7 +12,7 @@ const standard_1 = require("../../parsing/standard");
|
|
|
12
12
|
* List of line item details.
|
|
13
13
|
*/
|
|
14
14
|
class InvoiceV4LineItem {
|
|
15
|
-
constructor(
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
16
|
_InvoiceV4LineItem_instances.add(this);
|
|
17
17
|
/** Confidence score */
|
|
18
18
|
this.confidence = 0.0;
|
|
@@ -21,90 +21,88 @@ class InvoiceV4LineItem {
|
|
|
21
21
|
* the field in the document.
|
|
22
22
|
*/
|
|
23
23
|
this.polygon = [];
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
: "";
|
|
29
|
-
this.quantity = +parseFloat(rawPrediction["quantity"]).toFixed(3);
|
|
30
|
-
if (isNaN(this.quantity)) {
|
|
31
|
-
this.quantity = undefined;
|
|
24
|
+
this.description = prediction["description"];
|
|
25
|
+
this.productCode = prediction["product_code"];
|
|
26
|
+
if (prediction["quantity"] && !isNaN(prediction["quantity"])) {
|
|
27
|
+
this.quantity = +parseFloat(prediction["quantity"]).toFixed(3);
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.unitPrice = undefined;
|
|
29
|
+
if (prediction["tax_amount"] && !isNaN(prediction["tax_amount"])) {
|
|
30
|
+
this.taxAmount = +parseFloat(prediction["tax_amount"]).toFixed(3);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.totalAmount = undefined;
|
|
32
|
+
if (prediction["tax_rate"] && !isNaN(prediction["tax_rate"])) {
|
|
33
|
+
this.taxRate = +parseFloat(prediction["tax_rate"]).toFixed(3);
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.taxRate = undefined;
|
|
35
|
+
if (prediction["total_amount"] && !isNaN(prediction["total_amount"])) {
|
|
36
|
+
this.totalAmount = +parseFloat(prediction["total_amount"]).toFixed(3);
|
|
44
37
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.taxAmount = undefined;
|
|
38
|
+
if (prediction["unit_price"] && !isNaN(prediction["unit_price"])) {
|
|
39
|
+
this.unitPrice = +parseFloat(prediction["unit_price"]).toFixed(3);
|
|
48
40
|
}
|
|
49
|
-
this.pageId =
|
|
50
|
-
this.confidence =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (rawPrediction["polygon"]) {
|
|
54
|
-
this.polygon = rawPrediction["polygon"];
|
|
41
|
+
this.pageId = prediction["page_id"];
|
|
42
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
43
|
+
if (prediction["polygon"]) {
|
|
44
|
+
this.polygon = prediction.polygon;
|
|
55
45
|
}
|
|
56
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Default string representation.
|
|
49
|
+
*/
|
|
50
|
+
toString() {
|
|
51
|
+
const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);
|
|
52
|
+
return ("Description: " +
|
|
53
|
+
printable.description +
|
|
54
|
+
", Product code: " +
|
|
55
|
+
printable.productCode +
|
|
56
|
+
", Quantity: " +
|
|
57
|
+
printable.quantity +
|
|
58
|
+
", Tax Amount: " +
|
|
59
|
+
printable.taxAmount +
|
|
60
|
+
", Tax Rate (%): " +
|
|
61
|
+
printable.taxRate +
|
|
62
|
+
", Total Amount: " +
|
|
63
|
+
printable.totalAmount +
|
|
64
|
+
", Unit Price: " +
|
|
65
|
+
printable.unitPrice);
|
|
66
|
+
}
|
|
57
67
|
/**
|
|
58
68
|
* Output in a format suitable for inclusion in an rST table.
|
|
59
69
|
*/
|
|
60
70
|
toTableLine() {
|
|
61
71
|
const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);
|
|
62
72
|
return ("| " +
|
|
63
|
-
printable.
|
|
73
|
+
printable.description.padEnd(36) +
|
|
64
74
|
" | " +
|
|
65
|
-
printable.
|
|
75
|
+
printable.productCode.padEnd(12) +
|
|
66
76
|
" | " +
|
|
67
|
-
printable.
|
|
77
|
+
printable.quantity.padEnd(8) +
|
|
68
78
|
" | " +
|
|
69
|
-
printable.
|
|
79
|
+
printable.taxAmount.padEnd(10) +
|
|
70
80
|
" | " +
|
|
71
|
-
printable.
|
|
81
|
+
printable.taxRate.padEnd(12) +
|
|
72
82
|
" | " +
|
|
73
|
-
printable.
|
|
83
|
+
printable.totalAmount.padEnd(12) +
|
|
84
|
+
" | " +
|
|
85
|
+
printable.unitPrice.padEnd(10) +
|
|
74
86
|
" |");
|
|
75
87
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Default string representation.
|
|
78
|
-
*/
|
|
79
|
-
toString() {
|
|
80
|
-
const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);
|
|
81
|
-
return ("Code: " +
|
|
82
|
-
printable.productCode +
|
|
83
|
-
", Quantity: " +
|
|
84
|
-
printable.quantity +
|
|
85
|
-
", Price: " +
|
|
86
|
-
printable.unitPrice +
|
|
87
|
-
", Amount: " +
|
|
88
|
-
printable.totalAmount +
|
|
89
|
-
", Tax (Rate): " +
|
|
90
|
-
printable.tax +
|
|
91
|
-
" Description: " +
|
|
92
|
-
printable.description).trim();
|
|
93
|
-
}
|
|
94
88
|
}
|
|
95
89
|
exports.InvoiceV4LineItem = InvoiceV4LineItem;
|
|
96
90
|
_InvoiceV4LineItem_instances = new WeakSet(), _InvoiceV4LineItem_printableValues = function _InvoiceV4LineItem_printableValues() {
|
|
97
91
|
return {
|
|
98
|
-
|
|
92
|
+
description: this.description ?
|
|
93
|
+
this.description.length <= 36 ?
|
|
94
|
+
this.description :
|
|
95
|
+
this.description.slice(0, 33) + "..." :
|
|
96
|
+
"",
|
|
97
|
+
productCode: this.productCode ?
|
|
98
|
+
this.productCode.length <= 12 ?
|
|
99
|
+
this.productCode :
|
|
100
|
+
this.productCode.slice(0, 9) + "..." :
|
|
101
|
+
"",
|
|
99
102
|
quantity: this.quantity !== undefined ? (0, standard_1.floatToString)(this.quantity) : "",
|
|
100
|
-
|
|
103
|
+
taxAmount: this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "",
|
|
104
|
+
taxRate: this.taxRate !== undefined ? (0, standard_1.floatToString)(this.taxRate) : "",
|
|
101
105
|
totalAmount: this.totalAmount !== undefined ? (0, standard_1.floatToString)(this.totalAmount) : "",
|
|
102
|
-
|
|
103
|
-
(this.taxRate !== undefined
|
|
104
|
-
? " (" + (0, standard_1.floatToString)(this.taxRate) + "%)"
|
|
105
|
-
: ""),
|
|
106
|
-
description: this.description.length > 33
|
|
107
|
-
? this.description.substring(0, 33) + "..."
|
|
108
|
-
: this.description,
|
|
106
|
+
unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
|
|
109
107
|
};
|
|
110
108
|
};
|
|
@@ -2,7 +2,7 @@ import { Inference, StringDict, Page } from "../../../parsing/common";
|
|
|
2
2
|
import { W9V1Document } from "./w9V1Document";
|
|
3
3
|
import { W9V1Page } from "./w9V1Page";
|
|
4
4
|
/**
|
|
5
|
-
* Inference prediction for
|
|
5
|
+
* Inference prediction for W9, API version 1.
|
|
6
6
|
*/
|
|
7
7
|
export declare class W9V1 extends Inference {
|
|
8
8
|
/** The endpoint's name. */
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../../parsing/common");
|
|
|
5
5
|
const w9V1Document_1 = require("./w9V1Document");
|
|
6
6
|
const w9V1Page_1 = require("./w9V1Page");
|
|
7
7
|
/**
|
|
8
|
-
* Inference prediction for
|
|
8
|
+
* Inference prediction for W9, API version 1.
|
|
9
9
|
*/
|
|
10
10
|
class W9V1 extends common_1.Inference {
|
|
11
11
|
constructor(rawPrediction) {
|
|
@@ -2,7 +2,7 @@ import { StringDict } from "../../../parsing/common";
|
|
|
2
2
|
import { PositionField, StringField } from "../../../parsing/standard";
|
|
3
3
|
import { W9V1Document } from "./w9V1Document";
|
|
4
4
|
/**
|
|
5
|
-
* Page data for
|
|
5
|
+
* Page data for W9, API version 1.
|
|
6
6
|
*/
|
|
7
7
|
export declare class W9V1Page extends W9V1Document {
|
|
8
8
|
/** The street address (number, street, and apt. or suite no.) of the applicant. */
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../../parsing/common");
|
|
|
5
5
|
const standard_1 = require("../../../parsing/standard");
|
|
6
6
|
const w9V1Document_1 = require("./w9V1Document");
|
|
7
7
|
/**
|
|
8
|
-
* Page data for
|
|
8
|
+
* Page data for W9, API version 1.
|
|
9
9
|
*/
|
|
10
10
|
class W9V1Page extends w9V1Document_1.W9V1Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
package/src/http/mindeeApi.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const API_KEY_ENVVAR_NAME = "MINDEE_API_KEY";
|
|
2
|
-
export declare const API_HOST_ENVVAR_NAME = "MINDEE_API_HOST";
|
|
3
|
-
export declare const STANDARD_API_OWNER = "mindee";
|
|
4
|
-
interface MindeeApiConstructorProps {
|
|
5
|
-
apiKey: string;
|
|
6
|
-
urlName: string;
|
|
7
|
-
version: string;
|
|
8
|
-
owner: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class MindeeApi {
|
|
11
|
-
apiKey: string;
|
|
12
|
-
baseHeaders: Record<string, string>;
|
|
13
|
-
hostname: string;
|
|
14
|
-
private readonly urlName;
|
|
15
|
-
private readonly version;
|
|
16
|
-
constructor({ apiKey, urlName, version, owner, }: MindeeApiConstructorProps);
|
|
17
|
-
protected apiKeyFromEnv(): string;
|
|
18
|
-
protected hostnameFromEnv(): string;
|
|
19
|
-
}
|
|
20
|
-
export {};
|