mindee 4.1.1 → 4.3.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 +19 -0
- package/README.md +4 -1
- package/package.json +1 -1
- package/src/client.js +2 -8
- package/src/geometry/boundingBox.d.ts +7 -1
- package/src/geometry/boundingBox.js +11 -0
- package/src/geometry/boundingBoxUtils.d.ts +2 -2
- package/src/geometry/boundingBoxUtils.js +11 -28
- package/src/geometry/index.js +3 -1
- package/src/http/error.d.ts +1 -1
- package/src/http/error.js +2 -2
- package/src/parsing/common/inference.js +1 -2
- package/src/parsing/custom/index.d.ts +1 -1
- package/src/parsing/custom/index.js +2 -3
- package/src/parsing/custom/lineItems.d.ts +3 -16
- package/src/parsing/custom/lineItems.js +29 -37
- package/src/parsing/standard/base.d.ts +2 -2
- package/src/parsing/standard/base.js +2 -2
- package/src/parsing/standard/field.d.ts +10 -10
- package/src/parsing/standard/field.js +10 -10
- package/src/parsing/standard/position.js +12 -1
- package/src/product/barcodeReader/barcodeReaderV1.d.ts +16 -0
- package/src/product/barcodeReader/barcodeReaderV1.js +22 -0
- package/src/product/barcodeReader/barcodeReaderV1Document.d.ts +16 -0
- package/src/product/barcodeReader/barcodeReaderV1Document.js +37 -0
- package/src/product/barcodeReader/internal.d.ts +2 -0
- package/src/product/barcodeReader/internal.js +7 -0
- package/src/product/cropper/cropperV1.d.ts +4 -3
- package/src/product/cropper/cropperV1.js +4 -3
- package/src/product/cropper/cropperV1Document.d.ts +2 -6
- package/src/product/cropper/cropperV1Document.js +2 -19
- package/src/product/cropper/cropperV1Page.d.ts +12 -0
- package/src/product/cropper/cropperV1Page.js +26 -0
- package/src/product/cropper/internal.d.ts +1 -0
- package/src/product/cropper/internal.js +3 -1
- package/src/product/custom/customV1Document.d.ts +8 -1
- package/src/product/custom/customV1Document.js +9 -0
- package/src/product/custom/customV1Page.d.ts +8 -1
- package/src/product/custom/customV1Page.js +9 -0
- package/src/product/fr/carteVitale/carteVitaleV1Document.js +1 -1
- package/src/product/fr/idCard/idCardV1Document.js +1 -1
- package/src/product/fr/idCard/idCardV2.d.ts +17 -0
- package/src/product/fr/idCard/idCardV2.js +23 -0
- package/src/product/fr/idCard/idCardV2Document.d.ts +42 -0
- package/src/product/fr/idCard/idCardV2Document.js +98 -0
- package/src/product/fr/idCard/idCardV2Page.d.ts +14 -0
- package/src/product/fr/idCard/idCardV2Page.js +27 -0
- package/src/product/fr/idCard/internal.d.ts +1 -0
- package/src/product/fr/idCard/internal.js +3 -1
- package/src/product/fr/index.d.ts +1 -0
- package/src/product/fr/index.js +3 -1
- package/src/product/index.d.ts +8 -6
- package/src/product/index.js +16 -12
- package/src/product/internal.d.ts +2 -0
- package/src/product/internal.js +3 -1
- package/src/product/multiReceiptsDetector/internal.d.ts +2 -0
- package/src/product/multiReceiptsDetector/internal.js +7 -0
- package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +16 -0
- package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +22 -0
- package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +14 -0
- package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +28 -0
- package/src/product/passport/passportV1Document.js +1 -1
- package/src/product/proofOfAddress/proofOfAddressV1Document.js +2 -2
- package/src/product/us/bankCheck/bankCheckV1Page.js +1 -1
- package/src/product/us/index.d.ts +1 -0
- package/src/product/us/index.js +3 -1
- package/src/product/us/w9/internal.d.ts +3 -0
- package/src/product/us/w9/internal.js +9 -0
- package/src/product/us/w9/w9V1.d.ts +17 -0
- package/src/product/us/w9/w9V1.js +23 -0
- package/src/product/us/w9/w9V1Document.d.ts +10 -0
- package/src/product/us/w9/w9V1Document.js +15 -0
- package/src/product/us/w9/w9V1Page.d.ts +34 -0
- package/src/product/us/w9/w9V1Page.js +78 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarcodeReaderV1Document = exports.BarcodeReaderV1 = void 0;
|
|
4
|
+
var barcodeReaderV1_1 = require("./barcodeReaderV1");
|
|
5
|
+
Object.defineProperty(exports, "BarcodeReaderV1", { enumerable: true, get: function () { return barcodeReaderV1_1.BarcodeReaderV1; } });
|
|
6
|
+
var barcodeReaderV1Document_1 = require("./barcodeReaderV1Document");
|
|
7
|
+
Object.defineProperty(exports, "BarcodeReaderV1Document", { enumerable: true, get: function () { return barcodeReaderV1Document_1.BarcodeReaderV1Document; } });
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Inference,
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
2
|
import { CropperV1Document } from "./cropperV1Document";
|
|
3
|
+
import { CropperV1Page } from "./cropperV1Page";
|
|
3
4
|
/**
|
|
4
|
-
* Inference prediction for Cropper API
|
|
5
|
+
* Inference prediction for Cropper, API version 1.
|
|
5
6
|
*/
|
|
6
7
|
export declare class CropperV1 extends Inference {
|
|
7
8
|
/** The endpoint's name. */
|
|
@@ -11,6 +12,6 @@ export declare class CropperV1 extends Inference {
|
|
|
11
12
|
/** The document-level prediction. */
|
|
12
13
|
prediction: CropperV1Document;
|
|
13
14
|
/** The document's pages. */
|
|
14
|
-
pages: Page<
|
|
15
|
+
pages: Page<CropperV1Page>[];
|
|
15
16
|
constructor(rawPrediction: StringDict);
|
|
16
17
|
}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CropperV1 = void 0;
|
|
4
4
|
const common_1 = require("../../parsing/common");
|
|
5
5
|
const cropperV1Document_1 = require("./cropperV1Document");
|
|
6
|
+
const cropperV1Page_1 = require("./cropperV1Page");
|
|
6
7
|
/**
|
|
7
|
-
* Inference prediction for Cropper API
|
|
8
|
+
* Inference prediction for Cropper, API version 1.
|
|
8
9
|
*/
|
|
9
10
|
class CropperV1 extends common_1.Inference {
|
|
10
11
|
constructor(rawPrediction) {
|
|
@@ -15,8 +16,8 @@ class CropperV1 extends common_1.Inference {
|
|
|
15
16
|
this.endpointVersion = "1";
|
|
16
17
|
/** The document's pages. */
|
|
17
18
|
this.pages = [];
|
|
18
|
-
this.prediction = new cropperV1Document_1.CropperV1Document(
|
|
19
|
-
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(
|
|
19
|
+
this.prediction = new cropperV1Document_1.CropperV1Document();
|
|
20
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(cropperV1Page_1.CropperV1Page, page, page["id"], page["orientation"]));
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
exports.CropperV1 = CropperV1;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Prediction
|
|
2
|
-
import { PositionField } from "../../parsing/standard";
|
|
1
|
+
import { Prediction } from "../../parsing/common";
|
|
3
2
|
/**
|
|
4
|
-
* Document data for Cropper API
|
|
3
|
+
* Document data for Cropper, API version 1.
|
|
5
4
|
*/
|
|
6
5
|
export declare class CropperV1Document implements Prediction {
|
|
7
|
-
/** A list of cropped positions. */
|
|
8
|
-
cropping: PositionField[];
|
|
9
|
-
constructor(rawPrediction: StringDict, pageId?: number);
|
|
10
6
|
/**
|
|
11
7
|
* Default string representation.
|
|
12
8
|
*/
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CropperV1Document = void 0;
|
|
4
|
-
const summaryHelper_1 = require("../../parsing/common/summaryHelper");
|
|
5
|
-
const standard_1 = require("../../parsing/standard");
|
|
6
4
|
/**
|
|
7
|
-
* Document data for Cropper API
|
|
5
|
+
* Document data for Cropper, API version 1.
|
|
8
6
|
*/
|
|
9
7
|
class CropperV1Document {
|
|
10
|
-
constructor(rawPrediction, pageId) {
|
|
11
|
-
/** A list of cropped positions. */
|
|
12
|
-
this.cropping = [];
|
|
13
|
-
rawPrediction["cropping"] &&
|
|
14
|
-
rawPrediction["cropping"].forEach((crop) => {
|
|
15
|
-
this.cropping.push(new standard_1.PositionField({
|
|
16
|
-
prediction: crop,
|
|
17
|
-
pageId: pageId,
|
|
18
|
-
}));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
8
|
/**
|
|
22
9
|
* Default string representation.
|
|
23
10
|
*/
|
|
24
11
|
toString() {
|
|
25
|
-
|
|
26
|
-
.map((crop) => crop.toString())
|
|
27
|
-
.join("\n ");
|
|
28
|
-
const outStr = `:Cropping: ${cropping}`.trim();
|
|
29
|
-
return (0, summaryHelper_1.cleanOutString)(outStr);
|
|
12
|
+
return "";
|
|
30
13
|
}
|
|
31
14
|
}
|
|
32
15
|
exports.CropperV1Document = CropperV1Document;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { PositionField } from "../../parsing/standard";
|
|
3
|
+
import { CropperV1Document } from "./cropperV1Document";
|
|
4
|
+
/**
|
|
5
|
+
* Page data for Cropper, API version 1.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CropperV1Page extends CropperV1Document {
|
|
8
|
+
/** List of documents found in the image. */
|
|
9
|
+
cropping: PositionField[];
|
|
10
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CropperV1Page = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../parsing/standard");
|
|
6
|
+
const cropperV1Document_1 = require("./cropperV1Document");
|
|
7
|
+
/**
|
|
8
|
+
* Page data for Cropper, API version 1.
|
|
9
|
+
*/
|
|
10
|
+
class CropperV1Page extends cropperV1Document_1.CropperV1Document {
|
|
11
|
+
constructor(rawPrediction, pageId) {
|
|
12
|
+
super();
|
|
13
|
+
/** List of documents found in the image. */
|
|
14
|
+
this.cropping = [];
|
|
15
|
+
rawPrediction["cropping"].map((itemPrediction) => this.cropping.push(new standard_1.PositionField({
|
|
16
|
+
prediction: itemPrediction,
|
|
17
|
+
pageId: pageId,
|
|
18
|
+
})));
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
const cropping = this.cropping.join("\n ");
|
|
22
|
+
const outStr = `:Document Cropper: ${cropping}`.trimEnd();
|
|
23
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CropperV1Page = CropperV1Page;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CropperV1Document = exports.CropperV1 = void 0;
|
|
3
|
+
exports.CropperV1Page = exports.CropperV1Document = exports.CropperV1 = void 0;
|
|
4
4
|
var cropperV1_1 = require("./cropperV1");
|
|
5
5
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
6
6
|
var cropperV1Document_1 = require("./cropperV1Document");
|
|
7
7
|
Object.defineProperty(exports, "CropperV1Document", { enumerable: true, get: function () { return cropperV1Document_1.CropperV1Document; } });
|
|
8
|
+
var cropperV1Page_1 = require("./cropperV1Page");
|
|
9
|
+
Object.defineProperty(exports, "CropperV1Page", { enumerable: true, get: function () { return cropperV1Page_1.CropperV1Page; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StringDict, Prediction } from "../../parsing/common";
|
|
2
|
-
import { ClassificationField, ListField } from "../../parsing/custom";
|
|
2
|
+
import { ClassificationField, ListField, CustomLine } from "../../parsing/custom";
|
|
3
3
|
/**
|
|
4
4
|
* Document data for Custom builds.
|
|
5
5
|
*/
|
|
@@ -18,6 +18,13 @@ export declare class CustomV1Document implements Prediction {
|
|
|
18
18
|
* @param pageId page the field was found on.
|
|
19
19
|
*/
|
|
20
20
|
protected setField(fieldName: string, fieldValue: any, pageId?: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Order column fields into line items.
|
|
23
|
+
* @param anchorNames list of possible anchor fields.
|
|
24
|
+
* @param fieldNames list of all column fields.
|
|
25
|
+
* @param heightTolerance height tolerance to apply to lines.
|
|
26
|
+
*/
|
|
27
|
+
columnsToLineItems(anchorNames: string[], fieldNames: string[], heightTolerance?: number): CustomLine[];
|
|
21
28
|
/**
|
|
22
29
|
* Default string representation.
|
|
23
30
|
*/
|
|
@@ -40,6 +40,15 @@ class CustomV1Document {
|
|
|
40
40
|
throw new Error(`Unknown API field type for field ${fieldName} : ${fieldValue}`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Order column fields into line items.
|
|
45
|
+
* @param anchorNames list of possible anchor fields.
|
|
46
|
+
* @param fieldNames list of all column fields.
|
|
47
|
+
* @param heightTolerance height tolerance to apply to lines.
|
|
48
|
+
*/
|
|
49
|
+
columnsToLineItems(anchorNames, fieldNames, heightTolerance = 0.01) {
|
|
50
|
+
return (0, custom_1.getLineItems)(anchorNames, fieldNames, this.fields, heightTolerance);
|
|
51
|
+
}
|
|
43
52
|
/**
|
|
44
53
|
* Default string representation.
|
|
45
54
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StringDict, Prediction } from "../../parsing/common";
|
|
2
|
-
import { ListField } from "../../parsing/custom";
|
|
2
|
+
import { ListField, CustomLine } from "../../parsing/custom";
|
|
3
3
|
/**
|
|
4
4
|
* Page data for Custom builds.
|
|
5
5
|
*/
|
|
@@ -7,6 +7,13 @@ export declare class CustomV1Page implements Prediction {
|
|
|
7
7
|
/** List of page-specific fields for a Custom build. Cannot include Classification fields. */
|
|
8
8
|
fields: Map<string, ListField>;
|
|
9
9
|
constructor(rawPrediction: StringDict, pageId?: number);
|
|
10
|
+
/**
|
|
11
|
+
* Order column fields into line items.
|
|
12
|
+
* @param anchorNames list of possible anchor fields.
|
|
13
|
+
* @param fieldNames list of all column fields.
|
|
14
|
+
* @param heightTolerance height tolerance to apply to lines.
|
|
15
|
+
*/
|
|
16
|
+
columnsToLineItems(anchorNames: string[], fieldNames: string[], heightTolerance?: number): CustomLine[];
|
|
10
17
|
/**
|
|
11
18
|
* Default string representation.
|
|
12
19
|
*/
|
|
@@ -17,6 +17,15 @@ class CustomV1Page {
|
|
|
17
17
|
}));
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Order column fields into line items.
|
|
22
|
+
* @param anchorNames list of possible anchor fields.
|
|
23
|
+
* @param fieldNames list of all column fields.
|
|
24
|
+
* @param heightTolerance height tolerance to apply to lines.
|
|
25
|
+
*/
|
|
26
|
+
columnsToLineItems(anchorNames, fieldNames, heightTolerance = 0.01) {
|
|
27
|
+
return (0, custom_1.getLineItems)(anchorNames, fieldNames, this.fields, heightTolerance);
|
|
28
|
+
}
|
|
20
29
|
/**
|
|
21
30
|
* Default string representation.
|
|
22
31
|
*/
|
|
@@ -32,7 +32,7 @@ class CarteVitaleV1Document {
|
|
|
32
32
|
* Default string representation.
|
|
33
33
|
*/
|
|
34
34
|
toString() {
|
|
35
|
-
const givenNames = this.givenNames.join("\n
|
|
35
|
+
const givenNames = this.givenNames.join("\n ");
|
|
36
36
|
const outStr = `:Given Name(s): ${givenNames}
|
|
37
37
|
:Surname: ${this.surname}
|
|
38
38
|
:Social Security Number: ${this.socialSecurity}
|
|
@@ -56,7 +56,7 @@ class IdCardV1Document {
|
|
|
56
56
|
* Default string representation.
|
|
57
57
|
*/
|
|
58
58
|
toString() {
|
|
59
|
-
const givenNames = this.givenNames.join("\n
|
|
59
|
+
const givenNames = this.givenNames.join("\n ");
|
|
60
60
|
const outStr = `:Identity Number: ${this.idNumber}
|
|
61
61
|
:Given Name(s): ${givenNames}
|
|
62
62
|
:Surname: ${this.surname}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../../parsing/common";
|
|
2
|
+
import { IdCardV2Document } from "./idCardV2Document";
|
|
3
|
+
import { IdCardV2Page } from "./idCardV2Page";
|
|
4
|
+
/**
|
|
5
|
+
* Inference prediction for Carte Nationale d'Identité, API version 2.
|
|
6
|
+
*/
|
|
7
|
+
export declare class IdCardV2 extends Inference {
|
|
8
|
+
/** The endpoint's name. */
|
|
9
|
+
endpointName: string;
|
|
10
|
+
/** The endpoint's version. */
|
|
11
|
+
endpointVersion: string;
|
|
12
|
+
/** The document-level prediction. */
|
|
13
|
+
prediction: IdCardV2Document;
|
|
14
|
+
/** The document's pages. */
|
|
15
|
+
pages: Page<IdCardV2Page>[];
|
|
16
|
+
constructor(rawPrediction: StringDict);
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdCardV2 = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const idCardV2Document_1 = require("./idCardV2Document");
|
|
6
|
+
const idCardV2Page_1 = require("./idCardV2Page");
|
|
7
|
+
/**
|
|
8
|
+
* Inference prediction for Carte Nationale d'Identité, API version 2.
|
|
9
|
+
*/
|
|
10
|
+
class IdCardV2 extends common_1.Inference {
|
|
11
|
+
constructor(rawPrediction) {
|
|
12
|
+
super(rawPrediction);
|
|
13
|
+
/** The endpoint's name. */
|
|
14
|
+
this.endpointName = "idcard_fr";
|
|
15
|
+
/** The endpoint's version. */
|
|
16
|
+
this.endpointVersion = "2";
|
|
17
|
+
/** The document's pages. */
|
|
18
|
+
this.pages = [];
|
|
19
|
+
this.prediction = new idCardV2Document_1.IdCardV2Document(rawPrediction["prediction"]);
|
|
20
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(idCardV2Page_1.IdCardV2Page, page, page["id"], page["orientation"]));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.IdCardV2 = IdCardV2;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../../parsing/common";
|
|
2
|
+
import { DateField, StringField } from "../../../parsing/standard";
|
|
3
|
+
/**
|
|
4
|
+
* Document data for Carte Nationale d'Identité, API version 2.
|
|
5
|
+
*/
|
|
6
|
+
export declare class IdCardV2Document implements Prediction {
|
|
7
|
+
/** The alternate name of the card holder. */
|
|
8
|
+
alternateName: StringField;
|
|
9
|
+
/** The name of the issuing authority. */
|
|
10
|
+
authority: StringField;
|
|
11
|
+
/** The date of birth of the card holder. */
|
|
12
|
+
birthDate: DateField;
|
|
13
|
+
/** The place of birth of the card holder. */
|
|
14
|
+
birthPlace: StringField;
|
|
15
|
+
/** The card access number (CAN). */
|
|
16
|
+
cardAccessNumber: StringField;
|
|
17
|
+
/** The document number. */
|
|
18
|
+
documentNumber: StringField;
|
|
19
|
+
/** The expiry date of the identification card. */
|
|
20
|
+
expiryDate: DateField;
|
|
21
|
+
/** The gender of the card holder. */
|
|
22
|
+
gender: StringField;
|
|
23
|
+
/** The given name(s) of the card holder. */
|
|
24
|
+
givenNames: StringField[];
|
|
25
|
+
/** The date of issue of the identification card. */
|
|
26
|
+
issueDate: DateField;
|
|
27
|
+
/** The Machine Readable Zone, first line. */
|
|
28
|
+
mrz1: StringField;
|
|
29
|
+
/** The Machine Readable Zone, second line. */
|
|
30
|
+
mrz2: StringField;
|
|
31
|
+
/** The Machine Readable Zone, third line. */
|
|
32
|
+
mrz3: StringField;
|
|
33
|
+
/** The nationality of the card holder. */
|
|
34
|
+
nationality: StringField;
|
|
35
|
+
/** The surname of the card holder. */
|
|
36
|
+
surname: StringField;
|
|
37
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
38
|
+
/**
|
|
39
|
+
* Default string representation.
|
|
40
|
+
*/
|
|
41
|
+
toString(): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdCardV2Document = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../../parsing/standard");
|
|
6
|
+
/**
|
|
7
|
+
* Document data for Carte Nationale d'Identité, API version 2.
|
|
8
|
+
*/
|
|
9
|
+
class IdCardV2Document {
|
|
10
|
+
constructor(rawPrediction, pageId) {
|
|
11
|
+
/** The given name(s) of the card holder. */
|
|
12
|
+
this.givenNames = [];
|
|
13
|
+
this.alternateName = new standard_1.StringField({
|
|
14
|
+
prediction: rawPrediction["alternate_name"],
|
|
15
|
+
pageId: pageId,
|
|
16
|
+
});
|
|
17
|
+
this.authority = new standard_1.StringField({
|
|
18
|
+
prediction: rawPrediction["authority"],
|
|
19
|
+
pageId: pageId,
|
|
20
|
+
});
|
|
21
|
+
this.birthDate = new standard_1.DateField({
|
|
22
|
+
prediction: rawPrediction["birth_date"],
|
|
23
|
+
pageId: pageId,
|
|
24
|
+
});
|
|
25
|
+
this.birthPlace = new standard_1.StringField({
|
|
26
|
+
prediction: rawPrediction["birth_place"],
|
|
27
|
+
pageId: pageId,
|
|
28
|
+
});
|
|
29
|
+
this.cardAccessNumber = new standard_1.StringField({
|
|
30
|
+
prediction: rawPrediction["card_access_number"],
|
|
31
|
+
pageId: pageId,
|
|
32
|
+
});
|
|
33
|
+
this.documentNumber = new standard_1.StringField({
|
|
34
|
+
prediction: rawPrediction["document_number"],
|
|
35
|
+
pageId: pageId,
|
|
36
|
+
});
|
|
37
|
+
this.expiryDate = new standard_1.DateField({
|
|
38
|
+
prediction: rawPrediction["expiry_date"],
|
|
39
|
+
pageId: pageId,
|
|
40
|
+
});
|
|
41
|
+
this.gender = new standard_1.StringField({
|
|
42
|
+
prediction: rawPrediction["gender"],
|
|
43
|
+
pageId: pageId,
|
|
44
|
+
});
|
|
45
|
+
rawPrediction["given_names"] &&
|
|
46
|
+
rawPrediction["given_names"].map((itemPrediction) => this.givenNames.push(new standard_1.StringField({
|
|
47
|
+
prediction: itemPrediction,
|
|
48
|
+
pageId: pageId,
|
|
49
|
+
})));
|
|
50
|
+
this.issueDate = new standard_1.DateField({
|
|
51
|
+
prediction: rawPrediction["issue_date"],
|
|
52
|
+
pageId: pageId,
|
|
53
|
+
});
|
|
54
|
+
this.mrz1 = new standard_1.StringField({
|
|
55
|
+
prediction: rawPrediction["mrz1"],
|
|
56
|
+
pageId: pageId,
|
|
57
|
+
});
|
|
58
|
+
this.mrz2 = new standard_1.StringField({
|
|
59
|
+
prediction: rawPrediction["mrz2"],
|
|
60
|
+
pageId: pageId,
|
|
61
|
+
});
|
|
62
|
+
this.mrz3 = new standard_1.StringField({
|
|
63
|
+
prediction: rawPrediction["mrz3"],
|
|
64
|
+
pageId: pageId,
|
|
65
|
+
});
|
|
66
|
+
this.nationality = new standard_1.StringField({
|
|
67
|
+
prediction: rawPrediction["nationality"],
|
|
68
|
+
pageId: pageId,
|
|
69
|
+
});
|
|
70
|
+
this.surname = new standard_1.StringField({
|
|
71
|
+
prediction: rawPrediction["surname"],
|
|
72
|
+
pageId: pageId,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Default string representation.
|
|
77
|
+
*/
|
|
78
|
+
toString() {
|
|
79
|
+
const givenNames = this.givenNames.join("\n ");
|
|
80
|
+
const outStr = `:Nationality: ${this.nationality}
|
|
81
|
+
:Card Access Number: ${this.cardAccessNumber}
|
|
82
|
+
:Document Number: ${this.documentNumber}
|
|
83
|
+
:Given Name(s): ${givenNames}
|
|
84
|
+
:Surname: ${this.surname}
|
|
85
|
+
:Alternate Name: ${this.alternateName}
|
|
86
|
+
:Date of Birth: ${this.birthDate}
|
|
87
|
+
:Place of Birth: ${this.birthPlace}
|
|
88
|
+
:Gender: ${this.gender}
|
|
89
|
+
:Expiry Date: ${this.expiryDate}
|
|
90
|
+
:Mrz Line 1: ${this.mrz1}
|
|
91
|
+
:Mrz Line 2: ${this.mrz2}
|
|
92
|
+
:Mrz Line 3: ${this.mrz3}
|
|
93
|
+
:Date of Issue: ${this.issueDate}
|
|
94
|
+
:Issuing Authority: ${this.authority}`.trimEnd();
|
|
95
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.IdCardV2Document = IdCardV2Document;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StringDict } from "../../../parsing/common";
|
|
2
|
+
import { ClassificationField } from "../../../parsing/standard";
|
|
3
|
+
import { IdCardV2Document } from "./idCardV2Document";
|
|
4
|
+
/**
|
|
5
|
+
* Page data for Carte Nationale d'Identité, API version 2.
|
|
6
|
+
*/
|
|
7
|
+
export declare class IdCardV2Page extends IdCardV2Document {
|
|
8
|
+
/** The sides of the document which are visible. */
|
|
9
|
+
documentSide: ClassificationField;
|
|
10
|
+
/** The document type or format. */
|
|
11
|
+
documentType: ClassificationField;
|
|
12
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdCardV2Page = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../../parsing/standard");
|
|
6
|
+
const idCardV2Document_1 = require("./idCardV2Document");
|
|
7
|
+
/**
|
|
8
|
+
* Page data for Carte Nationale d'Identité, API version 2.
|
|
9
|
+
*/
|
|
10
|
+
class IdCardV2Page extends idCardV2Document_1.IdCardV2Document {
|
|
11
|
+
constructor(rawPrediction, pageId) {
|
|
12
|
+
super(rawPrediction, pageId);
|
|
13
|
+
this.documentSide = new standard_1.ClassificationField({
|
|
14
|
+
prediction: rawPrediction["document_side"],
|
|
15
|
+
});
|
|
16
|
+
this.documentType = new standard_1.ClassificationField({
|
|
17
|
+
prediction: rawPrediction["document_type"],
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
let outStr = `:Document Type: ${this.documentType}
|
|
22
|
+
:Document Sides: ${this.documentSide}`.trimEnd();
|
|
23
|
+
outStr += "\n" + super.toString();
|
|
24
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IdCardV2Page = IdCardV2Page;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IdCardV1Page = exports.IdCardV1Document = exports.IdCardV1 = void 0;
|
|
3
|
+
exports.IdCardV1Page = exports.IdCardV1Document = exports.IdCardV2 = exports.IdCardV1 = void 0;
|
|
4
4
|
var idCardV1_1 = require("./idCardV1");
|
|
5
5
|
Object.defineProperty(exports, "IdCardV1", { enumerable: true, get: function () { return idCardV1_1.IdCardV1; } });
|
|
6
|
+
var idCardV2_1 = require("./idCardV2");
|
|
7
|
+
Object.defineProperty(exports, "IdCardV2", { enumerable: true, get: function () { return idCardV2_1.IdCardV2; } });
|
|
6
8
|
var idCardV1Document_1 = require("./idCardV1Document");
|
|
7
9
|
Object.defineProperty(exports, "IdCardV1Document", { enumerable: true, get: function () { return idCardV1Document_1.IdCardV1Document; } });
|
|
8
10
|
var idCardV1Page_1 = require("./idCardV1Page");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { IdCardV1 } from "./idCard/idCardV1";
|
|
2
|
+
export { IdCardV2 } from "./idCard/idCardV2";
|
|
2
3
|
export { BankAccountDetailsV1 } from "./bankAccountDetails/bankAccountDetailsV1";
|
|
3
4
|
export { BankAccountDetailsV2 } from "./bankAccountDetails/bankAccountDetailsV2";
|
|
4
5
|
export { CarteVitaleV1 } from "./carteVitale/carteVitaleV1";
|
package/src/product/fr/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CarteVitaleV1 = exports.BankAccountDetailsV2 = exports.BankAccountDetailsV1 = exports.IdCardV1 = void 0;
|
|
3
|
+
exports.CarteVitaleV1 = exports.BankAccountDetailsV2 = exports.BankAccountDetailsV1 = exports.IdCardV2 = exports.IdCardV1 = void 0;
|
|
4
4
|
var idCardV1_1 = require("./idCard/idCardV1");
|
|
5
5
|
Object.defineProperty(exports, "IdCardV1", { enumerable: true, get: function () { return idCardV1_1.IdCardV1; } });
|
|
6
|
+
var idCardV2_1 = require("./idCard/idCardV2");
|
|
7
|
+
Object.defineProperty(exports, "IdCardV2", { enumerable: true, get: function () { return idCardV2_1.IdCardV2; } });
|
|
6
8
|
var bankAccountDetailsV1_1 = require("./bankAccountDetails/bankAccountDetailsV1");
|
|
7
9
|
Object.defineProperty(exports, "BankAccountDetailsV1", { enumerable: true, get: function () { return bankAccountDetailsV1_1.BankAccountDetailsV1; } });
|
|
8
10
|
var bankAccountDetailsV2_1 = require("./bankAccountDetails/bankAccountDetailsV2");
|
package/src/product/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
export { BarcodeReaderV1 } from "./barcodeReader/barcodeReaderV1";
|
|
2
|
+
export { CropperV1 } from "./cropper/cropperV1";
|
|
3
|
+
export { CustomV1 } from "./custom/customV1";
|
|
4
|
+
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
1
5
|
export { InvoiceV4 } from "./invoice/invoiceV4";
|
|
2
6
|
export { InvoiceSplitterV1 } from "./invoiceSplitter/invoiceSplitterV1";
|
|
3
|
-
export {
|
|
4
|
-
export { ReceiptV5 } from "./receipt/receiptV5";
|
|
7
|
+
export { MultiReceiptsDetectorV1 } from "./multiReceiptsDetector/multiReceiptsDetectorV1";
|
|
5
8
|
export { PassportV1 } from "./passport/passportV1";
|
|
6
|
-
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
7
|
-
export { CustomV1 } from "./custom/customV1";
|
|
8
|
-
export { CropperV1 } from "./cropper/cropperV1";
|
|
9
9
|
export { ProofOfAddressV1 } from "./proofOfAddress/proofOfAddressV1";
|
|
10
|
+
export { ReceiptV4 } from "./receipt/receiptV4";
|
|
11
|
+
export { ReceiptV5 } from "./receipt/receiptV5";
|
|
12
|
+
export * as eu from "./eu";
|
|
10
13
|
export * as fr from "./fr";
|
|
11
14
|
export * as us from "./us";
|
|
12
|
-
export * as eu from "./eu";
|
package/src/product/index.js
CHANGED
|
@@ -23,25 +23,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.eu = exports.
|
|
26
|
+
exports.us = exports.fr = exports.eu = exports.ReceiptV5 = exports.ReceiptV4 = exports.ProofOfAddressV1 = exports.PassportV1 = exports.MultiReceiptsDetectorV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.FinancialDocumentV1 = exports.CustomV1 = exports.CropperV1 = exports.BarcodeReaderV1 = void 0;
|
|
27
|
+
var barcodeReaderV1_1 = require("./barcodeReader/barcodeReaderV1");
|
|
28
|
+
Object.defineProperty(exports, "BarcodeReaderV1", { enumerable: true, get: function () { return barcodeReaderV1_1.BarcodeReaderV1; } });
|
|
29
|
+
var cropperV1_1 = require("./cropper/cropperV1");
|
|
30
|
+
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
31
|
+
var customV1_1 = require("./custom/customV1");
|
|
32
|
+
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return customV1_1.CustomV1; } });
|
|
33
|
+
var financialDocumentV1_1 = require("./financialDocument/financialDocumentV1");
|
|
34
|
+
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return financialDocumentV1_1.FinancialDocumentV1; } });
|
|
27
35
|
var invoiceV4_1 = require("./invoice/invoiceV4");
|
|
28
36
|
Object.defineProperty(exports, "InvoiceV4", { enumerable: true, get: function () { return invoiceV4_1.InvoiceV4; } });
|
|
29
37
|
var invoiceSplitterV1_1 = require("./invoiceSplitter/invoiceSplitterV1");
|
|
30
38
|
Object.defineProperty(exports, "InvoiceSplitterV1", { enumerable: true, get: function () { return invoiceSplitterV1_1.InvoiceSplitterV1; } });
|
|
31
|
-
var
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
var receiptV5_1 = require("./receipt/receiptV5");
|
|
34
|
-
Object.defineProperty(exports, "ReceiptV5", { enumerable: true, get: function () { return receiptV5_1.ReceiptV5; } });
|
|
39
|
+
var multiReceiptsDetectorV1_1 = require("./multiReceiptsDetector/multiReceiptsDetectorV1");
|
|
40
|
+
Object.defineProperty(exports, "MultiReceiptsDetectorV1", { enumerable: true, get: function () { return multiReceiptsDetectorV1_1.MultiReceiptsDetectorV1; } });
|
|
35
41
|
var passportV1_1 = require("./passport/passportV1");
|
|
36
42
|
Object.defineProperty(exports, "PassportV1", { enumerable: true, get: function () { return passportV1_1.PassportV1; } });
|
|
37
|
-
var financialDocumentV1_1 = require("./financialDocument/financialDocumentV1");
|
|
38
|
-
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return financialDocumentV1_1.FinancialDocumentV1; } });
|
|
39
|
-
var customV1_1 = require("./custom/customV1");
|
|
40
|
-
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return customV1_1.CustomV1; } });
|
|
41
|
-
var cropperV1_1 = require("./cropper/cropperV1");
|
|
42
|
-
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
43
43
|
var proofOfAddressV1_1 = require("./proofOfAddress/proofOfAddressV1");
|
|
44
44
|
Object.defineProperty(exports, "ProofOfAddressV1", { enumerable: true, get: function () { return proofOfAddressV1_1.ProofOfAddressV1; } });
|
|
45
|
+
var receiptV4_1 = require("./receipt/receiptV4");
|
|
46
|
+
Object.defineProperty(exports, "ReceiptV4", { enumerable: true, get: function () { return receiptV4_1.ReceiptV4; } });
|
|
47
|
+
var receiptV5_1 = require("./receipt/receiptV5");
|
|
48
|
+
Object.defineProperty(exports, "ReceiptV5", { enumerable: true, get: function () { return receiptV5_1.ReceiptV5; } });
|
|
49
|
+
exports.eu = __importStar(require("./eu"));
|
|
45
50
|
exports.fr = __importStar(require("./fr"));
|
|
46
51
|
exports.us = __importStar(require("./us"));
|
|
47
|
-
exports.eu = __importStar(require("./eu"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * as barcodeReader from "./barcodeReader/internal";
|
|
1
2
|
export * as cropper from "./cropper/internal";
|
|
2
3
|
export * as custom from "./custom/internal";
|
|
3
4
|
export * as eu from "./eu/internal";
|
|
@@ -5,6 +6,7 @@ export * as financialDocument from "./financialDocument/internal";
|
|
|
5
6
|
export * as fr from "./fr/internal";
|
|
6
7
|
export * as invoice from "./invoice/internal";
|
|
7
8
|
export * as invoiceSplitter from "./invoiceSplitter/internal";
|
|
9
|
+
export * as multiReceiptsDetector from "./multiReceiptsDetector/internal";
|
|
8
10
|
export * as passport from "./passport/internal";
|
|
9
11
|
export * as proofOfAddress from "./proofOfAddress/internal";
|
|
10
12
|
export * as receipt from "./receipt/internal";
|
package/src/product/internal.js
CHANGED
|
@@ -23,7 +23,8 @@ 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.receipt = exports.proofOfAddress = exports.passport = exports.invoiceSplitter = exports.invoice = exports.fr = exports.financialDocument = exports.eu = exports.custom = exports.cropper = void 0;
|
|
26
|
+
exports.us = exports.receipt = exports.proofOfAddress = exports.passport = exports.multiReceiptsDetector = exports.invoiceSplitter = exports.invoice = exports.fr = exports.financialDocument = exports.eu = exports.custom = exports.cropper = exports.barcodeReader = void 0;
|
|
27
|
+
exports.barcodeReader = __importStar(require("./barcodeReader/internal"));
|
|
27
28
|
exports.cropper = __importStar(require("./cropper/internal"));
|
|
28
29
|
exports.custom = __importStar(require("./custom/internal"));
|
|
29
30
|
exports.eu = __importStar(require("./eu/internal"));
|
|
@@ -31,6 +32,7 @@ exports.financialDocument = __importStar(require("./financialDocument/internal")
|
|
|
31
32
|
exports.fr = __importStar(require("./fr/internal"));
|
|
32
33
|
exports.invoice = __importStar(require("./invoice/internal"));
|
|
33
34
|
exports.invoiceSplitter = __importStar(require("./invoiceSplitter/internal"));
|
|
35
|
+
exports.multiReceiptsDetector = __importStar(require("./multiReceiptsDetector/internal"));
|
|
34
36
|
exports.passport = __importStar(require("./passport/internal"));
|
|
35
37
|
exports.proofOfAddress = __importStar(require("./proofOfAddress/internal"));
|
|
36
38
|
exports.receipt = __importStar(require("./receipt/internal"));
|