Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 20.2.0

* Added: Introduced `bigint` create/update APIs for legacy Databases attributes
* Added: Introduced `bigint` create/update APIs for `TablesDB` columns
* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 CHANGELOG version doesn't match the code version

The new CHANGELOG entry is titled ## 20.2.0, but every other file in this PR (lib/constants.ts, package.json, package-lock.json, install.sh, install.ps1, scoop/appwrite.config.json) sets the version to 20.3.0. The PR title itself also says "version 20.2.0". All install scripts and release artifact URLs point to 20.3.0, so users running the install script will download a binary that was never released under the CHANGELOG's stated version, causing installation failures or confusion about which changelog entry describes the installed build.

## 20.1.0

* Added `--switch` and `--new` flags on `appwrite login` to explicitly manage multiple saved accounts
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Command Line SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.3-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down Expand Up @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
20.1.0
20.2.0
```

### Install using prebuilt binaries
Expand Down Expand Up @@ -83,7 +83,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
Once the installation completes, you can verify your install using
```
$ appwrite -v
20.1.0
20.2.0
```

## Getting Started
Expand Down
7 changes: 7 additions & 0 deletions docs/examples/databases/create-big-int-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```bash
appwrite databases create-big-int-attribute \
--database-id <DATABASE_ID> \
--collection-id <COLLECTION_ID> \
--key '' \
--required false
```
8 changes: 8 additions & 0 deletions docs/examples/databases/update-big-int-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```bash
appwrite databases update-big-int-attribute \
--database-id <DATABASE_ID> \
--collection-id <COLLECTION_ID> \
--key '' \
--required false \
--default null
```
Comment on lines +1 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Option name mismatch in documentation example

The example uses --default null, but the actual CLI option defined in lib/commands/services/databases.ts is --xdefault. Running this example as written will produce an unknown option error. The flag should be --xdefault null — though even that won't work as written because parseInteger is used as the parser for --xdefault, so "null" would be coerced to NaN, not a JSON null. The same mismatch is present in docs/examples/tablesdb/update-big-int-column.md.

1 change: 1 addition & 0 deletions docs/examples/functions/create-variable.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
```bash
appwrite functions create-variable \
--function-id <FUNCTION_ID> \
--variable-id <VARIABLE_ID> \
--key <KEY> \
--value <VALUE>
```
3 changes: 2 additions & 1 deletion docs/examples/functions/list-variables.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
```bash
appwrite functions list-variables \
--function-id <FUNCTION_ID>
--function-id <FUNCTION_ID> \
--limit 25
```
3 changes: 1 addition & 2 deletions docs/examples/functions/update-variable.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
```bash
appwrite functions update-variable \
--function-id <FUNCTION_ID> \
--variable-id <VARIABLE_ID> \
--key <KEY>
--variable-id <VARIABLE_ID>
```
2 changes: 1 addition & 1 deletion docs/examples/project/create-ephemeral-key.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```bash
appwrite project create-ephemeral-key \
--scopes one two three \
--duration 1
--duration 600
```
2 changes: 1 addition & 1 deletion docs/examples/project/get-o-auth-2-provider.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
appwrite project get-o-auth-2-provider \
--provider <PROVIDER>
--provider-id amazon
```
3 changes: 2 additions & 1 deletion docs/examples/project/list-o-auth-2-providers.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```bash
appwrite project list-o-auth-2-providers
appwrite project list-o-auth-2-providers \
--limit 25
```
4 changes: 4 additions & 0 deletions docs/examples/proxy/update-rule-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite proxy update-rule-status \
--rule-id <RULE_ID>
```
4 changes: 0 additions & 4 deletions docs/examples/proxy/update-rule-verification.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/examples/sites/create-variable.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
```bash
appwrite sites create-variable \
--site-id <SITE_ID> \
--variable-id <VARIABLE_ID> \
--key <KEY> \
--value <VALUE>
```
3 changes: 2 additions & 1 deletion docs/examples/sites/list-variables.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
```bash
appwrite sites list-variables \
--site-id <SITE_ID>
--site-id <SITE_ID> \
--limit 25
```
3 changes: 1 addition & 2 deletions docs/examples/sites/update-variable.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
```bash
appwrite sites update-variable \
--site-id <SITE_ID> \
--variable-id <VARIABLE_ID> \
--key <KEY>
--variable-id <VARIABLE_ID>
```
7 changes: 7 additions & 0 deletions docs/examples/tablesdb/create-big-int-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```bash
appwrite tables-db create-big-int-column \
--database-id <DATABASE_ID> \
--table-id <TABLE_ID> \
--key '' \
--required false
```
8 changes: 8 additions & 0 deletions docs/examples/tablesdb/update-big-int-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```bash
appwrite tables-db update-big-int-column \
--database-id <DATABASE_ID> \
--table-id <TABLE_ID> \
--key '' \
--required false \
--default null
```
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You can use "View source" of this page to see the full script.

# REPO
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/20.1.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/20.1.0/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/20.2.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/20.2.0/appwrite-cli-win-arm64.exe"

$APPWRITE_BINARY_NAME = "appwrite.exe"

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ verifyMacOSCodeSignature() {
downloadBinary() {
echo "[2/5] Downloading executable for $OS ($ARCH) ..."

GITHUB_LATEST_VERSION="20.1.0"
GITHUB_LATEST_VERSION="20.2.0"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
45 changes: 45 additions & 0 deletions lib/commands/services/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,51 @@
);


const databasesCreateBigIntAttributeCommand = databases
.command(`create-big-int-attribute`)
.description(`Create a bigint attribute. Optionally, minimum and maximum values can be provided.
`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
.requiredOption(`--key <key>`, `Attribute Key.`)
.requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
.option(`--min <min>`, `Minimum value`, parseInteger)
.option(`--max <max>`, `Maximum value`, parseInteger)
.option(`--xdefault <xdefault>`, `Default value. Cannot be set when attribute is required.`, parseInteger)
Comment on lines +378 to +380
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 parseInteger loses precision for large BigInt values

parseInt() returns a JavaScript number (IEEE 754 double), which can only safely represent integers up to Number.MAX_SAFE_INTEGER (2^53 − 1 ≈ 9 × 10^15). Database BIGINT columns are 64-bit and accept values up to ~9.2 × 10^18. Passing a value like 9223372036854775807 through parseInteger silently serialises as 9223372036854776000 — a different number — without any error. The --min, --max, and --xdefault options all share this flaw on both the create-big-int-attribute and update-big-int-attribute commands. The same problem exists in the parallel tables-db.ts commands. A parseBigInt helper that validates as a BigInt string and passes the value as a string (or BigInt) to the SDK would fix this.

.option(
`--array [value]`,
`Is attribute an array?`,
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.action(
actionRunner(
async ({ databaseId, collectionId, key, required, min, max, xdefault, array }) =>
parse(await (await getDatabasesClient()).createBigIntAttribute(databaseId, collectionId, key, required, min, max, xdefault, array)),

Check failure on line 390 in lib/commands/services/databases.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Property 'createBigIntAttribute' does not exist on type 'Databases'. Did you mean 'createPointAttribute'?
),
);


const databasesUpdateBigIntAttributeCommand = databases
.command(`update-big-int-attribute`)
.description(`Update a bigint attribute. Changing the \`default\` value will not update already existing documents.
`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
.requiredOption(`--key <key>`, `Attribute Key.`)
.requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
.requiredOption(`--xdefault <xdefault>`, `Default value. Cannot be set when attribute is required.`, parseInteger)
.option(`--min <min>`, `Minimum value`, parseInteger)
.option(`--max <max>`, `Maximum value`, parseInteger)
.option(`--new-key <new-key>`, `New Attribute Key.`)
.action(
actionRunner(
async ({ databaseId, collectionId, key, required, xdefault, min, max, newKey }) =>
parse(await (await getDatabasesClient()).updateBigIntAttribute(databaseId, collectionId, key, required, xdefault, min, max, newKey)),

Check failure on line 410 in lib/commands/services/databases.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Property 'updateBigIntAttribute' does not exist on type 'Databases'. Did you mean 'updatePointAttribute'?
),
);


