From 20b16420b0cf4c8a32460c2e46aa6b60684edd93 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Mar 2026 13:01:17 +0000 Subject: [PATCH 1/5] feat: update Command Line SDK to 17.0.0 * Breaking: Removed `--key` option from `appwrite project update-variable` * Added `documents-db` commands to CLI * Added `vectors-db` commands to CLI * Added docs examples for `documents-db` and `vectors-db` * Added `--variable-id` to `appwrite project create-variable` * Updated API version badge to 1.9.0 --- CHANGELOG.md | 9 + README.md | 6 +- cli.ts | 4 + .../examples/documentsdb/create-collection.md | 6 + docs/examples/documentsdb/create-document.md | 7 + docs/examples/documentsdb/create-documents.md | 6 + docs/examples/documentsdb/create-index.md | 8 + .../documentsdb/create-transaction.md | 3 + docs/examples/documentsdb/create.md | 5 + .../decrement-document-attribute.md | 7 + .../examples/documentsdb/delete-collection.md | 5 + docs/examples/documentsdb/delete-document.md | 6 + docs/examples/documentsdb/delete-documents.md | 5 + docs/examples/documentsdb/delete-index.md | 6 + .../documentsdb/delete-transaction.md | 4 + docs/examples/documentsdb/delete.md | 4 + .../documentsdb/get-collection-usage.md | 5 + docs/examples/documentsdb/get-collection.md | 5 + docs/examples/documentsdb/get-document.md | 6 + docs/examples/documentsdb/get-index.md | 6 + docs/examples/documentsdb/get-transaction.md | 4 + docs/examples/documentsdb/get-usage.md | 4 + docs/examples/documentsdb/get.md | 4 + .../increment-document-attribute.md | 7 + .../documentsdb/list-collection-logs.md | 5 + docs/examples/documentsdb/list-collections.md | 4 + .../documentsdb/list-document-logs.md | 6 + docs/examples/documentsdb/list-documents.md | 5 + docs/examples/documentsdb/list-indexes.md | 5 + .../examples/documentsdb/list-transactions.md | 3 + docs/examples/documentsdb/list-usage.md | 3 + docs/examples/documentsdb/list.md | 3 + .../examples/documentsdb/update-collection.md | 6 + docs/examples/documentsdb/update-document.md | 6 + docs/examples/documentsdb/update-documents.md | 5 + .../documentsdb/update-transaction.md | 4 + docs/examples/documentsdb/update.md | 5 + docs/examples/documentsdb/upsert-document.md | 6 + docs/examples/documentsdb/upsert-documents.md | 6 + docs/examples/project/create-variable.md | 1 + docs/examples/project/update-variable.md | 3 +- docs/examples/users/update-impersonator.md | 5 + docs/examples/vectorsdb/create-collection.md | 7 + docs/examples/vectorsdb/create-document.md | 7 + docs/examples/vectorsdb/create-documents.md | 6 + docs/examples/vectorsdb/create-index.md | 8 + docs/examples/vectorsdb/create-operations.md | 4 + .../vectorsdb/create-text-embeddings.md | 4 + docs/examples/vectorsdb/create-transaction.md | 3 + docs/examples/vectorsdb/create.md | 5 + docs/examples/vectorsdb/delete-collection.md | 5 + docs/examples/vectorsdb/delete-document.md | 6 + docs/examples/vectorsdb/delete-documents.md | 5 + docs/examples/vectorsdb/delete-index.md | 6 + docs/examples/vectorsdb/delete-transaction.md | 4 + docs/examples/vectorsdb/delete.md | 4 + .../vectorsdb/get-collection-usage.md | 5 + docs/examples/vectorsdb/get-collection.md | 5 + docs/examples/vectorsdb/get-document.md | 6 + docs/examples/vectorsdb/get-index.md | 6 + docs/examples/vectorsdb/get-transaction.md | 4 + docs/examples/vectorsdb/get-usage.md | 4 + docs/examples/vectorsdb/get.md | 4 + .../vectorsdb/list-collection-logs.md | 5 + docs/examples/vectorsdb/list-collections.md | 4 + docs/examples/vectorsdb/list-document-logs.md | 6 + docs/examples/vectorsdb/list-documents.md | 5 + docs/examples/vectorsdb/list-indexes.md | 5 + docs/examples/vectorsdb/list-transactions.md | 3 + docs/examples/vectorsdb/list-usage.md | 3 + docs/examples/vectorsdb/list.md | 3 + docs/examples/vectorsdb/update-collection.md | 6 + docs/examples/vectorsdb/update-document.md | 6 + docs/examples/vectorsdb/update-documents.md | 5 + docs/examples/vectorsdb/update-transaction.md | 4 + docs/examples/vectorsdb/update.md | 5 + docs/examples/vectorsdb/upsert-document.md | 6 + docs/examples/vectorsdb/upsert-documents.md | 6 + install.ps1 | 4 +- install.sh | 2 +- lib/commands/push.ts | 30 +- lib/commands/run.ts | 12 +- lib/commands/services/documents-db.ts | 583 ++++++++++++++++++ lib/commands/services/project.ts | 33 +- lib/commands/services/users.ts | 15 +- lib/commands/services/vectors-db.ts | 570 +++++++++++++++++ lib/constants.ts | 2 +- lib/questions.ts | 20 +- package.json | 2 +- scoop/appwrite.config.json | 6 +- 90 files changed, 1608 insertions(+), 64 deletions(-) create mode 100644 docs/examples/documentsdb/create-collection.md create mode 100644 docs/examples/documentsdb/create-document.md create mode 100644 docs/examples/documentsdb/create-documents.md create mode 100644 docs/examples/documentsdb/create-index.md create mode 100644 docs/examples/documentsdb/create-transaction.md create mode 100644 docs/examples/documentsdb/create.md create mode 100644 docs/examples/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/documentsdb/delete-collection.md create mode 100644 docs/examples/documentsdb/delete-document.md create mode 100644 docs/examples/documentsdb/delete-documents.md create mode 100644 docs/examples/documentsdb/delete-index.md create mode 100644 docs/examples/documentsdb/delete-transaction.md create mode 100644 docs/examples/documentsdb/delete.md create mode 100644 docs/examples/documentsdb/get-collection-usage.md create mode 100644 docs/examples/documentsdb/get-collection.md create mode 100644 docs/examples/documentsdb/get-document.md create mode 100644 docs/examples/documentsdb/get-index.md create mode 100644 docs/examples/documentsdb/get-transaction.md create mode 100644 docs/examples/documentsdb/get-usage.md create mode 100644 docs/examples/documentsdb/get.md create mode 100644 docs/examples/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/documentsdb/list-collection-logs.md create mode 100644 docs/examples/documentsdb/list-collections.md create mode 100644 docs/examples/documentsdb/list-document-logs.md create mode 100644 docs/examples/documentsdb/list-documents.md create mode 100644 docs/examples/documentsdb/list-indexes.md create mode 100644 docs/examples/documentsdb/list-transactions.md create mode 100644 docs/examples/documentsdb/list-usage.md create mode 100644 docs/examples/documentsdb/list.md create mode 100644 docs/examples/documentsdb/update-collection.md create mode 100644 docs/examples/documentsdb/update-document.md create mode 100644 docs/examples/documentsdb/update-documents.md create mode 100644 docs/examples/documentsdb/update-transaction.md create mode 100644 docs/examples/documentsdb/update.md create mode 100644 docs/examples/documentsdb/upsert-document.md create mode 100644 docs/examples/documentsdb/upsert-documents.md create mode 100644 docs/examples/users/update-impersonator.md create mode 100644 docs/examples/vectorsdb/create-collection.md create mode 100644 docs/examples/vectorsdb/create-document.md create mode 100644 docs/examples/vectorsdb/create-documents.md create mode 100644 docs/examples/vectorsdb/create-index.md create mode 100644 docs/examples/vectorsdb/create-operations.md create mode 100644 docs/examples/vectorsdb/create-text-embeddings.md create mode 100644 docs/examples/vectorsdb/create-transaction.md create mode 100644 docs/examples/vectorsdb/create.md create mode 100644 docs/examples/vectorsdb/delete-collection.md create mode 100644 docs/examples/vectorsdb/delete-document.md create mode 100644 docs/examples/vectorsdb/delete-documents.md create mode 100644 docs/examples/vectorsdb/delete-index.md create mode 100644 docs/examples/vectorsdb/delete-transaction.md create mode 100644 docs/examples/vectorsdb/delete.md create mode 100644 docs/examples/vectorsdb/get-collection-usage.md create mode 100644 docs/examples/vectorsdb/get-collection.md create mode 100644 docs/examples/vectorsdb/get-document.md create mode 100644 docs/examples/vectorsdb/get-index.md create mode 100644 docs/examples/vectorsdb/get-transaction.md create mode 100644 docs/examples/vectorsdb/get-usage.md create mode 100644 docs/examples/vectorsdb/get.md create mode 100644 docs/examples/vectorsdb/list-collection-logs.md create mode 100644 docs/examples/vectorsdb/list-collections.md create mode 100644 docs/examples/vectorsdb/list-document-logs.md create mode 100644 docs/examples/vectorsdb/list-documents.md create mode 100644 docs/examples/vectorsdb/list-indexes.md create mode 100644 docs/examples/vectorsdb/list-transactions.md create mode 100644 docs/examples/vectorsdb/list-usage.md create mode 100644 docs/examples/vectorsdb/list.md create mode 100644 docs/examples/vectorsdb/update-collection.md create mode 100644 docs/examples/vectorsdb/update-document.md create mode 100644 docs/examples/vectorsdb/update-documents.md create mode 100644 docs/examples/vectorsdb/update-transaction.md create mode 100644 docs/examples/vectorsdb/update.md create mode 100644 docs/examples/vectorsdb/upsert-document.md create mode 100644 docs/examples/vectorsdb/upsert-documents.md create mode 100644 lib/commands/services/documents-db.ts create mode 100644 lib/commands/services/vectors-db.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e4fc3f..33c66a71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 17.0.0 + +* Breaking: Removed `--key` option from `appwrite project update-variable` +* Added `documents-db` commands to CLI +* Added `vectors-db` commands to CLI +* Added docs examples for `documents-db` and `vectors-db` +* Added `--variable-id` to `appwrite project create-variable` +* Updated API version badge to 1.9.0 + ## 16.0.0 * Breaking: Moved webhook commands from `projects` to new `webhooks` service. diff --git a/README.md b/README.md index 8ab0f246..85d61206 100644 --- a/README.md +++ b/README.md @@ -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.8.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.0-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) @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using ```sh $ appwrite -v -16.0.0 +17.0.0 ``` ### Install using prebuilt binaries @@ -60,7 +60,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 -16.0.0 +17.0.0 ``` ## Getting Started diff --git a/cli.ts b/cli.ts index 204b74d4..5de78947 100644 --- a/cli.ts +++ b/cli.ts @@ -28,6 +28,7 @@ import { account } from './lib/commands/services/account.js'; import { activities } from './lib/commands/services/activities.js'; import { backups } from './lib/commands/services/backups.js'; import { databases } from './lib/commands/services/databases.js'; +import { documentsDB } from './lib/commands/services/documents-db.js'; import { functions } from './lib/commands/services/functions.js'; import { graphql } from './lib/commands/services/graphql.js'; import { health } from './lib/commands/services/health.js'; @@ -44,6 +45,7 @@ import { teams } from './lib/commands/services/teams.js'; import { tokens } from './lib/commands/services/tokens.js'; import { users } from './lib/commands/services/users.js'; import { vcs } from './lib/commands/services/vcs.js'; +import { vectorsDB } from './lib/commands/services/vectors-db.js'; import { webhooks } from './lib/commands/services/webhooks.js'; const { version } = packageJson; @@ -139,6 +141,7 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) { .addCommand(activities) .addCommand(backups) .addCommand(databases) + .addCommand(documentsDB) .addCommand(functions) .addCommand(graphql) .addCommand(health) @@ -155,6 +158,7 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) { .addCommand(tokens) .addCommand(users) .addCommand(vcs) + .addCommand(vectorsDB) .addCommand(webhooks) .addCommand(client) .parse(process.argv); diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 00000000..3d296a7d --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db create-collection \ + --database-id \ + --collection-id \ + --name +``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 00000000..b03f6062 --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,7 @@ +```bash +appwrite documents-db create-document \ + --database-id \ + --collection-id \ + --document-id \ + --data '{ "key": "value" }' +``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 00000000..9d417594 --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db create-documents \ + --database-id \ + --collection-id \ + --documents one two three +``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 00000000..69415ba3 --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,8 @@ +```bash +appwrite documents-db create-index \ + --database-id \ + --collection-id \ + --key '' \ + --type key \ + --attributes one two three +``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 00000000..885cd43e --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,3 @@ +```bash +appwrite documents-db create-transaction +``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 00000000..05685093 --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db create \ + --database-id \ + --name +``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 00000000..b1a5805c --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,7 @@ +```bash +appwrite documents-db decrement-document-attribute \ + --database-id \ + --collection-id \ + --document-id \ + --attribute '' +``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 00000000..8d92b6a4 --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db delete-collection \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 00000000..e99cca84 --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db delete-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 00000000..00105318 --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db delete-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 00000000..8915ee6d --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db delete-index \ + --database-id \ + --collection-id \ + --key '' +``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 00000000..eea99d3b --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db delete-transaction \ + --transaction-id +``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 00000000..7003513a --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db delete \ + --database-id +``` diff --git a/docs/examples/documentsdb/get-collection-usage.md b/docs/examples/documentsdb/get-collection-usage.md new file mode 100644 index 00000000..15785ae4 --- /dev/null +++ b/docs/examples/documentsdb/get-collection-usage.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db get-collection-usage \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 00000000..903fb450 --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db get-collection \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 00000000..8eafa297 --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db get-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 00000000..0d9d69b2 --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db get-index \ + --database-id \ + --collection-id \ + --key '' +``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 00000000..7d295920 --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db get-transaction \ + --transaction-id +``` diff --git a/docs/examples/documentsdb/get-usage.md b/docs/examples/documentsdb/get-usage.md new file mode 100644 index 00000000..f48177b6 --- /dev/null +++ b/docs/examples/documentsdb/get-usage.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db get-usage \ + --database-id +``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 00000000..c90d07d6 --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db get \ + --database-id +``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 00000000..391ab3c7 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,7 @@ +```bash +appwrite documents-db increment-document-attribute \ + --database-id \ + --collection-id \ + --document-id \ + --attribute '' +``` diff --git a/docs/examples/documentsdb/list-collection-logs.md b/docs/examples/documentsdb/list-collection-logs.md new file mode 100644 index 00000000..6e66ce86 --- /dev/null +++ b/docs/examples/documentsdb/list-collection-logs.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db list-collection-logs \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 00000000..d52fb968 --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db list-collections \ + --database-id +``` diff --git a/docs/examples/documentsdb/list-document-logs.md b/docs/examples/documentsdb/list-document-logs.md new file mode 100644 index 00000000..625fa8ec --- /dev/null +++ b/docs/examples/documentsdb/list-document-logs.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db list-document-logs \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 00000000..a87e8556 --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db list-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 00000000..e7bafd40 --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db list-indexes \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 00000000..e74f4ca2 --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,3 @@ +```bash +appwrite documents-db list-transactions +``` diff --git a/docs/examples/documentsdb/list-usage.md b/docs/examples/documentsdb/list-usage.md new file mode 100644 index 00000000..aa9ec8b2 --- /dev/null +++ b/docs/examples/documentsdb/list-usage.md @@ -0,0 +1,3 @@ +```bash +appwrite documents-db list-usage +``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 00000000..fd21df85 --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,3 @@ +```bash +appwrite documents-db list +``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 00000000..8119cc4e --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db update-collection \ + --database-id \ + --collection-id \ + --name +``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 00000000..66392165 --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db update-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 00000000..fd0e65b9 --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db update-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 00000000..a6be4ce1 --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite documents-db update-transaction \ + --transaction-id +``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 00000000..e75e23c3 --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,5 @@ +```bash +appwrite documents-db update \ + --database-id \ + --name +``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 00000000..0a2bbc62 --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db upsert-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 00000000..018f0e9a --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,6 @@ +```bash +appwrite documents-db upsert-documents \ + --database-id \ + --collection-id \ + --documents one two three +``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md index e1dc1606..3e0a50b7 100644 --- a/docs/examples/project/create-variable.md +++ b/docs/examples/project/create-variable.md @@ -1,5 +1,6 @@ ```bash appwrite project create-variable \ + --variable-id \ --key \ --value ``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md index 70bed01e..7426d25c 100644 --- a/docs/examples/project/update-variable.md +++ b/docs/examples/project/update-variable.md @@ -1,5 +1,4 @@ ```bash appwrite project update-variable \ - --variable-id \ - --key + --variable-id ``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md new file mode 100644 index 00000000..c052034a --- /dev/null +++ b/docs/examples/users/update-impersonator.md @@ -0,0 +1,5 @@ +```bash +appwrite users update-impersonator \ + --user-id \ + --impersonator false +``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 00000000..792f04f8 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,7 @@ +```bash +appwrite vectors-db create-collection \ + --database-id \ + --collection-id \ + --name \ + --dimension 1 +``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 00000000..5eaa2e78 --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,7 @@ +```bash +appwrite vectors-db create-document \ + --database-id \ + --collection-id \ + --document-id \ + --data '{ "key": "value" }' +``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 00000000..386f5d70 --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db create-documents \ + --database-id \ + --collection-id \ + --documents one two three +``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 00000000..7e52b310 --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,8 @@ +```bash +appwrite vectors-db create-index \ + --database-id \ + --collection-id \ + --key '' \ + --type hnsw_euclidean \ + --attributes one two three +``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 00000000..39df5b2a --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db create-operations \ + --transaction-id +``` diff --git a/docs/examples/vectorsdb/create-text-embeddings.md b/docs/examples/vectorsdb/create-text-embeddings.md new file mode 100644 index 00000000..70e8716c --- /dev/null +++ b/docs/examples/vectorsdb/create-text-embeddings.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db create-text-embeddings \ + --texts one two three +``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 00000000..99f73f75 --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,3 @@ +```bash +appwrite vectors-db create-transaction +``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 00000000..8e9b3d37 --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db create \ + --database-id \ + --name +``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 00000000..37780358 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db delete-collection \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 00000000..6528410e --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db delete-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 00000000..ecefbcf1 --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db delete-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 00000000..5080f342 --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db delete-index \ + --database-id \ + --collection-id \ + --key '' +``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 00000000..f0d37be8 --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db delete-transaction \ + --transaction-id +``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 00000000..6d4ff2ab --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db delete \ + --database-id +``` diff --git a/docs/examples/vectorsdb/get-collection-usage.md b/docs/examples/vectorsdb/get-collection-usage.md new file mode 100644 index 00000000..77c1a977 --- /dev/null +++ b/docs/examples/vectorsdb/get-collection-usage.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db get-collection-usage \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 00000000..02ccf4ca --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db get-collection \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 00000000..40be134b --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db get-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 00000000..6ca81acc --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db get-index \ + --database-id \ + --collection-id \ + --key '' +``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 00000000..bdd0c288 --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db get-transaction \ + --transaction-id +``` diff --git a/docs/examples/vectorsdb/get-usage.md b/docs/examples/vectorsdb/get-usage.md new file mode 100644 index 00000000..c768a18d --- /dev/null +++ b/docs/examples/vectorsdb/get-usage.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db get-usage \ + --database-id +``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 00000000..e6f3c31e --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db get \ + --database-id +``` diff --git a/docs/examples/vectorsdb/list-collection-logs.md b/docs/examples/vectorsdb/list-collection-logs.md new file mode 100644 index 00000000..9551f6b6 --- /dev/null +++ b/docs/examples/vectorsdb/list-collection-logs.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db list-collection-logs \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 00000000..4724599f --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db list-collections \ + --database-id +``` diff --git a/docs/examples/vectorsdb/list-document-logs.md b/docs/examples/vectorsdb/list-document-logs.md new file mode 100644 index 00000000..b8f63791 --- /dev/null +++ b/docs/examples/vectorsdb/list-document-logs.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db list-document-logs \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 00000000..ef430028 --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db list-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 00000000..af9183d8 --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db list-indexes \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 00000000..ce2298bf --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,3 @@ +```bash +appwrite vectors-db list-transactions +``` diff --git a/docs/examples/vectorsdb/list-usage.md b/docs/examples/vectorsdb/list-usage.md new file mode 100644 index 00000000..472035b9 --- /dev/null +++ b/docs/examples/vectorsdb/list-usage.md @@ -0,0 +1,3 @@ +```bash +appwrite vectors-db list-usage +``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 00000000..630d6d75 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,3 @@ +```bash +appwrite vectors-db list +``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 00000000..3ad41829 --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db update-collection \ + --database-id \ + --collection-id \ + --name +``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 00000000..1fb31e1e --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db update-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 00000000..99c96156 --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db update-documents \ + --database-id \ + --collection-id +``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 00000000..92fe0e44 --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,4 @@ +```bash +appwrite vectors-db update-transaction \ + --transaction-id +``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 00000000..df0d1a09 --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,5 @@ +```bash +appwrite vectors-db update \ + --database-id \ + --name +``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 00000000..9f613689 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db upsert-document \ + --database-id \ + --collection-id \ + --document-id +``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 00000000..115f694e --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,6 @@ +```bash +appwrite vectors-db upsert-documents \ + --database-id \ + --collection-id \ + --documents one two three +``` diff --git a/install.ps1 b/install.ps1 index 1febbb27..d5239761 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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/16.0.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 4556948b..201af610 100644 --- a/install.sh +++ b/install.sh @@ -96,7 +96,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="16.0.0" + GITHUB_LATEST_VERSION="17.0.0" GITHUB_FILE="appwrite-cli-${OS}-${ARCH}" GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE" diff --git a/lib/commands/push.ts b/lib/commands/push.ts index 88cc79f2..0ed1a0ec 100644 --- a/lib/commands/push.ts +++ b/lib/commands/push.ts @@ -829,18 +829,9 @@ export class Push { const functionsServiceForVars = await getFunctionsService( this.projectClient, ); - const { variables } = await paginate( - async (args: any) => { - return await functionsServiceForVars.listVariables({ - functionId: args.functionId, - }); - }, - { - functionId: func["$id"], - }, - 100, - "variables", - ); + const { variables } = await functionsServiceForVars.listVariables({ + functionId: func["$id"], + }); await Promise.all( variables.map(async (variable: any) => { @@ -1199,18 +1190,9 @@ export class Push { .replaceSpinner(SPINNER_DOTS); const sitesServiceForVars = await getSitesService(this.projectClient); - const { variables } = await paginate( - async (args: any) => { - return await sitesServiceForVars.listVariables({ - siteId: args.siteId, - }); - }, - { - siteId: site["$id"], - }, - 100, - "variables", - ); + const { variables } = await sitesServiceForVars.listVariables({ + siteId: site["$id"], + }); await Promise.all( variables.map(async (variable: any) => { diff --git a/lib/commands/run.ts b/lib/commands/run.ts index bfc566d0..3d655454 100644 --- a/lib/commands/run.ts +++ b/lib/commands/run.ts @@ -12,7 +12,6 @@ import inquirer from "inquirer"; import path from "path"; import { Command } from "commander"; import { localConfig, globalConfig } from "../config.js"; -import { paginate } from "../paginate.js"; import { getFunctionsService } from "../services.js"; import { questionsRunFunctions } from "../questions.js"; import { @@ -177,12 +176,11 @@ const runFunction = async ({ if (withVariables) { try { - const { variables: remoteVariables } = await paginate( - async () => (await getFunctionsService()).listVariables(func["$id"]), - {}, - 100, - "variables", - ); + const { variables: remoteVariables } = await ( + await getFunctionsService() + ).listVariables({ + functionId: func["$id"], + }); remoteVariables.forEach((v) => { allVariables[v.key] = v.value; diff --git a/lib/commands/services/documents-db.ts b/lib/commands/services/documents-db.ts new file mode 100644 index 00000000..9ce226a2 --- /dev/null +++ b/lib/commands/services/documents-db.ts @@ -0,0 +1,583 @@ +import { Command } from "commander"; +import { sdkForProject } from "../../sdks.js"; +import { + actionRunner, + commandDescriptions, + success, + parse, + parseBool, + parseInteger, +} from "../../parser.js"; +import { DocumentsDB } from "@appwrite.io/console"; + +let documentsDBClient: DocumentsDB | null = null; + +const getDocumentsDBClient = async (): Promise => { + if (!documentsDBClient) { + const sdkClient = await sdkForProject(); + documentsDBClient = new DocumentsDB(sdkClient); + } + return documentsDBClient; +}; + +export const documentsDB = new Command("documents-db") + .description(commandDescriptions["documentsDB"] ?? "") + .configureHelp({ + helpWidth: process.stdout.columns || 80, + }); + +documentsDB + .command(`list`) + .description(`Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`) + .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: name`) + .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) + .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), + ) + .action( + actionRunner( + async ({ queries, search, total }) => + parse(await (await getDocumentsDBClient()).list(queries, search, total)), + ), + ); + +documentsDB + .command(`create`) + .description(`Create a new Database. +`) + .requiredOption(`--database-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.`) + .requiredOption(`--name `, `Database name. Max length: 128 chars.`) + .option( + `--enabled [value]`, + `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, name, enabled }) => + parse(await (await getDocumentsDBClient()).create(databaseId, name, enabled)), + ), + ); + +documentsDB + .command(`list-transactions`) + .description(``) + .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).`) + .action( + actionRunner( + async ({ queries }) => + parse(await (await getDocumentsDBClient()).listTransactions(queries)), + ), + ); + +documentsDB + .command(`create-transaction`) + .description(``) + .option(`--ttl `, `Seconds before the transaction expires.`, parseInteger) + .action( + actionRunner( + async ({ ttl }) => + parse(await (await getDocumentsDBClient()).createTransaction(ttl)), + ), + ); + +documentsDB + .command(`get-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .action( + actionRunner( + async ({ transactionId }) => + parse(await (await getDocumentsDBClient()).getTransaction(transactionId)), + ), + ); + +documentsDB + .command(`update-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .option( + `--commit [value]`, + `Commit transaction?`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--rollback [value]`, + `Rollback transaction?`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ transactionId, commit, rollback }) => + parse(await (await getDocumentsDBClient()).updateTransaction(transactionId, commit, rollback)), + ), + ); + +documentsDB + .command(`delete-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .action( + actionRunner( + async ({ transactionId }) => + parse(await (await getDocumentsDBClient()).deleteTransaction(transactionId)), + ), + ); + +documentsDB + .command(`list-usage`) + .description(`List usage metrics and statistics for all databases in the project. You can view the total number of databases, collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ range }) => + parse(await (await getDocumentsDBClient()).listUsage(range)), + ), + ); + +documentsDB + .command(`get`) + .description(`Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.`) + .requiredOption(`--database-id `, `Database ID.`) + .action( + actionRunner( + async ({ databaseId }) => + parse(await (await getDocumentsDBClient()).get(databaseId)), + ), + ); + +documentsDB + .command(`update`) + .description(`Update a database by its unique ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--name `, `Database name. Max length: 128 chars.`) + .option( + `--enabled [value]`, + `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, name, enabled }) => + parse(await (await getDocumentsDBClient()).update(databaseId, name, enabled)), + ), + ); + +documentsDB + .command(`delete`) + .description(`Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.`) + .requiredOption(`--database-id `, `Database ID.`) + .action( + actionRunner( + async ({ databaseId }) => + parse(await (await getDocumentsDBClient()).delete(databaseId)), + ), + ); + +documentsDB + .command(`list-collections`) + .description(`Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.`) + .requiredOption(`--database-id `, `Database ID.`) + .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`) + .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) + .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), + ) + .action( + actionRunner( + async ({ databaseId, queries, search, total }) => + parse(await (await getDocumentsDBClient()).listCollections(databaseId, queries, search, total)), + ), + ); + +documentsDB + .command(`create-collection`) + .description(`Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-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.`) + .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option( + `--document-security [value]`, + `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--enabled [value]`, + `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option(`--attributes [attributes...]`, `Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.`) + .option(`--indexes [indexes...]`, `Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).`) + .action( + actionRunner( + async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled, attributes, indexes }) => + parse(await (await getDocumentsDBClient()).createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled, attributes, indexes)), + ), + ); + +documentsDB + .command(`get-collection`) + .description(`Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .action( + actionRunner( + async ({ databaseId, collectionId }) => + parse(await (await getDocumentsDBClient()).getCollection(databaseId, collectionId)), + ), + ); + +documentsDB + .command(`update-collection`) + .description(`Update a collection by its unique ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) + .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option( + `--document-security [value]`, + `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--enabled [value]`, + `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled }) => + parse(await (await getDocumentsDBClient()).updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled)), + ), + ); + +documentsDB + .command(`delete-collection`) + .description(`Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .action( + actionRunner( + async ({ databaseId, collectionId }) => + parse(await (await getDocumentsDBClient()).deleteCollection(databaseId, collectionId)), + ), + ); + +documentsDB + .command(`list-documents`) + .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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.`) + .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) + .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(`--ttl `, `TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).`, parseInteger) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, transactionId, total, ttl }) => + parse(await (await getDocumentsDBClient()).listDocuments(databaseId, collectionId, queries, transactionId, total, ttl)), + ), + ); + +documentsDB + .command(`create-document`) + .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) + .requiredOption(`--document-id `, `Document 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(`--data `, `Document data as JSON object.`) + .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).`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions }) => + parse(await (await getDocumentsDBClient()).createDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions)), + ), + ); + +documentsDB + .command(`create-documents`) + .description(`Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) + .requiredOption(`--documents [documents...]`, `Array of documents data as JSON objects.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documents }) => + parse(await (await getDocumentsDBClient()).createDocuments(databaseId, collectionId, documents)), + ), + ); + +documentsDB + .command(`upsert-documents`) + .description(`Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. +`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documents, transactionId }) => + parse(await (await getDocumentsDBClient()).upsertDocuments(databaseId, collectionId, documents, transactionId)), + ), + ); + +documentsDB + .command(`update-documents`) + .description(`Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .option(`--data `, `Document data as JSON object. Include only attribute and value pairs to be updated.`) + .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.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, data, queries, transactionId }) => + parse(await (await getDocumentsDBClient()).updateDocuments(databaseId, collectionId, JSON.parse(data), queries, transactionId)), + ), + ); + +documentsDB + .command(`delete-documents`) + .description(`Bulk delete documents using queries, if no queries are passed then all documents are deleted.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, transactionId }) => + parse(await (await getDocumentsDBClient()).deleteDocuments(databaseId, collectionId, queries, transactionId)), + ), + ); + +documentsDB + .command(`get-document`) + .description(`Get a document by its unique ID. This endpoint response returns a JSON object with the document data.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) + .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.`) + .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, queries, transactionId }) => + parse(await (await getDocumentsDBClient()).getDocument(databaseId, collectionId, documentId, queries, transactionId)), + ), + ); + +documentsDB + .command(`upsert-document`) + .description(`Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--data `, `Document data as JSON object. Include all required fields of the document to be created or updated.`) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => + parse(await (await getDocumentsDBClient()).upsertDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), + ), + ); + +documentsDB + .command(`update-document`) + .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--data `, `Document data as JSON object. Include only fields and value pairs to be updated.`) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => + parse(await (await getDocumentsDBClient()).updateDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), + ), + ); + +documentsDB + .command(`delete-document`) + .description(`Delete a document by its unique ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, transactionId }) => + parse(await (await getDocumentsDBClient()).deleteDocument(databaseId, collectionId, documentId, transactionId)), + ), + ); + +documentsDB + .command(`list-document-logs`) + .description(`Get the document activity logs list by its unique ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .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`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, queries }) => + parse(await (await getDocumentsDBClient()).listDocumentLogs(databaseId, collectionId, documentId, queries)), + ), + ); + +documentsDB + .command(`decrement-document-attribute`) + .description(`Decrement a specific column of a row by a given value.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .requiredOption(`--attribute `, `Attribute key.`) + .option(`--value `, `Value to decrement the attribute by. The value must be a number.`, parseInteger) + .option(`--min `, `Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.`, parseInteger) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, attribute, value, min, transactionId }) => + parse(await (await getDocumentsDBClient()).decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min, transactionId)), + ), + ); + +documentsDB + .command(`increment-document-attribute`) + .description(`Increment a specific column of a row by a given value.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .requiredOption(`--attribute `, `Attribute key.`) + .option(`--value `, `Value to increment the attribute by. The value must be a number.`, parseInteger) + .option(`--max `, `Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.`, parseInteger) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, attribute, value, max, transactionId }) => + parse(await (await getDocumentsDBClient()).incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max, transactionId)), + ), + ); + +documentsDB + .command(`list-indexes`) + .description(`List indexes in the collection.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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`) + .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), + ) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, total }) => + parse(await (await getDocumentsDBClient()).listIndexes(databaseId, collectionId, queries, total)), + ), + ); + +documentsDB + .command(`create-index`) + .description(`Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. +Attributes can be \`key\`, \`fulltext\`, and \`unique\`.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .requiredOption(`--type `, `Index type.`) + .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`) + .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`) + .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`) + .action( + actionRunner( + async ({ databaseId, collectionId, key, type, attributes, orders, lengths }) => + parse(await (await getDocumentsDBClient()).createIndex(databaseId, collectionId, key, type, attributes, orders, lengths)), + ), + ); + +documentsDB + .command(`get-index`) + .description(`Get index by ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .action( + actionRunner( + async ({ databaseId, collectionId, key }) => + parse(await (await getDocumentsDBClient()).getIndex(databaseId, collectionId, key)), + ), + ); + +documentsDB + .command(`delete-index`) + .description(`Delete an index.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .action( + actionRunner( + async ({ databaseId, collectionId, key }) => + parse(await (await getDocumentsDBClient()).deleteIndex(databaseId, collectionId, key)), + ), + ); + +documentsDB + .command(`list-collection-logs`) + .description(`Get the collection activity logs list by its unique ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .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`) + .action( + actionRunner( + async ({ databaseId, collectionId, queries }) => + parse(await (await getDocumentsDBClient()).listCollectionLogs(databaseId, collectionId, queries)), + ), + ); + +documentsDB + .command(`get-collection-usage`) + .description(`Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ databaseId, collectionId, range }) => + parse(await (await getDocumentsDBClient()).getCollectionUsage(databaseId, collectionId, range)), + ), + ); + +documentsDB + .command(`get-usage`) + .description(`Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) + .requiredOption(`--database-id `, `Database ID.`) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ databaseId, range }) => + parse(await (await getDocumentsDBClient()).getUsage(databaseId, range)), + ), + ); + diff --git a/lib/commands/services/project.ts b/lib/commands/services/project.ts index 32ef26e7..9f3cd4c2 100644 --- a/lib/commands/services/project.ts +++ b/lib/commands/services/project.ts @@ -41,16 +41,25 @@ project project .command(`list-variables`) - .description(`Get a list of all project variables. These variables will be accessible in all Appwrite Functions at runtime.`) + .description(`Get a list of all project environment variables.`) + .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, 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), + ) .action( actionRunner( - async () => parse(await (await getProjectClient()).listVariables()), + async ({ queries, total }) => + parse(await (await getProjectClient()).listVariables(queries, total)), ), ); project .command(`create-variable`) - .description(`Create a new project variable. This variable will be accessible in all Appwrite Functions at runtime.`) + .description(`Create a new project environment variable. These variables can be accessed by all functions and sites in the project.`) + .requiredOption(`--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 `, `Variable key. Max length: 255 chars.`) .requiredOption(`--value `, `Variable value. Max length: 8192 chars.`) .option( @@ -61,15 +70,15 @@ project ) .action( actionRunner( - async ({ key, value, secret }) => - parse(await (await getProjectClient()).createVariable(key, value, secret)), + async ({ variableId, key, value, secret }) => + parse(await (await getProjectClient()).createVariable(variableId, key, value, secret)), ), ); project .command(`get-variable`) - .description(`Get a project variable by its unique ID.`) - .requiredOption(`--variable-id `, `Variable unique ID.`) + .description(`Get a variable by its unique ID. `) + .requiredOption(`--variable-id `, `Variable ID.`) .action( actionRunner( async ({ variableId }) => @@ -79,9 +88,9 @@ project project .command(`update-variable`) - .description(`Update project variable by its unique ID. This variable will be accessible in all Appwrite Functions at runtime.`) - .requiredOption(`--variable-id `, `Variable unique ID.`) - .requiredOption(`--key `, `Variable key. Max length: 255 chars.`) + .description(`Update variable by its unique ID.`) + .requiredOption(`--variable-id `, `Variable ID.`) + .option(`--key `, `Variable key. Max length: 255 chars.`) .option(`--value `, `Variable value. Max length: 8192 chars.`) .option( `--secret [value]`, @@ -98,8 +107,8 @@ project project .command(`delete-variable`) - .description(`Delete a project variable by its unique ID. `) - .requiredOption(`--variable-id `, `Variable unique ID.`) + .description(`Delete a variable by its unique ID. `) + .requiredOption(`--variable-id `, `Variable ID.`) .action( actionRunner( async ({ variableId }) => diff --git a/lib/commands/services/users.ts b/lib/commands/services/users.ts index 86e9046e..00a77a29 100644 --- a/lib/commands/services/users.ts +++ b/lib/commands/services/users.ts @@ -29,7 +29,7 @@ export const users = new Command("users") users .command(`list`) .description(`Get a list of all the project's users. You can use the query params to filter your results.`) - .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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`) + .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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .option( `--total [value]`, @@ -241,6 +241,19 @@ users ), ); +users + .command(`update-impersonator`) + .description(`Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. +`) + .requiredOption(`--user-id `, `User ID.`) + .requiredOption(`--impersonator `, `Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.`, parseBool) + .action( + actionRunner( + async ({ userId, impersonator }) => + parse(await (await getUsersClient()).updateImpersonator(userId, impersonator)), + ), + ); + users .command(`create-jwt`) .description(`Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.`) diff --git a/lib/commands/services/vectors-db.ts b/lib/commands/services/vectors-db.ts new file mode 100644 index 00000000..ead7838f --- /dev/null +++ b/lib/commands/services/vectors-db.ts @@ -0,0 +1,570 @@ +import { Command } from "commander"; +import { sdkForProject } from "../../sdks.js"; +import { + actionRunner, + commandDescriptions, + success, + parse, + parseBool, + parseInteger, +} from "../../parser.js"; +import { VectorsDB } from "@appwrite.io/console"; + +let vectorsDBClient: VectorsDB | null = null; + +const getVectorsDBClient = async (): Promise => { + if (!vectorsDBClient) { + const sdkClient = await sdkForProject(); + vectorsDBClient = new VectorsDB(sdkClient); + } + return vectorsDBClient; +}; + +export const vectorsDB = new Command("vectors-db") + .description(commandDescriptions["vectorsDB"] ?? "") + .configureHelp({ + helpWidth: process.stdout.columns || 80, + }); + +vectorsDB + .command(`list`) + .description(``) + .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: name`) + .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) + .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), + ) + .action( + actionRunner( + async ({ queries, search, total }) => + parse(await (await getVectorsDBClient()).list(queries, search, total)), + ), + ); + +vectorsDB + .command(`create`) + .description(``) + .requiredOption(`--database-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.`) + .requiredOption(`--name `, `Database name. Max length: 128 chars.`) + .option( + `--enabled [value]`, + `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, name, enabled }) => + parse(await (await getVectorsDBClient()).create(databaseId, name, enabled)), + ), + ); + +vectorsDB + .command(`create-text-embeddings`) + .description(``) + .requiredOption(`--texts [texts...]`, `Array of text to generate embeddings.`) + .option(`--model `, `The embedding model to use for generating vector embeddings.`) + .action( + actionRunner( + async ({ texts, model }) => + parse(await (await getVectorsDBClient()).createTextEmbeddings(texts, model)), + ), + ); + +vectorsDB + .command(`list-transactions`) + .description(``) + .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).`) + .action( + actionRunner( + async ({ queries }) => + parse(await (await getVectorsDBClient()).listTransactions(queries)), + ), + ); + +vectorsDB + .command(`create-transaction`) + .description(``) + .option(`--ttl `, `Seconds before the transaction expires.`, parseInteger) + .action( + actionRunner( + async ({ ttl }) => + parse(await (await getVectorsDBClient()).createTransaction(ttl)), + ), + ); + +vectorsDB + .command(`get-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .action( + actionRunner( + async ({ transactionId }) => + parse(await (await getVectorsDBClient()).getTransaction(transactionId)), + ), + ); + +vectorsDB + .command(`update-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .option( + `--commit [value]`, + `Commit transaction?`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--rollback [value]`, + `Rollback transaction?`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ transactionId, commit, rollback }) => + parse(await (await getVectorsDBClient()).updateTransaction(transactionId, commit, rollback)), + ), + ); + +vectorsDB + .command(`delete-transaction`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .action( + actionRunner( + async ({ transactionId }) => + parse(await (await getVectorsDBClient()).deleteTransaction(transactionId)), + ), + ); + +vectorsDB + .command(`create-operations`) + .description(``) + .requiredOption(`--transaction-id `, `Transaction ID.`) + .option(`--operations [operations...]`, `Array of staged operations.`) + .action( + actionRunner( + async ({ transactionId, operations }) => + parse(await (await getVectorsDBClient()).createOperations(transactionId, operations)), + ), + ); + +vectorsDB + .command(`list-usage`) + .description(``) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ range }) => + parse(await (await getVectorsDBClient()).listUsage(range)), + ), + ); + +vectorsDB + .command(`get`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .action( + actionRunner( + async ({ databaseId }) => + parse(await (await getVectorsDBClient()).get(databaseId)), + ), + ); + +vectorsDB + .command(`update`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--name `, `Database name. Max length: 128 chars.`) + .option( + `--enabled [value]`, + `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, name, enabled }) => + parse(await (await getVectorsDBClient()).update(databaseId, name, enabled)), + ), + ); + +vectorsDB + .command(`delete`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .action( + actionRunner( + async ({ databaseId }) => + parse(await (await getVectorsDBClient()).delete(databaseId)), + ), + ); + +vectorsDB + .command(`list-collections`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .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`) + .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) + .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), + ) + .action( + actionRunner( + async ({ databaseId, queries, search, total }) => + parse(await (await getVectorsDBClient()).listCollections(databaseId, queries, search, total)), + ), + ); + +vectorsDB + .command(`create-collection`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-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.`) + .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) + .requiredOption(`--dimension `, `Embedding dimension.`, parseInteger) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option( + `--document-security [value]`, + `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--enabled [value]`, + `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled }) => + parse(await (await getVectorsDBClient()).createCollection(databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled)), + ), + ); + +vectorsDB + .command(`get-collection`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .action( + actionRunner( + async ({ databaseId, collectionId }) => + parse(await (await getVectorsDBClient()).getCollection(databaseId, collectionId)), + ), + ); + +vectorsDB + .command(`update-collection`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) + .option(`--dimension `, `Embedding dimensions.`, parseInteger) + .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option( + `--document-security [value]`, + `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--enabled [value]`, + `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .action( + actionRunner( + async ({ databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled }) => + parse(await (await getVectorsDBClient()).updateCollection(databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled)), + ), + ); + +vectorsDB + .command(`delete-collection`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .action( + actionRunner( + async ({ databaseId, collectionId }) => + parse(await (await getVectorsDBClient()).deleteCollection(databaseId, collectionId)), + ), + ); + +vectorsDB + .command(`list-documents`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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.`) + .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) + .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(`--ttl `, `TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).`, parseInteger) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, transactionId, total, ttl }) => + parse(await (await getVectorsDBClient()).listDocuments(databaseId, collectionId, queries, transactionId, total, ttl)), + ), + ); + +vectorsDB + .command(`create-document`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) + .requiredOption(`--document-id `, `Document 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(`--data `, `Document data as JSON object.`) + .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).`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions }) => + parse(await (await getVectorsDBClient()).createDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions)), + ), + ); + +vectorsDB + .command(`create-documents`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) + .requiredOption(`--documents [documents...]`, `Array of documents data as JSON objects.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documents }) => + parse(await (await getVectorsDBClient()).createDocuments(databaseId, collectionId, documents)), + ), + ); + +vectorsDB + .command(`upsert-documents`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documents, transactionId }) => + parse(await (await getVectorsDBClient()).upsertDocuments(databaseId, collectionId, documents, transactionId)), + ), + ); + +vectorsDB + .command(`update-documents`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .option(`--data `, `Document data as JSON object. Include only attribute and value pairs to be updated.`) + .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.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, data, queries, transactionId }) => + parse(await (await getVectorsDBClient()).updateDocuments(databaseId, collectionId, JSON.parse(data), queries, transactionId)), + ), + ); + +vectorsDB + .command(`delete-documents`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, transactionId }) => + parse(await (await getVectorsDBClient()).deleteDocuments(databaseId, collectionId, queries, transactionId)), + ), + ); + +vectorsDB + .command(`get-document`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) + .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.`) + .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, queries, transactionId }) => + parse(await (await getVectorsDBClient()).getDocument(databaseId, collectionId, documentId, queries, transactionId)), + ), + ); + +vectorsDB + .command(`upsert-document`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--data `, `Document data as JSON object. Include all required fields of the document to be created or updated.`) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => + parse(await (await getVectorsDBClient()).upsertDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), + ), + ); + +vectorsDB + .command(`update-document`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--data `, `Document data as JSON object. Include only fields and value pairs to be updated.`) + .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => + parse(await (await getVectorsDBClient()).updateDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), + ), + ); + +vectorsDB + .command(`delete-document`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) + .option(`--transaction-id `, `Transaction ID for staging the operation.`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, transactionId }) => + parse(await (await getVectorsDBClient()).deleteDocument(databaseId, collectionId, documentId, transactionId)), + ), + ); + +vectorsDB + .command(`list-document-logs`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) + .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`) + .action( + actionRunner( + async ({ databaseId, collectionId, documentId, queries }) => + parse(await (await getVectorsDBClient()).listDocumentLogs(databaseId, collectionId, documentId, queries)), + ), + ); + +vectorsDB + .command(`list-indexes`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .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`) + .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), + ) + .action( + actionRunner( + async ({ databaseId, collectionId, queries, total }) => + parse(await (await getVectorsDBClient()).listIndexes(databaseId, collectionId, queries, total)), + ), + ); + +vectorsDB + .command(`create-index`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .requiredOption(`--type `, `Index type.`) + .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`) + .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`) + .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`) + .action( + actionRunner( + async ({ databaseId, collectionId, key, type, attributes, orders, lengths }) => + parse(await (await getVectorsDBClient()).createIndex(databaseId, collectionId, key, type, attributes, orders, lengths)), + ), + ); + +vectorsDB + .command(`get-index`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .action( + actionRunner( + async ({ databaseId, collectionId, key }) => + parse(await (await getVectorsDBClient()).getIndex(databaseId, collectionId, key)), + ), + ); + +vectorsDB + .command(`delete-index`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--key `, `Index Key.`) + .action( + actionRunner( + async ({ databaseId, collectionId, key }) => + parse(await (await getVectorsDBClient()).deleteIndex(databaseId, collectionId, key)), + ), + ); + +vectorsDB + .command(`list-collection-logs`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .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`) + .action( + actionRunner( + async ({ databaseId, collectionId, queries }) => + parse(await (await getVectorsDBClient()).listCollectionLogs(databaseId, collectionId, queries)), + ), + ); + +vectorsDB + .command(`get-collection-usage`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ databaseId, collectionId, range }) => + parse(await (await getVectorsDBClient()).getCollectionUsage(databaseId, collectionId, range)), + ), + ); + +vectorsDB + .command(`get-usage`) + .description(``) + .requiredOption(`--database-id `, `Database ID.`) + .option(`--range `, `Date range.`) + .action( + actionRunner( + async ({ databaseId, range }) => + parse(await (await getVectorsDBClient()).getUsage(databaseId, range)), + ), + ); + diff --git a/lib/constants.ts b/lib/constants.ts index 570abfd7..29f7b604 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -1,7 +1,7 @@ // SDK export const SDK_TITLE = 'Appwrite'; export const SDK_TITLE_LOWER = 'appwrite'; -export const SDK_VERSION = '16.0.0'; +export const SDK_VERSION = '17.0.0'; export const SDK_NAME = 'Command Line'; export const SDK_PLATFORM = 'console'; export const SDK_LANGUAGE = 'cli'; diff --git a/lib/questions.ts b/lib/questions.ts index 9cf69640..0e2c1dbd 100644 --- a/lib/questions.ts +++ b/lib/questions.ts @@ -187,15 +187,19 @@ export const questionsInitProject: Question[] = [ const client = await sdkForConsole(true); const { teams } = isCloud() ? await paginate( - async (opts: { sdk?: Client } = {}) => - (await getOrganizationsService(opts.sdk)).list(), + async (args) => + (await getOrganizationsService(args.sdk as Client)).list({ + queries: args.queries as string[], + }), { sdk: client }, 100, "teams", ) : await paginate( - async (opts: { sdk?: Client } = {}) => - (await getTeamsService(opts.sdk)).list(), + async (args) => + (await getTeamsService(args.sdk as Client)).list({ + queries: args.queries as string[], + }), { parseOutput: false, sdk: client }, 100, "teams", @@ -247,7 +251,7 @@ export const questionsInitProject: Question[] = [ ]; const { projects } = await paginate( - async () => (await getProjectsService()).list(queries), + async (args) => (await getProjectsService()).list(args.queries as string[]), { parseOutput: false }, 100, "projects", @@ -342,7 +346,8 @@ export const questionsPullFunctions: Question[] = [ validate: (value: any) => validateRequired("function", value), choices: async () => { const { functions } = await paginate( - async () => (await getFunctionsService()).list(), + async (args) => + (await getFunctionsService()).list(args.queries as string[]), { parseOutput: false }, 100, "functions", @@ -385,7 +390,8 @@ export const questionsPullSites: Question[] = [ validate: (value: any) => validateRequired("site", value), choices: async () => { const { sites } = await paginate( - async () => (await getSitesService()).list(), + async (args) => + (await getSitesService()).list(args.queries as string[]), { parseOutput: false }, 100, "sites", diff --git a/package.json b/package.json index e7cead39..0b81a8e4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "16.0.0", + "version": "17.0.0", "license": "BSD-3-Clause", "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/scoop/appwrite.config.json b/scoop/appwrite.config.json index b48b95bb..d70f4d66 100644 --- a/scoop/appwrite.config.json +++ b/scoop/appwrite.config.json @@ -1,12 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json", - "version": "16.0.0", + "version": "17.0.0", "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.", "homepage": "https://github.com/appwrite/sdk-for-cli", "license": "BSD-3-Clause", "architecture": { "64bit": { - "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-x64.exe", "bin": [ [ "appwrite-cli-win-x64.exe", @@ -15,7 +15,7 @@ ] }, "arm64": { - "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe", From 81c99374fb2a6caf0cf61048c05a0f81247077f2 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 04:23:46 +0000 Subject: [PATCH 2/5] chore: update Command Line SDK to 17.0.0 --- CHANGELOG.md | 4 +--- README.md | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c66a71..7b6542a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,8 @@ ## 17.0.0 +* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents * Breaking: Removed `--key` option from `appwrite project update-variable` -* Added `documents-db` commands to CLI -* Added `vectors-db` commands to CLI -* Added docs examples for `documents-db` and `vectors-db` * Added `--variable-id` to `appwrite project create-variable` * Updated API version badge to 1.9.0 diff --git a/README.md b/README.md index 85d61206..4ec85870 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) From d37adf5284d5a96b41bea837af4138a84dc142b3 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 05:25:51 +0000 Subject: [PATCH 3/5] chore: update Command Line SDK to 17.0.0 --- cli.ts | 4 - .../examples/documentsdb/create-collection.md | 6 - docs/examples/documentsdb/create-document.md | 7 - docs/examples/documentsdb/create-documents.md | 6 - docs/examples/documentsdb/create-index.md | 8 - .../documentsdb/create-transaction.md | 3 - docs/examples/documentsdb/create.md | 5 - .../decrement-document-attribute.md | 7 - .../examples/documentsdb/delete-collection.md | 5 - docs/examples/documentsdb/delete-document.md | 6 - docs/examples/documentsdb/delete-documents.md | 5 - docs/examples/documentsdb/delete-index.md | 6 - .../documentsdb/delete-transaction.md | 4 - docs/examples/documentsdb/delete.md | 4 - .../documentsdb/get-collection-usage.md | 5 - docs/examples/documentsdb/get-collection.md | 5 - docs/examples/documentsdb/get-document.md | 6 - docs/examples/documentsdb/get-index.md | 6 - docs/examples/documentsdb/get-transaction.md | 4 - docs/examples/documentsdb/get-usage.md | 4 - docs/examples/documentsdb/get.md | 4 - .../increment-document-attribute.md | 7 - .../documentsdb/list-collection-logs.md | 5 - docs/examples/documentsdb/list-collections.md | 4 - .../documentsdb/list-document-logs.md | 6 - docs/examples/documentsdb/list-documents.md | 5 - docs/examples/documentsdb/list-indexes.md | 5 - .../examples/documentsdb/list-transactions.md | 3 - docs/examples/documentsdb/list-usage.md | 3 - docs/examples/documentsdb/list.md | 3 - .../examples/documentsdb/update-collection.md | 6 - docs/examples/documentsdb/update-document.md | 6 - docs/examples/documentsdb/update-documents.md | 5 - .../documentsdb/update-transaction.md | 4 - docs/examples/documentsdb/update.md | 5 - docs/examples/documentsdb/upsert-document.md | 6 - docs/examples/documentsdb/upsert-documents.md | 6 - docs/examples/vectorsdb/create-collection.md | 7 - docs/examples/vectorsdb/create-document.md | 7 - docs/examples/vectorsdb/create-documents.md | 6 - docs/examples/vectorsdb/create-index.md | 8 - docs/examples/vectorsdb/create-operations.md | 4 - .../vectorsdb/create-text-embeddings.md | 4 - docs/examples/vectorsdb/create-transaction.md | 3 - docs/examples/vectorsdb/create.md | 5 - docs/examples/vectorsdb/delete-collection.md | 5 - docs/examples/vectorsdb/delete-document.md | 6 - docs/examples/vectorsdb/delete-documents.md | 5 - docs/examples/vectorsdb/delete-index.md | 6 - docs/examples/vectorsdb/delete-transaction.md | 4 - docs/examples/vectorsdb/delete.md | 4 - .../vectorsdb/get-collection-usage.md | 5 - docs/examples/vectorsdb/get-collection.md | 5 - docs/examples/vectorsdb/get-document.md | 6 - docs/examples/vectorsdb/get-index.md | 6 - docs/examples/vectorsdb/get-transaction.md | 4 - docs/examples/vectorsdb/get-usage.md | 4 - docs/examples/vectorsdb/get.md | 4 - .../vectorsdb/list-collection-logs.md | 5 - docs/examples/vectorsdb/list-collections.md | 4 - docs/examples/vectorsdb/list-document-logs.md | 6 - docs/examples/vectorsdb/list-documents.md | 5 - docs/examples/vectorsdb/list-indexes.md | 5 - docs/examples/vectorsdb/list-transactions.md | 3 - docs/examples/vectorsdb/list-usage.md | 3 - docs/examples/vectorsdb/list.md | 3 - docs/examples/vectorsdb/update-collection.md | 6 - docs/examples/vectorsdb/update-document.md | 6 - docs/examples/vectorsdb/update-documents.md | 5 - docs/examples/vectorsdb/update-transaction.md | 4 - docs/examples/vectorsdb/update.md | 5 - docs/examples/vectorsdb/upsert-document.md | 6 - docs/examples/vectorsdb/upsert-documents.md | 6 - lib/commands/services/documents-db.ts | 583 ------------------ lib/commands/services/vectors-db.ts | 570 ----------------- 75 files changed, 1522 deletions(-) delete mode 100644 docs/examples/documentsdb/create-collection.md delete mode 100644 docs/examples/documentsdb/create-document.md delete mode 100644 docs/examples/documentsdb/create-documents.md delete mode 100644 docs/examples/documentsdb/create-index.md delete mode 100644 docs/examples/documentsdb/create-transaction.md delete mode 100644 docs/examples/documentsdb/create.md delete mode 100644 docs/examples/documentsdb/decrement-document-attribute.md delete mode 100644 docs/examples/documentsdb/delete-collection.md delete mode 100644 docs/examples/documentsdb/delete-document.md delete mode 100644 docs/examples/documentsdb/delete-documents.md delete mode 100644 docs/examples/documentsdb/delete-index.md delete mode 100644 docs/examples/documentsdb/delete-transaction.md delete mode 100644 docs/examples/documentsdb/delete.md delete mode 100644 docs/examples/documentsdb/get-collection-usage.md delete mode 100644 docs/examples/documentsdb/get-collection.md delete mode 100644 docs/examples/documentsdb/get-document.md delete mode 100644 docs/examples/documentsdb/get-index.md delete mode 100644 docs/examples/documentsdb/get-transaction.md delete mode 100644 docs/examples/documentsdb/get-usage.md delete mode 100644 docs/examples/documentsdb/get.md delete mode 100644 docs/examples/documentsdb/increment-document-attribute.md delete mode 100644 docs/examples/documentsdb/list-collection-logs.md delete mode 100644 docs/examples/documentsdb/list-collections.md delete mode 100644 docs/examples/documentsdb/list-document-logs.md delete mode 100644 docs/examples/documentsdb/list-documents.md delete mode 100644 docs/examples/documentsdb/list-indexes.md delete mode 100644 docs/examples/documentsdb/list-transactions.md delete mode 100644 docs/examples/documentsdb/list-usage.md delete mode 100644 docs/examples/documentsdb/list.md delete mode 100644 docs/examples/documentsdb/update-collection.md delete mode 100644 docs/examples/documentsdb/update-document.md delete mode 100644 docs/examples/documentsdb/update-documents.md delete mode 100644 docs/examples/documentsdb/update-transaction.md delete mode 100644 docs/examples/documentsdb/update.md delete mode 100644 docs/examples/documentsdb/upsert-document.md delete mode 100644 docs/examples/documentsdb/upsert-documents.md delete mode 100644 docs/examples/vectorsdb/create-collection.md delete mode 100644 docs/examples/vectorsdb/create-document.md delete mode 100644 docs/examples/vectorsdb/create-documents.md delete mode 100644 docs/examples/vectorsdb/create-index.md delete mode 100644 docs/examples/vectorsdb/create-operations.md delete mode 100644 docs/examples/vectorsdb/create-text-embeddings.md delete mode 100644 docs/examples/vectorsdb/create-transaction.md delete mode 100644 docs/examples/vectorsdb/create.md delete mode 100644 docs/examples/vectorsdb/delete-collection.md delete mode 100644 docs/examples/vectorsdb/delete-document.md delete mode 100644 docs/examples/vectorsdb/delete-documents.md delete mode 100644 docs/examples/vectorsdb/delete-index.md delete mode 100644 docs/examples/vectorsdb/delete-transaction.md delete mode 100644 docs/examples/vectorsdb/delete.md delete mode 100644 docs/examples/vectorsdb/get-collection-usage.md delete mode 100644 docs/examples/vectorsdb/get-collection.md delete mode 100644 docs/examples/vectorsdb/get-document.md delete mode 100644 docs/examples/vectorsdb/get-index.md delete mode 100644 docs/examples/vectorsdb/get-transaction.md delete mode 100644 docs/examples/vectorsdb/get-usage.md delete mode 100644 docs/examples/vectorsdb/get.md delete mode 100644 docs/examples/vectorsdb/list-collection-logs.md delete mode 100644 docs/examples/vectorsdb/list-collections.md delete mode 100644 docs/examples/vectorsdb/list-document-logs.md delete mode 100644 docs/examples/vectorsdb/list-documents.md delete mode 100644 docs/examples/vectorsdb/list-indexes.md delete mode 100644 docs/examples/vectorsdb/list-transactions.md delete mode 100644 docs/examples/vectorsdb/list-usage.md delete mode 100644 docs/examples/vectorsdb/list.md delete mode 100644 docs/examples/vectorsdb/update-collection.md delete mode 100644 docs/examples/vectorsdb/update-document.md delete mode 100644 docs/examples/vectorsdb/update-documents.md delete mode 100644 docs/examples/vectorsdb/update-transaction.md delete mode 100644 docs/examples/vectorsdb/update.md delete mode 100644 docs/examples/vectorsdb/upsert-document.md delete mode 100644 docs/examples/vectorsdb/upsert-documents.md delete mode 100644 lib/commands/services/documents-db.ts delete mode 100644 lib/commands/services/vectors-db.ts diff --git a/cli.ts b/cli.ts index 5de78947..204b74d4 100644 --- a/cli.ts +++ b/cli.ts @@ -28,7 +28,6 @@ import { account } from './lib/commands/services/account.js'; import { activities } from './lib/commands/services/activities.js'; import { backups } from './lib/commands/services/backups.js'; import { databases } from './lib/commands/services/databases.js'; -import { documentsDB } from './lib/commands/services/documents-db.js'; import { functions } from './lib/commands/services/functions.js'; import { graphql } from './lib/commands/services/graphql.js'; import { health } from './lib/commands/services/health.js'; @@ -45,7 +44,6 @@ import { teams } from './lib/commands/services/teams.js'; import { tokens } from './lib/commands/services/tokens.js'; import { users } from './lib/commands/services/users.js'; import { vcs } from './lib/commands/services/vcs.js'; -import { vectorsDB } from './lib/commands/services/vectors-db.js'; import { webhooks } from './lib/commands/services/webhooks.js'; const { version } = packageJson; @@ -141,7 +139,6 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) { .addCommand(activities) .addCommand(backups) .addCommand(databases) - .addCommand(documentsDB) .addCommand(functions) .addCommand(graphql) .addCommand(health) @@ -158,7 +155,6 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) { .addCommand(tokens) .addCommand(users) .addCommand(vcs) - .addCommand(vectorsDB) .addCommand(webhooks) .addCommand(client) .parse(process.argv); diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md deleted file mode 100644 index 3d296a7d..00000000 --- a/docs/examples/documentsdb/create-collection.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db create-collection \ - --database-id \ - --collection-id \ - --name -``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md deleted file mode 100644 index b03f6062..00000000 --- a/docs/examples/documentsdb/create-document.md +++ /dev/null @@ -1,7 +0,0 @@ -```bash -appwrite documents-db create-document \ - --database-id \ - --collection-id \ - --document-id \ - --data '{ "key": "value" }' -``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md deleted file mode 100644 index 9d417594..00000000 --- a/docs/examples/documentsdb/create-documents.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db create-documents \ - --database-id \ - --collection-id \ - --documents one two three -``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md deleted file mode 100644 index 69415ba3..00000000 --- a/docs/examples/documentsdb/create-index.md +++ /dev/null @@ -1,8 +0,0 @@ -```bash -appwrite documents-db create-index \ - --database-id \ - --collection-id \ - --key '' \ - --type key \ - --attributes one two three -``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md deleted file mode 100644 index 885cd43e..00000000 --- a/docs/examples/documentsdb/create-transaction.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite documents-db create-transaction -``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md deleted file mode 100644 index 05685093..00000000 --- a/docs/examples/documentsdb/create.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db create \ - --database-id \ - --name -``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md deleted file mode 100644 index b1a5805c..00000000 --- a/docs/examples/documentsdb/decrement-document-attribute.md +++ /dev/null @@ -1,7 +0,0 @@ -```bash -appwrite documents-db decrement-document-attribute \ - --database-id \ - --collection-id \ - --document-id \ - --attribute '' -``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md deleted file mode 100644 index 8d92b6a4..00000000 --- a/docs/examples/documentsdb/delete-collection.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db delete-collection \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md deleted file mode 100644 index e99cca84..00000000 --- a/docs/examples/documentsdb/delete-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db delete-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md deleted file mode 100644 index 00105318..00000000 --- a/docs/examples/documentsdb/delete-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db delete-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md deleted file mode 100644 index 8915ee6d..00000000 --- a/docs/examples/documentsdb/delete-index.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db delete-index \ - --database-id \ - --collection-id \ - --key '' -``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md deleted file mode 100644 index eea99d3b..00000000 --- a/docs/examples/documentsdb/delete-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db delete-transaction \ - --transaction-id -``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md deleted file mode 100644 index 7003513a..00000000 --- a/docs/examples/documentsdb/delete.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db delete \ - --database-id -``` diff --git a/docs/examples/documentsdb/get-collection-usage.md b/docs/examples/documentsdb/get-collection-usage.md deleted file mode 100644 index 15785ae4..00000000 --- a/docs/examples/documentsdb/get-collection-usage.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db get-collection-usage \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md deleted file mode 100644 index 903fb450..00000000 --- a/docs/examples/documentsdb/get-collection.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db get-collection \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md deleted file mode 100644 index 8eafa297..00000000 --- a/docs/examples/documentsdb/get-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db get-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md deleted file mode 100644 index 0d9d69b2..00000000 --- a/docs/examples/documentsdb/get-index.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db get-index \ - --database-id \ - --collection-id \ - --key '' -``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md deleted file mode 100644 index 7d295920..00000000 --- a/docs/examples/documentsdb/get-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db get-transaction \ - --transaction-id -``` diff --git a/docs/examples/documentsdb/get-usage.md b/docs/examples/documentsdb/get-usage.md deleted file mode 100644 index f48177b6..00000000 --- a/docs/examples/documentsdb/get-usage.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db get-usage \ - --database-id -``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md deleted file mode 100644 index c90d07d6..00000000 --- a/docs/examples/documentsdb/get.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db get \ - --database-id -``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md deleted file mode 100644 index 391ab3c7..00000000 --- a/docs/examples/documentsdb/increment-document-attribute.md +++ /dev/null @@ -1,7 +0,0 @@ -```bash -appwrite documents-db increment-document-attribute \ - --database-id \ - --collection-id \ - --document-id \ - --attribute '' -``` diff --git a/docs/examples/documentsdb/list-collection-logs.md b/docs/examples/documentsdb/list-collection-logs.md deleted file mode 100644 index 6e66ce86..00000000 --- a/docs/examples/documentsdb/list-collection-logs.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db list-collection-logs \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md deleted file mode 100644 index d52fb968..00000000 --- a/docs/examples/documentsdb/list-collections.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db list-collections \ - --database-id -``` diff --git a/docs/examples/documentsdb/list-document-logs.md b/docs/examples/documentsdb/list-document-logs.md deleted file mode 100644 index 625fa8ec..00000000 --- a/docs/examples/documentsdb/list-document-logs.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db list-document-logs \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md deleted file mode 100644 index a87e8556..00000000 --- a/docs/examples/documentsdb/list-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db list-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md deleted file mode 100644 index e7bafd40..00000000 --- a/docs/examples/documentsdb/list-indexes.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db list-indexes \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md deleted file mode 100644 index e74f4ca2..00000000 --- a/docs/examples/documentsdb/list-transactions.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite documents-db list-transactions -``` diff --git a/docs/examples/documentsdb/list-usage.md b/docs/examples/documentsdb/list-usage.md deleted file mode 100644 index aa9ec8b2..00000000 --- a/docs/examples/documentsdb/list-usage.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite documents-db list-usage -``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md deleted file mode 100644 index fd21df85..00000000 --- a/docs/examples/documentsdb/list.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite documents-db list -``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md deleted file mode 100644 index 8119cc4e..00000000 --- a/docs/examples/documentsdb/update-collection.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db update-collection \ - --database-id \ - --collection-id \ - --name -``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md deleted file mode 100644 index 66392165..00000000 --- a/docs/examples/documentsdb/update-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db update-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md deleted file mode 100644 index fd0e65b9..00000000 --- a/docs/examples/documentsdb/update-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db update-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md deleted file mode 100644 index a6be4ce1..00000000 --- a/docs/examples/documentsdb/update-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite documents-db update-transaction \ - --transaction-id -``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md deleted file mode 100644 index e75e23c3..00000000 --- a/docs/examples/documentsdb/update.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite documents-db update \ - --database-id \ - --name -``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md deleted file mode 100644 index 0a2bbc62..00000000 --- a/docs/examples/documentsdb/upsert-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db upsert-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md deleted file mode 100644 index 018f0e9a..00000000 --- a/docs/examples/documentsdb/upsert-documents.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite documents-db upsert-documents \ - --database-id \ - --collection-id \ - --documents one two three -``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md deleted file mode 100644 index 792f04f8..00000000 --- a/docs/examples/vectorsdb/create-collection.md +++ /dev/null @@ -1,7 +0,0 @@ -```bash -appwrite vectors-db create-collection \ - --database-id \ - --collection-id \ - --name \ - --dimension 1 -``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md deleted file mode 100644 index 5eaa2e78..00000000 --- a/docs/examples/vectorsdb/create-document.md +++ /dev/null @@ -1,7 +0,0 @@ -```bash -appwrite vectors-db create-document \ - --database-id \ - --collection-id \ - --document-id \ - --data '{ "key": "value" }' -``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md deleted file mode 100644 index 386f5d70..00000000 --- a/docs/examples/vectorsdb/create-documents.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db create-documents \ - --database-id \ - --collection-id \ - --documents one two three -``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md deleted file mode 100644 index 7e52b310..00000000 --- a/docs/examples/vectorsdb/create-index.md +++ /dev/null @@ -1,8 +0,0 @@ -```bash -appwrite vectors-db create-index \ - --database-id \ - --collection-id \ - --key '' \ - --type hnsw_euclidean \ - --attributes one two three -``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md deleted file mode 100644 index 39df5b2a..00000000 --- a/docs/examples/vectorsdb/create-operations.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db create-operations \ - --transaction-id -``` diff --git a/docs/examples/vectorsdb/create-text-embeddings.md b/docs/examples/vectorsdb/create-text-embeddings.md deleted file mode 100644 index 70e8716c..00000000 --- a/docs/examples/vectorsdb/create-text-embeddings.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db create-text-embeddings \ - --texts one two three -``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md deleted file mode 100644 index 99f73f75..00000000 --- a/docs/examples/vectorsdb/create-transaction.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite vectors-db create-transaction -``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md deleted file mode 100644 index 8e9b3d37..00000000 --- a/docs/examples/vectorsdb/create.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db create \ - --database-id \ - --name -``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md deleted file mode 100644 index 37780358..00000000 --- a/docs/examples/vectorsdb/delete-collection.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db delete-collection \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md deleted file mode 100644 index 6528410e..00000000 --- a/docs/examples/vectorsdb/delete-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db delete-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md deleted file mode 100644 index ecefbcf1..00000000 --- a/docs/examples/vectorsdb/delete-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db delete-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md deleted file mode 100644 index 5080f342..00000000 --- a/docs/examples/vectorsdb/delete-index.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db delete-index \ - --database-id \ - --collection-id \ - --key '' -``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md deleted file mode 100644 index f0d37be8..00000000 --- a/docs/examples/vectorsdb/delete-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db delete-transaction \ - --transaction-id -``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md deleted file mode 100644 index 6d4ff2ab..00000000 --- a/docs/examples/vectorsdb/delete.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db delete \ - --database-id -``` diff --git a/docs/examples/vectorsdb/get-collection-usage.md b/docs/examples/vectorsdb/get-collection-usage.md deleted file mode 100644 index 77c1a977..00000000 --- a/docs/examples/vectorsdb/get-collection-usage.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db get-collection-usage \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md deleted file mode 100644 index 02ccf4ca..00000000 --- a/docs/examples/vectorsdb/get-collection.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db get-collection \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md deleted file mode 100644 index 40be134b..00000000 --- a/docs/examples/vectorsdb/get-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db get-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md deleted file mode 100644 index 6ca81acc..00000000 --- a/docs/examples/vectorsdb/get-index.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db get-index \ - --database-id \ - --collection-id \ - --key '' -``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md deleted file mode 100644 index bdd0c288..00000000 --- a/docs/examples/vectorsdb/get-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db get-transaction \ - --transaction-id -``` diff --git a/docs/examples/vectorsdb/get-usage.md b/docs/examples/vectorsdb/get-usage.md deleted file mode 100644 index c768a18d..00000000 --- a/docs/examples/vectorsdb/get-usage.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db get-usage \ - --database-id -``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md deleted file mode 100644 index e6f3c31e..00000000 --- a/docs/examples/vectorsdb/get.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db get \ - --database-id -``` diff --git a/docs/examples/vectorsdb/list-collection-logs.md b/docs/examples/vectorsdb/list-collection-logs.md deleted file mode 100644 index 9551f6b6..00000000 --- a/docs/examples/vectorsdb/list-collection-logs.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db list-collection-logs \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md deleted file mode 100644 index 4724599f..00000000 --- a/docs/examples/vectorsdb/list-collections.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db list-collections \ - --database-id -``` diff --git a/docs/examples/vectorsdb/list-document-logs.md b/docs/examples/vectorsdb/list-document-logs.md deleted file mode 100644 index b8f63791..00000000 --- a/docs/examples/vectorsdb/list-document-logs.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db list-document-logs \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md deleted file mode 100644 index ef430028..00000000 --- a/docs/examples/vectorsdb/list-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db list-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md deleted file mode 100644 index af9183d8..00000000 --- a/docs/examples/vectorsdb/list-indexes.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db list-indexes \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md deleted file mode 100644 index ce2298bf..00000000 --- a/docs/examples/vectorsdb/list-transactions.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite vectors-db list-transactions -``` diff --git a/docs/examples/vectorsdb/list-usage.md b/docs/examples/vectorsdb/list-usage.md deleted file mode 100644 index 472035b9..00000000 --- a/docs/examples/vectorsdb/list-usage.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite vectors-db list-usage -``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md deleted file mode 100644 index 630d6d75..00000000 --- a/docs/examples/vectorsdb/list.md +++ /dev/null @@ -1,3 +0,0 @@ -```bash -appwrite vectors-db list -``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md deleted file mode 100644 index 3ad41829..00000000 --- a/docs/examples/vectorsdb/update-collection.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db update-collection \ - --database-id \ - --collection-id \ - --name -``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md deleted file mode 100644 index 1fb31e1e..00000000 --- a/docs/examples/vectorsdb/update-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db update-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md deleted file mode 100644 index 99c96156..00000000 --- a/docs/examples/vectorsdb/update-documents.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db update-documents \ - --database-id \ - --collection-id -``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md deleted file mode 100644 index 92fe0e44..00000000 --- a/docs/examples/vectorsdb/update-transaction.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite vectors-db update-transaction \ - --transaction-id -``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md deleted file mode 100644 index df0d1a09..00000000 --- a/docs/examples/vectorsdb/update.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite vectors-db update \ - --database-id \ - --name -``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md deleted file mode 100644 index 9f613689..00000000 --- a/docs/examples/vectorsdb/upsert-document.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db upsert-document \ - --database-id \ - --collection-id \ - --document-id -``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md deleted file mode 100644 index 115f694e..00000000 --- a/docs/examples/vectorsdb/upsert-documents.md +++ /dev/null @@ -1,6 +0,0 @@ -```bash -appwrite vectors-db upsert-documents \ - --database-id \ - --collection-id \ - --documents one two three -``` diff --git a/lib/commands/services/documents-db.ts b/lib/commands/services/documents-db.ts deleted file mode 100644 index 9ce226a2..00000000 --- a/lib/commands/services/documents-db.ts +++ /dev/null @@ -1,583 +0,0 @@ -import { Command } from "commander"; -import { sdkForProject } from "../../sdks.js"; -import { - actionRunner, - commandDescriptions, - success, - parse, - parseBool, - parseInteger, -} from "../../parser.js"; -import { DocumentsDB } from "@appwrite.io/console"; - -let documentsDBClient: DocumentsDB | null = null; - -const getDocumentsDBClient = async (): Promise => { - if (!documentsDBClient) { - const sdkClient = await sdkForProject(); - documentsDBClient = new DocumentsDB(sdkClient); - } - return documentsDBClient; -}; - -export const documentsDB = new Command("documents-db") - .description(commandDescriptions["documentsDB"] ?? "") - .configureHelp({ - helpWidth: process.stdout.columns || 80, - }); - -documentsDB - .command(`list`) - .description(`Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`) - .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: name`) - .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) - .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), - ) - .action( - actionRunner( - async ({ queries, search, total }) => - parse(await (await getDocumentsDBClient()).list(queries, search, total)), - ), - ); - -documentsDB - .command(`create`) - .description(`Create a new Database. -`) - .requiredOption(`--database-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.`) - .requiredOption(`--name `, `Database name. Max length: 128 chars.`) - .option( - `--enabled [value]`, - `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, name, enabled }) => - parse(await (await getDocumentsDBClient()).create(databaseId, name, enabled)), - ), - ); - -documentsDB - .command(`list-transactions`) - .description(``) - .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).`) - .action( - actionRunner( - async ({ queries }) => - parse(await (await getDocumentsDBClient()).listTransactions(queries)), - ), - ); - -documentsDB - .command(`create-transaction`) - .description(``) - .option(`--ttl `, `Seconds before the transaction expires.`, parseInteger) - .action( - actionRunner( - async ({ ttl }) => - parse(await (await getDocumentsDBClient()).createTransaction(ttl)), - ), - ); - -documentsDB - .command(`get-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .action( - actionRunner( - async ({ transactionId }) => - parse(await (await getDocumentsDBClient()).getTransaction(transactionId)), - ), - ); - -documentsDB - .command(`update-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .option( - `--commit [value]`, - `Commit transaction?`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--rollback [value]`, - `Rollback transaction?`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ transactionId, commit, rollback }) => - parse(await (await getDocumentsDBClient()).updateTransaction(transactionId, commit, rollback)), - ), - ); - -documentsDB - .command(`delete-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .action( - actionRunner( - async ({ transactionId }) => - parse(await (await getDocumentsDBClient()).deleteTransaction(transactionId)), - ), - ); - -documentsDB - .command(`list-usage`) - .description(`List usage metrics and statistics for all databases in the project. You can view the total number of databases, collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ range }) => - parse(await (await getDocumentsDBClient()).listUsage(range)), - ), - ); - -documentsDB - .command(`get`) - .description(`Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.`) - .requiredOption(`--database-id `, `Database ID.`) - .action( - actionRunner( - async ({ databaseId }) => - parse(await (await getDocumentsDBClient()).get(databaseId)), - ), - ); - -documentsDB - .command(`update`) - .description(`Update a database by its unique ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--name `, `Database name. Max length: 128 chars.`) - .option( - `--enabled [value]`, - `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, name, enabled }) => - parse(await (await getDocumentsDBClient()).update(databaseId, name, enabled)), - ), - ); - -documentsDB - .command(`delete`) - .description(`Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.`) - .requiredOption(`--database-id `, `Database ID.`) - .action( - actionRunner( - async ({ databaseId }) => - parse(await (await getDocumentsDBClient()).delete(databaseId)), - ), - ); - -documentsDB - .command(`list-collections`) - .description(`Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.`) - .requiredOption(`--database-id `, `Database ID.`) - .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`) - .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) - .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), - ) - .action( - actionRunner( - async ({ databaseId, queries, search, total }) => - parse(await (await getDocumentsDBClient()).listCollections(databaseId, queries, search, total)), - ), - ); - -documentsDB - .command(`create-collection`) - .description(`Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-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.`) - .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option( - `--document-security [value]`, - `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--enabled [value]`, - `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option(`--attributes [attributes...]`, `Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.`) - .option(`--indexes [indexes...]`, `Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).`) - .action( - actionRunner( - async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled, attributes, indexes }) => - parse(await (await getDocumentsDBClient()).createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled, attributes, indexes)), - ), - ); - -documentsDB - .command(`get-collection`) - .description(`Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .action( - actionRunner( - async ({ databaseId, collectionId }) => - parse(await (await getDocumentsDBClient()).getCollection(databaseId, collectionId)), - ), - ); - -documentsDB - .command(`update-collection`) - .description(`Update a collection by its unique ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) - .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option( - `--document-security [value]`, - `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--enabled [value]`, - `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, collectionId, name, permissions, documentSecurity, enabled }) => - parse(await (await getDocumentsDBClient()).updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled)), - ), - ); - -documentsDB - .command(`delete-collection`) - .description(`Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .action( - actionRunner( - async ({ databaseId, collectionId }) => - parse(await (await getDocumentsDBClient()).deleteCollection(databaseId, collectionId)), - ), - ); - -documentsDB - .command(`list-documents`) - .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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.`) - .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) - .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(`--ttl `, `TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).`, parseInteger) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, transactionId, total, ttl }) => - parse(await (await getDocumentsDBClient()).listDocuments(databaseId, collectionId, queries, transactionId, total, ttl)), - ), - ); - -documentsDB - .command(`create-document`) - .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) - .requiredOption(`--document-id `, `Document 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(`--data `, `Document data as JSON object.`) - .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).`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions }) => - parse(await (await getDocumentsDBClient()).createDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions)), - ), - ); - -documentsDB - .command(`create-documents`) - .description(`Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) - .requiredOption(`--documents [documents...]`, `Array of documents data as JSON objects.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documents }) => - parse(await (await getDocumentsDBClient()).createDocuments(databaseId, collectionId, documents)), - ), - ); - -documentsDB - .command(`upsert-documents`) - .description(`Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. -`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documents, transactionId }) => - parse(await (await getDocumentsDBClient()).upsertDocuments(databaseId, collectionId, documents, transactionId)), - ), - ); - -documentsDB - .command(`update-documents`) - .description(`Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .option(`--data `, `Document data as JSON object. Include only attribute and value pairs to be updated.`) - .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.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, data, queries, transactionId }) => - parse(await (await getDocumentsDBClient()).updateDocuments(databaseId, collectionId, JSON.parse(data), queries, transactionId)), - ), - ); - -documentsDB - .command(`delete-documents`) - .description(`Bulk delete documents using queries, if no queries are passed then all documents are deleted.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, transactionId }) => - parse(await (await getDocumentsDBClient()).deleteDocuments(databaseId, collectionId, queries, transactionId)), - ), - ); - -documentsDB - .command(`get-document`) - .description(`Get a document by its unique ID. This endpoint response returns a JSON object with the document data.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--document-id `, `Document ID.`) - .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.`) - .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, queries, transactionId }) => - parse(await (await getDocumentsDBClient()).getDocument(databaseId, collectionId, documentId, queries, transactionId)), - ), - ); - -documentsDB - .command(`upsert-document`) - .description(`Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--data `, `Document data as JSON object. Include all required fields of the document to be created or updated.`) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => - parse(await (await getDocumentsDBClient()).upsertDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), - ), - ); - -documentsDB - .command(`update-document`) - .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--data `, `Document data as JSON object. Include only fields and value pairs to be updated.`) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => - parse(await (await getDocumentsDBClient()).updateDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), - ), - ); - -documentsDB - .command(`delete-document`) - .description(`Delete a document by its unique ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, transactionId }) => - parse(await (await getDocumentsDBClient()).deleteDocument(databaseId, collectionId, documentId, transactionId)), - ), - ); - -documentsDB - .command(`list-document-logs`) - .description(`Get the document activity logs list by its unique ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .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`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, queries }) => - parse(await (await getDocumentsDBClient()).listDocumentLogs(databaseId, collectionId, documentId, queries)), - ), - ); - -documentsDB - .command(`decrement-document-attribute`) - .description(`Decrement a specific column of a row by a given value.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .requiredOption(`--attribute `, `Attribute key.`) - .option(`--value `, `Value to decrement the attribute by. The value must be a number.`, parseInteger) - .option(`--min `, `Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.`, parseInteger) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, attribute, value, min, transactionId }) => - parse(await (await getDocumentsDBClient()).decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min, transactionId)), - ), - ); - -documentsDB - .command(`increment-document-attribute`) - .description(`Increment a specific column of a row by a given value.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .requiredOption(`--attribute `, `Attribute key.`) - .option(`--value `, `Value to increment the attribute by. The value must be a number.`, parseInteger) - .option(`--max `, `Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.`, parseInteger) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, attribute, value, max, transactionId }) => - parse(await (await getDocumentsDBClient()).incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max, transactionId)), - ), - ); - -documentsDB - .command(`list-indexes`) - .description(`List indexes in the collection.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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`) - .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), - ) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, total }) => - parse(await (await getDocumentsDBClient()).listIndexes(databaseId, collectionId, queries, total)), - ), - ); - -documentsDB - .command(`create-index`) - .description(`Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. -Attributes can be \`key\`, \`fulltext\`, and \`unique\`.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .requiredOption(`--type `, `Index type.`) - .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`) - .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`) - .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`) - .action( - actionRunner( - async ({ databaseId, collectionId, key, type, attributes, orders, lengths }) => - parse(await (await getDocumentsDBClient()).createIndex(databaseId, collectionId, key, type, attributes, orders, lengths)), - ), - ); - -documentsDB - .command(`get-index`) - .description(`Get index by ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .action( - actionRunner( - async ({ databaseId, collectionId, key }) => - parse(await (await getDocumentsDBClient()).getIndex(databaseId, collectionId, key)), - ), - ); - -documentsDB - .command(`delete-index`) - .description(`Delete an index.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .action( - actionRunner( - async ({ databaseId, collectionId, key }) => - parse(await (await getDocumentsDBClient()).deleteIndex(databaseId, collectionId, key)), - ), - ); - -documentsDB - .command(`list-collection-logs`) - .description(`Get the collection activity logs list by its unique ID.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .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`) - .action( - actionRunner( - async ({ databaseId, collectionId, queries }) => - parse(await (await getDocumentsDBClient()).listCollectionLogs(databaseId, collectionId, queries)), - ), - ); - -documentsDB - .command(`get-collection-usage`) - .description(`Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ databaseId, collectionId, range }) => - parse(await (await getDocumentsDBClient()).getCollectionUsage(databaseId, collectionId, range)), - ), - ); - -documentsDB - .command(`get-usage`) - .description(`Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`) - .requiredOption(`--database-id `, `Database ID.`) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ databaseId, range }) => - parse(await (await getDocumentsDBClient()).getUsage(databaseId, range)), - ), - ); - diff --git a/lib/commands/services/vectors-db.ts b/lib/commands/services/vectors-db.ts deleted file mode 100644 index ead7838f..00000000 --- a/lib/commands/services/vectors-db.ts +++ /dev/null @@ -1,570 +0,0 @@ -import { Command } from "commander"; -import { sdkForProject } from "../../sdks.js"; -import { - actionRunner, - commandDescriptions, - success, - parse, - parseBool, - parseInteger, -} from "../../parser.js"; -import { VectorsDB } from "@appwrite.io/console"; - -let vectorsDBClient: VectorsDB | null = null; - -const getVectorsDBClient = async (): Promise => { - if (!vectorsDBClient) { - const sdkClient = await sdkForProject(); - vectorsDBClient = new VectorsDB(sdkClient); - } - return vectorsDBClient; -}; - -export const vectorsDB = new Command("vectors-db") - .description(commandDescriptions["vectorsDB"] ?? "") - .configureHelp({ - helpWidth: process.stdout.columns || 80, - }); - -vectorsDB - .command(`list`) - .description(``) - .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: name`) - .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) - .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), - ) - .action( - actionRunner( - async ({ queries, search, total }) => - parse(await (await getVectorsDBClient()).list(queries, search, total)), - ), - ); - -vectorsDB - .command(`create`) - .description(``) - .requiredOption(`--database-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.`) - .requiredOption(`--name `, `Database name. Max length: 128 chars.`) - .option( - `--enabled [value]`, - `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, name, enabled }) => - parse(await (await getVectorsDBClient()).create(databaseId, name, enabled)), - ), - ); - -vectorsDB - .command(`create-text-embeddings`) - .description(``) - .requiredOption(`--texts [texts...]`, `Array of text to generate embeddings.`) - .option(`--model `, `The embedding model to use for generating vector embeddings.`) - .action( - actionRunner( - async ({ texts, model }) => - parse(await (await getVectorsDBClient()).createTextEmbeddings(texts, model)), - ), - ); - -vectorsDB - .command(`list-transactions`) - .description(``) - .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).`) - .action( - actionRunner( - async ({ queries }) => - parse(await (await getVectorsDBClient()).listTransactions(queries)), - ), - ); - -vectorsDB - .command(`create-transaction`) - .description(``) - .option(`--ttl `, `Seconds before the transaction expires.`, parseInteger) - .action( - actionRunner( - async ({ ttl }) => - parse(await (await getVectorsDBClient()).createTransaction(ttl)), - ), - ); - -vectorsDB - .command(`get-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .action( - actionRunner( - async ({ transactionId }) => - parse(await (await getVectorsDBClient()).getTransaction(transactionId)), - ), - ); - -vectorsDB - .command(`update-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .option( - `--commit [value]`, - `Commit transaction?`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--rollback [value]`, - `Rollback transaction?`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ transactionId, commit, rollback }) => - parse(await (await getVectorsDBClient()).updateTransaction(transactionId, commit, rollback)), - ), - ); - -vectorsDB - .command(`delete-transaction`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .action( - actionRunner( - async ({ transactionId }) => - parse(await (await getVectorsDBClient()).deleteTransaction(transactionId)), - ), - ); - -vectorsDB - .command(`create-operations`) - .description(``) - .requiredOption(`--transaction-id `, `Transaction ID.`) - .option(`--operations [operations...]`, `Array of staged operations.`) - .action( - actionRunner( - async ({ transactionId, operations }) => - parse(await (await getVectorsDBClient()).createOperations(transactionId, operations)), - ), - ); - -vectorsDB - .command(`list-usage`) - .description(``) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ range }) => - parse(await (await getVectorsDBClient()).listUsage(range)), - ), - ); - -vectorsDB - .command(`get`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .action( - actionRunner( - async ({ databaseId }) => - parse(await (await getVectorsDBClient()).get(databaseId)), - ), - ); - -vectorsDB - .command(`update`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--name `, `Database name. Max length: 128 chars.`) - .option( - `--enabled [value]`, - `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, name, enabled }) => - parse(await (await getVectorsDBClient()).update(databaseId, name, enabled)), - ), - ); - -vectorsDB - .command(`delete`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .action( - actionRunner( - async ({ databaseId }) => - parse(await (await getVectorsDBClient()).delete(databaseId)), - ), - ); - -vectorsDB - .command(`list-collections`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .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`) - .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) - .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), - ) - .action( - actionRunner( - async ({ databaseId, queries, search, total }) => - parse(await (await getVectorsDBClient()).listCollections(databaseId, queries, search, total)), - ), - ); - -vectorsDB - .command(`create-collection`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-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.`) - .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) - .requiredOption(`--dimension `, `Embedding dimension.`, parseInteger) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option( - `--document-security [value]`, - `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--enabled [value]`, - `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled }) => - parse(await (await getVectorsDBClient()).createCollection(databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled)), - ), - ); - -vectorsDB - .command(`get-collection`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .action( - actionRunner( - async ({ databaseId, collectionId }) => - parse(await (await getVectorsDBClient()).getCollection(databaseId, collectionId)), - ), - ); - -vectorsDB - .command(`update-collection`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) - .option(`--dimension `, `Embedding dimensions.`, parseInteger) - .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option( - `--document-security [value]`, - `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option( - `--enabled [value]`, - `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .action( - actionRunner( - async ({ databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled }) => - parse(await (await getVectorsDBClient()).updateCollection(databaseId, collectionId, name, dimension, permissions, documentSecurity, enabled)), - ), - ); - -vectorsDB - .command(`delete-collection`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .action( - actionRunner( - async ({ databaseId, collectionId }) => - parse(await (await getVectorsDBClient()).deleteCollection(databaseId, collectionId)), - ), - ); - -vectorsDB - .command(`list-documents`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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.`) - .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) - .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(`--ttl `, `TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).`, parseInteger) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, transactionId, total, ttl }) => - parse(await (await getVectorsDBClient()).listDocuments(databaseId, collectionId, queries, transactionId, total, ttl)), - ), - ); - -vectorsDB - .command(`create-document`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) - .requiredOption(`--document-id `, `Document 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(`--data `, `Document data as JSON object.`) - .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).`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions }) => - parse(await (await getVectorsDBClient()).createDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions)), - ), - ); - -vectorsDB - .command(`create-documents`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) - .requiredOption(`--documents [documents...]`, `Array of documents data as JSON objects.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documents }) => - parse(await (await getVectorsDBClient()).createDocuments(databaseId, collectionId, documents)), - ), - ); - -vectorsDB - .command(`upsert-documents`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documents, transactionId }) => - parse(await (await getVectorsDBClient()).upsertDocuments(databaseId, collectionId, documents, transactionId)), - ), - ); - -vectorsDB - .command(`update-documents`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .option(`--data `, `Document data as JSON object. Include only attribute and value pairs to be updated.`) - .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.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, data, queries, transactionId }) => - parse(await (await getVectorsDBClient()).updateDocuments(databaseId, collectionId, JSON.parse(data), queries, transactionId)), - ), - ); - -vectorsDB - .command(`delete-documents`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, transactionId }) => - parse(await (await getVectorsDBClient()).deleteDocuments(databaseId, collectionId, queries, transactionId)), - ), - ); - -vectorsDB - .command(`get-document`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--document-id `, `Document ID.`) - .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.`) - .option(`--transaction-id `, `Transaction ID to read uncommitted changes within the transaction.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, queries, transactionId }) => - parse(await (await getVectorsDBClient()).getDocument(databaseId, collectionId, documentId, queries, transactionId)), - ), - ); - -vectorsDB - .command(`upsert-document`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--data `, `Document data as JSON object. Include all required fields of the document to be created or updated.`) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => - parse(await (await getVectorsDBClient()).upsertDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), - ), - ); - -vectorsDB - .command(`update-document`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--data `, `Document data as JSON object. Include only fields and value pairs to be updated.`) - .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, data, permissions, transactionId }) => - parse(await (await getVectorsDBClient()).updateDocument(databaseId, collectionId, documentId, JSON.parse(data), permissions, transactionId)), - ), - ); - -vectorsDB - .command(`delete-document`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--document-id `, `Document ID.`) - .option(`--transaction-id `, `Transaction ID for staging the operation.`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, transactionId }) => - parse(await (await getVectorsDBClient()).deleteDocument(databaseId, collectionId, documentId, transactionId)), - ), - ); - -vectorsDB - .command(`list-document-logs`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .requiredOption(`--document-id `, `Document ID.`) - .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`) - .action( - actionRunner( - async ({ databaseId, collectionId, documentId, queries }) => - parse(await (await getVectorsDBClient()).listDocumentLogs(databaseId, collectionId, documentId, queries)), - ), - ); - -vectorsDB - .command(`list-indexes`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .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`) - .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), - ) - .action( - actionRunner( - async ({ databaseId, collectionId, queries, total }) => - parse(await (await getVectorsDBClient()).listIndexes(databaseId, collectionId, queries, total)), - ), - ); - -vectorsDB - .command(`create-index`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .requiredOption(`--type `, `Index type.`) - .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`) - .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`) - .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`) - .action( - actionRunner( - async ({ databaseId, collectionId, key, type, attributes, orders, lengths }) => - parse(await (await getVectorsDBClient()).createIndex(databaseId, collectionId, key, type, attributes, orders, lengths)), - ), - ); - -vectorsDB - .command(`get-index`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .action( - actionRunner( - async ({ databaseId, collectionId, key }) => - parse(await (await getVectorsDBClient()).getIndex(databaseId, collectionId, key)), - ), - ); - -vectorsDB - .command(`delete-index`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--key `, `Index Key.`) - .action( - actionRunner( - async ({ databaseId, collectionId, key }) => - parse(await (await getVectorsDBClient()).deleteIndex(databaseId, collectionId, key)), - ), - ); - -vectorsDB - .command(`list-collection-logs`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .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`) - .action( - actionRunner( - async ({ databaseId, collectionId, queries }) => - parse(await (await getVectorsDBClient()).listCollectionLogs(databaseId, collectionId, queries)), - ), - ); - -vectorsDB - .command(`get-collection-usage`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .requiredOption(`--collection-id `, `Collection ID.`) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ databaseId, collectionId, range }) => - parse(await (await getVectorsDBClient()).getCollectionUsage(databaseId, collectionId, range)), - ), - ); - -vectorsDB - .command(`get-usage`) - .description(``) - .requiredOption(`--database-id `, `Database ID.`) - .option(`--range `, `Date range.`) - .action( - actionRunner( - async ({ databaseId, range }) => - parse(await (await getVectorsDBClient()).getUsage(databaseId, range)), - ), - ); - From a6dfe8afc6ccde4c8931a5cd95e3fb5c493803d8 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 06:41:56 +0000 Subject: [PATCH 4/5] chore: update Command Line SDK to 17.0.0 --- lib/commands/services/account.ts | 169 ------------------------------ lib/commands/services/health.ts | 68 ------------ lib/commands/services/projects.ts | 12 --- 3 files changed, 249 deletions(-) diff --git a/lib/commands/services/account.ts b/lib/commands/services/account.ts index ce945115..e91e4423 100644 --- a/lib/commands/services/account.ts +++ b/lib/commands/services/account.ts @@ -58,83 +58,6 @@ account ), ); -account - .command(`list-billing-addresses`) - .description(`List all billing addresses for a user.`) - .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`) - .action( - actionRunner( - async ({ queries }) => - parse(await (await getAccountClient()).listBillingAddresses(queries)), - ), - ); - -account - .command(`create-billing-address`) - .description(`Add a new billing address to a user's account.`) - .requiredOption(`--country `, `Country`) - .requiredOption(`--city `, `City`) - .requiredOption(`--street-address `, `Street address`) - .option(`--address-line-2 `, `Address line 2`) - .option(`--state `, `State or province`) - .option(`--postal-code `, `Postal code`) - .action( - actionRunner( - async ({ country, city, streetAddress, addressLine2, state, postalCode }) => - parse(await (await getAccountClient()).createBillingAddress(country, city, streetAddress, addressLine2, state, postalCode)), - ), - ); - -account - .command(`get-billing-address`) - .description(`Get a specific billing address for a user using it's ID.`) - .requiredOption(`--billing-address-id `, `Unique ID of billing address`) - .action( - actionRunner( - async ({ billingAddressId }) => - parse(await (await getAccountClient()).getBillingAddress(billingAddressId)), - ), - ); - -account - .command(`update-billing-address`) - .description(`Update a specific billing address using it's ID.`) - .requiredOption(`--billing-address-id `, `Unique ID of billing address`) - .requiredOption(`--country `, `Country`) - .requiredOption(`--city `, `City`) - .requiredOption(`--street-address `, `Street address`) - .option(`--address-line-2 `, `Address line 2`) - .option(`--state `, `State or province`) - .option(`--postal-code `, `Postal code`) - .action( - actionRunner( - async ({ billingAddressId, country, city, streetAddress, addressLine2, state, postalCode }) => - parse(await (await getAccountClient()).updateBillingAddress(billingAddressId, country, city, streetAddress, addressLine2, state, postalCode)), - ), - ); - -account - .command(`delete-billing-address`) - .description(`Delete a specific billing address using it's ID.`) - .requiredOption(`--billing-address-id `, `Billing address unique ID`) - .action( - actionRunner( - async ({ billingAddressId }) => - parse(await (await getAccountClient()).deleteBillingAddress(billingAddressId)), - ), - ); - -account - .command(`get-coupon`) - .description(`Get coupon details for an account.`) - .requiredOption(`--coupon-id `, `ID of the coupon`) - .action( - actionRunner( - async ({ couponId }) => - parse(await (await getAccountClient()).getCoupon(couponId)), - ), - ); - account .command(`update-email`) .description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. @@ -177,17 +100,6 @@ account ), ); -account - .command(`list-invoices`) - .description(`List all invoices tied to an account.`) - .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount`) - .action( - actionRunner( - async ({ queries }) => - parse(await (await getAccountClient()).listInvoices(queries)), - ), - ); - account .command(`create-jwt`) .description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`) @@ -408,87 +320,6 @@ account ), ); -account - .command(`list-payment-methods`) - .description(`List payment methods for this account.`) - .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`) - .action( - actionRunner( - async ({ queries }) => - parse(await (await getAccountClient()).listPaymentMethods(queries)), - ), - ); - -account - .command(`create-payment-method`) - .description(`Create a new payment method for the current user account.`) - .action( - actionRunner( - async () => parse(await (await getAccountClient()).createPaymentMethod()), - ), - ); - -account - .command(`get-payment-method`) - .description(`Get a specific payment method for the user.`) - .requiredOption(`--payment-method-id `, `Unique ID of payment method`) - .action( - actionRunner( - async ({ paymentMethodId }) => - parse(await (await getAccountClient()).getPaymentMethod(paymentMethodId)), - ), - ); - -account - .command(`update-payment-method`) - .description(`Update a new payment method for the current user account.`) - .requiredOption(`--payment-method-id `, `Unique ID of payment method`) - .requiredOption(`--expiry-month `, `Payment expiry month`, parseInteger) - .requiredOption(`--expiry-year `, `Expiry year`, parseInteger) - .option(`--state `, `State of the payment method country`) - .action( - actionRunner( - async ({ paymentMethodId, expiryMonth, expiryYear, state }) => - parse(await (await getAccountClient()).updatePaymentMethod(paymentMethodId, expiryMonth, expiryYear, state)), - ), - ); - -account - .command(`delete-payment-method`) - .description(`Delete a specific payment method from a user's account.`) - .requiredOption(`--payment-method-id `, `Unique ID of payment method`) - .action( - actionRunner( - async ({ paymentMethodId }) => - parse(await (await getAccountClient()).deletePaymentMethod(paymentMethodId)), - ), - ); - -account - .command(`update-payment-method-provider`) - .description(`Update payment method provider.`) - .requiredOption(`--payment-method-id `, `Unique ID of payment method`) - .requiredOption(`--provider-method-id `, `Payment method ID from the payment provider`) - .requiredOption(`--name `, `Name in the payment method`) - .option(`--state `, `State of the payment method country`) - .action( - actionRunner( - async ({ paymentMethodId, providerMethodId, name, state }) => - parse(await (await getAccountClient()).updatePaymentMethodProvider(paymentMethodId, providerMethodId, name, state)), - ), - ); - -account - .command(`update-payment-method-mandate-options`) - .description(`Update payment method mandate options.`) - .requiredOption(`--payment-method-id `, `Unique ID of payment method`) - .action( - actionRunner( - async ({ paymentMethodId }) => - parse(await (await getAccountClient()).updatePaymentMethodMandateOptions(paymentMethodId)), - ), - ); - account .command(`update-phone`) .description(`Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.`) diff --git a/lib/commands/services/health.ts b/lib/commands/services/health.ts index 794969fc..4ad11cab 100644 --- a/lib/commands/services/health.ts +++ b/lib/commands/services/health.ts @@ -64,19 +64,6 @@ health ), ); -health - .command(`get-console-pausing`) - .description(`Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. -`) - .option(`--threshold `, `Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10.`, parseInteger) - .option(`--inactivity-days `, `Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7.`, parseInteger) - .action( - actionRunner( - async ({ threshold, inactivityDays }) => - parse(await (await getHealthClient()).getConsolePausing(threshold, inactivityDays)), - ), - ); - health .command(`get-db`) .description(`Check the Appwrite database servers are up and connection is successful.`) @@ -106,28 +93,6 @@ health ), ); -health - .command(`get-queue-billing-project-aggregation`) - .description(`Get billing project aggregation queue.`) - .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) - .action( - actionRunner( - async ({ threshold }) => - parse(await (await getHealthClient()).getQueueBillingProjectAggregation(threshold)), - ), - ); - -health - .command(`get-queue-billing-team-aggregation`) - .description(`Get billing team aggregation queue.`) - .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) - .action( - actionRunner( - async ({ threshold }) => - parse(await (await getHealthClient()).getQueueBillingTeamAggregation(threshold)), - ), - ); - health .command(`get-queue-builds`) .description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`) @@ -139,17 +104,6 @@ health ), ); -health - .command(`get-queue-priority-builds`) - .description(`Get the priority builds queue size.`) - .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.`, parseInteger) - .action( - actionRunner( - async ({ threshold }) => - parse(await (await getHealthClient()).getQueuePriorityBuilds(threshold)), - ), - ); - health .command(`get-queue-certificates`) .description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`) @@ -252,17 +206,6 @@ health ), ); -health - .command(`get-queue-region-manager`) - .description(`Get region manager queue.`) - .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger) - .action( - actionRunner( - async ({ threshold }) => - parse(await (await getHealthClient()).getQueueRegionManager(threshold)), - ), - ); - health .command(`get-queue-stats-resources`) .description(`Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.`) @@ -285,17 +228,6 @@ health ), ); -health - .command(`get-queue-threats`) - .description(`Get threats queue.`) - .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger) - .action( - actionRunner( - async ({ threshold }) => - parse(await (await getHealthClient()).getQueueThreats(threshold)), - ), - ); - health .command(`get-queue-webhooks`) .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`) diff --git a/lib/commands/services/projects.ts b/lib/commands/services/projects.ts index 85e9327b..075742e3 100644 --- a/lib/commands/services/projects.ts +++ b/lib/commands/services/projects.ts @@ -270,18 +270,6 @@ projects ), ); -projects - .command(`update-console-access`) - .description(`Record console access to a project. This endpoint updates the last accessed timestamp for the project to track console activity. -`) - .requiredOption(`--project-id `, `Project ID`) - .action( - actionRunner( - async ({ projectId }) => - parse(await (await getProjectsClient()).updateConsoleAccess(projectId)), - ), - ); - projects .command(`list-dev-keys`) .description(`List all the project\'s dev keys. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development.'`) From fa12c4c978006d12f2b724694fe52bc7ffb5c247 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:16:51 +0000 Subject: [PATCH 5/5] chore: update Command Line SDK to 17.0.0 --- CHANGELOG.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b6542a4..172822e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,15 @@ ## 17.0.0 * [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents -* Breaking: Removed `--key` option from `appwrite project update-variable` -* Added `--variable-id` to `appwrite project create-variable` -* Updated API version badge to 1.9.0 +* [BREAKING] Removed `--key` required option from `appwrite project update-variable` (now optional) +* [BREAKING] Removed billing/payment commands from `appwrite account`: `list-billing-addresses`, `create-billing-address`, `get-billing-address`, `update-billing-address`, `delete-billing-address`, `get-coupon`, `list-invoices`, `list-payment-methods`, `create-payment-method`, `get-payment-method`, `update-payment-method`, `delete-payment-method`, `update-payment-method-provider`, `update-payment-method-mandate-options` +* [BREAKING] Removed cloud-specific health commands: `get-console-pausing`, `get-queue-billing-project-aggregation`, `get-queue-billing-team-aggregation`, `get-queue-priority-builds`, `get-queue-region-manager`, `get-queue-threats` +* [BREAKING] Removed `appwrite projects update-console-access` command +* Added `--variable-id` required parameter to `appwrite project create-variable` +* Added `--queries` and `--total` optional parameters to `appwrite project list-variables` +* Added new `appwrite users update-impersonator` command +* Added `impersonator` as a filterable attribute in `appwrite users list` +* Updated API version badge to `1.9.0` and compatibility to server version `1.9.x` ## 16.0.0