appwrite-cli 5.0.3 → 6.0.0-rc.1

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 (54) hide show
  1. package/README.md +4 -4
  2. package/docs/examples/functions/create-build.md +1 -1
  3. package/docs/examples/functions/create-execution.md +1 -0
  4. package/docs/examples/functions/create.md +1 -0
  5. package/docs/examples/functions/delete-execution.md +3 -0
  6. package/docs/examples/functions/update-deployment-build.md +3 -0
  7. package/docs/examples/functions/update.md +1 -0
  8. package/docs/examples/messaging/update-email.md +1 -0
  9. package/docs/examples/projects/create-j-w-t.md +4 -0
  10. package/docs/examples/projects/update-mock-numbers.md +3 -0
  11. package/docs/examples/projects/update-session-alerts.md +3 -0
  12. package/docs/examples/users/create-j-w-t.md +4 -0
  13. package/docs/examples/vcs/get-repository-contents.md +4 -0
  14. package/index.js +34 -7
  15. package/install.ps1 +3 -3
  16. package/install.sh +2 -2
  17. package/lib/client.js +19 -5
  18. package/lib/commands/account.js +307 -153
  19. package/lib/commands/assistant.js +8 -5
  20. package/lib/commands/avatars.js +116 -60
  21. package/lib/commands/console.js +8 -5
  22. package/lib/commands/databases.js +353 -164
  23. package/lib/commands/functions.js +310 -100
  24. package/lib/commands/generic.js +206 -54
  25. package/lib/commands/graphql.js +14 -8
  26. package/lib/commands/health.js +140 -71
  27. package/lib/commands/init.js +250 -155
  28. package/lib/commands/locale.js +50 -26
  29. package/lib/commands/messaging.js +363 -179
  30. package/lib/commands/migrations.js +98 -50
  31. package/lib/commands/project.js +38 -20
  32. package/lib/commands/projects.js +449 -144
  33. package/lib/commands/proxy.js +32 -17
  34. package/lib/commands/pull.js +231 -0
  35. package/lib/commands/push.js +1518 -0
  36. package/lib/commands/run.js +282 -0
  37. package/lib/commands/storage.js +160 -76
  38. package/lib/commands/teams.js +102 -50
  39. package/lib/commands/users.js +325 -135
  40. package/lib/commands/vcs.js +102 -29
  41. package/lib/config.js +190 -18
  42. package/lib/emulation/docker.js +187 -0
  43. package/lib/emulation/utils.js +177 -0
  44. package/lib/id.js +30 -0
  45. package/lib/paginate.js +1 -2
  46. package/lib/parser.js +69 -12
  47. package/lib/questions.js +462 -84
  48. package/lib/sdks.js +1 -1
  49. package/lib/spinner.js +103 -0
  50. package/lib/utils.js +248 -3
  51. package/lib/validations.js +17 -0
  52. package/package.json +6 -2
  53. package/scoop/appwrite.json +3 -3
  54. package/lib/commands/deploy.js +0 -941
@@ -4,7 +4,7 @@ const tar = require("tar");
4
4
  const ignore = require("ignore");
5
5
  const { promisify } = require('util');
6
6
  const libClient = require('../client.js');
7
- const { getAllFiles } = require('../utils.js');
7
+ const { getAllFiles, showConsoleLink } = require('../utils.js');
8
8
  const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -43,6 +43,7 @@ const functions = new Command("functions").description(commandDescriptions['func
43
43
  * @typedef {Object} FunctionsListRequestParams
44
44
  * @property {string[]} 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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} overrideForCli
46
47
  * @property {boolean} parseOutput
47
48
  * @property {libClient | undefined} sdk
48
49
  */
@@ -50,8 +51,9 @@ const functions = new Command("functions").description(commandDescriptions['func
50
51
  /**
51
52
  * @param {FunctionsListRequestParams} params
52
53
  */
53
- const functionsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
54
- let client = !sdk ? await sdkForProject() : sdk;
54
+ const functionsList = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55
+ let client = !sdk ? await sdkForProject() :
56
+ sdk;
55
57
  let apiPath = '/functions';
56
58
  let payload = {};
57
59
  if (typeof queries !== 'undefined') {
@@ -68,11 +70,16 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
68
70
  }, payload);
69
71
 
70
72
  if (parseOutput) {
71
- parse(response)
72
- success()
73
+ if(console) {
74
+ showConsoleLink('functions', 'list');
75
+ } else {
76
+ parse(response)
77
+ success()
78
+ }
73
79
  }
74
-
80
+
75
81
  return response;
82
+
76
83
  }
77
84
 
78
85
  /**
@@ -88,6 +95,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
88
95
  * @property {boolean} logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
89
96
  * @property {string} entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
90
97
  * @property {string} commands Build Commands.
98
+ * @property {string[]} scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
91
99
  * @property {string} installationId Appwrite Installation ID for VCS (Version Control System) deployment.
92
100
  * @property {string} providerRepositoryId Repository ID of the repo linked to the function.
93
101
  * @property {string} providerBranch Production branch for the repo linked to the function.
@@ -97,6 +105,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
97
105
  * @property {string} templateOwner The name of the owner of the template.
98
106
  * @property {string} templateRootDirectory Path to function code in the template repo.
99
107
  * @property {string} templateBranch Production branch for the repo linked to the function template.
108
+ * @property {boolean} overrideForCli
100
109
  * @property {boolean} parseOutput
101
110
  * @property {libClient | undefined} sdk
102
111
  */
@@ -104,8 +113,9 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
104
113
  /**
105
114
  * @param {FunctionsCreateRequestParams} params
106
115
  */
107
- const functionsCreate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch, parseOutput = true, sdk = undefined}) => {
108
- let client = !sdk ? await sdkForProject() : sdk;
116
+ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,templateRepository,templateOwner,templateRootDirectory,templateBranch,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
117
+ let client = !sdk ? await sdkForProject() :
118
+ sdk;
109
119
  let apiPath = '/functions';
110
120
  let payload = {};
111
121
  if (typeof functionId !== 'undefined') {
@@ -143,6 +153,10 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
143
153
  if (typeof commands !== 'undefined') {
144
154
  payload['commands'] = commands;
145
155
  }
156
+ scopes = scopes === true ? [] : scopes;
157
+ if (typeof scopes !== 'undefined') {
158
+ payload['scopes'] = scopes;
159
+ }
146
160
  if (typeof installationId !== 'undefined') {
147
161
  payload['installationId'] = installationId;
148
162
  }
@@ -181,12 +195,14 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
181
195
  parse(response)
182
196
  success()
183
197
  }
184
-
198
+
185
199
  return response;
200
+
186
201
  }
