From 35873e59fbcf7fc33825be1abf5819b164d83353 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 13 Aug 2026 16:18:14 +0100 Subject: [PATCH] Remove dead code found by static analysis Adds shipmonk/dead-code-detector as a PHPStan extension behind `composer dead-code`, and removes what it found. Every candidate was cross-checked against appwrite/cloud, which consumes this repository as appwrite/server-ce. Symbols that repository still references are listed in phpstan-deadcode.neon with the reason, alongside abstract declarations with live implementations and one method called from a .phtml view, so the check runs green and records the cross-check. Removed: - Appwrite\Event\{Audit,Execution,Func,Migration,Screenshot,StatsResources} and Appwrite\Event\Delete -- superseded by Appwrite\Event\Publisher\* - Appwrite\Functions\Validator\Payload - 159 unused methods and constants across 61 files - utopia-php/analytics and utopia-php/preloader, referenced nowhere Executor\Exception\Timeout kept its timeout only to feed the getter that went away, so the value moved into the exception message. league/csv stays: appwrite/cloud uses it without declaring it, so it has to be added there first. appwrite/cloud also has a stale `use Appwrite\Event\Delete;` in app/controllers/general.php to drop. Co-Authored-By: Claude Opus 5 (1M context) --- .gitignore | 1 + composer.json | 6 +- composer.lock | 178 ++++++-------- phpstan-deadcode.neon | 86 +++++++ src/Appwrite/Auth/MFA/Type.php | 10 - src/Appwrite/Databases/TransactionState.php | 19 -- src/Appwrite/Event/Audit.php | 212 ---------------- src/Appwrite/Event/Certificate.php | 60 ----- src/Appwrite/Event/Database.php | 58 ----- src/Appwrite/Event/Delete.php | 151 ------------ src/Appwrite/Event/Event.php | 46 ---- src/Appwrite/Event/Execution.php | 75 ------ src/Appwrite/Event/Func.php | 229 ------------------ src/Appwrite/Event/Migration.php | 90 ------- src/Appwrite/Event/Screenshot.php | 50 ---- src/Appwrite/Event/StatsResources.php | 74 ------ src/Appwrite/Extend/Exception.php | 1 - src/Appwrite/Functions/Validator/Payload.php | 18 -- src/Appwrite/GraphQL/Exception.php | 5 - src/Appwrite/Platform/Installer/Server.php | 1 - .../Http/Databases/Collections/Action.php | 60 ----- .../Http/Databases/Transactions/Create.php | 5 - .../Http/Databases/Transactions/Delete.php | 5 - .../Http/Databases/Transactions/Get.php | 5 - .../Transactions/Operations/Create.php | 5 - .../Http/Databases/Transactions/XList.php | 5 - .../Http/DocumentsDB/Transactions/Create.php | 5 - .../Http/DocumentsDB/Transactions/Delete.php | 5 - .../Http/DocumentsDB/Transactions/Get.php | 5 - .../Transactions/Operations/Create.php | 5 - .../Http/DocumentsDB/Transactions/XList.php | 5 - .../Http/TablesDB/Transactions/Create.php | 5 - .../Http/TablesDB/Transactions/Delete.php | 5 - .../Http/TablesDB/Transactions/Get.php | 5 - .../Transactions/Operations/Create.php | 5 - .../Http/TablesDB/Transactions/XList.php | 5 - .../Http/VectorsDB/Transactions/Create.php | 5 - .../Http/VectorsDB/Transactions/Delete.php | 5 - .../Http/VectorsDB/Transactions/Get.php | 5 - .../Transactions/Operations/Create.php | 5 - .../Http/VectorsDB/Transactions/XList.php | 5 - .../Modules/Projects/Http/Projects/Create.php | 6 - .../Projects/Http/Projects/Team/Update.php | 7 - .../Modules/Projects/Http/Projects/Update.php | 7 - src/Appwrite/Promises/Promise.php | 37 --- src/Appwrite/Realtime/Message/Dispatcher.php | 8 - src/Appwrite/SDK/Method.php | 80 ------ src/Appwrite/SDK/Parameter.php | 36 --- src/Appwrite/SDK/Specification/Format.php | 15 -- src/Appwrite/Usage/Context.php | 20 -- .../Utopia/Database/Documents/User.php | 22 -- src/Appwrite/Utopia/Fetch/BodyMultipart.php | 11 - src/Appwrite/Utopia/Request.php | 11 - src/Appwrite/Utopia/Request/Filters/V17.php | 2 - src/Appwrite/Utopia/Response.php | 27 --- src/Appwrite/Utopia/Response/Model.php | 22 -- src/Appwrite/Utopia/View.php | 13 - src/Executor/Exception.php | 1 - src/Executor/Exception/Timeout.php | 14 -- src/Executor/Executor.php | 34 +-- tests/e2e/Client.php | 73 ------ tests/e2e/Scopes/ApiDocumentsDB.php | 5 - tests/e2e/Scopes/SchemaPolling.php | 86 ------- tests/e2e/Scopes/Scope.php | 42 ---- tests/e2e/Scopes/SideNone.php | 8 - .../e2e/Services/Functions/FunctionsBase.php | 81 ------- tests/e2e/Services/GraphQL/Base.php | 6 - .../GraphQL/TablesDB/DatabaseServerTest.php | 110 --------- .../Services/Realtime/RealtimeQueryBase.php | 5 - tests/e2e/Services/Sites/SitesBase.php | 72 ------ tests/extensions/RetrySubscriber.php | 8 - tests/extensions/Retryable.php | 22 -- .../unit/Utopia/Response/Filters/V17Test.php | 15 -- 73 files changed, 169 insertions(+), 2267 deletions(-) create mode 100644 phpstan-deadcode.neon delete mode 100644 src/Appwrite/Event/Audit.php delete mode 100644 src/Appwrite/Event/Delete.php delete mode 100644 src/Appwrite/Event/Execution.php delete mode 100644 src/Appwrite/Event/Func.php delete mode 100644 src/Appwrite/Event/Migration.php delete mode 100644 src/Appwrite/Event/Screenshot.php delete mode 100644 src/Appwrite/Event/StatsResources.php delete mode 100644 src/Appwrite/Functions/Validator/Payload.php diff --git a/.gitignore b/.gitignore index 99ad534f93..f81ec131fc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ docker-compose.web-installer.yml docker-compose.web-installer.yml.**.backup tests/playwright/screenshots .playwright-mcp/ +.phpstan-cache-deadcode diff --git a/composer.json b/composer.json index 89d6e7b1bb..a5e5dbdaf8 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "analyze": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G", "bench": "vendor/bin/phpbench run --report=benchmark", "check": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G", + "dead-code": "./vendor/bin/phpstan analyse -c phpstan-deadcode.neon --memory-limit=2G", "refactor": "vendor/bin/rector process", "refactor:check": "vendor/bin/rector process --dry-run", "installer:clean": "php src/Appwrite/Platform/Installer/Server.php --clean", @@ -65,7 +66,6 @@ "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "2.0.*", "utopia-php/agents": "2.*", - "utopia-php/analytics": "0.15.*", "utopia-php/audit": "3.0.*", "utopia-php/auth": "^0.10", "utopia-php/cache": "^4.0.0", @@ -91,7 +91,6 @@ "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "2.*", "utopia-php/span": "3.0.*", - "utopia-php/preloader": "0.2.*", "utopia-php/queue": "^1.0.0", "utopia-php/servers": "0.4.*", "utopia-php/registry": "0.5.*", @@ -123,7 +122,8 @@ "textalk/websocket": "1.5.*", "czproject/git-php": "4.*", "laravel/pint": "1.*", - "rector/rector": "^2.4" + "rector/rector": "^2.4", + "shipmonk/dead-code-detector": "^0.13" }, "provide": { "ext-phpiredis": "*" diff --git a/composer.lock b/composer.lock index dcf4def469..b5f3bcd802 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4ad47c6924e38efc505314c491e8315e", + "content-hash": "1e71e6593aadcb27e643cd2caefb88f8", "packages": [ { "name": "adhocore/jwt", @@ -3120,52 +3120,6 @@ }, "time": "2026-05-29T10:44:54+00:00" }, - { - "name": "utopia-php/analytics", - "version": "0.15.2", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/analytics.git", - "reference": "ce5be7042ad518b83e401dcd785d20c4cc872c67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/analytics/zipball/ce5be7042ad518b83e401dcd785d20c4cc872c67", - "reference": "ce5be7042ad518b83e401dcd785d20c4cc872c67", - "shasum": "" - }, - "require": { - "php": ">=8.0" - }, - "require-dev": { - "laravel/pint": "dev-main", - "phpunit/phpunit": "^9.3", - "utopia-php/system": "0.10.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Analytics\\": "src/Analytics" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A simple library to track events & users.", - "keywords": [ - "analytics", - "framework", - "php", - "upf", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/analytics/issues", - "source": "https://github.com/utopia-php/analytics/tree/0.15.2" - }, - "time": "2026-02-09T12:46:39+00:00" - }, { "name": "utopia-php/audit", "version": "3.0.1", @@ -4578,59 +4532,6 @@ }, "time": "2026-08-05T18:07:20+00:00" }, - { - "name": "utopia-php/preloader", - "version": "0.2.4", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/preloader.git", - "reference": "65ef48392e72172f584b0baa2e224f9a1cebcce0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/preloader/zipball/65ef48392e72172f584b0baa2e224f9a1cebcce0", - "reference": "65ef48392e72172f584b0baa2e224f9a1cebcce0", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Preloader\\": "src/Preloader" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eldad Fux", - "email": "team@appwrite.io" - } - ], - "description": "Utopia Preloader library is simple and lite library for managing PHP preloading configuration", - "keywords": [ - "framework", - "php", - "preload", - "preloader", - "preloading", - "upf", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/preloader/issues", - "source": "https://github.com/utopia-php/preloader/tree/0.2.4" - }, - "time": "2020-10-24T07:04:59+00:00" - }, { "name": "utopia-php/psr7", "version": "0.2.0", @@ -7644,6 +7545,83 @@ ], "time": "2025-02-07T05:00:38+00:00" }, + { + "name": "shipmonk/dead-code-detector", + "version": "0.13.5", + "source": { + "type": "git", + "url": "https://github.com/shipmonk-rnd/dead-code-detector.git", + "reference": "a12cdd093624362743c8814a96a54fcc0a57d96d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/shipmonk-rnd/dead-code-detector/zipball/a12cdd093624362743c8814a96a54fcc0a57d96d", + "reference": "a12cdd093624362743c8814a96a54fcc0a57d96d", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.12" + }, + "require-dev": { + "composer-runtime-api": "^2.0", + "composer/semver": "^3.4", + "doctrine/orm": "^2.19 || ^3.0", + "editorconfig-checker/editorconfig-checker": "^10.6.0", + "ergebnis/composer-normalize": "^2.45.0", + "nette/application": "^3.1", + "nette/component-model": "^3.0", + "nette/utils": "^3.0 || ^4.0", + "nikic/php-parser": "^5.4.0", + "phpstan/phpstan-phpunit": "^2.0.4", + "phpstan/phpstan-strict-rules": "^2.0.3", + "phpstan/phpstan-symfony": "^2.0.2", + "phpunit/phpcov": "^8.2", + "phpunit/phpunit": "^9.6.22", + "shipmonk/coding-standard": "^0.1.3", + "shipmonk/composer-dependency-analyser": "^1.8.2", + "shipmonk/name-collision-detector": "^2.1.1", + "shipmonk/phpstan-dev": "^0.1.1", + "shipmonk/phpstan-rules": "^4.1.0", + "symfony/contracts": "^2.5 || ^3.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/routing": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "twig/twig": "^3.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "ShipMonk\\PHPStan\\DeadCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.", + "keywords": [ + "PHPStan", + "dead code", + "static analysis", + "unused code" + ], + "support": { + "issues": "https://github.com/shipmonk-rnd/dead-code-detector/issues", + "source": "https://github.com/shipmonk-rnd/dead-code-detector/tree/0.13.5" + }, + "time": "2025-10-13T12:19:42+00:00" + }, { "name": "staabm/side-effects-detector", "version": "1.0.5", diff --git a/phpstan-deadcode.neon b/phpstan-deadcode.neon new file mode 100644 index 0000000000..80382c18ca --- /dev/null +++ b/phpstan-deadcode.neon @@ -0,0 +1,86 @@ +# Dead code detection: unused methods, constants and enum cases. +# +# composer dead-code +# +# Anything listed under ignoreErrors is dead as far as this repository can see, +# but must not be removed -- each group explains why. Appwrite is the base +# server for appwrite/cloud, so a symbol unused here may still be consumed +# there; check that repository before deleting anything this reports. +includes: + - vendor/shipmonk/dead-code-detector/rules.neon + +parameters: + level: 0 + tmpDir: .phpstan-cache-deadcode + bootstrapFiles: + - app/init/constants.php + scanDirectories: + - vendor/swoole/ide-helper + paths: + - src + - app + - bin + - tests + excludePaths: + - tests/resources + ignoreErrors: + # Referenced in appwrite/cloud. + - '#^Unused Appwrite\\Auth\\MFA\\Challenge::challenge$#' + - '#^Unused Appwrite\\Auth\\MFA\\Challenge::verify$#' + - '#^Unused Appwrite\\Certificates\\Adapter::getCertificateStatus$#' + - '#^Unused Appwrite\\Certificates\\LetsEncrypt::getCertificateStatus$#' + - '#^Unused Appwrite\\Event\\Certificate::getAction$#' + - '#^Unused Appwrite\\Event\\Certificate::getDomain$#' + - '#^Unused Appwrite\\Event\\Database::getDatabase$#' + - '#^Unused Appwrite\\Event\\Database::setDatabase$#' + - '#^Unused Appwrite\\Event\\Database::setTable$#' + - '#^Unused Appwrite\\Event\\Event::EXECUTIONS_QUEUE_NAME$#' + - '#^Unused Appwrite\\Event\\Event::setPaused$#' + - '#^Unused Appwrite\\Event\\Event::setPlatform$#' + - '#^Unused Appwrite\\Event\\Message\\Audit::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Base::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Build::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Execution::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Executions::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Mail::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Messaging::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\StatsResources::fromArray$#' + - '#^Unused Appwrite\\Event\\Message\\Usage::fromArray$#' + - '#^Unused Appwrite\\Event\\Publisher\\Execution::enqueue$#' + - '#^Unused Appwrite\\Event\\Publisher\\Execution::getSize$#' + - '#^Unused Appwrite\\Event\\Publisher\\StatsResources::enqueue$#' + - '#^Unused Appwrite\\Filter\\Filter::apply$#' + - '#^Unused Appwrite\\GraphQL\\Resolvers::document$#' + - '#^Unused Appwrite\\GraphQL\\Schema::collections$#' + - '#^Unused Appwrite\\Messaging\\Adapter::subscribe$#' + - '#^Unused Appwrite\\Platform\\Action::disableSubqueries$#' + - '#^Unused Appwrite\\Platform\\Action::dump$#' + - '#^Unused Appwrite\\Platform\\Action::foreachDocument$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Documents\\Action::getResourceId$#' + - '#^Unused Appwrite\\Promises\\Promise::all$#' + - '#^Unused Appwrite\\SDK\\Specification\\Format::getServices$#' + - '#^Unused Appwrite\\Usage\\Context::getResourceId$#' + - '#^Unused Appwrite\\Usage\\Context::getResourcePath$#' + - '#^Unused Appwrite\\Usage\\Context::getService$#' + - '#^Unused Appwrite\\Usage\\Context::setResourceId$#' + - '#^Unused Appwrite\\Usage\\Context::setService$#' + - '#^Unused Appwrite\\Utopia\\Fetch\\BodyMultipart::getPart$#' + - '#^Unused Appwrite\\Utopia\\Messaging\\Messages\\Console::getTo$#' + - '#^Unused Appwrite\\Utopia\\Messaging\\Messages\\Webhook::getTo$#' + - '#^Unused Executor\\Executor::flatten$#' + - '#^Unused Executor\\Executor::parseCookie$#' + + # Abstract or interface declaration whose implementations are live. + - '#^Unused Appwrite\\Messaging\\Adapter::unsubscribe$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Action::getResponseModel$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Attributes\\Action::getResponseModel$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Documents\\Action::getResponseModel$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Indexes\\Action::getResponseModel$#' + - '#^Unused Tests\\E2E\\Scopes\\Scope::getHeaders$#' + + # Implements an abstract parent -- removing it would leave the class incomplete. + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Databases\\Collections\\Attributes\\Delete::getResponseModel$#' + - '#^Unused Appwrite\\Platform\\Modules\\Databases\\Http\\Embeddings\\Text\\Create::getResponseModel$#' + + # Called from a .phtml view, which PHPStan does not analyse. + - '#^Unused Appwrite\\Extend\\Exception::getCTAs$#' diff --git a/src/Appwrite/Auth/MFA/Type.php b/src/Appwrite/Auth/MFA/Type.php index 38236a4635..387e0a6c20 100644 --- a/src/Appwrite/Auth/MFA/Type.php +++ b/src/Appwrite/Auth/MFA/Type.php @@ -22,11 +22,6 @@ abstract class Type return $this; } - public function getLabel(): ?string - { - return $this->instance->getLabel(); - } - public function setIssuer(string $issuer): self { $this->instance->setIssuer($issuer); @@ -34,11 +29,6 @@ abstract class Type return $this; } - public function getIssuer(): ?string - { - return $this->instance->getIssuer(); - } - public function getSecret(): string { return $this->instance->getSecret(); diff --git a/src/Appwrite/Databases/TransactionState.php b/src/Appwrite/Databases/TransactionState.php index 71bd8799c7..8799ef60e5 100644 --- a/src/Appwrite/Databases/TransactionState.php +++ b/src/Appwrite/Databases/TransactionState.php @@ -222,25 +222,6 @@ class TransactionState return max(0, $adjustedCount); } - /** - * Check if a document exists with transaction-aware logic - * - * @param Document $database Target database document - * @param string $collectionId Collection ID - * @param string $documentId Document ID - * @param string|null $transactionId Optional transaction ID - * @return bool True if document exists - */ - public function documentExists( - Document $database, - string $collectionId, - string $documentId, - ?string $transactionId = null - ): bool { - $doc = $this->getDocument($database, $collectionId, $documentId, $transactionId); - return !$doc->isEmpty(); - } - /** * Apply bulk update to documents in transaction state that match queries * diff --git a/src/Appwrite/Event/Audit.php b/src/Appwrite/Event/Audit.php deleted file mode 100644 index 191acdf21a..0000000000 --- a/src/Appwrite/Event/Audit.php +++ /dev/null @@ -1,212 +0,0 @@ -setQueue(System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_AUDITS_CLASS_NAME', Event::AUDITS_CLASS_NAME)); - } - - /** - * Set resource for this audit event. - * - * @param string $resource - * @return self - */ - public function setResource(string $resource): self - { - $this->resource = $resource; - - return $this; - } - - /** - * Returns the set audit resource. - * - * @return string - */ - public function getResource(): string - { - return $this->resource; - } - - /** - * Set mode for this audit event - * - * @param string $mode - * @return self - */ - public function setMode(string $mode): self - { - $this->mode = $mode; - - return $this; - } - - /** - * Returns the set audit mode. - * - * @return string - */ - public function getMode(): string - { - return $this->mode; - } - - /** - * Set user agent for this audit event. - * - * @param string $userAgent - * @return self - */ - public function setUserAgent(string $userAgent): self - { - $this->userAgent = $userAgent; - - return $this; - } - - /** - * Returns the set audit user agent. - * - * @return string - */ - public function getUserAgent(): string - { - return $this->userAgent; - } - - /** - * Set IP for this audit event. - * - * @param string $ip - * @return self - */ - public function setIP(string $ip): self - { - $this->ip = $ip; - - return $this; - } - - /** - * Returns the set audit IP. - * - * @return string - */ - public function getIP(): string - { - return $this->ip; - } - - /** - * Set the hostname. - * - * @param string $hostname - * - * @return self - */ - public function setHostname(string $hostname): self - { - $this->hostname = $hostname; - - return $this; - } - - /** - * Get the hostname. - * - * @return string - */ - public function getHostname(): string - { - return $this->hostname; - } - - /** - * Set SDK name for this audit event. - * - * @param string $sdk - * @return self - */ - public function setSdk(string $sdk): self - { - $this->sdk = $sdk; - - return $this; - } - - /** - * Returns the set audit SDK name. - * - * @return string - */ - public function getSdk(): string - { - return $this->sdk; - } - - /** - * Set SDK version for this audit event. - * - * @param string $sdkVersion - * @return self - */ - public function setSdkVersion(string $sdkVersion): self - { - $this->sdkVersion = $sdkVersion; - - return $this; - } - - /** - * Returns the set audit SDK version. - * - * @return string - */ - public function getSdkVersion(): string - { - return $this->sdkVersion; - } - - /** - * Prepare payload for queue. - * - * @return array - */ - protected function preparePayload(): array - { - return [ - 'project' => $this->project, - 'user' => $this->user, - 'payload' => $this->payload, - 'resource' => $this->resource, - 'mode' => $this->mode, - 'ip' => $this->ip, - 'userAgent' => $this->userAgent, - 'event' => $this->event, - 'hostname' => $this->hostname, - 'sdk' => $this->sdk, - 'sdkVersion' => $this->sdkVersion - ]; - } -} diff --git a/src/Appwrite/Event/Certificate.php b/src/Appwrite/Event/Certificate.php index 5f8fe0408c..af6da47716 100644 --- a/src/Appwrite/Event/Certificate.php +++ b/src/Appwrite/Event/Certificate.php @@ -24,19 +24,6 @@ class Certificate extends Event ->setClass(System::getEnv('_APP_CERTIFICATES_CLASS_NAME', Event::CERTIFICATES_CLASS_NAME)); } - /** - * Set domain for this certificates event. - * - * @param Document $domain - * @return self - */ - public function setDomain(Document $domain): self - { - $this->domain = $domain; - - return $this; - } - /** * Returns the set domain for this certificate event. * @@ -47,53 +34,6 @@ class Certificate extends Event return $this->domain; } - /** - * Set if the certificate needs to be validated. - * - * @param bool $skipRenewCheck - * @return self - */ - public function setSkipRenewCheck(bool $skipRenewCheck): self - { - $this->skipRenewCheck = $skipRenewCheck; - - return $this; - } - - - /** - * Set override for main domain used for validation - * - * @param string|null $validationDomain - * @return self - */ - public function setValidationDomain(?string $validationDomain): self - { - $this->validationDomain = $validationDomain; - - return $this; - } - - /** - * Get validation domain - * - * @return string|null - */ - public function getValidationDomain(): ?string - { - return $this->validationDomain; - } - - /** - * Return if the certificate needs be validated. - * - * @return bool - */ - public function getSkipRenewCheck(): bool - { - return $this->skipRenewCheck; - } - /** * Set action for this certificate event. * diff --git a/src/Appwrite/Event/Database.php b/src/Appwrite/Event/Database.php index 4e8e1fdea9..35bebee574 100644 --- a/src/Appwrite/Event/Database.php +++ b/src/Appwrite/Event/Database.php @@ -85,51 +85,6 @@ class Database extends Event return $this; } - /** - * Returns set table for this event. - * - * @return null|Document - */ - public function getTable(): ?Document - { - return $this->table; - } - - /** - * Set the row for this database event. - * - * @param Document $row - * @return self - */ - public function setRow(Document $row): self - { - $this->row = $row; - - return $this; - } - - /** - * Returns set row for this database event. - * @return null|Document - */ - public function getRow(): ?Document - { - return $this->row; - } - - /** - * Set the collection for this database event. - * - * @param Document $collection - * @return self - */ - public function setCollection(Document $collection): self - { - $this->collection = $collection; - - return $this; - } - /** * Returns set collection for this event. * @@ -140,19 +95,6 @@ class Database extends Event return $this->collection; } - /** - * Set the document for this database event. - * - * @param Document $document - * @return self - */ - public function setDocument(Document $document): self - { - $this->document = $document; - - return $this; - } - /** * Returns set document for this database event. * @return null|Document diff --git a/src/Appwrite/Event/Delete.php b/src/Appwrite/Event/Delete.php deleted file mode 100644 index 6747acb03f..0000000000 --- a/src/Appwrite/Event/Delete.php +++ /dev/null @@ -1,151 +0,0 @@ -setQueue(System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_DELETE_CLASS_NAME', Event::DELETE_CLASS_NAME)); - } - - /** - * Sets the type for the delete event (use the constants starting with DELETE_TYPE_*). - * - * @param string $type - * @return self - */ - public function setType(string $type): self - { - $this->type = $type; - - return $this; - } - - /** - * Returns the set type for the delete event. - * - * @return string - */ - public function getType(): string - { - return $this->type; - } - - /** - * set Datetime. - * - * @param string $datetime - * @return self - */ - public function setDatetime(string $datetime): self - { - $this->datetime = $datetime; - return $this; - } - - /** - * Sets datetime for 1h interval. - * - * @param string $datetime - * @return self - */ - public function setUsageRetentionHourlyDateTime(string $datetime): self - { - $this->hourlyUsageRetentionDatetime = $datetime; - return $this; - } - - /** - * Sets the document for the delete event. - * - * @param Document $document - * @return self - */ - public function setDocument(Document $document): self - { - $this->document = $document; - - return $this; - } - - /** - * Returns the resource for the delete event. - * - * @return string - */ - public function getResource(): string - { - return $this->resource; - } - - /** - * Sets the resource for the delete event. - * - * @param string $resource - * @return self - */ - public function setResource(string $resource): self - { - $this->resource = $resource; - - return $this; - } - - /** - * Sets the resource type for the delete event. - * - * @param string $resourceType - * @return self - */ - public function setResourceType(string $resourceType): self - { - $this->resourceType = $resourceType; - - return $this; - } - - /** - * Returns the set document for the delete event. - * - * @return null|Document - */ - public function getDocument(): ?Document - { - return $this->document; - } - - /** - * Prepare the payload for the event - * - * @return array - */ - protected function preparePayload(): array - { - return [ - 'project' => $this->project, - 'type' => $this->type, - 'document' => $this->document, - 'resource' => $this->resource, - 'resourceType' => $this->resourceType, - 'datetime' => $this->datetime, - 'hourlyUsageRetentionDatetime' => $this->hourlyUsageRetentionDatetime - ]; - } -} diff --git a/src/Appwrite/Event/Event.php b/src/Appwrite/Event/Event.php index 04aa9ba616..8beaeedc01 100644 --- a/src/Appwrite/Event/Event.php +++ b/src/Appwrite/Event/Event.php @@ -13,26 +13,19 @@ class Event public const DATABASE_CLASS_NAME = 'DatabaseV1'; public const DELETE_QUEUE_NAME = 'v1-deletes'; - public const DELETE_CLASS_NAME = 'DeletesV1'; public const AUDITS_QUEUE_NAME = 'v1-audits'; - public const AUDITS_CLASS_NAME = 'AuditsV1'; public const MAILS_QUEUE_NAME = 'v1-mails'; - public const MAILS_CLASS_NAME = 'MailsV1'; public const NOTIFICATIONS_QUEUE_NAME = 'v1-notifications'; - public const NOTIFICATIONS_CLASS_NAME = 'NotificationsV1'; public const FUNCTIONS_QUEUE_NAME = 'v1-functions'; - public const FUNCTIONS_CLASS_NAME = 'FunctionsV1'; public const FUNCTIONS_QUEUE_TTL = 60 * 60 * 24 * 7; // 7 days public const STATS_RESOURCES_QUEUE_NAME = 'v1-stats-resources'; - public const STATS_RESOURCES_CLASS_NAME = 'StatsResourcesV1'; public const STATS_USAGE_QUEUE_NAME = 'v1-stats-usage'; - public const STATS_USAGE_CLASS_NAME = 'StatsUsageV1'; public const WEBHOOK_QUEUE_NAME = 'v1-webhooks'; public const WEBHOOK_CLASS_NAME = 'WebhooksV1'; @@ -41,22 +34,16 @@ class Event public const CERTIFICATES_CLASS_NAME = 'CertificatesV1'; public const BUILDS_QUEUE_NAME = 'v1-builds'; - public const BUILDS_CLASS_NAME = 'BuildsV1'; public const JOBS_QUEUE_NAME = 'v1-jobs'; - public const JOBS_CLASS_NAME = 'JobsV1'; public const SCREENSHOTS_QUEUE_NAME = 'v1-screenshots'; - public const SCREENSHOTS_CLASS_NAME = 'ScreenshotsV1'; public const MESSAGING_QUEUE_NAME = 'v1-messaging'; - public const MESSAGING_CLASS_NAME = 'MessagingV1'; public const EXECUTIONS_QUEUE_NAME = 'v1-executions'; - public const EXECUTIONS_CLASS_NAME = 'ExecutionsV1'; public const MIGRATIONS_QUEUE_NAME = 'v1-migrations'; - public const MIGRATIONS_CLASS_NAME = 'MigrationsV1'; protected string $queue = ''; protected string $class = ''; @@ -95,14 +82,6 @@ class Event return $this; } - /** - * Get paused state for this event. - */ - public function getPaused(): bool - { - return $this->paused; - } - /** * Set queue used for this event. * @@ -126,19 +105,6 @@ class Event return $this->queue; } - /** - * Set TTL (time-to-live) for jobs in this queue. - * - * @param int $ttl TTL in seconds - * @return static - */ - public function setTTL(int $ttl): static - { - $this->ttl = $ttl; - - return $this; - } - /** * Get TTL (time-to-live) for jobs in this queue. * @@ -228,18 +194,6 @@ class Event return $this; } - /** - * Set user ID for this event. - * - * @return static - */ - public function setUserId(string $userId): static - { - $this->userId = $userId; - - return $this; - } - /** * Get user responsible for triggering this event. * diff --git a/src/Appwrite/Event/Execution.php b/src/Appwrite/Event/Execution.php deleted file mode 100644 index 9e735991ba..0000000000 --- a/src/Appwrite/Event/Execution.php +++ /dev/null @@ -1,75 +0,0 @@ -setQueue(Event::EXECUTIONS_QUEUE_NAME) - ->setClass(Event::EXECUTIONS_CLASS_NAME); - } - - /** - * Sets execution document for the execution event. - * - * @param Document $execution - * @return self - */ - public function setExecution(Document $execution): self - { - $this->execution = $execution; - - return $this; - } - - /** - * Returns set execution document for the execution event. - * - * @return null|Document - */ - public function getExecution(): ?Document - { - return $this->execution; - } - - /** - * Prepare payload for the execution event. - * - * @return array - */ - protected function preparePayload(): array - { - return [ - 'project' => $this->project, - 'execution' => $this->execution, - ]; - } - - /** - * Trim payload for the execution event. - * Only the project ID is needed — the worker DI fetches the full project from the platform database. - * - * @return array - */ - protected function trimPayload(): array - { - $trimmed = []; - - if ($this->project) { - $trimmed['project'] = new Document([ - '$id' => $this->project->getId(), - ]); - } - - return $trimmed; - } -} diff --git a/src/Appwrite/Event/Func.php b/src/Appwrite/Event/Func.php deleted file mode 100644 index 7790437e1c..0000000000 --- a/src/Appwrite/Event/Func.php +++ /dev/null @@ -1,229 +0,0 @@ -setQueue(System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_FUNCTIONS_CLASS_NAME', Event::FUNCTIONS_CLASS_NAME)) - ->setTTL(Event::FUNCTIONS_QUEUE_TTL); - } - - /** - * Sets function document for the function event. - * - * @param Document $function - * @return self - */ - public function setFunction(Document $function): self - { - $this->function = $function; - - return $this; - } - - /** - * Returns set function document for the function event. - * - * @return null|Document - */ - public function getFunction(): ?Document - { - return $this->function; - } - - /** - * Sets function id for the function event. - * - * @param string $functionId - */ - public function setFunctionId(string $functionId): self - { - $this->functionId = $functionId; - - return $this; - } - - /** - * Returns set function id for the function event. - * - * @return string|null - */ - public function getFunctionId(): ?string - { - return $this->functionId; - } - - /** - * Sets execution for the function event. - * - * @param Document $execution - * @return self - */ - public function setExecution(Document $execution): self - { - $this->execution = $execution; - - return $this; - } - - /** - * Returns set execution for the function event. - * - * @return null|Document - */ - public function getExecution(): ?Document - { - return $this->execution; - } - - /** - * Sets type for the function event. - * - * @param string $type Can be `schedule`, `event` or `http`. - * @return self - */ - public function setType(string $type): self - { - $this->type = $type; - - return $this; - } - - /** - * Returns set type for the function event. - * - * @return string - */ - public function getType(): string - { - return $this->type; - } - - /** - * Sets custom body for the function event. - * - * @param string $body - * @return self - */ - public function setBody(string $body): self - { - $this->body = $body; - - return $this; - } - - /** - * Sets custom method for the function event. - * - * @param string $method - * @return self - */ - public function setMethod(string $method): self - { - $this->method = $method; - - return $this; - } - - /** - * Sets custom path for the function event. - * - * @param string $path - * @return self - */ - public function setPath(string $path): self - { - $this->path = $path; - - return $this; - } - - /** - * Sets custom headers for the function event. - * - * @param array $headers - * @return self - */ - public function setHeaders(array $headers): self - { - $this->headers = $headers; - - return $this; - } - - /** - * Returns set JWT for the function event. - * - * @return string - */ - public function getJWT(): string - { - return $this->jwt; - } - - /** - * Sets JWT for the function event. - * - * @param string $jwt - * @return self - */ - public function setJWT(string $jwt): self - { - $this->jwt = $jwt; - return $this; - } - - /** - * Prepare payload for the function event. - * - * @return array - */ - protected function preparePayload(): array - { - $events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null; - - $platform = $this->platform; - if (empty($platform)) { - $platform = Config::getParam('platform', []); - } - - return [ - 'project' => $this->project, - 'user' => $this->user, - 'userId' => $this->userId, - 'function' => $this->function, - 'functionId' => $this->functionId, - 'execution' => $this->execution, - 'type' => $this->type, - 'jwt' => $this->jwt, - 'payload' => $this->payload, - 'events' => $events, - 'body' => $this->body, - 'path' => $this->path, - 'headers' => $this->headers, - 'method' => $this->method, - 'platform' => $platform, - ]; - } -} diff --git a/src/Appwrite/Event/Migration.php b/src/Appwrite/Event/Migration.php deleted file mode 100644 index 89f49f0876..0000000000 --- a/src/Appwrite/Event/Migration.php +++ /dev/null @@ -1,90 +0,0 @@ -setQueue(System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_MIGRATIONS_CLASS_NAME', Event::MIGRATIONS_CLASS_NAME)); - } - - /** - * Sets migration document for the migration event. - * - * @param Document $migration - * @return self - */ - public function setMigration(Document $migration): self - { - $this->migration = $migration; - - return $this; - } - - /** - * Returns set migration document for the function event. - * - * @return null|Document - */ - public function getMigration(): ?Document - { - return $this->migration; - } - - /** - * Sets migration type for the migration event. - * - * @param string $type - * - * @return self - */ - public function setType(string $type): self - { - $this->type = $type; - - return $this; - } - - /** - * Returns set migration type for the migration event. - * - * @return string - */ - public function getType(): string - { - return $this->type; - } - - /** - * Prepare the payload for the migration event. - * - * @return array - */ - protected function preparePayload(): array - { - $platform = $this->platform; - if (empty($platform)) { - $platform = Config::getParam('platform', []); - } - - return [ - 'project' => $this->project, - 'user' => $this->user, - 'migration' => $this->migration, - 'platform' => $platform, - ]; - } -} diff --git a/src/Appwrite/Event/Screenshot.php b/src/Appwrite/Event/Screenshot.php deleted file mode 100644 index acacf2b872..0000000000 --- a/src/Appwrite/Event/Screenshot.php +++ /dev/null @@ -1,50 +0,0 @@ -setQueue(System::getEnv('_APP_SCREENSHOTS_QUEUE_NAME', Event::SCREENSHOTS_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_SCREENSHOTS_CLASS_NAME', Event::SCREENSHOTS_CLASS_NAME)); - } - - public function setDeploymentId(string $deploymentId): self - { - $this->deploymentId = $deploymentId; - - return $this; - } - - protected function preparePayload(): array - { - $platform = $this->platform; - if (empty($platform)) { - $platform = Config::getParam('platform', []); - } - - return [ - 'project' => $this->project, - 'deploymentId' => $this->deploymentId, - 'platform' => $platform, - ]; - } - - public function reset(): self - { - $this->deploymentId = ''; - parent::reset(); - - return $this; - } -} diff --git a/src/Appwrite/Event/StatsResources.php b/src/Appwrite/Event/StatsResources.php deleted file mode 100644 index 42259f76b9..0000000000 --- a/src/Appwrite/Event/StatsResources.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ - protected array $gauges = []; - - public function __construct(protected Publisher $publisher) - { - parent::__construct($publisher); - - $this - ->setQueue(System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME)) - ->setClass(System::getEnv('_APP_STATS_RESOURCES_CLASS_NAME', Event::STATS_RESOURCES_CLASS_NAME)); - } - - /** - * Set the full set of pre-computed gauge metrics for this message. Replaces any - * previously-set gauges. - * - * @param array $gauges - */ - public function setGauges(array $gauges): self - { - $this->gauges = $gauges; - return $this; - } - - /** - * Append a single pre-computed gauge metric to this message. - */ - public function addGauge(string $metric, int $value): self - { - $this->gauges[] = ['metric' => $metric, 'value' => $value]; - return $this; - } - - /** - * @return array - */ - public function getGauges(): array - { - return $this->gauges; - } - - /** - * Prepare the payload for the usage event. - * - * @return array - */ - protected function preparePayload(): array - { - return [ - 'project' => $this->project, - 'gauges' => $this->gauges, - ]; - } -} diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 2477eb0379..278338905f 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -99,7 +99,6 @@ class Exception extends \Exception public const string USER_EMAIL_NOT_VERIFIED = 'user_email_not_verified'; public const string USER_MISSING_ID = 'user_missing_id'; public const string USER_MORE_FACTORS_REQUIRED = 'user_more_factors_required'; - public const string USER_INVALID_CHALLENGE = 'user_invalid_challenge'; public const string USER_AUTHENTICATOR_NOT_FOUND = 'user_authenticator_not_found'; public const string USER_AUTHENTICATOR_ALREADY_VERIFIED = 'user_authenticator_already_verified'; public const string USER_RECOVERY_CODES_ALREADY_EXISTS = 'user_recovery_codes_already_exists'; diff --git a/src/Appwrite/Functions/Validator/Payload.php b/src/Appwrite/Functions/Validator/Payload.php deleted file mode 100644 index acb461eabd..0000000000 --- a/src/Appwrite/Functions/Validator/Payload.php +++ /dev/null @@ -1,18 +0,0 @@ -isCollectionsAPI() - ? Exception::ATTRIBUTE_FORMAT_UNSUPPORTED - : Exception::COLUMN_FORMAT_UNSUPPORTED; - } - - /** - * Get the correct default unsupported message. - */ - protected function getDefaultUnsupportedException(): string - { - return $this->isCollectionsAPI() - ? Exception::ATTRIBUTE_DEFAULT_UNSUPPORTED - : Exception::COLUMN_DEFAULT_UNSUPPORTED; - } - - /** - * Get the appropriate parent level not found exception. - */ - protected function getParentNotFoundException(): string - { - return $this->isCollectionsAPI() - ? Exception::COLLECTION_NOT_FOUND - : Exception::TABLE_NOT_FOUND; - } - - /** - * Get the correct invalid structure message. - */ - protected function getStructureException(): string - { - return $this->isCollectionsAPI() - ? Exception::DOCUMENT_INVALID_STRUCTURE - : Exception::ROW_INVALID_STRUCTURE; - } - - /** - * Get the exception for unknown attribute/column in index. - */ - protected function getParentUnknownException(): string - { - return $this->isCollectionsAPI() - ? Exception::ATTRIBUTE_UNKNOWN - : Exception::COLUMN_UNKNOWN; - } - - /** - * Get the exception for invalid attribute/column type in index. - */ - protected function getParentInvalidTypeException(): string - { - return $this->isCollectionsAPI() - ? Exception::ATTRIBUTE_TYPE_INVALID - : Exception::COLUMN_TYPE_INVALID; - } - /** * Add row bytes information to a collection/table document. */ diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php index 1e0c7af49b..8f2ac12741 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php @@ -24,11 +24,6 @@ class Create extends Action return 'createDatabasesTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php index 9130929162..83c5f8b1fc 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php @@ -23,11 +23,6 @@ class Delete extends Action return 'deleteDatabasesTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_NONE; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php index d31c2fb48b..d9d03ca5c5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php @@ -20,11 +20,6 @@ class Get extends Action return 'getDatabasesTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php index 3aca66cd6d..d81c376b9f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php @@ -31,11 +31,6 @@ class Create extends Action return 'createDatabasesTransactionOperations'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php index 22a7da97aa..898418202b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php @@ -23,11 +23,6 @@ class XList extends Action return 'listDatabasesTransactions'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION_LIST; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Create.php index 9341779dcd..7365ae6a95 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Create.php @@ -18,11 +18,6 @@ class Create extends TransactionsCreate return 'createDocumentsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Delete.php index 94ff3fa214..4116f9ff3c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Delete.php @@ -18,11 +18,6 @@ class Delete extends TransactionsDelete return 'deleteDocumentsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_NONE; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Get.php index c2f4b85881..0a3027f007 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Get.php @@ -18,11 +18,6 @@ class Get extends TransactionsGet return 'getDocumentsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Operations/Create.php index 963af2f43e..0d8d06121f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/Operations/Create.php @@ -20,11 +20,6 @@ class Create extends OperationsCreate return 'createDocumentsDBOperations'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/XList.php index b216ce6a4a..73f7d6b90b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Transactions/XList.php @@ -18,11 +18,6 @@ class XList extends TransactionsList return 'listDocumentsDBTransactions'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION_LIST; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php index 6876cf6a8f..56ac2c1e01 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php @@ -18,11 +18,6 @@ class Create extends TransactionsCreate return 'createTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php index 988bfc3d1d..0e702d532b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php @@ -19,11 +19,6 @@ class Delete extends TransactionsDelete return 'deleteTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_NONE; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php index cfb621d28d..465a191faa 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php @@ -19,11 +19,6 @@ class Get extends TransactionsGet return 'getTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php index b00b75f270..50dcd21020 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php @@ -21,11 +21,6 @@ class Create extends OperationsCreate return 'createOperations'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php index f06ef13af8..6abc5bafa2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php @@ -18,11 +18,6 @@ class XList extends TransactionsList return 'listTransactions'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION_LIST; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Create.php index cb67d3f7f1..2b9f250889 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Create.php @@ -18,11 +18,6 @@ class Create extends TransactionsCreate return 'createVectorsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Delete.php index 2de71fc904..4539ed487b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Delete.php @@ -18,11 +18,6 @@ class Delete extends TransactionsDelete return 'deleteVectorsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_NONE; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Get.php index 5b1a227844..09a7289cd7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Get.php @@ -18,11 +18,6 @@ class Get extends TransactionsGet return 'getVectorsDBTransaction'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Operations/Create.php index 27283cda49..0fc766a5e2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/Operations/Create.php @@ -20,11 +20,6 @@ class Create extends OperationsCreate return 'createVectorsDBOperations'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/XList.php index fb95667ffb..ee309db7e0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Transactions/XList.php @@ -18,11 +18,6 @@ class XList extends TransactionsList return 'listVectorsDBTransactions'; } - protected function getResponseModel(): string - { - return UtopiaResponse::MODEL_TRANSACTION_LIST; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index d8f85a64d5..f65ca3eae9 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -24,7 +24,6 @@ use Utopia\Platform\Enum; use Utopia\Platform\Scope\HTTP; use Utopia\Pools\Group; use Utopia\System\System; -use Utopia\Validator; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; @@ -37,11 +36,6 @@ class Create extends Action return 'createProject'; } - protected function getQueriesValidator(): Validator - { - return new Projects(); - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php index 4e5a293855..21e6572a39 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php @@ -7,14 +7,12 @@ use Appwrite\Platform\Modules\Projects\Http\Projects\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Appwrite\Utopia\Database\Validator\Queries\Projects; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Scope\HTTP; -use Utopia\Validator; class Update extends Action { @@ -25,11 +23,6 @@ class Update extends Action return 'updateProjectTeam'; } - protected function getQueriesValidator(): Validator - { - return new Projects(); - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php index c633a7adbf..acc4cf101b 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php @@ -3,12 +3,10 @@ namespace Appwrite\Platform\Modules\Projects\Http\Projects; use Appwrite\Extend\Exception; -use Appwrite\Utopia\Database\Validator\Queries\Projects; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; use Utopia\Platform\Scope\HTTP; -use Utopia\Validator; use Utopia\Validator\Text; use Utopia\Validator\URL; @@ -21,11 +19,6 @@ class Update extends Action return 'updateProject'; } - protected function getQueriesValidator(): Validator - { - return new Projects(); - } - public function __construct() { $this diff --git a/src/Appwrite/Promises/Promise.php b/src/Appwrite/Promises/Promise.php index 579969cd7b..1d240194ff 100644 --- a/src/Appwrite/Promises/Promise.php +++ b/src/Appwrite/Promises/Promise.php @@ -45,43 +45,6 @@ abstract class Promise return new static($promise); } - /** - * Resolve promise with given value. - * - * @param mixed $value - * @return self - */ - public static function resolve(mixed $value): self - { - return new static(function (callable $resolve) use ($value) { - $resolve($value); - }); - } - - /** - * Rejects the promise with the given reason. - * - * @param mixed $value - * @return self - */ - public static function reject(mixed $value): self - { - return new static(function (callable $resolve, callable $reject) use ($value) { - $reject($value); - }); - } - - /** - * Catch any exception thrown by the executor. - * - * @param callable $onRejected - * @return self - */ - public function catch(callable $onRejected): self - { - return $this->then(null, $onRejected); - } - /** * Execute the promise. * diff --git a/src/Appwrite/Realtime/Message/Dispatcher.php b/src/Appwrite/Realtime/Message/Dispatcher.php index 827588f624..d086d82a7b 100644 --- a/src/Appwrite/Realtime/Message/Dispatcher.php +++ b/src/Appwrite/Realtime/Message/Dispatcher.php @@ -32,14 +32,6 @@ class Dispatcher return $this; } - /** - * @return array - */ - public function getHandlers(): array - { - return $this->handlers; - } - /** * Routes a parsed websocket message to the handler that registered for its `type`, * runs param validation + dependency injection, and returns whatever the handler returns. diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index f1b327513f..0e14a68fa3 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -236,97 +236,17 @@ class Method return $this; } - public function setMethodName(string $name): self - { - $this->name = $name; - return $this; - } - - public function setDesc(string $desc): self - { - $this->desc = $desc; - return $this; - } - - public function setDescription(string $description): self - { - $this->description = $description; - return $this; - } - - public function setAuth(array $auth): self - { - $this->validateAuthTypes($auth); - $this->auth = $auth; - return $this; - } - - /** - * @param array $responses - */ - public function setResponses(array $responses): self - { - foreach ($responses as $response) { - $this->validateResponseModel($response->getModel()); - $this->validateNoContent($response); - } - $this->responses = $responses; - return $this; - } - - public function setContentType(ContentType $contentType): self - { - $this->contentType = $contentType; - return $this; - } - public function setType(?MethodType $type): self { $this->type = $type; return $this; } - public function setDeprecated(bool|Deprecated $deprecated): self - { - $this->deprecated = $deprecated; - return $this; - } - - public function setHide(bool|Deprecated $hide): self - { - $this->hide = $hide; - return $this; - } - - public function setPackaging(bool $packaging): self - { - $this->packaging = $packaging; - return $this; - } - - public function setRequestType(ContentType $requestType): self - { - $this->requestType = $requestType; - return $this; - } - - public function setParameters(array $parameters): self - { - $this->parameters = $parameters; - return $this; - } - public function isPublic(): bool { return $this->public; } - public function setPublic(bool $public): self - { - $this->public = $public; - return $this; - } - public static function getErrors(): array { return self::$errors; diff --git a/src/Appwrite/SDK/Parameter.php b/src/Appwrite/SDK/Parameter.php index fbba9e957e..0c56348757 100644 --- a/src/Appwrite/SDK/Parameter.php +++ b/src/Appwrite/SDK/Parameter.php @@ -29,23 +29,11 @@ class Parameter return $this->name; } - public function setName(string $name): static - { - $this->name = $name; - return $this; - } - public function getDescription(): string { return $this->description; } - public function setDescription(string $description): static - { - $this->description = $description; - return $this; - } - public function getDefault(): mixed { return $this->default === Undefined::Value ? null : $this->default; @@ -56,23 +44,11 @@ class Parameter return $this->default !== Undefined::Value; } - public function setDefault(mixed $default): static - { - $this->default = $default; - return $this; - } - public function getValidator(): mixed { return $this->validator; } - public function setValidator(mixed $validator): static - { - $this->validator = $validator; - return $this; - } - public function getOptional(): bool { return $this->optional === Undefined::Value ? false : $this->optional; @@ -83,20 +59,8 @@ class Parameter return $this->optional !== Undefined::Value; } - public function setOptional(bool $optional): static - { - $this->optional = $optional; - return $this; - } - public function getHide(): bool { return $this->hide; } - - public function setHide(bool $hide): static - { - $this->hide = $hide; - return $this; - } } diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index d39e893768..2b7ea2c783 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -156,21 +156,6 @@ abstract class Format return ['type' => 'object']; } - /** - * Set Services. - * - * Set services value - * - * @param array $services - * - * @return self - */ - public function setServices(array $services): self - { - $this->services = $services; - return $this; - } - /** * Set Services. * diff --git a/src/Appwrite/Usage/Context.php b/src/Appwrite/Usage/Context.php index 49e852fed7..fcad4b8e22 100644 --- a/src/Appwrite/Usage/Context.php +++ b/src/Appwrite/Usage/Context.php @@ -23,16 +23,6 @@ class Context return $this; } - /** - * Add a document to reduce - */ - public function addReduce(Document $document): self - { - $this->reduce[] = $document; - - return $this; - } - /** * Get all metrics * @@ -86,11 +76,6 @@ class Context return $this; } - public function getResource(): string - { - return ''; - } - public function setResourceId(string $resourceId): self { return $this; @@ -106,11 +91,6 @@ class Context return $this; } - public function getResourceInternalId(): string - { - return ''; - } - /** * Reset the context */ diff --git a/src/Appwrite/Utopia/Database/Documents/User.php b/src/Appwrite/Utopia/Database/Documents/User.php index 360ea8b279..dea8f23d27 100644 --- a/src/Appwrite/Utopia/Database/Documents/User.php +++ b/src/Appwrite/Utopia/Database/Documents/User.php @@ -11,7 +11,6 @@ use Utopia\Database\Validator\Roles; class User extends Document { - public const ROLE_ANY = 'any'; public const ROLE_GUESTS = 'guests'; public const ROLE_USERS = 'users'; public const ROLE_ADMIN = 'admin'; @@ -20,16 +19,6 @@ class User extends Document public const ROLE_KEYS = 'keys'; public const ROLE_SYSTEM = 'system'; - public function getEmail(): ?string - { - return $this->getAttribute('email'); - } - - public function getPhone(): ?string - { - return $this->getAttribute('phone'); - } - /** * Returns all roles for a user. * @@ -83,17 +72,6 @@ class User extends Document return $roles; } - /** - * Check if user is anonymous. - * - * @return bool - */ - public function isAnonymous(): bool - { - return is_null($this->getEmail()) - && is_null($this->getPhone()); - } - /** * Is Privileged User? * diff --git a/src/Appwrite/Utopia/Fetch/BodyMultipart.php b/src/Appwrite/Utopia/Fetch/BodyMultipart.php index 90732eb7a1..3e4afe6a44 100644 --- a/src/Appwrite/Utopia/Fetch/BodyMultipart.php +++ b/src/Appwrite/Utopia/Fetch/BodyMultipart.php @@ -106,17 +106,6 @@ class BodyMultipart return $this; } - public function getBoundary(): string - { - return $this->boundary; - } - - public function setBoundary(string $boundary): self - { - $this->boundary = $boundary; - return $this; - } - public function exportHeader(): string { return 'multipart/form-data; boundary=' . $this->boundary; diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index be23c2f211..4ff251be9a 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -123,17 +123,6 @@ class Request extends UtopiaRequest return $this->filters; } - /** - * Reset filters - * - * @return void - */ - public function resetFilters(): void - { - $this->filters = []; - $this->filteredParams = null; - } - /** * Check if a filter has been set * diff --git a/src/Appwrite/Utopia/Request/Filters/V17.php b/src/Appwrite/Utopia/Request/Filters/V17.php index 0e4f9eceb6..2efce57ff3 100644 --- a/src/Appwrite/Utopia/Request/Filters/V17.php +++ b/src/Appwrite/Utopia/Request/Filters/V17.php @@ -14,8 +14,6 @@ class V17 extends Filter protected const CHAR_SPACE = ' '; protected const CHAR_BRACKET_START = '['; protected const CHAR_BRACKET_END = ']'; - protected const CHAR_PARENTHESES_START = '('; - protected const CHAR_PARENTHESES_END = ')'; protected const CHAR_BACKSLASH = '\\'; // Convert 1.4 params to 1.5 diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index d41392e8fb..80dd69bd38 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -29,7 +29,6 @@ class Response extends SwooleResponse public const MODEL_METRIC_LIST = 'metricList'; public const MODEL_METRIC_BREAKDOWN = 'metricBreakdown'; public const MODEL_ERROR_DEV = 'errorDev'; - public const MODEL_BASE_LIST = 'baseList'; public const MODEL_USAGE_DOCUMENTSDBS = 'usageDocumentsDBs'; public const MODEL_USAGE_DOCUMENTSDB = 'usageDocumentsDB'; public const MODEL_USAGE_VECTORSDBS = 'usageVectorsDBs'; @@ -132,7 +131,6 @@ class Response extends SwooleResponse // MFA public const MODEL_MFA_TYPE = 'mfaType'; public const MODEL_MFA_FACTORS = 'mfaFactors'; - public const MODEL_MFA_OTP = 'mfaTotp'; public const MODEL_MFA_CHALLENGE = 'mfaChallenge'; public const MODEL_MFA_CHALLENGE_SECRET = 'mfaChallengeSecret'; public const MODEL_MFA_RECOVERY_CODES = 'mfaRecoveryCodes'; @@ -191,7 +189,6 @@ class Response extends SwooleResponse public const MODEL_INSTALLATION = 'installation'; public const MODEL_INSTALLATION_LIST = 'installationList'; public const MODEL_PROVIDER_REPOSITORY = 'providerRepository'; - public const MODEL_PROVIDER_REPOSITORY_LIST = 'providerRepositoryList'; public const MODEL_PROVIDER_REPOSITORY_FRAMEWORK = 'providerRepositoryFramework'; public const MODEL_PROVIDER_REPOSITORY_FRAMEWORK_LIST = 'providerRepositoryFrameworkList'; public const MODEL_PROVIDER_REPOSITORY_RUNTIME = 'providerRepositoryRuntime'; @@ -225,7 +222,6 @@ class Response extends SwooleResponse public const MODEL_DEPLOYMENT_LIST = 'deploymentList'; public const MODEL_EXECUTION = 'execution'; public const MODEL_EXECUTION_LIST = 'executionList'; - public const MODEL_FUNC_PERMISSIONS = 'funcPermissions'; public const MODEL_HEADERS = 'headers'; public const MODEL_SPECIFICATION = 'specification'; public const MODEL_SPECIFICATION_LIST = 'specificationList'; @@ -288,7 +284,6 @@ class Response extends SwooleResponse public const MODEL_PLATFORM_LIST = 'platformList'; public const MODEL_VARIABLE = 'variable'; public const MODEL_VARIABLE_LIST = 'variableList'; - public const MODEL_VCS = 'vcs'; public const MODEL_EMAIL_TEMPLATE = 'emailTemplate'; public const MODEL_EMAIL_TEMPLATE_LIST = 'emailTemplateList'; public const MODEL_OAUTH2_GITHUB = 'oAuth2Github'; @@ -358,13 +353,6 @@ class Response extends SwooleResponse public const MODEL_CONSOLE_KEY_SCOPE = 'consoleKeyScope'; public const MODEL_CONSOLE_KEY_SCOPE_LIST = 'consoleKeyScopeList'; - // Deprecated - public const MODEL_PERMISSIONS = 'permissions'; - public const MODEL_RULE = 'rule'; - public const MODEL_TASK = 'task'; - public const MODEL_DOMAIN = 'domain'; - public const MODEL_DOMAIN_LIST = 'domainList'; - // Tests (keep last) public const MODEL_MOCK = 'mock'; @@ -753,16 +741,6 @@ class Response extends SwooleResponse return $this->filters; } - /** - * Reset filters - * - * @return void - */ - public function resetFilters(): void - { - $this->filters = []; - } - /** * Check if a filter has been set * @@ -809,9 +787,4 @@ class Response extends SwooleResponse { $this->impersonatorUser = $impersonatorUser->isEmpty() ? null : $impersonatorUser; } - - public function getImpersonatorUser(): ?Document - { - return $this->impersonatorUser; - } } diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index b32894ab3c..f7dc8e769d 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -14,7 +14,6 @@ abstract class Model public const TYPE_DATETIME = 'datetime'; public const TYPE_DATETIME_EXAMPLE = '2020-10-15T06:38:00.000+00:00'; public const TYPE_RELATIONSHIP = 'relationship'; - public const TYPE_PAYLOAD = 'payload'; public const TYPE_ARRAY = 'array'; public const TYPE_ENUM = 'enum'; public const TYPE_ID = 'id'; @@ -118,27 +117,6 @@ abstract class Model return $list; } - /** - * Get Readonly Fields - * - * Returns list of field names that are marked as readOnly - * and should not be allowed in create/update payloads - * - * @return array - */ - public function getReadonlyFields(): array - { - $list = []; - - foreach ($this->rules as $key => $rule) { - if ($rule['readOnly'] ?? false) { - $list[] = $key; - } - } - - return $list; - } - /** * Is None * diff --git a/src/Appwrite/Utopia/View.php b/src/Appwrite/Utopia/View.php index c5f66ae9ee..050c2f5b2a 100644 --- a/src/Appwrite/Utopia/View.php +++ b/src/Appwrite/Utopia/View.php @@ -6,17 +6,4 @@ use Utopia\Http\View as OldView; class View extends OldView { - /** - * Escape - * - * Convert all applicable characters to HTML entities - * - * @param string $str - * @return string - * @deprecated Use print method with escape filter - */ - public function escape($str) - { - return \htmlentities($str, ENT_QUOTES, 'UTF-8'); - } } diff --git a/src/Executor/Exception.php b/src/Executor/Exception.php index db40b4b745..845cc8e00c 100644 --- a/src/Executor/Exception.php +++ b/src/Executor/Exception.php @@ -5,7 +5,6 @@ namespace Executor; class Exception extends \Exception { public const string GENERAL_UNKNOWN = 'general_unknown'; - public const string BUILD_FAILED = 'build_failed'; public function __construct( string $message = '', diff --git a/src/Executor/Exception/Timeout.php b/src/Executor/Exception/Timeout.php index b62d2eeb42..82b8bc030c 100644 --- a/src/Executor/Exception/Timeout.php +++ b/src/Executor/Exception/Timeout.php @@ -3,21 +3,7 @@ namespace Executor\Exception; use Executor\Exception; -use Throwable; class Timeout extends Exception { - public function __construct( - string $message, - private readonly int $timeoutSeconds, - int $code = 0, - ?Throwable $previous = null, - ) { - parent::__construct($message, $code, $previous); - } - - public function getTimeoutSeconds(): int - { - return $this->timeoutSeconds; - } } diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 64c50f7ce9..f76535fcab 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -17,13 +17,7 @@ class Executor public const METHOD_GET = 'GET'; public const METHOD_POST = 'POST'; - public const METHOD_PUT = 'PUT'; - public const METHOD_PATCH = 'PATCH'; public const METHOD_DELETE = 'DELETE'; - public const METHOD_HEAD = 'HEAD'; - public const METHOD_OPTIONS = 'OPTIONS'; - public const METHOD_CONNECT = 'CONNECT'; - public const METHOD_TRACE = 'TRACE'; protected bool $selfSigned = false; @@ -173,32 +167,6 @@ class Executor return $response['body']; } - public function createCommand( - string $deploymentId, - string $projectId, - string $command, - int $timeout - ) { - $runtimeId = "$projectId-$deploymentId-build"; - $route = "/runtimes/$runtimeId/commands"; - - $params = [ - 'command' => $command, - 'timeout' => $timeout - ]; - - $response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout); - - $status = $response['headers']['status-code']; - if ($status >= 400) { - $message = \is_string($response['body']) ? $response['body'] : ($response['body']['message'] ?? ''); - $type = \is_array($response['body']) ? ($response['body']['type'] ?? ExecutorException::GENERAL_UNKNOWN) : ExecutorException::GENERAL_UNKNOWN; - throw new ExecutorException($message, $status, type: $type); - } - - return $response['body']; - } - /** * Call * @@ -324,7 +292,7 @@ class Executor if ($curlError) { if ($curlError == CURLE_OPERATION_TIMEDOUT) { - throw new ExecutorTimeout('Executor request timed out', $timeout); + throw new ExecutorTimeout('Executor request timed out after ' . $timeout . ' seconds'); } throw new ExecutorException($curlErrorMessage . ' with status code ' . $responseStatus, $responseStatus); } diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 6965a87d73..44d290e07f 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -14,8 +14,6 @@ class Client public const METHOD_DELETE = 'DELETE'; public const METHOD_HEAD = 'HEAD'; public const METHOD_OPTIONS = 'OPTIONS'; - public const METHOD_CONNECT = 'CONNECT'; - public const METHOD_TRACE = 'TRACE'; /** * Is Self Signed Certificates Allowed? @@ -48,66 +46,6 @@ class Client { } - /** - * Set Project - * - * Your Appwrite project ID. You can find your project ID in your Appwrite console project settings. - * - * @param string $value - * - * @return self $this - */ - public function setProject(string $value): self - { - $this->addHeader('X-Appwrite-Project', $value); - - return $this; - } - - /** - * Set Key - * - * Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard. - * - * @param string $value - * - * @return self $this - */ - public function setKey(string $value): self - { - $this->addHeader('X-Appwrite-Key', $value); - - return $this; - } - - /** - * Set Locale - * - * @param string $value - * - * @return self $this - */ - public function setLocale(string $value): self - { - $this->addHeader('X-Appwrite-Locale', $value); - - return $this; - } - - /** - * Set Mode - * - * @param string $value - * - * @return self $this - */ - public function setMode(string $value): self - { - $this->addHeader('X-Appwrite-Mode', $value); - - return $this; - } - /** * Set Response Format * @@ -122,17 +60,6 @@ class Client return $this; } - /** - * @param bool $status true - * @return self $this - */ - public function setSelfSigned(bool $status = true): self - { - $this->selfSigned = $status; - - return $this; - } - /** * @param string $endpoint * @return self $this diff --git a/tests/e2e/Scopes/ApiDocumentsDB.php b/tests/e2e/Scopes/ApiDocumentsDB.php index 9948b03971..d44e988f37 100644 --- a/tests/e2e/Scopes/ApiDocumentsDB.php +++ b/tests/e2e/Scopes/ApiDocumentsDB.php @@ -92,11 +92,6 @@ trait ApiDocumentsDB { return false; } - - protected function getSupportForIntegerIds(): bool - { - return false; - } protected function getSupportForOperators(): bool { return false; diff --git a/tests/e2e/Scopes/SchemaPolling.php b/tests/e2e/Scopes/SchemaPolling.php index 867ff3213b..d5bcb555f1 100644 --- a/tests/e2e/Scopes/SchemaPolling.php +++ b/tests/e2e/Scopes/SchemaPolling.php @@ -47,92 +47,6 @@ trait SchemaPolling }, $timeoutMs, $waitMs); } - /** - * Wait for multiple attributes to become available. - * - * @param string $databaseId The database ID - * @param string $containerId The collection/table ID - * @param array $attributeKeys Array of attribute keys to wait for - * @param int $timeoutMs Maximum time to wait in milliseconds - * @param int $waitMs Time between polling attempts in milliseconds - */ - protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 240000, int $waitMs = 500): void - { - $this->assertEventually(function () use ($databaseId, $containerId, $attributeKeys) { - $container = $this->client->call( - Client::METHOD_GET, - $this->getContainerUrl($databaseId, $containerId), - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]) - ); - - $this->assertEquals(200, $container['headers']['status-code']); - $this->assertArrayHasKey('body', $container); - $this->assertArrayHasKey($this->getSchemaResource(), $container['body']); - - $attributes = $container['body'][$this->getSchemaResource()]; - $availableKeys = []; - - foreach ($attributes as $attr) { - if ($attr['status'] === 'failed') { - throw new Critical("Attribute '{$attr['key']}' failed: " . ($attr['error'] ?? 'unknown error')); - } - if ($attr['status'] === 'available') { - $availableKeys[] = $attr['key']; - } - } - - foreach ($attributeKeys as $key) { - $this->assertContains($key, $availableKeys, "Attribute '$key' is not available yet"); - } - }, $timeoutMs, $waitMs); - } - - /** - * Wait for the collection/table to have at least a certain number of available attributes. - * - * @param string $databaseId The database ID - * @param string $containerId The collection/table ID - * @param int $count Minimum number of available attributes required - * @param int $timeoutMs Maximum time to wait in milliseconds - * @param int $waitMs Time between polling attempts in milliseconds - */ - protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 240000, int $waitMs = 500): void - { - $this->assertEventually(function () use ($databaseId, $containerId, $count) { - $container = $this->client->call( - Client::METHOD_GET, - $this->getContainerUrl($databaseId, $containerId), - array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]) - ); - - $this->assertEquals(200, $container['headers']['status-code']); - $this->assertArrayHasKey('body', $container); - $this->assertArrayHasKey($this->getSchemaResource(), $container['body']); - - $attributes = $container['body'][$this->getSchemaResource()]; - $availableCount = 0; - - foreach ($attributes as $attr) { - if ($attr['status'] === 'failed') { - throw new Critical("Attribute '{$attr['key']}' failed: " . ($attr['error'] ?? 'unknown error')); - } - if ($attr['status'] === 'available') { - $availableCount++; - } - } - - $this->assertGreaterThanOrEqual($count, $availableCount, "Expected at least $count available attributes, got $availableCount"); - }, $timeoutMs, $waitMs); - } - /** * Wait for an index to become available. * diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 503a2c0273..2cd11b2cf5 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -130,22 +130,6 @@ abstract class Scope extends TestCase return $this->getConsoleVariables()['supportForMultipleFulltextIndexes'] ?? true; } - /** - * Check if the database adapter supports resizing attributes - */ - protected function getSupportForAttributeResizing(): bool - { - return $this->getConsoleVariables()['supportForAttributeResizing'] ?? true; - } - - /** - * Check if the database adapter supports fixed schemas with row width limits - */ - protected function getSupportForSchemas(): bool - { - return $this->getConsoleVariables()['supportForSchemas'] ?? true; - } - /** * Check if the database adapter supports attributes */ @@ -162,14 +146,6 @@ abstract class Scope extends TestCase return $this->getConsoleVariables()['maxIndexLength'] ?? 767; } - /** - * Check if the database adapter uses integer sequence IDs - */ - protected function getSupportForIntegerIds(): bool - { - return $this->getConsoleVariables()['supportForIntegerIds'] ?? true; - } - protected function getLastEmail(int $limit = 1, ?callable $probe = null): array { $result = []; @@ -274,24 +250,6 @@ abstract class Scope extends TestCase return []; } - protected function assertLastRequest(callable $probe, string $type, $timeoutMs = 20_000, $waitMs = 500): array - { - $hostname = match ($type) { - 'webhook' => 'request-catcher-webhook', - 'sms' => 'request-catcher-sms', - default => throw new \Exception('Invalid request catcher type.'), - }; - - $this->assertEventually(function () use (&$request, $probe, $hostname) { - $request = json_decode(file_get_contents('http://' . $hostname . ':5000/__last_request__'), true); - $request['data'] = json_decode($request['data'], true); - - call_user_func($probe, $request); - }, $timeoutMs, $waitMs); - - return $request; - } - protected function assertSamePixels(string $expectedImagePath, string $actualImageBlob): void { $expected = new \Imagick($expectedImagePath); diff --git a/tests/e2e/Scopes/SideNone.php b/tests/e2e/Scopes/SideNone.php index 79c52afe00..8675d44fe0 100644 --- a/tests/e2e/Scopes/SideNone.php +++ b/tests/e2e/Scopes/SideNone.php @@ -8,12 +8,4 @@ trait SideNone { return []; } - - /** - * @return string - */ - public function getSide() - { - return 'none'; - } } diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 4a55680e31..b5270afc69 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -195,46 +195,6 @@ trait FunctionsBase return $variable; } - protected function getVariable(string $functionId, string $variableId): mixed - { - $variable = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - return $variable; - } - - protected function updateVariable(string $functionId, string $variableId, mixed $params): mixed - { - $variable = $this->client->call(Client::METHOD_PUT, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), $params); - - return $variable; - } - - protected function listVariables(string $functionId, mixed $params = []): mixed - { - $variables = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/variables', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), $params); - - return $variables; - } - - protected function deleteVariable(string $functionId, string $variableId): mixed - { - $variable = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - return $variable; - } - protected function getFunction(string $functionId): mixed { $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, array_merge([ @@ -255,16 +215,6 @@ trait FunctionsBase return $deployment; } - protected function getExecution(string $functionId, $executionId): mixed - { - $execution = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - return $execution; - } - protected function listFunctions(mixed $params = []): mixed { $functions = $this->client->call(Client::METHOD_GET, '/functions', array_merge([ @@ -285,16 +235,6 @@ trait FunctionsBase return $deployments; } - protected function listExecutions(string $functionId, mixed $params = []): mixed - { - $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), $params); - - return $executions; - } - protected function packageFunction(string $function): CURLFile { $folderPath = realpath(__DIR__ . '/../../../resources/functions') . "/$function"; @@ -447,27 +387,6 @@ trait FunctionsBase return $response; } - protected function setupDuplicateDeployment(string $functionId, string $deploymentId): string - { - $deployment = $this->createDuplicateDeployment($functionId, $deploymentId); - $this->assertEquals(202, $deployment['headers']['status-code']); - - $deploymentId = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($functionId, $deploymentId) { - $deployment = $this->getDeployment($functionId, $deploymentId); - $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $this->assertEventually(function () use ($functionId, $deploymentId) { - $function = $this->getFunction($functionId); - $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - return $deploymentId; - } - protected function createDuplicateDeployment(string $functionId, string $deploymentId): mixed { $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments/duplicate', array_merge([ diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 09d978fab4..553521c0db 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -46,9 +46,6 @@ trait Base public const string CREATE_IP_ATTRIBUTE = 'create_ip_attribute'; public const string CREATE_ENUM_ATTRIBUTE = 'create_enum_attribute'; public const string CREATE_DATETIME_ATTRIBUTE = 'create_datetime_attribute'; - public const string CREATE_POINT_ATTRIBUTE = 'create_point_attribute'; - public const string CREATE_LINE_ATTRIBUTE = 'create_line_attribute'; - public const string CREATE_POLYGON_ATTRIBUTE = 'create_polygon_attribute'; public const string CREATE_RELATIONSHIP_ATTRIBUTE = 'create_relationship_attribute'; public const string UPDATE_STRING_ATTRIBUTE = 'update_string_attribute'; @@ -60,9 +57,6 @@ trait Base public const string UPDATE_IP_ATTRIBUTE = 'update_ip_attribute'; public const string UPDATE_ENUM_ATTRIBUTE = 'update_enum_attribute'; public const string UPDATE_DATETIME_ATTRIBUTE = 'update_datetime_attribute'; - public const string UPDATE_POINT_ATTRIBUTE = 'update_point_attribute'; - public const string UPDATE_LINE_ATTRIBUTE = 'update_line_attribute'; - public const string UPDATE_POLYGON_ATTRIBUTE = 'update_polygon_attribute'; public const string UPDATE_RELATIONSHIP_ATTRIBUTE = 'update_relationship_attribute'; public const string GET_ATTRIBUTES = 'get_attributes'; diff --git a/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php b/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php index 12910be6c0..ed93f425f5 100644 --- a/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php +++ b/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php @@ -651,42 +651,6 @@ final class DatabaseServerTest extends Scope return self::$cachedRelationshipColumnData[$cacheKey]; } - protected function setupUpdatedRelationshipColumn(): array - { - $data = $this->setupRelationshipColumn(); - $projectId = $this->getProject()['$id']; - - $databaseId = $data['database']['_id']; - $tableId = $data['table2']['_id']; - - $this->assertEventually(function () use ($databaseId, $tableId) { - $response = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/actors', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ])); - $this->assertEquals('available', $response['body']['status']); - }, 240000, 500); - - $query = $this->getQuery(self::UPDATE_RELATIONSHIP_COLUMN); - $gqlPayload = [ - 'query' => $query, - 'variables' => [ - 'databaseId' => $databaseId, - 'tableId' => $tableId, - 'key' => 'actors', - 'onDelete' => Database::RELATION_MUTATE_CASCADE, - ] - ]; - - $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $gqlPayload); - - return $data; - } - protected function setupIPColumn(): array { $cacheKey = $this->getProject()['$id'] ?? 'default'; @@ -717,43 +681,6 @@ final class DatabaseServerTest extends Scope return self::$cachedIPColumnData[$cacheKey]; } - protected function setupUpdatedIPColumn(): array - { - $data = $this->setupIPColumn(); - $projectId = $this->getProject()['$id']; - - $databaseId = $data['database']['_id']; - $tableId = $data['table']['_id']; - - $this->assertEventually(function () use ($databaseId, $tableId) { - $response = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/ip', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ])); - $this->assertEquals('available', $response['body']['status']); - }, 240000, 500); - - $query = $this->getQuery(self::UPDATE_IP_COLUMN); - $gqlPayload = [ - 'query' => $query, - 'variables' => [ - 'databaseId' => $databaseId, - 'tableId' => $tableId, - 'key' => 'ip', - 'required' => false, - 'default' => '127.0.0.1' - ] - ]; - - $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $gqlPayload); - - return $data; - } - protected function setupURLColumn(): array { $cacheKey = $this->getProject()['$id'] ?? 'default'; @@ -784,43 +711,6 @@ final class DatabaseServerTest extends Scope return self::$cachedURLColumnData[$cacheKey]; } - protected function setupUpdatedURLColumn(): array - { - $data = $this->setupURLColumn(); - $projectId = $this->getProject()['$id']; - - $databaseId = $data['database']['_id']; - $tableId = $data['table']['_id']; - - $this->assertEventually(function () use ($databaseId, $tableId) { - $response = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/url', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ])); - $this->assertEquals('available', $response['body']['status']); - }, 240000, 500); - - $query = $this->getQuery(self::UPDATE_URL_COLUMN); - $gqlPayload = [ - 'query' => $query, - 'variables' => [ - 'databaseId' => $databaseId, - 'tableId' => $tableId, - 'key' => 'url', - 'required' => false, - 'default' => 'https://cloud.appwrite.io' - ] - ]; - - $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $gqlPayload); - - return $data; - } - protected function setupIndex(): array { $cacheKey = $this->getProject()['$id'] ?? 'default'; diff --git a/tests/e2e/Services/Realtime/RealtimeQueryBase.php b/tests/e2e/Services/Realtime/RealtimeQueryBase.php index 233103b963..3be30f1e63 100644 --- a/tests/e2e/Services/Realtime/RealtimeQueryBase.php +++ b/tests/e2e/Services/Realtime/RealtimeQueryBase.php @@ -19,11 +19,6 @@ trait RealtimeQueryBase use ProjectCustom; use SideClient; - protected function supportForCheckConnectionStatus(): bool - { - return false; - } - private function assertConnectionStatusIfSupported($client): ?array { if (!$this->supportForCheckConnectionStatus()) { diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 00cc0a6cc6..ddb6c3a753 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -210,16 +210,6 @@ trait SitesBase return $deployment; } - protected function getLog(string $siteId, $logId): mixed - { - $log = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/logs/' . $logId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - return $log; - } - protected function listSites(mixed $params = []): mixed { $sites = $this->client->call(Client::METHOD_GET, '/sites', array_merge([ @@ -240,18 +230,6 @@ trait SitesBase return $deployments; } - protected function listLogs(string $siteId, array $queries = []): mixed - { - $logs = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => $queries - ]); - - return $logs; - } - protected function packageSite(string $site): CURLFile { $folderPath = realpath(__DIR__ . '/../../../resources/sites') . "/$site"; @@ -286,27 +264,6 @@ trait SitesBase return $deployment; } - protected function setupDuplicateDeployment(string $siteId, string $deploymentId): string - { - $deployment = $this->createDuplicateDeployment($siteId, $deploymentId); - $this->assertEquals(202, $deployment['headers']['status-code']); - - $deploymentId = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 120000, 500); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $site = $this->getSite($siteId); - $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 60000, 500); - - return $deploymentId; - } - protected function createDuplicateDeployment(string $siteId, string $deploymentId): mixed { $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ @@ -339,35 +296,6 @@ trait SitesBase return $template; } - protected function helperGetLatestCommit(string $owner, string $repository): ?string - { - $maxRetries = 3; - for ($attempt = 0; $attempt < $maxRetries; $attempt++) { - if ($attempt > 0) { - sleep(2); - } - - $ch = curl_init("https://api.github.com/repos/{$owner}/{$repository}/commits/main"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'User-Agent: Appwrite', - 'Accept: application/vnd.github.v3+json' - ]); - - $response = curl_exec($ch); - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - if ($httpCode === 200) { - $commitData = json_decode($response, true); - if (isset($commitData['sha'])) { - return $commitData['sha']; - } - } - } - - return null; - } - protected function deleteSite(string $siteId): mixed { $site = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ diff --git a/tests/extensions/RetrySubscriber.php b/tests/extensions/RetrySubscriber.php index ff09b187d4..a3f9703d13 100644 --- a/tests/extensions/RetrySubscriber.php +++ b/tests/extensions/RetrySubscriber.php @@ -84,12 +84,4 @@ class RetrySubscriber implements FailedSubscriber return 0; } } - - /** - * Reset retry counts between test runs (useful for testing) - */ - public static function reset(): void - { - self::$retryCounts = []; - } } diff --git a/tests/extensions/Retryable.php b/tests/extensions/Retryable.php index 959c08d8f3..7830f2aef7 100644 --- a/tests/extensions/Retryable.php +++ b/tests/extensions/Retryable.php @@ -12,26 +12,4 @@ namespace Appwrite\Tests; */ trait Retryable { - /** - * Get the number of retries configured for the current test method. - * - * @return int - * @throws \ReflectionException - */ - public function getNumberOfRetries(): int - { - $root = new \ReflectionClass($this); - $name = $this->name(); - - if (!$root->hasMethod($name)) { - return 0; - } - - $method = $root->getMethod($name); - $attributes = $method->getAttributes(Retry::class); - $attribute = $attributes[0] ?? null; - $args = $attribute?->getArguments(); - $retries = $args['count'] ?? $args[0] ?? 0; - return \max(0, $retries); - } } diff --git a/tests/unit/Utopia/Response/Filters/V17Test.php b/tests/unit/Utopia/Response/Filters/V17Test.php index ffc4bcdf14..e6b62d5c76 100644 --- a/tests/unit/Utopia/Response/Filters/V17Test.php +++ b/tests/unit/Utopia/Response/Filters/V17Test.php @@ -146,19 +146,4 @@ final class V17Test extends TestCase $this->assertEquals($expected, $result); } - - public static function webhookProvider(): array - { - return [ - 'remove webhook additions' => [ - [ - 'enabled' => true, - 'logs' => ['test', 'test'], - 'attempts' => 1 - ], - [ - ], - ], - ]; - } }