mindee 4.27.1 → 4.29.0-rc1

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 (116) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +0 -21
  3. package/package.json +10 -9
  4. package/src/baseClient.d.ts +38 -0
  5. package/src/baseClient.js +69 -0
  6. package/src/cli.js +17 -7
  7. package/src/cliProducts.js +17 -7
  8. package/src/client.d.ts +3 -37
  9. package/src/client.js +11 -72
  10. package/src/clientV2.d.ts +156 -0
  11. package/src/clientV2.js +155 -0
  12. package/src/errors/mindeeError.d.ts +8 -0
  13. package/src/errors/mindeeError.js +17 -1
  14. package/src/http/apiSettings.d.ts +2 -8
  15. package/src/http/apiSettings.js +3 -41
  16. package/src/http/apiSettingsV2.d.ts +10 -0
  17. package/src/http/apiSettingsV2.js +46 -0
  18. package/src/http/baseEndpoint.d.ts +2 -2
  19. package/src/http/baseEndpoint.js +3 -3
  20. package/src/http/baseSettings.d.ts +11 -0
  21. package/src/http/baseSettings.js +59 -0
  22. package/src/http/endpoint.js +6 -6
  23. package/src/http/mindeeApiV2.d.ts +34 -0
  24. package/src/http/mindeeApiV2.js +120 -0
  25. package/src/http/workflowEndpoint.js +2 -2
  26. package/src/imageOperations/common/imageExtractor.d.ts +2 -2
  27. package/src/imageOperations/common/imageExtractor.js +1 -1
  28. package/src/imageOperations/imageCompressor.d.ts +1 -1
  29. package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +5 -2
  30. package/src/imageOperations/multiReceiptsExtractor/multiReceiptsExtractor.js +5 -2
  31. package/src/index.d.ts +1 -0
  32. package/src/index.js +20 -8
  33. package/src/input/localResponse.d.ts +13 -0
  34. package/src/input/localResponse.js +36 -7
  35. package/src/input/sources/localInputSource.d.ts +6 -0
  36. package/src/input/sources/localInputSource.js +26 -8
  37. package/src/internal.js +17 -7
  38. package/src/parsing/common/dateParser.d.ts +1 -0
  39. package/src/parsing/common/dateParser.js +12 -0
  40. package/src/parsing/common/document.js +1 -0
  41. package/src/parsing/common/execution.d.ts +0 -1
  42. package/src/parsing/common/execution.js +5 -9
  43. package/src/parsing/common/index.d.ts +1 -0
  44. package/src/parsing/common/index.js +20 -8
  45. package/src/parsing/index.d.ts +1 -0
  46. package/src/parsing/index.js +19 -8
  47. package/src/parsing/standard/addressField.d.ts +25 -0
  48. package/src/parsing/standard/addressField.js +40 -0
  49. package/src/parsing/standard/index.d.ts +10 -9
  50. package/src/parsing/standard/index.js +19 -17
  51. package/src/parsing/v2/commonResponse.d.ts +16 -0
  52. package/src/parsing/v2/commonResponse.js +19 -0
  53. package/src/parsing/v2/errorResponse.d.ts +15 -0
  54. package/src/parsing/v2/errorResponse.js +13 -0
  55. package/src/parsing/v2/field/baseField.d.ts +9 -0
  56. package/src/parsing/v2/field/baseField.js +18 -0
  57. package/src/parsing/v2/field/fieldConfidence.d.ts +9 -0
  58. package/src/parsing/v2/field/fieldConfidence.js +13 -0
  59. package/src/parsing/v2/field/fieldFactory.d.ts +8 -0
  60. package/src/parsing/v2/field/fieldFactory.js +22 -0
  61. package/src/parsing/v2/field/fieldLocation.d.ts +13 -0
  62. package/src/parsing/v2/field/fieldLocation.js +18 -0
  63. package/src/parsing/v2/field/index.d.ts +6 -0
  64. package/src/parsing/v2/field/index.js +15 -0
  65. package/src/parsing/v2/field/inferenceFields.d.ts +9 -0
  66. package/src/parsing/v2/field/inferenceFields.js +38 -0
  67. package/src/parsing/v2/field/listField.d.ts +12 -0
  68. package/src/parsing/v2/field/listField.js +36 -0
  69. package/src/parsing/v2/field/objectField.d.ts +9 -0
  70. package/src/parsing/v2/field/objectField.js +18 -0
  71. package/src/parsing/v2/field/simpleField.d.ts +7 -0
  72. package/src/parsing/v2/field/simpleField.js +17 -0
  73. package/src/parsing/v2/index.d.ts +12 -0
  74. package/src/parsing/v2/index.js +27 -0
  75. package/src/parsing/v2/inference.d.ts +24 -0
  76. package/src/parsing/v2/inference.js +26 -0
  77. package/src/parsing/v2/inferenceResponse.d.ts +10 -0
  78. package/src/parsing/v2/inferenceResponse.js +12 -0
  79. package/src/parsing/v2/inferenceResult.d.ts +15 -0
  80. package/src/parsing/v2/inferenceResult.js +25 -0
  81. package/src/parsing/v2/inferenceResultFile.d.ts +13 -0
  82. package/src/parsing/v2/inferenceResultFile.js +16 -0
  83. package/src/parsing/v2/inferenceResultModel.d.ts +8 -0
  84. package/src/parsing/v2/inferenceResultModel.js +9 -0
  85. package/src/parsing/v2/inferenceResultOptions.d.ts +9 -0
  86. package/src/parsing/v2/inferenceResultOptions.js +10 -0
  87. package/src/parsing/v2/job.d.ts +49 -0
  88. package/src/parsing/v2/job.js +29 -0
  89. package/src/parsing/v2/jobResponse.d.ts +10 -0
  90. package/src/parsing/v2/jobResponse.js +12 -0
  91. package/src/parsing/v2/jobResponseWebhook.d.ts +24 -0
  92. package/src/parsing/v2/jobResponseWebhook.js +19 -0
  93. package/src/parsing/v2/rawText.d.ts +15 -0
  94. package/src/parsing/v2/rawText.js +13 -0
  95. package/src/pdf/pdfCompressor.js +22 -9
  96. package/src/pdf/pdfOperation.js +3 -1
  97. package/src/product/financialDocument/financialDocumentV1Document.d.ts +8 -8
  98. package/src/product/financialDocument/financialDocumentV1Document.js +5 -5
  99. package/src/product/fr/internal.js +17 -7
  100. package/src/product/ind/indianPassport/indianPassportV1Document.js +1 -1
  101. package/src/product/ind/internal.js +17 -7
  102. package/src/product/index.js +17 -7
  103. package/src/product/internal.js +17 -7
  104. package/src/product/internationalId/internationalIdV2Document.d.ts +1 -1
  105. package/src/product/internationalId/internationalIdV2Document.js +1 -1
  106. package/src/product/invoice/invoiceV4Document.d.ts +10 -6
  107. package/src/product/invoice/invoiceV4Document.js +13 -5
  108. package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +1 -1
  109. package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -1
  110. package/src/product/receipt/receiptV5Document.d.ts +1 -1
  111. package/src/product/receipt/receiptV5Document.js +1 -1
  112. package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +3 -3
  113. package/src/product/us/healthcareCard/healthcareCardV1Copay.js +1 -1
  114. package/src/product/us/healthcareCard/healthcareCardV1Document.d.ts +4 -2
  115. package/src/product/us/healthcareCard/healthcareCardV1Document.js +8 -3
  116. package/src/product/us/internal.js +17 -7
