appwrite-utils-cli 0.9.85 → 0.9.88
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/dist/interactiveCLI.js
CHANGED
@@ -105,10 +105,16 @@ export class InteractiveCLI {
|
|
105
105
|
}
|
106
106
|
async selectDatabases(databases, message, multiSelect = true) {
|
107
107
|
const configDatabases = this.getLocalDatabases();
|
108
|
-
const
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
const allDatabases = [...databases, ...configDatabases].reduce((acc, db) => {
|
109
|
+
if (!acc.find(d => d.name === db.name)) {
|
110
|
+
acc.push(db);
|
111
|
+
}
|
112
|
+
return acc;
|
113
|
+
}, []);
|
114
|
+
const choices = allDatabases
|
115
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
116
|
+
.map((db) => ({ name: db.name, value: db }))
|
117
|
+
.filter((db) => db.name.toLowerCase() !== "migrations");
|
112
118
|
const { selectedDatabases } = await inquirer.prompt([
|
113
119
|
{
|
114
120
|
type: multiSelect ? "checkbox" : "list",
|
@@ -111,6 +111,9 @@ export class SchemaGenerator {
|
|
111
111
|
return;
|
112
112
|
}
|
113
113
|
this.config.collections.forEach((collection) => {
|
114
|
+
if (!collection.attributes) {
|
115
|
+
return;
|
116
|
+
}
|
114
117
|
collection.attributes.forEach((attr) => {
|
115
118
|
if (attr.type === "relationship" && attr.twoWay && attr.twoWayKey) {
|
116
119
|
const relationshipAttr = attr;
|
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.
|
4
|
+
"version": "0.9.88",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/interactiveCLI.ts
CHANGED
@@ -122,11 +122,18 @@ export class InteractiveCLI {
|
|
122
122
|
multiSelect = true
|
123
123
|
): Promise<Models.Database[]> {
|
124
124
|
const configDatabases = this.getLocalDatabases();
|
125
|
-
const
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
const allDatabases = [...databases, ...configDatabases].reduce((acc, db) => {
|
126
|
+
if (!acc.find(d => d.name === db.name)) {
|
127
|
+
acc.push(db);
|
128
|
+
}
|
129
|
+
return acc;
|
130
|
+
}, [] as Models.Database[]);
|
131
|
+
|
132
|
+
const choices = allDatabases
|
133
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
134
|
+
.map((db) => ({ name: db.name, value: db }))
|
135
|
+
.filter((db) => db.name.toLowerCase() !== "migrations");
|
136
|
+
|
130
137
|
const { selectedDatabases } = await inquirer.prompt([
|
131
138
|
{
|
132
139
|
type: multiSelect ? "checkbox" : "list",
|
@@ -137,7 +144,7 @@ export class InteractiveCLI {
|
|
137
144
|
pageSize: 10,
|
138
145
|
},
|
139
146
|
]);
|
140
|
-
|
147
|
+
|
141
148
|
return selectedDatabases;
|
142
149
|
}
|
143
150
|
|
@@ -146,6 +146,9 @@ export class SchemaGenerator {
|
|
146
146
|
return;
|
147
147
|
}
|
148
148
|
this.config.collections.forEach((collection) => {
|
149
|
+
if (!collection.attributes) {
|
150
|
+
return;
|
151
|
+
}
|
149
152
|
collection.attributes.forEach((attr) => {
|
150
153
|
if (attr.type === "relationship" && attr.twoWay && attr.twoWayKey) {
|
151
154
|
const relationshipAttr = attr as RelationshipAttribute;
|