appwrite-utils-cli 0.0.253 → 0.0.254

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
@@ -81,6 +81,7 @@ This setup ensures that developers have robust tools at their fingertips to mana
81
81
 
82
82
  ### Changelog
83
83
 
84
+ - 0.0.253: Added `--writeData` (or `--write-data`) to command to write the output of the import data to a file called dataLoaderOutput in your root dir
84
85
  - 0.0.23: Added batching to user deletion
85
86
  - 0.0.22: Converted all import processes except `postImportActions` and Relationship Resolution to the local data import, so it should be much faster.
86
87
  - 0.0.6: Added `setTargetFieldFromOtherCollectionDocumentsByMatchingField` for the below, but setting a different field than the field you matched. The names are long, but at least you know what's going on lmao.
@@ -647,7 +647,6 @@ export class DataLoader {
647
647
  finalData: transformedData,
648
648
  });
649
649
  this.importMap.set(this.getCollectionKey(collection.name), currentData);
650
- console.log(`Set import map for ${collection.name}, length is ${currentData.data.length}`);
651
650
  this.oldIdToNewIdPerCollectionMap.set(this.getCollectionKey(collection.name), collectionOldIdToNewIdMap);
652
651
  }
653
652
  else {
@@ -100,7 +100,8 @@ export class ImportController {
100
100
  if (userBatch.finalData && userBatch.finalData.length > 0) {
101
101
  const userId = userBatch.finalData.userId;
102
102
  if (dataLoader.userExistsMap.has(userId)) {
103
- if (!dataLoader.userExistsMap.get(userId)) {
103
+ // We only are storing the existing user ID's as true, so we need to check for that
104
+ if (!(dataLoader.userExistsMap.get(userId) === true)) {
104
105
  return usersController
105
106
  .createUserAndReturn(userBatch.finalData)
106
107
  .then(() => console.log("Created user"))
@@ -110,6 +111,7 @@ export class ImportController {
110
111
  });
111
112
  }
112
113
  else {
114
+ console.log("Skipped existing user: ", userId);
113
115
  return Promise.resolve();
114
116
  }
115
117
  }
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": "0.0.253",
4
+ "version": "0.0.254",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -858,9 +858,6 @@ export class DataLoader {
858
858
  finalData: transformedData,
859
859
  });
860
860
  this.importMap.set(this.getCollectionKey(collection.name), currentData);
861
- console.log(
862
- `Set import map for ${collection.name}, length is ${currentData.data.length}`
863
- );
864
861
  this.oldIdToNewIdPerCollectionMap.set(
865
862
  this.getCollectionKey(collection.name),
866
863
  collectionOldIdToNewIdMap!
@@ -160,7 +160,8 @@ export class ImportController {
160
160
  if (userBatch.finalData && userBatch.finalData.length > 0) {
161
161
  const userId = userBatch.finalData.userId;
162
162
  if (dataLoader.userExistsMap.has(userId)) {
163
- if (!dataLoader.userExistsMap.get(userId)) {
163
+ // We only are storing the existing user ID's as true, so we need to check for that
164
+ if (!(dataLoader.userExistsMap.get(userId) === true)) {
164
165
  return usersController
165
166
  .createUserAndReturn(userBatch.finalData)
166
167
  .then(() => console.log("Created user"))
@@ -174,6 +175,7 @@ export class ImportController {
174
175
  throw error;
175
176
  });
176
177
  } else {
178
+ console.log("Skipped existing user: ", userId);
177
179
  return Promise.resolve();
178
180
  }
179
181
  }