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.
Files changed (67) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +5 -4
  3. package/src/cli.js +52 -16
  4. package/src/client.d.ts +35 -6
  5. package/src/client.js +47 -16
  6. package/src/http/apiSettings.d.ts +15 -0
  7. package/src/http/{mindeeApi.js → apiSettings.js} +10 -13
  8. package/src/http/baseEndpoint.d.ts +27 -0
  9. package/src/http/baseEndpoint.js +65 -0
  10. package/src/http/endpoint.d.ts +27 -38
  11. package/src/http/endpoint.js +46 -60
  12. package/src/http/error.d.ts +11 -11
  13. package/src/http/error.js +29 -29
  14. package/src/http/index.d.ts +3 -2
  15. package/src/http/index.js +5 -5
  16. package/src/input/base.d.ts +7 -6
  17. package/src/input/base.js +1 -4
  18. package/src/parsing/common/apiResponse.d.ts +1 -1
  19. package/src/parsing/common/apiResponse.js +1 -1
  20. package/src/parsing/common/asyncPredictResponse.d.ts +4 -4
  21. package/src/parsing/common/asyncPredictResponse.js +8 -8
  22. package/src/parsing/common/extras/cropperExtra.js +1 -1
  23. package/src/parsing/common/feedback/feedbackResponse.d.ts +15 -0
  24. package/src/parsing/common/feedback/feedbackResponse.js +19 -0
  25. package/src/parsing/common/index.d.ts +1 -0
  26. package/src/parsing/common/index.js +3 -1
  27. package/src/parsing/common/inference.js +9 -5
  28. package/src/parsing/common/orientation.d.ts +1 -4
  29. package/src/parsing/common/orientation.js +1 -4
  30. package/src/parsing/common/page.d.ts +2 -3
  31. package/src/parsing/common/page.js +2 -3
  32. package/src/parsing/common/predictResponse.d.ts +3 -3
  33. package/src/parsing/common/predictResponse.js +5 -5
  34. package/src/parsing/custom/listField.d.ts +6 -3
  35. package/src/parsing/custom/listField.js +3 -0
  36. package/src/parsing/standard/amount.d.ts +4 -6
  37. package/src/parsing/standard/amount.js +1 -4
  38. package/src/parsing/standard/base.d.ts +9 -4
  39. package/src/parsing/standard/base.js +2 -4
  40. package/src/parsing/standard/companyRegistration.d.ts +3 -2
  41. package/src/parsing/standard/date.d.ts +4 -6
  42. package/src/parsing/standard/date.js +1 -4
  43. package/src/parsing/standard/field.d.ts +4 -15
  44. package/src/parsing/standard/field.js +2 -6
  45. package/src/parsing/standard/index.d.ts +1 -1
  46. package/src/parsing/standard/locale.d.ts +1 -3
  47. package/src/parsing/standard/locale.js +1 -3
  48. package/src/parsing/standard/paymentDetails.d.ts +11 -8
  49. package/src/parsing/standard/paymentDetails.js +1 -8
  50. package/src/parsing/standard/tax.d.ts +8 -12
  51. package/src/parsing/standard/tax.js +1 -7
  52. package/src/product/financialDocument/financialDocumentV1Document.js +2 -2
  53. package/src/product/invoice/invoiceV4Document.d.ts +33 -32
  54. package/src/product/invoice/invoiceV4Document.js +89 -104
  55. package/src/product/invoice/invoiceV4LineItem.d.ts +16 -16
  56. package/src/product/invoice/invoiceV4LineItem.js +58 -60
  57. package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +2 -2
  58. package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -2
  59. package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.d.ts +1 -1
  60. package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.js +1 -1
  61. package/src/product/us/w9/w9V1.d.ts +1 -1
  62. package/src/product/us/w9/w9V1.js +1 -1
  63. package/src/product/us/w9/w9V1Document.d.ts +1 -1
  64. package/src/product/us/w9/w9V1Document.js +1 -1
  65. package/src/product/us/w9/w9V1Page.d.ts +1 -1
  66. package/src/product/us/w9/w9V1Page.js +1 -1
  67. 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 summaryHelper_1 = require("../../parsing/common/summaryHelper");
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 Reference numbers including PO number. */
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
- /** Line items details. */
14
+ /** List of line item details. */
21
15
  this.lineItems = [];
