appwrite-cli 0.18.5 → 1.0.0

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.
Files changed (79) hide show
  1. package/.github/workflows/npm-publish.yml +8 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +4 -4
  4. package/appwrite.json +4 -0
  5. package/docs/examples/account/create-phone-session.md +1 -1
  6. package/docs/examples/account/get-logs.md +0 -1
  7. package/docs/examples/account/list-logs.md +2 -0
  8. package/docs/examples/account/list-sessions.md +1 -0
  9. package/docs/examples/account/update-phone.md +1 -1
  10. package/docs/examples/avatars/get-initials.md +0 -1
  11. package/docs/examples/databases/create-collection.md +2 -3
  12. package/docs/examples/databases/create-datetime-attribute.md +7 -0
  13. package/docs/examples/databases/create-document.md +0 -1
  14. package/docs/examples/databases/list-collection-logs.md +0 -1
  15. package/docs/examples/databases/list-collections.md +0 -4
  16. package/docs/examples/databases/list-document-logs.md +0 -1
  17. package/docs/examples/databases/list-documents.md +0 -6
  18. package/docs/examples/databases/list-logs.md +0 -1
  19. package/docs/examples/databases/list.md +0 -4
  20. package/docs/examples/databases/update-collection.md +0 -1
  21. package/docs/examples/databases/update-document.md +0 -1
  22. package/docs/examples/functions/create-variable.md +4 -0
  23. package/docs/examples/functions/create.md +1 -1
  24. package/docs/examples/functions/delete-variable.md +3 -0
  25. package/docs/examples/functions/get-function-usage.md +3 -0
  26. package/docs/examples/functions/get-usage.md +0 -1
  27. package/docs/examples/functions/get-variable.md +3 -0
  28. package/docs/examples/functions/list-deployments.md +0 -4
  29. package/docs/examples/functions/list-executions.md +0 -3
  30. package/docs/examples/functions/list-variables.md +2 -0
  31. package/docs/examples/functions/list.md +0 -4
  32. package/docs/examples/functions/update-variable.md +5 -0
  33. package/docs/examples/functions/update.md +1 -1
  34. package/docs/examples/locale/list-continents.md +1 -0
  35. package/docs/examples/locale/list-countries-e-u.md +1 -0
  36. package/docs/examples/locale/list-countries-phones.md +1 -0
  37. package/docs/examples/locale/list-countries.md +1 -0
  38. package/docs/examples/locale/list-currencies.md +1 -0
  39. package/docs/examples/locale/list-languages.md +1 -0
  40. package/docs/examples/projects/list.md +0 -4
  41. package/docs/examples/storage/create-bucket.md +1 -1
  42. package/docs/examples/storage/create-file.md +0 -1
  43. package/docs/examples/storage/list-buckets.md +0 -4
  44. package/docs/examples/storage/list-files.md +0 -4
  45. package/docs/examples/storage/update-bucket.md +1 -1
  46. package/docs/examples/storage/update-file.md +0 -1
  47. package/docs/examples/teams/get-memberships.md +0 -4
  48. package/docs/examples/teams/list-logs.md +0 -1
  49. package/docs/examples/teams/list-memberships.md +4 -0
  50. package/docs/examples/teams/list.md +0 -4
  51. package/docs/examples/users/create-argon2user.md +5 -0
  52. package/docs/examples/users/create-bcrypt-user.md +5 -0
  53. package/docs/examples/users/create-m-d5user.md +5 -0
  54. package/docs/examples/users/create-p-h-pass-user.md +5 -0
  55. package/docs/examples/users/create-s-h-a-user.md +6 -0
  56. package/docs/examples/users/create-scrypt-modified-user.md +8 -0
  57. package/docs/examples/users/create-scrypt-user.md +10 -0
  58. package/docs/examples/users/create.md +3 -2
  59. package/docs/examples/users/get-logs.md +0 -1
  60. package/docs/examples/users/list-logs.md +3 -0
  61. package/docs/examples/users/list-memberships.md +2 -0
  62. package/docs/examples/users/list-sessions.md +2 -0
  63. package/docs/examples/users/list.md +0 -4
  64. package/install.ps1 +2 -2
  65. package/install.sh +1 -1
  66. package/lib/client.js +7 -3
  67. package/lib/commands/account.js +24 -29
  68. package/lib/commands/avatars.js +2 -7
  69. package/lib/commands/databases.js +154 -210
  70. package/lib/commands/deploy.js +12 -3
  71. package/lib/commands/functions.js +227 -93
  72. package/lib/commands/generic.js +3 -3
  73. package/lib/commands/locale.js +24 -24
  74. package/lib/commands/projects.js +10 -30
  75. package/lib/commands/storage.js +53 -105
  76. package/lib/commands/teams.js +20 -65
  77. package/lib/commands/users.js +425 -47
  78. package/lib/questions.js +1 -1
  79. package/package.json +1 -1
