appwrite-cli 0.18.3 → 1.0.0-RC2

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 (65) 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/docs/examples/account/create-phone-session.md +1 -1
  5. package/docs/examples/account/get-logs.md +0 -1
  6. package/docs/examples/account/update-phone.md +1 -1
  7. package/docs/examples/avatars/get-initials.md +0 -1
  8. package/docs/examples/databases/create-collection.md +2 -3
  9. package/docs/examples/databases/create-datetime-attribute.md +7 -0
  10. package/docs/examples/databases/create-document.md +0 -1
  11. package/docs/examples/databases/list-collection-logs.md +0 -1
  12. package/docs/examples/databases/list-collections.md +0 -4
  13. package/docs/examples/databases/list-document-logs.md +0 -1
  14. package/docs/examples/databases/list-documents.md +0 -6
  15. package/docs/examples/databases/list-logs.md +0 -1
  16. package/docs/examples/databases/list.md +0 -4
  17. package/docs/examples/databases/update-collection.md +0 -1
  18. package/docs/examples/databases/update-document.md +0 -1
  19. package/docs/examples/functions/create-variable.md +4 -0
  20. package/docs/examples/functions/create.md +1 -2
  21. package/docs/examples/functions/delete-variable.md +3 -0
  22. package/docs/examples/functions/get-function-usage.md +3 -0
  23. package/docs/examples/functions/get-usage.md +0 -1
  24. package/docs/examples/functions/get-variable.md +3 -0
  25. package/docs/examples/functions/list-deployments.md +0 -4
  26. package/docs/examples/functions/list-executions.md +0 -3
  27. package/docs/examples/functions/list-variables.md +4 -0
  28. package/docs/examples/functions/list.md +0 -4
  29. package/docs/examples/functions/update-variable.md +5 -0
  30. package/docs/examples/functions/update.md +1 -2
  31. package/docs/examples/projects/list.md +0 -4
  32. package/docs/examples/storage/create-bucket.md +1 -1
  33. package/docs/examples/storage/create-file.md +0 -1
  34. package/docs/examples/storage/list-buckets.md +0 -4
  35. package/docs/examples/storage/list-files.md +0 -4
  36. package/docs/examples/storage/update-bucket.md +1 -1
  37. package/docs/examples/storage/update-file.md +0 -1
  38. package/docs/examples/teams/get-memberships.md +0 -4
  39. package/docs/examples/teams/list-logs.md +0 -1
  40. package/docs/examples/teams/list.md +0 -4
  41. package/docs/examples/users/create-argon2user.md +5 -0
  42. package/docs/examples/users/create-bcrypt-user.md +5 -0
  43. package/docs/examples/users/create-m-d5user.md +5 -0
  44. package/docs/examples/users/create-p-h-pass-user.md +5 -0
  45. package/docs/examples/users/create-s-h-a-user.md +6 -0
  46. package/docs/examples/users/create-scrypt-modified-user.md +8 -0
  47. package/docs/examples/users/create-scrypt-user.md +10 -0
  48. package/docs/examples/users/create.md +3 -2
  49. package/docs/examples/users/get-logs.md +0 -1
  50. package/docs/examples/users/list.md +0 -4
  51. package/install.ps1 +2 -2
  52. package/install.sh +1 -1
  53. package/lib/client.js +6 -3
  54. package/lib/commands/account.js +18 -23
  55. package/lib/commands/avatars.js +2 -7
  56. package/lib/commands/databases.js +154 -210
  57. package/lib/commands/functions.js +226 -92
  58. package/lib/commands/generic.js +3 -3
  59. package/lib/commands/init.js +57 -15
  60. package/lib/commands/projects.js +10 -30
  61. package/lib/commands/storage.js +53 -105
  62. package/lib/commands/teams.js +17 -62
  63. package/lib/commands/users.js +414 -36
  64. package/lib/questions.js +1 -1
  65. package/package.json +1 -1
@@ -12,37 +12,21 @@ const { localConfig, globalConfig } = require("../config");
12
12
 
13
13
  const projects = new Command("projects").description(commandDescriptions['projects'])