22
- this.locale = new standard_1.LocaleField({
23
- prediction: rawPrediction["locale"],
24
- valueKey: "language",
25
- });
26
- this.documentType = new standard_1.ClassificationField({
27
- prediction: rawPrediction["document_type"],
28
- });
29
- this.referenceNumbers =
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
- this.totalNet = new standard_1.AmountField({
51
- prediction: rawPrediction["total_net"],
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
- this.supplierName = new standard_1.StringField({
74
- prediction: rawPrediction["supplier_name"],
75
- pageId: pageId,
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
- this.customerName = new standard_1.StringField({
82
- prediction: rawPrediction["customer_name"],
83
- pageId: pageId,
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"].forEach((prediction) => this.supplierPaymentDetails.push(new standard_1.PaymentDetailsField({
96
- prediction: 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["line_items"] &&
100
- rawPrediction["line_items"].forEach((prediction) => this.lineItems.push(new invoiceV4LineItem_1.InvoiceV4LineItem(prediction)));
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
- .map((item) => item.toString())
105
- .join(", ");
106
- const paymentDetails = this.supplierPaymentDetails
107
- .map((item) => item.toString())
108
- .join("\n ");
109
- const customerCompanyRegistration = this.customerCompanyRegistrations
110
- .map((item) => item.toString())
111
- .join("; ");
112
- const companyRegistration = this.supplierCompanyRegistrations
113
- .map((item) => item.toString())
114
- .join("; ");
115
- let lineItems = "\n";
116
- if (this.lineItems.length > 0) {
117
- lineItems += (0, summaryHelper_1.lineSeparator)([22, 9, 9, 10, 18, 38], "-");
118
- lineItems +=
119
- "\n | Code | QTY | Price | Amount | Tax (Rate) | Description |\n";
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
- :Document type: ${this.documentType}
129
- :Invoice number: ${this.invoiceNumber}
130
- :Reference numbers: ${referenceNumbers}
131
- :Invoice date: ${this.date}
132
- :Invoice due date: ${this.dueDate}
133
- :Supplier name: ${this.supplierName}
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
- :Total net: ${this.totalNet}
142
- :Total tax: ${this.totalTax}
143
- :Total amount: ${this.totalAmount}
144
- :Line Items: ${lineItems}`;
145
- return (0, summaryHelper_1.cleanOutString)(outStr);
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 quantity */
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(rawPrediction: StringDict);
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(rawPrediction) {
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.productCode = rawPrediction["product_code"];
25
- this.description =
26
- rawPrediction["description"] !== undefined
27
- ? rawPrediction["description"]
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
- this.unitPrice = +parseFloat(rawPrediction["unit_price"]).toFixed(3);
34
- if (isNaN(this.unitPrice)) {
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
- this.totalAmount = +parseFloat(rawPrediction["total_amount"]).toFixed(3);
38
- if (isNaN(this.totalAmount)) {
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
- this.taxRate = +parseFloat(rawPrediction["tax_rate"]).toFixed(3);
42
- if (isNaN(this.taxRate)) {
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
- this.taxAmount = +parseFloat(rawPrediction["tax_amount"]).toFixed(3);
46
- if (isNaN(this.taxAmount)) {
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 = rawPrediction["page_id"];
50
- this.confidence = rawPrediction["confidence"]
51
- ? rawPrediction["confidence"]
52
- : 0.0;
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.productCode.padEnd(20) +
73
+ printable.description.padEnd(36) +
64
74
  " | " +
65
- printable.quantity.padEnd(7) +
75
+ printable.productCode.padEnd(12) +
66
76
  " | " +
67
- printable.unitPrice.padEnd(7) +
77
+ printable.quantity.padEnd(8) +
68
78
  " | " +
69
- printable.totalAmount.padEnd(8) +
79
+ printable.taxAmount.padEnd(10) +
70
80
  " | " +
71
- printable.tax.padEnd(16) +
81
+ printable.taxRate.padEnd(12) +
72
82
  " | " +
73
- printable.description.padEnd(36) +
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
- productCode: this.productCode ?? "",
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
- unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
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
- tax: (this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "") +
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
  };
@@ -1,9 +1,9 @@
1
- import { Inference, StringDict } from "../../parsing/common";
1
+ import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { InvoiceSplitterV1PageGroup } from "./invoiceSplitterV1PageGroup";
3
3
  /**
4
4
  * Document data for Invoice Splitter, API version 1.
5
5
  */
6
- export declare class InvoiceSplitterV1Document extends Inference {
6
+ export declare class InvoiceSplitterV1Document implements Prediction {
7
7
  /** List of page indexes that belong to the same invoice in the PDF. */
8
8
  invoicePageGroups: InvoiceSplitterV1PageGroup[];
9
9
  constructor(rawPrediction: StringDict);
@@ -6,9 +6,8 @@ const invoiceSplitterV1PageGroup_1 = require("./invoiceSplitterV1PageGroup");
6
6
  /**
7
7
  * Document data for Invoice Splitter, API version 1.
8
8
  */
9
- class InvoiceSplitterV1Document extends common_1.Inference {
9
+ class InvoiceSplitterV1Document {
10
10
  constructor(rawPrediction) {
11
- super(rawPrediction);
12
11
  /** List of page indexes that belong to the same invoice in the PDF. */
13
12
  this.invoicePageGroups = [];
14
13
  rawPrediction["invoice_page_groups"] &&
@@ -1,6 +1,6 @@
1
1
  import { StringDict } from "../../parsing/common";
2
2
  /**
3
- * Pages indexes in a group.
3
+ * Pages indexes in a group for Invoice Splitter V1.
4
4
  */
5
5
  export declare class InvoiceSplitterV1PageGroup {
6
6
  /** List of page indexes. */
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvoiceSplitterV1PageGroup = void 0;
4
4
  /**
5
- * Pages indexes in a group.
5
+ * Pages indexes in a group for Invoice Splitter V1.
6
6
  */
7
7
  class InvoiceSplitterV1PageGroup {
8
8
  constructor(prediction) {
@@ -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 US W9, API version 1.
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 US W9, API version 1.
8
+ * Inference prediction for W9, API version 1.
9
9
  */
10
10
  class W9V1 extends common_1.Inference {
11
11
  constructor(rawPrediction) {
@@ -1,6 +1,6 @@
1
1
  import { Prediction } from "../../../parsing/common";
2
2
  /**
3
- * Document data for US W9, API version 1.
3
+ * Document data for W9, API version 1.
4
4
  */
5
5
  export declare class W9V1Document implements Prediction {
6
6
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.W9V1Document = void 0;
4
4
  /**
5
- * Document data for US W9, API version 1.
5
+ * Document data for W9, API version 1.
6
6
  */
7
7
  class W9V1Document {
8
8
  /**
@@ -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 US W9, API version 1.
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 US W9, API version 1.
8
+ * Page data for W9, API version 1.
9
9
  */
10
10
  class W9V1Page extends w9V1Document_1.W9V1Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -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 {};