appwrite-utils-cli 1.2.18 → 1.2.19

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.
@@ -391,9 +391,8 @@ const transferDocumentWithRetry = async (db, dbId, collectionId, documentId, doc
391
391
  }
392
392
  catch (error) {
393
393
  // Check if document already exists
394
- if (error.code === 409 || error.message?.includes('already exists')) {
395
- console.log(chalk.yellow(`Document ${documentId} already exists, skipping...`));
396
- return true;
394
+ if (error.code === 409 || error.message?.toLowerCase().includes('already exists')) {
395
+ await db.updateDocument(dbId, collectionId, documentId, documentData, permissions);
397
396
  }
398
397
  if (retryCount < maxRetries) {
399
398
  // Calculate exponential backoff: 1s, 2s, 4s
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "appwrite-utils-cli",
3
3
  "description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
4
- "version": "1.2.18",
4
+ "version": "1.2.19",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -640,9 +640,14 @@ const transferDocumentWithRetry = async (
640
640
  return true;
641
641
  } catch (error: any) {
642
642
  // Check if document already exists
643
- if (error.code === 409 || error.message?.includes('already exists')) {
644
- console.log(chalk.yellow(`Document ${documentId} already exists, skipping...`));
645
- return true;
643
+ if (error.code === 409 || error.message?.toLowerCase().includes('already exists')) {
644
+ await db.updateDocument(
645
+ dbId,
646
+ collectionId,
647
+ documentId,
648
+ documentData,
649
+ permissions
650
+ );
646
651
  }
647
652
 
648
653
  if (retryCount < maxRetries) {