mindee 3.1.0 → 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.
Files changed (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +29 -23
  3. package/package.json +1 -1
  4. package/src/cli.js +69 -51
  5. package/src/client.d.ts +41 -5
  6. package/src/client.js +18 -5
  7. package/src/documents/cropper/cropperV1.d.ts +2 -2
  8. package/src/documents/cropper/cropperV1.js +1 -1
  9. package/src/documents/document.d.ts +2 -2
  10. package/src/documents/document.js +1 -1
  11. package/src/documents/eu/index.d.ts +1 -0
  12. package/src/documents/eu/index.js +5 -0
  13. package/src/documents/eu/licensePlate/licensePlateV1.d.ts +8 -0
  14. package/src/documents/eu/licensePlate/licensePlateV1.js +29 -0
  15. package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +12 -0
  16. package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +37 -0
  17. package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +14 -0
  18. package/src/documents/fr/carteVitale/carteVitaleV1.js +44 -0
  19. package/src/documents/fr/idCard/idCardV1.d.ts +11 -0
  20. package/src/documents/fr/idCard/idCardV1.js +1 -0
  21. package/src/documents/fr/index.d.ts +3 -0
  22. package/src/documents/fr/index.js +9 -0
  23. package/src/documents/index.d.ts +11 -17
  24. package/src/documents/index.js +36 -18
  25. package/src/documents/invoice/invoiceV3.d.ts +17 -0
  26. package/src/documents/invoice/invoiceV3.js +4 -0
  27. package/src/documents/passport/passportV1.d.ts +13 -0
  28. package/src/documents/passport/passportV1.js +1 -0
  29. package/src/documents/receipt/receiptV3.d.ts +9 -1
  30. package/src/documents/receipt/receiptV3.js +1 -0
  31. package/src/documents/shipping_container/shippingContainerV1.d.ts +12 -0
  32. package/src/documents/shipping_container/shippingContainerV1.js +37 -0
  33. package/src/documents/us/bankCheck/bankCheckV1.d.ts +20 -1
  34. package/src/documents/us/bankCheck/bankCheckV1.js +57 -0
  35. package/src/documents/us/index.d.ts +1 -0
  36. package/src/documents/us/index.js +5 -0
  37. package/src/fields/amount.d.ts +1 -0
  38. package/src/fields/apiBuilder.d.ts +1 -0
  39. package/src/fields/companyRegistration.d.ts +1 -1
  40. package/src/fields/field.d.ts +1 -0
  41. package/src/fields/field.js +1 -0
  42. package/src/fields/index.d.ts +1 -1
  43. package/src/fields/index.js +3 -3
  44. package/src/fields/locale.d.ts +3 -0
  45. package/src/fields/paymentDetails.d.ts +4 -0
  46. package/src/fields/{cropper.d.ts → position.d.ts} +8 -3
  47. package/src/fields/{cropper.js → position.js} +4 -6
  48. package/src/index.d.ts +1 -1
  49. package/src/index.js +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
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
+
13
+ ## v3.1.1 - 2022-11-08
14
+ ### Changes
15
+ * :bug: fix proper import and documentation of region-specific documents
16
+
3
17
  ## v3.1.0 - 2022-11-08
4
18
  ### Changes
5
19
  * :sparkles: Add support for French ID cards.
package/README.md CHANGED
@@ -13,8 +13,9 @@ npm install mindee
13
13
 
14
14
  Finally, Node.js away!
15
15
 
16
- ### Off-the-Shelf Documents
16
+ ### Loading a File and Parsing It
17
17
 
18
+ #### Global Documents
18
19
  ```js
19
20
  const mindee = require("mindee");
20
21
  // for TS or modules:
@@ -24,30 +25,27 @@ const mindee = require("mindee");
24
25
  const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });
25
26
 
26
27
  // Load a file from disk and parse it
27
- const invoiceResponse = mindeeClient
28
- .docFromPath("/path/to/the/invoice.pdf")
28
+ const apiResponse = mindeeClient
29
+ .docFromPath("/path/to/the/file.ext")
29
30
  .parse(mindee.InvoiceV3);
31
+ ```
30
32
 
31
- // Print a brief summary of the parsed data
32
- invoiceResponse.then((resp) => {
33
-
34
- // The document property can be undefined:
35
- // * TypeScript will throw an error without this guard clause
36
- // (or consider using the '?' notation)
37
- // * JavaScript will be very happy to produce subtle bugs
38
- // without this guard clause
39
- if (resp.document === undefined) return;
33
+ #### Region-Specific Documents
34
+ ```js
35
+ const mindee = require("mindee");
36
+ // for TS or modules:
37
+ // import * as mindee from "mindee";
40
38
 
41
- // full object
42
- console.log(resp.document);
39
+ // Init a new client
40
+ const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });
43
41
 
44
- // string summary
45
- console.log(resp.document.toString());
46
- });
42
+ // Load a file from disk and parse it
43
+ const apiResponse = mindeeClient
44
+ .docFromPath("/path/to/the/file.ext")
45
+ .parse(mindee.fr.IdCardV1);
47
46
  ```
48
47
 
49
- ### Custom Documents (API Builder)
50
-
48
+ #### Custom Documents (API Builder)
51
49
  ```js
52
50
  const mindee = require("mindee");
53
51
  // for TS or modules:
@@ -61,15 +59,23 @@ const mindeeClient = new mindee.Client({ apiKey: "my-api-key" })
61
59
  });
62
60
 
63
61
  // Load a file from disk and parse it
64
- const customResponse = mindeeClient
65
- .docFromPath("/path/to/the/wsnine.jpg")
62
+ const apiResponse = mindeeClient
63
+ .docFromPath("/path/to/the/file.ext")
66
64
  .parse(mindee.CustomV1, { endpointName: "wsnine" });
65
+ ```
67
66
 
67
+ ### Handling the Return
68
+ ```js
68
69
  // Print a brief summary of the parsed data
69
- customResponse.then((resp) => {
70
+ apiResponse.then((resp) => {
70
71
 
72
+ // The document property can be undefined:
73
+ // * TypeScript will throw an error without this guard clause
74
+ // (or consider using the '?' notation)
75
+ // * JavaScript will be very happy to produce subtle bugs
76
+ // without this guard clause
71
77
  if (resp.document === undefined) return;
72
-
78
+
73
79
  // full object
74
80
  console.log(resp.document);
75
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
package/src/cli.js CHANGED
@@ -5,59 +5,97 @@ const commander_1 = require("commander");
5
5
  const documents_1 = require("./documents");
6
6
  const api_1 = require("./api");
7
7
  const client_1 = require("./client");
8
+ const inputs_1 = require("./inputs");
8
9
  const program = new commander_1.Command();
9
- const COMMAND_INVOICE = "invoice";
10
- const COMMAND_RECEIPT = "receipt";
11
- const COMMAND_PASSPORT = "passport";
12
- const COMMAND_FINANCIAL = "financial";
13
- const COMMAND_FR_ID_CARD = "fr-id-card";
14
10
  const COMMAND_CUSTOM = "custom";
11
+ // The Map's key is the command name as it will appear on the console.
12
+ //
15
13
  const CLI_COMMAND_CONFIG = new Map([
16
14
  [
17
- COMMAND_INVOICE,
15
+ COMMAND_CUSTOM,
16
+ {
17
+ description: "A custom document",
18
+ docClass: documents_1.CustomV1,
19
+ fullText: false,
20
+ },
21
+ ],
22
+ [
23
+ "invoice",
18
24
  {
19
25
  description: "Invoice V3",
20
- docType: documents_1.DOC_TYPE_INVOICE_V3,
26
+ docClass: documents_1.InvoiceV3,
21
27
  fullText: true,
22
28
  },
23
29
  ],
24
30
  [
25
- COMMAND_RECEIPT,
31
+ "receipt",
26
32
  {
27
33
  description: "Expense Receipt V4",
28
- docType: documents_1.DOC_TYPE_RECEIPT_V4,
34
+ docClass: documents_1.ReceiptV4,
29
35
  fullText: true,
30
36
  },
31
37
  ],
32
38
  [
33
- COMMAND_PASSPORT,
39
+ "passport",
34
40
  {
35
41
  description: "Passport V1",
36
- docType: documents_1.DOC_TYPE_PASSPORT_V1,
42
+ docClass: documents_1.PassportV1,
37
43
  fullText: false,
38
44
  },
39
45
  ],
40
46
  [
41
- COMMAND_FINANCIAL,
47
+ "financial",
42
48
  {
43
49
  description: "Financial Document V1 (receipt or invoice)",
44
- docType: documents_1.DOC_TYPE_FINANCIAL_V1,
50
+ docClass: documents_1.FinancialDocumentV1,
45
51
  fullText: true,
46
52
  },
47
53
  ],
48
54
  [
49
- COMMAND_FR_ID_CARD,
55
+ "fr-id-card",
50
56
  {
51
57
  description: "FR ID Card V1",
52
- docType: documents_1.DOC_TYPE_IDCARD_V1,
58
+ docClass: documents_1.fr.IdCardV1,
53
59
  fullText: false,
54
60
  },
55
61
  ],
56
62
  [
57
- COMMAND_CUSTOM,
63
+ "fr-bank-account-details",
58
64
  {
59
- description: "A custom document",
60
- docType: documents_1.DOC_TYPE_CUSTOM,
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,
61
99
  fullText: false,
62
100
  },
63
101
  ],
@@ -78,41 +116,21 @@ async function predictCall(command, inputPath, options) {
78
116
  });
79
117
  }
80
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
+ }
81
127
  const predictParams = {
82
- docType: command === COMMAND_CUSTOM ? options.documentType : conf.docType,
83
- username: command === COMMAND_CUSTOM ? options.user : api_1.STANDARD_API_OWNER,
84
- 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,
85
130
  fullText: options.fullText,
131
+ pageOptions: pageOptions,
86
132
  };
87
- // Tried setting the response by using the responseClass property in constants.PRODUCTS_CONFIG
88
- // This compiled, but threw an exception:
89
- // TypeError: responseType is not a constructor
90
- //
91
- // So using a switch to explicitly set the response class parameter. Ugly, but works.
92
- // Improvements welcome!
93
- let response;
94
- switch (command) {
95
- case COMMAND_INVOICE:
96
- response = await doc.parse(documents_1.InvoiceV3, predictParams);
97
- break;
98
- case COMMAND_RECEIPT:
99
- response = await doc.parse(documents_1.ReceiptV4, predictParams);
100
- break;
101
- case COMMAND_FINANCIAL:
102
- response = await doc.parse(documents_1.FinancialDocumentV1, predictParams);
103
- break;
104
- case COMMAND_PASSPORT:
105
- response = await doc.parse(documents_1.PassportV1, predictParams);
106
- break;
107
- case COMMAND_FR_ID_CARD:
108
- response = await doc.parse(documents_1.IdCardV1, predictParams);
109
- break;
110
- case COMMAND_CUSTOM:
111
- response = await doc.parse(documents_1.CustomV1, predictParams);
112
- break;
113
- default:
114
- throw `Unhandled command: ${command}`;
115
- }
133
+ const response = await doc.parse(conf.docClass, predictParams);
116
134
  if (options.fullText) {
117
135
  response.pages.forEach((page) => {
118
136
  console.log(page.fullText?.toString());
@@ -134,7 +152,7 @@ function cli() {
134
152
  const prog = program.command(name);
135
153
  prog.description(info.description);
136
154
  prog.option("-k, --api-key <api_key>", "API key for document endpoint");
137
- prog.option("-C, --no-cut-pages", "Don't cut document pages");
155
+ prog.option("-c, --cut-pages", "Keep only the first 5 pages of the document.");
138
156
  prog.option("-p, --pages", "Show pages content");
139
157
  if (info.fullText) {
140
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 customConfigParams {
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(options?: ClientOptions);
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, }: customConfigParams): this;
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(options) {
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
@@ -97,9 +95,24 @@ class Client {
97
95
  this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.CropperV1.name], new documentConfig_1.DocumentConfig(documents_1.CropperV1, [
98
96
  new api_1.StandardEndpoint("cropper", "1", this.apiKey),
99
97
  ]));
100
- this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.IdCardV1.name], new documentConfig_1.DocumentConfig(documents_1.IdCardV1, [
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 { CropperField } from "../../fields";
2
+ import { PositionField } from "../../fields";
3
3
  export declare class CropperV1 extends Document {
4
- cropping: CropperField[];
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.CropperField({
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 { CropperField, FullText, OrientationField, stringDict } from "../fields";
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: CropperField[];
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.CropperField({
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;
@@ -11,6 +11,7 @@ class IdCardV1 extends document_1.Document {
11
11
  orientation: orientation,
12
12
  extras: extras,
13
13
  });
14
+ /** The list of the names of the person. */
14
15
  this.givenNames = [];
15
16
  this.authority = new fields_1.Field({
16
17
  prediction: prediction.authority,