appwrite-cli 0.18.5 → 1.0.0

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.
Files changed (79) hide show
  1. package/.github/workflows/npm-publish.yml +8 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +4 -4
  4. package/appwrite.json +4 -0
  5. package/docs/examples/account/create-phone-session.md +1 -1
  6. package/docs/examples/account/get-logs.md +0 -1
  7. package/docs/examples/account/list-logs.md +2 -0
  8. package/docs/examples/account/list-sessions.md +1 -0
  9. package/docs/examples/account/update-phone.md +1 -1
  10. package/docs/examples/avatars/get-initials.md +0 -1
  11. package/docs/examples/databases/create-collection.md +2 -3
  12. package/docs/examples/databases/create-datetime-attribute.md +7 -0
  13. package/docs/examples/databases/create-document.md +0 -1
  14. package/docs/examples/databases/list-collection-logs.md +0 -1
  15. package/docs/examples/databases/list-collections.md +0 -4
  16. package/docs/examples/databases/list-document-logs.md +0 -1
  17. package/docs/examples/databases/list-documents.md +0 -6
  18. package/docs/examples/databases/list-logs.md +0 -1
  19. package/docs/examples/databases/list.md +0 -4
  20. package/docs/examples/databases/update-collection.md +0 -1
  21. package/docs/examples/databases/update-document.md +0 -1
  22. package/docs/examples/functions/create-variable.md +4 -0
  23. package/docs/examples/functions/create.md +1 -1
  24. package/docs/examples/functions/delete-variable.md +3 -0
  25. package/docs/examples/functions/get-function-usage.md +3 -0
  26. package/docs/examples/functions/get-usage.md +0 -1
  27. package/docs/examples/functions/get-variable.md +3 -0
  28. package/docs/examples/functions/list-deployments.md +0 -4
  29. package/docs/examples/functions/list-executions.md +0 -3
  30. package/docs/examples/functions/list-variables.md +2 -0
  31. package/docs/examples/functions/list.md +0 -4
  32. package/docs/examples/functions/update-variable.md +5 -0
  33. package/docs/examples/functions/update.md +1 -1
  34. package/docs/examples/locale/list-continents.md +1 -0
  35. package/docs/examples/locale/list-countries-e-u.md +1 -0
  36. package/docs/examples/locale/list-countries-phones.md +1 -0
  37. package/docs/examples/locale/list-countries.md +1 -0
  38. package/docs/examples/locale/list-currencies.md +1 -0
  39. package/docs/examples/locale/list-languages.md +1 -0
  40. package/docs/examples/projects/list.md +0 -4
  41. package/docs/examples/storage/create-bucket.md +1 -1
  42. package/docs/examples/storage/create-file.md +0 -1
  43. package/docs/examples/storage/list-buckets.md +0 -4
  44. package/docs/examples/storage/list-files.md +0 -4
  45. package/docs/examples/storage/update-bucket.md +1 -1
  46. package/docs/examples/storage/update-file.md +0 -1
  47. package/docs/examples/teams/get-memberships.md +0 -4
  48. package/docs/examples/teams/list-logs.md +0 -1
  49. package/docs/examples/teams/list-memberships.md +4 -0
  50. package/docs/examples/teams/list.md +0 -4
  51. package/docs/examples/users/create-argon2user.md +5 -0
  52. package/docs/examples/users/create-bcrypt-user.md +5 -0
  53. package/docs/examples/users/create-m-d5user.md +5 -0
  54. package/docs/examples/users/create-p-h-pass-user.md +5 -0
  55. package/docs/examples/users/create-s-h-a-user.md +6 -0
  56. package/docs/examples/users/create-scrypt-modified-user.md +8 -0
  57. package/docs/examples/users/create-scrypt-user.md +10 -0
  58. package/docs/examples/users/create.md +3 -2
  59. package/docs/examples/users/get-logs.md +0 -1
  60. package/docs/examples/users/list-logs.md +3 -0
  61. package/docs/examples/users/list-memberships.md +2 -0
  62. package/docs/examples/users/list-sessions.md +2 -0
  63. package/docs/examples/users/list.md +0 -4
  64. package/install.ps1 +2 -2
  65. package/install.sh +1 -1
  66. package/lib/client.js +7 -3
  67. package/lib/commands/account.js +24 -29
  68. package/lib/commands/avatars.js +2 -7
  69. package/lib/commands/databases.js +154 -210
  70. package/lib/commands/deploy.js +12 -3
  71. package/lib/commands/functions.js +227 -93
  72. package/lib/commands/generic.js +3 -3
  73. package/lib/commands/locale.js +24 -24
  74. package/lib/commands/projects.js +10 -30
  75. package/lib/commands/storage.js +53 -105
  76. package/lib/commands/teams.js +20 -65
  77. package/lib/commands/users.js +425 -47
  78. package/lib/questions.js +1 -1
  79. package/package.json +1 -1
