Socket
Socket
Sign inDemoInstall

mindee

Package Overview
Dependencies
Maintainers
7
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mindee - npm Package Compare versions

Comparing version 4.8.1 to 4.8.2

9

CHANGELOG.md
# CHANGELOG
## v4.8.2 - 2024-02-09
### Changes
* :recycle: increased update time for async retries
### Fixes
* :bug: fixed improper float parsing for Generated list objects
* :bug: typescript should now allow the use of default values for enqueueAndParse() async options
## v4.8.1 - 2024-02-06

@@ -4,0 +13,0 @@ ### Fixes

2

package.json
{
"name": "mindee",
"version": "4.8.1",
"version": "4.8.2",
"description": "Mindee Client Library for Node.js",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -244,3 +244,3 @@ "use strict";

delaySec: 2,
maxRetries: 30,
maxRetries: 60,
});

@@ -255,3 +255,3 @@ }

delaySec: 2,
maxRetries: 30,
maxRetries: 60,
});

@@ -258,0 +258,0 @@ if (!response.document) {

@@ -35,2 +35,15 @@ /// <reference types="node" />

*/
export interface OptionalAsyncOptions extends PredictOptions {
initialDelaySec?: number;
delaySec?: number;
maxRetries?: number;
initialTimerOptions?: {
ref?: boolean;
signal?: AbortSignal;
};
recurringTimerOptions?: {
ref?: boolean;
signal?: AbortSignal;
};
}
export interface AsyncOptions extends PredictOptions {

@@ -143,3 +156,3 @@ initialDelaySec: number;

*/
enqueueAndParse<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, asyncParams?: AsyncOptions): Promise<AsyncPredictResponse<T>>;
enqueueAndParse<T extends Inference>(productClass: new (httpResponse: StringDict) => T, inputSource: InputSource, asyncParams?: OptionalAsyncOptions): Promise<AsyncPredictResponse<T>>;
/**

@@ -146,0 +159,0 @@ * Forces boolean coercion on truthy/falsy parameters.

@@ -7,3 +7,3 @@ "use strict";

};
var _Client_instances, _Client_validateAsyncParams, _Client_buildProductEndpoint, _Client_buildApiSettings, _Client_initializeOTSEndpoint, _Client_cleanAccountName, _Client_getOtsEndpoint;
var _Client_instances, _Client_setAsyncParams, _Client_buildProductEndpoint, _Client_buildApiSettings, _Client_initializeOTSEndpoint, _Client_cleanAccountName, _Client_getOtsEndpoint;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -159,7 +159,7 @@ exports.Client = void 0;

delaySec: 2,
maxRetries: 30,
maxRetries: 60,
initialTimerOptions: undefined,
recurringTimerOptions: undefined,
}) {
__classPrivateFieldGet(this, _Client_instances, "m", _Client_validateAsyncParams).call(this, asyncParams);
const validatedAsyncParams = __classPrivateFieldGet(this, _Client_instances, "m", _Client_setAsyncParams).call(this, asyncParams);
const enqueueResponse = await this.enqueue(productClass, inputSource, asyncParams);

@@ -171,7 +171,7 @@ if (enqueueResponse.job.id === undefined || enqueueResponse.job.id.length === 0) {

logger_1.logger.debug(`Successfully enqueued document with job id: ${queueId}.`);
await (0, promises_1.setTimeout)(asyncParams.initialDelaySec * 1000, undefined, asyncParams.initialTimerOptions);
await (0, promises_1.setTimeout)(validatedAsyncParams.initialDelaySec * 1000, undefined, asyncParams.initialTimerOptions);
let retryCounter = 1;
let pollResults;
pollResults = await this.parseQueued(productClass, queueId, asyncParams);
while (retryCounter < asyncParams.maxRetries) {
while (retryCounter < validatedAsyncParams.maxRetries) {
logger_1.logger.debug(`Polling server for parsing result with queueId: ${queueId}.

@@ -183,3 +183,3 @@ Attempt n°${retryCounter}/${asyncParams.maxRetries}.

}
await (0, promises_1.setTimeout)(asyncParams.delaySec * 1000, undefined, asyncParams.recurringTimerOptions);
await (0, promises_1.setTimeout)(validatedAsyncParams.delaySec * 1000, undefined, asyncParams.recurringTimerOptions);
pollResults = await this.parseQueued(productClass, queueId, asyncParams);

@@ -189,3 +189,3 @@ retryCounter++;

if (pollResults.job.status !== "completed") {
throw Error(`Asynchronous parsing request timed out after ${asyncParams.delaySec * retryCounter} seconds`);
throw Error(`Asynchronous parsing request timed out after ${validatedAsyncParams.delaySec * retryCounter} seconds`);
}

@@ -290,18 +290,20 @@ return pollResults;

exports.Client = Client;
_Client_instances = new WeakSet(), _Client_validateAsyncParams = function _Client_validateAsyncParams(asyncParams) {
_Client_instances = new WeakSet(), _Client_setAsyncParams = function _Client_setAsyncParams(asyncParams) {
const minDelaySec = 1;
const minInitialDelay = 2;
const minRetries = 2;
asyncParams.delaySec ?? (asyncParams.delaySec = 2);
asyncParams.initialDelaySec ?? (asyncParams.initialDelaySec = 4);
asyncParams.maxRetries ?? (asyncParams.maxRetries = 30);
if (asyncParams.delaySec < minDelaySec) {
const newAsyncParams = { ...asyncParams };
newAsyncParams.delaySec ?? (newAsyncParams.delaySec = 2);
newAsyncParams.initialDelaySec ?? (newAsyncParams.initialDelaySec = 4);
newAsyncParams.maxRetries ?? (newAsyncParams.maxRetries = 60);
if (newAsyncParams.delaySec < minDelaySec) {
throw Error(`Cannot set auto-parsing delay to less than ${minDelaySec} seconds.`);
}
if (asyncParams.initialDelaySec < minInitialDelay) {
if (newAsyncParams.initialDelaySec < minInitialDelay) {
throw Error(`Cannot set initial parsing delay to less than ${minInitialDelay} seconds.`);
}
if (asyncParams.maxRetries < minRetries) {
if (newAsyncParams.maxRetries < minRetries) {
throw Error(`Cannot set retry to less than ${minRetries}.`);
}
return newAsyncParams;
}, _Client_buildProductEndpoint = function _Client_buildProductEndpoint(endpointName, accountName, endpointVersion) {

@@ -308,0 +310,0 @@ return new http_1.Endpoint(endpointName, accountName, endpointVersion, __classPrivateFieldGet(this, _Client_instances, "m", _Client_buildApiSettings).call(this));

@@ -21,6 +21,3 @@ "use strict";

const valueStr = { ...value };
if (valueStr["value"] !== null && valueStr["value"] !== undefined && !isNaN(valueStr["value"])) {
valueStr["value"] = value["value"].toFixed(1);
}
else if (value["value"] !== undefined && value["value"] !== null) {
if (valueStr["value"] !== null && valueStr["value"] !== undefined) {
valueStr["value"] = value["value"].toString();

@@ -27,0 +24,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc