appwrite-cli 10.0.1 → 10.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.2.1
4
+
5
+ * Add transaction support for Databases and TablesDB
6
+
7
+ ## 10.1.0
8
+
9
+ * Deprecate `createVerification` method in `Account` service
10
+ * Add `createEmailVerification` method in `Account` service
11
+
3
12
  ## 10.0.1
4
13
 
5
14
  * Fix CLI Dart model generation issues
package/README.md CHANGED
@@ -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
- 10.0.1
32
+ 10.2.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
- 10.0.1
63
+ 10.2.1
64
64
  ```
65
65
 
66
66
  ## Getting Started
@@ -0,0 +1,2 @@
1
+ appwrite account create-email-verification \
2
+ --url https://example.com
@@ -0,0 +1,3 @@
1
+ appwrite account update-email-verification \
2
+ --user-id <USER_ID> \
3
+ --secret <SECRET>
@@ -0,0 +1,2 @@
1
+ appwrite databases create-operations \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1 @@
1
+ appwrite databases create-transaction
@@ -0,0 +1,2 @@
1
+ appwrite databases delete-transaction \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1,2 @@
1
+ appwrite databases get-transaction \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1 @@
1
+ appwrite databases list-transactions
@@ -0,0 +1,2 @@
1
+ appwrite databases update-transaction \
2
+ --transaction-id <TRANSACTION_ID>
@@ -1,4 +1,4 @@
1
1
  appwrite migrations create-csv-migration \
2
2
  --bucket-id <BUCKET_ID> \
3
3
  --file-id <FILE_ID> \
4
- --resource-id [ID1:ID2]
4
+ --resource-id <ID1:ID2>
@@ -0,0 +1,2 @@
1
+ appwrite tables-db create-operations \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1 @@
1
+ appwrite tables-db create-transaction
@@ -0,0 +1,2 @@
1
+ appwrite tables-db delete-transaction \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1,2 @@
1
+ appwrite tables-db get-transaction \
2
+ --transaction-id <TRANSACTION_ID>
@@ -0,0 +1 @@
1
+ appwrite tables-db list-transactions
@@ -0,0 +1,2 @@
1
+ appwrite tables-db update-transaction \
2
+ --transaction-id <TRANSACTION_ID>
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/10.0.1/appwrite-cli-win-x64.exe"
17
- $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.1/appwrite-cli-win-arm64.exe"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.2.1/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.2.1/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="10.0.1"
100
+ GITHUB_LATEST_VERSION="10.2.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
 
package/lib/client.js CHANGED
@@ -16,8 +16,8 @@ class Client {
16
16
  'x-sdk-name': 'Command Line',
17
17
  'x-sdk-platform': 'console',
18
18
  'x-sdk-language': 'cli',
19
- 'x-sdk-version': '10.0.1',
20
- 'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
19
+ 'x-sdk-version': '10.2.1',
20
+ 'user-agent' : `AppwriteCLI/10.2.1 (${os.type()} ${os.version()}; ${os.arch()})`,
21
21
  'X-Appwrite-Response-Format' : '1.8.0',
22
22
  };
23
23
  }
@@ -1527,6 +1527,39 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid
1527
1527
 
1528
1528
  return response;
1529
1529
 
1530
+ }
1531
+ /**
1532
+ * @typedef {Object} AccountCreateEmailVerificationRequestParams
1533
+ * @property {string} url URL to redirect the user back to your app from the verification 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.
1534
+ * @property {boolean} overrideForCli
1535
+ * @property {boolean} parseOutput
1536
+ * @property {libClient | undefined} sdk
1537
+ */
1538
+
1539
+ /**
1540
+ * @param {AccountCreateEmailVerificationRequestParams} params
1541
+ */
1542
+ const accountCreateEmailVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1543
+ let client = !sdk ? await sdkForProject() :
1544
+ sdk;
1545
+ let apiPath = '/account/verifications/email';
1546
+ let payload = {};
1547
+ if (typeof url !== 'undefined') {
1548
+ payload['url'] = url;
1549
+ }
1550
+
1551
+ let response = undefined;
1552
+
1553
+ response = await client.call('post', apiPath, {
1554
+ 'content-type': 'application/json',
1555
+ }, payload);
1556
+
1557
+ if (parseOutput) {
1558
+ parse(response)
1559
+ }
1560
+
1561
+ return response;
1562
+
1530
1563
  }
1531
1564
  /**
1532
1565
  * @typedef {Object} AccountCreateVerificationRequestParams
@@ -1542,7 +1575,7 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid
1542
1575
  const accountCreateVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1543
1576
  let client = !sdk ? await sdkForProject() :
1544
1577
  sdk;
1545
- let apiPath = '/account/verification';
1578
+ let apiPath = '/account/verifications/email';
1546
1579
  let payload = {};
1547
1580
  if (typeof url !== 'undefined') {
1548
1581
  payload['url'] = url;
@@ -1560,6 +1593,43 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli
1560
1593
 
1561
1594
  return response;
1562
1595
 
1596
+ }
1597
+ /**
1598
+ * @typedef {Object} AccountUpdateEmailVerificationRequestParams
1599
+ * @property {string} userId User ID.
1600
+ * @property {string} secret Valid verification token.
1601
+ * @property {boolean} overrideForCli
1602
+ * @property {boolean} parseOutput
1603
+ * @property {libClient | undefined} sdk
1604
+ */
1605
+
1606
+ /**
1607
+ * @param {AccountUpdateEmailVerificationRequestParams} params
1608
+ */
1609
+ const accountUpdateEmailVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1610
+ let client = !sdk ? await sdkForProject() :
1611
+ sdk;
1612
+ let apiPath = '/account/verifications/email';
1613
+ let payload = {};
1614
+ if (typeof userId !== 'undefined') {
1615
+ payload['userId'] = userId;
1616
+ }
1617
+ if (typeof secret !== 'undefined') {
1618
+ payload['secret'] = secret;
1619
+ }
1620
+
1621
+ let response = undefined;
1622
+
1623
+ response = await client.call('put', apiPath, {
1624
+ 'content-type': 'application/json',
1625
+ }, payload);
1626
+
1627
+ if (parseOutput) {
1628
+ parse(response)
1629
+ }
1630
+
1631
+ return response;
1632
+
1563
1633
  }
1564
1634
  /**
1565
1635
  * @typedef {Object} AccountUpdateVerificationRequestParams
@@ -1576,7 +1646,7 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli
1576
1646
  const accountUpdateVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1577
1647
  let client = !sdk ? await sdkForProject() :
1578
1648
  sdk;
1579
- let apiPath = '/account/verification';
1649
+ let apiPath = '/account/verifications/email';
1580
1650
  let payload = {};
1581
1651
  if (typeof userId !== 'undefined') {
1582
1652
  payload['userId'] = userId;
@@ -1611,7 +1681,7 @@ const accountUpdateVerification = async ({userId,secret,parseOutput = true, over
1611
1681
  const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1612
1682
  let client = !sdk ? await sdkForProject() :
1613
1683
  sdk;
1614
- let apiPath = '/account/verification/phone';
1684
+ let apiPath = '/account/verifications/phone';
1615
1685
  let payload = {};
1616
1686
 
1617
1687
  let response = undefined;
@@ -1642,7 +1712,7 @@ const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCl
1642
1712
  const accountUpdatePhoneVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1643
1713
  let client = !sdk ? await sdkForProject() :
1644
1714
  sdk;
1645
- let apiPath = '/account/verification/phone';
1715
+ let apiPath = '/account/verifications/phone';
1646
1716
  let payload = {};
1647
1717
  if (typeof userId !== 'undefined') {
1648
1718
  payload['userId'] = userId;
@@ -1949,16 +2019,29 @@ account
1949
2019
  .action(actionRunner(accountCreatePhoneToken))
1950
2020
 
1951
2021
  account
1952
- .command(`create-verification`)
2022
+ .command(`create-email-verification`)
1953
2023
  .description(`Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
