redai-automation-web-sdk 1.9.10 → 1.9.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 +2 -2
- package/dist/index.cjs +7 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -13
- package/dist/index.d.ts +5 -13
- package/dist/index.mjs +7 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -180,8 +180,8 @@ new AutomationWebClient(config: AutomationWebConfig)
|
|
|
180
180
|
**Config Options:**
|
|
181
181
|
- `baseUrl`: URL của automation-web API
|
|
182
182
|
- `timeout`: Timeout cho requests (ms)
|
|
183
|
-
- `retryCount`:
|
|
184
|
-
- `retryDelay`:
|
|
183
|
+
- `retryCount`: Deprecated (no-op, SDK không retry)
|
|
184
|
+
- `retryDelay`: Deprecated (no-op, SDK không retry)
|
|
185
185
|
- `apiKey`: API key (nếu cần)
|
|
186
186
|
- `userAgent`: Custom user agent
|
|
187
187
|
- `logging`: Bật/tắt logging
|
package/dist/index.cjs
CHANGED
|
@@ -137,7 +137,7 @@ var HttpClient = class {
|
|
|
137
137
|
timeout: this.config.timeout || 3e4,
|
|
138
138
|
headers: {
|
|
139
139
|
"Content-Type": "application/json",
|
|
140
|
-
"User-Agent": this.config.userAgent || "@redai/automation-web-sdk/1.9.
|
|
140
|
+
"User-Agent": this.config.userAgent || "@redai/automation-web-sdk/1.9.11",
|
|
141
141
|
...this.config.apiKey && { Authorization: `Bearer ${this.config.apiKey}` }
|
|
142
142
|
}
|
|
143
143
|
});
|
|
@@ -181,43 +181,10 @@ var HttpClient = class {
|
|
|
181
181
|
return instance;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* Make HTTP request
|
|
184
|
+
* Make HTTP request (single attempt, no retry)
|
|
185
185
|
*/
|
|
186
|
-
async makeRequestWithRetry(requestConfig
|
|
187
|
-
|
|
188
|
-
return await this.axiosInstance.request(requestConfig);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
const maxRetries = this.config.retryCount || 3;
|
|
191
|
-
const retryDelay = this.config.retryDelay || 1e3;
|
|
192
|
-
if (retryCount < maxRetries && this.shouldRetry(error)) {
|
|
193
|
-
if (this.config.logging) {
|
|
194
|
-
console.log(
|
|
195
|
-
`[HTTP] Retrying request (${retryCount + 1}/${maxRetries}) after ${retryDelay}ms`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
await this.delay(retryDelay * Math.pow(2, retryCount));
|
|
199
|
-
return this.makeRequestWithRetry(requestConfig, retryCount + 1);
|
|
200
|
-
}
|
|
201
|
-
throw error;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Determine if request should be retried
|
|
206
|
-
*/
|
|
207
|
-
shouldRetry(error) {
|
|
208
|
-
if (!import_axios.default.isAxiosError(error)) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
if (!error.response) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
return error.response.status >= 500 || error.response.status === 429;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Delay utility for retry logic
|
|
218
|
-
*/
|
|
219
|
-
delay(ms) {
|
|
220
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
186
|
+
async makeRequestWithRetry(requestConfig) {
|
|
187
|
+
return this.axiosInstance.request(requestConfig);
|
|
221
188
|
}
|
|
222
189
|
/**
|
|
223
190
|
* Generic request method
|
|
@@ -414,9 +381,9 @@ var HttpUtils = class {
|
|
|
414
381
|
var DEFAULT_CONFIG = {
|
|
415
382
|
baseUrl: "http://localhost:3000",
|
|
416
383
|
timeout: 3e4,
|
|
417
|
-
retryCount:
|
|
418
|
-
retryDelay:
|
|
419
|
-
userAgent: "@redai/automation-web-sdk/1.9.
|
|
384
|
+
retryCount: 0,
|
|
385
|
+
retryDelay: 0,
|
|
386
|
+
userAgent: "@redai/automation-web-sdk/1.9.11",
|
|
420
387
|
logging: false
|
|
421
388
|
};
|
|
422
389
|
var ThreadType = /* @__PURE__ */ ((ThreadType4) => {
|