From cd409258e04423fc6d0b00e824a8cabb6b8ae26e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Mar 2026 16:37:20 +0000 Subject: [PATCH 1/3] feat: update Command Line SDK to 15.2.0 * Added `webhooks` CLI commands: `list`, `create`, `get`, `update`, `delete`, `update-signature` * Updated docs with webhooks usage examples --- CHANGELOG.md | 5 + README.md | 4 +- cli.ts | 2 + docs/examples/webhooks/create.md | 7 + docs/examples/webhooks/delete.md | 4 + docs/examples/webhooks/get.md | 4 + docs/examples/webhooks/list.md | 3 + docs/examples/webhooks/update-signature.md | 4 + docs/examples/webhooks/update.md | 7 + install.ps1 | 4 +- install.sh | 2 +- .../generators/typescript/databases.ts | 42 +++++- lib/commands/pull.ts | 42 ++++-- lib/commands/services/webhooks.ts | 134 ++++++++++++++++++ lib/commands/utils/deployment.ts | 5 +- lib/constants.ts | 2 +- package.json | 2 +- scoop/appwrite.config.json | 6 +- 18 files changed, 250 insertions(+), 29 deletions(-) create mode 100644 docs/examples/webhooks/create.md create mode 100644 docs/examples/webhooks/delete.md create mode 100644 docs/examples/webhooks/get.md create mode 100644 docs/examples/webhooks/list.md create mode 100644 docs/examples/webhooks/update-signature.md create mode 100644 docs/examples/webhooks/update.md create mode 100644 lib/commands/services/webhooks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 17879cdc..8f171c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 15.2.0 + +* Added `webhooks` CLI commands: `list`, `create`, `get`, `update`, `delete`, `update-signature` +* Updated docs with webhooks usage examples + ## 15.1.0 * Added `resolveFileParam` to convert file or directory paths into `File` objects and tar.gz packages diff --git a/README.md b/README.md index bff77584..7b1551d5 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 -15.1.0 +15.2.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 -15.1.0 +15.2.0 ``` ## Getting Started diff --git a/cli.ts b/cli.ts index 9f0f803d..204b74d4 100644 --- a/cli.ts +++ b/cli.ts @@ -44,6 +44,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 { webhooks } from './lib/commands/services/webhooks.js'; const { version } = packageJson; inquirer.registerPrompt('search-list', inquirerSearchList); @@ -154,6 +155,7 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) { .addCommand(tokens) .addCommand(users) .addCommand(vcs) + .addCommand(webhooks) .addCommand(client) .parse(process.argv); diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md new file mode 100644 index 00000000..c0bf0356 --- /dev/null +++ b/docs/examples/webhooks/create.md @@ -0,0 +1,7 @@ +```bash +appwrite webhooks create \ + --webhook-id \ + --url '' \ + --name \ + --events one two three +``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md new file mode 100644 index 00000000..a9fc7a18 --- /dev/null +++ b/docs/examples/webhooks/delete.md @@ -0,0 +1,4 @@ +```bash +appwrite webhooks delete \ + --webhook-id +``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md new file mode 100644 index 00000000..3307149a --- /dev/null +++ b/docs/examples/webhooks/get.md @@ -0,0 +1,4 @@ +```bash +appwrite webhooks get \ + --webhook-id +``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md new file mode 100644 index 00000000..50e57740 --- /dev/null +++ b/docs/examples/webhooks/list.md @@ -0,0 +1,3 @@ +```bash +appwrite webhooks list +``` diff --git a/docs/examples/webhooks/update-signature.md b/docs/examples/webhooks/update-signature.md new file mode 100644 index 00000000..0636d557 --- /dev/null +++ b/docs/examples/webhooks/update-signature.md @@ -0,0 +1,4 @@ +```bash +appwrite webhooks update-signature \ + --webhook-id +``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md new file mode 100644 index 00000000..27a2ee4e --- /dev/null +++ b/docs/examples/webhooks/update.md @@ -0,0 +1,7 @@ +```bash +appwrite webhooks update \ + --webhook-id \ + --name \ + --url '' \ + --events one two three +``` diff --git a/install.ps1 b/install.ps1 index 527a8c15..e29ef459 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/15.1.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.2.0/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.2.0/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 61ab4b09..9cba8c80 100644 --- a/install.sh +++ b/install.sh @@ -96,7 +96,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="15.1.0" + GITHUB_LATEST_VERSION="15.2.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/generators/typescript/databases.ts b/lib/commands/generators/typescript/databases.ts index 75803217..951cc8ce 100644 --- a/lib/commands/generators/typescript/databases.ts +++ b/lib/commands/generators/typescript/databases.ts @@ -425,6 +425,18 @@ ${ }); } + /** + * Deduplicate entities by composite key ($id + databaseId). + * Keeps the last occurrence to match addTable/addCollection semantics. + */ + private dedupeEntities(entities: T[]): T[] { + const seen = new Map(); + for (const entity of entities) { + seen.set(`${entity.databaseId}:${entity.$id}`, entity); + } + return Array.from(seen.values()); + } + async generate( config: ConfigType, options?: GenerateOptions, @@ -437,9 +449,20 @@ ${ options?.appwriteImportSource ?? getAppwriteDependency(); const importExt = options?.importExtension ?? detectImportExtension(); + // Deduplicate entities to guard against corrupted configs + const dedupedConfig = { ...config }; + if (dedupedConfig.tables && dedupedConfig.tables.length > 0) { + dedupedConfig.tables = this.dedupeEntities(dedupedConfig.tables); + } + if (dedupedConfig.collections && dedupedConfig.collections.length > 0) { + dedupedConfig.collections = this.dedupeEntities( + dedupedConfig.collections, + ); + } + const hasEntities = - (config.tables && config.tables.length > 0) || - (config.collections && config.collections.length > 0); + (dedupedConfig.tables && dedupedConfig.tables.length > 0) || + (dedupedConfig.collections && dedupedConfig.collections.length > 0); if (!hasEntities) { console.log( @@ -449,15 +472,22 @@ ${ dbContent: "// No tables or collections found in configuration\n", typesContent: "// No tables or collections found in configuration\n", indexContent: this.generateIndexFile(importExt), - constantsContent: this.generateConstantsFile(config, appwriteDep), + constantsContent: this.generateConstantsFile( + dedupedConfig, + appwriteDep, + ), }; } return { - dbContent: this.generateDatabasesFile(config, importExt, appwriteDep), - typesContent: this.generateTypesFile(config, appwriteDep), + dbContent: this.generateDatabasesFile( + dedupedConfig, + importExt, + appwriteDep, + ), + typesContent: this.generateTypesFile(dedupedConfig, appwriteDep), indexContent: this.generateIndexFile(importExt), - constantsContent: this.generateConstantsFile(config, appwriteDep), + constantsContent: this.generateConstantsFile(dedupedConfig, appwriteDep), }; } } diff --git a/lib/commands/pull.ts b/lib/commands/pull.ts index 68031966..c78b35bd 100644 --- a/lib/commands/pull.ts +++ b/lib/commands/pull.ts @@ -266,7 +266,8 @@ export class Pull { } const { functions: allFunctions } = await paginate( - async () => new Functions(this.projectClient).list(), + async (args) => + new Functions(this.projectClient).list(args.queries as string[]), {}, 100, "functions", @@ -366,7 +367,8 @@ export class Pull { } const { sites: fetchedSites } = await paginate( - async () => new Sites(this.projectClient).list(), + async (args) => + new Sites(this.projectClient).list(args.queries as string[]), {}, 100, "sites", @@ -463,7 +465,8 @@ export class Pull { } const { databases } = await paginate( - async () => new Databases(this.projectClient).list(), + async (args) => + new Databases(this.projectClient).list(args.queries as string[]), {}, 100, "databases", @@ -479,8 +482,11 @@ export class Pull { allDatabases.push(database); const { collections } = await paginate( - async () => - new Databases(this.projectClient).listCollections(database.$id), + async (args) => + new Databases(this.projectClient).listCollections( + database.$id, + args.queries as string[], + ), {}, 100, "collections", @@ -529,7 +535,10 @@ export class Pull { } const { databases } = await paginate( - async () => new TablesDB(this.projectClient).list(), + async (args) => + new TablesDB(this.projectClient).list({ + queries: args.queries as string[], + }), {}, 100, "databases", @@ -545,7 +554,11 @@ export class Pull { allDatabases.push(filterBySchema(database, DatabaseSchema)); const { tables } = await paginate( - async () => new TablesDB(this.projectClient).listTables(database.$id), + async (args) => + new TablesDB(this.projectClient).listTables({ + databaseId: database.$id, + queries: args.queries as string[], + }), {}, 100, "tables", @@ -599,7 +612,8 @@ export class Pull { } const { buckets } = await paginate( - async () => new Storage(this.projectClient).listBuckets(), + async (args) => + new Storage(this.projectClient).listBuckets(args.queries as string[]), {}, 100, "buckets", @@ -638,7 +652,8 @@ export class Pull { } const { teams } = await paginate( - async () => new Teams(this.projectClient).list(), + async (args) => + new Teams(this.projectClient).list(args.queries as string[]), {}, 100, "teams", @@ -672,7 +687,8 @@ export class Pull { } const { topics } = await paginate( - async () => new Messaging(this.projectClient).listTopics(), + async (args) => + new Messaging(this.projectClient).listTopics(args.queries as string[]), {}, 100, "topics", @@ -763,7 +779,8 @@ const pullFunctions = async ({ const functionsToCheck = cliConfig.all ? ( await paginate( - async () => (await getFunctionsService()).list(), + async (args) => + (await getFunctionsService()).list(args.queries as string[]), {}, 100, "functions", @@ -811,7 +828,8 @@ const pullSites = async ({ const sitesToCheck = cliConfig.all ? ( await paginate( - async () => (await getSitesService()).list(), + async (args) => + (await getSitesService()).list(args.queries as string[]), {}, 100, "sites", diff --git a/lib/commands/services/webhooks.ts b/lib/commands/services/webhooks.ts new file mode 100644 index 00000000..a612c5c8 --- /dev/null +++ b/lib/commands/services/webhooks.ts @@ -0,0 +1,134 @@ +import { Command } from "commander"; +import { sdkForProject } from "../../sdks.js"; +import { + actionRunner, + commandDescriptions, + success, + parse, + parseBool, + parseInteger, +} from "../../parser.js"; +import { Webhooks } from "@appwrite.io/console"; + +let webhooksClient: Webhooks | null = null; + +const getWebhooksClient = async (): Promise => { + if (!webhooksClient) { + const sdkClient = await sdkForProject(); + webhooksClient = new Webhooks(sdkClient); + } + return webhooksClient; +}; + +export const webhooks = new Command("webhooks") + .description(commandDescriptions["webhooks"] ?? "") + .configureHelp({ + helpWidth: process.stdout.columns || 80, + }); + +webhooks + .command(`list`) + .description(`Get a list of all webhooks belonging to the project. 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, url, httpUser, security, events, enabled, logs, attempts`) + .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, total }) => + parse(await (await getWebhooksClient()).list(queries, total)), + ), + ); + +webhooks + .command(`create`) + .description(`Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.`) + .requiredOption(`--webhook-id `, `Webhook 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(`--url `, `Webhook URL.`) + .requiredOption(`--name `, `Webhook name. Max length: 128 chars.`) + .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) + .option( + `--enabled [value]`, + `Enable or disable a webhook.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--security [value]`, + `Certificate verification, false for disabled or true for enabled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option(`--http-user `, `Webhook HTTP user. Max length: 256 chars.`) + .option(`--http-pass `, `Webhook HTTP password. Max length: 256 chars.`) + .action( + actionRunner( + async ({ webhookId, url, name, events, enabled, security, httpUser, httpPass }) => + parse(await (await getWebhooksClient()).create(webhookId, url, name, events, enabled, security, httpUser, httpPass)), + ), + ); + +webhooks + .command(`get`) + .description(`Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. `) + .requiredOption(`--webhook-id `, `Webhook ID.`) + .action( + actionRunner( + async ({ webhookId }) => + parse(await (await getWebhooksClient()).get(webhookId)), + ), + ); + +webhooks + .command(`update`) + .description(`Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.`) + .requiredOption(`--webhook-id `, `Webhook ID.`) + .requiredOption(`--name `, `Webhook name. Max length: 128 chars.`) + .requiredOption(`--url `, `Webhook URL.`) + .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) + .option( + `--enabled [value]`, + `Enable or disable a webhook.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option( + `--security [value]`, + `Certificate verification, false for disabled or true for enabled.`, + (value: string | undefined) => + value === undefined ? true : parseBool(value), + ) + .option(`--http-user `, `Webhook HTTP user. Max length: 256 chars.`) + .option(`--http-pass `, `Webhook HTTP password. Max length: 256 chars.`) + .action( + actionRunner( + async ({ webhookId, name, url, events, enabled, security, httpUser, httpPass }) => + parse(await (await getWebhooksClient()).update(webhookId, name, url, events, enabled, security, httpUser, httpPass)), + ), + ); + +webhooks + .command(`delete`) + .description(`Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. `) + .requiredOption(`--webhook-id `, `Webhook ID.`) + .action( + actionRunner( + async ({ webhookId }) => + parse(await (await getWebhooksClient()).delete(webhookId)), + ), + ); + +webhooks + .command(`update-signature`) + .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(`--webhook-id `, `Webhook ID.`) + .action( + actionRunner( + async ({ webhookId }) => + parse(await (await getWebhooksClient()).updateSignature(webhookId)), + ), + ); + diff --git a/lib/commands/utils/deployment.ts b/lib/commands/utils/deployment.ts index 4c8e2130..b5fa701a 100644 --- a/lib/commands/utils/deployment.ts +++ b/lib/commands/utils/deployment.ts @@ -24,7 +24,10 @@ interface DeploymentDetails { * Package a directory into a tar.gz File object for deployment */ async function packageDirectory(dirPath: string): Promise { - const tempFile = path.join(os.tmpdir(), `appwrite-deploy-${Date.now()}.tar.gz`); + const tempFile = path.join( + os.tmpdir(), + `appwrite-deploy-${Date.now()}.tar.gz`, + ); await create( { diff --git a/lib/constants.ts b/lib/constants.ts index 42c1d90b..2830a2d3 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 = '15.1.0'; +export const SDK_VERSION = '15.2.0'; export const SDK_NAME = 'Command Line'; export const SDK_PLATFORM = 'console'; export const SDK_LANGUAGE = 'cli'; diff --git a/package.json b/package.json index 4e67ec0a..2d15301b 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": "15.1.0", + "version": "15.2.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 e9eb2a5b..a3a699c4 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": "15.1.0", + "version": "15.2.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/15.1.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.2.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/15.1.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.2.0/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe", From 9dc8d2787c04eebe382c5c278751260d83dc7768 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Mar 2026 02:31:09 +0000 Subject: [PATCH 2/3] chore: update Command Line SDK to 15.1.0 --- CHANGELOG.md | 5 - README.md | 6 +- docs/examples/projects/create-webhook.md | 8 -- docs/examples/projects/delete-webhook.md | 5 - docs/examples/projects/get-webhook.md | 5 - docs/examples/projects/list-webhooks.md | 4 - .../projects/update-webhook-signature.md | 5 - docs/examples/projects/update-webhook.md | 9 -- install.ps1 | 4 +- install.sh | 2 +- lib/commands/services/projects.ts | 100 ------------------ lib/constants.ts | 2 +- lib/parser.ts | 1 + package.json | 2 +- scoop/appwrite.config.json | 6 +- 15 files changed, 12 insertions(+), 152 deletions(-) delete mode 100644 docs/examples/projects/create-webhook.md delete mode 100644 docs/examples/projects/delete-webhook.md delete mode 100644 docs/examples/projects/get-webhook.md delete mode 100644 docs/examples/projects/list-webhooks.md delete mode 100644 docs/examples/projects/update-webhook-signature.md delete mode 100644 docs/examples/projects/update-webhook.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f171c9d..17879cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,5 @@ # Change Log -## 15.2.0 - -* Added `webhooks` CLI commands: `list`, `create`, `get`, `update`, `delete`, `update-signature` -* Updated docs with webhooks usage examples - ## 15.1.0 * Added `resolveFileParam` to convert file or directory paths into `File` objects and tar.gz packages diff --git a/README.md b/README.md index 7b1551d5..a1a1b94e 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.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.2-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 -15.2.0 +15.1.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 -15.2.0 +15.1.0 ``` ## Getting Started diff --git a/docs/examples/projects/create-webhook.md b/docs/examples/projects/create-webhook.md deleted file mode 100644 index 1a3c7663..00000000 --- a/docs/examples/projects/create-webhook.md +++ /dev/null @@ -1,8 +0,0 @@ -```bash -appwrite projects create-webhook \ - --project-id \ - --name \ - --events one two three \ - --url '' \ - --security false -``` diff --git a/docs/examples/projects/delete-webhook.md b/docs/examples/projects/delete-webhook.md deleted file mode 100644 index e0e1a99a..00000000 --- a/docs/examples/projects/delete-webhook.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite projects delete-webhook \ - --project-id \ - --webhook-id -``` diff --git a/docs/examples/projects/get-webhook.md b/docs/examples/projects/get-webhook.md deleted file mode 100644 index 7d2374bd..00000000 --- a/docs/examples/projects/get-webhook.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite projects get-webhook \ - --project-id \ - --webhook-id -``` diff --git a/docs/examples/projects/list-webhooks.md b/docs/examples/projects/list-webhooks.md deleted file mode 100644 index 64307b4d..00000000 --- a/docs/examples/projects/list-webhooks.md +++ /dev/null @@ -1,4 +0,0 @@ -```bash -appwrite projects list-webhooks \ - --project-id -``` diff --git a/docs/examples/projects/update-webhook-signature.md b/docs/examples/projects/update-webhook-signature.md deleted file mode 100644 index 18878592..00000000 --- a/docs/examples/projects/update-webhook-signature.md +++ /dev/null @@ -1,5 +0,0 @@ -```bash -appwrite projects update-webhook-signature \ - --project-id \ - --webhook-id -``` diff --git a/docs/examples/projects/update-webhook.md b/docs/examples/projects/update-webhook.md deleted file mode 100644 index f72d39d4..00000000 --- a/docs/examples/projects/update-webhook.md +++ /dev/null @@ -1,9 +0,0 @@ -```bash -appwrite projects update-webhook \ - --project-id \ - --webhook-id \ - --name \ - --events one two three \ - --url '' \ - --security false -``` diff --git a/install.ps1 b/install.ps1 index e29ef459..527a8c15 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/15.2.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.2.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.0/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.0/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 9cba8c80..61ab4b09 100644 --- a/install.sh +++ b/install.sh @@ -96,7 +96,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="15.2.0" + GITHUB_LATEST_VERSION="15.1.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/services/projects.ts b/lib/commands/services/projects.ts index 3c4e0aca..85e9327b 100644 --- a/lib/commands/services/projects.ts +++ b/lib/commands/services/projects.ts @@ -760,103 +760,3 @@ projects ), ); -projects - .command(`list-webhooks`) - .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( - `--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 ({ projectId, total }) => - parse(await (await getProjectsClient()).listWebhooks(projectId, total)), - ), - ); - -projects - .command(`create-webhook`) - .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.`) - .requiredOption(`--url `, `Webhook URL.`) - .requiredOption(`--security `, `Certificate verification, false for disabled or true for enabled.`, parseBool) - .option( - `--enabled [value]`, - `Enable or disable a webhook.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option(`--http-user `, `Webhook HTTP user. Max length: 256 chars.`) - .option(`--http-pass `, `Webhook HTTP password. Max length: 256 chars.`) - .action( - actionRunner( - async ({ projectId, name, events, url, security, enabled, httpUser, httpPass }) => - parse(await (await getProjectsClient()).createWebhook(projectId, name, events, url, security, enabled, httpUser, httpPass)), - ), - ); - -projects - .command(`get-webhook`) - .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.`) - .action( - actionRunner( - async ({ projectId, webhookId }) => - parse(await (await getProjectsClient()).getWebhook(projectId, webhookId)), - ), - ); - -projects - .command(`update-webhook`) - .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.`) - .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) - .requiredOption(`--url `, `Webhook URL.`) - .requiredOption(`--security `, `Certificate verification, false for disabled or true for enabled.`, parseBool) - .option( - `--enabled [value]`, - `Enable or disable a webhook.`, - (value: string | undefined) => - value === undefined ? true : parseBool(value), - ) - .option(`--http-user `, `Webhook HTTP user. Max length: 256 chars.`) - .option(`--http-pass `, `Webhook HTTP password. Max length: 256 chars.`) - .action( - actionRunner( - async ({ projectId, webhookId, name, events, url, security, enabled, httpUser, httpPass }) => - parse(await (await getProjectsClient()).updateWebhook(projectId, webhookId, name, events, url, security, enabled, httpUser, httpPass)), - ), - ); - -projects - .command(`delete-webhook`) - .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( - async ({ projectId, webhookId }) => - parse(await (await getProjectsClient()).deleteWebhook(projectId, webhookId)), - ), - ); - -projects - .command(`update-webhook-signature`) - .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( - async ({ projectId, webhookId }) => - parse(await (await getProjectsClient()).updateWebhookSignature(projectId, webhookId)), - ), - ); - diff --git a/lib/constants.ts b/lib/constants.ts index 2830a2d3..42c1d90b 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 = '15.2.0'; +export const SDK_VERSION = '15.1.0'; export const SDK_NAME = 'Command Line'; export const SDK_PLATFORM = 'console'; export const SDK_LANGUAGE = 'cli'; diff --git a/lib/parser.ts b/lib/parser.ts index 549124dd..2aebe6ef 100644 --- a/lib/parser.ts +++ b/lib/parser.ts @@ -305,6 +305,7 @@ export const commandDescriptions: Record = { messaging: `The messaging command allows you to manage topics and targets and send messages.`, migrations: `The migrations command allows you to migrate data between services.`, vcs: `The vcs command allows you to interact with VCS providers and manage your code repositories.`, + webhooks: `The webhooks command allows you to manage your project webhooks.`, main: chalk.redBright(`${logo}${description}`), }; diff --git a/package.json b/package.json index 2d15301b..4e67ec0a 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": "15.2.0", + "version": "15.1.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 a3a699c4..e9eb2a5b 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": "15.2.0", + "version": "15.1.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/15.2.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.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/15.2.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.0/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe", From 6195b8cb0da42eb4b52d57ed2452b231618c509e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Mar 2026 05:23:22 +0000 Subject: [PATCH 3/3] feat: update Command Line SDK to 16.0.0 * Breaking: Moved webhook commands from `projects` to new `webhooks` service. --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- install.ps1 | 4 ++-- install.sh | 2 +- lib/constants.ts | 2 +- package.json | 4 ++-- scoop/appwrite.config.json | 6 +++--- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17879cdc..36e4fc3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 16.0.0 + +* Breaking: Moved webhook commands from `projects` to new `webhooks` service. + ## 15.1.0 * Added `resolveFileParam` to convert file or directory paths into `File` objects and tar.gz packages diff --git a/README.md b/README.md index a1a1b94e..8ab0f246 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 -15.1.0 +16.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 -15.1.0 +16.0.0 ``` ## Getting Started diff --git a/install.ps1 b/install.ps1 index 527a8c15..1febbb27 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/15.1.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/15.1.0/appwrite-cli-win-arm64.exe" +$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" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 61ab4b09..4556948b 100644 --- a/install.sh +++ b/install.sh @@ -96,7 +96,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="15.1.0" + GITHUB_LATEST_VERSION="16.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/constants.ts b/lib/constants.ts index 42c1d90b..570abfd7 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 = '15.1.0'; +export const SDK_VERSION = '16.0.0'; export const SDK_NAME = 'Command Line'; export const SDK_PLATFORM = 'console'; export const SDK_LANGUAGE = 'cli'; diff --git a/package.json b/package.json index 4e67ec0a..e7cead39 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": "15.1.0", + "version": "16.0.0", "license": "BSD-3-Clause", "main": "dist/index.cjs", "module": "dist/index.js", @@ -47,7 +47,7 @@ "windows-arm64": "esbuild cli.ts --bundle --loader:.hbs=text --platform=node --target=node18 --format=esm --external:fsevents --outfile=dist/bundle-win-arm64.mjs && pkg dist/bundle-win-arm64.mjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe" }, "dependencies": { - "@appwrite.io/console": "^5.0.0", + "@appwrite.io/console": "*", "chalk": "4.1.2", "chokidar": "^3.6.0", "cli-progress": "^3.12.0", diff --git a/scoop/appwrite.config.json b/scoop/appwrite.config.json index e9eb2a5b..b48b95bb 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": "15.1.0", + "version": "16.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/15.1.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.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/15.1.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",