appwrite-cli 0.16.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -16
- package/docs/examples/account/{create-session.md → create-email-session.md} +1 -1
- package/docs/examples/account/create-phone-session.md +3 -0
- package/docs/examples/account/create-phone-verification.md +1 -0
- package/docs/examples/account/update-phone-session.md +3 -0
- package/docs/examples/account/update-phone-verification.md +3 -0
- package/docs/examples/account/update-phone.md +3 -0
- package/docs/examples/account/update-status.md +1 -0
- package/docs/examples/{database → databases}/create-boolean-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-collection.md +2 -1
- package/docs/examples/{database → databases}/create-document.md +2 -1
- package/docs/examples/{database → databases}/create-email-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-enum-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-float-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-index.md +2 -1
- package/docs/examples/{database → databases}/create-integer-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-ip-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-string-attribute.md +2 -1
- package/docs/examples/{database → databases}/create-url-attribute.md +2 -1
- package/docs/examples/databases/create.md +3 -0
- package/docs/examples/databases/delete-attribute.md +4 -0
- package/docs/examples/databases/delete-collection.md +3 -0
- package/docs/examples/{database → databases}/delete-document.md +2 -1
- package/docs/examples/databases/delete-index.md +4 -0
- package/docs/examples/databases/delete.md +2 -0
- package/docs/examples/databases/get-attribute.md +4 -0
- package/docs/examples/databases/get-collection-usage.md +4 -0
- package/docs/examples/databases/get-collection.md +3 -0
- package/docs/examples/databases/get-database-usage.md +3 -0
- package/docs/examples/{database → databases}/get-document.md +2 -1
- package/docs/examples/databases/get-index.md +4 -0
- package/docs/examples/databases/get-usage.md +2 -0
- package/docs/examples/databases/get.md +2 -0
- package/docs/examples/databases/list-attributes.md +3 -0
- package/docs/examples/databases/list-collection-logs.md +5 -0
- package/docs/examples/databases/list-collections.md +8 -0
- package/docs/examples/{database → databases}/list-document-logs.md +2 -1
- package/docs/examples/databases/list-documents.md +10 -0
- package/docs/examples/databases/list-indexes.md +3 -0
- package/docs/examples/databases/list-logs.md +4 -0
- package/docs/examples/databases/list.md +7 -0
- package/docs/examples/{database → databases}/update-collection.md +2 -1
- package/docs/examples/{database → databases}/update-document.md +3 -2
- package/docs/examples/databases/update.md +3 -0
- package/docs/examples/projects/create-key.md +2 -1
- package/docs/examples/projects/update-key.md +2 -1
- package/docs/examples/projects/update-webhook-signature.md +3 -0
- package/docs/examples/teams/list-logs.md +4 -0
- package/docs/examples/users/get-memberships.md +2 -0
- package/docs/examples/users/{update-verification.md → update-email-verification.md} +1 -1
- package/docs/examples/users/update-phone-verification.md +3 -0
- package/docs/examples/users/update-phone.md +3 -0
- package/index.js +2 -2
- package/install.ps1 +9 -5
- package/install.sh +1 -1
- package/lib/client.js +6 -7
- package/lib/commands/account.js +230 -56
- package/lib/commands/avatars.js +12 -9
- package/lib/commands/{database.js → databases.js} +484 -181
- package/lib/commands/deploy.js +156 -73
- package/lib/commands/functions.js +26 -9
- package/lib/commands/generic.js +13 -6
- package/lib/commands/health.js +3 -23
- package/lib/commands/init.js +43 -24
- package/lib/commands/locale.js +3 -0
- package/lib/commands/projects.js +50 -8
- package/lib/commands/storage.js +8 -5
- package/lib/commands/teams.js +45 -5
- package/lib/commands/users.js +101 -7
- package/lib/config.js +6 -4
- package/lib/parser.js +1 -1
- package/lib/questions.js +87 -4
- package/lib/sdks.js +17 -1
- package/lib/utils.js +19 -0
- package/package.json +8 -6
- package/docs/examples/account/delete.md +0 -1
- package/docs/examples/database/delete-attribute.md +0 -3
- package/docs/examples/database/delete-collection.md +0 -2
- package/docs/examples/database/delete-index.md +0 -3
- package/docs/examples/database/get-attribute.md +0 -3
- package/docs/examples/database/get-collection-usage.md +0 -3
- package/docs/examples/database/get-collection.md +0 -2
- package/docs/examples/database/get-index.md +0 -3
- package/docs/examples/database/get-usage.md +0 -2
- package/docs/examples/database/list-attributes.md +0 -2
- package/docs/examples/database/list-collection-logs.md +0 -4
- package/docs/examples/database/list-collections.md +0 -7
- package/docs/examples/database/list-documents.md +0 -9
- package/docs/examples/database/list-indexes.md +0 -2
- package/docs/examples/health/get-queue-usage.md +0 -1
package/lib/commands/health.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const pathLib = require('path');
|
|
2
3
|
const tar = require("tar");
|
|
4
|
+
const ignore = require("ignore");
|
|
3
5
|
const { promisify } = require('util');
|
|
4
6
|
const libClient = require('../client.js');
|
|
7
|
+
const { getAllFiles } = require('../utils.js');
|
|
5
8
|
const { Command } = require('commander');
|
|
6
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
@@ -128,23 +131,6 @@ const healthGetQueueLogs = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
128
131
|
return response;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
const healthGetQueueUsage = async ({ parseOutput = true, sdk = undefined}) => {
|
|
132
|
-
|
|
133
|
-
let client = !sdk ? await sdkForProject() : sdk;
|
|
134
|
-
let path = '/health/queue/usage';
|
|
135
|
-
let payload = {};
|
|
136
|
-
let response = undefined;
|
|
137
|
-
response = await client.call('get', path, {
|
|
138
|
-
'content-type': 'application/json',
|
|
139
|
-
}, payload);
|
|
140
|
-
|
|
141
|
-
if (parseOutput) {
|
|
142
|
-
parse(response)
|
|
143
|
-
success()
|
|
144
|
-
}
|
|
145
|
-
return response;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
134
|
const healthGetQueueWebhooks = async ({ parseOutput = true, sdk = undefined}) => {
|
|
149
135
|
|
|
150
136
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
@@ -232,11 +218,6 @@ health
|
|
|
232
218
|
.description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`)
|
|
233
219
|
.action(actionRunner(healthGetQueueLogs))
|
|
234
220
|
|
|
235
|
-
health
|
|
236
|
-
.command(`getQueueUsage`)
|
|
237
|
-
.description(`Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.`)
|
|
238
|
-
.action(actionRunner(healthGetQueueUsage))
|
|
239
|
-
|
|
240
221
|
health
|
|
241
222
|
.command(`getQueueWebhooks`)
|
|
242
223
|
.description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
|
|
@@ -262,7 +243,6 @@ module.exports = {
|
|
|
262
243
|
healthGetQueueCertificates,
|
|
263
244
|
healthGetQueueFunctions,
|
|
264
245
|
healthGetQueueLogs,
|
|
265
|
-
healthGetQueueUsage,
|
|
266
246
|
healthGetQueueWebhooks,
|
|
267
247
|
healthGetStorageLocal,
|
|
268
248
|
healthGetTime
|
package/lib/commands/init.js
CHANGED
|
@@ -6,22 +6,16 @@ const inquirer = require("inquirer");
|
|
|
6
6
|
const { teamsCreate } = require("./teams");
|
|
7
7
|
const { projectsCreate } = require("./projects");
|
|
8
8
|
const { functionsCreate } = require("./functions");
|
|
9
|
-
const {
|
|
9
|
+
const { databasesListCollections, databasesList } = require("./databases");
|
|
10
10
|
const { sdkForConsole } = require("../sdks");
|
|
11
11
|
const { localConfig } = require("../config");
|
|
12
|
-
const { questionsInitProject, questionsInitFunction } = require("../questions");
|
|
12
|
+
const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions");
|
|
13
13
|
const { success, log, actionRunner, commandDescriptions } = require("../parser");
|
|
14
14
|
|
|
15
15
|
const init = new Command("init")
|
|
16
16
|
.description(commandDescriptions['init'])
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
if (all == undefined) {
|
|
20
|
-
command.help()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
await initProject();
|
|
24
|
-
await initCollection()
|
|
17
|
+
.action(actionRunner(async (_options, command) => {
|
|
18
|
+
command.help();
|
|
25
19
|
}));
|
|
26
20
|
|
|
27
21
|
const initProject = async () => {
|
|
@@ -40,7 +34,7 @@ const initProject = async () => {
|
|
|
40
34
|
|
|
41
35
|
let teamId = response['$id'];
|
|
42
36
|
response = await projectsCreate({
|
|
43
|
-
projectId:
|
|
37
|
+
projectId: answers.id,
|
|
44
38
|
name: answers.project,
|
|
45
39
|
teamId,
|
|
46
40
|
parseOutput: false
|
|
@@ -54,6 +48,7 @@ const initProject = async () => {
|
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
const initFunction = async () => {
|
|
51
|
+
// TODO: Add CI/CD support (ID, name, runtime)
|
|
57
52
|
let answers = await inquirer.prompt(questionsInitFunction)
|
|
58
53
|
|
|
59
54
|
if (fs.existsSync(path.join(process.cwd(), 'functions', answers.name))) {
|
|
@@ -65,7 +60,7 @@ const initFunction = async () => {
|
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
let response = await functionsCreate({
|
|
68
|
-
functionId:
|
|
63
|
+
functionId: answers.id,
|
|
69
64
|
name: answers.name,
|
|
70
65
|
runtime: answers.runtime.id,
|
|
71
66
|
parseOutput: false
|
|
@@ -99,6 +94,7 @@ const initFunction = async () => {
|
|
|
99
94
|
runtime: response.runtime,
|
|
100
95
|
path: `functions/${answers.name}`,
|
|
101
96
|
entrypoint: answers.runtime.entrypoint || '',
|
|
97
|
+
ignore: answers.runtime.ignore || null,
|
|
102
98
|
execute: response.execute,
|
|
103
99
|
events: response.events,
|
|
104
100
|
schedule: response.schedule,
|
|
@@ -109,20 +105,41 @@ const initFunction = async () => {
|
|
|
109
105
|
success();
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
const initCollection = async () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})
|
|
108
|
+
const initCollection = async ({ all, databaseId } = {}) => {
|
|
109
|
+
const databaseIds = [];
|
|
110
|
+
|
|
111
|
+
if(databaseId) {
|
|
112
|
+
databaseIds.push(databaseId);
|
|
113
|
+
} else if(all) {
|
|
114
|
+
let allDatabases = await databasesList({
|
|
115
|
+
parseOutput: false
|
|
116
|
+
})
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
databaseIds.push(...allDatabases.databases.map((d) => d.$id));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if(databaseIds.length <= 0) {
|
|
122
|
+
let answers = await inquirer.prompt(questionsInitCollection)
|
|
123
|
+
if (!answers.databases) process.exit(1)
|
|
124
|
+
databaseIds.push(...answers.databases);
|
|
125
|
+
}
|
|
121
126
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
for(const databaseId of databaseIds) {
|
|
128
|
+
// TODO: Pagination?
|
|
129
|
+
let response = await databasesListCollections({
|
|
130
|
+
databaseId,
|
|
131
|
+
limit: 100,
|
|
132
|
+
parseOutput: false
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
let collections = response.collections;
|
|
136
|
+
log(`Found ${collections.length} collections`);
|
|
137
|
+
|
|
138
|
+
collections.forEach(async collection => {
|
|
139
|
+
log(`Fetching ${collection.name} ...`);
|
|
140
|
+
localConfig.addCollection(collection);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
126
143
|
|
|
127
144
|
success();
|
|
128
145
|
}
|
|
@@ -140,6 +157,8 @@ init
|
|
|
140
157
|
init
|
|
141
158
|
.command("collection")
|
|
142
159
|
.description("Initialise your Appwrite collections")
|
|
160
|
+
.option(`--databaseId <databaseId>`, `Database ID`)
|
|
161
|
+
.option(`--all`, `Flag to initialize all databases`)
|
|
143
162
|
.action(actionRunner(initCollection))
|
|
144
163
|
|
|
145
164
|
module.exports = {
|
package/lib/commands/locale.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const pathLib = require('path');
|
|
2
3
|
const tar = require("tar");
|
|
4
|
+
const ignore = require("ignore");
|
|
3
5
|
const { promisify } = require('util');
|
|
4
6
|
const libClient = require('../client.js');
|
|
7
|
+
const { getAllFiles } = require('../utils.js');
|
|
5
8
|
const { Command } = require('commander');
|
|
6
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
package/lib/commands/projects.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const pathLib = require('path');
|
|
2
3
|
const tar = require("tar");
|
|
4
|
+
const ignore = require("ignore");
|
|
3
5
|
const { promisify } = require('util');
|
|
4
6
|
const libClient = require('../client.js');
|
|
7
|
+
const { getAllFiles } = require('../utils.js');
|
|
5
8
|
const { Command } = require('commander');
|
|
6
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
@@ -413,10 +416,11 @@ const projectsListKeys = async ({ projectId, parseOutput = true, sdk = undefined
|
|
|
413
416
|
return response;
|
|
414
417
|
}
|
|
415
418
|
|
|
416
|
-
const projectsCreateKey = async ({ projectId, name, scopes, parseOutput = true, sdk = undefined}) => {
|
|
419
|
+
const projectsCreateKey = async ({ projectId, name, scopes, expire, parseOutput = true, sdk = undefined}) => {
|
|
417
420
|
/* @param {string} projectId */
|
|
418
421
|
/* @param {string} name */
|
|
419
422
|
/* @param {string[]} scopes */
|
|
423
|
+
/* @param {number} expire */
|
|
420
424
|
|
|
421
425
|
let client = !sdk ? await sdkForConsole() : sdk;
|
|
422
426
|
let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
|
|
@@ -431,6 +435,10 @@ const projectsCreateKey = async ({ projectId, name, scopes, parseOutput = true,
|
|
|
431
435
|
payload['scopes'] = scopes;
|
|
432
436
|
}
|
|
433
437
|
|
|
438
|
+
if (typeof expire !== 'undefined') {
|
|
439
|
+
payload['expire'] = expire;
|
|
440
|
+
}
|
|
441
|
+
|
|
434
442
|
let response = undefined;
|
|
435
443
|
response = await client.call('post', path, {
|
|
436
444
|
'content-type': 'application/json',
|
|
@@ -462,11 +470,12 @@ const projectsGetKey = async ({ projectId, keyId, parseOutput = true, sdk = unde
|
|
|
462
470
|
return response;
|
|
463
471
|
}
|
|
464
472
|
|
|
465
|
-
const projectsUpdateKey = async ({ projectId, keyId, name, scopes, parseOutput = true, sdk = undefined}) => {
|
|
473
|
+
const projectsUpdateKey = async ({ projectId, keyId, name, scopes, expire, parseOutput = true, sdk = undefined}) => {
|
|
466
474
|
/* @param {string} projectId */
|
|
467
475
|
/* @param {string} keyId */
|
|
468
476
|
/* @param {string} name */
|
|
469
477
|
/* @param {string[]} scopes */
|
|
478
|
+
/* @param {number} expire */
|
|
470
479
|
|
|
471
480
|
let client = !sdk ? await sdkForConsole() : sdk;
|
|
472
481
|
let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
|
|
@@ -481,6 +490,10 @@ const projectsUpdateKey = async ({ projectId, keyId, name, scopes, parseOutput =
|
|
|
481
490
|
payload['scopes'] = scopes;
|
|
482
491
|
}
|
|
483
492
|
|
|
493
|
+
if (typeof expire !== 'undefined') {
|
|
494
|
+
payload['expire'] = expire;
|
|
495
|
+
}
|
|
496
|
+
|
|
484
497
|
let response = undefined;
|
|
485
498
|
response = await client.call('put', path, {
|
|
486
499
|
'content-type': 'application/json',
|
|
@@ -900,6 +913,25 @@ const projectsDeleteWebhook = async ({ projectId, webhookId, parseOutput = true,
|
|
|
900
913
|
return response;
|
|
901
914
|
}
|
|
902
915
|
|
|
916
|
+
const projectsUpdateWebhookSignature = async ({ projectId, webhookId, parseOutput = true, sdk = undefined}) => {
|
|
917
|
+
/* @param {string} projectId */
|
|
918
|
+
/* @param {string} webhookId */
|
|
919
|
+
|
|
920
|
+
let client = !sdk ? await sdkForConsole() : sdk;
|
|
921
|
+
let path = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
|
|
922
|
+
let payload = {};
|
|
923
|
+
let response = undefined;
|
|
924
|
+
response = await client.call('patch', path, {
|
|
925
|
+
'content-type': 'application/json',
|
|
926
|
+
}, payload);
|
|
927
|
+
|
|
928
|
+
if (parseOutput) {
|
|
929
|
+
parse(response)
|
|
930
|
+
success()
|
|
931
|
+
}
|
|
932
|
+
return response;
|
|
933
|
+
}
|
|
934
|
+
|
|
903
935
|
|
|
904
936
|
projects
|
|
905
937
|
.command(`list`)
|
|
@@ -908,7 +940,7 @@ projects
|
|
|
908
940
|
.option(`--limit <limit>`, `Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
909
941
|
.option(`--offset <offset>`, `Results offset. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
|
|
910
942
|
.option(`--cursor <cursor>`, `ID of the project used as the starting point for the query, excluding the project itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
|
|
911
|
-
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
|
|
943
|
+
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
|
|
912
944
|
.option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
|
|
913
945
|
.action(actionRunner(projectsList))
|
|
914
946
|
|
|
@@ -1018,7 +1050,8 @@ projects
|
|
|
1018
1050
|
.description(``)
|
|
1019
1051
|
.requiredOption(`--projectId <projectId>`, `Project unique ID.`)
|
|
1020
1052
|
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
|
|
1021
|
-
.requiredOption(`--scopes <scopes...>`, `Key scopes list.`)
|
|
1053
|
+
.requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 scopes are allowed.`)
|
|
1054
|
+
.option(`--expire <expire>`, `Key expiration time in Unix timestamp. Use 0 for unlimited expiration.`, parseInteger)
|
|
1022
1055
|
.action(actionRunner(projectsCreateKey))
|
|
1023
1056
|
|
|
1024
1057
|
projects
|
|
@@ -1034,7 +1067,8 @@ projects
|
|
|
1034
1067
|
.requiredOption(`--projectId <projectId>`, `Project unique ID.`)
|
|
1035
1068
|
.requiredOption(`--keyId <keyId>`, `Key unique ID.`)
|
|
1036
1069
|
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
|
|
1037
|
-
.requiredOption(`--scopes <scopes...>`, `Key scopes list
|
|
1070
|
+
.requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 events are allowed.`)
|
|
1071
|
+
.option(`--expire <expire>`, `Key expiration time in Unix timestamp. Use 0 for unlimited expiration.`, parseInteger)
|
|
1038
1072
|
.action(actionRunner(projectsUpdateKey))
|
|
1039
1073
|
|
|
1040
1074
|
projects
|
|
@@ -1121,7 +1155,7 @@ projects
|
|
|
1121
1155
|
.description(``)
|
|
1122
1156
|
.requiredOption(`--projectId <projectId>`, `Project unique ID.`)
|
|
1123
1157
|
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
1124
|
-
.requiredOption(`--events <events...>`, `Events list.`)
|
|
1158
|
+
.requiredOption(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
|
|
1125
1159
|
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
1126
1160
|
.requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
|
|
1127
1161
|
.option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
@@ -1141,7 +1175,7 @@ projects
|
|
|
1141
1175
|
.requiredOption(`--projectId <projectId>`, `Project unique ID.`)
|
|
1142
1176
|
.requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`)
|
|
1143
1177
|
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
1144
|
-
.requiredOption(`--events <events...>`, `Events list.`)
|
|
1178
|
+
.requiredOption(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
|
|
1145
1179
|
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
1146
1180
|
.requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
|
|
1147
1181
|
.option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
@@ -1155,6 +1189,13 @@ projects
|
|
|
1155
1189
|
.requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`)
|
|
1156
1190
|
.action(actionRunner(projectsDeleteWebhook))
|
|
1157
1191
|
|
|
1192
|
+
projects
|
|
1193
|
+
.command(`updateWebhookSignature`)
|
|
1194
|
+
.description(``)
|
|
1195
|
+
.requiredOption(`--projectId <projectId>`, `Project unique ID.`)
|
|
1196
|
+
.requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`)
|
|
1197
|
+
.action(actionRunner(projectsUpdateWebhookSignature))
|
|
1198
|
+
|
|
1158
1199
|
|
|
1159
1200
|
module.exports = {
|
|
1160
1201
|
projects,
|
|
@@ -1187,5 +1228,6 @@ module.exports = {
|
|
|
1187
1228
|
projectsCreateWebhook,
|
|
1188
1229
|
projectsGetWebhook,
|
|
1189
1230
|
projectsUpdateWebhook,
|
|
1190
|
-
projectsDeleteWebhook
|
|
1231
|
+
projectsDeleteWebhook,
|
|
1232
|
+
projectsUpdateWebhookSignature
|
|
1191
1233
|
};
|
package/lib/commands/storage.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const pathLib = require('path');
|
|
2
3
|
const tar = require("tar");
|
|
4
|
+
const ignore = require("ignore");
|
|
3
5
|
const { promisify } = require('util');
|
|
4
6
|
const libClient = require('../client.js');
|
|
7
|
+
const { getAllFiles } = require('../utils.js');
|
|
5
8
|
const { Command } = require('commander');
|
|
6
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
@@ -269,7 +272,7 @@ const storageListFiles = async ({ bucketId, search, limit, offset, cursor, curso
|
|
|
269
272
|
const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
|
|
270
273
|
/* @param {string} bucketId */
|
|
271
274
|
/* @param {string} fileId */
|
|
272
|
-
/* @param {
|
|
275
|
+
/* @param {InputFile} file */
|
|
273
276
|
/* @param {string[]} read */
|
|
274
277
|
/* @param {string[]} write */
|
|
275
278
|
|
|
@@ -606,7 +609,7 @@ storage
|
|
|
606
609
|
.option(`--limit <limit>`, `Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
607
610
|
.option(`--offset <offset>`, `Results offset. The default value is 0. Use this param to manage pagination.`, parseInteger)
|
|
608
611
|
.option(`--cursor <cursor>`, `ID of the bucket used as the starting point for the query, excluding the bucket itself. Should be used for efficient pagination when working with large sets of data.`)
|
|
609
|
-
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
|
|
612
|
+
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
|
|
610
613
|
.option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
|
|
611
614
|
.action(actionRunner(storageListBuckets))
|
|
612
615
|
|
|
@@ -620,7 +623,7 @@ storage
|
|
|
620
623
|
.option(`--write <write...>`, `An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
|
|
621
624
|
.option(`--enabled <enabled>`, `Is bucket enabled?`, parseBool)
|
|
622
625
|
.option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the '_APP_STORAGE_LIMIT' environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)`, parseInteger)
|
|
623
|
-
.option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions
|
|
626
|
+
.option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
|
|
624
627
|
.option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
|
|
625
628
|
.option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
|
|
626
629
|
.action(actionRunner(storageCreateBucket))
|
|
@@ -641,7 +644,7 @@ storage
|
|
|
641
644
|
.option(`--write <write...>`, `An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.`)
|
|
642
645
|
.option(`--enabled <enabled>`, `Is bucket enabled?`, parseBool)
|
|
643
646
|
.option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)`, parseInteger)
|
|
644
|
-
.option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions
|
|
647
|
+
.option(`--allowedFileExtensions <allowedFileExtensions...>`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
|
|
645
648
|
.option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
|
|
646
649
|
.option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
|
|
647
650
|
.action(actionRunner(storageUpdateBucket))
|
|
@@ -660,7 +663,7 @@ storage
|
|
|
660
663
|
.option(`--limit <limit>`, `Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
661
664
|
.option(`--offset <offset>`, `Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
|
|
662
665
|
.option(`--cursor <cursor>`, `ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
|
|
663
|
-
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
|
|
666
|
+
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
|
|
664
667
|
.option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
|
|
665
668
|
.action(actionRunner(storageListFiles))
|
|
666
669
|
|
package/lib/commands/teams.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const pathLib = require('path');
|
|
2
3
|
const tar = require("tar");
|
|
4
|
+
const ignore = require("ignore");
|
|
3
5
|
const { promisify } = require('util');
|
|
4
6
|
const libClient = require('../client.js');
|
|
7
|
+
const { getAllFiles } = require('../utils.js');
|
|
5
8
|
const { Command } = require('commander');
|
|
6
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
@@ -147,6 +150,34 @@ const teamsDelete = async ({ teamId, parseOutput = true, sdk = undefined}) => {
|
|
|
147
150
|
return response;
|
|
148
151
|
}
|
|
149
152
|
|
|
153
|
+
const teamsListLogs = async ({ teamId, limit, offset, parseOutput = true, sdk = undefined}) => {
|
|
154
|
+
/* @param {string} teamId */
|
|
155
|
+
/* @param {number} limit */
|
|
156
|
+
/* @param {number} offset */
|
|
157
|
+
|
|
158
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
159
|
+
let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
|
|
160
|
+
let payload = {};
|
|
161
|
+
|
|
162
|
+
/** Query Params */
|
|
163
|
+
if (typeof limit !== 'undefined') {
|
|
164
|
+
payload['limit'] = limit;
|
|
165
|
+
}
|
|
166
|
+
if (typeof offset !== 'undefined') {
|
|
167
|
+
payload['offset'] = offset;
|
|
168
|
+
}
|
|
169
|
+
let response = undefined;
|
|
170
|
+
response = await client.call('get', path, {
|
|
171
|
+
'content-type': 'application/json',
|
|
172
|
+
}, payload);
|
|
173
|
+
|
|
174
|
+
if (parseOutput) {
|
|
175
|
+
parse(response)
|
|
176
|
+
success()
|
|
177
|
+
}
|
|
178
|
+
return response;
|
|
179
|
+
}
|
|
180
|
+
|
|
150
181
|
const teamsGetMemberships = async ({ teamId, search, limit, offset, cursor, cursorDirection, orderType, parseOutput = true, sdk = undefined}) => {
|
|
151
182
|
/* @param {string} teamId */
|
|
152
183
|
/* @param {string} search */
|
|
@@ -334,7 +365,7 @@ teams
|
|
|
334
365
|
.option(`--limit <limit>`, `Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
335
366
|
.option(`--offset <offset>`, `Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
|
|
336
367
|
.option(`--cursor <cursor>`, `ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
|
|
337
|
-
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
|
|
368
|
+
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
|
|
338
369
|
.option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
|
|
339
370
|
.action(actionRunner(teamsList))
|
|
340
371
|
|
|
@@ -343,7 +374,7 @@ teams
|
|
|
343
374
|
.description(`Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.`)
|
|
344
375
|
.requiredOption(`--teamId <teamId>`, `Team ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
345
376
|
.requiredOption(`--name <name>`, `Team name. Max length: 128 chars.`)
|
|
346
|
-
.option(`--roles <roles...>`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions).
|
|
377
|
+
.option(`--roles <roles...>`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
|
|
347
378
|
.action(actionRunner(teamsCreate))
|
|
348
379
|
|
|
349
380
|
teams
|
|
@@ -365,6 +396,14 @@ teams
|
|
|
365
396
|
.requiredOption(`--teamId <teamId>`, `Team ID.`)
|
|
366
397
|
.action(actionRunner(teamsDelete))
|
|
367
398
|
|
|
399
|
+
teams
|
|
400
|
+
.command(`listLogs`)
|
|
401
|
+
.description(`Get the team activity logs list by its unique ID.`)
|
|
402
|
+
.requiredOption(`--teamId <teamId>`, `Team ID.`)
|
|
403
|
+
.option(`--limit <limit>`, `Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
404
|
+
.option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
|
|
405
|
+
.action(actionRunner(teamsListLogs))
|
|
406
|
+
|
|
368
407
|
teams
|
|
369
408
|
.command(`getMemberships`)
|
|
370
409
|
.description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.`)
|
|
@@ -373,7 +412,7 @@ teams
|
|
|
373
412
|
.option(`--limit <limit>`, `Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
|
|
374
413
|
.option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
|
|
375
414
|
.option(`--cursor <cursor>`, `ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
|
|
376
|
-
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
|
|
415
|
+
.option(`--cursorDirection <cursorDirection>`, `Direction of the cursor, can be either 'before' or 'after'.`)
|
|
377
416
|
.option(`--orderType <orderType>`, `Order result by ASC or DESC order.`)
|
|
378
417
|
.action(actionRunner(teamsGetMemberships))
|
|
379
418
|
|
|
@@ -382,7 +421,7 @@ teams
|
|
|
382
421
|
.description(`Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team. Use the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when adding your platforms in the console interface.`)
|
|
383
422
|
.requiredOption(`--teamId <teamId>`, `Team ID.`)
|
|
384
423
|
.requiredOption(`--email <email>`, `Email of the new team member.`)
|
|
385
|
-
.requiredOption(`--roles <roles...>`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).
|
|
424
|
+
.requiredOption(`--roles <roles...>`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
|
|
386
425
|
.requiredOption(`--url <url>`, `URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
387
426
|
.option(`--name <name>`, `Name of the new team member. Max length: 128 chars.`)
|
|
388
427
|
.action(actionRunner(teamsCreateMembership))
|
|
@@ -399,7 +438,7 @@ teams
|
|
|
399
438
|
.description(`Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](/docs/permissions).`)
|
|
400
439
|
.requiredOption(`--teamId <teamId>`, `Team ID.`)
|
|
401
440
|
.requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
|
|
402
|
-
.requiredOption(`--roles <roles...>`, `An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
|
|
441
|
+
.requiredOption(`--roles <roles...>`, `An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
|
|
403
442
|
.action(actionRunner(teamsUpdateMembershipRoles))
|
|
404
443
|
|
|
405
444
|
teams
|
|
@@ -426,6 +465,7 @@ module.exports = {
|
|
|
426
465
|
teamsGet,
|
|
427
466
|
teamsUpdate,
|
|
428
467
|
teamsDelete,
|
|
468
|
+
teamsListLogs,
|
|
429
469
|
teamsGetMemberships,
|
|
430
470
|
teamsCreateMembership,
|
|
431
471
|
teamsGetMembership,
|