187
202
 
188
203
  /**
189
204
  * @typedef {Object} FunctionsListRuntimesRequestParams
205
+ * @property {boolean} overrideForCli
190
206
  * @property {boolean} parseOutput
191
207
  * @property {libClient | undefined} sdk
192
208
  */
@@ -194,8 +210,9 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
194
210
  /**
195
211
  * @param {FunctionsListRuntimesRequestParams} params
196
212
  */
197
- const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) => {
198
- let client = !sdk ? await sdkForProject() : sdk;
213
+ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
214
+ let client = !sdk ? await sdkForProject() :
215
+ sdk;
199
216
  let apiPath = '/functions/runtimes';
200
217
  let payload = {};
201
218
 
@@ -209,13 +226,15 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
209
226
  parse(response)
210
227
  success()
211
228
  }
212
-
229
+
213
230
  return response;
231
+
214
232
  }
215
233
 
216
234
  /**
217
235
  * @typedef {Object} FunctionsGetUsageRequestParams
218
236
  * @property {FunctionUsageRange} range Date range.
237
+ * @property {boolean} overrideForCli
219
238
  * @property {boolean} parseOutput
220
239
  * @property {libClient | undefined} sdk
221
240
  */
@@ -223,8 +242,9 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
223
242
  /**
224
243
  * @param {FunctionsGetUsageRequestParams} params
225
244
  */
226
- const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
227
- let client = !sdk ? await sdkForProject() : sdk;
245
+ const functionsGetUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
246
+ let client = !sdk ? await sdkForProject() :
247
+ sdk;
228
248
  let apiPath = '/functions/usage';
229
249
  let payload = {};
230
250
  if (typeof range !== 'undefined') {
@@ -241,13 +261,15 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
241
261
  parse(response)
242
262
  success()
243
263
  }
244
-
264
+
245
265
  return response;
266
+
246
267
  }
247
268
 
248
269
  /**
249
270
  * @typedef {Object} FunctionsGetRequestParams
250
271
  * @property {string} functionId Function ID.
272
+ * @property {boolean} overrideForCli
251
273
  * @property {boolean} parseOutput
252
274
  * @property {libClient | undefined} sdk
253
275
  */
@@ -255,8 +277,9 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
255
277
  /**
256
278
  * @param {FunctionsGetRequestParams} params
257
279
  */
258
- const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined}) => {
259
- let client = !sdk ? await sdkForProject() : sdk;
280
+ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
281
+ let client = !sdk ? await sdkForProject() :
282
+ sdk;
260
283
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
261
284
  let payload = {};
262
285
 
@@ -267,11 +290,16 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
267
290
  }, payload);
268
291
 
269
292
  if (parseOutput) {
270
- parse(response)
271
- success()
293
+ if(console) {
294
+ showConsoleLink('functions', 'get', functionId);
295
+ } else {
296
+ parse(response)
297
+ success()
298
+ }
272
299
  }
273
-
300
+
274
301
  return response;
302
+
275
303
  }
276
304
 
277
305
  /**
@@ -287,11 +315,13 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
287
315
  * @property {boolean} logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
288
316
  * @property {string} entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
289
317
  * @property {string} commands Build Commands.
318
+ * @property {string[]} scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
290
319
  * @property {string} installationId Appwrite Installation ID for VCS (Version Controle System) deployment.
291
320
  * @property {string} providerRepositoryId Repository ID of the repo linked to the function
292
321
  * @property {string} providerBranch Production branch for the repo linked to the function
293
322
  * @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
294
323
  * @property {string} providerRootDirectory Path to function code in the linked repo.
324
+ * @property {boolean} overrideForCli
295
325
  * @property {boolean} parseOutput
296
326
  * @property {libClient | undefined} sdk
297
327
  */
@@ -299,8 +329,9 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
299
329
  /**
300
330
  * @param {FunctionsUpdateRequestParams} params
301
331
  */
