@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.
- package/.github/workflows/eslint.yml +1 -1
- package/app/lib/queue.js +10 -11
- package/package.json +8 -8
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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.
|
|
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.
|
|
19
|
+
"p-queue": "7.4.1",
|
|
20
20
|
"pretty-bytes": "6.1.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@k03mad/eslint-config": "
|
|
23
|
+
"@k03mad/eslint-config": "13.2.1",
|
|
24
24
|
"@microsoft/eslint-formatter-sarif": "3.0.0",
|
|
25
|
-
"eslint": "8.
|
|
26
|
-
"eslint-plugin-import": "2.
|
|
27
|
-
"eslint-plugin-jsdoc": "46.
|
|
28
|
-
"eslint-plugin-n": "16.0
|
|
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": "
|
|
31
|
+
"eslint-plugin-unicorn": "49.0.0",
|
|
32
32
|
"husky": "8.0.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|