mindee 4.15.0 → 4.17.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.
Files changed (146) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.json +1 -1
  3. package/src/parsing/common/index.d.ts +1 -0
  4. package/src/parsing/common/index.js +4 -1
  5. package/src/parsing/common/summaryHelper.d.ts +10 -0
  6. package/src/parsing/common/summaryHelper.js +27 -1
  7. package/src/parsing/standard/amount.d.ts +0 -1
  8. package/src/parsing/standard/amount.js +4 -11
  9. package/src/parsing/standard/date.d.ts +2 -0
  10. package/src/parsing/standard/date.js +4 -2
  11. package/src/parsing/standard/index.d.ts +1 -1
  12. package/src/parsing/standard/index.js +1 -2
  13. package/src/parsing/standard/tax.js +4 -4
  14. package/src/product/billOfLading/billOfLadingV1.d.ts +16 -0
  15. package/src/product/billOfLading/billOfLadingV1.js +27 -0
  16. package/src/product/billOfLading/billOfLadingV1Carrier.d.ts +32 -0
  17. package/src/product/billOfLading/billOfLadingV1Carrier.js +62 -0
  18. package/src/product/billOfLading/billOfLadingV1CarrierItem.d.ts +38 -0
  19. package/src/product/billOfLading/billOfLadingV1CarrierItem.js +117 -0
  20. package/src/product/billOfLading/billOfLadingV1Consignee.d.ts +34 -0
  21. package/src/product/billOfLading/billOfLadingV1Consignee.js +67 -0
  22. package/src/product/billOfLading/billOfLadingV1Document.d.ts +39 -0
  23. package/src/product/billOfLading/billOfLadingV1Document.js +95 -0
  24. package/src/product/billOfLading/billOfLadingV1NotifyParty.d.ts +34 -0
  25. package/src/product/billOfLading/billOfLadingV1NotifyParty.js +67 -0
  26. package/src/product/billOfLading/billOfLadingV1Shipper.d.ts +34 -0
  27. package/src/product/billOfLading/billOfLadingV1Shipper.js +67 -0
  28. package/src/product/billOfLading/index.d.ts +1 -0
  29. package/src/product/billOfLading/index.js +5 -0
  30. package/src/product/billOfLading/internal.d.ts +7 -0
  31. package/src/product/billOfLading/internal.js +17 -0
  32. package/src/product/financialDocument/financialDocumentV1Document.d.ts +5 -1
  33. package/src/product/financialDocument/financialDocumentV1Document.js +11 -1
  34. package/src/product/financialDocument/financialDocumentV1LineItem.d.ts +8 -8
  35. package/src/product/financialDocument/financialDocumentV1LineItem.js +47 -22
  36. package/src/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +4 -4
  37. package/src/product/fr/energyBill/energyBillV1.d.ts +16 -0
  38. package/src/product/fr/energyBill/energyBillV1.js +27 -0
  39. package/src/product/fr/energyBill/energyBillV1Document.d.ts +49 -0
  40. package/src/product/fr/energyBill/energyBillV1Document.js +143 -0
  41. package/src/product/fr/energyBill/energyBillV1EnergyConsumer.d.ts +30 -0
  42. package/src/product/fr/energyBill/energyBillV1EnergyConsumer.js +57 -0
  43. package/src/product/fr/energyBill/energyBillV1EnergySupplier.d.ts +30 -0
  44. package/src/product/fr/energyBill/energyBillV1EnergySupplier.js +57 -0
  45. package/src/product/fr/energyBill/energyBillV1EnergyUsage.d.ts +38 -0
  46. package/src/product/fr/energyBill/energyBillV1EnergyUsage.js +117 -0
  47. package/src/product/fr/energyBill/energyBillV1MeterDetail.d.ts +32 -0
  48. package/src/product/fr/energyBill/energyBillV1MeterDetail.js +62 -0
  49. package/src/product/fr/energyBill/energyBillV1Subscription.d.ts +38 -0
  50. package/src/product/fr/energyBill/energyBillV1Subscription.js +117 -0
  51. package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.d.ts +38 -0
  52. package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.js +117 -0
  53. package/src/product/fr/energyBill/index.d.ts +1 -0
  54. package/src/product/fr/energyBill/index.js +5 -0
  55. package/src/product/fr/energyBill/internal.d.ts +8 -0
  56. package/src/product/fr/energyBill/internal.js +19 -0
  57. package/src/product/fr/index.d.ts +2 -0
  58. package/src/product/fr/index.js +5 -1
  59. package/src/product/fr/internal.d.ts +2 -0
  60. package/src/product/fr/internal.js +3 -1
  61. package/src/product/fr/payslip/index.d.ts +1 -0
  62. package/src/product/fr/payslip/index.js +5 -0
  63. package/src/product/fr/payslip/internal.d.ts +10 -0
  64. package/src/product/fr/payslip/internal.js +23 -0
  65. package/src/product/fr/payslip/payslipV2.d.ts +16 -0
  66. package/src/product/fr/payslip/payslipV2.js +27 -0
  67. package/src/product/fr/payslip/payslipV2BankAccountDetail.d.ts +32 -0
  68. package/src/product/fr/payslip/payslipV2BankAccountDetail.js +62 -0
  69. package/src/product/fr/payslip/payslipV2Document.d.ts +35 -0
  70. package/src/product/fr/payslip/payslipV2Document.js +80 -0
  71. package/src/product/fr/payslip/payslipV2Employee.d.ts +40 -0
  72. package/src/product/fr/payslip/payslipV2Employee.js +82 -0
  73. package/src/product/fr/payslip/payslipV2Employer.d.ts +40 -0
  74. package/src/product/fr/payslip/payslipV2Employer.js +82 -0
  75. package/src/product/fr/payslip/payslipV2Employment.d.ts +38 -0
  76. package/src/product/fr/payslip/payslipV2Employment.js +85 -0
  77. package/src/product/fr/payslip/payslipV2PayDetail.d.ts +46 -0
  78. package/src/product/fr/payslip/payslipV2PayDetail.js +168 -0
  79. package/src/product/fr/payslip/payslipV2PayPeriod.d.ts +36 -0
  80. package/src/product/fr/payslip/payslipV2PayPeriod.js +72 -0
  81. package/src/product/fr/payslip/payslipV2Pto.d.ts +32 -0
  82. package/src/product/fr/payslip/payslipV2Pto.js +84 -0
  83. package/src/product/fr/payslip/payslipV2SalaryDetail.d.ts +34 -0
  84. package/src/product/fr/payslip/payslipV2SalaryDetail.js +97 -0
  85. package/src/product/index.d.ts +2 -0
  86. package/src/product/index.js +5 -1
  87. package/src/product/internal.d.ts +2 -0
  88. package/src/product/internal.js +3 -1
  89. package/src/product/invoice/invoiceV4Document.d.ts +5 -1
  90. package/src/product/invoice/invoiceV4Document.js +11 -1
  91. package/src/product/invoice/invoiceV4LineItem.d.ts +8 -8
  92. package/src/product/invoice/invoiceV4LineItem.js +47 -22
  93. package/src/product/nutritionFactsLabel/index.d.ts +1 -0
  94. package/src/product/nutritionFactsLabel/index.js +5 -0
  95. package/src/product/nutritionFactsLabel/internal.d.ts +15 -0
  96. package/src/product/nutritionFactsLabel/internal.js +33 -0
  97. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.d.ts +16 -0
  98. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.js +27 -0
  99. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.d.ts +32 -0
  100. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.js +84 -0
  101. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.d.ts +32 -0
  102. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.js +84 -0
  103. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.d.ts +32 -0
  104. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.js +84 -0
  105. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.d.ts +32 -0
  106. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.js +84 -0
  107. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.d.ts +53 -0
  108. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.js +117 -0
  109. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.d.ts +36 -0
  110. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.js +107 -0
  111. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.d.ts +32 -0
  112. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.js +84 -0
  113. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.d.ts +32 -0
  114. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.js +84 -0
  115. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.d.ts +30 -0
  116. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.js +65 -0
  117. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.d.ts +34 -0
  118. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.js +89 -0
  119. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.d.ts +32 -0
  120. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.js +84 -0
  121. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.d.ts +32 -0
  122. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.js +84 -0
  123. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.d.ts +32 -0
  124. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.js +84 -0
  125. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.d.ts +32 -0
  126. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.js +84 -0
  127. package/src/product/receipt/receiptV5LineItem.d.ts +4 -4
  128. package/src/product/receipt/receiptV5LineItem.js +27 -12
  129. package/src/product/resume/resumeV1Certificate.d.ts +4 -4
  130. package/src/product/resume/resumeV1Certificate.js +9 -8
  131. package/src/product/resume/resumeV1Education.d.ts +7 -7
  132. package/src/product/resume/resumeV1Education.js +15 -14
  133. package/src/product/resume/resumeV1Language.d.ts +2 -2
  134. package/src/product/resume/resumeV1Language.js +5 -4
  135. package/src/product/resume/resumeV1ProfessionalExperience.d.ts +8 -8
  136. package/src/product/resume/resumeV1ProfessionalExperience.js +17 -16
  137. package/src/product/resume/resumeV1SocialNetworksUrl.d.ts +2 -2
  138. package/src/product/resume/resumeV1SocialNetworksUrl.js +5 -4
  139. package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +2 -2
  140. package/src/product/us/healthcareCard/healthcareCardV1Copay.js +11 -6
  141. package/src/product/us/usMail/index.d.ts +1 -0
  142. package/src/product/us/usMail/index.js +5 -0
  143. package/src/product/us/usMail/usMailV2RecipientAddress.d.ts +7 -7
  144. package/src/product/us/usMail/usMailV2RecipientAddress.js +17 -15
  145. package/src/product/us/usMail/usMailV2SenderAddress.d.ts +5 -5
  146. package/src/product/us/usMail/usMailV2SenderAddress.js +5 -25
