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
package/lib/commands/teams.js
CHANGED
|
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const teams = new Command("teams").description(commandDescriptions['teams']).configureHelp({
|
|
38
|
+
const teams = new Command("teams").description(commandDescriptions['teams'] ?? '').configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -74,7 +74,6 @@ const teamsList = async ({queries,search,parseOutput = true, overrideForCli = fa
|
|
|
74
74
|
showConsoleLink('teams', 'list');
|
|
75
75
|
} else {
|
|
76
76
|
parse(response)
|
|
77
|
-
success()
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -119,7 +118,6 @@ const teamsCreate = async ({teamId,name,roles,parseOutput = true, overrideForCli
|
|
|
119
118
|
|
|
120
119
|
if (parseOutput) {
|
|
121
120
|
parse(response)
|
|
122
|
-
success()
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
return response;
|
|
@@ -154,7 +152,6 @@ const teamsGet = async ({teamId,parseOutput = true, overrideForCli = false, sdk
|
|
|
154
152
|
showConsoleLink('teams', 'get', teamId);
|
|
155
153
|
} else {
|
|
156
154
|
parse(response)
|
|
157
|
-
success()
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
157
|
|
|
@@ -191,7 +188,6 @@ const teamsUpdateName = async ({teamId,name,parseOutput = true, overrideForCli =
|
|
|
191
188
|
|
|
192
189
|
if (parseOutput) {
|
|
193
190
|
parse(response)
|
|
194
|
-
success()
|
|
195
191
|
}
|
|
196
192
|
|
|
197
193
|
return response;
|
|
@@ -223,7 +219,6 @@ const teamsDelete = async ({teamId,parseOutput = true, overrideForCli = false, s
|
|
|
223
219
|
|
|
224
220
|
if (parseOutput) {
|
|
225
221
|
parse(response)
|
|
226
|
-
success()
|
|
227
222
|
}
|
|
228
223
|
|
|
229
224
|
return response;
|
|
@@ -259,7 +254,6 @@ const teamsListLogs = async ({teamId,queries,parseOutput = true, overrideForCli
|
|
|
259
254
|
|
|
260
255
|
if (parseOutput) {
|
|
261
256
|
parse(response)
|
|
262
|
-
success()
|
|
263
257
|
}
|
|
264
258
|
|
|
265
259
|
return response;
|
|
@@ -299,7 +293,6 @@ const teamsListMemberships = async ({teamId,queries,search,parseOutput = true, o
|
|
|
299
293
|
|
|
300
294
|
if (parseOutput) {
|
|
301
295
|
parse(response)
|
|
302
|
-
success()
|
|
303
296
|
}
|
|
304
297
|
|
|
305
298
|
return response;
|
|
@@ -356,7 +349,6 @@ const teamsCreateMembership = async ({teamId,roles,email,userId,phone,url,name,p
|
|
|
356
349
|
|
|
357
350
|
if (parseOutput) {
|
|
358
351
|
parse(response)
|
|
359
|
-
success()
|
|
360
352
|
}
|
|
361
353
|
|
|
362
354
|
return response;
|
|
@@ -389,7 +381,6 @@ const teamsGetMembership = async ({teamId,membershipId,parseOutput = true, overr
|
|
|
389
381
|
|
|
390
382
|
if (parseOutput) {
|
|
391
383
|
parse(response)
|
|
392
|
-
success()
|
|
393
384
|
}
|
|
394
385
|
|
|
395
386
|
return response;
|
|
@@ -427,7 +418,6 @@ const teamsUpdateMembership = async ({teamId,membershipId,roles,parseOutput = tr
|
|
|
427
418
|
|
|
428
419
|
if (parseOutput) {
|
|
429
420
|
parse(response)
|
|
430
|
-
success()
|
|
431
421
|
}
|
|
432
422
|
|
|
433
423
|
return response;
|
|
@@ -460,7 +450,6 @@ const teamsDeleteMembership = async ({teamId,membershipId,parseOutput = true, ov
|
|
|
460
450
|
|
|
461
451
|
if (parseOutput) {
|
|
462
452
|
parse(response)
|
|
463
|
-
success()
|
|
464
453
|
}
|
|
465
454
|
|
|
466
455
|
return response;
|
|
@@ -501,7 +490,6 @@ const teamsUpdateMembershipStatus = async ({teamId,membershipId,userId,secret,pa
|
|
|
501
490
|
|
|
502
491
|
if (parseOutput) {
|
|
503
492
|
parse(response)
|
|
504
|
-
success()
|
|
505
493
|
}
|
|
506
494
|
|
|
507
495
|
return response;
|
|
@@ -533,7 +521,6 @@ const teamsGetPrefs = async ({teamId,parseOutput = true, overrideForCli = false,
|
|
|
533
521
|
|
|
534
522
|
if (parseOutput) {
|
|
535
523
|
parse(response)
|
|
536
|
-
success()
|
|
537
524
|
}
|
|
538
525
|
|
|
539
526
|
return response;
|
|
@@ -569,7 +556,6 @@ const teamsUpdatePrefs = async ({teamId,prefs,parseOutput = true, overrideForCli
|
|
|
569
556
|
|
|
570
557
|
if (parseOutput) {
|
|
571
558
|
parse(response)
|
|
572
|
-
success()
|
|
573
559
|
}
|
|
574
560
|
|
|
575
561
|
return response;
|
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
|
@@ -51,10 +51,34 @@ async function dockerBuild(func, variables) {
|
|
|
51
51
|
|
|
52
52
|
const id = func.$id;
|
|
53
53
|
|
|
54
|
+
const ignorer = ignore();
|
|
55
|
+
ignorer.add('.appwrite');
|
|
56
|
+
if (func.ignore) {
|
|
57
|
+
ignorer.add(func.ignore);
|
|
58
|
+
} else if (fs.existsSync(path.join(functionDir, '.gitignore'))) {
|
|
59
|
+
ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
|
|
63
|
+
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
|
|
64
|
+
if (!fs.existsSync(tmpBuildPath)) {
|
|
65
|
+
fs.mkdirSync(tmpBuildPath, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for(const f of files) {
|
|
69
|
+
const filePath = path.join(tmpBuildPath, f);
|
|
70
|
+
const fileDir = path.dirname(filePath);
|
|
71
|
+
if (!fs.existsSync(fileDir)) {
|
|
72
|
+
fs.mkdirSync(fileDir, { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const sourcePath = path.join(functionDir, f);
|
|
76
|
+
fs.copyFileSync(sourcePath, filePath);
|
|
77
|
+
}
|
|
78
|
+
|
|
54
79
|
const params = [ 'run' ];
|
|
55
80
|
params.push('--name', id);
|
|
56
81
|
params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`);
|
|
57
|
-
params.push('-e', 'APPWRITE_ENV=development');
|
|
58
82
|
params.push('-e', 'OPEN_RUNTIMES_ENV=development');
|
|
59
83
|
params.push('-e', 'OPEN_RUNTIMES_SECRET=');
|
|
60
84
|
params.push('-e', `OPEN_RUNTIMES_ENTRYPOINT=${func.entrypoint}`);
|
|
@@ -131,47 +155,19 @@ async function dockerStart(func, variables, port) {
|
|
|
131
155
|
// Pack function files
|
|
132
156
|
const functionDir = path.join(process.cwd(), func.path);
|
|
133
157
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ignorer.add(func.ignore);
|
|
138
|
-
} else if (fs.existsSync(path.join(functionDir, '.gitignore'))) {
|
|
139
|
-
ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString());
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
|
|
143
|
-
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
|
|
144
|
-
if (!fs.existsSync(tmpBuildPath)) {
|
|
145
|
-
fs.mkdirSync(tmpBuildPath, { recursive: true });
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
for(const f of files) {
|
|
149
|
-
const filePath = path.join(tmpBuildPath, f);
|
|
150
|
-
const fileDir = path.dirname(filePath);
|
|
151
|
-
if (!fs.existsSync(fileDir)) {
|
|
152
|
-
fs.mkdirSync(fileDir, { recursive: true });
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const sourcePath = path.join(functionDir, f);
|
|
156
|
-
fs.copyFileSync(sourcePath, filePath);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const runtimeChunks = func.runtime.split("-");
|
|
160
|
-
const runtimeVersion = runtimeChunks.pop();
|
|
161
|
-
const runtimeName = runtimeChunks.join("-");
|
|
158
|
+
const runtimeChunks = func.runtime.split("-");
|
|
159
|
+
const runtimeVersion = runtimeChunks.pop();
|
|
160
|
+
const runtimeName = runtimeChunks.join("-");
|
|
162
161
|
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
163
162
|
|
|
164
163
|
const tool = systemTools[runtimeName];
|
|
165
164
|
|
|
166
|
-
const functionDir = path.join(process.cwd(), func.path);
|
|
167
|
-
|
|
168
165
|
const id = func.$id;
|
|
169
166
|
|
|
170
167
|
const params = [ 'run' ];
|
|
171
168
|
params.push('--rm');
|
|
172
169
|
params.push('--name', id);
|
|
173
170
|
params.push('-p', `${port}:3000`);
|
|
174
|
-
params.push('-e', 'APPWRITE_ENV=development');
|
|
175
171
|
params.push('-e', 'OPEN_RUNTIMES_ENV=development');
|
|
176
172
|
params.push('-e', 'OPEN_RUNTIMES_SECRET=');
|
|
177
173
|
|
|
@@ -256,7 +252,7 @@ function waitUntilPortOpen(port, iteration = 0) {
|
|
|
256
252
|
});
|
|
257
253
|
|
|
258
254
|
client.connect({port, host: '127.0.0.1'}, function() {});
|
|
259
|
-
});
|
|
255
|
+
});
|
|
260
256
|
}
|
|
261
257
|
|
|
262
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
|
]
|