@exyconn/common 2.3.2 → 2.3.4

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.
Files changed (40) hide show
  1. package/README.md +117 -12
  2. package/dist/client/http/index.d.mts +280 -49
  3. package/dist/client/http/index.d.ts +280 -49
  4. package/dist/client/http/index.js +564 -90
  5. package/dist/client/http/index.js.map +1 -1
  6. package/dist/client/http/index.mjs +520 -80
  7. package/dist/client/http/index.mjs.map +1 -1
  8. package/dist/client/index.d.mts +3 -3
  9. package/dist/client/index.d.ts +3 -3
  10. package/dist/client/index.js +573 -316
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/client/index.mjs +529 -287
  13. package/dist/client/index.mjs.map +1 -1
  14. package/dist/client/utils/index.d.mts +3 -279
  15. package/dist/client/utils/index.d.ts +3 -279
  16. package/dist/{index-D9a9oxQy.d.ts → index-CdbQ8YPt.d.ts} +51 -39
  17. package/dist/{index-D3yCCjBZ.d.mts → index-Ckhm_HaX.d.mts} +21 -2
  18. package/dist/{index-01hoqibP.d.ts → index-br6POSyA.d.ts} +21 -2
  19. package/dist/{index-DuxL84IW.d.mts → index-guYdqefq.d.mts} +51 -39
  20. package/dist/index.d.mts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +1214 -326
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +1226 -338
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/packageCheck-B_qfsD6R.d.ts +280 -0
  27. package/dist/packageCheck-C2_FT_Rl.d.mts +280 -0
  28. package/dist/server/index.d.mts +1 -1
  29. package/dist/server/index.d.ts +1 -1
  30. package/dist/server/index.js +631 -0
  31. package/dist/server/index.js.map +1 -1
  32. package/dist/server/index.mjs +625 -2
  33. package/dist/server/index.mjs.map +1 -1
  34. package/dist/server/middleware/index.d.mts +283 -2
  35. package/dist/server/middleware/index.d.ts +283 -2
  36. package/dist/server/middleware/index.js +761 -0
  37. package/dist/server/middleware/index.js.map +1 -1
  38. package/dist/server/middleware/index.mjs +751 -1
  39. package/dist/server/middleware/index.mjs.map +1 -1
  40. package/package.json +1 -1
@@ -1,109 +1,549 @@
1
1
  import axios from 'axios';
2
2
 
