appwrite-cli 6.0.0-rc.6 → 6.0.0-rc.9
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/create.md +1 -0
- 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-specifications.md +1 -0
- package/docs/examples/functions/list-templates.md +5 -0
- package/docs/examples/functions/update.md +1 -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 +182 -45
- 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 +14 -24
- 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 +81 -41
- package/lib/commands/push.js +134 -60
- 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 +28 -8
- 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
|
@@ -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
|
|
|
@@ -104,7 +103,8 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli
|
|
|
104
103
|
* @property {string} templateRepository Repository name of the template.
|
|
105
104
|
* @property {string} templateOwner The name of the owner of the template.
|
|
106
105
|
* @property {string} templateRootDirectory Path to function code in the template repo.
|
|
107
|
-
* @property {string}
|
|
106
|
+
* @property {string} templateVersion Version (tag) for the repo linked to the function template.
|
|
107
|
+
* @property {string} specification Runtime specification for the function and builds.
|
|
108
108
|
* @property {boolean} overrideForCli
|
|
109
109
|
* @property {boolean} parseOutput
|
|
110
110
|
* @property {libClient | undefined} sdk
|
|
@@ -113,7 +113,7 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli
|
|
|
113
113
|
/**
|
|
114
114
|
* @param {FunctionsCreateRequestParams} params
|
|
115
115
|
*/
|
|
116
|
-
const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,templateRepository,templateOwner,templateRootDirectory,
|
|
116
|
+
const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,templateRepository,templateOwner,templateRootDirectory,templateVersion,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
117
117
|
let client = !sdk ? await sdkForProject() :
|
|
118
118
|
sdk;
|
|
119
119
|
let apiPath = '/functions';
|
|
@@ -181,8 +181,11 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
181
181
|
if (typeof templateRootDirectory !== 'undefined') {
|
|
182
182
|
payload['templateRootDirectory'] = templateRootDirectory;
|
|
183
183
|
}
|
|
184
|
-
if (typeof
|
|
185
|
-
payload['
|
|
184
|
+
if (typeof templateVersion !== 'undefined') {
|
|
185
|
+
payload['templateVersion'] = templateVersion;
|
|
186
|
+
}
|
|
187
|
+
if (typeof specification !== 'undefined') {
|
|
188
|
+
payload['specification'] = specification;
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
let response = undefined;
|
|
@@ -193,7 +196,6 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
193
196
|
|
|
194
197
|
if (parseOutput) {
|
|
195
198
|
parse(response)
|
|
196
|
-
success()
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
return response;
|
|
@@ -224,7 +226,125 @@ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false
|
|
|
224
226
|
|
|
225
227
|
if (parseOutput) {
|
|
226
228
|
parse(response)
|
|
227
|
-
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return response;
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @typedef {Object} FunctionsListSpecificationsRequestParams
|
|
237
|
+
* @property {boolean} overrideForCli
|
|
238
|
+
* @property {boolean} parseOutput
|
|
239
|
+
* @property {libClient | undefined} sdk
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {FunctionsListSpecificationsRequestParams} params
|
|
244
|
+
*/
|
|
245
|
+
const functionsListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
246
|
+
let client = !sdk ? await sdkForProject() :
|
|
247
|
+
sdk;
|
|
248
|
+
let apiPath = '/functions/specifications';
|
|
249
|
+
let payload = {};
|
|
250
|
+
|
|
251
|
+
let response = undefined;
|
|
252
|
+
|
|
253
|
+
response = await client.call('get', apiPath, {
|
|
254
|
+
'content-type': 'application/json',
|
|
255
|
+
}, payload);
|
|
256
|
+
|
|
257
|
+
if (parseOutput) {
|
|
258
|
+
if(console) {
|
|
259
|
+
showConsoleLink('functions', 'listSpecifications');
|
|
260
|
+
} else {
|
|
261
|
+
parse(response)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return response;
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @typedef {Object} FunctionsListTemplatesRequestParams
|
|
271
|
+
* @property {string[]} runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.
|
|
272
|
+
* @property {string[]} useCases List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.
|
|
273
|
+
* @property {number} limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.
|
|
274
|
+
* @property {number} offset Offset the list of returned templates. Maximum offset is 5000.
|
|
275
|
+
* @property {boolean} overrideForCli
|
|
276
|
+
* @property {boolean} parseOutput
|
|
277
|
+
* @property {libClient | undefined} sdk
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @param {FunctionsListTemplatesRequestParams} params
|
|
282
|
+
*/
|
|
283
|
+
const functionsListTemplates = async ({runtimes,useCases,limit,offset,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
284
|
+
let client = !sdk ? await sdkForProject() :
|
|
285
|
+
sdk;
|
|
286
|
+
let apiPath = '/functions/templates';
|
|
287
|
+
let payload = {};
|
|
288
|
+
if (typeof runtimes !== 'undefined') {
|
|
289
|
+
payload['runtimes'] = runtimes;
|
|
290
|
+
}
|
|
291
|
+
if (typeof useCases !== 'undefined') {
|
|
292
|
+
payload['useCases'] = useCases;
|
|
293
|
+
}
|
|
294
|
+
if (typeof limit !== 'undefined') {
|
|
295
|
+
payload['limit'] = limit;
|
|
296
|
+
}
|
|
297
|
+
if (typeof offset !== 'undefined') {
|
|
298
|
+
payload['offset'] = offset;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let response = undefined;
|
|
302
|
+
|
|
303
|
+
response = await client.call('get', apiPath, {
|
|
304
|
+
'content-type': 'application/json',
|
|
305
|
+
}, payload);
|
|
306
|
+
|
|
307
|
+
if (parseOutput) {
|
|
308
|
+
if(console) {
|
|
309
|
+
showConsoleLink('functions', 'listTemplates');
|
|
310
|
+
} else {
|
|
311
|
+
parse(response)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return response;
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @typedef {Object} FunctionsGetTemplateRequestParams
|
|
321
|
+
* @property {string} templateId Template ID.
|
|
322
|
+
* @property {boolean} overrideForCli
|
|
323
|
+
* @property {boolean} parseOutput
|
|
324
|
+
* @property {libClient | undefined} sdk
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @param {FunctionsGetTemplateRequestParams} params
|
|
329
|
+
*/
|
|
330
|
+
const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
331
|
+
let client = !sdk ? await sdkForProject() :
|
|
332
|
+
sdk;
|
|
333
|
+
let apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
|
|
334
|
+
let payload = {};
|
|
335
|
+
|
|
336
|
+
let response = undefined;
|
|
337
|
+
|
|
338
|
+
response = await client.call('get', apiPath, {
|
|
339
|
+
'content-type': 'application/json',
|
|
340
|
+
}, payload);
|
|
341
|
+
|
|
342
|
+
if (parseOutput) {
|
|
343
|
+
if(console) {
|
|
344
|
+
showConsoleLink('functions', 'getTemplate', templateId);
|
|
345
|
+
} else {
|
|
346
|
+
parse(response)
|
|
347
|
+
}
|
|
228
348
|
}
|
|
229
349
|
|
|
230
350
|
return response;
|
|
@@ -259,7 +379,6 @@ const functionsGetUsage = async ({range,parseOutput = true, overrideForCli = fal
|
|
|
259
379
|
|
|
260
380
|
if (parseOutput) {
|
|
261
381
|
parse(response)
|
|
262
|
-
success()
|
|
263
382
|
}
|
|
264
383
|
|
|
265
384
|
return response;
|
|
@@ -294,7 +413,6 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
294
413
|
showConsoleLink('functions', 'get', functionId);
|
|
295
414
|
} else {
|
|
296
415
|
parse(response)
|
|
297
|
-
success()
|
|
298
416
|
}
|
|
299
417
|
}
|
|
300
418
|
|
|
@@ -321,6 +439,7 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
321
439
|
* @property {string} providerBranch Production branch for the repo linked to the function
|
|
322
440
|
* @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.
|
|
323
441
|
* @property {string} providerRootDirectory Path to function code in the linked repo.
|
|
442
|
+
* @property {string} specification Runtime specification for the function and builds.
|
|
324
443
|
* @property {boolean} overrideForCli
|
|
325
444
|
* @property {boolean} parseOutput
|
|
326
445
|
* @property {libClient | undefined} sdk
|
|
@@ -329,7 +448,7 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
329
448
|
/**
|
|
330
449
|
* @param {FunctionsUpdateRequestParams} params
|
|
331
450
|
*/
|
|
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}) => {
|
|
451
|
+
const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
333
452
|
let client = !sdk ? await sdkForProject() :
|
|
334
453
|
sdk;
|
|
335
454
|
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
@@ -385,6 +504,9 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
385
504
|
if (typeof providerRootDirectory !== 'undefined') {
|
|
386
505
|
payload['providerRootDirectory'] = providerRootDirectory;
|
|
387
506
|
}
|
|
507
|
+
if (typeof specification !== 'undefined') {
|
|
508
|
+
payload['specification'] = specification;
|
|
509
|
+
}
|
|
388
510
|
|
|
389
511
|
let response = undefined;
|
|
390
512
|
|
|
@@ -394,7 +516,6 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
394
516
|
|
|
395
517
|
if (parseOutput) {
|
|
396
518
|
parse(response)
|
|
397
|
-
success()
|
|
398
519
|
}
|
|
399
520
|
|
|
400
521
|
return response;
|
|
@@ -426,7 +547,6 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli =
|
|
|
426
547
|
|
|
427
548
|
if (parseOutput) {
|
|
428
549
|
parse(response)
|
|
429
|
-
success()
|
|
430
550
|
}
|
|
431
551
|
|
|
432
552
|
return response;
|
|
@@ -436,7 +556,7 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli =
|
|
|
436
556
|
/**
|
|
437
557
|
* @typedef {Object} FunctionsListDeploymentsRequestParams
|
|
438
558
|
* @property {string} functionId Function ID.
|
|
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
|
|
559
|
+
* @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, type, size
|
|
440
560
|
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
441
561
|
* @property {boolean} overrideForCli
|
|
442
562
|
* @property {boolean} parseOutput
|
|
@@ -469,7 +589,6 @@ const functionsListDeployments = async ({functionId,queries,search,parseOutput =
|
|
|
469
589
|
showConsoleLink('functions', 'listDeployments', functionId);
|
|
470
590
|
} else {
|
|
471
591
|
parse(response)
|
|
472
|
-
success()
|
|
473
592
|
}
|
|
474
593
|
}
|
|
475
594
|
|
|
@@ -523,15 +642,17 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co
|
|
|
523
642
|
|
|
524
643
|
const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
|
|
525
644
|
|
|
645
|
+
const archiveFileName = `${functionId}-code.tar.gz`;
|
|
646
|
+
|
|
526
647
|
await tar
|
|
527
648
|
.create({
|
|
528
649
|
gzip: true,
|
|
529
650
|
sync: true,
|
|
530
651
|
cwd: folderPath,
|
|
531
|
-
file:
|
|
652
|
+
file: archiveFileName
|
|
532
653
|
}, files);
|
|
533
654
|
|
|
534
|
-
let archivePath = fs.realpathSync(
|
|
655
|
+
let archivePath = fs.realpathSync(archiveFileName)
|
|
535
656
|
if (typeof archivePath !== 'undefined') {
|
|
536
657
|
payload['code'] = archivePath;
|
|
537
658
|
code = archivePath;
|
|
@@ -634,7 +755,6 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co
|
|
|
634
755
|
|
|
635
756
|
if (parseOutput) {
|
|
636
757
|
parse(response)
|
|
637
|
-
success()
|
|
638
758
|
}
|
|
639
759
|
|
|
640
760
|
return response;
|
|
@@ -669,7 +789,6 @@ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = tru
|
|
|
669
789
|
showConsoleLink('functions', 'getDeployment', functionId, deploymentId);
|
|
670
790
|
} else {
|
|
671
791
|
parse(response)
|
|
672
|
-
success()
|
|
673
792
|
}
|
|
674
793
|
}
|
|
675
794
|
|
|
@@ -703,7 +822,6 @@ const functionsUpdateDeployment = async ({functionId,deploymentId,parseOutput =
|
|
|
703
822
|
|
|
704
823
|
if (parseOutput) {
|
|
705
824
|
parse(response)
|
|
706
|
-
success()
|
|
707
825
|
}
|
|
708
826
|
|
|
709
827
|
return response;
|
|
@@ -736,7 +854,6 @@ const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput =
|
|
|
736
854
|
|
|
737
855
|
if (parseOutput) {
|
|
738
856
|
parse(response)
|
|
739
|
-
success()
|
|
740
857
|
}
|
|
741
858
|
|
|
742
859
|
return response;
|
|
@@ -773,7 +890,6 @@ const functionsCreateBuild = async ({functionId,deploymentId,buildId,parseOutput
|
|
|
773
890
|
|
|
774
891
|
if (parseOutput) {
|
|
775
892
|
parse(response)
|
|
776
|
-
success()
|
|
777
893
|
}
|
|
778
894
|
|
|
779
895
|
return response;
|
|
@@ -806,7 +922,6 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
806
922
|
|
|
807
923
|
if (parseOutput) {
|
|
808
924
|
parse(response)
|
|
809
|
-
success()
|
|
810
925
|
}
|
|
811
926
|
|
|
812
927
|
return response;
|
|
@@ -814,7 +929,7 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
814
929
|
}
|
|
815
930
|
|
|
816
931
|
/**
|
|
817
|
-
* @typedef {Object}
|
|
932
|
+
* @typedef {Object} FunctionsGetDeploymentDownloadRequestParams
|
|
818
933
|
* @property {string} functionId Function ID.
|
|
819
934
|
* @property {string} deploymentId Deployment ID.
|
|
820
935
|
* @property {boolean} overrideForCli
|
|
@@ -824,9 +939,9 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp
|
|
|
824
939
|
*/
|
|
825
940
|
|
|
826
941
|
/**
|
|
827
|
-
* @param {
|
|
942
|
+
* @param {FunctionsGetDeploymentDownloadRequestParams} params
|
|
828
943
|
*/
|
|
829
|
-
const
|
|
944
|
+
const functionsGetDeploymentDownload = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console}) => {
|
|
830
945
|
let client = !sdk ? await sdkForProject() :
|
|
831
946
|
sdk;
|
|
832
947
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
@@ -850,8 +965,11 @@ const functionsDownloadDeployment = async ({functionId,deploymentId,parseOutput
|
|
|
850
965
|
|
|
851
966
|
fs.writeFileSync(destination, response);
|
|
852
967
|
if (parseOutput) {
|
|
853
|
-
|
|
854
|
-
|
|
968
|
+
if(console) {
|
|
969
|
+
showConsoleLink('functions', 'getDeploymentDownload', functionId, deploymentId);
|
|
970
|
+
} else {
|
|
971
|
+
parse(response)
|
|
972
|
+
}
|
|
855
973
|
}
|
|
856
974
|
|
|
857
975
|
return response;
|
|
@@ -894,7 +1012,6 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput =
|
|
|
894
1012
|
showConsoleLink('functions', 'listExecutions', functionId);
|
|
895
1013
|
} else {
|
|
896
1014
|
parse(response)
|
|
897
|
-
success()
|
|
898
1015
|
}
|
|
899
1016
|
}
|
|
900
1017
|
|
|
@@ -910,7 +1027,7 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput =
|
|
|
910
1027
|
* @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
|
|
911
1028
|
* @property {ExecutionMethod} method HTTP method of execution. Default value is GET.
|
|
912
1029
|
* @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.
|
|
1030
|
+
* @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 with precision in minutes.
|
|
914
1031
|
* @property {boolean} overrideForCli
|
|
915
1032
|
* @property {boolean} parseOutput
|
|
916
1033
|
* @property {libClient | undefined} sdk
|
|
@@ -951,7 +1068,6 @@ const functionsCreateExecution = async ({functionId,body,async,xpath,method,head
|
|
|
951
1068
|
|
|
952
1069
|
if (parseOutput) {
|
|
953
1070
|
parse(response)
|
|
954
|
-
success()
|
|
955
1071
|
}
|
|
956
1072
|
|
|
957
1073
|
return response;
|
|
@@ -987,7 +1103,6 @@ const functionsGetExecution = async ({functionId,executionId,parseOutput = true,
|
|
|
987
1103
|
showConsoleLink('functions', 'getExecution', functionId, executionId);
|
|
988
1104
|
} else {
|
|
989
1105
|
parse(response)
|
|
990
|
-
success()
|
|
991
1106
|
}
|
|
992
1107
|
}
|
|
993
1108
|
|
|
@@ -1021,7 +1136,6 @@ const functionsDeleteExecution = async ({functionId,executionId,parseOutput = tr
|
|
|
1021
1136
|
|
|
1022
1137
|
if (parseOutput) {
|
|
1023
1138
|
parse(response)
|
|
1024
|
-
success()
|
|
1025
1139
|
}
|
|
1026
1140
|
|
|
1027
1141
|
return response;
|
|
@@ -1060,7 +1174,6 @@ const functionsGetFunctionUsage = async ({functionId,range,parseOutput = true, o
|
|
|
1060
1174
|
showConsoleLink('functions', 'getFunctionUsage', functionId);
|
|
1061
1175
|
} else {
|
|
1062
1176
|
parse(response)
|
|
1063
|
-
success()
|
|
1064
1177
|
}
|
|
1065
1178
|
}
|
|
1066
1179
|
|
|
@@ -1093,7 +1206,6 @@ const functionsListVariables = async ({functionId,parseOutput = true, overrideFo
|
|
|
1093
1206
|
|
|
1094
1207
|
if (parseOutput) {
|
|
1095
1208
|
parse(response)
|
|
1096
|
-
success()
|
|
1097
1209
|
}
|
|
1098
1210
|
|
|
1099
1211
|
return response;
|
|
@@ -1133,7 +1245,6 @@ const functionsCreateVariable = async ({functionId,key,value,parseOutput = true,
|
|
|
1133
1245
|
|
|
1134
1246
|
if (parseOutput) {
|
|
1135
1247
|
parse(response)
|
|
1136
|
-
success()
|
|
1137
1248
|
}
|
|
1138
1249
|
|
|
1139
1250
|
return response;
|
|
@@ -1166,7 +1277,6 @@ const functionsGetVariable = async ({functionId,variableId,parseOutput = true, o
|
|
|
1166
1277
|
|
|
1167
1278
|
if (parseOutput) {
|
|
1168
1279
|
parse(response)
|
|
1169
|
-
success()
|
|
1170
1280
|
}
|
|
1171
1281
|
|
|
1172
1282
|
return response;
|
|
@@ -1207,7 +1317,6 @@ const functionsUpdateVariable = async ({functionId,variableId,key,value,parseOut
|
|
|
1207
1317
|
|
|
1208
1318
|
if (parseOutput) {
|
|
1209
1319
|
parse(response)
|
|
1210
|
-
success()
|
|
1211
1320
|
}
|
|
1212
1321
|
|
|
1213
1322
|
return response;
|
|
@@ -1240,7 +1349,6 @@ const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true
|
|
|
1240
1349
|
|
|
1241
1350
|
if (parseOutput) {
|
|
1242
1351
|
parse(response)
|
|
1243
|
-
success()
|
|
1244
1352
|
}
|
|
1245
1353
|
|
|
1246
1354
|
return response;
|
|
@@ -1278,7 +1386,8 @@ functions
|
|
|
1278
1386
|
.option(`--template-repository <template-repository>`, `Repository name of the template.`)
|
|
1279
1387
|
.option(`--template-owner <template-owner>`, `The name of the owner of the template.`)
|
|
1280
1388
|
.option(`--template-root-directory <template-root-directory>`, `Path to function code in the template repo.`)
|
|
1281
|
-
.option(`--template-
|
|
1389
|
+
.option(`--template-version <template-version>`, `Version (tag) for the repo linked to the function template.`)
|
|
1390
|
+
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1282
1391
|
.action(actionRunner(functionsCreate))
|
|
1283
1392
|
|
|
1284
1393
|
functions
|
|
@@ -1286,6 +1395,29 @@ functions
|
|
|
1286
1395
|
.description(`Get a list of all runtimes that are currently active on your instance.`)
|
|
1287
1396
|
.action(actionRunner(functionsListRuntimes))
|
|
1288
1397
|
|
|
1398
|
+
functions
|
|
1399
|
+
.command(`list-specifications`)
|
|
1400
|
+
.description(`List allowed function specifications for this instance. `)
|
|
1401
|
+
.option(`--console`, `Get the resource console url`)
|
|
1402
|
+
.action(actionRunner(functionsListSpecifications))
|
|
1403
|
+
|
|
1404
|
+
functions
|
|
1405
|
+
.command(`list-templates`)
|
|
1406
|
+
.description(`List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1407
|
+
.option(`--runtimes [runtimes...]`, `List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.`)
|
|
1408
|
+
.option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.`)
|
|
1409
|
+
.option(`--limit <limit>`, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger)
|
|
1410
|
+
.option(`--offset <offset>`, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger)
|
|
1411
|
+
.option(`--console`, `Get the resource console url`)
|
|
1412
|
+
.action(actionRunner(functionsListTemplates))
|
|
1413
|
+
|
|
1414
|
+
functions
|
|
1415
|
+
.command(`get-template`)
|
|
1416
|
+
.description(`Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1417
|
+
.requiredOption(`--template-id <template-id>`, `Template ID.`)
|
|
1418
|
+
.option(`--console`, `Get the resource console url`)
|
|
1419
|
+
.action(actionRunner(functionsGetTemplate))
|
|
1420
|
+
|
|
1289
1421
|
functions
|
|
1290
1422
|
.command(`get-usage`)
|
|
1291
1423
|
.description(``)
|
|
@@ -1319,6 +1451,7 @@ functions
|
|
|
1319
1451
|
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`)
|
|
1320
1452
|
.option(`--provider-silent-mode <provider-silent-mode>`, `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.`, parseBool)
|
|
1321
1453
|
.option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
|
|
1454
|
+
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1322
1455
|
.action(actionRunner(functionsUpdate))
|
|
1323
1456
|
|
|
1324
1457
|
functions
|
|
@@ -1331,7 +1464,7 @@ functions
|
|
|
1331
1464
|
.command(`list-deployments`)
|
|
1332
1465
|
.description(`Get a list of all the project's code deployments. You can use the query params to filter your results.`)
|
|
1333
1466
|
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
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`)
|
|
1467
|
+
.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, type, size`)
|
|
1335
1468
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
1336
1469
|
.option(`--console`, `Get the resource console url`)
|
|
1337
1470
|
.action(actionRunner(functionsListDeployments))
|
|
@@ -1384,12 +1517,13 @@ functions
|
|
|
1384
1517
|
.action(actionRunner(functionsUpdateDeploymentBuild))
|
|
1385
1518
|
|
|
1386
1519
|
functions
|
|
1387
|
-
.command(`
|
|
1520
|
+
.command(`get-deployment-download`)
|
|
1388
1521
|
.description(`Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.`)
|
|
1389
1522
|
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1390
1523
|
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1391
1524
|
.requiredOption(`--destination <path>`, `output file path.`)
|
|
1392
|
-
.
|
|
1525
|
+
.option(`--console`, `Get the resource console url`)
|
|
1526
|
+
.action(actionRunner(functionsGetDeploymentDownload))
|
|
1393
1527
|
|
|
1394
1528
|
functions
|
|
1395
1529
|
.command(`list-executions`)
|
|
@@ -1409,7 +1543,7 @@ functions
|
|
|
1409
1543
|
.option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
|
|
1410
1544
|
.option(`--method <method>`, `HTTP method of execution. Default value is GET.`)
|
|
1411
1545
|
.option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
|
|
1412
|
-
.option(`--scheduled-at <scheduled-at>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
|
|
1546
|
+
.option(`--scheduled-at <scheduled-at>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.`)
|
|
1413
1547
|
.action(actionRunner(functionsCreateExecution))
|
|
1414
1548
|
|
|
1415
1549
|
functions
|
|
@@ -1477,6 +1611,9 @@ module.exports = {
|
|
|
1477
1611
|
functionsList,
|
|
1478
1612
|
functionsCreate,
|
|
1479
1613
|
functionsListRuntimes,
|
|
1614
|
+
functionsListSpecifications,
|
|
1615
|
+
functionsListTemplates,
|
|
1616
|
+
functionsGetTemplate,
|
|
1480
1617
|
functionsGetUsage,
|
|
1481
1618
|
functionsGet,
|
|
1482
1619
|
functionsUpdate,
|
|
@@ -1488,7 +1625,7 @@ module.exports = {
|
|
|
1488
1625
|
functionsDeleteDeployment,
|
|
1489
1626
|
functionsCreateBuild,
|
|
1490
1627
|
functionsUpdateDeploymentBuild,
|
|
1491
|
-
|
|
1628
|
+
functionsGetDeploymentDownload,
|
|
1492
1629
|
functionsListExecutions,
|
|
1493
1630
|
functionsCreateExecution,
|
|
1494
1631
|
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;
|