@@ -31,7 +31,14 @@ jobs:
31
31
  npm run mac-x64
32
32
  npm run mac-arm64
33
33
  - name: Publish NPM library
34
- run: npm publish
34
+ run: |
35
+ if ${{ contains(github.event.release.tag_name, '-RC') }}; then
36
+ echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM"
37
+ npm publish --tag next
38
+ else
39
+ echo "Publishing ${{ github.event.release.tag_name}} to NPM"
40
+ npm publish
41
+ fi
35
42
  env:
36
43
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37
44
  - uses: fnkr/github-action-ghr@v1
package/LICENSE.md CHANGED
@@ -9,4 +9,4 @@ Redistribution and use in source and binary forms, with or without modification,
9
9
 
10
10
  3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
11
 
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Appwrite Command Line SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-0.15.2-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.0.0-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
8
8
 
9
- **This SDK is compatible with Appwrite server version 0.15.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
9
+ **This SDK is compatible with Appwrite server version 1.0.0. 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
- 0.18.5
32
+ 1.0.0
33
33
  ```
34
34
 
35
35
  ### Install using prebuilt binaries
@@ -58,7 +58,7 @@ $ iwr -useb https://appwrite.io/cli/install.ps1 | iex
58
58
  Once the installation completes, you can verify your install using
59
59
  ```
60
60
  $ appwrite -v
