appwrite-utils-cli 0.9.79 → 0.9.80

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
@@ -125,6 +125,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
125
125
 
126
126
  ## Changelog
127
127
 
128
+ - 0.9.80: Fixed collections not being unique between local and remote
128
129
  - 0.9.79: Fixed local collections not being considered for the synchronization unless all de-selected
129
130
  - 0.9.78: Added colored text! And also added a lot more customization options as to what to wipe, update, etc.
130
131
  - 0.9.75: Fixed attribute bug
@@ -122,7 +122,9 @@ export class InteractiveCLI {
122
122
  async selectCollections(database, databasesClient, message, multiSelect = true) {
123
123
  const collections = await fetchAllCollections(database.$id, databasesClient);
124
124
  const configCollections = this.getLocalCollections();
125
- const allCollections = Array.from(new Set([...collections, ...configCollections]));
125
+ const collectionNames = collections.map((c) => c.name).concat(configCollections.map((c) => c.name));
126
+ const allCollectionNamesUnique = Array.from(new Set(collectionNames));
127
+ const allCollections = allCollectionNamesUnique.map((name) => configCollections.find((c) => c.name === name) ?? collections.find((c) => c.name === name)).filter((v) => v !== undefined);
126
128
  const choices = allCollections.map((collection) => ({
127
129
  name: collection.name,
128
130
  value: collection,
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.9.79",
4
+ "version": "0.9.80",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@types/inquirer": "^9.0.7",
34
- "appwrite-utils": "^0.3.91",
34
+ "appwrite-utils": "^0.3.94",
35
35
  "chalk": "^5.3.0",
36
36
  "commander": "^12.1.0",
37
37
  "inquirer": "^9.3.6",
@@ -152,7 +152,9 @@ export class InteractiveCLI {
152
152
  databasesClient
153
153
  );
154
154
  const configCollections = this.getLocalCollections();
155
- const allCollections = Array.from(new Set([...collections, ...configCollections]));
155
+ const collectionNames = collections.map((c) => c.name).concat(configCollections.map((c) => c.name));
156
+ const allCollectionNamesUnique = Array.from(new Set(collectionNames));
157
+ const allCollections = allCollectionNamesUnique.map((name) => configCollections.find((c) => c.name === name) ?? collections.find((c) => c.name === name)).filter((v) => v !== undefined);
156
158
  const choices = allCollections.map((collection) => ({
157
159
  name: collection.name,
158
160
  value: collection,