@zauru-sdk/services 2.23.0 → 2.23.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.
|
@@ -9,6 +9,10 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
9
9
|
const baseName = `${request.baseURL}${request.url}`;
|
|
10
10
|
console.log(chalk.green(baseName));
|
|
11
11
|
request.timeout = 200000;
|
|
12
|
+
request.metadata = { startTime: Date.now() };
|
|
13
|
+
if (config.debugHTTP) {
|
|
14
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
|
|
15
|
+
}
|
|
12
16
|
return request;
|
|
13
17
|
}, function (error) {
|
|
14
18
|
console.log(chalk.red("---------------- ERROR CON REQUEST CMS ----------------"));
|
|
@@ -19,13 +23,22 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
19
23
|
// Add a response interceptor
|
|
20
24
|
axiosInstance.interceptors.response.use(function (response) {
|
|
21
25
|
// Do something with response data
|
|
22
|
-
|
|
26
|
+
if (config.debugHTTP) {
|
|
27
|
+
const elapsed = Date.now() -
|
|
28
|
+
(response.config.metadata?.startTime ?? Date.now());
|
|
29
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
30
|
+
console.log(chalk.cyan("[DEBUG] RESPONSE DATA:"), JSON.stringify(response.data, null, 2));
|
|
31
|
+
}
|
|
23
32
|
return response;
|
|
24
33
|
}, function (error) {
|
|
25
34
|
console.log(chalk.red("---------------- ERROR CON REQUEST CMS ----------------"));
|
|
26
35
|
console.log(`${error}`);
|
|
27
36
|
// Do something with response error
|
|
28
37
|
const { response } = error;
|
|
38
|
+
if (config.debugHTTP) {
|
|
39
|
+
const elapsed = Date.now() - (error.config?.metadata?.startTime ?? Date.now());
|
|
40
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
41
|
+
}
|
|
29
42
|
const msgError = response
|
|
30
43
|
? `HTTP ${response.status} ${response.statusText} - URL: ${response?.config?.baseURL}${response?.config?.url} - ${JSON.stringify(response?.data)}`
|
|
31
44
|
: error;
|
|
@@ -9,6 +9,10 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
9
9
|
const baseName = `${request.baseURL}${request.url}`;
|
|
10
10
|
console.log(chalk.green(baseName));
|
|
11
11
|
request.timeout = 200000;
|
|
12
|
+
request.metadata = { startTime: Date.now() };
|
|
13
|
+
if (config.debugHTTP) {
|
|
14
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
|
|
15
|
+
}
|
|
12
16
|
return request;
|
|
13
17
|
}, function (error) {
|
|
14
18
|
console.log(chalk.red("---------------- ERROR CON REQUEST GRAPHQL ----------------"));
|
|
@@ -19,13 +23,22 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
19
23
|
// Add a response interceptor
|
|
20
24
|
axiosInstance.interceptors.response.use(function (response) {
|
|
21
25
|
// Do something with response data
|
|
22
|
-
|
|
26
|
+
if (config.debugHTTP) {
|
|
27
|
+
const elapsed = Date.now() -
|
|
28
|
+
(response.config.metadata?.startTime ?? Date.now());
|
|
29
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
30
|
+
console.log(chalk.cyan("[DEBUG] RESPONSE DATA:"), JSON.stringify(response.data, null, 2));
|
|
31
|
+
}
|
|
23
32
|
return response;
|
|
24
33
|
}, function (error) {
|
|
25
34
|
console.log(chalk.red("---------------- ERROR CON REQUEST GRAPHQL ----------------"));
|
|
26
35
|
console.log(`${error}`);
|
|
27
36
|
// Do something with response error
|
|
28
37
|
const { response } = error;
|
|
38
|
+
if (config.debugHTTP) {
|
|
39
|
+
const elapsed = Date.now() - (error.config?.metadata?.startTime ?? Date.now());
|
|
40
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
41
|
+
}
|
|
29
42
|
const msgError = response
|
|
30
43
|
? `HTTP ${response.status} ${response.statusText} - URL: ${response?.config?.baseURL}${response?.config?.url} - ${JSON.stringify(response?.data)}`
|
|
31
44
|
: error;
|
|
@@ -9,6 +9,10 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
9
9
|
const baseName = `${request.baseURL}${request.url}`;
|
|
10
10
|
console.log(chalk.green(baseName));
|
|
11
11
|
request.timeout = 200000;
|
|
12
|
+
request.metadata = { startTime: Date.now() };
|
|
13
|
+
if (config.debugHTTP) {
|
|
14
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
|
|
15
|
+
}
|
|
12
16
|
return request;
|
|
13
17
|
}, function (error) {
|
|
14
18
|
console.log(chalk.red("---------------- ERROR CON REQUEST ----------------"));
|
|
@@ -19,13 +23,22 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
19
23
|
// Add a response interceptor
|
|
20
24
|
axiosInstance.interceptors.response.use(function (response) {
|
|
21
25
|
// Do something with response data
|
|
22
|
-
|
|
26
|
+
if (config.debugHTTP) {
|
|
27
|
+
const elapsed = Date.now() -
|
|
28
|
+
(response.config.metadata?.startTime ?? Date.now());
|
|
29
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
30
|
+
console.log(chalk.cyan("[DEBUG] RESPONSE DATA:"), JSON.stringify(response.data, null, 2));
|
|
31
|
+
}
|
|
23
32
|
return response;
|
|
24
33
|
}, function (error) {
|
|
25
34
|
console.log(chalk.red("---------------- ERROR CON REQUEST ----------------"));
|
|
26
35
|
console.log(`${error}`);
|
|
27
36
|
// Do something with response error
|
|
28
37
|
const { response } = error;
|
|
38
|
+
if (config.debugHTTP) {
|
|
39
|
+
const elapsed = Date.now() - (error.config?.metadata?.startTime ?? Date.now());
|
|
40
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
41
|
+
}
|
|
29
42
|
const msgError = response
|
|
30
43
|
? `HTTP ${response.status} ${response.statusText} - URL: ${response?.config?.baseURL}${response?.config?.url} - ${JSON.stringify(response?.data)}`
|
|
31
44
|
: error;
|
|
@@ -9,6 +9,10 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
9
9
|
const baseName = `${request.baseURL}${request.url}`;
|
|
10
10
|
console.log(chalk.green(baseName));
|
|
11
11
|
request.timeout = 200000;
|
|
12
|
+
request.metadata = { startTime: Date.now() };
|
|
13
|
+
if (config.debugHTTP) {
|
|
14
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
|
|
15
|
+
}
|
|
12
16
|
return request;
|
|
13
17
|
}, function (error) {
|
|
14
18
|
console.log(chalk.red("---------------- ERROR CON REQUEST (REQUEST INTERCEPTOR) ----------------"));
|
|
@@ -19,12 +23,21 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
19
23
|
// Add a response interceptor
|
|
20
24
|
axiosInstance.interceptors.response.use(function (response) {
|
|
21
25
|
// Do something with response data
|
|
22
|
-
|
|
26
|
+
if (config.debugHTTP) {
|
|
27
|
+
const elapsed = Date.now() -
|
|
28
|
+
(response.config.metadata?.startTime ?? Date.now());
|
|
29
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
30
|
+
console.log(chalk.cyan("[DEBUG] RESPONSE DATA:"), JSON.stringify(response.data, null, 2));
|
|
31
|
+
}
|
|
23
32
|
return response;
|
|
24
33
|
}, function (error) {
|
|
25
34
|
console.log(chalk.red("---------------- ERROR CON REQUEST (RESPONSE INTERCEPTOR) ----------------"));
|
|
26
35
|
// Do something with response error
|
|
27
36
|
const { response } = error;
|
|
37
|
+
if (config.debugHTTP) {
|
|
38
|
+
const elapsed = Date.now() - (error.config?.metadata?.startTime ?? Date.now());
|
|
39
|
+
console.log(chalk.cyan(`[DEBUG] RESPONSE TIME: ${elapsed}ms`));
|
|
40
|
+
}
|
|
28
41
|
const msgError = response
|
|
29
42
|
? `HTTP ${response.status} ${response.statusText} - URL: ${response?.config?.baseURL}${response?.config?.url} - ${JSON.stringify(response?.data)}`
|
|
30
43
|
: error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.1",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@remix-run/node": "^2.8.1",
|
|
27
27
|
"@upstash/redis": "^1.34.5",
|
|
28
28
|
"@zauru-sdk/common": "^2.16.1",
|
|
29
|
-
"@zauru-sdk/config": "^2.
|
|
29
|
+
"@zauru-sdk/config": "^2.23.1",
|
|
30
30
|
"@zauru-sdk/graphql": "^2.19.1",
|
|
31
31
|
"@zauru-sdk/types": "^2.16.0",
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"chalk": "5.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "286f920db89f530c25ed6173e3e90a75516aeea6"
|
|
36
36
|
}
|