61
- 0.18.5
61
+ 1.0.0
62
62
  ```
63
63
 
64
64
  ## Getting Started
package/appwrite.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "projectId": "almost-reddit",
3
+ "projectName": "Almost Reddit"
4
+ }
@@ -1,3 +1,3 @@
1
1
  appwrite account createPhoneSession \
2
2
  --userId [USER_ID] \
3
- --number ''
3
+ --phone ''
@@ -1,3 +1,2 @@
1
1
  appwrite account getLogs \
2
2
 
3
-
@@ -0,0 +1,2 @@
1
+ appwrite account listLogs \
2
+
@@ -0,0 +1 @@
1
+ appwrite account listSessions
@@ -1,3 +1,3 @@
1
1
  appwrite account updatePhone \
2
- --number '' \
2
+ --phone '' \
3
3
  --password password
@@ -3,4 +3,3 @@ appwrite avatars getInitials \
3
3
 
4
4
 
5
5
 
6
-
@@ -2,6 +2,5 @@ appwrite databases createCollection \
2
2
  --databaseId [DATABASE_ID] \
3
3
  --collectionId [COLLECTION_ID] \
4
4
  --name [NAME] \
5
- --permission document \
6
- --read "role:all" \
7
- --write "role:all"
5
+
6
+
@@ -0,0 +1,7 @@
1
+ appwrite databases createDatetimeAttribute \
2
+ --databaseId [DATABASE_ID] \
3
+ --collectionId [COLLECTION_ID] \
4
+ --key '' \
5
+ --required false \
6
+
7
+
@@ -4,4 +4,3 @@ appwrite databases createDocument \
4
4
  --documentId [DOCUMENT_ID] \
5
5
  --data '{ "key": "value" }' \
6
6
 
7
-
@@ -2,4 +2,3 @@ appwrite databases listCollectionLogs \
2
2
  --databaseId [DATABASE_ID] \
3
3
  --collectionId [COLLECTION_ID] \
4
4
 
5
-
@@ -2,7 +2,3 @@ appwrite databases listCollections \
2
2
  --databaseId [DATABASE_ID] \
3
3
 
4
4
 
5
-
6
-
7
-
8
-
@@ -3,4 +3,3 @@ appwrite databases listDocumentLogs \
3
3
  --collectionId [COLLECTION_ID] \
4
4
  --documentId [DOCUMENT_ID] \
5
5
 
6
-
@@ -2,9 +2,3 @@ appwrite databases listDocuments \
2
2
  --databaseId [DATABASE_ID] \
3
3
  --collectionId [COLLECTION_ID] \
4
4
 
5
-
6
-
7
-
8
-
9
-
10
-
@@ -1,4 +1,3 @@
1
1
  appwrite databases listLogs \
2
2
  --databaseId [DATABASE_ID] \
3
3
 
4
-
@@ -1,7 +1,3 @@
1
1
  appwrite databases list \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
@@ -2,7 +2,6 @@ appwrite databases updateCollection \
2
2
  --databaseId [DATABASE_ID] \
3
3
  --collectionId [COLLECTION_ID] \
4
4
  --name [NAME] \
5
- --permission document \
6
5
 
7
6
 
8
7
 
@@ -4,4 +4,3 @@ appwrite databases updateDocument \
4
4
  --documentId [DOCUMENT_ID] \
5
5
 
6
6
 
7
-
@@ -0,0 +1,4 @@
1
+ appwrite functions createVariable \
2
+ --functionId [FUNCTION_ID] \
3
+ --key [KEY] \
4
+ --value [VALUE]
@@ -1,7 +1,7 @@
1
1
  appwrite functions create \
2
2
  --functionId [FUNCTION_ID] \
3
3
  --name [NAME] \
4
- --execute one two three \
4
+ --execute "any" \
5
5
  --runtime node-14.5 \
6
6
 
7
7
 
@@ -0,0 +1,3 @@
1
+ appwrite functions deleteVariable \
2
+ --functionId [FUNCTION_ID] \
3
+ --variableId [VARIABLE_ID]
@@ -0,0 +1,3 @@
1
+ appwrite functions getFunctionUsage \
2
+ --functionId [FUNCTION_ID] \
3
+
@@ -1,3 +1,2 @@
1
1
  appwrite functions getUsage \
2
- --functionId [FUNCTION_ID] \
3
2
 
@@ -0,0 +1,3 @@
1
+ appwrite functions getVariable \
2
+ --functionId [FUNCTION_ID] \
3
+ --variableId [VARIABLE_ID]
@@ -2,7 +2,3 @@ appwrite functions listDeployments \
2
2
  --functionId [FUNCTION_ID] \
3
3
 
4
4
 
5
-
6
-
7
-
8
-
@@ -2,6 +2,3 @@ appwrite functions listExecutions \
2
2
  --functionId [FUNCTION_ID] \
3
3
 
4
4
 
5
-
6
-
7
-
@@ -0,0 +1,2 @@
1
+ appwrite functions listVariables \
2
+ --functionId [FUNCTION_ID]
@@ -1,7 +1,3 @@
1
1
  appwrite functions list \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
@@ -0,0 +1,5 @@
1
+ appwrite functions updateVariable \
2
+ --functionId [FUNCTION_ID] \
3
+ --variableId [VARIABLE_ID] \
4
+ --key [KEY] \
5
+
@@ -1,7 +1,7 @@
1
1
  appwrite functions update \
2
2
  --functionId [FUNCTION_ID] \
3
3
  --name [NAME] \
4
- --execute one two three \
4
+ --execute "any" \
5
5
 
6
6
 
7
7
 
@@ -0,0 +1 @@
1
+ appwrite locale listContinents
@@ -0,0 +1 @@
1
+ appwrite locale listCountriesEU
@@ -0,0 +1 @@
1
+ appwrite locale listCountriesPhones
@@ -0,0 +1 @@
1
+ appwrite locale listCountries
@@ -0,0 +1 @@
1
+ appwrite locale listCurrencies
@@ -0,0 +1 @@
1
+ appwrite locale listLanguages
@@ -1,7 +1,3 @@
1
1
  appwrite projects list \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
@@ -1,7 +1,7 @@
1
1
  appwrite storage createBucket \
2
2
  --bucketId [BUCKET_ID] \
3
3
  --name [NAME] \
4
- --permission file \
4
+
5
5
 
6
6
 
7
7
 
@@ -3,4 +3,3 @@ appwrite storage createFile \
3
3
  --fileId [FILE_ID] \
4
4
  --file 'path/to/file.png' \
5
5
 
6
-
@@ -1,7 +1,3 @@
1
1
  appwrite storage listBuckets \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
@@ -2,7 +2,3 @@ appwrite storage listFiles \
2
2
  --bucketId [BUCKET_ID] \
3
3
 
4
4
 
5
-
6
-
7
-
8
-
@@ -1,7 +1,7 @@
1
1
  appwrite storage updateBucket \
2
2
  --bucketId [BUCKET_ID] \
3
3
  --name [NAME] \
4
- --permission file \
4
+
5
5
 
6
6
 
7
7
 
@@ -2,4 +2,3 @@ appwrite storage updateFile \
2
2
  --bucketId [BUCKET_ID] \
3
3
  --fileId [FILE_ID] \
4
4
 
5
-
@@ -2,7 +2,3 @@ appwrite teams getMemberships \
2
2
  --teamId [TEAM_ID] \
3
3
 
4
4
 
5
-
6
-
7
-
8
-
@@ -1,4 +1,3 @@
1
1
  appwrite teams listLogs \
2
2
  --teamId [TEAM_ID] \
3
3
 
4
-
@@ -0,0 +1,4 @@
1
+ appwrite teams listMemberships \
2
+ --teamId [TEAM_ID] \
3
+
4
+
@@ -1,7 +1,3 @@
1
1
  appwrite teams list \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
@@ -0,0 +1,5 @@
1
+ appwrite users createArgon2User \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+
@@ -0,0 +1,5 @@
1
+ appwrite users createBcryptUser \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+
@@ -0,0 +1,5 @@
1
+ appwrite users createMD5User \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+
@@ -0,0 +1,5 @@
1
+ appwrite users createPHPassUser \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+
@@ -0,0 +1,6 @@
1
+ appwrite users createSHAUser \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+
6
+
@@ -0,0 +1,8 @@
1
+ appwrite users createScryptModifiedUser \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+ --passwordSalt [PASSWORD_SALT] \
6
+ --passwordSaltSeparator [PASSWORD_SALT_SEPARATOR] \
7
+ --passwordSignerKey [PASSWORD_SIGNER_KEY] \
8
+
@@ -0,0 +1,10 @@
1
+ appwrite users createScryptUser \
2
+ --userId [USER_ID] \
3
+ --email email@example.com \
4
+ --password password \
5
+ --passwordSalt [PASSWORD_SALT] \
6
+ --passwordCpu null \
7
+ --passwordMemory null \
8
+ --passwordParallel null \
9
+ --passwordLength null \
10
+
@@ -1,5 +1,6 @@
1
1
  appwrite users create \
2
2
  --userId [USER_ID] \
3
- --email email@example.com \
4
- --password password \
3
+
4
+
5
+
5
6
 
@@ -1,4 +1,3 @@
1
1
  appwrite users getLogs \
2
2
  --userId [USER_ID] \
3
3
 
4
-
@@ -0,0 +1,3 @@
1
+ appwrite users listLogs \
2
+ --userId [USER_ID] \
3
+
@@ -0,0 +1,2 @@
1
+ appwrite users listMemberships \
2
+ --userId [USER_ID]
@@ -0,0 +1,2 @@
1
+ appwrite users listSessions \
2
+ --userId [USER_ID]
@@ -1,7 +1,3 @@
1
1
  appwrite users list \
2
2
 
3
3
 
4
-
5
-
6
-
7
-
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/0.18.5/appwrite-cli-win-x64.exe"
17
- $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/0.18.5/appwrite-cli-win-arm64.exe"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.0.0/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.0.0/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="0.18.5"
100
+ GITHUB_LATEST_VERSION="1.0.0"
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
@@ -12,9 +12,12 @@ class Client {
12
12
  this.endpoint = 'https://HOSTNAME/v1';
13
13
  this.headers = {
14
14
  'content-type': '',
15
- 'x-sdk-version': 'appwrite:cli:0.18.5',
16
- 'User-Agent' : `AppwriteCLI/0.18.5 (${os.type()} ${os.version()}; ${os.arch()})`,
17
- 'X-Appwrite-Response-Format' : '0.15.0',
15
+ 'x-sdk-name': 'Command Line',
16
+ 'x-sdk-platform': 'console',
17
+ 'x-sdk-language': 'cli',
18
+ 'x-sdk-version': '1.0.0',
19
+ 'user-agent' : `AppwriteCLI/1.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
20
+ 'X-Appwrite-Response-Format' : '1.0.0',
18
21
  };
19
22
  }
20
23
 
@@ -184,6 +187,7 @@ class Client {
184
187
  method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? formData : params,
185
188
  json: contentType.startsWith("application/json"),
186
189
  transformRequest: method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? undefined : (data) => JSONbig.stringify(data),
190
+ transformResponse: [ (data) => data ? JSONbig.parse(data) : data ],
187
191
  responseType: responseType,
188
192
  };
189
193
  try {