mindee 3.7.0 → 3.7.2
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 +11 -0
- package/package.json +1 -1
- package/src/cli.js +17 -17
- package/src/client.d.ts +5 -5
- package/src/client.js +4 -3
- package/src/index.d.ts +2 -2
- package/src/index.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v3.7.2 - 2023-04-04
|
|
4
|
+
### Fixes
|
|
5
|
+
* :bug: export DocumentClient class for easier 3rd party integration
|
|
6
|
+
* :bug: only display the job info when CLI parse-queued is processing
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## v3.7.1 - 2023-03-31
|
|
10
|
+
### Fixes
|
|
11
|
+
* :bug: make sure all documents are exported properly
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## v3.7.0 - 2023-03-31
|
|
4
15
|
### Changes
|
|
5
16
|
* :sparkles: add support for asynchronous predictions
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.cli = void 0;
|
|
27
27
|
const commander_1 = require("commander");
|
|
28
|
-
const
|
|
28
|
+
const _1 = require("./");
|
|
29
29
|
const api_1 = require("./api");
|
|
30
30
|
const client_1 = require("./client");
|
|
31
31
|
const inputs_1 = require("./inputs");
|
|
@@ -42,7 +42,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
42
42
|
COMMAND_CUSTOM,
|
|
43
43
|
{
|
|
44
44
|
displayName: "Custom Document",
|
|
45
|
-
docClass:
|
|
45
|
+
docClass: _1.CustomV1,
|
|
46
46
|
fullText: false,
|
|
47
47
|
async: false,
|
|
48
48
|
sync: true,
|
|
@@ -52,7 +52,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
52
52
|
"invoice",
|
|
53
53
|
{
|
|
54
54
|
displayName: "Invoice",
|
|
55
|
-
docClass:
|
|
55
|
+
docClass: _1.InvoiceV4,
|
|
56
56
|
fullText: true,
|
|
57
57
|
async: false,
|
|
58
58
|
sync: true,
|
|
@@ -62,7 +62,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
62
62
|
"invoice-splitter",
|
|
63
63
|
{
|
|
64
64
|
displayName: "Invoice Splitter",
|
|
65
|
-
docClass:
|
|
65
|
+
docClass: _1.InvoiceSplitterV1,
|
|
66
66
|
fullText: false,
|
|
67
67
|
async: true,
|
|
68
68
|
sync: false,
|
|
@@ -72,7 +72,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
72
72
|
"receipt",
|
|
73
73
|
{
|
|
74
74
|
displayName: "Expense Receipt",
|
|
75
|
-
docClass:
|
|
75
|
+
docClass: _1.ReceiptV4,
|
|
76
76
|
fullText: true,
|
|
77
77
|
async: false,
|
|
78
78
|
sync: true,
|
|
@@ -82,7 +82,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
82
82
|
"passport",
|
|
83
83
|
{
|
|
84
84
|
displayName: "Passport",
|
|
85
|
-
docClass:
|
|
85
|
+
docClass: _1.PassportV1,
|
|
86
86
|
fullText: false,
|
|
87
87
|
async: false,
|
|
88
88
|
sync: true,
|
|
@@ -92,7 +92,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
92
92
|
"financial",
|
|
93
93
|
{
|
|
94
94
|
displayName: "Financial Document",
|
|
95
|
-
docClass:
|
|
95
|
+
docClass: _1.FinancialDocumentV1,
|
|
96
96
|
fullText: true,
|
|
97
97
|
async: false,
|
|
98
98
|
sync: true,
|
|
@@ -102,7 +102,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
102
102
|
"fr-id-card",
|
|
103
103
|
{
|
|
104
104
|
displayName: "FR ID Card",
|
|
105
|
-
docClass:
|
|
105
|
+
docClass: _1.fr.IdCardV1,
|
|
106
106
|
fullText: false,
|
|
107
107
|
async: false,
|
|
108
108
|
sync: true,
|
|
@@ -112,7 +112,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
112
112
|
"fr-bank-account-details",
|
|
113
113
|
{
|
|
114
114
|
displayName: "FR Bank Account Details",
|
|
115
|
-
docClass:
|
|
115
|
+
docClass: _1.fr.BankAccountDetailsV1,
|
|
116
116
|
fullText: false,
|
|
117
117
|
async: false,
|
|
118
118
|
sync: true,
|
|
@@ -122,7 +122,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
122
122
|
"fr-carte-vitale",
|
|
123
123
|
{
|
|
124
124
|
displayName: "FR Carte Vitale",
|
|
125
|
-
docClass:
|
|
125
|
+
docClass: _1.fr.CarteVitaleV1,
|
|
126
126
|
fullText: false,
|
|
127
127
|
async: false,
|
|
128
128
|
sync: true,
|
|
@@ -132,7 +132,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
132
132
|
"eu-license-plate",
|
|
133
133
|
{
|
|
134
134
|
displayName: "EU License Plate",
|
|
135
|
-
docClass:
|
|
135
|
+
docClass: _1.eu.LicensePlateV1,
|
|
136
136
|
fullText: false,
|
|
137
137
|
async: false,
|
|
138
138
|
sync: true,
|
|
@@ -142,7 +142,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
142
142
|
"us-bank-check",
|
|
143
143
|
{
|
|
144
144
|
displayName: "US Bank Check",
|
|
145
|
-
docClass:
|
|
145
|
+
docClass: _1.us.BankCheckV1,
|
|
146
146
|
fullText: false,
|
|
147
147
|
async: false,
|
|
148
148
|
sync: true,
|
|
@@ -152,7 +152,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
152
152
|
"shipping-container",
|
|
153
153
|
{
|
|
154
154
|
displayName: "Shipping Container",
|
|
155
|
-
docClass:
|
|
155
|
+
docClass: _1.ShippingContainerV1,
|
|
156
156
|
fullText: false,
|
|
157
157
|
async: false,
|
|
158
158
|
sync: true,
|
|
@@ -162,7 +162,7 @@ const CLI_COMMAND_CONFIG = new Map([
|
|
|
162
162
|
"mvision",
|
|
163
163
|
{
|
|
164
164
|
displayName: "Mindee Vision",
|
|
165
|
-
docClass:
|
|
165
|
+
docClass: _1.MindeeVisionV1,
|
|
166
166
|
fullText: false,
|
|
167
167
|
async: false,
|
|
168
168
|
sync: true,
|
|
@@ -225,17 +225,17 @@ async function callEnqueue(command, inputPath, options) {
|
|
|
225
225
|
const response = await doc.enqueue(conf.docClass, predictParams);
|
|
226
226
|
console.log(response.job);
|
|
227
227
|
}
|
|
228
|
-
async function callParseQueued(command,
|
|
228
|
+
async function callParseQueued(command, queueId, options) {
|
|
229
229
|
const conf = getConfig(command);
|
|
230
230
|
const mindeeClient = initClient(command, options);
|
|
231
231
|
const predictParams = getPredictParams(command, options, conf);
|
|
232
232
|
const doc = mindeeClient.docForAsync();
|
|
233
|
-
const response = await doc.parseQueued(conf.docClass,
|
|
233
|
+
const response = await doc.parseQueued(conf.docClass, queueId, predictParams);
|
|
234
234
|
if (response.document !== undefined) {
|
|
235
235
|
printResponse(response.document, options);
|
|
236
236
|
}
|
|
237
237
|
else {
|
|
238
|
-
console.log(response);
|
|
238
|
+
console.log(response.job);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
function printResponse(response, options) {
|
package/src/client.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface PredictOptions {
|
|
|
40
40
|
*/
|
|
41
41
|
pageOptions?: PageOptions;
|
|
42
42
|
}
|
|
43
|
-
declare class DocumentClient {
|
|
43
|
+
export declare class DocumentClient {
|
|
44
44
|
docConfigs: DocConfigs;
|
|
45
45
|
inputSource?: InputSource;
|
|
46
46
|
constructor(docConfigs: DocConfigs, inputSource?: InputSource);
|
|
@@ -56,10 +56,10 @@ declare class DocumentClient {
|
|
|
56
56
|
* @param params
|
|
57
57
|
*/
|
|
58
58
|
enqueue<DocType extends Document>(documentClass: DocumentSig<DocType>, params?: PredictOptions): Promise<AsyncPredictResponse<DocType>>;
|
|
59
|
-
parseQueued<DocType extends Document>(documentClass: DocumentSig<DocType>,
|
|
60
|
-
endpointName?: string
|
|
61
|
-
accountName?: string
|
|
62
|
-
}
|
|
59
|
+
parseQueued<DocType extends Document>(documentClass: DocumentSig<DocType>, queueId: string, params?: {
|
|
60
|
+
endpointName?: string;
|
|
61
|
+
accountName?: string;
|
|
62
|
+
}): Promise<AsyncPredictResponse<DocType>>;
|
|
63
63
|
protected getBooleanParam(param?: boolean): boolean;
|
|
64
64
|
protected getDocConfig<DocType extends Document>(documentClass: DocumentSig<DocType>, endpointName?: string, accountName?: string): DocumentConfig<DocType>;
|
|
65
65
|
}
|
package/src/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Client = void 0;
|
|
3
|
+
exports.Client = exports.DocumentClient = void 0;
|
|
4
4
|
const inputs_1 = require("./inputs");
|
|
5
5
|
const api_1 = require("./api");
|
|
6
6
|
const documents_1 = require("./documents");
|
|
@@ -58,10 +58,10 @@ class DocumentClient {
|
|
|
58
58
|
cropper: this.getBooleanParam(params.cropper),
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
async parseQueued(documentClass, params = {
|
|
61
|
+
async parseQueued(documentClass, queueId, params = {
|
|
62
62
|
endpointName: "",
|
|
63
63
|
accountName: "",
|
|
64
|
-
}
|
|
64
|
+
}) {
|
|
65
65
|
const docConfig = this.getDocConfig(documentClass, params.endpointName, params.accountName);
|
|
66
66
|
return await docConfig.getQueuedDocument(queueId);
|
|
67
67
|
}
|
|
@@ -96,6 +96,7 @@ class DocumentClient {
|
|
|
96
96
|
return docConfig;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
exports.DocumentClient = DocumentClient;
|
|
99
100
|
/**
|
|
100
101
|
* Mindee Client
|
|
101
102
|
*/
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CustomV1, Document, FinancialDocumentV0, FinancialDocumentV1, InvoiceV3, InvoiceV4, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, fr, us, eu, } from "./documents";
|
|
2
|
-
export { Client, ClientOptions, CustomConfigParams, PredictOptions, } from "./client";
|
|
1
|
+
export { CustomV1, Document, FinancialDocumentV0, FinancialDocumentV1, InvoiceV3, InvoiceV4, InvoiceSplitterV1, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, MindeeVisionV1, fr, us, eu, } from "./documents";
|
|
2
|
+
export { Client, ClientOptions, CustomConfigParams, DocumentClient, PredictOptions, } from "./client";
|
|
3
3
|
export { ResponseSig, Response, AsyncPredictResponse } from "./api";
|
|
4
4
|
export { InputSource, PageOptionsOperation } from "./inputs";
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageOptionsOperation = exports.InputSource = exports.AsyncPredictResponse = exports.Response = exports.Client = exports.eu = exports.us = exports.fr = exports.ShippingContainerV1 = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceV4 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.FinancialDocumentV0 = exports.Document = exports.CustomV1 = void 0;
|
|
3
|
+
exports.PageOptionsOperation = exports.InputSource = exports.AsyncPredictResponse = exports.Response = exports.DocumentClient = exports.Client = exports.eu = exports.us = exports.fr = exports.MindeeVisionV1 = exports.ShippingContainerV1 = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.FinancialDocumentV0 = exports.Document = exports.CustomV1 = void 0;
|
|
4
4
|
var documents_1 = require("./documents");
|
|
5
5
|
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return documents_1.CustomV1; } });
|
|
6
6
|
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return documents_1.Document; } });
|
|
@@ -8,16 +8,19 @@ Object.defineProperty(exports, "FinancialDocumentV0", { enumerable: true, get: f
|
|
|
8
8
|
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return documents_1.FinancialDocumentV1; } });
|
|
9
9
|
Object.defineProperty(exports, "InvoiceV3", { enumerable: true, get: function () { return documents_1.InvoiceV3; } });
|
|
10
10
|
Object.defineProperty(exports, "InvoiceV4", { enumerable: true, get: function () { return documents_1.InvoiceV4; } });
|
|
11
|
+
Object.defineProperty(exports, "InvoiceSplitterV1", { enumerable: true, get: function () { return documents_1.InvoiceSplitterV1; } });
|
|
11
12
|
Object.defineProperty(exports, "PassportV1", { enumerable: true, get: function () { return documents_1.PassportV1; } });
|
|
12
13
|
Object.defineProperty(exports, "ReceiptV3", { enumerable: true, get: function () { return documents_1.ReceiptV3; } });
|
|
13
14
|
Object.defineProperty(exports, "ReceiptV4", { enumerable: true, get: function () { return documents_1.ReceiptV4; } });
|
|
14
15
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return documents_1.CropperV1; } });
|
|
15
16
|
Object.defineProperty(exports, "ShippingContainerV1", { enumerable: true, get: function () { return documents_1.ShippingContainerV1; } });
|
|
17
|
+
Object.defineProperty(exports, "MindeeVisionV1", { enumerable: true, get: function () { return documents_1.MindeeVisionV1; } });
|
|
16
18
|
Object.defineProperty(exports, "fr", { enumerable: true, get: function () { return documents_1.fr; } });
|
|
17
19
|
Object.defineProperty(exports, "us", { enumerable: true, get: function () { return documents_1.us; } });
|
|
18
20
|
Object.defineProperty(exports, "eu", { enumerable: true, get: function () { return documents_1.eu; } });
|
|
19
21
|
var client_1 = require("./client");
|
|
20
22
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
23
|
+
Object.defineProperty(exports, "DocumentClient", { enumerable: true, get: function () { return client_1.DocumentClient; } });
|
|
21
24
|
var api_1 = require("./api");
|
|
22
25
|
Object.defineProperty(exports, "Response", { enumerable: true, get: function () { return api_1.Response; } });
|
|
23
26
|
Object.defineProperty(exports, "AsyncPredictResponse", { enumerable: true, get: function () { return api_1.AsyncPredictResponse; } });
|