mindee 4.1.1 → 4.2.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 +14 -0
- package/README.md +4 -1
- package/package.json +1 -1
- package/src/client.js +2 -8
- 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/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/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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.2.0 - 2023-09-15
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add support for W9 V1
|
|
6
|
+
* :sparkles: add support for Barcode Reader V11
|
|
7
|
+
* :sparkles: add support for Multi Receipt Detector V1
|
|
8
|
+
* :sparkles: add support for FR Id Card V2
|
|
9
|
+
* :sparkles: add support for OTS Cropper V1
|
|
10
|
+
* :memo: update documentation
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
* :bug: fix missing position field display issues
|
|
14
|
+
* :bug: fix issues with asynchronous timeouts crashing in some instances
|
|
15
|
+
|
|
16
|
+
|
|
3
17
|
## v4.1.1 - 2023-09-04
|
|
4
18
|
### Changes
|
|
5
19
|
* :recycle: tweaked timer management in async
|
package/README.md
CHANGED
|
@@ -155,9 +155,12 @@ Complete details on the working of the library are available in the following gu
|
|
|
155
155
|
* [Node.js FR Carte Vitale OCR](https://developers.mindee.com/docs/nodejs-fr-carte-vitale-ocr)
|
|
156
156
|
* [Node.js FR ID Card OCR](https://developers.mindee.com/docs/nodejs-fr-id-card-ocr)
|
|
157
157
|
* [Node.js US Bank Check OCR](https://developers.mindee.com/docs/nodejs-us-bank-checks-ocr)
|
|
158
|
-
* [Node.js US
|
|
158
|
+
* [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
|
|
159
|
+
* [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
|
|
160
|
+
* [Node.js Barcode Reader API](https://developers.mindee.com/docs/nodejs-barcode-reader-api)
|
|
159
161
|
* [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-api)
|
|
160
162
|
* [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-api)
|
|
163
|
+
* [Node.js Multi Receipts Detector API](https://developers.mindee.com/docs/nodejs-multi-receipts-detector-api)
|
|
161
164
|
|
|
162
165
|
You can also take a look at the **[Reference Documentation](https://mindee.github.io/mindee-api-nodejs/)**.
|
|
163
166
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -122,14 +122,8 @@ class Client {
|
|
|
122
122
|
initialDelaySec: 6,
|
|
123
123
|
delaySec: 3,
|
|
124
124
|
maxRetries: 10,
|
|
125
|
-
initialTimerOptions:
|
|
126
|
-
|
|
127
|
-
signal: undefined,
|
|
128
|
-
},
|
|
129
|
-
recurringTimerOptions: {
|
|
130
|
-
ref: false,
|
|
131
|
-
signal: undefined,
|
|
132
|
-
},
|
|
125
|
+
initialTimerOptions: undefined,
|
|
126
|
+
recurringTimerOptions: undefined,
|
|
133
127
|
}) {
|
|
134
128
|
__classPrivateFieldGet(this, _Client_instances, "m", _Client_validateAsyncParams).call(this, asyncParams);
|
|
135
129
|
const enqueueResponse = await this.enqueue(productClass, inputSource, asyncParams);
|
package/src/http/error.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare class MindeeHttp413Error extends MindeeHttpError {
|
|
|
46
46
|
constructor(httpError: StringDict, url: string, code?: number);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Usually
|
|
49
|
+
* Usually corresponds to TooManyRequests errors.
|
|
50
50
|
* Arises whenever too many calls to the API are made in quick succession.
|
|
51
51
|
*/
|
|
52
52
|
export declare class MindeeHttp429Error extends MindeeHttpError {
|
package/src/http/error.js
CHANGED
|
@@ -168,7 +168,7 @@ class MindeeHttp413Error extends MindeeHttpError {
|
|
|
168
168
|
}
|
|
169
169
|
exports.MindeeHttp413Error = MindeeHttp413Error;
|
|
170
170
|
/**
|
|
171
|
-
* Usually
|
|
171
|
+
* Usually corresponds to TooManyRequests errors.
|
|
172
172
|
* Arises whenever too many calls to the API are made in quick succession.
|
|
173
173
|
*/
|
|
174
174
|
class MindeeHttp429Error extends MindeeHttpError {
|
|
@@ -195,7 +195,7 @@ exports.MindeeHttp500Error = MindeeHttp500Error;
|
|
|
195
195
|
class MindeeHttp504Error extends MindeeHttpError {
|
|
196
196
|
constructor(httpError, url, code) {
|
|
197
197
|
super(httpError, url, code);
|
|
198
|
-
this.name = "
|
|
198
|
+
this.name = "MindeeHttp504Error";
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
exports.MindeeHttp504Error = MindeeHttp504Error;
|
|
@@ -16,8 +16,8 @@ export declare class BaseField {
|
|
|
16
16
|
pageId?: number;
|
|
17
17
|
/**
|
|
18
18
|
* @param {Object} prediction - Prediction object from HTTP response
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
19
|
+
* @param valueKey - Key to use in the prediction dict
|
|
20
|
+
* @param reconstructed - Is the object reconstructed (not extracted by the API)
|
|
21
21
|
*/
|
|
22
22
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
23
23
|
compare(other: BaseField): boolean;
|
|
@@ -7,8 +7,8 @@ exports.BaseField = void 0;
|
|
|
7
7
|
class BaseField {
|
|
8
8
|
/**
|
|
9
9
|
* @param {Object} prediction - Prediction object from HTTP response
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
10
|
+
* @param valueKey - Key to use in the prediction dict
|
|
11
|
+
* @param reconstructed - Is the object reconstructed (not extracted by the API)
|
|
12
12
|
*/
|
|
13
13
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId = undefined, }) {
|
|
14
14
|
/** The value. */
|
|
@@ -24,23 +24,23 @@ export declare class Field extends BaseField {
|
|
|
24
24
|
/** The confidence score of the prediction. */
|
|
25
25
|
confidence: number;
|
|
26
26
|
/**
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
27
|
+
* @param prediction - Prediction object from HTTP response
|
|
28
|
+
* @param valueKey - Key to use in the prediction dict
|
|
29
|
+
* @param reconstructed - Does the object is reconstructed (not extracted by the API)
|
|
30
|
+
* @param pageId - Page ID for multi-page document
|
|
31
|
+
* @param extraFields - Extra fields to get from the prediction and to set as attribute of the Field
|
|
32
32
|
*/
|
|
33
33
|
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
34
34
|
/**
|
|
35
|
-
@param
|
|
36
|
-
@param
|
|
37
|
-
@param
|
|
38
|
-
@returns
|
|
35
|
+
@param array1 first Array of Fields
|
|
36
|
+
@param array2 second Array of Fields
|
|
37
|
+
@param attr Attribute to compare
|
|
38
|
+
@returns true if all elements in array1 exist in array2 and vice-versa, false otherwise
|
|
39
39
|
*/
|
|
40
40
|
static compareArrays(array1: Field[], array2: Field[], attr?: string): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* @param {Field[]} array - Array of Fields
|
|
43
|
-
* @returns {Number} product of all the fields
|
|
43
|
+
* @returns {Number} product of all the fields probability
|
|
44
44
|
*/
|
|
45
45
|
static arrayConfidence(array: Field[]): number;
|
|
46
46
|
}
|
|
@@ -8,11 +8,11 @@ const geometry_1 = require("../../geometry");
|
|
|
8
8
|
*/
|
|
9
9
|
class Field extends base_1.BaseField {
|
|
10
10
|
/**
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
11
|
+
* @param prediction - Prediction object from HTTP response
|
|
12
|
+
* @param valueKey - Key to use in the prediction dict
|
|
13
|
+
* @param reconstructed - Does the object is reconstructed (not extracted by the API)
|
|
14
|
+
* @param pageId - Page ID for multi-page document
|
|
15
|
+
* @param extraFields - Extra fields to get from the prediction and to set as attribute of the Field
|
|
16
16
|
*/
|
|
17
17
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId, }) {
|
|
18
18
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
@@ -28,10 +28,10 @@ class Field extends base_1.BaseField {
|
|
|
28
28
|
this.boundingBox = (0, geometry_1.getBoundingBox)(this.polygon);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
@param
|
|
32
|
-
@param
|
|
33
|
-
@param
|
|
34
|
-
@returns
|
|
31
|
+
@param array1 first Array of Fields
|
|
32
|
+
@param array2 second Array of Fields
|
|
33
|
+
@param attr Attribute to compare
|
|
34
|
+
@returns true if all elements in array1 exist in array2 and vice-versa, false otherwise
|
|
35
35
|
*/
|
|
36
36
|
static compareArrays(array1, array2, attr = "value") {
|
|
37
37
|
const list1 = array1.map((item) => item[attr]);
|
|
@@ -46,7 +46,7 @@ class Field extends base_1.BaseField {
|
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* @param {Field[]} array - Array of Fields
|
|
49
|
-
* @returns {Number} product of all the fields
|
|
49
|
+
* @returns {Number} product of all the fields probability
|
|
50
50
|
*/
|
|
51
51
|
static arrayConfidence(array) {
|
|
52
52
|
let total = 1.0;
|
|
@@ -16,7 +16,18 @@ class PositionField {
|
|
|
16
16
|
* Default string representation.
|
|
17
17
|
*/
|
|
18
18
|
toString() {
|
|
19
|
-
|
|
19
|
+
if (this.polygon && this.polygon.length > 0)
|
|
20
|
+
return `Polygon with ${this.polygon.length} points.`;
|
|
21
|
+
if (this.boundingBox && this.boundingBox.length > 0) {
|
|
22
|
+
return `Polygon with ${this.boundingBox.length} points.`;
|
|
23
|
+
}
|
|
24
|
+
if (this.rectangle && this.rectangle.length > 0) {
|
|
25
|
+
return `Polygon with ${this.rectangle.length} points.`;
|
|
26
|
+
}
|
|
27
|
+
if (this.quadrangle && this.quadrangle.length > 0) {
|
|
28
|
+
return `Polygon with ${this.quadrangle.length} points.`;
|
|
29
|
+
}
|
|
30
|
+
return "";
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
exports.PositionField = PositionField;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { BarcodeReaderV1Document } from "./barcodeReaderV1Document";
|
|
3
|
+
/**
|
|
4
|
+
* Inference prediction for Barcode Reader, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BarcodeReaderV1 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: BarcodeReaderV1Document;
|
|
13
|
+
/** The document's pages. */
|
|
14
|
+
pages: Page<BarcodeReaderV1Document>[];
|
|
15
|
+
constructor(rawPrediction: StringDict);
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarcodeReaderV1 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const barcodeReaderV1Document_1 = require("./barcodeReaderV1Document");
|
|
6
|
+
/**
|
|
7
|
+
* Inference prediction for Barcode Reader, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class BarcodeReaderV1 extends common_1.Inference {
|
|
10
|
+
constructor(rawPrediction) {
|
|
11
|
+
super(rawPrediction);
|
|
12
|
+
/** The endpoint's name. */
|
|
13
|
+
this.endpointName = "barcode_reader";
|
|
14
|
+
/** The endpoint's version. */
|
|
15
|
+
this.endpointVersion = "1";
|
|
16
|
+
/** The document's pages. */
|
|
17
|
+
this.pages = [];
|
|
18
|
+
this.prediction = new barcodeReaderV1Document_1.BarcodeReaderV1Document(rawPrediction["prediction"]);
|
|
19
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(barcodeReaderV1Document_1.BarcodeReaderV1Document, page, page["id"], page["orientation"]));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BarcodeReaderV1 = BarcodeReaderV1;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
+
import { StringField } from "../../parsing/standard";
|
|
3
|
+
/**
|
|
4
|
+
* Document data for Barcode Reader, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BarcodeReaderV1Document implements Prediction {
|
|
7
|
+
/** List of decoded 1D barcodes. */
|
|
8
|
+
codes1D: StringField[];
|
|
9
|
+
/** List of decoded 2D barcodes. */
|
|
10
|
+
codes2D: StringField[];
|
|
11
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
12
|
+
/**
|
|
13
|
+
* Default string representation.
|
|
14
|
+
*/
|
|
15
|
+
toString(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarcodeReaderV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../parsing/standard");
|
|
6
|
+
/**
|
|
7
|
+
* Document data for Barcode Reader, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class BarcodeReaderV1Document {
|
|
10
|
+
constructor(rawPrediction, pageId) {
|
|
11
|
+
/** List of decoded 1D barcodes. */
|
|
12
|
+
this.codes1D = [];
|
|
13
|
+
/** List of decoded 2D barcodes. */
|
|
14
|
+
this.codes2D = [];
|
|
15
|
+
rawPrediction["codes_1d"] &&
|
|
16
|
+
rawPrediction["codes_1d"].map((itemPrediction) => this.codes1D.push(new standard_1.StringField({
|
|
17
|
+
prediction: itemPrediction,
|
|
18
|
+
pageId: pageId,
|
|
19
|
+
})));
|
|
20
|
+
rawPrediction["codes_2d"] &&
|
|
21
|
+
rawPrediction["codes_2d"].map((itemPrediction) => this.codes2D.push(new standard_1.StringField({
|
|
22
|
+
prediction: itemPrediction,
|
|
23
|
+
pageId: pageId,
|
|
24
|
+
})));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Default string representation.
|
|
28
|
+
*/
|
|
29
|
+
toString() {
|
|
30
|
+
const codes1D = this.codes1D.join("\n ");
|
|
31
|
+
const codes2D = this.codes2D.join("\n ");
|
|
32
|
+
const outStr = `:Barcodes 1D: ${codes1D}
|
|
33
|
+
:Barcodes 2D: ${codes2D}`.trimEnd();
|
|
34
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BarcodeReaderV1Document = BarcodeReaderV1Document;
|
|
@@ -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; } });
|
|
@@ -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
|
+
}
|