302
- const functionsUpdate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, parseOutput = true, sdk = undefined}) => {
303
- let client = !sdk ? await sdkForProject() : sdk;
332
+ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
333
+ let client = !sdk ? await sdkForProject() :
334
+ sdk;
304
335
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
305
336
  let payload = {};
306
337
  if (typeof name !== 'undefined') {
@@ -335,6 +366,10 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
335
366
  if (typeof commands !== 'undefined') {
336
367
  payload['commands'] = commands;
337
368
  }
369
+ scopes = scopes === true ? [] : scopes;
370
+ if (typeof scopes !== 'undefined') {
371
+ payload['scopes'] = scopes;
372
+ }
338
373
  if (typeof installationId !== 'undefined') {
339
374
  payload['installationId'] = installationId;
340
375
  }
@@ -361,13 +396,15 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
361
396
  parse(response)
362
397
  success()
363
398
  }
364
-
399
+
365
400
  return response;
401
+
366
402
  }
367
403
 
368
404
  /**
369
405
  * @typedef {Object} FunctionsDeleteRequestParams
370
406
  * @property {string} functionId Function ID.
407
+ * @property {boolean} overrideForCli
371
408
  * @property {boolean} parseOutput
372
409
  * @property {libClient | undefined} sdk
373
410
  */
@@ -375,8 +412,9 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
375
412
  /**
376
413
  * @param {FunctionsDeleteRequestParams} params
377
414
  */
378
- const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined}) => {
379
- let client = !sdk ? await sdkForProject() : sdk;
415
+ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
416
+ let client = !sdk ? await sdkForProject() :
417
+ sdk;
380
418
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
381
419
  let payload = {};
382
420
 
@@ -390,8 +428,9 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
390
428
  parse(response)
391
429
  success()
392
430
  }
393
-
431
+
394
432
  return response;
433
+
395
434
  }
396
435
 
397
436
  /**
@@ -399,6 +438,7 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
399
438
  * @property {string} functionId Function ID.
400
439
  * @property {string[]} 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: size, buildId, activate, entrypoint, commands
401
440
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
441
+ * @property {boolean} overrideForCli
402
442
  * @property {boolean} parseOutput
403
443
  * @property {libClient | undefined} sdk
404
444
  */
@@ -406,8 +446,9 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
406
446
  /**
407
447
  * @param {FunctionsListDeploymentsRequestParams} params
408
448
  */
409
- const functionsListDeployments = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
410
- let client = !sdk ? await sdkForProject() : sdk;
449
+ const functionsListDeployments = async ({functionId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
450
+ let client = !sdk ? await sdkForProject() :
451
+ sdk;
411
452
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
412
453
  let payload = {};
413
454
  if (typeof queries !== 'undefined') {
@@ -424,11 +465,16 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
424
465
  }, payload);
425
466
 
426
467
  if (parseOutput) {
427
- parse(response)
428
- success()
468
+ if(console) {
469
+ showConsoleLink('functions', 'listDeployments', functionId);
470
+ } else {
471
+ parse(response)
472
+ success()
473
+ }
429
474
  }
430
-
475
+
431
476
  return response;
477
+
432
478
  }
433
479
 
434
480
  /**
@@ -438,6 +484,7 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
438
484
  * @property {boolean} activate Automatically activate the deployment when it is finished building.
439
485
  * @property {string} entrypoint Entrypoint File.
440
486
  * @property {string} commands Build Commands.
487
+ * @property {boolean} overrideForCli
441
488
  * @property {boolean} parseOutput
442
489
  * @property {libClient | undefined} sdk
443
490
  * @property {CallableFunction} onProgress
@@ -446,8 +493,9 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
446
493
  /**
447
494
  * @param {FunctionsCreateDeploymentRequestParams} params
448
495
  */
449
- const functionsCreateDeployment = async ({ functionId, code, activate, entrypoint, commands, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
450
- let client = !sdk ? await sdkForProject() : sdk;
496
+ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,commands,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}) => {
497
+ let client = !sdk ? await sdkForProject() :
498
+ sdk;
451
499
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
452
500
  let payload = {};
453
501
  if (typeof entrypoint !== 'undefined') {
@@ -460,19 +508,19 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
460
508
  if (!fs.lstatSync(folderPath).isDirectory()) {
461
509
  throw new Error('The path is not a directory.');
462
510
  }
463
-
511
+
464
512
  const ignorer = ignore();
465
513
 
466
514
  const func = localConfig.getFunction(functionId);
467
515
 
516
+ ignorer.add('.appwrite');
517
+
468
518
  if (func.ignore) {
469
519
  ignorer.add(func.ignore);
470
- log('Ignoring files using configuration from appwrite.json');
471
520
  } else if (fs.existsSync(pathLib.join(code, '.gitignore'))) {
472
521
  ignorer.add(fs.readFileSync(pathLib.join(code, '.gitignore')).toString());
473
- log('Ignoring files in .gitignore');
474
522
  }
475
-
523
+
476
524
  const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
477
525
 
478
526
  await tar
@@ -502,7 +550,7 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
502
550
  }
503
551
 
504
552
  const size = code.size;
505
-
553
+
506
554
  const apiHeaders = {
507
555
  'content-type': 'multipart/form-data',
508
556
  };
@@ -529,7 +577,7 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
529
577
  }
530
578
 
531
579
  let uploadableChunkTrimmed;
