mindee
Advanced tools
Comparing version 4.9.1 to 4.10.0
# CHANGELOG | ||
# v4.10.0 - 2024-04-12 | ||
### Changes | ||
* :sparkles: update Invoice to v4.5 (#264) | ||
### Fixes | ||
* :bug: fix error management not following intended flow (#267) | ||
* :recycle: deprecated old error handler (#266) | ||
## v4.9.1 - 2024-03-05 | ||
@@ -4,0 +13,0 @@ ### Changes |
{ | ||
"name": "mindee", | ||
"version": "4.9.1", | ||
"version": "4.10.0", | ||
"description": "Mindee Client Library for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
/** | ||
* Custom Error handling class. | ||
* @deprecated Clashes with current implementation of some errors, which may cause unexpected behaviors. | ||
*/ | ||
@@ -4,0 +5,0 @@ export declare class ErrorHandler { |
@@ -7,2 +7,3 @@ "use strict"; | ||
* Custom Error handling class. | ||
* @deprecated Clashes with current implementation of some errors, which may cause unexpected behaviors. | ||
*/ | ||
@@ -9,0 +10,0 @@ class ErrorHandler { |
@@ -8,6 +8,12 @@ "use strict"; | ||
let code; | ||
if (response.messageObj.statusCode && !Number.isNaN(response.data.statusCode)) { | ||
code = response.messageObj.statusCode; | ||
try { | ||
if (response.data.api_request["status_code"] === 200 && response.data?.job?.error?.code) { | ||
code = 500; | ||
response.data.api_request.error = response.data.job.error; | ||
} | ||
else { | ||
code = response.data.api_request["status_code"]; | ||
} | ||
} | ||
else { | ||
catch (e) { | ||
code = 500; | ||
@@ -14,0 +20,0 @@ } |
@@ -29,3 +29,2 @@ "use strict"; | ||
const path = __importStar(require("path")); | ||
const handler_1 = require("../errors/handler"); | ||
const buffer_1 = require("buffer"); | ||
@@ -117,3 +116,3 @@ const logger_1 = require("../logger"); | ||
if (!this.url.toLowerCase().startsWith("https")) { | ||
handler_1.errorHandler.throw(new Error("URL must be HTTPS")); | ||
throw new Error("URL must be HTTPS"); | ||
} | ||
@@ -120,0 +119,0 @@ this.fileObject = this.url; |
@@ -8,2 +8,4 @@ import { Prediction, StringDict } from "../../parsing/common"; | ||
export declare class InvoiceV4Document implements Prediction { | ||
/** The customer's address used for billing. */ | ||
billingAddress: StringField; | ||
/** The address of the customer. */ | ||
@@ -29,2 +31,4 @@ customerAddress: StringField; | ||
referenceNumbers: StringField[]; | ||
/** Customer's delivery address. */ | ||
shippingAddress: StringField; | ||
/** The address of the supplier or merchant. */ | ||
@@ -31,0 +35,0 @@ supplierAddress: StringField; |
@@ -22,2 +22,6 @@ "use strict"; | ||
this.supplierPaymentDetails = []; | ||
this.billingAddress = new standard_1.StringField({ | ||
prediction: rawPrediction["billing_address"], | ||
pageId: pageId, | ||
}); | ||
this.customerAddress = new standard_1.StringField({ | ||
@@ -64,2 +68,6 @@ prediction: rawPrediction["customer_address"], | ||
}))); | ||
this.shippingAddress = new standard_1.StringField({ | ||
prediction: rawPrediction["shipping_address"], | ||
pageId: pageId, | ||
}); | ||
this.supplierAddress = new standard_1.StringField({ | ||
@@ -135,2 +143,4 @@ prediction: rawPrediction["supplier_address"], | ||
:Customer Address: ${this.customerAddress} | ||
:Shipping Address: ${this.shippingAddress} | ||
:Billing Address: ${this.billingAddress} | ||
:Document Type: ${this.documentType} | ||
@@ -137,0 +147,0 @@ :Line Items: ${lineItemsSummary}`.trimEnd(); |
505366
11799