appwrite-cli 4.0.0 → 4.2.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.
@@ -116,11 +116,67 @@ const healthGetQueue = async ({ parseOutput = true, sdk = undefined}) => {
116
116
  return response;
117
117
  }
118
118
 
119
- const healthGetQueueCertificates = async ({ parseOutput = true, sdk = undefined}) => {
119
+ const healthGetQueueBuilds = async ({ threshold, parseOutput = true, sdk = undefined}) => {
120
+ /* @param {number} threshold */
121
+
122
+ let client = !sdk ? await sdkForProject() : sdk;
123
+ let apiPath = '/health/queue/builds';
124
+ let payload = {};
125
+
126
+ /** Query Params */
127
+ if (typeof threshold !== 'undefined') {
128
+ payload['threshold'] = threshold;
129
+ }
130
+ let response = undefined;
131
+ response = await client.call('get', apiPath, {
132
+ 'content-type': 'application/json',
133
+ }, payload);
134
+
135
+ if (parseOutput) {
136
+ parse(response)
137
+ success()
138
+ }
139
+ return response;
140
+ }
141
+
142
+ const healthGetQueueCertificates = async ({ threshold, parseOutput = true, sdk = undefined}) => {
143
+ /* @param {number} threshold */
120
144
 
121
145
  let client = !sdk ? await sdkForProject() : sdk;
122
146
  let apiPath = '/health/queue/certificates';
123
147
  let payload = {};
148
+
149
+ /** Query Params */
150
+ if (typeof threshold !== 'undefined') {
151
+ payload['threshold'] = threshold;
152
+ }
153
+ let response = undefined;
154
+ response = await client.call('get', apiPath, {
155
+ 'content-type': 'application/json',
156
+ }, payload);
157
+
158
+ if (parseOutput) {
159
+ parse(response)
160
+ success()
161
+ }
162
+ return response;
163
+ }
164
+
165
+ const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sdk = undefined}) => {
166
+ /* @param {string} name */
167
+ /* @param {number} threshold */
168
+
169
+ let client = !sdk ? await sdkForProject() : sdk;
170
+ let apiPath = '/health/queue/databases';
171
+ let payload = {};
172
+
173
+ /** Query Params */
174
+ if (typeof name !== 'undefined') {
175
+ payload['name'] = name;
176
+ }
177
+ if (typeof threshold !== 'undefined') {
178
+ payload['threshold'] = threshold;
179
+ }
124
180
  let response = undefined;
125
181
  response = await client.call('get', apiPath, {
126
182
  'content-type': 'application/json',
@@ -133,11 +189,40 @@ const healthGetQueueCertificates = async ({ parseOutput = true, sdk = undefined}
133
189
  return response;
134
190
  }
135
191
 
136
- const healthGetQueueFunctions = async ({ parseOutput = true, sdk = undefined}) => {
192
+ const healthGetQueueDeletes = async ({ threshold, parseOutput = true, sdk = undefined}) => {
193
+ /* @param {number} threshold */
194
+
195
+ let client = !sdk ? await sdkForProject() : sdk;
196
+ let apiPath = '/health/queue/deletes';
197
+ let payload = {};
198
+
199
+ /** Query Params */
200
+ if (typeof threshold !== 'undefined') {
201
+ payload['threshold'] = threshold;
202
+ }
203
+ let response = undefined;
204
+ response = await client.call('get', apiPath, {
205
+ 'content-type': 'application/json',
206
+ }, payload);
207
+
208
+ if (parseOutput) {
209
+ parse(response)
210
+ success()
211
+ }
212
+ return response;
213
+ }
214
+
215
+ const healthGetQueueFunctions = async ({ threshold, parseOutput = true, sdk = undefined}) => {
216
+ /* @param {number} threshold */
137
217
 
138
218
  let client = !sdk ? await sdkForProject() : sdk;
139
219
  let apiPath = '/health/queue/functions';
140
220
  let payload = {};
221
+
222
+ /** Query Params */
223
+ if (typeof threshold !== 'undefined') {
224
+ payload['threshold'] = threshold;
225
+ }
141
226
  let response = undefined;
142
227
  response = await client.call('get', apiPath, {
143
228
  'content-type': 'application/json',
@@ -150,11 +235,17 @@ const healthGetQueueFunctions = async ({ parseOutput = true, sdk = undefined}) =
150
235
  return response;
151
236
  }
152
237
 
153
- const healthGetQueueLogs = async ({ parseOutput = true, sdk = undefined}) => {
238
+ const healthGetQueueLogs = async ({ threshold, parseOutput = true, sdk = undefined}) => {
239
+ /* @param {number} threshold */
154
240
 
155
241
  let client = !sdk ? await sdkForProject() : sdk;
156
242
  let apiPath = '/health/queue/logs';
157
243
  let payload = {};
244
+
245
+ /** Query Params */
246
+ if (typeof threshold !== 'undefined') {
247
+ payload['threshold'] = threshold;
248
+ }
158
249
  let response = undefined;
159
250
  response = await client.call('get', apiPath, {
160
251
  'content-type': 'application/json',
@@ -167,11 +258,86 @@ const healthGetQueueLogs = async ({ parseOutput = true, sdk = undefined}) => {
167
258
  return response;
168
259
  }
169
260
 
170
- const healthGetQueueWebhooks = async ({ parseOutput = true, sdk = undefined}) => {
261
+ const healthGetQueueMails = async ({ threshold, parseOutput = true, sdk = undefined}) => {
262
+ /* @param {number} threshold */
263
+
264
+ let client = !sdk ? await sdkForProject() : sdk;
265
+ let apiPath = '/health/queue/mails';
266
+ let payload = {};
267
+
268
+ /** Query Params */
269
+ if (typeof threshold !== 'undefined') {
270
+ payload['threshold'] = threshold;
271
+ }
272
+ let response = undefined;
273
+ response = await client.call('get', apiPath, {
274
+ 'content-type': 'application/json',
275
+ }, payload);
276
+
277
+ if (parseOutput) {
278
+ parse(response)
279
+ success()
280
+ }
281
+ return response;
282
+ }
283
+
284
+ const healthGetQueueMessaging = async ({ threshold, parseOutput = true, sdk = undefined}) => {
285
+ /* @param {number} threshold */
286
+
287
+ let client = !sdk ? await sdkForProject() : sdk;
288
+ let apiPath = '/health/queue/messaging';
289
+ let payload = {};
290
+
291
+ /** Query Params */
292
+ if (typeof threshold !== 'undefined') {
293
+ payload['threshold'] = threshold;
294
+ }
295
+ let response = undefined;
296
+ response = await client.call('get', apiPath, {
297
+ 'content-type': 'application/json',
298
+ }, payload);
299
+
300
+ if (parseOutput) {
301
+ parse(response)
302
+ success()
303
+ }
304
+ return response;
305
+ }
306
+
307
+ const healthGetQueueMigrations = async ({ threshold, parseOutput = true, sdk = undefined}) => {
308
+ /* @param {number} threshold */
309
+
310
+ let client = !sdk ? await sdkForProject() : sdk;
311
+ let apiPath = '/health/queue/migrations';
312
+ let payload = {};
313
+
314
+ /** Query Params */
315
+ if (typeof threshold !== 'undefined') {
316
+ payload['threshold'] = threshold;
317
+ }
318
+ let response = undefined;
319
+ response = await client.call('get', apiPath, {
320
+ 'content-type': 'application/json',
321
+ }, payload);
322
+
323
+ if (parseOutput) {
324
+ parse(response)
325
+ success()
326
+ }
327
+ return response;
328
+ }
329
+
330
+ const healthGetQueueWebhooks = async ({ threshold, parseOutput = true, sdk = undefined}) => {
331
+ /* @param {number} threshold */
171
332
 
172
333
  let client = !sdk ? await sdkForProject() : sdk;
173
334
  let apiPath = '/health/queue/webhooks';
174
335
  let payload = {};
336
+
337
+ /** Query Params */
338
+ if (typeof threshold !== 'undefined') {
339
+ payload['threshold'] = threshold;
340
+ }
175
341
  let response = undefined;
176
342
  response = await client.call('get', apiPath, {
177
343
  'content-type': 'application/json',
@@ -249,24 +415,65 @@ health
249
415
  .description(`Check the Appwrite queue messaging servers are up and connection is successful.`)
250
416
  .action(actionRunner(healthGetQueue))
251
417
 
418
+ health
419
+ .command(`getQueueBuilds`)
420
+ .description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`)
421
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
422
+ .action(actionRunner(healthGetQueueBuilds))
423
+
252
424
  health
253
425
  .command(`getQueueCertificates`)
254
426
  .description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
427
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
255
428
  .action(actionRunner(healthGetQueueCertificates))
256
429
 
430
+ health
431
+ .command(`getQueueDatabases`)
432
+ .description(`Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.`)
433
+ .option(`--name <name>`, `Queue name for which to check the queue size`)
434
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
435
+ .action(actionRunner(healthGetQueueDatabases))
436
+
437
+ health
438
+ .command(`getQueueDeletes`)
439
+ .description(`Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.`)
440
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
441
+ .action(actionRunner(healthGetQueueDeletes))
442
+
257
443
  health
258
444
  .command(`getQueueFunctions`)
259
445
  .description(``)
446
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
260
447
  .action(actionRunner(healthGetQueueFunctions))
261
448
 
262
449
  health
263
450
  .command(`getQueueLogs`)
264
451
  .description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`)
452
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
265
453
  .action(actionRunner(healthGetQueueLogs))
266
454
 
455
+ health
456
+ .command(`getQueueMails`)
457
+ .description(`Get the number of mails that are waiting to be processed in the Appwrite internal queue server.`)
458
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
459
+ .action(actionRunner(healthGetQueueMails))
460
+
461
+ health
462
+ .command(`getQueueMessaging`)
463
+ .description(`Get the number of messages that are waiting to be processed in the Appwrite internal queue server.`)
464
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
465
+ .action(actionRunner(healthGetQueueMessaging))
466
+
467
+ health
468
+ .command(`getQueueMigrations`)
469
+ .description(`Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.`)
470
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
471
+ .action(actionRunner(healthGetQueueMigrations))
472
+
267
473
  health
268
474
  .command(`getQueueWebhooks`)
269
475
  .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
476
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
270
477
  .action(actionRunner(healthGetQueueWebhooks))
271
478
 
272
479
  health
@@ -288,9 +495,15 @@ module.exports = {
288
495
  healthGetDB,
289
496
  healthGetPubSub,
290
497
  healthGetQueue,
498
+ healthGetQueueBuilds,
291
499
  healthGetQueueCertificates,
500
+ healthGetQueueDatabases,
501
+ healthGetQueueDeletes,
292
502
  healthGetQueueFunctions,
293
503
  healthGetQueueLogs,
504
+ healthGetQueueMails,
505
+ healthGetQueueMessaging,
506
+ healthGetQueueMigrations,
294
507
  healthGetQueueWebhooks,
295
508
  healthGetStorageLocal,
296
509
  healthGetTime
@@ -10,6 +10,7 @@ const { databasesGet, databasesListCollections, databasesList } = require("./dat
10
10
  const { storageListBuckets } = require("./storage");
11
11
  const { sdkForConsole } = require("../sdks");
12
12
  const { localConfig } = require("../config");
13
+ const { paginate } = require("../paginate");
13
14
  const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions");
14
15
  const { success, log, actionRunner, commandDescriptions } = require("../parser");
15
16
 
@@ -24,11 +25,11 @@ const init = new Command("init")
24
25
 
25
26
  const initProject = async () => {
26
27
  let response = {}
27
- let answers = await inquirer.prompt(questionsInitProject)
28
+ const answers = await inquirer.prompt(questionsInitProject)
28
29
  if (!answers.project) process.exit(1)
29
30
 
30
31
  let sdk = await sdkForConsole();
31
- if (answers.start == "new") {
32
+ if (answers.start === "new") {
32
33
  response = await teamsCreate({
33
34
  teamId: 'unique()',
34
35
  name: answers.project,
@@ -53,8 +54,8 @@ const initProject = async () => {
53
54
 
54
55
  const initFunction = async () => {
55
56
  // TODO: Add CI/CD support (ID, name, runtime)
56
- let answers = await inquirer.prompt(questionsInitFunction)
57
- let functionFolder = path.join(process.cwd(), 'functions');
57
+ const answers = await inquirer.prompt(questionsInitFunction)
58
+ const functionFolder = path.join(process.cwd(), 'functions');
58
59
 
59
60
  if (!fs.existsSync(functionFolder)) {
60
61
  fs.mkdirSync(functionFolder, {
@@ -92,7 +93,7 @@ const initFunction = async () => {
92
93
  let gitPullCommands = `git sparse-checkout add ${answers.runtime.id}`;
93
94
 
94
95
  /* Force use CMD as powershell does not support && */
95
- if (process.platform == 'win32') {
96
+ if (process.platform === 'win32') {
96
97
  gitInitCommands = 'cmd /c "' + gitInitCommands + '"';
97
98
  gitPullCommands = 'cmd /c "' + gitPullCommands + '"';
98
99
  }
@@ -187,15 +188,12 @@ const initCollection = async ({ all, databaseId } = {}) => {
187
188
 
188
189
  localConfig.addDatabase(database);
189
190
 
190
- // TODO: Pagination?
191
- let response = await databasesListCollections({
191
+ const { collections, total } = await paginate(databasesListCollections, {
192
192
  databaseId,
193
- queries: ['limit(100)'],
194
193
  parseOutput: false
195
- })
194
+ }, 100, 'collections');
196
195
 
197
- let collections = response.collections;
198
- log(`Found ${collections.length} collections`);
196
+ log(`Found ${total} collections`);
199
197
 
200
198
  collections.forEach(async collection => {
201
199
  log(`Fetching ${collection.name} ...`);
@@ -211,13 +209,8 @@ const initCollection = async ({ all, databaseId } = {}) => {
211
209
  }
212
210
 
213
211
  const initBucket = async () => {
214
- // TODO: Pagination?
215
- let response = await storageListBuckets({
216
- queries: ['limit(100)'],
217
- parseOutput: false
218
- })
212
+ const { buckets } = await paginate(storageListBuckets, { parseOutput: false }, 100, 'buckets');
219
213
 
220
- let buckets = response.buckets;
221
214
  log(`Found ${buckets.length} buckets`);
222
215
 
223
216
  buckets.forEach(async bucket => {
@@ -229,13 +222,8 @@ const initBucket = async () => {
229
222
  }
230
223
 
231
224
  const initTeam = async () => {
232
- // TODO: Pagination?
233
- let response = await teamsList({
234
- queries: ['limit(100)'],
235
- parseOutput: false
236
- })
225
+ const { teams } = await paginate(teamsList, { parseOutput: false }, 100, 'teams');
237
226
 
238
- let teams = response.teams;
239
227
  log(`Found ${teams.length} teams`);
240
228
 
241
229
  teams.forEach(async team => {
@@ -599,8 +599,8 @@ storage
599
599
  .description(`Create a new storage bucket.`)
600
600
  .requiredOption(`--bucketId <bucketId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
601
601
  .requiredOption(`--name <name>`, `Bucket name`)
602
- .option(`--permissions [permissions...]`, `An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).`)
603
- .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)
602
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
603
+ .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](https://appwrite.io/docs/permissions).`, parseBool)
604
604
  .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool)
605
605
  .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
606
606
  .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
@@ -620,8 +620,8 @@ storage
620
620
  .description(`Update a storage bucket by its unique ID.`)
621
621
  .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`)
622
622
  .requiredOption(`--name <name>`, `Bucket name`)
623
- .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
624
- .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)
623
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
624
+ .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](https://appwrite.io/docs/permissions).`, parseBool)
625
625
  .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool)
626
626
  .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
627
627
  .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
@@ -639,47 +639,47 @@ storage
639
639
  storage
640
640
  .command(`listFiles`)
641
641
  .description(`Get a list of all the user files. You can use the query params to filter your results.`)
642
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
642
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
643
643
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded`)
644
644
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
645
645
  .action(actionRunner(storageListFiles))
646
646
 
647
647
  storage
648
648
  .command(`createFile`)
649
- .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. `)
650
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
649
+ .description(`Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/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. `)
650
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
651
651
  .requiredOption(`--fileId <fileId>`, `File ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
652
- .requiredOption(`--file <file>`, `Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](/docs/storage#file-input).`)
653
- .option(`--permissions [permissions...]`, `An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).`)
652
+ .requiredOption(`--file <file>`, `Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/storage#file-input).`)
653
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
654
654
  .action(actionRunner(storageCreateFile))
655
655
 
656
656
  storage
657
657
  .command(`getFile`)
658
658
  .description(`Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.`)
659
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
659
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
660
660
  .requiredOption(`--fileId <fileId>`, `File ID.`)
661
661
  .action(actionRunner(storageGetFile))
662
662
 
663
663
  storage
664
664
  .command(`updateFile`)
665
665
  .description(`Update a file by its unique ID. Only users with write permissions have access to update this resource.`)
666
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
666
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
667
667
  .requiredOption(`--fileId <fileId>`, `File unique ID.`)
668
668
  .option(`--name <name>`, `Name of the file`)
669
- .option(`--permissions [permissions...]`, `An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
669
+ .option(`--permissions [permissions...]`, `An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
670
670
  .action(actionRunner(storageUpdateFile))
671
671
 
672
672
  storage
673
673
  .command(`deleteFile`)
674
674
  .description(`Delete a file by its unique ID. Only users with write permissions have access to delete this resource.`)
675
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
675
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
676
676
  .requiredOption(`--fileId <fileId>`, `File ID.`)
677
677
  .action(actionRunner(storageDeleteFile))
678
678
 
679
679
  storage
680
680
  .command(`getFileDownload`)
681
681
  .description(`Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.`)
682
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
682
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
683
683
  .requiredOption(`--fileId <fileId>`, `File ID.`)
684
684
  .requiredOption(`--destination <path>`, `output file path.`)
685
685
  .action(actionRunner(storageGetFileDownload))
@@ -687,7 +687,7 @@ storage
687
687
  storage
688
688
  .command(`getFilePreview`)
689
689
  .description(`Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.`)
690
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
690
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
691
691
  .requiredOption(`--fileId <fileId>`, `File ID`)
692
692
  .option(`--width <width>`, `Resize preview image width, Pass an integer between 0 to 4000.`, parseInteger)
693
693
  .option(`--height <height>`, `Resize preview image height, Pass an integer between 0 to 4000.`, parseInteger)
@@ -706,7 +706,7 @@ storage
706
706
  storage
707
707
  .command(`getFileView`)
708
708
  .description(`Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.`)
709
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).`)
709
+ .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
710
710
  .requiredOption(`--fileId <fileId>`, `File ID.`)
711
711
  .requiredOption(`--destination <path>`, `output file path.`)
712
712
  .action(actionRunner(storageGetFileView))
@@ -405,7 +405,7 @@ teams
405
405
  .description(`Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.`)
406
406
  .requiredOption(`--teamId <teamId>`, `Team ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
407
407
  .requiredOption(`--name <name>`, `Team name. Max length: 128 chars.`)
408
- .option(`--roles [roles...]`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
408
+ .option(`--roles [roles...]`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
409
409
  .action(actionRunner(teamsCreate))
410
410
 
411
411
  teams
@@ -444,9 +444,9 @@ teams
444
444
 
445
445
  teams
446
446
  .command(`createMembership`)
447
- .description(`Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. Use the 'url' parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. `)
447
+ .description(`Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. Use the 'url' parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. `)
448
448
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
449
- .requiredOption(`--roles [roles...]`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
449
+ .requiredOption(`--roles [roles...]`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
450
450
  .option(`--email <email>`, `Email of the new team member.`)
451
451
  .option(`--userId <userId>`, `ID of the user to be added to a team.`)
452
452
  .option(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
@@ -463,7 +463,7 @@ teams
463
463
 
464
464
  teams
465
465
  .command(`updateMembership`)
466
- .description(`Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](/docs/permissions). `)
466
+ .description(`Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). `)
467
467
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
468
468
  .requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
469
469
  .requiredOption(`--roles [roles...]`, `An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
@@ -487,7 +487,7 @@ teams
487
487
 
488
488
  teams
489
489
  .command(`getPrefs`)
490
- .description(`Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](/docs/client/account#accountGetPrefs).`)
490
+ .description(`Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).`)
491
491
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
492
492
  .action(actionRunner(teamsGetPrefs))
493
493
 
@@ -922,7 +922,7 @@ users
922
922
 
923
923
  users
924
924
  .command(`createArgon2User`)
925
- .description(`Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
925
+ .description(`Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
926
926
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
927
927
  .requiredOption(`--email <email>`, `User email.`)
928
928
  .requiredOption(`--password <password>`, `User password hashed using Argon2.`)
@@ -931,7 +931,7 @@ users
931
931
 
932
932
  users
933
933
  .command(`createBcryptUser`)
934
- .description(`Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
934
+ .description(`Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
935
935
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
936
936
  .requiredOption(`--email <email>`, `User email.`)
937
937
  .requiredOption(`--password <password>`, `User password hashed using Bcrypt.`)
@@ -953,7 +953,7 @@ users
953
953
 
954
954
  users
955
955
  .command(`createMD5User`)
956
- .description(`Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
956
+ .description(`Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
957
957
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
958
958
  .requiredOption(`--email <email>`, `User email.`)
959
959
  .requiredOption(`--password <password>`, `User password hashed using MD5.`)
@@ -962,7 +962,7 @@ users
962
962
 
963
963
  users
964
964
  .command(`createPHPassUser`)
965
- .description(`Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
965
+ .description(`Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
966
966
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or pass the string 'ID.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.`)
967
967
  .requiredOption(`--email <email>`, `User email.`)
968
968
  .requiredOption(`--password <password>`, `User password hashed using PHPass.`)
@@ -971,7 +971,7 @@ users
971
971
 
972
972
  users
973
973
  .command(`createScryptUser`)
974
- .description(`Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
974
+ .description(`Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
975
975
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
976
976
  .requiredOption(`--email <email>`, `User email.`)
977
977
  .requiredOption(`--password <password>`, `User password hashed using Scrypt.`)
@@ -985,7 +985,7 @@ users
985
985
 
986
986
  users
987
987
  .command(`createScryptModifiedUser`)
988
- .description(`Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
988
+ .description(`Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
989
989
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
990
990
  .requiredOption(`--email <email>`, `User email.`)
991
991
  .requiredOption(`--password <password>`, `User password hashed using Scrypt Modified.`)
@@ -997,7 +997,7 @@ users
997
997
 
998
998
  users
999
999
  .command(`createSHAUser`)
1000
- .description(`Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
1000
+ .description(`Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`)
1001
1001
  .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
1002
1002
  .requiredOption(`--email <email>`, `User email.`)
1003
1003
  .requiredOption(`--password <password>`, `User password hashed using SHA.`)
@@ -1020,7 +1020,7 @@ users
1020
1020
 
1021
1021
  users
1022
1022
  .command(`delete`)
1023
- .description(`Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus) endpoint instead.`)
1023
+ .description(`Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.`)
1024
1024
  .requiredOption(`--userId <userId>`, `User ID.`)
1025
1025
  .action(actionRunner(usersDelete))
1026
1026
 
@@ -1033,7 +1033,7 @@ users
1033
1033
 
1034
1034
  users
1035
1035
  .command(`updateLabels`)
1036
- .description(`Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](/docs/permissions) for more info.`)
1036
+ .description(`Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.`)
1037
1037
  .requiredOption(`--userId <userId>`, `User ID.`)
1038
1038
  .requiredOption(`--labels [labels...]`, `Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.`)
1039
1039
  .action(actionRunner(usersUpdateLabels))