532
-
580
+
533
581
  if(currentPosition + 1 >= client.CHUNK_SIZE) {
534
582
  uploadableChunkTrimmed = uploadableChunk;
535
583
  } else {
@@ -582,8 +630,8 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
582
630
  await uploadChunk(true);
583
631
  }
584
632
 
585
- fs.unlinkSync(filePath);
586
-
633
+ await fs.unlink(filePath,()=>{});
634
+
587
635
  if (parseOutput) {
588
636
  parse(response)
589
637
  success()
@@ -596,6 +644,7 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
596
644
  * @typedef {Object} FunctionsGetDeploymentRequestParams
597
645
  * @property {string} functionId Function ID.
598
646
  * @property {string} deploymentId Deployment ID.
647
+ * @property {boolean} overrideForCli
599
648
  * @property {boolean} parseOutput
600
649
  * @property {libClient | undefined} sdk
601
650
  */
@@ -603,8 +652,9 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
603
652
  /**
604
653
  * @param {FunctionsGetDeploymentRequestParams} params
605
654
  */
606
- const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
607
- let client = !sdk ? await sdkForProject() : sdk;
655
+ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
656
+ let client = !sdk ? await sdkForProject() :
657
+ sdk;
608
658
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
609
659
  let payload = {};
610
660
 
@@ -615,17 +665,23 @@ const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput =
615
665
  }, payload);
616
666
 
617
667
  if (parseOutput) {
618
- parse(response)
619
- success()
668
+ if(console) {
669
+ showConsoleLink('functions', 'getDeployment', functionId, deploymentId);
670
+ } else {
671
+ parse(response)
672
+ success()
673
+ }
620
674
  }
621
-
675
+
622
676
  return response;
677
+
623
678
  }
624
679
 
625
680
  /**
626
681
  * @typedef {Object} FunctionsUpdateDeploymentRequestParams
627
682
  * @property {string} functionId Function ID.
628
683
  * @property {string} deploymentId Deployment ID.
684
+ * @property {boolean} overrideForCli
629
685
  * @property {boolean} parseOutput
630
686
  * @property {libClient | undefined} sdk
631
687
  */
@@ -633,8 +689,9 @@ const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput =
633
689
  /**
634
690
  * @param {FunctionsUpdateDeploymentRequestParams} params
635
691
  */
636
- const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
637
- let client = !sdk ? await sdkForProject() : sdk;
692
+ const functionsUpdateDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
693
+ let client = !sdk ? await sdkForProject() :
694
+ sdk;
638
695
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
639
696
  let payload = {};
640
697
 
@@ -648,14 +705,16 @@ const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput
648
705
  parse(response)
649
706
  success()
650
707
  }
651
-
708
+
652
709
  return response;
710
+
653
711
  }
654
712
 
655
713
  /**
656
714
  * @typedef {Object} FunctionsDeleteDeploymentRequestParams
657
715
  * @property {string} functionId Function ID.
658
716
  * @property {string} deploymentId Deployment ID.
717
+ * @property {boolean} overrideForCli
659
718
  * @property {boolean} parseOutput
660
719
  * @property {libClient | undefined} sdk
661
720
  */
@@ -663,8 +722,9 @@ const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput
663
722
  /**
664
723
  * @param {FunctionsDeleteDeploymentRequestParams} params
665
724
  */
666
- const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
667
- let client = !sdk ? await sdkForProject() : sdk;
725
+ const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
726
+ let client = !sdk ? await sdkForProject() :
727
+ sdk;
668
728
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
669
729
  let payload = {};
670
730
 
@@ -678,8 +738,9 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
678
738
  parse(response)
679
739
  success()
680
740
  }
681
-
741
+
682
742
  return response;
743
+
683
744
  }
684
745
 
685
746
  /**
@@ -687,6 +748,7 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
687
748
  * @property {string} functionId Function ID.
688
749
  * @property {string} deploymentId Deployment ID.
689
750
  * @property {string} buildId Build unique ID.
751
+ * @property {boolean} overrideForCli
690
752
  * @property {boolean} parseOutput
691
753
  * @property {libClient | undefined} sdk
692
754
  */
@@ -694,10 +756,14 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
694
756
  /**
695
757
  * @param {FunctionsCreateBuildRequestParams} params
696
758
  */
697
- const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOutput = true, sdk = undefined}) => {
698
- let client = !sdk ? await sdkForProject() : sdk;
699
- let apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
759
+ const functionsCreateBuild = async ({functionId,deploymentId,buildId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
760
+ let client = !sdk ? await sdkForProject() :
761
+ sdk;
762
+ let apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
700
763
  let payload = {};
764
+ if (typeof buildId !== 'undefined') {
765
+ payload['buildId'] = buildId;
766
+ }
701
767
 
702
768
  let response = undefined;
703
769
 
@@ -709,14 +775,49 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
709
775
  parse(response)
710
776
  success()
711
777
  }
712
-
778
+
779
+ return response;
780
+
781
+ }
782
+
783
+ /**
784
+ * @typedef {Object} FunctionsUpdateDeploymentBuildRequestParams
785
+ * @property {string} functionId Function ID.
786
+ * @property {string} deploymentId Deployment ID.
787
+ * @property {boolean} overrideForCli
788
+ * @property {boolean} parseOutput
789
+ * @property {libClient | undefined} sdk
790
+ */
791
+
792
+ /**
793
+ * @param {FunctionsUpdateDeploymentBuildRequestParams} params
794
+ */
795
+ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
796
+ let client = !sdk ? await sdkForProject() :
797
+ sdk;
798
+ let apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
799
+ let payload = {};
800
+
801
+ let response = undefined;
802
+
803
+ response = await client.call('patch', apiPath, {
804
+ 'content-type': 'application/json',
805
+ }, payload);
806
+
807
+ if (parseOutput) {
808
+ parse(response)
809
+ success()
810
+ }
811
+
713
812
  return response;
813
+
714
814
  }