3
- // src/client/http/axios-instance.ts
4
- var createHttpClient = (options) => {
5
- const {
6
- baseURL,
7
- timeout = 3e4,
8
- withCredentials = true,
9
- getAuthToken,
10
- onUnauthorized,
11
- onServerError
12
- } = options;
13
- const instance = axios.create({
14
- baseURL,
15
- timeout,
16
- withCredentials,
17
- headers: {
18
- "Content-Type": "application/json"
3
+ // src/client/http/http.ts
4
+
5
+ // src/client/http/logger.ts
6
+ var Logger = class {
7
+ constructor() {
8
+ this.isDevelopment = typeof window !== "undefined" && window.location.hostname === "localhost";
9
+ }
10
+ /**
11
+ * Log informational messages
12
+ */
13
+ info(message, data, options) {
14
+ if (this.isDevelopment) {
15
+ const prefix = options?.context ? `[${options.context}]` : "";
16
+ console.log(`${prefix} ${message}`, data ?? "");
19
17
  }
20
- });
21
- instance.interceptors.request.use(
22
- (config) => {
23
- if (getAuthToken) {
24
- const token = getAuthToken();
25
- if (token && config.headers) {
26
- config.headers.Authorization = `Bearer ${token}`;
27
- }
18
+ }
19
+ /**
20
+ * Log warning messages
21
+ */
22
+ warn(message, data, options) {
23
+ if (this.isDevelopment) {
24
+ const prefix = options?.context ? `[${options.context}]` : "";
25
+ console.warn(`${prefix} ${message}`, data ?? "");
26
+ }
27
+ }
28
+ /**
29
+ * Log error messages
30
+ */
31
+ error(message, error, options) {
32
+ const prefix = options?.context ? `[${options.context}]` : "";
33
+ if (this.isDevelopment) {
34
+ console.error(`${prefix} ${message}`, error, options?.metadata || "");
35
+ }
36
+ }
37
+ /**
38
+ * Log debug messages (only in development)
39
+ */
40
+ debug(message, data, options) {
41
+ if (this.isDevelopment) {
42
+ const prefix = options?.context ? `[${options.context}]` : "";
43
+ console.debug(`${prefix} ${message}`, data || "");
44
+ }
45
+ }
46
+ /**
47
+ * Log API errors with structured information
48
+ */
49
+ apiError(endpoint, error, metadata) {
50
+ this.error(`API Error: ${endpoint}`, error, {
51
+ context: "API",
52
+ metadata: {
53
+ endpoint,
54
+ ...metadata
55
+ }
56
+ });
57
+ }
58
+ };
59
+ var logger = new Logger();
60
+
61
+ // src/client/http/response-parser.ts
62
+ var STATUS_CODES = {
63
+ SUCCESS: 200,
64
+ CREATED: 201,
65
+ NO_CONTENT: 204,
66
+ BAD_REQUEST: 400,
67
+ UNAUTHORIZED: 401,
68
+ FORBIDDEN: 403,
69
+ NOT_FOUND: 404,
70
+ CONFLICT: 409,
71
+ ERROR: 500
72
+ };
73
+ var STATUS_MESSAGES = {
74
+ SUCCESS: "success",
75
+ CREATED: "created",
76
+ NO_CONTENT: "no_content",
77
+ BAD_REQUEST: "bad_request",
78
+ UNAUTHORIZED: "unauthorized",
79
+ FORBIDDEN: "forbidden",
80
+ NOT_FOUND: "not_found",
81
+ CONFLICT: "conflict",
82
+ ERROR: "error"
83
+ };
84
+ var SUCCESS_CODES = [200, 201, 204];
85
+ var ERROR_CODES = [400, 401, 403, 404, 409, 500];
86
+ var parseResponseData = (response, fallback = null) => {
87
+ try {
88
+ if (!response || typeof response !== "object") {
89
+ return fallback;
90
+ }
91
+ const resp = response;
92
+ if ("data" in resp) {
93
+ return resp["data"] ?? fallback;
94
+ }
95
+ return response;
96
+ } catch (error) {
97
+ logger.error("Error parsing response data", error);
98
+ return fallback;
99
+ }
100
+ };
101
+ var parseResponseMessage = (response, fallback = "") => {
102
+ try {
103
+ if (!response || typeof response !== "object") {
104
+ return fallback;
105
+ }
106
+ const resp = response;
107
+ if ("message" in resp && typeof resp["message"] === "string") {
108
+ return resp["message"];
109
+ }
110
+ return fallback;
111
+ } catch (error) {
112
+ logger.error("Error parsing response message", error);
113
+ return fallback;
114
+ }
115
+ };
116
+ var parseResponseStatus = (response) => {
117
+ try {
118
+ if (!response || typeof response !== "object") {
119
+ return null;
120
+ }
121
+ const resp = response;
122
+ if ("statusCode" in resp && typeof resp["statusCode"] === "number") {
123
+ return resp["statusCode"];
124
+ }
125
+ if ("status" in resp && typeof resp["status"] === "number") {
126
+ return resp["status"];
127
+ }
128
+ return null;
129
+ } catch (error) {
130
+ logger.error("Error parsing response status", error);
131
+ return null;
132
+ }
133
+ };
134
+ var parseResponseStatusMessage = (response, fallback = "") => {
135
+ try {
136
+ if (!response || typeof response !== "object") {
137
+ return fallback;
138
+ }
139
+ const resp = response;
140
+ if ("status" in resp && typeof resp["status"] === "string") {
141
+ return resp["status"];
142
+ }
143
+ return fallback;
144
+ } catch (error) {
145
+ logger.error("Error parsing response status message", error);
146
+ return fallback;
147
+ }
148
+ };
149
+ var isSuccessResponse = (response) => {
150
+ try {
151
+ const statusCode = parseResponseStatus(response);
152
+ if (statusCode !== null) {
153
+ return SUCCESS_CODES.includes(statusCode);
154
+ }
155
+ const status = parseResponseStatusMessage(response);
156
+ return [STATUS_MESSAGES.SUCCESS, STATUS_MESSAGES.CREATED, STATUS_MESSAGES.NO_CONTENT].includes(
157
+ status
158
+ );
159
+ } catch (error) {
160
+ logger.error("Error checking response success", error);
161
+ return false;
162
+ }
163
+ };
164
+ var isErrorResponse = (response) => {
165
+ try {
166
+ const statusCode = parseResponseStatus(response);
167
+ if (statusCode !== null) {
168
+ return ERROR_CODES.includes(statusCode);
169
+ }
170
+ return false;
171
+ } catch (error) {
172
+ logger.error("Error checking response error", error);
173
+ return false;
174
+ }
175
+ };
176
+ var parsePaginatedResponse = (response) => {
177
+ try {
178
+ if (!response || typeof response !== "object") {
179
+ return { items: [], total: 0, page: 1, limit: 10 };
180
+ }
181
+ const resp = response;
182
+ let items = [];
183
+ if ("data" in resp && Array.isArray(resp["data"])) {
184
+ items = resp["data"];
185
+ }
186
+ let total = items.length;
187
+ let page = 1;
188
+ let limit = 10;
189
+ let totalPages;
190
+ if ("paginationData" in resp && resp["paginationData"] && typeof resp["paginationData"] === "object") {
191
+ const paginationData = resp["paginationData"];
192
+ if ("total" in paginationData && typeof paginationData["total"] === "number") {
193
+ total = paginationData["total"];
28
194
  }
29
- return config;
30
- },
31
- (error) => Promise.reject(error)
32
- );
33
- instance.interceptors.response.use(
34
- (response) => response,
35
- (error) => {
36
- if (error.response) {
37
- const status = error.response.status;
38
- if (status === 401 && onUnauthorized) {
39
- onUnauthorized();
195
+ if ("page" in paginationData && typeof paginationData["page"] === "number") {
196
+ page = paginationData["page"];
197
+ }
198
+ if ("limit" in paginationData && typeof paginationData["limit"] === "number") {
199
+ limit = paginationData["limit"];
200
+ }
201
+ if ("totalPages" in paginationData && typeof paginationData["totalPages"] === "number") {
202
+ totalPages = paginationData["totalPages"];
203
+ }
204
+ }
205
+ let columns;
206
+ if ("columns" in resp && Array.isArray(resp["columns"])) {
207
+ columns = resp["columns"];
208
+ }
209
+ return {
210
+ items,
211
+ total,
212
+ page,
213
+ limit,
214
+ ...totalPages !== void 0 && { totalPages },
215
+ ...columns !== void 0 && { columns }
216
+ };
217
+ } catch (error) {
218
+ logger.error("Error parsing paginated response", error);
219
+ return { items: [], total: 0, page: 1, limit: 10 };
220
+ }
221
+ };
222
+ var extractNestedData = (response, path, fallback = null) => {
223
+ try {
224
+ const keys = path.split(".");
225
+ let current = response;
226
+ for (const key of keys) {
227
+ if (current && typeof current === "object" && key in current) {
228
+ current = current[key];
229
+ } else {
230
+ return fallback;
231
+ }
232
+ }
233
+ return current;
234
+ } catch (error) {
235
+ logger.error("Error extracting nested data", error);
236
+ return fallback;
237
+ }
238
+ };
239
+ var safeJsonParse = (json, fallback = null) => {
240
+ try {
241
+ return JSON.parse(json);
242
+ } catch (error) {
243
+ logger.error("Error parsing JSON", error);
244
+ return fallback;
245
+ }
246
+ };
247
+ var parseAxiosErrorMessage = (error) => {
248
+ try {
249
+ if (!error || typeof error !== "object") {
250
+ return "An unexpected error occurred";
251
+ }
252
+ const err = error;
253
+ if ("response" in err && err["response"] && typeof err["response"] === "object") {
254
+ const response = err["response"];
255
+ if ("data" in response && response["data"] && typeof response["data"] === "object") {
256
+ const data = response["data"];
257
+ if ("data" in data && data["data"] && typeof data["data"] === "object") {
258
+ const nestedData = data["data"];
259
+ if ("message" in nestedData && typeof nestedData["message"] === "string") {
260
+ return nestedData["message"];
261
+ }
40
262
  }
41
- if (status >= 500 && onServerError) {
42
- onServerError(error);
263
+ if ("message" in data && typeof data["message"] === "string") {
264
+ return data["message"];
265
+ }
266
+ if ("error" in data && typeof data["error"] === "string") {
267
+ return data["error"];
43
268
  }
44
269
  }
45
- return Promise.reject(error);
46
270
  }
47
- );
48
- return instance;
271
+ if ("message" in err && typeof err["message"] === "string") {
272
+ return err["message"];
273
+ }
274
+ if (typeof error === "string") {
275
+ return error;
276
+ }
277
+ return "An unexpected error occurred";
278
+ } catch (parseError2) {
279
+ logger.error("Error parsing axios error message", parseError2);
280
+ return "An unexpected error occurred";
281
+ }
282
+ };
283
+ var parseError = (error) => {
284
+ try {
285
+ if (!error || typeof error !== "object") {
286
+ return {
287
+ message: "An unexpected error occurred",
288
+ statusCode: null,
289
+ data: null
290
+ };
291
+ }
292
+ const err = error;
293
+ let statusCode = null;
294
+ let data = null;
295
+ let status;
296
+ if ("response" in err && err["response"] && typeof err["response"] === "object") {
297
+ const response = err["response"];
298
+ if ("status" in response && typeof response["status"] === "number") {
299
+ statusCode = response["status"];
300
+ }
301
+ if ("data" in response && response["data"] !== void 0) {
302
+ data = response["data"];
303
+ if (data && typeof data === "object" && "status" in data) {
304
+ const dataObj = data;
305
+ if (typeof dataObj["status"] === "string") {
306
+ status = dataObj["status"];
307
+ }
308
+ }
309
+ }
310
+ }
311
+ if (statusCode === null && "statusCode" in err && typeof err["statusCode"] === "number") {
312
+ statusCode = err["statusCode"];
313
+ }
314
+ if (data === null && "data" in err && err["data"] !== void 0) {
315
+ data = err["data"];
316
+ }
317
+ if (!status && "status" in err && typeof err["status"] === "string") {
318
+ status = err["status"];
319
+ }
320
+ return {
321
+ message: parseAxiosErrorMessage(error),
322
+ statusCode,
323
+ data,
324
+ ...status !== void 0 && { status }
325
+ };
326
+ } catch (err) {
327
+ logger.error("Error parsing error object", err);
328
+ return {
329
+ message: "An unexpected error occurred",
330
+ statusCode: null,
331
+ data: null
332
+ };
333
+ }
49
334
  };
50
- var withFormData = () => ({
335
+ var simpleParseResponse = (response) => {
336
+ return response?.data?.data?.data;
337
+ };
338
+ var simpleMetaParseResponse = (response) => {
339
+ return response?.data?.data?.meta;
340
+ };
341
+ var simpleParseDualDataResponse = (response) => {
342
+ return response?.data?.data;
343
+ };
344
+
345
+ // src/client/http/http.ts
346
+ var defaultConfig = {
347
+ baseUrl: typeof window !== "undefined" && window.location.hostname === "localhost" ? "http://localhost:4002" : "https://service-api.exyconn.com",
348
+ apiPrefix: "/v1/api",
349
+ timeout: 3e4,
350
+ defaultHeaders: {}
351
+ };
352
+ var currentConfig = { ...defaultConfig };
353
+ var axiosInstance = axios.create({
354
+ baseURL: defaultConfig.baseUrl,
355
+ timeout: defaultConfig.timeout,
51
356
  headers: {
52
- "Content-Type": "multipart/form-data"
357
+ "Content-Type": "application/json"
53
358
  }
54
359
  });
55
- var withTimeout = (ms) => ({
56
- timeout: ms
57
- });
58
- var withAbortSignal = (signal) => ({
59
- signal
60
- });
61
-
62
- // src/client/http/response-parser.ts
63
- var parseResponse = (response) => {
64
- if (response.data?.success && response.data?.data !== void 0) {
65
- return response.data.data;
360
+ var getApiBaseUrl = () => {
361
+ return currentConfig.baseUrl || defaultConfig.baseUrl;
362
+ };
363
+ var setApiBaseUrl = (baseUrl) => {
364
+ currentConfig.baseUrl = baseUrl;
365
+ axiosInstance.defaults.baseURL = baseUrl;
366
+ logger.info(`API Base URL updated to: ${baseUrl}`);
367
+ };
368
+ var getApiPrefix = () => {
369
+ return currentConfig.apiPrefix || defaultConfig.apiPrefix;
370
+ };
371
+ var setApiPrefix = (prefix) => {
372
+ currentConfig.apiPrefix = prefix;
373
+ logger.info(`API Prefix updated to: ${prefix}`);
374
+ };
375
+ var getCustomHeaders = () => {
376
+ return { ...currentConfig.defaultHeaders };
377
+ };
378
+ var setCustomHeader = (key, value) => {
379
+ if (!currentConfig.defaultHeaders) {
380
+ currentConfig.defaultHeaders = {};
66
381
  }
67
- return null;
382
+ currentConfig.defaultHeaders[key] = value;
383
+ axiosInstance.defaults.headers.common[key] = value;
384
+ logger.info(`Custom header added: ${key}`);
68
385
  };
69
- var parseFullResponse = (response) => {
70
- return response.data;
386
+ var removeCustomHeader = (key) => {
387
+ if (currentConfig.defaultHeaders) {
388
+ delete currentConfig.defaultHeaders[key];
389
+ }
390
+ delete axiosInstance.defaults.headers.common[key];
391
+ logger.info(`Custom header removed: ${key}`);
71
392
  };
72
- var parseError = (error) => {
73
- if (error.response?.data?.message) {
74
- return error.response.data.message;
393
+ var setCustomHeaders = (headers) => {
394
+ currentConfig.defaultHeaders = { ...currentConfig.defaultHeaders, ...headers };
395
+ Object.entries(headers).forEach(([key, value]) => {
396
+ axiosInstance.defaults.headers.common[key] = value;
397
+ });
398
+ logger.info(`Multiple custom headers added: ${Object.keys(headers).join(", ")}`);
399
+ };
400
+ var clearCustomHeaders = () => {
401
+ if (currentConfig.defaultHeaders) {
402
+ Object.keys(currentConfig.defaultHeaders).forEach((key) => {
403
+ delete axiosInstance.defaults.headers.common[key];
404
+ });
75
405
  }
76
- if (error.response?.data?.error) {
77
- return error.response.data.error;
406
+ currentConfig.defaultHeaders = {};
407
+ logger.info("All custom headers cleared");
408
+ };
409
+ var configureHttp = (config) => {
410
+ if (config.baseUrl) {
411
+ setApiBaseUrl(config.baseUrl);
412
+ }
413
+ if (config.apiPrefix) {
414
+ setApiPrefix(config.apiPrefix);
78
415
  }
79
- if (error.code === "ERR_NETWORK") {
80
- return "Network error. Please check your connection.";
416
+ if (config.timeout !== void 0) {
417
+ currentConfig.timeout = config.timeout;
418
+ axiosInstance.defaults.timeout = config.timeout;
81
419
  }
82
- if (error.code === "ECONNABORTED") {
83
- return "Request timed out. Please try again.";
420
+ if (config.defaultHeaders) {
421
+ setCustomHeaders(config.defaultHeaders);
84
422
  }
85
- return error.message || "An unexpected error occurred.";
423
+ logger.info("HTTP client configured successfully");
86
424
  };
87
- var isSuccess = (response) => {
88
- return response.data?.success === true;
425
+ var getHttpConfig = () => {
426
+ return { ...currentConfig };
427
+ };
428
+ var resetHttpConfig = () => {
429
+ currentConfig = { ...defaultConfig };
430
+ axiosInstance.defaults.baseURL = defaultConfig.baseUrl;
431
+ axiosInstance.defaults.timeout = defaultConfig.timeout;
432
+ clearCustomHeaders();
433
+ logger.info("HTTP configuration reset to defaults");
89
434
  };
90
- var isStatusError = (error, statusCode) => {
91
- return error.response?.status === statusCode;
435
+ var API_BASE_URL = getApiBaseUrl();
436
+ var API_PREFIX = getApiPrefix();
437
+ axiosInstance.interceptors.request.use(
438
+ (config) => {
439
+ try {
440
+ if (typeof window !== "undefined" && window.localStorage) {
441
+ const selectedOrg = localStorage.getItem("selectedOrganization");
442
+ if (selectedOrg) {
443
+ const org = JSON.parse(selectedOrg);
444
+ if (org && org._id) {
445
+ config.headers["x-organization-id"] = org._id;
446
+ }
447
+ }
448
+ }
449
+ } catch (error) {
450
+ logger.warn("Failed to read organization from localStorage", error);
451
+ }
452
+ return config;
453
+ },
454
+ (error) => {
455
+ return Promise.reject(error);
456
+ }
457
+ );
458
+ axiosInstance.interceptors.response.use(
459
+ (response) => response,
460
+ (error) => {
461
+ const parsedError = parseError(error);
462
+ logger.error("API Error", parsedError);
463
+ return Promise.reject(parsedError);
464
+ }
465
+ );
466
+ var buildHeaders = (customHeaders) => {
467
+ const headers = {
468
+ "Content-Type": "application/json",
469
+ ...currentConfig.defaultHeaders,
470
+ // Add global custom headers
471
+ ...customHeaders
472
+ // Request-specific headers override global ones
473
+ };
474
+ return headers;
475
+ };
476
+ var buildConfig = (params, customHeaders) => {
477
+ const config = {
478
+ headers: buildHeaders(customHeaders)
479
+ };
480
+ if (params) {
481
+ config.params = params;
482
+ }
483
+ return config;
92
484
  };
93
- var isUnauthorized = (error) => {
94
- return isStatusError(error, 401);
485
+ var getRequest = async (url, params, customHeaders) => {
486
+ const config = buildConfig(params, customHeaders);
487
+ return axiosInstance.get(url, config);
95
488
  };
96
- var isForbidden = (error) => {
97
- return isStatusError(error, 403);
489
+ var postRequest = async (url, data, customHeaders) => {
490
+ const config = buildConfig(void 0, customHeaders);
491
+ return axiosInstance.post(url, data, config);
492
+ };
493
+ var putRequest = async (url, data, customHeaders) => {
494
+ const config = buildConfig(void 0, customHeaders);
495
+ return axiosInstance.put(url, data, config);
496
+ };
497
+ var patchRequest = async (url, data, customHeaders) => {
498
+ const config = buildConfig(void 0, customHeaders);
499
+ return axiosInstance.patch(url, data, config);
500
+ };
501
+ var deleteRequest = async (url, params, customHeaders) => {
502
+ const config = buildConfig(params, customHeaders);
503
+ return axiosInstance.delete(url, config);
504
+ };
505
+ var uploadFile = async (url, file, additionalData) => {
506
+ const formData = new FormData();
507
+ formData.append("file", file);
508
+ if (additionalData) {
509
+ Object.entries(additionalData).forEach(([key, value]) => {
510
+ formData.append(key, String(value));
511
+ });
512
+ }
513
+ const config = {
514
+ headers: {
515
+ "Content-Type": "multipart/form-data"
516
+ }
517
+ };
518
+ return axiosInstance.post(url, formData, config);
519
+ };
520
+ var extractData = (response) => {
521
+ return parseResponseData(response.data);
522
+ };
523
+ var extractMessage = (response) => {
524
+ return parseResponseMessage(response, "");
525
+ };
526
+ var isSuccess = (response) => {
527
+ return response.status >= 200 && response.status < 300;
528
+ };
529
+ var extractPaginatedData = (response) => {
530
+ return parsePaginatedResponse(response.data);
531
+ };
532
+
533
+ // src/client/http/slug.ts
534
+ var generateSlug = (text) => {
535
+ if (!text) return "";
536
+ return text.trim().replace(/[^\w\s]/g, "").replace(/\s+(.)/g, (_, char) => char.toUpperCase()).replace(/\s+/g, "").replace(/^(.)/, (_, char) => char.toLowerCase());
98
537
  };
99
- var isNotFound = (error) => {
100
- return isStatusError(error, 404);
538
+ var generateUrlSlug = (text) => {
539
+ if (!text) return "";
540
+ return text.trim().toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
101
541
  };
102
- var isServerError = (error) => {
103
- const status = error.response?.status;
104
- return status !== void 0 && status >= 500;
542
+ var generateSnakeSlug = (text) => {
543
+ if (!text) return "";
544
+ return text.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
105
545
  };
106
546
 
107
- export { createHttpClient, isForbidden, isNotFound, isServerError, isStatusError, isSuccess, isUnauthorized, parseError, parseFullResponse, parseResponse, withAbortSignal, withFormData, withTimeout };
547
+ export { API_BASE_URL, API_PREFIX, ERROR_CODES, STATUS_CODES, STATUS_MESSAGES, SUCCESS_CODES, axiosInstance as axios, clearCustomHeaders, configureHttp, deleteRequest, extractData, extractMessage, extractNestedData, extractPaginatedData, generateSlug, generateSnakeSlug, generateUrlSlug, getApiBaseUrl, getApiPrefix, getCustomHeaders, getHttpConfig, getRequest, isErrorResponse, isSuccess, isSuccessResponse, logger, parseAxiosErrorMessage, parseError, parsePaginatedResponse, parseResponseData, parseResponseMessage, parseResponseStatus, parseResponseStatusMessage, patchRequest, postRequest, putRequest, removeCustomHeader, resetHttpConfig, safeJsonParse, setApiBaseUrl, setApiPrefix, setCustomHeader, setCustomHeaders, simpleMetaParseResponse, simpleParseDualDataResponse, simpleParseResponse, uploadFile };
108
548
  //# sourceMappingURL=index.mjs.map
109
549
  //# sourceMappingURL=index.mjs.map