const databasesCreateBooleanAttributeCommand = databases
.command(`create-boolean-attribute`)
.description(`Create a boolean attribute.
Expand Down
25 changes: 20 additions & 5 deletions lib/commands/services/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,24 @@
.command(`list-variables`)
.description(`Get a list of all variables of a specific function.`)
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
.option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --where, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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, resourceType, resourceId, secret`)
.option(
`--total [value]`,
`When set to false, the total count returned will be 0 and will not be calculated.`,
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.option(`--where <expression>`, `Filter using a simple comparison expression. Repeat for multiple filters. Supports field=value, field!=value, field>value, field>=value, field<value, and field<=value.`, (value: string, previous: string[] | undefined) => collectQueryValue(parseWhereQuery(value), previous))
.option(`--sort-asc <attribute>`, `Sort results by an attribute in ascending order. Repeat for multiple sort fields.`, (value: string, previous: string[] | undefined) => collectQueryValue(value, previous))
.option(`--sort-desc <attribute>`, `Sort results by an attribute in descending order. Repeat for multiple sort fields.`, (value: string, previous: string[] | undefined) => collectQueryValue(value, previous))
.option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger)
.option(`--offset <offset>`, `Number of results to skip.`, parseInteger)
.option(`--cursor-after <id>`, `Return results after this cursor ID.`)
.option(`--cursor-before <id>`, `Return results before this cursor ID.`)
.action(
actionRunner(
async ({ functionId }) =>
parse(await (await getFunctionsClient()).listVariables(functionId)),
async ({ functionId, queries, total, where, sortAsc, sortDesc, cursorAfter, cursorBefore, limit, offset }) =>
parse(await (await getFunctionsClient()).listVariables(functionId, buildQueries({ queries, where, sortAsc, sortDesc, cursorAfter, cursorBefore, limit, offset }), total)),

Check failure on line 533 in lib/commands/services/functions.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Expected 1 arguments, but got 3.
),
);

