appwrite-cli 5.0.3 → 6.0.0-rc.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 -4
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-execution.md +1 -0
- package/docs/examples/functions/create.md +1 -0
- package/docs/examples/functions/delete-execution.md +3 -0
- package/docs/examples/functions/update-deployment-build.md +3 -0
- package/docs/examples/functions/update.md +1 -0
- package/docs/examples/messaging/update-email.md +1 -0
- package/docs/examples/projects/create-j-w-t.md +4 -0
- package/docs/examples/projects/update-mock-numbers.md +3 -0
- package/docs/examples/projects/update-session-alerts.md +3 -0
- package/docs/examples/users/create-j-w-t.md +4 -0
- package/docs/examples/vcs/get-repository-contents.md +4 -0
- package/index.js +34 -7
- package/install.ps1 +3 -3
- package/install.sh +2 -2
- package/lib/client.js +19 -5
- package/lib/commands/account.js +307 -153
- package/lib/commands/assistant.js +8 -5
- package/lib/commands/avatars.js +116 -60
- package/lib/commands/console.js +8 -5
- package/lib/commands/databases.js +353 -164
- package/lib/commands/functions.js +310 -100
- package/lib/commands/generic.js +206 -54
- package/lib/commands/graphql.js +14 -8
- package/lib/commands/health.js +140 -71
- package/lib/commands/init.js +250 -155
- package/lib/commands/locale.js +50 -26
- package/lib/commands/messaging.js +363 -179
- package/lib/commands/migrations.js +98 -50
- package/lib/commands/project.js +38 -20
- package/lib/commands/projects.js +449 -144
- package/lib/commands/proxy.js +32 -17
- package/lib/commands/pull.js +231 -0
- package/lib/commands/push.js +1518 -0
- package/lib/commands/run.js +282 -0
- package/lib/commands/storage.js +160 -76
- package/lib/commands/teams.js +102 -50
- package/lib/commands/users.js +325 -135
- package/lib/commands/vcs.js +102 -29
- package/lib/config.js +190 -18
- package/lib/emulation/docker.js +187 -0
- package/lib/emulation/utils.js +177 -0
- package/lib/id.js +30 -0
- package/lib/paginate.js +1 -2
- package/lib/parser.js +69 -12
- package/lib/questions.js +462 -84
- package/lib/sdks.js +1 -1
- package/lib/spinner.js +103 -0
- package/lib/utils.js +248 -3
- package/lib/validations.js +17 -0
- package/package.json +6 -2
- package/scoop/appwrite.json +3 -3
- package/lib/commands/deploy.js +0 -941
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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)
|
|
8
8
|
|
|
9
|
-
**This SDK is compatible with Appwrite server version 1.
|
|
9
|
+
**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
|
|
10
10
|
|
|
11
11
|
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
|
12
12
|
|
|
@@ -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
|
-
|
|
32
|
+
6.0.0-rc.1
|
|
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
|
-
|
|
63
|
+
6.0.0-rc.1
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
package/index.js
CHANGED
|
@@ -10,9 +10,12 @@ const chalk = require("chalk");
|
|
|
10
10
|
const { version } = require("./package.json");
|
|
11
11
|
const { commandDescriptions, cliConfig } = require("./lib/parser");
|
|
12
12
|
const { client } = require("./lib/commands/generic");
|
|
13
|
-
const
|
|
13
|
+
const inquirer = require("inquirer");
|
|
14
|
+
const { login, logout, whoami, migrate, register } = require("./lib/commands/generic");
|
|
14
15
|
const { init } = require("./lib/commands/init");
|
|
15
|
-
const {
|
|
16
|
+
const { pull } = require("./lib/commands/pull");
|
|
17
|
+
const { run } = require("./lib/commands/run");
|
|
18
|
+
const { push } = require("./lib/commands/push");
|
|
16
19
|
const { account } = require("./lib/commands/account");
|
|
17
20
|
const { avatars } = require("./lib/commands/avatars");
|
|
18
21
|
const { assistant } = require("./lib/commands/assistant");
|
|
@@ -32,6 +35,8 @@ const { teams } = require("./lib/commands/teams");
|
|
|
32
35
|
const { users } = require("./lib/commands/users");
|
|
33
36
|
const { vcs } = require("./lib/commands/vcs");
|
|
34
37
|
|
|
38
|
+
inquirer.registerPrompt('search-list', require('inquirer-search-list'));
|
|
39
|
+
|
|
35
40
|
program
|
|
36
41
|
.description(commandDescriptions['main'])
|
|
37
42
|
.configureHelp({
|
|
@@ -39,18 +44,40 @@ program
|
|
|
39
44
|
sortSubcommands: true
|
|
40
45
|
})
|
|
41
46
|
.version(version, "-v, --version")
|
|
42
|
-
.option("--verbose", "Show complete error log")
|
|
43
|
-
.option("--json", "Output in JSON format")
|
|
47
|
+
.option("-V, --verbose", "Show complete error log")
|
|
48
|
+
.option("-j, --json", "Output in JSON format")
|
|
49
|
+
.hook('preAction', migrate)
|
|
50
|
+
.option("-f,--force", "Flag to confirm all warnings")
|
|
51
|
+
.option("-a,--all", "Flag to push all resources")
|
|
52
|
+
.option("--id [id...]", "Flag to pass list of ids for a giving action")
|
|
53
|
+
.option("--report", "Enable reporting in case of CLI errors")
|
|
44
54
|
.on("option:json", () => {
|
|
45
55
|
cliConfig.json = true;
|
|
46
56
|
})
|
|
47
57
|
.on("option:verbose", () => {
|
|
48
58
|
cliConfig.verbose = true;
|
|
49
59
|
})
|
|
60
|
+
.on("option:report", function() {
|
|
61
|
+
cliConfig.report = true;
|
|
62
|
+
cliConfig.reportData = { data: this };
|
|
63
|
+
})
|
|
64
|
+
.on("option:force", () => {
|
|
65
|
+
cliConfig.force = true;
|
|
66
|
+
})
|
|
67
|
+
.on("option:all", () => {
|
|
68
|
+
cliConfig.all = true;
|
|
69
|
+
})
|
|
70
|
+
.on("option:id", function() {
|
|
71
|
+
cliConfig.ids = this.opts().id;
|
|
72
|
+
})
|
|
50
73
|
.showSuggestionAfterError()
|
|
74
|
+
.addCommand(whoami)
|
|
75
|
+
.addCommand(register)
|
|
51
76
|
.addCommand(login)
|
|
52
77
|
.addCommand(init)
|
|
53
|
-
.addCommand(
|
|
78
|
+
.addCommand(pull)
|
|
79
|
+
.addCommand(push)
|
|
80
|
+
.addCommand(run)
|
|
54
81
|
.addCommand(logout)
|
|
55
82
|
.addCommand(account)
|
|
56
83
|
.addCommand(avatars)
|
|
@@ -72,5 +99,5 @@ program
|
|
|
72
99
|
.addCommand(vcs)
|
|
73
100
|
.addCommand(client)
|
|
74
101
|
.parse(process.argv);
|
|
75
|
-
|
|
76
|
-
process.stdout.columns = oldWidth;
|
|
102
|
+
|
|
103
|
+
process.stdout.columns = oldWidth;
|
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/
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.1/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.1/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
|
@@ -85,8 +85,8 @@ function CleanUp {
|
|
|
85
85
|
function InstallCompleted {
|
|
86
86
|
Write-Host "[4/4] Finishing Installation ... "
|
|
87
87
|
cleanup
|
|
88
|
-
Write-Host "🤘 May the force be with you."
|
|
89
88
|
Write-Host "To get started with Appwrite CLI, please visit https://appwrite.io/docs/command-line"
|
|
89
|
+
Write-Host "As first step, you can login to your Appwrite account using 'appwrite login'"
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
|
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="
|
|
100
|
+
GITHUB_LATEST_VERSION="6.0.0-rc.1"
|
|
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
|
|
|
@@ -145,8 +145,8 @@ cleanup() {
|
|
|
145
145
|
installCompleted() {
|
|
146
146
|
echo "[4/4] Wrapping up installation ... "
|
|
147
147
|
cleanup
|
|
148
|
-
printf "🤘 May the force be with you. \n"
|
|
149
148
|
echo "🚀 To get started with Appwrite CLI, please visit https://appwrite.io/docs/command-line"
|
|
149
|
+
echo "As first step, you can login to your Appwrite account using 'appwrite login'"
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
# Installation Starts here
|
package/lib/client.js
CHANGED
|
@@ -4,10 +4,11 @@ const { fetch, FormData, Agent } = require("undici");
|
|
|
4
4
|
const JSONbig = require("json-bigint")({ storeAsString: false });
|
|
5
5
|
const AppwriteException = require("./exception.js");
|
|
6
6
|
const { globalConfig } = require("./config.js");
|
|
7
|
+
const chalk = require("chalk");
|
|
7
8
|
|
|
8
9
|
class Client {
|
|
9
10
|
CHUNK_SIZE = 5*1024*1024; // 5MB
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
constructor() {
|
|
12
13
|
this.endpoint = 'https://cloud.appwrite.io/v1';
|
|
13
14
|
this.headers = {
|
|
@@ -15,8 +16,8 @@ class Client {
|
|
|
15
16
|
'x-sdk-name': 'Command Line',
|
|
16
17
|
'x-sdk-platform': 'console',
|
|
17
18
|
'x-sdk-language': 'cli',
|
|
18
|
-
'x-sdk-version': '
|
|
19
|
-
'user-agent' : `AppwriteCLI/
|
|
19
|
+
'x-sdk-version': '6.0.0-rc.1',
|
|
20
|
+
'user-agent' : `AppwriteCLI/6.0.0-rc.1 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
20
21
|
'X-Appwrite-Response-Format' : '1.5.0',
|
|
21
22
|
};
|
|
22
23
|
}
|
|
@@ -182,6 +183,11 @@ class Client {
|
|
|
182
183
|
},
|
|
183
184
|
}),
|
|
184
185
|
});
|
|
186
|
+
|
|
187
|
+
const warnings = response.headers.get('x-appwrite-warning');
|
|
188
|
+
if (warnings) {
|
|
189
|
+
warnings.split(';').forEach((warning) => console.warn(warning));
|
|
190
|
+
}
|
|
185
191
|
} catch (error) {
|
|
186
192
|
throw new AppwriteException(error.message);
|
|
187
193
|
}
|
|
@@ -194,6 +200,14 @@ class Client {
|
|
|
194
200
|
} catch (error) {
|
|
195
201
|
throw new AppwriteException(text, response.status, "", text);
|
|
196
202
|
}
|
|
203
|
+
|
|
204
|
+
if (path !== '/account' && json.code === 401 && json.type === 'user_more_factors_required') {
|
|
205
|
+
console.log(`${chalk.cyan.bold("ℹ Info")} ${chalk.cyan("Unusable account found, removing...")}`);
|
|
206
|
+
|
|
207
|
+
const current = globalConfig.getCurrentSession();
|
|
208
|
+
globalConfig.setCurrentSession('');
|
|
209
|
+
globalConfig.removeSession(current);
|
|
210
|
+
}
|
|
197
211
|
throw new AppwriteException(json.message, json.code, json.type, json);
|
|
198
212
|
}
|
|
199
213
|
|
|
@@ -204,7 +218,7 @@ class Client {
|
|
|
204
218
|
|
|
205
219
|
let cookies = response.headers.getSetCookie();
|
|
206
220
|
if (cookies && cookies.length > 0) {
|
|
207
|
-
globalConfig.setCookie(cookies
|
|
221
|
+
globalConfig.setCookie(cookies.join(";"));
|
|
208
222
|
}
|
|
209
223
|
|
|
210
224
|
const text = await response.text();
|
|
@@ -235,4 +249,4 @@ class Client {
|
|
|
235
249
|
}
|
|
236
250
|
}
|
|
237
251
|
|
|
238
|
-
module.exports = Client;
|
|
252
|
+
module.exports = Client;
|