mindee 4.11.0 → 4.12.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.12.0 - 2024-05-16
4
+ ### Changes
5
+ * :sparkles: update receipt to 5.2 and financial document to 1.7 (#270)
6
+
7
+
3
8
  # v4.11.0 - 2024-04-30
4
9
  ### Changes
5
10
  * :sparkles: update invoice to 4.6 & financial document to 1.6 (#269)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
@@ -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.6 document data.
5
+ * Financial Document API version 1.7 document data.
6
6
  */
7
7
  export declare class FinancialDocumentV1Document implements Prediction {
8
8
  /** The customer's address used for billing. */
@@ -19,16 +19,20 @@ export declare class FinancialDocumentV1Document implements Prediction {
19
19
  customerName: StringField;
20
20
  /** The date the purchase was made. */
21
21
  date: DateField;
22
+ /** The document number or identifier. */
23
+ documentNumber: StringField;
22
24
  /** One of: 'INVOICE', 'CREDIT NOTE', 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'. */
23
25
  documentType: ClassificationField;
24
26
  /** The date on which the payment is due. */
25
27
  dueDate: DateField;
26
- /** The invoice number or identifier. */
28
+ /** The invoice number or identifier only if document is an invoice. */
27
29
  invoiceNumber: StringField;
28
30
  /** List of line item details. */
29
31
  lineItems: FinancialDocumentV1LineItem[];
30
32
  /** The locale detected on the document. */
31
33
  locale: LocaleField;
34
+ /** The receipt number or identifier only if document is a receipt. */
35
+ receiptNumber: StringField;
32
36
  /** List of Reference numbers, including PO number. */
33
37
  referenceNumbers: StringField[];
34
38
  /** The customer's address used for shipping. */
@@ -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.6 document data.
8
+ * Financial Document API version 1.7 document data.
9
9
  */
10
10
  class FinancialDocumentV1Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -47,6 +47,10 @@ class FinancialDocumentV1Document {
47
47
  prediction: rawPrediction["date"],
48
48
  pageId: pageId,
49
49
  });
50
+ this.documentNumber = new standard_1.StringField({
51
+ prediction: rawPrediction["document_number"],
52
+ pageId: pageId,
53
+ });
50
54
  this.documentType = new standard_1.ClassificationField({
51
55
  prediction: rawPrediction["document_type"],
52
56
  });
@@ -66,6 +70,10 @@ class FinancialDocumentV1Document {
66
70
  this.locale = new standard_1.LocaleField({
67
71
  prediction: rawPrediction["locale"],
68
72
  });
73
+ this.receiptNumber = new standard_1.StringField({
74
+ prediction: rawPrediction["receipt_number"],
75
+ pageId: pageId,
76
+ });
69
77
  rawPrediction["reference_numbers"] &&
70
78
  rawPrediction["reference_numbers"].map((itemPrediction) => this.referenceNumbers.push(new standard_1.StringField({
71
79
  prediction: itemPrediction,
@@ -154,6 +162,8 @@ class FinancialDocumentV1Document {
154
162
  }
155
163
  const outStr = `:Locale: ${this.locale}
156
164
  :Invoice Number: ${this.invoiceNumber}
165
+ :Receipt Number: ${this.receiptNumber}
166
+ :Document Number: ${this.documentNumber}
157
167
  :Reference Numbers: ${referenceNumbers}
158
168
  :Purchase Date: ${this.date}
159
169
  :Due Date: ${this.dueDate}
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { ReceiptV5LineItem } from "./receiptV5LineItem";
3
3
  import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, StringField, Taxes } from "../../parsing/standard";
4
4
  /**
5
- * Receipt API version 5.1 document data.
5
+ * Receipt API version 5.2 document data.
6
6
  */
7
7
  export declare class ReceiptV5Document implements Prediction {
8
8
  /** The purchase category among predefined classes. */
@@ -15,6 +15,8 @@ export declare class ReceiptV5Document implements Prediction {
15
15
  lineItems: ReceiptV5LineItem[];
16
16
  /** The locale detected on the document. */
17
17
  locale: LocaleField;
18
+ /** The receipt number or identifier. */
19
+ receiptNumber: StringField;
18
20
  /** The purchase subcategory among predefined classes for transport and food. */
19
21
  subcategory: ClassificationField;
20
22
  /** The address of the supplier or merchant. */
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
5
5
  const receiptV5LineItem_1 = require("./receiptV5LineItem");
6
6
  const standard_1 = require("../../parsing/standard");
7
7
  /**
8
- * Receipt API version 5.1 document data.
8
+ * Receipt API version 5.2 document data.
9
9
  */
10
10
  class ReceiptV5Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -31,6 +31,10 @@ class ReceiptV5Document {
31
31
  this.locale = new standard_1.LocaleField({
32
32
  prediction: rawPrediction["locale"],
33
33
  });
34
+ this.receiptNumber = new standard_1.StringField({
35
+ prediction: rawPrediction["receipt_number"],
36
+ pageId: pageId,
37
+ });
34
38
  this.subcategory = new standard_1.ClassificationField({
35
39
  prediction: rawPrediction["subcategory"],
36
40
  });
@@ -104,6 +108,7 @@ class ReceiptV5Document {
104
108
  :Supplier Company Registrations: ${supplierCompanyRegistrations}
105
109
  :Supplier Address: ${this.supplierAddress}
106
110
  :Supplier Phone Number: ${this.supplierPhoneNumber}
111
+ :Receipt Number: ${this.receiptNumber}
107
112
  :Line Items: ${lineItemsSummary}`.trimEnd();
108
113
  return (0, common_1.cleanOutString)(outStr);
109
114
  }