@machinemetrics/mm-erp-sdk 0.1.1-beta.2 → 0.1.1-beta.3

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-erp-sdk",
3
3
  "description": "A library for syncing data between MachineMetrics and ERP systems",
4
- "version": "0.1.1-beta.2",
4
+ "version": "0.1.1-beta.3",
5
5
  "license": "MIT",
6
6
  "author": "machinemetrics",
7
7
  "main": "dist/mm-erp-sdk.js",
@@ -80,19 +80,26 @@ class AxiosClient implements HTTPClient {
80
80
  params: config.params,
81
81
  };
82
82
 
83
- logger.debug("HTTP request starting", {
83
+ logger.info("HTTP request starting", {
84
84
  url: config.url,
85
85
  method: config.method,
86
86
  baseURL: this.client.defaults.baseURL,
87
87
  retryAttempts: this.retryAttempts
88
88
  });
89
+
90
+ // Extra console.log for debugging
91
+ console.log("=== FULL URL DEBUG ===");
92
+ console.log("baseURL:", this.client.defaults.baseURL);
93
+ console.log("relative url:", config.url);
94
+ console.log("full constructed URL:", (this.client.defaults.baseURL || "") + config.url);
95
+ console.log("method:", config.method);
89
96
 
90
97
  let lastError: unknown;
91
98
  for (let attempt = 0; attempt <= this.retryAttempts; attempt++) {
92
99
  try {
93
- logger.debug(`HTTP request attempt ${attempt + 1}/${this.retryAttempts + 1}`);
100
+ logger.info(`HTTP request attempt ${attempt + 1}/${this.retryAttempts + 1}`);
94
101
  const response = await this.client.request<T>(axiosConfig);
95
- logger.debug("HTTP request succeeded", { status: response.status });
102
+ logger.info("HTTP request succeeded", { status: response.status });
96
103
  return {
97
104
  data: response.data,
98
105
  status: response.status,
@@ -100,7 +107,7 @@ class AxiosClient implements HTTPClient {
100
107
  };
101
108
  } catch (error) {
102
109
  lastError = error;
103
- logger.debug(`HTTP request attempt ${attempt + 1} failed`, {
110
+ logger.info(`HTTP request attempt ${attempt + 1} failed`, {
104
111
  errorType: typeof error,
105
112
  errorConstructor: error?.constructor?.name,
106
113
  isAxiosError: error instanceof AxiosError,
@@ -116,13 +123,13 @@ class AxiosClient implements HTTPClient {
116
123
  error.response.status >= 400 &&
117
124
  error.response.status < 500
118
125
  ) {
119
- logger.debug("Not retrying due to 4xx client error");
126
+ logger.info("Not retrying due to 4xx client error");
120
127
  break;
121
128
  }
122
129
  // If this was the last attempt, don't wait
123
130
  if (attempt < this.retryAttempts) {
124
131
  const waitTime = Math.pow(2, attempt) * 1000;
125
- logger.debug(`Waiting ${waitTime}ms before retry`);
132
+ logger.info(`Waiting ${waitTime}ms before retry`);
126
133
  // Exponential backoff: wait 2^attempt * 1000ms
127
134
  await new Promise((resolve) =>
128
135
  setTimeout(resolve, Math.pow(2, attempt) * 1000)
@@ -130,7 +137,7 @@ class AxiosClient implements HTTPClient {
130
137
  }
131
138
  }
132
139
  }
133
- logger.debug("HTTP request failed after all retries, throwing error");
140
+ logger.info("HTTP request failed after all retries, throwing error");
134
141
  throw this.handleError(lastError, config);
135
142
  }
136
143