appwrite-cli 6.0.0-rc.5 → 6.0.0-rc.7
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.
- package/README.md +3 -3
- package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +1 -1
- package/docs/examples/functions/get-template.md +2 -0
- package/docs/examples/functions/list-templates.md +5 -0
- package/index.js +4 -3
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +3 -3
- package/lib/commands/account.js +1 -49
- package/lib/commands/assistant.js +1 -2
- package/lib/commands/avatars.js +1 -8
- package/lib/commands/console.js +1 -2
- package/lib/commands/databases.js +1 -49
- package/lib/commands/functions.js +121 -35
- package/lib/commands/generic.js +11 -11
- package/lib/commands/graphql.js +1 -3
- package/lib/commands/health.js +1 -24
- package/lib/commands/init.js +7 -20
- package/lib/commands/locale.js +1 -9
- package/lib/commands/messaging.js +1 -47
- package/lib/commands/migrations.js +1 -17
- package/lib/commands/project.js +1 -7
- package/lib/commands/projects.js +1 -46
- package/lib/commands/proxy.js +1 -6
- package/lib/commands/pull.js +73 -35
- package/lib/commands/push.js +122 -55
- package/lib/commands/run.js +22 -22
- package/lib/commands/storage.js +1 -16
- package/lib/commands/teams.js +1 -15
- package/lib/commands/users.js +1 -44
- package/lib/commands/vcs.js +1 -11
- package/lib/config.js +11 -7
- package/lib/emulation/docker.js +29 -33
- package/lib/paginate.js +3 -1
- package/lib/parser.js +12 -15
- package/lib/questions.js +16 -31
- package/package.json +3 -2
- package/scoop/appwrite.json +3 -3
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const functions = new Command("functions").description(commandDescriptions['functions']).configureHelp({
|
|
38
|
+
const functions = new Command("functions").description(commandDescriptions['functions'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -74,7 +74,6 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli
|
|
|
74
74
|
showConsoleLink('functions', 'list');
|
|
75
75
|
} else {
|
|
76
76
|
parse(response)
|
|
77
|
-
success()
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -193,7 +192,6 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
193
192
|
|
|
194
193
|
if (parseOutput) {
|
|
195
194
|
parse(response)
|
|
196
|
-
success()
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
return response;
|
|
@@ -224,7 +222,91 @@ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false
|
|
|
224
222
|
|
|
225
223
|
if (parseOutput) {
|
|
226
224
|
parse(response)
|
|
227
|
-
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return response;
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @typedef {Object} FunctionsListTemplatesRequestParams
|
|
233
|
+
* @property {string[]} runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.
|
|
234
|
+
* @property {string[]} useCases List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.
|
|
235
|
+
* @property {number} limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.
|
|
236
|
+
* @property {number} offset Offset the list of returned templates. Maximum offset is 5000.
|
|
237
|
+
* @property {boolean} overrideForCli
|
|
238
|
+
* @property {boolean} parseOutput
|
|
239
|
+
* @property {libClient | undefined} sdk
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {FunctionsListTemplatesRequestParams} params
|
|
244
|
+
*/
|
|
245
|
+
const functionsListTemplates = async ({runtimes,useCases,limit,offset,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
246
|
+
let client = !sdk ? await sdkForProject() :
|
|
247
|
+
sdk;
|
|
248
|
+
let apiPath = '/functions/templates';
|
|
249
|
+
let payload = {};
|
|
250
|
+
if (typeof runtimes !== 'undefined') {
|
|
251
|
+
payload['runtimes'] = runtimes;
|
|
252
|
+
}
|
|
253
|
+
if (typeof useCases !== 'undefined') {
|
|
254
|
+
payload['useCases'] = useCases;
|
|
255
|
+
}
|
|
256
|
+
if (typeof limit !== 'undefined') {
|
|
257
|
+
payload['limit'] = limit;
|
|
258
|
+
}
|
|
259
|
+
if (typeof offset !== 'undefined') {
|
|
260
|
+
payload['offset'] = offset;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
let response = undefined;
|
|
264
|
+
|
|
265
|
+
response = await client.call('get', apiPath, {
|
|
266
|
+
'content-type': 'application/json',
|
|
267
|
+
}, payload);
|
|
268
|
+
|
|
269
|
+
if (parseOutput) {
|
|
270
|
+
if(console) {
|
|
271
|
+
showConsoleLink('functions', 'listTemplates');
|
|
272
|
+
} else {
|
|
273
|
+
parse(response)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return response;
|
|
278
|
+
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @typedef {Object} FunctionsGetTemplateRequestParams
|
|
283
|
+
* @property {string} templateId Template ID.
|
|
284
|
+
* @property {boolean} overrideForCli
|
|
285
|
+
* @property {boolean} parseOutput
|
|
286
|
+
* @property {libClient | undefined} sdk
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @param {FunctionsGetTemplateRequestParams} params
|
|
291
|
+
*/
|
|
292
|
+
const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
293
|
+
let client = !sdk ? await sdkForProject() :
|
|
294
|
+
sdk;
|
|
295
|
+
let apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
|
|
296
|
+
let payload = {};
|
|
297
|
+
|
|
298
|
+
let response = undefined;
|
|
299
|
+
|
|
300
|
+
response = await client.call('get', apiPath, {
|
|
301
|
+
'content-type': 'application/json',
|
|
302
|
+
}, payload);
|
|
303
|
+
|
|
304
|
+
if (parseOutput) {
|
|
305
|
+
if(console) {
|
|
306
|
+
showConsoleLink('functions', 'getTemplate', templateId);
|
|
307
|
+
} else {
|
|
308
|
+
parse(response)
|
|
309
|
+
}
|
|
228
310
|
}
|
|
229
311
|
|
|
230
312
|
return response;
|
|
@@ -259,7 +341,6 @@ const functionsGetUsage = async ({range,parseOutput = true, overrideForCli = fal
|
|
|
259
341
|
|
|
260
342
|
if (parseOutput) {
|
|
261
343
|
parse(response)
|
|
262
|
-
success()
|
|
263
344
|
}
|
|
264
345
|
|
|
265
346
|
return response;
|
|
@@ -294,7 +375,6 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
294
375
|
showConsoleLink('functions', 'get', functionId);
|
|
295
376
|
} else {
|
|
296
377
|
parse(response)
|
|
297
|
-
success()
|
|
298
378
|
}
|
|
299
379
|
}
|
|
300
380
|
|
|
@@ -394,7 +474,6 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
394
474
|
|
|
395
475
|
if (parseOutput) {
|
|
396
476
|
parse(response)
|
|
397
|
-
success()
|
|
398
477
|
}
|
|
399
478
|
|
|
400
479
|
return response;
|
|
@@ -426,7 +505,6 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli =
|
|
|
426
505
|
|
|
427
506
|
if (parseOutput) {
|
|
428
507
|
parse(response)
|
|
429
|
-
success()
|
|
430
508
|
}
|
|
431
509
|
|
|
432
510
|
return response;
|
|
@@ -469,7 +547,6 @@ const functionsListDeployments = async ({functionId,queries,search,parseOutput =
|
|
|
469
547
|
showConsoleLink('functions', 'listDeployments', functionId);
|
|
470
548
|
} else {
|
|
471
549
|
parse(response)
|
|
472
|
-
success()
|
|
473
550
|
}
|
|
474
551
|
}
|
|
475
552
|
|
|
@@ -523,15 +600,17 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co
|
|
|
523
600
|
|
|
524
601
|
const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
|
|
525
602
|
|
|
603
|
+
const archiveFileName = `${functionId}-code.tar.gz`;
|
|
604
|
+
|
|
526
605
|
await tar
|
|
527
606
|
.create({
|
|
528
607
|
gzip: true,
|
|
529
608
|
sync: true,
|
|
530
609
|
cwd: folderPath,
|
|
531
|
-
file:
|
|
610
|
+
file: archiveFileName
|
|
532
611
|
}, files);
|
|
533
612
|
|
|
534
|
-
let archivePath = fs.realpathSync(
|
|
613
|
+
let archivePath = fs.realpathSync(archiveFileName)
|
|
535
614
|
if (typeof archivePath !== 'undefined') {
|
|
536
615
|
payload['code'] = archivePath;
|
|
537
616
|
code = archivePath;
|
|
@@ -634,7 +713,6 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co
|
|
|
634
713
|
|
|
635
714
|
if (parseOutput) {
|
|
636
715
|
parse(response)
|
|
637
|
-
success()
|
|
638
716
|
}
|
|
639
717
|
|
|
640
718
|
return response;
|
|
@@ -669,7 +747,6 @@ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = tru
|
|
|
669
747
|
showConsoleLink('functions', 'getDeployment', functionId, deploymentId);
|
|
670
748
|
} else {
|
|
671
749
|
parse(response)
|
|
672
|
-
success()
|
|
673
750
|
}
|
|
674
751
|
}
|
|
675
752
|
|
|
@@ -703,7 +780,6 @@ const functionsUpdateDeployment = async ({functionId,deploymentId,parseOutput =
|
|
|
703
780
|
|
|
704
781
|
if (parseOutput) {
|
|
705
782
|
parse(response)
|
|
706
|
-
success()
|
|
707
783
|
}
|
|
708
784
|
|
|
709
785
|
return response;
|
|
@@ -736,7 +812,6 @@ const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput =
|
|
|
736
812
|
|
|
737
813
|
if (parseOutput) {
|
|
738
814
|
parse(response)
|
|
739
|
-
success()
|
|
740
815
|
}
|
|
741
816
|
|
|
742
817
|
return response;
|
|
@@ -773,7 +848,6 @@ const functionsCreateBuild = async ({functionId,deploymentId,buildId,parseOutput
|
|
|
773
848
|
|
|
774
849
|
if (parseOutput) {
|
|
775
850
|
parse(response)
|
|
776
|
-
success()
|
|
777
851
|
}
|
|
778
852
|
|
|
779
853
|
return response;
|
|
@@ -806,7 +880,6 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
806
880
|
|
|
807
881
|
if (parseOutput) {
|
|
808
882
|
parse(response)
|
|
809
|
-
success()
|
|
810
883
|
}
|
|
811
884
|
|
|
812
885
|
return response;
|
|
@@ -814,7 +887,7 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
814
887
|
}
|
|
815
888
|
|
|
816
889
|
/**
|
|
817
|
-
* @typedef {Object}
|
|
890
|
+
* @typedef {Object} FunctionsGetDeploymentDownloadRequestParams
|
|
818
891
|
* @property {string} functionId Function ID.
|
|
819
892
|
* @property {string} deploymentId Deployment ID.
|
|
820
893
|
* @property {boolean} overrideForCli
|
|
@@ -824,9 +897,9 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
824
897
|
*/
|
|
825
898
|
|
|
826
899
|
/**
|
|
827
|
-
* @param {
|
|
900
|
+
* @param {FunctionsGetDeploymentDownloadRequestParams} params
|
|
828
901
|
*/
|
|
829
|
-
const
|
|
902
|
+
const functionsGetDeploymentDownload = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console}) => {
|
|
830
903
|
let client = !sdk ? await sdkForProject() :
|
|
831
904
|
sdk;
|
|
832
905
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
@@ -850,8 +923,11 @@ const functionsDownloadDeployment = async ({functionId,deploymentId,parseOutput
|
|
|
850
923
|
|
|
851
924
|
fs.writeFileSync(destination, response);
|
|
852
925
|
if (parseOutput) {
|
|
853
|
-
|
|
854
|
-
|
|
926
|
+
if(console) {
|
|
927
|
+
showConsoleLink('functions', 'getDeploymentDownload', functionId, deploymentId);
|
|
928
|
+
} else {
|
|
929
|
+
parse(response)
|
|
930
|
+
}
|
|
855
931
|
}
|
|
856
932
|
|
|
857
933
|
return response;
|
|
@@ -894,7 +970,6 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput =
|
|
|
894
970
|
showConsoleLink('functions', 'listExecutions', functionId);
|
|
895
971
|
} else {
|
|
896
972
|
parse(response)
|
|
897
|
-
success()
|
|
898
973
|
}
|
|
899
974
|
}
|
|
900
975
|
|
|
@@ -951,7 +1026,6 @@ const functionsCreateExecution = async ({functionId,body,async,xpath,method,head
|
|
|
951
1026
|
|
|
952
1027
|
if (parseOutput) {
|
|
953
1028
|
parse(response)
|
|
954
|
-
success()
|
|
955
1029
|
}
|
|
956
1030
|
|
|
957
1031
|
return response;
|
|
@@ -987,7 +1061,6 @@ const functionsGetExecution = async ({functionId,executionId,parseOutput = true,
|
|
|
987
1061
|
showConsoleLink('functions', 'getExecution', functionId, executionId);
|
|
988
1062
|
} else {
|
|
989
1063
|
parse(response)
|
|
990
|
-
success()
|
|
991
1064
|
}
|
|
992
1065
|
}
|
|
993
1066
|
|
|
@@ -1021,7 +1094,6 @@ const functionsDeleteExecution = async ({functionId,executionId,parseOutput = tr
|
|
|
1021
1094
|
|
|
1022
1095
|
if (parseOutput) {
|
|
1023
1096
|
parse(response)
|
|
1024
|
-
success()
|
|
1025
1097
|
}
|
|
1026
1098
|
|
|
1027
1099
|
return response;
|
|
@@ -1060,7 +1132,6 @@ const functionsGetFunctionUsage = async ({functionId,range,parseOutput = true, o
|
|
|
1060
1132
|
showConsoleLink('functions', 'getFunctionUsage', functionId);
|
|
1061
1133
|
} else {
|
|
1062
1134
|
parse(response)
|
|
1063
|
-
success()
|
|
1064
1135
|
}
|
|
1065
1136
|
}
|
|
1066
1137
|
|
|
@@ -1093,7 +1164,6 @@ const functionsListVariables = async ({functionId,parseOutput = true, overrideFo
|
|
|
1093
1164
|
|
|
1094
1165
|
if (parseOutput) {
|
|
1095
1166
|
parse(response)
|
|
1096
|
-
success()
|
|
1097
1167
|
}
|
|
1098
1168
|
|
|
1099
1169
|
return response;
|
|
@@ -1133,7 +1203,6 @@ const functionsCreateVariable = async ({functionId,key,value,parseOutput = true,
|
|
|
1133
1203
|
|
|
1134
1204
|
if (parseOutput) {
|
|
1135
1205
|
parse(response)
|
|
1136
|
-
success()
|
|
1137
1206
|
}
|
|
1138
1207
|
|
|
1139
1208
|
return response;
|
|
@@ -1166,7 +1235,6 @@ const functionsGetVariable = async ({functionId,variableId,parseOutput = true, o
|
|
|
1166
1235
|
|
|
1167
1236
|
if (parseOutput) {
|
|
1168
1237
|
parse(response)
|
|
1169
|
-
success()
|
|
1170
1238
|
}
|
|
1171
1239
|
|
|
1172
1240
|
return response;
|
|
@@ -1207,7 +1275,6 @@ const functionsUpdateVariable = async ({functionId,variableId,key,value,parseOut
|
|
|
1207
1275
|
|
|
1208
1276
|
if (parseOutput) {
|
|
1209
1277
|
parse(response)
|
|
1210
|
-
success()
|
|
1211
1278
|
}
|
|
1212
1279
|
|
|
1213
1280
|
return response;
|
|
@@ -1240,7 +1307,6 @@ const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true
|
|
|
1240
1307
|
|
|
1241
1308
|
if (parseOutput) {
|
|
1242
1309
|
parse(response)
|
|
1243
|
-
success()
|
|
1244
1310
|
}
|
|
1245
1311
|
|
|
1246
1312
|
return response;
|
|
@@ -1286,6 +1352,23 @@ functions
|
|
|
1286
1352
|
.description(`Get a list of all runtimes that are currently active on your instance.`)
|
|
1287
1353
|
.action(actionRunner(functionsListRuntimes))
|
|
1288
1354
|
|
|
1355
|
+
functions
|
|
1356
|
+
.command(`list-templates`)
|
|
1357
|
+
.description(`List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1358
|
+
.option(`--runtimes [runtimes...]`, `List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.`)
|
|
1359
|
+
.option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.`)
|
|
1360
|
+
.option(`--limit <limit>`, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger)
|
|
1361
|
+
.option(`--offset <offset>`, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger)
|
|
1362
|
+
.option(`--console`, `Get the resource console url`)
|
|
1363
|
+
.action(actionRunner(functionsListTemplates))
|
|
1364
|
+
|
|
1365
|
+
functions
|
|
1366
|
+
.command(`get-template`)
|
|
1367
|
+
.description(`Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1368
|
+
.requiredOption(`--template-id <template-id>`, `Template ID.`)
|
|
1369
|
+
.option(`--console`, `Get the resource console url`)
|
|
1370
|
+
.action(actionRunner(functionsGetTemplate))
|
|
1371
|
+
|
|
1289
1372
|
functions
|
|
1290
1373
|
.command(`get-usage`)
|
|
1291
1374
|
.description(``)
|
|
@@ -1384,12 +1467,13 @@ functions
|
|
|
1384
1467
|
.action(actionRunner(functionsUpdateDeploymentBuild))
|
|
1385
1468
|
|
|
1386
1469
|
functions
|
|
1387
|
-
.command(`
|
|
1470
|
+
.command(`get-deployment-download`)
|
|
1388
1471
|
.description(`Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.`)
|
|
1389
1472
|
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1390
1473
|
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1391
1474
|
.requiredOption(`--destination <path>`, `output file path.`)
|
|
1392
|
-
.
|
|
1475
|
+
.option(`--console`, `Get the resource console url`)
|
|
1476
|
+
.action(actionRunner(functionsGetDeploymentDownload))
|
|
1393
1477
|
|
|
1394
1478
|
functions
|
|
1395
1479
|
.command(`list-executions`)
|
|
@@ -1477,6 +1561,8 @@ module.exports = {
|
|
|
1477
1561
|
functionsList,
|
|
1478
1562
|
functionsCreate,
|
|
1479
1563
|
functionsListRuntimes,
|
|
1564
|
+
functionsListTemplates,
|
|
1565
|
+
functionsGetTemplate,
|
|
1480
1566
|
functionsGetUsage,
|
|
1481
1567
|
functionsGet,
|
|
1482
1568
|
functionsUpdate,
|
|
@@ -1488,7 +1574,7 @@ module.exports = {
|
|
|
1488
1574
|
functionsDeleteDeployment,
|
|
1489
1575
|
functionsCreateBuild,
|
|
1490
1576
|
functionsUpdateDeploymentBuild,
|
|
1491
|
-
|
|
1577
|
+
functionsGetDeploymentDownload,
|
|
1492
1578
|
functionsListExecutions,
|
|
1493
1579
|
functionsCreateExecution,
|
|
1494
1580
|
functionsGetExecution,
|
package/lib/commands/generic.js
CHANGED
|
@@ -6,7 +6,7 @@ const { globalConfig, localConfig } = require("../config");
|
|
|
6
6
|
const { actionRunner, success, parseBool, commandDescriptions, error, parse, hint, log, drawTable, cliConfig } = require("../parser");
|
|
7
7
|
const ID = require("../id");
|
|
8
8
|
const { questionsLogin, questionsLogout, questionsListFactors, questionsMfaChallenge } = require("../questions");
|
|
9
|
-
const {
|
|
9
|
+
const { accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
|
|
10
10
|
|
|
11
11
|
const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
|
|
12
12
|
|
|
@@ -14,17 +14,17 @@ const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
|
|
|
14
14
|
const oldCurrent = globalConfig.getCurrentSession();
|
|
15
15
|
let configEndpoint = endpoint ?? DEFAULT_ENDPOINT;
|
|
16
16
|
|
|
17
|
-
if(globalConfig.getCurrentSession() !== '') {
|
|
17
|
+
if (globalConfig.getCurrentSession() !== '') {
|
|
18
18
|
log('You are currently signed in as ' + globalConfig.getEmail());
|
|
19
19
|
|
|
20
|
-
if(globalConfig.getSessions().length === 1) {
|
|
20
|
+
if (globalConfig.getSessions().length === 1) {
|
|
21
21
|
hint('You can sign in and manage multiple accounts with Appwrite CLI');
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const answers = email && password ? { email, password } : await inquirer.prompt(questionsLogin);
|
|
26
26
|
|
|
27
|
-
if(!answers.method) {
|
|
27
|
+
if (!answers.method) {
|
|
28
28
|
answers.method = 'login';
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -92,7 +92,7 @@ const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
|
|
|
92
92
|
} else {
|
|
93
93
|
globalConfig.removeSession(id);
|
|
94
94
|
globalConfig.setCurrentSession(oldCurrent);
|
|
95
|
-
if(endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials'){
|
|
95
|
+
if (endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') {
|
|
96
96
|
log('Use the --endpoint option for self-hosted instances')
|
|
97
97
|
}
|
|
98
98
|
throw error;
|
|
@@ -135,7 +135,7 @@ const whoami = new Command("whoami")
|
|
|
135
135
|
}
|
|
136
136
|
];
|
|
137
137
|
|
|
138
|
-
if(cliConfig.json) {
|
|
138
|
+
if (cliConfig.json) {
|
|
139
139
|
console.log(data);
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
@@ -193,7 +193,7 @@ const logout = new Command("logout")
|
|
|
193
193
|
}
|
|
194
194
|
if (sessions.length === 1) {
|
|
195
195
|
await deleteSession(current);
|
|
196
|
-
success();
|
|
196
|
+
success("Logging out");
|
|
197
197
|
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
@@ -207,16 +207,16 @@ const logout = new Command("logout")
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
const remainingSessions
|
|
210
|
+
const remainingSessions = globalConfig.getSessions();
|
|
211
211
|
|
|
212
|
-
if (remainingSessions
|
|
212
|
+
if (remainingSessions.length > 0 && remainingSessions.filter(session => session.id === current).length !== 1) {
|
|
213
213
|
const accountId = remainingSessions [0].id;
|
|
214
214
|
globalConfig.setCurrentSession(accountId);
|
|
215
215
|
|
|
216
216
|
success(`Current account is ${accountId}`);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
success();
|
|
219
|
+
success("Logging out");
|
|
220
220
|
}));
|
|
221
221
|
|
|
222
222
|
const client = new Command("client")
|
|
@@ -292,7 +292,7 @@ const client = new Command("client")
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
success()
|
|
295
|
+
success("Setting client")
|
|
296
296
|
}));
|
|
297
297
|
|
|
298
298
|
const migrate = async () => {
|
package/lib/commands/graphql.js
CHANGED
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const graphql = new Command("graphql").description(commandDescriptions['graphql']).configureHelp({
|
|
38
|
+
const graphql = new Command("graphql").description(commandDescriptions['graphql'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -68,7 +68,6 @@ const graphqlQuery = async ({query,parseOutput = true, overrideForCli = false, s
|
|
|
68
68
|
|
|
69
69
|
if (parseOutput) {
|
|
70
70
|
parse(response)
|
|
71
|
-
success()
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
return response;
|
|
@@ -104,7 +103,6 @@ const graphqlMutation = async ({query,parseOutput = true, overrideForCli = false
|
|
|
104
103
|
|
|
105
104
|
if (parseOutput) {
|
|
106
105
|
parse(response)
|
|
107
|
-
success()
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
return response;
|
package/lib/commands/health.js
CHANGED
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const health = new Command("health").description(commandDescriptions['health']).configureHelp({
|
|
38
|
+
const health = new Command("health").description(commandDescriptions['health'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -63,7 +63,6 @@ const healthGet = async ({parseOutput = true, overrideForCli = false, sdk = unde
|
|
|
63
63
|
|
|
64
64
|
if (parseOutput) {
|
|
65
65
|
parse(response)
|
|
66
|
-
success()
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
return response;
|
|
@@ -94,7 +93,6 @@ const healthGetAntivirus = async ({parseOutput = true, overrideForCli = false, s
|
|
|
94
93
|
|
|
95
94
|
if (parseOutput) {
|
|
96
95
|
parse(response)
|
|
97
|
-
success()
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
return response;
|
|
@@ -125,7 +123,6 @@ const healthGetCache = async ({parseOutput = true, overrideForCli = false, sdk =
|
|
|
125
123
|
|
|
126
124
|
if (parseOutput) {
|
|
127
125
|
parse(response)
|
|
128
|
-
success()
|
|
129
126
|
}
|
|
130
127
|
|
|
131
128
|
return response;
|
|
@@ -160,7 +157,6 @@ const healthGetCertificate = async ({domain,parseOutput = true, overrideForCli =
|
|
|
160
157
|
|
|
161
158
|
if (parseOutput) {
|
|
162
159
|
parse(response)
|
|
163
|
-
success()
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
return response;
|
|
@@ -191,7 +187,6 @@ const healthGetDB = async ({parseOutput = true, overrideForCli = false, sdk = un
|
|
|
191
187
|
|
|
192
188
|
if (parseOutput) {
|
|
193
189
|
parse(response)
|
|
194
|
-
success()
|
|
195
190
|
}
|
|
196
191
|
|
|
197
192
|
return response;
|
|
@@ -222,7 +217,6 @@ const healthGetPubSub = async ({parseOutput = true, overrideForCli = false, sdk
|
|
|
222
217
|
|
|
223
218
|
if (parseOutput) {
|
|
224
219
|
parse(response)
|
|
225
|
-
success()
|
|
226
220
|
}
|
|
227
221
|
|
|
228
222
|
return response;
|
|
@@ -253,7 +247,6 @@ const healthGetQueue = async ({parseOutput = true, overrideForCli = false, sdk =
|
|
|
253
247
|
|
|
254
248
|
if (parseOutput) {
|
|
255
249
|
parse(response)
|
|
256
|
-
success()
|
|
257
250
|
}
|
|
258
251
|
|
|
259
252
|
return response;
|
|
@@ -288,7 +281,6 @@ const healthGetQueueBuilds = async ({threshold,parseOutput = true, overrideForCl
|
|
|
288
281
|
|
|
289
282
|
if (parseOutput) {
|
|
290
283
|
parse(response)
|
|
291
|
-
success()
|
|
292
284
|
}
|
|
293
285
|
|
|
294
286
|
return response;
|
|
@@ -323,7 +315,6 @@ const healthGetQueueCertificates = async ({threshold,parseOutput = true, overrid
|
|
|
323
315
|
|
|
324
316
|
if (parseOutput) {
|
|
325
317
|
parse(response)
|
|
326
|
-
success()
|
|
327
318
|
}
|
|
328
319
|
|
|
329
320
|
return response;
|
|
@@ -362,7 +353,6 @@ const healthGetQueueDatabases = async ({name,threshold,parseOutput = true, overr
|
|
|
362
353
|
|
|
363
354
|
if (parseOutput) {
|
|
364
355
|
parse(response)
|
|
365
|
-
success()
|
|
366
356
|
}
|
|
367
357
|
|
|
368
358
|
return response;
|
|
@@ -397,7 +387,6 @@ const healthGetQueueDeletes = async ({threshold,parseOutput = true, overrideForC
|
|
|
397
387
|
|
|
398
388
|
if (parseOutput) {
|
|
399
389
|
parse(response)
|
|
400
|
-
success()
|
|
401
390
|
}
|
|
402
391
|
|
|
403
392
|
return response;
|
|
@@ -433,7 +422,6 @@ const healthGetFailedJobs = async ({name,threshold,parseOutput = true, overrideF
|
|
|
433
422
|
|
|
434
423
|
if (parseOutput) {
|
|
435
424
|
parse(response)
|
|
436
|
-
success()
|
|
437
425
|
}
|
|
438
426
|
|
|
439
427
|
return response;
|
|
@@ -468,7 +456,6 @@ const healthGetQueueFunctions = async ({threshold,parseOutput = true, overrideFo
|
|
|
468
456
|
|
|
469
457
|
if (parseOutput) {
|
|
470
458
|
parse(response)
|
|
471
|
-
success()
|
|
472
459
|
}
|
|
473
460
|
|
|
474
461
|
return response;
|
|
@@ -503,7 +490,6 @@ const healthGetQueueLogs = async ({threshold,parseOutput = true, overrideForCli
|
|
|
503
490
|
|
|
504
491
|
if (parseOutput) {
|
|
505
492
|
parse(response)
|
|
506
|
-
success()
|
|
507
493
|
}
|
|
508
494
|
|
|
509
495
|
return response;
|
|
@@ -538,7 +524,6 @@ const healthGetQueueMails = async ({threshold,parseOutput = true, overrideForCli
|
|
|
538
524
|
|
|
539
525
|
if (parseOutput) {
|
|
540
526
|
parse(response)
|
|
541
|
-
success()
|
|
542
527
|
}
|
|
543
528
|
|
|
544
529
|
return response;
|
|
@@ -573,7 +558,6 @@ const healthGetQueueMessaging = async ({threshold,parseOutput = true, overrideFo
|
|
|
573
558
|
|
|
574
559
|
if (parseOutput) {
|
|
575
560
|
parse(response)
|
|
576
|
-
success()
|
|
577
561
|
}
|
|
578
562
|
|
|
579
563
|
return response;
|
|
@@ -608,7 +592,6 @@ const healthGetQueueMigrations = async ({threshold,parseOutput = true, overrideF
|
|
|
608
592
|
|
|
609
593
|
if (parseOutput) {
|
|
610
594
|
parse(response)
|
|
611
|
-
success()
|
|
612
595
|
}
|
|
613
596
|
|
|
614
597
|
return response;
|
|
@@ -643,7 +626,6 @@ const healthGetQueueUsage = async ({threshold,parseOutput = true, overrideForCli
|
|
|
643
626
|
|
|
644
627
|
if (parseOutput) {
|
|
645
628
|
parse(response)
|
|
646
|
-
success()
|
|
647
629
|
}
|
|
648
630
|
|
|
649
631
|
return response;
|
|
@@ -678,7 +660,6 @@ const healthGetQueueUsageDump = async ({threshold,parseOutput = true, overrideFo
|
|
|
678
660
|
|
|
679
661
|
if (parseOutput) {
|
|
680
662
|
parse(response)
|
|
681
|
-
success()
|
|
682
663
|
}
|
|
683
664
|
|
|
684
665
|
return response;
|
|
@@ -713,7 +694,6 @@ const healthGetQueueWebhooks = async ({threshold,parseOutput = true, overrideFor
|
|
|
713
694
|
|
|
714
695
|
if (parseOutput) {
|
|
715
696
|
parse(response)
|
|
716
|
-
success()
|
|
717
697
|
}
|
|
718
698
|
|
|
719
699
|
return response;
|
|
@@ -744,7 +724,6 @@ const healthGetStorage = async ({parseOutput = true, overrideForCli = false, sdk
|
|
|
744
724
|
|
|
745
725
|
if (parseOutput) {
|
|
746
726
|
parse(response)
|
|
747
|
-
success()
|
|
748
727
|
}
|
|
749
728
|
|
|
750
729
|
return response;
|
|
@@ -775,7 +754,6 @@ const healthGetStorageLocal = async ({parseOutput = true, overrideForCli = false
|
|
|
775
754
|
|
|
776
755
|
if (parseOutput) {
|
|
777
756
|
parse(response)
|
|
778
|
-
success()
|
|
779
757
|
}
|
|
780
758
|
|
|
781
759
|
return response;
|
|
@@ -806,7 +784,6 @@ const healthGetTime = async ({parseOutput = true, overrideForCli = false, sdk =
|
|
|
806
784
|
|
|
807
785
|
if (parseOutput) {
|
|
808
786
|
parse(response)
|
|
809
|
-
success()
|
|
810
787
|
}
|
|
811
788
|
|
|
812
789
|
return response;
|