715
815
 
716
816
  /**
717
817
  * @typedef {Object} FunctionsDownloadDeploymentRequestParams
718
818
  * @property {string} functionId Function ID.
719
819
  * @property {string} deploymentId Deployment ID.
820
+ * @property {boolean} overrideForCli
720
821
  * @property {boolean} parseOutput
721
822
  * @property {libClient | undefined} sdk
722
823
  * @property {string} destination
@@ -725,14 +826,17 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
725
826
  /**
726
827
  * @param {FunctionsDownloadDeploymentRequestParams} params
727
828
  */
728
- const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined, destination}) => {
729
- let client = !sdk ? await sdkForProject() : sdk;
829
+ const functionsDownloadDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => {
830
+ let client = !sdk ? await sdkForProject() :
831
+ sdk;
730
832
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
731
833
  let payload = {};
732
- payload['project'] = localConfig.getProject().projectId
733
- payload['key'] = globalConfig.getKey();
734
- const queryParams = new URLSearchParams(payload);
735
- apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
834
+ if (!overrideForCli) {
835
+ payload['project'] = localConfig.getProject().projectId
836
+ payload['key'] = globalConfig.getKey();
837
+ const queryParams = new URLSearchParams(payload);
838
+ apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
839
+ }
736
840
 
737
841
  let response = undefined;
738
842
 
@@ -740,21 +844,26 @@ const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutp
740
844
  'content-type': 'application/json',
741
845
  }, payload, 'arraybuffer');
742
846
 
743
- fs.writeFileSync(destination, response);
847
+ if (overrideForCli) {
848
+ response = Buffer.from(response);
849
+ }
744
850
 
851
+ fs.writeFileSync(destination, response);
745
852
  if (parseOutput) {
746
853
  parse(response)
747
854
  success()
748
855
  }
749
-
856
+
750
857
  return response;
858
+
751
859
  }
752
860
 
753
861
  /**
754
862
  * @typedef {Object} FunctionsListExecutionsRequestParams
755
863
  * @property {string} functionId Function ID.
756
- * @property {string[]} 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: trigger, status, responseStatusCode, duration
864
+ * @property {string[]} 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
757
865
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
866
+ * @property {boolean} overrideForCli
758
867
  * @property {boolean} parseOutput
759
868
  * @property {libClient | undefined} sdk
760
869
  */
@@ -762,8 +871,9 @@ const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutp
762
871
  /**
763
872
  * @param {FunctionsListExecutionsRequestParams} params
764
873
  */
765
- const functionsListExecutions = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
766
- let client = !sdk ? await sdkForProject() : sdk;
874
+ const functionsListExecutions = async ({functionId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
875
+ let client = !sdk ? await sdkForProject() :
876
+ sdk;
767
877
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
768
878
  let payload = {};
769
879
  if (typeof queries !== 'undefined') {
@@ -780,11 +890,16 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
780
890
  }, payload);
781
891
 
782
892
  if (parseOutput) {
783
- parse(response)
784
- success()
893
+ if(console) {
894
+ showConsoleLink('functions', 'listExecutions', functionId);
895
+ } else {
896
+ parse(response)
897
+ success()
898
+ }
785
899
  }
786
-
900
+
787
901
  return response;
902
+
788
903
  }
789
904
 
790
905
  /**
@@ -795,6 +910,8 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
795
910
  * @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
796
911
  * @property {ExecutionMethod} method HTTP method of execution. Default value is GET.
797
912
  * @property {object} headers HTTP headers of execution. Defaults to empty.
913
+ * @property {string} scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
914
+ * @property {boolean} overrideForCli
798
915
  * @property {boolean} parseOutput
799
916
  * @property {libClient | undefined} sdk
800
917
  */
@@ -802,8 +919,9 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
802
919
  /**
803
920
  * @param {FunctionsCreateExecutionRequestParams} params
804
921
  */
805
- const functionsCreateExecution = async ({ functionId, body, async, xpath, method, headers, parseOutput = true, sdk = undefined}) => {
806
- let client = !sdk ? await sdkForProject() : sdk;
922
+ const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
923
+ let client = !sdk ? await sdkForProject() :
924
+ sdk;
807
925
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
808
926
  let payload = {};
809
927
  if (typeof body !== 'undefined') {
@@ -821,6 +939,9 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
821
939
  if (typeof headers !== 'undefined') {
822
940
  payload['headers'] = JSON.parse(headers);
823
941
  }
942
+ if (typeof scheduledAt !== 'undefined') {
943
+ payload['scheduledAt'] = scheduledAt;
944
+ }
824
945
 
825
946
  let response = undefined;
826
947
 
@@ -832,14 +953,16 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
832
953
  parse(response)
833
954
  success()
834
955
  }
835
-
956
+
836
957
  return response;
958
+
837
959
  }
