Skip to content

Commit 9961632

Browse files
authored
Merge pull request #215 from appwrite/dev
feat: Command Line SDK update for version 11.1.0
2 parents 44c7c7d + 4cd3264 commit 9961632

22 files changed

+298
-59
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 11.1.0
4+
5+
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
6+
37
## 11.0.0
48

59
* Rename `create-csv-migration` to `create-csv-import` command to create a CSV import of a collection/table

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
2929

3030
```sh
3131
$ appwrite -v
32-
11.0.0
32+
11.1.0
3333
```
3434

3535
### Install using prebuilt binaries
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
6060
Once the installation completes, you can verify your install using
6161
```
6262
$ appwrite -v
63-
11.0.0
63+
11.1.0
6464
```
6565

6666
## Getting Started

install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# You can use "View source" of this page to see the full script.
1414

1515
# REPO
16-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.0.0/appwrite-cli-win-x64.exe"
17-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.0.0/appwrite-cli-win-arm64.exe"
16+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.0/appwrite-cli-win-x64.exe"
17+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.0/appwrite-cli-win-arm64.exe"
1818

1919
$APPWRITE_BINARY_NAME = "appwrite.exe"
2020

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ printSuccess() {
9797
downloadBinary() {
9898
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
9999

100-
GITHUB_LATEST_VERSION="11.0.0"
100+
GITHUB_LATEST_VERSION="11.1.0"
101101
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
102102
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
103103

lib/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Client {
1616
'x-sdk-name': 'Command Line',
1717
'x-sdk-platform': 'console',
1818
'x-sdk-language': 'cli',
19-
'x-sdk-version': '11.0.0',
20-
'user-agent' : `AppwriteCLI/11.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
19+
'x-sdk-version': '11.1.0',
20+
'user-agent' : `AppwriteCLI/11.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
2121
'X-Appwrite-Response-Format' : '1.8.0',
2222
};
2323
}

lib/commands/account.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ const accountUpdateEmail = async ({email,password,parseOutput = true, overrideFo
185185
/**
186186
* @typedef {Object} AccountListIdentitiesRequestParams
187187
* @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 attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
188+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
188189
* @property {boolean} overrideForCli
189190
* @property {boolean} parseOutput
190191
* @property {libClient | undefined} sdk
@@ -193,14 +194,17 @@ const accountUpdateEmail = async ({email,password,parseOutput = true, overrideFo
193194
/**
194195
* @param {AccountListIdentitiesRequestParams} params
195196
*/
196-
const accountListIdentities = async ({queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
197+
const accountListIdentities = async ({queries,total,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
197198
let client = !sdk ? await sdkForProject() :
198199
sdk;
199200
let apiPath = '/account/identities';
200201
let payload = {};
201202
if (typeof queries !== 'undefined') {
202203
payload['queries'] = queries;
203204
}
205+
if (typeof total !== 'undefined') {
206+
payload['total'] = total;
207+
}
204208

205209
let response = undefined;
206210

@@ -276,6 +280,7 @@ const accountCreateJWT = async ({parseOutput = true, overrideForCli = false, sdk
276280
/**
277281
* @typedef {Object} AccountListLogsRequestParams
278282
* @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). Only supported methods are limit and offset
283+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
279284
* @property {boolean} overrideForCli
280285
* @property {boolean} parseOutput
281286
* @property {libClient | undefined} sdk
@@ -284,14 +289,17 @@ const accountCreateJWT = async ({parseOutput = true, overrideForCli = false, sdk
284289
/**
285290
* @param {AccountListLogsRequestParams} params
286291
*/
287-
const accountListLogs = async ({queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
292+
const accountListLogs = async ({queries,total,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
288293
let client = !sdk ? await sdkForProject() :
289294
sdk;
290295
let apiPath = '/account/logs';
291296
let payload = {};
292297
if (typeof queries !== 'undefined') {
293298
payload['queries'] = queries;
294299
}
300+
if (typeof total !== 'undefined') {
301+
payload['total'] = total;
302+
}
295303

296304
let response = undefined;
297305

@@ -1765,6 +1773,7 @@ account
17651773
.command(`list-identities`)
17661774
.description(`Get the list of identities for the currently logged in user.`)
17671775
.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 attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`)
1776+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
17681777
.action(actionRunner(accountListIdentities))
17691778

17701779
account
@@ -1782,6 +1791,7 @@ account
17821791
.command(`list-logs`)
17831792
.description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`)
17841793
.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). Only supported methods are limit and offset`)
1794+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
17851795
.action(actionRunner(accountListLogs))
17861796

17871797
account

lib/commands/databases.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const databases = new Command("databases").description(commandDescriptions['data
4343
* @typedef {Object} DatabasesListRequestParams
4444
* @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 attributes: name
4545
* @property {string} search Search term to filter your list results. Max length: 256 chars.
46+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
4647
* @property {boolean} overrideForCli
4748
* @property {boolean} parseOutput
4849
* @property {libClient | undefined} sdk
@@ -51,7 +52,7 @@ const databases = new Command("databases").description(commandDescriptions['data
5152
/**
5253
* @param {DatabasesListRequestParams} params
5354
*/
54-
const databasesList = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55+
const databasesList = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
5556
let client = !sdk ? await sdkForProject() :
5657
sdk;
5758
let apiPath = '/databases';
@@ -62,6 +63,9 @@ const databasesList = async ({queries,search,parseOutput = true, overrideForCli
6263
if (typeof search !== 'undefined') {
6364
payload['search'] = search;
6465
}
66+
if (typeof total !== 'undefined') {
67+
payload['total'] = total;
68+
}
6569

6670
let response = undefined;
6771

@@ -467,6 +471,7 @@ const databasesDelete = async ({databaseId,parseOutput = true, overrideForCli =
467471
* @property {string} databaseId Database ID.
468472
* @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 attributes: name, enabled, documentSecurity
469473
* @property {string} search Search term to filter your list results. Max length: 256 chars.
474+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
470475
* @property {boolean} overrideForCli
471476
* @property {boolean} parseOutput
472477
* @property {libClient | undefined} sdk
@@ -475,7 +480,7 @@ const databasesDelete = async ({databaseId,parseOutput = true, overrideForCli =
475480
/**
476481
* @param {DatabasesListCollectionsRequestParams} params
477482
*/
478-
const databasesListCollections = async ({databaseId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
483+
const databasesListCollections = async ({databaseId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
479484
let client = !sdk ? await sdkForProject() :
480485
sdk;
481486
let apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
@@ -486,6 +491,9 @@ const databasesListCollections = async ({databaseId,queries,search,parseOutput =
486491
if (typeof search !== 'undefined') {
487492
payload['search'] = search;
488493
}
494+
if (typeof total !== 'undefined') {
495+
payload['total'] = total;
496+
}
489497

490498
let response = undefined;
491499

@@ -672,6 +680,7 @@ const databasesDeleteCollection = async ({databaseId,collectionId,parseOutput =
672680
* @property {string} databaseId Database ID.
673681
* @property {string} collectionId Collection ID.
674682
* @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 attributes: key, type, size, required, array, status, error
683+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
675684
* @property {boolean} overrideForCli
676685
* @property {boolean} parseOutput
677686
* @property {libClient | undefined} sdk
@@ -680,14 +689,17 @@ const databasesDeleteCollection = async ({databaseId,collectionId,parseOutput =
680689
/**
681690
* @param {DatabasesListAttributesRequestParams} params
682691
*/
683-
const databasesListAttributes = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
692+
const databasesListAttributes = async ({databaseId,collectionId,queries,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
684693
let client = !sdk ? await sdkForProject() :
685694
sdk;
686695
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
687696
let payload = {};
688697
if (typeof queries !== 'undefined') {
689698
payload['queries'] = queries;
690699
}
700+
if (typeof total !== 'undefined') {
701+
payload['total'] = total;
702+
}
691703

692704
let response = undefined;
693705

@@ -2009,6 +2021,7 @@ const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key
20092021
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
20102022
* @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.
20112023
* @property {string} transactionId Transaction ID to read uncommitted changes within the transaction.
2024+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
20122025
* @property {boolean} overrideForCli
20132026
* @property {boolean} parseOutput
20142027
* @property {libClient | undefined} sdk
@@ -2017,7 +2030,7 @@ const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key
20172030
/**
20182031
* @param {DatabasesListDocumentsRequestParams} params
20192032
*/
2020-
const databasesListDocuments = async ({databaseId,collectionId,queries,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2033+
const databasesListDocuments = async ({databaseId,collectionId,queries,transactionId,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
20212034
let client = !sdk ? await sdkForProject() :
20222035
sdk;
20232036
let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
@@ -2028,6 +2041,9 @@ const databasesListDocuments = async ({databaseId,collectionId,queries,transacti
20282041
if (typeof transactionId !== 'undefined') {
20292042
payload['transactionId'] = transactionId;
20302043
}
2044+
if (typeof total !== 'undefined') {
2045+
payload['total'] = total;
2046+
}
20312047

20322048
let response = undefined;
20332049

@@ -2556,6 +2572,7 @@ const databasesIncrementDocumentAttribute = async ({databaseId,collectionId,docu
25562572
* @property {string} databaseId Database ID.
25572573
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
25582574
* @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 attributes: key, type, status, attributes, error
2575+
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
25592576
* @property {boolean} overrideForCli
25602577
* @property {boolean} parseOutput
25612578
* @property {libClient | undefined} sdk
@@ -2564,14 +2581,17 @@ const databasesIncrementDocumentAttribute = async ({databaseId,collectionId,docu
25642581
/**
25652582
* @param {DatabasesListIndexesRequestParams} params
25662583
*/
2567-
const databasesListIndexes = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2584+
const databasesListIndexes = async ({databaseId,collectionId,queries,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
25682585
let client = !sdk ? await sdkForProject() :
25692586
sdk;
25702587
let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
25712588
let payload = {};
25722589
if (typeof queries !== 'undefined') {
25732590
payload['queries'] = queries;
25742591
}
2592+
if (typeof total !== 'undefined') {
2593+
payload['total'] = total;
2594+
}
25752595

25762596
let response = undefined;
25772597

@@ -2845,6 +2865,7 @@ databases
28452865
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db list' instead] Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`)
28462866
.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 attributes: name`)
28472867
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
2868+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
28482869
.option(`--console`, `Get the resource console url`)
28492870
.action(actionRunner(databasesList))
28502871

@@ -2931,6 +2952,7 @@ databases
29312952
.requiredOption(`--database-id <database-id>`, `Database ID.`)
29322953
.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 attributes: name, enabled, documentSecurity`)
29332954
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
2955+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
29342956
.option(`--console`, `Get the resource console url`)
29352957
.action(actionRunner(databasesListCollections))
29362958

@@ -2977,6 +2999,7 @@ databases
29772999
.requiredOption(`--database-id <database-id>`, `Database ID.`)
29783000
.requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
29793001
.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 attributes: key, type, size, required, array, status, error`)
3002+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
29803003
.option(`--console`, `Get the resource console url`)
29813004
.action(actionRunner(databasesListAttributes))
29823005

@@ -3300,6 +3323,7 @@ databases
33003323
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
33013324
.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.`)
33023325
.option(`--transaction-id <transaction-id>`, `Transaction ID to read uncommitted changes within the transaction.`)
3326+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
33033327
.option(`--console`, `Get the resource console url`)
33043328
.action(actionRunner(databasesListDocuments))
33053329

@@ -3432,6 +3456,7 @@ databases
34323456
.requiredOption(`--database-id <database-id>`, `Database ID.`)
34333457
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
34343458
.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 attributes: key, type, status, attributes, error`)
3459+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
34353460
.option(`--console`, `Get the resource console url`)
34363461
.action(actionRunner(databasesListIndexes))
34373462

0 commit comments

Comments
 (0)