@ecodrix/erix-api 1.1.9 → 1.2.0

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": "@ecodrix/erix-api",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "author": "ECODrIx Team <contact@ecodrix.com>",
5
5
  "license": "MIT",
6
6
  "description": "Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",
package/src/core.ts CHANGED
@@ -74,7 +74,13 @@ export interface EcodrixOptions {
74
74
  * ```
75
75
  */
76
76
  export class Ecodrix {
77
+ /**
78
+ * @internal Axios HTTP client for making API requests.
79
+ */
77
80
  private readonly client: AxiosInstance;
81
+ /**
82
+ * @internal Socket.io client for real-time events.
83
+ */
78
84
  private readonly socket: Socket;
79
85
 
80
86
  /** WhatsApp messaging and conversation management. */
@@ -123,7 +129,8 @@ export class Ecodrix {
123
129
  const baseUrl = options.baseUrl ?? ECOD_API_BASE;
124
130
  const socketUrl = options.socketUrl || baseUrl;
125
131
 
126
- const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
132
+ const isBrowser =
133
+ typeof window !== "undefined" && typeof window.document !== "undefined";
127
134
  const runtime = isBrowser
128
135
  ? "browser"
129
136
  : typeof process !== "undefined"
@@ -156,11 +163,14 @@ export class Ecodrix {
156
163
  retryDelay: axiosRetry.exponentialDelay,
157
164
  retryCondition: (error) => {
158
165
  return (
159
- axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status === 429
166
+ axiosRetry.isNetworkOrIdempotentRequestError(error) ||
167
+ error.response?.status === 429
160
168
  );
161
169
  },
162
170
  onRetry: (retryCount, error, requestConfig) => {
163
- const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
171
+ const isDev =
172
+ typeof process !== "undefined" &&
173
+ process.env?.NODE_ENV === "development";
164
174
  if (isDev) {
165
175
  console.warn(
166
176
  `[ECODrIx SDK] Retrying request (${retryCount}/3): ${requestConfig.method?.toUpperCase()} ${requestConfig.url}. Reason: ${error.message}`,
@@ -313,7 +323,9 @@ export class Ecodrix {
313
323
  } catch (error: any) {
314
324
  if (error.response) {
315
325
  throw new APIError(
316
- error.response.data?.message || error.response.data?.error || "Raw Execution Failed",
326
+ error.response.data?.message ||
327
+ error.response.data?.error ||
328
+ "Raw Execution Failed",
317
329
  error.response.status,
318
330
  error.response.data?.code,
319
331
  );
@@ -158,11 +158,11 @@ export class MediaResource extends APIResource {
158
158
  */
159
159
  async upload(file: any, options: UploadOptions): Promise<any> {
160
160
  // Step 1: Get presigned URL
161
- const { data: presignedData } = await this.client.post(
161
+ const response = await this.post<any>(
162
162
  "/api/saas/storage/upload-url",
163
163
  options,
164
164
  );
165
- const { uploadUrl, key } = presignedData;
165
+ const { uploadUrl, key } = response.data;
166
166
 
167
167
  // Step 2: Upload directly to R2 (bypasses the API server for performance)
168
168
  await axios.put(uploadUrl, file, {