@riocrypto/common-server 1.0.2015 → 1.0.2017
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.
|
@@ -35,11 +35,15 @@ function maskHeaders(headers) {
|
|
|
35
35
|
// Request Interceptor
|
|
36
36
|
axiosWithLogging.interceptors.request.use((config) => {
|
|
37
37
|
var _a;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const customConfig = config;
|
|
39
|
+
// Check if logging is disabled for this request
|
|
40
|
+
if (!customConfig.skipLogging) {
|
|
41
|
+
// Mask sensitive headers in the configuration
|
|
42
|
+
const maskedHeaders = maskHeaders(customConfig.headers);
|
|
43
|
+
// Combine and log the full request configuration with masked headers
|
|
44
|
+
const logMessage = `Request: method=${customConfig.method}, url=${customConfig.url}, headers=${JSON.stringify(maskedHeaders)}, data=${JSON.stringify(customConfig.data)}`;
|
|
45
|
+
((_a = logger_1.default.getLogger()) === null || _a === void 0 ? void 0 : _a.info(logMessage)) || console.log(logMessage);
|
|
46
|
+
}
|
|
43
47
|
return config;
|
|
44
48
|
}, (error) => {
|
|
45
49
|
var _a;
|
|
@@ -51,14 +55,20 @@ axiosWithLogging.interceptors.request.use((config) => {
|
|
|
51
55
|
// Response Interceptor
|
|
52
56
|
axiosWithLogging.interceptors.response.use((response) => {
|
|
53
57
|
var _a;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
const customConfig = response.config;
|
|
59
|
+
// Check if logging is disabled for this request
|
|
60
|
+
if (!customConfig.skipLogging) {
|
|
61
|
+
// Combine and log the full response details
|
|
62
|
+
const logMessage = `Response: url=${customConfig.url}, status=${response.status}, data=${JSON.stringify(response.data)}`;
|
|
63
|
+
((_a = logger_1.default.getLogger()) === null || _a === void 0 ? void 0 : _a.info(logMessage)) || console.log(logMessage);
|
|
64
|
+
}
|
|
57
65
|
return response;
|
|
58
66
|
}, (error) => {
|
|
59
67
|
var _a;
|
|
68
|
+
// Mask sensitive headers in the error config
|
|
69
|
+
const maskedHeaders = error.config ? maskHeaders(error.config.headers) : {};
|
|
60
70
|
// Combine and log the response error details
|
|
61
|
-
let logMessage = `Response Error: url=${error.config ? error.config.url : "unknown"}, message=${error.message}`;
|
|
71
|
+
let logMessage = `Response Error: url=${error.config ? error.config.url : "unknown"}, message=${error.message}, headers=${JSON.stringify(maskedHeaders)}`;
|
|
62
72
|
if (error.response) {
|
|
63
73
|
logMessage += `, status=${error.response.status}, data=${JSON.stringify(error.response.data)}`;
|
|
64
74
|
}
|
|
@@ -45,11 +45,12 @@ declare class ClusterClient {
|
|
|
45
45
|
deleteRecord(id: string): Promise<void>;
|
|
46
46
|
registerUserWithCoincover(userId: string): Promise<void>;
|
|
47
47
|
importOrder(orderToImport: ImportOrderData): Promise<void>;
|
|
48
|
-
createInternalTransfer({ amount, currency, origin, destination, }: {
|
|
48
|
+
createInternalTransfer({ amount, currency, origin, destination, liquidityAutomationId, }: {
|
|
49
49
|
amount: number;
|
|
50
50
|
currency: Fiat | Crypto;
|
|
51
51
|
origin: TreasuryProvider;
|
|
52
52
|
destination: TreasuryProvider;
|
|
53
|
+
liquidityAutomationId: string;
|
|
53
54
|
}): Promise<void>;
|
|
54
55
|
}
|
|
55
56
|
export declare const buildClusterClient: () => Promise<ClusterClient>;
|
|
@@ -346,9 +346,9 @@ class ClusterClient {
|
|
|
346
346
|
});
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
createInternalTransfer({ amount, currency, origin, destination, }) {
|
|
349
|
+
createInternalTransfer({ amount, currency, origin, destination, liquidityAutomationId, }) {
|
|
350
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
yield this.axios.post(`${this.baseUrl}/api/liquidity/transfers`, { amount, currency, origin, destination }, {
|
|
351
|
+
yield this.axios.post(`${this.baseUrl}/api/liquidity/transfers`, { amount, currency, origin, destination, liquidityAutomationId }, {
|
|
352
352
|
headers: {
|
|
353
353
|
"x-cluster-api-key": this.clusterApiKey,
|
|
354
354
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2017",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/secret-manager": "^5.3.0",
|
|
29
29
|
"@google-cloud/storage": "^6.9.5",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.7.0",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1768",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.7.4",
|
|
34
34
|
"crypto-js": "^4.2.0",
|