@mimik/request-retry 4.0.10 → 4.0.12

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.
Files changed (3) hide show
  1. package/README.md +8 -8
  2. package/index.js +10 -10
  3. package/package.json +10 -9
package/README.md CHANGED
@@ -46,17 +46,17 @@ To ease migration from `request-promise`, the following adjustments are applied
46
46
  | --- | --- | --- | --- |
47
47
  | options | <code>object</code> | | Options for the request (similar to [axios](https://www.npmjs.com/package/axios)). The `validateStatus` option is disabled: an error is thrown for status codes outside **[200, 300)**. An additional option, `resolveWithFullResponse`, controls the return shape: when `true`, the full Axios response object is returned; when `false` or omitted, only `response.data` is returned. |
48
48
  | [options.retry] | <code>object</code> | | Retry configuration. |
49
- | [options.retry.retries] | <code>number</code> | <code>2</code> | Maximum number of retries, independent of the `retryStrategy`. If the value is `< 0` it is set to `0`; if `> 15` it is set to `15`. |
50
- | [options.retry.delay] | <code>number</code> | <code>1000</code> | Delay between retries in milliseconds when no `delayStrategy` is provided. If the value is `< 20` it is set to `20`; if `> 30000` it is set to `30000`. |
51
- | [options.retry.delayStrategy] | <code>function</code> | | A function that returns the delay (in milliseconds) to wait before the next retry. Signature: `(nbRetry, err, options, correlationId)`. Must return a number `> 0` and `< 30000`; otherwise `delay` is used. |
52
- | [options.retry.retryStrategy] | <code>function</code> | | A function that decides whether to retry. Signature: `(nbRetry, err, options, correlationId)`. Must return a boolean; otherwise it is ignored. |
53
- | [options.retry.timeout] | <code>number</code> | <code>50</code> | Request timeout (in seconds) applied to the initial request and all retries. If reached, a `TimeoutError` is thrown. Values `< 10` are set to `10`; values `> 120` are set to `120`. |
54
- | [options.retry.logLevel] | <code>object</code> | | Controls logging behavior. When omitted, requests and responses are logged at `info` with full details, and errors at `warn`. When provided but incomplete, only the provided keys are active; missing keys disable that logging. Non-object values are ignored and defaults apply. |
49
+ | [options.retry.retries] | <code>number</code> | <code>2</code> | Maximum number of retries, independent of the `retryStrategy`. If the value is `< 0`, it is set to `0`; if `> 15`, it is set to `15`. |
50
+ | [options.retry.delay] | <code>number</code> | <code>1000</code> | Delay between retries in milliseconds when no `delayStrategy` is provided. If the value is `< 20`, it is set to `20`; if `> 30000`, it is set to `30000`. |
51
+ | [options.retry.delayStrategy] | <code>function</code> | | A function that returns the delay (in milliseconds) to wait before the next retry. Signature: `(nbRetry, err, options, correlationId)`. Must return a number `> 0` and `< 30000`; otherwise `delay` is used. |
52
+ | [options.retry.retryStrategy] | <code>function</code> | | A function that decides whether to retry. Signature: `(nbRetry, err, options, correlationId)`. Must return a boolean; otherwise it is ignored. |
53
+ | [options.retry.timeout] | <code>number</code> | <code>50</code> | Request timeout (in seconds) applied to the initial request and all retries. If reached, a `TimeoutError` is thrown. Values `< 10` are set to `10`; values `> 120` are set to `120`. |
54
+ | [options.retry.logLevel] | <code>object</code> | | Controls logging behavior. When omitted, requests and responses are logged at `info` with full details, and errors at `warn`. When provided but incomplete, only the provided keys are active; missing keys disable that logging. Non-object values are ignored and defaults apply. |
55
55
  | [options.retry.logLevel.response] | <code>string</code> | | Log level for responses. Invalid values fall back to `silly`. |
56
56
  | [options.retry.logLevel.error] | <code>string</code> | | Log level for errors. Invalid values fall back to `silly`. |
57
57
  | [options.retry.logLevel.request] | <code>string</code> | | Log level for requests. Invalid values fall back to `silly`. |
58
- | [options.retry.logLevel.responseDetails] | <code>string</code> | <code>&quot;&#x27;type&#x27;&quot;</code> | Detail level for the response: `count`, `type`, or `full`. Invalid values fall back to `type`. When `logLevel` is omitted entirely, the default is `full`. |
59
- | [options.retry.logLevel.responseName] | <code>string</code> | <code>&quot;&#x27;response&#x27;&quot;</code> | Label associated with the response. Non-string or empty values fall back to `response`. |
58
+ | [options.retry.logLevel.responseDetails] | <code>string</code> | <code>&quot;&#x27;type&#x27;&quot;</code> | Detail level for the response: `count`, `type`, or `full`. Invalid values fall back to `type`. When `logLevel` is omitted entirely, the default is `full`. |
59
+ | [options.retry.logLevel.responseName] | <code>string</code> | <code>&quot;&#x27;response&#x27;&quot;</code> | Label associated with the response. Non-string or empty values fall back to `response`. |
60
60
  | [options.metrics] | <code>object</code> | | Metrics configuration. |
61
61
  | [options.metrics.HTTPRequestDuration] | <code>function</code> | | A `prom-client` metric function to measure request duration. |
62
62
  | [options.metrics.url] | <code>string</code> | | Optional URL label for the metric. If omitted, the request URL is used. |
package/index.js CHANGED
@@ -51,26 +51,26 @@ Promise.config({ cancellation: true });
51
51
  * when `true`, the full Axios response object is returned; when `false` or omitted, only `response.data` is returned.
52
52
  * @param {object} [options.retry] - Retry configuration.
53
53
  * @param {number} [options.retry.retries=2] - Maximum number of retries, independent of the `retryStrategy`.
54
- * If the value is `< 0` it is set to `0`; if `> 15` it is set to `15`.
54
+ * If the value is `< 0`, it is set to `0`; if `> 15`, it is set to `15`.
55
55
  * @param {number} [options.retry.delay=1000] - Delay between retries in milliseconds when no `delayStrategy` is provided.
56
- * If the value is `< 20` it is set to `20`; if `> 30000` it is set to `30000`.
56
+ * If the value is `< 20`, it is set to `20`; if `> 30000`, it is set to `30000`.
57
57
  * @param {Function} [options.retry.delayStrategy] - A function that returns the delay (in milliseconds) to wait before the next retry.
58
- * Signature: `(nbRetry, err, options, correlationId)`. Must return a number `> 0` and `< 30000`; otherwise `delay` is used.
58
+ * Signature: `(nbRetry, err, options, correlationId)`. Must return a number `> 0` and `< 30000`; otherwise `delay` is used.
59
59
  * @param {Function} [options.retry.retryStrategy] - A function that decides whether to retry. Signature:
60
- * `(nbRetry, err, options, correlationId)`. Must return a boolean; otherwise it is ignored.
60
+ * `(nbRetry, err, options, correlationId)`. Must return a boolean; otherwise it is ignored.
61
61
  * @param {number} [options.retry.timeout=50] - Request timeout (in seconds) applied to the initial request and all retries.
62
- * If reached, a `TimeoutError` is thrown. Values `< 10` are set to `10`; values `> 120` are set to `120`.
62
+ * If reached, a `TimeoutError` is thrown. Values `< 10` are set to `10`; values `> 120` are set to `120`.
63
63
  * @param {object} [options.retry.logLevel] - Controls logging behavior.
64
- * When omitted, requests and responses are logged at `info` with full details, and errors at `warn`.
65
- * When provided but incomplete, only the provided keys are active; missing keys disable that logging.
66
- * Non-object values are ignored and defaults apply.
64
+ * When omitted, requests and responses are logged at `info` with full details, and errors at `warn`.
65
+ * When provided but incomplete, only the provided keys are active; missing keys disable that logging.
66
+ * Non-object values are ignored and defaults apply.
67
67
  * @param {string} [options.retry.logLevel.response] - Log level for responses. Invalid values fall back to `silly`.
68
68
  * @param {string} [options.retry.logLevel.error] - Log level for errors. Invalid values fall back to `silly`.
69
69
  * @param {string} [options.retry.logLevel.request] - Log level for requests. Invalid values fall back to `silly`.
70
70
  * @param {string} [options.retry.logLevel.responseDetails='type'] - Detail level for the response: `count`, `type`, or `full`.
71
- * Invalid values fall back to `type`. When `logLevel` is omitted entirely, the default is `full`.
71
+ * Invalid values fall back to `type`. When `logLevel` is omitted entirely, the default is `full`.
72
72
  * @param {string} [options.retry.logLevel.responseName='response'] - Label associated with the response.
73
- * Non-string or empty values fall back to `response`.
73
+ * Non-string or empty values fall back to `response`.
74
74
  * @param {object} [options.metrics] - Metrics configuration.
75
75
  * @param {Function} [options.metrics.HTTPRequestDuration] - A `prom-client` metric function to measure request duration.
76
76
  * @param {string} [options.metrics.url] - Optional URL label for the metric. If omitted, the request URL is used.
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@mimik/request-retry",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "Request retry wrapping axios",
5
5
  "main": "./index.js",
6
+ "exports": "./index.js",
6
7
  "type": "module",
7
8
  "scripts": {
8
9
  "docs": "jsdoc2md index.js > README.md",
9
10
  "lint": "eslint . --no-error-on-unmatched-pattern",
10
- "test": "mocha --reporter mochawesome --bail --check-leaks --exit test/",
11
- "test-ci": "c8 --reporter=lcov --reporter=text npm test",
11
+ "test": "mocha",
12
+ "test-ci": "c8 npm test",
12
13
  "prepublishOnly": "npm run docs && npm run lint && npm run test-ci",
13
14
  "commit-ready": "npm run docs && npm run lint && npm run test-ci"
14
15
  },
@@ -28,26 +29,26 @@
28
29
  "dependencies": {
29
30
  "@mimik/request-helper": "^2.0.6",
30
31
  "@mimik/response-helper": "^4.0.11",
31
- "@mimik/sumologic-winston-logger": "^2.2.1",
32
+ "@mimik/sumologic-winston-logger": "^2.2.2",
32
33
  "axios": "1.13.6",
33
34
  "bluebird": "3.7.2"
34
35
  },
35
36
  "devDependencies": {
36
- "@eslint/js": "9.39.4",
37
+ "@eslint/js": "10.0.1",
37
38
  "@mimik/eslint-plugin-document-env": "^2.0.9",
38
- "@mimik/eslint-plugin-logger": "1.0.3",
39
+ "@mimik/eslint-plugin-logger": "^1.0.3",
39
40
  "@stylistic/eslint-plugin": "5.10.0",
40
41
  "body-parser": "2.2.2",
41
42
  "c8": "11.0.0",
42
43
  "chai": "6.2.2",
43
- "eslint": "9.39.4",
44
- "eslint-plugin-import": "2.32.0",
44
+ "eslint": "10.1.0",
45
+ "eslint-plugin-import-x": "4.16.2",
45
46
  "express": "5.2.1",
46
47
  "globals": "17.4.0",
47
48
  "husky": "9.1.7",
48
49
  "jsdoc-to-markdown": "9.1.3",
49
50
  "mocha": "11.7.5",
50
51
  "mochawesome": "7.1.4",
51
- "sinon": "21.0.2"
52
+ "sinon": "21.0.3"
52
53
  }
53
54
  }