@k03mad/request 3.0.0 → 3.1.0

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.
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  steps:
21
21
  - name: Checkout
22
- uses: actions/checkout@v3
22
+ uses: actions/checkout@v4
23
23
 
24
24
  - name: Install NodeJS
25
25
  uses: actions/setup-node@v3
package/app/lib/queue.js CHANGED
@@ -11,6 +11,7 @@ const intervals = {
11
11
 
12
12
  // host: p-queue options
13
13
  const requestQueue = {
14
+ // default
14
15
  '*': intervals.concurrency(3),
15
16
  };
16
17
 
@@ -40,23 +41,21 @@ const getLoggedQueue = (host, opts) => {
40
41
 
41
42
  /**
42
43
  * @param {string} host
43
- * @param {object} params
44
- * @param {number} params.concurrency
45
- * @param {number} params.rpm
46
- * @param {number} params.rps
44
+ * @param {object} [params]
45
+ * @param {number} [params.concurrency]
46
+ * @param {number} [params.rpm]
47
+ * @param {number} [params.rps]
47
48
  * @returns {object}
48
49
  */
49
- export default (host, params) => {
50
+ export default (host, params = {}) => {
50
51
  if (requestQueue[host]?._events) {
51
52
  return requestQueue[host];
52
53
  }
53
54
 
54
- if (Object.keys(params).length > 0) {
55
- for (const [key, value] of Object.entries(params)) {
56
- if (intervals[key]) {
57
- requestQueue[host] = intervals[key](value);
58
- break;
59
- }
55
+ for (const [key, value] of Object.entries(params)) {
56
+ if (intervals[key]) {
57
+ requestQueue[host] = intervals[key](value);
58
+ break;
60
59
  }
61
60
  }
62
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k03mad/request",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Request library",
5
5
  "maintainers": [
6
6
  "Kirill Molchanov <k03.mad@gmail.com"
@@ -16,19 +16,19 @@
16
16
  "chalk": "5.3.0",
17
17
  "debug": "4.3.4",
18
18
  "got": "13.0.0",
19
- "p-queue": "7.3.4",
19
+ "p-queue": "7.4.1",
20
20
  "pretty-bytes": "6.1.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@k03mad/eslint-config": "12.0.6",
23
+ "@k03mad/eslint-config": "13.2.1",
24
24
  "@microsoft/eslint-formatter-sarif": "3.0.0",
25
- "eslint": "8.46.0",
26
- "eslint-plugin-import": "2.28.0",
27
- "eslint-plugin-jsdoc": "46.4.5",
28
- "eslint-plugin-n": "16.0.1",
25
+ "eslint": "8.52.0",
26
+ "eslint-plugin-import": "2.29.0",
27
+ "eslint-plugin-jsdoc": "46.8.2",
28
+ "eslint-plugin-n": "16.2.0",
29
29
  "eslint-plugin-simple-import-sort": "10.0.0",
30
30
  "eslint-plugin-sort-destructure-keys": "1.5.0",
31
- "eslint-plugin-unicorn": "48.0.1",
31
+ "eslint-plugin-unicorn": "49.0.0",
32
32
  "husky": "8.0.3"
33
33
  },
34
34
  "scripts": {