@dotdev/harmony-sdk 1.20.0 → 1.22.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/dist/helpers/index.js
CHANGED
|
@@ -14,25 +14,37 @@ export class ApiHelper {
|
|
|
14
14
|
let response;
|
|
15
15
|
switch (type) {
|
|
16
16
|
case "GET":
|
|
17
|
-
response = await axiosInstance.get(url)
|
|
17
|
+
response = await axiosInstance.get(url).catch((error) => {
|
|
18
|
+
logger.error(error.toJSON(), `Error while sending request to ${endpoint} endpoint`);
|
|
19
|
+
throw error;
|
|
20
|
+
});
|
|
18
21
|
break;
|
|
19
22
|
case "POST":
|
|
20
23
|
default:
|
|
21
|
-
response = await axiosInstance
|
|
24
|
+
response = await axiosInstance
|
|
25
|
+
.post(url, requestBody)
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
logger.error(error.toJSON(), `Error while sending request to ${endpoint} endpoint`);
|
|
28
|
+
throw error;
|
|
29
|
+
});
|
|
22
30
|
break;
|
|
23
31
|
}
|
|
24
|
-
const
|
|
32
|
+
const logs = logger.child({
|
|
25
33
|
request: requestBody,
|
|
26
34
|
response: response?.data,
|
|
27
35
|
size: +response?.headers?.["content-length"],
|
|
28
36
|
status: response?.status,
|
|
29
37
|
});
|
|
30
|
-
|
|
38
|
+
logs.debug(`Received Harmony response: `);
|
|
31
39
|
const result = (await parseXml(response?.data)); // fix type
|
|
32
40
|
return result["S:Envelope"]["S:Body"][0];
|
|
33
41
|
}
|
|
34
42
|
catch (error) {
|
|
35
|
-
logger.
|
|
43
|
+
const logs = logger.child({
|
|
44
|
+
request: requestBody,
|
|
45
|
+
error: error,
|
|
46
|
+
});
|
|
47
|
+
logs.error(`Error while when sending request to Harmony`);
|
|
36
48
|
throw await ApiHelper.parseError(error);
|
|
37
49
|
}
|
|
38
50
|
}
|
package/dist/helpers/logger.d.ts
CHANGED
package/dist/helpers/logger.js
CHANGED
|
@@ -22,7 +22,6 @@ export class AuthModule {
|
|
|
22
22
|
<S:Body>${loginBody}</S:Body>
|
|
23
23
|
</S:Envelope>
|
|
24
24
|
`;
|
|
25
|
-
console.debug(`Authenticating with Harmony. Request body: ${soapEnvelope}`);
|
|
26
25
|
try {
|
|
27
26
|
const response = await ApiHelper.sendSoapRequest("/AuthenticationService/AuthenticationService", this.axiosInstance, soapEnvelope);
|
|
28
27
|
const token = response["ns2:LoginResponse"][0]["token"][0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotdev/harmony-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "Harmony API SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"author": "DotApparel",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@google-cloud/pino-logging-gcp-config": "^1.0.4",
|
|
20
21
|
"axios": "^1.7.2",
|
|
21
22
|
"axios-retry": "^4.5.0",
|
|
22
23
|
"pino": "^9.7.0",
|