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,37 +12,21 @@ const { localConfig, globalConfig } = require("../config");
12
12
 
13
13
  const teams = new Command("teams").description(commandDescriptions['teams'])
14
14
 
15
- const teamsList = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
15
+ const teamsList = 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 = '/teams';
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;
33
- }
34
- if (typeof offset !== 'undefined') {
35
- payload['offset'] = offset;
36
- }
37
- if (typeof cursor !== 'undefined') {
38
- payload['cursor'] = cursor;
39
- }
40
- if (typeof cursorDirection !== 'undefined') {
41
- payload['cursorDirection'] = cursorDirection;
42
- }
43
- if (typeof orderType !== 'undefined') {
44
- payload['orderType'] = orderType;
45
- }
46
30
  let response = undefined;
47
31
  response = await client.call('get', path, {
48
32
  'content-type': 'application/json',
@@ -150,21 +134,17 @@ const teamsDelete = async ({ teamId, parseOutput = true, sdk = undefined}) => {
150
134
  return response;
151
135
  }
152
136
 
153
- const teamsListLogs = async ({ teamId, limit, offset, parseOutput = true, sdk = undefined}) => {
137
+ const teamsListLogs = async ({ teamId, queries, parseOutput = true, sdk = undefined}) => {
154
138
  /* @param {string} teamId */
155
- /* @param {number} limit */
156
- /* @param {number} offset */
139
+ /* @param {string[]} queries */
157
140
 
158
141
  let client = !sdk ? await sdkForProject() : sdk;
159
142
  let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
160
143
  let payload = {};
161
144
 
162
145
  /** Query Params */
163
- if (typeof limit !== 'undefined') {
164
- payload['limit'] = limit;
165
- }
166
- if (typeof offset !== 'undefined') {
167
- payload['offset'] = offset;
146
+ if (typeof queries !== 'undefined') {
147
+ payload['queries'] = queries;
168
148
  }
169
149
  let response = undefined;
170
150
  response = await client.call('get', path, {
@@ -178,38 +158,22 @@ const teamsListLogs = async ({ teamId, limit, offset, parseOutput = true, sdk =
178
158
  return response;
179
159
  }
180
160
 
181
- const teamsGetMemberships = async ({ teamId, search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
161
+ const teamsListMemberships = async ({ teamId, queries, search, parseOutput = true, sdk = undefined}) => {
182
162
  /* @param {string} teamId */
163
+ /* @param {string[]} queries */
183
164
  /* @param {string} search */
184
- /* @param {number} limit */
185
- /* @param {number} offset */
186
- /* @param {string} cursor */
187
- /* @param {string} cursorDirection */
188
- /* @param {string} orderType */
189
165
 
190
166
  let client = !sdk ? await sdkForProject() : sdk;
191
167
  let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
192
168
  let payload = {};
193
169
 
194
170
  /** Query Params */
171
+ if (typeof queries !== 'undefined') {
172
+ payload['queries'] = queries;
173
+ }
195
174
  if (typeof search !== 'undefined') {
196
175
  payload['search'] = search;
197
176
  }
198
- if (typeof limit !== 'undefined') {
199
- payload['limit'] = limit;
200
- }
201
- if (typeof offset !== 'undefined') {
202
- payload['offset'] = offset;
203
- }
204
- if (typeof cursor !== 'undefined') {
205
- payload['cursor'] = cursor;
206
- }
207
- if (typeof cursorDirection !== 'undefined') {
208
- payload['cursorDirection'] = cursorDirection;
209
- }
210
- if (typeof orderType !== 'undefined') {
211
- payload['orderType'] = orderType;
212
- }
213
177
  let response = undefined;
214
178
  response = await client.call('get', path, {
215
179
  'content-type': 'application/json',
@@ -361,12 +325,8 @@ const teamsUpdateMembershipStatus = async ({ teamId, membershipId, userId, secre
361
325
  teams
362
326
  .command(`list`)
363
327
  .description(`Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
364
328
 
365
329
  In admin mode, this endpoint returns a list of all the teams in the current project. [Learn more about different API modes](/docs/admin).`)
330
+ .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, total`)
366
331
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
367
- .option(`--limit <limit>`, `Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
368
- .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)
369
- .option(`--cursor <cursor>`, `ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
370
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
371
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
372
332
  .action(actionRunner(teamsList))
373
333
 
374
334
  teams
@@ -400,21 +360,16 @@ teams
400
360
  .command(`listLogs`)
401
361
  .description(`Get the team activity logs list by its unique ID.`)
402
362
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
403
- .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)
404
- .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)
363
+ .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`)
405
364
  .action(actionRunner(teamsListLogs))
406
365
 
407
366
  teams
408
- .command(`getMemberships`)
367
+ .command(`listMemberships`)
409
368
  .description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.`)
410
369
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
370
+ .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: userId, teamId, invited, joined, confirm`)
411
371
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
412
- .option(`--limit <limit>`, `Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
413
- .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)
414
- .option(`--cursor <cursor>`, `ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
415
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
416
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
417
- .action(actionRunner(teamsGetMemberships))
372
+ .action(actionRunner(teamsListMemberships))
418
373
 
419
374
  teams
420
375
  .command(`createMembership`)
@@ -466,7 +421,7 @@ module.exports = {
466
421
  teamsUpdate,
467
422
  teamsDelete,
468
423
  teamsListLogs,
469
- teamsGetMemberships,
424
+ teamsListMemberships,
470
425
  teamsCreateMembership,
471
426
  teamsGetMembership,
472
427
  teamsUpdateMembershipRoles,