14
14
 
15
- const projectsList = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
15
+ const projectsList = 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 sdkForConsole() : sdk;
24
20
  let path = '/projects';
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',
@@ -420,7 +404,7 @@ const projectsCreateKey = async ({ projectId, name, scopes, expire, parseOutput
420
404
  /* @param {string} projectId */
421
405
  /* @param {string} name */
422
406
  /* @param {string[]} scopes */
423
- /* @param {number} expire */
407
+ /* @param {string} expire */
424
408
 
425
409
  let client = !sdk ? await sdkForConsole() : sdk;
426
410
  let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
@@ -475,7 +459,7 @@ const projectsUpdateKey = async ({ projectId, keyId, name, scopes, expire, parse
475
459
  /* @param {string} keyId */
476
460
  /* @param {string} name */
477
461
  /* @param {string[]} scopes */
478
- /* @param {number} expire */
462
+ /* @param {string} expire */
479
463
 
480
464
  let client = !sdk ? await sdkForConsole() : sdk;
481
465
  let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
@@ -936,12 +920,8 @@ const projectsUpdateWebhookSignature = async ({ projectId, webhookId, parseOutpu
936
920
  projects
937
921
  .command(`list`)
938
922
  .description(``)
923
+ .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`)
939
924
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
940
- .option(`--limit <limit>`, `Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
941
- .option(`--offset <offset>`, `Results offset. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
942
- .option(`--cursor <cursor>`, `ID of the project used as the starting point for the query, excluding the project itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
943
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
944
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
945
925
  .action(actionRunner(projectsList))
946
926
 
947
927
  projects
@@ -1051,7 +1031,7 @@ projects
1051
1031
  .requiredOption(`--projectId <projectId>`, `Project unique ID.`)
1052
1032
  .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
1053
1033
  .requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 scopes are allowed.`)
1054
- .option(`--expire <expire>`, `Key expiration time in Unix timestamp. Use 0 for unlimited expiration.`, parseInteger)
1034
+ .option(`--expire <expire>`, `Expiration time in ISO 8601 format. Use null for unlimited expiration.`)
1055
1035
  .action(actionRunner(projectsCreateKey))
1056
1036
 
1057
1037
  projects
@@ -1068,7 +1048,7 @@ projects
1068
1048
  .requiredOption(`--keyId <keyId>`, `Key unique ID.`)
1069
1049
  .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
1070
1050
  .requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 events are allowed.`)
1071
- .option(`--expire <expire>`, `Key expiration time in Unix timestamp. Use 0 for unlimited expiration.`, parseInteger)
1051
+ .option(`--expire <expire>`, `Expiration time in ISO 8601 format. Use null for unlimited expiration.`)
1072
1052
  .action(actionRunner(projectsUpdateKey))
1073
1053
 
1074
1054
  projects
@@ -12,37 +12,21 @@ const { localConfig, globalConfig } = require("../config");
12
12
 
13
13
  const storage = new Command("storage").description(commandDescriptions['storage'])
14
14
 
15
- const storageListBuckets = async ({ search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
15
+ const storageListBuckets = 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 = '/storage/buckets';
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',
@@ -55,15 +39,15 @@ const storageListBuckets = async ({ search, limit, offset, cursor, cursorDirecti
55
39
  return response;
56
40
  }
57
41
 
58
- const storageCreateBucket = async ({ bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus, parseOutput = true, sdk = undefined}) => {
42
+ const storageCreateBucket = async ({ bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus, parseOutput = true, sdk = undefined}) => {
59
43
  /* @param {string} bucketId */
60
44
  /* @param {string} name */
61
- /* @param {string} permission */
62
- /* @param {string[]} read */
63
- /* @param {string[]} write */
45
+ /* @param {string[]} permissions */
46
+ /* @param {boolean} fileSecurity */
64
47
  /* @param {boolean} enabled */
65
48
  /* @param {number} maximumFileSize */
66
49
  /* @param {string[]} allowedFileExtensions */
50
+ /* @param {string} compression */
67
51
  /* @param {boolean} encryption */
68
52
  /* @param {boolean} antivirus */
69
53
 
@@ -80,16 +64,12 @@ const storageCreateBucket = async ({ bucketId, name, permission, read, write, en
80
64
  payload['name'] = name;
81
65
  }
82
66
 
83
- if (typeof permission !== 'undefined') {
84
- payload['permission'] = permission;
67
+ if (typeof permissions !== 'undefined') {
68
+ payload['permissions'] = permissions;
85
69
  }
86
70
 
87
- if (typeof read !== 'undefined') {
88
- payload['read'] = read;
89
- }
90
-
91
- if (typeof write !== 'undefined') {
92
- payload['write'] = write;
71
+ if (typeof fileSecurity !== 'undefined') {
72
+ payload['fileSecurity'] = fileSecurity;
93
73
  }
94
74
 
95
75
  if (typeof enabled !== 'undefined') {
@@ -104,6 +84,10 @@ const storageCreateBucket = async ({ bucketId, name, permission, read, write, en
104
84
  payload['allowedFileExtensions'] = allowedFileExtensions;
105
85
  }
106
86
 
87
+ if (typeof compression !== 'undefined') {
88
+ payload['compression'] = compression;
89
+ }
90
+
107
91
  if (typeof encryption !== 'undefined') {
108
92
  payload['encryption'] = encryption;
109
93
  }
@@ -142,15 +126,15 @@ const storageGetBucket = async ({ bucketId, parseOutput = true, sdk = undefined}
142
126
  return response;
143
127
  }
144
128
 
145
- const storageUpdateBucket = async ({ bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus, parseOutput = true, sdk = undefined}) => {
129
+ const storageUpdateBucket = async ({ bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus, parseOutput = true, sdk = undefined}) => {
146
130
  /* @param {string} bucketId */
147
131
  /* @param {string} name */
148
- /* @param {string} permission */
149
- /* @param {string[]} read */
150
- /* @param {string[]} write */
132
+ /* @param {string[]} permissions */
133
+ /* @param {boolean} fileSecurity */
151
134
  /* @param {boolean} enabled */
152
135
  /* @param {number} maximumFileSize */
153
136
  /* @param {string[]} allowedFileExtensions */
137
+ /* @param {string} compression */
154
138
  /* @param {boolean} encryption */
155
139
  /* @param {boolean} antivirus */
156
140
 
@@ -163,16 +147,12 @@ const storageUpdateBucket = async ({ bucketId, name, permission, read, write, en
163
147
  payload['name'] = name;
164
148
  }
165
149
 
166
- if (typeof permission !== 'undefined') {
167
- payload['permission'] = permission;
168
- }
169
-
170
- if (typeof read !== 'undefined') {
171
- payload['read'] = read;
150
+ if (typeof permissions !== 'undefined') {
151
+ payload['permissions'] = permissions;
172
152
  }
173
153
 
174
- if (typeof write !== 'undefined') {
175
- payload['write'] = write;
154
+ if (typeof fileSecurity !== 'undefined') {
155
+ payload['fileSecurity'] = fileSecurity;
176
156
  }
177
157
 
178
158
  if (typeof enabled !== 'undefined') {
@@ -187,6 +167,10 @@ const storageUpdateBucket = async ({ bucketId, name, permission, read, write, en
187
167
  payload['allowedFileExtensions'] = allowedFileExtensions;
188
168
  }
189
169
 
170
+ if (typeof compression !== 'undefined') {
171
+ payload['compression'] = compression;
172
+ }
173
+
190
174
  if (typeof encryption !== 'undefined') {
191
175
  payload['encryption'] = encryption;
192
176
  }
@@ -225,38 +209,22 @@ const storageDeleteBucket = async ({ bucketId, parseOutput = true, sdk = undefin
225
209
  return response;
226
210
  }
227
211
 
228
- const storageListFiles = async ({ bucketId, search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
212
+ const storageListFiles = async ({ bucketId, queries, search, parseOutput = true, sdk = undefined}) => {
229
213
  /* @param {string} bucketId */
214
+ /* @param {string[]} queries */
230
215
  /* @param {string} search */
231
- /* @param {number} limit */
232
- /* @param {number} offset */
233
- /* @param {string} cursor */
234
- /* @param {string} cursorDirection */
235
- /* @param {string} orderType */
236
216
 
237
217
  let client = !sdk ? await sdkForProject() : sdk;
238
218
  let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
239
219
  let payload = {};
240
220
 
241
221
  /** Query Params */
222
+ if (typeof queries !== 'undefined') {
223
+ payload['queries'] = queries;
224
+ }
242
225
  if (typeof search !== 'undefined') {
243
226
  payload['search'] = search;
244
227
  }
245
- if (typeof limit !== 'undefined') {
246
- payload['limit'] = limit;
247
- }
248
- if (typeof offset !== 'undefined') {
249
- payload['offset'] = offset;
250
- }
251
- if (typeof cursor !== 'undefined') {
252
- payload['cursor'] = cursor;
253
- }
254
- if (typeof cursorDirection !== 'undefined') {
255
- payload['cursorDirection'] = cursorDirection;
256
- }
257
- if (typeof orderType !== 'undefined') {
258
- payload['orderType'] = orderType;
259
- }
260
228
  let response = undefined;
261
229
  response = await client.call('get', path, {
262
230
  'content-type': 'application/json',
@@ -269,12 +237,11 @@ const storageListFiles = async ({ bucketId, search, limit, offset, cursor, curso
269
237
  return response;
270
238
  }
271
239
 
272
- const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
240
+ const storageCreateFile = async ({ bucketId, fileId, file, permissions, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
273
241
  /* @param {string} bucketId */
274
242
  /* @param {string} fileId */
275
243
  /* @param {InputFile} file */
276
- /* @param {string[]} read */
277
- /* @param {string[]} write */
244
+ /* @param {string[]} permissions */
278
245
 
279
246
  let client = !sdk ? await sdkForProject() : sdk;
280
247
  let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
@@ -290,12 +257,8 @@ const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOut
290
257
  payload['file'] = filePath;
291
258
  }
292
259
 
293
- if (typeof read !== 'undefined') {
294
- payload['read'] = read;
295
- }
296
-
297
- if (typeof write !== 'undefined') {
298
- payload['write'] = write;
260
+ if (typeof permissions !== 'undefined') {
261
+ payload['permissions'] = permissions;
299
262
  }
300
263
 
301
264
  let response = undefined;
@@ -386,23 +349,18 @@ const storageGetFile = async ({ bucketId, fileId, parseOutput = true, sdk = unde
386
349
  return response;
387
350
  }
388
351
 
389
- const storageUpdateFile = async ({ bucketId, fileId, read, write, parseOutput = true, sdk = undefined}) => {
352
+ const storageUpdateFile = async ({ bucketId, fileId, permissions, parseOutput = true, sdk = undefined}) => {
390
353
  /* @param {string} bucketId */
391
354
  /* @param {string} fileId */
392
- /* @param {string[]} read */
393
- /* @param {string[]} write */
355
+ /* @param {string[]} permissions */
394
356
 
395
357
  let client = !sdk ? await sdkForProject() : sdk;
396
358
  let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
397
359
  let payload = {};
398
360
 
399
361
  /** Body Params */
400
- if (typeof read !== 'undefined') {
401
- payload['read'] = read;
402
- }
403
-
404
- if (typeof write !== 'undefined') {
405
- payload['write'] = write;
362
+ if (typeof permissions !== 'undefined') {
363
+ payload['permissions'] = permissions;
406
364
  }
407
365
 
408
366
  let response = undefined;
@@ -605,12 +563,8 @@ const storageGetBucketUsage = async ({ bucketId, range, parseOutput = true, sdk
605
563
  storage
606
564
  .command(`listBuckets`)
607
565
  .description(`Get a list of all the storage buckets. You can use the query params to filter your results.`)
566
+ .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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus`)
608
567
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
609
- .option(`--limit <limit>`, `Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
610
- .option(`--offset <offset>`, `Results offset. The default value is 0. Use this param to manage pagination.`, parseInteger)
611
- .option(`--cursor <cursor>`, `ID of the bucket used as the starting point for the query, excluding the bucket itself. Should be used for efficient pagination when working with large sets of data.`)
612
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
613
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
614
568
  .action(actionRunner(storageListBuckets))
615
569
 
616
570
  storage
@@ -618,12 +572,12 @@ storage
618
572
  .description(`Create a new storage bucket.`)
619
573
  .requiredOption(`--bucketId <bucketId>`, `Unique 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.`)
620
574
  .requiredOption(`--name <name>`, `Bucket name`)
621
- .requiredOption(`--permission <permission>`, `Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the 'read' and 'write' params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
622
- .option(`--read <read...>`, `An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
623
- .option(`--write <write...>`, `An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
575
+ .option(`--permissions <permissions...>`, `An array of permission strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).`)
576
+ .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).`, parseBool)
624
577
  .option(`--enabled <enabled>`, `Is bucket enabled?`, parseBool)
625
578
  .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the '_APP_STORAGE_LIMIT' environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)`, parseInteger)
626
579
  .option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
580
+ .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
627
581
  .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
628
582
  .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
629
583
  .action(actionRunner(storageCreateBucket))
@@ -639,12 +593,12 @@ storage
639
593
  .description(`Update a storage bucket by its unique ID.`)
640
594
  .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`)
641
595
  .requiredOption(`--name <name>`, `Bucket name`)
642
- .requiredOption(`--permission <permission>`, `Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the 'read' and 'write' params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
643
- .option(`--read <read...>`, `An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
644
- .option(`--write <write...>`, `An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
596
+ .option(`--permissions <permissions...>`, `An array of permission strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
597
+ .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).`, parseBool)
645
598
  .option(`--enabled <enabled>`, `Is bucket enabled?`, parseBool)
646
599
  .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)`, parseInteger)
647
600
  .option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
601
+ .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
648
602
  .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
649
603
  .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
650
604
  .action(actionRunner(storageUpdateBucket))
@@ -659,22 +613,17 @@ storage
659
613
  .command(`listFiles`)
660
614
  .description(`Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. [Learn more about different API modes](/docs/admin).`)
661
615
  .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
616
+ .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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded`)
662
617
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
663
- .option(`--limit <limit>`, `Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
664
- .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)
665
- .option(`--cursor <cursor>`, `ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
666
- .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
667
- .option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
668
618
  .action(actionRunner(storageListFiles))
669
619
 
670
620
  storage
671
621
  .command(`createFile`)
672
- .description(`Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](/docs/server/database#storageCreateBucket) API or directly from your Appwrite console. Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of '5MB'. The 'content-range' header values should always be in bytes. When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in 'x-appwrite-id' header to allow the server to know that the partial upload is for the existing file and not for a new one. If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. `)
622
+ .description(`Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of '5MB'. The 'content-range' header values should always be in bytes. When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in 'x-appwrite-id' header to allow the server to know that the partial upload is for the existing file and not for a new one. If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. `)
673
623
  .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
674
624
  .requiredOption(`--fileId <fileId>`, `File 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.`)
675
625
  .requiredOption(`--file <file>`, `Binary file.`)
676
- .option(`--read <read...>`, `An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
677
- .option(`--write <write...>`, `An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
626
+ .option(`--permissions <permissions...>`, `An array of permission strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).`)
678
627
  .action(actionRunner(storageCreateFile))
679
628
 
680
629
  storage
@@ -689,8 +638,7 @@ storage
689
638
  .description(`Update a file by its unique ID. Only users with write permissions have access to update this resource.`)
690
639
  .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
691
640
  .requiredOption(`--fileId <fileId>`, `File unique ID.`)
692
- .option(`--read <read...>`, `An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
693
- .option(`--write <write...>`, `An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
641
+ .option(`--permissions <permissions...>`, `An array of permission string. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
694
642
  .action(actionRunner(storageUpdateFile))
695
643
 
696
644
  storage
@@ -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 teamsGetMemberships = 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,20 +360,15 @@ 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
367
  .command(`getMemberships`)
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
372
  .action(actionRunner(teamsGetMemberships))
418
373
 
419
374
  teams