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
@@ -29,7 +29,7 @@ const localeGet = async ({ parseOutput = true, sdk = undefined}) => {
29
29
  return response;
30
30
  }
31
31
 
32
- const localeGetContinents = async ({ parseOutput = true, sdk = undefined}) => {
32
+ const localeListContinents = async ({ parseOutput = true, sdk = undefined}) => {
33
33
 
34
34
  let client = !sdk ? await sdkForProject() : sdk;
35
35
  let path = '/locale/continents';
@@ -46,7 +46,7 @@ const localeGetContinents = async ({ parseOutput = true, sdk = undefined}) => {
46
46
  return response;
47
47
  }
48
48
 
49
- const localeGetCountries = async ({ parseOutput = true, sdk = undefined}) => {
49
+ const localeListCountries = async ({ parseOutput = true, sdk = undefined}) => {
50
50
 
51
51
  let client = !sdk ? await sdkForProject() : sdk;
52
52
  let path = '/locale/countries';
@@ -63,7 +63,7 @@ const localeGetCountries = async ({ parseOutput = true, sdk = undefined}) => {
63
63
  return response;
64
64
  }
65
65
 
66
- const localeGetCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
66
+ const localeListCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
67
67
 
68
68
  let client = !sdk ? await sdkForProject() : sdk;
69
69
  let path = '/locale/countries/eu';
@@ -80,7 +80,7 @@ const localeGetCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
80
80
  return response;
81
81
  }
82
82
 
83
- const localeGetCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
83
+ const localeListCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
84
84
 
85
85
  let client = !sdk ? await sdkForProject() : sdk;
86
86
  let path = '/locale/countries/phones';
@@ -97,7 +97,7 @@ const localeGetCountriesPhones = async ({ parseOutput = true, sdk = undefined})
97
97
  return response;
98
98
  }
99
99
 
100
- const localeGetCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
100
+ const localeListCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
101
101
 
102
102
  let client = !sdk ? await sdkForProject() : sdk;
103
103
  let path = '/locale/currencies';
@@ -114,7 +114,7 @@ const localeGetCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
114
114
  return response;
115
115
  }
116
116
 
117
- const localeGetLanguages = async ({ parseOutput = true, sdk = undefined}) => {
117
+ const localeListLanguages = async ({ parseOutput = true, sdk = undefined}) => {
118
118
 
119
119
  let client = !sdk ? await sdkForProject() : sdk;
120
120
  let path = '/locale/languages';
@@ -138,43 +138,43 @@ locale
138
138
  .action(actionRunner(localeGet))
139
139
 
140
140
  locale
141
- .command(`getContinents`)
141
+ .command(`listContinents`)
142
142
  .description(`List of all continents. You can use the locale header to get the data in a supported language.`)
143
- .action(actionRunner(localeGetContinents))
143
+ .action(actionRunner(localeListContinents))
144
144
 
145
145
  locale
146
- .command(`getCountries`)
146
+ .command(`listCountries`)
147
147
  .description(`List of all countries. You can use the locale header to get the data in a supported language.`)
148
- .action(actionRunner(localeGetCountries))
148
+ .action(actionRunner(localeListCountries))
149
149
 
150
150
  locale
151
- .command(`getCountriesEU`)
151
+ .command(`listCountriesEU`)
152
152
  .description(`List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.`)
153
- .action(actionRunner(localeGetCountriesEU))
153
+ .action(actionRunner(localeListCountriesEU))
154
154
 
155
155
  locale
156
- .command(`getCountriesPhones`)
156
+ .command(`listCountriesPhones`)
157
157
  .description(`List of all countries phone codes. You can use the locale header to get the data in a supported language.`)
158
- .action(actionRunner(localeGetCountriesPhones))
158
+ .action(actionRunner(localeListCountriesPhones))
159
159
 
160
160
  locale
161
- .command(`getCurrencies`)
161
+ .command(`listCurrencies`)
162
162
  .description(`List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.`)
163
- .action(actionRunner(localeGetCurrencies))
163
+ .action(actionRunner(localeListCurrencies))
164
164
 
165
165
  locale
166
- .command(`getLanguages`)
166
+ .command(`listLanguages`)
167
167
  .description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`)
168
- .action(actionRunner(localeGetLanguages))
168
+ .action(actionRunner(localeListLanguages))
169
169
 
170
170
 
171
171
  module.exports = {
172
172
  locale,
173
173
  localeGet,
174
- localeGetContinents,
175
- localeGetCountries,
176
- localeGetCountriesEU,
177
- localeGetCountriesPhones,
178
- localeGetCurrencies,
179
- localeGetLanguages
174
+ localeListContinents,
175
+ localeListCountries,
176
+ localeListCountriesEU,
177
+ localeListCountriesPhones,
178
+ localeListCurrencies,
179
+ localeListLanguages
180
180
  };
@@ -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