@widergy/polling-handling 1.7.0 → 2.0.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/CHANGELOG.md +14 -0
- package/lib/index.js +7 -7
- package/package.json +21 -55
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.0.0](https://github.com/widergy/polling-handling/compare/v1.7.0...v2.0.0) (2023-11-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update dependencies polling handling ([#12](https://github.com/widergy/polling-handling/issues/12)) ([6d09688](https://github.com/widergy/polling-handling/commit/6d09688af2b32a4c71f407da8da98d5fb722a82c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* dependencies
|
|
12
|
+
|
|
13
|
+
* fix: fixing node image
|
|
14
|
+
|
|
1
15
|
# [1.7.0](https://github.com/widergy/polling-handling/compare/v1.6.2...v1.7.0) (2023-09-22)
|
|
2
16
|
|
|
3
17
|
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const web_utils_1 = require("@widergy/web-utils");
|
|
|
6
6
|
const DEFAULT_INTERVAL = 1000;
|
|
7
7
|
const DEFAULT_TIMEOUT = 70000;
|
|
8
8
|
const POLLING_TIMEOUT_ERROR = 'PollingTimeoutError';
|
|
9
|
-
const api = apisauce_1.create({
|
|
9
|
+
const api = (0, apisauce_1.create)({
|
|
10
10
|
baseURL: 'localhost',
|
|
11
11
|
timeout: 30000,
|
|
12
12
|
});
|
|
@@ -32,7 +32,7 @@ const pollResource = (url, interval, timeout, headers, failureCallback, original
|
|
|
32
32
|
failureCallback(response, {
|
|
33
33
|
name: POLLING_TIMEOUT_ERROR,
|
|
34
34
|
originalUrl,
|
|
35
|
-
timeout
|
|
35
|
+
timeout,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
reject(new PollingTimeoutError(`Polling timed out on url: ${url}`));
|
|
@@ -42,11 +42,11 @@ const pollResource = (url, interval, timeout, headers, failureCallback, original
|
|
|
42
42
|
resolve(response);
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
if (errorHandling_1.existsErrorCode(web_utils_1.ERROR_CODES.GATEWAY_TIMEOUT, response.data))
|
|
45
|
+
if ((0, errorHandling_1.existsErrorCode)(web_utils_1.ERROR_CODES.GATEWAY_TIMEOUT, response.data))
|
|
46
46
|
failureCallback(response, {
|
|
47
47
|
name: POLLING_TIMEOUT_ERROR,
|
|
48
48
|
originalUrl,
|
|
49
|
-
timeout
|
|
49
|
+
timeout,
|
|
50
50
|
});
|
|
51
51
|
reject(response);
|
|
52
52
|
}
|
|
@@ -69,7 +69,7 @@ const poll = async (baseUrl, request, failureCallback, originalUrl, timeout = DE
|
|
|
69
69
|
const retry = async (config, timeout, options, pollingInstance) => {
|
|
70
70
|
const { baseURL, headers, reqTimeout } = config;
|
|
71
71
|
const retryRequest = { baseURL, headers, reqTimeout };
|
|
72
|
-
return await pollingInstance.handle(apisauce_1.create(retryRequest).get(config.url), timeout, options);
|
|
72
|
+
return await pollingInstance.handle((0, apisauce_1.create)(retryRequest).get(config.url), timeout, options);
|
|
73
73
|
};
|
|
74
74
|
class Polling {
|
|
75
75
|
constructor(baseUrl = '', failureCallback = Function) {
|
|
@@ -91,7 +91,7 @@ class Polling {
|
|
|
91
91
|
const { retries = 0 } = options || {};
|
|
92
92
|
const response = {};
|
|
93
93
|
if (!request.ok) {
|
|
94
|
-
response.error = errorHandling_1.getResponseError(request);
|
|
94
|
+
response.error = (0, errorHandling_1.getResponseError)(request);
|
|
95
95
|
response.status = request.status;
|
|
96
96
|
return response;
|
|
97
97
|
}
|
|
@@ -103,7 +103,7 @@ class Polling {
|
|
|
103
103
|
.catch((err) => {
|
|
104
104
|
if (retries)
|
|
105
105
|
return retry(request.config, timeout, Object.assign(Object.assign({}, options), { retries: retries - 1 }), this);
|
|
106
|
-
response.error = errorHandling_1.getResponseError(err);
|
|
106
|
+
response.error = (0, errorHandling_1.getResponseError)(err);
|
|
107
107
|
response.status = err.status;
|
|
108
108
|
response.originalUrl = originalUrl;
|
|
109
109
|
return response;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widergy/polling-handling",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Utility GO! Polling Handling",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"prepare": "npm run build",
|
|
9
|
+
"prepare": "npm run build && husky install",
|
|
10
10
|
"build": "tsc"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
@@ -28,66 +28,32 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/widergy/polling-handling#readme",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@commitlint/cli": "^
|
|
32
|
-
"@commitlint/config-conventional": "^
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
31
|
+
"@commitlint/cli": "^17.7.1",
|
|
32
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
34
|
+
"@typescript-eslint/eslint-plugin-tslint": "^6.6.0",
|
|
35
|
+
"@typescript-eslint/parser": "^6.6.0",
|
|
36
|
+
"@widergy/semantic-release-package-config": "^1.0.0",
|
|
37
|
+
"eslint": "^8.48.0",
|
|
38
|
+
"eslint-config-prettier": "^9.0.0",
|
|
39
|
+
"eslint-config-standard-with-typescript": "^39.0.0",
|
|
40
|
+
"eslint-plugin-ban": "^1.6.0",
|
|
41
|
+
"eslint-plugin-jsdoc": "^46.5.1",
|
|
42
|
+
"eslint-plugin-import": "^2.28.1",
|
|
43
|
+
"eslint-plugin-n": "^16.1.0",
|
|
44
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
45
|
+
"husky": "^8.0.0",
|
|
36
46
|
"semantic-release": "^15.13.31",
|
|
37
|
-
"
|
|
38
|
-
"tslint-config-prettier": "^1.15.0",
|
|
39
|
-
"tslint-config-standard": "^8.0.1",
|
|
40
|
-
"typescript": "^3.1.3"
|
|
47
|
+
"typescript": "^5.2.2"
|
|
41
48
|
},
|
|
42
49
|
"dependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
},
|
|
46
|
-
"husky": {
|
|
47
|
-
"hooks": {
|
|
48
|
-
"pre-commit": "node branch-name-hook",
|
|
49
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
50
|
-
}
|
|
50
|
+
"@widergy/web-utils": "^2.0.0",
|
|
51
|
+
"apisauce": "^3.0.1"
|
|
51
52
|
},
|
|
52
53
|
"resolutions": {
|
|
53
54
|
"@types/node": "^12.0.0"
|
|
54
55
|
},
|
|
55
56
|
"release": {
|
|
56
|
-
"
|
|
57
|
-
"@semantic-release/commit-analyzer",
|
|
58
|
-
"@semantic-release/release-notes-generator",
|
|
59
|
-
[
|
|
60
|
-
"@semantic-release/changelog",
|
|
61
|
-
{
|
|
62
|
-
"changelogFile": "./CHANGELOG.md"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"@semantic-release/npm",
|
|
66
|
-
[
|
|
67
|
-
"@semantic-release/git",
|
|
68
|
-
{
|
|
69
|
-
"assets": [
|
|
70
|
-
"./CHANGELOG.md",
|
|
71
|
-
"package.json"
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"@semantic-release/github"
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
"commitlint": {
|
|
79
|
-
"extends": [
|
|
80
|
-
"@commitlint/config-conventional"
|
|
81
|
-
],
|
|
82
|
-
"rules": {
|
|
83
|
-
"subject-case": [
|
|
84
|
-
2,
|
|
85
|
-
"never",
|
|
86
|
-
[
|
|
87
|
-
"start-case",
|
|
88
|
-
"pascal-case"
|
|
89
|
-
]
|
|
90
|
-
]
|
|
91
|
-
}
|
|
57
|
+
"extends": "@widergy/semantic-release-package-config"
|
|
92
58
|
}
|
|
93
59
|
}
|