mindee 4.9.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ # v4.10.0 - 2024-04-12
4
+ ### Changes
5
+ * :sparkles: update Invoice to v4.5 (#264)
6
+
7
+ ### Fixes
8
+ * :bug: fix error management not following intended flow (#267)
9
+ * :recycle: deprecated old error handler (#266)
10
+
11
+
12
+ ## v4.9.1 - 2024-03-05
13
+ ### Changes
14
+ * :recycle: update error handling to account for future evolutions
15
+ * :recycle: expose the input, geometry & imageOperations modules in internals for better fine-tuning
16
+ * :recycle: fix inconsistencies with naming conventions
17
+ * :memo: add missing reference documentation
18
+
19
+
3
20
  ## v4.9.0 - 2024-02-21
4
21
  ### Changes
5
22
  * :sparkles: add support for resume V1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.9.0",
3
+ "version": "4.10.0",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
@@ -1,7 +1,10 @@
1
- declare class ErrorHandler {
1
+ /**
2
+ * Custom Error handling class.
3
+ * @deprecated Clashes with current implementation of some errors, which may cause unexpected behaviors.
4
+ */
5
+ export declare class ErrorHandler {
2
6
  throwOnError: boolean;
3
7
  constructor(throwOnError?: boolean);
4
8
  throw(error: Error): void;
5
9
  }
6
10
  export declare const errorHandler: ErrorHandler;
7
- export {};
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errorHandler = void 0;
3
+ exports.errorHandler = exports.ErrorHandler = void 0;
4
4
  const logger_1 = require("../logger");
5
+ /**
6
+ * Custom Error handling class.
7
+ * @deprecated Clashes with current implementation of some errors, which may cause unexpected behaviors.
8
+ */
5
9
  class ErrorHandler {
6
10
  constructor(throwOnError = true) {
7
11
  this.throwOnError = throwOnError;
@@ -15,4 +19,5 @@ class ErrorHandler {
15
19
  }
16
20
  }
17
21
  }
22
+ exports.ErrorHandler = ErrorHandler;
18
23
  exports.errorHandler = new ErrorHandler();
@@ -1 +1 @@
1
- export { MindeeError, MindeeMimeTypeError } from "./MindeeError";
1
+ export { MindeeError, MindeeMimeTypeError } from "./mindeeError";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MindeeMimeTypeError = exports.MindeeError = void 0;
4
- var MindeeError_1 = require("./MindeeError");
5
- Object.defineProperty(exports, "MindeeError", { enumerable: true, get: function () { return MindeeError_1.MindeeError; } });
6
- Object.defineProperty(exports, "MindeeMimeTypeError", { enumerable: true, get: function () { return MindeeError_1.MindeeMimeTypeError; } });
4
+ var mindeeError_1 = require("./mindeeError");
5
+ Object.defineProperty(exports, "MindeeError", { enumerable: true, get: function () { return mindeeError_1.MindeeError; } });
6
+ Object.defineProperty(exports, "MindeeMimeTypeError", { enumerable: true, get: function () { return mindeeError_1.MindeeMimeTypeError; } });
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Main Mindee Error custom class.
3
+ */
1
4
  export declare class MindeeError extends Error {
2
5
  constructor(message: string);
3
6
  }
7
+ /**
8
+ * Custom Mindee error relating to improper mimetypes in inputs.
9
+ */
4
10
  export declare class MindeeMimeTypeError extends MindeeError {
5
11
  constructor(message: string);
6
12
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MindeeMimeTypeError = exports.MindeeError = void 0;
4
+ /**
5
+ * Main Mindee Error custom class.
6
+ */
4
7
  class MindeeError extends Error {
5
8
  constructor(message) {
6
9
  super(message);
@@ -8,6 +11,9 @@ class MindeeError extends Error {
8
11
  }
9
12
  }
10
13
  exports.MindeeError = MindeeError;
14
+ /**
15
+ * Custom Mindee error relating to improper mimetypes in inputs.
16
+ */
11
17
  class MindeeMimeTypeError extends MindeeError {
12
18
  constructor(message) {
13
19
  super(message);
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ApiSettings = exports.STANDARD_API_OWNER = exports.API_HOST_ENVVAR_NAME = exports.API_KEY_ENVVAR_NAME = void 0;
27
+ /* eslint-disable @typescript-eslint/naming-convention */
27
28
  const logger_1 = require("../logger");
28
29
  const package_json_1 = require("../../package.json");
29
30
  const os = __importStar(require("os"));
@@ -15,6 +15,7 @@ const form_data_1 = __importDefault(require("form-data"));
15
15
  const base_1 = require("../input/base");
16
16
  const error_1 = require("./error");
17
17
  const baseEndpoint_1 = require("./baseEndpoint");
18
+ const responseValidation_1 = require("./responseValidation");
18
19
  /**
19
20
  * Endpoint for a product (OTS or Custom).
20
21
  */
@@ -40,9 +41,8 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
40
41
  await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_cutDocPages).call(this, params.inputDoc, params.pageOptions);
41
42
  }
42
43
  const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_predictReqPost).call(this, params.inputDoc, params.includeWords, params.cropper);
43
- const statusCode = response.messageObj.statusCode;
44
- if (statusCode === undefined || statusCode >= 400) {
45
- (0, error_1.handleError)(this.urlName, response, statusCode, response.messageObj?.statusMessage);
44
+ if (!(0, responseValidation_1.isValidSyncResponse)(response)) {
45
+ (0, error_1.handleError)(this.urlName, response, response.messageObj?.statusMessage);
46
46
  }
47
47
  return response;
48
48
  }
@@ -59,9 +59,8 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
59
59
  await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_cutDocPages).call(this, params.inputDoc, params.pageOptions);
60
60
  }
61
61
  const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_predictAsyncReqPost).call(this, params.inputDoc, params.includeWords, params.cropper);
62
- const statusCode = response.messageObj.statusCode;
63
- if (statusCode === undefined || statusCode >= 400) {
64
- (0, error_1.handleError)(this.urlName, response, statusCode, response.messageObj?.statusMessage);
62
+ if (!(0, responseValidation_1.isValidAsyncResponse)(response)) {
63
+ (0, error_1.handleError)(this.urlName, response, response.messageObj?.statusMessage);
65
64
  }
66
65
  return response;
67
66
  }
@@ -75,10 +74,8 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
75
74
  async getQueuedDocument(queueId) {
76
75
  const queueResponse = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_documentQueueReqGet).call(this, queueId);
77
76
  const queueStatusCode = queueResponse.messageObj.statusCode;
78
- if (queueStatusCode === undefined ||
79
- queueStatusCode < 200 ||
80
- queueStatusCode > 400) {
81
- (0, error_1.handleError)(this.urlName, queueResponse, queueStatusCode, queueResponse.messageObj?.statusMessage);
77
+ if (!(0, responseValidation_1.isValidAsyncResponse)(queueResponse)) {
78
+ (0, error_1.handleError)(this.urlName, queueResponse, queueResponse.messageObj?.statusMessage);
82
79
  }
83
80
  if (queueStatusCode === 302 &&
84
81
  queueResponse.messageObj.headers.location !== undefined) {
@@ -95,9 +92,8 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
95
92
  */
96
93
  async getDocument(documentId) {
97
94
  const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_documentGetReq).call(this, documentId);
98
- const statusCode = response.messageObj.statusCode;
99
- if (statusCode === undefined || statusCode >= 400) {
100
- (0, error_1.handleError)("document", response, statusCode, response.messageObj?.statusMessage);
95
+ if (!(0, responseValidation_1.isValidAsyncResponse)(response)) {
96
+ (0, error_1.handleError)("document", response, response.messageObj?.statusMessage);
101
97
  }
102
98
  return response;
103
99
  }
@@ -108,9 +104,8 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
108
104
  */
109
105
  async sendFeedback(documentId, feedback) {
110
106
  const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_documentFeedbackPutReq).call(this, documentId, feedback);
111
- const statusCode = response.messageObj.statusCode;
112
- if (statusCode === undefined || statusCode >= 400) {
113
- (0, error_1.handleError)("feedback", response, statusCode, response.messageObj?.statusMessage);
107
+ if (!(0, responseValidation_1.isValidSyncResponse)(response)) {
108
+ (0, error_1.handleError)("feedback", response, response.messageObj?.statusMessage);
114
109
  }
115
110
  return response;
116
111
  }
@@ -1,7 +1,7 @@
1
1
  import { MindeeError } from "../errors";
2
2
  import { StringDict } from "../parsing/common";
3
3
  import { EndpointResponse } from "./baseEndpoint";
4
- export declare function handleError(urlName: string, response: EndpointResponse, code?: number, serverError?: string): void;
4
+ export declare function handleError(urlName: string, response: EndpointResponse, serverError?: string): void;
5
5
  /**
6
6
  * `Error` wrapper for server (HTTP) errors.
7
7
  * Is used when an error is lacking a handled error code.
package/src/http/error.js CHANGED
@@ -3,9 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MindeeHttp504Error = exports.MindeeHttp500Error = exports.MindeeHttp429Error = exports.MindeeHttp413Error = exports.MindeeHttp404Error = exports.MindeeHttp403Error = exports.MindeeHttp401Error = exports.MindeeHttp400Error = exports.MindeeHttpError = exports.handleError = void 0;
4
4
  const errors_1 = require("../errors");
5
5
  const handler_1 = require("../errors/handler");
6
- function handleError(urlName, response, code, serverError) {
7
- if (code === undefined) {
8
- throw new MindeeHttpError({ message: "Missing HTTP Error code.", details: response.data, undefined }, urlName);
6
+ function handleError(urlName, response, serverError) {
7
+ let code;
8
+ try {
9
+ if (response.data.api_request["status_code"] === 200 && response.data?.job?.error?.code) {
10
+ code = 500;
11
+ response.data.api_request.error = response.data.job.error;
12
+ }
13
+ else {
14
+ code = response.data.api_request["status_code"];
15
+ }
16
+ }
17
+ catch (e) {
18
+ code = 500;
9
19
  }
10
20
  let errorObj;
11
21
  try {
@@ -2,3 +2,4 @@ export { Endpoint } from "./endpoint";
2
2
  export { EndpointResponse } from "./baseEndpoint";
3
3
  export { STANDARD_API_OWNER, API_KEY_ENVVAR_NAME, ApiSettings, } from "./apiSettings";
4
4
  export { MindeeHttpError, MindeeHttp400Error, MindeeHttp401Error, MindeeHttp403Error, MindeeHttp404Error, MindeeHttp413Error, MindeeHttp429Error, MindeeHttp500Error, MindeeHttp504Error, handleError, } from "./error";
5
+ export { isValidSyncResponse, isValidAsyncResponse, cleanRequestData, } from "./responseValidation";
package/src/http/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleError = exports.MindeeHttp504Error = exports.MindeeHttp500Error = exports.MindeeHttp429Error = exports.MindeeHttp413Error = exports.MindeeHttp404Error = exports.MindeeHttp403Error = exports.MindeeHttp401Error = exports.MindeeHttp400Error = exports.MindeeHttpError = exports.ApiSettings = exports.API_KEY_ENVVAR_NAME = exports.STANDARD_API_OWNER = exports.Endpoint = void 0;
3
+ exports.cleanRequestData = exports.isValidAsyncResponse = exports.isValidSyncResponse = exports.handleError = exports.MindeeHttp504Error = exports.MindeeHttp500Error = exports.MindeeHttp429Error = exports.MindeeHttp413Error = exports.MindeeHttp404Error = exports.MindeeHttp403Error = exports.MindeeHttp401Error = exports.MindeeHttp400Error = exports.MindeeHttpError = exports.ApiSettings = exports.API_KEY_ENVVAR_NAME = exports.STANDARD_API_OWNER = exports.Endpoint = void 0;
4
4
  var endpoint_1 = require("./endpoint");
5
5
  Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function () { return endpoint_1.Endpoint; } });
6
6
  var apiSettings_1 = require("./apiSettings");
@@ -18,3 +18,7 @@ Object.defineProperty(exports, "MindeeHttp429Error", { enumerable: true, get: fu
18
18
  Object.defineProperty(exports, "MindeeHttp500Error", { enumerable: true, get: function () { return error_1.MindeeHttp500Error; } });
19
19
  Object.defineProperty(exports, "MindeeHttp504Error", { enumerable: true, get: function () { return error_1.MindeeHttp504Error; } });
20
20
  Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return error_1.handleError; } });
21
+ var responseValidation_1 = require("./responseValidation");
22
+ Object.defineProperty(exports, "isValidSyncResponse", { enumerable: true, get: function () { return responseValidation_1.isValidSyncResponse; } });
23
+ Object.defineProperty(exports, "isValidAsyncResponse", { enumerable: true, get: function () { return responseValidation_1.isValidAsyncResponse; } });
24
+ Object.defineProperty(exports, "cleanRequestData", { enumerable: true, get: function () { return responseValidation_1.cleanRequestData; } });
@@ -0,0 +1,23 @@
1
+ import { EndpointResponse } from "./baseEndpoint";
2
+ /**
3
+ * Checks if the synchronous response is valid. Returns True if the response is valid.
4
+ *
5
+ * @param response an endpoint response object.
6
+ * @returns bool
7
+ */
8
+ export declare function isValidSyncResponse(response: EndpointResponse): boolean;
9
+ /**
10
+ * Checks if the asynchronous response is valid. Also checks if it is a valid synchronous response.
11
+ * Returns True if the response is valid.
12
+ *
13
+ * @param response an endpoint response object.
14
+ * @returns bool
15
+ */
16
+ export declare function isValidAsyncResponse(response: EndpointResponse): boolean;
17
+ /**
18
+ * Checks and correct the response object depending on the possible kinds of returns.
19
+ *
20
+ * @param response an endpoint response object.
21
+ * @returns EndpointResponse Returns the job error if the error is due to parsing, returns the http error otherwise.
22
+ */
23
+ export declare function cleanRequestData(response: EndpointResponse): EndpointResponse;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanRequestData = exports.isValidAsyncResponse = exports.isValidSyncResponse = void 0;
4
+ /**
5
+ * Checks if the synchronous response is valid. Returns True if the response is valid.
6
+ *
7
+ * @param response an endpoint response object.
8
+ * @returns bool
9
+ */
10
+ function isValidSyncResponse(response) {
11
+ if (!response.messageObj || !response.messageObj.statusCode) {
12
+ return false;
13
+ }
14
+ return !(isNaN(response.messageObj.statusCode) || parseInt(response.messageObj.statusCode.toString()) < 200 || parseInt(response.messageObj.statusCode.toString()) > 302);
15
+ }
16
+ exports.isValidSyncResponse = isValidSyncResponse;
17
+ /**
18
+ * Checks if the asynchronous response is valid. Also checks if it is a valid synchronous response.
19
+ * Returns True if the response is valid.
20
+ *
21
+ * @param response an endpoint response object.
22
+ * @returns bool
23
+ */
24
+ function isValidAsyncResponse(response) {
25
+ if (!isValidSyncResponse(response)) {
26
+ return false;
27
+ }
28
+ if (response.messageObj.statusCode) {
29
+ if (response.messageObj.statusCode >= 300 && response.messageObj.statusCode <= 302) {
30
+ // Skip next check for redirections as the final payload will be checked anyway.
31
+ return true;
32
+ }
33
+ else if (response.messageObj.statusCode < 200 || response.messageObj.statusCode > 302) {
34
+ return false;
35
+ }
36
+ }
37
+ if (!response.data["job"]) {
38
+ return false;
39
+ }
40
+ return !(response.data["job"] && response.data["job"]["error"] && Object.keys(response.data["job"]["error"]).length > 0);
41
+ }
42
+ exports.isValidAsyncResponse = isValidAsyncResponse;
43
+ /**
44
+ * Checks and correct the response object depending on the possible kinds of returns.
45
+ *
46
+ * @param response an endpoint response object.
47
+ * @returns EndpointResponse Returns the job error if the error is due to parsing, returns the http error otherwise.
48
+ */
49
+ function cleanRequestData(response) {
50
+ if (response.messageObj &&
51
+ response.messageObj.statusCode &&
52
+ (response.messageObj.statusCode < 200 ||
53
+ response.messageObj.statusCode > 302)) {
54
+ return response;
55
+ }
56
+ if (response.data) {
57
+ if (response.data["api_request"] && response.data["api_request"]["status_code"] && parseInt(response.data["api_request"]["status_code"].toString()) > 399) {
58
+ response.messageObj.statusCode = parseInt(response.data["api_request"]["status_code"].toString());
59
+ }
60
+ if (response.data["job"] && response.data["job"]["error"] && Object.keys(response.data["job"]["error"]).length > 0) {
61
+ response.messageObj.statusCode = 500;
62
+ }
63
+ }
64
+ return response;
65
+ }
66
+ exports.cleanRequestData = cleanRequestData;
@@ -1,4 +1,6 @@
1
- /** Options to pass to the `parse` method for cutting multi-page documents. */
1
+ /**
2
+ * Options to pass to the `parse` method for cutting multi-page documents.
3
+ */
2
4
  export interface PageOptions {
3
5
  /**
4
6
  * Zero-based list of page indexes.
@@ -15,7 +17,9 @@ export interface PageOptions {
15
17
  */
16
18
  onMinPages: number;
17
19
  }
18
- /** Operation to apply on the document, given the page indexes specified. */
20
+ /**
21
+ * Operation to apply on the document, given the page indexes specified.
22
+ */
19
23
  export declare enum PageOptionsOperation {
20
24
  /** Only keep pages matching the provided indexes. */
21
25
  KeepOnly = "KEEP_ONLY",
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageOptionsOperation = void 0;
4
- /** Operation to apply on the document, given the page indexes specified. */
4
+ /**
5
+ * Operation to apply on the document, given the page indexes specified.
6
+ */
5
7
  var PageOptionsOperation;
6
8
  (function (PageOptionsOperation) {
7
9
  /** Only keep pages matching the provided indexes. */
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.BufferInput = exports.UrlInput = exports.BytesInput = exports.StreamInput = exports.Base64Input = exports.PathInput = void 0;
27
27
  const fs_1 = require("fs");
28
28
  const path = __importStar(require("path"));
29
- const handler_1 = require("../errors/handler");
30
29
  const buffer_1 = require("buffer");
31
30
  const logger_1 = require("../logger");
32
31
  const base_1 = require("./base");
@@ -113,7 +112,7 @@ class UrlInput extends base_1.InputSource {
113
112
  }
114
113
  async init() {
115
114
  if (!this.url.toLowerCase().startsWith("https")) {
116
- handler_1.errorHandler.throw(new Error("URL must be HTTPS"));
115
+ throw new Error("URL must be HTTPS");
117
116
  }
118
117
  this.fileObject = this.url;
119
118
  }
package/src/internal.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export * as product from "./product/internal";
2
- export * as parsing from "./parsing";
3
- export * as pdf from "./pdf";
1
+ export * as input from "./input";
4
2
  export * as geometry from "./geometry";
5
3
  export * as http from "./http";
4
+ export * as imageOperations from "./imageOperations/internal";
5
+ export * as parsing from "./parsing";
6
+ export * as pdf from "./pdf";
7
+ export * as product from "./product/internal";
package/src/internal.js CHANGED
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.http = exports.geometry = exports.pdf = exports.parsing = exports.product = void 0;
27
- exports.product = __importStar(require("./product/internal"));
28
- exports.parsing = __importStar(require("./parsing"));
29
- exports.pdf = __importStar(require("./pdf"));
26
+ exports.product = exports.pdf = exports.parsing = exports.imageOperations = exports.http = exports.geometry = exports.input = void 0;
27
+ exports.input = __importStar(require("./input"));
30
28
  exports.geometry = __importStar(require("./geometry"));
31
29
  exports.http = __importStar(require("./http"));
30
+ exports.imageOperations = __importStar(require("./imageOperations/internal"));
31
+ exports.parsing = __importStar(require("./parsing"));
32
+ exports.pdf = __importStar(require("./pdf"));
33
+ exports.product = __importStar(require("./product/internal"));
@@ -12,6 +12,8 @@ export declare class Job {
12
12
  issuedAt: Date;
13
13
  /** Timestamp noting the availability of a prediction for an enqueued document. */
14
14
  availableAt?: Date;
15
+ /** Information about an error that occurred during the job processing. */
16
+ error?: StringDict;
15
17
  /** ID of the job. */
16
18
  id: string;
17
19
  /** Status of the job. */
@@ -5,6 +5,8 @@ import { AmountField, ClassificationField, CompanyRegistrationField, DateField,
5
5
  * Document data for Invoice, API version 4.
6
6
  */
7
7
  export declare class InvoiceV4Document implements Prediction {
8
+ /** The customer's address used for billing. */
9
+ billingAddress: StringField;
8
10
  /** The address of the customer. */
9
11
  customerAddress: StringField;
10
12
  /** List of company registrations associated to the customer. */
@@ -25,6 +27,8 @@ export declare class InvoiceV4Document implements Prediction {
25
27
  locale: LocaleField;
26
28
  /** List of Reference numbers, including PO number. */
27
29
  referenceNumbers: StringField[];
30
+ /** Customer's delivery address. */
31
+ shippingAddress: StringField;
28
32
  /** The address of the supplier or merchant. */
29
33
  supplierAddress: StringField;
30
34
  /** List of company registrations associated to the supplier. */
@@ -19,6 +19,10 @@ class InvoiceV4Document {
19
19
  this.supplierCompanyRegistrations = [];
20
20
  /** List of payment details associated to the supplier. */
21
21
  this.supplierPaymentDetails = [];
22
+ this.billingAddress = new standard_1.StringField({
23
+ prediction: rawPrediction["billing_address"],
24
+ pageId: pageId,
25
+ });
22
26
  this.customerAddress = new standard_1.StringField({
23
27
  prediction: rawPrediction["customer_address"],
24
28
  pageId: pageId,
@@ -60,6 +64,10 @@ class InvoiceV4Document {
60
64
  prediction: itemPrediction,
61
65
  pageId: pageId,
62
66
  })));
67
+ this.shippingAddress = new standard_1.StringField({
68
+ prediction: rawPrediction["shipping_address"],
69
+ pageId: pageId,
70
+ });
63
71
  this.supplierAddress = new standard_1.StringField({
64
72
  prediction: rawPrediction["supplier_address"],
65
73
  pageId: pageId,
@@ -130,6 +138,8 @@ class InvoiceV4Document {
130
138
  :Customer Name: ${this.customerName}
131
139
  :Customer Company Registrations: ${customerCompanyRegistrations}
132
140
  :Customer Address: ${this.customerAddress}
141
+ :Shipping Address: ${this.shippingAddress}
142
+ :Billing Address: ${this.billingAddress}
133
143
  :Document Type: ${this.documentType}
134
144
  :Line Items: ${lineItemsSummary}`.trimEnd();
135
145
  return (0, common_1.cleanOutString)(outStr);