838
960
 
839
961
  /**
840
962
  * @typedef {Object} FunctionsGetExecutionRequestParams
841
963
  * @property {string} functionId Function ID.
842
964
  * @property {string} executionId Execution ID.
965
+ * @property {boolean} overrideForCli
843
966
  * @property {boolean} parseOutput
844
967
  * @property {libClient | undefined} sdk
845
968
  */
@@ -847,8 +970,9 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
847
970
  /**
848
971
  * @param {FunctionsGetExecutionRequestParams} params
849
972
  */
850
- const functionsGetExecution = async ({ functionId, executionId, parseOutput = true, sdk = undefined}) => {
851
- let client = !sdk ? await sdkForProject() : sdk;
973
+ const functionsGetExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
974
+ let client = !sdk ? await sdkForProject() :
975
+ sdk;
852
976
  let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
853
977
  let payload = {};
854
978
 
@@ -858,18 +982,57 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
858
982
  'content-type': 'application/json',
859
983
  }, payload);
860
984
 
985
+ if (parseOutput) {
986
+ if(console) {
987
+ showConsoleLink('functions', 'getExecution', functionId, executionId);
988
+ } else {
989
+ parse(response)
990
+ success()
991
+ }
992
+ }
993
+
994
+ return response;
995
+
996
+ }
997
+
998
+ /**
999
+ * @typedef {Object} FunctionsDeleteExecutionRequestParams
1000
+ * @property {string} functionId Function ID.
1001
+ * @property {string} executionId Execution ID.
1002
+ * @property {boolean} overrideForCli
1003
+ * @property {boolean} parseOutput
1004
+ * @property {libClient | undefined} sdk
1005
+ */
1006
+
1007
+ /**
1008
+ * @param {FunctionsDeleteExecutionRequestParams} params
1009
+ */
1010
+ const functionsDeleteExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1011
+ let client = !sdk ? await sdkForProject() :
1012
+ sdk;
1013
+ let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
1014
+ let payload = {};
1015
+
1016
+ let response = undefined;
1017
+
1018
+ response = await client.call('delete', apiPath, {
1019
+ 'content-type': 'application/json',
1020
+ }, payload);
1021
+
861
1022
  if (parseOutput) {
862
1023
  parse(response)
863
1024
  success()
864
1025
  }
865
-
1026
+
866
1027
  return response;
1028
+
867
1029
  }
868
1030
 
869
1031
  /**
870
1032
  * @typedef {Object} FunctionsGetFunctionUsageRequestParams
871
1033
  * @property {string} functionId Function ID.
872
1034
  * @property {FunctionUsageRange} range Date range.
1035
+ * @property {boolean} overrideForCli
873
1036
  * @property {boolean} parseOutput
874
1037
  * @property {libClient | undefined} sdk
875
1038
  */
@@ -877,8 +1040,9 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
877
1040
  /**
878
1041
  * @param {FunctionsGetFunctionUsageRequestParams} params
879
1042
  */
880
- const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true, sdk = undefined}) => {
881
- let client = !sdk ? await sdkForProject() : sdk;
1043
+ const functionsGetFunctionUsage = async ({functionId,range,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1044
+ let client = !sdk ? await sdkForProject() :
1045
+ sdk;
882
1046
  let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
883
1047
  let payload = {};
884
1048
  if (typeof range !== 'undefined') {
@@ -892,16 +1056,22 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
892
1056
  }, payload);
893
1057
 
894
1058
  if (parseOutput) {
895
- parse(response)
896
- success()
1059
+ if(console) {
1060
+ showConsoleLink('functions', 'getFunctionUsage', functionId);
1061
+ } else {
1062
+ parse(response)
1063
+ success()
1064
+ }
897
1065
  }
898
-
1066
+
899
1067
  return response;
1068
+
900
1069
  }
901
1070
 
902
1071
  /**
903
1072
  * @typedef {Object} FunctionsListVariablesRequestParams
904
1073
  * @property {string} functionId Function unique ID.
1074
+ * @property {boolean} overrideForCli
905
1075
  * @property {boolean} parseOutput
906
1076
  * @property {libClient | undefined} sdk
907
1077
  */
@@ -909,8 +1079,9 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
909
1079
  /**
910
1080
  * @param {FunctionsListVariablesRequestParams} params
911
1081
  */
912
- const functionsListVariables = async ({ functionId, parseOutput = true, sdk = undefined}) => {
913
- let client = !sdk ? await sdkForProject() : sdk;
1082
+ const functionsListVariables = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1083
+ let client = !sdk ? await sdkForProject() :
1084
+ sdk;
914
1085
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
915
1086
  let payload = {};
916
1087
 
@@ -924,8 +1095,9 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
924
1095
  parse(response)
925
1096
  success()
926
1097
  }
927
-
1098
+
928
1099
  return response;
1100
+
929
1101
  }
930
1102
 
931
1103
  /**
@@ -933,6 +1105,7 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
933
1105
  * @property {string} functionId Function unique ID.
934
1106
  * @property {string} key Variable key. Max length: 255 chars.
935
1107
  * @property {string} value Variable value. Max length: 8192 chars.
1108
+ * @property {boolean} overrideForCli
936
1109
  * @property {boolean} parseOutput
937
1110
  * @property {libClient | undefined} sdk
938
1111
  */
