@k03mad/request 5.3.0 → 5.4.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/.github/workflows/lint.yml +3 -0
- package/README.md +1 -1
- package/app/lib/queue.js +2 -2
- package/app/lib/request.js +2 -2
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"Got" with queues and debug logs
|
package/app/lib/queue.js
CHANGED
|
@@ -5,8 +5,8 @@ const debug = _debug('mad:queue');
|
|
|
5
5
|
|
|
6
6
|
const intervals = {
|
|
7
7
|
concurrency: num => ({concurrency: num}),
|
|
8
|
-
rpm: num => ({
|
|
9
|
-
rps: num => ({
|
|
8
|
+
rpm: num => ({interval: 60_000, intervalCap: num}),
|
|
9
|
+
rps: num => ({interval: 1000, intervalCap: num}),
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// host: p-queue options
|
package/app/lib/request.js
CHANGED
|
@@ -22,8 +22,8 @@ const cacheGotResponseKeys = [
|
|
|
22
22
|
|
|
23
23
|
const gotDefaultOpts = got.extend({
|
|
24
24
|
dnsCache: true,
|
|
25
|
-
timeout: {request: 15_000},
|
|
26
25
|
headers: {'user-agent': 'curl/8.4.0'},
|
|
26
|
+
timeout: {request: 15_000},
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
const cacheDebug = msgArr => {
|
|
@@ -142,7 +142,7 @@ export const requestCache = (url, opts = {}, {cacheBy, expire = 43_200, queueBy,
|
|
|
142
142
|
cachedResponse[key] = res[key];
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
gotCache.set(cacheKey, {date: Date.now()
|
|
145
|
+
gotCache.set(cacheKey, {cachedResponse, date: Date.now()});
|
|
146
146
|
cacheDebug([cyan('CACHE SAVED'), urlLog]);
|
|
147
147
|
|
|
148
148
|
return res;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k03mad/request",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "Request library",
|
|
5
5
|
"maintainers": [
|
|
6
6
|
"Kirill Molchanov <k03.mad@gmail.com"
|
|
7
7
|
],
|
|
8
8
|
"main": "app/index.js",
|
|
9
|
-
"repository":
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/k03mad/request.git"
|
|
12
|
+
},
|
|
10
13
|
"license": "MIT",
|
|
11
14
|
"type": "module",
|
|
12
15
|
"engines": {
|
|
@@ -21,18 +24,18 @@
|
|
|
21
24
|
"strip-ansi": "7.1.0"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@k03mad/eslint-config": "
|
|
27
|
+
"@k03mad/eslint-config": "18.0.0",
|
|
25
28
|
"eslint": "8.56.0",
|
|
26
29
|
"husky": "8.0.3"
|
|
27
30
|
},
|
|
28
31
|
"scripts": {
|
|
29
|
-
"lint": "
|
|
32
|
+
"lint": "pnpm run lint:eslint",
|
|
30
33
|
"lint:eslint": "eslint ./ --cache",
|
|
31
|
-
"clean": "
|
|
34
|
+
"clean": "pnpm run clean:modules && pnpm run clean:eslint:cache",
|
|
32
35
|
"clean:modules": "rm -rf ./node_modules || true",
|
|
33
36
|
"clean:eslint:cache": "rm -rf .eslintcache || true",
|
|
34
|
-
"setup": "
|
|
35
|
-
"setup:prod": "
|
|
37
|
+
"setup": "pnpm run clean && pnpm i",
|
|
38
|
+
"setup:prod": "pnpm run clean && pnpm i --omit=dev",
|
|
36
39
|
"prepare": "husky install || true"
|
|
37
40
|
}
|
|
38
41
|
}
|