@orion-js/echoes 3.5.0 → 3.5.3
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/lib/request/index.js +2 -0
- package/lib/request/makeRequest.js +12 -8
- package/lib/types.d.ts +4 -0
- package/package.json +5 -5
package/lib/request/index.js
CHANGED
|
@@ -19,6 +19,8 @@ async function request(options) {
|
|
|
19
19
|
const requestMaker = config_1.default?.requests?.makeRequest || makeRequest_1.makeRequest;
|
|
20
20
|
const requestOptions = {
|
|
21
21
|
url: (0, getURL_1.default)(service),
|
|
22
|
+
retries: options.retries,
|
|
23
|
+
timeout: options.timeout,
|
|
22
24
|
data: {
|
|
23
25
|
body,
|
|
24
26
|
signature
|
|
@@ -5,15 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeRequest = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const helpers_1 = require("@orion-js/helpers");
|
|
8
9
|
const makeRequest = async (options) => {
|
|
9
|
-
const result = await (0,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const result = await (0, helpers_1.executeWithRetries)(async () => {
|
|
11
|
+
return await (0, axios_1.default)({
|
|
12
|
+
method: 'post',
|
|
13
|
+
url: options.url,
|
|
14
|
+
timeout: options.timeout,
|
|
15
|
+
headers: {
|
|
16
|
+
'User-Agent': 'Orionjs-Echoes/1.1'
|
|
17
|
+
},
|
|
18
|
+
data: options.data
|
|
19
|
+
});
|
|
20
|
+
}, options.retries, 200);
|
|
17
21
|
return {
|
|
18
22
|
data: result.data,
|
|
19
23
|
statusCode: result.status
|
package/lib/types.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface RequestOptions<TParams> {
|
|
|
17
17
|
method: string;
|
|
18
18
|
service: string;
|
|
19
19
|
params: TParams;
|
|
20
|
+
retries?: number;
|
|
21
|
+
timeout?: number;
|
|
20
22
|
}
|
|
21
23
|
export interface RequestHandlerResponse {
|
|
22
24
|
result?: any;
|
|
@@ -24,6 +26,8 @@ export interface RequestHandlerResponse {
|
|
|
24
26
|
}
|
|
25
27
|
export interface MakeRequestParams {
|
|
26
28
|
url: string;
|
|
29
|
+
retries?: number;
|
|
30
|
+
timeout?: number;
|
|
27
31
|
data: {
|
|
28
32
|
body: object;
|
|
29
33
|
signature: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/echoes",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@orion-js/env": "^3.5.0",
|
|
21
|
-
"@orion-js/helpers": "^3.5.
|
|
22
|
-
"@orion-js/http": "^3.5.
|
|
23
|
-
"@orion-js/services": "^3.5.
|
|
21
|
+
"@orion-js/helpers": "^3.5.3",
|
|
22
|
+
"@orion-js/http": "^3.5.3",
|
|
23
|
+
"@orion-js/services": "^3.5.3",
|
|
24
24
|
"axios": "^0.24.0",
|
|
25
25
|
"jssha": "^3.2.0",
|
|
26
26
|
"kafkajs": "^1.15.0",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "34430096bb765afdc07b6f3c079915d424491b9c"
|
|
44
44
|
}
|