mindee 4.23.0 → 4.24.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 +22 -0
- package/package.json +1 -2
- package/src/cli.js +7 -236
- package/src/cliProducts.d.ts +11 -0
- package/src/cliProducts.js +306 -0
- package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +1 -1
- package/src/product/deliveryNote/deliveryNoteV1Document.d.ts +1 -1
- package/src/product/deliveryNote/deliveryNoteV1Document.js +1 -1
- package/src/product/financialDocument/financialDocumentV1Document.d.ts +17 -14
- package/src/product/financialDocument/financialDocumentV1Document.js +5 -5
- package/src/product/financialDocument/financialDocumentV1LineItem.d.ts +1 -1
- package/src/product/financialDocument/financialDocumentV1LineItem.js +1 -1
- package/src/product/fr/energyBill/energyBillV1Document.d.ts +1 -1
- package/src/product/fr/energyBill/energyBillV1Document.js +4 -2
- package/src/product/fr/energyBill/energyBillV1EnergyUsage.d.ts +4 -0
- package/src/product/fr/energyBill/energyBillV1EnergyUsage.js +24 -1
- package/src/product/fr/energyBill/energyBillV1MeterDetail.d.ts +1 -1
- package/src/product/fr/energyBill/energyBillV1MeterDetail.js +2 -2
- package/src/product/fr/internal.d.ts +1 -1
- package/src/product/fr/internal.js +2 -2
- package/src/product/ind/internal.d.ts +1 -1
- package/src/product/ind/internal.js +2 -2
- package/src/product/index.d.ts +4 -7
- package/src/product/index.js +6 -11
- package/src/product/internal.d.ts +1 -2
- package/src/product/internal.js +2 -3
- package/src/product/invoice/invoiceV4Document.d.ts +14 -14
- package/src/product/invoice/invoiceV4Document.js +5 -5
- package/src/product/invoice/invoiceV4LineItem.d.ts +2 -2
- package/src/product/invoice/invoiceV4LineItem.js +1 -1
- package/src/product/invoiceSplitter/index.d.ts +1 -0
- package/src/product/invoiceSplitter/index.js +5 -0
- package/src/product/invoiceSplitter/internal.d.ts +1 -1
- package/src/product/invoiceSplitter/internal.js +3 -3
- package/src/product/invoiceSplitter/invoiceSplitterV1.d.ts +1 -1
- package/src/product/invoiceSplitter/invoiceSplitterV1.js +7 -2
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +5 -5
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +17 -10
- package/src/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.d.ts +28 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.js +53 -0
- package/src/product/receipt/internal.d.ts +0 -2
- package/src/product/receipt/internal.js +1 -5
- package/src/product/receipt/receiptV5Document.d.ts +8 -8
- package/src/product/receipt/receiptV5Document.js +2 -2
- package/src/product/receipt/receiptV5LineItem.d.ts +1 -1
- package/src/product/receipt/receiptV5LineItem.js +1 -1
- package/src/product/us/healthcareCard/healthcareCardV1Document.d.ts +1 -1
- package/src/product/us/healthcareCard/healthcareCardV1Document.js +1 -1
- package/src/product/us/healthcareCard/index.d.ts +0 -2
- package/src/product/us/healthcareCard/index.js +1 -5
- package/src/product/us/index.d.ts +0 -2
- package/src/product/us/index.js +1 -5
- package/src/product/us/internal.d.ts +1 -3
- package/src/product/us/internal.js +2 -4
- package/src/product/eu/driverLicense/driverLicenseV1.d.ts +0 -17
- package/src/product/eu/driverLicense/driverLicenseV1.js +0 -28
- package/src/product/eu/driverLicense/driverLicenseV1Document.d.ts +0 -36
- package/src/product/eu/driverLicense/driverLicenseV1Document.js +0 -79
- package/src/product/eu/driverLicense/driverLicenseV1Page.d.ts +0 -14
- package/src/product/eu/driverLicense/driverLicenseV1Page.js +0 -29
- package/src/product/eu/driverLicense/index.d.ts +0 -1
- package/src/product/eu/driverLicense/index.js +0 -5
- package/src/product/eu/driverLicense/internal.d.ts +0 -3
- package/src/product/eu/driverLicense/internal.js +0 -9
- package/src/product/eu/index.d.ts +0 -2
- package/src/product/eu/index.js +0 -7
- package/src/product/eu/internal.d.ts +0 -2
- package/src/product/eu/internal.js +0 -28
- package/src/product/eu/licensePlate/index.d.ts +0 -1
- package/src/product/eu/licensePlate/index.js +0 -5
- package/src/product/eu/licensePlate/internal.d.ts +0 -2
- package/src/product/eu/licensePlate/internal.js +0 -7
- package/src/product/eu/licensePlate/licensePlateV1.d.ts +0 -16
- package/src/product/eu/licensePlate/licensePlateV1.js +0 -27
- package/src/product/eu/licensePlate/licensePlateV1Document.d.ts +0 -14
- package/src/product/eu/licensePlate/licensePlateV1Document.js +0 -28
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.d.ts +0 -15
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.js +0 -21
- package/src/product/proofOfAddress/index.d.ts +0 -1
- package/src/product/proofOfAddress/index.js +0 -5
- package/src/product/proofOfAddress/internal.d.ts +0 -2
- package/src/product/proofOfAddress/internal.js +0 -7
- package/src/product/proofOfAddress/proofOfAddressV1.d.ts +0 -16
- package/src/product/proofOfAddress/proofOfAddressV1.js +0 -27
- package/src/product/proofOfAddress/proofOfAddressV1Document.d.ts +0 -30
- package/src/product/proofOfAddress/proofOfAddressV1Document.js +0 -75
- package/src/product/receipt/receiptV4.d.ts +0 -16
- package/src/product/receipt/receiptV4.js +0 -20
- package/src/product/receipt/receiptV4Document.d.ts +0 -36
- package/src/product/receipt/receiptV4Document.js +0 -73
- package/src/product/us/driverLicense/driverLicenseV1.d.ts +0 -17
- package/src/product/us/driverLicense/driverLicenseV1.js +0 -28
- package/src/product/us/driverLicense/driverLicenseV1Document.d.ts +0 -46
- package/src/product/us/driverLicense/driverLicenseV1Document.js +0 -104
- package/src/product/us/driverLicense/driverLicenseV1Page.d.ts +0 -14
- package/src/product/us/driverLicense/driverLicenseV1Page.js +0 -29
- package/src/product/us/driverLicense/index.d.ts +0 -1
- package/src/product/us/driverLicense/index.js +0 -5
- package/src/product/us/driverLicense/internal.d.ts +0 -3
- package/src/product/us/driverLicense/internal.js +0 -9
- package/src/product/us/w9/index.d.ts +0 -1
- package/src/product/us/w9/index.js +0 -5
- package/src/product/us/w9/internal.d.ts +0 -3
- package/src/product/us/w9/internal.js +0 -9
- package/src/product/us/w9/w9V1.d.ts +0 -17
- package/src/product/us/w9/w9V1.js +0 -28
- package/src/product/us/w9/w9V1Document.d.ts +0 -10
- package/src/product/us/w9/w9V1Document.js +0 -15
- package/src/product/us/w9/w9V1Page.d.ts +0 -34
- package/src/product/us/w9/w9V1Page.js +0 -78
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.24.0 - 2025-03-27
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: update structure for InvoiceSplitterV1
|
|
6
|
+
* :sparkles: update FR EnegryBillV1 to V1.2
|
|
7
|
+
* :sparkles: update US HealthcareCardV1 to V1.1
|
|
8
|
+
* :coffin: remove support for EU Driver License
|
|
9
|
+
* :coffin: remove support for License Plates
|
|
10
|
+
* :coffin: remove support for ReceiptV4
|
|
11
|
+
* :coffin: remove support for Proof of Address
|
|
12
|
+
* :coffin: remove support for US Driver License
|
|
13
|
+
* :coffin: remove support for US W9V1
|
|
14
|
+
### Fixes
|
|
15
|
+
* :bug: fix invalid indexes of some products
|
|
16
|
+
* :recycle: update CLI structure
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## v4.23.1 - 2025-03-05
|
|
20
|
+
### Changes
|
|
21
|
+
* :recycle: remove superfluous canvas dependency
|
|
22
|
+
* :memo: update doc
|
|
23
|
+
|
|
24
|
+
|
|
3
25
|
## v4.23.0 - 2025-02-21
|
|
4
26
|
### Changes
|
|
5
27
|
* :sparkles: add support for image & PDF compression
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.0",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "bin/mindee.js",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"typescript": "^5.6.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"canvas": "^3.0.1",
|
|
60
59
|
"commander": "~9.4.1",
|
|
61
60
|
"file-type": "~16.5.4",
|
|
62
61
|
"form-data": "~3.0.1",
|
package/src/cli.js
CHANGED
|
@@ -25,240 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.cli = cli;
|
|
27
27
|
const commander_1 = require("commander");
|
|
28
|
-
const product = __importStar(require("./product"));
|
|
29
28
|
const client_1 = require("./client");
|
|
30
29
|
const input_1 = require("./input");
|
|
31
30
|
const console = __importStar(require("console"));
|
|
31
|
+
const cliProducts_1 = require("./cliProducts");
|
|
32
32
|
const program = new commander_1.Command();
|
|
33
|
-
const COMMAND_CUSTOM = "custom";
|
|
34
|
-
const COMMAND_GENERATED = "generated";
|
|
35
|
-
//
|
|
36
|
-
// PRODUCT CONFIGURATION
|
|
37
|
-
//
|
|
38
|
-
// The Map's key is the command name as it will appear on the console.
|
|
39
|
-
//
|
|
40
|
-
const CLI_COMMAND_CONFIG = new Map([
|
|
41
|
-
[
|
|
42
|
-
COMMAND_CUSTOM,
|
|
43
|
-
{
|
|
44
|
-
displayName: "Custom Document",
|
|
45
|
-
docClass: product.CustomV1,
|
|
46
|
-
allWords: false,
|
|
47
|
-
async: false,
|
|
48
|
-
sync: true,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
[
|
|
52
|
-
COMMAND_GENERATED,
|
|
53
|
-
{
|
|
54
|
-
displayName: "Generated Document",
|
|
55
|
-
docClass: product.GeneratedV1,
|
|
56
|
-
allWords: true,
|
|
57
|
-
async: true,
|
|
58
|
-
sync: true,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
"barcode-reader",
|
|
63
|
-
{
|
|
64
|
-
displayName: "Barcode Reader",
|
|
65
|
-
docClass: product.BarcodeReaderV1,
|
|
66
|
-
allWords: true,
|
|
67
|
-
async: false,
|
|
68
|
-
sync: true,
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
[
|
|
72
|
-
"cropper",
|
|
73
|
-
{
|
|
74
|
-
displayName: "Cropper",
|
|
75
|
-
docClass: product.CropperV1,
|
|
76
|
-
allWords: false,
|
|
77
|
-
async: false,
|
|
78
|
-
sync: true,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
"financial",
|
|
83
|
-
{
|
|
84
|
-
displayName: "Financial Document",
|
|
85
|
-
docClass: product.FinancialDocumentV1,
|
|
86
|
-
allWords: true,
|
|
87
|
-
async: true,
|
|
88
|
-
sync: true,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
[
|
|
92
|
-
"fr-bank-account-details",
|
|
93
|
-
{
|
|
94
|
-
displayName: "FR Bank Account Details",
|
|
95
|
-
docClass: product.fr.BankAccountDetailsV2,
|
|
96
|
-
allWords: false,
|
|
97
|
-
async: false,
|
|
98
|
-
sync: true,
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
[
|
|
102
|
-
"fr-id-card",
|
|
103
|
-
{
|
|
104
|
-
displayName: "FR ID Card",
|
|
105
|
-
docClass: product.fr.IdCardV1,
|
|
106
|
-
allWords: false,
|
|
107
|
-
async: false,
|
|
108
|
-
sync: true,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"fr-health-card",
|
|
113
|
-
{
|
|
114
|
-
displayName: "FR Health Card",
|
|
115
|
-
docClass: product.fr.HealthCardV1,
|
|
116
|
-
allWords: false,
|
|
117
|
-
async: true,
|
|
118
|
-
sync: false,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
[
|
|
122
|
-
"fr-carte-grise",
|
|
123
|
-
{
|
|
124
|
-
displayName: "FR Carte Grise",
|
|
125
|
-
docClass: product.fr.CarteGriseV1,
|
|
126
|
-
allWords: false,
|
|
127
|
-
async: false,
|
|
128
|
-
sync: true,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
"eu-license-plate",
|
|
133
|
-
{
|
|
134
|
-
displayName: "EU License Plate",
|
|
135
|
-
docClass: product.eu.LicensePlateV1,
|
|
136
|
-
allWords: false,
|
|
137
|
-
async: false,
|
|
138
|
-
sync: true,
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
[
|
|
142
|
-
"driver-license",
|
|
143
|
-
{
|
|
144
|
-
displayName: "Driver License",
|
|
145
|
-
docClass: product.DriverLicenseV1,
|
|
146
|
-
allWords: false,
|
|
147
|
-
async: true,
|
|
148
|
-
sync: false,
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
[
|
|
152
|
-
"international-id",
|
|
153
|
-
{
|
|
154
|
-
displayName: "International Id",
|
|
155
|
-
docClass: product.InternationalIdV2,
|
|
156
|
-
allWords: false,
|
|
157
|
-
async: true,
|
|
158
|
-
sync: false,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
[
|
|
162
|
-
"invoice",
|
|
163
|
-
{
|
|
164
|
-
displayName: "Invoice",
|
|
165
|
-
docClass: product.InvoiceV4,
|
|
166
|
-
allWords: true,
|
|
167
|
-
async: false,
|
|
168
|
-
sync: true,
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
[
|
|
172
|
-
"invoice-splitter",
|
|
173
|
-
{
|
|
174
|
-
displayName: "Invoice Splitter",
|
|
175
|
-
docClass: product.InvoiceSplitterV1,
|
|
176
|
-
allWords: false,
|
|
177
|
-
async: true,
|
|
178
|
-
sync: false,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
[
|
|
182
|
-
"multi-receipts-detector",
|
|
183
|
-
{
|
|
184
|
-
displayName: "Multi Receipts Detector",
|
|
185
|
-
docClass: product.MultiReceiptsDetectorV1,
|
|
186
|
-
allWords: false,
|
|
187
|
-
async: false,
|
|
188
|
-
sync: true,
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
[
|
|
192
|
-
"passport",
|
|
193
|
-
{
|
|
194
|
-
displayName: "Passport",
|
|
195
|
-
docClass: product.PassportV1,
|
|
196
|
-
allWords: false,
|
|
197
|
-
async: false,
|
|
198
|
-
sync: true,
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
[
|
|
202
|
-
"receipt",
|
|
203
|
-
{
|
|
204
|
-
displayName: "Expense Receipt",
|
|
205
|
-
docClass: product.ReceiptV5,
|
|
206
|
-
allWords: true,
|
|
207
|
-
async: false,
|
|
208
|
-
sync: true,
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
[
|
|
212
|
-
"resume",
|
|
213
|
-
{
|
|
214
|
-
displayName: "Resume",
|
|
215
|
-
docClass: product.ResumeV1,
|
|
216
|
-
allWords: false,
|
|
217
|
-
async: true,
|
|
218
|
-
sync: false,
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
[
|
|
222
|
-
"us-bank-check",
|
|
223
|
-
{
|
|
224
|
-
displayName: "US Bank Check",
|
|
225
|
-
docClass: product.us.BankCheckV1,
|
|
226
|
-
allWords: false,
|
|
227
|
-
async: false,
|
|
228
|
-
sync: true,
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
[
|
|
232
|
-
"us-healthcare-card",
|
|
233
|
-
{
|
|
234
|
-
displayName: "US Healthcare Card",
|
|
235
|
-
docClass: product.us.HealthcareCardV1,
|
|
236
|
-
allWords: false,
|
|
237
|
-
async: true,
|
|
238
|
-
sync: false,
|
|
239
|
-
},
|
|
240
|
-
],
|
|
241
|
-
[
|
|
242
|
-
"us-mail",
|
|
243
|
-
{
|
|
244
|
-
displayName: "US Mail",
|
|
245
|
-
docClass: product.us.UsMailV2,
|
|
246
|
-
allWords: false,
|
|
247
|
-
async: true,
|
|
248
|
-
sync: false,
|
|
249
|
-
},
|
|
250
|
-
],
|
|
251
|
-
[
|
|
252
|
-
"us-w9",
|
|
253
|
-
{
|
|
254
|
-
displayName: "US W9",
|
|
255
|
-
docClass: product.us.W9V1,
|
|
256
|
-
allWords: false,
|
|
257
|
-
async: true,
|
|
258
|
-
sync: false,
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
]);
|
|
262
33
|
//
|
|
263
34
|
// EXECUTE THE COMMANDS
|
|
264
35
|
//
|
|
@@ -269,7 +40,7 @@ function initClient(options) {
|
|
|
269
40
|
});
|
|
270
41
|
}
|
|
271
42
|
function getConfig(command) {
|
|
272
|
-
const conf = CLI_COMMAND_CONFIG.get(command);
|
|
43
|
+
const conf = cliProducts_1.CLI_COMMAND_CONFIG.get(command);
|
|
273
44
|
if (conf === undefined) {
|
|
274
45
|
throw new Error(`Invalid document type ${command}`);
|
|
275
46
|
}
|
|
@@ -298,7 +69,7 @@ async function callParse(productClass, command, inputPath, options) {
|
|
|
298
69
|
const pageOptions = getPageOptions(options);
|
|
299
70
|
const inputSource = mindeeClient.docFromPath(inputPath);
|
|
300
71
|
let response;
|
|
301
|
-
if (command === COMMAND_CUSTOM || command === COMMAND_GENERATED) {
|
|
72
|
+
if (command === cliProducts_1.COMMAND_CUSTOM || command === cliProducts_1.COMMAND_GENERATED) {
|
|
302
73
|
const customEndpoint = mindeeClient.createEndpoint(options.endpoint, options.account, options.version);
|
|
303
74
|
response = await mindeeClient.parse(productClass, inputSource, {
|
|
304
75
|
endpoint: customEndpoint,
|
|
@@ -322,7 +93,7 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
|
|
|
322
93
|
const pageOptions = getPageOptions(options);
|
|
323
94
|
const inputSource = mindeeClient.docFromPath(inputPath);
|
|
324
95
|
let response;
|
|
325
|
-
if (command === COMMAND_CUSTOM || command === COMMAND_GENERATED) {
|
|
96
|
+
if (command === cliProducts_1.COMMAND_CUSTOM || command === cliProducts_1.COMMAND_GENERATED) {
|
|
326
97
|
const customEndpoint = mindeeClient.createEndpoint(options.endpoint, options.account, options.version);
|
|
327
98
|
response = await mindeeClient.enqueueAndParse(productClass, inputSource, {
|
|
328
99
|
endpoint: customEndpoint,
|
|
@@ -409,7 +180,7 @@ function routeSwitchboard(command, inputPath, allOptions) {
|
|
|
409
180
|
return callParse(docClass, command.name(), inputPath, allOptions);
|
|
410
181
|
}
|
|
411
182
|
function addPredictAction(prog) {
|
|
412
|
-
if (prog.name() === COMMAND_CUSTOM || prog.name() === COMMAND_GENERATED) {
|
|
183
|
+
if (prog.name() === cliProducts_1.COMMAND_CUSTOM || prog.name() === cliProducts_1.COMMAND_GENERATED) {
|
|
413
184
|
prog.action(function (inputPath, options, command) {
|
|
414
185
|
const allOptions = {
|
|
415
186
|
...prog.parent?.parent?.opts(),
|
|
@@ -436,7 +207,7 @@ function cli() {
|
|
|
436
207
|
program.name("mindee")
|
|
437
208
|
.description("Command line interface for Mindee products.")
|
|
438
209
|
.option("-d, --debug", "high verbosity mode");
|
|
439
|
-
CLI_COMMAND_CONFIG.forEach((info, name) => {
|
|
210
|
+
cliProducts_1.CLI_COMMAND_CONFIG.forEach((info, name) => {
|
|
440
211
|
const productCmd = program.command(name)
|
|
441
212
|
.description(info.displayName);
|
|
442
213
|
if (info.async) {
|
|
@@ -471,7 +242,7 @@ function cli() {
|
|
|
471
242
|
}
|
|
472
243
|
predictProductCmd.addOption(asyncOpt);
|
|
473
244
|
}
|
|
474
|
-
if (name === COMMAND_CUSTOM || name === COMMAND_GENERATED) {
|
|
245
|
+
if (name === cliProducts_1.COMMAND_CUSTOM || name === cliProducts_1.COMMAND_GENERATED) {
|
|
475
246
|
addCustomPostOptions(predictProductCmd);
|
|
476
247
|
}
|
|
477
248
|
addMainOptions(predictProductCmd);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Inference, StringDict } from "./parsing/common";
|
|
2
|
+
export declare const COMMAND_CUSTOM = "custom";
|
|
3
|
+
export declare const COMMAND_GENERATED = "generated";
|
|
4
|
+
export interface ProductConfig<T extends Inference = Inference> {
|
|
5
|
+
displayName: string;
|
|
6
|
+
docClass: new (rawPrediction: StringDict) => T;
|
|
7
|
+
allWords: boolean;
|
|
8
|
+
async: boolean;
|
|
9
|
+
sync: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CLI_COMMAND_CONFIG: Map<string, ProductConfig<Inference<import("./parsing/common").Prediction, import("./parsing/common").Prediction>>>;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// PRODUCT CONFIGURATION
|
|
4
|
+
//
|
|
5
|
+
// The Map's key is the command name as it will appear on the console.
|
|
6
|
+
//
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.CLI_COMMAND_CONFIG = exports.COMMAND_GENERATED = exports.COMMAND_CUSTOM = void 0;
|
|
32
|
+
const product = __importStar(require("./product"));
|
|
33
|
+
exports.COMMAND_CUSTOM = "custom";
|
|
34
|
+
exports.COMMAND_GENERATED = "generated";
|
|
35
|
+
exports.CLI_COMMAND_CONFIG = new Map([
|
|
36
|
+
[
|
|
37
|
+
exports.COMMAND_CUSTOM,
|
|
38
|
+
{
|
|
39
|
+
displayName: "Custom Document",
|
|
40
|
+
docClass: product.CustomV1,
|
|
41
|
+
allWords: false,
|
|
42
|
+
async: false,
|
|
43
|
+
sync: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
exports.COMMAND_GENERATED,
|
|
48
|
+
{
|
|
49
|
+
displayName: "Generated Document",
|
|
50
|
+
docClass: product.GeneratedV1,
|
|
51
|
+
allWords: true,
|
|
52
|
+
async: true,
|
|
53
|
+
sync: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"barcode-reader",
|
|
58
|
+
{
|
|
59
|
+
displayName: "Barcode Reader",
|
|
60
|
+
docClass: product.BarcodeReaderV1,
|
|
61
|
+
allWords: false,
|
|
62
|
+
async: false,
|
|
63
|
+
sync: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"bill-of-lading",
|
|
68
|
+
{
|
|
69
|
+
displayName: "Bill of Lading",
|
|
70
|
+
docClass: product.BillOfLadingV1,
|
|
71
|
+
allWords: false,
|
|
72
|
+
async: true,
|
|
73
|
+
sync: false,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"business-card",
|
|
78
|
+
{
|
|
79
|
+
displayName: "Business Card",
|
|
80
|
+
docClass: product.BusinessCardV1,
|
|
81
|
+
allWords: false,
|
|
82
|
+
async: true,
|
|
83
|
+
sync: false,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"cropper",
|
|
88
|
+
{
|
|
89
|
+
displayName: "Cropper",
|
|
90
|
+
docClass: product.CropperV1,
|
|
91
|
+
allWords: false,
|
|
92
|
+
async: false,
|
|
93
|
+
sync: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"delivery-note",
|
|
98
|
+
{
|
|
99
|
+
displayName: "Delivery note",
|
|
100
|
+
docClass: product.DeliveryNoteV1,
|
|
101
|
+
allWords: false,
|
|
102
|
+
async: true,
|
|
103
|
+
sync: false,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"driver-license",
|
|
108
|
+
{
|
|
109
|
+
displayName: "Driver License",
|
|
110
|
+
docClass: product.DriverLicenseV1,
|
|
111
|
+
allWords: false,
|
|
112
|
+
async: true,
|
|
113
|
+
sync: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"financial-document",
|
|
118
|
+
{
|
|
119
|
+
displayName: "Financial Document",
|
|
120
|
+
docClass: product.FinancialDocumentV1,
|
|
121
|
+
allWords: true,
|
|
122
|
+
async: true,
|
|
123
|
+
sync: true,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
"fr-bank-account-details",
|
|
128
|
+
{
|
|
129
|
+
displayName: "FR Bank Account Details",
|
|
130
|
+
docClass: product.fr.BankAccountDetailsV2,
|
|
131
|
+
allWords: false,
|
|
132
|
+
async: false,
|
|
133
|
+
sync: true,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"fr-carte-grise",
|
|
138
|
+
{
|
|
139
|
+
displayName: "FR Carte Grise",
|
|
140
|
+
docClass: product.fr.CarteGriseV1,
|
|
141
|
+
allWords: false,
|
|
142
|
+
async: false,
|
|
143
|
+
sync: true,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"fr-energy-bill",
|
|
148
|
+
{
|
|
149
|
+
displayName: "FR Energy Bill",
|
|
150
|
+
docClass: product.fr.EnergyBillV1,
|
|
151
|
+
allWords: false,
|
|
152
|
+
async: true,
|
|
153
|
+
sync: false,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"fr-health-card",
|
|
158
|
+
{
|
|
159
|
+
displayName: "FR Health Card",
|
|
160
|
+
docClass: product.fr.HealthCardV1,
|
|
161
|
+
allWords: false,
|
|
162
|
+
async: true,
|
|
163
|
+
sync: false,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"fr-carte-nationale-d-identite",
|
|
168
|
+
{
|
|
169
|
+
displayName: "FR Carte Nationale d'Identité",
|
|
170
|
+
docClass: product.fr.IdCardV2,
|
|
171
|
+
allWords: false,
|
|
172
|
+
async: false,
|
|
173
|
+
sync: true,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"fr-payslip",
|
|
178
|
+
{
|
|
179
|
+
displayName: "FR Payslip",
|
|
180
|
+
docClass: product.fr.PayslipV3,
|
|
181
|
+
allWords: false,
|
|
182
|
+
async: true,
|
|
183
|
+
sync: false,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
"ind-passport-india",
|
|
188
|
+
{
|
|
189
|
+
displayName: "IND Passport - India",
|
|
190
|
+
docClass: product.ind.IndianPassportV1,
|
|
191
|
+
allWords: false,
|
|
192
|
+
async: true,
|
|
193
|
+
sync: false,
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"international-id",
|
|
198
|
+
{
|
|
199
|
+
displayName: "International ID",
|
|
200
|
+
docClass: product.InternationalIdV2,
|
|
201
|
+
allWords: false,
|
|
202
|
+
async: true,
|
|
203
|
+
sync: false,
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
"invoice",
|
|
208
|
+
{
|
|
209
|
+
displayName: "Invoice",
|
|
210
|
+
docClass: product.InvoiceV4,
|
|
211
|
+
allWords: true,
|
|
212
|
+
async: true,
|
|
213
|
+
sync: true,
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
"invoice-splitter",
|
|
218
|
+
{
|
|
219
|
+
displayName: "Invoice Splitter",
|
|
220
|
+
docClass: product.InvoiceSplitterV1,
|
|
221
|
+
allWords: false,
|
|
222
|
+
async: true,
|
|
223
|
+
sync: false,
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
"multi-receipts-detector",
|
|
228
|
+
{
|
|
229
|
+
displayName: "Multi Receipts Detector",
|
|
230
|
+
docClass: product.MultiReceiptsDetectorV1,
|
|
231
|
+
allWords: false,
|
|
232
|
+
async: false,
|
|
233
|
+
sync: true,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
"nutrition-facts-label",
|
|
238
|
+
{
|
|
239
|
+
displayName: "Nutrition Facts Label",
|
|
240
|
+
docClass: product.NutritionFactsLabelV1,
|
|
241
|
+
allWords: false,
|
|
242
|
+
async: true,
|
|
243
|
+
sync: false,
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
"passport",
|
|
248
|
+
{
|
|
249
|
+
displayName: "Passport",
|
|
250
|
+
docClass: product.PassportV1,
|
|
251
|
+
allWords: false,
|
|
252
|
+
async: false,
|
|
253
|
+
sync: true,
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"receipt",
|
|
258
|
+
{
|
|
259
|
+
displayName: "Receipt",
|
|
260
|
+
docClass: product.ReceiptV5,
|
|
261
|
+
allWords: true,
|
|
262
|
+
async: true,
|
|
263
|
+
sync: true,
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
[
|
|
267
|
+
"resume",
|
|
268
|
+
{
|
|
269
|
+
displayName: "Resume",
|
|
270
|
+
docClass: product.ResumeV1,
|
|
271
|
+
allWords: false,
|
|
272
|
+
async: true,
|
|
273
|
+
sync: false,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
"us-bank-check",
|
|
278
|
+
{
|
|
279
|
+
displayName: "US Bank Check",
|
|
280
|
+
docClass: product.us.BankCheckV1,
|
|
281
|
+
allWords: false,
|
|
282
|
+
async: false,
|
|
283
|
+
sync: true,
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
[
|
|
287
|
+
"us-healthcare-card",
|
|
288
|
+
{
|
|
289
|
+
displayName: "US Healthcare Card",
|
|
290
|
+
docClass: product.us.HealthcareCardV1,
|
|
291
|
+
allWords: false,
|
|
292
|
+
async: true,
|
|
293
|
+
sync: false,
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
"us-us-mail",
|
|
298
|
+
{
|
|
299
|
+
displayName: "US US Mail",
|
|
300
|
+
docClass: product.us.UsMailV3,
|
|
301
|
+
allWords: false,
|
|
302
|
+
async: true,
|
|
303
|
+
sync: false,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
]);
|
|
@@ -53,7 +53,7 @@ async function extractInvoices(inputFile, indexes, strict = false) {
|
|
|
53
53
|
if (indexes instanceof product_1.InvoiceSplitterV1) {
|
|
54
54
|
indexes.prediction.invoicePageGroups.map((invoicePageGroup) => {
|
|
55
55
|
if (!strict || invoicePageGroup.confidence === 1) {
|
|
56
|
-
customIndexes.push(invoicePageGroup.pageIndexes);
|
|
56
|
+
customIndexes.push(invoicePageGroup.pageIndexes ?? []);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
2
|
import { AmountField, DateField, StringField } from "../../parsing/standard";
|
|
3
3
|
/**
|
|
4
|
-
* Delivery note API version 1.
|
|
4
|
+
* Delivery note API version 1.2 document data.
|
|
5
5
|
*/
|
|
6
6
|
export declare class DeliveryNoteV1Document implements Prediction {
|
|
7
7
|
/** The address of the customer receiving the goods. */
|
|
@@ -4,7 +4,7 @@ exports.DeliveryNoteV1Document = void 0;
|
|
|
4
4
|
const common_1 = require("../../parsing/common");
|
|
5
5
|
const standard_1 = require("../../parsing/standard");
|
|
6
6
|
/**
|
|
7
|
-
* Delivery note API version 1.
|
|
7
|
+
* Delivery note API version 1.2 document data.
|
|
8
8
|
*/
|
|
9
9
|
class DeliveryNoteV1Document {
|
|
10
10
|
constructor(rawPrediction, pageId) {
|