Expand All @@ -525,6 +539,7 @@
.command(`create-variable`)
.description(`Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.`)
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
.requiredOption(`--variable-id <variable-id>`, `Variable 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.`)
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
.requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
.option(
Expand All @@ -535,8 +550,8 @@
)
.action(
actionRunner(
async ({ functionId, key, value, secret }) =>
parse(await (await getFunctionsClient()).createVariable(functionId, key, value, secret)),
async ({ functionId, variableId, key, value, secret }) =>
parse(await (await getFunctionsClient()).createVariable(functionId, variableId, key, value, secret)),

Check failure on line 554 in lib/commands/services/functions.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Expected 1-4 arguments, but got 5.
),
);

Expand All @@ -559,7 +574,7 @@
.description(`Update variable by its unique ID.`)
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
.requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
.option(`--key <key>`, `Variable key. Max length: 255 chars.`)
.option(`--value <value>`, `Variable value. Max length: 8192 chars.`)
.option(
`--secret [value]`,
Expand Down
15 changes: 9 additions & 6 deletions lib/commands/services/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@
.requiredOption(`--endpoint <endpoint>`, `Source Appwrite endpoint`)
.requiredOption(`--project-id <project-id>`, `Source Project ID`)
.requiredOption(`--api-key <api-key>`, `Source API Key`)
.option(`--on-duplicate <on-duplicate>`, `Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.`)
.action(
actionRunner(
async ({ resources, endpoint, projectId, apiKey }) =>
parse(await (await getMigrationsClient()).createAppwriteMigration(resources, endpoint, projectId, apiKey)),
async ({ resources, endpoint, projectId, apiKey, onDuplicate }) =>
parse(await (await getMigrationsClient()).createAppwriteMigration(resources, endpoint, projectId, apiKey, onDuplicate)),

Check failure on line 71 in lib/commands/services/migrations.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Expected 1-4 arguments, but got 5.
),
);

Expand Down Expand Up @@ -136,10 +137,11 @@
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.option(`--on-duplicate <on-duplicate>`, `Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.`)
.action(
actionRunner(
async ({ bucketId, fileId, resourceId, internalFile }) =>
parse(await (await getMigrationsClient()).createCSVImport(bucketId, fileId, resourceId, internalFile)),
async ({ bucketId, fileId, resourceId, internalFile, onDuplicate }) =>
parse(await (await getMigrationsClient()).createCSVImport(bucketId, fileId, resourceId, internalFile, onDuplicate)),

Check failure on line 144 in lib/commands/services/migrations.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Expected 1-4 arguments, but got 5.
),
);

Expand Down Expand Up @@ -212,10 +214,11 @@
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.option(`--on-duplicate <on-duplicate>`, `Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.`)
.action(
actionRunner(
async ({ bucketId, fileId, resourceId, internalFile }) =>
parse(await (await getMigrationsClient()).createJSONImport(bucketId, fileId, resourceId, internalFile)),
async ({ bucketId, fileId, resourceId, internalFile, onDuplicate }) =>
parse(await (await getMigrationsClient()).createJSONImport(bucketId, fileId, resourceId, internalFile, onDuplicate)),

Check failure on line 221 in lib/commands/services/migrations.ts

View workflow job for this annotation

GitHub Actions / Build Validation

Expected 1-4 arguments, but got 5.
),
);

Expand Down
Loading