1954
2024
  .requiredOption(`--url <url>`, `URL to redirect the user back to your app from the verification 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.`)
2025
+ .action(actionRunner(accountCreateEmailVerification))
2026
+
2027
+ account
2028
+ .command(`create-verification`)
2029
+ .description(`[**DEPRECATED** - This command is deprecated. Please use 'account create-email-verification' instead] Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
2030
+ .requiredOption(`--url <url>`, `URL to redirect the user back to your app from the verification 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.`)
1955
2031
  .action(actionRunner(accountCreateVerification))
1956
2032
 
1957
2033
  account
1958
- .command(`update-verification`)
2034
+ .command(`update-email-verification`)
1959
2035
  .description(`Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.`)
1960
2036
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1961
2037
  .requiredOption(`--secret <secret>`, `Valid verification token.`)
2038
+ .action(actionRunner(accountUpdateEmailVerification))
2039
+
2040
+ account
2041
+ .command(`update-verification`)
2042
+ .description(`[**DEPRECATED** - This command is deprecated. Please use 'account update-email-verification' instead] Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.`)
2043
+ .requiredOption(`--user-id <user-id>`, `User ID.`)
2044
+ .requiredOption(`--secret <secret>`, `Valid verification token.`)
1962
2045
  .action(actionRunner(accountUpdateVerification))
1963
2046
 
1964
2047
  account
@@ -2019,7 +2102,9 @@ module.exports = {
2019
2102
  accountCreateMagicURLToken,
2020
2103
  accountCreateOAuth2Token,
2021
2104
  accountCreatePhoneToken,
2105
+ accountCreateEmailVerification,
2022
2106
  accountCreateVerification,
2107
+ accountUpdateEmailVerification,
2023
2108
  accountUpdateVerification,
2024
2109
  accountCreatePhoneVerification,
2025
2110
  accountUpdatePhoneVerification