appwrite-cli 5.0.1 → 5.0.3
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/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/generic.js +40 -3
- package/lib/questions.js +57 -2
- package/package.json +1 -1
- package/scoop/appwrite.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Appwrite Command Line SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
5.0.
|
|
32
|
+
5.0.3
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
|
|
|
60
60
|
Once the installation completes, you can verify your install using
|
|
61
61
|
```
|
|
62
62
|
$ appwrite -v
|
|
63
|
-
5.0.
|
|
63
|
+
5.0.3
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.3/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.3/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
package/install.sh
CHANGED
|
@@ -97,7 +97,7 @@ printSuccess() {
|
|
|
97
97
|
downloadBinary() {
|
|
98
98
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
99
99
|
|
|
100
|
-
GITHUB_LATEST_VERSION="5.0.
|
|
100
|
+
GITHUB_LATEST_VERSION="5.0.3"
|
|
101
101
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
102
102
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
103
103
|
|
package/lib/client.js
CHANGED
|
@@ -15,8 +15,8 @@ class Client {
|
|
|
15
15
|
'x-sdk-name': 'Command Line',
|
|
16
16
|
'x-sdk-platform': 'console',
|
|
17
17
|
'x-sdk-language': 'cli',
|
|
18
|
-
'x-sdk-version': '5.0.
|
|
19
|
-
'user-agent' : `AppwriteCLI/5.0.
|
|
18
|
+
'x-sdk-version': '5.0.3',
|
|
19
|
+
'user-agent' : `AppwriteCLI/5.0.3 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
20
20
|
'X-Appwrite-Response-Format' : '1.5.0',
|
|
21
21
|
};
|
|
22
22
|
}
|
package/lib/commands/generic.js
CHANGED
|
@@ -4,8 +4,8 @@ const Client = require("../client");
|
|
|
4
4
|
const { sdkForConsole } = require("../sdks");
|
|
5
5
|
const { globalConfig, localConfig } = require("../config");
|
|
6
6
|
const { actionRunner, success, parseBool, commandDescriptions, log, parse } = require("../parser");
|
|
7
|
-
const { questionsLogin } = require("../questions");
|
|
8
|
-
const { accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
|
|
7
|
+
const { questionsLogin, questionsListFactors, questionsMfaChallenge } = require("../questions");
|
|
8
|
+
const { accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
|
|
9
9
|
|
|
10
10
|
const login = new Command("login")
|
|
11
11
|
.description(commandDescriptions['login'])
|
|
@@ -24,7 +24,44 @@ const login = new Command("login")
|
|
|
24
24
|
sdk: client
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
client.setCookie(globalConfig.getCookie());
|
|
28
|
+
|
|
29
|
+
let account;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
account = await accountGet({
|
|
33
|
+
sdk: client,
|
|
34
|
+
parseOutput: false
|
|
35
|
+
});
|
|
36
|
+
} catch(error) {
|
|
37
|
+
if (error.response === 'user_more_factors_required') {
|
|
38
|
+
const { factor } = await inquirer.prompt(questionsListFactors);
|
|
39
|
+
|
|
40
|
+
const challenge = await accountCreateMfaChallenge({
|
|
41
|
+
factor,
|
|
42
|
+
parseOutput: false,
|
|
43
|
+
sdk: client
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const { otp } = await inquirer.prompt(questionsMfaChallenge);
|
|
47
|
+
|
|
48
|
+
await accountUpdateMfaChallenge({
|
|
49
|
+
challengeId: challenge.$id,
|
|
50
|
+
otp,
|
|
51
|
+
parseOutput: false,
|
|
52
|
+
sdk: client
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
account = await accountGet({
|
|
56
|
+
sdk: client,
|
|
57
|
+
parseOutput: false
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
success("Signed in as user with ID: " + account.$id);
|
|
28
65
|
}));
|
|
29
66
|
|
|
30
67
|
const logout = new Command("logout")
|
package/lib/questions.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const { localConfig } = require('./config');
|
|
2
2
|
const { projectsList } = require('./commands/projects');
|
|
3
3
|
const { functionsListRuntimes } = require('./commands/functions');
|
|
4
|
+
const { accountListMfaFactors } = require("./commands/account");
|
|
5
|
+
const { sdkForConsole } = require("./sdks");
|
|
6
|
+
|
|
4
7
|
const { databasesList } = require('./commands/databases');
|
|
5
8
|
const JSONbig = require("json-bigint")({ storeAsString: false });
|
|
6
9
|
|
|
@@ -387,7 +390,57 @@ const questionsDeployTeams = [
|
|
|
387
390
|
name: "override",
|
|
388
391
|
message: 'Are you sure you want to override this team? This can lead to loss of data! Type "YES" to confirm.'
|
|
389
392
|
},
|
|
390
|
-
]
|
|
393
|
+
];
|
|
394
|
+
|
|
395
|
+
const questionsListFactors = [
|
|
396
|
+
{
|
|
397
|
+
type: "list",
|
|
398
|
+
name: "factor",
|
|
399
|
+
message: "Your account is protected by multiple factors. Which factor would you like to use to authenticate?",
|
|
400
|
+
choices: async () => {
|
|
401
|
+
let client = await sdkForConsole(false);
|
|
402
|
+
const factors = await accountListMfaFactors({
|
|
403
|
+
sdk: client,
|
|
404
|
+
parseOutput: false
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
const choices = [
|
|
408
|
+
{
|
|
409
|
+
name: `TOTP (Time-based One-time Password)`,
|
|
410
|
+
value: 'totp'
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: `E-mail`,
|
|
414
|
+
value: 'email'
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: `Phone (SMS)`,
|
|
418
|
+
value: 'phone'
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
name: `Recovery code`,
|
|
422
|
+
value: 'recoveryCode'
|
|
423
|
+
}
|
|
424
|
+
].filter((ch) => factors[ch.value] === true);
|
|
425
|
+
|
|
426
|
+
return choices;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
|
|
431
|
+
const questionsMfaChallenge = [
|
|
432
|
+
{
|
|
433
|
+
type: "input",
|
|
434
|
+
name: "otp",
|
|
435
|
+
message: "Enter OTP",
|
|
436
|
+
validate(value) {
|
|
437
|
+
if (!value) {
|
|
438
|
+
return "Please enter OTP";
|
|
439
|
+
}
|
|
440
|
+
return true;
|
|
441
|
+
},
|
|
442
|
+
}
|
|
443
|
+
];
|
|
391
444
|
|
|
392
445
|
module.exports = {
|
|
393
446
|
questionsInitProject,
|
|
@@ -398,5 +451,7 @@ module.exports = {
|
|
|
398
451
|
questionsDeployCollections,
|
|
399
452
|
questionsDeployBuckets,
|
|
400
453
|
questionsDeployTeams,
|
|
401
|
-
questionsGetEntrypoint
|
|
454
|
+
questionsGetEntrypoint,
|
|
455
|
+
questionsListFactors,
|
|
456
|
+
questionsMfaChallenge
|
|
402
457
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "5.0.
|
|
5
|
+
"version": "5.0.3",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
package/scoop/appwrite.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
|
|
5
5
|
"homepage": "https://github.com/appwrite/sdk-for-cli",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"architecture": {
|
|
8
8
|
"64bit": {
|
|
9
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.3/appwrite-cli-win-x64.exe",
|
|
10
10
|
"bin": [
|
|
11
11
|
[
|
|
12
12
|
"appwrite-cli-win-x64.exe",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"arm64": {
|
|
18
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/5.0.3/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|