mindee 4.6.0 → 4.6.1

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,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.6.1 - 2023-12-15
4
+ ### Changes
5
+ * :recycle: tweak async delays & retry
6
+ * :recycle: tweak default async sample delays & retry
7
+ * :memo: update md doc & fix typos
8
+
9
+
3
10
  ## v4.6.0 - 2023-12-11
4
11
  ### Changes
5
12
  * :sparkles: add invoice-splitter auto-splitting feature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
package/src/cli.js CHANGED
@@ -228,9 +228,9 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
228
228
  pageOptions: pageOptions,
229
229
  allWords: predictParams.allWords,
230
230
  cropper: predictParams.cropper,
231
- initialDelaySec: 6,
232
- delaySec: 3,
233
- maxRetries: 10,
231
+ initialDelaySec: 4,
232
+ delaySec: 2,
233
+ maxRetries: 30,
234
234
  });
235
235
  }
236
236
  else {
@@ -238,9 +238,9 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
238
238
  pageOptions: pageOptions,
239
239
  allWords: predictParams.allWords,
240
240
  cropper: predictParams.cropper,
241
- initialDelaySec: 6,
242
- delaySec: 3,
243
- maxRetries: 10,
241
+ initialDelaySec: 4,
242
+ delaySec: 2,
243
+ maxRetries: 30,
244
244
  });
245
245
  if (!response.document) {
246
246
  throw Error("Document could not be retrieved");
package/src/client.js CHANGED
@@ -153,9 +153,9 @@ class Client {
153
153
  allWords: undefined,
154
154
  cropper: undefined,
155
155
  pageOptions: undefined,
156
- initialDelaySec: 6,
157
- delaySec: 3,
158
- maxRetries: 10,
156
+ initialDelaySec: 4,
157
+ delaySec: 2,
158
+ maxRetries: 30,
159
159
  initialTimerOptions: undefined,
160
160
  recurringTimerOptions: undefined,
161
161
  }) {
@@ -283,17 +283,20 @@ Job status: ${pollResults.job.status}.`);
283
283
  }
284
284
  exports.Client = Client;
285
285
  _Client_instances = new WeakSet(), _Client_validateAsyncParams = function _Client_validateAsyncParams(asyncParams) {
286
- asyncParams.delaySec ?? (asyncParams.delaySec = 3);
287
- asyncParams.initialDelaySec ?? (asyncParams.initialDelaySec = 6);
288
- asyncParams.maxRetries ?? (asyncParams.maxRetries = 10);
289
- if (asyncParams.delaySec < 2) {
290
- throw Error("Cannot set auto-parsing delay to less than 2 seconds.");
286
+ const minDelaySec = 1;
287
+ const minInitialDelay = 2;
288
+ const minRetries = 2;
289
+ asyncParams.delaySec ?? (asyncParams.delaySec = 2);
290
+ asyncParams.initialDelaySec ?? (asyncParams.initialDelaySec = 4);
291
+ asyncParams.maxRetries ?? (asyncParams.maxRetries = 30);
292
+ if (asyncParams.delaySec < minDelaySec) {
293
+ throw Error(`Cannot set auto-parsing delay to less than ${minDelaySec} seconds.`);
291
294
  }
292
- if (asyncParams.initialDelaySec < 4) {
293
- throw Error("Cannot set initial parsing delay to less than 4 seconds.");
295
+ if (asyncParams.initialDelaySec < minInitialDelay) {
296
+ throw Error(`Cannot set initial parsing delay to less than ${minInitialDelay} seconds.`);
294
297
  }
295
- if (!Number.isInteger(asyncParams.maxRetries)) {
296
- throw Error("Retry amount must be an integer.");
298
+ if (asyncParams.maxRetries < minRetries) {
299
+ throw Error(`Cannot set retry to less than ${minRetries}.`);
297
300
  }
298
301
  }, _Client_buildProductEndpoint = function _Client_buildProductEndpoint(endpointName, accountName, endpointVersion) {
299
302
  return new http_1.Endpoint(endpointName, accountName, endpointVersion, __classPrivateFieldGet(this, _Client_instances, "m", _Client_buildApiSettings).call(this));