@@ -12,39 +12,67 @@ const { localConfig, globalConfig } = require("../config");
12
12
 
13
13
  const users = new Command("users").description(commandDescriptions['users'])
14
14
 
15
- const usersList = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
15
+ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
16
+ /* @param {string[]} queries */
16
17
  /* @param {string} search */
17
- /* @param {number} limit */
18
- /* @param {number} offset */
19
- /* @param {string} cursor */
20
- /* @param {string} cursorDirection */
21
- /* @param {string} orderType */
22
18
 
23
19
  let client = !sdk ? await sdkForProject() : sdk;
24
20
  let path = '/users';
25
21
  let payload = {};
26
22
 
27
23
  /** Query Params */
24
+ if (typeof queries !== 'undefined') {
25
+ payload['queries'] = queries;
26
+ }
28
27
  if (typeof search !== 'undefined') {
29
28
  payload['search'] = search;
30
29
  }
31
- if (typeof limit !== 'undefined') {
32
- payload['limit'] = limit;
30
+ let response = undefined;
31
+ response = await client.call('get', path, {
32
+ 'content-type': 'application/json',
33
+ }, payload);
34
+
35
+ if (parseOutput) {
36
+ parse(response)
37
+ success()
38
+ }
39
+ return response;
40
+ }
41
+
42
+ const usersCreate = async ({ userId, email, phone, password, name, parseOutput = true, sdk = undefined}) => {
43
+ /* @param {string} userId */
44
+ /* @param {string} email */
45
+ /* @param {string} phone */
46
+ /* @param {string} password */
47
+ /* @param {string} name */
48
+
49
+ let client = !sdk ? await sdkForProject() : sdk;
50
+ let path = '/users';
51
+ let payload = {};
52
+
53
+ /** Body Params */
54
+ if (typeof userId !== 'undefined') {
55
+ payload['userId'] = userId;
33
56
  }
34
- if (typeof offset !== 'undefined') {
35
- payload['offset'] = offset;
57
+
58
+ if (typeof email !== 'undefined') {
59
+ payload['email'] = email;
36
60
  }
37
- if (typeof cursor !== 'undefined') {
38
- payload['cursor'] = cursor;
61
+
62
+ if (typeof phone !== 'undefined') {
63
+ payload['phone'] = phone;
39
64
  }
40
- if (typeof cursorDirection !== 'undefined') {
41
- payload['cursorDirection'] = cursorDirection;
65
+
66
+ if (typeof password !== 'undefined') {
67
+ payload['password'] = password;
42
68
  }
43
- if (typeof orderType !== 'undefined') {
44
- payload['orderType'] = orderType;
69
+
70
+ if (typeof name !== 'undefined') {
71
+ payload['name'] = name;
45
72
  }
73
+
46
74
  let response = undefined;
47
- response = await client.call('get', path, {
75
+ response = await client.call('post', path, {
48
76
  'content-type': 'application/json',
49
77
  }, payload);
50
78
 
@@ -55,14 +83,289 @@ const usersList = async ({ search, limit, offset, cursor, cursorDirection, order
55
83
  return response;
56
84
  }
57
85
 
58
- const usersCreate = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
86
+ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
59
87
  /* @param {string} userId */
60
88
  /* @param {string} email */
61
89
  /* @param {string} password */
62
90
  /* @param {string} name */
63
91
 
64
92
  let client = !sdk ? await sdkForProject() : sdk;
65
- let path = '/users';
93
+ let path = '/users/argon2';
94
+ let payload = {};
95
+
96
+ /** Body Params */
97
+ if (typeof userId !== 'undefined') {
98
+ payload['userId'] = userId;
99
+ }
100
+
101
+ if (typeof email !== 'undefined') {
102
+ payload['email'] = email;
103
+ }
104
+
105
+ if (typeof password !== 'undefined') {
106
+ payload['password'] = password;
107
+ }
108
+
109
+ if (typeof name !== 'undefined') {
110
+ payload['name'] = name;
111
+ }
112
+
113
+ let response = undefined;
114
+ response = await client.call('post', path, {
115
+ 'content-type': 'application/json',
116
+ }, payload);
117
+
118
+ if (parseOutput) {
119
+ parse(response)
120
+ success()
121
+ }
122
+ return response;
123
+ }
124
+
125
+ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
126
+ /* @param {string} userId */
127
+ /* @param {string} email */
128
+ /* @param {string} password */
129
+ /* @param {string} name */
130
+
131
+ let client = !sdk ? await sdkForProject() : sdk;
132
+ let path = '/users/bcrypt';
133
+ let payload = {};
134
+
135
+ /** Body Params */
136
+ if (typeof userId !== 'undefined') {
137
+ payload['userId'] = userId;
138
+ }
139
+
140
+ if (typeof email !== 'undefined') {
141
+ payload['email'] = email;
142
+ }
143
+
144
+ if (typeof password !== 'undefined') {
145
+ payload['password'] = password;
146
+ }
147
+
148
+ if (typeof name !== 'undefined') {
149
+ payload['name'] = name;
150
+ }
151
+
152
+ let response = undefined;
153
+ response = await client.call('post', path, {
154
+ 'content-type': 'application/json',
155
+ }, payload);
156
+
157
+ if (parseOutput) {
158
+ parse(response)
159
+ success()
160
+ }
161
+ return response;
162
+ }
163
+
164
+ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
165
+ /* @param {string} userId */
166
+ /* @param {string} email */
167
+ /* @param {string} password */
168
+ /* @param {string} name */
169
+
170
+ let client = !sdk ? await sdkForProject() : sdk;
171
+ let path = '/users/md5';
172
+ let payload = {};
173
+
174
+ /** Body Params */
175
+ if (typeof userId !== 'undefined') {
176
+ payload['userId'] = userId;
177
+ }
178
+
179
+ if (typeof email !== 'undefined') {
180
+ payload['email'] = email;
181
+ }
182
+
183
+ if (typeof password !== 'undefined') {
184
+ payload['password'] = password;
185
+ }
186
+
187
+ if (typeof name !== 'undefined') {
188
+ payload['name'] = name;
189
+ }
190
+
191
+ let response = undefined;
192
+ response = await client.call('post', path, {
193
+ 'content-type': 'application/json',
194
+ }, payload);
195
+
196
+ if (parseOutput) {
197
+ parse(response)
198
+ success()
199
+ }
200
+ return response;
201
+ }
202
+
203
+ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
204
+ /* @param {string} userId */
205
+ /* @param {string} email */
206
+ /* @param {string} password */
207
+ /* @param {string} name */
208
+
209
+ let client = !sdk ? await sdkForProject() : sdk;
210
+ let path = '/users/phpass';
211
+ let payload = {};
212
+
213
+ /** Body Params */
214
+ if (typeof userId !== 'undefined') {
215
+ payload['userId'] = userId;
216
+ }
217
+
218
+ if (typeof email !== 'undefined') {
219
+ payload['email'] = email;
220
+ }
221
+
222
+ if (typeof password !== 'undefined') {
223
+ payload['password'] = password;
224
+ }
225
+
226
+ if (typeof name !== 'undefined') {
227
+ payload['name'] = name;
228
+ }
229
+
230
+ let response = undefined;
231
+ response = await client.call('post', path, {
232
+ 'content-type': 'application/json',
233
+ }, payload);
234
+
235
+ if (parseOutput) {
236
+ parse(response)
237
+ success()
238
+ }
239
+ return response;
240
+ }
241
+
242
+ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name, parseOutput = true, sdk = undefined}) => {
243
+ /* @param {string} userId */
244
+ /* @param {string} email */
245
+ /* @param {string} password */
246
+ /* @param {string} passwordSalt */
247
+ /* @param {number} passwordCpu */
248
+ /* @param {number} passwordMemory */
249
+ /* @param {number} passwordParallel */
250
+ /* @param {number} passwordLength */
251
+ /* @param {string} name */
252
+
253
+ let client = !sdk ? await sdkForProject() : sdk;
254
+ let path = '/users/scrypt';
255
+ let payload = {};
256
+
257
+ /** Body Params */
258
+ if (typeof userId !== 'undefined') {
259
+ payload['userId'] = userId;
260
+ }
261
+
262
+ if (typeof email !== 'undefined') {
263
+ payload['email'] = email;
264
+ }
265
+
266
+ if (typeof password !== 'undefined') {
267
+ payload['password'] = password;
268
+ }
269
+
270
+ if (typeof passwordSalt !== 'undefined') {
271
+ payload['passwordSalt'] = passwordSalt;
272
+ }
273
+
274
+ if (typeof passwordCpu !== 'undefined') {
275
+ payload['passwordCpu'] = passwordCpu;
276
+ }
277
+
278
+ if (typeof passwordMemory !== 'undefined') {
279
+ payload['passwordMemory'] = passwordMemory;
280
+ }
281
+
282
+ if (typeof passwordParallel !== 'undefined') {
283
+ payload['passwordParallel'] = passwordParallel;
284
+ }
285
+
286
+ if (typeof passwordLength !== 'undefined') {
287
+ payload['passwordLength'] = passwordLength;
288
+ }
289
+
290
+ if (typeof name !== 'undefined') {
291
+ payload['name'] = name;
292
+ }
293
+
294
+ let response = undefined;
295
+ response = await client.call('post', path, {
296
+ 'content-type': 'application/json',
297
+ }, payload);
298
+
299
+ if (parseOutput) {
300
+ parse(response)
301
+ success()
302
+ }
303
+ return response;
304
+ }
305
+
306
+ const usersCreateScryptModifiedUser = async ({ userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name, parseOutput = true, sdk = undefined}) => {
307
+ /* @param {string} userId */
308
+ /* @param {string} email */
309
+ /* @param {string} password */
310
+ /* @param {string} passwordSalt */
311
+ /* @param {string} passwordSaltSeparator */
312
+ /* @param {string} passwordSignerKey */
313
+ /* @param {string} name */
314
+
315
+ let client = !sdk ? await sdkForProject() : sdk;
316
+ let path = '/users/scrypt-modified';
317
+ let payload = {};
318
+
319
+ /** Body Params */
320
+ if (typeof userId !== 'undefined') {
321
+ payload['userId'] = userId;
322
+ }
323
+
324
+ if (typeof email !== 'undefined') {
325
+ payload['email'] = email;
326
+ }
327
+
328
+ if (typeof password !== 'undefined') {
329
+ payload['password'] = password;
330
+ }
331
+
332
+ if (typeof passwordSalt !== 'undefined') {
333
+ payload['passwordSalt'] = passwordSalt;
334
+ }
335
+
336
+ if (typeof passwordSaltSeparator !== 'undefined') {
337
+ payload['passwordSaltSeparator'] = passwordSaltSeparator;
338
+ }
339
+
340
+ if (typeof passwordSignerKey !== 'undefined') {
341
+ payload['passwordSignerKey'] = passwordSignerKey;
342
+ }
343
+
344
+ if (typeof name !== 'undefined') {
345
+ payload['name'] = name;
346
+ }
347
+
348
+ let response = undefined;
349
+ response = await client.call('post', path, {
350
+ 'content-type': 'application/json',
351
+ }, payload);
352
+
353
+ if (parseOutput) {
354
+ parse(response)
355
+ success()
356
+ }
357
+ return response;
358
+ }
359
+
360
+ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, name, parseOutput = true, sdk = undefined}) => {
361
+ /* @param {string} userId */
362
+ /* @param {string} email */
363
+ /* @param {string} password */
364
+ /* @param {string} passwordVersion */
365
+ /* @param {string} name */
366
+
367
+ let client = !sdk ? await sdkForProject() : sdk;
368
+ let path = '/users/sha';
66
369
  let payload = {};
67
370
 
68
371
  /** Body Params */
@@ -78,6 +381,10 @@ const usersCreate = async ({ userId, email, password, name, parseOutput = true,
78
381
  payload['password'] = password;
79
382
  }
80
383
 
384
+ if (typeof passwordVersion !== 'undefined') {
385
+ payload['passwordVersion'] = passwordVersion;
386
+ }
387
+
81
388
  if (typeof name !== 'undefined') {
82
389
  payload['name'] = name;
83
390
  }
@@ -182,21 +489,17 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
182
489
  return response;
183
490
  }
184
491
 
185
- const usersGetLogs = async ({ userId, limit, offset, parseOutput = true, sdk = undefined}) => {
492
+ const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
186
493
  /* @param {string} userId */
187
- /* @param {number} limit */
188
- /* @param {number} offset */
494
+ /* @param {string[]} queries */
189
495
 
190
496
  let client = !sdk ? await sdkForProject() : sdk;
191
497
  let path = '/users/{userId}/logs'.replace('{userId}', userId);
192
498
  let payload = {};
193
499
 
194
500
  /** Query Params */
195
- if (typeof limit !== 'undefined') {
196
- payload['limit'] = limit;
197
- }
198
- if (typeof offset !== 'undefined') {
199
- payload['offset'] = offset;
501
+ if (typeof queries !== 'undefined') {
502
+ payload['queries'] = queries;
200
503
  }
201
504
  let response = undefined;
202
505
  response = await client.call('get', path, {
@@ -210,7 +513,7 @@ const usersGetLogs = async ({ userId, limit, offset, parseOutput = true, sdk = u
210
513
  return response;
211
514
  }
212
515
 
213
- const usersGetMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
516
+ const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
214
517
  /* @param {string} userId */
215
518
 
216
519
  let client = !sdk ? await sdkForProject() : sdk;
@@ -346,7 +649,7 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
346
649
  return response;
347
650
  }
348
651
 
349
- const usersGetSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
652
+ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
350
653
  /* @param {string} userId */
351
654
 
352
655
  let client = !sdk ? await sdkForProject() : sdk;
@@ -480,23 +783,92 @@ const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOu
480
783
  users
481
784
  .command(`list`)
482
785
  .description(`Get a list of all the project's users. You can use the query params to filter your results.`)
786
+ .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification`)
483
787
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
484
- .option(`--limit <limit>`, `Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
485
- .option(`--offset <offset>`, `Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
486
- .option(`--cursor <cursor>`, `ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
487
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
488
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
489
788
  .action(actionRunner(usersList))
490
789
 
491
790
  users
492
791
  .command(`create`)
493
792
  .description(`Create a new user.`)
494
793
  .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
495
- .requiredOption(`--email <email>`, `User email.`)
496
- .requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`)
794
+ .option(`--email <email>`, `User email.`)
795
+ .option(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
796
+ .option(`--password <password>`, `Plain text user password. Must be at least 8 chars.`)
497
797
  .option(`--name <name>`, `User name. Max length: 128 chars.`)
498
798
  .action(actionRunner(usersCreate))
499
799
 
800
+ users
801
+ .command(`createArgon2User`)
802
+ .description(`Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
803
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
804
+ .requiredOption(`--email <email>`, `User email.`)
805
+ .requiredOption(`--password <password>`, `User password hashed using Argon2.`)
806
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
807
+ .action(actionRunner(usersCreateArgon2User))
808
+
809
+ users
810
+ .command(`createBcryptUser`)
811
+ .description(`Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
812
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
813
+ .requiredOption(`--email <email>`, `User email.`)
814
+ .requiredOption(`--password <password>`, `User password hashed using Bcrypt.`)
815
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
816
+ .action(actionRunner(usersCreateBcryptUser))
817
+
818
+ users
819
+ .command(`createMD5User`)
820
+ .description(`Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
821
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
822
+ .requiredOption(`--email <email>`, `User email.`)
823
+ .requiredOption(`--password <password>`, `User password hashed using MD5.`)
824
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
825
+ .action(actionRunner(usersCreateMD5User))
826
+
827
+ users
828
+ .command(`createPHPassUser`)
829
+ .description(`Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
830
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
831
+ .requiredOption(`--email <email>`, `User email.`)
832
+ .requiredOption(`--password <password>`, `User password hashed using PHPass.`)
833
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
834
+ .action(actionRunner(usersCreatePHPassUser))
835
+
836
+ users
837
+ .command(`createScryptUser`)
838
+ .description(`Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
839
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
840
+ .requiredOption(`--email <email>`, `User email.`)
841
+ .requiredOption(`--password <password>`, `User password hashed using Scrypt.`)
842
+ .requiredOption(`--passwordSalt <passwordSalt>`, `Optional salt used to hash password.`)
843
+ .requiredOption(`--passwordCpu <passwordCpu>`, `Optional CPU cost used to hash password.`, parseInteger)
844
+ .requiredOption(`--passwordMemory <passwordMemory>`, `Optional memory cost used to hash password.`, parseInteger)
845
+ .requiredOption(`--passwordParallel <passwordParallel>`, `Optional parallelization cost used to hash password.`, parseInteger)
846
+ .requiredOption(`--passwordLength <passwordLength>`, `Optional hash length used to hash password.`, parseInteger)
847
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
848
+ .action(actionRunner(usersCreateScryptUser))
849
+
850
+ users
851
+ .command(`createScryptModifiedUser`)
852
+ .description(`Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
853
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
854
+ .requiredOption(`--email <email>`, `User email.`)
855
+ .requiredOption(`--password <password>`, `User password hashed using Scrypt Modified.`)
856
+ .requiredOption(`--passwordSalt <passwordSalt>`, `Salt used to hash password.`)
857
+ .requiredOption(`--passwordSaltSeparator <passwordSaltSeparator>`, `Salt separator used to hash password.`)
858
+ .requiredOption(`--passwordSignerKey <passwordSignerKey>`, `Signer key used to hash password.`)
859
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
860
+ .action(actionRunner(usersCreateScryptModifiedUser))
861
+
862
+ users
863
+ .command(`createSHAUser`)
864
+ .description(`Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
865
+ .requiredOption(`--userId <userId>`, `User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
866
+ .requiredOption(`--email <email>`, `User email.`)
867
+ .requiredOption(`--password <password>`, `User password hashed using SHA.`)
868
+ .option(`--passwordVersion <passwordVersion>`, `Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'`)
869
+ .option(`--name <name>`, `User name. Max length: 128 chars.`)
870
+ .action(actionRunner(usersCreateSHAUser))
871
+
500
872
  users
501
873
  .command(`getUsage`)
502
874
  .description(``)
@@ -524,18 +896,17 @@ users
524
896
  .action(actionRunner(usersUpdateEmail))
525
897
 
526
898
  users
527
- .command(`getLogs`)
899
+ .command(`listLogs`)
528
900
  .description(`Get the user activity logs list by its unique ID.`)
529
901
  .requiredOption(`--userId <userId>`, `User ID.`)
530
- .option(`--limit <limit>`, `Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
531
- .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
532
- .action(actionRunner(usersGetLogs))
902
+ .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset`)
903
+ .action(actionRunner(usersListLogs))
533
904
 
534
905
  users
535
- .command(`getMemberships`)
906
+ .command(`listMemberships`)
536
907
  .description(`Get the user membership list by its unique ID.`)
537
908
  .requiredOption(`--userId <userId>`, `User ID.`)
538
- .action(actionRunner(usersGetMemberships))
909
+ .action(actionRunner(usersListMemberships))
539
910
 
540
911
  users
541
912
  .command(`updateName`)
@@ -572,10 +943,10 @@ users
572
943
  .action(actionRunner(usersUpdatePrefs))
573
944
 
574
945
  users
575
- .command(`getSessions`)
946
+ .command(`listSessions`)
576
947
  .description(`Get the user sessions list by its unique ID.`)
577
948
  .requiredOption(`--userId <userId>`, `User ID.`)
578
- .action(actionRunner(usersGetSessions))
949
+ .action(actionRunner(usersListSessions))
579
950
 
580
951
  users
581
952
  .command(`deleteSessions`)
@@ -616,18 +987,25 @@ module.exports = {
616
987
  users,
617
988
  usersList,
618
989
  usersCreate,
990
+ usersCreateArgon2User,
991
+ usersCreateBcryptUser,
992
+ usersCreateMD5User,
993
+ usersCreatePHPassUser,
994
+ usersCreateScryptUser,
995
+ usersCreateScryptModifiedUser,
996
+ usersCreateSHAUser,
619
997
  usersGetUsage,
620
998
  usersGet,
621
999
  usersDelete,
622
1000
  usersUpdateEmail,
623
- usersGetLogs,
624
- usersGetMemberships,
1001
+ usersListLogs,
1002
+ usersListMemberships,
625
1003
  usersUpdateName,
626
1004
  usersUpdatePassword,
627
1005
  usersUpdatePhone,
628
1006
  usersGetPrefs,
629
1007
  usersUpdatePrefs,
630
- usersGetSessions,
1008
+ usersListSessions,
631
1009
  usersDeleteSessions,
632
1010
  usersDeleteSession,
633
1011
  usersUpdateStatus,
package/lib/questions.js CHANGED
@@ -160,7 +160,7 @@ const questionsInitFunction = [
160
160
  type: "input",
161
161
  name: "id",
162
162
  message: "What ID would you like to have for your function?",
163
- default: "myAwesomeFunction"
163
+ default: "unique()"
164
164
  },
165
165
  {
166
166
  type: "list",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "appwrite-cli",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "0.18.5",
5
+ "version": "1.0.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "index.js",
8
8
  "bin": {