appwrite-cli 10.0.0 → 10.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.1.0
4
+
5
+ * Deprecate `createVerification` method in `Account` service
6
+ * Add `createEmailVerification` method in `Account` service
7
+
8
+ ## 10.0.1
9
+
10
+ * Fix CLI Dart model generation issues
11
+ * Fix row permissions and security sync
12
+ * Fix error when pushing columns with relationships
13
+ * Fix resource name from attributes to columns for TablesDB indexes
14
+
3
15
  ## 10.0.0
4
16
 
5
17
  * **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted
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.0
32
+ 10.1.0
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.0
63
+ 10.1.0
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>
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.0/appwrite-cli-win-x64.exe"
17
- $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-arm64.exe"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.0/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.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="10.0.0"
100
+ GITHUB_LATEST_VERSION="10.1.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
@@ -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.0',
20
- 'user-agent' : `AppwriteCLI/10.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
19
+ 'x-sdk-version': '10.1.0',
20
+ 'user-agent' : `AppwriteCLI/10.1.0 (${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
@@ -1541,7 +1541,7 @@ functions
1541
1541
 
1542
1542
  functions
1543
1543
  .command(`create-template-deployment`)
1544
- .description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details.`)
1544
+ .description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.`)
1545
1545
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1546
1546
  .requiredOption(`--repository <repository>`, `Repository name of the template.`)
1547
1547
  .requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
@@ -1234,7 +1234,7 @@ const projectsListPlatforms = async ({projectId,parseOutput = true, overrideForC
1234
1234
  /**
1235
1235
  * @typedef {Object} ProjectsCreatePlatformRequestParams
1236
1236
  * @property {string} projectId Project unique ID.
1237
- * @property {PlatformType} type Platform type.
1237
+ * @property {PlatformType} type Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.
1238
1238
  * @property {string} name Platform name. Max length: 128 chars.
1239
1239
  * @property {string} key Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.
1240
1240
  * @property {string} store App store or Google Play store ID. Max length: 256 chars.
@@ -2354,7 +2354,7 @@ projects
2354
2354
  .command(`create-platform`)
2355
2355
  .description(`Create a new platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API.`)
2356
2356
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2357
- .requiredOption(`--type <type>`, `Platform type.`)
2357
+ .requiredOption(`--type <type>`, `Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.`)
2358
2358
  .requiredOption(`--name <name>`, `Platform name. Max length: 128 chars.`)
2359
2359
  .option(`--key <key>`, `Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.`)
2360
2360
  .option(`--store <store>`, `App store or Google Play store ID. Max length: 256 chars.`)
@@ -358,7 +358,7 @@ const pullTable = async () => {
358
358
  });
359
359
  if (fetchResponse["databases"].length <= 0) {
360
360
  log("No tables found.");
361
- success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`);
361
+ success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tableDBs.`);
362
362
  return;
363
363
  }
364
364
 
@@ -398,7 +398,7 @@ const pullTable = async () => {
398
398
  }
399
399
  }
400
400
 
401
- success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`);
401
+ success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tableDBs.`);
402
402
  }
403
403
 
404
404
  const pullBucket = async () => {
@@ -50,10 +50,12 @@ const {
50
50
  databasesUpdateCollection
51
51
  } = require("./databases");
52
52
  const {
53
+ tablesDBCreate,
53
54
  tablesDBGet,
55
+ tablesDBUpdate,
56
+ tablesDBCreateTable,
54
57
  tablesDBGetTable,
55
- tablesDBUpdateTable,
56
- tablesDBCreateTable
58
+ tablesDBUpdateTable
57
59
  } = require("./tables-db");
58
60
  const {
59
61
  storageGetBucket, storageUpdateBucket, storageCreateBucket
@@ -548,7 +550,7 @@ const createAttribute = (databaseId, collectionId, attribute) => {
548
550
  return databasesCreateRelationshipAttribute({
549
551
  databaseId,
550
552
  collectionId,
551
- relatedCollectionId: attribute.relatedCollection,
553
+ relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
552
554
  type: attribute.relationType,
553
555
  twoWay: attribute.twoWay,
554
556
  key: attribute.key,
@@ -667,7 +669,7 @@ const updateAttribute = (databaseId, collectionId, attribute) => {
667
669
  return databasesUpdateRelationshipAttribute({
668
670
  databaseId,
669
671
  collectionId,
670
- relatedCollectionId: attribute.relatedCollection,
672
+ relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
671
673
  type: attribute.relationType,
672
674
  twoWay: attribute.twoWay,
673
675
  key: attribute.key,
@@ -881,7 +883,7 @@ const createIndexes = async (indexes, collection) => {
881
883
  collectionId: collection['$id'],
882
884
  key: index.key,
883
885
  type: index.type,
884
- attributes: index.attributes,
886
+ attributes: index.columns ?? index.attributes,
885
887
  orders: index.orders,
886
888
  parseOutput: false
887
889
  });
@@ -1730,7 +1732,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1730
1732
 
1731
1733
  const databases = Array.from(new Set(tables.map(table => table['databaseId'])));
1732
1734
 
1733
- // Parallel db actions
1735
+ // Parallel tablesDB actions
1734
1736
  await Promise.all(databases.map(async (databaseId) => {
1735
1737
  const localDatabase = localConfig.getTablesDB(databaseId);
1736
1738
 
@@ -1741,7 +1743,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1741
1743
  });
1742
1744
 
1743
1745
  if (database.name !== (localDatabase.name ?? databaseId)) {
1744
- await databasesUpdate({
1746
+ await tablesDBUpdate({
1745
1747
  databaseId: databaseId,
1746
1748
  name: localDatabase.name ?? databaseId,
1747
1749
  parseOutput: false
@@ -1752,7 +1754,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1752
1754
  } catch (err) {
1753
1755
  log(`Database ${databaseId} not found. Creating it now ...`);
1754
1756
 
1755
- await databasesCreate({
1757
+ await tablesDBCreate({
1756
1758
  databaseId: databaseId,
1757
1759
  name: localDatabase.name ?? databaseId,
1758
1760
  parseOutput: false,
@@ -1761,10 +1763,12 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1761
1763
  }));
1762
1764
 
1763
1765
 
1764
- if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
1766
+ if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId'))) {
1765
1767
  return;
1766
1768
  }
1767
- // Parallel collection actions
1769
+ let tablesChanged = new Set();
1770
+
1771
+ // Parallel tables actions
1768
1772
  await Promise.all(tables.map(async (table) => {
1769
1773
  try {
1770
1774
  const remoteTable = await tablesDBGetTable({
@@ -1773,15 +1777,23 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1773
1777
  parseOutput: false,
1774
1778
  });
1775
1779
 
1776
- if (remoteTable.name !== table.name) {
1780
+ const changes = [];
1781
+ if (remoteTable.name !== table.name) changes.push('name');
1782
+ if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity');
1783
+ if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions');
1784
+
1785
+ if (changes.length > 0) {
1777
1786
  await tablesDBUpdateTable({
1778
1787
  databaseId: table['databaseId'],
1779
1788
  tableId: table['$id'],
1780
1789
  name: table.name,
1781
- parseOutput: false
1790
+ parseOutput: false,
1791
+ rowSecurity: table.rowSecurity,
1792
+ permissions: table['$permissions']
1782
1793
  })
1783
1794
 
1784
- success(`Updated ${table.name} ( ${table['$id']} ) name`);
1795
+ success(`Updated ${table.name} ( ${table['$id']} ) - ${changes.join(', ')}`);
1796
+ tablesChanged.add(table['$id']);
1785
1797
  }
1786
1798
  table.remoteVersion = remoteTable;
1787
1799
 
@@ -1794,16 +1806,19 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1794
1806
  databaseId: table['databaseId'],
1795
1807
  tableId: table['$id'],
1796
1808
  name: table.name,
1797
- documentSecurity: table.documentSecurity,
1809
+ rowSecurity: table.rowSecurity,
1798
1810
  permissions: table['$permissions'],
1799
1811
  parseOutput: false
1800
1812
  })
1813
+
1814
+ success(`Created ${table.name} ( ${table['$id']} )`);
1815
+ tablesChanged.add(table['$id']);
1801
1816
  } else {
1802
1817
  throw e;
1803
1818
  }
1804
1819
  }
1805
1820
  }))
1806
- let numberOfTables = 0;
1821
+
1807
1822
  // Serialize attribute actions
1808
1823
  for (let table of tables) {
1809
1824
  let columns = table.columns;
@@ -1831,11 +1846,11 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1831
1846
  } catch (e) {
1832
1847
  throw e;
1833
1848
  }
1834
- numberOfTables++;
1849
+ tablesChanged.add(table['$id']);
1835
1850
  success(`Successfully pushed ${table.name} ( ${table['$id']} )`);
1836
1851
  }
1837
1852
 
1838
- success(`Successfully pushed ${numberOfTables} tables`);
1853
+ success(`Successfully pushed ${tablesChanged.size} tables`);
1839
1854
  }
1840
1855
 
1841
1856
  const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
@@ -1482,7 +1482,7 @@ sites
1482
1482
 
1483
1483
  sites
1484
1484
  .command(`create-template-deployment`)
1485
- .description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.`)
1485
+ .description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.`)
1486
1486
  .requiredOption(`--site-id <site-id>`, `Site ID.`)
1487
1487
  .requiredOption(`--repository <repository>`, `Repository name of the template.`)
1488
1488
  .requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
@@ -503,7 +503,7 @@ const tablesDBListColumns = async ({databaseId,tableId,queries,parseOutput = tru
503
503
  /**
504
504
  * @typedef {Object} TablesDBCreateBooleanColumnRequestParams
505
505
  * @property {string} databaseId Database ID.
506
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
506
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
507
507
  * @property {string} key Column Key.
508
508
  * @property {boolean} required Is column required?
509
509
  * @property {boolean} xdefault Default value for column when not provided. Cannot be set when column is required.
@@ -550,7 +550,7 @@ const tablesDBCreateBooleanColumn = async ({databaseId,tableId,key,required,xdef
550
550
  /**
551
551
  * @typedef {Object} TablesDBUpdateBooleanColumnRequestParams
552
552
  * @property {string} databaseId Database ID.
553
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
553
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
554
554
  * @property {string} key Column Key.
555
555
  * @property {boolean} required Is column required?
556
556
  * @property {boolean} xdefault Default value for column when not provided. Cannot be set when column is required.
@@ -1182,7 +1182,7 @@ const tablesDBUpdateIpColumn = async ({databaseId,tableId,key,required,xdefault,
1182
1182
  /**
1183
1183
  * @typedef {Object} TablesDBCreateLineColumnRequestParams
1184
1184
  * @property {string} databaseId Database ID.
1185
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1185
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1186
1186
  * @property {string} key Column Key.
1187
1187
  * @property {boolean} required Is column required?
1188
1188
  * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.
@@ -1226,7 +1226,7 @@ const tablesDBCreateLineColumn = async ({databaseId,tableId,key,required,xdefaul
1226
1226
  /**
1227
1227
  * @typedef {Object} TablesDBUpdateLineColumnRequestParams
1228
1228
  * @property {string} databaseId Database ID.
1229
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1229
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1230
1230
  * @property {string} key Column Key.
1231
1231
  * @property {boolean} required Is column required?
1232
1232
  * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.
@@ -1271,7 +1271,7 @@ const tablesDBUpdateLineColumn = async ({databaseId,tableId,key,required,xdefaul
1271
1271
  /**
1272
1272
  * @typedef {Object} TablesDBCreatePointColumnRequestParams
1273
1273
  * @property {string} databaseId Database ID.
1274
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1274
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1275
1275
  * @property {string} key Column Key.
1276
1276
  * @property {boolean} required Is column required?
1277
1277
  * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.
@@ -1315,7 +1315,7 @@ const tablesDBCreatePointColumn = async ({databaseId,tableId,key,required,xdefau
1315
1315
  /**
1316
1316
  * @typedef {Object} TablesDBUpdatePointColumnRequestParams
1317
1317
  * @property {string} databaseId Database ID.
1318
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1318
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1319
1319
  * @property {string} key Column Key.
1320
1320
  * @property {boolean} required Is column required?
1321
1321
  * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.
@@ -1360,7 +1360,7 @@ const tablesDBUpdatePointColumn = async ({databaseId,tableId,key,required,xdefau
1360
1360
  /**
1361
1361
  * @typedef {Object} TablesDBCreatePolygonColumnRequestParams
1362
1362
  * @property {string} databaseId Database ID.
1363
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1363
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1364
1364
  * @property {string} key Column Key.
1365
1365
  * @property {boolean} required Is column required?
1366
1366
  * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.
@@ -1404,7 +1404,7 @@ const tablesDBCreatePolygonColumn = async ({databaseId,tableId,key,required,xdef
1404
1404
  /**
1405
1405
  * @typedef {Object} TablesDBUpdatePolygonColumnRequestParams
1406
1406
  * @property {string} databaseId Database ID.
1407
- * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1407
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1408
1408
  * @property {string} key Column Key.
1409
1409
  * @property {boolean} required Is column required?
1410
1410
  * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.
@@ -1504,7 +1504,7 @@ const tablesDBCreateRelationshipColumn = async ({databaseId,tableId,relatedTable
1504
1504
  /**
1505
1505
  * @typedef {Object} TablesDBCreateStringColumnRequestParams
1506
1506
  * @property {string} databaseId Database ID.
1507
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1507
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1508
1508
  * @property {string} key Column Key.
1509
1509
  * @property {number} size Column size for text columns, in number of characters.
1510
1510
  * @property {boolean} required Is column required?
@@ -1559,7 +1559,7 @@ const tablesDBCreateStringColumn = async ({databaseId,tableId,key,size,required,
1559
1559
  /**
1560
1560
  * @typedef {Object} TablesDBUpdateStringColumnRequestParams
1561
1561
  * @property {string} databaseId Database ID.
1562
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1562
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1563
1563
  * @property {string} key Column Key.
1564
1564
  * @property {boolean} required Is column required?
1565
1565
  * @property {string} xdefault Default value for column when not provided. Cannot be set when column is required.
@@ -1805,7 +1805,7 @@ const tablesDBUpdateRelationshipColumn = async ({databaseId,tableId,key,onDelete
1805
1805
  /**
1806
1806
  * @typedef {Object} TablesDBListIndexesRequestParams
1807
1807
  * @property {string} databaseId Database ID.
1808
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1808
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1809
1809
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, status, attributes, error
1810
1810
  * @property {boolean} overrideForCli
1811
1811
  * @property {boolean} parseOutput
@@ -1843,7 +1843,7 @@ const tablesDBListIndexes = async ({databaseId,tableId,queries,parseOutput = tru
1843
1843
  /**
1844
1844
  * @typedef {Object} TablesDBCreateIndexRequestParams
1845
1845
  * @property {string} databaseId Database ID.
1846
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1846
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1847
1847
  * @property {string} key Index Key.
1848
1848
  * @property {IndexType} type Index type.
1849
1849
  * @property {string[]} columns Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.
@@ -1897,7 +1897,7 @@ const tablesDBCreateIndex = async ({databaseId,tableId,key,type,columns,orders,l
1897
1897
  /**
1898
1898
  * @typedef {Object} TablesDBGetIndexRequestParams
1899
1899
  * @property {string} databaseId Database ID.
1900
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1900
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1901
1901
  * @property {string} key Index Key.
1902
1902
  * @property {boolean} overrideForCli
1903
1903
  * @property {boolean} parseOutput
@@ -1928,7 +1928,7 @@ const tablesDBGetIndex = async ({databaseId,tableId,key,parseOutput = true, over
1928
1928
  /**
1929
1929
  * @typedef {Object} TablesDBDeleteIndexRequestParams
1930
1930
  * @property {string} databaseId Database ID.
1931
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
1931
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
1932
1932
  * @property {string} key Index Key.
1933
1933
  * @property {boolean} overrideForCli
1934
1934
  * @property {boolean} parseOutput
@@ -1998,7 +1998,7 @@ const tablesDBListTableLogs = async ({databaseId,tableId,queries,parseOutput = t
1998
1998
  /**
1999
1999
  * @typedef {Object} TablesDBListRowsRequestParams
2000
2000
  * @property {string} databaseId Database ID.
2001
- * @property {string} tableId Table ID. You can create a new table using the TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate).
2001
+ * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
2002
2002
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2003
2003
  * @property {boolean} overrideForCli
2004
2004
  * @property {boolean} parseOutput
@@ -2036,7 +2036,7 @@ const tablesDBListRows = async ({databaseId,tableId,queries,parseOutput = true,
2036
2036
  /**
2037
2037
  * @typedef {Object} TablesDBCreateRowRequestParams
2038
2038
  * @property {string} databaseId Database ID.
2039
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.
2039
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
2040
2040
  * @property {string} rowId Row ID. Choose a custom ID or generate a random ID with &#039;ID.unique()&#039;. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
2041
2041
  * @property {object} data Row data as JSON object.
2042
2042
  * @property {string[]} permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
@@ -2080,7 +2080,7 @@ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2080
2080
  /**
2081
2081
  * @typedef {Object} TablesDBCreateRowsRequestParams
2082
2082
  * @property {string} databaseId Database ID.
2083
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.
2083
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
2084
2084
  * @property {object[]} rows Array of rows data as JSON objects.
2085
2085
  * @property {boolean} overrideForCli
2086
2086
  * @property {boolean} parseOutput
@@ -2192,7 +2192,7 @@ const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,parseOutput =
2192
2192
  /**
2193
2193
  * @typedef {Object} TablesDBDeleteRowsRequestParams
2194
2194
  * @property {string} databaseId Database ID.
2195
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
2195
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2196
2196
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2197
2197
  * @property {boolean} overrideForCli
2198
2198
  * @property {boolean} parseOutput
@@ -2228,7 +2228,7 @@ const tablesDBDeleteRows = async ({databaseId,tableId,queries,parseOutput = true
2228
2228
  /**
2229
2229
  * @typedef {Object} TablesDBGetRowRequestParams
2230
2230
  * @property {string} databaseId Database ID.
2231
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
2231
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2232
2232
  * @property {string} rowId Row ID.
2233
2233
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2234
2234
  * @property {boolean} overrideForCli
@@ -2349,7 +2349,7 @@ const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2349
2349
  /**
2350
2350
  * @typedef {Object} TablesDBDeleteRowRequestParams
2351
2351
  * @property {string} databaseId Database ID.
2352
- * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).
2352
+ * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2353
2353
  * @property {string} rowId Row ID.
2354
2354
  * @property {boolean} overrideForCli
2355
2355
  * @property {boolean} parseOutput
@@ -2625,7 +2625,7 @@ tablesDB
2625
2625
 
2626
2626
  tablesDB
2627
2627
  .command(`create-table`)
2628
- .description(`Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console.`)
2628
+ .description(`Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.`)
2629
2629
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2630
2630
  .requiredOption(`--table-id <table-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
2631
2631
  .requiredOption(`--name <name>`, `Table name. Max length: 128 chars.`)
@@ -2673,7 +2673,7 @@ tablesDB
2673
2673
  .command(`create-boolean-column`)
2674
2674
  .description(`Create a boolean column. `)
2675
2675
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2676
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2676
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2677
2677
  .requiredOption(`--key <key>`, `Column Key.`)
2678
2678
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2679
2679
  .option(`--xdefault [value]`, `Default value for column when not provided. Cannot be set when column is required.`, (value) => value === undefined ? true : parseBool(value))
@@ -2684,7 +2684,7 @@ tablesDB
2684
2684
  .command(`update-boolean-column`)
2685
2685
  .description(`Update a boolean column. Changing the 'default' value will not update already existing rows.`)
2686
2686
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2687
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2687
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2688
2688
  .requiredOption(`--key <key>`, `Column Key.`)
2689
2689
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2690
2690
  .option(`--xdefault [value]`, `Default value for column when not provided. Cannot be set when column is required.`, (value) => value === undefined ? true : parseBool(value))
@@ -2837,7 +2837,7 @@ tablesDB
2837
2837
  .command(`create-line-column`)
2838
2838
  .description(`Create a geometric line column.`)
2839
2839
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2840
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2840
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2841
2841
  .requiredOption(`--key <key>`, `Column Key.`)
2842
2842
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2843
2843
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`)
@@ -2847,7 +2847,7 @@ tablesDB
2847
2847
  .command(`update-line-column`)
2848
2848
  .description(`Update a line column. Changing the 'default' value will not update already existing rows.`)
2849
2849
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2850
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2850
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2851
2851
  .requiredOption(`--key <key>`, `Column Key.`)
2852
2852
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2853
2853
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`)
@@ -2858,7 +2858,7 @@ tablesDB
2858
2858
  .command(`create-point-column`)
2859
2859
  .description(`Create a geometric point column.`)
2860
2860
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2861
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2861
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2862
2862
  .requiredOption(`--key <key>`, `Column Key.`)
2863
2863
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2864
2864
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.`)
@@ -2868,7 +2868,7 @@ tablesDB
2868
2868
  .command(`update-point-column`)
2869
2869
  .description(`Update a point column. Changing the 'default' value will not update already existing rows.`)
2870
2870
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2871
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2871
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2872
2872
  .requiredOption(`--key <key>`, `Column Key.`)
2873
2873
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2874
2874
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.`)
@@ -2879,7 +2879,7 @@ tablesDB
2879
2879
  .command(`create-polygon-column`)
2880
2880
  .description(`Create a geometric polygon column.`)
2881
2881
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2882
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2882
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2883
2883
  .requiredOption(`--key <key>`, `Column Key.`)
2884
2884
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2885
2885
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.`)
@@ -2889,7 +2889,7 @@ tablesDB
2889
2889
  .command(`update-polygon-column`)
2890
2890
  .description(`Update a polygon column. Changing the 'default' value will not update already existing rows.`)
2891
2891
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2892
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2892
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2893
2893
  .requiredOption(`--key <key>`, `Column Key.`)
2894
2894
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2895
2895
  .option(`--xdefault <xdefault>`, `Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.`)
@@ -2913,7 +2913,7 @@ tablesDB
2913
2913
  .command(`create-string-column`)
2914
2914
  .description(`Create a string column. `)
2915
2915
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2916
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2916
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2917
2917
  .requiredOption(`--key <key>`, `Column Key.`)
2918
2918
  .requiredOption(`--size <size>`, `Column size for text columns, in number of characters.`, parseInteger)
2919
2919
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
@@ -2926,7 +2926,7 @@ tablesDB
2926
2926
  .command(`update-string-column`)
2927
2927
  .description(`Update a string column. Changing the 'default' value will not update already existing rows. `)
2928
2928
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2929
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2929
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2930
2930
  .requiredOption(`--key <key>`, `Column Key.`)
2931
2931
  .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value))
2932
2932
  .option(`--xdefault <xdefault>`, `Default value for column when not provided. Cannot be set when column is required.`)
@@ -2987,7 +2987,7 @@ tablesDB
2987
2987
  .command(`list-indexes`)
2988
2988
  .description(`List indexes on the table.`)
2989
2989
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2990
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2990
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
2991
2991
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, status, attributes, error`)
2992
2992
  .option(`--console`, `Get the resource console url`)
2993
2993
  .action(actionRunner(tablesDBListIndexes))
@@ -2996,7 +2996,7 @@ tablesDB
2996
2996
  .command(`create-index`)
2997
2997
  .description(`Creates an index on the columns listed. Your index should include all the columns you will query in a single request. Type can be 'key', 'fulltext', or 'unique'.`)
2998
2998
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2999
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
2999
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3000
3000
  .requiredOption(`--key <key>`, `Index Key.`)
3001
3001
  .requiredOption(`--type <type>`, `Index type.`)
3002
3002
  .requiredOption(`--columns [columns...]`, `Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.`)
@@ -3008,7 +3008,7 @@ tablesDB
3008
3008
  .command(`get-index`)
3009
3009
  .description(`Get index by ID.`)
3010
3010
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3011
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
3011
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3012
3012
  .requiredOption(`--key <key>`, `Index Key.`)
3013
3013
  .action(actionRunner(tablesDBGetIndex))
3014
3014
 
@@ -3016,7 +3016,7 @@ tablesDB
3016
3016
  .command(`delete-index`)
3017
3017
  .description(`Delete an index.`)
3018
3018
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3019
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
3019
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3020
3020
  .requiredOption(`--key <key>`, `Index Key.`)
3021
3021
  .action(actionRunner(tablesDBDeleteIndex))
3022
3022
 
@@ -3033,16 +3033,16 @@ tablesDB
3033
3033
  .command(`list-rows`)
3034
3034
  .description(`Get a list of all the user's rows in a given table. You can use the query params to filter your results.`)
3035
3035
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3036
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate).`)
3036
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).`)
3037
3037
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3038
3038
  .option(`--console`, `Get the resource console url`)
3039
3039
  .action(actionRunner(tablesDBListRows))
3040
3040
 
3041
3041
  tablesDB
3042
3042
  .command(`create-row`)
3043
- .description(`Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console.`)
3043
+ .description(`Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.`)
3044
3044
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3045
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.`)
3045
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.`)
3046
3046
  .requiredOption(`--row-id <row-id>`, `Row ID. Choose a custom ID or generate a random ID with 'ID.unique()'. 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.`)
3047
3047
  .requiredOption(`--data <data>`, `Row data as JSON object.`)
3048
3048
  .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
@@ -3050,15 +3050,15 @@ tablesDB
3050
3050
 
3051
3051
  tablesDB
3052
3052
  .command(`create-rows`)
3053
- .description(`Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console.`)
3053
+ .description(`Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.`)
3054
3054
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3055
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.`)
3055
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.`)
3056
3056
  .requiredOption(`--rows [rows...]`, `Array of rows data as JSON objects.`)
3057
3057
  .action(actionRunner(tablesDBCreateRows))
3058
3058
 
3059
3059
  tablesDB
3060
3060
  .command(`upsert-rows`)
3061
- .description(`Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. `)
3061
+ .description(`Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. `)
3062
3062
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3063
3063
  .requiredOption(`--table-id <table-id>`, `Table ID.`)
3064
3064
  .requiredOption(`--rows [rows...]`, `Array of row data as JSON objects. May contain partial rows.`)
@@ -3077,7 +3077,7 @@ tablesDB
3077
3077
  .command(`delete-rows`)
3078
3078
  .description(`Bulk delete rows using queries, if no queries are passed then all rows are deleted.`)
3079
3079
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3080
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
3080
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3081
3081
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3082
3082
  .action(actionRunner(tablesDBDeleteRows))
3083
3083
 
@@ -3085,7 +3085,7 @@ tablesDB
3085
3085
  .command(`get-row`)
3086
3086
  .description(`Get a row by its unique ID. This endpoint response returns a JSON object with the row data.`)
3087
3087
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3088
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
3088
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3089
3089
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3090
3090
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3091
3091
  .option(`--console`, `Get the resource console url`)
@@ -3093,7 +3093,7 @@ tablesDB
3093
3093
 
3094
3094
  tablesDB
3095
3095
  .command(`upsert-row`)
3096
- .description(`Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console.`)
3096
+ .description(`Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.`)
3097
3097
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3098
3098
  .requiredOption(`--table-id <table-id>`, `Table ID.`)
3099
3099
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
@@ -3115,7 +3115,7 @@ tablesDB
3115
3115
  .command(`delete-row`)
3116
3116
  .description(`Delete a row by its unique ID.`)
3117
3117
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3118
- .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`)
3118
+ .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3119
3119
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3120
3120
  .action(actionRunner(tablesDBDeleteRow))
3121
3121
 
package/lib/config.js CHANGED
@@ -9,7 +9,7 @@ const KeysSite = new Set(["path", "$id", "name", "enabled", "logging", "timeout"
9
9
  const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logging", "runtime", "specification", "scopes", "events", "schedule", "timeout", "entrypoint", "commands", "vars"]);
10
10
  const KeysDatabase = new Set(["$id", "name", "enabled"]);
11
11
  const KeysCollection = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "documentSecurity", "attributes", "indexes"]);
12
- const KeysTable = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "documentSecurity", "columns", "indexes"]);
12
+ const KeysTable = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "rowSecurity", "columns", "indexes"]);
13
13
  const KeysStorage = new Set(["$id", "$permissions", "fileSecurity", "name", "enabled", "maximumFileSize", "allowedFileExtensions", "compression", "encryption", "antivirus"]);
14
14
  const KeysTopics = new Set(["$id", "name", "subscribe"]);
15
15
  const KeysTeams = new Set(["$id", "name"]);
@@ -62,12 +62,13 @@ const KeysColumns = new Set([
62
62
  "onDelete",
63
63
  "side",
64
64
  // Indexes
65
- "attributes",
65
+ "columns",
66
66
  "orders",
67
67
  // Strings
68
68
  "encrypt",
69
69
  ]);
70
70
  const KeyIndexes = new Set(["key", "type", "status", "attributes", "orders"]);
71
+ const KeyIndexesColumns = new Set(["key", "type", "status", "columns", "orders"]);
71
72
 
72
73
  function whitelistKeys(value, keys, nestedKeys = {}) {
73
74
  if (Array.isArray(value)) {
@@ -404,7 +405,7 @@ class Local extends Config {
404
405
  addTable(props) {
405
406
  props = whitelistKeys(props, KeysTable, {
406
407
  columns: KeysColumns,
407
- indexes: KeyIndexes
408
+ indexes: KeyIndexesColumns
408
409
  });
409
410
 
410
411
  if (!this.has("tables")) {
package/lib/parser.js CHANGED
@@ -122,7 +122,7 @@ const parseError = (err) => {
122
122
  } catch {
123
123
  }
124
124
 
125
- const version = '10.0.0';
125
+ const version = '10.1.0';
126
126
  const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
127
127
  const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud()}`;
128
128
 
@@ -83,104 +83,101 @@ class Dart extends LanguageMeta {
83
83
  }
84
84
 
85
85
  getTemplate() {
86
- return `<% for (const attribute of collection.attributes) { -%>
87
- <% if (attribute.type === 'relationship') { -%>
88
- import '<%- toSnakeCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>.dart';
89
-
90
- <% } -%>
91
- <% } -%>
92
- /// This file is auto-generated by the Appwrite CLI.
93
- /// You can regenerate it by running \`appwrite ${process.argv.slice(2).join(' ')}\`.
94
-
95
- <% for (const attribute of collection.attributes) { -%>
96
- <% if (attribute.format === 'enum') { -%>
86
+ return `// This file is auto-generated by the Appwrite CLI.
87
+ // You can regenerate it by running \`appwrite ${process.argv.slice(2).join(' ')}\`.
88
+ <% const __relatedImportsSeen = new Set();
89
+ const sortedAttributes = collection.attributes.slice().sort((a, b) => {
90
+ if (a.required === b.required) return 0;
91
+ return a.required ? -1 : 1;
92
+ }); -%>
93
+ <% const __attrs = sortedAttributes; -%>
94
+ <% for (const attribute of __attrs) { -%>
95
+ <% if (attribute.type === '${AttributeType.RELATIONSHIP}') { -%>
96
+ <% const related = collections.find(c => c.$id === attribute.relatedCollection); -%>
97
+ <% if (related && !__relatedImportsSeen.has(toSnakeCase(related.name))) { -%>
98
+ import '<%- toSnakeCase(related.name) %>.dart';
99
+ <% __relatedImportsSeen.add(toSnakeCase(related.name)); -%>
100
+ <% } -%>
101
+ <% } -%>
102
+ <% } -%>
103
+
104
+ <% for (const attribute of __attrs) { -%>
105
+ <% if (attribute.format === '${AttributeType.ENUM}') { -%>
97
106
  enum <%- toPascalCase(attribute.key) %> {
98
107
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
99
- <%- strict ? toCamelCase(element) : element %><% if (index < attribute.elements.length - 1) { %>,<% } %>
108
+ <%- strict ? toCamelCase(element) : element %><% if (index < attribute.elements.length - 1) { -%>,<% } %>
100
109
  <% } -%>
101
110
  }
102
111
 
103
112
  <% } -%>
104
113
  <% } -%>
105
114
  class <%= toPascalCase(collection.name) %> {
106
- <% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
115
+ <% for (const [index, attribute] of Object.entries(__attrs)) { -%>
107
116
  <%- getType(attribute, collections) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
108
117
  <% } -%>
109
118
 
110
119
  <%= toPascalCase(collection.name) %>({
111
- <% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
112
- <% if (attribute.required) { %>required <% } %>this.<%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (index < collection.attributes.length - 1) { %>,<% } %>
120
+ <% for (const [index, attribute] of Object.entries(__attrs)) { -%>
121
+ <% if (attribute.required) { %>required <% } %>this.<%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (index < __attrs.length - 1) { -%>,<% } %>
113
122
  <% } -%>
114
123
  });
115
124
 
116
125
  factory <%= toPascalCase(collection.name) %>.fromMap(Map<String, dynamic> map) {
117
126
  return <%= toPascalCase(collection.name) %>(
118
- <% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
119
- <%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime') { -%>
120
- <% if (attribute.format === 'enum') { -%>
127
+ <% for (const [index, attribute] of Object.entries(__attrs)) { -%>
128
+ <%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (attribute.type === '${AttributeType.STRING}' || attribute.type === '${AttributeType.EMAIL}' || attribute.type === '${AttributeType.DATETIME}') { -%>
129
+ <% if (attribute.format === '${AttributeType.ENUM}') { -%>
121
130
  <% if (attribute.array) { -%>
122
- (map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.name == e)).toList()<% if (!attribute.required) { %> ?? []<% } -%>
123
- <% } else { -%>
131
+ (map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.name == e)).toList()<% } else { -%>
124
132
  <% if (!attribute.required) { -%>
125
133
  map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
126
134
  <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
127
135
  <% } -%>
128
136
  <% } else { -%>
129
137
  <% if (attribute.array) { -%>
130
- List<String>.from(map['<%= attribute.key %>'] ?? [])<% if (!attribute.required) { %> ?? []<% } -%>
131
- <% } else { -%>
132
- map['<%= attribute.key %>']<% if (!attribute.required) { %>?<% } %>.toString()<% if (!attribute.required) { %> ?? null<% } -%>
138
+ List<String>.from(map['<%= attribute.key %>'] ?? [])<% } else { -%>
139
+ map['<%= attribute.key %>']<% if (!attribute.required) { %>?<% } %>.toString()<% } -%>
133
140
  <% } -%>
134
- <% } -%>
135
- <% } else if (attribute.type === 'integer') { -%>
141
+ <% } else if (attribute.type === '${AttributeType.INTEGER}') { -%>
136
142
  <% if (attribute.array) { -%>
137
- List<int>.from(map['<%= attribute.key %>'] ?? [])<% if (!attribute.required) { %> ?? []<% } -%>
138
- <% } else { -%>
139
- map['<%= attribute.key %>']<% if (!attribute.required) { %> ?? null<% } -%>
140
- <% } -%>
141
- <% } else if (attribute.type === 'float') { -%>
143
+ List<int>.from(map['<%= attribute.key %>'] ?? [])<% } else { -%>
144
+ map['<%= attribute.key %>']<% } -%>
145
+ <% } else if (attribute.type === '${AttributeType.FLOAT}') { -%>
142
146
  <% if (attribute.array) { -%>
143
- List<double>.from(map['<%= attribute.key %>'] ?? [])<% if (!attribute.required) { %> ?? []<% } -%>
144
- <% } else { -%>
145
- map['<%= attribute.key %>']<% if (!attribute.required) { %> ?? null<% } -%>
146
- <% } -%>
147
- <% } else if (attribute.type === 'boolean') { -%>
147
+ List<double>.from(map['<%= attribute.key %>'] ?? [])<% } else { -%>
148
+ map['<%= attribute.key %>']<% } -%>
149
+ <% } else if (attribute.type === '${AttributeType.BOOLEAN}') { -%>
148
150
  <% if (attribute.array) { -%>
149
- List<bool>.from(map['<%= attribute.key %>'] ?? [])<% if (!attribute.required) { %> ?? []<% } -%>
150
- <% } else { -%>
151
- map['<%= attribute.key %>']<% if (!attribute.required) { %> ?? null<% } -%>
152
- <% } -%>
153
- <% } else if (attribute.type === 'relationship') { -%>
151
+ List<bool>.from(map['<%= attribute.key %>'] ?? [])<% } else { -%>
152
+ map['<%= attribute.key %>']<% } -%>
153
+ <% } else if (attribute.type === '${AttributeType.RELATIONSHIP}') { -%>
154
154
  <% if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') { -%>
155
- (map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>.fromMap(e)).toList()<% if (!attribute.required) { %> ?? []<% } -%>
155
+ (map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>.fromMap(e)).toList()
156
156
  <% } else { -%>
157
157
  <% if (!attribute.required) { -%>
158
158
  map['<%= attribute.key %>'] != null ? <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>.fromMap(map['<%= attribute.key %>']) : null<% } else { -%>
159
159
  <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>.fromMap(map['<%= attribute.key %>'])<% } -%>
160
160
  <% } -%>
161
- <% } -%><% if (index < collection.attributes.length - 1) { %>,<% } %>
161
+ <% } -%><% if (index < __attrs.length - 1) { -%>,<% } %>
162
162
  <% } -%>
163
163
  );
164
164
  }
165
165
 
166
166
  Map<String, dynamic> toMap() {
167
167
  return {
168
- <% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
169
- "<%= attribute.key %>": <% if (attribute.type === 'relationship') { -%>
168
+ <% for (const [index, attribute] of Object.entries(__attrs)) { -%>
169
+ '<%= attribute.key %>': <% if (attribute.type === '${AttributeType.RELATIONSHIP}') { -%>
170
170
  <% if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') { -%>
171
- <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.map((e) => e.toMap()).toList()<% if (!attribute.required) { %> ?? []<% } -%>
171
+ <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.map((e) => e.toMap()).toList()
172
172
  <% } else { -%>
173
- <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.toMap()<% if (!attribute.required) { %> ?? {}<% } -%>
174
- <% } -%>
175
- <% } else if (attribute.format === 'enum') { -%>
173
+ <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.toMap()<% } -%>
174
+ <% } else if (attribute.format === '${AttributeType.ENUM}') { -%>
176
175
  <% if (attribute.array) { -%>
177
- <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.map((e) => e.name).toList()<% if (!attribute.required) { %> ?? []<% } -%>
178
- <% } else { -%>
179
- <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.name<% if (!attribute.required) { %> ?? null<% } -%>
180
- <% } -%>
176
+ <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.map((e) => e.name).toList()<% } else { -%>
177
+ <%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (!attribute.required) { %>?<% } %>.name<% } -%>
181
178
  <% } else { -%>
182
179
  <%= strict ? toCamelCase(attribute.key) : attribute.key -%>
183
- <% } -%><% if (index < collection.attributes.length - 1) { %>,<% } %>
180
+ <% } -%><% if (index < __attrs.length - 1) { -%>,<% } %>
184
181
  <% } -%>
185
182
  };
186
183
  }
@@ -69,7 +69,7 @@ class TypeScript extends LanguageMeta {
69
69
  }
70
70
 
71
71
  getTemplate() {
72
- return `import { type Models } from '${this._getAppwriteDependency()}';
72
+ return `import type { Models } from '${this._getAppwriteDependency()}';
73
73
 
74
74
  // This file is auto-generated by the Appwrite CLI.
75
75
  // You can regenerate it by running \`appwrite ${process.argv.slice(2).join(' ')}\`.
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": "10.0.0",
5
+ "version": "10.1.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "index.js",
8
8
  "bin": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
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/10.0.0/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.0/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/10.0.0/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.0/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",