@konversi/konversi-client 1.5.8 → 1.5.11
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/README.md +46 -46
- package/dist/index.d.mts +605 -505
- package/dist/index.d.ts +605 -505
- package/dist/index.js +26 -0
- package/dist/index.mjs +26 -0
- package/package.json +28 -28
package/dist/index.js
CHANGED
|
@@ -85,6 +85,32 @@ var instance = import_axios.default.create({
|
|
|
85
85
|
baseURL,
|
|
86
86
|
timeout
|
|
87
87
|
});
|
|
88
|
+
instance.interceptors.response.use(
|
|
89
|
+
(response) => response,
|
|
90
|
+
(error) => {
|
|
91
|
+
var _a, _b, _c, _d, _e;
|
|
92
|
+
if (error.isAxiosError) {
|
|
93
|
+
const method = (_b = (_a = error.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase();
|
|
94
|
+
const url = (_c = error.config) == null ? void 0 : _c.url;
|
|
95
|
+
const status = (_d = error.response) == null ? void 0 : _d.status;
|
|
96
|
+
const message = error.message;
|
|
97
|
+
const responseBody = (_e = error.response) == null ? void 0 : _e.data;
|
|
98
|
+
const cleanError = new Error(
|
|
99
|
+
[
|
|
100
|
+
`Konversi call failed`,
|
|
101
|
+
`Method: ${method}`,
|
|
102
|
+
`URL: ${url}`,
|
|
103
|
+
`Status: ${status}`,
|
|
104
|
+
`Message: ${message}`,
|
|
105
|
+
`Response Body:`,
|
|
106
|
+
JSON.stringify(responseBody, null, 2)
|
|
107
|
+
].join("\n")
|
|
108
|
+
);
|
|
109
|
+
return Promise.reject(cleanError);
|
|
110
|
+
}
|
|
111
|
+
return Promise.reject(error);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
88
114
|
var setBaseUrl = (baseUrl) => {
|
|
89
115
|
instance.defaults.baseURL = baseUrl;
|
|
90
116
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -47,6 +47,32 @@ var instance = axios.create({
|
|
|
47
47
|
baseURL,
|
|
48
48
|
timeout
|
|
49
49
|
});
|
|
50
|
+
instance.interceptors.response.use(
|
|
51
|
+
(response) => response,
|
|
52
|
+
(error) => {
|
|
53
|
+
var _a, _b, _c, _d, _e;
|
|
54
|
+
if (error.isAxiosError) {
|
|
55
|
+
const method = (_b = (_a = error.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase();
|
|
56
|
+
const url = (_c = error.config) == null ? void 0 : _c.url;
|
|
57
|
+
const status = (_d = error.response) == null ? void 0 : _d.status;
|
|
58
|
+
const message = error.message;
|
|
59
|
+
const responseBody = (_e = error.response) == null ? void 0 : _e.data;
|
|
60
|
+
const cleanError = new Error(
|
|
61
|
+
[
|
|
62
|
+
`Konversi call failed`,
|
|
63
|
+
`Method: ${method}`,
|
|
64
|
+
`URL: ${url}`,
|
|
65
|
+
`Status: ${status}`,
|
|
66
|
+
`Message: ${message}`,
|
|
67
|
+
`Response Body:`,
|
|
68
|
+
JSON.stringify(responseBody, null, 2)
|
|
69
|
+
].join("\n")
|
|
70
|
+
);
|
|
71
|
+
return Promise.reject(cleanError);
|
|
72
|
+
}
|
|
73
|
+
return Promise.reject(error);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
50
76
|
var setBaseUrl = (baseUrl) => {
|
|
51
77
|
instance.defaults.baseURL = baseUrl;
|
|
52
78
|
};
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@konversi/konversi-client",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"build": "tsup index.ts --format cjs,esm --dts",
|
|
10
|
-
"lint": "tsc"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [],
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"axios": "^1.6.8",
|
|
17
|
-
"ts-node": "^10.9.2"
|
|
18
|
-
},
|
|
19
|
-
"description": "",
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"tsup": "^8.2.4",
|
|
22
|
-
"typescript": "^5.4.5"
|
|
23
|
-
},
|
|
24
|
-
"files": [
|
|
25
|
-
"dist"
|
|
26
|
-
],
|
|
27
|
-
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@konversi/konversi-client",
|
|
3
|
+
"version": "1.5.11",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsup index.ts --format cjs,esm --dts",
|
|
10
|
+
"lint": "tsc"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"axios": "^1.6.8",
|
|
17
|
+
"ts-node": "^10.9.2"
|
|
18
|
+
},
|
|
19
|
+
"description": "",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tsup": "^8.2.4",
|
|
22
|
+
"typescript": "^5.4.5"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
|
|
28
|
+
}
|