mindee 3.1.1 → 3.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 +10 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +69 -52
- package/src/client.d.ts +41 -5
- package/src/client.js +17 -4
- package/src/documents/cropper/cropperV1.d.ts +2 -2
- package/src/documents/cropper/cropperV1.js +1 -1
- package/src/documents/document.d.ts +2 -2
- package/src/documents/document.js +1 -1
- package/src/documents/eu/index.d.ts +1 -0
- package/src/documents/eu/index.js +5 -0
- package/src/documents/eu/licensePlate/licensePlateV1.d.ts +8 -0
- package/src/documents/eu/licensePlate/licensePlateV1.js +29 -0
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +12 -0
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +37 -0
- package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +14 -0
- package/src/documents/fr/carteVitale/carteVitaleV1.js +44 -0
- package/src/documents/fr/idCard/idCardV1.d.ts +11 -0
- package/src/documents/fr/idCard/idCardV1.js +1 -0
- package/src/documents/fr/index.d.ts +2 -0
- package/src/documents/fr/index.js +5 -1
- package/src/documents/index.d.ts +2 -0
- package/src/documents/index.js +4 -1
- package/src/documents/invoice/invoiceV3.d.ts +17 -0
- package/src/documents/invoice/invoiceV3.js +4 -0
- package/src/documents/passport/passportV1.d.ts +13 -0
- package/src/documents/passport/passportV1.js +1 -0
- package/src/documents/receipt/receiptV3.d.ts +9 -1
- package/src/documents/receipt/receiptV3.js +1 -0
- package/src/documents/shipping_container/shippingContainerV1.d.ts +12 -0
- package/src/documents/shipping_container/shippingContainerV1.js +37 -0
- package/src/documents/us/bankCheck/bankCheckV1.d.ts +20 -1
- package/src/documents/us/bankCheck/bankCheckV1.js +57 -0
- package/src/fields/amount.d.ts +1 -0
- package/src/fields/apiBuilder.d.ts +1 -0
- package/src/fields/companyRegistration.d.ts +1 -1
- package/src/fields/field.d.ts +1 -0
- package/src/fields/field.js +1 -0
- package/src/fields/index.d.ts +1 -1
- package/src/fields/index.js +3 -3
- package/src/fields/locale.d.ts +3 -0
- package/src/fields/paymentDetails.d.ts +4 -0
- package/src/fields/{cropper.d.ts → position.d.ts} +8 -3
- package/src/fields/{cropper.js → position.js} +4 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v3.2.0 - 2022-11-14
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: Add support for shipping container API V1
|
|
6
|
+
* :sparkles: Add support for EU license plate V1
|
|
7
|
+
* :bug: Fix page removal in CLI
|
|
8
|
+
* :sparkles: Add support for Carte Vitale V1
|
|
9
|
+
* :sparkles: Add support for FR Bank Account Details V1
|
|
10
|
+
* :memo: Export and add comments for method parameters.
|
|
11
|
+
* :sparkles: Add support for US Bank Check V1
|
|
12
|
+
|
|
3
13
|
## v3.1.1 - 2022-11-08
|
|
4
14
|
### Changes
|
|
5
15
|
* :bug: fix proper import and documentation of region-specific documents
|
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ const apiResponse = mindeeClient
|
|
|
67
67
|
### Handling the Return
|
|
68
68
|
```js
|
|
69
69
|
// Print a brief summary of the parsed data
|
|
70
|
-
|
|
70
|
+
apiResponse.then((resp) => {
|
|
71
71
|
|
|
72
72
|
// The document property can be undefined:
|
|
73
73
|
// * TypeScript will throw an error without this guard clause
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -3,62 +3,99 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cli = void 0;
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
5
|
const documents_1 = require("./documents");
|
|
6
|
-
const fr_1 = require("./documents/fr");
|
|
7
6
|
const api_1 = require("./api");
|
|
8
7
|
const client_1 = require("./client");
|
|
8
|
+
const inputs_1 = require("./inputs");
|
|
9
9
|
const program = new commander_1.Command();
|
|
10
|
-
const COMMAND_INVOICE = "invoice";
|
|
11
|
-
const COMMAND_RECEIPT = "receipt";
|
|
12
|
-
const COMMAND_PASSPORT = "passport";
|
|
13
|
-
const COMMAND_FINANCIAL = "financial";
|
|
14
|
-
const COMMAND_FR_ID_CARD = "fr-id-card";
|
|
15
10
|
const COMMAND_CUSTOM = "custom";
|
|
11
|
+
// The Map's key is the command name as it will appear on the console.
|
|
12
|
+
//
|
|
16
13
|
const CLI_COMMAND_CONFIG = new Map([
|
|
17
14
|
[
|
|
18
|
-
|
|
15
|
+
COMMAND_CUSTOM,
|
|
16
|
+
{
|
|
17
|
+
description: "A custom document",
|
|
18
|
+
docClass: documents_1.CustomV1,
|
|
19
|
+
fullText: false,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"invoice",
|
|
19
24
|
{
|
|
20
25
|
description: "Invoice V3",
|
|
21
|
-
|
|
26
|
+
docClass: documents_1.InvoiceV3,
|
|
22
27
|
fullText: true,
|
|
23
28
|
},
|
|
24
29
|
],
|
|
25
30
|
[
|
|
26
|
-
|
|
31
|
+
"receipt",
|
|
27
32
|
{
|
|
28
33
|
description: "Expense Receipt V4",
|
|
29
|
-
|
|
34
|
+
docClass: documents_1.ReceiptV4,
|
|
30
35
|
fullText: true,
|
|
31
36
|
},
|
|
32
37
|
],
|
|
33
38
|
[
|
|
34
|
-
|
|
39
|
+
"passport",
|
|
35
40
|
{
|
|
36
41
|
description: "Passport V1",
|
|
37
|
-
|
|
42
|
+
docClass: documents_1.PassportV1,
|
|
38
43
|
fullText: false,
|
|
39
44
|
},
|
|
40
45
|
],
|
|
41
46
|
[
|
|
42
|
-
|
|
47
|
+
"financial",
|
|
43
48
|
{
|
|
44
49
|
description: "Financial Document V1 (receipt or invoice)",
|
|
45
|
-
|
|
50
|
+
docClass: documents_1.FinancialDocumentV1,
|
|
46
51
|
fullText: true,
|
|
47
52
|
},
|
|
48
53
|
],
|
|
49
54
|
[
|
|
50
|
-
|
|
55
|
+
"fr-id-card",
|
|
51
56
|
{
|
|
52
57
|
description: "FR ID Card V1",
|
|
53
|
-
|
|
58
|
+
docClass: documents_1.fr.IdCardV1,
|
|
54
59
|
fullText: false,
|
|
55
60
|
},
|
|
56
61
|
],
|
|
57
62
|
[
|
|
58
|
-
|
|
63
|
+
"fr-bank-account-details",
|
|
59
64
|
{
|
|
60
|
-
description: "
|
|
61
|
-
|
|
65
|
+
description: "FR Bank Account Details V1",
|
|
66
|
+
docClass: documents_1.fr.BankAccountDetailsV1,
|
|
67
|
+
fullText: false,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"fr-carte-vitale",
|
|
72
|
+
{
|
|
73
|
+
description: "FR Carte Vitale V1",
|
|
74
|
+
docClass: documents_1.fr.CarteVitaleV1,
|
|
75
|
+
fullText: false,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
"eu-license-plate",
|
|
80
|
+
{
|
|
81
|
+
description: "EU License Plate V1",
|
|
82
|
+
docClass: documents_1.eu.LicensePlateV1,
|
|
83
|
+
fullText: false,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"us-bank-check",
|
|
88
|
+
{
|
|
89
|
+
description: "US Bank Check V1",
|
|
90
|
+
docClass: documents_1.us.BankCheckV1,
|
|
91
|
+
fullText: false,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"shipping-container",
|
|
96
|
+
{
|
|
97
|
+
description: "Shipping container V1",
|
|
98
|
+
docClass: documents_1.ShippingContainerV1,
|
|
62
99
|
fullText: false,
|
|
63
100
|
},
|
|
64
101
|
],
|
|
@@ -79,41 +116,21 @@ async function predictCall(command, inputPath, options) {
|
|
|
79
116
|
});
|
|
80
117
|
}
|
|
81
118
|
const doc = mindeeClient.docFromPath(inputPath);
|
|
119
|
+
let pageOptions = undefined;
|
|
120
|
+
if (options.cutPages) {
|
|
121
|
+
pageOptions = {
|
|
122
|
+
operation: inputs_1.PageOptionsOperation.KeepOnly,
|
|
123
|
+
pageIndexes: [0, 1, 2, 3, 4],
|
|
124
|
+
onMinPages: 5,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
82
127
|
const predictParams = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cutPages: options.cutPages,
|
|
128
|
+
endpointName: command === COMMAND_CUSTOM ? options.documentType : conf.docClass.name,
|
|
129
|
+
accountName: command === COMMAND_CUSTOM ? options.user : api_1.STANDARD_API_OWNER,
|
|
86
130
|
fullText: options.fullText,
|
|
131
|
+
pageOptions: pageOptions,
|
|
87
132
|
};
|
|
88
|
-
|
|
89
|
-
// This compiled, but threw an exception:
|
|
90
|
-
// TypeError: responseType is not a constructor
|
|
91
|
-
//
|
|
92
|
-
// So using a switch to explicitly set the response class parameter. Ugly, but works.
|
|
93
|
-
// Improvements welcome!
|
|
94
|
-
let response;
|
|
95
|
-
switch (command) {
|
|
96
|
-
case COMMAND_INVOICE:
|
|
97
|
-
response = await doc.parse(documents_1.InvoiceV3, predictParams);
|
|
98
|
-
break;
|
|
99
|
-
case COMMAND_RECEIPT:
|
|
100
|
-
response = await doc.parse(documents_1.ReceiptV4, predictParams);
|
|
101
|
-
break;
|
|
102
|
-
case COMMAND_FINANCIAL:
|
|
103
|
-
response = await doc.parse(documents_1.FinancialDocumentV1, predictParams);
|
|
104
|
-
break;
|
|
105
|
-
case COMMAND_PASSPORT:
|
|
106
|
-
response = await doc.parse(documents_1.PassportV1, predictParams);
|
|
107
|
-
break;
|
|
108
|
-
case COMMAND_FR_ID_CARD:
|
|
109
|
-
response = await doc.parse(fr_1.IdCardV1, predictParams);
|
|
110
|
-
break;
|
|
111
|
-
case COMMAND_CUSTOM:
|
|
112
|
-
response = await doc.parse(documents_1.CustomV1, predictParams);
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
throw `Unhandled command: ${command}`;
|
|
116
|
-
}
|
|
133
|
+
const response = await doc.parse(conf.docClass, predictParams);
|
|
117
134
|
if (options.fullText) {
|
|
118
135
|
response.pages.forEach((page) => {
|
|
119
136
|
console.log(page.fullText?.toString());
|
|
@@ -135,7 +152,7 @@ function cli() {
|
|
|
135
152
|
const prog = program.command(name);
|
|
136
153
|
prog.description(info.description);
|
|
137
154
|
prog.option("-k, --api-key <api_key>", "API key for document endpoint");
|
|
138
|
-
prog.option("-
|
|
155
|
+
prog.option("-c, --cut-pages", "Keep only the first 5 pages of the document.");
|
|
139
156
|
prog.option("-p, --pages", "Show pages content");
|
|
140
157
|
if (info.fullText) {
|
|
141
158
|
prog.option("-t, --full-text", "Include full document text in response");
|
package/src/client.d.ts
CHANGED
|
@@ -6,11 +6,38 @@ import { Document, DocumentSig } from "./documents";
|
|
|
6
6
|
import { DocumentConfig } from "./documents/documentConfig";
|
|
7
7
|
import { ReadStream } from "fs";
|
|
8
8
|
declare type DocConfigs = Map<string[], DocumentConfig<any>>;
|
|
9
|
-
interface PredictOptions {
|
|
9
|
+
export interface PredictOptions {
|
|
10
|
+
/**
|
|
11
|
+
* For custom endpoints, the "API name" field in the "Settings" page of the API Builder.
|
|
12
|
+
*
|
|
13
|
+
* Do not set for standard (off the shelf) endpoints.
|
|
14
|
+
*/
|
|
10
15
|
endpointName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* For custom endpoints, your organization's username on the API Builder.
|
|
18
|
+
* This is normally not required unless you have a custom endpoint which has the
|
|
19
|
+
* same name as standard (off the shelf) endpoint.
|
|
20
|
+
*
|
|
21
|
+
* Do not set for standard (off the shelf) endpoints.
|
|
22
|
+
*/
|
|
11
23
|
accountName?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to include the full text for each page.
|
|
26
|
+
*
|
|
27
|
+
* This performs a full OCR operation on the server and will increase response time.
|
|
28
|
+
*/
|
|
12
29
|
fullText?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to include cropper results for each page.
|
|
32
|
+
*
|
|
33
|
+
* This performs a cropping operation on the server and will increase response time.
|
|
34
|
+
*/
|
|
13
35
|
cropper?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If set, remove pages from the document as specified.
|
|
38
|
+
*
|
|
39
|
+
* This is done before sending the file to the server and is useful to avoid page limitations.
|
|
40
|
+
*/
|
|
14
41
|
pageOptions?: PageOptions;
|
|
15
42
|
}
|
|
16
43
|
declare class DocumentClient {
|
|
@@ -24,14 +51,23 @@ declare class DocumentClient {
|
|
|
24
51
|
*/
|
|
25
52
|
parse<DocType extends Document>(documentClass: DocumentSig<DocType>, params?: PredictOptions): Promise<Response<DocType>>;
|
|
26
53
|
}
|
|
27
|
-
interface
|
|
54
|
+
export interface CustomConfigParams {
|
|
55
|
+
/** Your organization's username on the API Builder. */
|
|
28
56
|
accountName: string;
|
|
57
|
+
/** The "API name" field in the "Settings" page of the API Builder. */
|
|
29
58
|
endpointName: string;
|
|
59
|
+
/**
|
|
60
|
+
* If set, locks the version of the model to use.
|
|
61
|
+
* If not set, use the latest version of the model.
|
|
62
|
+
*/
|
|
30
63
|
version?: string;
|
|
31
64
|
}
|
|
32
|
-
interface ClientOptions {
|
|
65
|
+
export interface ClientOptions {
|
|
66
|
+
/** Your API key for all endpoints. */
|
|
33
67
|
apiKey?: string;
|
|
68
|
+
/** Raise an `Error` on errors. */
|
|
34
69
|
throwOnError?: boolean;
|
|
70
|
+
/** Log debug messages. */
|
|
35
71
|
debug?: boolean;
|
|
36
72
|
}
|
|
37
73
|
/**
|
|
@@ -43,7 +79,7 @@ export declare class Client {
|
|
|
43
79
|
/**
|
|
44
80
|
* @param options
|
|
45
81
|
*/
|
|
46
|
-
constructor(
|
|
82
|
+
constructor({ apiKey, throwOnError, debug, }: ClientOptions);
|
|
47
83
|
protected addStandardEndpoints(): void;
|
|
48
84
|
/**
|
|
49
85
|
* Add a custom endpoint to the client.
|
|
@@ -51,7 +87,7 @@ export declare class Client {
|
|
|
51
87
|
* @param endpointName
|
|
52
88
|
* @param version
|
|
53
89
|
*/
|
|
54
|
-
addEndpoint({ accountName, endpointName, version, }:
|
|
90
|
+
addEndpoint({ accountName, endpointName, version, }: CustomConfigParams): this;
|
|
55
91
|
/**
|
|
56
92
|
* Load an input document from a local path.
|
|
57
93
|
* @param inputPath
|
package/src/client.js
CHANGED
|
@@ -66,11 +66,9 @@ class Client {
|
|
|
66
66
|
/**
|
|
67
67
|
* @param options
|
|
68
68
|
*/
|
|
69
|
-
constructor(
|
|
70
|
-
const throwOnError = options?.throwOnError === undefined ? true : options.throwOnError;
|
|
71
|
-
const debug = options?.debug === undefined ? false : options.debug;
|
|
72
|
-
this.apiKey = options?.apiKey === undefined ? "" : options.apiKey;
|
|
69
|
+
constructor({ apiKey = "", throwOnError = true, debug = false, }) {
|
|
73
70
|
this.docConfigs = new Map();
|
|
71
|
+
this.apiKey = apiKey;
|
|
74
72
|
handler_1.errorHandler.throwOnError = throwOnError;
|
|
75
73
|
logger_1.logger.level =
|
|
76
74
|
debug ?? process.env.MINDEE_DEBUG
|
|
@@ -100,6 +98,21 @@ class Client {
|
|
|
100
98
|
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.fr.IdCardV1.name], new documentConfig_1.DocumentConfig(documents_1.fr.IdCardV1, [
|
|
101
99
|
new api_1.StandardEndpoint("idcard_fr", "1", this.apiKey),
|
|
102
100
|
]));
|
|
101
|
+
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.us.BankCheckV1.name], new documentConfig_1.DocumentConfig(documents_1.us.BankCheckV1, [
|
|
102
|
+
new api_1.StandardEndpoint("bank_check", "1", this.apiKey),
|
|
103
|
+
]));
|
|
104
|
+
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.fr.BankAccountDetailsV1.name], new documentConfig_1.DocumentConfig(documents_1.fr.BankAccountDetailsV1, [
|
|
105
|
+
new api_1.StandardEndpoint("bank_account_details", "1", this.apiKey),
|
|
106
|
+
]));
|
|
107
|
+
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.fr.CarteVitaleV1.name], new documentConfig_1.DocumentConfig(documents_1.fr.CarteVitaleV1, [
|
|
108
|
+
new api_1.StandardEndpoint("carte_vitale", "1", this.apiKey),
|
|
109
|
+
]));
|
|
110
|
+
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.eu.LicensePlateV1.name], new documentConfig_1.DocumentConfig(documents_1.eu.LicensePlateV1, [
|
|
111
|
+
new api_1.StandardEndpoint("license_plates", "1", this.apiKey),
|
|
112
|
+
]));
|
|
113
|
+
this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.ShippingContainerV1.name], new documentConfig_1.DocumentConfig(documents_1.ShippingContainerV1, [
|
|
114
|
+
new api_1.StandardEndpoint("shipping_containers", "1", this.apiKey),
|
|
115
|
+
]));
|
|
103
116
|
}
|
|
104
117
|
/**
|
|
105
118
|
* Add a custom endpoint to the client.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
-
import {
|
|
2
|
+
import { PositionField } from "../../fields";
|
|
3
3
|
export declare class CropperV1 extends Document {
|
|
4
|
-
cropping:
|
|
4
|
+
cropping: PositionField[];
|
|
5
5
|
constructor({ prediction, orientation, inputSource, pageId, }: DocumentConstructorProps);
|
|
6
6
|
toString(): string;
|
|
7
7
|
}
|
|
@@ -13,7 +13,7 @@ class CropperV1 extends document_1.Document {
|
|
|
13
13
|
this.cropping = [];
|
|
14
14
|
if (pageId !== undefined) {
|
|
15
15
|
prediction.cropping.forEach((crop) => {
|
|
16
|
-
this.cropping.push(new fields_1.
|
|
16
|
+
this.cropping.push(new fields_1.PositionField({
|
|
17
17
|
prediction: crop,
|
|
18
18
|
pageId: pageId,
|
|
19
19
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputSource } from "../inputs";
|
|
2
|
-
import {
|
|
2
|
+
import { PositionField, FullText, OrientationField, stringDict } from "../fields";
|
|
3
3
|
export declare type DocumentSig<DocType extends Document> = {
|
|
4
4
|
new ({ prediction, orientation, extras, inputSource, pageId, fullText, documentType, }: DocumentConstructorProps): DocType;
|
|
5
5
|
};
|
|
@@ -30,7 +30,7 @@ export declare class Document {
|
|
|
30
30
|
fullText?: FullText;
|
|
31
31
|
pageId?: number | undefined;
|
|
32
32
|
orientation?: OrientationField;
|
|
33
|
-
cropper:
|
|
33
|
+
cropper: PositionField[];
|
|
34
34
|
readonly docType: string;
|
|
35
35
|
constructor({ orientation, extras, inputSource, fullText, pageId, documentType, }: BaseDocumentConstructorProps);
|
|
36
36
|
clone(): any;
|
|
@@ -23,7 +23,7 @@ class Document {
|
|
|
23
23
|
if (extras !== undefined) {
|
|
24
24
|
if (extras.cropper !== undefined) {
|
|
25
25
|
extras.cropper.cropping.forEach((crop) => {
|
|
26
|
-
this.cropper.push(new fields_1.
|
|
26
|
+
this.cropper.push(new fields_1.PositionField({
|
|
27
27
|
prediction: crop,
|
|
28
28
|
pageId: pageId,
|
|
29
29
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LicensePlateV1 } from "./licensePlate/licensePlateV1";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LicensePlateV1 = void 0;
|
|
4
|
+
var licensePlateV1_1 = require("./licensePlate/licensePlateV1");
|
|
5
|
+
Object.defineProperty(exports, "LicensePlateV1", { enumerable: true, get: function () { return licensePlateV1_1.LicensePlateV1; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
+
import { Field } from "../../../fields";
|
|
3
|
+
export declare class LicensePlateV1 extends Document {
|
|
4
|
+
/** A list of license plates values. */
|
|
5
|
+
licensePlates: Field[];
|
|
6
|
+
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LicensePlateV1 = void 0;
|
|
4
|
+
const document_1 = require("../../document");
|
|
5
|
+
const fields_1 = require("../../../fields");
|
|
6
|
+
class LicensePlateV1 extends document_1.Document {
|
|
7
|
+
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
+
super({
|
|
9
|
+
inputSource: inputSource,
|
|
10
|
+
pageId: pageId,
|
|
11
|
+
orientation: orientation,
|
|
12
|
+
extras: extras,
|
|
13
|
+
});
|
|
14
|
+
/** A list of license plates values. */
|
|
15
|
+
this.licensePlates = [];
|
|
16
|
+
prediction.license_plates.map((prediction) => this.licensePlates.push(new fields_1.Field({
|
|
17
|
+
prediction: prediction,
|
|
18
|
+
pageId: pageId,
|
|
19
|
+
})));
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
const outStr = `----- EU License plate V1 -----
|
|
23
|
+
Licence plates: ${this.licensePlates.map((plate) => plate.value).join(", ")}
|
|
24
|
+
----------------------
|
|
25
|
+
`;
|
|
26
|
+
return LicensePlateV1.cleanOutString(outStr);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.LicensePlateV1 = LicensePlateV1;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
+
import { Field } from "../../../fields";
|
|
3
|
+
export declare class BankAccountDetailsV1 extends Document {
|
|
4
|
+
/** The IBAN number. */
|
|
5
|
+
iban: Field;
|
|
6
|
+
/** The account holder name. */
|
|
7
|
+
accountHolderName: Field;
|
|
8
|
+
/** The SWIFT value. */
|
|
9
|
+
swift: Field;
|
|
10
|
+
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BankAccountDetailsV1 = void 0;
|
|
4
|
+
const document_1 = require("../../document");
|
|
5
|
+
const fields_1 = require("../../../fields");
|
|
6
|
+
class BankAccountDetailsV1 extends document_1.Document {
|
|
7
|
+
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
+
super({
|
|
9
|
+
inputSource: inputSource,
|
|
10
|
+
pageId: pageId,
|
|
11
|
+
orientation: orientation,
|
|
12
|
+
extras: extras,
|
|
13
|
+
});
|
|
14
|
+
this.iban = new fields_1.Field({
|
|
15
|
+
prediction: prediction.iban,
|
|
16
|
+
pageId: pageId,
|
|
17
|
+
});
|
|
18
|
+
this.accountHolderName = new fields_1.Field({
|
|
19
|
+
prediction: prediction.account_holder_name,
|
|
20
|
+
pageId: pageId,
|
|
21
|
+
});
|
|
22
|
+
this.swift = new fields_1.Field({
|
|
23
|
+
prediction: prediction.swift,
|
|
24
|
+
pageId: pageId,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
toString() {
|
|
28
|
+
const outStr = `----- FR Bank Account Details V1 -----
|
|
29
|
+
IBAN: ${this.iban}
|
|
30
|
+
Account holder name: ${this.accountHolderName}
|
|
31
|
+
SWIFT: ${this.swift}
|
|
32
|
+
----------------------
|
|
33
|
+
`;
|
|
34
|
+
return BankAccountDetailsV1.cleanOutString(outStr);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BankAccountDetailsV1 = BankAccountDetailsV1;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
+
import { Field, DateField } from "../../../fields";
|
|
3
|
+
export declare class CarteVitaleV1 extends Document {
|
|
4
|
+
/** The list of the names of the person. */
|
|
5
|
+
givenNames: Field[];
|
|
6
|
+
/** The surname of the person. */
|
|
7
|
+
surname: Field;
|
|
8
|
+
/** The ID number of the card. */
|
|
9
|
+
idNumber: Field;
|
|
10
|
+
/** The issuance date of the card. */
|
|
11
|
+
issuanceDate: DateField;
|
|
12
|
+
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CarteVitaleV1 = void 0;
|
|
4
|
+
const document_1 = require("../../document");
|
|
5
|
+
const fields_1 = require("../../../fields");
|
|
6
|
+
class CarteVitaleV1 extends document_1.Document {
|
|
7
|
+
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
+
super({
|
|
9
|
+
inputSource: inputSource,
|
|
10
|
+
pageId: pageId,
|
|
11
|
+
orientation: orientation,
|
|
12
|
+
extras: extras,
|
|
13
|
+
});
|
|
14
|
+
/** The list of the names of the person. */
|
|
15
|
+
this.givenNames = [];
|
|
16
|
+
this.idNumber = new fields_1.Field({
|
|
17
|
+
prediction: prediction.social_security,
|
|
18
|
+
pageId: pageId,
|
|
19
|
+
});
|
|
20
|
+
this.issuanceDate = new fields_1.DateField({
|
|
21
|
+
prediction: prediction.issuance_date,
|
|
22
|
+
pageId: pageId,
|
|
23
|
+
});
|
|
24
|
+
this.surname = new fields_1.Field({
|
|
25
|
+
prediction: prediction.surname,
|
|
26
|
+
pageId: pageId,
|
|
27
|
+
});
|
|
28
|
+
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.Field({
|
|
29
|
+
prediction: prediction,
|
|
30
|
+
pageId: pageId,
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
const outStr = `----- FR Carte Vitale V1 -----
|
|
35
|
+
Given names: ${this.givenNames.map((name) => name.value).join(" ")}
|
|
36
|
+
Surname: ${this.surname}
|
|
37
|
+
ID Number: ${this.idNumber}
|
|
38
|
+
Issuance date: ${this.issuanceDate}
|
|
39
|
+
----------------------
|
|
40
|
+
`;
|
|
41
|
+
return CarteVitaleV1.cleanOutString(outStr);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CarteVitaleV1 = CarteVitaleV1;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
2
|
import { Field, DateField, BaseField } from "../../../fields";
|
|
3
3
|
export declare class IdCardV1 extends Document {
|
|
4
|
+
/** The authority which has issued the card. */
|
|
4
5
|
authority: Field;
|
|
6
|
+
/** Indicates if it is the recto, the verso or the both of it. */
|
|
5
7
|
documentSide: BaseField;
|
|
8
|
+
/** The id number of the card. */
|
|
6
9
|
idNumber: Field;
|
|
10
|
+
/** The birth date of the person. */
|
|
7
11
|
birthDate: DateField;
|
|
12
|
+
/** The expiry date of the card. */
|
|
8
13
|
expiryDate: DateField;
|
|
14
|
+
/** The birth place of the person. */
|
|
9
15
|
birthPlace: Field;
|
|
16
|
+
/** The gender of the person. */
|
|
10
17
|
gender: Field;
|
|
18
|
+
/** The first mrz value. */
|
|
11
19
|
mrz1: Field;
|
|
20
|
+
/** The second mrz value. */
|
|
12
21
|
mrz2: Field;
|
|
22
|
+
/** The surname of the person. */
|
|
13
23
|
surname: Field;
|
|
24
|
+
/** The list of the names of the person. */
|
|
14
25
|
givenNames: Field[];
|
|
15
26
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
16
27
|
toString(): string;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IdCardV1 = void 0;
|
|
3
|
+
exports.CarteVitaleV1 = exports.BankAccountDetailsV1 = 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 bankAccountDetailsV1_1 = require("./bankAccountDetails/bankAccountDetailsV1");
|
|
7
|
+
Object.defineProperty(exports, "BankAccountDetailsV1", { enumerable: true, get: function () { return bankAccountDetailsV1_1.BankAccountDetailsV1; } });
|
|
8
|
+
var carteVitaleV1_1 = require("./carteVitale/carteVitaleV1");
|
|
9
|
+
Object.defineProperty(exports, "CarteVitaleV1", { enumerable: true, get: function () { return carteVitaleV1_1.CarteVitaleV1; } });
|
package/src/documents/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { PassportV1 } from "./passport/passportV1";
|
|
|
5
5
|
export { FinancialDocumentV1 } from "./financialDocument/financialDocumentV1";
|
|
6
6
|
export { CustomV1 } from "./custom";
|
|
7
7
|
export { CropperV1 } from "./cropper/cropperV1";
|
|
8
|
+
export { ShippingContainerV1 } from "./shipping_container/shippingContainerV1";
|
|
8
9
|
export { Document, DocumentConstructorProps, DocumentSig } from "./document";
|
|
9
10
|
export * as fr from "./fr";
|
|
10
11
|
export * as us from "./us";
|
|
12
|
+
export * as eu from "./eu";
|
package/src/documents/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.us = exports.fr = exports.Document = exports.CropperV1 = exports.CustomV1 = exports.FinancialDocumentV1 = exports.PassportV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.InvoiceV3 = void 0;
|
|
26
|
+
exports.eu = exports.us = exports.fr = exports.Document = exports.ShippingContainerV1 = exports.CropperV1 = exports.CustomV1 = exports.FinancialDocumentV1 = exports.PassportV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.InvoiceV3 = void 0;
|
|
27
27
|
var invoiceV3_1 = require("./invoice/invoiceV3");
|
|
28
28
|
Object.defineProperty(exports, "InvoiceV3", { enumerable: true, get: function () { return invoiceV3_1.InvoiceV3; } });
|
|
29
29
|
var receiptV3_1 = require("./receipt/receiptV3");
|
|
@@ -38,7 +38,10 @@ var custom_1 = require("./custom");
|
|
|
38
38
|
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return custom_1.CustomV1; } });
|
|
39
39
|
var cropperV1_1 = require("./cropper/cropperV1");
|
|
40
40
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return cropperV1_1.CropperV1; } });
|
|
41
|
+
var shippingContainerV1_1 = require("./shipping_container/shippingContainerV1");
|
|
42
|
+
Object.defineProperty(exports, "ShippingContainerV1", { enumerable: true, get: function () { return shippingContainerV1_1.ShippingContainerV1; } });
|
|
41
43
|
var document_1 = require("./document");
|
|
42
44
|
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return document_1.Document; } });
|
|
43
45
|
exports.fr = __importStar(require("./fr"));
|
|
44
46
|
exports.us = __importStar(require("./us"));
|
|
47
|
+
exports.eu = __importStar(require("./eu"));
|
|
@@ -2,22 +2,39 @@ import { Document, DocumentConstructorProps } from "../document";
|
|
|
2
2
|
import { BaseField, TaxField, PaymentDetails, Locale, Amount, Field, DateField, CompanyRegistration } from "../../fields";
|
|
3
3
|
export declare class InvoiceV3 extends Document {
|
|
4
4
|
#private;
|
|
5
|
+
/** Total amount with the tax amount of the purchase. */
|
|
5
6
|
locale: Locale;
|
|
7
|
+
/** The nature of the invoice. */
|
|
6
8
|
documentType: BaseField;
|
|
9
|
+
/** The total amount with tax included. */
|
|
7
10
|
totalIncl: Amount;
|
|
11
|
+
/** The creation date of the invoice. */
|
|
8
12
|
date: DateField;
|
|
13
|
+
/** The due date of the invoice. */
|
|
9
14
|
dueDate: DateField;
|
|
15
|
+
/** The created time of the invoice */
|
|
10
16
|
time: Field;
|
|
17
|
+
/** The total tax. */
|
|
11
18
|
totalTax: Amount;
|
|
19
|
+
/** The total amount without the tax value. */
|
|
12
20
|
totalExcl: Amount;
|
|
21
|
+
/** The supplier name. */
|
|
13
22
|
supplier: Field;
|
|
23
|
+
/** The supplier address. */
|
|
14
24
|
supplierAddress: Field;
|
|
25
|
+
/** The invoice number. */
|
|
15
26
|
invoiceNumber: Field;
|
|
27
|
+
/** The company regitration information. */
|
|
16
28
|
companyRegistration: CompanyRegistration[];
|
|
29
|
+
/** The name of the customer. */
|
|
17
30
|
customerName: Field;
|
|
31
|
+
/** The address of the customer. */
|
|
18
32
|
customerAddress: Field;
|
|
33
|
+
/** The list of the taxes. */
|
|
19
34
|
taxes: TaxField[];
|
|
35
|
+
/** The payment information. */
|
|
20
36
|
paymentDetails: PaymentDetails[];
|
|
37
|
+
/** The company registration information for the customer. */
|
|
21
38
|
customerCompanyRegistration: CompanyRegistration[];
|
|
22
39
|
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
23
40
|
toString(): string;
|
|
@@ -19,9 +19,13 @@ class InvoiceV3 extends document_1.Document {
|
|
|
19
19
|
extras: extras,
|
|
20
20
|
});
|
|
21
21
|
_InvoiceV3_instances.add(this);
|
|
22
|
+
/** The company regitration information. */
|
|
22
23
|
this.companyRegistration = [];
|
|
24
|
+
/** The list of the taxes. */
|
|
23
25
|
this.taxes = [];
|
|
26
|
+
/** The payment information. */
|
|
24
27
|
this.paymentDetails = [];
|
|
28
|
+
/** The company registration information for the customer. */
|
|
25
29
|
this.customerCompanyRegistration = [];
|
|
26
30
|
__classPrivateFieldGet(this, _InvoiceV3_instances, "m", _InvoiceV3_initFromApiPrediction).call(this, prediction, pageId);
|
|
27
31
|
__classPrivateFieldGet(this, _InvoiceV3_instances, "m", _InvoiceV3_checklist).call(this);
|
|
@@ -2,18 +2,31 @@ import { Document, DocumentConstructorProps } from "../document";
|
|
|
2
2
|
import { Field, DateField } from "../../fields";
|
|
3
3
|
export declare class PassportV1 extends Document {
|
|
4
4
|
#private;
|
|
5
|
+
/** The country of issue. */
|
|
5
6
|
country: Field;
|
|
7
|
+
/** The passport number. */
|
|
6
8
|
idNumber: Field;
|
|
9
|
+
/** The date of birth of the passport holder. */
|
|
7
10
|
birthDate: DateField;
|
|
11
|
+
/** The expiration date of the passport. */
|
|
8
12
|
expiryDate: DateField;
|
|
13
|
+
/** The issuance date.*/
|
|
9
14
|
issuanceDate: DateField;
|
|
15
|
+
/** The place of birth of the passport holder. */
|
|
10
16
|
birthPlace: Field;
|
|
17
|
+
/** The sex or gender of the passport holder. */
|
|
11
18
|
gender: Field;
|
|
19
|
+
/** The surname of the person. */
|
|
12
20
|
surname: Field;
|
|
21
|
+
/** The value of the first mrz line. */
|
|
13
22
|
mrz1: Field;
|
|
23
|
+
/** The value of the second mrz line. */
|
|
14
24
|
mrz2: Field;
|
|
25
|
+
/** List of first (given) names of the passport holder. */
|
|
15
26
|
givenNames: Field[];
|
|
27
|
+
/** The full name of the passport holder. */
|
|
16
28
|
fullName: Field;
|
|
29
|
+
/** All the mrz values combined. */
|
|
17
30
|
mrz: Field;
|
|
18
31
|
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
19
32
|
static convertMRZDateToDatetime(dateString: string): Date;
|
|
@@ -43,6 +43,7 @@ class PassportV1 extends document_1.Document {
|
|
|
43
43
|
extras: extras,
|
|
44
44
|
});
|
|
45
45
|
_PassportV1_instances.add(this);
|
|
46
|
+
/** List of first (given) names of the passport holder. */
|
|
46
47
|
this.givenNames = [];
|
|
47
48
|
this.country = new fields_1.Field({
|
|
48
49
|
prediction: prediction.country,
|
|
@@ -2,15 +2,23 @@ import { Document, DocumentConstructorProps } from "../document";
|
|
|
2
2
|
import { TaxField, Field, Amount, Locale, DateField } from "../../fields";
|
|
3
3
|
export declare class ReceiptV3 extends Document {
|
|
4
4
|
#private;
|
|
5
|
+
/** Total amount with the tax amount of the purchase. */
|
|
5
6
|
locale: Locale;
|
|
7
|
+
/** Where the purchase was made, the language, and the currency. */
|
|
6
8
|
totalIncl: Amount;
|
|
9
|
+
/** The purchase date. */
|
|
7
10
|
date: DateField;
|
|
8
|
-
/**
|
|
11
|
+
/** The type of purchase. */
|
|
9
12
|
category: Field;
|
|
13
|
+
/** Merchant's name as seen on the receipt. */
|
|
10
14
|
merchantName: Field;
|
|
15
|
+
/** Time as seen on the receipt in HH:MM format. */
|
|
11
16
|
time: Field;
|
|
17
|
+
/** Total tax amount of the purchase. */
|
|
12
18
|
totalTax: Amount;
|
|
19
|
+
/** Total amount without tax of the purchase. */
|
|
13
20
|
totalExcl: Amount;
|
|
21
|
+
/** List of different taxe. */
|
|
14
22
|
taxes: TaxField[];
|
|
15
23
|
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
16
24
|
toString(): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
+
import { Field } from "../../fields";
|
|
3
|
+
export declare class ShippingContainerV1 extends Document {
|
|
4
|
+
/** ISO 6346 code for container owner prefix + equipment identifier. */
|
|
5
|
+
owner: Field;
|
|
6
|
+
/** ISO 6346 code for container serial number (6+1 digits). */
|
|
7
|
+
serialNumber: Field;
|
|
8
|
+
/** ISO 6346 code for container length, height and type. */
|
|
9
|
+
sizeType: Field;
|
|
10
|
+
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShippingContainerV1 = void 0;
|
|
4
|
+
const document_1 = require("../document");
|
|
5
|
+
const fields_1 = require("../../fields");
|
|
6
|
+
class ShippingContainerV1 extends document_1.Document {
|
|
7
|
+
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
+
super({
|
|
9
|
+
inputSource: inputSource,
|
|
10
|
+
pageId: pageId,
|
|
11
|
+
orientation: orientation,
|
|
12
|
+
extras: extras,
|
|
13
|
+
});
|
|
14
|
+
this.owner = new fields_1.Field({
|
|
15
|
+
prediction: prediction.owner,
|
|
16
|
+
pageId: pageId,
|
|
17
|
+
});
|
|
18
|
+
this.serialNumber = new fields_1.Field({
|
|
19
|
+
prediction: prediction.serial_number,
|
|
20
|
+
pageId: pageId,
|
|
21
|
+
});
|
|
22
|
+
this.sizeType = new fields_1.Field({
|
|
23
|
+
prediction: prediction.size_type,
|
|
24
|
+
pageId: pageId,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
toString() {
|
|
28
|
+
const outStr = `----- Shipping Container V1 -----
|
|
29
|
+
Owner: ${this.owner}
|
|
30
|
+
Serial number: ${this.serialNumber}
|
|
31
|
+
Size and type: ${this.sizeType}
|
|
32
|
+
----------------------
|
|
33
|
+
`;
|
|
34
|
+
return ShippingContainerV1.cleanOutString(outStr);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ShippingContainerV1 = ShippingContainerV1;
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import { Document } from "../../document";
|
|
1
|
+
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
+
import { Field, DateField, PositionField, Amount } from "../../../fields";
|
|
2
3
|
export declare class BankCheckV1 extends Document {
|
|
4
|
+
/** Payer's bank account number. */
|
|
5
|
+
accountNumber: Field;
|
|
6
|
+
/** Total including taxes. */
|
|
7
|
+
amount: Amount;
|
|
8
|
+
/** Payer's bank account number. */
|
|
9
|
+
checkNumber: Field;
|
|
10
|
+
/** Check's position in the image. */
|
|
11
|
+
checkPosition: PositionField;
|
|
12
|
+
/** Date the check was issued. */
|
|
13
|
+
issuanceDate: DateField;
|
|
14
|
+
/** List of payees (full name or company name). */
|
|
15
|
+
payees: Field[];
|
|
16
|
+
/** Payer's bank account routing number. */
|
|
17
|
+
routingNumber: Field;
|
|
18
|
+
/** Signatures' positions in the image. */
|
|
19
|
+
signaturesPositions: PositionField;
|
|
20
|
+
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
21
|
+
toString(): string;
|
|
3
22
|
}
|
|
@@ -2,6 +2,63 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BankCheckV1 = void 0;
|
|
4
4
|
const document_1 = require("../../document");
|
|
5
|
+
const fields_1 = require("../../../fields");
|
|
5
6
|
class BankCheckV1 extends document_1.Document {
|
|
7
|
+
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
+
super({
|
|
9
|
+
inputSource: inputSource,
|
|
10
|
+
pageId: pageId,
|
|
11
|
+
orientation: orientation,
|
|
12
|
+
extras: extras,
|
|
13
|
+
});
|
|
14
|
+
/** List of payees (full name or company name). */
|
|
15
|
+
this.payees = [];
|
|
16
|
+
this.accountNumber = new fields_1.Field({
|
|
17
|
+
prediction: prediction.account_number,
|
|
18
|
+
pageId: pageId,
|
|
19
|
+
});
|
|
20
|
+
this.checkNumber = new fields_1.Field({
|
|
21
|
+
prediction: prediction.check_number,
|
|
22
|
+
pageId: pageId,
|
|
23
|
+
});
|
|
24
|
+
this.amount = new fields_1.Amount({
|
|
25
|
+
prediction: prediction.amount,
|
|
26
|
+
valueKey: "value",
|
|
27
|
+
pageId: pageId,
|
|
28
|
+
});
|
|
29
|
+
this.checkPosition = new fields_1.PositionField({
|
|
30
|
+
prediction: prediction.check_position,
|
|
31
|
+
pageId: pageId,
|
|
32
|
+
});
|
|
33
|
+
this.issuanceDate = new fields_1.DateField({
|
|
34
|
+
prediction: prediction.date,
|
|
35
|
+
pageId: pageId,
|
|
36
|
+
});
|
|
37
|
+
prediction.payees.map((prediction) => this.payees.push(new fields_1.Field({
|
|
38
|
+
prediction: prediction,
|
|
39
|
+
pageId: pageId,
|
|
40
|
+
})));
|
|
41
|
+
this.routingNumber = new fields_1.Field({
|
|
42
|
+
prediction: prediction.routing_number,
|
|
43
|
+
pageId: pageId,
|
|
44
|
+
});
|
|
45
|
+
this.signaturesPositions = new fields_1.PositionField({
|
|
46
|
+
prediction: prediction.signatures_positions,
|
|
47
|
+
pageId: pageId,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
toString() {
|
|
51
|
+
const outStr = `----- US Bank Check V1 -----
|
|
52
|
+
Filename: ${this.filename}
|
|
53
|
+
Routing number: ${this.routingNumber}
|
|
54
|
+
Account number: ${this.accountNumber}
|
|
55
|
+
Check number: ${this.checkNumber}
|
|
56
|
+
Date: ${this.issuanceDate}
|
|
57
|
+
Amount: ${this.amount}
|
|
58
|
+
Payees: ${this.payees.map((name) => name.value).join(", ")}
|
|
59
|
+
----------------------
|
|
60
|
+
`;
|
|
61
|
+
return BankCheckV1.cleanOutString(outStr);
|
|
62
|
+
}
|
|
6
63
|
}
|
|
7
64
|
exports.BankCheckV1 = BankCheckV1;
|
package/src/fields/amount.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Field, FieldConstructor } from "./field";
|
|
2
2
|
export declare function floatToString(value: number): string;
|
|
3
3
|
export declare class Amount extends Field {
|
|
4
|
+
/** The value. */
|
|
4
5
|
value: number | undefined;
|
|
5
6
|
/**
|
|
6
7
|
* @param {Object} prediction - Prediction object from HTTP response
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Field, FieldConstructor } from "./field";
|
|
2
2
|
export declare class CompanyRegistration extends Field {
|
|
3
|
-
/** Type of company registration number */
|
|
3
|
+
/** Type of company registration number. */
|
|
4
4
|
type: string;
|
|
5
5
|
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
6
6
|
}
|
package/src/fields/field.d.ts
CHANGED
package/src/fields/field.js
CHANGED
|
@@ -9,6 +9,7 @@ class BaseField {
|
|
|
9
9
|
* @param {Boolean} reconstructed - Does the object is reconstructed (not extracted by the API)
|
|
10
10
|
*/
|
|
11
11
|
constructor({ prediction, valueKey = "value", reconstructed = false, }) {
|
|
12
|
+
/** The value. */
|
|
12
13
|
this.value = undefined;
|
|
13
14
|
this.reconstructed = reconstructed;
|
|
14
15
|
if (prediction !== undefined &&
|
package/src/fields/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export { BaseField, stringDict, Field } from "./field";
|
|
|
8
8
|
export { ListField, ListFieldValue, ClassificationField } from "./apiBuilder";
|
|
9
9
|
export { FullText } from "./fullText";
|
|
10
10
|
export { CompanyRegistration } from "./companyRegistration";
|
|
11
|
-
export {
|
|
11
|
+
export { PositionField } from "./position";
|
package/src/fields/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PositionField = exports.CompanyRegistration = exports.FullText = exports.ClassificationField = exports.ListFieldValue = exports.ListField = exports.Field = exports.BaseField = exports.DateField = exports.Amount = exports.Locale = exports.OrientationField = exports.PaymentDetails = exports.TaxField = void 0;
|
|
4
4
|
var tax_1 = require("./tax");
|
|
5
5
|
Object.defineProperty(exports, "TaxField", { enumerable: true, get: function () { return tax_1.TaxField; } });
|
|
6
6
|
var paymentDetails_1 = require("./paymentDetails");
|
|
@@ -24,5 +24,5 @@ var fullText_1 = require("./fullText");
|
|
|
24
24
|
Object.defineProperty(exports, "FullText", { enumerable: true, get: function () { return fullText_1.FullText; } });
|
|
25
25
|
var companyRegistration_1 = require("./companyRegistration");
|
|
26
26
|
Object.defineProperty(exports, "CompanyRegistration", { enumerable: true, get: function () { return companyRegistration_1.CompanyRegistration; } });
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "
|
|
27
|
+
var position_1 = require("./position");
|
|
28
|
+
Object.defineProperty(exports, "PositionField", { enumerable: true, get: function () { return position_1.PositionField; } });
|
package/src/fields/locale.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Field } from "./field";
|
|
2
2
|
export declare class Locale extends Field {
|
|
3
|
+
/** The langage which has been detected */
|
|
3
4
|
language: string | undefined;
|
|
5
|
+
/** The country which has been detected (ISO Alpha-2)*/
|
|
4
6
|
country: string | undefined;
|
|
7
|
+
/** The currency which has been detected.*/
|
|
5
8
|
currency: string | undefined;
|
|
6
9
|
/**
|
|
7
10
|
* @param {Object} prediction - Prediction object from HTTP response
|
|
@@ -11,9 +11,13 @@ interface PaymentDetailsConstructor {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class PaymentDetails extends Field {
|
|
13
13
|
#private;
|
|
14
|
+
/** The account number. */
|
|
14
15
|
accountNumber: number | undefined;
|
|
16
|
+
/** The account IBAN. */
|
|
15
17
|
iban: string | undefined;
|
|
18
|
+
/** The routing number. */
|
|
16
19
|
routingNumber: number | undefined;
|
|
20
|
+
/** The SWIFT value. */
|
|
17
21
|
swift: number | undefined;
|
|
18
22
|
/**
|
|
19
23
|
* @param {Object} prediction - Prediction object from HTTP response
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stringDict } from "./field";
|
|
2
2
|
import { Polygon } from "../geometry";
|
|
3
|
-
export
|
|
3
|
+
export interface PositionFieldConstructor {
|
|
4
|
+
prediction: stringDict;
|
|
5
|
+
valueKey?: string;
|
|
6
|
+
pageId?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare class PositionField {
|
|
4
9
|
/** Straight rectangle. */
|
|
5
10
|
boundingBox: Polygon;
|
|
6
11
|
/** Free polygon with up to 30 vertices. */
|
|
@@ -11,6 +16,6 @@ export declare class CropperField extends BaseField {
|
|
|
11
16
|
rectangle: Polygon;
|
|
12
17
|
/** The document page on which the information was found. */
|
|
13
18
|
pageId: number | undefined;
|
|
14
|
-
constructor({ prediction,
|
|
19
|
+
constructor({ prediction, pageId }: PositionFieldConstructor);
|
|
15
20
|
toString(): string;
|
|
16
21
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor({ prediction, valueKey = "polygon", pageId }) {
|
|
7
|
-
super({ prediction, valueKey });
|
|
3
|
+
exports.PositionField = void 0;
|
|
4
|
+
class PositionField {
|
|
5
|
+
constructor({ prediction, pageId }) {
|
|
8
6
|
this.pageId = pageId;
|
|
9
7
|
this.boundingBox = prediction.bounding_box;
|
|
10
8
|
this.polygon = prediction.polygon;
|
|
@@ -15,4 +13,4 @@ class CropperField extends field_1.BaseField {
|
|
|
15
13
|
return `Polygon with ${this.polygon.length} points.`;
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
exports.
|
|
16
|
+
exports.PositionField = PositionField;
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CustomV1, FinancialDocumentV1, InvoiceV3, PassportV1, ReceiptV3, ReceiptV4, CropperV1, fr, us, } from "./documents";
|
|
1
|
+
export { CustomV1, FinancialDocumentV1, InvoiceV3, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, fr, us, eu, } from "./documents";
|
|
2
2
|
export { Client } from "./client";
|
|
3
3
|
export { PageOptionsOperation } from "./inputs";
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageOptionsOperation = exports.Client = exports.us = exports.fr = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.CustomV1 = void 0;
|
|
3
|
+
exports.PageOptionsOperation = exports.Client = exports.eu = exports.us = exports.fr = exports.ShippingContainerV1 = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.CustomV1 = void 0;
|
|
4
4
|
var documents_1 = require("./documents");
|
|
5
5
|
Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return documents_1.CustomV1; } });
|
|
6
6
|
Object.defineProperty(exports, "FinancialDocumentV1", { enumerable: true, get: function () { return documents_1.FinancialDocumentV1; } });
|
|
@@ -9,8 +9,10 @@ Object.defineProperty(exports, "PassportV1", { enumerable: true, get: function (
|
|
|
9
9
|
Object.defineProperty(exports, "ReceiptV3", { enumerable: true, get: function () { return documents_1.ReceiptV3; } });
|
|
10
10
|
Object.defineProperty(exports, "ReceiptV4", { enumerable: true, get: function () { return documents_1.ReceiptV4; } });
|
|
11
11
|
Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return documents_1.CropperV1; } });
|
|
12
|
+
Object.defineProperty(exports, "ShippingContainerV1", { enumerable: true, get: function () { return documents_1.ShippingContainerV1; } });
|
|
12
13
|
Object.defineProperty(exports, "fr", { enumerable: true, get: function () { return documents_1.fr; } });
|
|
13
14
|
Object.defineProperty(exports, "us", { enumerable: true, get: function () { return documents_1.us; } });
|
|
15
|
+
Object.defineProperty(exports, "eu", { enumerable: true, get: function () { return documents_1.eu; } });
|
|
14
16
|
var client_1 = require("./client");
|
|
15
17
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
16
18
|
var inputs_1 = require("./inputs");
|