mindee 4.18.0 → 4.19.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 +16 -1
- package/package.json +12 -12
- package/src/cli.js +1 -2
- package/src/client.d.ts +44 -12
- package/src/client.js +25 -1
- package/src/geometry/boundingBoxUtils.js +5 -6
- package/src/geometry/polygonUtils.js +13 -14
- package/src/http/apiSettings.d.ts +2 -0
- package/src/http/apiSettings.js +3 -1
- package/src/http/baseEndpoint.d.ts +10 -3
- package/src/http/baseEndpoint.js +14 -2
- package/src/http/endpoint.d.ts +3 -11
- package/src/http/endpoint.js +26 -22
- package/src/http/error.js +5 -5
- package/src/http/httpParams.d.ts +17 -0
- package/src/http/httpParams.js +2 -0
- package/src/http/index.d.ts +1 -0
- package/src/http/responseValidation.js +9 -4
- package/src/http/workflowEndpoint.d.ts +29 -0
- package/src/http/workflowEndpoint.js +99 -0
- package/src/imageOperations/common/extractedImage.d.ts +0 -1
- package/src/imageOperations/common/imageExtractor.js +1 -2
- package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +1 -2
- package/src/imageOperations/multiReceiptsExtractor/multiReceiptsExtractor.js +1 -2
- package/src/input/base.d.ts +0 -1
- package/src/input/localResponse.d.ts +0 -1
- package/src/input/localResponse.js +2 -2
- package/src/input/pageOptions.js +1 -1
- package/src/input/sources.d.ts +0 -2
- package/src/parsing/common/asyncPredictResponse.d.ts +1 -1
- package/src/parsing/common/asyncPredictResponse.js +10 -9
- package/src/parsing/common/execution.d.ts +39 -0
- package/src/parsing/common/execution.js +32 -0
- package/src/parsing/common/executionFile.d.ts +12 -0
- package/src/parsing/common/executionFile.js +14 -0
- package/src/parsing/common/executionPriority.d.ts +5 -0
- package/src/parsing/common/executionPriority.js +9 -0
- package/src/parsing/common/index.d.ts +4 -1
- package/src/parsing/common/index.js +9 -3
- package/src/parsing/common/page.js +1 -1
- package/src/parsing/common/summaryHelper.js +4 -5
- package/src/parsing/common/workflowResponse.d.ts +17 -0
- package/src/parsing/common/workflowResponse.js +17 -0
- package/src/parsing/custom/lineItems.js +2 -2
- package/src/parsing/generated/generatedObject.js +2 -2
- package/src/parsing/standard/paymentDetails.js +4 -4
- package/src/pdf/pdfOperation.d.ts +0 -1
- package/src/pdf/pdfOperation.js +2 -3
- package/src/product/index.d.ts +0 -1
- package/src/product/index.js +1 -3
- package/src/product/internationalId/internal.d.ts +0 -2
- package/src/product/internationalId/internal.js +1 -5
- package/src/product/internationalId/internationalIdV1.d.ts +0 -16
- package/src/product/internationalId/internationalIdV1.js +0 -27
- package/src/product/internationalId/internationalIdV1Document.d.ts +0 -42
- package/src/product/internationalId/internationalIdV1Document.js +0 -101
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GeneratedObjectField = void 0;
|
|
4
|
+
exports.isGeneratedObject = isGeneratedObject;
|
|
4
5
|
const standard_1 = require("../standard");
|
|
5
6
|
/** A JSON-like object, with miscellaneous values. */
|
|
6
7
|
class GeneratedObjectField {
|
|
@@ -104,4 +105,3 @@ function isGeneratedObject(strDict) {
|
|
|
104
105
|
}
|
|
105
106
|
return false;
|
|
106
107
|
}
|
|
107
|
-
exports.isGeneratedObject = isGeneratedObject;
|
|
@@ -21,16 +21,16 @@ class PaymentDetailsField extends field_1.Field {
|
|
|
21
21
|
this.iban = undefined;
|
|
22
22
|
this.routingNumber = undefined;
|
|
23
23
|
this.swift = undefined;
|
|
24
|
-
if (__classPrivateFieldGet(
|
|
24
|
+
if (__classPrivateFieldGet(_a, _a, "m", _PaymentDetailsField_isKeySet).call(_a, prediction[accountNumberKey])) {
|
|
25
25
|
this.accountNumber = prediction[accountNumberKey];
|
|
26
26
|
}
|
|
27
|
-
if (__classPrivateFieldGet(
|
|
27
|
+
if (__classPrivateFieldGet(_a, _a, "m", _PaymentDetailsField_isKeySet).call(_a, prediction[ibanKey])) {
|
|
28
28
|
this.iban = prediction[ibanKey];
|
|
29
29
|
}
|
|
30
|
-
if (__classPrivateFieldGet(
|
|
30
|
+
if (__classPrivateFieldGet(_a, _a, "m", _PaymentDetailsField_isKeySet).call(_a, prediction[routingNumberKey])) {
|
|
31
31
|
this.routingNumber = prediction[routingNumberKey];
|
|
32
32
|
}
|
|
33
|
-
if (__classPrivateFieldGet(
|
|
33
|
+
if (__classPrivateFieldGet(_a, _a, "m", _PaymentDetailsField_isKeySet).call(_a, prediction[swiftKey])) {
|
|
34
34
|
this.swift = prediction[swiftKey];
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/pdf/pdfOperation.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.extractPages = extractPages;
|
|
4
|
+
exports.countPages = countPages;
|
|
4
5
|
const handler_1 = require("../errors/handler");
|
|
5
6
|
const pdf_lib_1 = require("pdf-lib");
|
|
6
7
|
const input_1 = require("../input");
|
|
@@ -64,11 +65,9 @@ async function extractPages(file, pageOptions) {
|
|
|
64
65
|
const fileBuffer = Buffer.from(await newPdf.save());
|
|
65
66
|
return { file: fileBuffer, totalPagesRemoved: sumRemovedPages };
|
|
66
67
|
}
|
|
67
|
-
exports.extractPages = extractPages;
|
|
68
68
|
async function countPages(file) {
|
|
69
69
|
const currentPdf = await pdf_lib_1.PDFDocument.load(file, {
|
|
70
70
|
ignoreEncryption: true,
|
|
71
71
|
});
|
|
72
72
|
return currentPdf.getPageCount();
|
|
73
73
|
}
|
|
74
|
-
exports.countPages = countPages;
|
package/src/product/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { CustomV1 } from "./custom/customV1";
|
|
|
6
6
|
export { DeliveryNoteV1 } from "./deliveryNote/deliveryNoteV1";
|
|
7
7
|
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
8
8
|
export { GeneratedV1 } from "./generated/generatedV1";
|
|
9
|
-
export { InternationalIdV1 } from "./internationalId/internationalIdV1";
|
|
10
9
|
export { InternationalIdV2 } from "./internationalId/internationalIdV2";
|
|
11
10
|
export { InvoiceV4 } from "./invoice/invoiceV4";
|
|
12
11
|
export { InvoiceSplitterV1 } from "./invoiceSplitter/invoiceSplitterV1";
|
package/src/product/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.us = exports.ind = exports.fr = exports.eu = exports.ResumeV1 = exports.ReceiptV5 = exports.ReceiptV4 = exports.ProofOfAddressV1 = exports.PassportV1 = exports.NutritionFactsLabelV1 = exports.MultiReceiptsDetectorV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InternationalIdV2 = exports.
|
|
26
|
+
exports.us = exports.ind = exports.fr = exports.eu = exports.ResumeV1 = exports.ReceiptV5 = exports.ReceiptV4 = exports.ProofOfAddressV1 = exports.PassportV1 = exports.NutritionFactsLabelV1 = exports.MultiReceiptsDetectorV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InternationalIdV2 = exports.GeneratedV1 = exports.FinancialDocumentV1 = exports.DeliveryNoteV1 = exports.CustomV1 = exports.CropperV1 = exports.BusinessCardV1 = exports.BillOfLadingV1 = exports.BarcodeReaderV1 = void 0;
|
|
27
27
|
var barcodeReaderV1_1 = require("./barcodeReader/barcodeReaderV1");
|
|
28
28
|
Object.defineProperty(exports, "BarcodeReaderV1", { enumerable: true, get: function () { return barcodeReaderV1_1.BarcodeReaderV1; } });
|
|
29
29
|
var billOfLadingV1_1 = require("./billOfLading/billOfLadingV1");
|
|
@@ -40,8 +40,6 @@ var financialDocumentV1_1 = require("./financialDocument/financialDocumentV1");
|
|
|
40
40
|
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return financialDocumentV1_1.FinancialDocumentV1; } });
|
|
41
41
|
var generatedV1_1 = require("./generated/generatedV1");
|
|
42
42
|
Object.defineProperty(exports, "GeneratedV1", { enumerable: true, get: function () { return generatedV1_1.GeneratedV1; } });
|
|
43
|
-
var internationalIdV1_1 = require("./internationalId/internationalIdV1");
|
|
44
|
-
Object.defineProperty(exports, "InternationalIdV1", { enumerable: true, get: function () { return internationalIdV1_1.InternationalIdV1; } });
|
|
45
43
|
var internationalIdV2_1 = require("./internationalId/internationalIdV2");
|
|
46
44
|
Object.defineProperty(exports, "InternationalIdV2", { enumerable: true, get: function () { return internationalIdV2_1.InternationalIdV2; } });
|
|
47
45
|
var invoiceV4_1 = require("./invoice/invoiceV4");
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternationalIdV2Document = exports.InternationalIdV2 =
|
|
4
|
-
var internationalIdV1_1 = require("./internationalIdV1");
|
|
5
|
-
Object.defineProperty(exports, "InternationalIdV1", { enumerable: true, get: function () { return internationalIdV1_1.InternationalIdV1; } });
|
|
6
|
-
var internationalIdV1Document_1 = require("./internationalIdV1Document");
|
|
7
|
-
Object.defineProperty(exports, "InternationalIdV1Document", { enumerable: true, get: function () { return internationalIdV1Document_1.InternationalIdV1Document; } });
|
|
3
|
+
exports.InternationalIdV2Document = exports.InternationalIdV2 = void 0;
|
|
8
4
|
var internationalIdV2_1 = require("./internationalIdV2");
|
|
9
5
|
Object.defineProperty(exports, "InternationalIdV2", { enumerable: true, get: function () { return internationalIdV2_1.InternationalIdV2; } });
|
|
10
6
|
var internationalIdV2Document_1 = require("./internationalIdV2Document");
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
-
import { InternationalIdV1Document } from "./internationalIdV1Document";
|
|
3
|
-
/**
|
|
4
|
-
* Inference prediction for International ID, API version 1.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InternationalIdV1 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: InternationalIdV1Document;
|
|
13
|
-
/** The document's pages. */
|
|
14
|
-
pages: Page<InternationalIdV1Document>[];
|
|
15
|
-
constructor(rawPrediction: StringDict);
|
|
16
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternationalIdV1 = void 0;
|
|
4
|
-
const common_1 = require("../../parsing/common");
|
|
5
|
-
const internationalIdV1Document_1 = require("./internationalIdV1Document");
|
|
6
|
-
/**
|
|
7
|
-
* Inference prediction for International ID, API version 1.
|
|
8
|
-
*/
|
|
9
|
-
class InternationalIdV1 extends common_1.Inference {
|
|
10
|
-
constructor(rawPrediction) {
|
|
11
|
-
super(rawPrediction);
|
|
12
|
-
/** The endpoint's name. */
|
|
13
|
-
this.endpointName = "international_id";
|
|
14
|
-
/** The endpoint's version. */
|
|
15
|
-
this.endpointVersion = "1";
|
|
16
|
-
/** The document's pages. */
|
|
17
|
-
this.pages = [];
|
|
18
|
-
this.prediction = new internationalIdV1Document_1.InternationalIdV1Document(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(internationalIdV1Document_1.InternationalIdV1Document, page, page["id"], page["orientation"]));
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.InternationalIdV1 = InternationalIdV1;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
-
import { ClassificationField, DateField, StringField } from "../../parsing/standard";
|
|
3
|
-
/**
|
|
4
|
-
* Document data for International ID, API version 1.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InternationalIdV1Document implements Prediction {
|
|
7
|
-
/** The physical location of the document holder's residence. */
|
|
8
|
-
address: StringField;
|
|
9
|
-
/** The date of birth of the document holder. */
|
|
10
|
-
birthDate: DateField;
|
|
11
|
-
/** The location where the document holder was born. */
|
|
12
|
-
birthPlace: StringField;
|
|
13
|
-
/** The country that issued the identification document. */
|
|
14
|
-
countryOfIssue: StringField;
|
|
15
|
-
/** The unique identifier assigned to the identification document. */
|
|
16
|
-
documentNumber: StringField;
|
|
17
|
-
/** The type of identification document being used. */
|
|
18
|
-
documentType: ClassificationField;
|
|
19
|
-
/** The date when the document will no longer be valid for use. */
|
|
20
|
-
expiryDate: DateField;
|
|
21
|
-
/** The first names or given names of the document holder. */
|
|
22
|
-
givenNames: StringField[];
|
|
23
|
-
/** The date when the document was issued. */
|
|
24
|
-
issueDate: DateField;
|
|
25
|
-
/** First line of information in a standardized format for easy machine reading and processing. */
|
|
26
|
-
mrz1: StringField;
|
|
27
|
-
/** Second line of information in a standardized format for easy machine reading and processing. */
|
|
28
|
-
mrz2: StringField;
|
|
29
|
-
/** Third line of information in a standardized format for easy machine reading and processing. */
|
|
30
|
-
mrz3: StringField;
|
|
31
|
-
/** Indicates the country of citizenship or nationality of the document holder. */
|
|
32
|
-
nationality: StringField;
|
|
33
|
-
/** The document holder's biological sex, such as male or female. */
|
|
34
|
-
sex: StringField;
|
|
35
|
-
/** The surnames of the document holder. */
|
|
36
|
-
surnames: StringField[];
|
|
37
|
-
constructor(rawPrediction: StringDict, pageId?: number);
|
|
38
|
-
/**
|
|
39
|
-
* Default string representation.
|
|
40
|
-
*/
|
|
41
|
-
toString(): string;
|
|
42
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternationalIdV1Document = void 0;
|
|
4
|
-
const common_1 = require("../../parsing/common");
|
|
5
|
-
const standard_1 = require("../../parsing/standard");
|
|
6
|
-
/**
|
|
7
|
-
* Document data for International ID, API version 1.
|
|
8
|
-
*/
|
|
9
|
-
class InternationalIdV1Document {
|
|
10
|
-
constructor(rawPrediction, pageId) {
|
|
11
|
-
/** The first names or given names of the document holder. */
|
|
12
|
-
this.givenNames = [];
|
|
13
|
-
/** The surnames of the document holder. */
|
|
14
|
-
this.surnames = [];
|
|
15
|
-
this.address = new standard_1.StringField({
|
|
16
|
-
prediction: rawPrediction["address"],
|
|
17
|
-
pageId: pageId,
|
|
18
|
-
});
|
|
19
|
-
this.birthDate = new standard_1.DateField({
|
|
20
|
-
prediction: rawPrediction["birth_date"],
|
|
21
|
-
pageId: pageId,
|
|
22
|
-
});
|
|
23
|
-
this.birthPlace = new standard_1.StringField({
|
|
24
|
-
prediction: rawPrediction["birth_place"],
|
|
25
|
-
pageId: pageId,
|
|
26
|
-
});
|
|
27
|
-
this.countryOfIssue = new standard_1.StringField({
|
|
28
|
-
prediction: rawPrediction["country_of_issue"],
|
|
29
|
-
pageId: pageId,
|
|
30
|
-
});
|
|
31
|
-
this.documentNumber = new standard_1.StringField({
|
|
32
|
-
prediction: rawPrediction["document_number"],
|
|
33
|
-
pageId: pageId,
|
|
34
|
-
});
|
|
35
|
-
this.documentType = new standard_1.ClassificationField({
|
|
36
|
-
prediction: rawPrediction["document_type"],
|
|
37
|
-
});
|
|
38
|
-
this.expiryDate = new standard_1.DateField({
|
|
39
|
-
prediction: rawPrediction["expiry_date"],
|
|
40
|
-
pageId: pageId,
|
|
41
|
-
});
|
|
42
|
-
rawPrediction["given_names"] &&
|
|
43
|
-
rawPrediction["given_names"].map((itemPrediction) => this.givenNames.push(new standard_1.StringField({
|
|
44
|
-
prediction: itemPrediction,
|
|
45
|
-
pageId: pageId,
|
|
46
|
-
})));
|
|
47
|
-
this.issueDate = new standard_1.DateField({
|
|
48
|
-
prediction: rawPrediction["issue_date"],
|
|
49
|
-
pageId: pageId,
|
|
50
|
-
});
|
|
51
|
-
this.mrz1 = new standard_1.StringField({
|
|
52
|
-
prediction: rawPrediction["mrz1"],
|
|
53
|
-
pageId: pageId,
|
|
54
|
-
});
|
|
55
|
-
this.mrz2 = new standard_1.StringField({
|
|
56
|
-
prediction: rawPrediction["mrz2"],
|
|
57
|
-
pageId: pageId,
|
|
58
|
-
});
|
|
59
|
-
this.mrz3 = new standard_1.StringField({
|
|
60
|
-
prediction: rawPrediction["mrz3"],
|
|
61
|
-
pageId: pageId,
|
|
62
|
-
});
|
|
63
|
-
this.nationality = new standard_1.StringField({
|
|
64
|
-
prediction: rawPrediction["nationality"],
|
|
65
|
-
pageId: pageId,
|
|
66
|
-
});
|
|
67
|
-
this.sex = new standard_1.StringField({
|
|
68
|
-
prediction: rawPrediction["sex"],
|
|
69
|
-
pageId: pageId,
|
|
70
|
-
});
|
|
71
|
-
rawPrediction["surnames"] &&
|
|
72
|
-
rawPrediction["surnames"].map((itemPrediction) => this.surnames.push(new standard_1.StringField({
|
|
73
|
-
prediction: itemPrediction,
|
|
74
|
-
pageId: pageId,
|
|
75
|
-
})));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Default string representation.
|
|
79
|
-
*/
|
|
80
|
-
toString() {
|
|
81
|
-
const surnames = this.surnames.join("\n ");
|
|
82
|
-
const givenNames = this.givenNames.join("\n ");
|
|
83
|
-
const outStr = `:Document Type: ${this.documentType}
|
|
84
|
-
:Document Number: ${this.documentNumber}
|
|
85
|
-
:Country of Issue: ${this.countryOfIssue}
|
|
86
|
-
:Surnames: ${surnames}
|
|
87
|
-
:Given Names: ${givenNames}
|
|
88
|
-
:Gender: ${this.sex}
|
|
89
|
-
:Birth date: ${this.birthDate}
|
|
90
|
-
:Birth Place: ${this.birthPlace}
|
|
91
|
-
:Nationality: ${this.nationality}
|
|
92
|
-
:Issue Date: ${this.issueDate}
|
|
93
|
-
:Expiry Date: ${this.expiryDate}
|
|
94
|
-
:Address: ${this.address}
|
|
95
|
-
:Machine Readable Zone Line 1: ${this.mrz1}
|
|
96
|
-
:Machine Readable Zone Line 2: ${this.mrz2}
|
|
97
|
-
:Machine Readable Zone Line 3: ${this.mrz3}`.trimEnd();
|
|
98
|
-
return (0, common_1.cleanOutString)(outStr);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.InternationalIdV1Document = InternationalIdV1Document;
|