From 39709b9a69843586704c6240eb43b110814b684b Mon Sep 17 00:00:00 2001 From: ChiragAgg5k Date: Thu, 27 Feb 2025 05:01:21 +0000 Subject: [PATCH] chore: regenerate sdks --- .github/workflows/npm-publish.yml | 2 +- README.md | 4 +- install.ps1 | 4 +- install.sh | 2 +- lib/client.js | 4 +- lib/commands/account.js | 6 +- lib/commands/assistant.js | 2 +- lib/commands/databases.js | 6 +- lib/commands/functions.js | 8 +-- lib/commands/messaging.js | 6 +- lib/commands/migrations.js | 24 ++++---- lib/commands/organizations.js | 48 ++++++++++++++++ lib/commands/project.js | 2 +- lib/commands/projects.js | 92 +++++++++++++++---------------- lib/commands/proxy.js | 2 +- lib/commands/storage.js | 4 +- lib/commands/users.js | 2 +- lib/commands/vcs.js | 20 +++---- lib/parser.js | 2 +- lib/questions.js | 6 +- lib/utils.js | 13 +++++ package.json | 2 +- scoop/appwrite.json | 6 +- 23 files changed, 166 insertions(+), 101 deletions(-) create mode 100644 lib/commands/organizations.js diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b41bcac..c7eb01f 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,7 +14,7 @@ jobs: - name: Setup binfmt with QEMU run: | sudo apt update - sudo apt install qemu-system binfmt-support qemu-user-static + sudo apt install qemu binfmt-support qemu-user-static update-binfmts --display - name: Setup ldid run: | diff --git a/README.md b/README.md index b93b48b..789870d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using ```sh $ appwrite -v -6.2.0 +6.2.1 ``` ### 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 -6.2.0 +6.2.1 ``` ## Getting Started diff --git a/install.ps1 b/install.ps1 index 748ff85..54c64b7 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/6.2.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.1/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.1/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index b136ffc..45894cb 100644 --- a/install.sh +++ b/install.sh @@ -97,7 +97,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="6.2.0" + GITHUB_LATEST_VERSION="6.2.1" 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/client.js b/lib/client.js index 8ab45e2..70366be 100644 --- a/lib/client.js +++ b/lib/client.js @@ -16,8 +16,8 @@ class Client { 'x-sdk-name': 'Command Line', 'x-sdk-platform': 'console', 'x-sdk-language': 'cli', - 'x-sdk-version': '6.2.0', - 'user-agent' : `AppwriteCLI/6.2.0 (${os.type()} ${os.version()}; ${os.arch()})`, + 'x-sdk-version': '6.2.1', + 'user-agent' : `AppwriteCLI/6.2.1 (${os.type()} ${os.version()}; ${os.arch()})`, 'X-Appwrite-Response-Format' : '1.6.0', }; } diff --git a/lib/commands/account.js b/lib/commands/account.js index 40e2ec4..5a1efc6 100644 --- a/lib/commands/account.js +++ b/lib/commands/account.js @@ -1954,7 +1954,7 @@ account account .command(`create-push-target`) - .description(``) + .description(`Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.`) .requiredOption(`--target-id `, `Target 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(`--identifier `, `The target identifier (token, email, phone etc.)`) .option(`--provider-id `, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) @@ -1962,14 +1962,14 @@ account account .command(`update-push-target`) - .description(``) + .description(`Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.`) .requiredOption(`--target-id `, `Target ID.`) .requiredOption(`--identifier `, `The target identifier (token, email, phone etc.)`) .action(actionRunner(accountUpdatePushTarget)) account .command(`delete-push-target`) - .description(``) + .description(`Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.`) .requiredOption(`--target-id `, `Target ID.`) .action(actionRunner(accountDeletePushTarget)) diff --git a/lib/commands/assistant.js b/lib/commands/assistant.js index 16a17ec..20eb0ad 100644 --- a/lib/commands/assistant.js +++ b/lib/commands/assistant.js @@ -75,7 +75,7 @@ const assistantChat = async ({prompt,parseOutput = true, overrideForCli = false, assistant .command(`chat`) - .description(``) + .description(`Send a prompt to the AI assistant and receive a response. This endpoint allows you to interact with Appwrite's AI assistant by sending questions or prompts and receiving helpful responses in real-time through a server-sent events stream. `) .requiredOption(`--prompt `, `Prompt. A string containing questions asked to the AI assistant.`) .action(actionRunner(assistantChat)) diff --git a/lib/commands/databases.js b/lib/commands/databases.js index bf2df39..ede1729 100644 --- a/lib/commands/databases.js +++ b/lib/commands/databases.js @@ -2126,7 +2126,7 @@ databases databases .command(`get-usage`) - .description(``) + .description(`Get 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(databasesGetUsage)) @@ -2558,7 +2558,7 @@ databases databases .command(`get-collection-usage`) - .description(``) + .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.`) @@ -2573,7 +2573,7 @@ databases databases .command(`get-database-usage`) - .description(``) + .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.`) .option(`--console`, `Get the resource console url`) diff --git a/lib/commands/functions.js b/lib/commands/functions.js index a5b9a7f..a68aa89 100644 --- a/lib/commands/functions.js +++ b/lib/commands/functions.js @@ -1420,7 +1420,7 @@ functions functions .command(`get-usage`) - .description(``) + .description(`Get usage metrics and statistics for a for all functions. View statistics including total functions, deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. 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, defaults to 30 days.`) .option(`--range `, `Date range.`) .action(actionRunner(functionsGetUsage)) @@ -1503,7 +1503,7 @@ functions functions .command(`create-build`) - .description(``) + .description(`Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build.`) .requiredOption(`--function-id `, `Function ID.`) .requiredOption(`--deployment-id `, `Deployment ID.`) .option(`--build-id `, `Build unique ID.`) @@ -1511,7 +1511,7 @@ functions functions .command(`update-deployment-build`) - .description(``) + .description(`Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details.`) .requiredOption(`--function-id `, `Function ID.`) .requiredOption(`--deployment-id `, `Deployment ID.`) .action(actionRunner(functionsUpdateDeploymentBuild)) @@ -1563,7 +1563,7 @@ functions functions .command(`get-function-usage`) - .description(``) + .description(`Get usage metrics and statistics for a for a specific function. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. 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, defaults to 30 days.`) .requiredOption(`--function-id `, `Function ID.`) .option(`--range `, `Date range.`) .option(`--console`, `Get the resource console url`) diff --git a/lib/commands/messaging.js b/lib/commands/messaging.js index 957cb47..a21b041 100644 --- a/lib/commands/messaging.js +++ b/lib/commands/messaging.js @@ -2459,7 +2459,7 @@ messaging messaging .command(`update-email`) - .description(`Update an email message by its unique ID. `) + .description(`Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. `) .requiredOption(`--message-id `, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) @@ -2500,7 +2500,7 @@ messaging messaging .command(`update-push`) - .description(`Update a push notification by its unique ID. `) + .description(`Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. `) .requiredOption(`--message-id `, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) @@ -2536,7 +2536,7 @@ messaging messaging .command(`update-sms`) - .description(`Update an email message by its unique ID. `) + .description(`Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. `) .requiredOption(`--message-id `, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) diff --git a/lib/commands/migrations.js b/lib/commands/migrations.js index c90987b..fc25c81 100644 --- a/lib/commands/migrations.js +++ b/lib/commands/migrations.js @@ -584,14 +584,14 @@ const migrationsDelete = async ({migrationId,parseOutput = true, overrideForCli migrations .command(`list`) - .description(``) + .description(`List all migrations in the current project. This endpoint returns a list of all migrations including their status, progress, and any errors that occurred during the migration process.`) .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: status, stage, source, destination, resources, statusCounters, resourceData, errors`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(migrationsList)) migrations .command(`create-appwrite-migration`) - .description(``) + .description(`Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint `, `Source's Appwrite Endpoint`) .requiredOption(`--project-id `, `Source's Project ID`) @@ -600,7 +600,7 @@ migrations migrations .command(`get-appwrite-report`) - .description(``) + .description(`Generate a report of the data in an Appwrite project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated.`) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint `, `Source's Appwrite Endpoint`) .requiredOption(`--project-id `, `Source's Project ID`) @@ -609,21 +609,21 @@ migrations migrations .command(`create-firebase-migration`) - .description(``) + .description(`Migrate data from a Firebase project to your Appwrite project. This endpoint allows you to migrate resources like authentication and other supported services from a Firebase project. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--service-account `, `JSON of the Firebase service account credentials`) .action(actionRunner(migrationsCreateFirebaseMigration)) migrations .command(`get-firebase-report`) - .description(``) + .description(`Generate a report of the data in a Firebase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated.`) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--service-account `, `JSON of the Firebase service account credentials`) .action(actionRunner(migrationsGetFirebaseReport)) migrations .command(`create-n-host-migration`) - .description(``) + .description(`Migrate data from an NHost project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from an NHost project. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--subdomain `, `Source's Subdomain`) .requiredOption(`--region `, `Source's Region`) @@ -636,7 +636,7 @@ migrations migrations .command(`get-n-host-report`) - .description(``) + .description(`Generate a detailed report of the data in an NHost project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate.`) .requiredOption(`--subdomain `, `Source's Subdomain.`) .requiredOption(`--region `, `Source's Region.`) @@ -649,7 +649,7 @@ migrations migrations .command(`create-supabase-migration`) - .description(``) + .description(`Migrate data from a Supabase project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from a Supabase project. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint `, `Source's Supabase Endpoint`) .requiredOption(`--api-key `, `Source's API Key`) @@ -661,7 +661,7 @@ migrations migrations .command(`get-supabase-report`) - .description(``) + .description(`Generate a report of the data in a Supabase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. `) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint `, `Source's Supabase Endpoint.`) .requiredOption(`--api-key `, `Source's API Key.`) @@ -673,19 +673,19 @@ migrations migrations .command(`get`) - .description(``) + .description(`Get a migration by its unique ID. This endpoint returns detailed information about a specific migration including its current status, progress, and any errors that occurred during the migration process. `) .requiredOption(`--migration-id `, `Migration unique ID.`) .action(actionRunner(migrationsGet)) migrations .command(`retry`) - .description(``) + .description(`Retry a failed migration. This endpoint allows you to retry a migration that has previously failed.`) .requiredOption(`--migration-id `, `Migration unique ID.`) .action(actionRunner(migrationsRetry)) migrations .command(`delete`) - .description(``) + .description(`Delete a migration by its unique ID. This endpoint allows you to remove a migration from your project's migration history. `) .requiredOption(`--migration-id `, `Migration ID.`) .action(actionRunner(migrationsDelete)) diff --git a/lib/commands/organizations.js b/lib/commands/organizations.js new file mode 100644 index 0000000..a341d31 --- /dev/null +++ b/lib/commands/organizations.js @@ -0,0 +1,48 @@ +const { sdkForProject } = require('../sdks') +const { parse } = require('../parser') +const { showConsoleLink } = require('../utils.js'); + +/** + * @typedef {Object} OrganizationsListRequestParams + * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan + * @property {string} search Search term to filter your list results. Max length: 256 chars. + * @property {boolean} parseOutput + * @property {libClient | undefined} sdk + */ + +/** + * @param {OrganizationsListRequestParams} params + */ +const organizationsList = async ({queries, search, parseOutput = true, sdk = undefined, console}) => { + let client = !sdk ? await sdkForProject() : + sdk; + let apiPath = '/organizations'; + let payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + + let response = undefined; + + response = await client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + + if (parseOutput) { + if(console) { + showConsoleLink('organizations', 'list'); + } else { + parse(response) + } + } + + return response; + +} + +module.exports = { + organizationsList +} \ No newline at end of file diff --git a/lib/commands/project.js b/lib/commands/project.js index 1630ee5..23afbf6 100644 --- a/lib/commands/project.js +++ b/lib/commands/project.js @@ -252,7 +252,7 @@ const projectDeleteVariable = async ({variableId,parseOutput = true, overrideFor project .command(`get-usage`) - .description(``) + .description(`Get comprehensive usage statistics for your project. View metrics including network requests, bandwidth, storage, function executions, database usage, and user activity. Specify a time range with startDate and endDate, and optionally set the data granularity with period (1h or 1d). The response includes both total counts and detailed breakdowns by resource, along with historical data over the specified period.`) .requiredOption(`--start-date `, `Starting date for the usage`) .requiredOption(`--end-date `, `End date for the usage`) .option(`--period `, `Period used`) diff --git a/lib/commands/projects.js b/lib/commands/projects.js index 1ba74f4..9d0e189 100644 --- a/lib/commands/projects.js +++ b/lib/commands/projects.js @@ -1939,7 +1939,7 @@ const projectsUpdateWebhookSignature = async ({projectId,webhookId,parseOutput = projects .command(`list`) - .description(``) + .description(`Get a list of all projects. 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, teamId`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) @@ -1947,7 +1947,7 @@ projects projects .command(`create`) - .description(``) + .description(`Create a new project. You can create a maximum of 100 projects per account. `) .requiredOption(`--project-id `, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars.`) .requiredOption(`--name `, `Project name. Max length: 128 chars.`) .requiredOption(`--team-id `, `Team unique ID.`) @@ -1965,14 +1965,14 @@ projects projects .command(`get`) - .description(``) + .description(`Get a project by its unique ID. This endpoint allows you to retrieve the project's details, including its name, description, team, region, and other metadata. `) .requiredOption(`--project-id `, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsGet)) projects .command(`update`) - .description(``) + .description(`Update a project by its unique ID.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--name `, `Project name. Max length: 128 chars.`) .option(`--description `, `Project description. Max length: 256 chars.`) @@ -1988,13 +1988,13 @@ projects projects .command(`delete`) - .description(``) + .description(`Delete a project by its unique ID.`) .requiredOption(`--project-id `, `Project unique ID.`) .action(actionRunner(projectsDelete)) projects .command(`update-api-status`) - .description(``) + .description(`Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--api `, `API name.`) .requiredOption(`--status `, `API status.`, parseBool) @@ -2002,35 +2002,35 @@ projects projects .command(`update-api-status-all`) - .description(``) + .description(`Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--status `, `API status.`, parseBool) .action(actionRunner(projectsUpdateApiStatusAll)) projects .command(`update-auth-duration`) - .description(``) + .description(`Update how long sessions created within a project should stay active for.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--duration `, `Project session length in seconds. Max length: 31536000 seconds.`, parseInteger) .action(actionRunner(projectsUpdateAuthDuration)) projects .command(`update-auth-limit`) - .description(``) + .description(`Update the maximum number of users allowed in this project. Set to 0 for unlimited users. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--limit `, `Set the max number of users allowed in this project. Use 0 for unlimited.`, parseInteger) .action(actionRunner(projectsUpdateAuthLimit)) projects .command(`update-auth-sessions-limit`) - .description(``) + .description(`Update the maximum number of sessions allowed per user within the project, if the limit is hit the oldest session will be deleted to make room for new sessions.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--limit `, `Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10`, parseInteger) .action(actionRunner(projectsUpdateAuthSessionsLimit)) projects .command(`update-memberships-privacy`) - .description(``) + .description(`Update project membership privacy settings. Use this endpoint to control what user information is visible to other team members, such as user name, email, and MFA status. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--user-name `, `Set to true to show userName to members of a team.`, parseBool) .requiredOption(`--user-email `, `Set to true to show email to members of a team.`, parseBool) @@ -2039,42 +2039,42 @@ projects projects .command(`update-mock-numbers`) - .description(``) + .description(`Update the list of mock phone numbers for testing. Use these numbers to bypass SMS verification in development. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--numbers [numbers...]`, `An array of mock numbers and their corresponding verification codes (OTPs). Each number should be a valid E.164 formatted phone number. Maximum of 10 numbers are allowed.`) .action(actionRunner(projectsUpdateMockNumbers)) projects .command(`update-auth-password-dictionary`) - .description(``) + .description(`Enable or disable checking user passwords against common passwords dictionary. This helps ensure users don't use common and insecure passwords. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--enabled `, `Set whether or not to enable checking user's password against most commonly used passwords. Default is false.`, parseBool) .action(actionRunner(projectsUpdateAuthPasswordDictionary)) projects .command(`update-auth-password-history`) - .description(``) + .description(`Update the authentication password history requirement. Use this endpoint to require new passwords to be different than the last X amount of previously used ones.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--limit `, `Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0`, parseInteger) .action(actionRunner(projectsUpdateAuthPasswordHistory)) projects .command(`update-personal-data-check`) - .description(``) + .description(`Enable or disable checking user passwords against their personal data. This helps prevent users from using personal information in their passwords. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--enabled `, `Set whether or not to check a password for similarity with personal data. Default is false.`, parseBool) .action(actionRunner(projectsUpdatePersonalDataCheck)) projects .command(`update-session-alerts`) - .description(``) + .description(`Enable or disable session email alerts. When enabled, users will receive email notifications when new sessions are created.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--alerts `, `Set to true to enable session emails.`, parseBool) .action(actionRunner(projectsUpdateSessionAlerts)) projects .command(`update-auth-status`) - .description(``) + .description(`Update the status of a specific authentication method. Use this endpoint to enable or disable different authentication methods such as email, magic urls or sms in your project. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--method `, `Auth Method. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone`) .requiredOption(`--status `, `Set the status of this auth method.`, parseBool) @@ -2082,7 +2082,7 @@ projects projects .command(`create-jwt`) - .description(``) + .description(`Create a new JWT token. This token can be used to authenticate users with custom scopes and expiration time. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--scopes [scopes...]`, `List of scopes allowed for JWT key. Maximum of 100 scopes are allowed.`) .option(`--duration `, `Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.`, parseInteger) @@ -2090,14 +2090,14 @@ projects projects .command(`list-keys`) - .description(``) + .description(`Get a list of all API keys from the current project. `) .requiredOption(`--project-id `, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListKeys)) projects .command(`create-key`) - .description(``) + .description(`Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--name `, `Key name. Max length: 128 chars.`) .requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`) @@ -2106,7 +2106,7 @@ projects projects .command(`get-key`) - .description(``) + .description(`Get a key by its unique ID. This endpoint returns details about a specific API key in your project including it's scopes.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--key-id `, `Key unique ID.`) .option(`--console`, `Get the resource console url`) @@ -2114,7 +2114,7 @@ projects projects .command(`update-key`) - .description(``) + .description(`Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--key-id `, `Key unique ID.`) .requiredOption(`--name `, `Key name. Max length: 128 chars.`) @@ -2124,14 +2124,14 @@ projects projects .command(`delete-key`) - .description(``) + .description(`Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--key-id `, `Key unique ID.`) .action(actionRunner(projectsDeleteKey)) projects .command(`update-o-auth-2`) - .description(``) + .description(`Update the OAuth2 provider configurations. Use this endpoint to set up or update the OAuth2 provider credentials or enable/disable providers. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--provider `, `Provider Name`) .option(`--app-id `, `Provider app ID. Max length: 256 chars.`) @@ -2141,14 +2141,14 @@ projects projects .command(`list-platforms`) - .description(``) + .description(`Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. `) .requiredOption(`--project-id `, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListPlatforms)) projects .command(`create-platform`) - .description(``) + .description(`Create a new platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Platform type.`) .requiredOption(`--name `, `Platform name. Max length: 128 chars.`) @@ -2159,7 +2159,7 @@ projects projects .command(`get-platform`) - .description(``) + .description(`Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--platform-id `, `Platform unique ID.`) .option(`--console`, `Get the resource console url`) @@ -2167,7 +2167,7 @@ projects projects .command(`update-platform`) - .description(``) + .description(`Update a platform by its unique ID. Use this endpoint to update the platform's name, key, platform store ID, or hostname. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--platform-id `, `Platform unique ID.`) .requiredOption(`--name `, `Platform name. Max length: 128 chars.`) @@ -2178,14 +2178,14 @@ projects projects .command(`delete-platform`) - .description(``) + .description(`Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--platform-id `, `Platform unique ID.`) .action(actionRunner(projectsDeletePlatform)) projects .command(`update-service-status`) - .description(``) + .description(`Update the status of a specific service. Use this endpoint to enable or disable a service in your project. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--service `, `Service name.`) .requiredOption(`--status `, `Service status.`, parseBool) @@ -2193,14 +2193,14 @@ projects projects .command(`update-service-status-all`) - .description(``) + .description(`Update the status of all services. Use this endpoint to enable or disable all optional services at once. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--status `, `Service status.`, parseBool) .action(actionRunner(projectsUpdateServiceStatusAll)) projects .command(`update-smtp`) - .description(``) + .description(`Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--enabled `, `Enable custom SMTP service`, parseBool) .option(`--sender-name `, `Name of the email sender`) @@ -2215,7 +2215,7 @@ projects projects .command(`create-smtp-test`) - .description(``) + .description(`Send a test email to verify SMTP configuration. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--emails [emails...]`, `Array of emails to send test email to. Maximum of 10 emails are allowed.`) .requiredOption(`--sender-name `, `Name of the email sender`) @@ -2230,14 +2230,14 @@ projects projects .command(`update-team`) - .description(``) + .description(`Update the team ID of a project allowing for it to be transferred to another team.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--team-id `, `Team ID of the team to transfer project to.`) .action(actionRunner(projectsUpdateTeam)) projects .command(`get-email-template`) - .description(``) + .description(`Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2245,7 +2245,7 @@ projects projects .command(`update-email-template`) - .description(``) + .description(`Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2258,7 +2258,7 @@ projects projects .command(`delete-email-template`) - .description(``) + .description(`Reset a custom email template to its default value. This endpoint removes any custom content and restores the template to its original state. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2266,7 +2266,7 @@ projects projects .command(`get-sms-template`) - .description(``) + .description(`Get a custom SMS template for the specified locale and type returning it's contents.`) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2274,7 +2274,7 @@ projects projects .command(`update-sms-template`) - .description(``) + .description(`Update a custom SMS template for the specified locale and type. Use this endpoint to modify the content of your SMS templates. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2283,7 +2283,7 @@ projects projects .command(`delete-sms-template`) - .description(``) + .description(`Reset a custom SMS template to its default value. This endpoint removes any custom message and restores the template to its original state. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--type `, `Template type`) .requiredOption(`--locale `, `Template locale`) @@ -2291,14 +2291,14 @@ projects projects .command(`list-webhooks`) - .description(``) + .description(`Get a list of all webhooks belonging to the project. You can use the query params to filter your results. `) .requiredOption(`--project-id `, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListWebhooks)) projects .command(`create-webhook`) - .description(``) + .description(`Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--name `, `Webhook name. Max length: 128 chars.`) .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) @@ -2311,7 +2311,7 @@ projects projects .command(`get-webhook`) - .description(``) + .description(`Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--webhook-id `, `Webhook unique ID.`) .option(`--console`, `Get the resource console url`) @@ -2319,7 +2319,7 @@ projects projects .command(`update-webhook`) - .description(``) + .description(`Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--webhook-id `, `Webhook unique ID.`) .requiredOption(`--name `, `Webhook name. Max length: 128 chars.`) @@ -2333,14 +2333,14 @@ projects projects .command(`delete-webhook`) - .description(``) + .description(`Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--webhook-id `, `Webhook unique ID.`) .action(actionRunner(projectsDeleteWebhook)) projects .command(`update-webhook-signature`) - .description(``) + .description(`Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. `) .requiredOption(`--project-id `, `Project unique ID.`) .requiredOption(`--webhook-id `, `Webhook unique ID.`) .action(actionRunner(projectsUpdateWebhookSignature)) diff --git a/lib/commands/proxy.js b/lib/commands/proxy.js index beffbda..55aac5f 100644 --- a/lib/commands/proxy.js +++ b/lib/commands/proxy.js @@ -241,7 +241,7 @@ proxy proxy .command(`update-rule-verification`) - .description(``) + .description(`Retry getting verification process of a proxy rule. This endpoint triggers domain verification by checking DNS records (CNAME) against the configured target domain. If verification is successful, a TLS certificate will be automatically provisioned for the domain.`) .requiredOption(`--rule-id `, `Rule ID.`) .action(actionRunner(proxyUpdateRuleVerification)) diff --git a/lib/commands/storage.js b/lib/commands/storage.js index 16c2f74..a436781 100644 --- a/lib/commands/storage.js +++ b/lib/commands/storage.js @@ -952,13 +952,13 @@ storage storage .command(`get-usage`) - .description(``) + .description(`Get usage metrics and statistics for all buckets in the project. You can view the total number of buckets, files, 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(storageGetUsage)) storage .command(`get-bucket-usage`) - .description(``) + .description(`Get usage metrics and statistics a specific bucket in the project. You can view the total number of files, 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(`--bucket-id `, `Bucket ID.`) .option(`--range `, `Date range.`) .option(`--console`, `Get the resource console url`) diff --git a/lib/commands/users.js b/lib/commands/users.js index 1de7a59..fff1cb6 100644 --- a/lib/commands/users.js +++ b/lib/commands/users.js @@ -1768,7 +1768,7 @@ users users .command(`get-usage`) - .description(``) + .description(`Get usage metrics and statistics for all users in the project. You can view the total number of users and sessions. 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(usersGetUsage)) diff --git a/lib/commands/vcs.js b/lib/commands/vcs.js index a903cae..98428c2 100644 --- a/lib/commands/vcs.js +++ b/lib/commands/vcs.js @@ -387,14 +387,14 @@ const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrid vcs .command(`list-repositories`) - .description(``) + .description(`Get a list of GitHub repositories available through your installation. This endpoint returns repositories with their basic information, detected runtime environments, and latest push dates. You can optionally filter repositories using a search term. Each repository's runtime is automatically detected based on its contents and language statistics. The GitHub installation must be properly configured for this endpoint to work.`) .requiredOption(`--installation-id `, `Installation Id`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(vcsListRepositories)) vcs .command(`create-repository`) - .description(``) + .description(`Create a new GitHub repository through your installation. This endpoint allows you to create either a public or private repository by specifying a name and visibility setting. The repository will be created under your GitHub user account or organization, depending on your installation type. The GitHub installation must be properly configured and have the necessary permissions for repository creation.`) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--name `, `Repository name (slug)`) .requiredOption(`--xprivate `, `Mark repository public or private`, parseBool) @@ -402,21 +402,21 @@ vcs vcs .command(`get-repository`) - .description(``) + .description(`Get detailed information about a specific GitHub repository from your installation. This endpoint returns repository details including its ID, name, visibility status, organization, and latest push date. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work.`) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--provider-repository-id `, `Repository Id`) .action(actionRunner(vcsGetRepository)) vcs .command(`list-repository-branches`) - .description(``) + .description(`Get a list of all branches from a GitHub repository in your installation. This endpoint returns the names of all branches in the repository and their total count. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work. `) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--provider-repository-id `, `Repository Id`) .action(actionRunner(vcsListRepositoryBranches)) vcs .command(`get-repository-contents`) - .description(``) + .description(`Get a list of files and directories from a GitHub repository connected to your project. This endpoint returns the contents of a specified repository path, including file names, sizes, and whether each item is a file or directory. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work. `) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--provider-repository-id `, `Repository Id`) .option(`--provider-root-directory `, `Path to get contents of nested directory`) @@ -424,7 +424,7 @@ vcs vcs .command(`create-repository-detection`) - .description(``) + .description(`Analyze a GitHub repository to automatically detect the programming language and runtime environment. This endpoint scans the repository's files and language statistics to determine the appropriate runtime settings for your function. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work.`) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--provider-repository-id `, `Repository Id`) .option(`--provider-root-directory `, `Path to Root Directory`) @@ -432,7 +432,7 @@ vcs vcs .command(`update-external-deployments`) - .description(``) + .description(`Authorize and create deployments for a GitHub pull request in your project. This endpoint allows external contributions by creating deployments from pull requests, enabling preview environments for code review. The pull request must be open and not previously authorized. The GitHub installation must be properly configured and have access to both the repository and pull request for this endpoint to work.`) .requiredOption(`--installation-id `, `Installation Id`) .requiredOption(`--repository-id `, `VCS Repository Id`) .requiredOption(`--provider-pull-request-id `, `GitHub Pull Request Id`) @@ -440,20 +440,20 @@ vcs vcs .command(`list-installations`) - .description(``) + .description(`List all VCS installations configured for the current project. This endpoint returns a list of installations including their provider, organization, and other configuration details. `) .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: provider, organization`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(vcsListInstallations)) vcs .command(`get-installation`) - .description(``) + .description(`Get a VCS installation by its unique ID. This endpoint returns the installation's details including its provider, organization, and configuration. `) .requiredOption(`--installation-id `, `Installation Id`) .action(actionRunner(vcsGetInstallation)) vcs .command(`delete-installation`) - .description(``) + .description(`Delete a VCS installation by its unique ID. This endpoint removes the installation and all its associated repositories from the project.`) .requiredOption(`--installation-id `, `Installation Id`) .action(actionRunner(vcsDeleteInstallation)) diff --git a/lib/parser.js b/lib/parser.js index 1f48a07..48ea07b 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -120,7 +120,7 @@ const parseError = (err) => { } catch { } - const version = '6.2.0'; + const version = '6.2.1'; const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``; const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`; diff --git a/lib/questions.js b/lib/questions.js index 5d7c471..22bfa95 100644 --- a/lib/questions.js +++ b/lib/questions.js @@ -2,6 +2,7 @@ const chalk = require("chalk"); const Client = require("./client"); const { localConfig, globalConfig } = require('./config'); const { projectsList } = require('./commands/projects'); +const { organizationsList } = require('./commands/organizations'); const { teamsList } = require('./commands/teams'); const { functionsListRuntimes, functionsListSpecifications, functionsList } = require('./commands/functions'); const { accountListMfaFactors } = require("./commands/account"); @@ -152,7 +153,10 @@ const questionsInitProject = [ message: "Choose your organization", choices: async () => { let client = await sdkForConsole(true); - const { teams } = await paginate(teamsList, { parseOutput: false, sdk: client }, 100, 'teams'); + const hostname = new URL(client.endpoint).hostname; + const { teams } = hostname.endsWith('appwrite.io') + ? await paginate(organizationsList, { parseOutput: false, sdk: client }, 100, 'teams') + : await paginate(teamsList, { parseOutput: false, sdk: client }, 100, 'teams'); let choices = teams.map((team, idx) => { return { diff --git a/lib/utils.js b/lib/utils.js index a2cf3e3..37172e0 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -89,6 +89,9 @@ function showConsoleLink(serviceName, action, ...ids) { case "teams": url.pathname += getTeamsPath(action, ids); break; + case "organizations": + url.pathname += getOrganizationsPath(action, ids); + break; case "users": url.pathname += getUsersPath(action, ids); break; @@ -241,6 +244,16 @@ function getTeamsPath(action, ids) { return path; } +function getOrganizationsPath(action, ids) { + let path = `/organization-${ids[0]}`; + + if (action === 'list') { + path = '/account/organizations'; + } + + return path; +} + function getUsersPath(action, ids) { let path = '/auth'; diff --git a/package.json b/package.json index 71227d6..5056471 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appwrite-cli", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "6.2.0", + "version": "6.2.1", "license": "BSD-3-Clause", "main": "index.js", "bin": { diff --git a/scoop/appwrite.json b/scoop/appwrite.json index 1d2b330..cdae220 100644 --- a/scoop/appwrite.json +++ b/scoop/appwrite.json @@ -1,12 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json", - "version": "6.2.0", + "version": "6.2.1", "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/6.2.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.1/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/6.2.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.1/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",