@smoothsend/sdk 2.3.5 → 2.3.6
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/aptos/index.cjs +2 -2
- package/dist/aptos/index.d.ts +3 -3
- package/dist/aptos/index.js +3 -3
- package/dist/avax/SmoothSendAvaxSubmitter.d.ts +2 -2
- package/dist/avax/SmoothSendAvaxSubmitter.d.ts.map +1 -1
- package/dist/avax/index.cjs +52 -14
- package/dist/avax/index.cjs.map +1 -1
- package/dist/avax/index.d.ts +3 -3
- package/dist/avax/index.d.ts.map +1 -1
- package/dist/avax/index.js +53 -15
- package/dist/avax/index.js.map +1 -1
- package/dist/avax/publicAaDefaults.d.ts +26 -0
- package/dist/avax/publicAaDefaults.d.ts.map +1 -1
- package/dist/avax/useSmoothSendAvax.d.ts +2 -0
- package/dist/avax/useSmoothSendAvax.d.ts.map +1 -1
- package/dist/chunks/shared-BQ9u3lrN.js +557 -0
- package/dist/chunks/shared-BQ9u3lrN.js.map +1 -0
- package/dist/chunks/shared-BcSSEWv8.d.ts +474 -0
- package/dist/chunks/shared-BlhOY1v3.cjs +568 -0
- package/dist/chunks/shared-BlhOY1v3.cjs.map +1 -0
- package/dist/chunks/shared-CWbQR_je.js +1511 -0
- package/dist/chunks/shared-CWbQR_je.js.map +1 -0
- package/dist/chunks/shared-DMOh_aLU.d.ts +1279 -0
- package/dist/chunks/shared-DYAVFARB.d.ts +472 -0
- package/dist/chunks/shared-EuyoZgP8.cjs +1519 -0
- package/dist/chunks/shared-EuyoZgP8.cjs.map +1 -0
- package/dist/chunks/shared-W7k9S_GY.d.ts +262 -0
- package/dist/chunks/shared-vFCAUg0m.d.ts +780 -0
- package/dist/index.cjs +52 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +52 -14
- package/dist/index.js.map +1 -1
- package/dist/stellar/index.cjs +2 -2
- package/dist/stellar/index.d.ts +3 -3
- package/dist/stellar/index.js +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error handling system for SmoothSend SDK v2
|
|
5
|
+
* Provides typed error classes for different failure scenarios
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* All SDK errors extend SmoothSendError for consistent error handling
|
|
9
|
+
* Use instanceof checks to handle specific error types
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* try {
|
|
14
|
+
* await sdk.transfer(request, wallet);
|
|
15
|
+
* } catch (error) {
|
|
16
|
+
* if (error instanceof AuthenticationError) {
|
|
17
|
+
* console.error('Invalid API key');
|
|
18
|
+
* } else if (error instanceof RateLimitError) {
|
|
19
|
+
* console.error('Rate limit exceeded');
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Base error class for all SmoothSend SDK errors
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* All SDK-specific errors extend this class
|
|
29
|
+
* Contains error code, HTTP status code, and additional details
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* throw new SmoothSendError(
|
|
34
|
+
* 'Something went wrong',
|
|
35
|
+
* 'CUSTOM_ERROR',
|
|
36
|
+
* 500,
|
|
37
|
+
* { additionalInfo: 'details' }
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class SmoothSendError extends Error {
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new SmoothSendError
|
|
44
|
+
*
|
|
45
|
+
* @param message - Human-readable error message
|
|
46
|
+
* @param code - Error code for programmatic handling
|
|
47
|
+
* @param statusCode - HTTP status code (if applicable)
|
|
48
|
+
* @param details - Additional error details
|
|
49
|
+
*/
|
|
50
|
+
constructor(message, code, statusCode, details) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.code = code;
|
|
53
|
+
this.statusCode = statusCode;
|
|
54
|
+
this.details = details;
|
|
55
|
+
this.name = 'SmoothSendError';
|
|
56
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
57
|
+
if (Error.captureStackTrace) {
|
|
58
|
+
Error.captureStackTrace(this, this.constructor);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Authentication error - thrown when API key is invalid, missing, or expired
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* HTTP Status Code: 401
|
|
67
|
+
* Indicates authentication failure with the proxy worker
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* try {
|
|
72
|
+
* await sdk.transfer(request, wallet);
|
|
73
|
+
* } catch (error) {
|
|
74
|
+
* if (error instanceof AuthenticationError) {
|
|
75
|
+
* console.error('Invalid API key:', error.message);
|
|
76
|
+
* console.log('Get a new key at:', error.details.suggestion);
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
class AuthenticationError extends SmoothSendError {
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new AuthenticationError
|
|
84
|
+
*
|
|
85
|
+
* @param message - Human-readable error message
|
|
86
|
+
* @param details - Additional error details
|
|
87
|
+
*/
|
|
88
|
+
constructor(message, details) {
|
|
89
|
+
super(message, 'AUTHENTICATION_ERROR', 401, {
|
|
90
|
+
...details,
|
|
91
|
+
docs: 'https://docs.smoothsend.xyz/api-keys',
|
|
92
|
+
suggestion: 'Check your API key at dashboard.smoothsend.xyz'
|
|
93
|
+
});
|
|
94
|
+
this.name = 'AuthenticationError';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Rate limit error - thrown when request rate limit is exceeded
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* HTTP Status Code: 429
|
|
102
|
+
* Contains rate limit details including reset time
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* try {
|
|
107
|
+
* await sdk.transfer(request, wallet);
|
|
108
|
+
* } catch (error) {
|
|
109
|
+
* if (error instanceof RateLimitError) {
|
|
110
|
+
* console.error('Rate limit exceeded');
|
|
111
|
+
* console.log(`Limit: ${error.limit}`);
|
|
112
|
+
* console.log(`Remaining: ${error.remaining}`);
|
|
113
|
+
* console.log(`Resets at: ${error.resetTime}`);
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
class RateLimitError extends SmoothSendError {
|
|
119
|
+
/**
|
|
120
|
+
* Creates a new RateLimitError
|
|
121
|
+
*
|
|
122
|
+
* @param message - Human-readable error message
|
|
123
|
+
* @param limit - Maximum requests allowed per period
|
|
124
|
+
* @param remaining - Remaining requests in current period
|
|
125
|
+
* @param resetTime - When the rate limit resets (ISO 8601 timestamp)
|
|
126
|
+
*/
|
|
127
|
+
constructor(message, limit, remaining, resetTime) {
|
|
128
|
+
super(message, 'RATE_LIMIT_EXCEEDED', 429, {
|
|
129
|
+
limit,
|
|
130
|
+
remaining,
|
|
131
|
+
resetTime,
|
|
132
|
+
docs: 'https://docs.smoothsend.xyz/rate-limits',
|
|
133
|
+
suggestion: 'Wait until rate limit resets or upgrade your tier'
|
|
134
|
+
});
|
|
135
|
+
this.limit = limit;
|
|
136
|
+
this.remaining = remaining;
|
|
137
|
+
this.resetTime = resetTime;
|
|
138
|
+
this.name = 'RateLimitError';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Validation error - thrown when request parameters are invalid
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* HTTP Status Code: 400
|
|
146
|
+
* Contains field name that failed validation
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* try {
|
|
151
|
+
* await sdk.transfer(request, wallet);
|
|
152
|
+
* } catch (error) {
|
|
153
|
+
* if (error instanceof ValidationError) {
|
|
154
|
+
* console.error(`Invalid ${error.field}:`, error.message);
|
|
155
|
+
* }
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
class ValidationError extends SmoothSendError {
|
|
160
|
+
/**
|
|
161
|
+
* Creates a new ValidationError
|
|
162
|
+
*
|
|
163
|
+
* @param message - Human-readable error message
|
|
164
|
+
* @param field - Name of the field that failed validation
|
|
165
|
+
* @param details - Additional error details
|
|
166
|
+
*/
|
|
167
|
+
constructor(message, field, details) {
|
|
168
|
+
super(message, 'VALIDATION_ERROR', 400, {
|
|
169
|
+
field,
|
|
170
|
+
...details,
|
|
171
|
+
suggestion: `Check the '${field}' parameter and try again`
|
|
172
|
+
});
|
|
173
|
+
this.field = field;
|
|
174
|
+
this.name = 'ValidationError';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Network error - thrown when network connectivity issues occur
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* HTTP Status Code: 0 (no HTTP response)
|
|
182
|
+
* Indicates network connectivity problems
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* try {
|
|
187
|
+
* await sdk.transfer(request, wallet);
|
|
188
|
+
* } catch (error) {
|
|
189
|
+
* if (error instanceof NetworkError) {
|
|
190
|
+
* console.error('Network error:', error.message);
|
|
191
|
+
* console.log('Original error:', error.originalError);
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
class NetworkError extends SmoothSendError {
|
|
197
|
+
/**
|
|
198
|
+
* Creates a new NetworkError
|
|
199
|
+
*
|
|
200
|
+
* @param message - Human-readable error message
|
|
201
|
+
* @param originalError - Original error that caused the network failure
|
|
202
|
+
*/
|
|
203
|
+
constructor(message, originalError) {
|
|
204
|
+
super(message, 'NETWORK_ERROR', 0, {
|
|
205
|
+
originalError: originalError?.message,
|
|
206
|
+
suggestion: 'Check your internet connection and try again'
|
|
207
|
+
});
|
|
208
|
+
this.originalError = originalError;
|
|
209
|
+
this.name = 'NetworkError';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Helper function to create appropriate error from HTTP response
|
|
214
|
+
*
|
|
215
|
+
* @remarks
|
|
216
|
+
* Parses HTTP error response and creates typed error object
|
|
217
|
+
* Used internally by HTTP client
|
|
218
|
+
*
|
|
219
|
+
* @param statusCode - HTTP status code
|
|
220
|
+
* @param errorData - Error response data from API
|
|
221
|
+
* @param defaultMessage - Default message if none provided in response
|
|
222
|
+
* @returns Typed error object
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const error = createErrorFromResponse(401, {
|
|
227
|
+
* error: 'Invalid API key',
|
|
228
|
+
* details: { field: 'apiKey' }
|
|
229
|
+
* });
|
|
230
|
+
* throw error;
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
function createErrorFromResponse(statusCode, errorData, defaultMessage = 'An error occurred') {
|
|
234
|
+
const message = errorData?.error || errorData?.message || defaultMessage;
|
|
235
|
+
const details = errorData?.details || {};
|
|
236
|
+
switch (statusCode) {
|
|
237
|
+
case 401:
|
|
238
|
+
return new AuthenticationError(message, details);
|
|
239
|
+
case 429:
|
|
240
|
+
return new RateLimitError(message, parseInt(details.limit || '0'), parseInt(details.remaining || '0'), details.reset || details.resetTime || '');
|
|
241
|
+
case 400:
|
|
242
|
+
return new ValidationError(message, details.field || 'unknown', details);
|
|
243
|
+
default:
|
|
244
|
+
return new SmoothSendError(message, errorData?.errorCode || 'UNKNOWN_ERROR', statusCode, details);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Helper function to create network error from exception
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* Wraps generic exceptions in NetworkError for consistent error handling
|
|
252
|
+
* Used internally by HTTP client
|
|
253
|
+
*
|
|
254
|
+
* @param error - Original error or exception
|
|
255
|
+
* @returns NetworkError instance
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* try {
|
|
260
|
+
* await fetch(url);
|
|
261
|
+
* } catch (error) {
|
|
262
|
+
* throw createNetworkError(error);
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
function createNetworkError(error) {
|
|
267
|
+
const message = error?.message || 'Network request failed';
|
|
268
|
+
return new NetworkError(message, error instanceof Error ? error : undefined);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Shared Constants for SmoothSend Platform
|
|
273
|
+
*
|
|
274
|
+
* IMPORTANT: This file must be kept in sync across all repositories:
|
|
275
|
+
* - smoothsend-worker-proxy/src/shared-constants.ts
|
|
276
|
+
* - smoothsend-dev-console/src/lib/shared-constants.ts
|
|
277
|
+
* - smoothsend-sdk/src/shared-constants.ts
|
|
278
|
+
*
|
|
279
|
+
* Any changes to these constants must be replicated to all three locations.
|
|
280
|
+
*/
|
|
281
|
+
/**
|
|
282
|
+
* API Key Prefixes
|
|
283
|
+
* Used to identify key types from their prefix
|
|
284
|
+
*/
|
|
285
|
+
/**
|
|
286
|
+
* Usage Response Headers
|
|
287
|
+
* Headers sent by worker and read by SDK/Console
|
|
288
|
+
*
|
|
289
|
+
* IMPORTANT: Header names must match exactly
|
|
290
|
+
*/
|
|
291
|
+
const USAGE_HEADERS = {
|
|
292
|
+
RATE_LIMIT: 'X-Rate-Limit-Limit',
|
|
293
|
+
RATE_REMAINING: 'X-Rate-Limit-Remaining',
|
|
294
|
+
RATE_RESET: 'X-Rate-Limit-Reset',
|
|
295
|
+
MONTHLY_LIMIT: 'X-Monthly-Limit',
|
|
296
|
+
MONTHLY_USAGE: 'X-Monthly-Usage',
|
|
297
|
+
MONTHLY_REMAINING: 'X-Monthly-Remaining',
|
|
298
|
+
REQUEST_ID: 'X-Request-ID'};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* HTTP Client for proxy worker integration
|
|
302
|
+
* Handles authentication, rate limiting, usage tracking, and retry logic
|
|
303
|
+
*/
|
|
304
|
+
class HttpClient {
|
|
305
|
+
/**
|
|
306
|
+
* Constructor supports both old (baseURL, timeout) and new (config object) patterns
|
|
307
|
+
* for backward compatibility during migration
|
|
308
|
+
*/
|
|
309
|
+
constructor(configOrBaseURL, timeout) {
|
|
310
|
+
// Determine if using new config object or old baseURL pattern
|
|
311
|
+
if (typeof configOrBaseURL === 'string') {
|
|
312
|
+
// Old pattern: constructor(baseURL, timeout)
|
|
313
|
+
this.baseURL = configOrBaseURL;
|
|
314
|
+
this.network = 'testnet';
|
|
315
|
+
this.maxRetries = 3;
|
|
316
|
+
this.isProxyMode = false;
|
|
317
|
+
this.includeOrigin = false;
|
|
318
|
+
this.client = axios.create({
|
|
319
|
+
baseURL: this.baseURL,
|
|
320
|
+
timeout: timeout || 30000,
|
|
321
|
+
headers: {
|
|
322
|
+
'Content-Type': 'application/json',
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
// New pattern: constructor(config)
|
|
328
|
+
const config = configOrBaseURL;
|
|
329
|
+
this.apiKey = config.apiKey;
|
|
330
|
+
this.network = config.network || 'testnet';
|
|
331
|
+
this.maxRetries = config.retries || 3;
|
|
332
|
+
this.baseURL = config.baseUrl || 'https://proxy.smoothsend.xyz';
|
|
333
|
+
this.isProxyMode = true;
|
|
334
|
+
this.includeOrigin = config.includeOrigin || false;
|
|
335
|
+
const headers = {
|
|
336
|
+
'Content-Type': 'application/json',
|
|
337
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
338
|
+
'X-Network': this.network,
|
|
339
|
+
...config.customHeaders,
|
|
340
|
+
};
|
|
341
|
+
// Browsers forbid setting the `Origin` header manually ("unsafe header").
|
|
342
|
+
// The browser will set it automatically on cross-origin requests.
|
|
343
|
+
// If callers need the origin explicitly, they can pass a custom header (e.g. `X-Origin`).
|
|
344
|
+
this.client = axios.create({
|
|
345
|
+
baseURL: this.baseURL,
|
|
346
|
+
timeout: config.timeout || 30000,
|
|
347
|
+
headers,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
// Request interceptor - add timestamp to prevent caching
|
|
351
|
+
this.client.interceptors.request.use((config) => {
|
|
352
|
+
config.params = { ...config.params, _t: Date.now() };
|
|
353
|
+
return config;
|
|
354
|
+
}, (error) => Promise.reject(error));
|
|
355
|
+
// Response interceptor - handle errors but don't transform responses
|
|
356
|
+
this.client.interceptors.response.use((response) => response, (error) => {
|
|
357
|
+
// Let the request methods handle errors for proper retry logic
|
|
358
|
+
return Promise.reject(error);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Extract usage metadata from response headers (proxy mode only)
|
|
363
|
+
* Uses USAGE_HEADERS constants for consistency across systems
|
|
364
|
+
*/
|
|
365
|
+
extractMetadata(response) {
|
|
366
|
+
if (!this.isProxyMode) {
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
// Convert header names to lowercase for case-insensitive lookup
|
|
370
|
+
const headers = response.headers;
|
|
371
|
+
return {
|
|
372
|
+
rateLimit: {
|
|
373
|
+
limit: headers[USAGE_HEADERS.RATE_LIMIT.toLowerCase()] || '0',
|
|
374
|
+
remaining: headers[USAGE_HEADERS.RATE_REMAINING.toLowerCase()] || '0',
|
|
375
|
+
reset: headers[USAGE_HEADERS.RATE_RESET.toLowerCase()] || '',
|
|
376
|
+
},
|
|
377
|
+
monthly: {
|
|
378
|
+
limit: headers[USAGE_HEADERS.MONTHLY_LIMIT.toLowerCase()] || '0',
|
|
379
|
+
usage: headers[USAGE_HEADERS.MONTHLY_USAGE.toLowerCase()] || '0',
|
|
380
|
+
remaining: headers[USAGE_HEADERS.MONTHLY_REMAINING.toLowerCase()] || '0',
|
|
381
|
+
},
|
|
382
|
+
requestId: headers[USAGE_HEADERS.REQUEST_ID.toLowerCase()] || '',
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Determine if an error should be retried
|
|
387
|
+
*/
|
|
388
|
+
shouldRetry(error, attempt) {
|
|
389
|
+
// Don't retry if we've exceeded max retries
|
|
390
|
+
if (attempt >= this.maxRetries) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
// Only retry in proxy mode (legacy mode doesn't have retry logic)
|
|
394
|
+
if (!this.isProxyMode) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
// Network errors - retry
|
|
398
|
+
if (!error.response) {
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
const status = error.response.status;
|
|
402
|
+
// 5xx server errors - retry
|
|
403
|
+
if (status >= 500 && status < 600) {
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
// 4xx client errors - don't retry (including 429 rate limit)
|
|
407
|
+
if (status >= 400 && status < 500) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Calculate exponential backoff delay with jitter
|
|
414
|
+
*/
|
|
415
|
+
calculateBackoff(attempt) {
|
|
416
|
+
const baseDelay = 1000; // 1 second
|
|
417
|
+
const maxDelay = 10000; // 10 seconds
|
|
418
|
+
const exponentialDelay = baseDelay * Math.pow(2, attempt);
|
|
419
|
+
const delay = Math.min(exponentialDelay, maxDelay);
|
|
420
|
+
// Add jitter (±20%)
|
|
421
|
+
const jitter = delay * 0.2 * (Math.random() * 2 - 1);
|
|
422
|
+
return Math.floor(delay + jitter);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Execute request with retry logic (proxy mode) or single attempt (legacy mode)
|
|
426
|
+
*/
|
|
427
|
+
async executeWithRetry(operation) {
|
|
428
|
+
let lastError;
|
|
429
|
+
const maxAttempts = this.isProxyMode ? this.maxRetries : 0;
|
|
430
|
+
for (let attempt = 0; attempt <= maxAttempts; attempt++) {
|
|
431
|
+
try {
|
|
432
|
+
const response = await operation();
|
|
433
|
+
// Success - extract metadata (if proxy mode) and return
|
|
434
|
+
const result = {
|
|
435
|
+
success: true,
|
|
436
|
+
data: response.data,
|
|
437
|
+
};
|
|
438
|
+
const metadata = this.extractMetadata(response);
|
|
439
|
+
if (metadata) {
|
|
440
|
+
result.metadata = metadata;
|
|
441
|
+
}
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
lastError = error;
|
|
446
|
+
// Check if we should retry
|
|
447
|
+
if (!this.shouldRetry(error, attempt)) {
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
// Wait before retrying (except on last attempt)
|
|
451
|
+
if (attempt < maxAttempts) {
|
|
452
|
+
const delay = this.calculateBackoff(attempt);
|
|
453
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
// All retries failed - handle error
|
|
458
|
+
return this.handleError(lastError);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Handle errors and create appropriate error responses
|
|
462
|
+
*/
|
|
463
|
+
handleError(error) {
|
|
464
|
+
if (this.isProxyMode) {
|
|
465
|
+
// Proxy mode: use typed errors
|
|
466
|
+
if (error.response) {
|
|
467
|
+
// Server responded with error status
|
|
468
|
+
const { status, data } = error.response;
|
|
469
|
+
const sdkError = createErrorFromResponse(status, data);
|
|
470
|
+
throw sdkError;
|
|
471
|
+
}
|
|
472
|
+
else if (error.request) {
|
|
473
|
+
// Network error - no response received
|
|
474
|
+
const networkError = createNetworkError(error);
|
|
475
|
+
throw networkError;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
// Other error (request setup, etc.)
|
|
479
|
+
const networkError = createNetworkError(error);
|
|
480
|
+
throw networkError;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
// Legacy mode: return error response without throwing
|
|
485
|
+
if (error.response) {
|
|
486
|
+
const { status, data } = error.response;
|
|
487
|
+
return {
|
|
488
|
+
success: false,
|
|
489
|
+
error: data?.error || `HTTP Error ${status}`,
|
|
490
|
+
details: data?.details,
|
|
491
|
+
errorCode: data?.errorCode || `HTTP_${status}`,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
else if (error.request) {
|
|
495
|
+
return {
|
|
496
|
+
success: false,
|
|
497
|
+
error: 'Network error - unable to connect to server',
|
|
498
|
+
errorCode: 'NETWORK_ERROR',
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
return {
|
|
503
|
+
success: false,
|
|
504
|
+
error: error.message || 'Unknown error occurred',
|
|
505
|
+
errorCode: 'UNKNOWN_ERROR',
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* GET request
|
|
512
|
+
*/
|
|
513
|
+
async get(url, config) {
|
|
514
|
+
return this.executeWithRetry(() => this.client.get(url, config));
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* POST request
|
|
518
|
+
*/
|
|
519
|
+
async post(url, data, config) {
|
|
520
|
+
return this.executeWithRetry(() => this.client.post(url, data, config));
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* PUT request
|
|
524
|
+
*/
|
|
525
|
+
async put(url, data, config) {
|
|
526
|
+
return this.executeWithRetry(() => this.client.put(url, data, config));
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* DELETE request
|
|
530
|
+
*/
|
|
531
|
+
async delete(url, config) {
|
|
532
|
+
return this.executeWithRetry(() => this.client.delete(url, config));
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Update network parameter for subsequent requests
|
|
536
|
+
*/
|
|
537
|
+
setNetwork(network) {
|
|
538
|
+
this.network = network;
|
|
539
|
+
this.client.defaults.headers['X-Network'] = network;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Get current network
|
|
543
|
+
*/
|
|
544
|
+
getNetwork() {
|
|
545
|
+
return this.network;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
var http = /*#__PURE__*/Object.freeze({
|
|
550
|
+
__proto__: null,
|
|
551
|
+
HttpClient: HttpClient
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
const VERSION = '2.3.6';
|
|
555
|
+
|
|
556
|
+
export { AuthenticationError as A, HttpClient as H, NetworkError as N, RateLimitError as R, SmoothSendError as S, VERSION as V, ValidationError as a, createNetworkError as b, createErrorFromResponse as c, http as h };
|
|
557
|
+
//# sourceMappingURL=shared-BQ9u3lrN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-BQ9u3lrN.js","sources":["../../src/types/errors.ts","../../src/shared-constants.ts","../../src/utils/http.ts","../../src/version.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAIH;;;;;;;;;;;;;;;;AAgBG;AACG,MAAO,eAAgB,SAAQ,KAAK,CAAA;AACxC;;;;;;;AAOG;AACH,IAAA,WAAA,CACE,OAAe,EACR,IAAY,EACZ,UAAmB,EACnB,OAAa,EAAA;QAEpB,KAAK,CAAC,OAAO,CAAC;QAJP,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,OAAO,GAAP,OAAO;AAGd,QAAA,IAAI,CAAC,IAAI,GAAG,iBAAiB;;AAG7B,QAAA,IAAI,KAAK,CAAC,iBAAiB,EAAE;YAC3B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC;QACjD;IACF;AACD;AAED;;;;;;;;;;;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