@ecodrix/erix-api 1.1.7 → 1.1.9
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/cli.js +4 -4
- package/dist/index.d.ts +3 -2
- package/dist/ts/browser/index.global.js +8 -8
- package/dist/ts/browser/index.global.js.map +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/cjs/index.cjs.map +1 -1
- package/dist/ts/cjs/index.d.cts +3 -2
- package/dist/ts/esm/index.d.ts +3 -2
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +4 -3
- package/src/core.ts +8 -0
- package/src/resources/media.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecodrix/erix-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
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.",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"schema"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"axios": "^1.7.
|
|
49
|
+
"axios": "^1.7.9",
|
|
50
50
|
"axios-retry": "^4.5.0",
|
|
51
51
|
"commander": "^14.0.3",
|
|
52
52
|
"dotenv": "^17.4.0",
|
|
53
53
|
"picocolors": "^1.1.1",
|
|
54
|
-
"socket.io-client": "^4.
|
|
54
|
+
"socket.io-client": "^4.8.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@biomejs/biome": "^1.9.4",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"build": "tsup",
|
|
67
67
|
"build:final": "pnpm clear && pnpm build",
|
|
68
68
|
"dev": "tsup --watch",
|
|
69
|
+
"type": "tsc --noEmit",
|
|
69
70
|
"clear": "rm -rf dist",
|
|
70
71
|
"lint": "biome lint .",
|
|
71
72
|
"format": "biome format --write .",
|
package/src/core.ts
CHANGED
|
@@ -159,6 +159,14 @@ export class Ecodrix {
|
|
|
159
159
|
axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status === 429
|
|
160
160
|
);
|
|
161
161
|
},
|
|
162
|
+
onRetry: (retryCount, error, requestConfig) => {
|
|
163
|
+
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
164
|
+
if (isDev) {
|
|
165
|
+
console.warn(
|
|
166
|
+
`[ECODrIx SDK] Retrying request (${retryCount}/3): ${requestConfig.method?.toUpperCase()} ${requestConfig.url}. Reason: ${error.message}`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
162
170
|
});
|
|
163
171
|
|
|
164
172
|
// Initialise resources
|
package/src/resources/media.ts
CHANGED
|
@@ -75,15 +75,18 @@ export class MediaResource extends APIResource {
|
|
|
75
75
|
* List files within a specific folder, with optional date filtering.
|
|
76
76
|
*
|
|
77
77
|
* @param folder - The folder key to list.
|
|
78
|
-
* @param params - Optional `year` and `
|
|
78
|
+
* @param params - Optional `year`, `month`, and search `q` filters.
|
|
79
79
|
* @returns Array of file metadata objects.
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```typescript
|
|
83
|
-
* const { data: files } = await ecod.media.list("invoices", {
|
|
83
|
+
* const { data: files } = await ecod.media.list("invoices", { q: "contract" });
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
async list(
|
|
86
|
+
async list(
|
|
87
|
+
folder: string,
|
|
88
|
+
params?: { year?: string; month?: string; q?: string },
|
|
89
|
+
) {
|
|
87
90
|
return this.get(`/api/saas/storage/files/${folder}`, { params } as any);
|
|
88
91
|
}
|
|
89
92
|
|
|
@@ -155,7 +158,10 @@ export class MediaResource extends APIResource {
|
|
|
155
158
|
*/
|
|
156
159
|
async upload(file: any, options: UploadOptions): Promise<any> {
|
|
157
160
|
// Step 1: Get presigned URL
|
|
158
|
-
const { data: presignedData } = await this.client.post(
|
|
161
|
+
const { data: presignedData } = await this.client.post(
|
|
162
|
+
"/api/saas/storage/upload-url",
|
|
163
|
+
options,
|
|
164
|
+
);
|
|
159
165
|
const { uploadUrl, key } = presignedData;
|
|
160
166
|
|
|
161
167
|
// Step 2: Upload directly to R2 (bypasses the API server for performance)
|