zudello-integration-sdk 1.0.23 → 1.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudello-integration-sdk",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -13,6 +13,7 @@
13
13
  "dependencies": {
14
14
  "@aws-sdk/client-s3": "^3.658.0",
15
15
  "axios": "^1.6.7",
16
+ "circular-json": "^0.5.9",
16
17
  "dotenv": "^16.4.5",
17
18
  "lodash": "^4.17.21",
18
19
  "moment-timezone": "^0.5.45",
package/src/sdk/Base.js CHANGED
@@ -49,18 +49,22 @@ class BaseSDK {
49
49
  }
50
50
 
51
51
  async makeRequest (method, url, data, params = {}, returnHeaders = false) {
52
- const callback = ({ status, response, body, params, headers }) => {
53
- this.logger.request(`${this.integrationName} - ${method} ${url}`, {
54
- status,
55
- request: {
56
- url,
57
- method,
58
- body,
59
- params,
60
- headers
61
- },
62
- response
63
- })
52
+ // const callback = ({ status, response, body, params, headers }) => {
53
+ // this.logger.request(`${this.integrationName} - ${method} ${url}`, {
54
+ // status,
55
+ // request: {
56
+ // url,
57
+ // method,
58
+ // body,
59
+ // params,
60
+ // headers
61
+ // },
62
+ // response
63
+ // })
64
+ // }
65
+
66
+ const callback = (data) => {
67
+ this.logger.request(`${this.integrationName} - ${method} ${url}`, data)
64
68
  }
65
69
 
66
70
  switch (method.toLowerCase()) {
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const axios = require('axios')
4
+ const CircularJSON = require('circular-json')
4
5
  const ResponseHandler = require('./responseHandler')
5
6
 
6
7
  class ApiInstance {
@@ -61,12 +62,15 @@ class ApiInstance {
61
62
  ? this.responseHandler.success(response.headers || null)
62
63
  : this.responseHandler.success(response.data || null)
63
64
  } catch (error) {
64
- callback({
65
- status: error?.response?.status,
66
- response: error?.response?.data,
67
- params,
68
- headers
69
- })
65
+ // callback({
66
+ // status: error?.response?.status,
67
+ // response: error?.response?.data,
68
+ // params,
69
+ // headers
70
+ // })
71
+
72
+ callback(CircularJSON.stringify(error, null, 2))
73
+ callback(CircularJSON.stringify(error.response, null, 2))
70
74
 
71
75
  if (this.retryStatuses.includes(error?.response?.status) && retryCount === 0) {
72
76
  await this.sleep(20000)
@@ -117,13 +121,16 @@ class ApiInstance {
117
121
 
118
122
  return this.responseHandler.success(response.data || null)
119
123
  } catch (error) {
120
- callback({
121
- status: error?.response?.status,
122
- response: error?.response?.data,
123
- params,
124
- headers,
125
- body: data
126
- })
124
+ // callback({
125
+ // status: error?.response?.status,
126
+ // response: error?.response?.data,
127
+ // params,
128
+ // headers,
129
+ // body: data
130
+ // })
131
+
132
+ callback(CircularJSON.stringify(error, null, 2))
133
+ callback(CircularJSON.stringify(error.response, null, 2))
127
134
 
128
135
  if (this.retryStatuses.includes(error?.response?.status) && retryCount === 0) {
129
136
  await this.sleep(20000)
@@ -160,13 +167,15 @@ class ApiInstance {
160
167
 
161
168
  return this.responseHandler.success(response.data || null)
162
169
  } catch (error) {
163
- callback({
164
- status: error?.response?.status,
165
- response: error?.response?.data,
166
- params,
167
- headers,
168
- body: data
169
- })
170
+ // callback({
171
+ // status: error?.response?.status,
172
+ // response: error?.response?.data,
173
+ // params,
174
+ // headers,
175
+ // body: data
176
+ // })
177
+
178
+ callback(error?.response)
170
179
 
171
180
  if (this.retryStatuses.includes(error?.response?.status) && retryCount === 0) {
172
181
  await this.sleep(20000)
@@ -197,10 +206,12 @@ class ApiInstance {
197
206
 
198
207
  return response.data
199
208
  } catch (error) {
200
- callback({
201
- status: error?.response?.status,
202
- response: error?.response?.data
203
- })
209
+ // callback({
210
+ // status: error?.response?.status,
211
+ // response: error?.response?.data
212
+ // })
213
+
214
+ callback(error?.response)
204
215
 
205
216
  if (this.retryStatuses.includes(error?.response?.status) && retryCount === 0) {
206
217
  await this.sleep(20000)