@magentrix-corp/magentrix-cli 1.1.2 → 1.1.3

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 (2) hide show
  1. package/actions/publish.js +19 -3
  2. package/package.json +1 -1
@@ -194,9 +194,25 @@ const handleDeleteStaticAssetAction = async (instanceUrl, apiKey, action) => {
194
194
  * Handles CREATE_FOLDER action.
195
195
  */
196
196
  const handleCreateFolderAction = async (instanceUrl, apiKey, action) => {
197
- const response = await createFolder(instanceUrl, apiKey, action.parentPath, action.folderName);
198
- if (response?.error) throw new Error(response.error);
199
- return response;
197
+ try {
198
+ const response = await createFolder(instanceUrl, apiKey, action.parentPath, action.folderName);
199
+ return response;
200
+ } catch (error) {
201
+ // Check if folder already exists (likely created by file upload)
202
+ const errorMessage = error?.message || String(error);
203
+ const errorLower = errorMessage.toLowerCase();
204
+ const alreadyExists = errorLower.includes('already exists') ||
205
+ errorLower.includes('folder exists') ||
206
+ errorLower.includes('duplicate');
207
+
208
+ if (alreadyExists) {
209
+ // Folder already exists, update cache and treat as success
210
+ return { alreadyExisted: true };
211
+ }
212
+
213
+ // Other errors should still fail
214
+ throw error;
215
+ }
200
216
  };
201
217
 
202
218
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magentrix-corp/magentrix-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "CLI tool for synchronizing local files with Magentrix cloud platform",
5
5
  "main": "index.js",
6
6
  "type": "module",