Comparing version 4.1.0 to 4.1.1
# CHANGELOG | ||
## v4.1.1 - 2023-09-04 | ||
### Changes | ||
* :recycle: tweaked timer management in async | ||
### Fixes | ||
* :bug: fix ocr option not being generated as an Ocr object | ||
## v4.1.0 - 2023-08-31 | ||
@@ -4,0 +12,0 @@ ### Changes |
{ | ||
"name": "mindee", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Mindee Client Library for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Readable } from "stream"; | ||
@@ -38,2 +39,10 @@ import { InputSource, PageOptions } from "./input"; | ||
maxRetries: number; | ||
initialTimerOptions?: { | ||
ref?: boolean; | ||
signal?: AbortSignal; | ||
}; | ||
recurringTimerOptions?: { | ||
ref?: boolean; | ||
signal?: AbortSignal; | ||
}; | ||
} | ||
@@ -40,0 +49,0 @@ export interface ClientOptions { |
@@ -125,2 +125,10 @@ "use strict"; | ||
maxRetries: 10, | ||
initialTimerOptions: { | ||
ref: false, | ||
signal: undefined, | ||
}, | ||
recurringTimerOptions: { | ||
ref: false, | ||
signal: undefined, | ||
}, | ||
}) { | ||
@@ -134,3 +142,3 @@ __classPrivateFieldGet(this, _Client_instances, "m", _Client_validateAsyncParams).call(this, asyncParams); | ||
logger_1.logger.debug(`Successfully enqueued document with job id: ${queueId}.`); | ||
await (0, promises_1.setTimeout)(asyncParams.initialDelaySec * 1000); | ||
await (0, promises_1.setTimeout)(asyncParams.initialDelaySec * 1000, undefined, asyncParams.initialTimerOptions); | ||
let retryCounter = 1; | ||
@@ -146,3 +154,3 @@ let pollResults; | ||
} | ||
await (0, promises_1.setTimeout)(asyncParams.delaySec * 1000); | ||
await (0, promises_1.setTimeout)(asyncParams.delaySec * 1000, undefined, asyncParams.recurringTimerOptions); | ||
pollResults = await this.parseQueued(productClass, queueId, asyncParams); | ||
@@ -254,2 +262,5 @@ retryCounter++; | ||
_Client_instances = new WeakSet(), _Client_validateAsyncParams = function _Client_validateAsyncParams(asyncParams) { | ||
asyncParams.delaySec ?? (asyncParams.delaySec = 3); | ||
asyncParams.initialDelaySec ?? (asyncParams.initialDelaySec = 6); | ||
asyncParams.maxRetries ?? (asyncParams.maxRetries = 10); | ||
if (asyncParams.delaySec < 2) { | ||
@@ -256,0 +267,0 @@ throw Error("Cannot set auto-parsing delay to less than 2 seconds."); |
@@ -6,2 +6,3 @@ "use strict"; | ||
const extras_1 = require("./extras/extras"); | ||
const ocr_1 = require("./ocr"); | ||
/** | ||
@@ -20,3 +21,3 @@ * Document prediction wrapper class. Holds the results of a parsed document. | ||
this.filename = httpResponse?.name ?? ""; | ||
this.ocr = httpResponse?.ocr ?? undefined; | ||
this.ocr = httpResponse.ocr && Object.keys(httpResponse.ocr).length > 0 ? new ocr_1.Ocr(httpResponse.ocr) : undefined; | ||
this.inference = new inferenceClass(httpResponse["inference"]); | ||
@@ -23,0 +24,0 @@ // Note: this is a convoluted but functional way of being able to implement/use Extras fields |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
339682
7929