mindee 4.8.1 → 4.9.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 (67) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +6 -3
  3. package/package.json +1 -1
  4. package/src/cli.js +42 -2
  5. package/src/client.d.ts +14 -1
  6. package/src/client.js +16 -14
  7. package/src/parsing/generated/generatedList.js +1 -4
  8. package/src/product/barcodeReader/barcodeReaderV1.js +6 -1
  9. package/src/product/cropper/cropperV1.js +6 -1
  10. package/src/product/eu/driverLicense/driverLicenseV1.d.ts +17 -0
  11. package/src/product/eu/driverLicense/driverLicenseV1.js +28 -0
  12. package/src/product/eu/driverLicense/driverLicenseV1Document.d.ts +36 -0
  13. package/src/product/eu/driverLicense/driverLicenseV1Document.js +79 -0
  14. package/src/product/eu/driverLicense/driverLicenseV1Page.d.ts +14 -0
  15. package/src/product/eu/driverLicense/driverLicenseV1Page.js +29 -0
  16. package/src/product/eu/driverLicense/internal.d.ts +2 -0
  17. package/src/product/eu/driverLicense/internal.js +7 -0
  18. package/src/product/eu/index.d.ts +1 -0
  19. package/src/product/eu/index.js +3 -1
  20. package/src/product/eu/internal.d.ts +1 -0
  21. package/src/product/eu/internal.js +2 -1
  22. package/src/product/eu/licensePlate/licensePlateV1.js +6 -1
  23. package/src/product/financialDocument/financialDocumentV1.js +6 -1
  24. package/src/product/fr/bankAccountDetails/bankAccountDetailsV1.js +6 -1
  25. package/src/product/fr/bankAccountDetails/bankAccountDetailsV2.js +6 -1
  26. package/src/product/fr/carteGrise/carteGriseV1.js +6 -1
  27. package/src/product/fr/carteVitale/carteVitaleV1.js +6 -1
  28. package/src/product/fr/idCard/idCardV1.js +6 -1
  29. package/src/product/fr/idCard/idCardV2.js +6 -1
  30. package/src/product/index.d.ts +3 -0
  31. package/src/product/index.js +7 -1
  32. package/src/product/internal.d.ts +2 -0
  33. package/src/product/internal.js +3 -1
  34. package/src/product/internationalId/internal.d.ts +4 -0
  35. package/src/product/internationalId/internal.js +11 -0
  36. package/src/product/internationalId/internationalIdV1.d.ts +16 -0
  37. package/src/product/internationalId/internationalIdV1.js +27 -0
  38. package/src/product/internationalId/internationalIdV1Document.d.ts +42 -0
  39. package/src/product/internationalId/internationalIdV1Document.js +101 -0
  40. package/src/product/internationalId/internationalIdV2.d.ts +16 -0
  41. package/src/product/internationalId/internationalIdV2.js +27 -0
  42. package/src/product/internationalId/internationalIdV2Document.d.ts +46 -0
  43. package/src/product/internationalId/internationalIdV2Document.js +111 -0
  44. package/src/product/invoice/invoiceV4.js +6 -1
  45. package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +6 -1
  46. package/src/product/passport/passportV1.js +6 -1
  47. package/src/product/proofOfAddress/proofOfAddressV1.js +6 -1
  48. package/src/product/receipt/receiptV5.js +6 -1
  49. package/src/product/resume/internal.d.ts +7 -0
  50. package/src/product/resume/internal.js +17 -0
  51. package/src/product/resume/resumeV1.d.ts +16 -0
  52. package/src/product/resume/resumeV1.js +27 -0
  53. package/src/product/resume/resumeV1Certificate.d.ts +34 -0
  54. package/src/product/resume/resumeV1Certificate.js +87 -0
  55. package/src/product/resume/resumeV1Document.d.ts +51 -0
  56. package/src/product/resume/resumeV1Document.js +197 -0
  57. package/src/product/resume/resumeV1Education.d.ts +40 -0
  58. package/src/product/resume/resumeV1Education.js +117 -0
  59. package/src/product/resume/resumeV1Language.d.ts +30 -0
  60. package/src/product/resume/resumeV1Language.js +67 -0
  61. package/src/product/resume/resumeV1ProfessionalExperience.d.ts +42 -0
  62. package/src/product/resume/resumeV1ProfessionalExperience.js +127 -0
  63. package/src/product/resume/resumeV1SocialNetworksUrl.d.ts +30 -0
  64. package/src/product/resume/resumeV1SocialNetworksUrl.js +67 -0
  65. package/src/product/us/bankCheck/bankCheckV1.js +6 -1
  66. package/src/product/us/driverLicense/driverLicenseV1.js +6 -1
  67. package/src/product/us/w9/w9V1.js +6 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.9.0 - 2024-02-21
