appwrite-cli 1.2.1 → 2.0.1
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 +4 -4
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/console/variables.md +1 -0
- package/docs/examples/databases/create-relationship-attribute.md +9 -0
- package/docs/examples/databases/get-document.md +2 -1
- package/docs/examples/databases/update-boolean-attribute.md +6 -0
- package/docs/examples/databases/update-datetime-attribute.md +6 -0
- package/docs/examples/databases/update-email-attribute.md +6 -0
- package/docs/examples/databases/update-enum-attribute.md +7 -0
- package/docs/examples/databases/update-float-attribute.md +8 -0
- package/docs/examples/databases/update-integer-attribute.md +8 -0
- package/docs/examples/databases/update-ip-attribute.md +6 -0
- package/docs/examples/databases/update-relationship-attribute.md +5 -0
- package/docs/examples/databases/update-string-attribute.md +6 -0
- package/docs/examples/databases/update-url-attribute.md +6 -0
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +3 -0
- package/docs/examples/projects/update-auth-password-history.md +3 -0
- package/docs/examples/teams/create-membership.md +3 -1
- package/docs/examples/teams/get-prefs.md +2 -0
- package/docs/examples/teams/{update.md → update-name.md} +1 -1
- package/docs/examples/teams/update-prefs.md +3 -0
- package/docs/examples/users/update-password.md +1 -1
- package/index.js +2 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +7 -7
- package/lib/commands/account.js +40 -7
- package/lib/commands/console.js +44 -0
- package/lib/commands/databases.js +727 -103
- package/lib/commands/deploy.js +270 -146
- package/lib/commands/functions.js +35 -9
- package/lib/commands/generic.js +6 -3
- package/lib/commands/init.js +215 -179
- package/lib/commands/projects.js +139 -5
- package/lib/commands/storage.js +39 -11
- package/lib/commands/teams.js +102 -16
- package/lib/commands/users.js +51 -2
- package/lib/config.js +84 -6
- package/lib/parser.js +7 -2
- package/lib/questions.js +307 -280
- package/package.json +1 -1
- package/docs/examples/account/get-logs.md +0 -2
- package/docs/examples/account/get-sessions.md +0 -1
- package/docs/examples/functions/retry-build.md +0 -4
- package/docs/examples/locale/get-continents.md +0 -1
- package/docs/examples/locale/get-countries-e-u.md +0 -1
- package/docs/examples/locale/get-countries-phones.md +0 -1
- package/docs/examples/locale/get-countries.md +0 -1
- package/docs/examples/locale/get-currencies.md +0 -1
- package/docs/examples/locale/get-languages.md +0 -1
- package/docs/examples/teams/get-memberships.md +0 -4
- package/docs/examples/users/get-logs.md +0 -3
- package/docs/examples/users/get-memberships.md +0 -2
- package/docs/examples/users/get-sessions.md +0 -2
package/lib/config.js
CHANGED
|
@@ -22,7 +22,7 @@ class Config {
|
|
|
22
22
|
|
|
23
23
|
write() {
|
|
24
24
|
let dir = _path.dirname(this.path)
|
|
25
|
-
if (!fs.existsSync(dir)){
|
|
25
|
+
if (!fs.existsSync(dir)) {
|
|
26
26
|
fs.mkdirSync(dir, { recursive: true });
|
|
27
27
|
}
|
|
28
28
|
fs.writeFileSync(this.path, JSONbig.stringify(this.data, null, 4));
|
|
@@ -135,7 +135,7 @@ class Local extends Config {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
getCollection($id) {
|
|
138
|
-
if (!this.has("
|
|
138
|
+
if (!this.has("collections")) {
|
|
139
139
|
return {};
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -156,7 +156,7 @@ class Local extends Config {
|
|
|
156
156
|
|
|
157
157
|
let collections = this.get("collections");
|
|
158
158
|
for (let i = 0; i < collections.length; i++) {
|
|
159
|
-
if (collections[i]['$id'] == props['$id']) {
|
|
159
|
+
if (collections[i]['$id'] == props['$id'] && collections[i]['databaseId'] == props['databaseId']) {
|
|
160
160
|
collections[i] = props;
|
|
161
161
|
this.set("collections", collections);
|
|
162
162
|
return;
|
|
@@ -166,6 +166,84 @@ class Local extends Config {
|
|
|
166
166
|
this.set("collections", collections);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
getBuckets() {
|
|
170
|
+
if (!this.has("buckets")) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return this.get("buckets");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
getBucket($id) {
|
|
177
|
+
if (!this.has("buckets")) {
|
|
178
|
+
return {};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let buckets = this.get("buckets");
|
|
182
|
+
for (let i = 0; i < buckets.length; i++) {
|
|
183
|
+
if (buckets[i]['$id'] == $id) {
|
|
184
|
+
return buckets[i];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
addBucket(props) {
|
|
192
|
+
if (!this.has("buckets")) {
|
|
193
|
+
this.set("buckets", []);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let buckets = this.get("buckets");
|
|
197
|
+
for (let i = 0; i < buckets.length; i++) {
|
|
198
|
+
if (buckets[i]['$id'] == props['$id']) {
|
|
199
|
+
buckets[i] = props;
|
|
200
|
+
this.set("buckets", buckets);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
buckets.push(props);
|
|
205
|
+
this.set("buckets", buckets);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
getDatabases() {
|
|
209
|
+
if (!this.has("databases")) {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
return this.get("databases");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
getDatabase($id) {
|
|
216
|
+
if (!this.has("databases")) {
|
|
217
|
+
return {};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
let databases = this.get("databases");
|
|
221
|
+
for (let i = 0; i < databases.length; i++) {
|
|
222
|
+
if (databases[i]['$id'] == $id) {
|
|
223
|
+
return databases[i];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return {};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
addDatabase(props) {
|
|
231
|
+
if (!this.has("databases")) {
|
|
232
|
+
this.set("databases", []);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
let databases = this.get("databases");
|
|
236
|
+
for (let i = 0; i < databases.length; i++) {
|
|
237
|
+
if (databases[i]['$id'] == props['$id']) {
|
|
238
|
+
databases[i] = props;
|
|
239
|
+
this.set("databases", databases);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
databases.push(props);
|
|
244
|
+
this.set("databases", databases);
|
|
245
|
+
}
|
|
246
|
+
|
|
169
247
|
getTeams() {
|
|
170
248
|
if (!this.has("teams")) {
|
|
171
249
|
return [];
|
|
@@ -187,7 +265,7 @@ class Local extends Config {
|
|
|
187
265
|
|
|
188
266
|
return {};
|
|
189
267
|
}
|
|
190
|
-
|
|
268
|
+
|
|
191
269
|
addTeam(props) {
|
|
192
270
|
if (!this.has("teams")) {
|
|
193
271
|
this.set("teams", []);
|
|
@@ -300,6 +378,6 @@ class Global extends Config {
|
|
|
300
378
|
}
|
|
301
379
|
|
|
302
380
|
module.exports = {
|
|
303
|
-
localConfig
|
|
304
|
-
globalConfig
|
|
381
|
+
localConfig: new Local(),
|
|
382
|
+
globalConfig: new Global(),
|
|
305
383
|
};
|
package/lib/parser.js
CHANGED
|
@@ -23,8 +23,12 @@ const parse = (data) => {
|
|
|
23
23
|
drawJSON(data[key]);
|
|
24
24
|
}
|
|
25
25
|
} else if (typeof data[key] === 'object') {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (data[key] && data[key].constructor.name === 'BigNumber') {
|
|
27
|
+
console.log(`${chalk.yellow.bold(key)} : ${data[key]}`);
|
|
28
|
+
} else {
|
|
29
|
+
console.log(`${chalk.yellow.bold.underline(key)}`)
|
|
30
|
+
parse(data[key]);
|
|
31
|
+
}
|
|
28
32
|
} else {
|
|
29
33
|
console.log(`${chalk.yellow.bold(key)} : ${data[key]}`);
|
|
30
34
|
}
|
|
@@ -164,6 +168,7 @@ const commandDescriptions = {
|
|
|
164
168
|
"client": `The client command allows you to configure your CLI`,
|
|
165
169
|
"login": `The login command allows you to authenticate and manage a user account.`,
|
|
166
170
|
"logout": `The logout command allows you to logout of your Appwrite account.`,
|
|
171
|
+
"console" : `The console command allows gives you access to the APIs used by the Appwrite console.`,
|
|
167
172
|
"main": chalk.redBright(`${logo}${description}`),
|
|
168
173
|
}
|
|
169
174
|
|