@mimik/request-retry 4.0.5 → 4.0.6

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/README.md CHANGED
@@ -17,7 +17,7 @@ Make a request with retries.
17
17
  **Throws**:
18
18
 
19
19
  - <code>Error</code> An error produced by `getRichError`, wrapping an error from
20
- [request-promise](https://www.npmjs.com/package/request-promise) or a `TimeoutError`.
20
+ [request-promise](https://www.npmjs.com/package/request-promise) or a `TimeoutError`.
21
21
 
22
22
  The following properties may be added to the `options` object under the `retry` property:
23
23
  - retries `{int}`: Maximum number of retries, independent of the `retryStrategy`. Default: `2`.
@@ -71,5 +71,5 @@ To ease migration from `request-promise`, the following adjustments are applied
71
71
 
72
72
  | Param | Type | Description |
73
73
  | --- | --- | --- |
74
- | 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. |
74
+ | 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. |
75
75
 
package/index.js CHANGED
@@ -48,13 +48,13 @@ Promise.config({ cancellation: true });
48
48
  * @requires @mimik/response-helper
49
49
  * @category async
50
50
  * @param {object} options - Options for the request (similar to [axios](https://www.npmjs.com/package/axios)).
51
- * The `validateStatus` option is disabled: an error is thrown for status codes outside **[200, 300)**.
52
- * An additional option, `resolveWithFullResponse`, controls the return shape:
53
- * when `true`, the full Axios response object is returned; when `false` or omitted, only `response.data` is returned.
51
+ * The `validateStatus` option is disabled: an error is thrown for status codes outside **[200, 300)**.
52
+ * An additional option, `resolveWithFullResponse`, controls the return shape:
53
+ * when `true`, the full Axios response object is returned; when `false` or omitted, only `response.data` is returned.
54
54
  * @return {Promise}
55
55
  * @fulfil {object} - The Axios response when `resolveWithFullResponse` is `true`; otherwise `response.data`.
56
56
  * @throws {Error} An error produced by `getRichError`, wrapping an error from
57
- * [request-promise](https://www.npmjs.com/package/request-promise) or a `TimeoutError`.
57
+ * [request-promise](https://www.npmjs.com/package/request-promise) or a `TimeoutError`.
58
58
  *
59
59
  * The following properties may be added to the `options` object under the `retry` property:
60
60
  * - retries `{int}`: Maximum number of retries, independent of the `retryStrategy`. Default: `2`.
@@ -10,7 +10,7 @@ import process from 'process';
10
10
  * | SUMO_LOGIC_COLLECTOR_CODE | code to use to log on sumologic | null
11
11
  * | NO_STACK | flag to have a stack associated with the log | yes
12
12
  * | LOG_LEVEL | log level to log | error
13
- * | CONSOLE_LEVEL | log level to diplay | debug
13
+ * | CONSOLE_LEVEL | log level to display | debug
14
14
  * | LOG_MODE | log mode | none
15
15
  */
16
16
  /*
@@ -26,12 +26,12 @@ const options = {
26
26
  * delayStrategy: 'joe', // => setDelay returning retryDelay
27
27
  * delayStrategy: function badDelay() { return 'joe' }, // => no change then bad delay strategy => retryDelay
28
28
  * delayStrategy: function userDelay(...args) { return (Math.pow(2, args[0]) * 100) + Math.floor(Math.random() * 50) }, // OK
29
- * retryStrategy: 'joe', // => unknowRetry returning false
29
+ * retryStrategy: 'joe', // => unknownRetry returning false
30
30
  * retryStrategy: function badRetry() { return 'joe' }, // => no change then bad retry strategy => false
31
31
  * retryStrategy: function userRetry(...args) { // OK
32
32
  * const { statusCode } = args[1]; // err
33
33
  *
34
- * return statusCode && (Math.floor(statusCode/100) !== 5 || statusCode !== 429); // retry if there is no statusCode or if there is 500 range statucCode or 429
34
+ * return statusCode && (Math.floor(statusCode/100) !== 5 || statusCode !== 429); // retry if there is no statusCode or if there is 500 range statusCode or 429
35
35
  * },
36
36
  * retryStrategy: function invalidRetry(...args) { // defaultRetry
37
37
  * const { statusCode } = args[34]; // null value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimik/request-retry",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "Request retry wrapping axios",
5
5
  "main": "./index.js",
6
6
  "type": "module",
@@ -31,25 +31,25 @@
31
31
  "dependencies": {
32
32
  "@mimik/request-helper": "^2.0.2",
33
33
  "@mimik/response-helper": "^4.0.6",
34
- "@mimik/sumologic-winston-logger": "^2.1.6",
34
+ "@mimik/sumologic-winston-logger": "^2.1.8",
35
35
  "axios": "1.12.2",
36
36
  "bluebird": "3.7.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@eslint/js": "9.35.0",
39
+ "@eslint/js": "9.36.0",
40
40
  "@mimik/eslint-plugin-document-env": "^2.0.8",
41
- "@stylistic/eslint-plugin": "5.3.1",
41
+ "@stylistic/eslint-plugin": "5.4.0",
42
42
  "acorn": "8.15.0",
43
43
  "body-parser": "2.2.0",
44
44
  "c8": "10.1.3",
45
45
  "chai": "6.0.1",
46
- "eslint": "9.35.0",
46
+ "eslint": "9.36.0",
47
47
  "eslint-plugin-import": "2.32.0",
48
48
  "express": "5.1.0",
49
49
  "husky": "9.1.7",
50
50
  "jsdoc-to-markdown": "9.1.2",
51
51
  "mocha": "11.7.2",
52
- "mochawesome": "7.1.3",
52
+ "mochawesome": "7.1.4",
53
53
  "sinon": "21.0.0"
54
54
  }
55
55
  }
package/test/testEnv.js CHANGED
@@ -10,7 +10,7 @@ import process from 'node:process';
10
10
  * | SUMO_LOGIC_COLLECTOR_CODE | code to use to log on sumologic | null
11
11
  * | NO_STACK | flag to have a stack associated with the log | yes
12
12
  * | LOG_LEVEL | log level to log | error
13
- * | CONSOLE_LEVEL | log level to diplay | debug
13
+ * | CONSOLE_LEVEL | log level to display | debug
14
14
  * | LOG_MODE | log mode | none
15
15
  */
16
16