mindee 3.0.0 → 3.0.1
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 +4 -0
- package/README.md +19 -0
- package/package.json +1 -1
- package/src/documents/receipt/receiptV4.d.ts +11 -2
- package/src/documents/receipt/receiptV4.js +3 -2
- package/src/inputs/index.d.ts +1 -1
- package/src/inputs/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v3.0.1 - 2022-11-02
|
|
4
|
+
### Fixes
|
|
5
|
+
* :bug: Fix for `supplier` property name in `ReceiptV4` document.
|
|
6
|
+
|
|
3
7
|
## v3.0.0 - 2022-10-31
|
|
4
8
|
### ¡Breaking Changes!
|
|
5
9
|
* :sparkles: New PDF cut system, which allows specifying exactly which pages to keep or remove.
|
package/README.md
CHANGED
|
@@ -30,7 +30,19 @@ const invoiceResponse = mindeeClient
|
|
|
30
30
|
|
|
31
31
|
// Print a brief summary of the parsed data
|
|
32
32
|
invoiceResponse.then((resp) => {
|
|
33
|
+
|
|
34
|
+
// The document property can be undefined:
|
|
35
|
+
// * TypeScript will throw an error without this guard clause
|
|
36
|
+
// (or consider using the '?' notation)
|
|
37
|
+
// * JavaScript will be very happy to produce subtle bugs
|
|
38
|
+
// without this guard clause
|
|
39
|
+
if (resp.document === undefined) return;
|
|
40
|
+
|
|
41
|
+
// full object
|
|
33
42
|
console.log(resp.document);
|
|
43
|
+
|
|
44
|
+
// string summary
|
|
45
|
+
console.log(resp.document.toString());
|
|
34
46
|
});
|
|
35
47
|
```
|
|
36
48
|
|
|
@@ -55,7 +67,14 @@ const customResponse = mindeeClient
|
|
|
55
67
|
|
|
56
68
|
// Print a brief summary of the parsed data
|
|
57
69
|
customResponse.then((resp) => {
|
|
70
|
+
|
|
71
|
+
if (resp.document === undefined) return;
|
|
72
|
+
|
|
73
|
+
// full object
|
|
58
74
|
console.log(resp.document);
|
|
75
|
+
|
|
76
|
+
// string summary
|
|
77
|
+
console.log(resp.document.toString());
|
|
59
78
|
});
|
|
60
79
|
```
|
|
61
80
|
|
package/package.json
CHANGED
|
@@ -2,16 +2,25 @@ import { Document, DocumentConstructorProps } from "../document";
|
|
|
2
2
|
import { Amount, DateField, Field, Locale, TaxField } from "../../fields";
|
|
3
3
|
export declare class ReceiptV4 extends Document {
|
|
4
4
|
#private;
|
|
5
|
+
/** Where the purchase was made, the language, and the currency. */
|
|
5
6
|
locale: Locale;
|
|
7
|
+
/** The purchase date. */
|
|
6
8
|
date: DateField;
|
|
7
|
-
/**
|
|
9
|
+
/** The type of purchase. */
|
|
8
10
|
category: Field;
|
|
9
|
-
|
|
11
|
+
/** Merchant's name as seen on the receipt. */
|
|
12
|
+
supplier: Field;
|
|
13
|
+
/** Time as seen on the receipt in HH:MM format. */
|
|
10
14
|
time: Field;
|
|
15
|
+
/** List of taxes detected on the receipt. */
|
|
11
16
|
taxes: TaxField[];
|
|
17
|
+
/** Total amount of tip and gratuity. */
|
|
12
18
|
tip: Amount;
|
|
19
|
+
/** total spent including taxes, discounts, fees, tips, and gratuity. */
|
|
13
20
|
totalAmount: Amount;
|
|
21
|
+
/** Total amount of the purchase excluding taxes. */
|
|
14
22
|
totalNet: Amount;
|
|
23
|
+
/** Total tax amount of the purchase. */
|
|
15
24
|
totalTax: Amount;
|
|
16
25
|
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
17
26
|
toString(): string;
|
|
@@ -20,6 +20,7 @@ class ReceiptV4 extends document_1.Document {
|
|
|
20
20
|
fullText: fullText,
|
|
21
21
|
});
|
|
22
22
|
_ReceiptV4_instances.add(this);
|
|
23
|
+
/** List of taxes detected on the receipt. */
|
|
23
24
|
this.taxes = [];
|
|
24
25
|
__classPrivateFieldGet(this, _ReceiptV4_instances, "m", _ReceiptV4_initFromApiPrediction).call(this, prediction, pageId);
|
|
25
26
|
}
|
|
@@ -33,7 +34,7 @@ Tip: ${this.tip}
|
|
|
33
34
|
Date: ${this.date}
|
|
34
35
|
Category: ${this.category}
|
|
35
36
|
Time: ${this.time}
|
|
36
|
-
Supplier name: ${this.
|
|
37
|
+
Supplier name: ${this.supplier}
|
|
37
38
|
Taxes: ${taxes}
|
|
38
39
|
Total taxes: ${this.totalTax}
|
|
39
40
|
Locale: ${this.locale}
|
|
@@ -76,7 +77,7 @@ _ReceiptV4_instances = new WeakSet(), _ReceiptV4_initFromApiPrediction = functio
|
|
|
76
77
|
prediction: apiPrediction.category,
|
|
77
78
|
pageId: pageId,
|
|
78
79
|
});
|
|
79
|
-
this.
|
|
80
|
+
this.supplier = new fields_1.Field({
|
|
80
81
|
prediction: apiPrediction.supplier,
|
|
81
82
|
pageId: pageId,
|
|
82
83
|
});
|
package/src/inputs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { PageOptions, PageOptionsOperation } from "./pageOptions";
|
|
2
2
|
export { Base64Input, BytesInput, PathInput, StreamInput, UrlInput, } from "./sources";
|
|
3
|
-
export { InputSource, INPUT_TYPE_BASE64, INPUT_TYPE_BYTES, INPUT_TYPE_PATH, INPUT_TYPE_STREAM, } from "./base";
|
|
3
|
+
export { InputSource, INPUT_TYPE_BASE64, INPUT_TYPE_BYTES, INPUT_TYPE_PATH, INPUT_TYPE_STREAM, INPUT_TYPE_URL, } from "./base";
|
package/src/inputs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INPUT_TYPE_STREAM = exports.INPUT_TYPE_PATH = exports.INPUT_TYPE_BYTES = exports.INPUT_TYPE_BASE64 = exports.InputSource = exports.UrlInput = exports.StreamInput = exports.PathInput = exports.BytesInput = exports.Base64Input = exports.PageOptionsOperation = void 0;
|
|
3
|
+
exports.INPUT_TYPE_URL = exports.INPUT_TYPE_STREAM = exports.INPUT_TYPE_PATH = exports.INPUT_TYPE_BYTES = exports.INPUT_TYPE_BASE64 = exports.InputSource = exports.UrlInput = exports.StreamInput = exports.PathInput = exports.BytesInput = exports.Base64Input = exports.PageOptionsOperation = void 0;
|
|
4
4
|
var pageOptions_1 = require("./pageOptions");
|
|
5
5
|
Object.defineProperty(exports, "PageOptionsOperation", { enumerable: true, get: function () { return pageOptions_1.PageOptionsOperation; } });
|
|
6
6
|
var sources_1 = require("./sources");
|
|
@@ -15,3 +15,4 @@ Object.defineProperty(exports, "INPUT_TYPE_BASE64", { enumerable: true, get: fun
|
|
|
15
15
|
Object.defineProperty(exports, "INPUT_TYPE_BYTES", { enumerable: true, get: function () { return base_1.INPUT_TYPE_BYTES; } });
|
|
16
16
|
Object.defineProperty(exports, "INPUT_TYPE_PATH", { enumerable: true, get: function () { return base_1.INPUT_TYPE_PATH; } });
|
|
17
17
|
Object.defineProperty(exports, "INPUT_TYPE_STREAM", { enumerable: true, get: function () { return base_1.INPUT_TYPE_STREAM; } });
|
|
18
|
+
Object.defineProperty(exports, "INPUT_TYPE_URL", { enumerable: true, get: function () { return base_1.INPUT_TYPE_URL; } });
|