mindee 4.3.3 → 4.5.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 +17 -0
- package/package.json +1 -1
- package/src/client.d.ts +7 -7
- package/src/errors/MindeeError.d.ts +3 -0
- package/src/errors/MindeeError.js +8 -1
- package/src/errors/index.d.ts +1 -1
- package/src/errors/index.js +2 -1
- package/src/imageOperations/extractedImage.d.ts +8 -0
- package/src/imageOperations/extractedImage.js +2 -0
- package/src/imageOperations/extractedMultiReceiptImage.d.ts +10 -0
- package/src/imageOperations/extractedMultiReceiptImage.js +18 -0
- package/src/imageOperations/index.d.ts +2 -0
- package/src/imageOperations/index.js +7 -0
- package/src/imageOperations/internal.d.ts +3 -0
- package/src/imageOperations/internal.js +7 -0
- package/src/imageOperations/multiReceiptsExtractor.d.ts +4 -0
- package/src/imageOperations/multiReceiptsExtractor.js +66 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +2 -1
- package/src/parsing/common/document.d.ts +2 -0
- package/src/parsing/common/document.js +1 -0
- package/src/parsing/custom/listField.d.ts +3 -3
- package/src/parsing/custom/listField.js +8 -3
- package/src/parsing/standard/position.js +4 -4
- package/src/product/fr/carteGrise/carteGriseV1.d.ts +16 -0
- package/src/product/fr/carteGrise/carteGriseV1.js +22 -0
- package/src/product/fr/carteGrise/carteGriseV1Document.d.ts +94 -0
- package/src/product/fr/carteGrise/carteGriseV1Document.js +224 -0
- package/src/product/fr/carteGrise/internal.d.ts +2 -0
- package/src/product/fr/carteGrise/internal.js +7 -0
- package/src/product/fr/index.d.ts +1 -0
- package/src/product/fr/index.js +3 -1
- package/src/product/fr/internal.d.ts +1 -0
- package/src/product/fr/internal.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.5.0 - 2023-11-29
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add Multi-Receipts auto-extraction feature
|
|
6
|
+
* :art: add example file to illustrate multi-receipt image extraction feature
|
|
7
|
+
* :recycle: add new imageOperations namespace
|
|
8
|
+
* :recycle: fix loose typing issues for inputsources
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## v4.4.0 - 2023-11-17
|
|
12
|
+
### Changes
|
|
13
|
+
* :sparkles: add support for Carte Grise V1
|
|
14
|
+
* :sparkles: add page nubmer attribute to doc
|
|
15
|
+
* :arrow_up: update product tests & doc
|
|
16
|
+
### Fixes
|
|
17
|
+
* :bug: fix broken `page_id` attribute for newer custom builds
|
|
18
|
+
|
|
19
|
+
|
|
3
20
|
## v4.3.2 - 2023-11-07
|
|
4
21
|
### Changes
|
|
5
22
|
* :recycle: update invoice splitter
|
package/package.json
CHANGED
package/src/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import { Readable } from "stream";
|
|
5
|
-
import { InputSource, PageOptions } from "./input";
|
|
5
|
+
import { Base64Input, BytesInput, InputSource, PathInput, StreamInput, PageOptions, UrlInput, BufferInput } from "./input";
|
|
6
6
|
import { Endpoint } from "./http";
|
|
7
7
|
import { AsyncPredictResponse, FeedbackResponse, Inference, PredictResponse, StringDict } from "./parsing/common";
|
|
8
8
|
/**
|
|
@@ -160,34 +160,34 @@ export declare class Client {
|
|
|
160
160
|
* Load an input document from a local path.
|
|
161
161
|
* @param inputPath
|
|
162
162
|
*/
|
|
163
|
-
docFromPath(inputPath: string):
|
|
163
|
+
docFromPath(inputPath: string): PathInput;
|
|
164
164
|
/**
|
|
165
165
|
* Load an input document from a base64 encoded string.
|
|
166
166
|
* @param inputString input content, as a string.
|
|
167
167
|
* @param filename file name.
|
|
168
168
|
*/
|
|
169
|
-
docFromBase64(inputString: string, filename: string):
|
|
169
|
+
docFromBase64(inputString: string, filename: string): Base64Input;
|
|
170
170
|
/**
|
|
171
171
|
* Load an input document from a `stream.Readable` object.
|
|
172
172
|
* @param inputStream input content, as a readable stream.
|
|
173
173
|
* @param filename file name.
|
|
174
174
|
*/
|
|
175
|
-
docFromStream(inputStream: Readable, filename: string):
|
|
175
|
+
docFromStream(inputStream: Readable, filename: string): StreamInput;
|
|
176
176
|
/**
|
|
177
177
|
* Load an input document from a bytes string.
|
|
178
178
|
* @param inputBytes input content, as readable bytes.
|
|
179
179
|
* @param filename file name.
|
|
180
180
|
*/
|
|
181
|
-
docFromBytes(inputBytes: string, filename: string):
|
|
181
|
+
docFromBytes(inputBytes: string, filename: string): BytesInput;
|
|
182
182
|
/**
|
|
183
183
|
* Load an input document from a URL.
|
|
184
184
|
* @param url input url. Must be HTTPS.
|
|
185
185
|
*/
|
|
186
|
-
docFromUrl(url: string):
|
|
186
|
+
docFromUrl(url: string): UrlInput;
|
|
187
187
|
/**
|
|
188
188
|
* Load an input document from a Buffer.
|
|
189
189
|
* @param buffer input content, as a buffer.
|
|
190
190
|
* @param filename file name.
|
|
191
191
|
*/
|
|
192
|
-
docFromBuffer(buffer: Buffer, filename: string):
|
|
192
|
+
docFromBuffer(buffer: Buffer, filename: string): BufferInput;
|
|
193
193
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MindeeError = void 0;
|
|
3
|
+
exports.MindeeMimeTypeError = exports.MindeeError = void 0;
|
|
4
4
|
class MindeeError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
@@ -8,3 +8,10 @@ class MindeeError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.MindeeError = MindeeError;
|
|
11
|
+
class MindeeMimeTypeError extends MindeeError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "MindeeMimeTypeError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.MindeeMimeTypeError = MindeeMimeTypeError;
|
package/src/errors/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MindeeError } from "./MindeeError";
|
|
1
|
+
export { MindeeError, MindeeMimeTypeError } from "./MindeeError";
|
package/src/errors/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MindeeError = void 0;
|
|
3
|
+
exports.MindeeMimeTypeError = exports.MindeeError = void 0;
|
|
4
4
|
var MindeeError_1 = require("./MindeeError");
|
|
5
5
|
Object.defineProperty(exports, "MindeeError", { enumerable: true, get: function () { return MindeeError_1.MindeeError; } });
|
|
6
|
+
Object.defineProperty(exports, "MindeeMimeTypeError", { enumerable: true, get: function () { return MindeeError_1.MindeeMimeTypeError; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BufferInput } from "../input";
|
|
3
|
+
import { ExtractedImage } from "./extractedImage";
|
|
4
|
+
export declare class ExtractedMultiReceiptImage implements ExtractedImage {
|
|
5
|
+
readonly receiptId: number;
|
|
6
|
+
readonly pageId: number;
|
|
7
|
+
imageData: Buffer;
|
|
8
|
+
constructor(imageData: Uint8Array, pageId: number, receiptId: number);
|
|
9
|
+
asSource(): BufferInput;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractedMultiReceiptImage = void 0;
|
|
4
|
+
const input_1 = require("../input");
|
|
5
|
+
class ExtractedMultiReceiptImage {
|
|
6
|
+
constructor(imageData, pageId, receiptId) {
|
|
7
|
+
this.pageId = pageId;
|
|
8
|
+
this.imageData = Buffer.from(imageData);
|
|
9
|
+
this.receiptId = receiptId;
|
|
10
|
+
}
|
|
11
|
+
asSource() {
|
|
12
|
+
return new input_1.BufferInput({
|
|
13
|
+
buffer: this.imageData,
|
|
14
|
+
filename: `receipt_p${this.pageId}_${this.receiptId}.pdf`,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ExtractedMultiReceiptImage = ExtractedMultiReceiptImage;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractedMultiReceiptImage = exports.extractReceipts = void 0;
|
|
4
|
+
var multiReceiptsExtractor_1 = require("./multiReceiptsExtractor");
|
|
5
|
+
Object.defineProperty(exports, "extractReceipts", { enumerable: true, get: function () { return multiReceiptsExtractor_1.extractReceipts; } });
|
|
6
|
+
var extractedMultiReceiptImage_1 = require("./extractedMultiReceiptImage");
|
|
7
|
+
Object.defineProperty(exports, "ExtractedMultiReceiptImage", { enumerable: true, get: function () { return extractedMultiReceiptImage_1.ExtractedMultiReceiptImage; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractedMultiReceiptImage = exports.extractReceipts = void 0;
|
|
4
|
+
var multiReceiptsExtractor_1 = require("./multiReceiptsExtractor");
|
|
5
|
+
Object.defineProperty(exports, "extractReceipts", { enumerable: true, get: function () { return multiReceiptsExtractor_1.extractReceipts; } });
|
|
6
|
+
var extractedMultiReceiptImage_1 = require("./extractedMultiReceiptImage");
|
|
7
|
+
Object.defineProperty(exports, "ExtractedMultiReceiptImage", { enumerable: true, get: function () { return extractedMultiReceiptImage_1.ExtractedMultiReceiptImage; } });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MultiReceiptsDetectorV1 } from "../product";
|
|
2
|
+
import { ExtractedMultiReceiptImage } from "./extractedMultiReceiptImage";
|
|
3
|
+
import { LocalInputSource } from "../input/base";
|
|
4
|
+
export declare function extractReceipts(inputFile: LocalInputSource, inference: MultiReceiptsDetectorV1): Promise<ExtractedMultiReceiptImage[]>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractReceipts = void 0;
|
|
4
|
+
const pdf_lib_1 = require("pdf-lib");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const geometry_1 = require("../geometry");
|
|
7
|
+
const extractedMultiReceiptImage_1 = require("./extractedMultiReceiptImage");
|
|
8
|
+
async function addPage(pdfPage, boundingBox, pageId, receiptId) {
|
|
9
|
+
const { width, height } = pdfPage.getSize();
|
|
10
|
+
const receiptPdf = await pdf_lib_1.PDFDocument.create();
|
|
11
|
+
const newWidth = width * ((0, geometry_1.getMinMaxX)(boundingBox).max - (0, geometry_1.getMinMaxX)(boundingBox).min);
|
|
12
|
+
const newHeight = height * ((0, geometry_1.getMinMaxY)(boundingBox).max - (0, geometry_1.getMinMaxY)(boundingBox).min);
|
|
13
|
+
//Note: PDF-lib seems to invert y coordinates, giving us the following horror:
|
|
14
|
+
const croppedReceipt = await receiptPdf.embedPage(pdfPage, {
|
|
15
|
+
left: (0, geometry_1.getMinMaxX)(boundingBox).min * width,
|
|
16
|
+
right: (0, geometry_1.getMinMaxX)(boundingBox).max * width,
|
|
17
|
+
top: height - ((0, geometry_1.getMinMaxY)(boundingBox).min * height),
|
|
18
|
+
bottom: height - ((0, geometry_1.getMinMaxY)(boundingBox).max * height),
|
|
19
|
+
});
|
|
20
|
+
const receiptPage = receiptPdf.addPage([newWidth, newHeight]);
|
|
21
|
+
receiptPage.drawPage(croppedReceipt, {
|
|
22
|
+
width: newWidth,
|
|
23
|
+
height: newHeight,
|
|
24
|
+
});
|
|
25
|
+
const receiptBytes = await receiptPdf.save();
|
|
26
|
+
return new extractedMultiReceiptImage_1.ExtractedMultiReceiptImage(receiptBytes, pageId, receiptId);
|
|
27
|
+
}
|
|
28
|
+
async function loadPdfDoc(inputFile) {
|
|
29
|
+
let pdfDoc;
|
|
30
|
+
if (!["image/jpeg", "image/jpg", "image/png", "application/pdf"].includes(inputFile.mimeType)) {
|
|
31
|
+
throw new errors_1.MindeeMimeTypeError(`Unsupported file type "${inputFile.mimeType}" Currently supported types are .png, .jpg and .pdf`);
|
|
32
|
+
}
|
|
33
|
+
else if (inputFile.isPdf()) {
|
|
34
|
+
pdfDoc = await pdf_lib_1.PDFDocument.load(inputFile.fileObject);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
pdfDoc = await pdf_lib_1.PDFDocument.create();
|
|
38
|
+
let image;
|
|
39
|
+
if (inputFile.mimeType === "image/png") {
|
|
40
|
+
image = await pdfDoc.embedPng(inputFile.fileObject);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
image = await pdfDoc.embedJpg(inputFile.fileObject);
|
|
44
|
+
}
|
|
45
|
+
const imageDims = image.scale(1);
|
|
46
|
+
const pageImage = pdfDoc.addPage([imageDims.width, imageDims.height]);
|
|
47
|
+
pageImage.drawImage(image);
|
|
48
|
+
}
|
|
49
|
+
return pdfDoc;
|
|
50
|
+
}
|
|
51
|
+
async function extractReceipts(inputFile, inference) {
|
|
52
|
+
const images = [];
|
|
53
|
+
if (!inference.prediction.receipts) {
|
|
54
|
+
throw new errors_1.MindeeError("No possible receipts candidates found for MultiReceipts extraction.");
|
|
55
|
+
}
|
|
56
|
+
const pdfDoc = await loadPdfDoc(inputFile);
|
|
57
|
+
for (let pageId = 0; pageId < pdfDoc.getPageCount(); pageId++) {
|
|
58
|
+
const [page] = await pdfDoc.copyPages(pdfDoc, [pageId]);
|
|
59
|
+
for (let receiptId = 0; receiptId < inference.pages[pageId].prediction.receipts.length; receiptId++) {
|
|
60
|
+
const receipt = inference.pages[pageId].prediction.receipts[receiptId];
|
|
61
|
+
images.push(await addPage(page, receipt.boundingBox, pageId, receiptId));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return images;
|
|
65
|
+
}
|
|
66
|
+
exports.extractReceipts = extractReceipts;
|
package/src/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { Client, PredictOptions } from "./client";
|
|
|
3
3
|
export { AsyncPredictResponse, PredictResponse, Document, Page, } from "./parsing/common";
|
|
4
4
|
export { InputSource, PageOptionsOperation } from "./input";
|
|
5
5
|
export * as internal from "./internal";
|
|
6
|
+
export * as imageOperations from "./imageOperations";
|
package/src/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.internal = exports.PageOptionsOperation = exports.InputSource = exports.Page = exports.Document = exports.PredictResponse = exports.AsyncPredictResponse = exports.Client = exports.product = void 0;
|
|
26
|
+
exports.imageOperations = exports.internal = exports.PageOptionsOperation = exports.InputSource = exports.Page = exports.Document = exports.PredictResponse = exports.AsyncPredictResponse = exports.Client = exports.product = void 0;
|
|
27
27
|
exports.product = __importStar(require("./product"));
|
|
28
28
|
var client_1 = require("./client");
|
|
29
29
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
@@ -36,3 +36,4 @@ var input_1 = require("./input");
|
|
|
36
36
|
Object.defineProperty(exports, "InputSource", { enumerable: true, get: function () { return input_1.InputSource; } });
|
|
37
37
|
Object.defineProperty(exports, "PageOptionsOperation", { enumerable: true, get: function () { return input_1.PageOptionsOperation; } });
|
|
38
38
|
exports.internal = __importStar(require("./internal"));
|
|
39
|
+
exports.imageOperations = __importStar(require("./imageOperations"));
|
|
@@ -17,6 +17,8 @@ export declare class Document<T extends Inference> {
|
|
|
17
17
|
extras?: Extras;
|
|
18
18
|
/** Raw-text response for `allWords` parsing. */
|
|
19
19
|
ocr?: Ocr;
|
|
20
|
+
/** Page number as sent back by the API. */
|
|
21
|
+
nPages: number;
|
|
20
22
|
/**
|
|
21
23
|
*
|
|
22
24
|
* @param inferenceClass constructor signature for an inference.
|
|
@@ -19,7 +19,9 @@ export declare class ListFieldValue {
|
|
|
19
19
|
* the word in the document.
|
|
20
20
|
*/
|
|
21
21
|
polygon: Polygon;
|
|
22
|
-
|
|
22
|
+
/** The document page on which the information was found. */
|
|
23
|
+
pageId?: number;
|
|
24
|
+
constructor(prediction: StringDict, pageId?: number);
|
|
23
25
|
/**
|
|
24
26
|
* Default string representation.
|
|
25
27
|
*/
|
|
@@ -30,8 +32,6 @@ export declare class ListField {
|
|
|
30
32
|
confidence: number;
|
|
31
33
|
/** True if the field was reconstructed or computed using other fields. */
|
|
32
34
|
reconstructed: boolean;
|
|
33
|
-
/** The document page on which the information was found. */
|
|
34
|
-
pageId: number;
|
|
35
35
|
/**
|
|
36
36
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
37
37
|
*/
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ListField = exports.ListFieldValue = void 0;
|
|
4
4
|
const geometry_1 = require("../../geometry");
|
|
5
5
|
class ListFieldValue {
|
|
6
|
-
constructor(prediction) {
|
|
6
|
+
constructor(prediction, pageId) {
|
|
7
7
|
/**
|
|
8
8
|
* Contains exactly 4 relative vertices coordinates (points) of a right
|
|
9
9
|
* rectangle containing the word in the document.
|
|
@@ -20,6 +20,9 @@ class ListFieldValue {
|
|
|
20
20
|
this.polygon = prediction["polygon"];
|
|
21
21
|
this.bbox = (0, geometry_1.getBoundingBox)(prediction["polygon"]);
|
|
22
22
|
}
|
|
23
|
+
if (pageId !== undefined) {
|
|
24
|
+
this.pageId = pageId;
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Default string representation.
|
|
@@ -37,10 +40,12 @@ class ListField {
|
|
|
37
40
|
this.values = [];
|
|
38
41
|
this.confidence = prediction["confidence"];
|
|
39
42
|
this.reconstructed = reconstructed;
|
|
40
|
-
this.pageId = pageId !== undefined ? pageId : prediction["page_id"];
|
|
41
43
|
if (prediction["values"] !== undefined) {
|
|
42
44
|
prediction["values"].forEach((field) => {
|
|
43
|
-
|
|
45
|
+
if (pageId === undefined) {
|
|
46
|
+
pageId = field["page_id"];
|
|
47
|
+
}
|
|
48
|
+
this.values.push(new ListFieldValue(field, pageId));
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
}
|
|
@@ -7,10 +7,10 @@ exports.PositionField = void 0;
|
|
|
7
7
|
class PositionField {
|
|
8
8
|
constructor({ prediction = {}, pageId }) {
|
|
9
9
|
this.pageId = pageId;
|
|
10
|
-
this.boundingBox = prediction["bounding_box"];
|
|
11
|
-
this.polygon = prediction["polygon"];
|
|
12
|
-
this.quadrangle = prediction["quadrangle"];
|
|
13
|
-
this.rectangle = prediction["rectangle"];
|
|
10
|
+
this.boundingBox = "bounding_box" in prediction ? prediction["bounding_box"] : [];
|
|
11
|
+
this.polygon = "polygon" in prediction ? prediction["polygon"] : [];
|
|
12
|
+
this.quadrangle = "quadrangle" in prediction ? prediction["quadrangle"] : [];
|
|
13
|
+
this.rectangle = "rectangle" in prediction ? prediction["rectangle"] : [];
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Default string representation.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../../parsing/common";
|
|
2
|
+
import { CarteGriseV1Document } from "./carteGriseV1Document";
|
|
3
|
+
/**
|
|
4
|
+
* Inference prediction for Carte Grise, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CarteGriseV1 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: CarteGriseV1Document;
|
|
13
|
+
/** The document's pages. */
|
|
14
|
+
pages: Page<CarteGriseV1Document>[];
|
|
15
|
+
constructor(rawPrediction: StringDict);
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CarteGriseV1 = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const carteGriseV1Document_1 = require("./carteGriseV1Document");
|
|
6
|
+
/**
|
|
7
|
+
* Inference prediction for Carte Grise, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class CarteGriseV1 extends common_1.Inference {
|
|
10
|
+
constructor(rawPrediction) {
|
|
11
|
+
super(rawPrediction);
|
|
12
|
+
/** The endpoint's name. */
|
|
13
|
+
this.endpointName = "carte_grise";
|
|
14
|
+
/** The endpoint's version. */
|
|
15
|
+
this.endpointVersion = "1";
|
|
16
|
+
/** The document's pages. */
|
|
17
|
+
this.pages = [];
|
|
18
|
+
this.prediction = new carteGriseV1Document_1.CarteGriseV1Document(rawPrediction["prediction"]);
|
|
19
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(carteGriseV1Document_1.CarteGriseV1Document, page, page["id"], page["orientation"]));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.CarteGriseV1 = CarteGriseV1;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../../parsing/common";
|
|
2
|
+
import { DateField, StringField } from "../../../parsing/standard";
|
|
3
|
+
/**
|
|
4
|
+
* Document data for Carte Grise, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CarteGriseV1Document implements Prediction {
|
|
7
|
+
/** The vehicle's license plate number. */
|
|
8
|
+
a: StringField;
|
|
9
|
+
/** The vehicle's first release date. */
|
|
10
|
+
b: DateField;
|
|
11
|
+
/** The vehicle owner's full name including maiden name. */
|
|
12
|
+
c1: StringField;
|
|
13
|
+
/** The vehicle owner's address. */
|
|
14
|
+
c3: StringField;
|
|
15
|
+
/** Number of owners of the license certificate. */
|
|
16
|
+
c41: StringField;
|
|
17
|
+
/** Mentions about the ownership of the vehicle. */
|
|
18
|
+
c4A: StringField;
|
|
19
|
+
/** The vehicle's brand. */
|
|
20
|
+
d1: StringField;
|
|
21
|
+
/** The vehicle's commercial name. */
|
|
22
|
+
d3: StringField;
|
|
23
|
+
/** The Vehicle Identification Number (VIN). */
|
|
24
|
+
e: StringField;
|
|
25
|
+
/** The vehicle's maximum admissible weight. */
|
|
26
|
+
f1: StringField;
|
|
27
|
+
/** The vehicle's maximum admissible weight within the license's state. */
|
|
28
|
+
f2: StringField;
|
|
29
|
+
/** The vehicle's maximum authorized weight with coupling. */
|
|
30
|
+
f3: StringField;
|
|
31
|
+
/** The document's formula number. */
|
|
32
|
+
formulaNumber: StringField;
|
|
33
|
+
/** The vehicle's weight with coupling if tractor different than category M1. */
|
|
34
|
+
g: StringField;
|
|
35
|
+
/** The vehicle's national empty weight. */
|
|
36
|
+
g1: StringField;
|
|
37
|
+
/** The car registration date of the given certificate. */
|
|
38
|
+
i: DateField;
|
|
39
|
+
/** The vehicle's category. */
|
|
40
|
+
j: StringField;
|
|
41
|
+
/** The vehicle's national type. */
|
|
42
|
+
j1: StringField;
|
|
43
|
+
/** The vehicle's body type (CE). */
|
|
44
|
+
j2: StringField;
|
|
45
|
+
/** The vehicle's body type (National designation). */
|
|
46
|
+
j3: StringField;
|
|
47
|
+
/** Machine Readable Zone, first line. */
|
|
48
|
+
mrz1: StringField;
|
|
49
|
+
/** Machine Readable Zone, second line. */
|
|
50
|
+
mrz2: StringField;
|
|
51
|
+
/** The vehicle's owner first name. */
|
|
52
|
+
ownerFirstName: StringField;
|
|
53
|
+
/** The vehicle's owner surname. */
|
|
54
|
+
ownerSurname: StringField;
|
|
55
|
+
/** The vehicle engine's displacement (cm3). */
|
|
56
|
+
p1: StringField;
|
|
57
|
+
/** The vehicle's maximum net power (kW). */
|
|
58
|
+
p2: StringField;
|
|
59
|
+
/** The vehicle's fuel type or energy source. */
|
|
60
|
+
p3: StringField;
|
|
61
|
+
/** The vehicle's administrative power (fiscal horsepower). */
|
|
62
|
+
p6: StringField;
|
|
63
|
+
/** The vehicle's power to weight ratio. */
|
|
64
|
+
q: StringField;
|
|
65
|
+
/** The vehicle's number of seats. */
|
|
66
|
+
s1: StringField;
|
|
67
|
+
/** The vehicle's number of standing rooms (person). */
|
|
68
|
+
s2: StringField;
|
|
69
|
+
/** The vehicle's sound level (dB). */
|
|
70
|
+
u1: StringField;
|
|
71
|
+
/** The vehicle engine's rotation speed (RPM). */
|
|
72
|
+
u2: StringField;
|
|
73
|
+
/** The vehicle's CO2 emission (g/km). */
|
|
74
|
+
v7: StringField;
|
|
75
|
+
/** Next technical control date. */
|
|
76
|
+
x1: StringField;
|
|
77
|
+
/** Amount of the regional proportional tax of the registration (in euros). */
|
|
78
|
+
y1: StringField;
|
|
79
|
+
/** Amount of the additional parafiscal tax of the registration (in euros). */
|
|
80
|
+
y2: StringField;
|
|
81
|
+
/** Amount of the additional CO2 tax of the registration (in euros). */
|
|
82
|
+
y3: StringField;
|
|
83
|
+
/** Amount of the fee for managing the registration (in euros). */
|
|
84
|
+
y4: StringField;
|
|
85
|
+
/** Amount of the fee for delivery of the registration certificate in euros. */
|
|
86
|
+
y5: StringField;
|
|
87
|
+
/** Total amount of registration fee to be paid in euros. */
|
|
88
|
+
y6: StringField;
|
|
89
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
90
|
+
/**
|
|
91
|
+
* Default string representation.
|
|
92
|
+
*/
|
|
93
|
+
toString(): string;
|
|
94
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CarteGriseV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../../parsing/standard");
|
|
6
|
+
/**
|
|
7
|
+
* Document data for Carte Grise, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class CarteGriseV1Document {
|
|
10
|
+
constructor(rawPrediction, pageId) {
|
|
11
|
+
this.a = new standard_1.StringField({
|
|
12
|
+
prediction: rawPrediction["a"],
|
|
13
|
+
pageId: pageId,
|
|
14
|
+
});
|
|
15
|
+
this.b = new standard_1.DateField({
|
|
16
|
+
prediction: rawPrediction["b"],
|
|
17
|
+
pageId: pageId,
|
|
18
|
+
});
|
|
19
|
+
this.c1 = new standard_1.StringField({
|
|
20
|
+
prediction: rawPrediction["c1"],
|
|
21
|
+
pageId: pageId,
|
|
22
|
+
});
|
|
23
|
+
this.c3 = new standard_1.StringField({
|
|
24
|
+
prediction: rawPrediction["c3"],
|
|
25
|
+
pageId: pageId,
|
|
26
|
+
});
|
|
27
|
+
this.c41 = new standard_1.StringField({
|
|
28
|
+
prediction: rawPrediction["c41"],
|
|
29
|
+
pageId: pageId,
|
|
30
|
+
});
|
|
31
|
+
this.c4A = new standard_1.StringField({
|
|
32
|
+
prediction: rawPrediction["c4a"],
|
|
33
|
+
pageId: pageId,
|
|
34
|
+
});
|
|
35
|
+
this.d1 = new standard_1.StringField({
|
|
36
|
+
prediction: rawPrediction["d1"],
|
|
37
|
+
pageId: pageId,
|
|
38
|
+
});
|
|
39
|
+
this.d3 = new standard_1.StringField({
|
|
40
|
+
prediction: rawPrediction["d3"],
|
|
41
|
+
pageId: pageId,
|
|
42
|
+
});
|
|
43
|
+
this.e = new standard_1.StringField({
|
|
44
|
+
prediction: rawPrediction["e"],
|
|
45
|
+
pageId: pageId,
|
|
46
|
+
});
|
|
47
|
+
this.f1 = new standard_1.StringField({
|
|
48
|
+
prediction: rawPrediction["f1"],
|
|
49
|
+
pageId: pageId,
|
|
50
|
+
});
|
|
51
|
+
this.f2 = new standard_1.StringField({
|
|
52
|
+
prediction: rawPrediction["f2"],
|
|
53
|
+
pageId: pageId,
|
|
54
|
+
});
|
|
55
|
+
this.f3 = new standard_1.StringField({
|
|
56
|
+
prediction: rawPrediction["f3"],
|
|
57
|
+
pageId: pageId,
|
|
58
|
+
});
|
|
59
|
+
this.formulaNumber = new standard_1.StringField({
|
|
60
|
+
prediction: rawPrediction["formula_number"],
|
|
61
|
+
pageId: pageId,
|
|
62
|
+
});
|
|
63
|
+
this.g = new standard_1.StringField({
|
|
64
|
+
prediction: rawPrediction["g"],
|
|
65
|
+
pageId: pageId,
|
|
66
|
+
});
|
|
67
|
+
this.g1 = new standard_1.StringField({
|
|
68
|
+
prediction: rawPrediction["g1"],
|
|
69
|
+
pageId: pageId,
|
|
70
|
+
});
|
|
71
|
+
this.i = new standard_1.DateField({
|
|
72
|
+
prediction: rawPrediction["i"],
|
|
73
|
+
pageId: pageId,
|
|
74
|
+
});
|
|
75
|
+
this.j = new standard_1.StringField({
|
|
76
|
+
prediction: rawPrediction["j"],
|
|
77
|
+
pageId: pageId,
|
|
78
|
+
});
|
|
79
|
+
this.j1 = new standard_1.StringField({
|
|
80
|
+
prediction: rawPrediction["j1"],
|
|
81
|
+
pageId: pageId,
|
|
82
|
+
});
|
|
83
|
+
this.j2 = new standard_1.StringField({
|
|
84
|
+
prediction: rawPrediction["j2"],
|
|
85
|
+
pageId: pageId,
|
|
86
|
+
});
|
|
87
|
+
this.j3 = new standard_1.StringField({
|
|
88
|
+
prediction: rawPrediction["j3"],
|
|
89
|
+
pageId: pageId,
|
|
90
|
+
});
|
|
91
|
+
this.mrz1 = new standard_1.StringField({
|
|
92
|
+
prediction: rawPrediction["mrz1"],
|
|
93
|
+
pageId: pageId,
|
|
94
|
+
});
|
|
95
|
+
this.mrz2 = new standard_1.StringField({
|
|
96
|
+
prediction: rawPrediction["mrz2"],
|
|
97
|
+
pageId: pageId,
|
|
98
|
+
});
|
|
99
|
+
this.ownerFirstName = new standard_1.StringField({
|
|
100
|
+
prediction: rawPrediction["owner_first_name"],
|
|
101
|
+
pageId: pageId,
|
|
102
|
+
});
|
|
103
|
+
this.ownerSurname = new standard_1.StringField({
|
|
104
|
+
prediction: rawPrediction["owner_surname"],
|
|
105
|
+
pageId: pageId,
|
|
106
|
+
});
|
|
107
|
+
this.p1 = new standard_1.StringField({
|
|
108
|
+
prediction: rawPrediction["p1"],
|
|
109
|
+
pageId: pageId,
|
|
110
|
+
});
|
|
111
|
+
this.p2 = new standard_1.StringField({
|
|
112
|
+
prediction: rawPrediction["p2"],
|
|
113
|
+
pageId: pageId,
|
|
114
|
+
});
|
|
115
|
+
this.p3 = new standard_1.StringField({
|
|
116
|
+
prediction: rawPrediction["p3"],
|
|
117
|
+
pageId: pageId,
|
|
118
|
+
});
|
|
119
|
+
this.p6 = new standard_1.StringField({
|
|
120
|
+
prediction: rawPrediction["p6"],
|
|
121
|
+
pageId: pageId,
|
|
122
|
+
});
|
|
123
|
+
this.q = new standard_1.StringField({
|
|
124
|
+
prediction: rawPrediction["q"],
|
|
125
|
+
pageId: pageId,
|
|
126
|
+
});
|
|
127
|
+
this.s1 = new standard_1.StringField({
|
|
128
|
+
prediction: rawPrediction["s1"],
|
|
129
|
+
pageId: pageId,
|
|
130
|
+
});
|
|
131
|
+
this.s2 = new standard_1.StringField({
|
|
132
|
+
prediction: rawPrediction["s2"],
|
|
133
|
+
pageId: pageId,
|
|
134
|
+
});
|
|
135
|
+
this.u1 = new standard_1.StringField({
|
|
136
|
+
prediction: rawPrediction["u1"],
|
|
137
|
+
pageId: pageId,
|
|
138
|
+
});
|
|
139
|
+
this.u2 = new standard_1.StringField({
|
|
140
|
+
prediction: rawPrediction["u2"],
|
|
141
|
+
pageId: pageId,
|
|
142
|
+
});
|
|
143
|
+
this.v7 = new standard_1.StringField({
|
|
144
|
+
prediction: rawPrediction["v7"],
|
|
145
|
+
pageId: pageId,
|
|
146
|
+
});
|
|
147
|
+
this.x1 = new standard_1.StringField({
|
|
148
|
+
prediction: rawPrediction["x1"],
|
|
149
|
+
pageId: pageId,
|
|
150
|
+
});
|
|
151
|
+
this.y1 = new standard_1.StringField({
|
|
152
|
+
prediction: rawPrediction["y1"],
|
|
153
|
+
pageId: pageId,
|
|
154
|
+
});
|
|
155
|
+
this.y2 = new standard_1.StringField({
|
|
156
|
+
prediction: rawPrediction["y2"],
|
|
157
|
+
pageId: pageId,
|
|
158
|
+
});
|
|
159
|
+
this.y3 = new standard_1.StringField({
|
|
160
|
+
prediction: rawPrediction["y3"],
|
|
161
|
+
pageId: pageId,
|
|
162
|
+
});
|
|
163
|
+
this.y4 = new standard_1.StringField({
|
|
164
|
+
prediction: rawPrediction["y4"],
|
|
165
|
+
pageId: pageId,
|
|
166
|
+
});
|
|
167
|
+
this.y5 = new standard_1.StringField({
|
|
168
|
+
prediction: rawPrediction["y5"],
|
|
169
|
+
pageId: pageId,
|
|
170
|
+
});
|
|
171
|
+
this.y6 = new standard_1.StringField({
|
|
172
|
+
prediction: rawPrediction["y6"],
|
|
173
|
+
pageId: pageId,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Default string representation.
|
|
178
|
+
*/
|
|
179
|
+
toString() {
|
|
180
|
+
const outStr = `:a: ${this.a}
|
|
181
|
+
:b: ${this.b}
|
|
182
|
+
:c1: ${this.c1}
|
|
183
|
+
:c3: ${this.c3}
|
|
184
|
+
:c41: ${this.c41}
|
|
185
|
+
:c4a: ${this.c4A}
|
|
186
|
+
:d1: ${this.d1}
|
|
187
|
+
:d3: ${this.d3}
|
|
188
|
+
:e: ${this.e}
|
|
189
|
+
:f1: ${this.f1}
|
|
190
|
+
:f2: ${this.f2}
|
|
191
|
+
:f3: ${this.f3}
|
|
192
|
+
:g: ${this.g}
|
|
193
|
+
:g1: ${this.g1}
|
|
194
|
+
:i: ${this.i}
|
|
195
|
+
:j: ${this.j}
|
|
196
|
+
:j1: ${this.j1}
|
|
197
|
+
:j2: ${this.j2}
|
|
198
|
+
:j3: ${this.j3}
|
|
199
|
+
:p1: ${this.p1}
|
|
200
|
+
:p2: ${this.p2}
|
|
201
|
+
:p3: ${this.p3}
|
|
202
|
+
:p6: ${this.p6}
|
|
203
|
+
:q: ${this.q}
|
|
204
|
+
:s1: ${this.s1}
|
|
205
|
+
:s2: ${this.s2}
|
|
206
|
+
:u1: ${this.u1}
|
|
207
|
+
:u2: ${this.u2}
|
|
208
|
+
:v7: ${this.v7}
|
|
209
|
+
:x1: ${this.x1}
|
|
210
|
+
:y1: ${this.y1}
|
|
211
|
+
:y2: ${this.y2}
|
|
212
|
+
:y3: ${this.y3}
|
|
213
|
+
:y4: ${this.y4}
|
|
214
|
+
:y5: ${this.y5}
|
|
215
|
+
:y6: ${this.y6}
|
|
216
|
+
:Formula Number: ${this.formulaNumber}
|
|
217
|
+
:Owner's First Name: ${this.ownerFirstName}
|
|
218
|
+
:Owner's Surname: ${this.ownerSurname}
|
|
219
|
+
:MRZ Line 1: ${this.mrz1}
|
|
220
|
+
:MRZ Line 2: ${this.mrz2}`.trimEnd();
|
|
221
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.CarteGriseV1Document = CarteGriseV1Document;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CarteGriseV1Document = exports.CarteGriseV1 = void 0;
|
|
4
|
+
var carteGriseV1_1 = require("./carteGriseV1");
|
|
5
|
+
Object.defineProperty(exports, "CarteGriseV1", { enumerable: true, get: function () { return carteGriseV1_1.CarteGriseV1; } });
|
|
6
|
+
var carteGriseV1Document_1 = require("./carteGriseV1Document");
|
|
7
|
+
Object.defineProperty(exports, "CarteGriseV1Document", { enumerable: true, get: function () { return carteGriseV1Document_1.CarteGriseV1Document; } });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { IdCardV1 } from "./idCard/idCardV1";
|
|
2
2
|
export { IdCardV2 } from "./idCard/idCardV2";
|
|
3
|
+
export { CarteGriseV1 } from "./carteGrise/carteGriseV1";
|
|
3
4
|
export { BankAccountDetailsV1 } from "./bankAccountDetails/bankAccountDetailsV1";
|
|
4
5
|
export { BankAccountDetailsV2 } from "./bankAccountDetails/bankAccountDetailsV2";
|
|
5
6
|
export { CarteVitaleV1 } from "./carteVitale/carteVitaleV1";
|
package/src/product/fr/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CarteVitaleV1 = exports.BankAccountDetailsV2 = exports.BankAccountDetailsV1 = exports.IdCardV2 = exports.IdCardV1 = void 0;
|
|
3
|
+
exports.CarteVitaleV1 = exports.BankAccountDetailsV2 = exports.BankAccountDetailsV1 = exports.CarteGriseV1 = 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
6
|
var idCardV2_1 = require("./idCard/idCardV2");
|
|
7
7
|
Object.defineProperty(exports, "IdCardV2", { enumerable: true, get: function () { return idCardV2_1.IdCardV2; } });
|
|
8
|
+
var carteGriseV1_1 = require("./carteGrise/carteGriseV1");
|
|
9
|
+
Object.defineProperty(exports, "CarteGriseV1", { enumerable: true, get: function () { return carteGriseV1_1.CarteGriseV1; } });
|
|
8
10
|
var bankAccountDetailsV1_1 = require("./bankAccountDetails/bankAccountDetailsV1");
|
|
9
11
|
Object.defineProperty(exports, "BankAccountDetailsV1", { enumerable: true, get: function () { return bankAccountDetailsV1_1.BankAccountDetailsV1; } });
|
|
10
12
|
var bankAccountDetailsV2_1 = require("./bankAccountDetails/bankAccountDetailsV2");
|
|
@@ -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.idCard = exports.carteVitale = exports.bankAccountDetails = void 0;
|
|
26
|
+
exports.carteGrise = exports.idCard = exports.carteVitale = exports.bankAccountDetails = void 0;
|
|
27
27
|
exports.bankAccountDetails = __importStar(require("./bankAccountDetails/internal"));
|
|
28
28
|
exports.carteVitale = __importStar(require("./carteVitale/internal"));
|
|
29
29
|
exports.idCard = __importStar(require("./idCard/internal"));
|
|
30
|
+
exports.carteGrise = __importStar(require("./carteGrise/internal"));
|