appwrite-utils-cli 1.2.16 → 1.2.17

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/README.md CHANGED
@@ -637,7 +637,8 @@ npx appwrite-utils-cli appwrite-migrate --generateConstants --constantsLanguages
637
637
 
638
638
  ### Changelog
639
639
 
640
- - 1.1.15: Fixed various transfer and sync functionalities
640
+ - 1.2.17: Fixed users transfer not keeping validation of email / phone, temporarily disable bulk transfer to see if permissions aren't being updated by it
641
+ - 1.2.15: Fixed various transfer and sync functionalities
641
642
  - 1.0.5: Fixed `.` directories being ignored. Normally a good thing
642
643
  - 1.0.4: Fixed `appwriteConfig.yaml` being the name for the converted config, instead of `config.yaml`
643
644
  - 1.0.3: Fixed appwriteConfig detection for `--it` so it detects when you can migrate your config
@@ -322,7 +322,14 @@ export class ComprehensiveTransfer {
322
322
  }
323
323
  // Handle indexes with enhanced status checking
324
324
  MessageFormatter.info(`Creating indexes for collection ${collection.name} with enhanced monitoring...`, { prefix: "Transfer" });
325
- const indexesSuccess = await this.createCollectionIndexesWithStatusCheck(dbId, this.targetDatabases, targetCollection.$id, targetCollection, collection.indexes);
325
+ let indexesSuccess = true;
326
+ // Check if indexes need to be created ahead of time
327
+ if (collection.indexes.some((index) => !targetCollection.indexes.some((ti) => ti.key === index.key ||
328
+ ti.attributes.sort().join(",") ===
329
+ index.attributes.sort().join(","))) ||
330
+ collection.indexes.length !== targetCollection.indexes.length) {
331
+ indexesSuccess = await this.createCollectionIndexesWithStatusCheck(dbId, this.targetDatabases, targetCollection.$id, targetCollection, collection.indexes);
332
+ }
326
333
  if (!indexesSuccess) {
327
334
  MessageFormatter.error(`Failed to create some indexes for collection ${collection.name}`, undefined, { prefix: "Transfer" });
328
335
  MessageFormatter.warning(`Proceeding with document transfer despite index failures for collection ${collection.name}`, { prefix: "Transfer" });
@@ -810,8 +817,9 @@ export class ComprehensiveTransfer {
810
817
  let totalSkipped = 0;
811
818
  let totalUpdated = 0;
812
819
  // Check if bulk operations are supported
813
- const supportsBulk = this.options.sourceEndpoint.includes("cloud.appwrite.io") ||
814
- this.options.targetEndpoint.includes("cloud.appwrite.io");
820
+ const bulkEnabled = false;
821
+ // Temporarily disable to see if it fixes my permissions issues
822
+ const supportsBulk = bulkEnabled ? this.options.targetEndpoint.includes("cloud.appwrite.io") : false;
815
823
  if (supportsBulk) {
816
824
  MessageFormatter.info(`Using bulk operations for enhanced performance`, {
817
825
  prefix: "Transfer",
@@ -376,6 +376,12 @@ export const transferUsersLocalToRemote = async (localUsers, endpoint, projectId
376
376
  if (user.status === false) {
377
377
  await tryAwaitWithRetry(async () => remoteUsers.updateStatus(user.$id, false));
378
378
  }
379
+ if (user.emailVerification) {
380
+ await tryAwaitWithRetry(async () => remoteUsers.updateEmailVerification(user.$id, true));
381
+ }
382
+ if (user.phoneVerification) {
383
+ await tryAwaitWithRetry(async () => remoteUsers.updatePhoneVerification(user.$id, true));
384
+ }
379
385
  totalTransferred++;
380
386
  console.log(chalk.green(`Transferred user ${user.$id}`));
381
387
  }
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.16",
4
+ "version": "1.2.17",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -573,14 +573,28 @@ export class ComprehensiveTransfer {
573
573
  { prefix: "Transfer" }
574
574
  );
575
575
 
576
- const indexesSuccess =
577
- await this.createCollectionIndexesWithStatusCheck(
576
+ let indexesSuccess = true;
577
+ // Check if indexes need to be created ahead of time
578
+ if (
579
+ collection.indexes.some(
580
+ (index) =>
581
+ !targetCollection.indexes.some(
582
+ (ti) =>
583
+ ti.key === index.key ||
584
+ ti.attributes.sort().join(",") ===
585
+ index.attributes.sort().join(",")
586
+ )
587
+ ) ||
588
+ collection.indexes.length !== targetCollection.indexes.length
589
+ ) {
590
+ indexesSuccess = await this.createCollectionIndexesWithStatusCheck(
578
591
  dbId,
579
592
  this.targetDatabases,
580
593
  targetCollection.$id,
581
594
  targetCollection,
582
595
  collection.indexes as any
583
596
  );
597
+ }
584
598
 
585
599
  if (!indexesSuccess) {
586
600
  MessageFormatter.error(
@@ -1442,9 +1456,9 @@ export class ComprehensiveTransfer {
1442
1456
  let totalUpdated = 0;
1443
1457
 
1444
1458
  // Check if bulk operations are supported
1445
- const supportsBulk =
1446
- this.options.sourceEndpoint.includes("cloud.appwrite.io") ||
1447
- this.options.targetEndpoint.includes("cloud.appwrite.io");
1459
+ const bulkEnabled = false;
1460
+ // Temporarily disable to see if it fixes my permissions issues
1461
+ const supportsBulk = bulkEnabled ? this.options.targetEndpoint.includes("cloud.appwrite.io") : false;
1448
1462
 
1449
1463
  if (supportsBulk) {
1450
1464
  MessageFormatter.info(`Using bulk operations for enhanced performance`, {
@@ -769,6 +769,18 @@ export const transferUsersLocalToRemote = async (
769
769
  );
770
770
  }
771
771
 
772
+ if (user.emailVerification) {
773
+ await tryAwaitWithRetry(async () =>
774
+ remoteUsers.updateEmailVerification(user.$id, true)
775
+ );
776
+ }
777
+
778
+ if (user.phoneVerification) {
779
+ await tryAwaitWithRetry(async () =>
780
+ remoteUsers.updatePhoneVerification(user.$id, true)
781
+ );
782
+ }
783
+
772
784
  totalTransferred++;
773
785
  console.log(chalk.green(`Transferred user ${user.$id}`));
774
786
  } catch (error) {