appwrite-cli 6.0.0-rc.6 → 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 +120 -53
- package/lib/commands/run.js +10 -12
- 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 +1 -3
- package/lib/paginate.js +3 -1
- package/lib/parser.js +12 -15
- package/lib/questions.js +16 -31
- package/package.json +2 -2
- package/scoop/appwrite.json +3 -3
package/lib/commands/users.js
CHANGED
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const users = new Command("users").description(commandDescriptions['users']).configureHelp({
|
|
38
|
+
const users = new Command("users").description(commandDescriptions['users'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -74,7 +74,6 @@ const usersList = async ({queries,search,parseOutput = true, overrideForCli = fa
|
|
|
74
74
|
showConsoleLink('users', 'list');
|
|
75
75
|
} else {
|
|
76
76
|
parse(response)
|
|
77
|
-
success()
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -126,7 +125,6 @@ const usersCreate = async ({userId,email,phone,password,name,parseOutput = true,
|
|
|
126
125
|
|
|
127
126
|
if (parseOutput) {
|
|
128
127
|
parse(response)
|
|
129
|
-
success()
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
return response;
|
|
@@ -173,7 +171,6 @@ const usersCreateArgon2User = async ({userId,email,password,name,parseOutput = t
|
|
|
173
171
|
|
|
174
172
|
if (parseOutput) {
|
|
175
173
|
parse(response)
|
|
176
|
-
success()
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
return response;
|
|
@@ -220,7 +217,6 @@ const usersCreateBcryptUser = async ({userId,email,password,name,parseOutput = t
|
|
|
220
217
|
|
|
221
218
|
if (parseOutput) {
|
|
222
219
|
parse(response)
|
|
223
|
-
success()
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
return response;
|
|
@@ -259,7 +255,6 @@ const usersListIdentities = async ({queries,search,parseOutput = true, overrideF
|
|
|
259
255
|
|
|
260
256
|
if (parseOutput) {
|
|
261
257
|
parse(response)
|
|
262
|
-
success()
|
|
263
258
|
}
|
|
264
259
|
|
|
265
260
|
return response;
|
|
@@ -291,7 +286,6 @@ const usersDeleteIdentity = async ({identityId,parseOutput = true, overrideForCl
|
|
|
291
286
|
|
|
292
287
|
if (parseOutput) {
|
|
293
288
|
parse(response)
|
|
294
|
-
success()
|
|
295
289
|
}
|
|
296
290
|
|
|
297
291
|
return response;
|
|
@@ -338,7 +332,6 @@ const usersCreateMD5User = async ({userId,email,password,name,parseOutput = true
|
|
|
338
332
|
|
|
339
333
|
if (parseOutput) {
|
|
340
334
|
parse(response)
|
|
341
|
-
success()
|
|
342
335
|
}
|
|
343
336
|
|
|
344
337
|
return response;
|
|
@@ -385,7 +378,6 @@ const usersCreatePHPassUser = async ({userId,email,password,name,parseOutput = t
|
|
|
385
378
|
|
|
386
379
|
if (parseOutput) {
|
|
387
380
|
parse(response)
|
|
388
|
-
success()
|
|
389
381
|
}
|
|
390
382
|
|
|
391
383
|
return response;
|
|
@@ -452,7 +444,6 @@ const usersCreateScryptUser = async ({userId,email,password,passwordSalt,passwor
|
|
|
452
444
|
|
|
453
445
|
if (parseOutput) {
|
|
454
446
|
parse(response)
|
|
455
|
-
success()
|
|
456
447
|
}
|
|
457
448
|
|
|
458
449
|
return response;
|
|
@@ -511,7 +502,6 @@ const usersCreateScryptModifiedUser = async ({userId,email,password,passwordSalt
|
|
|
511
502
|
|
|
512
503
|
if (parseOutput) {
|
|
513
504
|
parse(response)
|
|
514
|
-
success()
|
|
515
505
|
}
|
|
516
506
|
|
|
517
507
|
return response;
|
|
@@ -562,7 +552,6 @@ const usersCreateSHAUser = async ({userId,email,password,passwordVersion,name,pa
|
|
|
562
552
|
|
|
563
553
|
if (parseOutput) {
|
|
564
554
|
parse(response)
|
|
565
|
-
success()
|
|
566
555
|
}
|
|
567
556
|
|
|
568
557
|
return response;
|
|
@@ -597,7 +586,6 @@ const usersGetUsage = async ({range,parseOutput = true, overrideForCli = false,
|
|
|
597
586
|
|
|
598
587
|
if (parseOutput) {
|
|
599
588
|
parse(response)
|
|
600
|
-
success()
|
|
601
589
|
}
|
|
602
590
|
|
|
603
591
|
return response;
|
|
@@ -632,7 +620,6 @@ const usersGet = async ({userId,parseOutput = true, overrideForCli = false, sdk
|
|
|
632
620
|
showConsoleLink('users', 'get', userId);
|
|
633
621
|
} else {
|
|
634
622
|
parse(response)
|
|
635
|
-
success()
|
|
636
623
|
}
|
|
637
624
|
}
|
|
638
625
|
|
|
@@ -665,7 +652,6 @@ const usersDelete = async ({userId,parseOutput = true, overrideForCli = false, s
|
|
|
665
652
|
|
|
666
653
|
if (parseOutput) {
|
|
667
654
|
parse(response)
|
|
668
|
-
success()
|
|
669
655
|
}
|
|
670
656
|
|
|
671
657
|
return response;
|
|
@@ -701,7 +687,6 @@ const usersUpdateEmail = async ({userId,email,parseOutput = true, overrideForCli
|
|
|
701
687
|
|
|
702
688
|
if (parseOutput) {
|
|
703
689
|
parse(response)
|
|
704
|
-
success()
|
|
705
690
|
}
|
|
706
691
|
|
|
707
692
|
return response;
|
|
@@ -741,7 +726,6 @@ const usersCreateJWT = async ({userId,sessionId,duration,parseOutput = true, ove
|
|
|
741
726
|
|
|
742
727
|
if (parseOutput) {
|
|
743
728
|
parse(response)
|
|
744
|
-
success()
|
|
745
729
|
}
|
|
746
730
|
|
|
747
731
|
return response;
|
|
@@ -778,7 +762,6 @@ const usersUpdateLabels = async ({userId,labels,parseOutput = true, overrideForC
|
|
|
778
762
|
|
|
779
763
|
if (parseOutput) {
|
|
780
764
|
parse(response)
|
|
781
|
-
success()
|
|
782
765
|
}
|
|
783
766
|
|
|
784
767
|
return response;
|
|
@@ -814,7 +797,6 @@ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli
|
|
|
814
797
|
|
|
815
798
|
if (parseOutput) {
|
|
816
799
|
parse(response)
|
|
817
|
-
success()
|
|
818
800
|
}
|
|
819
801
|
|
|
820
802
|
return response;
|
|
@@ -846,7 +828,6 @@ const usersListMemberships = async ({userId,parseOutput = true, overrideForCli =
|
|
|
846
828
|
|
|
847
829
|
if (parseOutput) {
|
|
848
830
|
parse(response)
|
|
849
|
-
success()
|
|
850
831
|
}
|
|
851
832
|
|
|
852
833
|
return response;
|
|
@@ -882,7 +863,6 @@ const usersUpdateMfa = async ({userId,mfa,parseOutput = true, overrideForCli = f
|
|
|
882
863
|
|
|
883
864
|
if (parseOutput) {
|
|
884
865
|
parse(response)
|
|
885
|
-
success()
|
|
886
866
|
}
|
|
887
867
|
|
|
888
868
|
return response;
|
|
@@ -915,7 +895,6 @@ const usersDeleteMfaAuthenticator = async ({userId,type,parseOutput = true, over
|
|
|
915
895
|
|
|
916
896
|
if (parseOutput) {
|
|
917
897
|
parse(response)
|
|
918
|
-
success()
|
|
919
898
|
}
|
|
920
899
|
|
|
921
900
|
return response;
|
|
@@ -947,7 +926,6 @@ const usersListMfaFactors = async ({userId,parseOutput = true, overrideForCli =
|
|
|
947
926
|
|
|
948
927
|
if (parseOutput) {
|
|
949
928
|
parse(response)
|
|
950
|
-
success()
|
|
951
929
|
}
|
|
952
930
|
|
|
953
931
|
return response;
|
|
@@ -979,7 +957,6 @@ const usersGetMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForC
|
|
|
979
957
|
|
|
980
958
|
if (parseOutput) {
|
|
981
959
|
parse(response)
|
|
982
|
-
success()
|
|
983
960
|
}
|
|
984
961
|
|
|
985
962
|
return response;
|
|
@@ -1011,7 +988,6 @@ const usersUpdateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideF
|
|
|
1011
988
|
|
|
1012
989
|
if (parseOutput) {
|
|
1013
990
|
parse(response)
|
|
1014
|
-
success()
|
|
1015
991
|
}
|
|
1016
992
|
|
|
1017
993
|
return response;
|
|
@@ -1043,7 +1019,6 @@ const usersCreateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideF
|
|
|
1043
1019
|
|
|
1044
1020
|
if (parseOutput) {
|
|
1045
1021
|
parse(response)
|
|
1046
|
-
success()
|
|
1047
1022
|
}
|
|
1048
1023
|
|
|
1049
1024
|
return response;
|
|
@@ -1079,7 +1054,6 @@ const usersUpdateName = async ({userId,name,parseOutput = true, overrideForCli =
|
|
|
1079
1054
|
|
|
1080
1055
|
if (parseOutput) {
|
|
1081
1056
|
parse(response)
|
|
1082
|
-
success()
|
|
1083
1057
|
}
|
|
1084
1058
|
|
|
1085
1059
|
return response;
|
|
@@ -1115,7 +1089,6 @@ const usersUpdatePassword = async ({userId,password,parseOutput = true, override
|
|
|
1115
1089
|
|
|
1116
1090
|
if (parseOutput) {
|
|
1117
1091
|
parse(response)
|
|
1118
|
-
success()
|
|
1119
1092
|
}
|
|
1120
1093
|
|
|
1121
1094
|
return response;
|
|
@@ -1151,7 +1124,6 @@ const usersUpdatePhone = async ({userId,number,parseOutput = true, overrideForCl
|
|
|
1151
1124
|
|
|
1152
1125
|
if (parseOutput) {
|
|
1153
1126
|
parse(response)
|
|
1154
|
-
success()
|
|
1155
1127
|
}
|
|
1156
1128
|
|
|
1157
1129
|
return response;
|
|
@@ -1183,7 +1155,6 @@ const usersGetPrefs = async ({userId,parseOutput = true, overrideForCli = false,
|
|
|
1183
1155
|
|
|
1184
1156
|
if (parseOutput) {
|
|
1185
1157
|
parse(response)
|
|
1186
|
-
success()
|
|
1187
1158
|
}
|
|
1188
1159
|
|
|
1189
1160
|
return response;
|
|
@@ -1219,7 +1190,6 @@ const usersUpdatePrefs = async ({userId,prefs,parseOutput = true, overrideForCli
|
|
|
1219
1190
|
|
|
1220
1191
|
if (parseOutput) {
|
|
1221
1192
|
parse(response)
|
|
1222
|
-
success()
|
|
1223
1193
|
}
|
|
1224
1194
|
|
|
1225
1195
|
return response;
|
|
@@ -1254,7 +1224,6 @@ const usersListSessions = async ({userId,parseOutput = true, overrideForCli = fa
|
|
|
1254
1224
|
showConsoleLink('users', 'listSessions', userId);
|
|
1255
1225
|
} else {
|
|
1256
1226
|
parse(response)
|
|
1257
|
-
success()
|
|
1258
1227
|
}
|
|
1259
1228
|
}
|
|
1260
1229
|
|
|
@@ -1287,7 +1256,6 @@ const usersCreateSession = async ({userId,parseOutput = true, overrideForCli = f
|
|
|
1287
1256
|
|
|
1288
1257
|
if (parseOutput) {
|
|
1289
1258
|
parse(response)
|
|
1290
|
-
success()
|
|
1291
1259
|
}
|
|
1292
1260
|
|
|
1293
1261
|
return response;
|
|
@@ -1319,7 +1287,6 @@ const usersDeleteSessions = async ({userId,parseOutput = true, overrideForCli =
|
|
|
1319
1287
|
|
|
1320
1288
|
if (parseOutput) {
|
|
1321
1289
|
parse(response)
|
|
1322
|
-
success()
|
|
1323
1290
|
}
|
|
1324
1291
|
|
|
1325
1292
|
return response;
|
|
@@ -1352,7 +1319,6 @@ const usersDeleteSession = async ({userId,sessionId,parseOutput = true, override
|
|
|
1352
1319
|
|
|
1353
1320
|
if (parseOutput) {
|
|
1354
1321
|
parse(response)
|
|
1355
|
-
success()
|
|
1356
1322
|
}
|
|
1357
1323
|
|
|
1358
1324
|
return response;
|
|
@@ -1388,7 +1354,6 @@ const usersUpdateStatus = async ({userId,status,parseOutput = true, overrideForC
|
|
|
1388
1354
|
|
|
1389
1355
|
if (parseOutput) {
|
|
1390
1356
|
parse(response)
|
|
1391
|
-
success()
|
|
1392
1357
|
}
|
|
1393
1358
|
|
|
1394
1359
|
return response;
|
|
@@ -1424,7 +1389,6 @@ const usersListTargets = async ({userId,queries,parseOutput = true, overrideForC
|
|
|
1424
1389
|
|
|
1425
1390
|
if (parseOutput) {
|
|
1426
1391
|
parse(response)
|
|
1427
|
-
success()
|
|
1428
1392
|
}
|
|
1429
1393
|
|
|
1430
1394
|
return response;
|
|
@@ -1476,7 +1440,6 @@ const usersCreateTarget = async ({userId,targetId,providerType,identifier,provid
|
|
|
1476
1440
|
|
|
1477
1441
|
if (parseOutput) {
|
|
1478
1442
|
parse(response)
|
|
1479
|
-
success()
|
|
1480
1443
|
}
|
|
1481
1444
|
|
|
1482
1445
|
return response;
|
|
@@ -1509,7 +1472,6 @@ const usersGetTarget = async ({userId,targetId,parseOutput = true, overrideForCl
|
|
|
1509
1472
|
|
|
1510
1473
|
if (parseOutput) {
|
|
1511
1474
|
parse(response)
|
|
1512
|
-
success()
|
|
1513
1475
|
}
|
|
1514
1476
|
|
|
1515
1477
|
return response;
|
|
@@ -1554,7 +1516,6 @@ const usersUpdateTarget = async ({userId,targetId,identifier,providerId,name,par
|
|
|
1554
1516
|
|
|
1555
1517
|
if (parseOutput) {
|
|
1556
1518
|
parse(response)
|
|
1557
|
-
success()
|
|
1558
1519
|
}
|
|
1559
1520
|
|
|
1560
1521
|
return response;
|
|
@@ -1587,7 +1548,6 @@ const usersDeleteTarget = async ({userId,targetId,parseOutput = true, overrideFo
|
|
|
1587
1548
|
|
|
1588
1549
|
if (parseOutput) {
|
|
1589
1550
|
parse(response)
|
|
1590
|
-
success()
|
|
1591
1551
|
}
|
|
1592
1552
|
|
|
1593
1553
|
return response;
|
|
@@ -1627,7 +1587,6 @@ const usersCreateToken = async ({userId,length,expire,parseOutput = true, overri
|
|
|
1627
1587
|
|
|
1628
1588
|
if (parseOutput) {
|
|
1629
1589
|
parse(response)
|
|
1630
|
-
success()
|
|
1631
1590
|
}
|
|
1632
1591
|
|
|
1633
1592
|
return response;
|
|
@@ -1663,7 +1622,6 @@ const usersUpdateEmailVerification = async ({userId,emailVerification,parseOutpu
|
|
|
1663
1622
|
|
|
1664
1623
|
if (parseOutput) {
|
|
1665
1624
|
parse(response)
|
|
1666
|
-
success()
|
|
1667
1625
|
}
|
|
1668
1626
|
|
|
1669
1627
|
return response;
|
|
@@ -1699,7 +1657,6 @@ const usersUpdatePhoneVerification = async ({userId,phoneVerification,parseOutpu
|
|
|
1699
1657
|
|
|
1700
1658
|
if (parseOutput) {
|
|
1701
1659
|
parse(response)
|
|
1702
|
-
success()
|
|
1703
1660
|
}
|
|
1704
1661
|
|
|
1705
1662
|
return response;
|
package/lib/commands/vcs.js
CHANGED
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const vcs = new Command("vcs").description(commandDescriptions['vcs']).configureHelp({
|
|
38
|
+
const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -68,7 +68,6 @@ const vcsListRepositories = async ({installationId,search,parseOutput = true, ov
|
|
|
68
68
|
|
|
69
69
|
if (parseOutput) {
|
|
70
70
|
parse(response)
|
|
71
|
-
success()
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
return response;
|
|
@@ -108,7 +107,6 @@ const vcsCreateRepository = async ({installationId,name,xprivate,parseOutput = t
|
|
|
108
107
|
|
|
109
108
|
if (parseOutput) {
|
|
110
109
|
parse(response)
|
|
111
|
-
success()
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
return response;
|
|
@@ -141,7 +139,6 @@ const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput
|
|
|
141
139
|
|
|
142
140
|
if (parseOutput) {
|
|
143
141
|
parse(response)
|
|
144
|
-
success()
|
|
145
142
|
}
|
|
146
143
|
|
|
147
144
|
return response;
|
|
@@ -174,7 +171,6 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa
|
|
|
174
171
|
|
|
175
172
|
if (parseOutput) {
|
|
176
173
|
parse(response)
|
|
177
|
-
success()
|
|
178
174
|
}
|
|
179
175
|
|
|
180
176
|
return response;
|
|
@@ -211,7 +207,6 @@ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,pro
|
|
|
211
207
|
|
|
212
208
|
if (parseOutput) {
|
|
213
209
|
parse(response)
|
|
214
|
-
success()
|
|
215
210
|
}
|
|
216
211
|
|
|
217
212
|
return response;
|
|
@@ -248,7 +243,6 @@ const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId
|
|
|
248
243
|
|
|
249
244
|
if (parseOutput) {
|
|
250
245
|
parse(response)
|
|
251
|
-
success()
|
|
252
246
|
}
|
|
253
247
|
|
|
254
248
|
return response;
|
|
@@ -285,7 +279,6 @@ const vcsUpdateExternalDeployments = async ({installationId,repositoryId,provide
|
|
|
285
279
|
|
|
286
280
|
if (parseOutput) {
|
|
287
281
|
parse(response)
|
|
288
|
-
success()
|
|
289
282
|
}
|
|
290
283
|
|
|
291
284
|
return response;
|
|
@@ -324,7 +317,6 @@ const vcsListInstallations = async ({queries,search,parseOutput = true, override
|
|
|
324
317
|
|
|
325
318
|
if (parseOutput) {
|
|
326
319
|
parse(response)
|
|
327
|
-
success()
|
|
328
320
|
}
|
|
329
321
|
|
|
330
322
|
return response;
|
|
@@ -356,7 +348,6 @@ const vcsGetInstallation = async ({installationId,parseOutput = true, overrideFo
|
|
|
356
348
|
|
|
357
349
|
if (parseOutput) {
|
|
358
350
|
parse(response)
|
|
359
|
-
success()
|
|
360
351
|
}
|
|
361
352
|
|
|
362
353
|
return response;
|
|
@@ -388,7 +379,6 @@ const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrid
|
|
|
388
379
|
|
|
389
380
|
if (parseOutput) {
|
|
390
381
|
parse(response)
|
|
391
|
-
success()
|
|
392
382
|
}
|
|
393
383
|
|
|
394
384
|
return response;
|
package/lib/config.js
CHANGED
|
@@ -4,7 +4,8 @@ const _path = require("path");
|
|
|
4
4
|
const process = require("process");
|
|
5
5
|
const JSONbig = require("json-bigint")({ storeAsString: false });
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const KeysVars = new Set(["key", "value"]);
|
|
8
|
+
const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logging", "runtime", "scopes", "events", "schedule", "timeout", "entrypoint", "commands", "vars"]);
|
|
8
9
|
const KeysDatabase = new Set(["$id", "name", "enabled"]);
|
|
9
10
|
const KeysCollection = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "documentSecurity", "attributes", "indexes"]);
|
|
10
11
|
const KeysStorage = new Set(["$id", "$permissions", "fileSecurity", "name", "enabled", "maximumFileSize", "allowedFileExtensions", "compression", "encryption", "antivirus"]);
|
|
@@ -38,10 +39,10 @@ const KeysAttributes = new Set([
|
|
|
38
39
|
const KeyIndexes = new Set(["key", "type", "status", "attributes", "orders"]);
|
|
39
40
|
|
|
40
41
|
function whitelistKeys(value, keys, nestedKeys = {}) {
|
|
41
|
-
if(Array.isArray(value)) {
|
|
42
|
+
if (Array.isArray(value)) {
|
|
42
43
|
const newValue = [];
|
|
43
44
|
|
|
44
|
-
for(const item of value) {
|
|
45
|
+
for (const item of value) {
|
|
45
46
|
newValue.push(whitelistKeys(item, keys, nestedKeys));
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -50,8 +51,8 @@ function whitelistKeys(value, keys, nestedKeys = {}) {
|
|
|
50
51
|
|
|
51
52
|
const newValue = {};
|
|
52
53
|
Object.keys(value).forEach((key) => {
|
|
53
|
-
if(keys.has(key)) {
|
|
54
|
-
if(nestedKeys[key]) {
|
|
54
|
+
if (keys.has(key)) {
|
|
55
|
+
if (nestedKeys[key]) {
|
|
55
56
|
newValue[key] = whitelistKeys(value[key], nestedKeys[key]);
|
|
56
57
|
} else {
|
|
57
58
|
newValue[key] = value[key];
|
|
@@ -151,7 +152,9 @@ class Local extends Config {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
addFunction(props) {
|
|
154
|
-
props = whitelistKeys(props, KeysFunction
|
|
155
|
+
props = whitelistKeys(props, KeysFunction, {
|
|
156
|
+
vars: KeysVars
|
|
157
|
+
});
|
|
155
158
|
|
|
156
159
|
if (!this.has("functions")) {
|
|
157
160
|
this.set("functions", []);
|
|
@@ -403,7 +406,7 @@ class Local extends Config {
|
|
|
403
406
|
return;
|
|
404
407
|
}
|
|
405
408
|
|
|
406
|
-
this.set('settings', this.createSettingsObject(
|
|
409
|
+
this.set('settings', this.createSettingsObject(projectSettings));
|
|
407
410
|
}
|
|
408
411
|
|
|
409
412
|
createSettingsObject(projectSettings) {
|
|
@@ -615,5 +618,6 @@ module.exports = {
|
|
|
615
618
|
KeysTopics,
|
|
616
619
|
KeysStorage,
|
|
617
620
|
KeysTeams,
|
|
621
|
+
KeysCollection,
|
|
618
622
|
whitelistKeys
|
|
619
623
|
};
|
package/lib/emulation/docker.js
CHANGED
|
@@ -79,7 +79,6 @@ async function dockerBuild(func, variables) {
|
|
|
79
79
|
const params = [ 'run' ];
|
|
80
80
|
params.push('--name', id);
|
|
81
81
|
params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`);
|
|
82
|
-
params.push('-e', 'APPWRITE_ENV=development');
|
|
83
82
|
params.push('-e', 'OPEN_RUNTIMES_ENV=development');
|
|
84
83
|
params.push('-e', 'OPEN_RUNTIMES_SECRET=');
|
|
85
84
|
params.push('-e', `OPEN_RUNTIMES_ENTRYPOINT=${func.entrypoint}`);
|
|
@@ -169,7 +168,6 @@ async function dockerStart(func, variables, port) {
|
|
|
169
168
|
params.push('--rm');
|
|
170
169
|
params.push('--name', id);
|
|
171
170
|
params.push('-p', `${port}:3000`);
|
|
172
|
-
params.push('-e', 'APPWRITE_ENV=development');
|
|
173
171
|
params.push('-e', 'OPEN_RUNTIMES_ENV=development');
|
|
174
172
|
params.push('-e', 'OPEN_RUNTIMES_SECRET=');
|
|
175
173
|
|
|
@@ -254,7 +252,7 @@ function waitUntilPortOpen(port, iteration = 0) {
|
|
|
254
252
|
});
|
|
255
253
|
|
|
256
254
|
client.connect({port, host: '127.0.0.1'}, function() {});
|
|
257
|
-
});
|
|
255
|
+
});
|
|
258
256
|
}
|
|
259
257
|
|
|
260
258
|
module.exports = {
|
package/lib/paginate.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
const paginate = async (action, args = {}, limit = 100, wrapper = '') => {
|
|
1
|
+
const paginate = async (action, args = {}, limit = 100, wrapper = '', queries = []) => {
|
|
2
2
|
let pageNumber = 0;
|
|
3
3
|
let results = [];
|
|
4
4
|
let total = 0;
|
|
5
5
|
|
|
6
6
|
while (true) {
|
|
7
7
|
const offset = pageNumber * limit;
|
|
8
|
+
|
|
8
9
|
// Merge the limit and offset into the args
|
|
9
10
|
const response = await action({
|
|
10
11
|
...args,
|
|
11
12
|
queries: [
|
|
13
|
+
...queries,
|
|
12
14
|
JSON.stringify({ method: 'limit', values: [limit] }),
|
|
13
15
|
JSON.stringify({ method: 'offset', values: [offset] })
|
|
14
16
|
]
|
package/lib/parser.js
CHANGED
|
@@ -120,7 +120,7 @@ const parseError = (err) => {
|
|
|
120
120
|
} catch {
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const version = '6.0.0-rc.
|
|
123
|
+
const version = '6.0.0-rc.7';
|
|
124
124
|
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
|
|
125
125
|
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
|
|
126
126
|
|
|
@@ -203,29 +203,26 @@ const commandDescriptions = {
|
|
|
203
203
|
"account": `The account command allows you to authenticate and manage a user account.`,
|
|
204
204
|
"graphql": `The graphql command allows you to query and mutate any resource type on your Appwrite server.`,
|
|
205
205
|
"avatars": `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`,
|
|
206
|
-
"databases": `The databases command allows you to create structured collections of documents
|
|
207
|
-
"init": `The init command provides a convenient wrapper for creating and initializing
|
|
208
|
-
"push": `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams and messaging.`,
|
|
209
|
-
"run": `The run command allows you to run project locally to allow easy development and quick debugging.`,
|
|
210
|
-
"functions": `The functions command allows you view, create and manage your Cloud Functions.`,
|
|
206
|
+
"databases": `The databases command allows you to create structured collections of documents and query and filter lists of documents.`,
|
|
207
|
+
"init": `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in Appwrite.`,
|
|
208
|
+
"push": `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and messaging-topics.`,
|
|
209
|
+
"run": `The run command allows you to run the project locally to allow easy development and quick debugging.`,
|
|
210
|
+
"functions": `The functions command allows you to view, create, and manage your Cloud Functions.`,
|
|
211
211
|
"health": `The health command allows you to both validate and monitor your Appwrite server's health.`,
|
|
212
|
-
"pull": `The pull command helps you pull your Appwrite project, functions, collections, buckets, teams and messaging`,
|
|
212
|
+
"pull": `The pull command helps you pull your Appwrite project, functions, collections, buckets, teams, and messaging-topics`,
|
|
213
213
|
"locale": `The locale command allows you to customize your app based on your users' location.`,
|
|
214
|
-
"projects": `The projects command allows you to view, create and manage your Appwrite projects.`,
|
|
215
214
|
"storage": `The storage command allows you to manage your project files.`,
|
|
216
|
-
"teams": `The teams command allows you to group users of your project
|
|
215
|
+
"teams": `The teams command allows you to group users of your project to enable them to share read and write access to your project resources.`,
|
|
217
216
|
"users": `The users command allows you to manage your project users.`,
|
|
218
217
|
"client": `The client command allows you to configure your CLI`,
|
|
219
218
|
"login": `The login command allows you to authenticate and manage a user account.`,
|
|
220
|
-
"logout": `The logout command allows you to
|
|
221
|
-
"whoami": `The
|
|
219
|
+
"logout": `The logout command allows you to log out of your Appwrite account.`,
|
|
220
|
+
"whoami": `The whomai command gives information about the currently logged-in user.`,
|
|
222
221
|
"register": `Outputs the link to create an Appwrite account.`,
|
|
223
|
-
"console" : `The console command
|
|
222
|
+
"console" : `The console command gives you access to the APIs used by the Appwrite Console.`,
|
|
224
223
|
"assistant": `The assistant command allows you to interact with the Appwrite Assistant AI`,
|
|
225
|
-
"messaging": `The messaging command allows you to send messages.`,
|
|
224
|
+
"messaging": `The messaging command allows you to manage topics and targets and send messages.`,
|
|
226
225
|
"migrations": `The migrations command allows you to migrate data between services.`,
|
|
227
|
-
"project": `The project command is for overall project administration.`,
|
|
228
|
-
"proxy": `The proxy command allows you to configure behavior for your attached domains.`,
|
|
229
226
|
"vcs": `The vcs command allows you to interact with VCS providers and manage your code repositories.`,
|
|
230
227
|
"main": chalk.redBright(`${logo}${description}`),
|
|
231
228
|
}
|
package/lib/questions.js
CHANGED
|
@@ -189,11 +189,11 @@ const questionsInitProject = [
|
|
|
189
189
|
message: "Choose your Appwrite project.",
|
|
190
190
|
choices: async (answers) => {
|
|
191
191
|
const queries = [
|
|
192
|
-
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization
|
|
193
|
-
JSON.stringify({ method: 'orderDesc', attribute: '
|
|
192
|
+
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }),
|
|
193
|
+
JSON.stringify({ method: 'orderDesc', attribute: '$id' })
|
|
194
194
|
]
|
|
195
195
|
|
|
196
|
-
const { projects } = await paginate(projectsList, { parseOutput: false
|
|
196
|
+
const { projects } = await paginate(projectsList, { parseOutput: false }, 100, 'projects', queries);
|
|
197
197
|
|
|
198
198
|
let choices = projects.map((project) => {
|
|
199
199
|
return {
|
|
@@ -301,22 +301,7 @@ const questionsCreateFunction = [
|
|
|
301
301
|
})
|
|
302
302
|
return choices;
|
|
303
303
|
},
|
|
304
|
-
}
|
|
305
|
-
{
|
|
306
|
-
type: "list",
|
|
307
|
-
name: "template",
|
|
308
|
-
message: "How would you like to start your function code?",
|
|
309
|
-
choices: [
|
|
310
|
-
{
|
|
311
|
-
name: `Start from scratch ${chalk.blackBright(`(starter)`)}`,
|
|
312
|
-
value: "starter"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
name: "Pick a template",
|
|
316
|
-
value: "custom"
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
|
-
},
|
|
304
|
+
}
|
|
320
305
|
];
|
|
321
306
|
|
|
322
307
|
const questionsCreateFunctionSelectTemplate = (templates) => {
|
|
@@ -646,11 +631,6 @@ const questionsPushFunctions = [
|
|
|
646
631
|
return choices;
|
|
647
632
|
}
|
|
648
633
|
},
|
|
649
|
-
{
|
|
650
|
-
type: "input",
|
|
651
|
-
name: "override",
|
|
652
|
-
message: 'Are you sure you want to override this function\'s variables? This can lead to loss of secrets! Type "YES" to confirm.'
|
|
653
|
-
},
|
|
654
634
|
]
|
|
655
635
|
|
|
656
636
|
const questionsPushCollections = [
|
|
@@ -678,7 +658,15 @@ const questionPushChanges = [
|
|
|
678
658
|
{
|
|
679
659
|
type: "input",
|
|
680
660
|
name: "changes",
|
|
681
|
-
message: `
|
|
661
|
+
message: `Are you sure you want to apply these changes? (YES/NO)`
|
|
662
|
+
}
|
|
663
|
+
];
|
|
664
|
+
|
|
665
|
+
const questionPushChangesConfirmation = [
|
|
666
|
+
{
|
|
667
|
+
type: "input",
|
|
668
|
+
name: "changes",
|
|
669
|
+
message: `Please type 'YES' or 'NO':`
|
|
682
670
|
}
|
|
683
671
|
];
|
|
684
672
|
|
|
@@ -708,6 +696,7 @@ const questionsPushMessagingTopics = [
|
|
|
708
696
|
type: "checkbox",
|
|
709
697
|
name: "topics",
|
|
710
698
|
message: "Which messaging topic would you like to push?",
|
|
699
|
+
validate: (value) => validateRequired('topics', value),
|
|
711
700
|
when: () => localConfig.getMessagingTopics().length > 0,
|
|
712
701
|
choices: () => {
|
|
713
702
|
let topics = localConfig.getMessagingTopics();
|
|
@@ -719,11 +708,6 @@ const questionsPushMessagingTopics = [
|
|
|
719
708
|
}
|
|
720
709
|
});
|
|
721
710
|
}
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
type: "input",
|
|
725
|
-
name: "override",
|
|
726
|
-
message: 'Would you like to override existing topics? This can lead to loss of data! Type "YES" to confirm.'
|
|
727
711
|
}
|
|
728
712
|
]
|
|
729
713
|
|
|
@@ -862,5 +846,6 @@ module.exports = {
|
|
|
862
846
|
questionGetEndpoint,
|
|
863
847
|
questionsInitResources,
|
|
864
848
|
questionsCreateTeam,
|
|
865
|
-
questionPushChanges
|
|
849
|
+
questionPushChanges,
|
|
850
|
+
questionPushChangesConfirmation
|
|
866
851
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "6.0.0-rc.
|
|
5
|
+
"version": "6.0.0-rc.7",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"ignore": "^5.2.0",
|
|
36
36
|
"chokidar": "^3.6.0",
|
|
37
37
|
"tail": "^2.2.6",
|
|
38
|
-
"dotenv": "^16.
|
|
38
|
+
"dotenv": "^16.4.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"pkg": "5.8.1"
|