4
+ ### Changes
5
+ * :sparkles: add support for resume V1
6
+ * :sparkles: add support for International ID v2
7
+ * :sparkles: add support for EU Driver License V1
8
+
9
+ ### Fixes
10
+ :memo: misc doc fixes
11
+
12
+ ## v4.8.2 - 2024-02-09
13
+ ### Changes
14
+ * :recycle: increased update time for async retries
15
+
16
+ ### Fixes
17
+ * :bug: fixed improper float parsing for Generated list objects
18
+ * :bug: typescript should now allow the use of default values for enqueueAndParse() async options
19
+
20
+
3
21
  ## v4.8.1 - 2024-02-06
4
22
  ### Fixes
5
23
  * :bug: fixed invalid code samples for generated & async generic APIs
package/README.md CHANGED
@@ -147,17 +147,20 @@ Complete details on the working of the library are available in the following gu
147
147
  * [Node.js Generated API](https://developers.mindee.com/docs/nodejs-generated-api)
148
148
  * [Node.js Custom OCR](https://developers.mindee.com/docs/nodejs-api-builder)
149
149
  * [Node.js Invoice OCR](https://developers.mindee.com/docs/nodejs-invoice-ocr)
150
+ * [Node.js International Id OCR](https://developers.mindee.com/docs/nodejs-international-id-ocr)
150
151
  * [Node.js Receipt OCR](https://developers.mindee.com/docs/nodejs-receipt-ocr)
152
+ * [Node.js Resume OCR](https://developers.mindee.com/docs/nodejs-resume-ocr)
151
153
  * [Node.js Financial Document OCR](https://developers.mindee.com/docs/nodejs-financial-document-ocr)
152
154
  * [Node.js Passport OCR](https://developers.mindee.com/docs/nodejs-passport-ocr)
153
155
  * [Node.js Proof of Address OCR](https://developers.mindee.com/docs/nodejs-proof-of-address-ocr)
154
156
  * [Node.js EU License Plate OCR](https://developers.mindee.com/docs/nodejs-eu-license-plates-ocr)
157
+ * [Node.js EU Driver License OCR](https://developers.mindee.com/docs/nodejs-eu-driver-license-ocr)
155
158
  * [Node.js FR Bank Account Detail OCR](https://developers.mindee.com/docs/nodejs-fr-bank-account-details-ocr)
156
159
  * [Node.js FR Carte Vitale OCR](https://developers.mindee.com/docs/nodejs-fr-carte-vitale-ocr)
157
160
  * [Node.js FR ID Card OCR](https://developers.mindee.com/docs/nodejs-fr-id-card-ocr)
158
161
  * [Node.js US Bank Check OCR](https://developers.mindee.com/docs/nodejs-us-bank-checks-ocr)
159
- * [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
160
- * [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
162
+ * [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
163
+ * [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
161
164
  * [Node.js Barcode Reader API](https://developers.mindee.com/docs/nodejs-barcode-reader-api)
162
165
  * [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-api)
163
166
  * [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-api)
@@ -171,4 +174,4 @@ Copyright © Mindee
171
174
  Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
172
175
 
173
176
  ## Questions?
174
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
177
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.8.1",
3
+ "version": "4.9.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
@@ -68,6 +68,16 @@ const CLI_COMMAND_CONFIG = new Map([
68
68
  sync: true,
69
69
  },
70
70
  ],
71
+ [
72
+ "international-id",
73
+ {
74
+ displayName: "International Id",
75
+ docClass: product.InternationalIdV2,
76
+ allWords: false,
77
+ async: true,
78
+ sync: false,
79
+ },
80
+ ],
71
81
  [
72
82
  "invoice",
73
83
  {
@@ -98,6 +108,16 @@ const CLI_COMMAND_CONFIG = new Map([
98
108
  sync: true,
99
109
  },
100
110
  ],
111
+ [
112
+ "resume",
113
+ {
114
+ displayName: "Resume",
115
+ docClass: product.ResumeV1,
116
+ allWords: false,
117
+ async: true,
118
+ sync: false,
119
+ },
120
+ ],
101
121
  [
102
122
  "passport",
103
123
  {
@@ -158,6 +178,16 @@ const CLI_COMMAND_CONFIG = new Map([
158
178
  sync: true,
159
179
  },
160
180
  ],
181
+ [
182
+ "eu-driver-license",
183
+ {
184
+ displayName: "EU Driver License",
185
+ docClass: product.eu.DriverLicenseV1,
186
+ allWords: false,
187
+ async: false,
188
+ sync: true,
189
+ },
190
+ ],
161
191
  [
162
192
  "us-bank-check",
163
193
  {
@@ -168,6 +198,16 @@ const CLI_COMMAND_CONFIG = new Map([
168
198
  sync: true,
169
199
  },
170
200
  ],
201
+ [
202
+ "us-driver-license",
203
+ {
204
+ displayName: "US Driver License",
205
+ docClass: product.us.DriverLicenseV1,
206
+ allWords: false,
207
+ async: false,
208
+ sync: true,
209
+ },
210
+ ],
171
211
  ]);
172
212
  //
173
213
  // EXECUTE THE COMMANDS
@@ -241,7 +281,7 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
241
281
  cropper: predictParams.cropper,
242
282
  initialDelaySec: 4,
243
283
  delaySec: 2,
244
- maxRetries: 30,
284
+ maxRetries: 60,
245
285
  });
246
286
  }
247
287
  else {
@@ -251,7 +291,7 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
251
291
  cropper: predictParams.cropper,
252
292
  initialDelaySec: 4,
253
293
  delaySec: 2,
254
- maxRetries: 30,
294
+ maxRetries: 60,
255
295
  });
256
296
  if (!response.document) {
257
297
  throw Error("Document could not be retrieved");
package/src/client.d.ts CHANGED
@@ -32,6 +32,19 @@ export interface PredictOptions {
32
32
  /**
33
33
  * Asynchronous polling parameters.
34
34
  */
35
+ export interface OptionalAsyncOptions extends PredictOptions {
36
+ initialDelaySec?: number;
37
+ delaySec?: number;
38
+ maxRetries?: number;
39
+ initialTimerOptions?: {
40
+ ref?: boolean;
41
+ signal?: AbortSignal;
42
+ };
43
+ recurringTimerOptions?: {
44
+ ref?: boolean;
45
+ signal?: AbortSignal;
46
+ };
47
+ }
35
48
  export interface AsyncOptions extends PredictOptions {
36
49
  initialDelaySec: number;
37
50
  delaySec: number;
@@ -139,7 +152,7 @@ export declare class Client {
139
152
  * @category Synchronous
140
153
  * @returns a `Promise` containing parsing results.
141
154
  */
142
- enqueueAndParse<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, asyncParams?: AsyncOptions): Promise<AsyncPredictResponse<T>>;
155
+ enqueueAndParse<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, asyncParams?: OptionalAsyncOptions): Promise<AsyncPredictResponse<T>>;
143
156
  /**
144
157
  * Forces boolean coercion on truthy/falsy parameters.
145
158
  * @param param input parameter to check.
package/src/client.js CHANGED
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
5
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
6
  };
7
- var _Client_instances, _Client_validateAsyncParams, _Client_buildProductEndpoint, _Client_buildApiSettings, _Client_initializeOTSEndpoint, _Client_cleanAccountName, _Client_getOtsEndpoint;
7
+ var _Client_instances, _Client_setAsyncParams, _Client_buildProductEndpoint, _Client_buildApiSettings, _Client_initializeOTSEndpoint, _Client_cleanAccountName, _Client_getOtsEndpoint;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Client = void 0;
10
10
  const input_1 = require("./input");
@@ -155,34 +155,34 @@ class Client {
155
155
  pageOptions: undefined,
156
156
  initialDelaySec: 4,
157
157
  delaySec: 2,
158
- maxRetries: 30,
158
+ maxRetries: 60,
159
159
  initialTimerOptions: undefined,
160
160
  recurringTimerOptions: undefined,
161
161
  }) {
162
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_validateAsyncParams).call(this, asyncParams);
162
+ const validatedAsyncParams = __classPrivateFieldGet(this, _Client_instances, "m", _Client_setAsyncParams).call(this, asyncParams);
163
163
  const enqueueResponse = await this.enqueue(productClass, inputSource, asyncParams);
164
164
  if (enqueueResponse.job.id === undefined || enqueueResponse.job.id.length === 0) {
165
165
  throw Error("Enqueueing of the document failed.");
166
166
  }
167
167
  const queueId = enqueueResponse.job.id;
168
168
  logger_1.logger.debug(`Successfully enqueued document with job id: ${queueId}.`);
169
- await (0, promises_1.setTimeout)(asyncParams.initialDelaySec * 1000, undefined, asyncParams.initialTimerOptions);
169
+ await (0, promises_1.setTimeout)(validatedAsyncParams.initialDelaySec * 1000, undefined, asyncParams.initialTimerOptions);
170
170
  let retryCounter = 1;
171
171
  let pollResults;
172
172
  pollResults = await this.parseQueued(productClass, queueId, asyncParams);
173
- while (retryCounter < asyncParams.maxRetries) {
173
+ while (retryCounter < validatedAsyncParams.maxRetries) {
174
174
  logger_1.logger.debug(`Polling server for parsing result with queueId: ${queueId}.
175
175
  Attempt n°${retryCounter}/${asyncParams.maxRetries}.
176
176
  Job status: ${pollResults.job.status}.`);
177
177
  if (pollResults.job.status === "completed") {
178
178
  break;
179
179
  }
180
- await (0, promises_1.setTimeout)(asyncParams.delaySec * 1000, undefined, asyncParams.recurringTimerOptions);
180
+ await (0, promises_1.setTimeout)(validatedAsyncParams.delaySec * 1000, undefined, asyncParams.recurringTimerOptions);
181
181
  pollResults = await this.parseQueued(productClass, queueId, asyncParams);
182
182
  retryCounter++;
183
183
  }
184
184
  if (pollResults.job.status !== "completed") {
185
- throw Error(`Asynchronous parsing request timed out after ${asyncParams.delaySec * retryCounter} seconds`);
185
+ throw Error(`Asynchronous parsing request timed out after ${validatedAsyncParams.delaySec * retryCounter} seconds`);
186
186
  }
187
187
  return pollResults;
188
188
  }
@@ -282,22 +282,24 @@ Job status: ${pollResults.job.status}.`);
282
282
  }
283
283
  }
284
284
  exports.Client = Client;
285
- _Client_instances = new WeakSet(), _Client_validateAsyncParams = function _Client_validateAsyncParams(asyncParams) {
285
+ _Client_instances = new WeakSet(), _Client_setAsyncParams = function _Client_setAsyncParams(asyncParams) {
286
286
  const minDelaySec = 1;
287
287
  const minInitialDelay = 2;
288
288
  const minRetries = 2;
289
- asyncParams.delaySec ?? (asyncParams.delaySec = 2);
290
- asyncParams.initialDelaySec ?? (asyncParams.initialDelaySec = 4);
291
- asyncParams.maxRetries ?? (asyncParams.maxRetries = 30);
292
- if (asyncParams.delaySec < minDelaySec) {
289
+ const newAsyncParams = { ...asyncParams };
290
+ newAsyncParams.delaySec ?? (newAsyncParams.delaySec = 2);
291
+ newAsyncParams.initialDelaySec ?? (newAsyncParams.initialDelaySec = 4);
292
+ newAsyncParams.maxRetries ?? (newAsyncParams.maxRetries = 60);
293
+ if (newAsyncParams.delaySec < minDelaySec) {
293
294
  throw Error(`Cannot set auto-parsing delay to less than ${minDelaySec} seconds.`);
294
295
  }
295
- if (asyncParams.initialDelaySec < minInitialDelay) {
296
+ if (newAsyncParams.initialDelaySec < minInitialDelay) {
296
297
  throw Error(`Cannot set initial parsing delay to less than ${minInitialDelay} seconds.`);
297
298
  }
298
- if (asyncParams.maxRetries < minRetries) {
299
+ if (newAsyncParams.maxRetries < minRetries) {
299
300
  throw Error(`Cannot set retry to less than ${minRetries}.`);
300
301
  }
302
+ return newAsyncParams;
301
303
  }, _Client_buildProductEndpoint = function _Client_buildProductEndpoint(endpointName, accountName, endpointVersion) {
302
304
  return new http_1.Endpoint(endpointName, accountName, endpointVersion, __classPrivateFieldGet(this, _Client_instances, "m", _Client_buildApiSettings).call(this));
303
305
  }, _Client_buildApiSettings = function _Client_buildApiSettings() {
@@ -18,10 +18,7 @@ class GeneratedListField {
18
18
  }
19
19
  else {
20
20
  const valueStr = { ...value };
21
- if (valueStr["value"] !== null && valueStr["value"] !== undefined && !isNaN(valueStr["value"])) {
22
- valueStr["value"] = value["value"].toFixed(1);
23
- }
24
- else if (value["value"] !== undefined && value["value"] !== null) {
21
+ if (valueStr["value"] !== null && valueStr["value"] !== undefined) {
25
22
  valueStr["value"] = value["value"].toString();
26
23
  }
27
24
  this.values.push(new standard_1.StringField({ prediction: valueStr, pageId: pageId }));
@@ -16,7 +16,12 @@ class BarcodeReaderV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new barcodeReaderV1Document_1.BarcodeReaderV1Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(barcodeReaderV1Document_1.BarcodeReaderV1Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(barcodeReaderV1Document_1.BarcodeReaderV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.BarcodeReaderV1 = BarcodeReaderV1;
@@ -17,7 +17,12 @@ class CropperV1 extends common_1.Inference {
17
17
  /** The document's pages. */
18
18
  this.pages = [];
19
19
  this.prediction = new cropperV1Document_1.CropperV1Document();
20
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(cropperV1Page_1.CropperV1Page, page, page["id"], page["orientation"]));
20
+ rawPrediction["pages"].forEach((page) => {
21
+ if (page.prediction !== undefined && page.prediction !== null &&
22
+ Object.keys(page.prediction).length > 0) {
23
+ this.pages.push(new common_1.Page(cropperV1Page_1.CropperV1Page, page, page["id"], page["orientation"]));
24
+ }
25
+ });
21
26
  }
22
27
  }
23
28
  exports.CropperV1 = CropperV1;
@@ -0,0 +1,17 @@
1
+ import { Inference, StringDict, Page } from "../../../parsing/common";
2
+ import { DriverLicenseV1Document } from "./driverLicenseV1Document";
3
+ import { DriverLicenseV1Page } from "./driverLicenseV1Page";
4
+ /**
5
+ * Inference prediction for Driver License, API version 1.
6
+ */
7
+ export declare class DriverLicenseV1 extends Inference {
8
+ /** The endpoint's name. */
9
+ endpointName: string;
10
+ /** The endpoint's version. */
11
+ endpointVersion: string;
12
+ /** The document-level prediction. */
13
+ prediction: DriverLicenseV1Document;
14
+ /** The document's pages. */
15
+ pages: Page<DriverLicenseV1Page>[];
16
+ constructor(rawPrediction: StringDict);
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DriverLicenseV1 = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const driverLicenseV1Document_1 = require("./driverLicenseV1Document");
6
+ const driverLicenseV1Page_1 = require("./driverLicenseV1Page");
7
+ /**
8
+ * Inference prediction for Driver License, API version 1.
9
+ */
10
+ class DriverLicenseV1 extends common_1.Inference {
11
+ constructor(rawPrediction) {
12
+ super(rawPrediction);
13
+ /** The endpoint's name. */
14
+ this.endpointName = "eu_driver_license";
15
+ /** The endpoint's version. */
16
+ this.endpointVersion = "1";
17
+ /** The document's pages. */
18
+ this.pages = [];
19
+ this.prediction = new driverLicenseV1Document_1.DriverLicenseV1Document(rawPrediction["prediction"]);
20
+ rawPrediction["pages"].forEach((page) => {
21
+ if (page.prediction !== undefined && page.prediction !== null &&
22
+ Object.keys(page.prediction).length > 0) {
23
+ this.pages.push(new common_1.Page(driverLicenseV1Page_1.DriverLicenseV1Page, page, page["id"], page["orientation"]));
24
+ }
25
+ });
26
+ }
27
+ }
28
+ exports.DriverLicenseV1 = DriverLicenseV1;
@@ -0,0 +1,36 @@
1
+ import { Prediction, StringDict } from "../../../parsing/common";
2
+ import { DateField, StringField } from "../../../parsing/standard";
3
+ /**
4
+ * Document data for Driver License, API version 1.
5
+ */
6
+ export declare class DriverLicenseV1Document implements Prediction {
7
+ /** EU driver license holders address */
8
+ address: StringField;
9
+ /** EU driver license holders categories */
10
+ category: StringField;
11
+ /** Country code extracted as a string. */
12
+ countryCode: StringField;
13
+ /** The date of birth of the document holder */
14
+ dateOfBirth: DateField;
15
+ /** ID number of the Document. */
16
+ documentId: StringField;
17
+ /** Date the document expires */
18
+ expiryDate: DateField;
19
+ /** First name(s) of the driver license holder */
20
+ firstName: StringField;
21
+ /** Authority that issued the document */
22
+ issueAuthority: StringField;
23
+ /** Date the document was issued */
24
+ issueDate: DateField;
25
+ /** Last name of the driver license holder. */
26
+ lastName: StringField;
27
+ /** Machine-readable license number */
28
+ mrz: StringField;
29
+ /** Place where the driver license holder was born */
30
+ placeOfBirth: StringField;
31
+ constructor(rawPrediction: StringDict, pageId?: number);
32
+ /**
33
+ * Default string representation.
34
+ */
35
+ toString(): string;
36
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DriverLicenseV1Document = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const standard_1 = require("../../../parsing/standard");
6
+ /**
7
+ * Document data for Driver License, API version 1.
8
+ */
9
+ class DriverLicenseV1Document {
10
+ constructor(rawPrediction, pageId) {
11
+ this.address = new standard_1.StringField({
12
+ prediction: rawPrediction["address"],
13
+ pageId: pageId,
14
+ });
15
+ this.category = new standard_1.StringField({
16
+ prediction: rawPrediction["category"],
17
+ pageId: pageId,
18
+ });
19
+ this.countryCode = new standard_1.StringField({
20
+ prediction: rawPrediction["country_code"],
21
+ pageId: pageId,
22
+ });
23
+ this.dateOfBirth = new standard_1.DateField({
24
+ prediction: rawPrediction["date_of_birth"],
25
+ pageId: pageId,
26
+ });
27
+ this.documentId = new standard_1.StringField({
28
+ prediction: rawPrediction["document_id"],
29
+ pageId: pageId,
30
+ });
31
+ this.expiryDate = new standard_1.DateField({
32
+ prediction: rawPrediction["expiry_date"],
33
+ pageId: pageId,
34
+ });
35
+ this.firstName = new standard_1.StringField({
36
+ prediction: rawPrediction["first_name"],
37
+ pageId: pageId,
38
+ });
39
+ this.issueAuthority = new standard_1.StringField({
40
+ prediction: rawPrediction["issue_authority"],
41
+ pageId: pageId,
42
+ });
43
+ this.issueDate = new standard_1.DateField({
44
+ prediction: rawPrediction["issue_date"],
45
+ pageId: pageId,
46
+ });
47
+ this.lastName = new standard_1.StringField({
48
+ prediction: rawPrediction["last_name"],
49
+ pageId: pageId,
50
+ });
51
+ this.mrz = new standard_1.StringField({
52
+ prediction: rawPrediction["mrz"],
53
+ pageId: pageId,
54
+ });
55
+ this.placeOfBirth = new standard_1.StringField({
56
+ prediction: rawPrediction["place_of_birth"],
57
+ pageId: pageId,
58
+ });
59
+ }
60
+ /**
61
+ * Default string representation.
62
+ */
63
+ toString() {
64
+ const outStr = `:Country Code: ${this.countryCode}
65
+ :Document ID: ${this.documentId}
66
+ :Driver License Category: ${this.category}
67
+ :Last Name: ${this.lastName}
68
+ :First Name: ${this.firstName}
69
+ :Date Of Birth: ${this.dateOfBirth}
70
+ :Place Of Birth: ${this.placeOfBirth}
71
+ :Expiry Date: ${this.expiryDate}
72
+ :Issue Date: ${this.issueDate}
73
+ :Issue Authority: ${this.issueAuthority}
74
+ :MRZ: ${this.mrz}
75
+ :Address: ${this.address}`.trimEnd();
76
+ return (0, common_1.cleanOutString)(outStr);
77
+ }
78
+ }
79
+ exports.DriverLicenseV1Document = DriverLicenseV1Document;
@@ -0,0 +1,14 @@
1
+ import { StringDict } from "../../../parsing/common";
2
+ import { PositionField } from "../../../parsing/standard";
3
+ import { DriverLicenseV1Document } from "./driverLicenseV1Document";
4
+ /**
5
+ * Page data for Driver License, API version 1.
6
+ */
7
+ export declare class DriverLicenseV1Page extends DriverLicenseV1Document {
8
+ /** Has a photo of the EU driver license holder */
9
+ photo: PositionField;
10
+ /** Has a signature of the EU driver license holder */
11
+ signature: PositionField;
12
+ constructor(rawPrediction: StringDict, pageId?: number);
13
+ toString(): string;
14
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DriverLicenseV1Page = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const standard_1 = require("../../../parsing/standard");
6
+ const driverLicenseV1Document_1 = require("./driverLicenseV1Document");
7
+ /**
8
+ * Page data for Driver License, API version 1.
9
+ */
10
+ class DriverLicenseV1Page extends driverLicenseV1Document_1.DriverLicenseV1Document {
11
+ constructor(rawPrediction, pageId) {
12
+ super(rawPrediction, pageId);
13
+ this.photo = new standard_1.PositionField({
14
+ prediction: rawPrediction["photo"],
15
+ pageId: pageId,
16
+ });
17
+ this.signature = new standard_1.PositionField({
18
+ prediction: rawPrediction["signature"],
19
+ pageId: pageId,
20
+ });
21
+ }
22
+ toString() {
23
+ let outStr = `:Photo: ${this.photo}
24
+ :Signature: ${this.signature}`.trimEnd();
25
+ outStr += "\n" + super.toString();
26
+ return (0, common_1.cleanOutString)(outStr);
27
+ }
28
+ }
29
+ exports.DriverLicenseV1Page = DriverLicenseV1Page;
@@ -0,0 +1,2 @@
1
+ export { DriverLicenseV1 } from "./driverLicenseV1";
2
+ export { DriverLicenseV1Document } from "./driverLicenseV1Document";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DriverLicenseV1Document = exports.DriverLicenseV1 = void 0;
4
+ var driverLicenseV1_1 = require("./driverLicenseV1");
5
+ Object.defineProperty(exports, "DriverLicenseV1", { enumerable: true, get: function () { return driverLicenseV1_1.DriverLicenseV1; } });
6
+ var driverLicenseV1Document_1 = require("./driverLicenseV1Document");
7
+ Object.defineProperty(exports, "DriverLicenseV1Document", { enumerable: true, get: function () { return driverLicenseV1Document_1.DriverLicenseV1Document; } });
@@ -1 +1,2 @@
1
1
  export { LicensePlateV1 } from "./licensePlate/licensePlateV1";
2
+ export { DriverLicenseV1 } from "./driverLicense/driverLicenseV1";
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LicensePlateV1 = void 0;
3
+ exports.DriverLicenseV1 = exports.LicensePlateV1 = void 0;
4
4
  var licensePlateV1_1 = require("./licensePlate/licensePlateV1");
5
5
  Object.defineProperty(exports, "LicensePlateV1", { enumerable: true, get: function () { return licensePlateV1_1.LicensePlateV1; } });
6
+ var driverLicenseV1_1 = require("./driverLicense/driverLicenseV1");
7
+ Object.defineProperty(exports, "DriverLicenseV1", { enumerable: true, get: function () { return driverLicenseV1_1.DriverLicenseV1; } });
@@ -1 +1,2 @@
1
1
  export * as licensePlate from "./licensePlate/internal";
2
+ export * as driverLicense from "./driverLicense/internal";
@@ -23,5 +23,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.licensePlate = void 0;
26
+ exports.driverLicense = exports.licensePlate = void 0;
27
27
  exports.licensePlate = __importStar(require("./licensePlate/internal"));
28
+ exports.driverLicense = __importStar(require("./driverLicense/internal"));
@@ -16,7 +16,12 @@ class LicensePlateV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new licensePlateV1Document_1.LicensePlateV1Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(licensePlateV1Document_1.LicensePlateV1Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(licensePlateV1Document_1.LicensePlateV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.LicensePlateV1 = LicensePlateV1;
@@ -16,7 +16,12 @@ class FinancialDocumentV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new financialDocumentV1Document_1.FinancialDocumentV1Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(financialDocumentV1Document_1.FinancialDocumentV1Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(financialDocumentV1Document_1.FinancialDocumentV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.FinancialDocumentV1 = FinancialDocumentV1;
@@ -16,7 +16,12 @@ class BankAccountDetailsV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new bankAccountDetailsV1Document_1.BankAccountDetailsV1Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(bankAccountDetailsV1Document_1.BankAccountDetailsV1Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(bankAccountDetailsV1Document_1.BankAccountDetailsV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.BankAccountDetailsV1 = BankAccountDetailsV1;
@@ -16,7 +16,12 @@ class BankAccountDetailsV2 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new bankAccountDetailsV2Document_1.BankAccountDetailsV2Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(bankAccountDetailsV2Document_1.BankAccountDetailsV2Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(bankAccountDetailsV2Document_1.BankAccountDetailsV2Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.BankAccountDetailsV2 = BankAccountDetailsV2;
@@ -16,7 +16,12 @@ class CarteGriseV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
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"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(carteGriseV1Document_1.CarteGriseV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.CarteGriseV1 = CarteGriseV1;
@@ -16,7 +16,12 @@ class CarteVitaleV1 extends common_1.Inference {
16
16
  /** The document's pages. */
17
17
  this.pages = [];
18
18
  this.prediction = new carteVitaleV1Document_1.CarteVitaleV1Document(rawPrediction["prediction"]);
19
- this.pages = rawPrediction["pages"].map((page) => new common_1.Page(carteVitaleV1Document_1.CarteVitaleV1Document, page, page["id"], page["orientation"]));
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(carteVitaleV1Document_1.CarteVitaleV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
20
25
  }
21
26
  }
22
27
  exports.CarteVitaleV1 = CarteVitaleV1;