@@ -0,0 +1,39 @@
1
+ import { Prediction, StringDict } from "../../parsing/common";
2
+ import { BillOfLadingV1Shipper } from "./billOfLadingV1Shipper";
3
+ import { BillOfLadingV1Consignee } from "./billOfLadingV1Consignee";
4
+ import { BillOfLadingV1NotifyParty } from "./billOfLadingV1NotifyParty";
5
+ import { BillOfLadingV1Carrier } from "./billOfLadingV1Carrier";
6
+ import { BillOfLadingV1CarrierItem } from "./billOfLadingV1CarrierItem";
7
+ import { DateField, StringField } from "../../parsing/standard";
8
+ /**
9
+ * Bill of Lading API version 1.1 document data.
10
+ */
11
+ export declare class BillOfLadingV1Document implements Prediction {
12
+ /** A unique identifier assigned to a Bill of Lading document. */
13
+ billOfLadingNumber: StringField;
14
+ /** The shipping company responsible for transporting the goods. */
15
+ carrier: BillOfLadingV1Carrier;
16
+ /** The goods being shipped. */
17
+ carrierItems: BillOfLadingV1CarrierItem[];
18
+ /** The party to whom the goods are being shipped. */
19
+ consignee: BillOfLadingV1Consignee;
20
+ /** The date when the bill of lading is issued. */
21
+ dateOfIssue: DateField;
22
+ /** The date when the vessel departs from the port of loading. */
23
+ departureDate: DateField;
24
+ /** The party to be notified of the arrival of the goods. */
25
+ notifyParty: BillOfLadingV1NotifyParty;
26
+ /** The place where the goods are to be delivered. */
27
+ placeOfDelivery: StringField;
28
+ /** The port where the goods are unloaded from the vessel. */
29
+ portOfDischarge: StringField;
30
+ /** The port where the goods are loaded onto the vessel. */
31
+ portOfLoading: StringField;
32
+ /** The party responsible for shipping the goods. */
33
+ shipper: BillOfLadingV1Shipper;
34
+ constructor(rawPrediction: StringDict, pageId?: number);
35
+ /**
36
+ * Default string representation.
37
+ */
38
+ toString(): string;
39
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillOfLadingV1Document = void 0;
4
+ const common_1 = require("../../parsing/common");
5
+ const billOfLadingV1Shipper_1 = require("./billOfLadingV1Shipper");
6
+ const billOfLadingV1Consignee_1 = require("./billOfLadingV1Consignee");
7
+ const billOfLadingV1NotifyParty_1 = require("./billOfLadingV1NotifyParty");
8
+ const billOfLadingV1Carrier_1 = require("./billOfLadingV1Carrier");
9
+ const billOfLadingV1CarrierItem_1 = require("./billOfLadingV1CarrierItem");
10
+ const standard_1 = require("../../parsing/standard");
11
+ /**
12
+ * Bill of Lading API version 1.1 document data.
13
+ */
14
+ class BillOfLadingV1Document {
15
+ constructor(rawPrediction, pageId) {
16
+ /** The goods being shipped. */
17
+ this.carrierItems = [];
18
+ this.billOfLadingNumber = new standard_1.StringField({
19
+ prediction: rawPrediction["bill_of_lading_number"],
20
+ pageId: pageId,
21
+ });
22
+ this.carrier = new billOfLadingV1Carrier_1.BillOfLadingV1Carrier({
23
+ prediction: rawPrediction["carrier"],
24
+ pageId: pageId,
25
+ });
26
+ rawPrediction["carrier_items"] &&
27
+ rawPrediction["carrier_items"].map((itemPrediction) => this.carrierItems.push(new billOfLadingV1CarrierItem_1.BillOfLadingV1CarrierItem({
28
+ prediction: itemPrediction,
29
+ pageId: pageId,
30
+ })));
31
+ this.consignee = new billOfLadingV1Consignee_1.BillOfLadingV1Consignee({
32
+ prediction: rawPrediction["consignee"],
33
+ pageId: pageId,
34
+ });
35
+ this.dateOfIssue = new standard_1.DateField({
36
+ prediction: rawPrediction["date_of_issue"],
37
+ pageId: pageId,
38
+ });
39
+ this.departureDate = new standard_1.DateField({
40
+ prediction: rawPrediction["departure_date"],
41
+ pageId: pageId,
42
+ });
43
+ this.notifyParty = new billOfLadingV1NotifyParty_1.BillOfLadingV1NotifyParty({
44
+ prediction: rawPrediction["notify_party"],
45
+ pageId: pageId,
46
+ });
47
+ this.placeOfDelivery = new standard_1.StringField({
48
+ prediction: rawPrediction["place_of_delivery"],
49
+ pageId: pageId,
50
+ });
51
+ this.portOfDischarge = new standard_1.StringField({
52
+ prediction: rawPrediction["port_of_discharge"],
53
+ pageId: pageId,
54
+ });
55
+ this.portOfLoading = new standard_1.StringField({
56
+ prediction: rawPrediction["port_of_loading"],
57
+ pageId: pageId,
58
+ });
59
+ this.shipper = new billOfLadingV1Shipper_1.BillOfLadingV1Shipper({
60
+ prediction: rawPrediction["shipper"],
61
+ pageId: pageId,
62
+ });
63
+ }
64
+ /**
65
+ * Default string representation.
66
+ */
67
+ toString() {
68
+ let carrierItemsSummary = "";
69
+ if (this.carrierItems && this.carrierItems.length > 0) {
70
+ const carrierItemsColSizes = [38, 14, 13, 18, 10, 13];
71
+ carrierItemsSummary += "\n" + (0, common_1.lineSeparator)(carrierItemsColSizes, "-") + "\n ";
72
+ carrierItemsSummary += "| Description ";
73
+ carrierItemsSummary += "| Gross Weight ";
74
+ carrierItemsSummary += "| Measurement ";
75
+ carrierItemsSummary += "| Measurement Unit ";
76
+ carrierItemsSummary += "| Quantity ";
77
+ carrierItemsSummary += "| Weight Unit ";
78
+ carrierItemsSummary += "|\n" + (0, common_1.lineSeparator)(carrierItemsColSizes, "=");
79
+ carrierItemsSummary += this.carrierItems.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(carrierItemsColSizes, "-")).join("");
80
+ }
81
+ const outStr = `:Bill of Lading Number: ${this.billOfLadingNumber}
82
+ :Shipper: ${this.shipper.toFieldList()}
83
+ :Consignee: ${this.consignee.toFieldList()}
84
+ :Notify Party: ${this.notifyParty.toFieldList()}
85
+ :Carrier: ${this.carrier.toFieldList()}
86
+ :Items: ${carrierItemsSummary}
87
+ :Port of Loading: ${this.portOfLoading}
88
+ :Port of Discharge: ${this.portOfDischarge}
89
+ :Place of Delivery: ${this.placeOfDelivery}
90
+ :Date of issue: ${this.dateOfIssue}
91
+ :Departure Date: ${this.departureDate}`.trimEnd();
92
+ return (0, common_1.cleanOutString)(outStr);
93
+ }
94
+ }
95
+ exports.BillOfLadingV1Document = BillOfLadingV1Document;
@@ -0,0 +1,34 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The party to be notified of the arrival of the goods.
5
+ */
6
+ export declare class BillOfLadingV1NotifyParty {
7
+ #private;
8
+ /** The address of the notify party. */
9
+ address: string | null;
10
+ /** The email of the shipper. */
11
+ email: string | null;
12
+ /** The name of the notify party. */
13
+ name: string | null;
14
+ /** The phone number of the notify party. */
15
+ phone: string | null;
16
+ /** Confidence score */
17
+ confidence: number;
18
+ /** The document page on which the information was found. */
19
+ pageId: number;
20
+ /**
21
+ * Contains the relative vertices coordinates (points) of a polygon containing
22
+ * the field in the document.
23
+ */
24
+ polygon: Polygon;
25
+ constructor({ prediction }: StringDict);
26
+ /**
27
+ * Default string representation.
28
+ */
29
+ toString(): string;
30
+ /**
31
+ * Output in a format suitable for inclusion in a field list.
32
+ */
33
+ toFieldList(): string;
34
+ }
@@ -0,0 +1,67 @@
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 _BillOfLadingV1NotifyParty_instances, _BillOfLadingV1NotifyParty_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BillOfLadingV1NotifyParty = void 0;
10
+ /**
11
+ * The party to be notified of the arrival of the goods.
12
+ */
13
+ class BillOfLadingV1NotifyParty {
14
+ constructor({ prediction = {} }) {
15
+ _BillOfLadingV1NotifyParty_instances.add(this);
16
+ /** Confidence score */
17
+ this.confidence = 0.0;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ this.polygon = [];
23
+ this.address = prediction["address"];
24
+ this.email = prediction["email"];
25
+ this.name = prediction["name"];
26
+ this.phone = prediction["phone"];
27
+ this.pageId = prediction["page_id"];
28
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
29
+ if (prediction["polygon"]) {
30
+ this.polygon = prediction.polygon;
31
+ }
32
+ }
33
+ /**
34
+ * Default string representation.
35
+ */
36
+ toString() {
37
+ const printable = __classPrivateFieldGet(this, _BillOfLadingV1NotifyParty_instances, "m", _BillOfLadingV1NotifyParty_printableValues).call(this);
38
+ return ("Address: " +
39
+ printable.address +
40
+ ", Email: " +
41
+ printable.email +
42
+ ", Name: " +
43
+ printable.name +
44
+ ", Phone: " +
45
+ printable.phone);
46
+ }
47
+ /**
48
+ * Output in a format suitable for inclusion in a field list.
49
+ */
50
+ toFieldList() {
51
+ const printable = __classPrivateFieldGet(this, _BillOfLadingV1NotifyParty_instances, "m", _BillOfLadingV1NotifyParty_printableValues).call(this);
52
+ return `
53
+ :Address: ${printable.address}
54
+ :Email: ${printable.email}
55
+ :Name: ${printable.name}
56
+ :Phone: ${printable.phone}`.trimEnd();
57
+ }
58
+ }
59
+ exports.BillOfLadingV1NotifyParty = BillOfLadingV1NotifyParty;
60
+ _BillOfLadingV1NotifyParty_instances = new WeakSet(), _BillOfLadingV1NotifyParty_printableValues = function _BillOfLadingV1NotifyParty_printableValues() {
61
+ return {
62
+ address: this.address ?? "",
63
+ email: this.email ?? "",
64
+ name: this.name ?? "",
65
+ phone: this.phone ?? "",
66
+ };
67
+ };
@@ -0,0 +1,34 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The party responsible for shipping the goods.
5
+ */
6
+ export declare class BillOfLadingV1Shipper {
7
+ #private;
8
+ /** The address of the shipper. */
9
+ address: string | null;
10
+ /** The email of the shipper. */
11
+ email: string | null;
12
+ /** The name of the shipper. */
13
+ name: string | null;
14
+ /** The phone number of the shipper. */
15
+ phone: string | null;
16
+ /** Confidence score */
17
+ confidence: number;
18
+ /** The document page on which the information was found. */
19
+ pageId: number;
20
+ /**
21
+ * Contains the relative vertices coordinates (points) of a polygon containing
22
+ * the field in the document.
23
+ */
24
+ polygon: Polygon;
25
+ constructor({ prediction }: StringDict);
26
+ /**
27
+ * Default string representation.
28
+ */
29
+ toString(): string;
30
+ /**
31
+ * Output in a format suitable for inclusion in a field list.
32
+ */
33
+ toFieldList(): string;
34
+ }
@@ -0,0 +1,67 @@
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 _BillOfLadingV1Shipper_instances, _BillOfLadingV1Shipper_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BillOfLadingV1Shipper = void 0;
10
+ /**
11
+ * The party responsible for shipping the goods.
12
+ */
13
+ class BillOfLadingV1Shipper {
14
+ constructor({ prediction = {} }) {
15
+ _BillOfLadingV1Shipper_instances.add(this);
16
+ /** Confidence score */
17
+ this.confidence = 0.0;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ this.polygon = [];
23
+ this.address = prediction["address"];
24
+ this.email = prediction["email"];
25
+ this.name = prediction["name"];
26
+ this.phone = prediction["phone"];
27
+ this.pageId = prediction["page_id"];
28
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
29
+ if (prediction["polygon"]) {
30
+ this.polygon = prediction.polygon;
31
+ }
32
+ }
33
+ /**
34
+ * Default string representation.
35
+ */
36
+ toString() {
37
+ const printable = __classPrivateFieldGet(this, _BillOfLadingV1Shipper_instances, "m", _BillOfLadingV1Shipper_printableValues).call(this);
38
+ return ("Address: " +
39
+ printable.address +
40
+ ", Email: " +
41
+ printable.email +
42
+ ", Name: " +
43
+ printable.name +
44
+ ", Phone: " +
45
+ printable.phone);
46
+ }
47
+ /**
48
+ * Output in a format suitable for inclusion in a field list.
49
+ */
50
+ toFieldList() {
51
+ const printable = __classPrivateFieldGet(this, _BillOfLadingV1Shipper_instances, "m", _BillOfLadingV1Shipper_printableValues).call(this);
52
+ return `
53
+ :Address: ${printable.address}
54
+ :Email: ${printable.email}
55
+ :Name: ${printable.name}
56
+ :Phone: ${printable.phone}`.trimEnd();
57
+ }
58
+ }
59
+ exports.BillOfLadingV1Shipper = BillOfLadingV1Shipper;
60
+ _BillOfLadingV1Shipper_instances = new WeakSet(), _BillOfLadingV1Shipper_printableValues = function _BillOfLadingV1Shipper_printableValues() {
61
+ return {
62
+ address: this.address ?? "",
63
+ email: this.email ?? "",
64
+ name: this.name ?? "",
65
+ phone: this.phone ?? "",
66
+ };
67
+ };
@@ -0,0 +1 @@
1
+ export { BillOfLadingV1 } from "./billOfLadingV1";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillOfLadingV1 = void 0;
4
+ var billOfLadingV1_1 = require("./billOfLadingV1");
5
+ Object.defineProperty(exports, "BillOfLadingV1", { enumerable: true, get: function () { return billOfLadingV1_1.BillOfLadingV1; } });
@@ -0,0 +1,7 @@
1
+ export { BillOfLadingV1 } from "./billOfLadingV1";
2
+ export { BillOfLadingV1Carrier } from "./billOfLadingV1Carrier";
3
+ export { BillOfLadingV1CarrierItem } from "./billOfLadingV1CarrierItem";
4
+ export { BillOfLadingV1Consignee } from "./billOfLadingV1Consignee";
5
+ export { BillOfLadingV1Document } from "./billOfLadingV1Document";
6
+ export { BillOfLadingV1NotifyParty } from "./billOfLadingV1NotifyParty";
7
+ export { BillOfLadingV1Shipper } from "./billOfLadingV1Shipper";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillOfLadingV1Shipper = exports.BillOfLadingV1NotifyParty = exports.BillOfLadingV1Document = exports.BillOfLadingV1Consignee = exports.BillOfLadingV1CarrierItem = exports.BillOfLadingV1Carrier = exports.BillOfLadingV1 = void 0;
4
+ var billOfLadingV1_1 = require("./billOfLadingV1");
5
+ Object.defineProperty(exports, "BillOfLadingV1", { enumerable: true, get: function () { return billOfLadingV1_1.BillOfLadingV1; } });
6
+ var billOfLadingV1Carrier_1 = require("./billOfLadingV1Carrier");
7
+ Object.defineProperty(exports, "BillOfLadingV1Carrier", { enumerable: true, get: function () { return billOfLadingV1Carrier_1.BillOfLadingV1Carrier; } });
8
+ var billOfLadingV1CarrierItem_1 = require("./billOfLadingV1CarrierItem");
9
+ Object.defineProperty(exports, "BillOfLadingV1CarrierItem", { enumerable: true, get: function () { return billOfLadingV1CarrierItem_1.BillOfLadingV1CarrierItem; } });
10
+ var billOfLadingV1Consignee_1 = require("./billOfLadingV1Consignee");
11
+ Object.defineProperty(exports, "BillOfLadingV1Consignee", { enumerable: true, get: function () { return billOfLadingV1Consignee_1.BillOfLadingV1Consignee; } });
12
+ var billOfLadingV1Document_1 = require("./billOfLadingV1Document");
13
+ Object.defineProperty(exports, "BillOfLadingV1Document", { enumerable: true, get: function () { return billOfLadingV1Document_1.BillOfLadingV1Document; } });
14
+ var billOfLadingV1NotifyParty_1 = require("./billOfLadingV1NotifyParty");
15
+ Object.defineProperty(exports, "BillOfLadingV1NotifyParty", { enumerable: true, get: function () { return billOfLadingV1NotifyParty_1.BillOfLadingV1NotifyParty; } });
16
+ var billOfLadingV1Shipper_1 = require("./billOfLadingV1Shipper");
17
+ Object.defineProperty(exports, "BillOfLadingV1Shipper", { enumerable: true, get: function () { return billOfLadingV1Shipper_1.BillOfLadingV1Shipper; } });
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { FinancialDocumentV1LineItem } from "./financialDocumentV1LineItem";
3
3
  import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