@@ -940,8 +1113,9 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
940
1113
  /**
941
1114
  * @param {FunctionsCreateVariableRequestParams} params
942
1115
  */
943
- const functionsCreateVariable = async ({ functionId, key, value, parseOutput = true, sdk = undefined}) => {
944
- let client = !sdk ? await sdkForProject() : sdk;
1116
+ const functionsCreateVariable = async ({functionId,key,value,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1117
+ let client = !sdk ? await sdkForProject() :
1118
+ sdk;
945
1119
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
946
1120
  let payload = {};
947
1121
  if (typeof key !== 'undefined') {
@@ -961,14 +1135,16 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
961
1135
  parse(response)
962
1136
  success()
963
1137
  }
964
-
1138
+
965
1139
  return response;
1140
+
966
1141
  }
967
1142
 
968
1143
  /**
969
1144
  * @typedef {Object} FunctionsGetVariableRequestParams
970
1145
  * @property {string} functionId Function unique ID.
971
1146
  * @property {string} variableId Variable unique ID.
1147
+ * @property {boolean} overrideForCli
972
1148
  * @property {boolean} parseOutput
973
1149
  * @property {libClient | undefined} sdk
974
1150
  */
@@ -976,8 +1152,9 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
976
1152
  /**
977
1153
  * @param {FunctionsGetVariableRequestParams} params
978
1154
  */
979
- const functionsGetVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
980
- let client = !sdk ? await sdkForProject() : sdk;
1155
+ const functionsGetVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1156
+ let client = !sdk ? await sdkForProject() :
1157
+ sdk;
981
1158
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
982
1159
  let payload = {};
983
1160
 
@@ -991,8 +1168,9 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
991
1168
  parse(response)
992
1169
  success()
993
1170
  }
994
-
1171
+
995
1172
  return response;
1173
+
996
1174
  }
997
1175
 
998
1176
  /**
@@ -1001,6 +1179,7 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
1001
1179
  * @property {string} variableId Variable unique ID.
1002
1180
  * @property {string} key Variable key. Max length: 255 chars.
1003
1181
  * @property {string} value Variable value. Max length: 8192 chars.
1182
+ * @property {boolean} overrideForCli
1004
1183
  * @property {boolean} parseOutput
1005
1184
  * @property {libClient | undefined} sdk
1006
1185
  */
@@ -1008,8 +1187,9 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
1008
1187
  /**
1009
1188
  * @param {FunctionsUpdateVariableRequestParams} params
1010
1189
  */
1011
- const functionsUpdateVariable = async ({ functionId, variableId, key, value, parseOutput = true, sdk = undefined}) => {
1012
- let client = !sdk ? await sdkForProject() : sdk;
1190
+ const functionsUpdateVariable = async ({functionId,variableId,key,value,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1191
+ let client = !sdk ? await sdkForProject() :
1192
+ sdk;
1013
1193
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
1014
1194
  let payload = {};
1015
1195
  if (typeof key !== 'undefined') {
@@ -1029,14 +1209,16 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
1029
1209
  parse(response)
1030
1210
  success()
1031
1211
  }
1032
-
1212
+
1033
1213
  return response;
1214
+
1034
1215
  }
1035
1216
 
1036
1217
  /**
1037
1218
  * @typedef {Object} FunctionsDeleteVariableRequestParams
1038
1219
  * @property {string} functionId Function unique ID.
1039
1220
  * @property {string} variableId Variable unique ID.
1221
+ * @property {boolean} overrideForCli
1040
1222
  * @property {boolean} parseOutput
1041
1223
  * @property {libClient | undefined} sdk
1042
1224
  */
@@ -1044,8 +1226,9 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
1044
1226
  /**
1045
1227
  * @param {FunctionsDeleteVariableRequestParams} params
1046
1228
  */
1047
- const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
1048
- let client = !sdk ? await sdkForProject() : sdk;
1229
+ const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1230
+ let client = !sdk ? await sdkForProject() :
1231
+ sdk;
1049
1232
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
1050
1233
  let payload = {};
1051
1234
 
@@ -1059,8 +1242,9 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
1059
1242
  parse(response)
1060
1243
  success()
1061
1244
  }
1062
-
1245
+
1063
1246
  return response;
1247
+
1064
1248
  }
1065
1249
 
1066
1250
  functions
@@ -1068,6 +1252,7 @@ functions
1068
1252
  .description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
1069
1253
  .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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId`)
1070
1254
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1255
+ .option(`--console`, `Get the resource console url`)
1071
1256
  .action(actionRunner(functionsList))
1072
1257
 
1073
1258
  functions
@@ -1084,6 +1269,7 @@ functions
1084
1269
  .option(`--logging <logging>`, `Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.`, parseBool)
1085
1270
  .option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
1086
1271
  .option(`--commands <commands>`, `Build Commands.`)
1272
+ .option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
1087
1273
  .option(`--installationId <installationId>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
1088
1274
  .option(`--providerRepositoryId <providerRepositoryId>`, `Repository ID of the repo linked to the function.`)
1089
1275
  .option(`--providerBranch <providerBranch>`, `Production branch for the repo linked to the function.`)
@@ -1110,6 +1296,7 @@ functions
1110
1296
  .command(`get`)
1111
1297
  .description(`Get a function by its unique ID.`)