@@ -0,0 +1,49 @@
1
+ import { StringDict } from "../common";
2
+ import { ErrorResponse } from "./errorResponse";
3
+ import { JobResponseWebhook } from "./jobResponseWebhook";
4
+ /**
5
+ * Job information for a V2 polling attempt.
6
+ */
7
+ export declare class Job {
8
+ /**
9
+ * Job ID.
10
+ */
11
+ id: string;
12
+ /**
13
+ * Error response if any.
14
+ */
15
+ error?: ErrorResponse;
16
+ /**
17
+ * Timestamp of the job creation.
18
+ */
19
+ createdAt: Date | null;
20
+ /**
21
+ * ID of the model.
22
+ */
23
+ modelId: string;
24
+ /**
25
+ * Name for the file.
26
+ */
27
+ filename: string;
28
+ /**
29
+ * Optional alias for the file.
30
+ */
31
+ alias: string;
32
+ /**
33
+ * Status of the job.
34
+ */
35
+ status?: string;
36
+ /**
37
+ * URL to poll for the job status.
38
+ */
39
+ pollingUrl: string;
40
+ /**
41
+ * URL to poll for the job result, redirects to the result if available.
42
+ */
43
+ resultUrl?: string;
44
+ /**
45
+ * ID of webhooks associated with the job.
46
+ */
47
+ webhooks: Array<JobResponseWebhook>;
48
+ constructor(serverResponse: StringDict);
49
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Job = void 0;
4
+ const errorResponse_1 = require("./errorResponse");
5
+ const dateParser_1 = require("../common/dateParser");
6
+ /**
7
+ * Job information for a V2 polling attempt.
8
+ */
9
+ class Job {
10
+ constructor(serverResponse) {
11
+ this.id = serverResponse["id"];
12
+ if (serverResponse["status"] !== undefined) {
13
+ this.status = serverResponse["status"];
14
+ }
15
+ if (serverResponse["error"] !== undefined &&
16
+ serverResponse["error"] !== null &&
17
+ Object.keys(serverResponse["error"]).length > 0) {
18
+ this.error = new errorResponse_1.ErrorResponse(serverResponse["error"]);
19
+ }
20
+ this.createdAt = (0, dateParser_1.parseDate)(serverResponse["created_at"]);
21
+ this.modelId = serverResponse["model_id"];
22
+ this.pollingUrl = serverResponse["polling_url"];
23
+ this.filename = serverResponse["filename"];
24
+ this.resultUrl = serverResponse["result_url"];
25
+ this.alias = serverResponse["alias"];
26
+ this.webhooks = serverResponse["webhooks"];
27
+ }
28
+ }
29
+ exports.Job = Job;
@@ -0,0 +1,10 @@
1
+ import { CommonResponse } from "./commonResponse";
2
+ import { StringDict } from "../common";
3
+ import { Job } from "./job";
4
+ export declare class JobResponse extends CommonResponse {
5
+ /**
6
+ * Job for the polling.
7
+ */
8
+ job: Job;
9
+ constructor(serverResponse: StringDict);
10
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JobResponse = void 0;
4
+ const commonResponse_1 = require("./commonResponse");
5
+ const job_1 = require("./job");
6
+ class JobResponse extends commonResponse_1.CommonResponse {
7
+ constructor(serverResponse) {
8
+ super(serverResponse);
9
+ this.job = new job_1.Job(serverResponse["job"]);
10
+ }
11
+ }
12
+ exports.JobResponse = JobResponse;
@@ -0,0 +1,24 @@
1
+ import { ErrorResponse } from "./errorResponse";
2
+ import { StringDict } from "../common";
3
+ /**
4
+ * JobResponseWebhook information.
5
+ */
6
+ export declare class JobResponseWebhook {
7
+ /**
8
+ * JobResponseWebhook ID.
9
+ */
10
+ id: string;
11
+ /**
12
+ * Created at date.
13
+ */
14
+ createdAt: Date | null;
15
+ /**
16
+ * Status of the webhook.
17
+ */
18
+ status: string;
19
+ /**
20
+ * Error response, if any.
21
+ */
22
+ error?: ErrorResponse;
23
+ constructor(serverResponse: StringDict);
24
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JobResponseWebhook = void 0;
4
+ const errorResponse_1 = require("./errorResponse");
5
+ const common_1 = require("../common");
6
+ /**
7
+ * JobResponseWebhook information.
8
+ */
9
+ class JobResponseWebhook {
10
+ constructor(serverResponse) {
11
+ this.id = serverResponse["id"];
12
+ this.createdAt = (0, common_1.parseDate)(serverResponse["created_at"]);
13
+ this.status = serverResponse["status"];
14
+ if (serverResponse["error"] !== undefined) {
15
+ this.error = new errorResponse_1.ErrorResponse(serverResponse["error"]);
16
+ }
17
+ }
18
+ }
19
+ exports.JobResponseWebhook = JobResponseWebhook;
@@ -0,0 +1,15 @@
1
+ import { StringDict } from "../common";
2
+ export declare class RawText {
3
+ /**
4
+ * The page number the text was found on.
5
+ */
6
+ page: number;
7
+ /**
8
+ * The text content found on the page.
9
+ */
10
+ content: string;
11
+ /**
12
+ * @param serverResponse JSON response from the server.
13
+ */
14
+ constructor(serverResponse: StringDict);
15
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RawText = void 0;
4
+ class RawText {
5
+ /**
6
+ * @param serverResponse JSON response from the server.
7
+ */
8
+ constructor(serverResponse) {
9
+ this.page = serverResponse["page"];
10
+ this.content = serverResponse["content"];
11
+ }
12
+ }
13
+ exports.RawText = RawText;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -32,7 +42,7 @@ const tmp_1 = __importDefault(require("tmp"));
32
42
  const pdfUtils_1 = require("./pdfUtils");
33
43
  const fs = __importStar(require("node:fs"));
34
44
  const node_poppler_1 = require("node-poppler");
35
- const pdf_lib_1 = require("pdf-lib");
45
+ const pdf_lib_1 = require("@cantoo/pdf-lib");
36
46
  const imageOperations_1 = require("../imageOperations");
37
47
  /**
38
48
  * Compresses each page of a provided PDF buffer.
@@ -118,7 +128,10 @@ async function compressPdfPages(pdfData, extractedPdfInfo, imageQuality, disable
118
128
  * @returns A Promise resolving to an array of compressed page buffers.
119
129
  */
120
130
  async function compressPagesWithQuality(pdfData, extractedPdfInfo, imageQuality, disableSourceText, extractedText) {
121
- const pdfDoc = await pdf_lib_1.PDFDocument.load(pdfData);
131
+ const pdfDoc = await pdf_lib_1.PDFDocument.load(pdfData, {
132
+ ignoreEncryption: true,
133
+ password: ""
134
+ });
122
135
  const compressedPages = [];
123
136
  for (let i = 0; i < extractedPdfInfo.pages.length; i++) {
124
137
  const page = pdfDoc.getPages()[i];
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractPages = extractPages;
4
4
  exports.countPages = countPages;
5
5
  const handler_1 = require("../errors/handler");
6
- const pdf_lib_1 = require("pdf-lib");
6
+ const pdf_lib_1 = require("@cantoo/pdf-lib");
7
7
  const input_1 = require("../input");
8
8
  const errors_1 = require("../errors");
9
9
  const logger_1 = require("../logger");
@@ -16,6 +16,7 @@ const logger_1 = require("../logger");
16
16
  async function extractPages(file, pageOptions) {
17
17
  const currentPdf = await pdf_lib_1.PDFDocument.load(file, {
18
18
  ignoreEncryption: true,
19
+ password: ""
19
20
  });
20
21
  const newPdf = await pdf_lib_1.PDFDocument.create();
21
22
  const pageCount = currentPdf.getPageCount();
@@ -68,6 +69,7 @@ async function extractPages(file, pageOptions) {
68
69
  async function countPages(file) {
69
70
  const currentPdf = await pdf_lib_1.PDFDocument.load(file, {
70
71
  ignoreEncryption: true,
72
+ password: ""
71
73
  });
72
74
  return currentPdf.getPageCount();
73
75
  }
@@ -1,16 +1,16 @@
1
1
  import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { FinancialDocumentV1LineItem } from "./financialDocumentV1LineItem";
3
- import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
3
+ import { AddressField, AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
4
4
  /**
5
- * Financial Document API version 1.12 document data.
5
+ * Financial Document API version 1.14 document data.
6
6
  */
7
7
  export declare class FinancialDocumentV1Document implements Prediction {
8
8
  /** The customer's address used for billing. */
9
- billingAddress: StringField;
10
- /** The purchase category, only for receipts. */
9
+ billingAddress: AddressField;
10
+ /** The purchase category. */
11
11
  category: ClassificationField;
12
12
  /** The address of the customer. */
13
- customerAddress: StringField;
13
+ customerAddress: AddressField;
14
14
  /** List of company registration numbers associated to the customer. */
15
15
  customerCompanyRegistrations: CompanyRegistrationField[];
16
16
  /** The customer account number or identifier from the supplier. */
@@ -45,11 +45,11 @@ export declare class FinancialDocumentV1Document implements Prediction {
45
45
  /** List of Reference numbers, including PO number, only if the document is an invoice. */
46
46
  referenceNumbers: StringField[];
47
47
  /** The customer's address used for shipping. */
48
- shippingAddress: StringField;
49
- /** The purchase subcategory for transport and food, only for receipts. */
48
+ shippingAddress: AddressField;
49
+ /** The purchase subcategory for transport, food and shooping. */
50
50
  subcategory: ClassificationField;
51
51
  /** The address of the supplier or merchant. */
52
- supplierAddress: StringField;
52
+ supplierAddress: AddressField;
53
53
  /** List of company registration numbers associated to the supplier. */
54
54
  supplierCompanyRegistrations: CompanyRegistrationField[];
55
55
  /** The email of the supplier or merchant. */
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
5
5
  const financialDocumentV1LineItem_1 = require("./financialDocumentV1LineItem");
6
6
  const standard_1 = require("../../parsing/standard");
7
7
  /**
8
- * Financial Document API version 1.12 document data.
8
+ * Financial Document API version 1.14 document data.
9
9
  */
10
10
  class FinancialDocumentV1Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -19,14 +19,14 @@ class FinancialDocumentV1Document {
19
19
  this.supplierCompanyRegistrations = [];
20
20
  /** List of payment details associated to the supplier (only for invoices). */
21
21
  this.supplierPaymentDetails = [];
22
- this.billingAddress = new standard_1.StringField({
22
+ this.billingAddress = new standard_1.AddressField({
23
23
  prediction: rawPrediction["billing_address"],
24
24
  pageId: pageId,
25
25
  });
26
26
  this.category = new standard_1.ClassificationField({
27
27
  prediction: rawPrediction["category"],
28
28
  });
29
- this.customerAddress = new standard_1.StringField({
29
+ this.customerAddress = new standard_1.AddressField({
30
30
  prediction: rawPrediction["customer_address"],
31
31
  pageId: pageId,
32
32
  });
@@ -90,14 +90,14 @@ class FinancialDocumentV1Document {
90
90
  prediction: itemPrediction,
91
91
  pageId: pageId,
92
92
  })));
93
- this.shippingAddress = new standard_1.StringField({
93
+ this.shippingAddress = new standard_1.AddressField({
94
94
  prediction: rawPrediction["shipping_address"],
95
95
  pageId: pageId,
96
96
  });
97
97
  this.subcategory = new standard_1.ClassificationField({
98
98
  prediction: rawPrediction["subcategory"],
99
99
  });
100
- this.supplierAddress = new standard_1.StringField({
100
+ this.supplierAddress = new standard_1.AddressField({
101
101
  prediction: rawPrediction["supplier_address"],
102
102
  pageId: pageId,
103
103
  });
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.payslip = exports.idCard = exports.healthCard = exports.energyBill = exports.carteGrise = exports.bankAccountDetails = void 0;
27
37
  exports.bankAccountDetails = __importStar(require("./bankAccountDetails/internal"));
@@ -121,10 +121,10 @@ class IndianPassportV1Document {
121
121
  :Name of Mother: ${this.nameOfMother}
122
122
  :Old Passport Date of Issue: ${this.oldPassportDateOfIssue}
123
123
  :Old Passport Number: ${this.oldPassportNumber}
124
+ :Old Passport Place of Issue: ${this.oldPassportPlaceOfIssue}
124
125
  :Address Line 1: ${this.address1}
125
126
  :Address Line 2: ${this.address2}
126
127
  :Address Line 3: ${this.address3}
127
- :Old Passport Place of Issue: ${this.oldPassportPlaceOfIssue}
128
128
  :File Number: ${this.fileNumber}`.trimEnd();
129
129
  return (0, common_1.cleanOutString)(outStr);
130
130
  }
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.indianPassport = void 0;
27
37
  exports.indianPassport = __importStar(require("./indianPassport/internal"));
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ResumeV1 = exports.ReceiptV5 = exports.PassportV1 = exports.NutritionFactsLabelV1 = exports.MultiReceiptsDetectorV1 = exports.InvoiceV4 = exports.InvoiceSplitterV1 = exports.InternationalIdV2 = exports.GeneratedV1 = exports.FinancialDocumentV1 = exports.DriverLicenseV1 = exports.DeliveryNoteV1 = exports.CustomV1 = exports.CropperV1 = exports.BusinessCardV1 = exports.BillOfLadingV1 = exports.BarcodeReaderV1 = exports.us = exports.ind = exports.fr = void 0;
27
37
  exports.fr = __importStar(require("./fr"));
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.us = exports.resume = exports.receipt = exports.passport = exports.nutritionFactsLabel = exports.multiReceiptsDetector = exports.invoiceSplitter = exports.invoice = exports.internationalId = exports.ind = exports.generated = exports.fr = exports.financialDocument = exports.driverLicense = exports.deliveryNote = exports.custom = exports.cropper = exports.businessCard = exports.billOfLading = exports.barcodeReader = void 0;
27
37
  exports.barcodeReader = __importStar(require("./barcodeReader/internal"));
@@ -1,7 +1,7 @@
1
1
  import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { ClassificationField, DateField, StringField } from "../../parsing/standard";
3
3
  /**
4
- * International ID API version 2.1 document data.
4
+ * International ID API version 2.2 document data.
5
5
  */
6
6
  export declare class InternationalIdV2Document implements Prediction {
7
7
  /** The physical address of the document holder. */
@@ -4,7 +4,7 @@ exports.InternationalIdV2Document = void 0;
4
4
  const common_1 = require("../../parsing/common");
5
5
  const standard_1 = require("../../parsing/standard");
6
6
  /**
7
- * International ID API version 2.1 document data.
7
+ * International ID API version 2.2 document data.
8
8
  */
9
9
  class InternationalIdV2Document {
10
10
  constructor(rawPrediction, pageId) {
@@ -1,14 +1,16 @@
1
1
  import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { InvoiceV4LineItem } from "./invoiceV4LineItem";
3
- import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
3
+ import { AddressField, AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
4
4
  /**
5
- * Invoice API version 4.10 document data.
5
+ * Invoice API version 4.11 document data.
6
6
  */
7
7
  export declare class InvoiceV4Document implements Prediction {
8
8
  /** The customer billing address. */
9
- billingAddress: StringField;
9
+ billingAddress: AddressField;
10
+ /** The purchase category. */
11
+ category: ClassificationField;
10
12
  /** The address of the customer. */
11
- customerAddress: StringField;
13
+ customerAddress: AddressField;
12
14
  /** List of company registration numbers associated to the customer. */
13
15
  customerCompanyRegistrations: CompanyRegistrationField[];
14
16
  /** The customer account number or identifier from the supplier. */
@@ -36,9 +38,11 @@ export declare class InvoiceV4Document implements Prediction {
36
38
  /** List of all reference numbers on the invoice, including the purchase order number. */
37
39
  referenceNumbers: StringField[];
38
40
  /** Customer's delivery address. */
39
- shippingAddress: StringField;
41
+ shippingAddress: AddressField;
42
+ /** The purchase subcategory for transport, food and shopping. */
43
+ subcategory: ClassificationField;
40
44
  /** The address of the supplier or merchant. */
41
- supplierAddress: StringField;
45
+ supplierAddress: AddressField;
42
46
  /** List of company registration numbers associated to the supplier. */
43
47
  supplierCompanyRegistrations: CompanyRegistrationField[];
44
48
  /** The email address of the supplier or merchant. */
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
5
5
  const invoiceV4LineItem_1 = require("./invoiceV4LineItem");
6
6
  const standard_1 = require("../../parsing/standard");
7
7
  /**
8
- * Invoice API version 4.10 document data.
8
+ * Invoice API version 4.11 document data.
9
9
  */
10
10
  class InvoiceV4Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -19,11 +19,14 @@ class InvoiceV4Document {
19
19
  this.supplierCompanyRegistrations = [];
20
20
  /** List of payment details associated to the supplier of the invoice. */
21
21
  this.supplierPaymentDetails = [];
22
- this.billingAddress = new standard_1.StringField({
22
+ this.billingAddress = new standard_1.AddressField({
23
23
  prediction: rawPrediction["billing_address"],
24
24
  pageId: pageId,
25
25
  });
26
- this.customerAddress = new standard_1.StringField({
26
+ this.category = new standard_1.ClassificationField({
27
+ prediction: rawPrediction["category"],
28
+ });
29
+ this.customerAddress = new standard_1.AddressField({
27
30
  prediction: rawPrediction["customer_address"],
28
31
  pageId: pageId,
29
32
  });
@@ -79,11 +82,14 @@ class InvoiceV4Document {
79
82
  prediction: itemPrediction,
80
83
  pageId: pageId,
81
84
  })));
82
- this.shippingAddress = new standard_1.StringField({
85
+ this.shippingAddress = new standard_1.AddressField({
83
86
  prediction: rawPrediction["shipping_address"],
84
87
  pageId: pageId,
85
88
  });
86
- this.supplierAddress = new standard_1.StringField({
89
+ this.subcategory = new standard_1.ClassificationField({
90
+ prediction: rawPrediction["subcategory"],
91
+ });
92
+ this.supplierAddress = new standard_1.AddressField({
87
93
  prediction: rawPrediction["supplier_address"],
88
94
  pageId: pageId,
89
95
  });
@@ -176,6 +182,8 @@ class InvoiceV4Document {
176
182
  :Billing Address: ${this.billingAddress}
177
183
  :Document Type: ${this.documentType}
178
184
  :Document Type Extended: ${this.documentTypeExtended}
185
+ :Purchase Subcategory: ${this.subcategory}
186
+ :Purchase Category: ${this.category}
179
187
  :Line Items: ${lineItemsSummary}`.trimEnd();
180
188
  return (0, common_1.cleanOutString)(outStr);
181
189
  }
@@ -1,7 +1,7 @@
1
1
  import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { InvoiceSplitterV1InvoicePageGroup } from "./invoiceSplitterV1InvoicePageGroup";
3
3
  /**
4
- * Invoice Splitter API version 1.2 document data.
4
+ * Invoice Splitter API version 1.4 document data.
5
5
  */
6
6
  export declare class InvoiceSplitterV1Document implements Prediction {
7
7
  /** List of page groups. Each group represents a single invoice within a multi-invoice document. */
@@ -4,7 +4,7 @@ exports.InvoiceSplitterV1Document = void 0;
4
4
  const common_1 = require("../../parsing/common");
5
5
  const invoiceSplitterV1InvoicePageGroup_1 = require("./invoiceSplitterV1InvoicePageGroup");
6
6
  /**
7
- * Invoice Splitter API version 1.2 document data.
7
+ * Invoice Splitter API version 1.4 document data.
8
8
  */
9
9
  class InvoiceSplitterV1Document {
10
10
  constructor(rawPrediction, pageId) {
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { ReceiptV5LineItem } from "./receiptV5LineItem";
3
3
  import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, StringField, Taxes } from "../../parsing/standard";
4
4
  /**
5
- * Receipt API version 5.3 document data.
5
+ * Receipt API version 5.4 document data.
6
6
  */
7
7
  export declare class ReceiptV5Document implements Prediction {
8
8
  /** The purchase category of the receipt. */
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
5
5
  const receiptV5LineItem_1 = require("./receiptV5LineItem");
6
6
  const standard_1 = require("../../parsing/standard");
7
7
  /**
8
- * Receipt API version 5.3 document data.
8
+ * Receipt API version 5.4 document data.
9
9
  */
10
10
  class ReceiptV5Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -1,13 +1,13 @@
1
1
  import { StringDict } from "../../../parsing/common";
2
2
  import { Polygon } from "../../../geometry";
3
3
  /**
4
- * Is a fixed amount for a covered service.
4
+ * Copayments for covered services.
5
5
  */
6
6
  export declare class HealthcareCardV1Copay {
7
7
  #private;
8
- /** The price of service. */
8
+ /** The price of the service. */
9
9
  serviceFees: number | null;
10
- /** The name of service of the copay. */
10
+ /** The name of the service. */
11
11
  serviceName: string | null;
12
12
  /** Confidence score */
13
13
  confidence: number;