4
4
  /**
5
- * Financial Document API version 1.9 document data.
5
+ * Financial Document API version 1.10 document data.
6
6
  */
7
7
  export declare class FinancialDocumentV1Document implements Prediction {
8
8
  /** The customer's address used for billing. */
@@ -31,6 +31,10 @@ export declare class FinancialDocumentV1Document implements Prediction {
31
31
  lineItems: FinancialDocumentV1LineItem[];
32
32
  /** The locale detected on the document. */
33
33
  locale: LocaleField;
34
+ /** The date on which the payment is due / fullfilled. */
35
+ paymentDate: DateField;
36
+ /** The purchase order number. */
37
+ poNumber: StringField;
34
38
  /** The receipt number or identifier only if document is a receipt. */
35
39
  receiptNumber: StringField;
36
40
  /** List of Reference numbers, including PO number. */
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
5
5
  const financialDocumentV1LineItem_1 = require("./financialDocumentV1LineItem");
6
6
  const standard_1 = require("../../parsing/standard");
7
7
  /**
8
- * Financial Document API version 1.9 document data.
8
+ * Financial Document API version 1.10 document data.
9
9
  */
10
10
  class FinancialDocumentV1Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -70,6 +70,14 @@ class FinancialDocumentV1Document {
70
70
  this.locale = new standard_1.LocaleField({
71
71
  prediction: rawPrediction["locale"],
72
72
  });
73
+ this.paymentDate = new standard_1.DateField({
74
+ prediction: rawPrediction["payment_date"],
75
+ pageId: pageId,
76
+ });
77
+ this.poNumber = new standard_1.StringField({
78
+ prediction: rawPrediction["po_number"],
79
+ pageId: pageId,
80
+ });
73
81
  this.receiptNumber = new standard_1.StringField({
74
82
  prediction: rawPrediction["receipt_number"],
75
83
  pageId: pageId,
@@ -163,11 +171,13 @@ class FinancialDocumentV1Document {
163
171
  }
164
172
  const outStr = `:Locale: ${this.locale}
165
173
  :Invoice Number: ${this.invoiceNumber}
174
+ :Purchase Order Number: ${this.poNumber}
166
175
  :Receipt Number: ${this.receiptNumber}
167
176
  :Document Number: ${this.documentNumber}
168
177
  :Reference Numbers: ${referenceNumbers}
169
178
  :Purchase Date: ${this.date}
170
179
  :Due Date: ${this.dueDate}
180
+ :Payment Date: ${this.paymentDate}
171
181
  :Total Net: ${this.totalNet}
172
182
  :Total Amount: ${this.totalAmount}
173
183
  :Taxes: ${this.taxes}
@@ -6,21 +6,21 @@ import { Polygon } from "../../geometry";
6
6
  export declare class FinancialDocumentV1LineItem {
7
7
  #private;
8
8
  /** The item description. */
9
- description: string | undefined;
9
+ description: string | null;
10
10
  /** The product code referring to the item. */
11
- productCode: string | undefined;
11
+ productCode: string | null;
12
12
  /** The item quantity */
13
- quantity: number | undefined;
13
+ quantity: number | null;
14
14
  /** The item tax amount. */
15
- taxAmount: number | undefined;
15
+ taxAmount: number | null;
16
16
  /** The item tax rate in percentage. */
17
- taxRate: number | undefined;
17
+ taxRate: number | null;
18
18
  /** The item total amount. */
19
- totalAmount: number | undefined;
19
+ totalAmount: number | null;
20
20
  /** The item unit of measure. */
21
- unitMeasure: string | undefined;
21
+ unitMeasure: string | null;
22
22
  /** The item unit price. */
23
- unitPrice: number | undefined;
23
+ unitPrice: number | null;
24
24
  /** Confidence score */
25
25
  confidence: number;
26
26
  /** The document page on which the information was found. */
@@ -7,7 +7,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
7
7
  var _FinancialDocumentV1LineItem_instances, _FinancialDocumentV1LineItem_printableValues;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.FinancialDocumentV1LineItem = void 0;
10
- const standard_1 = require("../../parsing/standard");
10
+ const common_1 = require("../../parsing/common");
11
11
  /**
12
12
  * List of line item details.
13
13
  */
@@ -23,21 +23,46 @@ class FinancialDocumentV1LineItem {
23
23
  this.polygon = [];
24
24
  this.description = prediction["description"];
25
25
  this.productCode = prediction["product_code"];
26
- if (prediction["quantity"] && !isNaN(prediction["quantity"])) {
27
- this.quantity = +parseFloat(prediction["quantity"]).toFixed(3);
26
+ if (prediction["quantity"] !== undefined &&
27
+ prediction["quantity"] !== null &&
28
+ !isNaN(prediction["quantity"])) {
29
+ this.quantity = +parseFloat(prediction["quantity"]);
28
30
  }
29
- if (prediction["tax_amount"] && !isNaN(prediction["tax_amount"])) {
30
- this.taxAmount = +parseFloat(prediction["tax_amount"]).toFixed(3);
31
+ else {
32
+ this.quantity = null;
31
33
  }
32
- if (prediction["tax_rate"] && !isNaN(prediction["tax_rate"])) {
33
- this.taxRate = +parseFloat(prediction["tax_rate"]).toFixed(3);
34
+ if (prediction["tax_amount"] !== undefined &&
35
+ prediction["tax_amount"] !== null &&
36
+ !isNaN(prediction["tax_amount"])) {
37
+ this.taxAmount = +parseFloat(prediction["tax_amount"]);
34
38
  }
35
- if (prediction["total_amount"] && !isNaN(prediction["total_amount"])) {
36
- this.totalAmount = +parseFloat(prediction["total_amount"]).toFixed(3);
39
+ else {
40
+ this.taxAmount = null;
41
+ }
42
+ if (prediction["tax_rate"] !== undefined &&
43
+ prediction["tax_rate"] !== null &&
44
+ !isNaN(prediction["tax_rate"])) {
45
+ this.taxRate = +parseFloat(prediction["tax_rate"]);
46
+ }
47
+ else {
48
+ this.taxRate = null;
49
+ }
50
+ if (prediction["total_amount"] !== undefined &&
51
+ prediction["total_amount"] !== null &&
52
+ !isNaN(prediction["total_amount"])) {
53
+ this.totalAmount = +parseFloat(prediction["total_amount"]);
54
+ }
55
+ else {
56
+ this.totalAmount = null;
37
57
  }
38
58
  this.unitMeasure = prediction["unit_measure"];
39
- if (prediction["unit_price"] && !isNaN(prediction["unit_price"])) {
40
- this.unitPrice = +parseFloat(prediction["unit_price"]).toFixed(3);
59
+ if (prediction["unit_price"] !== undefined &&
60
+ prediction["unit_price"] !== null &&
61
+ !isNaN(prediction["unit_price"])) {
62
+ this.unitPrice = +parseFloat(prediction["unit_price"]);
63
+ }
64
+ else {
65
+ this.unitPrice = null;
41
66
  }
42
67
  this.pageId = prediction["page_id"];
43
68
  this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
@@ -96,23 +121,23 @@ _FinancialDocumentV1LineItem_instances = new WeakSet(), _FinancialDocumentV1Line
96
121
  return {
97
122
  description: this.description ?
98
123
  this.description.length <= 36 ?
99
- this.description :
100
- this.description.slice(0, 33) + "..." :
124
+ (0, common_1.cleanSpecialChars)(this.description) :
125
+ (0, common_1.cleanSpecialChars)(this.description).slice(0, 33) + "..." :
101
126
  "",
102
127
  productCode: this.productCode ?
103
128
  this.productCode.length <= 12 ?
104
- this.productCode :
105
- this.productCode.slice(0, 9) + "..." :
129
+ (0, common_1.cleanSpecialChars)(this.productCode) :
130
+ (0, common_1.cleanSpecialChars)(this.productCode).slice(0, 9) + "..." :
106
131
  "",
107
- quantity: this.quantity !== undefined ? (0, standard_1.floatToString)(this.quantity) : "",
108
- taxAmount: this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "",
109
- taxRate: this.taxRate !== undefined ? (0, standard_1.floatToString)(this.taxRate) : "",
110
- totalAmount: this.totalAmount !== undefined ? (0, standard_1.floatToString)(this.totalAmount) : "",
132
+ quantity: this.quantity !== undefined ? (0, common_1.floatToString)(this.quantity) : "",
133
+ taxAmount: this.taxAmount !== undefined ? (0, common_1.floatToString)(this.taxAmount) : "",
134
+ taxRate: this.taxRate !== undefined ? (0, common_1.floatToString)(this.taxRate) : "",
135
+ totalAmount: this.totalAmount !== undefined ? (0, common_1.floatToString)(this.totalAmount) : "",
111
136
  unitMeasure: this.unitMeasure ?
112
137
  this.unitMeasure.length <= 15 ?
113
- this.unitMeasure :
114
- this.unitMeasure.slice(0, 12) + "..." :
138
+ (0, common_1.cleanSpecialChars)(this.unitMeasure) :
139
+ (0, common_1.cleanSpecialChars)(this.unitMeasure).slice(0, 12) + "..." :
115
140
  "",
116
- unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
141
+ unitPrice: this.unitPrice !== undefined ? (0, common_1.floatToString)(this.unitPrice) : "",
117
142
  };
118
143
  };
@@ -6,13 +6,13 @@ import { Polygon } from "../../../geometry";
6
6
  export declare class BankAccountDetailsV2Bban {
7
7
  #private;
8
8
  /** The BBAN bank code outputted as a string. */
9
- bbanBankCode: string | undefined;
9
+ bbanBankCode: string | null;
10
10
  /** The BBAN branch code outputted as a string. */
11
- bbanBranchCode: string | undefined;
11
+ bbanBranchCode: string | null;
12
12
  /** The BBAN key outputted as a string. */
13
- bbanKey: string | undefined;
13
+ bbanKey: string | null;
14
14
  /** The BBAN Account number outputted as a string. */
15
- bbanNumber: string | undefined;
15
+ bbanNumber: string | null;
16
16
  /** Confidence score */
17
17
  confidence: number;
18
18
  /** The document page on which the information was found. */
@@ -0,0 +1,16 @@
1
+ import { Inference, StringDict, Page } from "../../../parsing/common";
2
+ import { EnergyBillV1Document } from "./energyBillV1Document";
3
+ /**
4
+ * Energy Bill API version 1 inference prediction.
5
+ */
6
+ export declare class EnergyBillV1 extends Inference {
7
+ /** The endpoint's name. */
8
+ endpointName: string;
9
+ /** The endpoint's version. */
10
+ endpointVersion: string;
11
+ /** The document-level prediction. */
12
+ prediction: EnergyBillV1Document;
13
+ /** The document's pages. */
14
+ pages: Page<EnergyBillV1Document>[];
15
+ constructor(rawPrediction: StringDict);
16
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnergyBillV1 = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const energyBillV1Document_1 = require("./energyBillV1Document");
6
+ /**
7
+ * Energy Bill API version 1 inference prediction.
8
+ */
9
+ class EnergyBillV1 extends common_1.Inference {
10
+ constructor(rawPrediction) {
11
+ super(rawPrediction);
12
+ /** The endpoint's name. */
13
+ this.endpointName = "energy_bill_fra";
14
+ /** The endpoint's version. */
15
+ this.endpointVersion = "1";
16
+ /** The document's pages. */
17
+ this.pages = [];
18
+ this.prediction = new energyBillV1Document_1.EnergyBillV1Document(rawPrediction["prediction"]);
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(energyBillV1Document_1.EnergyBillV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
25
+ }
26
+ }
27
+ exports.EnergyBillV1 = EnergyBillV1;