1112
1298
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1299
+ .option(`--console`, `Get the resource console url`)
1113
1300
  .action(actionRunner(functionsGet))
1114
1301
 
1115
1302
  functions
@@ -1126,6 +1313,7 @@ functions
1126
1313
  .option(`--logging <logging>`, `Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.`, parseBool)
1127
1314
  .option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
1128
1315
  .option(`--commands <commands>`, `Build Commands.`)
1316
+ .option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
1129
1317
  .option(`--installationId <installationId>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`)
1130
1318
  .option(`--providerRepositoryId <providerRepositoryId>`, `Repository ID of the repo linked to the function`)
1131
1319
  .option(`--providerBranch <providerBranch>`, `Production branch for the repo linked to the function`)
@@ -1145,6 +1333,7 @@ functions
1145
1333
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1146
1334
  .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: size, buildId, activate, entrypoint, commands`)
1147
1335
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1336
+ .option(`--console`, `Get the resource console url`)
1148
1337
  .action(actionRunner(functionsListDeployments))
1149
1338
 
1150
1339
  functions
@@ -1162,6 +1351,7 @@ functions
1162
1351
  .description(`Get a code deployment by its unique ID.`)
1163
1352
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1164
1353
  .requiredOption(`--deploymentId <deploymentId>`, `Deployment ID.`)
1354
+ .option(`--console`, `Get the resource console url`)
1165
1355
  .action(actionRunner(functionsGetDeployment))
1166
1356
 
1167
1357
  functions
@@ -1180,12 +1370,19 @@ functions
1180
1370
 
1181
1371
  functions
1182
1372
  .command(`createBuild`)
1183
- .description(`Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.`)
1373
+ .description(``)
1184
1374
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1185
1375
  .requiredOption(`--deploymentId <deploymentId>`, `Deployment ID.`)
1186
- .requiredOption(`--buildId <buildId>`, `Build unique ID.`)
1376
+ .option(`--buildId <buildId>`, `Build unique ID.`)
1187
1377
  .action(actionRunner(functionsCreateBuild))
1188
1378
 
1379
+ functions
1380
+ .command(`updateDeploymentBuild`)
1381
+ .description(``)
1382
+ .requiredOption(`--functionId <functionId>`, `Function ID.`)
1383
+ .requiredOption(`--deploymentId <deploymentId>`, `Deployment ID.`)
1384
+ .action(actionRunner(functionsUpdateDeploymentBuild))
1385
+
1189
1386
  functions
1190
1387
  .command(`downloadDeployment`)
1191
1388
  .description(`Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.`)
@@ -1198,8 +1395,9 @@ functions
1198
1395
  .command(`listExecutions`)
1199
1396
  .description(`Get a list of all the current user function execution logs. You can use the query params to filter your results.`)
1200
1397
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1201
- .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: trigger, status, responseStatusCode, duration`)
1398
+ .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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId`)
1202
1399
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1400
+ .option(`--console`, `Get the resource console url`)
1203
1401
  .action(actionRunner(functionsListExecutions))
1204
1402
 
1205
1403
  functions
@@ -1211,6 +1409,7 @@ functions
1211
1409
  .option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
1212
1410
  .option(`--method <method>`, `HTTP method of execution. Default value is GET.`)
1213
1411
  .option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
1412
+ .option(`--scheduledAt <scheduledAt>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
1214
1413
  .action(actionRunner(functionsCreateExecution))
1215
1414
 
1216
1415
  functions
@@ -1218,13 +1417,22 @@ functions
1218
1417
  .description(`Get a function execution log by its unique ID.`)
1219
1418
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1220
1419
  .requiredOption(`--executionId <executionId>`, `Execution ID.`)
1420
+ .option(`--console`, `Get the resource console url`)
1221
1421
  .action(actionRunner(functionsGetExecution))
1222
1422
 
1423
+ functions
1424
+ .command(`deleteExecution`)
1425
+ .description(`Delete a function execution by its unique ID. `)
1426
+ .requiredOption(`--functionId <functionId>`, `Function ID.`)
1427
+ .requiredOption(`--executionId <executionId>`, `Execution ID.`)
1428
+ .action(actionRunner(functionsDeleteExecution))
1429
+
1223
1430
  functions
1224
1431
  .command(`getFunctionUsage`)
1225
1432
  .description(``)
1226
1433
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
1227
1434
  .option(`--range <range>`, `Date range.`)
1435
+ .option(`--console`, `Get the resource console url`)
1228
1436
  .action(actionRunner(functionsGetFunctionUsage))
1229
1437
 
1230
1438
  functions
@@ -1279,14 +1487,16 @@ module.exports = {
1279
1487
  functionsUpdateDeployment,
1280
1488
  functionsDeleteDeployment,
1281
1489
  functionsCreateBuild,
1490
+ functionsUpdateDeploymentBuild,
1282
1491
  functionsDownloadDeployment,
1283
1492
  functionsListExecutions,
1284
1493
  functionsCreateExecution,
1285
1494
  functionsGetExecution,
1495
+ functionsDeleteExecution,
1286
1496
  functionsGetFunctionUsage,
1287
1497
  functionsListVariables,
1288
1498
  functionsCreateVariable,
1289
1499
  functionsGetVariable,
1290
1500
  functionsUpdateVariable,
1291
1501
  functionsDeleteVariable
1292
- };
1502
+ };